3 /******************************************************************************
5 * Module Name: aslcompiler.l - Flex input file
8 *****************************************************************************/
10 /******************************************************************************
14 * Some or all of this work - Copyright (c) 1999 - 2003, 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 "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 "IndexField" { count (2); return (PARSEOP_INDEXFIELD); }
211 "Method" { count (2); return (PARSEOP_METHOD); }
212 "Mutex" { count (2); return (PARSEOP_MUTEX); }
213 "OperationRegion" { count (2); return (PARSEOP_OPERATIONREGION); }
214 "PowerResource" { count (2); return (PARSEOP_POWERRESOURCE); }
215 "Processor" { count (2); return (PARSEOP_PROCESSOR); }
216 "ThermalZone" { count (2); return (PARSEOP_THERMALZONE); }
217 "Alias" { count (2); return (PARSEOP_ALIAS); }
218 "Name" { count (2); return (PARSEOP_NAME); }
219 "Scope" { count (2); return (PARSEOP_SCOPE); }
220 "Break" { count (3); return (PARSEOP_BREAK); }
221 "BreakPoint" { count (3); return (PARSEOP_BREAKPOINT); }
222 "Continue" { count (3); return (PARSEOP_CONTINUE); }
223 "Fatal" { count (3); return (PARSEOP_FATAL); }
224 "If" { count (3); return (PARSEOP_IF); }
225 "Else" { count (3); return (PARSEOP_ELSE); }
226 "ElseIf" { count (3); return (PARSEOP_ELSEIF); }
227 "Load" { count (3); return (PARSEOP_LOAD); }
228 "Noop" { count (3); return (PARSEOP_NOOP); }
229 "Notify" { count (3); return (PARSEOP_NOTIFY); }
230 "Release" { count (3); return (PARSEOP_RELEASE); }
231 "Reset" { count (3); return (PARSEOP_RESET); }
232 "Return" { count (3); return (PARSEOP_RETURN); }
233 "Signal" { count (3); return (PARSEOP_SIGNAL); }
234 "Sleep" { count (3); return (PARSEOP_SLEEP); }
235 "Stall" { count (3); return (PARSEOP_STALL); }
236 "Switch" { count (3); return (PARSEOP_SWITCH); }
237 "Case" { count (3); return (PARSEOP_CASE); }
238 "Default" { count (3); return (PARSEOP_DEFAULT); }
239 "Unload" { count (3); return (PARSEOP_UNLOAD); }
240 "While" { count (3); return (PARSEOP_WHILE); }
242 "Acquire" { count (3); return (PARSEOP_ACQUIRE); }
243 "Add" { count (3); return (PARSEOP_ADD); }
244 "And" { count (3); return (PARSEOP_AND); }
245 "Concatenate" { count (3); return (PARSEOP_CONCATENATE); }
246 "ConcatenateResTemplate" { count (3); return (PARSEOP_CONCATENATERESTEMPLATE); }
247 "CondRefOf" { count (3); return (PARSEOP_CONDREFOF); }
248 "CopyObject" { count (3); return (PARSEOP_COPYOBJECT); }
249 "Decrement" { count (3); return (PARSEOP_DECREMENT); }
250 "DeRefOf" { count (3); return (PARSEOP_DEREFOF); }
251 "Divide" { count (3); return (PARSEOP_DIVIDE); }
252 "FindSetLeftBit" { count (3); return (PARSEOP_FINDSETLEFTBIT); }
253 "FindSetRightBit" { count (3); return (PARSEOP_FINDSETRIGHTBIT); }
254 "FromBCD" { count (3); return (PARSEOP_FROMBCD); }
255 "Increment" { count (3); return (PARSEOP_INCREMENT); }
256 "Index" { count (3); return (PARSEOP_INDEX); }
257 "LAnd" { count (3); return (PARSEOP_LAND); }
258 "LEqual" { count (3); return (PARSEOP_LEQUAL); }
259 "LGreater" { count (3); return (PARSEOP_LGREATER); }
260 "LGreaterEqual" { count (3); return (PARSEOP_LGREATEREQUAL); }
261 "LLess" { count (3); return (PARSEOP_LLESS); }
262 "LLessEqual" { count (3); return (PARSEOP_LLESSEQUAL); }
263 "LNot" { count (3); return (PARSEOP_LNOT); }
264 "LNotEqual" { count (3); return (PARSEOP_LNOTEQUAL); }
265 "LoadTable" { count (3); return (PARSEOP_LOADTABLE); }
266 "LOr" { count (3); return (PARSEOP_LOR); }
267 "Match" { count (3); return (PARSEOP_MATCH); }
268 "Mid" { count (3); return (PARSEOP_MID); }
269 "Mod" { count (3); return (PARSEOP_MOD); }
270 "Multiply" { count (3); return (PARSEOP_MULTIPLY); }
271 "NAnd" { count (3); return (PARSEOP_NAND); }
272 "NOr" { count (3); return (PARSEOP_NOR); }
273 "Not" { count (3); return (PARSEOP_NOT); }
274 "ObjectType" { count (3); return (PARSEOP_OBJECTTYPE); }
275 "Or" { count (3); return (PARSEOP_OR); }
276 "RefOf" { count (3); return (PARSEOP_REFOF); }
277 "ShiftLeft" { count (3); return (PARSEOP_SHIFTLEFT); }
278 "ShiftRight" { count (3); return (PARSEOP_SHIFTRIGHT); }
279 "SizeOf" { count (3); return (PARSEOP_SIZEOF); }
280 "Store" { count (3); return (PARSEOP_STORE); }
281 "Subtract" { count (3); return (PARSEOP_SUBTRACT); }
282 "ToBCD" { count (3); return (PARSEOP_TOBCD); }
283 "ToBuffer" { count (3); return (PARSEOP_TOBUFFER); }
284 "ToDecimalString" { count (3); return (PARSEOP_TODECIMALSTRING); }
285 "ToHexString" { count (3); return (PARSEOP_TOHEXSTRING); }
286 "ToInteger" { count (3); return (PARSEOP_TOINTEGER); }
287 "ToString" { count (3); return (PARSEOP_TOSTRING); }
288 "Wait" { count (3); return (PARSEOP_WAIT); }
289 "XOr" { count (3); return (PARSEOP_XOR); }
291 "Arg0" { count (1); return (PARSEOP_ARG0); }
292 "Arg1" { count (1); return (PARSEOP_ARG1); }
293 "Arg2" { count (1); return (PARSEOP_ARG2); }
294 "Arg3" { count (1); return (PARSEOP_ARG3); }
295 "Arg4" { count (1); return (PARSEOP_ARG4); }
296 "Arg5" { count (1); return (PARSEOP_ARG5); }
297 "Arg6" { count (1); return (PARSEOP_ARG6); }
299 "Local0" { count (1); return (PARSEOP_LOCAL0); }
300 "Local1" { count (1); return (PARSEOP_LOCAL1); }
301 "Local2" { count (1); return (PARSEOP_LOCAL2); }
302 "Local3" { count (1); return (PARSEOP_LOCAL3); }
303 "Local4" { count (1); return (PARSEOP_LOCAL4); }
304 "Local5" { count (1); return (PARSEOP_LOCAL5); }
305 "Local6" { count (1); return (PARSEOP_LOCAL6); }
306 "Local7" { count (1); return (PARSEOP_LOCAL7); }
308 "Debug" { count (1); return (PARSEOP_DEBUG); }
310 "DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); }
311 "Buffer" { count (1); return (PARSEOP_BUFFER); }
312 "Package" { count (1); return (PARSEOP_PACKAGE); }
314 "EISAID" { count (1); return (PARSEOP_EISAID); }
315 "ResourceTemplate" { count (1); return (PARSEOP_RESOURCETEMPLATE); }
316 "Unicode" { count (1); return (PARSEOP_UNICODE); }
317 "DMA" { count (1); return (PARSEOP_DMA); }
318 "DWordIO" { count (1); return (PARSEOP_DWORDIO); }
319 "DWordMemory" { count (1); return (PARSEOP_DWORDMEMORY); }
320 "EndDependentFn" { count (1); return (PARSEOP_ENDDEPENDENTFN); }
321 "FixedIO" { count (1); return (PARSEOP_FIXEDIO); }
322 "Interrupt" { count (1); return (PARSEOP_INTERRUPT); }
323 "IO" { count (1); return (PARSEOP_IO); }
324 "IRQNoFlags" { count (1); return (PARSEOP_IRQNOFLAGS); }
325 "IRQ" { count (1); return (PARSEOP_IRQ); }
326 "Memory24" { count (1); return (PARSEOP_MEMORY24); }
327 "Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); }
328 "Memory32" { count (1); return (PARSEOP_MEMORY32); }
329 "QWordIO" { count (1); return (PARSEOP_QWORDIO); }
330 "QWordMemory" { count (1); return (PARSEOP_QWORDMEMORY); }
331 "Register" { count (1); return (PARSEOP_REGISTER); }
332 "StartDependentFn" { count (1); return (PARSEOP_STARTDEPENDENTFN); }
333 "StartDependentFnNoPri" { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); }
334 "VendorLong" { count (1); return (PARSEOP_VENDORLONG); }
335 "VendorShort" { count (1); return (PARSEOP_VENDORSHORT); }
336 "WordBusNumber" { count (1); return (PARSEOP_WORDBUSNUMBER); }
337 "WordIO" { count (1); return (PARSEOP_WORDIO); }
339 "UnknownObj" { count (0); return (PARSEOP_OBJECTTYPE_UNK); }
340 "IntObj" { count (0); return (PARSEOP_OBJECTTYPE_INT); }
341 "StrObj" { count (0); return (PARSEOP_OBJECTTYPE_STR); }
342 "BuffObj" { count (0); return (PARSEOP_OBJECTTYPE_BUF); }
343 "PkgObj" { count (0); return (PARSEOP_OBJECTTYPE_PKG); }
344 "FieldUnitObj" { count (0); return (PARSEOP_OBJECTTYPE_FLD); }
345 "DeviceObj" { count (0); return (PARSEOP_OBJECTTYPE_DEV); }
346 "EventObj" { count (0); return (PARSEOP_OBJECTTYPE_EVT); }
347 "MethodObj" { count (0); return (PARSEOP_OBJECTTYPE_MTH); }
348 "MutexObj" { count (0); return (PARSEOP_OBJECTTYPE_MTX); }
349 "OpRegionObj" { count (0); return (PARSEOP_OBJECTTYPE_OPR); }
350 "PowerResObj" { count (0); return (PARSEOP_OBJECTTYPE_POW); }
351 "ThermalZoneObj" { count (0); return (PARSEOP_OBJECTTYPE_THZ); }
352 "BuffFieldObj" { count (0); return (PARSEOP_OBJECTTYPE_BFF); }
353 "DDBHandleObj" { count (0); return (PARSEOP_OBJECTTYPE_DDB); }
355 "AnyAcc" { count (0); return (PARSEOP_ACCESSTYPE_ANY); }
356 "ByteAcc" { count (0); return (PARSEOP_ACCESSTYPE_BYTE); }
357 "WordAcc" { count (0); return (PARSEOP_ACCESSTYPE_WORD); }
358 "DWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_DWORD); }
359 "QWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_QWORD); }
360 "BufferAcc" { count (0); return (PARSEOP_ACCESSTYPE_BUF); }
362 "Lock" { count (0); return (PARSEOP_LOCKRULE_LOCK); }
363 "NoLock" { count (0); return (PARSEOP_LOCKRULE_NOLOCK); }
365 "Preserve" { count (0); return (PARSEOP_UPDATERULE_PRESERVE); }
366 "WriteAsOnes" { count (0); return (PARSEOP_UPDATERULE_ONES); }
367 "WriteAsZeros" { count (0); return (PARSEOP_UPDATERULE_ZEROS); }
369 "Serialized" { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); }
370 "NotSerialized" { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); }
372 "SystemIO" { count (0); return (PARSEOP_REGIONSPACE_IO); }
373 "SystemMemory" { count (0); return (PARSEOP_REGIONSPACE_MEM); }
374 "PCI_Config" { count (0); return (PARSEOP_REGIONSPACE_PCI); }
375 "EmbeddedControl" { count (0); return (PARSEOP_REGIONSPACE_EC); }
376 "SMBus" { count (0); return (PARSEOP_REGIONSPACE_SMBUS); }
377 "SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); }
378 "PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); }
380 "FFixedHW" { count (0); return (PARSEOP_ADDRESSSPACE_FFIXEDHW); }
382 "SMBQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); }
383 "SMBSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); }
384 "SMBByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); }
385 "SMBWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); }
386 "SMBBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); }
387 "SMBProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); }
388 "SMBBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); }
390 "MTR" { count (0); return (PARSEOP_MATCHTYPE_MTR); }
391 "MEQ" { count (0); return (PARSEOP_MATCHTYPE_MEQ); }
392 "MLE" { count (0); return (PARSEOP_MATCHTYPE_MLE); }
393 "MLT" { count (0); return (PARSEOP_MATCHTYPE_MLT); }
394 "MGE" { count (0); return (PARSEOP_MATCHTYPE_MGE); }
395 "MGT" { count (0); return (PARSEOP_MATCHTYPE_MGT); }
397 "Compatibility" { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); }
398 "TypeA" { count (0); return (PARSEOP_DMATYPE_A); }
399 "TypeB" { count (0); return (PARSEOP_DMATYPE_B); }
400 "TypeF" { count (0); return (PARSEOP_DMATYPE_F); }
402 "BusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); }
403 "NotBusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); }
405 "Transfer8" { count (0); return (PARSEOP_XFERTYPE_8); }
406 "Transfer8_16" { count (0); return (PARSEOP_XFERTYPE_8_16); }
407 "Transfer16" { count (0); return (PARSEOP_XFERTYPE_16); }
409 "ResourceConsumer" { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); }
410 "ResourceProducer" { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); }
412 "MinFixed" { count (0); return (PARSEOP_MINTYPE_FIXED); }
413 "MinNotFixed" { count (0); return (PARSEOP_MINTYPE_NOTFIXED); }
415 "MaxFixed" { count (0); return (PARSEOP_MAXTYPE_FIXED); }
416 "MaxNotFixed" { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); }
418 "PosDecode" { count (0); return (PARSEOP_DECODETYPE_POS); }
419 "SubDecode" { count (0); return (PARSEOP_DECODETYPE_SUB); }
421 "ISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_ISAONLY); }
422 "NonISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); }
423 "EntireRange" { count (0); return (PARSEOP_RANGETYPE_ENTIRE); }
425 "Cacheable" { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); }
426 "WriteCombining" { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); }
427 "Prefetchable" { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); }
428 "NonCacheable" { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); }
430 "ReadWrite" { count (0); return (PARSEOP_READWRITETYPE_BOTH); }
431 "ReadOnly" { count (0); return (PARSEOP_READWRITETYPE_READONLY); }
433 "Edge" { count (0); return (PARSEOP_INTTYPE_EDGE); }
434 "Level" { count (0); return (PARSEOP_INTTYPE_LEVEL); }
436 "ActiveHigh" { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); }
437 "ActiveLow" { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); }
439 "Shared" { count (0); return (PARSEOP_SHARETYPE_SHARED); }
440 "Exclusive" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); }
442 "Decode10" { count (0); return (PARSEOP_IODECODETYPE_10); }
443 "Decode16" { count (0); return (PARSEOP_IODECODETYPE_16); }
445 "TypeTranslation" { count (0); return (PARSEOP_TYPE_TRANSLATION); }
446 "TypeStatic" { count (0); return (PARSEOP_TYPE_STATIC); }
448 "SparseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); }
449 "DenseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); }
451 "AddressRangeMemory" { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); }
452 "AddressRangeReserved" { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); }
453 "AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); }
454 "AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); }
457 "{" { count (0); return('{'); }
458 "}" { count (0); return('}'); }
459 "," { count (0); return(','); }
460 "(" { count (0); return('('); }
461 ")" { count (0); return(')'); }
466 s=malloc (ACPI_NAME_SIZE + 1);
467 if (strcmp (AslCompilertext, "\\"))
470 ACPI_STRUPR (AslCompilertext);
472 memcpy (s, AslCompilertext, strlen (AslCompilertext));
473 AslCompilerlval.s = s;
474 DbgPrint (ASL_PARSE_OUTPUT, "NameSeg: %s\n", s);
475 return (PARSEOP_NAMESEG); }
477 {NameString} { char *s;
479 s=malloc (strlen (AslCompilertext)+1);
480 ACPI_STRUPR (AslCompilertext);
481 strcpy (s, AslCompilertext);
482 s[strlen (AslCompilertext)] = 0;
483 AslCompilerlval.s = s;
484 DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s);
485 return (PARSEOP_NAMESTRING); }
489 AslCompilererror ("Parse error, expecting ASL keyword or name");}
493 "Invalid character (0x%2.2X), expecting ASL keyword or name",
495 AslCompilererror (MsgBuffer);}
497 <<EOF>> { if (AslPopInputFileStack ())
500 return (PARSEOP_INCLUDE_END);};
504 /*! [End] no source code translation !*/
506 typedef struct asl_file_node
509 UINT32 CurrentLineNumber;
510 YY_BUFFER_STATE State;
512 struct asl_file_node *Next;
516 ASL_FILE_NODE *InputStack = NULL;
519 /*******************************************************************************
521 * FUNCTION: AslPopInputFileStack
525 * RETURN: 0 if a node was popped, -1 otherwise
527 * DESCRIPTION: Pop the top of the input file stack and point the parser to
528 * the saved parse buffer contained in the fnode. Also, set the
529 * global line counters to the saved values. This function is
530 * called when an include file reaches EOF.
532 ******************************************************************************/
535 AslPopInputFileStack (
538 ASL_FILE_NODE *Fnode;
539 FILE *InputFile = NULL;
543 DbgPrint (ASL_PARSE_OUTPUT, "\nPop InputFile Stack, Fnode %p\n\n", Fnode);
551 /* Close the current include file */
555 /* Update the top-of-stack */
557 InputStack = Fnode->Next;
558 InputFile = Fnode->File;
560 /* Reset global line counter and filename */
562 Gbl_Files[ASL_FILE_INPUT].Filename = Fnode->Filename;
563 Gbl_CurrentLineNumber = Fnode->CurrentLineNumber;
565 /* Point the parser to the popped file */
567 yy_delete_buffer (YY_CURRENT_BUFFER);
568 yy_switch_to_buffer (Fnode->State);
570 /* All done with this node */
572 ACPI_MEM_FREE (Fnode);
577 /*******************************************************************************
579 * FUNCTION: AslPushInputFileStack
581 * PARAMETERS: InputFile - Open file pointer
582 * Filename - Name of the file
586 * DESCRIPTION: Push the InputFile onto the file stack, and point the parser
587 * to this file. Called when an include file is successfully
590 ******************************************************************************/
593 AslPushInputFileStack (
597 ASL_FILE_NODE *Fnode;
598 YY_BUFFER_STATE State;
601 /* Save the current state in an Fnode */
603 Fnode = UtLocalCalloc (sizeof (ASL_FILE_NODE));
606 Fnode->Next = InputStack;
607 Fnode->State = YY_CURRENT_BUFFER;
608 Fnode->CurrentLineNumber = Gbl_CurrentLineNumber;
609 Fnode->Filename = Gbl_Files[ASL_FILE_INPUT].Filename;
611 /* Push it on the stack */
615 /* Point the parser to this file */
617 State = yy_create_buffer (InputFile, YY_BUF_SIZE);
618 yy_switch_to_buffer (State);
620 DbgPrint (ASL_PARSE_OUTPUT, "\nPush InputFile Stack, returning %p\n\n", InputFile);
622 /* Reset the global line count and filename */
624 Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
625 Gbl_CurrentLineNumber = 1;
630 /*******************************************************************************
632 * FUNCTION: ResetCurrentLineBuffer
638 * DESCRIPTION: Reset the Line Buffer to zero, increment global line numbers.
640 ******************************************************************************/
643 ResetCurrentLineBuffer (
647 if (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle)
649 FlWriteFile (ASL_FILE_SOURCE_OUTPUT, Gbl_CurrentLineBuffer,
650 Gbl_LineBufPtr - Gbl_CurrentLineBuffer);
653 Gbl_CurrentLineOffset += Gbl_CurrentColumn;
654 Gbl_CurrentColumn = 0;
656 Gbl_CurrentLineNumber++;
657 Gbl_LogicalLineNumber++;
658 Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
662 /*******************************************************************************
664 * FUNCTION: InsertLineBuffer
666 * PARAMETERS: SourceChar - One char from the input ASL source file
670 * DESCRIPTION: Put one character of the source file into the temp line buffer
672 ******************************************************************************/
674 #define ASL_SPACES_PER_TAB 4
684 if (SourceChar == EOF)
689 Gbl_InputByteCount++;
691 /* Handle tabs. Convert to spaces */
693 if (SourceChar == '\t')
696 Count = ASL_SPACES_PER_TAB -
697 (Gbl_CurrentColumn & (ASL_SPACES_PER_TAB-1));
701 for (i = 0; i < Count; i++)
705 /* Insert the character into the line buffer */
707 *Gbl_LineBufPtr = (UINT8) SourceChar;
710 if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1)))
714 * Warning if we have split a long source line.
715 * <Probably overkill>
717 sprintf (MsgBuffer, "Max %d", ASL_LINE_BUFFER_SIZE);
718 AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE,
719 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
720 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
721 Gbl_Files[ASL_FILE_INPUT].Filename, MsgBuffer);
724 ResetCurrentLineBuffer ();
726 else if (SourceChar == '\n')
730 ResetCurrentLineBuffer ();
736 /*******************************************************************************
740 * PARAMETERS: yytext - Contains the matched keyword.
741 * Type - Keyword/Character type:
742 * 0 = anything except a keyword
743 * 1 = pseudo-keywords
744 * 2 = non-executable ASL keywords
745 * 3 = executable ASL keywords
749 * DESCRIPTION: Count keywords and put them into the line buffer
751 ******************************************************************************/
769 TotalExecutableOpcodes++;
773 for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++)
775 InsertLineBuffer (yytext[i]);
781 /*******************************************************************************
789 * DESCRIPTION: Process a standard comment.
791 ******************************************************************************/
800 InsertLineBuffer ('/');
801 InsertLineBuffer ('*');
805 /* Eat chars until end-of-comment */
807 while ((c = (char) input()) != '*' && c != EOF)
809 InsertLineBuffer (c);
819 * Check for nested comment -- can help catch cases where a previous
820 * comment was accidently left unterminated
822 if ((c1 == '/') && (c == '*'))
824 AslCommonError (ASL_WARNING, ASL_MSG_NESTED_COMMENT,
825 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
826 Gbl_InputByteCount, Gbl_CurrentColumn,
827 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
830 /* Comment is closed only if the NEXT character is a slash */
832 InsertLineBuffer (c);
834 if ((c1 = (char) input()) != '/' && c1 != EOF)
845 InsertLineBuffer (c1);
851 * Premature End-Of-File
853 AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
854 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
855 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
856 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
861 /*******************************************************************************
869 * DESCRIPTION: Process a new "//" comment.
871 ******************************************************************************/
879 InsertLineBuffer ('/');
880 InsertLineBuffer ('/');
882 while ((c = (char) input()) != '\n' && c != EOF)
884 InsertLineBuffer (c);
890 * Premature End-Of-File
892 AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
893 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
894 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
895 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
899 InsertLineBuffer (c);
904 /*******************************************************************************
912 * DESCRIPTION: Process a string literal (surrounded by quotes)
914 ******************************************************************************/
916 #define ASL_NORMAL_CHAR 0
917 #define ASL_ESCAPE_SEQUENCE 1
918 #define ASL_OCTAL_CONSTANT 2
919 #define ASL_HEX_CONSTANT 3
927 UINT32 State = ASL_NORMAL_CHAR;
930 char ConvertBuffer[4];
934 * Eat chars until end-of-literal.
935 * NOTE: Put back the original surrounding quotes into the
936 * source line buffer.
938 InsertLineBuffer ('\"');
939 while ((StringChar = (char) input()) != EOF)
941 InsertLineBuffer (StringChar);
947 case ASL_NORMAL_CHAR:
953 * Special handling for backslash-escape sequence. We will
954 * toss the backslash and translate the escape char(s).
956 State = ASL_ESCAPE_SEQUENCE;
961 /* String terminator */
963 goto CompletedString;
968 case ASL_ESCAPE_SEQUENCE:
970 State = ASL_NORMAL_CHAR;
974 StringChar = 0x07; /* BELL */
978 StringChar = 0x08; /* BACKSPACE */
982 StringChar = 0x0C; /* FORMFEED */
986 StringChar = 0x0A; /* LINEFEED */
990 StringChar = 0x0D; /* CARRIAGE RETURN*/
994 StringChar = 0x09; /* HORIZONTAL TAB */
998 StringChar = 0x0B; /* VERTICAL TAB */
1002 State = ASL_HEX_CONSTANT;
1006 case '\'': /* Single Quote */
1007 case '\"': /* Double Quote */
1008 case '\\': /* Backslash */
1013 /* Check for an octal digit (0-7) */
1015 if (ACPI_IS_OCTAL_DIGIT (StringChar))
1017 State = ASL_OCTAL_CONSTANT;
1018 ConvertBuffer[0] = StringChar;
1023 /* Unknown escape sequence issue warning, but use the character */
1025 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_ESCAPE,
1026 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
1027 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
1028 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
1034 case ASL_OCTAL_CONSTANT:
1036 /* Up to three octal digits allowed */
1038 if (!ACPI_IS_OCTAL_DIGIT (StringChar) ||
1042 * Reached end of the constant. Convert the assembled ASCII
1043 * string and resume processing of the next character
1045 ConvertBuffer[i] = 0;
1046 Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 8);
1048 /* Check for NULL or non-ascii character (ignore if so) */
1050 if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
1052 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
1053 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
1054 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
1055 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
1063 State = ASL_NORMAL_CHAR;
1068 /* Append another digit of the constant */
1070 ConvertBuffer[i] = StringChar;
1075 case ASL_HEX_CONSTANT:
1077 /* Up to two hex digits allowed */
1079 if (!ACPI_IS_XDIGIT (StringChar) ||
1083 * Reached end of the constant. Convert the assembled ASCII
1084 * string and resume processing of the next character
1086 ConvertBuffer[i] = 0;
1087 Digit = (UINT8) ACPI_STRTOUL (ConvertBuffer, NULL, 16);
1089 /* Check for NULL or non-ascii character (ignore if so) */
1091 if ((Digit == 0) || (Digit > ACPI_ASCII_MAX))
1093 AslCommonError (ASL_WARNING, ASL_MSG_INVALID_STRING,
1094 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
1095 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
1096 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
1104 State = ASL_NORMAL_CHAR;
1109 /* Append another digit of the constant */
1111 ConvertBuffer[i] = StringChar;
1116 /* Save the finished character */
1123 * Premature End-Of-File
1125 AslCommonError (ASL_ERROR, ASL_MSG_EARLY_EOF,
1126 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
1127 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
1128 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
1134 * Null terminate the input string and copy string to a new buffer
1138 CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1);
1141 AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
1142 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
1143 Gbl_CurrentLineOffset, Gbl_CurrentColumn,
1144 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
1148 ACPI_STRCPY (CleanString, MsgBuffer);
1149 AslCompilerlval.s = CleanString;