From 20742152746b64d31082fcc7f0766390b378afdc Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 8 Mar 2021 15:02:02 +0100 Subject: Better handling of option possibility in lex scanner - improved handling of `%option` - multiple options on 1 line - handling of unknown options that contain part of a handled option (like noreentrant) - correction of definition yylex function definition, signature depends on usage of - reentrant - bison-bridge - bison-locations (automatically include bison-bridge) (found as part of some Fossies tests) --- src/lexscanner.l | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/src/lexscanner.l b/src/lexscanner.l index 47d3443..c3a6f25 100644 --- a/src/lexscanner.l +++ b/src/lexscanner.l @@ -74,6 +74,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; int squareCount = 0; @@ -108,7 +111,7 @@ TopStart "%top{"{nl} TopEnd "}"{nl} LiteralStart "%{"{nl} LiteralEnd "%}"{nl} -OptPrefix "%option"{ws}+"prefix"{ws}*"="{ws}* +Option "%option" RulesStart "%%"{nl} RulesEnd "%%"{nl} RulesSharp "<"[^>]*">" @@ -149,6 +152,7 @@ ANYopt .* NONLopt [^\n]* %x DefSection +%x Option %x OptPrefix %x DefSectionLine %x RulesSectionInit @@ -180,19 +184,61 @@ NONLopt [^\n]* %% <*>\x0d -{OptPrefix} { +{Option} { + BEGIN (Option); + } +