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