CMake Nightly Date Stamp
[kiteware-cmake.git] / Source / LexerParser / cmExprLexer.in.l
blob90c1cc3ab1287f5773cd6f27cad596377bfda772
1 %{
2 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
3    file Copyright.txt or https://cmake.org/licensing for details.  */
4 /*
6 This file must be translated to C++ and modified to build everywhere.
8 Run flex >= 2.6 like this:
10   flex --nounistd -DFLEXINT_H --noline --header-file=cmExprLexer.h -ocmExprLexer.cxx cmExprLexer.in.l
12 Modify cmExprLexer.cxx:
13   - remove trailing whitespace:              sed -i 's/\s*$//' cmExprLexer.h cmExprLexer.cxx
14   - remove blank lines at end of file:       sed -i '${/^$/d;}' cmExprLexer.h cmExprLexer.cxx
15   - #include "cmStandardLexer.h" at the top: sed -i '1i#include "cmStandardLexer.h"' cmExprLexer.cxx
19 /* IWYU pragma: no_forward_declare yyguts_t */
21 #ifndef __clang_analyzer__ /* Suppress clang-analyzer warnings */
23 #include "cmExprParserHelper.h"
25 /* Replace the lexer input function.  */
26 #undef YY_INPUT
27 #define YY_INPUT(buf, result, max_size) \
28   do { result = yyextra->LexInput(buf, max_size); } while (0)
30 /* Include the set of tokens from the parser.  */
31 #include "cmExprParserTokens.h"
33 #include <string>
35 /*--------------------------------------------------------------------------*/
38 %option prefix="cmExpr_yy"
40 %option reentrant
41 %option noyywrap
42 %pointer
45 [ \t]  {}
47 [0-9][0-9]* { yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; }
48 0[xX][0-9a-fA-F][0-9a-fA-F]* {  yylvalp->Number = std::stoll(yytext, nullptr, 16); return exp_NUMBER; }
50 "+" { return exp_PLUS; }
51 "-" { return exp_MINUS; }
52 "*" { return exp_TIMES; }
53 "/" { return exp_DIVIDE; }
54 "%" { return exp_MOD; }
55 "\|" { return exp_OR; }
56 "&" { return exp_AND; }
57 "^" { return exp_XOR; }
58 "~" { return exp_NOT; }
59 "<<" { return exp_SHIFTLEFT; }
60 ">>" { return exp_SHIFTRIGHT; }
61 "(" { return exp_OPENPARENT; }
62 ")" { return exp_CLOSEPARENT; }
63 . { yyextra->UnexpectedChar(yytext[0]); }
67 /*--------------------------------------------------------------------------*/
69 #endif /* __clang_analyzer__ */