cmExprLexer.in.l 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. /*
  5. This file must be translated to C++ and modified to build everywhere.
  6. Run flex >= 2.6 like this:
  7. flex --nounistd -DFLEXINT_H --noline --header-file=cmExprLexer.h -ocmExprLexer.cxx cmExprLexer.in.l
  8. Modify cmExprLexer.cxx:
  9. - remove trailing whitespace: sed -i 's/\s*$//' cmExprLexer.h cmExprLexer.cxx
  10. - remove blank lines at end of file: sed -i '${/^$/d;}' cmExprLexer.h cmExprLexer.cxx
  11. - #include "cmStandardLexer.h" at the top: sed -i '1i#include "cmStandardLexer.h"' cmExprLexer.cxx
  12. */
  13. /* IWYU pragma: no_forward_declare yyguts_t */
  14. #include "cmExprParserHelper.h"
  15. /* Replace the lexer input function. */
  16. #undef YY_INPUT
  17. #define YY_INPUT(buf, result, max_size) \
  18. { result = yyextra->LexInput(buf, max_size); }
  19. /* Include the set of tokens from the parser. */
  20. #include "cmExprParserTokens.h"
  21. /*--------------------------------------------------------------------------*/
  22. %}
  23. %option prefix="cmExpr_yy"
  24. %option reentrant
  25. %option noyywrap
  26. %pointer
  27. %%
  28. [0-9][0-9]* { yylvalp->Number = atoi(yytext); return exp_NUMBER; }
  29. "+" { return exp_PLUS; }
  30. "-" { return exp_MINUS; }
  31. "*" { return exp_TIMES; }
  32. "/" { return exp_DIVIDE; }
  33. "%" { return exp_MOD; }
  34. "\|" { return exp_OR; }
  35. "&" { return exp_AND; }
  36. "^" { return exp_XOR; }
  37. "~" { return exp_NOT; }
  38. "<<" { return exp_SHIFTLEFT; }
  39. ">>" { return exp_SHIFTRIGHT; }
  40. "(" { return exp_OPENPARENT; }
  41. ")" { return exp_CLOSEPARENT; }
  42. %%