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