2 /*============================================================================
3 CMake - Cross Platform Makefile Generator
4 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
6 Distributed under the OSI-approved BSD License (the "License");
7 see accompanying file Copyright.txt for details.
9 This software is distributed WITHOUT ANY WARRANTY; without even the
10 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 See the License for more information.
12 ============================================================================*/
15 This file must be translated to C and modified to build everywhere.
19 flex --prefix=cmExpr_yy --header-file=cmExprLexer.h -ocmExprLexer.cxx cmExprLexer.in.l
21 Modify cmExprLexer.cxx:
23 - remove "yyscanner" argument from these methods:
24 yy_fatal_error, cmExpr_yyalloc, cmExpr_yyrealloc, cmExpr_yyfree
25 - remove all YY_BREAK lines occurring right after return statements
26 - change while ( 1 ) to for(;;)
30 - remove the yy_init_globals function
31 - remove the block that includes unistd.h
32 - remove #line directives (avoids bogus warning on old Sun)
36 #include "cmStandardLexer.h"
38 #include "cmExprParserHelper.h"
40 /* Replace the lexer input function. */
42 #define YY_INPUT(buf, result, max_size) \
43 { result = yyextra->LexInput(buf, max_size); }
45 /* Include the set of tokens from the parser. */
46 #include "cmExprParserTokens.h"
48 /*--------------------------------------------------------------------------*/
57 [0-9][0-9]* { yylvalp->Number = atoi(yytext); return exp_NUMBER; }
59 "+" { return exp_PLUS; }
60 "-" { return exp_MINUS; }
61 "*" { return exp_TIMES; }
62 "/" { return exp_DIVIDE; }
63 "%" { return exp_MOD; }
64 "\|" { return exp_OR; }
65 "&" { return exp_AND; }
66 "^" { return exp_XOR; }
67 "~" { return exp_NOT; }
68 "<<" { return exp_SHIFTLEFT; }
69 ">>" { return exp_SHIFTRIGHT; }
70 "(" { return exp_OPENPARENT; }
71 ")" { return exp_CLOSEPARENT; }