From 1288d8c535edd2ce29eebdc4acca6b2beab89841 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 21 Jul 2015 23:48:45 +0100 Subject: Change binding grammar to new approach. --- src/nsgenbind-lexer.l | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'src/nsgenbind-lexer.l') diff --git a/src/nsgenbind-lexer.l b/src/nsgenbind-lexer.l index 4b5e225..f7b6528 100644 --- a/src/nsgenbind-lexer.l +++ b/src/nsgenbind-lexer.l @@ -72,7 +72,9 @@ cblockopen \%\{ cblockclose \%\} /* used for #include directive */ -poundsign ^{whitespace}*# +poundsign ^{whitespace}*# + +dblcolon \:\: %x cblock @@ -88,44 +90,55 @@ poundsign ^{whitespace}*# yylloc->last_column = 0; } - /* terminals */ + /* binding terminals */ -webidlfile return TOK_IDLFILE; +binding return TOK_BINDING; -hdrcomment return TOK_HDR_COMMENT; +webidl return TOK_WEBIDL; -preamble return TOK_PREAMBLE; +preface return TOK_PREFACE; prologue return TOK_PROLOGUE; epilogue return TOK_EPILOGUE; -binding return TOK_BINDING; +postface return TOK_POSTFACE; -interface return TOK_INTERFACE; -flags return TOK_FLAGS; + /* class member terminals */ -type return TOK_TYPE; +class return TOK_CLASS; private return TOK_PRIVATE; internal return TOK_INTERNAL; +flags return TOK_FLAGS; + +type return TOK_TYPE; + unshared return TOK_UNSHARED; shared return TOK_SHARED; property return TOK_PROPERTY; -operation return TOK_OPERATION; + /* implementation terminals */ + +init return TOK_INIT; -api return TOK_API; +fini return TOK_FINI; + +method return TOK_METHOD; getter return TOK_GETTER; setter return TOK_SETTER; + /* other terminals */ + +{dblcolon} return TOK_DBLCOLON; + {cblockopen} BEGIN(cblock); {identifier} { @@ -140,7 +153,7 @@ setter return TOK_SETTER; {multicomment} /* nothing */ -{poundsign}include BEGIN(incl); +{poundsign}include BEGIN(incl); {other} return (int) yytext[0]; @@ -151,7 +164,7 @@ setter return TOK_SETTER; \% yylval->text = strdup(yytext); return TOK_CCODE_LITERAL; -[ \t]*\" /* eat the whitespace and open quotes */ +[ \t]*\" /* eat the whitespace and open quotes */ [^\t\n\"]+ { /* got the include file name */ -- cgit v1.2.3