diff -r 000000000000 -r feede61efa96 paper/atccl.lex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/paper/atccl.lex Fri Jun 04 13:48:28 2010 +0200 @@ -0,0 +1,79 @@ +%{ +#include +#include +#include "atccl_parser.tab.h" + +int line_no = 1; +char line_buffer[1024]; +char* installId(); + +%} + +%option nounput + +delim [ \t] +ws {delim}+ +letter [A-Za-z] +digit [0-9] +id {letter}({letter}|{digit}|_)* +real {digit}+\.{digit}+ + +%% + +copx { return COPX; } +adep { return ADEP; } +ades { return ADES; } +rwy { return RWY; } +route { return ROUTE; } +atyp { return ATYP; } +equip { return EQUIP; } +tas { return TAS; } +frul { return FRUL; } +ftyp { return FTYP; } +travel_type { return TRAVEL_TYPE; } +time_separation { return TIMESEP; } +time_sep { return TIMESEP; } +fl { return FL; } +constraint { return CONSTRNT; } +pattern { return PATTERN; } +flowpoint { return FLOWP; } + + +is { return IS; } +in { return IN; } +not { return NOT; } +less { return LESS; } +greater { return GREATER; } +than { return THAN; } +and { return AND; } +or { return OR; } +at { return AT; } +from { return FROM; } +until { return UNTIL; } +on { return ON; } + +{digit}+ { yylval.integer = atoi(yytext); return INTEGER; } +{real} { yylval.real = atof(yytext); return REAL; } +{id} { yylval.string = installId(); return STRING; } +\" { return QUOTE; } +#.*$ { return COM; } +{ws} { } +\n.* { strcpy(line_buffer, yytext+1); line_no++; yyless(1); } +. { return yytext[0]; } +%% + +char* installId() +{ + static char* no_string = "$$$NO STRING$$$"; + char* id = no_string; + if (id_table_no < MAX_ID_TABLE_NO) + { + id = strdup(yytext); + id_table[id_table_no++] = id; + } + else + { + yyerror("Maximum number of string literals used"); + } + return id; +}