|
1 |
|
2 %option noyywrap |
|
3 |
|
4 %{ |
|
5 /**************************************************************************** |
|
6 ** |
|
7 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
8 ** All rights reserved. |
|
9 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
10 ** |
|
11 ** This file is part of the QLALR tool of the Qt Toolkit. |
|
12 ** |
|
13 ** $QT_BEGIN_LICENSE:LGPL$ |
|
14 ** No Commercial Usage |
|
15 ** This file contains pre-release code and may not be distributed. |
|
16 ** You may use this file in accordance with the terms and conditions |
|
17 ** contained in the Technology Preview License Agreement accompanying |
|
18 ** this package. |
|
19 ** |
|
20 ** GNU Lesser General Public License Usage |
|
21 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
22 ** General Public License version 2.1 as published by the Free Software |
|
23 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
24 ** packaging of this file. Please review the following information to |
|
25 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
26 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
27 ** |
|
28 ** In addition, as a special exception, Nokia gives you certain additional |
|
29 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
30 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
31 ** |
|
32 ** If you have questions regarding the use of this file, please contact |
|
33 ** Nokia at qt-info@nokia.com. |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** |
|
39 ** |
|
40 ** |
|
41 ** |
|
42 ** $QT_END_LICENSE$ |
|
43 ** |
|
44 ****************************************************************************/ |
|
45 |
|
46 #include "calc_parser.h" |
|
47 #include <cstdlib> |
|
48 |
|
49 #define YY_DECL int CalcParser::nextToken() |
|
50 %} |
|
51 |
|
52 %% |
|
53 |
|
54 [ \t\n] { /* eat me */ } |
|
55 [0-9]+ { sym(1) = atoi (yytext); return Token_number; } |
|
56 "(" { return Token_lparen; } |
|
57 ")" { return Token_rparen; } |
|
58 "+" { return Token_plus; } |
|
59 "-" { return Token_minus; } |
|
60 |
|
61 %% |