diff options
Diffstat (limited to 'src/build.l')
| -rw-r--r-- | src/build.l | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/build.l b/src/build.l index 8189f9d..aab7de1 100644 --- a/src/build.l +++ b/src/build.l | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | std::string strbuf; | 7 | std::string strbuf; |
| 8 | %} | 8 | %} |
| 9 | 9 | ||
| 10 | %x regexp | ||
| 11 | %x strsq | 10 | %x strsq |
| 12 | %x strdq | 11 | %x strdq |
| 13 | %x comment | 12 | %x comment |
| @@ -33,6 +32,8 @@ std::string strbuf; | |||
| 33 | "clean" return TOK_CLEAN; | 32 | "clean" return TOK_CLEAN; |
| 34 | "target" return TOK_TARGET; | 33 | "target" return TOK_TARGET; |
| 35 | "input" return TOK_INPUT; | 34 | "input" return TOK_INPUT; |
| 35 | "filter" return TOK_FILTER; | ||
| 36 | "prefix" return TOK_PREFIX; | ||
| 36 | 37 | ||
| 37 | \n+ { | 38 | \n+ { |
| 38 | yylloc->last_line += yyleng; | 39 | yylloc->last_line += yyleng; |
| @@ -45,19 +46,6 @@ std::string strbuf; | |||
| 45 | yylloc->first_column = yylloc->last_column+1; | 46 | yylloc->first_column = yylloc->last_column+1; |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | "/" { | ||
| 49 | BEGIN( regexp ); | ||
| 50 | strbuf = ""; | ||
| 51 | } | ||
| 52 | <regexp>[^\n/\\]* strbuf += yytext; | ||
| 53 | <regexp>"\\/" strbuf += "/"; | ||
| 54 | <regexp>"\\" strbuf += "\\"; | ||
| 55 | <regexp>"/" { | ||
| 56 | BEGIN( INITIAL ); | ||
| 57 | yylval->strval = stringdup( strbuf.c_str() ); | ||
| 58 | return REGEXP; | ||
| 59 | } | ||
| 60 | |||
| 61 | "#".* /* single line comment */ | 49 | "#".* /* single line comment */ |
| 62 | 50 | ||
| 63 | [a-zA-Z][a-zA-Z0-9]* { | 51 | [a-zA-Z][a-zA-Z0-9]* { |
| @@ -67,6 +55,11 @@ std::string strbuf; | |||
| 67 | { | 55 | { |
| 68 | return TARGETTYPE; | 56 | return TARGETTYPE; |
| 69 | } | 57 | } |
| 58 | else if( bld.isPerform( yytext ) ) | ||
| 59 | { | ||
| 60 | yylval->strval = stringdup( yytext ); | ||
| 61 | return PERFORM; | ||
| 62 | } | ||
| 70 | else if( bld.isFunction( yytext ) ) | 63 | else if( bld.isFunction( yytext ) ) |
| 71 | { | 64 | { |
| 72 | yylval->strval = stringdup( yytext ); | 65 | yylval->strval = stringdup( yytext ); |
| @@ -76,11 +69,6 @@ std::string strbuf; | |||
| 76 | } | 69 | } |
| 77 | } | 70 | } |
| 78 | 71 | ||
| 79 | [^ \t\r\n\'\":=,/][^ \t\r\n\'\"=,]+[^ \t\r\n\'\":=,] { | ||
| 80 | yylval->strval = stringdup( yytext ); | ||
| 81 | return STRING; | ||
| 82 | } | ||
| 83 | |||
| 84 | \" { | 72 | \" { |
| 85 | BEGIN( strdq ); | 73 | BEGIN( strdq ); |
| 86 | strbuf = ""; | 74 | strbuf = ""; |
| @@ -103,6 +91,9 @@ std::string strbuf; | |||
| 103 | <strdq,strsq>\\r strbuf += "\r"; | 91 | <strdq,strsq>\\r strbuf += "\r"; |
| 104 | <strdq,strsq>\\b strbuf += "\b"; | 92 | <strdq,strsq>\\b strbuf += "\b"; |
| 105 | <strdq,strsq>\\f strbuf += "\f"; | 93 | <strdq,strsq>\\f strbuf += "\f"; |
| 94 | <strdq,strsq>\\\\ strbuf += "\\"; | ||
| 95 | <strdq,strsq>\\\" strbuf += "\""; | ||
| 96 | <strdq,strsq>\\\' strbuf += "\'"; | ||
| 106 | 97 | ||
| 107 | <strdq>\" { | 98 | <strdq>\" { |
| 108 | BEGIN( INITIAL ); | 99 | BEGIN( INITIAL ); |
| @@ -117,7 +108,9 @@ std::string strbuf; | |||
| 117 | } | 108 | } |
| 118 | 109 | ||
| 119 | . { | 110 | . { |
| 120 | bld.error( yylloc, "Invalid character found!" ); | 111 | char buf[] = {"Character x is out of place"}; |
| 112 | buf[10] = yytext[0]; | ||
| 113 | bld.error( yylloc, "Character !" ); | ||
| 121 | } | 114 | } |
| 122 | 115 | ||
| 123 | %% | 116 | %% |
