OSDN Git Service

klibc基本機能実装. ACPICAの準備
[vaneos/DivergeMirror.git] / drivers / acpi / compiler / aslrules.y
1 NoEcho('
2 /******************************************************************************
3  *
4  * Module Name: aslrules.y - Bison/Yacc production rules
5  *
6  *****************************************************************************/
7
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2015, 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 ')
118
119 /*******************************************************************************
120  *
121  * Production rules start here
122  *
123  ******************************************************************************/
124
125 /*
126  * ASL Names
127  *
128  * Root rule. Allow multiple #line directives before the definition block
129  * to handle output from preprocessors
130  */
131 ASLCode
132     : DefinitionBlockTerm
133     | error                         {YYABORT; $$ = NULL;}
134     ;
135
136 /*
137  * Blocks, Data, and Opcodes
138  */
139
140 /*
141  * Note concerning support for "module-level code".
142  *
143  * ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control
144  * methods (the so-called module-level code.) This support was explicitly
145  * removed in ACPI 2.0, but this type of code continues to be created by
146  * BIOS vendors. In order to support the disassembly and recompilation of
147  * such code (and the porting of ASL code to iASL), iASL supports this
148  * code in violation of the current ACPI specification.
149  *
150  * The grammar change to support module-level code is to revert the
151  * {ObjectList} portion of the DefinitionBlockTerm in ACPI 2.0 to the
152  * original use of {TermList} instead (see below.) This allows the use
153  * of Type1 and Type2 opcodes at module level.
154  */
155 DefinitionBlockTerm
156     : PARSEOP_DEFINITIONBLOCK '('   {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
157         String ','
158         String ','
159         ByteConst ','
160         String ','
161         String ','
162         DWordConst
163         ')'                         {TrSetEndLineNumber ($<n>3);}
164             '{' TermList '}'        {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);}
165     ;
166
167     /*
168      * ASL Extensions: C-style math/logical operators and expressions.
169      * The implementation transforms these operators into the standard
170      * AML opcodes and syntax.
171      *
172      * Supported operators and precedence rules (high-to-low)
173      *
174      * NOTE: The operator precedence and associativity rules are
175      * implemented by the tokens in asltokens.y
176      *
177      * (left-to-right):
178      *  1)      ( ) expr++ expr--
179      *
180      * (right-to-left):
181      *  2)      ! ~
182      *
183      * (left-to-right):
184      *  3)      *   /   %
185      *  4)      +   -
186      *  5)      >>  <<
187      *  6)      <   >   <=  >=
188      *  7)      ==  !=
189      *  8)      &
190      *  9)      ^
191      *  10)     |
192      *  11)     &&
193      *  12)     ||
194      *
195      * (right-to-left):
196      *  13)     = += -= *= /= %= <<= >>= &= ^= |=
197      */
198 Expression
199
200     /* Unary operators */
201
202     : PARSEOP_EXP_LOGICAL_NOT           {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);}
203         TermArg                         {$$ = TrLinkChildren ($<n>2,1,$3);}
204     | PARSEOP_EXP_NOT                   {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);}
205         TermArg                         {$$ = TrLinkChildren ($<n>2,2,$3,TrCreateNullTarget ());}
206
207     | SuperName PARSEOP_EXP_INCREMENT   {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
208                                         {$$ = TrLinkChildren ($<n>3,1,$1);}
209     | SuperName PARSEOP_EXP_DECREMENT   {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
210                                         {$$ = TrLinkChildren ($<n>3,1,$1);}
211
212     /* Binary operators: math and logical */
213
214     | TermArg PARSEOP_EXP_ADD           {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
215         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
216     | TermArg PARSEOP_EXP_DIVIDE        {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
217         TermArg                         {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateNullTarget (),
218                                             TrCreateNullTarget ());}
219     | TermArg PARSEOP_EXP_MODULO        {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
220         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
221     | TermArg PARSEOP_EXP_MULTIPLY      {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
222         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
223     | TermArg PARSEOP_EXP_SHIFT_LEFT    {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
224         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
225     | TermArg PARSEOP_EXP_SHIFT_RIGHT   {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
226         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
227     | TermArg PARSEOP_EXP_SUBTRACT      {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
228         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
229
230     | TermArg PARSEOP_EXP_AND           {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
231         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
232     | TermArg PARSEOP_EXP_OR            {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
233         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
234     | TermArg PARSEOP_EXP_XOR           {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
235         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
236
237     | TermArg PARSEOP_EXP_GREATER       {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
238         TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
239     | TermArg PARSEOP_EXP_GREATER_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATEREQUAL);}
240         TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
241     | TermArg PARSEOP_EXP_LESS          {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
242         TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
243     | TermArg PARSEOP_EXP_LESS_EQUAL    {$<n>$ = TrCreateLeafNode (PARSEOP_LLESSEQUAL);}
244         TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
245
246     | TermArg PARSEOP_EXP_EQUAL         {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
247         TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
248     | TermArg PARSEOP_EXP_NOT_EQUAL     {$<n>$ = TrCreateLeafNode (PARSEOP_LNOTEQUAL);}
249         TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
250
251     | TermArg PARSEOP_EXP_LOGICAL_AND   {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);}
252         TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
253     | TermArg PARSEOP_EXP_LOGICAL_OR    {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);}
254         TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
255
256       /* Parentheses */
257
258     | '(' TermArg ')'                   { $$ = $2;}
259     ;
260
261 EqualsTerm
262
263     /* All assignment-type operations */
264
265     : SuperName PARSEOP_EXP_EQUALS
266         TermArg                         {$$ = TrCreateAssignmentNode ($1, $3);}
267
268     | TermArg PARSEOP_EXP_ADD_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
269         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
270                                             TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
271
272     | TermArg PARSEOP_EXP_DIV_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
273         TermArg                         {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateNullTarget (),
274                                             TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
275
276     | TermArg PARSEOP_EXP_MOD_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
277         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
278                                             TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
279
280     | TermArg PARSEOP_EXP_MUL_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
281         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
282                                             TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
283
284     | TermArg PARSEOP_EXP_SHL_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
285         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
286                                             TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
287
288     | TermArg PARSEOP_EXP_SHR_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
289         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
290                                             TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
291
292     | TermArg PARSEOP_EXP_SUB_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
293         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
294                                             TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
295
296     | TermArg PARSEOP_EXP_AND_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
297         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
298                                             TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
299
300     | TermArg PARSEOP_EXP_OR_EQ         {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
301         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
302                                             TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
303
304     | TermArg PARSEOP_EXP_XOR_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
305         TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
306                                             TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
307     ;
308
309
310 /* ACPI 3.0 -- allow semicolons between terms */
311
312 TermList
313     :                               {$$ = NULL;}
314     | TermList Term                 {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
315     | TermList Term ';'             {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
316     | TermList ';' Term             {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
317     | TermList ';' Term ';'         {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
318     ;
319
320 Term
321     : Object                        {}
322     | Type1Opcode                   {}
323     | Type2Opcode                   {}
324     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
325     | Type2StringOpcode             {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
326     | Type2BufferOpcode             {}
327     | Type2BufferOrStringOpcode     {}
328     | error                         {$$ = AslDoError(); yyclearin;}
329     ;
330
331 CompilerDirective
332     : IncludeTerm                   {}
333     | ExternalTerm                  {}
334     ;
335
336 ObjectList
337     :                               {$$ = NULL;}
338     | ObjectList Object             {$$ = TrLinkPeerNode ($1,$2);}
339     | error                         {$$ = AslDoError(); yyclearin;}
340     ;
341
342 Object
343     : CompilerDirective             {}
344     | NamedObject                   {}
345     | NameSpaceModifier             {}
346     ;
347
348 DataObject
349     : BufferData                    {}
350     | PackageData                   {}
351     | IntegerData                   {}
352     | StringData                    {}
353     ;
354
355 BufferData
356     : Type5Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
357     | Type2BufferOrStringOpcode     {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
358     | Type2BufferOpcode             {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
359     | BufferTerm                    {}
360     ;
361
362 PackageData
363     : PackageTerm                   {}
364     ;
365
366 IntegerData
367     : Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
368     | Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
369     | Integer                       {}
370     | ConstTerm                     {}
371     ;
372
373 StringData
374     : Type2StringOpcode             {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
375     | String                        {}
376     ;
377
378 NamedObject
379     : BankFieldTerm                 {}
380     | CreateBitFieldTerm            {}
381     | CreateByteFieldTerm           {}
382     | CreateDWordFieldTerm          {}
383     | CreateFieldTerm               {}
384     | CreateQWordFieldTerm          {}
385     | CreateWordFieldTerm           {}
386     | DataRegionTerm                {}
387     | DeviceTerm                    {}
388     | EventTerm                     {}
389     | FieldTerm                     {}
390     | FunctionTerm                  {}
391     | IndexFieldTerm                {}
392     | MethodTerm                    {}
393     | MutexTerm                     {}
394     | OpRegionTerm                  {}
395     | PowerResTerm                  {}
396     | ProcessorTerm                 {}
397     | ThermalZoneTerm               {}
398     ;
399
400 NameSpaceModifier
401     : AliasTerm                     {}
402     | NameTerm                      {}
403     | ScopeTerm                     {}
404     ;
405
406 MethodInvocationTerm
407     : NameString '('                {TrUpdateNode (PARSEOP_METHODCALL, $1);}
408         ArgList ')'                 {$$ = TrLinkChildNode ($1,$4);}
409     ;
410
411 ArgList
412     :                               {$$ = NULL;}
413     | TermArg
414     | ArgList ','                   /* Allows a trailing comma at list end */
415     | ArgList ','
416         TermArg                     {$$ = TrLinkPeerNode ($1,$3);}
417     ;
418
419 /*
420 Removed from TermArg due to reduce/reduce conflicts
421     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
422     | Type2StringOpcode             {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
423     | Type2BufferOpcode             {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
424     | Type2BufferOrStringOpcode     {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
425
426 */
427
428 TermArg
429     : Type2Opcode                   {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
430     | DataObject                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
431     | NameString                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
432     | ArgTerm                       {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
433     | LocalTerm                     {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
434     ;
435
436 Target
437     :                               {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */
438     | ','                           {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */
439     | ',' SuperName                 {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
440     ;
441
442 RequiredTarget
443     : ',' SuperName                 {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
444     ;
445
446 SimpleTarget
447     : NameString                    {}
448     | LocalTerm                     {}
449     | ArgTerm                       {}
450     ;
451
452 /* Rules for specifying the type of one method argument or return value */
453
454 ParameterTypePackage
455     :                               {$$ = NULL;}
456     | ObjectTypeKeyword             {$$ = $1;}
457     | ParameterTypePackage ','
458         ObjectTypeKeyword           {$$ = TrLinkPeerNodes (2,$1,$3);}
459     ;
460
461 ParameterTypePackageList
462     :                               {$$ = NULL;}
463     | ObjectTypeKeyword             {$$ = $1;}
464     | '{' ParameterTypePackage '}'  {$$ = $2;}
465     ;
466
467 OptionalParameterTypePackage
468     :                               {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
469     | ',' ParameterTypePackageList  {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
470     ;
471
472 /* Rules for specifying the types for method arguments */
473
474 ParameterTypesPackage
475     : ParameterTypePackageList      {$$ = $1;}
476     | ParameterTypesPackage ','
477         ParameterTypePackageList    {$$ = TrLinkPeerNodes (2,$1,$3);}
478     ;
479
480 ParameterTypesPackageList
481     :                               {$$ = NULL;}
482     | ObjectTypeKeyword             {$$ = $1;}
483     | '{' ParameterTypesPackage '}' {$$ = $2;}
484     ;
485
486 OptionalParameterTypesPackage
487     :                               {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
488     | ',' ParameterTypesPackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
489     ;
490
491
492 /* Opcode types */
493
494 Type1Opcode
495     : BreakTerm                     {}
496     | BreakPointTerm                {}
497     | ContinueTerm                  {}
498     | FatalTerm                     {}
499     | IfElseTerm                    {}
500     | LoadTerm                      {}
501     | NoOpTerm                      {}
502     | NotifyTerm                    {}
503     | ReleaseTerm                   {}
504     | ResetTerm                     {}
505     | ReturnTerm                    {}
506     | SignalTerm                    {}
507     | SleepTerm                     {}
508     | StallTerm                     {}
509     | SwitchTerm                    {}
510     | UnloadTerm                    {}
511     | WhileTerm                     {}
512     ;
513
514 Type2Opcode
515     : AcquireTerm                   {}
516     | CondRefOfTerm                 {}
517     | CopyObjectTerm                {}
518     | DerefOfTerm                   {}
519     | ObjectTypeTerm                {}
520     | RefOfTerm                     {}
521     | SizeOfTerm                    {}
522     | StoreTerm                     {}
523     | EqualsTerm                    {}
524     | TimerTerm                     {}
525     | WaitTerm                      {}
526     | MethodInvocationTerm          {}
527     ;
528
529 /*
530  * Type 3/4/5 opcodes
531  */
532
533 Type2IntegerOpcode                  /* "Type3" opcodes */
534     : Expression                    {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
535     | AddTerm                       {}
536     | AndTerm                       {}
537     | DecTerm                       {}
538     | DivideTerm                    {}
539     | FindSetLeftBitTerm            {}
540     | FindSetRightBitTerm           {}
541     | FromBCDTerm                   {}
542     | IncTerm                       {}
543     | IndexTerm                     {}
544     | LAndTerm                      {}
545     | LEqualTerm                    {}
546     | LGreaterTerm                  {}
547     | LGreaterEqualTerm             {}
548     | LLessTerm                     {}
549     | LLessEqualTerm                {}
550     | LNotTerm                      {}
551     | LNotEqualTerm                 {}
552     | LoadTableTerm                 {}
553     | LOrTerm                       {}
554     | MatchTerm                     {}
555     | ModTerm                       {}
556     | MultiplyTerm                  {}
557     | NAndTerm                      {}
558     | NOrTerm                       {}
559     | NotTerm                       {}
560     | OrTerm                        {}
561     | ShiftLeftTerm                 {}
562     | ShiftRightTerm                {}
563     | SubtractTerm                  {}
564     | ToBCDTerm                     {}
565     | ToIntegerTerm                 {}
566     | XOrTerm                       {}
567     ;
568
569 Type2StringOpcode                   /* "Type4" Opcodes */
570     : ToDecimalStringTerm           {}
571     | ToHexStringTerm               {}
572     | ToStringTerm                  {}
573     ;
574
575 Type2BufferOpcode                   /* "Type5" Opcodes */
576     : ToBufferTerm                  {}
577     | ConcatResTerm                 {}
578     ;
579
580 Type2BufferOrStringOpcode
581     : ConcatTerm                    {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
582     | PrintfTerm                    {}
583     | FprintfTerm                   {}
584     | MidTerm                       {}
585     ;
586
587 /*
588  * A type 3 opcode evaluates to an Integer and cannot have a destination operand
589  */
590
591 Type3Opcode
592     : EISAIDTerm                    {}
593     ;
594
595 /* Obsolete
596 Type4Opcode
597     : ConcatTerm                    {}
598     | ToDecimalStringTerm           {}
599     | ToHexStringTerm               {}
600     | MidTerm                       {}
601     | ToStringTerm                  {}
602     ;
603 */
604
605
606 Type5Opcode
607     : ResourceTemplateTerm          {}
608     | UnicodeTerm                   {}
609     | ToPLDTerm                     {}
610     | ToUUIDTerm                    {}
611     ;
612
613 Type6Opcode
614     : RefOfTerm                     {}
615     | DerefOfTerm                   {}
616     | IndexTerm                     {}
617     | MethodInvocationTerm          {}
618     ;
619
620 IncludeTerm
621     : PARSEOP_INCLUDE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE);}
622         String  ')'                 {TrLinkChildren ($<n>3,1,$4);FlOpenIncludeFile ($4);}
623         TermList
624         IncludeEndTerm              {$$ = TrLinkPeerNodes (3,$<n>3,$7,$8);}
625     ;
626
627 IncludeEndTerm
628     : PARSEOP_INCLUDE_END           {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);}
629     ;
630
631 ExternalTerm
632     : PARSEOP_EXTERNAL '('
633         NameString
634         OptionalObjectTypeKeyword
635         OptionalParameterTypePackage
636         OptionalParameterTypesPackage
637         ')'                         {$$ = TrCreateNode (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);}
638     | PARSEOP_EXTERNAL '('
639         error ')'                   {$$ = AslDoError(); yyclearin;}
640     ;
641
642
643 /******* Named Objects *******************************************************/
644
645
646 BankFieldTerm
647     : PARSEOP_BANKFIELD '('         {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);}
648         NameString
649         NameStringItem
650         TermArgItem
651         ',' AccessTypeKeyword
652         ',' LockRuleKeyword
653         ',' UpdateRuleKeyword
654         ')' '{'
655             FieldUnitList '}'       {$$ = TrLinkChildren ($<n>3,7,$4,$5,$6,$8,$10,$12,$15);}
656     | PARSEOP_BANKFIELD '('
657         error ')' '{' error '}'     {$$ = AslDoError(); yyclearin;}
658     ;
659
660 FieldUnitList
661     :                               {$$ = NULL;}
662     | FieldUnit
663     | FieldUnitList ','             /* Allows a trailing comma at list end */
664     | FieldUnitList ','
665         FieldUnit                   {$$ = TrLinkPeerNode ($1,$3);}
666     ;
667
668 FieldUnit
669     : FieldUnitEntry                {}
670     | OffsetTerm                    {}
671     | AccessAsTerm                  {}
672     | ConnectionTerm                {}
673     ;
674
675 FieldUnitEntry
676     : ',' AmlPackageLengthTerm      {$$ = TrCreateNode (PARSEOP_RESERVED_BYTES,1,$2);}
677     | NameSeg ','
678         AmlPackageLengthTerm        {$$ = TrLinkChildNode ($1,$3);}
679     ;
680
681 OffsetTerm
682     : PARSEOP_OFFSET '('
683         AmlPackageLengthTerm
684         ')'                         {$$ = TrCreateNode (PARSEOP_OFFSET,1,$3);}
685     | PARSEOP_OFFSET '('
686         error ')'                   {$$ = AslDoError(); yyclearin;}
687     ;
688
689 AccessAsTerm
690     : PARSEOP_ACCESSAS '('
691         AccessTypeKeyword
692         OptionalAccessAttribTerm
693         ')'                         {$$ = TrCreateNode (PARSEOP_ACCESSAS,2,$3,$4);}
694     | PARSEOP_ACCESSAS '('
695         error ')'                   {$$ = AslDoError(); yyclearin;}
696     ;
697
698 ConnectionTerm
699     : PARSEOP_CONNECTION '('
700         NameString
701         ')'                         {$$ = TrCreateNode (PARSEOP_CONNECTION,1,$3);}
702     | PARSEOP_CONNECTION '('        {$<n>$ = TrCreateLeafNode (PARSEOP_CONNECTION);}
703         ResourceMacroTerm
704         ')'                         {$$ = TrLinkChildren ($<n>3, 1,
705                                             TrLinkChildren (TrCreateLeafNode (PARSEOP_RESOURCETEMPLATE), 3,
706                                                 TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
707                                                 TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
708                                                 $4));}
709     | PARSEOP_CONNECTION '('
710         error ')'                   {$$ = AslDoError(); yyclearin;}
711     ;
712
713 CreateBitFieldTerm
714     : PARSEOP_CREATEBITFIELD '('    {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);}
715         TermArg
716         TermArgItem
717         NameStringItem
718         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
719     | PARSEOP_CREATEBITFIELD '('
720         error ')'                   {$$ = AslDoError(); yyclearin;}
721     ;
722
723 CreateByteFieldTerm
724     : PARSEOP_CREATEBYTEFIELD '('   {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);}
725         TermArg
726         TermArgItem
727         NameStringItem
728         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
729     | PARSEOP_CREATEBYTEFIELD '('
730         error ')'                   {$$ = AslDoError(); yyclearin;}
731     ;
732
733 CreateDWordFieldTerm
734     : PARSEOP_CREATEDWORDFIELD '('  {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);}
735         TermArg
736         TermArgItem
737         NameStringItem
738         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
739     | PARSEOP_CREATEDWORDFIELD '('
740         error ')'                   {$$ = AslDoError(); yyclearin;}
741     ;
742
743 CreateFieldTerm
744     : PARSEOP_CREATEFIELD '('       {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);}
745         TermArg
746         TermArgItem
747         TermArgItem
748         NameStringItem
749         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,TrSetNodeFlags ($7, NODE_IS_NAME_DECLARATION));}
750     | PARSEOP_CREATEFIELD '('
751         error ')'                   {$$ = AslDoError(); yyclearin;}
752     ;
753
754 CreateQWordFieldTerm
755     : PARSEOP_CREATEQWORDFIELD '('  {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);}
756         TermArg
757         TermArgItem
758         NameStringItem
759         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
760     | PARSEOP_CREATEQWORDFIELD '('
761         error ')'                   {$$ = AslDoError(); yyclearin;}
762     ;
763
764 CreateWordFieldTerm
765     : PARSEOP_CREATEWORDFIELD '('   {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);}
766         TermArg
767         TermArgItem
768         NameStringItem
769         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
770     | PARSEOP_CREATEWORDFIELD '('
771         error ')'                   {$$ = AslDoError(); yyclearin;}
772     ;
773
774 DataRegionTerm
775     : PARSEOP_DATATABLEREGION '('   {$<n>$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);}
776         NameString
777         TermArgItem
778         TermArgItem
779         TermArgItem
780         ')'                         {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$6,$7);}
781     | PARSEOP_DATATABLEREGION '('
782         error ')'                   {$$ = AslDoError(); yyclearin;}
783     ;
784
785 DeviceTerm
786     : PARSEOP_DEVICE '('            {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);}
787         NameString
788         ')' '{'
789             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
790     | PARSEOP_DEVICE '('
791         error ')'                   {$$ = AslDoError(); yyclearin;}
792     ;
793
794 EventTerm
795     : PARSEOP_EVENT '('             {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);}
796         NameString
797         ')'                         {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));}
798     | PARSEOP_EVENT '('
799         error ')'                   {$$ = AslDoError(); yyclearin;}
800     ;
801
802 FieldTerm
803     : PARSEOP_FIELD '('             {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);}
804         NameString
805         ',' AccessTypeKeyword
806         ',' LockRuleKeyword
807         ',' UpdateRuleKeyword
808         ')' '{'
809             FieldUnitList '}'       {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$10,$13);}
810     | PARSEOP_FIELD '('
811         error ')' '{' error '}'     {$$ = AslDoError(); yyclearin;}
812     ;
813
814 FunctionTerm
815     : PARSEOP_FUNCTION '('          {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
816         NameString
817         OptionalParameterTypePackage
818         OptionalParameterTypesPackage
819         ')' '{'
820             TermList '}'            {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),
821                                         TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),
822                                         TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL),
823                                         TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);}
824     | PARSEOP_FUNCTION '('
825         error ')'                   {$$ = AslDoError(); yyclearin;}
826     ;
827
828 IndexFieldTerm
829     : PARSEOP_INDEXFIELD '('        {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);}
830         NameString
831         NameStringItem
832         ',' AccessTypeKeyword
833         ',' LockRuleKeyword
834         ',' UpdateRuleKeyword
835         ')' '{'
836             FieldUnitList '}'       {$$ = TrLinkChildren ($<n>3,6,$4,$5,$7,$9,$11,$14);}
837     | PARSEOP_INDEXFIELD '('
838         error ')' '{' error '}'     {$$ = AslDoError(); yyclearin;}
839     ;
840
841 MethodTerm
842     : PARSEOP_METHOD  '('           {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
843         NameString
844         OptionalByteConstExpr       {UtCheckIntegerRange ($5, 0, 7);}
845         OptionalSerializeRuleKeyword
846         OptionalByteConstExpr
847         OptionalParameterTypePackage
848         OptionalParameterTypesPackage
849         ')' '{'
850             TermList '}'            {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$7,$8,$9,$10,$13);}
851     | PARSEOP_METHOD '('
852         error ')'                   {$$ = AslDoError(); yyclearin;}
853     ;
854
855 MutexTerm
856     : PARSEOP_MUTEX '('             {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);}
857         NameString
858         ',' ByteConstExpr
859         ')'                         {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
860     | PARSEOP_MUTEX '('
861         error ')'                   {$$ = AslDoError(); yyclearin;}
862     ;
863
864 OpRegionTerm
865     : PARSEOP_OPERATIONREGION '('   {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);}
866         NameString
867         ',' OpRegionSpaceIdTerm
868         TermArgItem
869         TermArgItem
870         ')'                         {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8);}
871     | PARSEOP_OPERATIONREGION '('
872         error ')'                   {$$ = AslDoError(); yyclearin;}
873     ;
874
875 OpRegionSpaceIdTerm
876     : RegionSpaceKeyword            {}
877     | ByteConst                     {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
878     ;
879
880 PowerResTerm
881     : PARSEOP_POWERRESOURCE '('     {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);}
882         NameString
883         ',' ByteConstExpr
884         ',' WordConstExpr
885         ')' '{'
886             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$8,$11);}
887     | PARSEOP_POWERRESOURCE '('
888         error ')'                   {$$ = AslDoError(); yyclearin;}
889     ;
890
891 ProcessorTerm
892     : PARSEOP_PROCESSOR '('         {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);}
893         NameString
894         ',' ByteConstExpr
895         OptionalDWordConstExpr
896         OptionalByteConstExpr
897         ')' '{'
898             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,5,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8,$11);}
899     | PARSEOP_PROCESSOR '('
900         error ')'                   {$$ = AslDoError(); yyclearin;}
901     ;
902
903 ThermalZoneTerm
904     : PARSEOP_THERMALZONE '('       {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);}
905         NameString
906         ')' '{'
907             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
908     | PARSEOP_THERMALZONE '('
909         error ')'                   {$$ = AslDoError(); yyclearin;}
910     ;
911
912
913 /******* Namespace modifiers *************************************************/
914
915
916 AliasTerm
917     : PARSEOP_ALIAS '('             {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);}
918         NameString
919         NameStringItem
920         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));}
921     | PARSEOP_ALIAS '('
922         error ')'                   {$$ = AslDoError(); yyclearin;}
923     ;
924
925 NameTerm
926     : PARSEOP_NAME '('              {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);}
927         NameString
928         ',' DataObject
929         ')'                         {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
930     | PARSEOP_NAME '('
931         error ')'                   {$$ = AslDoError(); yyclearin;}
932     ;
933
934 ScopeTerm
935     : PARSEOP_SCOPE '('             {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);}
936         NameString
937         ')' '{'
938             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
939     | PARSEOP_SCOPE '('
940         error ')'                   {$$ = AslDoError(); yyclearin;}
941     ;
942
943
944 /******* Type 1 opcodes *******************************************************/
945
946
947 BreakTerm
948     : PARSEOP_BREAK                 {$$ = TrCreateNode (PARSEOP_BREAK, 0);}
949     ;
950
951 BreakPointTerm
952     : PARSEOP_BREAKPOINT            {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);}
953     ;
954
955 ContinueTerm
956     : PARSEOP_CONTINUE              {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);}
957     ;
958
959 FatalTerm
960     : PARSEOP_FATAL '('             {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);}
961         ByteConstExpr
962         ',' DWordConstExpr
963         TermArgItem
964         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);}
965     | PARSEOP_FATAL '('
966         error ')'                   {$$ = AslDoError(); yyclearin;}
967     ;
968
969 IfElseTerm
970     : IfTerm ElseTerm               {$$ = TrLinkPeerNode ($1,$2);}
971     ;
972
973 IfTerm
974     : PARSEOP_IF '('                {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
975         TermArg
976         ')' '{'
977             TermList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
978
979     | PARSEOP_IF '('
980         error ')'                   {$$ = AslDoError(); yyclearin;}
981     ;
982
983 ElseTerm
984     :                               {$$ = NULL;}
985     | PARSEOP_ELSE '{'              {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
986         TermList '}'                {$$ = TrLinkChildren ($<n>3,1,$4);}
987
988     | PARSEOP_ELSE '{'
989         error '}'                   {$$ = AslDoError(); yyclearin;}
990
991     | PARSEOP_ELSE
992         error                       {$$ = AslDoError(); yyclearin;}
993
994     | PARSEOP_ELSEIF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
995         TermArg                     {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
996         ')' '{'
997             TermList '}'            {TrLinkChildren ($<n>5,2,$4,$8);}
998         ElseTerm                    {TrLinkPeerNode ($<n>5,$11);}
999                                     {$$ = TrLinkChildren ($<n>3,1,$<n>5);}
1000
1001     | PARSEOP_ELSEIF '('
1002         error ')'                   {$$ = AslDoError(); yyclearin;}
1003
1004     | PARSEOP_ELSEIF
1005         error                       {$$ = AslDoError(); yyclearin;}
1006     ;
1007
1008 LoadTerm
1009     : PARSEOP_LOAD '('              {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);}
1010         NameString
1011         RequiredTarget
1012         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1013     | PARSEOP_LOAD '('
1014         error ')'                   {$$ = AslDoError(); yyclearin;}
1015     ;
1016
1017 NoOpTerm
1018     : PARSEOP_NOOP                  {$$ = TrCreateNode (PARSEOP_NOOP, 0);}
1019     ;
1020
1021 NotifyTerm
1022     : PARSEOP_NOTIFY '('            {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);}
1023         SuperName
1024         TermArgItem
1025         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1026     | PARSEOP_NOTIFY '('
1027         error ')'                   {$$ = AslDoError(); yyclearin;}
1028     ;
1029
1030 ReleaseTerm
1031     : PARSEOP_RELEASE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);}
1032         SuperName
1033         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1034     | PARSEOP_RELEASE '('
1035         error ')'                   {$$ = AslDoError(); yyclearin;}
1036     ;
1037
1038 ResetTerm
1039     : PARSEOP_RESET '('             {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);}
1040         SuperName
1041         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1042     | PARSEOP_RESET '('
1043         error ')'                   {$$ = AslDoError(); yyclearin;}
1044     ;
1045
1046 ReturnTerm
1047     : PARSEOP_RETURN '('            {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
1048         OptionalReturnArg
1049         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1050     | PARSEOP_RETURN                {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
1051     | PARSEOP_RETURN '('
1052         error ')'                   {$$ = AslDoError(); yyclearin;}
1053     ;
1054
1055 SignalTerm
1056     : PARSEOP_SIGNAL '('            {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);}
1057         SuperName
1058         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1059     | PARSEOP_SIGNAL '('
1060         error ')'                   {$$ = AslDoError(); yyclearin;}
1061     ;
1062
1063 SleepTerm
1064     : PARSEOP_SLEEP '('             {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);}
1065         TermArg
1066         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1067     | PARSEOP_SLEEP '('
1068         error ')'                   {$$ = AslDoError(); yyclearin;}
1069     ;
1070
1071 StallTerm
1072     : PARSEOP_STALL '('             {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);}
1073         TermArg
1074         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1075     | PARSEOP_STALL '('
1076         error ')'                   {$$ = AslDoError(); yyclearin;}
1077     ;
1078
1079 SwitchTerm
1080     : PARSEOP_SWITCH '('            {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);}
1081         TermArg
1082         ')' '{'
1083             CaseDefaultTermList '}'
1084                                     {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1085     | PARSEOP_SWITCH '('
1086         error ')'                   {$$ = AslDoError(); yyclearin;}
1087     ;
1088
1089 /*
1090  * Case-Default list; allow only one Default term and unlimited Case terms
1091  */
1092
1093 CaseDefaultTermList
1094     :                               {$$ = NULL;}
1095     | CaseTerm  {}
1096     | DefaultTerm   {}
1097     | CaseDefaultTermList
1098         CaseTerm                    {$$ = TrLinkPeerNode ($1,$2);}
1099     | CaseDefaultTermList
1100         DefaultTerm                 {$$ = TrLinkPeerNode ($1,$2);}
1101
1102 /* Original - attempts to force zero or one default term within the switch */
1103
1104 /*
1105 CaseDefaultTermList
1106     :                               {$$ = NULL;}
1107     | CaseTermList
1108         DefaultTerm
1109         CaseTermList                {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));}
1110     | CaseTermList
1111         CaseTerm                    {$$ = TrLinkPeerNode ($1,$2);}
1112     ;
1113
1114 CaseTermList
1115     :                               {$$ = NULL;}
1116     | CaseTerm                      {}
1117     | CaseTermList
1118         CaseTerm                    {$$ = TrLinkPeerNode ($1,$2);}
1119     ;
1120 */
1121
1122 CaseTerm
1123     : PARSEOP_CASE '('              {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);}
1124         DataObject
1125         ')' '{'
1126             TermList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1127     | PARSEOP_CASE '('
1128         error ')'                   {$$ = AslDoError(); yyclearin;}
1129     ;
1130
1131 DefaultTerm
1132     : PARSEOP_DEFAULT '{'           {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);}
1133         TermList '}'                {$$ = TrLinkChildren ($<n>3,1,$4);}
1134     | PARSEOP_DEFAULT '{'
1135         error '}'                   {$$ = AslDoError(); yyclearin;}
1136     ;
1137
1138 UnloadTerm
1139     : PARSEOP_UNLOAD '('            {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);}
1140         SuperName
1141         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1142     | PARSEOP_UNLOAD '('
1143         error ')'                   {$$ = AslDoError(); yyclearin;}
1144     ;
1145
1146 WhileTerm
1147     : PARSEOP_WHILE '('             {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);}
1148         TermArg
1149         ')' '{' TermList '}'
1150                                     {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1151     | PARSEOP_WHILE '('
1152         error ')'                   {$$ = AslDoError(); yyclearin;}
1153     ;
1154
1155
1156 /******* Type 2 opcodes *******************************************************/
1157
1158 AcquireTerm
1159     : PARSEOP_ACQUIRE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);}
1160         SuperName
1161         ',' WordConstExpr
1162         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$6);}
1163     | PARSEOP_ACQUIRE '('
1164         error ')'                   {$$ = AslDoError(); yyclearin;}
1165     ;
1166
1167 AddTerm
1168     : PARSEOP_ADD '('               {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
1169         TermArg
1170         TermArgItem
1171         Target
1172         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1173     | PARSEOP_ADD '('
1174         error ')'                   {$$ = AslDoError(); yyclearin;}
1175     ;
1176
1177 AndTerm
1178     : PARSEOP_AND '('               {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
1179         TermArg
1180         TermArgItem
1181         Target
1182         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1183     | PARSEOP_AND '('
1184         error ')'                   {$$ = AslDoError(); yyclearin;}
1185     ;
1186
1187 ConcatTerm
1188     : PARSEOP_CONCATENATE '('       {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);}
1189         TermArg
1190         TermArgItem
1191         Target
1192         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1193     | PARSEOP_CONCATENATE '('
1194         error ')'                   {$$ = AslDoError(); yyclearin;}
1195     ;
1196
1197 ConcatResTerm
1198     : PARSEOP_CONCATENATERESTEMPLATE '('    {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);}
1199         TermArg
1200         TermArgItem
1201         Target
1202         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1203     | PARSEOP_CONCATENATERESTEMPLATE '('
1204         error ')'                   {$$ = AslDoError(); yyclearin;}
1205     ;
1206
1207 CondRefOfTerm
1208     : PARSEOP_CONDREFOF '('         {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);}
1209         SuperName
1210         Target
1211         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1212     | PARSEOP_CONDREFOF '('
1213         error ')'                   {$$ = AslDoError(); yyclearin;}
1214     ;
1215
1216 CopyObjectTerm
1217     : PARSEOP_COPYOBJECT '('        {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);}
1218         TermArg
1219         ',' SimpleTarget
1220         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
1221     | PARSEOP_COPYOBJECT '('
1222         error ')'                   {$$ = AslDoError(); yyclearin;}
1223     ;
1224
1225 DecTerm
1226     : PARSEOP_DECREMENT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
1227         SuperName
1228         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1229     | PARSEOP_DECREMENT '('
1230         error ')'                   {$$ = AslDoError(); yyclearin;}
1231     ;
1232
1233 DerefOfTerm
1234     : PARSEOP_DEREFOF '('           {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);}
1235         TermArg
1236         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1237     | PARSEOP_DEREFOF '('
1238         error ')'                   {$$ = AslDoError(); yyclearin;}
1239     ;
1240
1241 DivideTerm
1242     : PARSEOP_DIVIDE '('            {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
1243         TermArg
1244         TermArgItem
1245         Target
1246         Target
1247         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);}
1248     | PARSEOP_DIVIDE '('
1249         error ')'                   {$$ = AslDoError(); yyclearin;}
1250     ;
1251
1252 FindSetLeftBitTerm
1253     : PARSEOP_FINDSETLEFTBIT '('    {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);}
1254         TermArg
1255         Target
1256         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1257     | PARSEOP_FINDSETLEFTBIT '('
1258         error ')'                   {$$ = AslDoError(); yyclearin;}
1259     ;
1260
1261 FindSetRightBitTerm
1262     : PARSEOP_FINDSETRIGHTBIT '('   {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);}
1263         TermArg
1264         Target
1265         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1266     | PARSEOP_FINDSETRIGHTBIT '('
1267         error ')'                   {$$ = AslDoError(); yyclearin;}
1268     ;
1269
1270 FromBCDTerm
1271     : PARSEOP_FROMBCD '('           {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);}
1272         TermArg
1273         Target
1274         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1275     | PARSEOP_FROMBCD '('
1276         error ')'                   {$$ = AslDoError(); yyclearin;}
1277     ;
1278
1279 IncTerm
1280     : PARSEOP_INCREMENT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
1281         SuperName
1282         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1283     | PARSEOP_INCREMENT '('
1284         error ')'                   {$$ = AslDoError(); yyclearin;}
1285     ;
1286
1287 IndexTerm
1288     : PARSEOP_INDEX '('             {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);}
1289         TermArg
1290         TermArgItem
1291         Target
1292         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1293     | PARSEOP_INDEX '('
1294         error ')'                   {$$ = AslDoError(); yyclearin;}
1295     ;
1296
1297 LAndTerm
1298     : PARSEOP_LAND '('              {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);}
1299         TermArg
1300         TermArgItem
1301         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1302     | PARSEOP_LAND '('
1303         error ')'                   {$$ = AslDoError(); yyclearin;}
1304     ;
1305
1306 LEqualTerm
1307     : PARSEOP_LEQUAL '('            {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
1308         TermArg
1309         TermArgItem
1310         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1311     | PARSEOP_LEQUAL '('
1312         error ')'                   {$$ = AslDoError(); yyclearin;}
1313     ;
1314
1315 LGreaterTerm
1316     : PARSEOP_LGREATER '('          {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
1317         TermArg
1318         TermArgItem
1319         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1320     | PARSEOP_LGREATER '('
1321         error ')'                   {$$ = AslDoError(); yyclearin;}
1322     ;
1323
1324 LGreaterEqualTerm
1325     : PARSEOP_LGREATEREQUAL '('     {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
1326         TermArg
1327         TermArgItem
1328         ')'                         {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
1329     | PARSEOP_LGREATEREQUAL '('
1330         error ')'                   {$$ = AslDoError(); yyclearin;}
1331     ;
1332
1333 LLessTerm
1334     : PARSEOP_LLESS '('             {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
1335         TermArg
1336         TermArgItem
1337         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1338     | PARSEOP_LLESS '('
1339         error ')'                   {$$ = AslDoError(); yyclearin;}
1340     ;
1341
1342 LLessEqualTerm
1343     : PARSEOP_LLESSEQUAL '('        {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
1344         TermArg
1345         TermArgItem
1346         ')'                         {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
1347     | PARSEOP_LLESSEQUAL '('
1348         error ')'                   {$$ = AslDoError(); yyclearin;}
1349     ;
1350
1351 LNotTerm
1352     : PARSEOP_LNOT '('              {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);}
1353         TermArg
1354         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1355     | PARSEOP_LNOT '('
1356         error ')'                   {$$ = AslDoError(); yyclearin;}
1357     ;
1358
1359 LNotEqualTerm
1360     : PARSEOP_LNOTEQUAL '('         {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
1361         TermArg
1362         TermArgItem
1363         ')'                         {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
1364     | PARSEOP_LNOTEQUAL '('
1365         error ')'                   {$$ = AslDoError(); yyclearin;}
1366     ;
1367
1368 LoadTableTerm
1369     : PARSEOP_LOADTABLE '('         {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);}
1370         TermArg
1371         TermArgItem
1372         TermArgItem
1373         OptionalListString
1374         OptionalListString
1375         OptionalReference
1376         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$5,$6,$7,$8,$9);}
1377     | PARSEOP_LOADTABLE '('
1378         error ')'                   {$$ = AslDoError(); yyclearin;}
1379     ;
1380
1381 LOrTerm
1382     : PARSEOP_LOR '('               {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);}
1383         TermArg
1384         TermArgItem
1385         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1386     | PARSEOP_LOR '('
1387         error ')'                   {$$ = AslDoError(); yyclearin;}
1388     ;
1389
1390 MatchTerm
1391     : PARSEOP_MATCH '('             {$<n>$ = TrCreateLeafNode (PARSEOP_MATCH);}
1392         TermArg
1393         ',' MatchOpKeyword
1394         TermArgItem
1395         ',' MatchOpKeyword
1396         TermArgItem
1397         TermArgItem
1398         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$7,$9,$10,$11);}
1399     | PARSEOP_MATCH '('
1400         error ')'                   {$$ = AslDoError(); yyclearin;}
1401     ;
1402
1403 MidTerm
1404     : PARSEOP_MID '('               {$<n>$ = TrCreateLeafNode (PARSEOP_MID);}
1405         TermArg
1406         TermArgItem
1407         TermArgItem
1408         Target
1409         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);}
1410     | PARSEOP_MID '('
1411         error ')'                   {$$ = AslDoError(); yyclearin;}
1412     ;
1413
1414 ModTerm
1415     : PARSEOP_MOD '('               {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
1416         TermArg
1417         TermArgItem
1418         Target
1419         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1420     | PARSEOP_MOD '('
1421         error ')'                   {$$ = AslDoError(); yyclearin;}
1422     ;
1423
1424 MultiplyTerm
1425     : PARSEOP_MULTIPLY '('          {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
1426         TermArg
1427         TermArgItem
1428         Target
1429         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1430     | PARSEOP_MULTIPLY '('
1431         error ')'                   {$$ = AslDoError(); yyclearin;}
1432     ;
1433
1434 NAndTerm
1435     : PARSEOP_NAND '('              {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);}
1436         TermArg
1437         TermArgItem
1438         Target
1439         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1440     | PARSEOP_NAND '('
1441         error ')'                   {$$ = AslDoError(); yyclearin;}
1442     ;
1443
1444 NOrTerm
1445     : PARSEOP_NOR '('               {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);}
1446         TermArg
1447         TermArgItem
1448         Target
1449         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1450     | PARSEOP_NOR '('
1451         error ')'                   {$$ = AslDoError(); yyclearin;}
1452     ;
1453
1454 NotTerm
1455     : PARSEOP_NOT '('               {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);}
1456         TermArg
1457         Target
1458         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1459     | PARSEOP_NOT '('
1460         error ')'                   {$$ = AslDoError(); yyclearin;}
1461     ;
1462
1463 ObjectTypeTerm
1464     : PARSEOP_OBJECTTYPE '('        {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);}
1465         ObjectTypeName
1466         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1467     | PARSEOP_OBJECTTYPE '('
1468         error ')'                   {$$ = AslDoError(); yyclearin;}
1469     ;
1470
1471 OrTerm
1472     : PARSEOP_OR '('                {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
1473         TermArg
1474         TermArgItem
1475         Target
1476         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1477     | PARSEOP_OR '('
1478         error ')'                   {$$ = AslDoError(); yyclearin;}
1479     ;
1480
1481 /*
1482  * In RefOf, the node isn't really a target, but we can't keep track of it after
1483  * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.)
1484  */
1485 RefOfTerm
1486     : PARSEOP_REFOF '('             {$<n>$ = TrCreateLeafNode (PARSEOP_REFOF);}
1487         SuperName
1488         ')'                         {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_TARGET));}
1489     | PARSEOP_REFOF '('
1490         error ')'                   {$$ = AslDoError(); yyclearin;}
1491     ;
1492
1493 ShiftLeftTerm
1494     : PARSEOP_SHIFTLEFT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
1495         TermArg
1496         TermArgItem
1497         Target
1498         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1499     | PARSEOP_SHIFTLEFT '('
1500         error ')'                   {$$ = AslDoError(); yyclearin;}
1501     ;
1502
1503 ShiftRightTerm
1504     : PARSEOP_SHIFTRIGHT '('        {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
1505         TermArg
1506         TermArgItem
1507         Target
1508         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1509     | PARSEOP_SHIFTRIGHT '('
1510         error ')'                   {$$ = AslDoError(); yyclearin;}
1511     ;
1512
1513 SizeOfTerm
1514     : PARSEOP_SIZEOF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);}
1515         SuperName
1516         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1517     | PARSEOP_SIZEOF '('
1518         error ')'                   {$$ = AslDoError(); yyclearin;}
1519     ;
1520
1521 StoreTerm
1522     : PARSEOP_STORE '('             {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);}
1523         TermArg
1524         ',' SuperName
1525         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
1526     | PARSEOP_STORE '('
1527         error ')'                   {$$ = AslDoError(); yyclearin;}
1528     ;
1529
1530 SubtractTerm
1531     : PARSEOP_SUBTRACT '('          {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
1532         TermArg
1533         TermArgItem
1534         Target
1535         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1536     | PARSEOP_SUBTRACT '('
1537         error ')'                   {$$ = AslDoError(); yyclearin;}
1538     ;
1539
1540 TimerTerm
1541     : PARSEOP_TIMER '('             {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);}
1542         ')'                         {$$ = TrLinkChildren ($<n>3,0);}
1543     | PARSEOP_TIMER                 {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);}
1544     | PARSEOP_TIMER '('
1545         error ')'                   {$$ = AslDoError(); yyclearin;}
1546     ;
1547
1548 ToBCDTerm
1549     : PARSEOP_TOBCD '('             {$<n>$ = TrCreateLeafNode (PARSEOP_TOBCD);}
1550         TermArg
1551         Target
1552         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1553     | PARSEOP_TOBCD '('
1554         error ')'                   {$$ = AslDoError(); yyclearin;}
1555     ;
1556
1557 ToBufferTerm
1558     : PARSEOP_TOBUFFER '('          {$<n>$ = TrCreateLeafNode (PARSEOP_TOBUFFER);}
1559         TermArg
1560         Target
1561         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1562     | PARSEOP_TOBUFFER '('
1563         error ')'                   {$$ = AslDoError(); yyclearin;}
1564     ;
1565
1566 ToDecimalStringTerm
1567     : PARSEOP_TODECIMALSTRING '('   {$<n>$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);}
1568         TermArg
1569         Target
1570         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1571     | PARSEOP_TODECIMALSTRING '('
1572         error ')'                   {$$ = AslDoError(); yyclearin;}
1573     ;
1574
1575 ToHexStringTerm
1576     : PARSEOP_TOHEXSTRING '('       {$<n>$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);}
1577         TermArg
1578         Target
1579         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1580     | PARSEOP_TOHEXSTRING '('
1581         error ')'                   {$$ = AslDoError(); yyclearin;}
1582     ;
1583
1584 ToIntegerTerm
1585     : PARSEOP_TOINTEGER '('         {$<n>$ = TrCreateLeafNode (PARSEOP_TOINTEGER);}
1586         TermArg
1587         Target
1588         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1589     | PARSEOP_TOINTEGER '('
1590         error ')'                   {$$ = AslDoError(); yyclearin;}
1591     ;
1592
1593 PldKeyword
1594     : PARSEOP_PLD_REVISION          {$$ = TrCreateLeafNode (PARSEOP_PLD_REVISION);}
1595     | PARSEOP_PLD_IGNORECOLOR       {$$ = TrCreateLeafNode (PARSEOP_PLD_IGNORECOLOR);}
1596     | PARSEOP_PLD_RED               {$$ = TrCreateLeafNode (PARSEOP_PLD_RED);}
1597     | PARSEOP_PLD_GREEN             {$$ = TrCreateLeafNode (PARSEOP_PLD_GREEN);}
1598     | PARSEOP_PLD_BLUE              {$$ = TrCreateLeafNode (PARSEOP_PLD_BLUE);}
1599     | PARSEOP_PLD_WIDTH             {$$ = TrCreateLeafNode (PARSEOP_PLD_WIDTH);}
1600     | PARSEOP_PLD_HEIGHT            {$$ = TrCreateLeafNode (PARSEOP_PLD_HEIGHT);}
1601     | PARSEOP_PLD_USERVISIBLE       {$$ = TrCreateLeafNode (PARSEOP_PLD_USERVISIBLE);}
1602     | PARSEOP_PLD_DOCK              {$$ = TrCreateLeafNode (PARSEOP_PLD_DOCK);}
1603     | PARSEOP_PLD_LID               {$$ = TrCreateLeafNode (PARSEOP_PLD_LID);}
1604     | PARSEOP_PLD_PANEL             {$$ = TrCreateLeafNode (PARSEOP_PLD_PANEL);}
1605     | PARSEOP_PLD_VERTICALPOSITION  {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALPOSITION);}
1606     | PARSEOP_PLD_HORIZONTALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALPOSITION);}
1607     | PARSEOP_PLD_SHAPE             {$$ = TrCreateLeafNode (PARSEOP_PLD_SHAPE);}
1608     | PARSEOP_PLD_GROUPORIENTATION  {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPORIENTATION);}
1609     | PARSEOP_PLD_GROUPTOKEN        {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPTOKEN);}
1610     | PARSEOP_PLD_GROUPPOSITION     {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPPOSITION);}
1611     | PARSEOP_PLD_BAY               {$$ = TrCreateLeafNode (PARSEOP_PLD_BAY);}
1612     | PARSEOP_PLD_EJECTABLE         {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTABLE);}
1613     | PARSEOP_PLD_EJECTREQUIRED     {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTREQUIRED);}
1614     | PARSEOP_PLD_CABINETNUMBER     {$$ = TrCreateLeafNode (PARSEOP_PLD_CABINETNUMBER);}
1615     | PARSEOP_PLD_CARDCAGENUMBER    {$$ = TrCreateLeafNode (PARSEOP_PLD_CARDCAGENUMBER);}
1616     | PARSEOP_PLD_REFERENCE         {$$ = TrCreateLeafNode (PARSEOP_PLD_REFERENCE);}
1617     | PARSEOP_PLD_ROTATION          {$$ = TrCreateLeafNode (PARSEOP_PLD_ROTATION);}
1618     | PARSEOP_PLD_ORDER             {$$ = TrCreateLeafNode (PARSEOP_PLD_ORDER);}
1619     | PARSEOP_PLD_RESERVED          {$$ = TrCreateLeafNode (PARSEOP_PLD_RESERVED);}
1620     | PARSEOP_PLD_VERTICALOFFSET    {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALOFFSET);}
1621     | PARSEOP_PLD_HORIZONTALOFFSET  {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALOFFSET);}
1622     ;
1623
1624 PldKeywordList
1625     :                               {$$ = NULL;}
1626     | PldKeyword
1627         PARSEOP_EXP_EQUALS Integer  {$$ = TrLinkChildren ($1,1,$3);}
1628     | PldKeyword
1629         PARSEOP_EXP_EQUALS String   {$$ = TrLinkChildren ($1,1,$3);}
1630     | PldKeywordList ','            /* Allows a trailing comma at list end */
1631     | PldKeywordList ','
1632         PldKeyword
1633         PARSEOP_EXP_EQUALS Integer  {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));}
1634     | PldKeywordList ','
1635         PldKeyword
1636         PARSEOP_EXP_EQUALS String   {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));}
1637     ;
1638
1639 ToPLDTerm
1640     : PARSEOP_TOPLD '('             {$<n>$ = TrCreateLeafNode (PARSEOP_TOPLD);}
1641         PldKeywordList
1642         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1643     | PARSEOP_TOPLD '('
1644         error ')'                   {$$ = AslDoError(); yyclearin;}
1645     ;
1646
1647 PrintfArgList
1648     :                               {$$ = NULL;}
1649     | TermArg                       {$$ = $1;}
1650     | PrintfArgList ','
1651        TermArg                      {$$ = TrLinkPeerNode ($1, $3);}
1652     ;
1653
1654 PrintfTerm
1655     : PARSEOP_PRINTF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_PRINTF);}
1656         StringData
1657         PrintfArgList
1658         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1659     | PARSEOP_PRINTF '('
1660         error ')'                   {$$ = AslDoError(); yyclearin;}
1661     ;
1662
1663 FprintfTerm
1664     : PARSEOP_FPRINTF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_FPRINTF);}
1665         TermArg ','
1666         StringData
1667         PrintfArgList
1668         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);}
1669     | PARSEOP_FPRINTF '('
1670         error ')'                   {$$ = AslDoError(); yyclearin;}
1671     ;
1672
1673 ToStringTerm
1674     : PARSEOP_TOSTRING '('          {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);}
1675         TermArg
1676         OptionalCount
1677         Target
1678         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1679     | PARSEOP_TOSTRING '('
1680         error ')'                   {$$ = AslDoError(); yyclearin;}
1681     ;
1682
1683 ToUUIDTerm
1684     : PARSEOP_TOUUID '('
1685         StringData ')'              {$$ = TrUpdateNode (PARSEOP_TOUUID, $3);}
1686     | PARSEOP_TOUUID '('
1687         error ')'                   {$$ = AslDoError(); yyclearin;}
1688     ;
1689
1690 WaitTerm
1691     : PARSEOP_WAIT '('              {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);}
1692         SuperName
1693         TermArgItem
1694         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1695     | PARSEOP_WAIT '('
1696         error ')'                   {$$ = AslDoError(); yyclearin;}
1697     ;
1698
1699 XOrTerm
1700     : PARSEOP_XOR '('               {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
1701         TermArg
1702         TermArgItem
1703         Target
1704         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1705     | PARSEOP_XOR '('
1706         error ')'                   {$$ = AslDoError(); yyclearin;}
1707     ;
1708
1709
1710 /******* Keywords *************************************************************/
1711
1712
1713 AccessAttribKeyword
1714     : PARSEOP_ACCESSATTRIB_BLOCK            {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);}
1715     | PARSEOP_ACCESSATTRIB_BLOCK_CALL       {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);}
1716     | PARSEOP_ACCESSATTRIB_BYTE             {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);}
1717     | PARSEOP_ACCESSATTRIB_QUICK            {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );}
1718     | PARSEOP_ACCESSATTRIB_SND_RCV          {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);}
1719     | PARSEOP_ACCESSATTRIB_WORD             {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);}
1720     | PARSEOP_ACCESSATTRIB_WORD_CALL        {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);}
1721     | PARSEOP_ACCESSATTRIB_MULTIBYTE '('    {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_MULTIBYTE);}
1722         ByteConst
1723         ')'                                 {$$ = TrLinkChildren ($<n>3,1,$4);}
1724     | PARSEOP_ACCESSATTRIB_RAW_BYTES '('    {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_BYTES);}
1725         ByteConst
1726         ')'                                 {$$ = TrLinkChildren ($<n>3,1,$4);}
1727     | PARSEOP_ACCESSATTRIB_RAW_PROCESS '('  {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_PROCESS);}
1728         ByteConst
1729         ')'                                 {$$ = TrLinkChildren ($<n>3,1,$4);}
1730     ;
1731
1732 AccessTypeKeyword
1733     : PARSEOP_ACCESSTYPE_ANY                {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_ANY);}
1734     | PARSEOP_ACCESSTYPE_BYTE               {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BYTE);}
1735     | PARSEOP_ACCESSTYPE_WORD               {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_WORD);}
1736     | PARSEOP_ACCESSTYPE_DWORD              {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_DWORD);}
1737     | PARSEOP_ACCESSTYPE_QWORD              {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_QWORD);}
1738     | PARSEOP_ACCESSTYPE_BUF                {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);}
1739     ;
1740
1741 AddressingModeKeyword
1742     : PARSEOP_ADDRESSINGMODE_7BIT           {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_7BIT);}
1743     | PARSEOP_ADDRESSINGMODE_10BIT          {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_10BIT);}
1744     ;
1745
1746 AddressKeyword
1747     : PARSEOP_ADDRESSTYPE_MEMORY            {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);}
1748     | PARSEOP_ADDRESSTYPE_RESERVED          {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);}
1749     | PARSEOP_ADDRESSTYPE_NVS               {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);}
1750     | PARSEOP_ADDRESSTYPE_ACPI              {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);}
1751     ;
1752
1753 AddressSpaceKeyword
1754     : ByteConst                             {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);}
1755     | RegionSpaceKeyword                    {}
1756     ;
1757
1758 BitsPerByteKeyword
1759     : PARSEOP_BITSPERBYTE_FIVE              {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_FIVE);}
1760     | PARSEOP_BITSPERBYTE_SIX               {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SIX);}
1761     | PARSEOP_BITSPERBYTE_SEVEN             {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SEVEN);}
1762     | PARSEOP_BITSPERBYTE_EIGHT             {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_EIGHT);}
1763     | PARSEOP_BITSPERBYTE_NINE              {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_NINE);}
1764     ;
1765
1766 ClockPhaseKeyword
1767     : PARSEOP_CLOCKPHASE_FIRST              {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_FIRST);}
1768     | PARSEOP_CLOCKPHASE_SECOND             {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_SECOND);}
1769     ;
1770
1771 ClockPolarityKeyword
1772     : PARSEOP_CLOCKPOLARITY_LOW             {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_LOW);}
1773     | PARSEOP_CLOCKPOLARITY_HIGH            {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_HIGH);}
1774     ;
1775
1776 DecodeKeyword
1777     : PARSEOP_DECODETYPE_POS                {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);}
1778     | PARSEOP_DECODETYPE_SUB                {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);}
1779     ;
1780
1781 DevicePolarityKeyword
1782     : PARSEOP_DEVICEPOLARITY_LOW            {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_LOW);}
1783     | PARSEOP_DEVICEPOLARITY_HIGH           {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_HIGH);}
1784     ;
1785
1786 DMATypeKeyword
1787     : PARSEOP_DMATYPE_A                     {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);}
1788     | PARSEOP_DMATYPE_COMPATIBILITY         {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);}
1789     | PARSEOP_DMATYPE_B                     {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);}
1790     | PARSEOP_DMATYPE_F                     {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);}
1791     ;
1792
1793 EndianKeyword
1794     : PARSEOP_ENDIAN_LITTLE                 {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_LITTLE);}
1795     | PARSEOP_ENDIAN_BIG                    {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_BIG);}
1796     ;
1797
1798 FlowControlKeyword
1799     : PARSEOP_FLOWCONTROL_HW                {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_HW);}
1800     | PARSEOP_FLOWCONTROL_NONE              {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_NONE);}
1801     | PARSEOP_FLOWCONTROL_SW                {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_SW);}
1802     ;
1803
1804 InterruptLevel
1805     : PARSEOP_INTLEVEL_ACTIVEBOTH           {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEBOTH);}
1806     | PARSEOP_INTLEVEL_ACTIVEHIGH           {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);}
1807     | PARSEOP_INTLEVEL_ACTIVELOW            {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);}
1808     ;
1809
1810 InterruptTypeKeyword
1811     : PARSEOP_INTTYPE_EDGE                  {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);}
1812     | PARSEOP_INTTYPE_LEVEL                 {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);}
1813     ;
1814
1815 IODecodeKeyword
1816     : PARSEOP_IODECODETYPE_16               {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);}
1817     | PARSEOP_IODECODETYPE_10               {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);}
1818     ;
1819
1820 IoRestrictionKeyword
1821     : PARSEOP_IORESTRICT_IN                 {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_IN);}
1822     | PARSEOP_IORESTRICT_OUT                {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_OUT);}
1823     | PARSEOP_IORESTRICT_NONE               {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_NONE);}
1824     | PARSEOP_IORESTRICT_PRESERVE           {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_PRESERVE);}
1825     ;
1826
1827 LockRuleKeyword
1828     : PARSEOP_LOCKRULE_LOCK                 {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);}
1829     | PARSEOP_LOCKRULE_NOLOCK               {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);}
1830     ;
1831
1832 MatchOpKeyword
1833     : PARSEOP_MATCHTYPE_MTR                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR);}
1834     | PARSEOP_MATCHTYPE_MEQ                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);}
1835     | PARSEOP_MATCHTYPE_MLE                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLE);}
1836     | PARSEOP_MATCHTYPE_MLT                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLT);}
1837     | PARSEOP_MATCHTYPE_MGE                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGE);}
1838     | PARSEOP_MATCHTYPE_MGT                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);}
1839     ;
1840
1841 MaxKeyword
1842     : PARSEOP_MAXTYPE_FIXED                 {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);}
1843     | PARSEOP_MAXTYPE_NOTFIXED              {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);}
1844     ;
1845
1846 MemTypeKeyword
1847     : PARSEOP_MEMTYPE_CACHEABLE             {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);}
1848     | PARSEOP_MEMTYPE_WRITECOMBINING        {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);}
1849     | PARSEOP_MEMTYPE_PREFETCHABLE          {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);}
1850     | PARSEOP_MEMTYPE_NONCACHEABLE          {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);}
1851     ;
1852
1853 MinKeyword
1854     : PARSEOP_MINTYPE_FIXED                 {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_FIXED);}
1855     | PARSEOP_MINTYPE_NOTFIXED              {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);}
1856     ;
1857
1858 ObjectTypeKeyword
1859     : PARSEOP_OBJECTTYPE_UNK                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);}
1860     | PARSEOP_OBJECTTYPE_INT                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);}
1861     | PARSEOP_OBJECTTYPE_STR                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);}
1862     | PARSEOP_OBJECTTYPE_BUF                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);}
1863     | PARSEOP_OBJECTTYPE_PKG                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);}
1864     | PARSEOP_OBJECTTYPE_FLD                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);}
1865     | PARSEOP_OBJECTTYPE_DEV                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);}
1866     | PARSEOP_OBJECTTYPE_EVT                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);}
1867     | PARSEOP_OBJECTTYPE_MTH                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);}
1868     | PARSEOP_OBJECTTYPE_MTX                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);}
1869     | PARSEOP_OBJECTTYPE_OPR                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);}
1870     | PARSEOP_OBJECTTYPE_POW                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);}
1871     | PARSEOP_OBJECTTYPE_PRO                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);}
1872     | PARSEOP_OBJECTTYPE_THZ                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);}
1873     | PARSEOP_OBJECTTYPE_BFF                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);}
1874     | PARSEOP_OBJECTTYPE_DDB                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);}
1875     ;
1876
1877 ParityTypeKeyword
1878     : PARSEOP_PARITYTYPE_SPACE              {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_SPACE);}
1879     | PARSEOP_PARITYTYPE_MARK               {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_MARK);}
1880     | PARSEOP_PARITYTYPE_ODD                {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_ODD);}
1881     | PARSEOP_PARITYTYPE_EVEN               {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_EVEN);}
1882     | PARSEOP_PARITYTYPE_NONE               {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_NONE);}
1883     ;
1884
1885 PinConfigByte
1886     : PinConfigKeyword                      {$$ = $1;}
1887     | ByteConstExpr                         {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
1888     ;
1889
1890 PinConfigKeyword
1891     : PARSEOP_PIN_NOPULL                    {$$ = TrCreateLeafNode (PARSEOP_PIN_NOPULL);}
1892     | PARSEOP_PIN_PULLDOWN                  {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDOWN);}
1893     | PARSEOP_PIN_PULLUP                    {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLUP);}
1894     | PARSEOP_PIN_PULLDEFAULT               {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDEFAULT);}
1895     ;
1896
1897 RangeTypeKeyword
1898     : PARSEOP_RANGETYPE_ISAONLY             {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ISAONLY);}
1899     | PARSEOP_RANGETYPE_NONISAONLY          {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_NONISAONLY);}
1900     | PARSEOP_RANGETYPE_ENTIRE              {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);}
1901     ;
1902
1903 RegionSpaceKeyword
1904     : PARSEOP_REGIONSPACE_IO                {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);}
1905     | PARSEOP_REGIONSPACE_MEM               {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);}
1906     | PARSEOP_REGIONSPACE_PCI               {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);}
1907     | PARSEOP_REGIONSPACE_EC                {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);}
1908     | PARSEOP_REGIONSPACE_SMBUS             {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);}
1909     | PARSEOP_REGIONSPACE_CMOS              {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);}
1910     | PARSEOP_REGIONSPACE_PCIBAR            {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);}
1911     | PARSEOP_REGIONSPACE_IPMI              {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);}
1912     | PARSEOP_REGIONSPACE_GPIO              {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GPIO);}
1913     | PARSEOP_REGIONSPACE_GSBUS             {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GSBUS);}
1914     | PARSEOP_REGIONSPACE_PCC               {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCC);}
1915     | PARSEOP_REGIONSPACE_FFIXEDHW          {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_FFIXEDHW);}
1916     ;
1917
1918 ResourceTypeKeyword
1919     : PARSEOP_RESOURCETYPE_CONSUMER         {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);}
1920     | PARSEOP_RESOURCETYPE_PRODUCER         {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);}
1921     ;
1922
1923 SerializeRuleKeyword
1924     : PARSEOP_SERIALIZERULE_SERIAL          {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);}
1925     | PARSEOP_SERIALIZERULE_NOTSERIAL       {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);}
1926     ;
1927
1928 ShareTypeKeyword
1929     : PARSEOP_SHARETYPE_SHARED              {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);}
1930     | PARSEOP_SHARETYPE_EXCLUSIVE           {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);}
1931     | PARSEOP_SHARETYPE_SHAREDWAKE          {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHAREDWAKE);}
1932     | PARSEOP_SHARETYPE_EXCLUSIVEWAKE       {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVEWAKE);}
1933    ;
1934
1935 SlaveModeKeyword
1936     : PARSEOP_SLAVEMODE_CONTROLLERINIT      {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_CONTROLLERINIT);}
1937     | PARSEOP_SLAVEMODE_DEVICEINIT          {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_DEVICEINIT);}
1938     ;
1939
1940 StopBitsKeyword
1941     : PARSEOP_STOPBITS_TWO                  {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_TWO);}
1942     | PARSEOP_STOPBITS_ONEPLUSHALF          {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONEPLUSHALF);}
1943     | PARSEOP_STOPBITS_ONE                  {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONE);}
1944     | PARSEOP_STOPBITS_ZERO                 {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ZERO);}
1945     ;
1946
1947 TranslationKeyword
1948     : PARSEOP_TRANSLATIONTYPE_SPARSE        {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);}
1949     | PARSEOP_TRANSLATIONTYPE_DENSE         {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);}
1950     ;
1951
1952 TypeKeyword
1953     : PARSEOP_TYPE_TRANSLATION              {$$ = TrCreateLeafNode (PARSEOP_TYPE_TRANSLATION);}
1954     | PARSEOP_TYPE_STATIC                   {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);}
1955     ;
1956
1957 UpdateRuleKeyword
1958     : PARSEOP_UPDATERULE_PRESERVE           {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);}
1959     | PARSEOP_UPDATERULE_ONES               {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);}
1960     | PARSEOP_UPDATERULE_ZEROS              {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);}
1961     ;
1962
1963 WireModeKeyword
1964     : PARSEOP_WIREMODE_FOUR                 {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_FOUR);}
1965     | PARSEOP_WIREMODE_THREE                {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_THREE);}
1966     ;
1967
1968 XferSizeKeyword
1969     : PARSEOP_XFERSIZE_8                    {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_8,   0);}
1970     | PARSEOP_XFERSIZE_16                   {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_16,  1);}
1971     | PARSEOP_XFERSIZE_32                   {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32,  2);}
1972     | PARSEOP_XFERSIZE_64                   {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_64,  3);}
1973     | PARSEOP_XFERSIZE_128                  {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_128, 4);}
1974     | PARSEOP_XFERSIZE_256                  {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_256, 5);}
1975     ;
1976
1977 XferTypeKeyword
1978     : PARSEOP_XFERTYPE_8                    {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);}
1979     | PARSEOP_XFERTYPE_8_16                 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);}
1980     | PARSEOP_XFERTYPE_16                   {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_16);}
1981     ;
1982
1983
1984 /******* Miscellaneous Types **************************************************/
1985
1986
1987 SuperName
1988     : NameString                    {}
1989     | ArgTerm                       {}
1990     | LocalTerm                     {}
1991     | DebugTerm                     {}
1992     | Type6Opcode                   {}
1993
1994 /* For ObjectType: SuperName except for MethodInvocationTerm */
1995
1996 ObjectTypeName
1997     : NameString                    {}
1998     | ArgTerm                       {}
1999     | LocalTerm                     {}
2000     | DebugTerm                     {}
2001     | RefOfTerm                     {}
2002     | DerefOfTerm                   {}
2003     | IndexTerm                     {}
2004
2005 /*    | MethodInvocationTerm          {} */  /* Caused reduce/reduce with Type6Opcode->MethodInvocationTerm */
2006     ;
2007
2008 ArgTerm
2009     : PARSEOP_ARG0                  {$$ = TrCreateLeafNode (PARSEOP_ARG0);}
2010     | PARSEOP_ARG1                  {$$ = TrCreateLeafNode (PARSEOP_ARG1);}
2011     | PARSEOP_ARG2                  {$$ = TrCreateLeafNode (PARSEOP_ARG2);}
2012     | PARSEOP_ARG3                  {$$ = TrCreateLeafNode (PARSEOP_ARG3);}
2013     | PARSEOP_ARG4                  {$$ = TrCreateLeafNode (PARSEOP_ARG4);}
2014     | PARSEOP_ARG5                  {$$ = TrCreateLeafNode (PARSEOP_ARG5);}
2015     | PARSEOP_ARG6                  {$$ = TrCreateLeafNode (PARSEOP_ARG6);}
2016     ;
2017
2018 LocalTerm
2019     : PARSEOP_LOCAL0                {$$ = TrCreateLeafNode (PARSEOP_LOCAL0);}
2020     | PARSEOP_LOCAL1                {$$ = TrCreateLeafNode (PARSEOP_LOCAL1);}
2021     | PARSEOP_LOCAL2                {$$ = TrCreateLeafNode (PARSEOP_LOCAL2);}
2022     | PARSEOP_LOCAL3                {$$ = TrCreateLeafNode (PARSEOP_LOCAL3);}
2023     | PARSEOP_LOCAL4                {$$ = TrCreateLeafNode (PARSEOP_LOCAL4);}
2024     | PARSEOP_LOCAL5                {$$ = TrCreateLeafNode (PARSEOP_LOCAL5);}
2025     | PARSEOP_LOCAL6                {$$ = TrCreateLeafNode (PARSEOP_LOCAL6);}
2026     | PARSEOP_LOCAL7                {$$ = TrCreateLeafNode (PARSEOP_LOCAL7);}
2027     ;
2028
2029 DebugTerm
2030     : PARSEOP_DEBUG                 {$$ = TrCreateLeafNode (PARSEOP_DEBUG);}
2031     ;
2032
2033
2034 ByteConst
2035     : Integer                       {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
2036     ;
2037
2038 WordConst
2039     : Integer                       {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
2040     ;
2041
2042 DWordConst
2043     : Integer                       {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
2044     ;
2045
2046 QWordConst
2047     : Integer                       {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
2048     ;
2049
2050 Integer
2051     : PARSEOP_INTEGER               {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, AslCompilerlval.i);}
2052     ;
2053
2054 String
2055     : PARSEOP_STRING_LITERAL        {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (ACPI_NATIVE_INT) AslCompilerlval.s);}
2056     ;
2057
2058 ConstTerm
2059     : ConstExprTerm                 {}
2060     | PARSEOP_REVISION              {$$ = TrCreateLeafNode (PARSEOP_REVISION);}
2061     ;
2062
2063 ConstExprTerm
2064     : PARSEOP_ZERO                  {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
2065     | PARSEOP_ONE                   {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
2066     | PARSEOP_ONES                  {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
2067     | PARSEOP___DATE__              {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);}
2068     | PARSEOP___FILE__              {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);}
2069     | PARSEOP___LINE__              {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);}
2070     | PARSEOP___PATH__              {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);}
2071     ;
2072
2073 /*
2074  * The NODE_COMPILE_TIME_CONST flag in the following constant expressions
2075  * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes
2076  * to simple integers. It is an error if these types of expressions cannot be
2077  * reduced, since the AML grammar for ****ConstExpr requires a simple constant.
2078  * Note: The required byte length of the constant is passed through to the
2079  * constant folding code in the node AmlLength field.
2080  */
2081 ByteConstExpr
2082     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);}
2083     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);}
2084     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
2085     | ByteConst                     {}
2086     ;
2087
2088 WordConstExpr
2089     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);}
2090     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);}
2091     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
2092     | WordConst                     {}
2093     ;
2094
2095 DWordConstExpr
2096     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);}
2097     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);}
2098     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
2099     | DWordConst                    {}
2100     ;
2101
2102 QWordConstExpr
2103     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);}
2104     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);}
2105     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
2106     | QWordConst                    {}
2107     ;
2108
2109 /* OptionalCount must appear before ByteList or an incorrect reduction will result */
2110
2111 OptionalCount
2112     :                               {$$ = TrCreateLeafNode (PARSEOP_ONES);}       /* Placeholder is a OnesOp object */
2113     | ','                           {$$ = TrCreateLeafNode (PARSEOP_ONES);}       /* Placeholder is a OnesOp object */
2114     | ',' TermArg                   {$$ = $2;}
2115     ;
2116
2117 BufferTerm
2118     : PARSEOP_BUFFER '('            {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);}
2119         OptionalTermArg
2120         ')' '{'
2121             BufferTermData '}'      {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
2122     | PARSEOP_BUFFER '('
2123         error ')'                   {$$ = AslDoError(); yyclearin;}
2124     ;
2125
2126 BufferTermData
2127     : ByteList                      {}
2128     | StringData                    {}
2129     ;
2130
2131 ByteList
2132     :                               {$$ = NULL;}
2133     | ByteConstExpr
2134     | ByteList ','                  /* Allows a trailing comma at list end */
2135     | ByteList ','
2136         ByteConstExpr               {$$ = TrLinkPeerNode ($1,$3);}
2137     ;
2138
2139 DataBufferTerm
2140     : PARSEOP_DATABUFFER  '('       {$<n>$ = TrCreateLeafNode (PARSEOP_DATABUFFER);}
2141         OptionalWordConst
2142         ')' '{'
2143             ByteList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
2144     | PARSEOP_DATABUFFER '('
2145         error ')'                   {$$ = AslDoError(); yyclearin;}
2146     ;
2147
2148 DWordList
2149     :                               {$$ = NULL;}
2150     | DWordConstExpr
2151     | DWordList ','                 /* Allows a trailing comma at list end */
2152     | DWordList ','
2153         DWordConstExpr              {$$ = TrLinkPeerNode ($1,$3);}
2154     ;
2155
2156 PackageTerm
2157     : PARSEOP_PACKAGE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);}
2158         VarPackageLengthTerm
2159         ')' '{'
2160             PackageList '}'         {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
2161     | PARSEOP_PACKAGE '('
2162         error ')'                   {$$ = AslDoError(); yyclearin;}
2163     ;
2164
2165 PackageList
2166     :                               {$$ = NULL;}
2167     | PackageElement
2168     | PackageList ','               /* Allows a trailing comma at list end */
2169     | PackageList ','
2170         PackageElement              {$$ = TrLinkPeerNode ($1,$3);}
2171     ;
2172
2173 PackageElement
2174     : DataObject                    {}
2175     | NameString                    {}
2176     ;
2177
2178 VarPackageLengthTerm
2179     :                               {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
2180     | TermArg                       {$$ = $1;}
2181     ;
2182
2183
2184 /******* Macros ***********************************************/
2185
2186
2187 EISAIDTerm
2188     : PARSEOP_EISAID '('
2189         StringData ')'              {$$ = TrUpdateNode (PARSEOP_EISAID, $3);}
2190     | PARSEOP_EISAID '('
2191         error ')'                   {$$ = AslDoError(); yyclearin;}
2192     ;
2193
2194 UnicodeTerm
2195     : PARSEOP_UNICODE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_UNICODE);}
2196         StringData
2197         ')'                         {$$ = TrLinkChildren ($<n>3,2,0,$4);}
2198     | PARSEOP_UNICODE '('
2199         error ')'                   {$$ = AslDoError(); yyclearin;}
2200     ;
2201
2202
2203 /******* Resources and Memory ***********************************************/
2204
2205
2206 /*
2207  * Note: Create two default nodes to allow conversion to a Buffer AML opcode
2208  * Also, insert the EndTag at the end of the template.
2209  */
2210 ResourceTemplateTerm
2211     : PARSEOP_RESOURCETEMPLATE '(' ')'
2212         '{'
2213         ResourceMacroList '}'       {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,4,
2214                                           TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
2215                                           TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
2216                                           $5,
2217                                           TrCreateLeafNode (PARSEOP_ENDTAG));}
2218     ;
2219
2220 ResourceMacroList
2221     :                               {$$ = NULL;}
2222     | ResourceMacroList
2223         ResourceMacroTerm           {$$ = TrLinkPeerNode ($1,$2);}
2224     ;
2225
2226 ResourceMacroTerm
2227     : DMATerm                       {}
2228     | DWordIOTerm                   {}
2229     | DWordMemoryTerm               {}
2230     | DWordSpaceTerm                {}
2231     | EndDependentFnTerm            {}
2232     | ExtendedIOTerm                {}
2233     | ExtendedMemoryTerm            {}
2234     | ExtendedSpaceTerm             {}
2235     | FixedDmaTerm                  {}
2236     | FixedIOTerm                   {}
2237     | GpioIntTerm                   {}
2238     | GpioIoTerm                    {}
2239     | I2cSerialBusTerm              {}
2240     | InterruptTerm                 {}
2241     | IOTerm                        {}
2242     | IRQNoFlagsTerm                {}
2243     | IRQTerm                       {}
2244     | Memory24Term                  {}
2245     | Memory32FixedTerm             {}
2246     | Memory32Term                  {}
2247     | QWordIOTerm                   {}
2248     | QWordMemoryTerm               {}
2249     | QWordSpaceTerm                {}
2250     | RegisterTerm                  {}
2251     | SpiSerialBusTerm              {}
2252     | StartDependentFnNoPriTerm     {}
2253     | StartDependentFnTerm          {}
2254     | UartSerialBusTerm             {}
2255     | VendorLongTerm                {}
2256     | VendorShortTerm               {}
2257     | WordBusNumberTerm             {}
2258     | WordIOTerm                    {}
2259     | WordSpaceTerm                 {}
2260     ;
2261
2262 DMATerm
2263     : PARSEOP_DMA '('               {$<n>$ = TrCreateLeafNode (PARSEOP_DMA);}
2264         DMATypeKeyword
2265         OptionalBusMasterKeyword
2266         ',' XferTypeKeyword
2267         OptionalNameString_Last
2268         ')' '{'
2269             ByteList '}'            {$$ = TrLinkChildren ($<n>3,5,$4,$5,$7,$8,$11);}
2270     | PARSEOP_DMA '('
2271         error ')'                   {$$ = AslDoError(); yyclearin;}
2272     ;
2273
2274 DWordIOTerm
2275     : PARSEOP_DWORDIO '('           {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDIO);}
2276         OptionalResourceType_First
2277         OptionalMinType
2278         OptionalMaxType
2279         OptionalDecodeType
2280         OptionalRangeType
2281         ',' DWordConstExpr
2282         ',' DWordConstExpr
2283         ',' DWordConstExpr
2284         ',' DWordConstExpr
2285         ',' DWordConstExpr
2286         OptionalByteConstExpr
2287         OptionalStringData
2288         OptionalNameString
2289         OptionalType
2290         OptionalTranslationType_Last
2291         ')'                         {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);}
2292     | PARSEOP_DWORDIO '('
2293         error ')'                   {$$ = AslDoError(); yyclearin;}
2294     ;
2295
2296 DWordMemoryTerm
2297     : PARSEOP_DWORDMEMORY '('       {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDMEMORY);}
2298         OptionalResourceType_First
2299         OptionalDecodeType
2300         OptionalMinType
2301         OptionalMaxType
2302         OptionalMemType
2303         ',' OptionalReadWriteKeyword
2304         ',' DWordConstExpr
2305         ',' DWordConstExpr
2306         ',' DWordConstExpr
2307         ',' DWordConstExpr
2308         ',' DWordConstExpr
2309         OptionalByteConstExpr
2310         OptionalStringData
2311         OptionalNameString
2312         OptionalAddressRange
2313         OptionalType_Last
2314         ')'                         {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);}
2315     | PARSEOP_DWORDMEMORY '('
2316         error ')'                   {$$ = AslDoError(); yyclearin;}
2317     ;
2318
2319 DWordSpaceTerm
2320     : PARSEOP_DWORDSPACE '('        {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDSPACE);}
2321         ByteConstExpr               {UtCheckIntegerRange ($4, 0xC0, 0xFF);}
2322         OptionalResourceType
2323         OptionalDecodeType
2324         OptionalMinType
2325         OptionalMaxType
2326         ',' ByteConstExpr
2327         ',' DWordConstExpr
2328         ',' DWordConstExpr
2329         ',' DWordConstExpr
2330         ',' DWordConstExpr
2331         ',' DWordConstExpr
2332         OptionalByteConstExpr
2333         OptionalStringData
2334         OptionalNameString_Last
2335         ')'                         {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);}
2336     | PARSEOP_DWORDSPACE '('
2337         error ')'                   {$$ = AslDoError(); yyclearin;}
2338     ;
2339
2340
2341 EndDependentFnTerm
2342     : PARSEOP_ENDDEPENDENTFN '('
2343         ')'                         {$$ = TrCreateLeafNode (PARSEOP_ENDDEPENDENTFN);}
2344     | PARSEOP_ENDDEPENDENTFN '('
2345         error ')'                   {$$ = AslDoError(); yyclearin;}
2346     ;
2347
2348 ExtendedIOTerm
2349     : PARSEOP_EXTENDEDIO '('        {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDIO);}
2350         OptionalResourceType_First
2351         OptionalMinType
2352         OptionalMaxType
2353         OptionalDecodeType
2354         OptionalRangeType
2355         ',' QWordConstExpr
2356         ',' QWordConstExpr
2357         ',' QWordConstExpr
2358         ',' QWordConstExpr
2359         ',' QWordConstExpr
2360         OptionalQWordConstExpr
2361         OptionalNameString
2362         OptionalType
2363         OptionalTranslationType_Last
2364         ')'                         {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22);}
2365     | PARSEOP_EXTENDEDIO '('
2366         error ')'                   {$$ = AslDoError(); yyclearin;}
2367     ;
2368
2369 ExtendedMemoryTerm
2370     : PARSEOP_EXTENDEDMEMORY '('    {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDMEMORY);}
2371         OptionalResourceType_First
2372         OptionalDecodeType
2373         OptionalMinType
2374         OptionalMaxType
2375         OptionalMemType
2376         ',' OptionalReadWriteKeyword
2377         ',' QWordConstExpr
2378         ',' QWordConstExpr
2379         ',' QWordConstExpr
2380         ',' QWordConstExpr
2381         ',' QWordConstExpr
2382         OptionalQWordConstExpr
2383         OptionalNameString
2384         OptionalAddressRange
2385         OptionalType_Last
2386         ')'                         {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24);}
2387     | PARSEOP_EXTENDEDMEMORY '('
2388         error ')'                   {$$ = AslDoError(); yyclearin;}
2389     ;
2390
2391 ExtendedSpaceTerm
2392     : PARSEOP_EXTENDEDSPACE '('     {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDSPACE);}
2393         ByteConstExpr               {UtCheckIntegerRange ($4, 0xC0, 0xFF);}
2394         OptionalResourceType
2395         OptionalDecodeType
2396         OptionalMinType
2397         OptionalMaxType
2398         ',' ByteConstExpr
2399         ',' QWordConstExpr
2400         ',' QWordConstExpr
2401         ',' QWordConstExpr
2402         ',' QWordConstExpr
2403         ',' QWordConstExpr
2404         OptionalQWordConstExpr
2405         OptionalNameString_Last
2406         ')'                         {$$ = TrLinkChildren ($<n>3,13,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23);}
2407     | PARSEOP_EXTENDEDSPACE '('
2408         error ')'                   {$$ = AslDoError(); yyclearin;}
2409     ;
2410
2411 FixedDmaTerm
2412     : PARSEOP_FIXEDDMA '('          {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDDMA);}
2413         WordConstExpr               /* 04: DMA RequestLines */
2414         ',' WordConstExpr           /* 06: DMA Channels */
2415         OptionalXferSize            /* 07: DMA TransferSize */
2416         OptionalNameString          /* 08: DescriptorName */
2417         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$6,$7,$8);}
2418     | PARSEOP_FIXEDDMA '('
2419         error ')'                   {$$ = AslDoError(); yyclearin;}
2420     ;
2421
2422 FixedIOTerm
2423     : PARSEOP_FIXEDIO '('           {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDIO);}
2424         WordConstExpr
2425         ',' ByteConstExpr
2426         OptionalNameString_Last
2427         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);}
2428     | PARSEOP_FIXEDIO '('
2429         error ')'                   {$$ = AslDoError(); yyclearin;}
2430     ;
2431
2432 GpioIntTerm
2433     : PARSEOP_GPIO_INT '('          {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_INT);}
2434         InterruptTypeKeyword        /* 04: InterruptType */
2435         ',' InterruptLevel          /* 06: InterruptLevel */
2436         OptionalShareType           /* 07: SharedType */
2437         ',' PinConfigByte           /* 09: PinConfig */
2438         OptionalWordConstExpr       /* 10: DebounceTimeout */
2439         ',' StringData              /* 12: ResourceSource */
2440         OptionalByteConstExpr       /* 13: ResourceSourceIndex */
2441         OptionalResourceType        /* 14: ResourceType */
2442         OptionalNameString          /* 15: DescriptorName */
2443         OptionalBuffer_Last         /* 16: VendorData */
2444         ')' '{'
2445             DWordConstExpr '}'      {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);}
2446     | PARSEOP_GPIO_INT '('
2447         error ')'                   {$$ = AslDoError(); yyclearin;}
2448     ;
2449
2450 GpioIoTerm
2451     : PARSEOP_GPIO_IO '('           {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_IO);}
2452         OptionalShareType_First     /* 04: SharedType */
2453         ',' PinConfigByte           /* 06: PinConfig */
2454         OptionalWordConstExpr       /* 07: DebounceTimeout */
2455         OptionalWordConstExpr       /* 08: DriveStrength */
2456         OptionalIoRestriction       /* 09: IoRestriction */
2457         ',' StringData              /* 11: ResourceSource */
2458         OptionalByteConstExpr       /* 12: ResourceSourceIndex */
2459         OptionalResourceType        /* 13: ResourceType */
2460         OptionalNameString          /* 14: DescriptorName */
2461         OptionalBuffer_Last         /* 15: VendorData */
2462         ')' '{'
2463             DWordList '}'           {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);}
2464     | PARSEOP_GPIO_IO '('
2465         error ')'                   {$$ = AslDoError(); yyclearin;}
2466     ;
2467
2468 I2cSerialBusTerm
2469     : PARSEOP_I2C_SERIALBUS '('     {$<n>$ = TrCreateLeafNode (PARSEOP_I2C_SERIALBUS);}
2470         WordConstExpr               /* 04: SlaveAddress */
2471         OptionalSlaveMode           /* 05: SlaveMode */
2472         ',' DWordConstExpr          /* 07: ConnectionSpeed */
2473         OptionalAddressingMode      /* 08: AddressingMode */
2474         ',' StringData              /* 10: ResourceSource */
2475         OptionalByteConstExpr       /* 11: ResourceSourceIndex */
2476         OptionalResourceType        /* 12: ResourceType */
2477         OptionalNameString          /* 13: DescriptorName */
2478         OptionalBuffer_Last         /* 14: VendorData */
2479         ')'                         {$$ = TrLinkChildren ($<n>3,9,$4,$5,$7,$8,$10,$11,$12,$13,$14);}
2480     | PARSEOP_I2C_SERIALBUS '('
2481         error ')'                   {$$ = AslDoError(); yyclearin;}
2482     ;
2483
2484 InterruptTerm
2485     : PARSEOP_INTERRUPT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_INTERRUPT);}
2486         OptionalResourceType_First
2487         ',' InterruptTypeKeyword
2488         ',' InterruptLevel
2489         OptionalShareType
2490         OptionalByteConstExpr
2491         OptionalStringData
2492         OptionalNameString_Last
2493         ')' '{'
2494             DWordList '}'           {$$ = TrLinkChildren ($<n>3,8,$4,$6,$8,$9,$10,$11,$12,$15);}
2495     | PARSEOP_INTERRUPT '('
2496         error ')'                   {$$ = AslDoError(); yyclearin;}
2497     ;
2498
2499 IOTerm
2500     : PARSEOP_IO '('                {$<n>$ = TrCreateLeafNode (PARSEOP_IO);}
2501         IODecodeKeyword
2502         ',' WordConstExpr
2503         ',' WordConstExpr
2504         ',' ByteConstExpr
2505         ',' ByteConstExpr
2506         OptionalNameString_Last
2507         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);}
2508     | PARSEOP_IO '('
2509         error ')'                   {$$ = AslDoError(); yyclearin;}
2510     ;
2511
2512 IRQNoFlagsTerm
2513     : PARSEOP_IRQNOFLAGS '('        {$<n>$ = TrCreateLeafNode (PARSEOP_IRQNOFLAGS);}
2514         OptionalNameString_First
2515         ')' '{'
2516             ByteList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
2517     | PARSEOP_IRQNOFLAGS '('
2518         error ')'                   {$$ = AslDoError(); yyclearin;}
2519     ;
2520
2521 IRQTerm
2522     : PARSEOP_IRQ '('               {$<n>$ = TrCreateLeafNode (PARSEOP_IRQ);}
2523         InterruptTypeKeyword
2524         ',' InterruptLevel
2525         OptionalShareType
2526         OptionalNameString_Last
2527         ')' '{'
2528             ByteList '}'            {$$ = TrLinkChildren ($<n>3,5,$4,$6,$7,$8,$11);}
2529     | PARSEOP_IRQ '('
2530         error ')'                   {$$ = AslDoError(); yyclearin;}
2531     ;
2532
2533 Memory24Term
2534     : PARSEOP_MEMORY24 '('          {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY24);}
2535         OptionalReadWriteKeyword
2536         ',' WordConstExpr
2537         ',' WordConstExpr
2538         ',' WordConstExpr
2539         ',' WordConstExpr
2540         OptionalNameString_Last
2541         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);}
2542     | PARSEOP_MEMORY24 '('
2543         error ')'                   {$$ = AslDoError(); yyclearin;}
2544     ;
2545
2546 Memory32FixedTerm
2547     : PARSEOP_MEMORY32FIXED '('     {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY32FIXED);}
2548         OptionalReadWriteKeyword
2549         ',' DWordConstExpr
2550         ',' DWordConstExpr
2551         OptionalNameString_Last
2552         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$6,$8,$9);}
2553     | PARSEOP_MEMORY32FIXED '('
2554         error ')'                   {$$ = AslDoError(); yyclearin;}
2555     ;
2556
2557 Memory32Term
2558     : PARSEOP_MEMORY32 '('          {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY32);}
2559         OptionalReadWriteKeyword
2560         ',' DWordConstExpr
2561         ',' DWordConstExpr
2562         ',' DWordConstExpr
2563         ',' DWordConstExpr
2564         OptionalNameString_Last
2565         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);}
2566     | PARSEOP_MEMORY32 '('
2567         error ')'                   {$$ = AslDoError(); yyclearin;}
2568     ;
2569
2570 QWordIOTerm
2571     : PARSEOP_QWORDIO '('           {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDIO);}
2572         OptionalResourceType_First
2573         OptionalMinType
2574         OptionalMaxType
2575         OptionalDecodeType
2576         OptionalRangeType
2577         ',' QWordConstExpr
2578         ',' QWordConstExpr
2579         ',' QWordConstExpr
2580         ',' QWordConstExpr
2581         ',' QWordConstExpr
2582         OptionalByteConstExpr
2583         OptionalStringData
2584         OptionalNameString
2585         OptionalType
2586         OptionalTranslationType_Last
2587         ')'                         {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);}
2588     | PARSEOP_QWORDIO '('
2589         error ')'                   {$$ = AslDoError(); yyclearin;}
2590     ;
2591
2592 QWordMemoryTerm
2593     : PARSEOP_QWORDMEMORY '('       {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDMEMORY);}
2594         OptionalResourceType_First
2595         OptionalDecodeType
2596         OptionalMinType
2597         OptionalMaxType
2598         OptionalMemType
2599         ',' OptionalReadWriteKeyword
2600         ',' QWordConstExpr
2601         ',' QWordConstExpr
2602         ',' QWordConstExpr
2603         ',' QWordConstExpr
2604         ',' QWordConstExpr
2605         OptionalByteConstExpr
2606         OptionalStringData
2607         OptionalNameString
2608         OptionalAddressRange
2609         OptionalType_Last
2610         ')'                         {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);}
2611     | PARSEOP_QWORDMEMORY '('
2612         error ')'                   {$$ = AslDoError(); yyclearin;}
2613     ;
2614
2615 QWordSpaceTerm
2616     : PARSEOP_QWORDSPACE '('        {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDSPACE);}
2617         ByteConstExpr               {UtCheckIntegerRange ($4, 0xC0, 0xFF);}
2618         OptionalResourceType
2619         OptionalDecodeType
2620         OptionalMinType
2621         OptionalMaxType
2622         ',' ByteConstExpr
2623         ',' QWordConstExpr
2624         ',' QWordConstExpr
2625         ',' QWordConstExpr
2626         ',' QWordConstExpr
2627         ',' QWordConstExpr
2628         OptionalByteConstExpr
2629         OptionalStringData
2630         OptionalNameString_Last
2631         ')'                         {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);}
2632     | PARSEOP_QWORDSPACE '('
2633         error ')'                   {$$ = AslDoError(); yyclearin;}
2634     ;
2635
2636 RegisterTerm
2637     : PARSEOP_REGISTER '('          {$<n>$ = TrCreateLeafNode (PARSEOP_REGISTER);}
2638         AddressSpaceKeyword
2639         ',' ByteConstExpr
2640         ',' ByteConstExpr
2641         ',' QWordConstExpr
2642         OptionalAccessSize
2643         OptionalNameString_Last
2644         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$11,$12);}
2645     | PARSEOP_REGISTER '('
2646         error ')'                   {$$ = AslDoError(); yyclearin;}
2647     ;
2648
2649 SpiSerialBusTerm
2650     : PARSEOP_SPI_SERIALBUS '('     {$<n>$ = TrCreateLeafNode (PARSEOP_SPI_SERIALBUS);}
2651         WordConstExpr               /* 04: DeviceSelection */
2652         OptionalDevicePolarity      /* 05: DevicePolarity */
2653         OptionalWireMode            /* 06: WireMode */
2654         ',' ByteConstExpr           /* 08: DataBitLength */
2655         OptionalSlaveMode           /* 09: SlaveMode */
2656         ',' DWordConstExpr          /* 11: ConnectionSpeed */
2657         ',' ClockPolarityKeyword    /* 13: ClockPolarity */
2658         ',' ClockPhaseKeyword       /* 15: ClockPhase */
2659         ',' StringData              /* 17: ResourceSource */
2660         OptionalByteConstExpr       /* 18: ResourceSourceIndex */
2661         OptionalResourceType        /* 19: ResourceType */
2662         OptionalNameString          /* 20: DescriptorName */
2663         OptionalBuffer_Last         /* 21: VendorData */
2664         ')'                         {$$ = TrLinkChildren ($<n>3,13,$4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20,$21);}
2665     | PARSEOP_SPI_SERIALBUS '('
2666         error ')'                   {$$ = AslDoError(); yyclearin;}
2667     ;
2668
2669 StartDependentFnNoPriTerm
2670     : PARSEOP_STARTDEPENDENTFN_NOPRI '('    {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);}
2671         ')' '{'
2672         ResourceMacroList '}'       {$$ = TrLinkChildren ($<n>3,1,$6);}
2673     | PARSEOP_STARTDEPENDENTFN_NOPRI '('
2674         error ')'                   {$$ = AslDoError(); yyclearin;}
2675     ;
2676
2677 StartDependentFnTerm
2678     : PARSEOP_STARTDEPENDENTFN '('  {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN);}
2679         ByteConstExpr
2680         ',' ByteConstExpr
2681         ')' '{'
2682         ResourceMacroList '}'       {$$ = TrLinkChildren ($<n>3,3,$4,$6,$9);}
2683     | PARSEOP_STARTDEPENDENTFN '('
2684         error ')'                   {$$ = AslDoError(); yyclearin;}
2685     ;
2686
2687 UartSerialBusTerm
2688     : PARSEOP_UART_SERIALBUS '('    {$<n>$ = TrCreateLeafNode (PARSEOP_UART_SERIALBUS);}
2689         DWordConstExpr              /* 04: ConnectionSpeed */
2690         OptionalBitsPerByte         /* 05: BitsPerByte */
2691         OptionalStopBits            /* 06: StopBits */
2692         ',' ByteConstExpr           /* 08: LinesInUse */
2693         OptionalEndian              /* 09: Endianess */
2694         OptionalParityType          /* 10: Parity */
2695         OptionalFlowControl         /* 11: FlowControl */
2696         ',' WordConstExpr           /* 13: Rx BufferSize */
2697         ',' WordConstExpr           /* 15: Tx BufferSize */
2698         ',' StringData              /* 17: ResourceSource */
2699         OptionalByteConstExpr       /* 18: ResourceSourceIndex */
2700         OptionalResourceType        /* 19: ResourceType */
2701         OptionalNameString          /* 20: DescriptorName */
2702         OptionalBuffer_Last         /* 21: VendorData */
2703         ')'                         {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20,$21);}
2704     | PARSEOP_UART_SERIALBUS '('
2705         error ')'                   {$$ = AslDoError(); yyclearin;}
2706     ;
2707
2708 VendorLongTerm
2709     : PARSEOP_VENDORLONG '('        {$<n>$ = TrCreateLeafNode (PARSEOP_VENDORLONG);}
2710         OptionalNameString_First
2711         ')' '{'
2712             ByteList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
2713     | PARSEOP_VENDORLONG '('
2714         error ')'                   {$$ = AslDoError(); yyclearin;}
2715     ;
2716
2717 VendorShortTerm
2718     : PARSEOP_VENDORSHORT '('       {$<n>$ = TrCreateLeafNode (PARSEOP_VENDORSHORT);}
2719         OptionalNameString_First
2720         ')' '{'
2721             ByteList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
2722     | PARSEOP_VENDORSHORT '('
2723         error ')'                   {$$ = AslDoError(); yyclearin;}
2724     ;
2725
2726 WordBusNumberTerm
2727     : PARSEOP_WORDBUSNUMBER '('     {$<n>$ = TrCreateLeafNode (PARSEOP_WORDBUSNUMBER);}
2728         OptionalResourceType_First
2729         OptionalMinType
2730         OptionalMaxType
2731         OptionalDecodeType
2732         ',' WordConstExpr
2733         ',' WordConstExpr
2734         ',' WordConstExpr
2735         ',' WordConstExpr
2736         ',' WordConstExpr
2737         OptionalByteConstExpr
2738         OptionalStringData
2739         OptionalNameString_Last
2740         ')'                         {$$ = TrLinkChildren ($<n>3,12,$4,$5,$6,$7,$9,$11,$13,$15,$17,$18,$19,$20);}
2741     | PARSEOP_WORDBUSNUMBER '('
2742         error ')'                   {$$ = AslDoError(); yyclearin;}
2743     ;
2744
2745 WordIOTerm
2746     : PARSEOP_WORDIO '('            {$<n>$ = TrCreateLeafNode (PARSEOP_WORDIO);}
2747         OptionalResourceType_First
2748         OptionalMinType
2749         OptionalMaxType
2750         OptionalDecodeType
2751         OptionalRangeType
2752         ',' WordConstExpr
2753         ',' WordConstExpr
2754         ',' WordConstExpr
2755         ',' WordConstExpr
2756         ',' WordConstExpr
2757         OptionalByteConstExpr
2758         OptionalStringData
2759         OptionalNameString
2760         OptionalType
2761         OptionalTranslationType_Last
2762         ')'                         {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);}
2763     | PARSEOP_WORDIO '('
2764         error ')'                   {$$ = AslDoError(); yyclearin;}
2765     ;
2766
2767 WordSpaceTerm
2768     : PARSEOP_WORDSPACE '('         {$<n>$ = TrCreateLeafNode (PARSEOP_WORDSPACE);}
2769         ByteConstExpr               {UtCheckIntegerRange ($4, 0xC0, 0xFF);}
2770         OptionalResourceType
2771         OptionalDecodeType
2772         OptionalMinType
2773         OptionalMaxType
2774         ',' ByteConstExpr
2775         ',' WordConstExpr
2776         ',' WordConstExpr
2777         ',' WordConstExpr
2778         ',' WordConstExpr
2779         ',' WordConstExpr
2780         OptionalByteConstExpr
2781         OptionalStringData
2782         OptionalNameString_Last
2783         ')'                         {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);}
2784     | PARSEOP_WORDSPACE '('
2785         error ')'                   {$$ = AslDoError(); yyclearin;}
2786     ;
2787
2788
2789 /******* Object References ***********************************************/
2790
2791 /* Allow IO, DMA, IRQ Resource macro names to also be used as identifiers */
2792
2793 NameString
2794     : NameSeg                       {}
2795     | PARSEOP_NAMESTRING            {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);}
2796     | PARSEOP_IO                    {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");}
2797     | PARSEOP_DMA                   {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");}
2798     | PARSEOP_IRQ                   {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");}
2799     ;
2800
2801 NameSeg
2802     : PARSEOP_NAMESEG               {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) AslCompilerlval.s);}
2803     ;
2804
2805
2806 /******* Helper rules ****************************************************/
2807
2808
2809 AmlPackageLengthTerm
2810     : Integer                       {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,(ACPI_PARSE_OBJECT *) $1);}
2811     ;
2812
2813 NameStringItem
2814     : ',' NameString                {$$ = $2;}
2815     | ',' error                     {$$ = AslDoError (); yyclearin;}
2816     ;
2817
2818 TermArgItem
2819     : ',' TermArg                   {$$ = $2;}
2820     | ',' error                     {$$ = AslDoError (); yyclearin;}
2821     ;
2822
2823 OptionalBusMasterKeyword
2824     : ','                                       {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);}
2825     | ',' PARSEOP_BUSMASTERTYPE_MASTER          {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);}
2826     | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER       {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_NOTMASTER);}
2827     ;
2828
2829 OptionalAccessAttribTerm
2830     :                               {$$ = NULL;}
2831     | ','                           {$$ = NULL;}
2832     | ',' ByteConstExpr             {$$ = $2;}
2833     | ',' AccessAttribKeyword       {$$ = $2;}
2834     ;
2835
2836 OptionalAccessSize
2837     :                               {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);}
2838     | ','                           {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);}
2839     | ',' ByteConstExpr             {$$ = $2;}
2840     ;
2841
2842 OptionalAddressingMode
2843     : ','                           {$$ = NULL;}
2844     | ',' AddressingModeKeyword     {$$ = $2;}
2845     ;
2846
2847 OptionalAddressRange
2848     :                               {$$ = NULL;}
2849     | ','                           {$$ = NULL;}
2850     | ',' AddressKeyword            {$$ = $2;}
2851     ;
2852
2853 OptionalBitsPerByte
2854     : ','                           {$$ = NULL;}
2855     | ',' BitsPerByteKeyword        {$$ = $2;}
2856     ;
2857
2858 OptionalBuffer_Last
2859     :                               {$$ = NULL;}
2860     | ','                           {$$ = NULL;}
2861     | ',' DataBufferTerm            {$$ = $2;}
2862     ;
2863
2864 OptionalByteConstExpr
2865     :                               {$$ = NULL;}
2866     | ','                           {$$ = NULL;}
2867     | ',' ByteConstExpr             {$$ = $2;}
2868     ;
2869
2870 OptionalDecodeType
2871     : ','                           {$$ = NULL;}
2872     | ',' DecodeKeyword             {$$ = $2;}
2873     ;
2874
2875 OptionalDevicePolarity
2876     : ','                           {$$ = NULL;}
2877     | ',' DevicePolarityKeyword     {$$ = $2;}
2878     ;
2879
2880 OptionalDWordConstExpr
2881     :                               {$$ = NULL;}
2882     | ','                           {$$ = NULL;}
2883     | ',' DWordConstExpr            {$$ = $2;}
2884     ;
2885
2886 OptionalEndian
2887     : ','                           {$$ = NULL;}
2888     | ',' EndianKeyword             {$$ = $2;}
2889     ;
2890
2891 OptionalFlowControl
2892     : ','                           {$$ = NULL;}
2893     | ',' FlowControlKeyword        {$$ = $2;}
2894     ;
2895
2896 OptionalIoRestriction
2897     : ','                           {$$ = NULL;}
2898     | ',' IoRestrictionKeyword      {$$ = $2;}
2899     ;
2900
2901 OptionalListString
2902     :                               {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));}   /* Placeholder is a NULL string */
2903     | ','                           {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));}   /* Placeholder is a NULL string */
2904     | ',' TermArg                   {$$ = $2;}
2905     ;
2906
2907 OptionalMaxType
2908     : ','                           {$$ = NULL;}
2909     | ',' MaxKeyword                {$$ = $2;}
2910     ;
2911
2912 OptionalMemType
2913     : ','                           {$$ = NULL;}
2914     | ',' MemTypeKeyword            {$$ = $2;}
2915     ;
2916
2917 OptionalMinType
2918     : ','                           {$$ = NULL;}
2919     | ',' MinKeyword                {$$ = $2;}
2920     ;
2921
2922 OptionalNameString
2923     :                               {$$ = NULL;}
2924     | ','                           {$$ = NULL;}
2925     | ',' NameString                {$$ = $2;}
2926     ;
2927
2928 OptionalNameString_Last
2929     :                               {$$ = NULL;}
2930     | ','                           {$$ = NULL;}
2931     | ',' NameString                {$$ = $2;}
2932     ;
2933
2934 OptionalNameString_First
2935     :                               {$$ = TrCreateLeafNode (PARSEOP_ZERO);}
2936     | NameString                    {$$ = $1;}
2937     ;
2938
2939 OptionalObjectTypeKeyword
2940     :                               {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);}
2941     | ',' ObjectTypeKeyword         {$$ = $2;}
2942     ;
2943
2944 OptionalParityType
2945     : ','                           {$$ = NULL;}
2946     | ',' ParityTypeKeyword         {$$ = $2;}
2947     ;
2948
2949 OptionalQWordConstExpr
2950     :                               {$$ = NULL;}
2951     | ','                           {$$ = NULL;}
2952     | ',' QWordConstExpr            {$$ = $2;}
2953     ;
2954
2955 OptionalRangeType
2956     : ','                           {$$ = NULL;}
2957     | ',' RangeTypeKeyword          {$$ = $2;}
2958     ;
2959
2960 OptionalReadWriteKeyword
2961     :                                   {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);}
2962     | PARSEOP_READWRITETYPE_BOTH        {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);}
2963     | PARSEOP_READWRITETYPE_READONLY    {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);}
2964     ;
2965
2966 OptionalReference
2967     :                               {$$ = TrCreateLeafNode (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
2968     | ','                           {$$ = TrCreateLeafNode (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
2969     | ',' TermArg                   {$$ = $2;}
2970     ;
2971
2972 OptionalResourceType_First
2973     :                               {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);}
2974     | ResourceTypeKeyword           {$$ = $1;}
2975     ;
2976
2977 OptionalResourceType
2978     :                               {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);}
2979     | ','                           {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);}
2980     | ',' ResourceTypeKeyword       {$$ = $2;}
2981     ;
2982
2983 OptionalReturnArg
2984     :                               {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);}       /* Placeholder is a ZeroOp object */
2985     | TermArg                       {$$ = $1;}
2986     ;
2987
2988 OptionalSerializeRuleKeyword
2989     :                               {$$ = NULL;}
2990     | ','                           {$$ = NULL;}
2991     | ',' SerializeRuleKeyword      {$$ = $2;}
2992     ;
2993
2994 OptionalSlaveMode
2995     : ','                           {$$ = NULL;}
2996     | ',' SlaveModeKeyword          {$$ = $2;}
2997     ;
2998
2999 OptionalShareType
3000     :                               {$$ = NULL;}
3001     | ','                           {$$ = NULL;}
3002     | ',' ShareTypeKeyword          {$$ = $2;}
3003     ;
3004
3005 OptionalShareType_First
3006     :                               {$$ = NULL;}
3007     | ShareTypeKeyword              {$$ = $1;}
3008     ;
3009
3010 OptionalStopBits
3011     : ','                           {$$ = NULL;}
3012     | ',' StopBitsKeyword           {$$ = $2;}
3013     ;
3014
3015 OptionalStringData
3016     :                               {$$ = NULL;}
3017     | ','                           {$$ = NULL;}
3018     | ',' StringData                {$$ = $2;}
3019     ;
3020
3021 OptionalTermArg
3022     :                               {$$ = NULL;}
3023     | TermArg                       {$$ = $1;}
3024     ;
3025
3026 OptionalType
3027     :                               {$$ = NULL;}
3028     | ','                           {$$ = NULL;}
3029     | ',' TypeKeyword               {$$ = $2;}
3030     ;
3031
3032 OptionalType_Last
3033     :                               {$$ = NULL;}
3034     | ','                           {$$ = NULL;}
3035     | ',' TypeKeyword               {$$ = $2;}
3036     ;
3037
3038 OptionalTranslationType_Last
3039     :                               {$$ = NULL;}
3040     | ','                           {$$ = NULL;}
3041     | ',' TranslationKeyword        {$$ = $2;}
3042     ;
3043
3044 OptionalWireMode
3045     : ','                           {$$ = NULL;}
3046     | ',' WireModeKeyword           {$$ = $2;}
3047     ;
3048
3049 OptionalWordConst
3050     :                               {$$ = NULL;}
3051     | WordConst                     {$$ = $1;}
3052     ;
3053
3054 OptionalWordConstExpr
3055     : ','                           {$$ = NULL;}
3056     | ',' WordConstExpr             {$$ = $2;}
3057     ;
3058
3059 OptionalXferSize
3060     :                               {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);}
3061     | ','                           {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);}
3062     | ',' XferSizeKeyword           {$$ = $2;}
3063     ;