diff options
Diffstat (limited to 'aidl_language_l.l')
-rw-r--r-- | aidl_language_l.l | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/aidl_language_l.l b/aidl_language_l.l index cba2165..cd349ec 100644 --- a/aidl_language_l.l +++ b/aidl_language_l.l @@ -8,7 +8,7 @@ // comment and whitespace handling // these functions save a copy of the buffer -static void begin_extra_text(unsigned lineno, which_extra_text which); +static void begin_extra_text(which_extra_text which); static void append_extra_text(char* text); static extra_text_type* get_extra_text(void); // you now own the object // this returns @@ -18,7 +18,6 @@ using android::aidl::cpp_strdup; #define RETURN_BUFFER(t) \ do { \ - yylval->buffer.lineno = yyget_lineno(yyscanner); \ yylval->buffer.token = (t); \ yylval->buffer.data = cpp_strdup(yytext); \ yylval->buffer.extra = get_extra_text(); \ @@ -47,21 +46,20 @@ idvalue (0|[1-9][0-9]*) %} -\%\%\{ { begin_extra_text(yylineno, COPY_TEXT); +\%\%\{ { begin_extra_text(COPY_TEXT); BEGIN(COPYING); } <COPYING>\}\%\% { yylloc->step(); BEGIN(INITIAL); } <COPYING>.* { append_extra_text(yytext); } <COPYING>\n+ { yylloc->lines(yyleng); append_extra_text(yytext); } -\/\* { begin_extra_text(yylineno, - (which_extra_text)LONG_COMMENT); +\/\* { begin_extra_text((which_extra_text)LONG_COMMENT); BEGIN(LONG_COMMENT); } <LONG_COMMENT>\n+ { yylloc->lines(yyleng); append_extra_text(yytext); } <LONG_COMMENT>[^*]* { append_extra_text(yytext); } <LONG_COMMENT>\*+[^/] { append_extra_text(yytext); } <LONG_COMMENT>\*+\/ { yylloc->step(); BEGIN(INITIAL); } -\/\/.*\n { begin_extra_text(yylineno, SHORT_COMMENT); +\/\/.*\n { begin_extra_text(SHORT_COMMENT); append_extra_text(yytext); yylloc->lines(1); yylloc->step(); } @@ -71,8 +69,7 @@ idvalue (0|[1-9][0-9]*) <<EOF>> { yyterminate(); } /* symbols */ -; { RETURN_BUFFER(';'); } - +; { return ';'; } \{ { return '{'; } \} { return '}'; } = { return '='; } @@ -86,10 +83,10 @@ idvalue (0|[1-9][0-9]*) \> { return '>'; } /* keywords */ -parcelable { RETURN_BUFFER(yy::parser::token::PARCELABLE); } interface { RETURN_BUFFER(yy::parser::token::INTERFACE); } oneway { RETURN_BUFFER(yy::parser::token::ONEWAY); } +parcelable { return yy::parser::token::PARCELABLE; } import { return yy::parser::token::IMPORT; } package { return yy::parser::token::PACKAGE; } in { return yy::parser::token::IN; } @@ -102,7 +99,6 @@ inout { return yy::parser::token::INOUT; } /* syntax error! */ . { printf("UNKNOWN(%s)", yytext); - yylval->buffer.lineno = yylineno; yylval->buffer.token = yy::parser::token::IDENTIFIER; yylval->buffer.data = cpp_strdup(yytext); return yy::parser::token::IDENTIFIER; @@ -115,10 +111,9 @@ inout { return yy::parser::token::INOUT; } extra_text_type* g_extraText = NULL; extra_text_type* g_nextExtraText = NULL; -void begin_extra_text(unsigned lineno, which_extra_text which) +void begin_extra_text(which_extra_text which) { extra_text_type* text = new extra_text_type(); - text->lineno = lineno; text->which = which; text->data = NULL; text->len = 0; |