diff options
Diffstat (limited to '')
| -rw-r--r-- | src/build.l | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/build.l b/src/build.l index 6a80f45..3a457b1 100644 --- a/src/build.l +++ b/src/build.l | |||
| @@ -7,13 +7,14 @@ | |||
| 7 | std::string strbuf; | 7 | std::string strbuf; |
| 8 | %} | 8 | %} |
| 9 | 9 | ||
| 10 | %x regexp | ||
| 10 | %x strsq | 11 | %x strsq |
| 11 | %x strdq | 12 | %x strdq |
| 12 | %x comment | 13 | %x comment |
| 13 | %option noyywrap nounput batch debug | 14 | %option noyywrap nounput batch debug |
| 14 | 15 | ||
| 15 | %{ | 16 | %{ |
| 16 | # define YY_USER_ACTION yylloc->columns (yyleng); | 17 | //# define YY_USER_ACTION yylloc->columns (yyleng); |
| 17 | %} | 18 | %} |
| 18 | %% | 19 | %% |
| 19 | 20 | ||
| @@ -38,16 +39,27 @@ std::string strbuf; | |||
| 38 | "perform" return TOK_PERFORM; | 39 | "perform" return TOK_PERFORM; |
| 39 | "produces" return TOK_PRODUCES; | 40 | "produces" return TOK_PRODUCES; |
| 40 | "command" return TOK_COMMAND; | 41 | "command" return TOK_COMMAND; |
| 42 | "check" return TOK_CHECK; | ||
| 41 | 43 | ||
| 42 | "..."\n /* elipsis line continuation */ | 44 | "..."\n /* elipsis line continuation */ |
| 43 | \n+ return TOX_EOL; | 45 | \n+ return TOK_EOL; |
| 44 | [ \t\r]* /* whitespace */ | 46 | [ \t\r]* /* whitespace */ |
| 45 | 47 | ||
| 46 | \/\/.* /* single line comment */ | 48 | "/" { |
| 49 | BEGIN( regexp ); | ||
| 50 | strbuf = ""; | ||
| 51 | } | ||
| 52 | <regexp>[^\n/]* strbuf += yytext; | ||
| 53 | <regexp>"/" { | ||
| 54 | BEGIN( INITIAL ); | ||
| 55 | yylval->strval = stringdup( strbuf.c_str() ); | ||
| 56 | return REGEXP; | ||
| 57 | } | ||
| 58 | |||
| 47 | "#".* /* single line comment */ | 59 | "#".* /* single line comment */ |
| 48 | 60 | ||
| 49 | [^ \t\r\n\'\"]+ { | 61 | [^ \t\r\n\'\":=,.]+ { |
| 50 | yylval.strval = stringdup( yytext ); | 62 | yylval->strval = stringdup( yytext ); |
| 51 | return STRING; | 63 | return STRING; |
| 52 | } | 64 | } |
| 53 | 65 | ||
| @@ -86,11 +98,13 @@ std::string strbuf; | |||
| 86 | return STRING; | 98 | return STRING; |
| 87 | } | 99 | } |
| 88 | 100 | ||
| 101 | %% | ||
| 89 | 102 | ||
| 90 | void Builder::scanBegin() | 103 | void Builder::scanBegin() |
| 91 | { | 104 | { |
| 105 | yy_flex_debug = false; | ||
| 92 | if( !(yyin = fopen( file.c_str(), "r" )) ) | 106 | if( !(yyin = fopen( file.c_str(), "r" )) ) |
| 93 | error( std::string("cannot open ") + file ); | 107 | fprintf( stderr, "cannot open %s\n", file.c_str() ); |
| 94 | } | 108 | } |
| 95 | 109 | ||
| 96 | void Builder::scanEnd() | 110 | void Builder::scanEnd() |
