summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-04-27 19:03:55 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-04-27 19:03:55 (GMT)
commit12f15fc1db3a8e95bcbabaa4f899f0b717003f1d (patch)
tree9ee7c368889db8683f9a866ed6e776e090b5f4f2 /src
parent7f671fa2d1ae55bbf6aa796b4b010e5205711c60 (diff)
parentd15265f42015279c886cceb165e31f068c456379 (diff)
downloadDoxygen-12f15fc1db3a8e95bcbabaa4f899f0b717003f1d.zip
Doxygen-12f15fc1db3a8e95bcbabaa4f899f0b717003f1d.tar.gz
Doxygen-12f15fc1db3a8e95bcbabaa4f899f0b717003f1d.tar.bz2
Merge branch 'albert-github-feature/bug_lex_option'
Diffstat (limited to 'src')
-rw-r--r--src/lexscanner.l54
1 files changed, 50 insertions, 4 deletions
diff --git a/src/lexscanner.l b/src/lexscanner.l
index 417f559..cd06464 100644
--- a/src/lexscanner.l
+++ b/src/lexscanner.l
@@ -72,6 +72,9 @@ struct lexscannerYY_state
bool nestedComment = false;
QCString prefix = "yy";
+ bool reentrant = false;
+ bool bison_bridge = false;
+ bool bison_locations = false;
QCString cCodeBuffer;
int roundCount = 0;
@@ -105,7 +108,7 @@ TopStart "%top{"{nl}
TopEnd "}"{nl}
LiteralStart "%{"{nl}
LiteralEnd "%}"{nl}
-OptPrefix "%option"{ws}+"prefix"{ws}*"="{ws}*
+Option "%option"
RulesStart "%%"{nl}
RulesEnd "%%"{nl}
RulesSharp "<"[^>\n]*">"
@@ -147,6 +150,7 @@ ANYopt .*
NONLopt [^\n]*
%x DefSection
+%x Option
%x OptPrefix
%x DefSectionLine
%x RulesSectionInit
@@ -179,19 +183,61 @@ NONLopt [^\n]*
%%
<*>\x0d
-<DefSection>{OptPrefix} {
+<DefSection>{Option} {
+ BEGIN (Option);
+ }
+<Option>"prefix"{ws}*"="{ws}* {
BEGIN (OptPrefix);
}
<OptPrefix>"\""[^\"]*"\"" {
yyextra->prefix = yytext;
yyextra->prefix = yyextra->prefix.mid(1,yyleng-2);
+ BEGIN (Option);
+ }
+<Option>"reentrant" {
+ yyextra-> reentrant = true;
+ }
+<Option>"bison-bridge" {
+ yyextra-> bison_bridge = true;
+ }
+<Option>"bison-locations" {
+ yyextra-> bison_bridge = true;
+ yyextra-> bison_locations = true;
}
-<OptPrefix>{nl} {
+<Option>{nws}+
+<Option>{ws}+
+<Option>{nl} {
yyextra->cCodeBuffer += yytext;
BEGIN (DefSection);
}
<DefSection>^{RulesStart} {
- yyextra->cCodeBuffer += "int " + yyextra->prefix + "lex (yyscan_t yyscanner) {\n";
+ {
+ bool fill = false;
+ yyextra->cCodeBuffer += "int " + yyextra->prefix + "lex (";
+ if (yyextra->bison_bridge )
+ {
+ if (fill) yyextra->cCodeBuffer += ",";
+ yyextra->cCodeBuffer += "YYSTYPE * yylval_param";
+ fill = true;
+ }
+ if (yyextra->bison_locations)
+ {
+ if (fill) yyextra->cCodeBuffer += ",";
+ yyextra->cCodeBuffer += "YYLTYPE * yylloc_param";
+ fill = true;
+ }
+ if (yyextra->reentrant)
+ {
+ if (fill) yyextra->cCodeBuffer += ",";
+ yyextra->cCodeBuffer += "yyscan_t yyscanner";
+ fill = true;
+ }
+ if (!yyextra->bison_bridge && !yyextra->bison_locations && !yyextra->reentrant)
+ {
+ yyextra->cCodeBuffer += "void";
+ }
+ yyextra->cCodeBuffer += ") {\n";
+ }
BEGIN (RulesSectionInit);
}
<DefSection>^{TopStart} {