Loading tools/aidl/aidl_language.cpp +2 −1 Original line number Original line Diff line number Diff line #include "aidl_language.h" #include "aidl_language.h" #include "aidl_language_y.hpp" #include <stdio.h> #include <stdio.h> #include <stdlib.h> #include <stdlib.h> #include <string> #include <string> Loading Loading @@ -74,7 +75,7 @@ bool ParseState::OpenFileFromDisk() { } } int ParseState::RunParser() { int ParseState::RunParser() { int ret = yyparse(this); int ret = yy::parser(this).parse(); free((void *)g_currentPackage); free((void *)g_currentPackage); g_currentPackage = NULL; g_currentPackage = NULL; Loading tools/aidl/aidl_language_l.l +19 −18 Original line number Original line Diff line number Diff line %{ %{ #include "aidl_language.h" #include "aidl_language.h" #include "aidl_language_y.h" #include "aidl_language_y.hpp" #include "search_path.h" #include "search_path.h" #include <string.h> #include <string.h> #include <stdlib.h> #include <stdlib.h> Loading Loading @@ -39,6 +39,7 @@ static void do_package_statement(const char* importText); %option noyywrap %option noyywrap %option reentrant %option reentrant %option bison-bridge %option bison-bridge %option bison-locations %x COPYING LONG_COMMENT %x COPYING LONG_COMMENT Loading @@ -65,13 +66,13 @@ idvalue (0|[1-9][0-9]*) <LONG_COMMENT>\**\/ { BEGIN(INITIAL); } <LONG_COMMENT>\**\/ { BEGIN(INITIAL); } ^{whitespace}?import{whitespace}[^ \t\r\n]+{whitespace}?; { ^{whitespace}?import{whitespace}[^ \t\r\n]+{whitespace}?; { SET_BUFFER(IMPORT); SET_BUFFER(yy::parser::token::IMPORT); return IMPORT; return yy::parser::token::IMPORT; } } ^{whitespace}?package{whitespace}[^ \t\r\n]+{whitespace}?; { ^{whitespace}?package{whitespace}[^ \t\r\n]+{whitespace}?; { do_package_statement(yytext); do_package_statement(yytext); SET_BUFFER(PACKAGE); SET_BUFFER(yy::parser::token::PACKAGE); return PACKAGE; return yy::parser::token::PACKAGE; } } <<EOF>> { yyterminate(); } <<EOF>> { yyterminate(); } Loading @@ -90,25 +91,25 @@ idvalue (0|[1-9][0-9]*) = { SET_BUFFER('='); return '='; } = { SET_BUFFER('='); return '='; } /* keywords */ /* keywords */ parcelable { SET_BUFFER(PARCELABLE); return PARCELABLE; } parcelable { SET_BUFFER(yy::parser::token::PARCELABLE); return yy::parser::token::PARCELABLE; } interface { SET_BUFFER(INTERFACE); return INTERFACE; } interface { SET_BUFFER(yy::parser::token::INTERFACE); return yy::parser::token::INTERFACE; } in { SET_BUFFER(IN); return IN; } in { SET_BUFFER(yy::parser::token::IN); return yy::parser::token::IN; } out { SET_BUFFER(OUT); return OUT; } out { SET_BUFFER(yy::parser::token::OUT); return yy::parser::token::OUT; } inout { SET_BUFFER(INOUT); return INOUT; } inout { SET_BUFFER(yy::parser::token::INOUT); return yy::parser::token::INOUT; } oneway { SET_BUFFER(ONEWAY); return ONEWAY; } oneway { SET_BUFFER(yy::parser::token::ONEWAY); return yy::parser::token::ONEWAY; } {brackets}+ { SET_BUFFER(ARRAY); return ARRAY; } {brackets}+ { SET_BUFFER(yy::parser::token::ARRAY); return yy::parser::token::ARRAY; } {idvalue} { SET_BUFFER(IDVALUE); return IDVALUE; } {idvalue} { SET_BUFFER(yy::parser::token::IDVALUE); return yy::parser::token::IDVALUE; } {identifier} { SET_BUFFER(IDENTIFIER); return IDENTIFIER; } {identifier} { SET_BUFFER(yy::parser::token::IDENTIFIER); return yy::parser::token::IDENTIFIER; } {identifier}\<{whitespace}*{identifier}({whitespace}*,{whitespace}*{identifier})*{whitespace}*\> { {identifier}\<{whitespace}*{identifier}({whitespace}*,{whitespace}*{identifier})*{whitespace}*\> { SET_BUFFER(GENERIC); return GENERIC; } SET_BUFFER(yy::parser::token::GENERIC); return yy::parser::token::GENERIC; } /* syntax error! */ /* syntax error! */ . { printf("UNKNOWN(%s)", yytext); . { printf("UNKNOWN(%s)", yytext); yylval->buffer.lineno = yylineno; yylval->buffer.lineno = yylineno; yylval->buffer.token = IDENTIFIER; yylval->buffer.token = yy::parser::token::IDENTIFIER; yylval->buffer.data = strdup(yytext); yylval->buffer.data = strdup(yytext); return IDENTIFIER; return yy::parser::token::IDENTIFIER; } } %% %% Loading tools/aidl/aidl_language_y.y +10 −8 Original line number Original line Diff line number Diff line %{ %{ #include "aidl_language.h" #include "aidl_language.h" #include "aidl_language_y.hpp" #include <stdio.h> #include <stdio.h> #include <stdlib.h> #include <stdlib.h> #include <string.h> #include <string.h> int yyerror(ParseState* ps, char* errstr) int yylex(lexer_type *, yy::parser::location_type *l, void *); { ps->ReportError(errstr); return 1; } int yylex(lexer_type *, void *); static int count_brackets(const char*); static int count_brackets(const char*); #define YYLEX_PARAM ps->Scanner() #define lex_scanner ps->Scanner() %} %} %parse-param { ParseState* ps } %parse-param { ParseState* ps } %lex-param { void *lex_scanner } %pure-parser %pure-parser %skeleton "glr.cc" %token IMPORT %token IMPORT %token PACKAGE %token PACKAGE Loading Loading @@ -339,3 +336,8 @@ static int count_brackets(const char* s) } } return n; return n; } } void yy::parser::error(const yy::parser::location_type& l, const std::string& errstr) { ps->ReportError(errstr); } Loading
tools/aidl/aidl_language.cpp +2 −1 Original line number Original line Diff line number Diff line #include "aidl_language.h" #include "aidl_language.h" #include "aidl_language_y.hpp" #include <stdio.h> #include <stdio.h> #include <stdlib.h> #include <stdlib.h> #include <string> #include <string> Loading Loading @@ -74,7 +75,7 @@ bool ParseState::OpenFileFromDisk() { } } int ParseState::RunParser() { int ParseState::RunParser() { int ret = yyparse(this); int ret = yy::parser(this).parse(); free((void *)g_currentPackage); free((void *)g_currentPackage); g_currentPackage = NULL; g_currentPackage = NULL; Loading
tools/aidl/aidl_language_l.l +19 −18 Original line number Original line Diff line number Diff line %{ %{ #include "aidl_language.h" #include "aidl_language.h" #include "aidl_language_y.h" #include "aidl_language_y.hpp" #include "search_path.h" #include "search_path.h" #include <string.h> #include <string.h> #include <stdlib.h> #include <stdlib.h> Loading Loading @@ -39,6 +39,7 @@ static void do_package_statement(const char* importText); %option noyywrap %option noyywrap %option reentrant %option reentrant %option bison-bridge %option bison-bridge %option bison-locations %x COPYING LONG_COMMENT %x COPYING LONG_COMMENT Loading @@ -65,13 +66,13 @@ idvalue (0|[1-9][0-9]*) <LONG_COMMENT>\**\/ { BEGIN(INITIAL); } <LONG_COMMENT>\**\/ { BEGIN(INITIAL); } ^{whitespace}?import{whitespace}[^ \t\r\n]+{whitespace}?; { ^{whitespace}?import{whitespace}[^ \t\r\n]+{whitespace}?; { SET_BUFFER(IMPORT); SET_BUFFER(yy::parser::token::IMPORT); return IMPORT; return yy::parser::token::IMPORT; } } ^{whitespace}?package{whitespace}[^ \t\r\n]+{whitespace}?; { ^{whitespace}?package{whitespace}[^ \t\r\n]+{whitespace}?; { do_package_statement(yytext); do_package_statement(yytext); SET_BUFFER(PACKAGE); SET_BUFFER(yy::parser::token::PACKAGE); return PACKAGE; return yy::parser::token::PACKAGE; } } <<EOF>> { yyterminate(); } <<EOF>> { yyterminate(); } Loading @@ -90,25 +91,25 @@ idvalue (0|[1-9][0-9]*) = { SET_BUFFER('='); return '='; } = { SET_BUFFER('='); return '='; } /* keywords */ /* keywords */ parcelable { SET_BUFFER(PARCELABLE); return PARCELABLE; } parcelable { SET_BUFFER(yy::parser::token::PARCELABLE); return yy::parser::token::PARCELABLE; } interface { SET_BUFFER(INTERFACE); return INTERFACE; } interface { SET_BUFFER(yy::parser::token::INTERFACE); return yy::parser::token::INTERFACE; } in { SET_BUFFER(IN); return IN; } in { SET_BUFFER(yy::parser::token::IN); return yy::parser::token::IN; } out { SET_BUFFER(OUT); return OUT; } out { SET_BUFFER(yy::parser::token::OUT); return yy::parser::token::OUT; } inout { SET_BUFFER(INOUT); return INOUT; } inout { SET_BUFFER(yy::parser::token::INOUT); return yy::parser::token::INOUT; } oneway { SET_BUFFER(ONEWAY); return ONEWAY; } oneway { SET_BUFFER(yy::parser::token::ONEWAY); return yy::parser::token::ONEWAY; } {brackets}+ { SET_BUFFER(ARRAY); return ARRAY; } {brackets}+ { SET_BUFFER(yy::parser::token::ARRAY); return yy::parser::token::ARRAY; } {idvalue} { SET_BUFFER(IDVALUE); return IDVALUE; } {idvalue} { SET_BUFFER(yy::parser::token::IDVALUE); return yy::parser::token::IDVALUE; } {identifier} { SET_BUFFER(IDENTIFIER); return IDENTIFIER; } {identifier} { SET_BUFFER(yy::parser::token::IDENTIFIER); return yy::parser::token::IDENTIFIER; } {identifier}\<{whitespace}*{identifier}({whitespace}*,{whitespace}*{identifier})*{whitespace}*\> { {identifier}\<{whitespace}*{identifier}({whitespace}*,{whitespace}*{identifier})*{whitespace}*\> { SET_BUFFER(GENERIC); return GENERIC; } SET_BUFFER(yy::parser::token::GENERIC); return yy::parser::token::GENERIC; } /* syntax error! */ /* syntax error! */ . { printf("UNKNOWN(%s)", yytext); . { printf("UNKNOWN(%s)", yytext); yylval->buffer.lineno = yylineno; yylval->buffer.lineno = yylineno; yylval->buffer.token = IDENTIFIER; yylval->buffer.token = yy::parser::token::IDENTIFIER; yylval->buffer.data = strdup(yytext); yylval->buffer.data = strdup(yytext); return IDENTIFIER; return yy::parser::token::IDENTIFIER; } } %% %% Loading
tools/aidl/aidl_language_y.y +10 −8 Original line number Original line Diff line number Diff line %{ %{ #include "aidl_language.h" #include "aidl_language.h" #include "aidl_language_y.hpp" #include <stdio.h> #include <stdio.h> #include <stdlib.h> #include <stdlib.h> #include <string.h> #include <string.h> int yyerror(ParseState* ps, char* errstr) int yylex(lexer_type *, yy::parser::location_type *l, void *); { ps->ReportError(errstr); return 1; } int yylex(lexer_type *, void *); static int count_brackets(const char*); static int count_brackets(const char*); #define YYLEX_PARAM ps->Scanner() #define lex_scanner ps->Scanner() %} %} %parse-param { ParseState* ps } %parse-param { ParseState* ps } %lex-param { void *lex_scanner } %pure-parser %pure-parser %skeleton "glr.cc" %token IMPORT %token IMPORT %token PACKAGE %token PACKAGE Loading Loading @@ -339,3 +336,8 @@ static int count_brackets(const char* s) } } return n; return n; } } void yy::parser::error(const yy::parser::location_type& l, const std::string& errstr) { ps->ReportError(errstr); }