xref: /freebsd/sys/contrib/dev/acpica/compiler/aslcompiler.l (revision 792bbaba989533a1fc93823df1720c8c4aaf0442)
1 %{
2 /******************************************************************************
3  *
4  * Module Name: aslcompiler.l - Flex/lex input file
5  *
6  *****************************************************************************/
7 
8 /*
9  * Copyright (C) 2000 - 2016, Intel Corp.
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions, and the following disclaimer,
17  *    without modification.
18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19  *    substantially similar to the "NO WARRANTY" disclaimer below
20  *    ("Disclaimer") and any redistribution must be conditioned upon
21  *    including a substantially similar Disclaimer requirement for further
22  *    binary redistribution.
23  * 3. Neither the names of the above-listed copyright holders nor the names
24  *    of any contributors may be used to endorse or promote products derived
25  *    from this software without specific prior written permission.
26  *
27  * Alternatively, this software may be distributed under the terms of the
28  * GNU General Public License ("GPL") version 2 as published by the Free
29  * Software Foundation.
30  *
31  * NO WARRANTY
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42  * POSSIBILITY OF SUCH DAMAGES.
43  */
44 
45 #include <contrib/dev/acpica/compiler/aslcompiler.h>
46 #include "aslcompiler.y.h"
47 
48 #include <stdlib.h>
49 #include <string.h>
50 YYSTYPE AslCompilerlval;
51 
52 /*
53  * Generation:  Use the following command line:
54  *
55  * flex.exe -PAslCompiler -i -o$(InputPath).c $(InputPath)
56  *
57  * -i: Scanner must be case-insensitive
58  */
59 
60 #define _COMPONENT          ACPI_COMPILER
61         ACPI_MODULE_NAME    ("aslscanner")
62 
63 
64 /* Local prototypes */
65 
66 static void
67 AslDoLineDirective (void);
68 
69 static char
70 AslDoComment (void);
71 
72 static char
73 AslDoCommentType2 (void);
74 
75 static char
76 AslDoStringLiteral (void);
77 
78 static void
79 count (int type);
80 
81 
82 /*! [Begin] no source code translation */
83 
84 %}
85     /* Definitions */
86 
87 LeadNameChar                [A-Za-z_]
88 DigitChar                   [0-9]
89 HexDigitChar                [A-Fa-f0-9]
90 RootChar                    [\\]
91 Nothing                     []
92 
93 NameChar                    [A-Za-z_0-9]
94 NameSeg1                    {LeadNameChar}{NameChar}
95 NameSeg2                    {LeadNameChar}{NameChar}{NameChar}
96 NameSeg3                    {LeadNameChar}{NameChar}{NameChar}{NameChar}
97 NameSeg                     {LeadNameChar}|{NameSeg1}|{NameSeg2}|{NameSeg3}
98 
99 NameString                  {RootChar}|{RootChar}{NamePath}|[\^]+{NamePath}|{NonEmptyNamePath}
100 NamePath                    {NonEmptyNamePath}?
101 NonEmptyNamePath            {NameSeg}{NamePathTail}*
102 NamePathTail                [.]{NameSeg}
103 
104 %%
105     /* Rules */
106 
107 [ ]                         { count (0); }
108 [\n]                        { count (0); } /* Handle files with both LF and CR/LF */
109 [\r]                        { count (0); } /* termination on both Unix and Windows */
110 [ \t]                       { count (0); }
111 
112 
113 "/*"                        { if (!AslDoComment ()) {yyterminate ();} }
114 "//"                        { if (!AslDoCommentType2 ()) {yyterminate ();} }
115 
116 "\""                        { if (AslDoStringLiteral ()) {return (PARSEOP_STRING_LITERAL);}
117                               else {yyterminate ();} }
118 ";"                         { count (0); return(';'); }
119 
120     /* ASL Extension: Standard C operators */
121 
122 "~"                         { count (3); return (PARSEOP_EXP_NOT); }
123 "!"                         { count (3); return (PARSEOP_EXP_LOGICAL_NOT); }
124 "*"                         { count (3); return (PARSEOP_EXP_MULTIPLY); }
125 "/"                         { count (3); return (PARSEOP_EXP_DIVIDE); }
126 "%"                         { count (3); return (PARSEOP_EXP_MODULO); }
127 "+"                         { count (3); return (PARSEOP_EXP_ADD); }
128 "-"                         { count (3); return (PARSEOP_EXP_SUBTRACT); }
129 ">>"                        { count (3); return (PARSEOP_EXP_SHIFT_RIGHT); }
130 "<<"                        { count (3); return (PARSEOP_EXP_SHIFT_LEFT); }
131 "<"                         { count (3); return (PARSEOP_EXP_LESS); }
132 ">"                         { count (3); return (PARSEOP_EXP_GREATER); }
133 "&"                         { count (3); return (PARSEOP_EXP_AND); }
134 "<="                        { count (3); return (PARSEOP_EXP_LESS_EQUAL); }
135 ">="                        { count (3); return (PARSEOP_EXP_GREATER_EQUAL); }
136 "=="                        { count (3); return (PARSEOP_EXP_EQUAL); }
137 "!="                        { count (3); return (PARSEOP_EXP_NOT_EQUAL); }
138 "|"                         { count (3); return (PARSEOP_EXP_OR); }
139 "&&"                        { count (3); return (PARSEOP_EXP_LOGICAL_AND); }
140 "||"                        { count (3); return (PARSEOP_EXP_LOGICAL_OR); }
141 "++"                        { count (3); return (PARSEOP_EXP_INCREMENT); }
142 "--"                        { count (3); return (PARSEOP_EXP_DECREMENT); }
143 "^ "                        { count (3); return (PARSEOP_EXP_XOR); }
144 
145     /* ASL Extension: Standard C assignment operators */
146 
147 "="                         { count (3); return (PARSEOP_EXP_EQUALS); }
148 "+="                        { count (3); return (PARSEOP_EXP_ADD_EQ); }
149 "-="                        { count (3); return (PARSEOP_EXP_SUB_EQ); }
150 "*="                        { count (3); return (PARSEOP_EXP_MUL_EQ); }
151 "/="                        { count (3); return (PARSEOP_EXP_DIV_EQ); }
152 "%="                        { count (3); return (PARSEOP_EXP_MOD_EQ); }
153 "<<="                       { count (3); return (PARSEOP_EXP_SHL_EQ); }
154 ">>="                       { count (3); return (PARSEOP_EXP_SHR_EQ); }
155 "&="                        { count (3); return (PARSEOP_EXP_AND_EQ); }
156 "^="                        { count (3); return (PARSEOP_EXP_XOR_EQ); }
157 "|="                        { count (3); return (PARSEOP_EXP_OR_EQ); }
158 
159 "["                         { count (3); return (PARSEOP_EXP_INDEX_LEFT); }
160 "]"                         { count (0); return (PARSEOP_EXP_INDEX_RIGHT); }
161 "("                         { count (0); return (PARSEOP_OPEN_PAREN); }
162 ")"                         { count (0); return (PARSEOP_CLOSE_PAREN); }
163 
164 "{"                         { count (0); return ('{'); }
165 "}"                         { count (0); return ('}'); }
166 ","                         { count (0); return (','); }
167 
168 
169     /*
170      * Begin standard ASL grammar
171      */
172 0[xX]{HexDigitChar}+ |
173 {DigitChar}+                { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext);
174                                 count (1); return (PARSEOP_INTEGER); }
175 
176 "Include"                   { count (1); return (PARSEOP_INCLUDE); }
177 "External"                  { count (1); return (PARSEOP_EXTERNAL); }
178 
179  /*
180   * The #line directive is emitted by the preprocessor and handled
181   * here in the main iASL lexer - simply set the line number and
182   * optionally the current filename.
183   */
184 "#line"                     { AslDoLineDirective ();}
185 
186 
187  /****************************************************************************
188   *
189   * Main ASL operators
190   *
191   ****************************************************************************/
192 
193 "AccessAs"                  { count (1); return (PARSEOP_ACCESSAS); }
194 "Acquire"                   { count (3); return (PARSEOP_ACQUIRE); }
195 "Add"                       { count (3); return (PARSEOP_ADD); }
196 "Alias"                     { count (2); return (PARSEOP_ALIAS); }
197 "And"                       { count (3); return (PARSEOP_AND); }
198 "BankField"                 { count (2); return (PARSEOP_BANKFIELD); }
199 "Break"                     { count (3); return (PARSEOP_BREAK); }
200 "BreakPoint"                { count (3); return (PARSEOP_BREAKPOINT); }
201 "Buffer"                    { count (1); return (PARSEOP_BUFFER); }
202 "Case"                      { count (3); return (PARSEOP_CASE); }
203 "Concatenate"               { count (3); return (PARSEOP_CONCATENATE); }
204 "ConcatenateResTemplate"    { count (3); return (PARSEOP_CONCATENATERESTEMPLATE); }
205 "CondRefOf"                 { count (3); return (PARSEOP_CONDREFOF); }
206 "Connection"                { count (2); return (PARSEOP_CONNECTION); }
207 "Continue"                  { count (3); return (PARSEOP_CONTINUE); }
208 "CopyObject"                { count (3); return (PARSEOP_COPYOBJECT); }
209 "CreateBitField"            { count (2); return (PARSEOP_CREATEBITFIELD); }
210 "CreateByteField"           { count (2); return (PARSEOP_CREATEBYTEFIELD); }
211 "CreateDWordField"          { count (2); return (PARSEOP_CREATEDWORDFIELD); }
212 "CreateField"               { count (2); return (PARSEOP_CREATEFIELD); }
213 "CreateQWordField"          { count (2); return (PARSEOP_CREATEQWORDFIELD); }
214 "CreateWordField"           { count (2); return (PARSEOP_CREATEWORDFIELD); }
215 "DataTableRegion"           { count (2); return (PARSEOP_DATATABLEREGION); }
216 "Debug"                     { count (1); return (PARSEOP_DEBUG); }
217 "Decrement"                 { count (3); return (PARSEOP_DECREMENT); }
218 "Default"                   { count (3); return (PARSEOP_DEFAULT); }
219 "DefinitionBlock"           { count (1); return (PARSEOP_DEFINITION_BLOCK); }
220 "DeRefOf"                   { count (3); return (PARSEOP_DEREFOF); }
221 "Device"                    { count (2); return (PARSEOP_DEVICE); }
222 "Divide"                    { count (3); return (PARSEOP_DIVIDE); }
223 "Eisaid"                    { count (1); return (PARSEOP_EISAID); }
224 "Else"                      { count (3); return (PARSEOP_ELSE); }
225 "ElseIf"                    { count (3); return (PARSEOP_ELSEIF); }
226 "Event"                     { count (2); return (PARSEOP_EVENT); }
227 "Fatal"                     { count (3); return (PARSEOP_FATAL); }
228 "Field"                     { count (2); return (PARSEOP_FIELD); }
229 "FindSetLeftBit"            { count (3); return (PARSEOP_FINDSETLEFTBIT); }
230 "FindSetRightBit"           { count (3); return (PARSEOP_FINDSETRIGHTBIT); }
231 "FromBcd"                   { count (3); return (PARSEOP_FROMBCD); }
232 "Function"                  { count (2); return (PARSEOP_FUNCTION); }
233 "If"                        { count (3); return (PARSEOP_IF); }
234 "Increment"                 { count (3); return (PARSEOP_INCREMENT); }
235 "Index"                     { count (3); return (PARSEOP_INDEX); }
236 "IndexField"                { count (2); return (PARSEOP_INDEXFIELD); }
237 "LAnd"                      { count (3); return (PARSEOP_LAND); }
238 "LEqual"                    { count (3); return (PARSEOP_LEQUAL); }
239 "LGreater"                  { count (3); return (PARSEOP_LGREATER); }
240 "LGreaterEqual"             { count (3); return (PARSEOP_LGREATEREQUAL); }
241 "LLess"                     { count (3); return (PARSEOP_LLESS); }
242 "LLessEqual"                { count (3); return (PARSEOP_LLESSEQUAL); }
243 "LNot"                      { count (3); return (PARSEOP_LNOT); }
244 "LNotEqual"                 { count (3); return (PARSEOP_LNOTEQUAL); }
245 "Load"                      { count (3); return (PARSEOP_LOAD); }
246 "LoadTable"                 { count (3); return (PARSEOP_LOADTABLE); }
247 "LOr"                       { count (3); return (PARSEOP_LOR); }
248 "Match"                     { count (3); return (PARSEOP_MATCH); }
249 "Method"                    { count (2); return (PARSEOP_METHOD); }
250 "Mid"                       { count (3); return (PARSEOP_MID); }
251 "Mod"                       { count (3); return (PARSEOP_MOD); }
252 "Multiply"                  { count (3); return (PARSEOP_MULTIPLY); }
253 "Mutex"                     { count (2); return (PARSEOP_MUTEX); }
254 "Name"                      { count (2); return (PARSEOP_NAME); }
255 "NAnd"                      { count (3); return (PARSEOP_NAND); }
256 "Noop"                      { if (!AcpiGbl_IgnoreNoopOperator) {count (3); return (PARSEOP_NOOP);} }
257 "NOr"                       { count (3); return (PARSEOP_NOR); }
258 "Not"                       { count (3); return (PARSEOP_NOT); }
259 "Notify"                    { count (3); return (PARSEOP_NOTIFY); }
260 "ObjectType"                { count (3); return (PARSEOP_OBJECTTYPE); }
261 "Offset"                    { count (1); return (PARSEOP_OFFSET); }
262 "One"                       { count (1); return (PARSEOP_ONE); }
263 "Ones"                      { count (1); return (PARSEOP_ONES); }
264 "OperationRegion"           { count (2); return (PARSEOP_OPERATIONREGION); }
265 "Or"                        { count (3); return (PARSEOP_OR); }
266 "Package"                   { count (1); return (PARSEOP_PACKAGE); }
267 "PowerResource"             { count (2); return (PARSEOP_POWERRESOURCE); }
268 "Processor"                 { count (2); return (PARSEOP_PROCESSOR); }
269 "RefOf"                     { count (3); return (PARSEOP_REFOF); }
270 "Release"                   { count (3); return (PARSEOP_RELEASE); }
271 "Reset"                     { count (3); return (PARSEOP_RESET); }
272 "Return"                    { count (3); return (PARSEOP_RETURN); }
273 "Revision"                  { count (1); return (PARSEOP_REVISION); }
274 "Scope"                     { count (2); return (PARSEOP_SCOPE); }
275 "ShiftLeft"                 { count (3); return (PARSEOP_SHIFTLEFT); }
276 "ShiftRight"                { count (3); return (PARSEOP_SHIFTRIGHT); }
277 "Signal"                    { count (3); return (PARSEOP_SIGNAL); }
278 "SizeOf"                    { count (3); return (PARSEOP_SIZEOF); }
279 "Sleep"                     { count (3); return (PARSEOP_SLEEP); }
280 "Stall"                     { count (3); return (PARSEOP_STALL); }
281 "Store"                     { count (3); return (PARSEOP_STORE); }
282 "Subtract"                  { count (3); return (PARSEOP_SUBTRACT); }
283 "Switch"                    { count (3); return (PARSEOP_SWITCH); }
284 "ThermalZone"               { count (2); return (PARSEOP_THERMALZONE); }
285 "Timer"                     { count (3); return (PARSEOP_TIMER); }
286 "ToBcd"                     { count (3); return (PARSEOP_TOBCD); }
287 "ToBuffer"                  { count (3); return (PARSEOP_TOBUFFER); }
288 "ToDecimalString"           { count (3); return (PARSEOP_TODECIMALSTRING); }
289 "ToHexString"               { count (3); return (PARSEOP_TOHEXSTRING); }
290 "ToInteger"                 { count (3); return (PARSEOP_TOINTEGER); }
291 "ToString"                  { count (3); return (PARSEOP_TOSTRING); }
292 "ToUuid"                    { count (1); return (PARSEOP_TOUUID); }
293 "Unicode"                   { count (1); return (PARSEOP_UNICODE); }
294 "Unload"                    { count (3); return (PARSEOP_UNLOAD); }
295 "Wait"                      { count (3); return (PARSEOP_WAIT); }
296 "While"                     { count (3); return (PARSEOP_WHILE); }
297 "XOr"                       { count (3); return (PARSEOP_XOR); }
298 "Zero"                      { count (1); return (PARSEOP_ZERO); }
299 
300     /* Control method arguments and locals */
301 
302 "Arg0"                      { count (1); return (PARSEOP_ARG0); }
303 "Arg1"                      { count (1); return (PARSEOP_ARG1); }
304 "Arg2"                      { count (1); return (PARSEOP_ARG2); }
305 "Arg3"                      { count (1); return (PARSEOP_ARG3); }
306 "Arg4"                      { count (1); return (PARSEOP_ARG4); }
307 "Arg5"                      { count (1); return (PARSEOP_ARG5); }
308 "Arg6"                      { count (1); return (PARSEOP_ARG6); }
309 "Local0"                    { count (1); return (PARSEOP_LOCAL0); }
310 "Local1"                    { count (1); return (PARSEOP_LOCAL1); }
311 "Local2"                    { count (1); return (PARSEOP_LOCAL2); }
312 "Local3"                    { count (1); return (PARSEOP_LOCAL3); }
313 "Local4"                    { count (1); return (PARSEOP_LOCAL4); }
314 "Local5"                    { count (1); return (PARSEOP_LOCAL5); }
315 "Local6"                    { count (1); return (PARSEOP_LOCAL6); }
316 "Local7"                    { count (1); return (PARSEOP_LOCAL7); }
317 
318 
319  /****************************************************************************
320   *
321   * Resource Descriptor macros
322   *
323   ****************************************************************************/
324 
325 "ResourceTemplate"          { count (1); return (PARSEOP_RESOURCETEMPLATE); }
326 "RawDataBuffer"             { count (1); return (PARSEOP_DATABUFFER); }
327 
328 "DMA"                       { count (1); return (PARSEOP_DMA); }
329 "DWordIO"                   { count (1); return (PARSEOP_DWORDIO); }
330 "DWordMemory"               { count (1); return (PARSEOP_DWORDMEMORY); }
331 "DWordSpace"                { count (1); return (PARSEOP_DWORDSPACE); }
332 "EndDependentFn"            { count (1); return (PARSEOP_ENDDEPENDENTFN); }
333 "ExtendedIO"                { count (1); return (PARSEOP_EXTENDEDIO); }
334 "ExtendedMemory"            { count (1); return (PARSEOP_EXTENDEDMEMORY); }
335 "ExtendedSpace"             { count (1); return (PARSEOP_EXTENDEDSPACE); }
336 "FixedDma"                  { count (1); return (PARSEOP_FIXEDDMA); }
337 "FixedIO"                   { count (1); return (PARSEOP_FIXEDIO); }
338 "GpioInt"                   { count (1); return (PARSEOP_GPIO_INT); }
339 "GpioIo"                    { count (1); return (PARSEOP_GPIO_IO); }
340 "I2cSerialBus"              { count (1); return (PARSEOP_I2C_SERIALBUS); }
341 "I2cSerialBusV2"            { count (1); return (PARSEOP_I2C_SERIALBUS_V2); }
342 "Interrupt"                 { count (1); return (PARSEOP_INTERRUPT); }
343 "IO"                        { count (1); return (PARSEOP_IO); }
344 "IRQ"                       { count (1); return (PARSEOP_IRQ); }
345 "IRQNoFlags"                { count (1); return (PARSEOP_IRQNOFLAGS); }
346 "Memory24"                  { count (1); return (PARSEOP_MEMORY24); }
347 "Memory32"                  { count (1); return (PARSEOP_MEMORY32); }
348 "Memory32Fixed"             { count (1); return (PARSEOP_MEMORY32FIXED); }
349 "QWordIO"                   { count (1); return (PARSEOP_QWORDIO); }
350 "QWordMemory"               { count (1); return (PARSEOP_QWORDMEMORY); }
351 "QWordSpace"                { count (1); return (PARSEOP_QWORDSPACE); }
352 "Register"                  { count (1); return (PARSEOP_REGISTER); }
353 "SpiSerialBus"              { count (1); return (PARSEOP_SPI_SERIALBUS); }
354 "SpiSerialBusV2"            { count (1); return (PARSEOP_SPI_SERIALBUS_V2); }
355 "StartDependentFn"          { count (1); return (PARSEOP_STARTDEPENDENTFN); }
356 "StartDependentFnNoPri"     { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); }
357 "UartSerialBus"             { count (1); return (PARSEOP_UART_SERIALBUS); }
358 "UartSerialBusV2"           { count (1); return (PARSEOP_UART_SERIALBUS_V2); }
359 "VendorLong"                { count (1); return (PARSEOP_VENDORLONG); }
360 "VendorShort"               { count (1); return (PARSEOP_VENDORSHORT); }
361 "WordBusNumber"             { count (1); return (PARSEOP_WORDBUSNUMBER); }
362 "WordIO"                    { count (1); return (PARSEOP_WORDIO); }
363 "WordSpace"                 { count (1); return (PARSEOP_WORDSPACE); }
364 
365 
366  /****************************************************************************
367   *
368   * Keywords used as arguments to ASL operators and macros
369   *
370   ****************************************************************************/
371 
372     /*  AccessAttribKeyword: Serial Bus Attributes (ACPI 5.0) */
373 
374 "AttribQuick"               { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); }
375 "AttribSendReceive"         { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); }
376 "AttribByte"                { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); }
377 "AttribWord"                { count (0); return (PARSEOP_ACCESSATTRIB_WORD); }
378 "AttribBlock"               { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); }
379 "AttribProcessCall"         { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); }
380 "AttribBlockProcessCall"    { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); }
381 
382     /* AccessAttribKeyword: Legacy synonyms for above (pre-ACPI 5.0) */
383 
384 "SMBQuick"                  { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); }
385 "SMBSendReceive"            { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); }
386 "SMBByte"                   { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); }
387 "SMBWord"                   { count (0); return (PARSEOP_ACCESSATTRIB_WORD); }
388 "SMBBlock"                  { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); }
389 "SMBProcessCall"            { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); }
390 "SMBBlockProcessCall"       { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); }
391 
392     /* AccessTypeKeyword: Field Access Types */
393 
394 "AnyAcc"                    { count (0); return (PARSEOP_ACCESSTYPE_ANY); }
395 "ByteAcc"                   { count (0); return (PARSEOP_ACCESSTYPE_BYTE); }
396 "WordAcc"                   { count (0); return (PARSEOP_ACCESSTYPE_WORD); }
397 "DWordAcc"                  { count (0); return (PARSEOP_ACCESSTYPE_DWORD); }
398 "QWordAcc"                  { count (0); return (PARSEOP_ACCESSTYPE_QWORD); }
399 "BufferAcc"                 { count (0); return (PARSEOP_ACCESSTYPE_BUF); }
400 
401     /* AddressingModeKeyword: Mode - Resource Descriptors (ACPI 5.0) */
402 
403 "AddressingMode7Bit"        { count (0); return (PARSEOP_ADDRESSINGMODE_7BIT); }
404 "AddressingMode10Bit"       { count (0); return (PARSEOP_ADDRESSINGMODE_10BIT); }
405 
406     /* AddressKeyword: ACPI memory range types */
407 
408 "AddressRangeMemory"        { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); }
409 "AddressRangeReserved"      { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); }
410 "AddressRangeNVS"           { count (0); return (PARSEOP_ADDRESSTYPE_NVS); }
411 "AddressRangeACPI"          { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); }
412 
413     /* BusMasterKeyword: DMA Bus Mastering */
414 
415 "BusMaster"                 { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); }
416 "NotBusMaster"              { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); }
417 
418     /* ByteLengthKeyword: Bits per Byte - Resource Descriptors (ACPI 5.0) */
419 
420 "DataBitsFive"              { count (0); return (PARSEOP_BITSPERBYTE_FIVE); }
421 "DataBitsSix"               { count (0); return (PARSEOP_BITSPERBYTE_SIX); }
422 "DataBitsSeven"             { count (0); return (PARSEOP_BITSPERBYTE_SEVEN); }
423 "DataBitsEight"             { count (0); return (PARSEOP_BITSPERBYTE_EIGHT); }
424 "DataBitsNine"              { count (0); return (PARSEOP_BITSPERBYTE_NINE); }
425 
426     /* ClockPhaseKeyword: Resource Descriptors (ACPI 5.0) */
427 
428 "ClockPhaseFirst"           { count (0); return (PARSEOP_CLOCKPHASE_FIRST); }
429 "ClockPhaseSecond"          { count (0); return (PARSEOP_CLOCKPHASE_SECOND); }
430 
431     /* ClockPolarityKeyword: Resource Descriptors (ACPI 5.0) */
432 
433 "ClockPolarityLow"          { count (0); return (PARSEOP_CLOCKPOLARITY_LOW); }
434 "ClockPolarityHigh"         { count (0); return (PARSEOP_CLOCKPOLARITY_HIGH); }
435 
436     /* DecodeKeyword: Type of Memory Decoding - Resource Descriptors */
437 
438 "PosDecode"                 { count (0); return (PARSEOP_DECODETYPE_POS); }
439 "SubDecode"                 { count (0); return (PARSEOP_DECODETYPE_SUB); }
440 
441     /* DmaTypeKeyword: DMA Types - DMA Resource Descriptor */
442 
443 "Compatibility"             { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); }
444 "TypeA"                     { count (0); return (PARSEOP_DMATYPE_A); }
445 "TypeB"                     { count (0); return (PARSEOP_DMATYPE_B); }
446 "TypeF"                     { count (0); return (PARSEOP_DMATYPE_F); }
447 
448     /* EndianKeyword: Endian type - Resource Descriptor (ACPI 5.0) */
449 
450 "LittleEndian"              { count (0); return (PARSEOP_ENDIAN_LITTLE); }
451 "BigEndian"                 { count (0); return (PARSEOP_ENDIAN_BIG); }
452 
453     /* ExtendedAttribKeyword: Bus attributes, AccessAs operator (ACPI 5.0) */
454 
455 "AttribBytes"               { count (0); return (PARSEOP_ACCESSATTRIB_MULTIBYTE); }
456 "AttribRawBytes"            { count (0); return (PARSEOP_ACCESSATTRIB_RAW_BYTES); }
457 "AttribRawProcessBytes"     { count (0); return (PARSEOP_ACCESSATTRIB_RAW_PROCESS); }
458 
459     /* FlowControlKeyword: Resource Descriptors (ACPI 5.0) */
460 
461 "FlowControlHardware"       { count (0); return (PARSEOP_FLOWCONTROL_HW); }
462 "FlowControlNone"           { count (0); return (PARSEOP_FLOWCONTROL_NONE); }
463 "FlowControlXon"            { count (0); return (PARSEOP_FLOWCONTROL_SW); }
464 
465     /* InterruptLevelKeyword: Interrupt Active Types */
466 
467 "ActiveBoth"                { count (0); return (PARSEOP_INTLEVEL_ACTIVEBOTH); }
468 "ActiveHigh"                { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); }
469 "ActiveLow"                 { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); }
470 
471     /* InterruptTypeKeyword: Interrupt Types */
472 
473 "Edge"                      { count (0); return (PARSEOP_INTTYPE_EDGE); }
474 "Level"                     { count (0); return (PARSEOP_INTTYPE_LEVEL); }
475 
476     /* IoDecodeKeyword: Type of Memory Decoding - Resource Descriptors */
477 
478 "Decode10"                  { count (0); return (PARSEOP_IODECODETYPE_10); }
479 "Decode16"                  { count (0); return (PARSEOP_IODECODETYPE_16); }
480 
481     /* IoRestrictionKeyword: I/O Restriction - GPIO Resource Descriptors (ACPI 5.0) */
482 
483 "IoRestrictionNone"         { count (0); return (PARSEOP_IORESTRICT_NONE); }
484 "IoRestrictionInputOnly"    { count (0); return (PARSEOP_IORESTRICT_IN); }
485 "IoRestrictionOutputOnly"   { count (0); return (PARSEOP_IORESTRICT_OUT); }
486 "IoRestrictionNoneAndPreserve"   { count (0); return (PARSEOP_IORESTRICT_PRESERVE); }
487 
488     /* LockRuleKeyword: Global Lock use for Field Operator */
489 
490 "Lock"                      { count (0); return (PARSEOP_LOCKRULE_LOCK); }
491 "NoLock"                    { count (0); return (PARSEOP_LOCKRULE_NOLOCK); }
492 
493     /* MatchOpKeyword: Types for Match Operator */
494 
495 "MTR"                       { count (0); return (PARSEOP_MATCHTYPE_MTR); }
496 "MEQ"                       { count (0); return (PARSEOP_MATCHTYPE_MEQ); }
497 "MLE"                       { count (0); return (PARSEOP_MATCHTYPE_MLE); }
498 "MLT"                       { count (0); return (PARSEOP_MATCHTYPE_MLT); }
499 "MGE"                       { count (0); return (PARSEOP_MATCHTYPE_MGE); }
500 "MGT"                       { count (0); return (PARSEOP_MATCHTYPE_MGT); }
501 
502     /* MaxKeyword: Max Range Type - Resource Descriptors */
503 
504 "MaxFixed"                  { count (0); return (PARSEOP_MAXTYPE_FIXED); }
505 "MaxNotFixed"               { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); }
506 
507     /* MemTypeKeyword: Memory Types - Resource Descriptors */
508 
509 "Cacheable"                 { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); }
510 "WriteCombining"            { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); }
511 "Prefetchable"              { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); }
512 "NonCacheable"              { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); }
513 
514     /* MinKeyword: Min Range Type - Resource Descriptors */
515 
516 "MinFixed"                  { count (0); return (PARSEOP_MINTYPE_FIXED); }
517 "MinNotFixed"               { count (0); return (PARSEOP_MINTYPE_NOTFIXED); }
518 
519     /* ObjectTypeKeyword: ACPI Object Types */
520 
521 "UnknownObj"                { count (0); return (PARSEOP_OBJECTTYPE_UNK); }
522 "IntObj"                    { count (0); return (PARSEOP_OBJECTTYPE_INT); }
523 "StrObj"                    { count (0); return (PARSEOP_OBJECTTYPE_STR); }
524 "BuffObj"                   { count (0); return (PARSEOP_OBJECTTYPE_BUF); }
525 "PkgObj"                    { count (0); return (PARSEOP_OBJECTTYPE_PKG); }
526 "FieldUnitObj"              { count (0); return (PARSEOP_OBJECTTYPE_FLD); }
527 "DeviceObj"                 { count (0); return (PARSEOP_OBJECTTYPE_DEV); }
528 "EventObj"                  { count (0); return (PARSEOP_OBJECTTYPE_EVT); }
529 "MethodObj"                 { count (0); return (PARSEOP_OBJECTTYPE_MTH); }
530 "MutexObj"                  { count (0); return (PARSEOP_OBJECTTYPE_MTX); }
531 "OpRegionObj"               { count (0); return (PARSEOP_OBJECTTYPE_OPR); }
532 "PowerResObj"               { count (0); return (PARSEOP_OBJECTTYPE_POW); }
533 "ProcessorObj"              { count (0); return (PARSEOP_OBJECTTYPE_PRO); }
534 "ThermalZoneObj"            { count (0); return (PARSEOP_OBJECTTYPE_THZ); }
535 "BuffFieldObj"              { count (0); return (PARSEOP_OBJECTTYPE_BFF); }
536 "DDBHandleObj"              { count (0); return (PARSEOP_OBJECTTYPE_DDB); }
537 
538     /* ParityKeyword: Resource Descriptors (ACPI 5.0) */
539 
540 "ParityTypeSpace"           { count (0); return (PARSEOP_PARITYTYPE_SPACE); }
541 "ParityTypeMark"            { count (0); return (PARSEOP_PARITYTYPE_MARK); }
542 "ParityTypeOdd"             { count (0); return (PARSEOP_PARITYTYPE_ODD); }
543 "ParityTypeEven"            { count (0); return (PARSEOP_PARITYTYPE_EVEN); }
544 "ParityTypeNone"            { count (0); return (PARSEOP_PARITYTYPE_NONE); }
545 
546     /* PinConfigKeyword: Pin Configuration - GPIO Resource Descriptors (ACPI 5.0) */
547 
548 "PullDefault"               { count (0); return (PARSEOP_PIN_PULLDEFAULT); }
549 "PullUp"                    { count (0); return (PARSEOP_PIN_PULLUP); }
550 "PullDown"                  { count (0); return (PARSEOP_PIN_PULLDOWN); }
551 "PullNone"                  { count (0); return (PARSEOP_PIN_NOPULL); }
552 
553     /* PolarityKeyword: Resource Descriptors (ACPI 5.0) */
554 
555 "PolarityLow"               { count (0); return (PARSEOP_DEVICEPOLARITY_LOW); }
556 "PolarityHigh"              { count (0); return (PARSEOP_DEVICEPOLARITY_HIGH); }
557 
558     /* RangeTypeKeyword: I/O Range Types - Resource Descriptors */
559 
560 "ISAOnlyRanges"             { count (0); return (PARSEOP_RANGETYPE_ISAONLY); }
561 "NonISAOnlyRanges"          { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); }
562 "EntireRange"               { count (0); return (PARSEOP_RANGETYPE_ENTIRE); }
563 
564     /* ReadWriteKeyword: Memory Access Types - Resource Descriptors */
565 
566 "ReadWrite"                 { count (0); return (PARSEOP_READWRITETYPE_BOTH); }
567 "ReadOnly"                  { count (0); return (PARSEOP_READWRITETYPE_READONLY); }
568 
569     /* RegionSpaceKeyword: Operation Region Address Space Types */
570 
571 "SystemIO"                  { count (0); return (PARSEOP_REGIONSPACE_IO); }
572 "SystemMemory"              { count (0); return (PARSEOP_REGIONSPACE_MEM); }
573 "PCI_Config"                { count (0); return (PARSEOP_REGIONSPACE_PCI); }
574 "EmbeddedControl"           { count (0); return (PARSEOP_REGIONSPACE_EC); }
575 "SMBus"                     { count (0); return (PARSEOP_REGIONSPACE_SMBUS); }
576 "SystemCMOS"                { count (0); return (PARSEOP_REGIONSPACE_CMOS); }
577 "PciBarTarget"              { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); }
578 "IPMI"                      { count (0); return (PARSEOP_REGIONSPACE_IPMI); }
579 "GeneralPurposeIo"          { count (0); return (PARSEOP_REGIONSPACE_GPIO); }       /* ACPI 5.0 */
580 "GenericSerialBus"          { count (0); return (PARSEOP_REGIONSPACE_GSBUS); }      /* ACPI 5.0 */
581 "PCC"                       { count (0); return (PARSEOP_REGIONSPACE_PCC); }        /* ACPI 5.0 */
582 "FFixedHW"                  { count (0); return (PARSEOP_REGIONSPACE_FFIXEDHW); }
583 
584     /* ResourceTypeKeyword: Resource Usage - Resource Descriptors */
585 
586 "ResourceConsumer"          { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); }
587 "ResourceProducer"          { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); }
588 
589     /* SerializeRuleKeyword: Control Method Serialization */
590 
591 "Serialized"                { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); }
592 "NotSerialized"             { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); }
593 
594     /* ShareTypeKeyword: Interrupt Sharing - Resource Descriptors */
595 
596 "Shared"                    { count (0); return (PARSEOP_SHARETYPE_SHARED); }
597 "Exclusive"                 { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); }
598 "SharedAndWake"             { count (0); return (PARSEOP_SHARETYPE_SHAREDWAKE); }       /* ACPI 5.0 */
599 "ExclusiveAndWake"          { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVEWAKE); }    /* ACPI 5.0 */
600 
601     /* SlaveModeKeyword: Resource Descriptors (ACPI 5.0) */
602 
603 "ControllerInitiated"       { count (0); return (PARSEOP_SLAVEMODE_CONTROLLERINIT); }
604 "DeviceInitiated"           { count (0); return (PARSEOP_SLAVEMODE_DEVICEINIT); }
605 
606     /* StopBitsKeyword: Resource Descriptors (ACPI 5.0) */
607 
608 "StopBitsOne"               { count (0); return (PARSEOP_STOPBITS_ONE); }
609 "StopBitsOnePlusHalf"       { count (0); return (PARSEOP_STOPBITS_ONEPLUSHALF); }
610 "StopBitsTwo"               { count (0); return (PARSEOP_STOPBITS_TWO); }
611 "StopBitsZero"              { count (0); return (PARSEOP_STOPBITS_ZERO); }
612 
613     /* TransferWidthKeyword: DMA Widths - Fixed DMA Resource Descriptor (ACPI 5.0) */
614 
615 "Width8bit"                 { count (0); return (PARSEOP_XFERSIZE_8); }
616 "Width16bit"                { count (0); return (PARSEOP_XFERSIZE_16); }
617 "Width32bit"                { count (0); return (PARSEOP_XFERSIZE_32); }
618 "Width64bit"                { count (0); return (PARSEOP_XFERSIZE_64); }
619 "Width128bit"               { count (0); return (PARSEOP_XFERSIZE_128); }
620 "Width256bit"               { count (0); return (PARSEOP_XFERSIZE_256); }
621 
622     /* TranslationKeyword: Translation Density Types - Resource Descriptors */
623 
624 "SparseTranslation"         { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); }
625 "DenseTranslation"          { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); }
626 
627     /* TypeKeyword: Translation Types - Resource Descriptors */
628 
629 "TypeTranslation"           { count (0); return (PARSEOP_TYPE_TRANSLATION); }
630 "TypeStatic"                { count (0); return (PARSEOP_TYPE_STATIC); }
631 
632     /* UpdateRuleKeyword: Field Update Rules */
633 
634 "Preserve"                  { count (0); return (PARSEOP_UPDATERULE_PRESERVE); }
635 "WriteAsOnes"               { count (0); return (PARSEOP_UPDATERULE_ONES); }
636 "WriteAsZeros"              { count (0); return (PARSEOP_UPDATERULE_ZEROS); }
637 
638     /* WireModeKeyword: SPI Wire Mode - Resource Descriptors (ACPI 5.0) */
639 
640 "FourWireMode"              { count (0); return (PARSEOP_WIREMODE_FOUR); }
641 "ThreeWireMode"             { count (0); return (PARSEOP_WIREMODE_THREE); }
642 
643     /* XferTypeKeyword: DMA Transfer Types */
644 
645 "Transfer8"                 { count (0); return (PARSEOP_XFERTYPE_8); }
646 "Transfer8_16"              { count (0); return (PARSEOP_XFERTYPE_8_16); }
647 "Transfer16"                { count (0); return (PARSEOP_XFERTYPE_16); }
648 
649     /* ToPld macro */
650 
651 "ToPLD"                     { count (0); return (PARSEOP_TOPLD); }
652 
653 "PLD_Revision"              { count (0); return (PARSEOP_PLD_REVISION); }
654 "PLD_IgnoreColor"           { count (0); return (PARSEOP_PLD_IGNORECOLOR); }
655 "PLD_Red"                   { count (0); return (PARSEOP_PLD_RED); }
656 "PLD_Green"                 { count (0); return (PARSEOP_PLD_GREEN); }
657 "PLD_Blue"                  { count (0); return (PARSEOP_PLD_BLUE); }
658 "PLD_Width"                 { count (0); return (PARSEOP_PLD_WIDTH); }
659 "PLD_Height"                { count (0); return (PARSEOP_PLD_HEIGHT); }
660 "PLD_UserVisible"           { count (0); return (PARSEOP_PLD_USERVISIBLE); }
661 "PLD_Dock"                  { count (0); return (PARSEOP_PLD_DOCK); }
662 "PLD_Lid"                   { count (0); return (PARSEOP_PLD_LID); }
663 "PLD_Panel"                 { count (0); return (PARSEOP_PLD_PANEL); }
664 "PLD_VerticalPosition"      { count (0); return (PARSEOP_PLD_VERTICALPOSITION); }
665 "PLD_HorizontalPosition"    { count (0); return (PARSEOP_PLD_HORIZONTALPOSITION); }
666 "PLD_Shape"                 { count (0); return (PARSEOP_PLD_SHAPE); }
667 "PLD_GroupOrientation"      { count (0); return (PARSEOP_PLD_GROUPORIENTATION); }
668 "PLD_GroupToken"            { count (0); return (PARSEOP_PLD_GROUPTOKEN); }
669 "PLD_GroupPosition"         { count (0); return (PARSEOP_PLD_GROUPPOSITION); }
670 "PLD_Bay"                   { count (0); return (PARSEOP_PLD_BAY); }
671 "PLD_Ejectable"             { count (0); return (PARSEOP_PLD_EJECTABLE); }
672 "PLD_EjectRequired"         { count (0); return (PARSEOP_PLD_EJECTREQUIRED); }
673 "PLD_CabinetNumber"         { count (0); return (PARSEOP_PLD_CABINETNUMBER); }
674 "PLD_CardCageNumber"        { count (0); return (PARSEOP_PLD_CARDCAGENUMBER); }
675 "PLD_Reference"             { count (0); return (PARSEOP_PLD_REFERENCE); }
676 "PLD_Rotation"              { count (0); return (PARSEOP_PLD_ROTATION); }
677 "PLD_Order"                 { count (0); return (PARSEOP_PLD_ORDER); }
678 "PLD_Reserved"              { count (0); return (PARSEOP_PLD_RESERVED); }
679 "PLD_VerticalOffset"        { count (0); return (PARSEOP_PLD_VERTICALOFFSET); }
680 "PLD_HorizontalOffset"      { count (0); return (PARSEOP_PLD_HORIZONTALOFFSET); }
681 
682 
683     /* printf debug macros */
684 
685 "printf"                    { count (0); return (PARSEOP_PRINTF); }
686 "fprintf"                   { count (0); return (PARSEOP_FPRINTF); }
687 
688     /* Other macros */
689 
690 "For"                       { count (0); return (PARSEOP_FOR); }
691 
692     /* Predefined compiler names */
693 
694 "__DATE__"                  { count (0); return (PARSEOP___DATE__); }
695 "__FILE__"                  { count (0); return (PARSEOP___FILE__); }
696 "__LINE__"                  { count (0); return (PARSEOP___LINE__); }
697 "__PATH__"                  { count (0); return (PARSEOP___PATH__); }
698 
699 
700 {NameSeg}                   { char *s;
701                                 count (0);
702                                 s=UtStringCacheCalloc (ACPI_NAME_SIZE + 1);
703                                 if (strcmp (AslCompilertext, "\\"))
704                                 {
705                                     strcpy (s, "____");
706                                     AcpiUtStrupr (AslCompilertext);
707                                 }
708                                 memcpy (s, AslCompilertext, strlen (AslCompilertext));
709                                 AslCompilerlval.s = s;
710                                 DbgPrint (ASL_PARSE_OUTPUT, "NameSeg: %s\n", s);
711                                 return (PARSEOP_NAMESEG); }
712 
713 {NameString}                { char *s;
714                                 count (0);
715                                 s=UtStringCacheCalloc (strlen (AslCompilertext)+1);
716                                 AcpiUtStrupr (AslCompilertext);
717                                 strcpy (s, AslCompilertext);
718                                 AslCompilerlval.s = s;
719                                 DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s);
720                                 return (PARSEOP_NAMESTRING); }
721 
722 .                           { count (1);
723                                 if (isprint ((int) *AslCompilertext))
724                                 {
725                                     sprintf (MsgBuffer,
726                                         "Invalid character (%c), expecting ASL keyword or name",
727                                         *AslCompilertext);
728                                 }
729                                 else
730                                 {
731                                     sprintf (MsgBuffer,
732                                         "Invalid character (0x%2.2X), expecting ASL keyword or name",
733                                         *AslCompilertext);
734                                 }
735                                 AslCompilererror (MsgBuffer);}
736 
737 <<EOF>>                     { if (AslPopInputFileStack ())
738                                 {yyterminate();}
739                               else
740                                 {return (PARSEOP_INCLUDE_END);} };
741 
742 %%
743 
744 /*! [End] no source code translation !*/
745 
746 /*
747  * Bring in the scanner support routines
748  */
749 #include <contrib/dev/acpica/compiler/aslsupport.l>
750