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 - 2020, 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
174static void
175AslDoLineDirective (void);
176
177static BOOLEAN
178AslDoComment (void);
179
180static BOOLEAN
181AslDoCommentType2 (void);
182
183static char
184AslDoStringLiteral (void);
185
186static void
187count (int type);
188
189
190/*! [Begin] no source code translation */
191
192%}
193    /* Definitions */
194
195LeadNameChar                [A-Za-z_]
196DigitChar                   [0-9]
197ErrorCode                   [(][ ]*[1-9][0-9][0-9][0-9][ ]*[)]
198OctalChar                   [0-7]
199HexDigitChar                [A-Fa-f0-9]
200RootChar                    [\\]
201Nothing                     []
202
203NameChar                    [A-Za-z_0-9]
204NameSeg1                    {LeadNameChar}{NameChar}
205NameSeg2                    {LeadNameChar}{NameChar}{NameChar}
206NameSeg3                    {LeadNameChar}{NameChar}{NameChar}{NameChar}
207NameSeg                     {LeadNameChar}|{NameSeg1}|{NameSeg2}|{NameSeg3}
208
209NameString                  {RootChar}|{RootChar}{NamePath}|[\^]+{NamePath}|{NonEmptyNamePath}
210NamePath                    {NonEmptyNamePath}?
211NonEmptyNamePath            {NameSeg}{NamePathTail}*
212NamePathTail                [.]{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]*            { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext);
283                                count (1); 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"DMA"                       { count (1); return (PARSEOP_DMA); }
438"DWordIO"                   { count (1); return (PARSEOP_DWORDIO); }
439"DWordMemory"               { count (1); return (PARSEOP_DWORDMEMORY); }
440"DWordSpace"                { count (1); return (PARSEOP_DWORDSPACE); }
441"EndDependentFn"            { count (1); return (PARSEOP_ENDDEPENDENTFN); }
442"ExtendedIO"                { count (1); return (PARSEOP_EXTENDEDIO); }
443"ExtendedMemory"            { count (1); return (PARSEOP_EXTENDEDMEMORY); }
444"ExtendedSpace"             { count (1); return (PARSEOP_EXTENDEDSPACE); }
445"FixedDma"                  { count (1); return (PARSEOP_FIXEDDMA); }
446"FixedIO"                   { count (1); return (PARSEOP_FIXEDIO); }
447"GpioInt"                   { count (1); return (PARSEOP_GPIO_INT); }
448"GpioIo"                    { count (1); return (PARSEOP_GPIO_IO); }
449"I2cSerialBus"              { count (1); return (PARSEOP_I2C_SERIALBUS); }
450"I2cSerialBusV2"            { count (1); return (PARSEOP_I2C_SERIALBUS_V2); }
451"Interrupt"                 { count (1); return (PARSEOP_INTERRUPT); }
452"IO"                        { count (1); return (PARSEOP_IO); }
453"IRQ"                       { count (1); return (PARSEOP_IRQ); }
454"IRQNoFlags"                { count (1); return (PARSEOP_IRQNOFLAGS); }
455"Memory24"                  { count (1); return (PARSEOP_MEMORY24); }
456"Memory32"                  { count (1); return (PARSEOP_MEMORY32); }
457"Memory32Fixed"             { count (1); return (PARSEOP_MEMORY32FIXED); }
458"PinConfig"                 { count (1); return (PARSEOP_PINCONFIG); }
459"PinFunction"               { count (1); return (PARSEOP_PINFUNCTION); }
460"PinGroup"                  { count (1); return (PARSEOP_PINGROUP); }
461"PinGroupConfig"            { count (1); return (PARSEOP_PINGROUPCONFIG); }
462"PinGroupFunction"          { count (1); return (PARSEOP_PINGROUPFUNCTION); }
463"QWordIO"                   { count (1); return (PARSEOP_QWORDIO); }
464"QWordMemory"               { count (1); return (PARSEOP_QWORDMEMORY); }
465"QWordSpace"                { count (1); return (PARSEOP_QWORDSPACE); }
466"Register"                  { count (1); return (PARSEOP_REGISTER); }
467"SpiSerialBus"              { count (1); return (PARSEOP_SPI_SERIALBUS); }
468"SpiSerialBusV2"            { count (1); return (PARSEOP_SPI_SERIALBUS_V2); }
469"StartDependentFn"          { count (1); return (PARSEOP_STARTDEPENDENTFN); }
470"StartDependentFnNoPri"     { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); }
471"UartSerialBus"             { count (1); return (PARSEOP_UART_SERIALBUS); }
472"UartSerialBusV2"           { count (1); return (PARSEOP_UART_SERIALBUS_V2); }
473"VendorLong"                { count (1); return (PARSEOP_VENDORLONG); }
474"VendorShort"               { count (1); return (PARSEOP_VENDORSHORT); }
475"WordBusNumber"             { count (1); return (PARSEOP_WORDBUSNUMBER); }
476"WordIO"                    { count (1); return (PARSEOP_WORDIO); }
477"WordSpace"                 { count (1); return (PARSEOP_WORDSPACE); }
478
479
480 /****************************************************************************
481  *
482  * Keywords used as arguments to ASL operators and macros
483  *
484  ****************************************************************************/
485
486    /*  AccessAttribKeyword: Serial Bus Attributes (ACPI 5.0) */
487
488"AttribQuick"               { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); }
489"AttribSendReceive"         { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); }
490"AttribByte"                { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); }
491"AttribWord"                { count (0); return (PARSEOP_ACCESSATTRIB_WORD); }
492"AttribBlock"               { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); }
493"AttribProcessCall"         { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); }
494"AttribBlockProcessCall"    { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); }
495
496    /* AccessAttribKeyword: Legacy synonyms for above (pre-ACPI 5.0) */
497
498"SMBQuick"                  { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); }
499"SMBSendReceive"            { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); }
500"SMBByte"                   { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); }
501"SMBWord"                   { count (0); return (PARSEOP_ACCESSATTRIB_WORD); }
502"SMBBlock"                  { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); }
503"SMBProcessCall"            { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); }
504"SMBBlockProcessCall"       { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); }
505
506    /* AccessTypeKeyword: Field Access Types */
507
508"AnyAcc"                    { count (0); return (PARSEOP_ACCESSTYPE_ANY); }
509"ByteAcc"                   { count (0); return (PARSEOP_ACCESSTYPE_BYTE); }
510"WordAcc"                   { count (0); return (PARSEOP_ACCESSTYPE_WORD); }
511"DWordAcc"                  { count (0); return (PARSEOP_ACCESSTYPE_DWORD); }
512"QWordAcc"                  { count (0); return (PARSEOP_ACCESSTYPE_QWORD); }
513"BufferAcc"                 { count (0); return (PARSEOP_ACCESSTYPE_BUF); }
514
515    /* AddressingModeKeyword: Mode - Resource Descriptors (ACPI 5.0) */
516
517"AddressingMode7Bit"        { count (0); return (PARSEOP_ADDRESSINGMODE_7BIT); }
518"AddressingMode10Bit"       { count (0); return (PARSEOP_ADDRESSINGMODE_10BIT); }
519
520    /* AddressKeyword: ACPI memory range types */
521
522"AddressRangeMemory"        { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); }
523"AddressRangeReserved"      { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); }
524"AddressRangeNVS"           { count (0); return (PARSEOP_ADDRESSTYPE_NVS); }
525"AddressRangeACPI"          { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); }
526
527    /* BusMasterKeyword: DMA Bus Mastering */
528
529"BusMaster"                 { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); }
530"NotBusMaster"              { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); }
531
532    /* ByteLengthKeyword: Bits per Byte - Resource Descriptors (ACPI 5.0) */
533
534"DataBitsFive"              { count (0); return (PARSEOP_BITSPERBYTE_FIVE); }
535"DataBitsSix"               { count (0); return (PARSEOP_BITSPERBYTE_SIX); }
536"DataBitsSeven"             { count (0); return (PARSEOP_BITSPERBYTE_SEVEN); }
537"DataBitsEight"             { count (0); return (PARSEOP_BITSPERBYTE_EIGHT); }
538"DataBitsNine"              { count (0); return (PARSEOP_BITSPERBYTE_NINE); }
539
540    /* ClockPhaseKeyword: Resource Descriptors (ACPI 5.0) */
541
542"ClockPhaseFirst"           { count (0); return (PARSEOP_CLOCKPHASE_FIRST); }
543"ClockPhaseSecond"          { count (0); return (PARSEOP_CLOCKPHASE_SECOND); }
544
545    /* ClockPolarityKeyword: Resource Descriptors (ACPI 5.0) */
546
547"ClockPolarityLow"          { count (0); return (PARSEOP_CLOCKPOLARITY_LOW); }
548"ClockPolarityHigh"         { count (0); return (PARSEOP_CLOCKPOLARITY_HIGH); }
549
550    /* DecodeKeyword: Type of Memory Decoding - Resource Descriptors */
551
552"PosDecode"                 { count (0); return (PARSEOP_DECODETYPE_POS); }
553"SubDecode"                 { count (0); return (PARSEOP_DECODETYPE_SUB); }
554
555    /* DmaTypeKeyword: DMA Types - DMA Resource Descriptor */
556
557"Compatibility"             { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); }
558"TypeA"                     { count (0); return (PARSEOP_DMATYPE_A); }
559"TypeB"                     { count (0); return (PARSEOP_DMATYPE_B); }
560"TypeF"                     { count (0); return (PARSEOP_DMATYPE_F); }
561
562    /* EndianKeyword: Endian type - Resource Descriptor (ACPI 5.0) */
563
564"LittleEndian"              { count (0); return (PARSEOP_ENDIAN_LITTLE); }
565"BigEndian"                 { count (0); return (PARSEOP_ENDIAN_BIG); }
566
567    /* ExtendedAttribKeyword: Bus attributes, AccessAs operator (ACPI 5.0) */
568
569"AttribBytes"               { count (0); return (PARSEOP_ACCESSATTRIB_BYTES); }
570"AttribRawBytes"            { count (0); return (PARSEOP_ACCESSATTRIB_RAW_BYTES); }
571"AttribRawProcessBytes"     { count (0); return (PARSEOP_ACCESSATTRIB_RAW_PROCESS); }
572
573    /* FlowControlKeyword: Resource Descriptors (ACPI 5.0) */
574
575"FlowControlHardware"       { count (0); return (PARSEOP_FLOWCONTROL_HW); }
576"FlowControlNone"           { count (0); return (PARSEOP_FLOWCONTROL_NONE); }
577"FlowControlXon"            { count (0); return (PARSEOP_FLOWCONTROL_SW); }
578
579    /* InterruptLevelKeyword: Interrupt Active Types */
580
581"ActiveBoth"                { count (0); return (PARSEOP_INTLEVEL_ACTIVEBOTH); }
582"ActiveHigh"                { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); }
583"ActiveLow"                 { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); }
584
585    /* InterruptTypeKeyword: Interrupt Types */
586
587"Edge"                      { count (0); return (PARSEOP_INTTYPE_EDGE); }
588"Level"                     { count (0); return (PARSEOP_INTTYPE_LEVEL); }
589
590    /* IoDecodeKeyword: Type of Memory Decoding - Resource Descriptors */
591
592"Decode10"                  { count (0); return (PARSEOP_IODECODETYPE_10); }
593"Decode16"                  { count (0); return (PARSEOP_IODECODETYPE_16); }
594
595    /* IoRestrictionKeyword: I/O Restriction - GPIO Resource Descriptors (ACPI 5.0) */
596
597"IoRestrictionNone"         { count (0); return (PARSEOP_IORESTRICT_NONE); }
598"IoRestrictionInputOnly"    { count (0); return (PARSEOP_IORESTRICT_IN); }
599"IoRestrictionOutputOnly"   { count (0); return (PARSEOP_IORESTRICT_OUT); }
600"IoRestrictionNoneAndPreserve"   { count (0); return (PARSEOP_IORESTRICT_PRESERVE); }
601
602    /* LockRuleKeyword: Global Lock use for Field Operator */
603
604"Lock"                      { count (0); return (PARSEOP_LOCKRULE_LOCK); }
605"NoLock"                    { count (0); return (PARSEOP_LOCKRULE_NOLOCK); }
606
607    /* MatchOpKeyword: Types for Match Operator */
608
609"MTR"                       { count (0); return (PARSEOP_MATCHTYPE_MTR); }
610"MEQ"                       { count (0); return (PARSEOP_MATCHTYPE_MEQ); }
611"MLE"                       { count (0); return (PARSEOP_MATCHTYPE_MLE); }
612"MLT"                       { count (0); return (PARSEOP_MATCHTYPE_MLT); }
613"MGE"                       { count (0); return (PARSEOP_MATCHTYPE_MGE); }
614"MGT"                       { count (0); return (PARSEOP_MATCHTYPE_MGT); }
615
616    /* MaxKeyword: Max Range Type - Resource Descriptors */
617
618"MaxFixed"                  { count (0); return (PARSEOP_MAXTYPE_FIXED); }
619"MaxNotFixed"               { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); }
620
621    /* MemTypeKeyword: Memory Types - Resource Descriptors */
622
623"Cacheable"                 { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); }
624"WriteCombining"            { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); }
625"Prefetchable"              { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); }
626"NonCacheable"              { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); }
627
628    /* MinKeyword: Min Range Type - Resource Descriptors */
629
630"MinFixed"                  { count (0); return (PARSEOP_MINTYPE_FIXED); }
631"MinNotFixed"               { count (0); return (PARSEOP_MINTYPE_NOTFIXED); }
632
633    /* ObjectTypeKeyword: ACPI Object Types */
634
635"UnknownObj"                { count (0); return (PARSEOP_OBJECTTYPE_UNK); }
636"IntObj"                    { count (0); return (PARSEOP_OBJECTTYPE_INT); }
637"StrObj"                    { count (0); return (PARSEOP_OBJECTTYPE_STR); }
638"BuffObj"                   { count (0); return (PARSEOP_OBJECTTYPE_BUF); }
639"PkgObj"                    { count (0); return (PARSEOP_OBJECTTYPE_PKG); }
640"FieldUnitObj"              { count (0); return (PARSEOP_OBJECTTYPE_FLD); }
641"DeviceObj"                 { count (0); return (PARSEOP_OBJECTTYPE_DEV); }
642"EventObj"                  { count (0); return (PARSEOP_OBJECTTYPE_EVT); }
643"MethodObj"                 { count (0); return (PARSEOP_OBJECTTYPE_MTH); }
644"MutexObj"                  { count (0); return (PARSEOP_OBJECTTYPE_MTX); }
645"OpRegionObj"               { count (0); return (PARSEOP_OBJECTTYPE_OPR); }
646"PowerResObj"               { count (0); return (PARSEOP_OBJECTTYPE_POW); }
647"ProcessorObj"              { count (0); return (PARSEOP_OBJECTTYPE_PRO); }
648"ThermalZoneObj"            { count (0); return (PARSEOP_OBJECTTYPE_THZ); }
649"BuffFieldObj"              { count (0); return (PARSEOP_OBJECTTYPE_BFF); }
650"DDBHandleObj"              { count (0); return (PARSEOP_OBJECTTYPE_DDB); }
651
652    /* ParityKeyword: Resource Descriptors (ACPI 5.0) */
653
654"ParityTypeSpace"           { count (0); return (PARSEOP_PARITYTYPE_SPACE); }
655"ParityTypeMark"            { count (0); return (PARSEOP_PARITYTYPE_MARK); }
656"ParityTypeOdd"             { count (0); return (PARSEOP_PARITYTYPE_ODD); }
657"ParityTypeEven"            { count (0); return (PARSEOP_PARITYTYPE_EVEN); }
658"ParityTypeNone"            { count (0); return (PARSEOP_PARITYTYPE_NONE); }
659
660    /* PinConfigKeyword: Pin Configuration - GPIO Resource Descriptors (ACPI 5.0) */
661
662"PullDefault"               { count (0); return (PARSEOP_PIN_PULLDEFAULT); }
663"PullUp"                    { count (0); return (PARSEOP_PIN_PULLUP); }
664"PullDown"                  { count (0); return (PARSEOP_PIN_PULLDOWN); }
665"PullNone"                  { count (0); return (PARSEOP_PIN_NOPULL); }
666
667    /* PolarityKeyword: Resource Descriptors (ACPI 5.0) */
668
669"PolarityLow"               { count (0); return (PARSEOP_DEVICEPOLARITY_LOW); }
670"PolarityHigh"              { count (0); return (PARSEOP_DEVICEPOLARITY_HIGH); }
671
672    /* RangeTypeKeyword: I/O Range Types - Resource Descriptors */
673
674"ISAOnlyRanges"             { count (0); return (PARSEOP_RANGETYPE_ISAONLY); }
675"NonISAOnlyRanges"          { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); }
676"EntireRange"               { count (0); return (PARSEOP_RANGETYPE_ENTIRE); }
677
678    /* ReadWriteKeyword: Memory Access Types - Resource Descriptors */
679
680"ReadWrite"                 { count (0); return (PARSEOP_READWRITETYPE_BOTH); }
681"ReadOnly"                  { count (0); return (PARSEOP_READWRITETYPE_READONLY); }
682
683    /* RegionSpaceKeyword: Operation Region Address Space Types */
684
685"SystemIO"                  { count (0); return (PARSEOP_REGIONSPACE_IO); }
686"SystemMemory"              { count (0); return (PARSEOP_REGIONSPACE_MEM); }
687"PCI_Config"                { count (0); return (PARSEOP_REGIONSPACE_PCI); }
688"EmbeddedControl"           { count (0); return (PARSEOP_REGIONSPACE_EC); }
689"SMBus"                     { count (0); return (PARSEOP_REGIONSPACE_SMBUS); }
690"SystemCMOS"                { count (0); return (PARSEOP_REGIONSPACE_CMOS); }
691"PciBarTarget"              { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); }
692"IPMI"                      { count (0); return (PARSEOP_REGIONSPACE_IPMI); }
693"GeneralPurposeIo"          { count (0); return (PARSEOP_REGIONSPACE_GPIO); }       /* ACPI 5.0 */
694"GenericSerialBus"          { count (0); return (PARSEOP_REGIONSPACE_GSBUS); }      /* ACPI 5.0 */
695"PCC"                       { count (0); return (PARSEOP_REGIONSPACE_PCC); }        /* ACPI 5.0 */
696"FFixedHW"                  { count (0); return (PARSEOP_REGIONSPACE_FFIXEDHW); }
697
698    /* ResourceTypeKeyword: Resource Usage - Resource Descriptors */
699
700"ResourceConsumer"          { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); }
701"ResourceProducer"          { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); }
702
703    /* SerializeRuleKeyword: Control Method Serialization */
704
705"Serialized"                { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); }
706"NotSerialized"             { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); }
707
708    /* ShareTypeKeyword: Interrupt Sharing - Resource Descriptors */
709
710"Shared"                    { count (0); return (PARSEOP_SHARETYPE_SHARED); }
711"Exclusive"                 { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); }
712"SharedAndWake"             { count (0); return (PARSEOP_SHARETYPE_SHAREDWAKE); }       /* ACPI 5.0 */
713"ExclusiveAndWake"          { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVEWAKE); }    /* ACPI 5.0 */
714
715    /* SlaveModeKeyword: Resource Descriptors (ACPI 5.0) */
716
717"ControllerInitiated"       { count (0); return (PARSEOP_SLAVEMODE_CONTROLLERINIT); }
718"DeviceInitiated"           { count (0); return (PARSEOP_SLAVEMODE_DEVICEINIT); }
719
720    /* StopBitsKeyword: Resource Descriptors (ACPI 5.0) */
721
722"StopBitsOne"               { count (0); return (PARSEOP_STOPBITS_ONE); }
723"StopBitsOnePlusHalf"       { count (0); return (PARSEOP_STOPBITS_ONEPLUSHALF); }
724"StopBitsTwo"               { count (0); return (PARSEOP_STOPBITS_TWO); }
725"StopBitsZero"              { count (0); return (PARSEOP_STOPBITS_ZERO); }
726
727    /* TransferWidthKeyword: DMA Widths - Fixed DMA Resource Descriptor (ACPI 5.0) */
728
729"Width8bit"                 { count (0); return (PARSEOP_XFERSIZE_8); }
730"Width16bit"                { count (0); return (PARSEOP_XFERSIZE_16); }
731"Width32bit"                { count (0); return (PARSEOP_XFERSIZE_32); }
732"Width64bit"                { count (0); return (PARSEOP_XFERSIZE_64); }
733"Width128bit"               { count (0); return (PARSEOP_XFERSIZE_128); }
734"Width256bit"               { count (0); return (PARSEOP_XFERSIZE_256); }
735
736    /* TranslationKeyword: Translation Density Types - Resource Descriptors */
737
738"SparseTranslation"         { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); }
739"DenseTranslation"          { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); }
740
741    /* TypeKeyword: Translation Types - Resource Descriptors */
742
743"TypeTranslation"           { count (0); return (PARSEOP_TYPE_TRANSLATION); }
744"TypeStatic"                { count (0); return (PARSEOP_TYPE_STATIC); }
745
746    /* UpdateRuleKeyword: Field Update Rules */
747
748"Preserve"                  { count (0); return (PARSEOP_UPDATERULE_PRESERVE); }
749"WriteAsOnes"               { count (0); return (PARSEOP_UPDATERULE_ONES); }
750"WriteAsZeros"              { count (0); return (PARSEOP_UPDATERULE_ZEROS); }
751
752    /* WireModeKeyword: SPI Wire Mode - Resource Descriptors (ACPI 5.0) */
753
754"FourWireMode"              { count (0); return (PARSEOP_WIREMODE_FOUR); }
755"ThreeWireMode"             { count (0); return (PARSEOP_WIREMODE_THREE); }
756
757    /* XferTypeKeyword: DMA Transfer Types */
758
759"Transfer8"                 { count (0); return (PARSEOP_XFERTYPE_8); }
760"Transfer8_16"              { count (0); return (PARSEOP_XFERTYPE_8_16); }
761"Transfer16"                { count (0); return (PARSEOP_XFERTYPE_16); }
762
763    /* ToPld macro */
764
765"ToPLD"                     { count (0); return (PARSEOP_TOPLD); }
766
767"PLD_Revision"              { count (0); return (PARSEOP_PLD_REVISION); }
768"PLD_IgnoreColor"           { count (0); return (PARSEOP_PLD_IGNORECOLOR); }
769"PLD_Red"                   { count (0); return (PARSEOP_PLD_RED); }
770"PLD_Green"                 { count (0); return (PARSEOP_PLD_GREEN); }
771"PLD_Blue"                  { count (0); return (PARSEOP_PLD_BLUE); }
772"PLD_Width"                 { count (0); return (PARSEOP_PLD_WIDTH); }
773"PLD_Height"                { count (0); return (PARSEOP_PLD_HEIGHT); }
774"PLD_UserVisible"           { count (0); return (PARSEOP_PLD_USERVISIBLE); }
775"PLD_Dock"                  { count (0); return (PARSEOP_PLD_DOCK); }
776"PLD_Lid"                   { count (0); return (PARSEOP_PLD_LID); }
777"PLD_Panel"                 { count (0); return (PARSEOP_PLD_PANEL); }
778"PLD_VerticalPosition"      { count (0); return (PARSEOP_PLD_VERTICALPOSITION); }
779"PLD_HorizontalPosition"    { count (0); return (PARSEOP_PLD_HORIZONTALPOSITION); }
780"PLD_Shape"                 { count (0); return (PARSEOP_PLD_SHAPE); }
781"PLD_GroupOrientation"      { count (0); return (PARSEOP_PLD_GROUPORIENTATION); }
782"PLD_GroupToken"            { count (0); return (PARSEOP_PLD_GROUPTOKEN); }
783"PLD_GroupPosition"         { count (0); return (PARSEOP_PLD_GROUPPOSITION); }
784"PLD_Bay"                   { count (0); return (PARSEOP_PLD_BAY); }
785"PLD_Ejectable"             { count (0); return (PARSEOP_PLD_EJECTABLE); }
786"PLD_EjectRequired"         { count (0); return (PARSEOP_PLD_EJECTREQUIRED); }
787"PLD_CabinetNumber"         { count (0); return (PARSEOP_PLD_CABINETNUMBER); }
788"PLD_CardCageNumber"        { count (0); return (PARSEOP_PLD_CARDCAGENUMBER); }
789"PLD_Reference"             { count (0); return (PARSEOP_PLD_REFERENCE); }
790"PLD_Rotation"              { count (0); return (PARSEOP_PLD_ROTATION); }
791"PLD_Order"                 { count (0); return (PARSEOP_PLD_ORDER); }
792"PLD_Reserved"              { count (0); return (PARSEOP_PLD_RESERVED); }
793"PLD_VerticalOffset"        { count (0); return (PARSEOP_PLD_VERTICALOFFSET); }
794"PLD_HorizontalOffset"      { count (0); return (PARSEOP_PLD_HORIZONTALOFFSET); }
795
796
797    /* printf debug macros */
798
799"printf"                    { count (0); return (PARSEOP_PRINTF); }
800"fprintf"                   { count (0); return (PARSEOP_FPRINTF); }
801
802    /* Other macros */
803
804"For"                       { count (0); return (PARSEOP_FOR); }
805
806    /* Predefined compiler names */
807
808"__DATE__"                  { count (0); return (PARSEOP___DATE__); }
809"__FILE__"                  { count (0); return (PARSEOP___FILE__); }
810"__LINE__"                  { count (0); return (PARSEOP___LINE__); }
811"__PATH__"                  { count (0); return (PARSEOP___PATH__); }
812"__METHOD__"                { count (0); return (PARSEOP___METHOD__); }
813"__EXPECT__"{ErrorCode}     { char *s;
814                                int index = 0;
815                                count (0);
816                                while (!isdigit (AslCompilertext[index]))
817                                {
818                                    index++;
819                                }
820
821                                /*
822                                 * The error code is contained inside the
823                                 * {ErrorCode} pattern. Extract it and log it
824                                 * as the expected error code.
825                                 */
826                                s = UtLocalCacheCalloc (ASL_ERROR_CODE_LENGTH + 1);
827                                memcpy (s, AslCompilertext + index, ASL_ERROR_CODE_LENGTH);
828                                AslLogExpectedExceptionByLine (s); }
829
830{NameSeg}                   { char *s;
831                                count (0);
832                                s=UtLocalCacheCalloc (ACPI_NAMESEG_SIZE + 1);
833                                if (strcmp (AslCompilertext, "\\"))
834                                {
835                                    /*
836                                     * According to the ACPI specification,
837                                     * NameSegments must have length of 4. If
838                                     * the NameSegment has length less than 4,
839                                     * they are padded with underscores to meet
840                                     * the required length.
841                                     */
842                                    strcpy (s, "____");
843                                    AcpiUtStrupr (AslCompilertext);
844                                }
845                                memcpy (s, AslCompilertext, strlen (AslCompilertext));
846                                AslCompilerlval.s = s;
847                                DbgPrint (ASL_PARSE_OUTPUT, "NameSeg: %s\n", s);
848                                return (PARSEOP_NAMESEG); }
849
850{NameString}                { char *s;
851                                count (0);
852                                s=UtLocalCacheCalloc (strlen (AslCompilertext)+1);
853                                AcpiUtStrupr (AslCompilertext);
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