3 /******************************************************************************
5 * Module Name: aslcompiler.l - Flex input file
8 *****************************************************************************/
10 /******************************************************************************
14 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
15 * All rights reserved.
19 * 2.1. This is your license from Intel Corp. under its intellectual property
20 * rights. You may have additional license terms from the party that provided
21 * you this software, covering your right to use that party's intellectual
24 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
25 * copy of the source code appearing in this file ("Covered Code") an
26 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
27 * base code distributed originally by Intel ("Original Intel Code") to copy,
28 * make derivatives, distribute, use and display any portion of the Covered
29 * Code in any form, with the right to sublicense such rights; and
31 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
32 * license (with the right to sublicense), under only those claims of Intel
33 * patents that are infringed by the Original Intel Code, to make, use, sell,
34 * offer to sell, and import the Covered Code and derivative works thereof
35 * solely to the minimum extent necessary to exercise the above copyright
36 * license, and in no event shall the patent license extend to any additions
37 * to or modifications of the Original Intel Code. No other license or right
38 * is granted directly or by implication, estoppel or otherwise;
40 * The above copyright and patent license is granted only if the following
45 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
46 * Redistribution of source code of any substantial portion of the Covered
47 * Code or modification with rights to further distribute source must include
48 * the above Copyright Notice, the above License, this list of Conditions,
49 * and the following Disclaimer and Export Compliance provision. In addition,
50 * Licensee must cause all Covered Code to which Licensee contributes to
51 * contain a file documenting the changes Licensee made to create that Covered
52 * Code and the date of any change. Licensee must include in that file the
53 * documentation of any changes made by any predecessor Licensee. Licensee
54 * must include a prominent statement that the modification is derived,
55 * directly or indirectly, from Original Intel Code.
57 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
58 * Redistribution of source code of any substantial portion of the Covered
59 * Code or modification without rights to further distribute source must
60 * include the following Disclaimer and Export Compliance provision in the
61 * documentation and/or other materials provided with distribution. In
62 * addition, Licensee may not authorize further sublicense of source of any
63 * portion of the Covered Code, and must include terms to the effect that the
64 * license from Licensee to its licensee is limited to the intellectual
65 * property embodied in the software Licensee provides to its licensee, and
66 * not to intellectual property embodied in modifications its licensee may
69 * 3.3. Redistribution of Executable. Redistribution in executable form of any
70 * substantial portion of the Covered Code or modification must reproduce the
71 * above Copyright Notice, and the following Disclaimer and Export Compliance
72 * provision in the documentation and/or other materials provided with the
75 * 3.4. Intel retains all right, title, and interest in and to the Original
78 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
79 * Intel shall be used in advertising or otherwise to promote the sale, use or
80 * other dealings in products derived from or relating to the Covered Code
81 * without prior written authorization from Intel.
83 * 4. Disclaimer and Export Compliance
85 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
86 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
87 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
88 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
89 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
90 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
93 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
94 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
95 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
96 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
97 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
98 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
99 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
102 * 4.3. Licensee shall not export, either directly or indirectly, any of this
103 * software or system incorporating such software without first obtaining any
104 * required license or other approval from the U. S. Department of Commerce or
105 * any other agency or department of the United States Government. In the
106 * event Licensee exports any such software from the United States or
107 * re-exports any such software from a foreign destination, Licensee shall
108 * ensure that the distribution and export/re-export of the software is in
109 * compliance with all laws, regulations, orders, or other restrictions of the
110 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
111 * any of its subsidiaries will export/re-export any technical data, process,
112 * software, or service, directly or indirectly, to any country for which the
113 * United States government or any agency thereof requires an export license,
114 * other governmental approval, or letter of assurance, without first obtaining
115 * such license, approval or letter.
117 *****************************************************************************/
122 #include <contrib/dev/acpica/compiler/aslcompiler.h>
123 #include "aslcompiler.y.h"
124 YYSTYPE AslCompilerlval;
127 * Generation: Use the following command line:
129 * flex.exe -PAslCompiler -i -o$(InputPath).c $(InputPath)
131 * -i: Scanner must be case-insensitive
134 #define _COMPONENT ACPI_COMPILER
135 ACPI_MODULE_NAME ("aslscan")
147 /*! [Begin] no source code translation */
152 LeadNameChar [A-Za-z_]
154 HexDigitChar [A-Fa-f0-9]
158 NameChar [A-Za-z_0-9]
159 NameSeg1 {LeadNameChar}{NameChar}
160 NameSeg2 {LeadNameChar}{NameChar}{NameChar}
161 NameSeg3 {LeadNameChar}{NameChar}{NameChar}{NameChar}
162 NameSeg {LeadNameChar}|{NameSeg1}|{NameSeg2}|{NameSeg3}
164 NameString {RootChar}|{RootChar}{NamePath}|[\^]+{NamePath}|{NonEmptyNamePath}
165 NamePath {NonEmptyNamePath}?
166 NonEmptyNamePath {NameSeg}{NamePathTail}*
167 NamePathTail [.]{NameSeg}
176 "/*" { if (!comment ()) yyterminate (); }
177 "//" { if (!comment2 ()) yyterminate (); }
179 "\"" { if (literal ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); }
182 0[xX]{HexDigitChar}+ |
183 {DigitChar}+ { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext);
184 count (1); return (PARSEOP_INTEGER); }
186 "Include" { count (1); return (PARSEOP_INCLUDE); }
187 "#include" { count (1); return (PARSEOP_INCLUDE_CSTYLE); }
188 "#line" { count (1); return (PARSEOP_LINE_CSTYLE); }
189 "External" { count (1); return (PARSEOP_EXTERNAL); }
192 "Ones" { count (1); return (PARSEOP_ONES); }
193 "One" { count (1); return (PARSEOP_ONE); }
194 "Zero" { count (1); return (PARSEOP_ZERO); }
195 "Revision" { count (1); return (PARSEOP_REVISION); }
197 "Offset" { count (1); return (PARSEOP_OFFSET); }
198 "AccessAs" { count (1); return (PARSEOP_ACCESSAS); }
199 "BankField" { count (2); return (PARSEOP_BANKFIELD); }
200 "CreateBitField" { count (2); return (PARSEOP_CREATEBITFIELD); }
201 "CreateByteField" { count (2); return (PARSEOP_CREATEBYTEFIELD); }
202 "CreateDWordField" { count (2); return (PARSEOP_CREATEDWORDFIELD); }
203 "CreateField" { count (2); return (PARSEOP_CREATEFIELD); }
204 "CreateQWordField" { count (2); return (PARSEOP_CREATEQWORDFIELD); }
205 "CreateWordField" { count (2); return (PARSEOP_CREATEWORDFIELD); }
206 "DataTableRegion" { count (2); return (PARSEOP_DATATABLEREGION); }
207 "Device" { count (2); return (PARSEOP_DEVICE); }
208 "Event" { count (2); return (PARSEOP_EVENT); }
209 "Field" { count (2); return (PARSEOP_FIELD); }
210 "Function" { count (2); return (PARSEOP_FUNCTION); }
211 "IndexField" { count (2); return (PARSEOP_INDEXFIELD); }
212 "Method" { count (2); return (PARSEOP_METHOD); }
213 "Mutex" { count (2); return (PARSEOP_MUTEX); }
214 "OperationRegion" { count (2); return (PARSEOP_OPERATIONREGION); }
215 "PowerResource" { count (2); return (PARSEOP_POWERRESOURCE); }
216 "Processor" { count (2); return (PARSEOP_PROCESSOR); }
217 "ThermalZone" { count (2); return (PARSEOP_THERMALZONE); }
218 "Alias" { count (2); return (PARSEOP_ALIAS); }
219 "Name" { count (2); return (PARSEOP_NAME); }
220 "Scope" { count (2); return (PARSEOP_SCOPE); }
221 "Break" { count (3); return (PARSEOP_BREAK); }
222 "BreakPoint" { count (3); return (PARSEOP_BREAKPOINT); }
223 "Continue" { count (3); return (PARSEOP_CONTINUE); }
224 "Fatal" { count (3); return (PARSEOP_FATAL); }
225 "If" { count (3); return (PARSEOP_IF); }
226 "Else" { count (3); return (PARSEOP_ELSE); }
227 "ElseIf" { count (3); return (PARSEOP_ELSEIF); }
228 "Load" { count (3); return (PARSEOP_LOAD); }
229 "Noop" { count (3); return (PARSEOP_NOOP); }
230 "Notify" { count (3); return (PARSEOP_NOTIFY); }
231 "Release" { count (3); return (PARSEOP_RELEASE); }
232 "Reset" { count (3); return (PARSEOP_RESET); }
233 "Return" { count (3); return (PARSEOP_RETURN); }
234 "Signal" { count (3); return (PARSEOP_SIGNAL); }
235 "Sleep" { count (3); return (PARSEOP_SLEEP); }
236 "Stall" { count (3); return (PARSEOP_STALL); }
237 "Switch" { count (3); return (PARSEOP_SWITCH); }
238 "Case" { count (3); return (PARSEOP_CASE); }
239 "Default" { count (3); return (PARSEOP_DEFAULT); }
240 "Unload" { count (3); return (PARSEOP_UNLOAD); }
241 "While" { count (3); return (PARSEOP_WHILE); }
243 "Acquire" { count (3); return (PARSEOP_ACQUIRE); }
244 "Add" { count (3); return (PARSEOP_ADD); }
245 "And" { count (3); return (PARSEOP_AND); }
246 "Concatenate" { count (3); return (PARSEOP_CONCATENATE); }
247 "ConcatenateResTemplate" { count (3); return (PARSEOP_CONCATENATERESTEMPLATE); }
248 "CondRefOf" { count (3); return (PARSEOP_CONDREFOF); }
249 "CopyObject" { count (3); return (PARSEOP_COPYOBJECT); }
250 "Decrement" { count (3); return (PARSEOP_DECREMENT); }
251 "DeRefOf" { count (3); return (PARSEOP_DEREFOF); }
252 "Divide" { count (3); return (PARSEOP_DIVIDE); }
253 "FindSetLeftBit" { count (3); return (PARSEOP_FINDSETLEFTBIT); }
254 "FindSetRightBit" { count (3); return (PARSEOP_FINDSETRIGHTBIT); }
255 "FromBCD" { count (3); return (PARSEOP_FROMBCD); }
256 "Increment" { count (3); return (PARSEOP_INCREMENT); }
257 "Index" { count (3); return (PARSEOP_INDEX); }
258 "LAnd" { count (3); return (PARSEOP_LAND); }
259 "LEqual" { count (3); return (PARSEOP_LEQUAL); }
260 "LGreater" { count (3); return (PARSEOP_LGREATER); }
261 "LGreaterEqual" { count (3); return (PARSEOP_LGREATEREQUAL); }
262 "LLess" { count (3); return (PARSEOP_LLESS); }
263 "LLessEqual" { count (3); return (PARSEOP_LLESSEQUAL); }
264 "LNot" { count (3); return (PARSEOP_LNOT); }
265 "LNotEqual" { count (3); return (PARSEOP_LNOTEQUAL); }
266 "LoadTable" { count (3); return (PARSEOP_LOADTABLE); }
267 "LOr" { count (3); return (PARSEOP_LOR); }
268 "Match" { count (3); return (PARSEOP_MATCH); }
269 "Mid" { count (3); return (PARSEOP_MID); }
270 "Mod" { count (3); return (PARSEOP_MOD); }
271 "Multiply" { count (3); return (PARSEOP_MULTIPLY); }
272 "NAnd" { count (3); return (PARSEOP_NAND); }
273 "NOr" { count (3); return (PARSEOP_NOR); }
274 "Not" { count (3); return (PARSEOP_NOT); }
275 "ObjectType" { count (3); return (PARSEOP_OBJECTTYPE); }
276 "Or" { count (3); return (PARSEOP_OR); }
277 "RefOf" { count (3); return (PARSEOP_REFOF); }
278 "ShiftLeft" { count (3); return (PARSEOP_SHIFTLEFT); }
279 "ShiftRight" { count (3); return (PARSEOP_SHIFTRIGHT); }
280 "SizeOf" { count (3); return (PARSEOP_SIZEOF); }
281 "Store" { count (3); return (PARSEOP_STORE); }
282 "Subtract" { count (3); return (PARSEOP_SUBTRACT); }
283 "Timer" { count (3); return (PARSEOP_TIMER); }
284 "ToBCD" { count (3); return (PARSEOP_TOBCD); }
285 "ToBuffer" { count (3); return (PARSEOP_TOBUFFER); }
286 "ToDecimalString" { count (3); return (PARSEOP_TODECIMALSTRING); }
287 "ToHexString" { count (3); return (PARSEOP_TOHEXSTRING); }
288 "ToInteger" { count (3); return (PARSEOP_TOINTEGER); }
289 "ToString" { count (3); return (PARSEOP_TOSTRING); }
290 "Wait" { count (3); return (PARSEOP_WAIT); }
291 "XOr" { count (3); return (PARSEOP_XOR); }
293 "Arg0" { count (1); return (PARSEOP_ARG0); }
294 "Arg1" { count (1); return (PARSEOP_ARG1); }
295 "Arg2" { count (1); return (PARSEOP_ARG2); }
296 "Arg3" { count (1); return (PARSEOP_ARG3); }
297 "Arg4" { count (1); return (PARSEOP_ARG4); }
298 "Arg5" { count (1); return (PARSEOP_ARG5); }
299 "Arg6" { count (1); return (PARSEOP_ARG6); }
301 "Local0" { count (1); return (PARSEOP_LOCAL0); }
302 "Local1" { count (1); return (PARSEOP_LOCAL1); }
303 "Local2" { count (1); return (PARSEOP_LOCAL2); }
304 "Local3" { count (1); return (PARSEOP_LOCAL3); }
305 "Local4" { count (1); return (PARSEOP_LOCAL4); }
306 "Local5" { count (1); return (PARSEOP_LOCAL5); }
307 "Local6" { count (1); return (PARSEOP_LOCAL6); }
308 "Local7" { count (1); return (PARSEOP_LOCAL7); }
310 "Debug" { count (1); return (PARSEOP_DEBUG); }
312 "DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); }
313 "Buffer" { count (1); return (PARSEOP_BUFFER); }
314 "Package" { count (1); return (PARSEOP_PACKAGE); }
316 "EISAID" { count (1); return (PARSEOP_EISAID); }
317 "ResourceTemplate" { count (1); return (PARSEOP_RESOURCETEMPLATE); }
318 "ToUUID" { count (1); return (PARSEOP_TOUUID); }
319 "Unicode" { count (1); return (PARSEOP_UNICODE); }
320 "DMA" { count (1); return (PARSEOP_DMA); }
321 "DWordIO" { count (1); return (PARSEOP_DWORDIO); }
322 "DWordMemory" { count (1); return (PARSEOP_DWORDMEMORY); }
323 "DWordSpace" { count (1); return (PARSEOP_DWORDSPACE); }
324 "EndDependentFn" { count (1); return (PARSEOP_ENDDEPENDENTFN); }
325 "ExtendedIO" { count (1); return (PARSEOP_EXTENDEDIO); }
326 "ExtendedMemory" { count (1); return (PARSEOP_EXTENDEDMEMORY); }
327 "ExtendedSpace" { count (1); return (PARSEOP_EXTENDEDSPACE); }
328 "FixedIO" { count (1); return (PARSEOP_FIXEDIO); }
329 "Interrupt" { count (1); return (PARSEOP_INTERRUPT); }
330 "IO" { count (1); return (PARSEOP_IO); }
331 "IRQNoFlags" { count (1); return (PARSEOP_IRQNOFLAGS); }
332 "IRQ" { count (1); return (PARSEOP_IRQ); }
333 "Memory24" { count (1); return (PARSEOP_MEMORY24); }
334 "Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); }
335 "Memory32" { count (1); return (PARSEOP_MEMORY32); }
336 "QWordIO" { count (1); return (PARSEOP_QWORDIO); }
337 "QWordMemory" { count (1); return (PARSEOP_QWORDMEMORY); }
338 "QWordSpace" { count (1); return (PARSEOP_QWORDSPACE); }
339 "Register" { count (1); return (PARSEOP_REGISTER); }
340 "StartDependentFn" { count (1); return (PARSEOP_STARTDEPENDENTFN); }
341 "StartDependentFnNoPri" { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); }
342 "VendorLong" { count (1); return (PARSEOP_VENDORLONG); }
343 "VendorShort" { count (1); return (PARSEOP_VENDORSHORT); }
344 "WordBusNumber" { count (1); return (PARSEOP_WORDBUSNUMBER); }
345 "WordIO" { count (1); return (PARSEOP_WORDIO); }
346 "WordSpace" { count (1); return (PARSEOP_WORDSPACE); }
348 "UnknownObj" { count (0); return (PARSEOP_OBJECTTYPE_UNK); }
349 "IntObj" { count (0); return (PARSEOP_OBJECTTYPE_INT); }
350 "StrObj" { count (0); return (PARSEOP_OBJECTTYPE_STR); }
351 "BuffObj" { count (0); return (PARSEOP_OBJECTTYPE_BUF); }
352 "PkgObj" { count (0); return (PARSEOP_OBJECTTYPE_PKG); }
353 "FieldUnitObj" { count (0); return (PARSEOP_OBJECTTYPE_FLD); }
354 "DeviceObj" { count (0); return (PARSEOP_OBJECTTYPE_DEV); }
355 "EventObj" { count (0); return (PARSEOP_OBJECTTYPE_EVT); }
356 "MethodObj" { count (0); return (PARSEOP_OBJECTTYPE_MTH); }
357 "MutexObj" { count (0); return (PARSEOP_OBJECTTYPE_MTX); }
358 "OpRegionObj" { count (0); return (PARSEOP_OBJECTTYPE_OPR); }
359 "PowerResObj" { count (0); return (PARSEOP_OBJECTTYPE_POW); }
360 "ProcessorObj" { count (0); return (PARSEOP_OBJECTTYPE_PRO); }
361 "ThermalZoneObj" { count (0); return (PARSEOP_OBJECTTYPE_THZ); }
362 "BuffFieldObj" { count (0); return (PARSEOP_OBJECTTYPE_BFF); }
363 "DDBHandleObj" { count (0); return (PARSEOP_OBJECTTYPE_DDB); }
365 "AnyAcc" { count (0); return (PARSEOP_ACCESSTYPE_ANY); }
366 "ByteAcc" { count (0); return (PARSEOP_ACCESSTYPE_BYTE); }
367 "WordAcc" { count (0); return (PARSEOP_ACCESSTYPE_WORD); }
368 "DWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_DWORD); }
369 "QWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_QWORD); }
370 "BufferAcc" { count (0); return (PARSEOP_ACCESSTYPE_BUF); }
372 "Lock" { count (0); return (PARSEOP_LOCKRULE_LOCK); }
373 "NoLock" { count (0); return (PARSEOP_LOCKRULE_NOLOCK); }
375 "Preserve" { count (0); return (PARSEOP_UPDATERULE_PRESERVE); }
376 "WriteAsOnes" { count (0); return (PARSEOP_UPDATERULE_ONES); }
377 "WriteAsZeros" { count (0); return (PARSEOP_UPDATERULE_ZEROS); }
379 "Serialized" { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); }
380 "NotSerialized" { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); }
382 "SystemIO" { count (0); return (PARSEOP_REGIONSPACE_IO); }
383 "SystemMemory" { count (0); return (PARSEOP_REGIONSPACE_MEM); }
384 "PCI_Config" { count (0); return (PARSEOP_REGIONSPACE_PCI); }
385 "EmbeddedControl" { count (0); return (PARSEOP_REGIONSPACE_EC); }
386 "SMBus" { count (0); return (PARSEOP_REGIONSPACE_SMBUS); }
387 "SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); }
388 "PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); }
390 "FFixedHW" { count (0); return (PARSEOP_ADDRESSSPACE_FFIXEDHW); }
392 "SMBQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); }
393 "SMBSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); }
394 "SMBByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); }
395 "SMBWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); }
396 "SMBBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); }
397 "SMBProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); }
398 "SMBBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); }
400 "MTR" { count (0); return (PARSEOP_MATCHTYPE_MTR); }
401 "MEQ" { count (0); return (PARSEOP_MATCHTYPE_MEQ); }
402 "MLE" { count (0); return (PARSEOP_MATCHTYPE_MLE); }
403 "MLT" { count (0); return (PARSEOP_MATCHTYPE_MLT); }
404 "MGE" { count (0); return (PARSEOP_MATCHTYPE_MGE); }
405 "MGT" { count (0); return (PARSEOP_MATCHTYPE_MGT); }
407 "Compatibility" { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); }
408 "TypeA" { count (0); return (PARSEOP_DMATYPE_A); }
409 "TypeB" { count (0); return (PARSEOP_DMATYPE_B); }
410 "TypeF" { count (0); return (PARSEOP_DMATYPE_F); }
412 "BusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); }
413 "NotBusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); }
415 "Transfer8" { count (0); return (PARSEOP_XFERTYPE_8); }
416 "Transfer8_16" { count (0); return (PARSEOP_XFERTYPE_8_16); }
417 "Transfer16" { count (0); return (PARSEOP_XFERTYPE_16); }
419 "ResourceConsumer" { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); }
420 "ResourceProducer" { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); }
422 "MinFixed" { count (0); return (PARSEOP_MINTYPE_FIXED); }
423 "MinNotFixed" { count (0); return (PARSEOP_MINTYPE_NOTFIXED); }
425 "MaxFixed" { count (0); return (PARSEOP_MAXTYPE_FIXED); }
426 "MaxNotFixed" { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); }
428 "PosDecode" { count (0); return (PARSEOP_DECODETYPE_POS); }
429 "SubDecode" { count (0); return (PARSEOP_DECODETYPE_SUB); }
431 "ISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_ISAONLY); }
432 "NonISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); }
433 "EntireRange" { count (0); return (PARSEOP_RANGETYPE_ENTIRE); }
435 "Cacheable" { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); }
436 "WriteCombining" { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); }
437 "Prefetchable" { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); }
438 "NonCacheable" { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); }
440 "ReadWrite" { count (0); return (PARSEOP_READWRITETYPE_BOTH); }
441 "ReadOnly" { count (0); return (PARSEOP_READWRITETYPE_READONLY); }
443 "Edge" { count (0); return (PARSEOP_INTTYPE_EDGE); }
444 "Level" { count (0); return (PARSEOP_INTTYPE_LEVEL); }
446 "ActiveHigh" { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); }
447 "ActiveLow" { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); }
449 "Shared" { count (0); return (PARSEOP_SHARETYPE_SHARED); }
450 "Exclusive" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); }
452 "Decode10" { count (0); return (PARSEOP_IODECODETYPE_10); }
453 "Decode16" { count (0); return (PARSEOP_IODECODETYPE_16); }
455 "TypeTranslation" { count (0); return (PARSEOP_TYPE_TRANSLATION); }
456 "TypeStatic" { count (0); return (PARSEOP_TYPE_STATIC); }
458 "SparseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); }
459 "DenseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); }
461 "AddressRangeMemory" { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); }
462 "AddressRangeReserved" { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); }
463 "AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); }
464 "AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); }
467 "{" { count (0); return('{'); }
468 "}" { count (0); return('}'); }
469 "," { count (0); return(','); }
470 "(" { count (0); return('('); }
471 ")" { count (0); return(')'); }
476 s=malloc (ACPI_NAME_SIZE + 1);
477 if (strcmp (AslCompilertext, "\\"))
480 AcpiUtStrupr (AslCompilertext);
482 memcpy (s, AslCompilertext, strlen (AslCompilertext));
483 AslCompilerlval.s = s;
484 DbgPrint (ASL_PARSE_OUTPUT, "NameSeg: %s\n", s);
485 return (PARSEOP_NAMESEG); }
487 {NameString} { char *s;
489 s=malloc (strlen (AslCompilertext)+1);
490 AcpiUtStrupr (AslCompilertext);
491 strcpy (s, AslCompilertext);
492 s[strlen (AslCompilertext)] = 0;
493 AslCompilerlval.s = s;
494 DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s);
495 return (PARSEOP_NAMESTRING); }
499 AslCompilererror ("Parse error, expecting ASL keyword or name");}
503 "Invalid character (0x%2.2X), expecting ASL keyword or name",
505 AslCompilererror (MsgBuffer);}
507 <<EOF>> { if (AslPopInputFileStack ())
510 return (PARSEOP_INCLUDE_END);};
514 /*! [End] no source code translation !*/
516 typedef struct asl_file_node
519 UINT32 CurrentLineNumber;
520 YY_BUFFER_STATE State;
522 struct asl_file_node *Next;
526 ASL_FILE_NODE *InputStack = NULL;
529 /*******************************************************************************
531 * FUNCTION: AslPopInputFileStack
535 * RETURN: 0 if a node was popped, -1 otherwise
537 * DESCRIPTION: Pop the top of the input file stack and point the parser to
538 * the saved parse buffer contained in the fnode. Also, set the
539 * global line counters to the saved values. This function is
540 * called when an include file reaches EOF.
542 ******************************************************************************/
545 AslPopInputFileStack (
548 ASL_FILE_NODE *Fnode;
549 FILE *InputFile = NULL;
553 DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode);
561 /* Close the current include file */
565 /* Update the top-of-stack */
567 InputStack = Fnode->Next;
568 InputFile = Fnode->File;
570 /* Reset global line counter and filename */
572 Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
573 Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
575 /* Point the parser to the popped file */
577 yy_delete_buffer (YY_CURRENT_BUFFER);
578 yy_switch_to_buffer (Fnode->State);
580 /* All done with this node */
582 ACPI_MEM_FREE (Fnode);
587 /*******************************************************************************
589 * FUNCTION: AslPushInputFileStack
591 * PARAMETERS: InputFile - Open file pointer
592 * Filename - Name of the file
596 * DESCRIPTION: Push the InputFile onto the file stack, and point the parser
597 * to this file. Called when an include file is successfully
600 ******************************************************************************/
603 AslPushInputFileStack (
607 ASL_FILE_NODE *Fnode;
608 YY_BUFFER_STATE State;
611 /* Save the current state in an Fnode */
613 Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE));
616 Fnode->Next = InputStack;
617 Fnode->State = YY_CURRENT_BUFFER;
618 Fnode->CurrentLineNumber = Gbl_CurrentLineNumber;
619 Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
621 /* Push it on the stack */
625 /* Point the parser to this file */
627 State = yy_create_buffer (InputFile, YY_BUF_SIZE);
628 yy_switch_to_buffer (State);
630 DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile);
632 /* Reset the global line count and filename */
634 Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
635 Gbl_CurrentLineNumber = 1;
640 /*******************************************************************************
642 * FUNCTION: ResetCurrentLineBuffer
648 * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers.
650 ******************************************************************************/
653 ResetCurrentLineBuffer (
657 if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle)
659 FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer,
660 Gbl_LineBufPtr - Gbl_CurrentLineBuffer);
663 Gbl_CurrentLineOffset += Gbl_CurrentColumn;
664 Gbl_CurrentColumn = 0;
666 Gbl_CurrentLineNumber++;
667 Gbl_LogicalLineNumber++;
668 Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
672 /*******************************************************************************
674 * FUNCTION: InsertLineBuffer
676 * PARAMETERS: SourceChar - One char from the input ASL source file
680 * DESCRIPTION: Put one character of the source file into the temp line buffer
682 ******************************************************************************/
684 #define ASL_SPACES_PER_TAB 4
694 if (SourceChar == EOF)
699 Gbl_InputByteCount++;
701 /* Handle tabs. Convert to spaces */
703 if (SourceChar == '\t')
706 Count = ASL_SPACES_PER_TAB -
707 (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1));
711 for (i = 0; i < Count; i++)
715 /* Insert the character into the line buffer */
717 *Gbl_LineBufPtr = (UINT8) SourceChar;
720 if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1)))
724 * Warning if we have split a long source line.
725 * <Probably overkill>
727 sprintf (MsgBuffer, "Max %d", ASL_LINE_BUFFER_SIZE);
728 AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
729 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
730 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
731 Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer);
734 ResetCurrentLineBuffer ();
736 else if (SourceChar == '\n')
740 ResetCurrentLineBuffer ();
746 /*******************************************************************************
750 * PARAMETERS: yytext - Contains the matched keyword.
751 * Type - Keyword/Character type:
752 * 0 = anything except a keyword
753 * 1 = pseudo-keywords
754 * 2 = non-executable ASL keywords
755 * 3 = executable ASL keywords
759 * DESCRIPTION: Count keywords and put them into the line buffer
761 ******************************************************************************/
779 TotalExecutableOpcodes++;
783 for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++)
785 InsertLineBuffer (yytext[i]);
791 /*******************************************************************************
799 * DESCRIPTION: Process a standard comment.
801 ******************************************************************************/
810 InsertLineBuffer ('/');
811 InsertLineBuffer ('*');
815 /* Eat chars until end-of-comment */
817 while ((c = (char) input()) != '*' && c != EOF)
819 InsertLineBuffer (c);
829 * Check for nested comment -- can help catch cases where a previous
830 * comment was accidently left unterminated
832 if ((c1 == '/') && (c == '*'))
834 AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT,
835 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
836 Gbl_InputByteCount, Gbl_CurrentColumn,
837 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
840 /* Comment is closed only if the NEXT character is a slash */
842 InsertLineBuffer (c);
844 if ((c1 = (char) input()) != '/' && c1 != EOF)
855 InsertLineBuffer (c1);
861 * Premature End-Of-File
863 AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
864 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
865 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
866 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
871 /*******************************************************************************
879 * DESCRIPTION: Process a new "//" comment.
881 ******************************************************************************/
889 InsertLineBuffer ('/');
890 InsertLineBuffer ('/');
892 while ((c = (char) input()) != '\n' && c != EOF)
894 InsertLineBuffer (c);
899 /* End of file is OK, change to newline. Let parser detect EOF later */
904 InsertLineBuffer (c);
909 /*******************************************************************************
917 * DESCRIPTION: Process a string literal (surrounded by quotes)
919 ******************************************************************************/
921 #define ASL_NORMAL_CHAR 0
922 #define ASL_ESCAPE_SEQUENCE 1
923 #define ASL_OCTAL_CONSTANT 2
924 #define ASL_HEX_CONSTANT 3
932 UINT32 State = ASL_NORMAL_CHAR;
935 UINT8 StringLength = 0;
936 char ConvertBuffer[4];
940 * Eat chars until end-of-literal.
941 * NOTE: Put back the original surrounding quotes into the
942 * source line buffer.
944 InsertLineBuffer ('\"');
945 while ((StringChar = (char) input()) != EOF)
948 if (StringLength == ACPI_MAX_STRING_CONVERSION)
950 /* Emit error only once, but keep going */
952 AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
953 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
954 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
955 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
958 InsertLineBuffer (StringChar);
964 case ASL_NORMAL_CHAR:
970 * Special handling for backslash-escape sequence. We will
971 * toss the backslash and translate the escape char(s).
973 State = ASL_ESCAPE_SEQUENCE;
978 /* String terminator */
980 goto CompletedString;
985 case ASL_ESCAPE_SEQUENCE:
987 State = ASL_NORMAL_CHAR;
991 StringChar = 0x07; /* BELL */
995 StringChar = 0x08; /* BACKSPACE */
999 StringChar = 0x0C; /* FORMFEED */
1003 StringChar = 0x0A; /* LINEFEED */
1007 StringChar = 0x0D; /* CARRIAGE RETURN*/
1011 StringChar = 0x09; /* HORIZONTAL TAB */
1015 StringChar = 0x0B; /* VERTICAL TAB */
1019 State = ASL_HEX_CONSTANT;
1023 case '\'': /* Single Quote */
1024 case '\"': /* Double Quote */
1025 case '\\': /* Backslash */
1030 /* Check for an octal digit (0-7) */
1032 if (ACPI_IS_OCTAL_DIGIT (StringChar))
1034 State = ASL_OCTAL_CONSTANT;
1035 ConvertBuffer[0] = StringChar;
1040 /* Unknown escape sequence issue warning, but use the character */
1042 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE,
1043 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
1044 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
1045 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
1051 case ASL_OCTAL_CONSTANT:
1053 /* Up to three octal digits allowed */
1055 if (!ACPI_IS_OCTAL_DIGIT (StringChar) ||
1059 * Reached end of the constant. Convert the assembled ASCII
1060 * string and resume processing of the next character
1062 ConvertBuffer[i] = 0;
1063 Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8);
1065 /* Check for NULL or non-ascii character (ignore if so) */
1067 if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
1069 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
1070 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
1071 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
1072 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
1080 State = ASL_NORMAL_CHAR;
1085 /* Append another digit of the constant */
1087 ConvertBuffer[i] = StringChar;
1092 case ASL_HEX_CONSTANT:
1094 /* Up to two hex digits allowed */
1096 if (!ACPI_IS_XDIGIT (StringChar) ||
1100 * Reached end of the constant. Convert the assembled ASCII
1101 * string and resume processing of the next character
1103 ConvertBuffer[i] = 0;
1104 Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16);
1106 /* Check for NULL or non-ascii character (ignore if so) */
1108 if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
1110 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
1111 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
1112 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
1113 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
1121 State = ASL_NORMAL_CHAR;
1126 /* Append another digit of the constant */
1128 ConvertBuffer[i] = StringChar;
1133 /* Save the finished character */
1140 * Premature End-Of-File
1142 AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
1143 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
1144 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
1145 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
1151 * Null terminate the input string and copy string to a new buffer
1155 CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1);
1158 AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
1159 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
1160 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
1161 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
1165 ACPI_STRCPY (CleanString, MsgBuffer);
1166 AslCompilerlval.s = CleanString;