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