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