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