Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmExprLexer.in.l
blobb571e8cb254cd6be06654e562516a93bf0fc9355
1 %{
2 /*=========================================================================
4   Program:   CMake - Cross-Platform Makefile Generator
5   Module:    $RCSfile: cmExprLexer.in.l,v $
6   Language:  C++
7   Date:      $Date: 2006/08/08 18:00:28 $
8   Version:   $Revision: 1.3 $
10   Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
11   See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
17 =========================================================================*/
20 This file must be translated to C and modified to build everywhere.
22 Run flex like this:
24   flex --prefix=cmExpr_yy --header-file=cmExprLexer.h -ocmExprLexer.cxx cmExprLexer.in.l
26 Modify cmExprLexer.cxx:
27   - remove TABs
28   - remove "yyscanner" argument from these methods:
29       yy_fatal_error, cmExpr_yyalloc, cmExpr_yyrealloc, cmExpr_yyfree
30   - remove all YY_BREAK lines occurring right after return statements
31   - change while ( 1 ) to for(;;)
33 Modify cmExprLexer.h:
34   - remove TABs
35   - remove the yy_init_globals function
36   - remove the block that includes unistd.h
37   - remove #line directives (avoids bogus warning on old Sun)
41 #include "cmStandardLexer.h"
43 #include "cmExprParserHelper.h"
45 /* Replace the lexer input function.  */
46 #undef YY_INPUT
47 #define YY_INPUT(buf, result, max_size) \
48   { result = yyextra->LexInput(buf, max_size); }
50 /* Include the set of tokens from the parser.  */
51 #include "cmExprParserTokens.h"
53 /*--------------------------------------------------------------------------*/
56 %option reentrant
57 %option noyywrap
58 %pointer
62 [0-9][0-9]* { yylvalp->Number = atoi(yytext); return exp_NUMBER; } 
64 "+" { return exp_PLUS; }
65 "-" { return exp_MINUS; } 
66 "*" { return exp_TIMES; } 
67 "/" { return exp_DIVIDE; } 
68 "%" { return exp_MOD; } 
69 "\|" { return exp_OR; } 
70 "&" { return exp_AND; } 
71 "^" { return exp_XOR; } 
72 "~" { return exp_NOT; } 
73 "<<" { return exp_SHIFTLEFT; } 
74 ">>" { return exp_SHIFTRIGHT; } 
75 "(" { return exp_OPENPARENT; }
76 ")" { return exp_CLOSEPARENT; }