Imported Upstream version 2.8.9
[platform/upstream/cmake.git] / Source / cmExprLexer.in.l
1 %{
2 /*============================================================================
3   CMake - Cross Platform Makefile Generator
4   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5
6   Distributed under the OSI-approved BSD License (the "License");
7   see accompanying file Copyright.txt for details.
8
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 ============================================================================*/
13 /*
14
15 This file must be translated to C and modified to build everywhere.
16
17 Run flex like this:
18
19   flex --prefix=cmExpr_yy --header-file=cmExprLexer.h -ocmExprLexer.cxx cmExprLexer.in.l
20
21 Modify cmExprLexer.cxx:
22   - remove TABs
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(;;)
27
28 Modify cmExprLexer.h:
29   - remove TABs
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)
33
34 */
35
36 #include "cmStandardLexer.h"
37
38 #include "cmExprParserHelper.h"
39
40 /* Replace the lexer input function.  */
41 #undef YY_INPUT
42 #define YY_INPUT(buf, result, max_size) \
43   { result = yyextra->LexInput(buf, max_size); }
44
45 /* Include the set of tokens from the parser.  */
46 #include "cmExprParserTokens.h"
47
48 /*--------------------------------------------------------------------------*/
49 %}
50
51 %option reentrant
52 %option noyywrap
53 %pointer
54
55 %%
56
57 [0-9][0-9]* { yylvalp->Number = atoi(yytext); return exp_NUMBER; } 
58
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; }
72
73 %%