xref: /netbsd-src/sys/external/bsd/acpica/dist/compiler/aslprimaries.y (revision 046a29855e04359424fd074e8313af6b6be8cfb6)
1 NoEcho('
2 /******************************************************************************
3  *
4  * Module Name: aslprimaries.y - Rules for primary ASL operators
5  *                             - Keep this file synched with the
6  *                               CvParseOpBlockType function in cvcompiler.c
7  *
8  *****************************************************************************/
9 
10 /*
11  * Copyright (C) 2000 - 2023, Intel Corp.
12  * All rights reserved.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions, and the following disclaimer,
19  *    without modification.
20  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
21  *    substantially similar to the "NO WARRANTY" disclaimer below
22  *    ("Disclaimer") and any redistribution must be conditioned upon
23  *    including a substantially similar Disclaimer requirement for further
24  *    binary redistribution.
25  * 3. Neither the names of the above-listed copyright holders nor the names
26  *    of any contributors may be used to endorse or promote products derived
27  *    from this software without specific prior written permission.
28  *
29  * Alternatively, this software may be distributed under the terms of the
30  * GNU General Public License ("GPL") version 2 as published by the Free
31  * Software Foundation.
32  *
33  * NO WARRANTY
34  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
37  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
38  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
40  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
41  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
42  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
43  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44  * POSSIBILITY OF SUCH DAMAGES.
45  */
46 
47 ')
48 
49 
50 /*******************************************************************************
51  *
52  * ASL Primary Terms
53  *
54  ******************************************************************************/
55 
56 AccessAsTerm
57     : PARSEOP_ACCESSAS
58         PARSEOP_OPEN_PAREN
59         AccessTypeKeyword
60         OptionalAccessAttribTerm
61         PARSEOP_CLOSE_PAREN         {$$ = TrCreateOp (PARSEOP_ACCESSAS,2,$3,$4);}
62     | PARSEOP_ACCESSAS
63         PARSEOP_OPEN_PAREN
64         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
65     ;
66 
67 AcquireTerm
68     : PARSEOP_ACQUIRE
69         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp(PARSEOP_ACQUIRE);}
70         SuperName
71         ',' WordConstExpr
72         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$6);}
73     | PARSEOP_ACQUIRE
74         PARSEOP_OPEN_PAREN
75         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
76     ;
77 
78 AddTerm
79     : PARSEOP_ADD
80         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_ADD);}
81         TermArg
82         TermArgItem
83         Target
84         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
85     | PARSEOP_ADD
86         PARSEOP_OPEN_PAREN
87         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
88     ;
89 
90 AliasTerm
91     : PARSEOP_ALIAS
92         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_ALIAS);}
93         NameString
94         NameStringItem
95         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,
96                                         TrSetOpFlags ($5, OP_IS_NAME_DECLARATION));}
97     | PARSEOP_ALIAS
98         PARSEOP_OPEN_PAREN
99         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
100     ;
101 
102 AndTerm
103     : PARSEOP_AND
104         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_AND);}
105         TermArg
106         TermArgItem
107         Target
108         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
109     | PARSEOP_AND
110         PARSEOP_OPEN_PAREN
111         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
112     ;
113 
114 ArgTerm
115     : PARSEOP_ARG0                  {$$ = TrCreateLeafOp (PARSEOP_ARG0);}
116     | PARSEOP_ARG1                  {$$ = TrCreateLeafOp (PARSEOP_ARG1);}
117     | PARSEOP_ARG2                  {$$ = TrCreateLeafOp (PARSEOP_ARG2);}
118     | PARSEOP_ARG3                  {$$ = TrCreateLeafOp (PARSEOP_ARG3);}
119     | PARSEOP_ARG4                  {$$ = TrCreateLeafOp (PARSEOP_ARG4);}
120     | PARSEOP_ARG5                  {$$ = TrCreateLeafOp (PARSEOP_ARG5);}
121     | PARSEOP_ARG6                  {$$ = TrCreateLeafOp (PARSEOP_ARG6);}
122     ;
123 
124 BankFieldTerm
125     : PARSEOP_BANKFIELD
126         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_BANKFIELD);}
127         NameString
128         NameStringItem
129         TermArgItem
130         OptionalAccessTypeKeyword
131         OptionalLockRuleKeyword
132         OptionalUpdateRuleKeyword
133         PARSEOP_CLOSE_PAREN '{'
134             FieldUnitList '}'       {$$ = TrLinkOpChildren ($<n>3,7,
135                                         $4,$5,$6,$7,$8,$9,$12);}
136     | PARSEOP_BANKFIELD
137         PARSEOP_OPEN_PAREN
138         error PARSEOP_CLOSE_PAREN
139         '{' error '}'               {$$ = AslDoError(); yyclearin;}
140     ;
141 
142 BreakTerm
143     : PARSEOP_BREAK                 {$$ = TrCreateOp (PARSEOP_BREAK, 0);}
144     ;
145 
146 BreakPointTerm
147     : PARSEOP_BREAKPOINT            {$$ = TrCreateOp (PARSEOP_BREAKPOINT, 0);}
148     ;
149 
150 BufferTerm
151     : PARSEOP_BUFFER                {$<n>$ = TrCreateLeafOp (PARSEOP_BUFFER); COMMENT_CAPTURE_OFF; }
152         OptionalDataCount
153         '{' BufferTermData '}'      {$$ = TrLinkOpChildren ($<n>2,2,$3,$5); COMMENT_CAPTURE_ON;}
154     ;
155 
156 BufferTermData
157     : ByteList                      {}
158     | StringData                    {}
159     ;
160 
161 CaseTerm
162     : PARSEOP_CASE
163         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_CASE);}
164         DataObject
165         PARSEOP_CLOSE_PAREN '{'
166             TermList '}'            {$$ = TrLinkOpChildren ($<n>3,2,$4,$7);}
167     | PARSEOP_CASE
168         PARSEOP_OPEN_PAREN
169         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
170     ;
171 
172 ConcatTerm
173     : PARSEOP_CONCATENATE
174         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_CONCATENATE);}
175         TermArg
176         TermArgItem
177         Target
178         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
179     | PARSEOP_CONCATENATE
180         PARSEOP_OPEN_PAREN
181         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
182     ;
183 
184 ConcatResTerm
185     : PARSEOP_CONCATENATERESTEMPLATE
186         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (
187                                         PARSEOP_CONCATENATERESTEMPLATE);}
188         TermArg
189         TermArgItem
190         Target
191         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
192     | PARSEOP_CONCATENATERESTEMPLATE
193         PARSEOP_OPEN_PAREN
194         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
195     ;
196 
197 CondRefOfTerm
198     : PARSEOP_CONDREFOF
199         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_CONDREFOF);}
200         CondRefOfSource
201         Target
202         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
203     | PARSEOP_CONDREFOF
204         PARSEOP_OPEN_PAREN
205         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
206     ;
207 
208 ConnectionTerm
209     : PARSEOP_CONNECTION
210         PARSEOP_OPEN_PAREN
211         NameString
212         PARSEOP_CLOSE_PAREN         {$$ = TrCreateOp (PARSEOP_CONNECTION,1,$3);}
213     | PARSEOP_CONNECTION
214         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_CONNECTION);}
215         ResourceMacroTerm
216         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3, 1,
217                                         TrLinkOpChildren (
218                                             TrCreateLeafOp (PARSEOP_RESOURCETEMPLATE), 3,
219                                             TrCreateLeafOp (PARSEOP_DEFAULT_ARG),
220                                             TrCreateLeafOp (PARSEOP_DEFAULT_ARG),
221                                             $4));}
222     | PARSEOP_CONNECTION
223         PARSEOP_OPEN_PAREN
224         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
225     ;
226 
227 ContinueTerm
228     : PARSEOP_CONTINUE              {$$ = TrCreateOp (PARSEOP_CONTINUE, 0);}
229     ;
230 
231 CopyObjectTerm
232     : PARSEOP_COPYOBJECT
233         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_COPYOBJECT);}
234         TermArg
235         ',' SimpleName
236         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,
237                                         TrSetOpFlags ($6, OP_IS_TARGET));}
238     | PARSEOP_COPYOBJECT
239         PARSEOP_OPEN_PAREN
240         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
241     ;
242 
243 CreateBitFieldTerm
244     : PARSEOP_CREATEBITFIELD
245         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_CREATEBITFIELD);}
246         TermArg
247         TermArgItem
248         NameStringItem
249         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,
250                                         TrSetOpFlags ($6, OP_IS_NAME_DECLARATION));}
251     | PARSEOP_CREATEBITFIELD
252         PARSEOP_OPEN_PAREN
253         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
254     ;
255 
256 CreateByteFieldTerm
257     : PARSEOP_CREATEBYTEFIELD
258         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_CREATEBYTEFIELD);}
259         TermArg
260         TermArgItem
261         NameStringItem
262         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,
263                                         TrSetOpFlags ($6, OP_IS_NAME_DECLARATION));}
264     | PARSEOP_CREATEBYTEFIELD
265         PARSEOP_OPEN_PAREN
266         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
267     ;
268 
269 CreateDWordFieldTerm
270     : PARSEOP_CREATEDWORDFIELD
271         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_CREATEDWORDFIELD);}
272         TermArg
273         TermArgItem
274         NameStringItem
275         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,
276                                         TrSetOpFlags ($6, OP_IS_NAME_DECLARATION));}
277     | PARSEOP_CREATEDWORDFIELD
278         PARSEOP_OPEN_PAREN
279         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
280     ;
281 
282 CreateFieldTerm
283     : PARSEOP_CREATEFIELD
284         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_CREATEFIELD);}
285         TermArg
286         TermArgItem
287         TermArgItem
288         NameStringItem
289         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,4,$4,$5,$6,
290                                         TrSetOpFlags ($7, OP_IS_NAME_DECLARATION));}
291     | PARSEOP_CREATEFIELD
292         PARSEOP_OPEN_PAREN
293         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
294     ;
295 
296 CreateQWordFieldTerm
297     : PARSEOP_CREATEQWORDFIELD
298         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_CREATEQWORDFIELD);}
299         TermArg
300         TermArgItem
301         NameStringItem
302         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,
303                                         TrSetOpFlags ($6, OP_IS_NAME_DECLARATION));}
304     | PARSEOP_CREATEQWORDFIELD
305         PARSEOP_OPEN_PAREN
306         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
307     ;
308 
309 CreateWordFieldTerm
310     : PARSEOP_CREATEWORDFIELD
311         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_CREATEWORDFIELD);}
312         TermArg
313         TermArgItem
314         NameStringItem
315         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,
316                                         TrSetOpFlags ($6, OP_IS_NAME_DECLARATION));}
317     | PARSEOP_CREATEWORDFIELD
318         PARSEOP_OPEN_PAREN
319         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
320     ;
321 
322 DataRegionTerm
323     : PARSEOP_DATATABLEREGION
324         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_DATATABLEREGION);}
325         NameString
326         TermArgItem
327         TermArgItem
328         TermArgItem
329         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,4,
330                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$5,$6,$7);}
331     | PARSEOP_DATATABLEREGION
332         PARSEOP_OPEN_PAREN
333         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
334     ;
335 
336 DebugTerm
337     : PARSEOP_DEBUG                 {$$ = TrCreateLeafOp (PARSEOP_DEBUG);}
338     ;
339 
340 DecTerm
341     : PARSEOP_DECREMENT
342         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_DECREMENT);}
343         SuperName
344         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
345     | PARSEOP_DECREMENT
346         PARSEOP_OPEN_PAREN
347         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
348     ;
349 
350 DefaultTerm
351     : PARSEOP_DEFAULT '{'           {$<n>$ = TrCreateLeafOp (PARSEOP_DEFAULT);}
352         TermList '}'                {$$ = TrLinkOpChildren ($<n>3,1,$4);}
353     | PARSEOP_DEFAULT '{'
354         error '}'                   {$$ = AslDoError(); yyclearin;}
355     ;
356 
357 DerefOfTerm
358     : PARSEOP_DEREFOF
359         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_DEREFOF);}
360         DerefOfSource
361         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
362     | PARSEOP_DEREFOF
363         PARSEOP_OPEN_PAREN
364         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
365     ;
366 
367 DeviceTerm
368     : PARSEOP_DEVICE
369         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_DEVICE);}
370         NameString
371         PARSEOP_CLOSE_PAREN '{'
372             TermList '}'            {$$ = TrLinkOpChildren ($<n>3,2,
373                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$7);}
374     | PARSEOP_DEVICE
375         PARSEOP_OPEN_PAREN
376         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
377     ;
378 
379 DivideTerm
380     : PARSEOP_DIVIDE
381         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_DIVIDE);}
382         TermArg
383         TermArgItem
384         Target
385         Target
386         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,4,$4,$5,$6,$7);}
387     | PARSEOP_DIVIDE
388         PARSEOP_OPEN_PAREN
389         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
390     ;
391 
392 EISAIDTerm
393     : PARSEOP_EISAID
394         PARSEOP_OPEN_PAREN
395         StringLiteral
396         PARSEOP_CLOSE_PAREN         {$$ = TrSetOpIntegerValue (PARSEOP_EISAID, $3);}
397     | PARSEOP_EISAID
398         PARSEOP_OPEN_PAREN
399         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
400     ;
401 
402 ElseIfTerm
403     : IfTerm ElseTerm               {$$ = TrLinkPeerOp ($1,$2);}
404     ;
405 
406 ElseTerm
407     :                               {$$ = NULL;}
408     | PARSEOP_ELSE '{'
409         TermList           {$<n>$ = TrCreateLeafOp (PARSEOP_ELSE);}
410         '}'                {$$ = TrLinkOpChildren ($<n>4,1,$3);}
411 
412     | PARSEOP_ELSE '{'
413         error '}'                   {$$ = AslDoError(); yyclearin;}
414 
415     | PARSEOP_ELSE
416         error                       {$$ = AslDoError(); yyclearin;}
417 
418     | PARSEOP_ELSEIF
419         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_ELSE);}
420         TermArg                     {$<n>$ = TrCreateLeafOp (PARSEOP_IF);}
421         PARSEOP_CLOSE_PAREN '{'
422             TermList '}'            {TrLinkOpChildren ($<n>5,2,$4,$8);}
423         ElseTerm                    {TrLinkPeerOp ($<n>5,$11);}
424                                     {$$ = TrLinkOpChildren ($<n>3,1,$<n>5);}
425 
426     | PARSEOP_ELSEIF
427         PARSEOP_OPEN_PAREN
428         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
429 
430     | PARSEOP_ELSEIF
431         error                       {$$ = AslDoError(); yyclearin;}
432     ;
433 
434 EventTerm
435     : PARSEOP_EVENT
436         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_EVENT);}
437         NameString
438         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,
439                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION));}
440     | PARSEOP_EVENT
441         PARSEOP_OPEN_PAREN
442         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
443     ;
444 
445 ExternalTerm
446     : PARSEOP_EXTERNAL
447         PARSEOP_OPEN_PAREN
448         NameString
449         OptionalObjectTypeKeyword
450         OptionalParameterTypePackage
451         OptionalParameterTypesPackage
452         PARSEOP_CLOSE_PAREN         {$$ = TrCreateOp (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);}
453     | PARSEOP_EXTERNAL
454         PARSEOP_OPEN_PAREN
455         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
456     ;
457 
458 FatalTerm
459     : PARSEOP_FATAL
460         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_FATAL);}
461         ByteConstExpr
462         ',' DWordConstExpr
463         TermArgItem
464         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$6,$7);}
465     | PARSEOP_FATAL
466         PARSEOP_OPEN_PAREN
467         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
468     ;
469 
470 FieldTerm
471     : PARSEOP_FIELD
472         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_FIELD);}
473         NameString
474         OptionalAccessTypeKeyword
475         OptionalLockRuleKeyword
476         OptionalUpdateRuleKeyword
477         PARSEOP_CLOSE_PAREN '{'
478             FieldUnitList '}'       {$$ = TrLinkOpChildren ($<n>3,5,$4,$5,$6,$7,$10);}
479     | PARSEOP_FIELD
480         PARSEOP_OPEN_PAREN
481         error PARSEOP_CLOSE_PAREN
482         '{' error '}'               {$$ = AslDoError(); yyclearin;}
483     ;
484 
485 FindSetLeftBitTerm
486     : PARSEOP_FINDSETLEFTBIT
487         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_FINDSETLEFTBIT);}
488         TermArg
489         Target
490         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
491     | PARSEOP_FINDSETLEFTBIT
492         PARSEOP_OPEN_PAREN
493         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
494     ;
495 
496 FindSetRightBitTerm
497     : PARSEOP_FINDSETRIGHTBIT
498         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_FINDSETRIGHTBIT);}
499         TermArg
500         Target
501         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
502     | PARSEOP_FINDSETRIGHTBIT
503         PARSEOP_OPEN_PAREN
504         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
505     ;
506 
507     /* Convert a For() loop to a While() loop */
508 ForTerm
509     : PARSEOP_FOR
510         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_WHILE);}
511         OptionalTermArg ','         {}
512         OptionalPredicate ','
513         OptionalTermArg             {$<n>$ = TrLinkPeerOp ($4,$<n>3);
514                                             TrSetOpParent ($9,$<n>3);}                /* New parent is WHILE */
515         PARSEOP_CLOSE_PAREN
516         '{' TermList '}'            {$<n>$ = TrLinkOpChildren ($<n>3,2,$7,$13);}
517                                     {$<n>$ = TrLinkPeerOp ($13,$9);
518                                         $$ = $<n>10;}
519     ;
520 
521 OptionalPredicate
522     :                               {$$ = TrCreateValuedLeafOp (PARSEOP_INTEGER, 1);}
523     | TermArg                       {$$ = $1;}
524     ;
525 
526 FprintfTerm
527     : PARSEOP_FPRINTF
528         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_FPRINTF);}
529         TermArg ','
530         StringLiteral
531         PrintfArgList
532         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$6,$7);}
533     | PARSEOP_FPRINTF
534         PARSEOP_OPEN_PAREN
535         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
536     ;
537 
538 FromBCDTerm
539     : PARSEOP_FROMBCD
540         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_FROMBCD);}
541         TermArg
542         Target
543         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
544     | PARSEOP_FROMBCD
545         PARSEOP_OPEN_PAREN
546         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
547     ;
548 
549 FunctionTerm
550     : PARSEOP_FUNCTION
551         PARSEOP_OPEN_PAREN          {COMMENT_CAPTURE_OFF; $<n>$ = TrCreateLeafOp (PARSEOP_METHOD); }
552         NameString
553         OptionalParameterTypePackage
554         OptionalParameterTypesPackage
555         PARSEOP_CLOSE_PAREN '{'     {COMMENT_CAPTURE_ON; }
556             TermList '}'            {$$ = TrLinkOpChildren ($<n>3,7,
557                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),
558                                         TrCreateLeafOp (PARSEOP_DEFAULT_ARG),
559                                         TrCreateLeafOp (PARSEOP_SERIALIZERULE_NOTSERIAL),
560                                         TrCreateValuedLeafOp (PARSEOP_BYTECONST, 0),$5,$6,$10);}
561     | PARSEOP_FUNCTION
562         PARSEOP_OPEN_PAREN
563         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
564     ;
565 
566 IfTerm
567     : PARSEOP_IF
568         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_IF);}
569         TermArg
570         PARSEOP_CLOSE_PAREN '{'
571             TermList '}'            {$$ = TrLinkOpChildren ($<n>3,2,$4,$7);}
572 
573     | PARSEOP_IF
574         PARSEOP_OPEN_PAREN
575         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
576     ;
577 
578 IncludeTerm
579     : PARSEOP_INCLUDE
580         PARSEOP_OPEN_PAREN
581         String
582         PARSEOP_CLOSE_PAREN         {$$ = TrSetOpIntegerValue (PARSEOP_INCLUDE, $3);
583                                         FlOpenIncludeFile ($3);}
584     ;
585 
586 IncludeEndTerm
587     : PARSEOP_INCLUDE_END           {$<n>$ = TrCreateLeafOp (PARSEOP_INCLUDE_END);
588                                         TrSetOpCurrentFilename ($$);}
589     ;
590 
591 IncTerm
592     : PARSEOP_INCREMENT
593         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_INCREMENT);}
594         SuperName
595         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
596     | PARSEOP_INCREMENT
597         PARSEOP_OPEN_PAREN
598         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
599     ;
600 
601 IndexFieldTerm
602     : PARSEOP_INDEXFIELD
603         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_INDEXFIELD);}
604         NameString
605         NameStringItem
606         OptionalAccessTypeKeyword
607         OptionalLockRuleKeyword
608         OptionalUpdateRuleKeyword
609         PARSEOP_CLOSE_PAREN '{'
610             FieldUnitList '}'       {$$ = TrLinkOpChildren ($<n>3,6,$4,$5,$6,$7,$8,$11);}
611     | PARSEOP_INDEXFIELD
612         PARSEOP_OPEN_PAREN
613         error PARSEOP_CLOSE_PAREN
614         '{' error '}'               {$$ = AslDoError(); yyclearin;}
615     ;
616 
617 IndexTerm
618     : PARSEOP_INDEX
619         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_INDEX);}
620         TermArg
621         TermArgItem
622         Target
623         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
624     | PARSEOP_INDEX
625         PARSEOP_OPEN_PAREN
626         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
627     ;
628 
629 LAndTerm
630     : PARSEOP_LAND
631         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LAND);}
632         TermArg
633         TermArgItem
634         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
635     | PARSEOP_LAND
636         PARSEOP_OPEN_PAREN
637         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
638     ;
639 
640 LEqualTerm
641     : PARSEOP_LEQUAL
642         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LEQUAL);}
643         TermArg
644         TermArgItem
645         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
646     | PARSEOP_LEQUAL
647         PARSEOP_OPEN_PAREN
648         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
649     ;
650 
651 LGreaterEqualTerm
652     : PARSEOP_LGREATEREQUAL
653         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LLESS);}
654         TermArg
655         TermArgItem
656         PARSEOP_CLOSE_PAREN         {$$ = TrCreateOp (PARSEOP_LNOT, 1,
657                                         TrLinkOpChildren ($<n>3,2,$4,$5));}
658     | PARSEOP_LGREATEREQUAL
659         PARSEOP_OPEN_PAREN
660         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
661     ;
662 
663 LGreaterTerm
664     : PARSEOP_LGREATER
665         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LGREATER);}
666         TermArg
667         TermArgItem
668         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
669     | PARSEOP_LGREATER
670         PARSEOP_OPEN_PAREN
671         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
672     ;
673 
674 LLessEqualTerm
675     : PARSEOP_LLESSEQUAL
676         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LGREATER);}
677         TermArg
678         TermArgItem
679         PARSEOP_CLOSE_PAREN         {$$ = TrCreateOp (PARSEOP_LNOT, 1,
680                                         TrLinkOpChildren ($<n>3,2,$4,$5));}
681     | PARSEOP_LLESSEQUAL
682         PARSEOP_OPEN_PAREN
683         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
684     ;
685 
686 LLessTerm
687     : PARSEOP_LLESS
688         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LLESS);}
689         TermArg
690         TermArgItem
691         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
692     | PARSEOP_LLESS
693         PARSEOP_OPEN_PAREN
694         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
695     ;
696 
697 LNotEqualTerm
698     : PARSEOP_LNOTEQUAL
699         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LEQUAL);}
700         TermArg
701         TermArgItem
702         PARSEOP_CLOSE_PAREN         {$$ = TrCreateOp (PARSEOP_LNOT, 1,
703                                         TrLinkOpChildren ($<n>3,2,$4,$5));}
704     | PARSEOP_LNOTEQUAL
705         PARSEOP_OPEN_PAREN
706         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
707     ;
708 
709 LNotTerm
710     : PARSEOP_LNOT
711         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LNOT);}
712         TermArg
713         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
714     | PARSEOP_LNOT
715         PARSEOP_OPEN_PAREN
716         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
717     ;
718 
719 LoadTableTerm
720     : PARSEOP_LOADTABLE
721         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LOADTABLE);}
722         TermArg
723         TermArgItem
724         TermArgItem
725         OptionalListString
726         OptionalListString
727         OptionalReference
728         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,6,$4,$5,$6,$7,$8,$9);}
729     | PARSEOP_LOADTABLE
730         PARSEOP_OPEN_PAREN
731         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
732     ;
733 
734 LoadTerm
735     : PARSEOP_LOAD
736         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LOAD);}
737         NameString
738         Target
739         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
740     | PARSEOP_LOAD
741         PARSEOP_OPEN_PAREN
742         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
743     ;
744 
745 LocalTerm
746     : PARSEOP_LOCAL0                {$$ = TrCreateLeafOp (PARSEOP_LOCAL0);}
747     | PARSEOP_LOCAL1                {$$ = TrCreateLeafOp (PARSEOP_LOCAL1);}
748     | PARSEOP_LOCAL2                {$$ = TrCreateLeafOp (PARSEOP_LOCAL2);}
749     | PARSEOP_LOCAL3                {$$ = TrCreateLeafOp (PARSEOP_LOCAL3);}
750     | PARSEOP_LOCAL4                {$$ = TrCreateLeafOp (PARSEOP_LOCAL4);}
751     | PARSEOP_LOCAL5                {$$ = TrCreateLeafOp (PARSEOP_LOCAL5);}
752     | PARSEOP_LOCAL6                {$$ = TrCreateLeafOp (PARSEOP_LOCAL6);}
753     | PARSEOP_LOCAL7                {$$ = TrCreateLeafOp (PARSEOP_LOCAL7);}
754     ;
755 
756 LOrTerm
757     : PARSEOP_LOR
758         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_LOR);}
759         TermArg
760         TermArgItem
761         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
762     | PARSEOP_LOR
763         PARSEOP_OPEN_PAREN
764         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
765     ;
766 
767 MatchTerm
768     : PARSEOP_MATCH
769         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_MATCH);}
770         TermArg
771         ',' MatchOpKeyword
772         TermArgItem
773         ',' MatchOpKeyword
774         TermArgItem
775         TermArgItem
776         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,6,$4,$6,$7,$9,$10,$11);}
777     | PARSEOP_MATCH
778         PARSEOP_OPEN_PAREN
779         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
780     ;
781 
782 MethodTerm
783     : PARSEOP_METHOD
784         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_METHOD); COMMENT_CAPTURE_OFF;}
785         NameString
786         OptionalByteConstExpr       {UtCheckIntegerRange ($5, 0, 7);}
787         OptionalSerializeRuleKeyword
788         OptionalByteConstExpr
789         OptionalParameterTypePackage
790         OptionalParameterTypesPackage
791         PARSEOP_CLOSE_PAREN '{'     {COMMENT_CAPTURE_ON;}
792             TermList '}'            {$$ = TrLinkOpChildren ($<n>3,7,
793                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),
794                                         $5,$7,$8,$9,$10,$14);}
795     | PARSEOP_METHOD
796         PARSEOP_OPEN_PAREN
797         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
798     ;
799 
800 MidTerm
801     : PARSEOP_MID
802         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_MID);}
803         TermArg
804         TermArgItem
805         TermArgItem
806         Target
807         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,4,$4,$5,$6,$7);}
808     | PARSEOP_MID
809         PARSEOP_OPEN_PAREN
810         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
811     ;
812 
813 ModTerm
814     : PARSEOP_MOD
815         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_MOD);}
816         TermArg
817         TermArgItem
818         Target
819         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
820     | PARSEOP_MOD
821         PARSEOP_OPEN_PAREN
822         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
823     ;
824 
825 MultiplyTerm
826     : PARSEOP_MULTIPLY
827         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_MULTIPLY);}
828         TermArg
829         TermArgItem
830         Target
831         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
832     | PARSEOP_MULTIPLY
833         PARSEOP_OPEN_PAREN
834         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
835     ;
836 
837 MutexTerm
838     : PARSEOP_MUTEX
839         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_MUTEX);}
840         NameString
841         OptionalSyncLevel
842         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,
843                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$5);}
844     | PARSEOP_MUTEX
845         PARSEOP_OPEN_PAREN
846         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
847     ;
848 
849 NameTerm
850     : PARSEOP_NAME
851         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_NAME);}
852         NameString
853         ',' DataObject
854         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,
855                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$6);}
856     | PARSEOP_NAME
857         PARSEOP_OPEN_PAREN
858         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
859     ;
860 
861 NAndTerm
862     : PARSEOP_NAND
863         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_NAND);}
864         TermArg
865         TermArgItem
866         Target
867         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
868     | PARSEOP_NAND
869         PARSEOP_OPEN_PAREN
870         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
871     ;
872 
873 NoOpTerm
874     : PARSEOP_NOOP                  {$$ = TrCreateOp (PARSEOP_NOOP, 0);}
875     ;
876 
877 NOrTerm
878     : PARSEOP_NOR
879         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_NOR);}
880         TermArg
881         TermArgItem
882         Target
883         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
884     | PARSEOP_NOR
885         PARSEOP_OPEN_PAREN
886         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
887     ;
888 
889 NotifyTerm
890     : PARSEOP_NOTIFY
891         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_NOTIFY);}
892         SuperName
893         TermArgItem
894         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
895     | PARSEOP_NOTIFY
896         PARSEOP_OPEN_PAREN
897         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
898     ;
899 
900 NotTerm
901     : PARSEOP_NOT
902         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_NOT);}
903         TermArg
904         Target
905         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
906     | PARSEOP_NOT
907         PARSEOP_OPEN_PAREN
908         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
909     ;
910 
911 ObjectTypeTerm
912     : PARSEOP_OBJECTTYPE
913         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE);}
914         ObjectTypeSource
915         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
916     | PARSEOP_OBJECTTYPE
917         PARSEOP_OPEN_PAREN
918         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
919     ;
920 
921 OffsetTerm
922     : PARSEOP_OFFSET
923         PARSEOP_OPEN_PAREN
924         AmlPackageLengthTerm
925         PARSEOP_CLOSE_PAREN         {$$ = TrCreateOp (PARSEOP_OFFSET,1,$3);}
926     | PARSEOP_OFFSET
927         PARSEOP_OPEN_PAREN
928         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
929     ;
930 
931 OpRegionTerm
932     : PARSEOP_OPERATIONREGION
933         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_OPERATIONREGION);}
934         NameString
935         ',' OpRegionSpaceIdTerm
936         TermArgItem
937         TermArgItem
938         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,4,
939                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),
940                                         $6,$7,$8);}
941     | PARSEOP_OPERATIONREGION
942         PARSEOP_OPEN_PAREN
943         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
944     ;
945 
946 OpRegionSpaceIdTerm
947     : RegionSpaceKeyword            {}
948     | ByteConst                     {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
949     ;
950 
951 OrTerm
952     : PARSEOP_OR
953         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_OR);}
954         TermArg
955         TermArgItem
956         Target
957         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
958     | PARSEOP_OR
959         PARSEOP_OPEN_PAREN
960         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
961     ;
962 
963 PackageTerm
964     : PARSEOP_PACKAGE               {$<n>$ = TrCreateLeafOp (PARSEOP_VAR_PACKAGE);}
965         OptionalDataCount
966         '{' PackageList '}'         {$$ = TrLinkOpChildren ($<n>2,2,$3,$5);}
967 
968 PowerResTerm
969     : PARSEOP_POWERRESOURCE
970         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_POWERRESOURCE);}
971         NameString
972         ',' ByteConstExpr
973         ',' WordConstExpr
974         PARSEOP_CLOSE_PAREN '{'
975             TermList '}'            {$$ = TrLinkOpChildren ($<n>3,4,
976                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),
977                                         $6,$8,$11);}
978     | PARSEOP_POWERRESOURCE
979         PARSEOP_OPEN_PAREN
980         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
981     ;
982 
983 PrintfTerm
984     : PARSEOP_PRINTF
985         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_PRINTF);}
986         StringLiteral
987         PrintfArgList
988         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
989     | PARSEOP_PRINTF
990         PARSEOP_OPEN_PAREN
991         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
992     ;
993 
994 PrintfArgList
995     :                               {$$ = NULL;}
996     | TermArg                       {$$ = $1;}
997     | PrintfArgList ','
998        TermArg                      {$$ = TrLinkPeerOp ($1, $3);}
999     ;
1000 
1001 ProcessorTerm
1002     : PARSEOP_PROCESSOR
1003         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_PROCESSOR);}
1004         NameString
1005         ',' ByteConstExpr
1006         OptionalDWordConstExpr
1007         OptionalByteConstExpr
1008         PARSEOP_CLOSE_PAREN '{'
1009             TermList '}'            {$$ = TrLinkOpChildren ($<n>3,5,
1010                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),
1011                                         $6,$7,$8,$11);}
1012     | PARSEOP_PROCESSOR
1013         PARSEOP_OPEN_PAREN
1014         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1015     ;
1016 
1017 RawDataBufferTerm
1018     : PARSEOP_DATABUFFER
1019         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_DATABUFFER);}
1020         OptionalWordConst
1021         PARSEOP_CLOSE_PAREN '{'
1022             ByteList '}'            {$$ = TrLinkOpChildren ($<n>3,2,$4,$7);}
1023     | PARSEOP_DATABUFFER
1024         PARSEOP_OPEN_PAREN
1025         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1026     ;
1027 
1028 /*
1029  * In RefOf, the node isn't really a target, but we can't keep track of it after
1030  * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.)
1031  */
1032 RefOfTerm
1033     : PARSEOP_REFOF
1034         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_REFOF);}
1035         RefOfSource
1036         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,
1037                                         TrSetOpFlags ($4, OP_IS_TARGET));}
1038     | PARSEOP_REFOF
1039         PARSEOP_OPEN_PAREN
1040         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1041     ;
1042 
1043 ReleaseTerm
1044     : PARSEOP_RELEASE
1045         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_RELEASE);}
1046         SuperName
1047         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
1048     | PARSEOP_RELEASE
1049         PARSEOP_OPEN_PAREN
1050         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1051     ;
1052 
1053 ResetTerm
1054     : PARSEOP_RESET
1055         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_RESET);}
1056         SuperName
1057         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
1058     | PARSEOP_RESET
1059         PARSEOP_OPEN_PAREN
1060         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1061     ;
1062 
1063 ReturnTerm
1064     : PARSEOP_RETURN
1065         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_RETURN);}
1066         OptionalReturnArg
1067         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
1068     | PARSEOP_RETURN                {$$ = TrLinkOpChildren (
1069                                         TrCreateLeafOp (PARSEOP_RETURN),1,
1070                                         TrSetOpFlags (TrCreateLeafOp (PARSEOP_ZERO),
1071                                             OP_IS_NULL_RETURN));}
1072     | PARSEOP_RETURN
1073         PARSEOP_OPEN_PAREN
1074         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1075     ;
1076 
1077 ScopeTerm
1078     : PARSEOP_SCOPE
1079         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_SCOPE);}
1080         NameString
1081         PARSEOP_CLOSE_PAREN '{'
1082             TermList '}'            {$$ = TrLinkOpChildren ($<n>3,2,
1083                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$7);}
1084     | PARSEOP_SCOPE
1085         PARSEOP_OPEN_PAREN
1086         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1087     ;
1088 
1089 ShiftLeftTerm
1090     : PARSEOP_SHIFTLEFT
1091         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_SHIFTLEFT);}
1092         TermArg
1093         TermArgItem
1094         Target
1095         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
1096     | PARSEOP_SHIFTLEFT
1097         PARSEOP_OPEN_PAREN
1098         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1099     ;
1100 
1101 ShiftRightTerm
1102     : PARSEOP_SHIFTRIGHT
1103         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_SHIFTRIGHT);}
1104         TermArg
1105         TermArgItem
1106         Target
1107         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
1108     | PARSEOP_SHIFTRIGHT
1109         PARSEOP_OPEN_PAREN
1110         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1111     ;
1112 
1113 SignalTerm
1114     : PARSEOP_SIGNAL
1115         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_SIGNAL);}
1116         SuperName
1117         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
1118     | PARSEOP_SIGNAL
1119         PARSEOP_OPEN_PAREN
1120         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1121     ;
1122 
1123 SizeOfTerm
1124     : PARSEOP_SIZEOF
1125         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_SIZEOF);}
1126         SuperName
1127         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
1128     | PARSEOP_SIZEOF
1129         PARSEOP_OPEN_PAREN
1130         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1131     ;
1132 
1133 SleepTerm
1134     : PARSEOP_SLEEP
1135         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_SLEEP);}
1136         TermArg
1137         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
1138     | PARSEOP_SLEEP
1139         PARSEOP_OPEN_PAREN
1140         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1141     ;
1142 
1143 StallTerm
1144     : PARSEOP_STALL
1145         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_STALL);}
1146         TermArg
1147         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
1148     | PARSEOP_STALL
1149         PARSEOP_OPEN_PAREN
1150         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1151     ;
1152 
1153 StoreTerm
1154     : PARSEOP_STORE
1155         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_STORE);}
1156         TermArg
1157         ',' SuperName
1158         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,
1159                                             TrSetOpFlags ($6, OP_IS_TARGET));}
1160     | PARSEOP_STORE
1161         PARSEOP_OPEN_PAREN
1162         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1163     ;
1164 
1165 SubtractTerm
1166     : PARSEOP_SUBTRACT
1167         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_SUBTRACT);}
1168         TermArg
1169         TermArgItem
1170         Target
1171         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
1172     | PARSEOP_SUBTRACT
1173         PARSEOP_OPEN_PAREN
1174         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1175     ;
1176 
1177 SwitchTerm
1178     : PARSEOP_SWITCH
1179         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_SWITCH);}
1180         TermArg
1181         PARSEOP_CLOSE_PAREN '{'
1182             CaseDefaultTermList '}' {$$ = TrLinkOpChildren ($<n>3,2,$4,$7);}
1183     | PARSEOP_SWITCH
1184         PARSEOP_OPEN_PAREN
1185         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1186     ;
1187 
1188 ThermalZoneTerm
1189     : PARSEOP_THERMALZONE
1190         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_THERMALZONE);}
1191         NameString
1192         PARSEOP_CLOSE_PAREN '{'
1193             TermList '}'            {$$ = TrLinkOpChildren ($<n>3,2,
1194                                         TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$7);}
1195     | PARSEOP_THERMALZONE
1196         PARSEOP_OPEN_PAREN
1197         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1198     ;
1199 
1200 TimerTerm
1201     : PARSEOP_TIMER
1202         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_TIMER);}
1203         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,0);}
1204     | PARSEOP_TIMER                 {$$ = TrLinkOpChildren (
1205                                         TrCreateLeafOp (PARSEOP_TIMER),0);}
1206     | PARSEOP_TIMER
1207         PARSEOP_OPEN_PAREN
1208         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1209     ;
1210 
1211 ToBCDTerm
1212     : PARSEOP_TOBCD
1213         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_TOBCD);}
1214         TermArg
1215         Target
1216         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
1217     | PARSEOP_TOBCD
1218         PARSEOP_OPEN_PAREN
1219         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1220     ;
1221 
1222 ToBufferTerm
1223     : PARSEOP_TOBUFFER
1224         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_TOBUFFER);}
1225         TermArg
1226         Target
1227         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
1228     | PARSEOP_TOBUFFER
1229         PARSEOP_OPEN_PAREN
1230         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1231     ;
1232 
1233 ToDecimalStringTerm
1234     : PARSEOP_TODECIMALSTRING
1235         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_TODECIMALSTRING);}
1236         TermArg
1237         Target
1238         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
1239     | PARSEOP_TODECIMALSTRING
1240         PARSEOP_OPEN_PAREN
1241         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1242     ;
1243 
1244 ToHexStringTerm
1245     : PARSEOP_TOHEXSTRING
1246         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_TOHEXSTRING);}
1247         TermArg
1248         Target
1249         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
1250     | PARSEOP_TOHEXSTRING
1251         PARSEOP_OPEN_PAREN
1252         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1253     ;
1254 
1255 ToIntegerTerm
1256     : PARSEOP_TOINTEGER
1257         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_TOINTEGER);}
1258         TermArg
1259         Target
1260         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
1261     | PARSEOP_TOINTEGER
1262         PARSEOP_OPEN_PAREN
1263         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1264     ;
1265 
1266 ToPLDTerm
1267     : PARSEOP_TOPLD
1268         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_TOPLD);}
1269         PldKeywordList
1270         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
1271     | PARSEOP_TOPLD
1272         PARSEOP_OPEN_PAREN
1273         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1274     ;
1275 
1276 PldKeywordList
1277     :                               {$$ = NULL;}
1278     | PldKeyword
1279         PARSEOP_EXP_EQUALS Integer  {$$ = TrLinkOpChildren ($1,1,$3);}
1280     | PldKeyword
1281         PARSEOP_EXP_EQUALS String   {$$ = TrLinkOpChildren ($1,1,$3);}
1282     | PldKeywordList ','            /* Allows a trailing comma at list end */
1283     | PldKeywordList ','
1284         PldKeyword
1285         PARSEOP_EXP_EQUALS Integer  {$$ = TrLinkPeerOp ($1,TrLinkOpChildren ($3,1,$5));}
1286     | PldKeywordList ','
1287         PldKeyword
1288         PARSEOP_EXP_EQUALS String   {$$ = TrLinkPeerOp ($1,TrLinkOpChildren ($3,1,$5));}
1289     ;
1290 
1291 
1292 ToStringTerm
1293     : PARSEOP_TOSTRING
1294         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_TOSTRING);}
1295         TermArg
1296         OptionalCount
1297         Target
1298         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
1299     | PARSEOP_TOSTRING
1300         PARSEOP_OPEN_PAREN
1301         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1302     ;
1303 
1304 ToUUIDTerm
1305     : PARSEOP_TOUUID
1306         PARSEOP_OPEN_PAREN
1307         StringLiteral
1308         PARSEOP_CLOSE_PAREN         {$$ = TrSetOpIntegerValue (PARSEOP_TOUUID, $3);}
1309     | PARSEOP_TOUUID
1310         PARSEOP_OPEN_PAREN
1311         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1312     ;
1313 
1314 UnicodeTerm
1315     : PARSEOP_UNICODE
1316         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_UNICODE);}
1317         StringLiteral
1318         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,0,$4);}
1319     | PARSEOP_UNICODE
1320         PARSEOP_OPEN_PAREN
1321         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1322     ;
1323 
1324 UnloadTerm
1325     : PARSEOP_UNLOAD
1326         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_UNLOAD);}
1327         SuperName
1328         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,1,$4);}
1329     | PARSEOP_UNLOAD
1330         PARSEOP_OPEN_PAREN
1331         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1332     ;
1333 
1334 WaitTerm
1335     : PARSEOP_WAIT
1336         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_WAIT);}
1337         SuperName
1338         TermArgItem
1339         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
1340     | PARSEOP_WAIT
1341         PARSEOP_OPEN_PAREN
1342         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1343     ;
1344 
1345 XOrTerm
1346     : PARSEOP_XOR
1347         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_XOR);}
1348         TermArg
1349         TermArgItem
1350         Target
1351         PARSEOP_CLOSE_PAREN         {$$ = TrLinkOpChildren ($<n>3,3,$4,$5,$6);}
1352     | PARSEOP_XOR
1353         PARSEOP_OPEN_PAREN
1354         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1355     ;
1356 
1357 WhileTerm
1358     : PARSEOP_WHILE
1359         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_WHILE);}
1360         TermArg
1361         PARSEOP_CLOSE_PAREN
1362             '{' TermList '}'        {$$ = TrLinkOpChildren ($<n>3,2,$4,$7);}
1363     | PARSEOP_WHILE
1364         PARSEOP_OPEN_PAREN
1365         error PARSEOP_CLOSE_PAREN   {$$ = AslDoError(); yyclearin;}
1366     ;
1367