xref: /dflybsd-src/sys/contrib/dev/acpica/source/compiler/aslrules.y (revision 9cefb7c89c63c495157c0c77d761030bf2bea9b0)
1 NoEcho('
2 /******************************************************************************
3  *
4  * Module Name: aslrules.y - Main Bison/Yacc production rules
5  *
6  *****************************************************************************/
7 
8 /*
9  * Copyright (C) 2000 - 2016, Intel Corp.
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions, and the following disclaimer,
17  *    without modification.
18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19  *    substantially similar to the "NO WARRANTY" disclaimer below
20  *    ("Disclaimer") and any redistribution must be conditioned upon
21  *    including a substantially similar Disclaimer requirement for further
22  *    binary redistribution.
23  * 3. Neither the names of the above-listed copyright holders nor the names
24  *    of any contributors may be used to endorse or promote products derived
25  *    from this software without specific prior written permission.
26  *
27  * Alternatively, this software may be distributed under the terms of the
28  * GNU General Public License ("GPL") version 2 as published by the Free
29  * Software Foundation.
30  *
31  * NO WARRANTY
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42  * POSSIBILITY OF SUCH DAMAGES.
43  */
44 
45 ')
46 
47 /*******************************************************************************
48  *
49  * ASL Root and Secondary Terms
50  *
51  ******************************************************************************/
52 
53 /*
54  * Root term. Allow multiple #line directives before the definition block
55  * to handle output from preprocessors
56  */
57 AslCode
58     : DefinitionBlockList           {$<n>$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_ASL_CODE),1, $1);}
59     | error                         {YYABORT; $$ = NULL;}
60     ;
61 
62 
63 /*
64  * Note concerning support for "module-level code".
65  *
66  * ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control
67  * methods (the so-called module-level code.) This support was explicitly
68  * removed in ACPI 2.0, but this type of code continues to be created by
69  * BIOS vendors. In order to support the disassembly and recompilation of
70  * such code (and the porting of ASL code to iASL), iASL supports this
71  * code in violation of the current ACPI specification.
72  *
73  * The grammar change to support module-level code is to revert the
74  * {ObjectList} portion of the DefinitionBlockTerm in ACPI 2.0 to the
75  * original use of {TermList} instead (see below.) This allows the use
76  * of Type1 and Type2 opcodes at module level.
77  */
78 DefinitionBlockTerm
79     : PARSEOP_DEFINITION_BLOCK '('  {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITION_BLOCK);}
80         String ','
81         String ','
82         ByteConst ','
83         String ','
84         String ','
85         DWordConst
86         ')'                         {TrSetEndLineNumber ($<n>3);}
87             '{' TermList '}'        {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);}
88     ;
89 
90 DefinitionBlockList
91     : DefinitionBlockTerm
92     | DefinitionBlockTerm
93         DefinitionBlockList         {$$ = TrLinkPeerNodes (2, $1,$2);}
94     ;
95 
96 SuperName
97     : NameString                    {}
98     | ArgTerm                       {}
99     | LocalTerm                     {}
100     | DebugTerm                     {}
101     | Type6Opcode                   {}
102 
103 Target
104     :                               {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */
105     | ','                           {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */
106     | ',' SuperName                 {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
107     ;
108 
109 TermArg
110     : Type2Opcode                   {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
111     | DataObject                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
112     | NameString                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
113     | ArgTerm                       {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
114     | LocalTerm                     {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
115     ;
116 
117 /*
118  NOTE: Removed from TermArg due to reduce/reduce conflicts:
119     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
120     | Type2StringOpcode             {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
121     | Type2BufferOpcode             {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
122     | Type2BufferOrStringOpcode     {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
123 
124 */
125 
126 MethodInvocationTerm
127     : NameString '('                {TrUpdateNode (PARSEOP_METHODCALL, $1);}
128         ArgList ')'                 {$$ = TrLinkChildNode ($1,$4);}
129     ;
130 
131 /* OptionalCount must appear before ByteList or an incorrect reduction will result */
132 
133 OptionalCount
134     :                               {$$ = TrCreateLeafNode (PARSEOP_ONES);}       /* Placeholder is a OnesOp object */
135     | ','                           {$$ = TrCreateLeafNode (PARSEOP_ONES);}       /* Placeholder is a OnesOp object */
136     | ',' TermArg                   {$$ = $2;}
137     ;
138 
139 VarPackageLengthTerm
140     :                               {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
141     | TermArg                       {$$ = $1;}
142     ;
143 
144 
145 /******* List Terms **************************************************/
146 
147 ArgList
148     :                               {$$ = NULL;}
149     | TermArg
150     | ArgList ','                   /* Allows a trailing comma at list end */
151     | ArgList ','
152         TermArg                     {$$ = TrLinkPeerNode ($1,$3);}
153     ;
154 
155 ByteList
156     :                               {$$ = NULL;}
157     | ByteConstExpr
158     | ByteList ','                  /* Allows a trailing comma at list end */
159     | ByteList ','
160         ByteConstExpr               {$$ = TrLinkPeerNode ($1,$3);}
161     ;
162 
163 DWordList
164     :                               {$$ = NULL;}
165     | DWordConstExpr
166     | DWordList ','                 /* Allows a trailing comma at list end */
167     | DWordList ','
168         DWordConstExpr              {$$ = TrLinkPeerNode ($1,$3);}
169     ;
170 
171 FieldUnitList
172     :                               {$$ = NULL;}
173     | FieldUnit
174     | FieldUnitList ','             /* Allows a trailing comma at list end */
175     | FieldUnitList ','
176         FieldUnit                   {$$ = TrLinkPeerNode ($1,$3);}
177     ;
178 
179 FieldUnit
180     : FieldUnitEntry                {}
181     | OffsetTerm                    {}
182     | AccessAsTerm                  {}
183     | ConnectionTerm                {}
184     ;
185 
186 FieldUnitEntry
187     : ',' AmlPackageLengthTerm      {$$ = TrCreateNode (PARSEOP_RESERVED_BYTES,1,$2);}
188     | NameSeg ','
189         AmlPackageLengthTerm        {$$ = TrLinkChildNode ($1,$3);}
190     ;
191 
192 ObjectList
193     :                               {$$ = NULL;}
194     | ObjectList Object             {$$ = TrLinkPeerNode ($1,$2);}
195     | error                         {$$ = AslDoError(); yyclearin;}
196     ;
197 
198 Object
199     : CompilerDirective             {}
200     | NamedObject                   {}
201     | NameSpaceModifier             {}
202     ;
203 
204 PackageList
205     :                               {$$ = NULL;}
206     | PackageElement
207     | PackageList ','               /* Allows a trailing comma at list end */
208     | PackageList ','
209         PackageElement              {$$ = TrLinkPeerNode ($1,$3);}
210     ;
211 
212 PackageElement
213     : DataObject                    {}
214     | NameString                    {}
215     ;
216 
217     /* Rules for specifying the type of one method argument or return value */
218 
219 ParameterTypePackage
220     :                               {$$ = NULL;}
221     | ObjectTypeKeyword             {$$ = $1;}
222     | ParameterTypePackage ','
223         ObjectTypeKeyword           {$$ = TrLinkPeerNodes (2,$1,$3);}
224     ;
225 
226 ParameterTypePackageList
227     :                               {$$ = NULL;}
228     | ObjectTypeKeyword             {$$ = $1;}
229     | '{' ParameterTypePackage '}'  {$$ = $2;}
230     ;
231 
232 OptionalParameterTypePackage
233     :                               {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
234     | ',' ParameterTypePackageList  {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
235     ;
236 
237     /* Rules for specifying the types for method arguments */
238 
239 ParameterTypesPackage
240     : ParameterTypePackageList      {$$ = $1;}
241     | ParameterTypesPackage ','
242         ParameterTypePackageList    {$$ = TrLinkPeerNodes (2,$1,$3);}
243     ;
244 
245 ParameterTypesPackageList
246     :                               {$$ = NULL;}
247     | ObjectTypeKeyword             {$$ = $1;}
248     | '{' ParameterTypesPackage '}' {$$ = $2;}
249     ;
250 
251 OptionalParameterTypesPackage
252     :                               {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
253     | ',' ParameterTypesPackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
254     ;
255 
256     /* ACPI 3.0 -- allow semicolons between terms */
257 
258 TermList
259     :                               {$$ = NULL;}
260     | TermList Term                 {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
261     | TermList Term ';'             {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
262     | TermList ';' Term             {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
263     | TermList ';' Term ';'         {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
264     ;
265 
266 Term
267     : Object                        {}
268     | Type1Opcode                   {}
269     | Type2Opcode                   {}
270     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
271     | Type2StringOpcode             {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
272     | Type2BufferOpcode             {}
273     | Type2BufferOrStringOpcode     {}
274     | error                         {$$ = AslDoError(); yyclearin;}
275     ;
276 
277 /*
278  * Case-Default list; allow only one Default term and unlimited Case terms
279  */
280 CaseDefaultTermList
281     :                               {$$ = NULL;}
282     | CaseTerm  {}
283     | DefaultTerm   {}
284     | CaseDefaultTermList
285         CaseTerm                    {$$ = TrLinkPeerNode ($1,$2);}
286     | CaseDefaultTermList
287         DefaultTerm                 {$$ = TrLinkPeerNode ($1,$2);}
288 
289 /* Original - attempts to force zero or one default term within the switch */
290 
291 /*
292 CaseDefaultTermList
293     :                               {$$ = NULL;}
294     | CaseTermList
295         DefaultTerm
296         CaseTermList                {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));}
297     | CaseTermList
298         CaseTerm                    {$$ = TrLinkPeerNode ($1,$2);}
299     ;
300 
301 CaseTermList
302     :                               {$$ = NULL;}
303     | CaseTerm                      {}
304     | CaseTermList
305         CaseTerm                    {$$ = TrLinkPeerNode ($1,$2);}
306     ;
307 */
308 
309 
310 /*******************************************************************************
311  *
312  * ASL Data and Constant Terms
313  *
314  ******************************************************************************/
315 
316 DataObject
317     : BufferData                    {}
318     | PackageData                   {}
319     | IntegerData                   {}
320     | StringData                    {}
321     ;
322 
323 BufferData
324     : Type5Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
325     | Type2BufferOrStringOpcode     {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
326     | Type2BufferOpcode             {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
327     | BufferTerm                    {}
328     ;
329 
330 PackageData
331     : PackageTerm                   {}
332     ;
333 
334 IntegerData
335     : Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
336     | Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
337     | Integer                       {}
338     | ConstTerm                     {}
339     ;
340 
341 StringData
342     : Type2StringOpcode             {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
343     | String                        {}
344     ;
345 
346 ByteConst
347     : Integer                       {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
348     ;
349 
350 WordConst
351     : Integer                       {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
352     ;
353 
354 DWordConst
355     : Integer                       {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
356     ;
357 
358 QWordConst
359     : Integer                       {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
360     ;
361 
362 /*
363  * The NODE_COMPILE_TIME_CONST flag in the following constant expressions
364  * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes
365  * to simple integers. It is an error if these types of expressions cannot be
366  * reduced, since the AML grammar for ****ConstExpr requires a simple constant.
367  * Note: The required byte length of the constant is passed through to the
368  * constant folding code in the node AmlLength field.
369  */
370 ByteConstExpr
371     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);}
372     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);}
373     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
374     | ByteConst                     {}
375     ;
376 
377 WordConstExpr
378     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);}
379     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);}
380     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
381     | WordConst                     {}
382     ;
383 
384 DWordConstExpr
385     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);}
386     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);}
387     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
388     | DWordConst                    {}
389     ;
390 
391 QWordConstExpr
392     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);}
393     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);}
394     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
395     | QWordConst                    {}
396     ;
397 
398 ConstTerm
399     : ConstExprTerm                 {}
400     | PARSEOP_REVISION              {$$ = TrCreateLeafNode (PARSEOP_REVISION);}
401     ;
402 
403 ConstExprTerm
404     : PARSEOP_ZERO                  {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
405     | PARSEOP_ONE                   {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
406     | PARSEOP_ONES                  {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
407     | PARSEOP___DATE__              {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);}
408     | PARSEOP___FILE__              {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);}
409     | PARSEOP___LINE__              {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);}
410     | PARSEOP___PATH__              {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);}
411     ;
412 
413 Integer
414     : PARSEOP_INTEGER               {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, AslCompilerlval.i);}
415     ;
416 
417 String
418     : PARSEOP_STRING_LITERAL        {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (ACPI_NATIVE_INT) AslCompilerlval.s);}
419     ;
420 
421 
422 /*******************************************************************************
423  *
424  * ASL Opcode Terms
425  *
426  ******************************************************************************/
427 
428 CompilerDirective
429     : IncludeTerm                   {}
430     | IncludeEndTerm                {}
431     | ExternalTerm                  {}
432     ;
433 
434 NamedObject
435     : BankFieldTerm                 {}
436     | CreateBitFieldTerm            {}
437     | CreateByteFieldTerm           {}
438     | CreateDWordFieldTerm          {}
439     | CreateFieldTerm               {}
440     | CreateQWordFieldTerm          {}
441     | CreateWordFieldTerm           {}
442     | DataRegionTerm                {}
443     | DeviceTerm                    {}
444     | EventTerm                     {}
445     | FieldTerm                     {}
446     | FunctionTerm                  {}
447     | IndexFieldTerm                {}
448     | MethodTerm                    {}
449     | MutexTerm                     {}
450     | OpRegionTerm                  {}
451     | PowerResTerm                  {}
452     | ProcessorTerm                 {}
453     | ThermalZoneTerm               {}
454     ;
455 
456 NameSpaceModifier
457     : AliasTerm                     {}
458     | NameTerm                      {}
459     | ScopeTerm                     {}
460     ;
461 
462 /* For ObjectType: SuperName except for MethodInvocationTerm */
463 
464 ObjectTypeName
465     : NameString                    {}
466     | ArgTerm                       {}
467     | LocalTerm                     {}
468     | DebugTerm                     {}
469     | RefOfTerm                     {}
470     | DerefOfTerm                   {}
471     | IndexTerm                     {}
472 /*    | MethodInvocationTerm          {} */  /* Caused reduce/reduce with Type6Opcode->MethodInvocationTerm */
473     ;
474 
475 RequiredTarget
476     : ',' SuperName                 {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
477     ;
478 
479 SimpleTarget
480     : NameString                    {}
481     | LocalTerm                     {}
482     | ArgTerm                       {}
483     ;
484 
485 /* Opcode types */
486 
487 Type1Opcode
488     : BreakTerm                     {}
489     | BreakPointTerm                {}
490     | ContinueTerm                  {}
491     | FatalTerm                     {}
492     | ElseIfTerm                    {}
493     | LoadTerm                      {}
494     | NoOpTerm                      {}
495     | NotifyTerm                    {}
496     | ReleaseTerm                   {}
497     | ResetTerm                     {}
498     | ReturnTerm                    {}
499     | SignalTerm                    {}
500     | SleepTerm                     {}
501     | StallTerm                     {}
502     | SwitchTerm                    {}
503     | UnloadTerm                    {}
504     | WhileTerm                     {}
505     ;
506 
507 Type2Opcode
508     : AcquireTerm                   {}
509     | CondRefOfTerm                 {}
510     | CopyObjectTerm                {}
511     | DerefOfTerm                   {}
512     | ObjectTypeTerm                {}
513     | RefOfTerm                     {}
514     | SizeOfTerm                    {}
515     | StoreTerm                     {}
516     | EqualsTerm                    {}
517     | TimerTerm                     {}
518     | WaitTerm                      {}
519     | MethodInvocationTerm          {}
520     ;
521 
522 /*
523  * Type 3/4/5 opcodes
524  */
525 Type2IntegerOpcode                  /* "Type3" opcodes */
526     : Expression                    {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
527     | AddTerm                       {}
528     | AndTerm                       {}
529     | DecTerm                       {}
530     | DivideTerm                    {}
531     | FindSetLeftBitTerm            {}
532     | FindSetRightBitTerm           {}
533     | FromBCDTerm                   {}
534     | IncTerm                       {}
535     | IndexTerm                     {}
536     | LAndTerm                      {}
537     | LEqualTerm                    {}
538     | LGreaterTerm                  {}
539     | LGreaterEqualTerm             {}
540     | LLessTerm                     {}
541     | LLessEqualTerm                {}
542     | LNotTerm                      {}
543     | LNotEqualTerm                 {}
544     | LoadTableTerm                 {}
545     | LOrTerm                       {}
546     | MatchTerm                     {}
547     | ModTerm                       {}
548     | MultiplyTerm                  {}
549     | NAndTerm                      {}
550     | NOrTerm                       {}
551     | NotTerm                       {}
552     | OrTerm                        {}
553     | ShiftLeftTerm                 {}
554     | ShiftRightTerm                {}
555     | SubtractTerm                  {}
556     | ToBCDTerm                     {}
557     | ToIntegerTerm                 {}
558     | XOrTerm                       {}
559     ;
560 
561 Type2StringOpcode                   /* "Type4" Opcodes */
562     : ToDecimalStringTerm           {}
563     | ToHexStringTerm               {}
564     | ToStringTerm                  {}
565     ;
566 
567 Type2BufferOpcode                   /* "Type5" Opcodes */
568     : ToBufferTerm                  {}
569     | ConcatResTerm                 {}
570     ;
571 
572 Type2BufferOrStringOpcode
573     : ConcatTerm                    {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
574     | PrintfTerm                    {}
575     | FprintfTerm                   {}
576     | MidTerm                       {}
577     ;
578 
579 /*
580  * A type 3 opcode evaluates to an Integer and cannot have a destination operand
581  */
582 Type3Opcode
583     : EISAIDTerm                    {}
584     ;
585 
586 /* Obsolete
587 Type4Opcode
588     : ConcatTerm                    {}
589     | ToDecimalStringTerm           {}
590     | ToHexStringTerm               {}
591     | MidTerm                       {}
592     | ToStringTerm                  {}
593     ;
594 */
595 
596 Type5Opcode
597     : ResourceTemplateTerm          {}
598     | UnicodeTerm                   {}
599     | ToPLDTerm                     {}
600     | ToUUIDTerm                    {}
601     ;
602 
603 Type6Opcode
604     : RefOfTerm                     {}
605     | DerefOfTerm                   {}
606     | IndexTerm                     {}
607     | IndexExpTerm                  {}
608     | MethodInvocationTerm          {}
609     ;
610 
611 
612 /*******************************************************************************
613  *
614  * ASL Primary Terms
615  *
616  ******************************************************************************/
617 
618 AccessAsTerm
619     : PARSEOP_ACCESSAS '('
620         AccessTypeKeyword
621         OptionalAccessAttribTerm
622         ')'                         {$$ = TrCreateNode (PARSEOP_ACCESSAS,2,$3,$4);}
623     | PARSEOP_ACCESSAS '('
624         error ')'                   {$$ = AslDoError(); yyclearin;}
625     ;
626 
627 AcquireTerm
628     : PARSEOP_ACQUIRE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);}
629         SuperName
630         ',' WordConstExpr
631         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$6);}
632     | PARSEOP_ACQUIRE '('
633         error ')'                   {$$ = AslDoError(); yyclearin;}
634     ;
635 
636 AddTerm
637     : PARSEOP_ADD '('               {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
638         TermArg
639         TermArgItem
640         Target
641         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
642     | PARSEOP_ADD '('
643         error ')'                   {$$ = AslDoError(); yyclearin;}
644     ;
645 
646 AliasTerm
647     : PARSEOP_ALIAS '('             {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);}
648         NameString
649         NameStringItem
650         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,
651                                         TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));}
652     | PARSEOP_ALIAS '('
653         error ')'                   {$$ = AslDoError(); yyclearin;}
654     ;
655 
656 AndTerm
657     : PARSEOP_AND '('               {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
658         TermArg
659         TermArgItem
660         Target
661         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
662     | PARSEOP_AND '('
663         error ')'                   {$$ = AslDoError(); yyclearin;}
664     ;
665 
666 ArgTerm
667     : PARSEOP_ARG0                  {$$ = TrCreateLeafNode (PARSEOP_ARG0);}
668     | PARSEOP_ARG1                  {$$ = TrCreateLeafNode (PARSEOP_ARG1);}
669     | PARSEOP_ARG2                  {$$ = TrCreateLeafNode (PARSEOP_ARG2);}
670     | PARSEOP_ARG3                  {$$ = TrCreateLeafNode (PARSEOP_ARG3);}
671     | PARSEOP_ARG4                  {$$ = TrCreateLeafNode (PARSEOP_ARG4);}
672     | PARSEOP_ARG5                  {$$ = TrCreateLeafNode (PARSEOP_ARG5);}
673     | PARSEOP_ARG6                  {$$ = TrCreateLeafNode (PARSEOP_ARG6);}
674     ;
675 
676 BankFieldTerm
677     : PARSEOP_BANKFIELD '('         {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);}
678         NameString
679         NameStringItem
680         TermArgItem
681         ',' AccessTypeKeyword
682         ',' LockRuleKeyword
683         ',' UpdateRuleKeyword
684         ')' '{'
685             FieldUnitList '}'       {$$ = TrLinkChildren ($<n>3,7,$4,$5,$6,$8,$10,$12,$15);}
686     | PARSEOP_BANKFIELD '('
687         error ')' '{' error '}'     {$$ = AslDoError(); yyclearin;}
688     ;
689 
690 BreakTerm
691     : PARSEOP_BREAK                 {$$ = TrCreateNode (PARSEOP_BREAK, 0);}
692     ;
693 
694 BreakPointTerm
695     : PARSEOP_BREAKPOINT            {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);}
696     ;
697 
698 BufferTerm
699     : PARSEOP_BUFFER '('            {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);}
700         OptionalTermArg
701         ')' '{'
702             BufferTermData '}'      {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
703     | PARSEOP_BUFFER '('
704         error ')'                   {$$ = AslDoError(); yyclearin;}
705     ;
706 
707 BufferTermData
708     : ByteList                      {}
709     | StringData                    {}
710     ;
711 
712 CaseTerm
713     : PARSEOP_CASE '('              {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);}
714         DataObject
715         ')' '{'
716             TermList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
717     | PARSEOP_CASE '('
718         error ')'                   {$$ = AslDoError(); yyclearin;}
719     ;
720 
721 ConcatTerm
722     : PARSEOP_CONCATENATE '('       {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);}
723         TermArg
724         TermArgItem
725         Target
726         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
727     | PARSEOP_CONCATENATE '('
728         error ')'                   {$$ = AslDoError(); yyclearin;}
729     ;
730 
731 ConcatResTerm
732     : PARSEOP_CONCATENATERESTEMPLATE '('    {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);}
733         TermArg
734         TermArgItem
735         Target
736         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
737     | PARSEOP_CONCATENATERESTEMPLATE '('
738         error ')'                   {$$ = AslDoError(); yyclearin;}
739     ;
740 
741 ConnectionTerm
742     : PARSEOP_CONNECTION '('
743         NameString
744         ')'                         {$$ = TrCreateNode (PARSEOP_CONNECTION,1,$3);}
745     | PARSEOP_CONNECTION '('        {$<n>$ = TrCreateLeafNode (PARSEOP_CONNECTION);}
746         ResourceMacroTerm
747         ')'                         {$$ = TrLinkChildren ($<n>3, 1,
748                                             TrLinkChildren (TrCreateLeafNode (PARSEOP_RESOURCETEMPLATE), 3,
749                                                 TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
750                                                 TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
751                                                 $4));}
752     | PARSEOP_CONNECTION '('
753         error ')'                   {$$ = AslDoError(); yyclearin;}
754     ;
755 
756 CondRefOfTerm
757     : PARSEOP_CONDREFOF '('         {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);}
758         SuperName
759         Target
760         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
761     | PARSEOP_CONDREFOF '('
762         error ')'                   {$$ = AslDoError(); yyclearin;}
763     ;
764 
765 ContinueTerm
766     : PARSEOP_CONTINUE              {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);}
767     ;
768 
769 CopyObjectTerm
770     : PARSEOP_COPYOBJECT '('        {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);}
771         TermArg
772         ',' SimpleTarget
773         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
774     | PARSEOP_COPYOBJECT '('
775         error ')'                   {$$ = AslDoError(); yyclearin;}
776     ;
777 
778 CreateBitFieldTerm
779     : PARSEOP_CREATEBITFIELD '('    {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);}
780         TermArg
781         TermArgItem
782         NameStringItem
783         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
784     | PARSEOP_CREATEBITFIELD '('
785         error ')'                   {$$ = AslDoError(); yyclearin;}
786     ;
787 
788 CreateByteFieldTerm
789     : PARSEOP_CREATEBYTEFIELD '('   {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);}
790         TermArg
791         TermArgItem
792         NameStringItem
793         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
794     | PARSEOP_CREATEBYTEFIELD '('
795         error ')'                   {$$ = AslDoError(); yyclearin;}
796     ;
797 
798 CreateDWordFieldTerm
799     : PARSEOP_CREATEDWORDFIELD '('  {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);}
800         TermArg
801         TermArgItem
802         NameStringItem
803         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
804     | PARSEOP_CREATEDWORDFIELD '('
805         error ')'                   {$$ = AslDoError(); yyclearin;}
806     ;
807 
808 CreateFieldTerm
809     : PARSEOP_CREATEFIELD '('       {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);}
810         TermArg
811         TermArgItem
812         TermArgItem
813         NameStringItem
814         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,TrSetNodeFlags ($7, NODE_IS_NAME_DECLARATION));}
815     | PARSEOP_CREATEFIELD '('
816         error ')'                   {$$ = AslDoError(); yyclearin;}
817     ;
818 
819 CreateQWordFieldTerm
820     : PARSEOP_CREATEQWORDFIELD '('  {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);}
821         TermArg
822         TermArgItem
823         NameStringItem
824         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
825     | PARSEOP_CREATEQWORDFIELD '('
826         error ')'                   {$$ = AslDoError(); yyclearin;}
827     ;
828 
829 CreateWordFieldTerm
830     : PARSEOP_CREATEWORDFIELD '('   {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);}
831         TermArg
832         TermArgItem
833         NameStringItem
834         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
835     | PARSEOP_CREATEWORDFIELD '('
836         error ')'                   {$$ = AslDoError(); yyclearin;}
837     ;
838 
839 DataRegionTerm
840     : PARSEOP_DATATABLEREGION '('   {$<n>$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);}
841         NameString
842         TermArgItem
843         TermArgItem
844         TermArgItem
845         ')'                         {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$6,$7);}
846     | PARSEOP_DATATABLEREGION '('
847         error ')'                   {$$ = AslDoError(); yyclearin;}
848     ;
849 
850 DebugTerm
851     : PARSEOP_DEBUG                 {$$ = TrCreateLeafNode (PARSEOP_DEBUG);}
852     ;
853 
854 DecTerm
855     : PARSEOP_DECREMENT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
856         SuperName
857         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
858     | PARSEOP_DECREMENT '('
859         error ')'                   {$$ = AslDoError(); yyclearin;}
860     ;
861 
862 DefaultTerm
863     : PARSEOP_DEFAULT '{'           {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);}
864         TermList '}'                {$$ = TrLinkChildren ($<n>3,1,$4);}
865     | PARSEOP_DEFAULT '{'
866         error '}'                   {$$ = AslDoError(); yyclearin;}
867     ;
868 
869 DerefOfTerm
870     : PARSEOP_DEREFOF '('           {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);}
871         TermArg
872         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
873     | PARSEOP_DEREFOF '('
874         error ')'                   {$$ = AslDoError(); yyclearin;}
875     ;
876 
877 DeviceTerm
878     : PARSEOP_DEVICE '('            {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);}
879         NameString
880         ')' '{'
881             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
882     | PARSEOP_DEVICE '('
883         error ')'                   {$$ = AslDoError(); yyclearin;}
884     ;
885 
886 DivideTerm
887     : PARSEOP_DIVIDE '('            {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
888         TermArg
889         TermArgItem
890         Target
891         Target
892         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);}
893     | PARSEOP_DIVIDE '('
894         error ')'                   {$$ = AslDoError(); yyclearin;}
895     ;
896 
897 EISAIDTerm
898     : PARSEOP_EISAID '('
899         StringData ')'              {$$ = TrUpdateNode (PARSEOP_EISAID, $3);}
900     | PARSEOP_EISAID '('
901         error ')'                   {$$ = AslDoError(); yyclearin;}
902     ;
903 
904 ElseIfTerm
905     : IfTerm ElseTerm               {$$ = TrLinkPeerNode ($1,$2);}
906     ;
907 
908 ElseTerm
909     :                               {$$ = NULL;}
910     | PARSEOP_ELSE '{'              {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
911         TermList '}'                {$$ = TrLinkChildren ($<n>3,1,$4);}
912 
913     | PARSEOP_ELSE '{'
914         error '}'                   {$$ = AslDoError(); yyclearin;}
915 
916     | PARSEOP_ELSE
917         error                       {$$ = AslDoError(); yyclearin;}
918 
919     | PARSEOP_ELSEIF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
920         TermArg                     {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
921         ')' '{'
922             TermList '}'            {TrLinkChildren ($<n>5,2,$4,$8);}
923         ElseTerm                    {TrLinkPeerNode ($<n>5,$11);}
924                                     {$$ = TrLinkChildren ($<n>3,1,$<n>5);}
925 
926     | PARSEOP_ELSEIF '('
927         error ')'                   {$$ = AslDoError(); yyclearin;}
928 
929     | PARSEOP_ELSEIF
930         error                       {$$ = AslDoError(); yyclearin;}
931     ;
932 
933 EventTerm
934     : PARSEOP_EVENT '('             {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);}
935         NameString
936         ')'                         {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));}
937     | PARSEOP_EVENT '('
938         error ')'                   {$$ = AslDoError(); yyclearin;}
939     ;
940 
941 ExternalTerm
942     : PARSEOP_EXTERNAL '('
943         NameString
944         OptionalObjectTypeKeyword
945         OptionalParameterTypePackage
946         OptionalParameterTypesPackage
947         ')'                         {$$ = TrCreateNode (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);}
948     | PARSEOP_EXTERNAL '('
949         error ')'                   {$$ = AslDoError(); yyclearin;}
950     ;
951 
952 FatalTerm
953     : PARSEOP_FATAL '('             {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);}
954         ByteConstExpr
955         ',' DWordConstExpr
956         TermArgItem
957         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);}
958     | PARSEOP_FATAL '('
959         error ')'                   {$$ = AslDoError(); yyclearin;}
960     ;
961 
962 FieldTerm
963     : PARSEOP_FIELD '('             {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);}
964         NameString
965         ',' AccessTypeKeyword
966         ',' LockRuleKeyword
967         ',' UpdateRuleKeyword
968         ')' '{'
969             FieldUnitList '}'       {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$10,$13);}
970     | PARSEOP_FIELD '('
971         error ')' '{' error '}'     {$$ = AslDoError(); yyclearin;}
972     ;
973 
974 FindSetLeftBitTerm
975     : PARSEOP_FINDSETLEFTBIT '('    {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);}
976         TermArg
977         Target
978         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
979     | PARSEOP_FINDSETLEFTBIT '('
980         error ')'                   {$$ = AslDoError(); yyclearin;}
981     ;
982 
983 FindSetRightBitTerm
984     : PARSEOP_FINDSETRIGHTBIT '('   {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);}
985         TermArg
986         Target
987         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
988     | PARSEOP_FINDSETRIGHTBIT '('
989         error ')'                   {$$ = AslDoError(); yyclearin;}
990     ;
991 
992 FprintfTerm
993     : PARSEOP_FPRINTF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_FPRINTF);}
994         TermArg ','
995         StringData
996         PrintfArgList
997         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);}
998     | PARSEOP_FPRINTF '('
999         error ')'                   {$$ = AslDoError(); yyclearin;}
1000     ;
1001 
1002 FromBCDTerm
1003     : PARSEOP_FROMBCD '('           {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);}
1004         TermArg
1005         Target
1006         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1007     | PARSEOP_FROMBCD '('
1008         error ')'                   {$$ = AslDoError(); yyclearin;}
1009     ;
1010 
1011 FunctionTerm
1012     : PARSEOP_FUNCTION '('          {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
1013         NameString
1014         OptionalParameterTypePackage
1015         OptionalParameterTypesPackage
1016         ')' '{'
1017             TermList '}'            {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),
1018                                         TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),
1019                                         TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL),
1020                                         TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);}
1021     | PARSEOP_FUNCTION '('
1022         error ')'                   {$$ = AslDoError(); yyclearin;}
1023     ;
1024 
1025 IfTerm
1026     : PARSEOP_IF '('                {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
1027         TermArg
1028         ')' '{'
1029             TermList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1030 
1031     | PARSEOP_IF '('
1032         error ')'                   {$$ = AslDoError(); yyclearin;}
1033     ;
1034 
1035 IncludeTerm
1036     : PARSEOP_INCLUDE '('
1037         String  ')'                 {$$ = TrUpdateNode (PARSEOP_INCLUDE, $3);
1038                                         FlOpenIncludeFile ($3);}
1039     ;
1040 
1041 IncludeEndTerm
1042     : PARSEOP_INCLUDE_END           {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE_END); TrSetCurrentFilename ($$);}
1043     ;
1044 
1045 IncTerm
1046     : PARSEOP_INCREMENT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
1047         SuperName
1048         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1049     | PARSEOP_INCREMENT '('
1050         error ')'                   {$$ = AslDoError(); yyclearin;}
1051     ;
1052 
1053 IndexFieldTerm
1054     : PARSEOP_INDEXFIELD '('        {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);}
1055         NameString
1056         NameStringItem
1057         ',' AccessTypeKeyword
1058         ',' LockRuleKeyword
1059         ',' UpdateRuleKeyword
1060         ')' '{'
1061             FieldUnitList '}'       {$$ = TrLinkChildren ($<n>3,6,$4,$5,$7,$9,$11,$14);}
1062     | PARSEOP_INDEXFIELD '('
1063         error ')' '{' error '}'     {$$ = AslDoError(); yyclearin;}
1064     ;
1065 
1066 IndexTerm
1067     : PARSEOP_INDEX '('             {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);}
1068         TermArg
1069         TermArgItem
1070         Target
1071         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1072     | PARSEOP_INDEX '('
1073         error ')'                   {$$ = AslDoError(); yyclearin;}
1074     ;
1075 
1076 LAndTerm
1077     : PARSEOP_LAND '('              {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);}
1078         TermArg
1079         TermArgItem
1080         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1081     | PARSEOP_LAND '('
1082         error ')'                   {$$ = AslDoError(); yyclearin;}
1083     ;
1084 
1085 LEqualTerm
1086     : PARSEOP_LEQUAL '('            {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
1087         TermArg
1088         TermArgItem
1089         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1090     | PARSEOP_LEQUAL '('
1091         error ')'                   {$$ = AslDoError(); yyclearin;}
1092     ;
1093 
1094 LGreaterEqualTerm
1095     : PARSEOP_LGREATEREQUAL '('     {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
1096         TermArg
1097         TermArgItem
1098         ')'                         {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
1099     | PARSEOP_LGREATEREQUAL '('
1100         error ')'                   {$$ = AslDoError(); yyclearin;}
1101     ;
1102 
1103 LGreaterTerm
1104     : PARSEOP_LGREATER '('          {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
1105         TermArg
1106         TermArgItem
1107         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1108     | PARSEOP_LGREATER '('
1109         error ')'                   {$$ = AslDoError(); yyclearin;}
1110     ;
1111 
1112 LLessEqualTerm
1113     : PARSEOP_LLESSEQUAL '('        {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
1114         TermArg
1115         TermArgItem
1116         ')'                         {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
1117     | PARSEOP_LLESSEQUAL '('
1118         error ')'                   {$$ = AslDoError(); yyclearin;}
1119     ;
1120 
1121 LLessTerm
1122     : PARSEOP_LLESS '('             {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
1123         TermArg
1124         TermArgItem
1125         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1126     | PARSEOP_LLESS '('
1127         error ')'                   {$$ = AslDoError(); yyclearin;}
1128     ;
1129 
1130 LNotEqualTerm
1131     : PARSEOP_LNOTEQUAL '('         {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
1132         TermArg
1133         TermArgItem
1134         ')'                         {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
1135     | PARSEOP_LNOTEQUAL '('
1136         error ')'                   {$$ = AslDoError(); yyclearin;}
1137     ;
1138 
1139 LNotTerm
1140     : PARSEOP_LNOT '('              {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);}
1141         TermArg
1142         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1143     | PARSEOP_LNOT '('
1144         error ')'                   {$$ = AslDoError(); yyclearin;}
1145     ;
1146 
1147 LoadTableTerm
1148     : PARSEOP_LOADTABLE '('         {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);}
1149         TermArg
1150         TermArgItem
1151         TermArgItem
1152         OptionalListString
1153         OptionalListString
1154         OptionalReference
1155         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$5,$6,$7,$8,$9);}
1156     | PARSEOP_LOADTABLE '('
1157         error ')'                   {$$ = AslDoError(); yyclearin;}
1158     ;
1159 
1160 LoadTerm
1161     : PARSEOP_LOAD '('              {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);}
1162         NameString
1163         RequiredTarget
1164         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1165     | PARSEOP_LOAD '('
1166         error ')'                   {$$ = AslDoError(); yyclearin;}
1167     ;
1168 
1169 LocalTerm
1170     : PARSEOP_LOCAL0                {$$ = TrCreateLeafNode (PARSEOP_LOCAL0);}
1171     | PARSEOP_LOCAL1                {$$ = TrCreateLeafNode (PARSEOP_LOCAL1);}
1172     | PARSEOP_LOCAL2                {$$ = TrCreateLeafNode (PARSEOP_LOCAL2);}
1173     | PARSEOP_LOCAL3                {$$ = TrCreateLeafNode (PARSEOP_LOCAL3);}
1174     | PARSEOP_LOCAL4                {$$ = TrCreateLeafNode (PARSEOP_LOCAL4);}
1175     | PARSEOP_LOCAL5                {$$ = TrCreateLeafNode (PARSEOP_LOCAL5);}
1176     | PARSEOP_LOCAL6                {$$ = TrCreateLeafNode (PARSEOP_LOCAL6);}
1177     | PARSEOP_LOCAL7                {$$ = TrCreateLeafNode (PARSEOP_LOCAL7);}
1178     ;
1179 
1180 LOrTerm
1181     : PARSEOP_LOR '('               {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);}
1182         TermArg
1183         TermArgItem
1184         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1185     | PARSEOP_LOR '('
1186         error ')'                   {$$ = AslDoError(); yyclearin;}
1187     ;
1188 
1189 MatchTerm
1190     : PARSEOP_MATCH '('             {$<n>$ = TrCreateLeafNode (PARSEOP_MATCH);}
1191         TermArg
1192         ',' MatchOpKeyword
1193         TermArgItem
1194         ',' MatchOpKeyword
1195         TermArgItem
1196         TermArgItem
1197         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$7,$9,$10,$11);}
1198     | PARSEOP_MATCH '('
1199         error ')'                   {$$ = AslDoError(); yyclearin;}
1200     ;
1201 
1202 MethodTerm
1203     : PARSEOP_METHOD  '('           {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
1204         NameString
1205         OptionalByteConstExpr       {UtCheckIntegerRange ($5, 0, 7);}
1206         OptionalSerializeRuleKeyword
1207         OptionalByteConstExpr
1208         OptionalParameterTypePackage
1209         OptionalParameterTypesPackage
1210         ')' '{'
1211             TermList '}'            {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$7,$8,$9,$10,$13);}
1212     | PARSEOP_METHOD '('
1213         error ')'                   {$$ = AslDoError(); yyclearin;}
1214     ;
1215 
1216 MidTerm
1217     : PARSEOP_MID '('               {$<n>$ = TrCreateLeafNode (PARSEOP_MID);}
1218         TermArg
1219         TermArgItem
1220         TermArgItem
1221         Target
1222         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);}
1223     | PARSEOP_MID '('
1224         error ')'                   {$$ = AslDoError(); yyclearin;}
1225     ;
1226 
1227 ModTerm
1228     : PARSEOP_MOD '('               {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
1229         TermArg
1230         TermArgItem
1231         Target
1232         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1233     | PARSEOP_MOD '('
1234         error ')'                   {$$ = AslDoError(); yyclearin;}
1235     ;
1236 
1237 MultiplyTerm
1238     : PARSEOP_MULTIPLY '('          {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
1239         TermArg
1240         TermArgItem
1241         Target
1242         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1243     | PARSEOP_MULTIPLY '('
1244         error ')'                   {$$ = AslDoError(); yyclearin;}
1245     ;
1246 
1247 MutexTerm
1248     : PARSEOP_MUTEX '('             {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);}
1249         NameString
1250         ',' ByteConstExpr
1251         ')'                         {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
1252     | PARSEOP_MUTEX '('
1253         error ')'                   {$$ = AslDoError(); yyclearin;}
1254     ;
1255 
1256 NameTerm
1257     : PARSEOP_NAME '('              {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);}
1258         NameString
1259         ',' DataObject
1260         ')'                         {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
1261     | PARSEOP_NAME '('
1262         error ')'                   {$$ = AslDoError(); yyclearin;}
1263     ;
1264 
1265 NAndTerm
1266     : PARSEOP_NAND '('              {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);}
1267         TermArg
1268         TermArgItem
1269         Target
1270         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1271     | PARSEOP_NAND '('
1272         error ')'                   {$$ = AslDoError(); yyclearin;}
1273     ;
1274 
1275 NoOpTerm
1276     : PARSEOP_NOOP                  {$$ = TrCreateNode (PARSEOP_NOOP, 0);}
1277     ;
1278 
1279 NOrTerm
1280     : PARSEOP_NOR '('               {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);}
1281         TermArg
1282         TermArgItem
1283         Target
1284         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1285     | PARSEOP_NOR '('
1286         error ')'                   {$$ = AslDoError(); yyclearin;}
1287     ;
1288 
1289 NotifyTerm
1290     : PARSEOP_NOTIFY '('            {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);}
1291         SuperName
1292         TermArgItem
1293         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1294     | PARSEOP_NOTIFY '('
1295         error ')'                   {$$ = AslDoError(); yyclearin;}
1296     ;
1297 
1298 NotTerm
1299     : PARSEOP_NOT '('               {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);}
1300         TermArg
1301         Target
1302         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1303     | PARSEOP_NOT '('
1304         error ')'                   {$$ = AslDoError(); yyclearin;}
1305     ;
1306 
1307 ObjectTypeTerm
1308     : PARSEOP_OBJECTTYPE '('        {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);}
1309         ObjectTypeName
1310         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1311     | PARSEOP_OBJECTTYPE '('
1312         error ')'                   {$$ = AslDoError(); yyclearin;}
1313     ;
1314 
1315 OffsetTerm
1316     : PARSEOP_OFFSET '('
1317         AmlPackageLengthTerm
1318         ')'                         {$$ = TrCreateNode (PARSEOP_OFFSET,1,$3);}
1319     | PARSEOP_OFFSET '('
1320         error ')'                   {$$ = AslDoError(); yyclearin;}
1321     ;
1322 
1323 OpRegionTerm
1324     : PARSEOP_OPERATIONREGION '('   {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);}
1325         NameString
1326         ',' OpRegionSpaceIdTerm
1327         TermArgItem
1328         TermArgItem
1329         ')'                         {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8);}
1330     | PARSEOP_OPERATIONREGION '('
1331         error ')'                   {$$ = AslDoError(); yyclearin;}
1332     ;
1333 
1334 OpRegionSpaceIdTerm
1335     : RegionSpaceKeyword            {}
1336     | ByteConst                     {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
1337     ;
1338 
1339 OrTerm
1340     : PARSEOP_OR '('                {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
1341         TermArg
1342         TermArgItem
1343         Target
1344         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1345     | PARSEOP_OR '('
1346         error ')'                   {$$ = AslDoError(); yyclearin;}
1347     ;
1348 
1349 PackageTerm
1350     : PARSEOP_PACKAGE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);}
1351         VarPackageLengthTerm
1352         ')' '{'
1353             PackageList '}'         {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1354     | PARSEOP_PACKAGE '('
1355         error ')'                   {$$ = AslDoError(); yyclearin;}
1356     ;
1357 
1358 PowerResTerm
1359     : PARSEOP_POWERRESOURCE '('     {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);}
1360         NameString
1361         ',' ByteConstExpr
1362         ',' WordConstExpr
1363         ')' '{'
1364             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$8,$11);}
1365     | PARSEOP_POWERRESOURCE '('
1366         error ')'                   {$$ = AslDoError(); yyclearin;}
1367     ;
1368 
1369 PrintfTerm
1370     : PARSEOP_PRINTF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_PRINTF);}
1371         StringData
1372         PrintfArgList
1373         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1374     | PARSEOP_PRINTF '('
1375         error ')'                   {$$ = AslDoError(); yyclearin;}
1376     ;
1377 
1378 PrintfArgList
1379     :                               {$$ = NULL;}
1380     | TermArg                       {$$ = $1;}
1381     | PrintfArgList ','
1382        TermArg                      {$$ = TrLinkPeerNode ($1, $3);}
1383     ;
1384 
1385 ProcessorTerm
1386     : PARSEOP_PROCESSOR '('         {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);}
1387         NameString
1388         ',' ByteConstExpr
1389         OptionalDWordConstExpr
1390         OptionalByteConstExpr
1391         ')' '{'
1392             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,5,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8,$11);}
1393     | PARSEOP_PROCESSOR '('
1394         error ')'                   {$$ = AslDoError(); yyclearin;}
1395     ;
1396 
1397 RawDataBufferTerm
1398     : PARSEOP_DATABUFFER  '('       {$<n>$ = TrCreateLeafNode (PARSEOP_DATABUFFER);}
1399         OptionalWordConst
1400         ')' '{'
1401             ByteList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1402     | PARSEOP_DATABUFFER '('
1403         error ')'                   {$$ = AslDoError(); yyclearin;}
1404     ;
1405 
1406 /*
1407  * In RefOf, the node isn't really a target, but we can't keep track of it after
1408  * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.)
1409  */
1410 RefOfTerm
1411     : PARSEOP_REFOF '('             {$<n>$ = TrCreateLeafNode (PARSEOP_REFOF);}
1412         SuperName
1413         ')'                         {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_TARGET));}
1414     | PARSEOP_REFOF '('
1415         error ')'                   {$$ = AslDoError(); yyclearin;}
1416     ;
1417 
1418 ReleaseTerm
1419     : PARSEOP_RELEASE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);}
1420         SuperName
1421         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1422     | PARSEOP_RELEASE '('
1423         error ')'                   {$$ = AslDoError(); yyclearin;}
1424     ;
1425 
1426 ResetTerm
1427     : PARSEOP_RESET '('             {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);}
1428         SuperName
1429         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1430     | PARSEOP_RESET '('
1431         error ')'                   {$$ = AslDoError(); yyclearin;}
1432     ;
1433 
1434 ReturnTerm
1435     : PARSEOP_RETURN '('            {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
1436         OptionalReturnArg
1437         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1438     | PARSEOP_RETURN                {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
1439     | PARSEOP_RETURN '('
1440         error ')'                   {$$ = AslDoError(); yyclearin;}
1441     ;
1442 
1443 ScopeTerm
1444     : PARSEOP_SCOPE '('             {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);}
1445         NameString
1446         ')' '{'
1447             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
1448     | PARSEOP_SCOPE '('
1449         error ')'                   {$$ = AslDoError(); yyclearin;}
1450     ;
1451 
1452 ShiftLeftTerm
1453     : PARSEOP_SHIFTLEFT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
1454         TermArg
1455         TermArgItem
1456         Target
1457         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1458     | PARSEOP_SHIFTLEFT '('
1459         error ')'                   {$$ = AslDoError(); yyclearin;}
1460     ;
1461 
1462 ShiftRightTerm
1463     : PARSEOP_SHIFTRIGHT '('        {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
1464         TermArg
1465         TermArgItem
1466         Target
1467         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1468     | PARSEOP_SHIFTRIGHT '('
1469         error ')'                   {$$ = AslDoError(); yyclearin;}
1470     ;
1471 
1472 SignalTerm
1473     : PARSEOP_SIGNAL '('            {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);}
1474         SuperName
1475         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1476     | PARSEOP_SIGNAL '('
1477         error ')'                   {$$ = AslDoError(); yyclearin;}
1478     ;
1479 
1480 SizeOfTerm
1481     : PARSEOP_SIZEOF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);}
1482         SuperName
1483         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1484     | PARSEOP_SIZEOF '('
1485         error ')'                   {$$ = AslDoError(); yyclearin;}
1486     ;
1487 
1488 SleepTerm
1489     : PARSEOP_SLEEP '('             {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);}
1490         TermArg
1491         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1492     | PARSEOP_SLEEP '('
1493         error ')'                   {$$ = AslDoError(); yyclearin;}
1494     ;
1495 
1496 StallTerm
1497     : PARSEOP_STALL '('             {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);}
1498         TermArg
1499         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1500     | PARSEOP_STALL '('
1501         error ')'                   {$$ = AslDoError(); yyclearin;}
1502     ;
1503 
1504 StoreTerm
1505     : PARSEOP_STORE '('             {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);}
1506         TermArg
1507         ',' SuperName
1508         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
1509     | PARSEOP_STORE '('
1510         error ')'                   {$$ = AslDoError(); yyclearin;}
1511     ;
1512 
1513 SubtractTerm
1514     : PARSEOP_SUBTRACT '('          {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
1515         TermArg
1516         TermArgItem
1517         Target
1518         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1519     | PARSEOP_SUBTRACT '('
1520         error ')'                   {$$ = AslDoError(); yyclearin;}
1521     ;
1522 SwitchTerm
1523     : PARSEOP_SWITCH '('            {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);}
1524         TermArg
1525         ')' '{'
1526             CaseDefaultTermList '}'
1527                                     {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1528     | PARSEOP_SWITCH '('
1529         error ')'                   {$$ = AslDoError(); yyclearin;}
1530     ;
1531 
1532 ThermalZoneTerm
1533     : PARSEOP_THERMALZONE '('       {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);}
1534         NameString
1535         ')' '{'
1536             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
1537     | PARSEOP_THERMALZONE '('
1538         error ')'                   {$$ = AslDoError(); yyclearin;}
1539     ;
1540 
1541 TimerTerm
1542     : PARSEOP_TIMER '('             {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);}
1543         ')'                         {$$ = TrLinkChildren ($<n>3,0);}
1544     | PARSEOP_TIMER                 {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);}
1545     | PARSEOP_TIMER '('
1546         error ')'                   {$$ = AslDoError(); yyclearin;}
1547     ;
1548 
1549 ToBCDTerm
1550     : PARSEOP_TOBCD '('             {$<n>$ = TrCreateLeafNode (PARSEOP_TOBCD);}
1551         TermArg
1552         Target
1553         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1554     | PARSEOP_TOBCD '('
1555         error ')'                   {$$ = AslDoError(); yyclearin;}
1556     ;
1557 
1558 ToBufferTerm
1559     : PARSEOP_TOBUFFER '('          {$<n>$ = TrCreateLeafNode (PARSEOP_TOBUFFER);}
1560         TermArg
1561         Target
1562         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1563     | PARSEOP_TOBUFFER '('
1564         error ')'                   {$$ = AslDoError(); yyclearin;}
1565     ;
1566 
1567 ToDecimalStringTerm
1568     : PARSEOP_TODECIMALSTRING '('   {$<n>$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);}
1569         TermArg
1570         Target
1571         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1572     | PARSEOP_TODECIMALSTRING '('
1573         error ')'                   {$$ = AslDoError(); yyclearin;}
1574     ;
1575 
1576 ToHexStringTerm
1577     : PARSEOP_TOHEXSTRING '('       {$<n>$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);}
1578         TermArg
1579         Target
1580         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1581     | PARSEOP_TOHEXSTRING '('
1582         error ')'                   {$$ = AslDoError(); yyclearin;}
1583     ;
1584 
1585 ToIntegerTerm
1586     : PARSEOP_TOINTEGER '('         {$<n>$ = TrCreateLeafNode (PARSEOP_TOINTEGER);}
1587         TermArg
1588         Target
1589         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1590     | PARSEOP_TOINTEGER '('
1591         error ')'                   {$$ = AslDoError(); yyclearin;}
1592     ;
1593 
1594 ToPLDTerm
1595     : PARSEOP_TOPLD '('             {$<n>$ = TrCreateLeafNode (PARSEOP_TOPLD);}
1596         PldKeywordList
1597         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1598     | PARSEOP_TOPLD '('
1599         error ')'                   {$$ = AslDoError(); yyclearin;}
1600     ;
1601 
1602 PldKeywordList
1603     :                               {$$ = NULL;}
1604     | PldKeyword
1605         PARSEOP_EXP_EQUALS Integer  {$$ = TrLinkChildren ($1,1,$3);}
1606     | PldKeyword
1607         PARSEOP_EXP_EQUALS String   {$$ = TrLinkChildren ($1,1,$3);}
1608     | PldKeywordList ','            /* Allows a trailing comma at list end */
1609     | PldKeywordList ','
1610         PldKeyword
1611         PARSEOP_EXP_EQUALS Integer  {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));}
1612     | PldKeywordList ','
1613         PldKeyword
1614         PARSEOP_EXP_EQUALS String   {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));}
1615     ;
1616 
1617 
1618 ToStringTerm
1619     : PARSEOP_TOSTRING '('          {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);}
1620         TermArg
1621         OptionalCount
1622         Target
1623         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1624     | PARSEOP_TOSTRING '('
1625         error ')'                   {$$ = AslDoError(); yyclearin;}
1626     ;
1627 
1628 ToUUIDTerm
1629     : PARSEOP_TOUUID '('
1630         StringData ')'              {$$ = TrUpdateNode (PARSEOP_TOUUID, $3);}
1631     | PARSEOP_TOUUID '('
1632         error ')'                   {$$ = AslDoError(); yyclearin;}
1633     ;
1634 
1635 UnicodeTerm
1636     : PARSEOP_UNICODE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_UNICODE);}
1637         StringData
1638         ')'                         {$$ = TrLinkChildren ($<n>3,2,0,$4);}
1639     | PARSEOP_UNICODE '('
1640         error ')'                   {$$ = AslDoError(); yyclearin;}
1641     ;
1642 
1643 UnloadTerm
1644     : PARSEOP_UNLOAD '('            {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);}
1645         SuperName
1646         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1647     | PARSEOP_UNLOAD '('
1648         error ')'                   {$$ = AslDoError(); yyclearin;}
1649     ;
1650 
1651 WaitTerm
1652     : PARSEOP_WAIT '('              {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);}
1653         SuperName
1654         TermArgItem
1655         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1656     | PARSEOP_WAIT '('
1657         error ')'                   {$$ = AslDoError(); yyclearin;}
1658     ;
1659 
1660 XOrTerm
1661     : PARSEOP_XOR '('               {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
1662         TermArg
1663         TermArgItem
1664         Target
1665         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1666     | PARSEOP_XOR '('
1667         error ')'                   {$$ = AslDoError(); yyclearin;}
1668     ;
1669 
1670 WhileTerm
1671     : PARSEOP_WHILE '('             {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);}
1672         TermArg
1673         ')' '{' TermList '}'
1674                                     {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1675     | PARSEOP_WHILE '('
1676         error ')'                   {$$ = AslDoError(); yyclearin;}
1677     ;
1678 
1679 
1680 /*******************************************************************************
1681  *
1682  * ASL Helper Terms
1683  *
1684  ******************************************************************************/
1685 
1686 AmlPackageLengthTerm
1687     : Integer                       {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,(ACPI_PARSE_OBJECT *) $1);}
1688     ;
1689 
1690 NameStringItem
1691     : ',' NameString                {$$ = $2;}
1692     | ',' error                     {$$ = AslDoError (); yyclearin;}
1693     ;
1694 
1695 TermArgItem
1696     : ',' TermArg                   {$$ = $2;}
1697     | ',' error                     {$$ = AslDoError (); yyclearin;}
1698     ;
1699 
1700 OptionalReference
1701     :                               {$$ = TrCreateLeafNode (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
1702     | ','                           {$$ = TrCreateLeafNode (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
1703     | ',' TermArg                   {$$ = $2;}
1704     ;
1705 
1706 OptionalReturnArg
1707     :                               {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);}       /* Placeholder is a ZeroOp object */
1708     | TermArg                       {$$ = $1;}
1709     ;
1710 
1711 OptionalSerializeRuleKeyword
1712     :                               {$$ = NULL;}
1713     | ','                           {$$ = NULL;}
1714     | ',' SerializeRuleKeyword      {$$ = $2;}
1715     ;
1716 
1717 OptionalTermArg
1718     :                               {$$ = NULL;}
1719     | TermArg                       {$$ = $1;}
1720     ;
1721 
1722 OptionalWordConst
1723     :                               {$$ = NULL;}
1724     | WordConst                     {$$ = $1;}
1725     ;
1726