/***************************************************************************** * * Copyright (C) 1997-2021 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * */ %option never-interactive %option prefix="lexscannerYY" %option reentrant %option extra-type="struct lexscannerYY_state *" %option noyywrap %top{ #include // forward declare yyscan_t to improve type safety #define YY_TYPEDEF_YY_SCANNER_T struct yyguts_t; typedef yyguts_t *yyscan_t; } %{ /* * includes */ #include #include #include #include #include #include #include #include "config.h" #include "lexscanner.h" #include "entry.h" #include "message.h" #include "util.h" #include "scanner.h" #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 #define USE_STATE2STRING 0 #define repeatChar(chr, cnt) std::string(cnt, chr).c_str() struct lexscannerYY_state { COutlineParser cOutlineParser; const char * inputString = 0; int inputPosition = 0; int lastContext = 0; int lastCContext = 0; int lastStringContext = 0; int docBlockContext = 0; int lastPreLineCtrlContext = 0; int lastRawStringContext = 0; int curlyCount = 0; bool insideCode = FALSE; QCString delimiter; QCString docBlockName; uint fencedSize = 0; bool nestedComment = false; QCString prefix = "yy"; bool reentrant = false; bool bison_bridge = false; bool bison_locations = false; QCString cCodeBuffer; int roundCount = 0; QCString fileName; ClangTUParser *clangParser = 0; std::shared_ptr current; std::shared_ptr current_root; SrcLangExt language; }; #if USE_STATE2STRING static const char *stateToString(int state); #endif //----------------------------------------------------------------------------- // forward declarations for statefull functions static void handleCCode(yyscan_t yyscanner); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); /* ----------------------------------------------------------------- */ #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size); // otherwise the filename would be the name of the converted file (*.cpp instead of *.l) static inline const char *getLexerFILE() {return __FILE__;} #include "doxygen_lex.h" %} nl (\r\n|\r|\n) ws [ \t] nws [^ \t\n] TopStart "%top{"{nl} TopEnd "}"{nl} LiteralStart "%{"{nl} LiteralEnd "%}"{nl} Option "%option" RulesStart "%%"{nl} RulesEnd "%%"{nl} RulesSharp "<"[^>\n]*">" RulesCurly "{"[^{}\n]*"}" StartSquare "[" StartDouble "\"" StartRound "(" StartRoundQuest "(?" EscapeRulesCharOpen "\\["|"\\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\" EscapeRulesCharClose "\\]"|"\\>"|"\\}"|"\\)" EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose} CMD ("\\"|"@") BN [ \t\n\r] BL [ \t\r]*"\n" B [ \t] Bopt {B}* ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]* PRE [pP][rR][eE] CODE [cC][oO][dD][eE] RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" RAWEND ")"[^ \t\(\)\\]{0,16}\" CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) CHARCE "[:"[^:]*":]" /* no comment start / end signs inside square brackets */ NCOMM [^/\*] // C start comment CCS "/\*" // C end comment CCE "*\/" // Cpp comment CPPC "/\/" // doxygen start comment DCOMM ("/\*!"|"/\**"|"/\/!"|"/\/\/") // Optional any character ANYopt .* // Optional all but newline NONLopt [^\n]* %x DefSection %x Option %x OptPrefix %x DefSectionLine %x RulesSectionInit %x RulesPattern %x RulesDouble %x RulesRoundDouble %x RulesSquare %x RulesRoundSquare %x RulesRound %x RulesRoundQuest %x UserSection %x TopSection %x LiteralSection %x COMMENT %x SkipCurly %x SkipCurlyEndDoc %x PreLineCtrl %x DocLine %x DocBlock %x DocCopyBlock %x SkipString %x RawString %x SkipComment %x SkipCxxComment %x Comment %% <*>\x0d {Option} { BEGIN (Option); }