%top { #include "grammar.h" } %{ //typedef struct _rented_coder rented_coder; //#include "d2c-d2c_gram.h" #include #include #include "manual.h" %} %option noyywrap %option nounput //%option noinput %option yylineno %option stack %option noyy_top_state //%option reentrant //%option bison-bridge /* %option bison-bridge */ /* %option bison-locations */ /* %option ecs */ /* %option nodefault */ /* %option noyywrap */ /* %option reentrant */ %x comments %x ins_name try_details ins_details %x encoding encoding_type encoding_content %x encoding_bits encoding_bits_size %x raw_line %% [ \t\n]+ { } "/*" { BEGIN(comments); } "*/" { BEGIN(INITIAL); } [^*\n] { } "Copyright"[^\n]* { yylvalp->string = strdup(yytext); return COPYRIGHT; } "*" { } "\n" { } "@title" { BEGIN(ins_name); return TITLE; } [ ][A-Za-z-]+ { yylvalp->string = strdup(yytext + 1); BEGIN(try_details); return INS_NAME; } [ ,/] { BEGIN(ins_details); } [\n] { BEGIN(INITIAL); } [^\n]* { yylvalp->cstring = yytext; return INS_DETAILS; } [\n] { BEGIN(INITIAL); } "@encoding" { BEGIN(encoding); return ENCODING; } [ ] { } "(" { BEGIN(encoding_type); } [A-Za-z] { yylvalp->string = strdup(yytext); return TYPE; } [0-9]+ { yylvalp->integer = atoi(yytext); return NUMBER; } ")" { BEGIN(encoding); } "{" { BEGIN(encoding_content); } [ \t\n]+ { } "}" { BEGIN(INITIAL); } "@half " { yy_push_state(raw_line); return HALF; } "@word " { yy_push_state(raw_line); return WORD; } [^\n]+ { yylvalp->cstring = yytext; return RAW_LINE; } "\n" { yy_pop_state(); } "@syntax " { yy_push_state(raw_line); return SYNTAX; } "@conv" { return CONV; } "{" { read_block(temp); yylvalp->cstring = temp; return RAW_BLOCK; } "@hooks" { return HOOKS; } "@rules" { return RULES; } %%