dtparser.l revision 1.1.1.10 1 1.1 jruoho %{
2 1.1 jruoho /******************************************************************************
3 1.1 jruoho *
4 1.1 jruoho * Module Name: dtparser.l - Flex input file for table compiler lexer
5 1.1 jruoho *
6 1.1 jruoho *****************************************************************************/
7 1.1 jruoho
8 1.1 jruoho /*
9 1.1.1.10 christos * Copyright (C) 2000 - 2020, Intel Corp.
10 1.1 jruoho * All rights reserved.
11 1.1 jruoho *
12 1.1 jruoho * Redistribution and use in source and binary forms, with or without
13 1.1 jruoho * modification, are permitted provided that the following conditions
14 1.1 jruoho * are met:
15 1.1 jruoho * 1. Redistributions of source code must retain the above copyright
16 1.1 jruoho * notice, this list of conditions, and the following disclaimer,
17 1.1 jruoho * without modification.
18 1.1 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 1.1 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
20 1.1 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
21 1.1 jruoho * including a substantially similar Disclaimer requirement for further
22 1.1 jruoho * binary redistribution.
23 1.1 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
24 1.1 jruoho * of any contributors may be used to endorse or promote products derived
25 1.1 jruoho * from this software without specific prior written permission.
26 1.1 jruoho *
27 1.1 jruoho * Alternatively, this software may be distributed under the terms of the
28 1.1 jruoho * GNU General Public License ("GPL") version 2 as published by the Free
29 1.1 jruoho * Software Foundation.
30 1.1 jruoho *
31 1.1 jruoho * NO WARRANTY
32 1.1 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 1.1 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 1.1 jruoho * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 1.1 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 1.1 jruoho * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 1.1 jruoho * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 1.1 jruoho * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 1.1 jruoho * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 1.1 jruoho * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 1.1 jruoho * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 1.1 jruoho * POSSIBILITY OF SUCH DAMAGES.
43 1.1 jruoho */
44 1.1 jruoho
45 1.1 jruoho #include "aslcompiler.h"
46 1.1 jruoho #include "dtparser.y.h"
47 1.1 jruoho
48 1.1 jruoho #define YY_NO_INPUT /* No file input, we use strings only */
49 1.1 jruoho
50 1.1 jruoho #define _COMPONENT ACPI_COMPILER
51 1.1 jruoho ACPI_MODULE_NAME ("dtscanner")
52 1.1 jruoho %}
53 1.1 jruoho
54 1.1 jruoho %option noyywrap
55 1.1 jruoho %option nounput
56 1.1 jruoho
57 1.1 jruoho Number [0-9a-fA-F]+
58 1.1 jruoho HexNumber 0[xX][0-9a-fA-F]+
59 1.1 jruoho DecimalNumber 0[dD][0-9]+
60 1.1 jruoho LabelRef $[a-zA-Z][0-9a-zA-Z]*
61 1.1 jruoho WhiteSpace [ \t\v\r]+
62 1.1 jruoho NewLine [\n]
63 1.1 jruoho
64 1.1 jruoho %%
65 1.1 jruoho
66 1.1.1.7 christos \( return (OP_EXP_PAREN_OPEN);
67 1.1.1.7 christos \) return (OP_EXP_PAREN_CLOSE);
68 1.1.1.7 christos \~ return (OP_EXP_ONES_COMPLIMENT);
69 1.1.1.7 christos \! return (OP_EXP_LOGICAL_NOT);
70 1.1.1.7 christos \* return (OP_EXP_MULTIPLY);
71 1.1.1.7 christos \/ return (OP_EXP_DIVIDE);
72 1.1.1.7 christos \% return (OP_EXP_MODULO);
73 1.1.1.7 christos \+ return (OP_EXP_ADD);
74 1.1.1.7 christos \- return (OP_EXP_SUBTRACT);
75 1.1.1.7 christos ">>" return (OP_EXP_SHIFT_RIGHT);
76 1.1.1.7 christos "<<" return (OP_EXP_SHIFT_LEFT);
77 1.1.1.7 christos \< return (OP_EXP_LESS);
78 1.1.1.7 christos \> return (OP_EXP_GREATER);
79 1.1.1.7 christos "<=" return (OP_EXP_LESS_EQUAL);
80 1.1.1.7 christos ">=" return (OP_EXP_GREATER_EQUAL);
81 1.1.1.7 christos "==" return (OP_EXP_EQUAL);
82 1.1.1.7 christos "!=" return (OP_EXP_NOT_EQUAL);
83 1.1.1.7 christos \& return (OP_EXP_AND);
84 1.1.1.7 christos \^ return (OP_EXP_XOR);
85 1.1.1.7 christos \| return (OP_EXP_OR);
86 1.1.1.7 christos "&&" return (OP_EXP_LOGICAL_AND);
87 1.1.1.7 christos "||" return (OP_EXP_LOGICAL_OR);
88 1.1.1.7 christos <<EOF>> return (OP_EXP_EOF); /* null end-of-string */
89 1.1.1.7 christos
90 1.1.1.7 christos {LabelRef} return (OP_EXP_LABEL);
91 1.1.1.7 christos {Number} return (OP_EXP_NUMBER);
92 1.1.1.7 christos {HexNumber} return (OP_EXP_HEX_NUMBER);
93 1.1.1.7 christos {NewLine} return (OP_EXP_NEW_LINE);
94 1.1 jruoho {WhiteSpace} /* Ignore */
95 1.1 jruoho
96 1.1.1.7 christos . return (OP_EXP_EOF);
97 1.1 jruoho
98 1.1 jruoho %%
99 1.1 jruoho
100 1.1 jruoho /*
101 1.1 jruoho * Local support functions
102 1.1 jruoho */
103 1.1.1.10 christos static YY_BUFFER_STATE LexBuffer;
104 1.1 jruoho
105 1.1 jruoho /******************************************************************************
106 1.1 jruoho *
107 1.1 jruoho * FUNCTION: DtInitLexer, DtTerminateLexer
108 1.1 jruoho *
109 1.1 jruoho * PARAMETERS: String - Input string to be parsed
110 1.1 jruoho *
111 1.1 jruoho * RETURN: None
112 1.1 jruoho *
113 1.1 jruoho * DESCRIPTION: Initialization and termination routines for lexer. Lexer needs
114 1.1 jruoho * a buffer to handle strings instead of a file.
115 1.1 jruoho *
116 1.1 jruoho *****************************************************************************/
117 1.1 jruoho
118 1.1 jruoho int
119 1.1 jruoho DtInitLexer (
120 1.1 jruoho char *String)
121 1.1 jruoho {
122 1.1 jruoho LexBuffer = yy_scan_string (String);
123 1.1 jruoho return (LexBuffer == NULL);
124 1.1 jruoho }
125 1.1 jruoho
126 1.1 jruoho void
127 1.1 jruoho DtTerminateLexer (
128 1.1 jruoho void)
129 1.1 jruoho {
130 1.1 jruoho yy_delete_buffer (LexBuffer);
131 1.1 jruoho }
132