%{ //**************************************************************** //* * //* Lex.l : Reg. Exp. for the LOGLAN-82 and the LOGLAN-93 * //* languages. * //* * //* (c) LITA, university of PAU (France), summer 1993. * //**************************************************************** #ifdef TOKENS_DEBUG #define TOKENS_ERROR #define TOKENS_DEBUG_printf(a) fprintf(stderr,a) #define TOKENS_DEBUG_printf2(a,b) fprintf(stderr,a,b) #else #define TOKENS_DEBUG_printf(a) #define TOKENS_DEBUG_printf2(a,b) #endif #ifdef TOKENS_ERROR #define TOKENS_ERROR_printf(a) fprintf(stderr,a) #else #define TOKENS_ERROR_printf(a) #endif #ifdef SYNTAX_ONLY #define SEMANTIC(a) #else #define SEMANTIC(a) a #endif #ifndef SYNTAX_ONLY #include #include #include "Objects.h" #include "Expr.h" #include "Instr.h" #endif #include "syntax.h" int line_number=1; #ifndef SYNTAX_ONLY void LexAdvanceCursor( int length ); Location ThisPlace; int BeginningOfLine; #endif %} %x CondComment CondLineComment %x CondString Letter [A-Za-z] IdLetter {Letter}|[_0-9] Digit [0-9] Identifier {Letter}({IdLetter}*) A [Aa] B [Bb] C [Cc] D [Dd] E [Ee] F [Ff] G [Gg] H [Hh] I [Ii] J [Jj] K [Kk] L [Ll] M [Mm] N [Nn] O [Oo] P [Pp] Q [Qq] R [Rr] S [Ss] T [Tt] U [Uu] V [Vv] W [Ww] X [Xx] Y [Yy] Z [Zz] %% {B}{E}{G}{I}{N} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(Begin); } {E}{N}{D} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(END); } {P}{R}{O}{G}{R}{A}{M} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(PROGRAM); } {U}{N}{I}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(UNIT); } {C}{L}{A}{S}{S} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(CLASS); } {P}{R}{O}{C}{E}{D}{U}{R}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(PROCEDURE); } {F}{U}{N}{C}{T}{I}{O}{N} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(FUNCTION); } {C}{O}{R}{O}{U}{T}{I}{N}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(COROUTINE); } {P}{R}{O}{C}{E}{S}{S} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(PROCESS); } {B}{L}{O}{C}{K} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(BLOCK); } {T}{Y}{P}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(TYPE); } {H}{A}{N}{D}{L}{E}{R}{S} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(HANDLERS); } {I}{N}{P}{U}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(INPUT); } {O}{U}{T}{P}{U}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(OUTPUT); } {I}{N}{O}{U}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(INOUT); } {V}{I}{R}{T}{U}{A}{L} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(VIRTUAL); } {W}{H}{E}{N} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(WHEN); } {O}{T}{H}{E}{R}{W}{I}{S}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(OTHERWISE); } {C}{O}{N}{S}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(CONST); } {V}{A}{R} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(VAR); } {S}{I}{G}{N}{A}{L} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(SIGNAL); } {O}{T}{H}{E}{R}{W}{I}{S}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(OTHERWISE); } {I}{N}{T}{E}{G}{E}{R} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(INTEGER); } {R}{E}{A}{L} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(REAL); } {B}{O}{O}{L}{E}{A}{N} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(BOOLEAN); } {C}{H}{A}{R}{A}{C}{T}{E}{R} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(CHARACTER); } {S}{T}{R}{I}{N}{G} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(STRING); } {F}{I}{L}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(File); } {P}{R}{O}{C}{E}{S}{S} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(PROCESS); } {C}{O}{R}{O}{U}{T}{I}{N}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(COROUTINE); } {A}{R}{R}{A}{Y}{O}{F} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(ARRAY_OF); } {N}{O}{N}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(NONE); } {T}{H}{I}{S} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(THIS); } {D}{I}{V} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(DIV); } {M}{O}{D} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(MOD); } {I}{S} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(IS); } {I}{N} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(IN); } {O}{R} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(OR); } {A}{N}{D} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(AND); } {N}{O}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(NOT); } {Q}{U}{A} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(QUA); } {R}{E}{S}{U}{L}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(RESULT); } {N}{E}{W} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(NEW); } {C}{O}{P}{Y} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(COPY); } {A}{T}{T}{A}{C}{H} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(ATTACH); } {D}{E}{T}{A}{C}{H} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(DETACH); } {S}{T}{O}{P} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(STOP); } {R}{E}{S}{U}{M}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(RESUME); } {T}{E}{R}{M}{I}{N}{A}{T}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(TERMINATE); } {P}{U}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(PUT); } {G}{E}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(GET); } {R}{E}{A}{D} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(READ); } {R}{E}{A}{D}{L}{N} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(READLN); } {W}{R}{I}{T}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(WRITE); } {W}{R}{I}{T}{E}{L}{N} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(WRITELN); } {C}{A}{L}{L} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(CALL); } {K}{I}{L}{L} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(KILL); } {E}{X}{I}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(EXIT); } {R}{E}{P}{E}{A}{T} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(REPEAT); } {I}{N}{N}{E}{R} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(INNER); } {W}{I}{N}{D} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(WIND); } {R}{A}{I}{S}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(RAISE); } {A}{R}{R}{A}{Y} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(ARRAY); } {D}{I}{M} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(DIM); } {D}{O} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(DO); } {O}{D} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(OD); } {W}{H}{I}{L}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(WHILE); } {F}{O}{R} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(FOR); } {S}{T}{E}{P} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(STEP); } {T}{O} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(TO); } {D}{O}{W}{N}{T}{O} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(DOWNTO); } {I}{F} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(IF); } {T}{H}{E}{N} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(THEN); } {E}{L}{S}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(ELSE); } {F}{I} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(FI); } {A}{N}{D}{I}{F} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(ANDIF); } {O}{R}{I}{F} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(ORIF); } {C}{A}{S}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(CASE); } {E}{S}{A}{C} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(ESAC); } {P}{R}{E}{F} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(PREF); } {S}{H}{A}{R}{E}{D} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(SHARED); } {E}{N}{U}{M} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(ENUM); } {T}{R}{U}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisBool.Bool = 1 )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(BOOLCONST); } {F}{A}{L}{S}{E} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisBool.Bool = 0 )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(BOOLCONST); } \* { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(STAR); } \/ { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(DIVIDE); } \+ { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(PLUS); } \- { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(MINUS); } \= { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(EQUAL); } ("<>")|("=/=") { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(NEQUAL); } "<" { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(LESS); } ">" { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(GREATER); } (">=")|("=>") { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(GREATEROREQUAL); } ("<=")|("=<") { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(LESSOREQUAL); } \( { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(OPENINGBRACKET); } \) { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(CLOSINGBRACKET); } \, { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(LIST_SEPARATOR); } : { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(VARSEPARATOR); } \; { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(ENDSENTENCE); } \. { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(POINT); } ":=" { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisLoc = new Location( ThisPlace ) )); return(AFFECTATION); } " " { SEMANTIC(( ThisPlace.Tab(1) )); } \n { SEMANTIC(( BeginningOfLine = 1 )); SEMANTIC(( ThisPlace.Cr() )); line_number++; } {Identifier} { TOKENS_DEBUG_printf2("%s.\n",yytext); SEMANTIC(( yylval.ThisString.Str = new String ( yytext ) )); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisString.Loc = new Location( ThisPlace ) )); return(IDENTIFIER); } {Digit}+ { TOKENS_DEBUG_printf("DigitSequence.\n"); SEMANTIC(( yylval.ThisInt.Int = atoi(yytext) )); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisInt.Loc = new Location( ThisPlace ) )); return(DIGITSEQUENCE); } \'.?\' { TOKENS_DEBUG_printf("CharConst.\n"); SEMANTIC(( yylval.ThisChar.Char = yytext[1] )); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisChar.Loc = new Location( ThisPlace ) )); return(CHARCONST); } \'[^\'\n]*\' { TOKENS_ERROR_printf("Error : Multiple Character constant.\n"); SEMANTIC(( yylval.ThisChar.Char = yytext[1] )); SEMANTIC(( LexAdvanceCursor( strlen(yytext) ) )); SEMANTIC(( yylval.ThisChar.Loc = new Location( ThisPlace ) )); return(CHARCONST); } \" { BEGIN(CondString); SEMANTIC(( ThisPlace.Tab( 1 ) )); yymore(); } "(*" { BEGIN(CondComment); SEMANTIC(( ThisPlace.Tab( 2 ) )); yymore(); } . { TOKENS_ERROR_printf("Erreur d'entree.\n"); SEMANTIC(( ThisPlace.Select( 1 ) )); } "//" { BEGIN(CondLineComment); SEMANTIC(( ThisPlace.Tab( 2 ) )); yymore(); } .*\n { BEGIN(INITIAL); SEMANTIC(( ThisPlace.Cr() )); SEMANTIC(( BeginningOfLine = 1 )); line_number++; } \" { TOKENS_DEBUG_printf2("String :%s\n",yytext); BEGIN(INITIAL); SEMANTIC( { yylval.ThisString.Str = new String(yytext); ThisPlace.Select( strlen(yytext) ); yylval.ThisString.Loc = new Location( ThisPlace ); }); return(TEXTCONST); } \\\" { yymore(); } \n { TOKENS_ERROR_printf("Error : Unterminated String.\n"); line_number++; BEGIN(INITIAL); SEMANTIC(( ThisPlace.Cr() )); SEMANTIC(( BeginningOfLine = 1 )); return(TEXTCONST); } . { yymore(); } "(*" { SEMANTIC(( ThisPlace.Tab( 2 ) )); } "*)" { BEGIN(INITIAL); SEMANTIC(( ThisPlace.Select( 2 ) )); } . { SEMANTIC(( ThisPlace.Tab( 1 ) )); } %% #ifndef SYNTAX_ONLY void LexAdvanceCursor( int length ) { if ( !BeginningOfLine ) ThisPlace.Advance(); ThisPlace.Select( length ); BeginningOfLine = 0; ThisPlace; } #endif /* SYNTAX_ONLY */