Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
define isatty() on architectures that lack it
[simgrid.git] / src / xbt / automaton / parserPromela.lex
index f4c9132..04384ea 100644 (file)
@@ -1,10 +1,23 @@
+/* Copyright (c) 2012, 2014. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
 %option noyywrap
 
 %{
 
+#include "simgrid_config.h"
+#ifndef HAVE_UNISTD_H
+#define YY_NO_UNISTD_H /* hello Windows */
+static int isatty(int fd) {
+  return 0;
+}
+#endif
 
 #include <stdio.h>
-#include "y.tab.h"
+#include "parserPromela.tab.hacc"
   
   extern YYSTYPE yylval;
  
@@ -27,51 +40,46 @@ commentaire  "/*"([^\*\/]*{nouv_ligne}*[^\*\/]*)*"*/"
 
 %%
 
-"never"      { printf("%s", yytext); return (NEVER); }
-"if"         { printf("%s", yytext); return (IF); }
-"fi"         { printf("%s", yytext); 
-               return (FI); }
-"->"         { printf("%s", yytext); return (IMPLIES); }
-"goto"       { printf("%s", yytext); return (GOTO); }
-"&&"         { printf("%s", yytext); return (AND); }
-"||"         { printf("%s", yytext); return (OR); }
-"!"          { printf("%s", yytext); return (NOT); }
-"("          { printf("%s", yytext); return (LEFT_PAR); }
-")"          { printf("%s", yytext); return (RIGHT_PAR); }
-"::"         { printf("%s", yytext); return (CASE); }
-":"          { printf("%s", yytext); return (COLON); }
-";"          { printf("%s", yytext); return (SEMI_COLON); }
-"1"          { printf("%s", yytext); return (CASE_TRUE); }
-"{"          { printf("%s", yytext); return (LEFT_BRACE); }
-"}"          { printf("%s", yytext); return (RIGHT_BRACE); }
+"never"      { return (NEVER); }
+"if"         { return (IF); }
+"fi"         { return (FI); }
+"->"         { return (IMPLIES); }
+"goto"       { return (GOTO); }
+"&&"         { return (AND); }
+"||"         { return (OR); }
+"!"          { return (NOT); }
+"("          { return (LEFT_PAR); }
+")"          { return (RIGHT_PAR); }
+"::"         { return (CASE); }
+":"          { return (COLON); }
+";"          { return (SEMI_COLON); }
+"1"          { return (CASE_TRUE); }
+"{"          { return (LEFT_BRACE); }
+"}"          { return (RIGHT_BRACE); }
 
 
-{commentaire}             { printf(" ");}
+{commentaire}             { }
 
-{blancs}                  { printf("%s",yytext); }
+{blancs}                  { }
 
 
-{reel}                    { printf("%s",yytext); 
-                            sscanf(yytext,"%lf",&yylval.real); 
+{reel}                    { sscanf(yytext,"%lf",&yylval.real); 
                             return (LITT_REEL); }
 
-{entier}                  { printf("%s",yytext); 
-                            sscanf(yytext,"%d",&yylval.integer); 
+{entier}                  { sscanf(yytext,"%d",&yylval.integer); 
                             return (LITT_ENT); }
 
-{chaine}                  { printf("%s",yytext);  
-                            yylval.string=(char *)malloc(strlen(yytext)+1);
+{chaine}                  { yylval.string=(char *)malloc(strlen(yytext)+1);
                             sscanf(yytext,"%s",yylval.string); 
                             return (LITT_CHAINE); }
 
-[a-zA-Z]{caractere}*      { printf("%s",yytext); 
-                           yylval.string=(char *)malloc(strlen(yytext)+1);
-                           sscanf(yytext,"%s",yylval.string);
-                           return (ID); }
+[a-zA-Z]{caractere}*      { yylval.string=(char *)malloc(strlen(yytext)+1);
+                            sscanf(yytext,"%s",yylval.string);
+                                             return (ID); }
                   
-{numl}                    { printf("\n"); }
+{numl}                    { }
 
-.                         { printf("caractère inconnu\n"); }
+.                         { }
 
 %%