X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/320ce7537deb2d6f8a5db078d2d6aab1e1a77f8f..1504c9b837a7561d8ae2c81f1c4d57fe0f138781:/Cycript.l.in?ds=inline diff --git a/Cycript.l.in b/Cycript.l.in index 91e6a63..bdd25ed 100644 --- a/Cycript.l.in +++ b/Cycript.l.in @@ -161,8 +161,11 @@ XMLName {XMLNameStart}{XMLNamePart}* \/{RegularExpressionBody}\/{RegularExpressionFlags} E("") \/\/[^\n]* L -\/\*!(\n|[^\*]|\*[^/])*\*\/ V() C yylval->comment_ = new(yyextra->pool_) CYComment(apr_pstrmemdup(yyextra->pool_, yytext, yyleng)); return tk::Comment; -\/\*(\n|[^\*]|\*[^/])*\*\/ V(N) + + /* http://ostermiller.org/findcomment.html */ + /* XXX: unify these two rules using !? */ +\/\*!([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/ V() C yylval->comment_ = new(yyextra->pool_) CYComment(apr_pstrmemdup(yyextra->pool_, yytext, yyleng)); return tk::Comment; +\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/ V(N) @begin E4X "<>" L return tk::LeftRight; @@ -340,14 +343,14 @@ XMLName {XMLNameStart}{XMLNamePart}* (\.[0-9]+|(0|[1-9][0-9]*)(\.[0-9]*)?){Exponent}? L C yylval->number_ = new(yyextra->pool_) CYNumber(strtod(yytext, NULL)); return tk::NumericLiteral; 0[xX][0-9a-fA-F]+ L C yylval->number_ = new(yyextra->pool_) CYNumber(strtoull(yytext + 2, NULL, 16)); return tk::NumericLiteral; - +0[0-7]+ L C yylval->number_ = new(yyextra->pool_) CYNumber(strtoull(yytext + 1, NULL, 8)); return tk::NumericLiteral; 0[bB][0-1]+ L C yylval->number_ = new(yyextra->pool_) CYNumber(strtoull(yytext + 2, NULL, 2)); return tk::NumericLiteral; \"([^"\\\n]|{Escape})*\"|'([^'\\\n]|{Escape})*' L C { char *value(reinterpret_cast(apr_palloc(yyextra->pool_, yyleng))); char *local(value); - for (int i(1); i != yyleng - 1; ++i) { + for (yy_size_t i(1), e(yyleng - 1); i != e; ++i) { char next(yytext[i]); if (yytext[i] == '\\') @@ -381,7 +384,8 @@ XMLName {XMLNameStart}{XMLNamePart}* \r?\n yylloc->end.lines(); yylloc->step(); N [ \t] L -<> L yyterminate(); + +<> if (yyextra->auto_) { yyextra->auto_ = false; return tk::AutoComplete; } L yyterminate(); . L { CYDriver::Error error;