From: Gao, Liming Date: Mon, 27 Jan 2014 05:23:15 +0000 (+0000) Subject: Sync BaseTool trunk (version r2649) into EDKII BaseTools. X-Git-Tag: edk2-stable201903~11769 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=f51461c829c124288a930829a78e2a5a799f4039 Sync BaseTool trunk (version r2649) into EDKII BaseTools. Signed-off-by: Gao, Liming git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15188 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/BaseTools/Bin/Win32/BPDG.exe b/BaseTools/Bin/Win32/BPDG.exe index 76186caddd..7e7a62192f 100644 Binary files a/BaseTools/Bin/Win32/BPDG.exe and b/BaseTools/Bin/Win32/BPDG.exe differ diff --git a/BaseTools/Bin/Win32/BootSectImage.exe b/BaseTools/Bin/Win32/BootSectImage.exe index 7e4bd4dd16..a2ea5caf22 100755 Binary files a/BaseTools/Bin/Win32/BootSectImage.exe and b/BaseTools/Bin/Win32/BootSectImage.exe differ diff --git a/BaseTools/Bin/Win32/EfiLdrImage.exe b/BaseTools/Bin/Win32/EfiLdrImage.exe index 45219e3c38..a417b3052f 100755 Binary files a/BaseTools/Bin/Win32/EfiLdrImage.exe and b/BaseTools/Bin/Win32/EfiLdrImage.exe differ diff --git a/BaseTools/Bin/Win32/EfiRom.exe b/BaseTools/Bin/Win32/EfiRom.exe index bec9d9bcc2..306e2da4cf 100755 Binary files a/BaseTools/Bin/Win32/EfiRom.exe and b/BaseTools/Bin/Win32/EfiRom.exe differ diff --git a/BaseTools/Bin/Win32/GenBootSector.exe b/BaseTools/Bin/Win32/GenBootSector.exe index ac0abfb5b7..c87126002e 100755 Binary files a/BaseTools/Bin/Win32/GenBootSector.exe and b/BaseTools/Bin/Win32/GenBootSector.exe differ diff --git a/BaseTools/Bin/Win32/GenCrc32.exe b/BaseTools/Bin/Win32/GenCrc32.exe index 3f4c4d8ab4..3d21de0df4 100755 Binary files a/BaseTools/Bin/Win32/GenCrc32.exe and b/BaseTools/Bin/Win32/GenCrc32.exe differ diff --git a/BaseTools/Bin/Win32/GenDepex.exe b/BaseTools/Bin/Win32/GenDepex.exe index 3f7452a38c..540efbdd3b 100755 Binary files a/BaseTools/Bin/Win32/GenDepex.exe and b/BaseTools/Bin/Win32/GenDepex.exe differ diff --git a/BaseTools/Bin/Win32/GenFds.exe b/BaseTools/Bin/Win32/GenFds.exe index 2c7783bc30..0fe530a57f 100755 Binary files a/BaseTools/Bin/Win32/GenFds.exe and b/BaseTools/Bin/Win32/GenFds.exe differ diff --git a/BaseTools/Bin/Win32/GenFfs.exe b/BaseTools/Bin/Win32/GenFfs.exe index ad788da194..bd8d39f347 100755 Binary files a/BaseTools/Bin/Win32/GenFfs.exe and b/BaseTools/Bin/Win32/GenFfs.exe differ diff --git a/BaseTools/Bin/Win32/GenFv.exe b/BaseTools/Bin/Win32/GenFv.exe index c99b15c2be..e41175ec64 100755 Binary files a/BaseTools/Bin/Win32/GenFv.exe and b/BaseTools/Bin/Win32/GenFv.exe differ diff --git a/BaseTools/Bin/Win32/GenFw.exe b/BaseTools/Bin/Win32/GenFw.exe index df4199eca8..1c262ce07d 100755 Binary files a/BaseTools/Bin/Win32/GenFw.exe and b/BaseTools/Bin/Win32/GenFw.exe differ diff --git a/BaseTools/Bin/Win32/GenPage.exe b/BaseTools/Bin/Win32/GenPage.exe index a1d26dde3d..ff4a21b255 100755 Binary files a/BaseTools/Bin/Win32/GenPage.exe and b/BaseTools/Bin/Win32/GenPage.exe differ diff --git a/BaseTools/Bin/Win32/GenPatchPcdTable.exe b/BaseTools/Bin/Win32/GenPatchPcdTable.exe index b551b21f76..6195250cf1 100755 Binary files a/BaseTools/Bin/Win32/GenPatchPcdTable.exe and b/BaseTools/Bin/Win32/GenPatchPcdTable.exe differ diff --git a/BaseTools/Bin/Win32/GenSec.exe b/BaseTools/Bin/Win32/GenSec.exe index 8043691303..8ee0199236 100755 Binary files a/BaseTools/Bin/Win32/GenSec.exe and b/BaseTools/Bin/Win32/GenSec.exe differ diff --git a/BaseTools/Bin/Win32/GenVtf.exe b/BaseTools/Bin/Win32/GenVtf.exe index 3a0324cd4d..f3689914fe 100755 Binary files a/BaseTools/Bin/Win32/GenVtf.exe and b/BaseTools/Bin/Win32/GenVtf.exe differ diff --git a/BaseTools/Bin/Win32/LzmaCompress.exe b/BaseTools/Bin/Win32/LzmaCompress.exe index b4915d657e..f6dd28acf1 100755 Binary files a/BaseTools/Bin/Win32/LzmaCompress.exe and b/BaseTools/Bin/Win32/LzmaCompress.exe differ diff --git a/BaseTools/Bin/Win32/PatchPcdValue.exe b/BaseTools/Bin/Win32/PatchPcdValue.exe index dc145cdef3..00d66c98c4 100755 Binary files a/BaseTools/Bin/Win32/PatchPcdValue.exe and b/BaseTools/Bin/Win32/PatchPcdValue.exe differ diff --git a/BaseTools/Bin/Win32/Split.exe b/BaseTools/Bin/Win32/Split.exe index 9ea9592246..c8b56ecacf 100755 Binary files a/BaseTools/Bin/Win32/Split.exe and b/BaseTools/Bin/Win32/Split.exe differ diff --git a/BaseTools/Bin/Win32/TargetTool.exe b/BaseTools/Bin/Win32/TargetTool.exe index 6cda989ca6..eb436e2de5 100755 Binary files a/BaseTools/Bin/Win32/TargetTool.exe and b/BaseTools/Bin/Win32/TargetTool.exe differ diff --git a/BaseTools/Bin/Win32/TianoCompress.exe b/BaseTools/Bin/Win32/TianoCompress.exe index 0c756484b7..d48a3e1e1f 100755 Binary files a/BaseTools/Bin/Win32/TianoCompress.exe and b/BaseTools/Bin/Win32/TianoCompress.exe differ diff --git a/BaseTools/Bin/Win32/Trim.exe b/BaseTools/Bin/Win32/Trim.exe index feb0b1d955..18ff1a6276 100755 Binary files a/BaseTools/Bin/Win32/Trim.exe and b/BaseTools/Bin/Win32/Trim.exe differ diff --git a/BaseTools/Bin/Win32/UPT.exe b/BaseTools/Bin/Win32/UPT.exe index bea44d9e0d..684e12bb7c 100644 Binary files a/BaseTools/Bin/Win32/UPT.exe and b/BaseTools/Bin/Win32/UPT.exe differ diff --git a/BaseTools/Bin/Win32/VfrCompile.exe b/BaseTools/Bin/Win32/VfrCompile.exe index a35a4893ea..c177920caa 100755 Binary files a/BaseTools/Bin/Win32/VfrCompile.exe and b/BaseTools/Bin/Win32/VfrCompile.exe differ diff --git a/BaseTools/Bin/Win32/VolInfo.exe b/BaseTools/Bin/Win32/VolInfo.exe index 0ef74aa943..cfc971a972 100755 Binary files a/BaseTools/Bin/Win32/VolInfo.exe and b/BaseTools/Bin/Win32/VolInfo.exe differ diff --git a/BaseTools/Bin/Win32/build.exe b/BaseTools/Bin/Win32/build.exe index c7aaa98dbc..5953fa3d04 100755 Binary files a/BaseTools/Bin/Win32/build.exe and b/BaseTools/Bin/Win32/build.exe differ diff --git a/BaseTools/Conf/XMLSchema/DistributionPackage.xsd b/BaseTools/Conf/XMLSchema/DistributionPackage.xsd index c1f2184ca6..5fbbd59f93 100644 --- a/BaseTools/Conf/XMLSchema/DistributionPackage.xsd +++ b/BaseTools/Conf/XMLSchema/DistributionPackage.xsd @@ -1,2767 +1,2767 @@ - - - - - - This schema defines the UEFI/PI Distribution Package description (PKG) - file. It describes the content of: - 1) Package descriptions with definitions and headers. - 2) Modules in either source or binary format. (Note that Binary format - is for FFS leaf section file types only, complete FFS files cannot be distributed using this - distribution format.) - 3) The distribution of custom tools used to modify the binary images to - create UEFI/PI compliant images. - 4) Finally, it can be used to distribute other miscellaneous content - that is not specific to UEFI/PI images. - The Package Surface Area describes the content of packages, while the - Module Surface Area provides information relevant to source and/or binary distributions. - - - - - - - This header contains (legal) information usually required - for distributing both binary and/or source code. - - - - - The list of packages in this distribution. - Packages are groups of files and/or modules that are similar - in nature. - Packages are uniquely identified by a package GUID and a - package version. - A package can declare public mappings of C names to GUID - values. - A package can provide header files for library classes - and/or other industry standard definitions. - A package can also declare public mappings of platform - configuration database (PCD) "knobs" to control features and operation of modules - within a platform. - Finally, a package lists the library instances and/or - modules that are provided in a distribution package. - - - - - The listing of UEFI/PI compliant modules in this - distribution that are NOT part of a Package. Every module that is provided as part of a - package needs to be described in a PackageSurfaceArea.Modules section. - The ModuleSurfaceArea section describes how each module in a - distribution is coded, or, in the case of a binary module distribution, how it was built. - UEFI/PI compliant libraries and modules are uniquely - identified by the Module's GUID and version number. - This section will typically be used for modules that don't - require any additional files that would be included in a package. For example, the Enhanced - FAT driver binary does not need to have a package description, as no additional files are - provided. - - - - - This section is for distributing vendor specific executable - tools, tool source code and/or configuration files. These tools are primarily for - manipulating code and/or binary images. - Tools in this section can: - 1) Parse build meta-data files to create source code files - and build scripts. - 2) Modify image files to conform to UEFI/PI specifications. - 3) Generate binary files from certain types of text/unicode - files. - 4) Generate PCI Option Roms or Firmware Device images. - 5) Implement external encoding/decoding/signature/GUIDed - tools. - 6) Distribution Package create/install/remove tools. - - - - - - The list of miscellaneous files in this distribution. Any - files that are not listed in either the Package, Module or Tools sections can be listed - here. This section can be used to distribute specifications for packages and modules that - are not "industry standards" such as a specification for a chipset or a video - device. - - - - - The UserExtensions section is used to disseminate processing - instructions that may be custom to the content provided by the distribution. This section - contains information that is common to all aspects of this disribution. - - - - - - - - - - - This section defines the content of the UEIF/PI compliant Distribution - Package Header. This is the only required element of a UEFI/PI compliant distribution package. - - - - - - - This is the User Interface Name for this Distribution - Package. - Each Distribution Package is uniquely identified by it's - GUID and Version number. - - - - - - - The reference name of the Distribution - Package file. This single word name can be used by tools as a keyword or for - directory and/or file creation. - White space and special characters (dash and - underscore characters may be used) are not permitted in this name. - - - - - - - - - - This 128-bit GUID and the Version attribute uniquely - identify this Distribution Package. - Backward compatible releases of a distribution package need - only change the version number, while non-backward compatible changes require the GUID to - change (resetting the version number to 1.0 is optional.) - - - - - - - This value, along with the GUID, is used to - uniquely identify this object. The higher the number, the more recent the - content. - - - - - - - - - A string identifying who created this distribution package. - - - - - - The date and time this distribution was created. The format - is: YYYY-MM-DDThh:mm:ss, for example: 2001-01-31T13:30:00 (note the T character separator - between the calendar date and the time. - - - - - The copyright for this file that is generated by the creator - of the distribution. If a derivative work is generated from an existing distribution, then - the existing copyright must be maintained, and additional copyrights may be appended to the - end of this element. It may also be the primary copyright for all code provided in the - Distribution Package. - - - - - - - - - - - - - A license that describes any restrictions on the use of this - distribution. If a derivative work is allowed by the original license and a derivative work - is generated from an existing distribution, then the existing license must be maintained, - and additional licenses may be appended to the end of this element. It may also be the - primary license for all code provided in the distribution file. Alternatively, this may - point to a filename that contains the License. The file (included in the content zip file) - will be stored in the same location as the distribution package's .pkg file. - - - - - - - - - - - - - A one line description of the Distribution Package. - - - - - - - - - - - - - A complete description of the Distribution Package. This - description may include the release name of the file, the version of the file, and a - complete description of the file contents and/or features including a description of the - updates since the previous file release. - - - - - - - - - - - - The packaging utilities will use this MD5 sum value of the - included ZIP file containing files and/or code. If this element is not present, then - installation tools should assume that the content is correct, or that other methods may be - needed to verify content. - - - - - This version of this XML Schema is 1.1 - Changes to 1.1 from 1.0 - #1 Updated to present date and new version which is - important to reflect the present state of the matter - #2 Added definition/enumeration of UNDEFIND type 2 is - important since there is a large body of legacy code for which the GUID’s and other - code/data objects were not decorated with their usage. This document will allow for - importing today’s source artifacts and producing decorations using the ‘Undefined’ versus - having an error - #3 Allow for inclusion of ARM and future architecture - types - - - - - - If set to true, all content within this Distribution Package - should NOT be modified. The default permits modification of all content. - - - - - If set to true, then the content can be repackaged into another - distribution package. The default prohibits repackaging the Distribution content. - - - - - - - - - - A package is a collection of related objects - Includes, Libraries and - Modules. - Each package is uniquely identified by it's GUID and Version number. - Backward compatible releases of a package need only change the version number, while non-backward - compatible changes require the GUID to change (resetting the version number to 1.0 is optional.) - - - - - - - - - - - This is the User Interface Name for this - package. - - - - - - - This is a single word BaseName - of the package. This BaseName can be used by tools as a keyword - and for directory/file creation. - - - - - - - - - This GUID and the Version attribute uniquely - identify a given package. - - - - - - - This value, along with the GUID, - is used to uniquely identify this object. - Backward compatible changes must - make sure this number is incremented from the most recent - version. Non-backward compatible changes require a new GUID, and - the version can be reset. - - - - - - - - - If the package requires a different copyright - than the distribution package, this element can list one or more copyright - lines. - - - - - - - - - - - - - If the package requires licenses that are - different from the distribution package license, this element can contain one or - more license text paragraphs (or license filenames.) - - - - - - - - - - - - - A one line description of this package. - - - - - - - - - - - - - A complete description of a package. This - description may include the release name of the package, the version of the - package, and a complete description of the package contents and/or features - including a description of the updates since the previous package’s release. - - - - - - - - - - - - - This element is the location (in the ZIP file) - for the root directory of a package. - - - - - - - - - - The term cloned is used here to indicate that this package - as been copied and modified to a completely different package. An example might be for a new - generation of chipsets that have few or no elements in common with the original. - - - - - - - This GUID and the Version attribute uniquely - identify the Package that this Package was copied from. - - - - - - - This value, along with the GUID, - is used to uniquely identify the package that this package was - cloned from. - - - - - - - - - - - - - - Library Classes are public interfaces that can be used by - modules. One or more library instances can implement a library class, however only one - library instance can be linked to an individual module. This provides the platform - integrator with the flexibility of choosing one library instance's implementation over a - different library instance. - - - - - - - - - The header file provides definitions - and function prototypes for a library class. Modules can be coded - against these functions, using the definitions in this header, - without concerning themselves about the libraries' implementation - details. This is a PackagePath relative path and filename for the - include file. - - - - - - - - This GUID and the - Version attribute uniquely identify the Recommended Library - Instance. - - - - - - - This value, along with - the GUID, is used to uniquely identify this object. If this - value is not specified, then any version of the library - instance is recommended. - - - - - - - - - - - - - - The single word name of the Library - Class that module developers will use to identify a library class - dependency. - - - - - - - - - - - - - This section is used to list header files for industry - standards not under the auspices of UEFI.org. For example, headers that contain definitions - and data structures for the USB specifications. - - - - - - - - - The package relative path and - filename (in the content zip file) of the industry standard include - file. - - - - - - - - - - - - - - All top level header files that are included by a package - that are not listed above. They cannot be: - 1) Local to a module (module specific.) - 2) An industry standard header. - 3) A library class header. - - - - - - - - - This is the Package relative path - and filename location within the content ZIP file. - - - - - - - - - - - - - - - - - - - - - - - - - This section lists the Module Surface Area for - all modules provided with this package. - - - - - - - - - - This section defines the mapping of GUID C names to GUID - values as a Registry Format GUID. - Modules that use these GUIDs must specify their dependency - on this package. - - - - - - Individual GUID Declarations - - - - - - - - - - - - - - - - - - - - This section defines the mapping of Protocol C names to GUID - values as a Registry Format GUID. - Modules that use these Protocols must specify their - dependency on this package. - - - - - - Individual Protocol Declarations - - - - - - - - - - - - - - - - - - - - This section defines the mapping of Ppi C names to GUID - values as a Registry Format GUID. - Modules that use these Ppis must specify their dependency on - this package. - - - - - - Individual PPI Declarations - - - - - - - - - - - - - - - - - - - This section is used to declare platform configuration knobs - that are defined by this package. - Modules that use these PCD values must specify their - dependency on this package. - - - - - - - - - Specifies the C name of the Token - Space GUID of which this PCD Entry is a member. This C name should - also be listed in the GUIDs section, (specified above,) where the C - name is assigned to a GUID value. - - - - - Specifies the 32-bit token value for - this PCD Entry. The Token number must be unique to the Token Space - that declares the PCD. - The minLength of 3 is required to - handle the "0x" prefix to the hex number. - - - - - - - - - - - - A string that contains the data type - of this PCD Entry. PCD data types are restricted to the following - set:UINT8, UINT16, UINT32, UINT64, VOID*, BOOLEAN. - - - - - - A string that contains one or more - PCD Item types separated by spaces. The PCD Item types are - restricted to FeaturePcd, FixedPcd, PatchPcd, Pcd and/or PcdEx. - - - - - - - This is a recommended maximum data - size for VOID* data types, the actual value should be defined by the - Platform Integrator. It is not required for the other data types. - The minLength of 3 is required to - handle the "0x" prefix to the hex number. - - - - - - - - - - - This entry contains prompt - information, that may used by tools to assist platform integrators - with choosing the correct values - - - - - - - - - - - - - - Valid Error messages that may be - implemented in a module for the PCD Entry. Only One Error Number per - PcdError, (multiple ErrorMessage entries are permitted) and multiple - PcdError elements are permitted. - - - - - - One of the following - types of comparisons, which must be able to evaluate to - either true or false. - - - - The PCD Value must be - space separated list of values. Values are restricted to the - data type of this PCD. - - - - - - - - - - - - The PCD must be within a - specifed range of numeric values. Restricted to C style - Relational, Equality and Logicial Operators and parenthesis - are valid. Only the CName for this PCD is permitted in the - ValidValueRange expression. All other values must be - numeric. - LValue (op RValue)+ - - - - - - A in-fix logical - expression using C style logical operators. - - - - - - - A hexadecimal value for - the error message as defined by specifications. - The minLength of 3 is - required to handle the "0x" prefix to the hex number. - - - - - - - - - - - This string should be - defined by specifications. There are pre-defined error - number ranges in the UEFI/PI specificaiton. - - - - - - - - - - - - - - - - - - - - - - - - - This section is used to describe any PCD interdependencies - or relationships. - - - - - - This entry must used - TokenSpaceGuidCName.PcdCname for every named PCD. Restricted to Relational, - Equality and Logical Operators (NOT, AND, OR, GT, GE, EQ, LE, LT and XOR) and - parenthesis are valid. Only the TokenSpaceGuidCName.PcdCname us permitted to - name PCDs in the expression. All other values must be numeric. - LValue (op RValue)+ - - - - - - - - - This section contains files that are not part of the code - distributed with this package. - - - - - - Only required if different from the Package - Copyright. - - - - - Only required if different from the Package - License. - - - - - A one line description of this section's - content. - - - - - A complete description of the files in this - section. - - - - - This is the PackagePath relative path and - filename location within the ZIP file. - - - - - - - If true, used by installation - tools to ensure that a file that must be executable has the - correct properties to permit execution. - - - - - - - - - - - - - - - This section is used for any processing instructions that - may be custom to the content provided by this package that are common to this package. - - - - - - - - - This is a single word identifier for grouping - similar content that does not fit into previously defined sections or other sections - of the Distribution. - - - - - This can be used to differentiate multiple sections - with a grouping. - For example, a PRE_PROCESS Identifier might indicate - specific steps and tools required before processing module content, while a - different UserExtensions section with a POST_PROCESS Identifier might describe steps - that need to be executed after operations on the modules in this package. - - - - - - - - - - - - - - - - Each module is uniquely identified by it's GUID and Version number. - Backward compatible releases of a module need only change the version number, while non-backward - compatible changes require the GUID to change (resetting the version number to 1.0 is optional.) - - - - - - - - - - - This is the User Interface Name for this Module. - - - - - - - - This is a single word BaseName - that will be used to create a module meta-data file. - This name should also be used to - create output file names and directories. - - - - - - - - - This GUID and the Version attribute uniquely - identify a given Module. - - - - - - - This value, along with the GUID, - is used to uniquely identify this object. - Backward compatible changes must - make sure this number is incremented from the most recent - version. Non-backward compatible changes require a new GUID, and - the version can be reset. - - - - - - - - - This is only required if the Copyright is - different from either the Package or Distribution copyright. Multiple copyright - lines are permitted within this section. - - - - - - - - - - - - This is only required if the license is - different from either the Package or Distribution license. Multiple licenses are - permitted within this section. - - - - - - - - - - - - A brief text description of the module. - - - - - - - - - - - - - A complete description of the module contents - and/or features including a description of the updates since the previous module - release. - - - - - - - - - - - - - - - - - List general information about a module, including the - Supported Architectures, this module's type, specifications the module is coded against, and - other informational content. - - - - - - One of the Enumerated module types that limit - the use of a module. - - - - - For stand-alone modules that are NOT part of any - package, this is the path to the root of the module as listed in the ZIP file. - For modules included in a package, this is the location, relative to the root of - the package (PackagePath) this module belongs to. - - - - - This element is only required for the PEIM that - produces the PCD PPI or the DXE Driver that produces the PCD Protocol. - - - - - - - - - - - - - - - - - This is a list of other specifications that this - module is written against. These entries can be used in #define statements - (depending on the build system implementation, they may be autogenerated.) - - - - - - - - - - - - - - Different firmware execution paths may be taken - based on a given state of the hardware, firmware, or through feature settings. A - BootMode may be declared (PRODUCES) or discovered (CONSUMES) based on these - states and feature settings. If the usage is UNDEFINE, it implies that a Boot - Mode is used, but the package creator does not know how it is used. The - supported boot modes map to the PI specification Boot Modes. The boot modes - listed with Recovery are to indicate that the BootMode is valid during a - recovery boot. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The module always supports - the given boot modes. - - - - - The module may support a - given mode on some execution paths. - - - - - The module will change the - boot mode. - - - - - The module will change the - boot mode on some exection paths. - - - - - The package creator does not - know how the boot mode is used. - - - - - - - - - - - - - The functions that make up the Event, Timer, and - Task Priority Services are used during preboot to create, close, signal, and - wait for events; to set timers; and to raise and restore task priority levels as - defined in the UEFI specification. GUIDed events should be listed in the Guids - section. - - - - - - - - - - - The module will register a - notification function and calls the function when it is - signaled. - - - - - The module will register a - notification function and calls the function when it is - signaled on some execution paths. - - - - - The module will signal all - events in an event group. - - - - - The module will signal all - events in an event group under some execution paths. - - - - - - The package creator does not - know how an event is used. - - - - - - - - - - - - - - - - - - - - - - - - This is a list of non-GUIDed Hand Off Blocks - (HOBs) produced or consumed by this module. - - - - - - - - - - - - - - - - - - - - - - - A HOB must be present in the - system. - - - - - If present, the HOB will be - used. - - - - - The HOB is always produced - by the module. - - - - - The HOB may be produced by - the module under some execution paths. - - - - - The package creator knows - that a HOB is used, but does not know how it is used. - - - - - - - - - - - - - - - - - - - - This section may be included for Modules that are copied - from a different module. - - - - - - This GUID and the Version attribute uniquely - identify the Module that this Module was copied from. - - - - - - - This value, along with the GUID, - is used to uniquely identify this object. - - - - - - - - - - - - - - A list of the different Library Classes consumed by a - driver, core and/or application module, or produced by a Library module. - - - - - - - - - Used by tools to identify different - instances of libraries that provide the library class. This keyword - identifies the library class this module needs to be linked against. - - - - - - - - - This GUID and the - Version attribute uniquely identify the recommended Library - Instance for this module . - - - - - - - This value, along with - the GUID, is used to uniquely identify this object. - - - - - - - - - - - - - - - - Library instances can provide code - for a library class, or may require other library instances - themselves. Since different execution paths in a library (or module) - may need different library classes based on some setting, library - classes may not alway be required. - - - - - - - - - - - - - - A FeatureFlag attribute must evaluate to - either true or false - it may be a fixed value of true or false, a C - name or an in-fix expression. - - - - - - - - - - - - - - - This is the module relative - (ModuleProperties.Path) path and filename location within the ZIP file. - - - - - - - - The Family attribute is used to - restrict usage to a given family of compilers, such as GCC or - MSFT. Since not all code processing tools use the same syntax, - especially for assembly, this field can be used to identify - different syntax. - - - - - - - - - - - - - - - - - - - - - - - - This is the module relative - (ModuleProperties.Path) path and filename location within the ZIP - file. - - - - - - - - - Binary file distribution - is limited to UEFI/PI FFS leaf section file types. - - - - - - - - A UEFI/PI FFS Leaf - section file type, not a raw PE32 file. - - - - - - - - - - - - - - - - - - - - - - - - - - - This section contains information - about how the module was coded, such as Compiler Tools, Flags, PCDs - (only PatchPcd and/or PcdEx) and Library Class Instances used to - build the binary. - - - - - - - The element is the - Patchable PCD Value that was used during the build. - - - - - - - - - The minLength of 3 is - required to handle the "0x" prefix to the hex number. - - - - - - - - - - - - - This field is required - if the Pcd Datum Type is VOID* - The minLength of 3 is - required to handle the "0x" prefix to the hex number. - - - - - - - - - - - - The minLength of 3 is - required to handle the "0x" prefix to the hex number. - - - - - - - - - - - - Error information - implemented by the module. - - - - - - - - - - - - - - - - - - - The minLength of 3 is - required to handle the "0x" prefix to the hex number. - - - - - - - - - - - - - - - - - - - - - - - - - - - The element is the - DynamicEx PCD Value that was used during the build. - - - - - - - - The minLength of 3 is - required to handle the "0x" prefix to the hex number. - - - - - - - - - - - - - This field is required - if the Pcd Datum Type is VOID* - - - - - - - - - - - - Error information - implemented by the module. - - - - - - - - - - - - - - - - - - - The minLength of 3 is - required to handle the "0x" prefix to the hex number. - - - - - - - - - - - - - - - - - - - - - - - - - - - This is the actual - library instance that was used to link against the module. - - - - - - - This GUID and the - Version attribute uniquely identify the actual Library - Instance linked in this module. - - - - - - - This value, along with - the GUID, is used to uniquely identify this object. - - - - - - - - - - - - - - - - Any description of OS, - Tool, and flags for the individual tool can go in this - section. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This GUID and the Version attribute - uniquely identify Package that this Module depends on. - - - - - - - - This value, along with - the GUID, is used to uniquely identify this object. If the - version attribute is not specified, the most recent version - of the package can be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Only valid for Variable GUID types. - This can be either a Hex Array or C string in unicode - format: L"string" Data. - - - - - - - - - - The module does not install - the GUID, and the GUID must be present for the module to - execute. - - - - - The module does not install - the GUID, however, the GUID will be used if it is present. - - - - - - The module always installs - the GUID. - - - - - The Module will install the - GUID under certain execution paths. - - - - - The package creator knows - that a GUID is used, but does not know how it is used. - - - - - - - - - - - - - - - - - - - - A listing of protocols required or produced by this module. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A listing of PPIs required or produced by this module. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - These elements specify additional information about the - module. This area may be used by tools to generate code. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This section describes how a platform is coded with respect - to the platform configuration knobs. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This is the PEI dependency expression for a Dependency - Section. - - - - - - An in-fix expression, of C identifiers and TRUE, - FALSE, AND, OR, NOT, BEFORE, and AFTER as well as parenthesis () in the in-fix - notation. The operators are restricted to grammar defined in the PI - specification. - - - - - - - - - - - - - - This is the DXE dependency expression for a Dependency - Section. - - - - - - An in-fix expression, of C identifiers and TRUE, - FALSE, AND, OR, NOT, BEFORE, and AFTER as well as parenthesis () in the in-fix - notation. The operators are restricted to grammar defined in the PI - specification. - - - - - - - - - - - - - - This is the SMM dependency expression for a Dependency - Section. - - - - - - An in-fix expression, of C identifiers and TRUE, - FALSE, AND, OR, NOT, BEFORE, and AFTER as well as parenthesis () in the in-fix - notation. The operators are restricted to grammar defined in the PI - specification. - - - - - - - - - - - - - - - This section is used to provide comments and/or list - auxiliary files, such as pdb or map files. - - - - - - - - - - - - - - - This is the path and filename location within - the ZIP file. - - - - - - - If true, used by installation - tools to ensure that a file that must be executable has the - correct properties to permit execution. - - - - - - - - - - - - - - This section is used for any processing instructions that - may be custom to the content provided by the distribution that are common to module. - The content is vendor specific. - The content can be plain text as well as any user-defined, - properly formatted XML structure. - - - - - This is a single word identifier for grouping - similar content. For example, ReferenceBuild might be used to identify non-PI - compliant build steps, with two different UserExtensions sections, one with an - Identifier of Prebuild, and another of PostBuild. Both UserExtensions sections would - use the same UserId. - - - - - This can be any string used to differentiate or - identify this section from other UserExtensions sections. - For example, a PRE_PROCESS Identifier might indicate - specific steps and tools required before processing module content, while a - different UserExtensions section with a POST_PROCESS Identifier might describe steps - that need to be executed after operations on this module. - - - - - - - - - - - This attribute is used when the binaries are distributed for - this module and no code generation from source files is required. If set, then the BinaryFiles - section should be used, and any files listed in the SourceFiles section do not have to be built. - Additionally, the AsBuilt section for each binary file must be included. - - - - - - - - - - - - - - - - This is the User Interface Name for this Tools - Distribution. - - - - - This is only required if the Copyright is - different from the Distribution Package copyright. - - - - - This is only required if the License is - different from the Distribution Package license. - - - - - This is only required if the Abstract is - different from the Distribution Package Abstract. - - - - - - - - - - - - This is only required if the Description is - different from the Distribution Package Description. - - - - - - - - - - - - - - - - This is the path and filename location within the ZIP file. - - - - - - - - This is required for tools that execute; it - should not be used for configuration files. - - - - - If true, used by installation tools to - ensure that a file that must be executable has the correct properties to - permit execution. - - - - - - - - - - - - - - This section contains a list of files that are not part of the code - distributed with modules, packages or tools. - - - - - - - - - The User interface name for this content. - - - - - - This is only required if the Copyright is - different from the Distribution Package Copyright. - - - - - This is only required if the License is - different from the Distribution Package License. - - - - - - - - - - - - - - - - - - This is the path and filename location within the ZIP file. - - - - - - - - If true, used by installation tools to - ensure that a file that must be executable has the correct properties to - permit execution. - - - - - - - - - - - - - - - - - - - This is a single word identifier for grouping similar content. - For example, ReferenceBuild might be used to identify non-PI compliant build steps, with two - different UserExtensions sections, one with an Identifier of Prebuild, and another of PostBuild. - Both UserExtensions sections would use the same UserId. - - - - - This can be any string used to differentiate or identify this - section from other UserExtensions sections. - For example, a PRE_PROCESS Identifier might indicate specific - steps and tools required before processing distribution package content, while a different - UserExtensions section with a POST_PROCESS Identifier might describe steps that need to be - executed after operations on this content. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Any processor architecture not listed above. The Architecture - must be a target architecture of one or more compiler tool chains. - - - - - - - - - - - - - Any other family of build utilities for which compiler tools - exist. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The following module types are defined by specifications. - Module types for components and libraries defined for this distribution - mechanism. - - - - - Use of this module is not restricted. - - - - - This module is only applicable to the DXE core. - - - - - - This module is only applicable to a DXE driver. - - - - - - This module is only applicable to a DXE runtime driver. - - - - - - This module is only applicable to an IPF DXE runtime driver. - - - - - - This module is only applicable to a DXE SMM driver. - - - - - - This module is only applicable to the PEI core. - - - - - - This module is only valid for PEI modules. - - - - - This module is only applicable to Security phase. - - - - - - This module is only valid for UEFI drivers. - - - - - This module is only valid for UEFI runtime - drivers. - - - - - This module is only valid for UEFI applications. - - - - - - This module is only applicable to the SMM - core. - - - - - This content is restricted to a specific implementation. - - - - - - This enumeration is for use in a list that where the package - creator does not know the what module types are supported by a module. - - - - - This pattern has been added for use in a module lists - for - future expansion. - - - - - - - - The following data types are defined by the PCD specification (or PCD - section of the UEFI/PI specifications.) - - - - - - - - - - - - - - - - - - - - The Feature PCD is a binary, evaluating to either true or false. - This is used during build to include/exclude content. It can also be used during execution to - force execution paths within drivers, or to enable/disable features within a driver for a given - platform. - - - - - The Fixed PCD is a #define value that is set at build time. - - - - - - The Patch PCD is a #define that is set at build time, and that - can be modified within a binary file. Additional information, such as the offset location of the - value, along with it's length may need to be provided. - - - - - This PCD type has an overloaded definition. Prior to build, the - platform integrator may choose to implement a PCD as Fixed, Patchable or a Dynamic PCD. If the - platform integrator choose to use the PCD as dynamic, then a PCD driver is required in the - platform (PEI/DXE/both) to track the PCD in some sort of 'database' of these items. For Dynamic - PCDs, the PcdGet* must pass in the token space guid and the token number to retrieve data - (PcdSet* also needs these values.) - - - - - The PCD can only be used as Dynamic, and the platform firmware - must contain a driver to maintain a 'database' of these items. For Dynamic PCDs, the PcdGet* - must pass in the token space guid and the token number to retrieve data (PcdSet* also needs - these values.) - - - - - - - - A GUID must contain five different Hexadecimal character sets that are - separated by a dash (-) character. - - - - - - - - - The EDK II build system supports workstations running one of the - following supported operating systems. This is the OS for the developer's workstation, not the target - platform. - - - - - For Windows 2003, Windows XP and Windows Vista. - - - - - - For Windows 2003, Windows XP and Windows Vista. - - - - - - - - - - - - - - - Typically, this is used for Windows Batch files. - - - - - - Typically use for shell scripts - valid for any Linux and Mac - OS/X. - - - - - - - + + + + + + This schema defines the UEFI/PI Distribution Package description (PKG) + file. It describes the content of: + 1) Package descriptions with definitions and headers. + 2) Modules in either source or binary format. (Note that Binary format + is for FFS leaf section file types only, complete FFS files cannot be distributed using this + distribution format.) + 3) The distribution of custom tools used to modify the binary images to + create UEFI/PI compliant images. + 4) Finally, it can be used to distribute other miscellaneous content + that is not specific to UEFI/PI images. + The Package Surface Area describes the content of packages, while the + Module Surface Area provides information relevant to source and/or binary distributions. + + + + + + + This header contains (legal) information usually required + for distributing both binary and/or source code. + + + + + The list of packages in this distribution. + Packages are groups of files and/or modules that are similar + in nature. + Packages are uniquely identified by a package GUID and a + package version. + A package can declare public mappings of C names to GUID + values. + A package can provide header files for library classes + and/or other industry standard definitions. + A package can also declare public mappings of platform + configuration database (PCD) "knobs" to control features and operation of modules + within a platform. + Finally, a package lists the library instances and/or + modules that are provided in a distribution package. + + + + + The listing of UEFI/PI compliant modules in this + distribution that are NOT part of a Package. Every module that is provided as part of a + package needs to be described in a PackageSurfaceArea.Modules section. + The ModuleSurfaceArea section describes how each module in a + distribution is coded, or, in the case of a binary module distribution, how it was built. + UEFI/PI compliant libraries and modules are uniquely + identified by the Module's GUID and version number. + This section will typically be used for modules that don't + require any additional files that would be included in a package. For example, the Enhanced + FAT driver binary does not need to have a package description, as no additional files are + provided. + + + + + This section is for distributing vendor specific executable + tools, tool source code and/or configuration files. These tools are primarily for + manipulating code and/or binary images. + Tools in this section can: + 1) Parse build meta-data files to create source code files + and build scripts. + 2) Modify image files to conform to UEFI/PI specifications. + 3) Generate binary files from certain types of text/unicode + files. + 4) Generate PCI Option Roms or Firmware Device images. + 5) Implement external encoding/decoding/signature/GUIDed + tools. + 6) Distribution Package create/install/remove tools. + + + + + + The list of miscellaneous files in this distribution. Any + files that are not listed in either the Package, Module or Tools sections can be listed + here. This section can be used to distribute specifications for packages and modules that + are not "industry standards" such as a specification for a chipset or a video + device. + + + + + The UserExtensions section is used to disseminate processing + instructions that may be custom to the content provided by the distribution. This section + contains information that is common to all aspects of this disribution. + + + + + + + + + + + This section defines the content of the UEIF/PI compliant Distribution + Package Header. This is the only required element of a UEFI/PI compliant distribution package. + + + + + + + This is the User Interface Name for this Distribution + Package. + Each Distribution Package is uniquely identified by it's + GUID and Version number. + + + + + + + The reference name of the Distribution + Package file. This single word name can be used by tools as a keyword or for + directory and/or file creation. + White space and special characters (dash and + underscore characters may be used) are not permitted in this name. + + + + + + + + + + This 128-bit GUID and the Version attribute uniquely + identify this Distribution Package. + Backward compatible releases of a distribution package need + only change the version number, while non-backward compatible changes require the GUID to + change (resetting the version number to 1.0 is optional.) + + + + + + + This value, along with the GUID, is used to + uniquely identify this object. The higher the number, the more recent the + content. + + + + + + + + + A string identifying who created this distribution package. + + + + + + The date and time this distribution was created. The format + is: YYYY-MM-DDThh:mm:ss, for example: 2001-01-31T13:30:00 (note the T character separator + between the calendar date and the time. + + + + + The copyright for this file that is generated by the creator + of the distribution. If a derivative work is generated from an existing distribution, then + the existing copyright must be maintained, and additional copyrights may be appended to the + end of this element. It may also be the primary copyright for all code provided in the + Distribution Package. + + + + + + + + + + + + + A license that describes any restrictions on the use of this + distribution. If a derivative work is allowed by the original license and a derivative work + is generated from an existing distribution, then the existing license must be maintained, + and additional licenses may be appended to the end of this element. It may also be the + primary license for all code provided in the distribution file. Alternatively, this may + point to a filename that contains the License. The file (included in the content zip file) + will be stored in the same location as the distribution package's .pkg file. + + + + + + + + + + + + + A one line description of the Distribution Package. + + + + + + + + + + + + + A complete description of the Distribution Package. This + description may include the release name of the file, the version of the file, and a + complete description of the file contents and/or features including a description of the + updates since the previous file release. + + + + + + + + + + + + The packaging utilities will use this MD5 sum value of the + included ZIP file containing files and/or code. If this element is not present, then + installation tools should assume that the content is correct, or that other methods may be + needed to verify content. + + + + + This version of this XML Schema is 1.1 + Changes to 1.1 from 1.0 + #1 Updated to present date and new version which is + important to reflect the present state of the matter + #2 Added definition/enumeration of UNDEFIND type 2 is + important since there is a large body of legacy code for which the GUID’s and other + code/data objects were not decorated with their usage. This document will allow for + importing today’s source artifacts and producing decorations using the ‘Undefined’ versus + having an error + #3 Allow for inclusion of ARM and future architecture + types + + + + + + If set to true, all content within this Distribution Package + should NOT be modified. The default permits modification of all content. + + + + + If set to true, then the content can be repackaged into another + distribution package. The default prohibits repackaging the Distribution content. + + + + + + + + + + A package is a collection of related objects - Includes, Libraries and + Modules. + Each package is uniquely identified by it's GUID and Version number. + Backward compatible releases of a package need only change the version number, while non-backward + compatible changes require the GUID to change (resetting the version number to 1.0 is optional.) + + + + + + + + + + + This is the User Interface Name for this + package. + + + + + + + This is a single word BaseName + of the package. This BaseName can be used by tools as a keyword + and for directory/file creation. + + + + + + + + + This GUID and the Version attribute uniquely + identify a given package. + + + + + + + This value, along with the GUID, + is used to uniquely identify this object. + Backward compatible changes must + make sure this number is incremented from the most recent + version. Non-backward compatible changes require a new GUID, and + the version can be reset. + + + + + + + + + If the package requires a different copyright + than the distribution package, this element can list one or more copyright + lines. + + + + + + + + + + + + + If the package requires licenses that are + different from the distribution package license, this element can contain one or + more license text paragraphs (or license filenames.) + + + + + + + + + + + + + A one line description of this package. + + + + + + + + + + + + + A complete description of a package. This + description may include the release name of the package, the version of the + package, and a complete description of the package contents and/or features + including a description of the updates since the previous package’s release. + + + + + + + + + + + + + This element is the location (in the ZIP file) + for the root directory of a package. + + + + + + + + + + The term cloned is used here to indicate that this package + as been copied and modified to a completely different package. An example might be for a new + generation of chipsets that have few or no elements in common with the original. + + + + + + + This GUID and the Version attribute uniquely + identify the Package that this Package was copied from. + + + + + + + This value, along with the GUID, + is used to uniquely identify the package that this package was + cloned from. + + + + + + + + + + + + + + Library Classes are public interfaces that can be used by + modules. One or more library instances can implement a library class, however only one + library instance can be linked to an individual module. This provides the platform + integrator with the flexibility of choosing one library instance's implementation over a + different library instance. + + + + + + + + + The header file provides definitions + and function prototypes for a library class. Modules can be coded + against these functions, using the definitions in this header, + without concerning themselves about the libraries' implementation + details. This is a PackagePath relative path and filename for the + include file. + + + + + + + + This GUID and the + Version attribute uniquely identify the Recommended Library + Instance. + + + + + + + This value, along with + the GUID, is used to uniquely identify this object. If this + value is not specified, then any version of the library + instance is recommended. + + + + + + + + + + + + + + The single word name of the Library + Class that module developers will use to identify a library class + dependency. + + + + + + + + + + + + + This section is used to list header files for industry + standards not under the auspices of UEFI.org. For example, headers that contain definitions + and data structures for the USB specifications. + + + + + + + + + The package relative path and + filename (in the content zip file) of the industry standard include + file. + + + + + + + + + + + + + + All top level header files that are included by a package + that are not listed above. They cannot be: + 1) Local to a module (module specific.) + 2) An industry standard header. + 3) A library class header. + + + + + + + + + This is the Package relative path + and filename location within the content ZIP file. + + + + + + + + + + + + + + + + + + + + + + + + + This section lists the Module Surface Area for + all modules provided with this package. + + + + + + + + + + This section defines the mapping of GUID C names to GUID + values as a Registry Format GUID. + Modules that use these GUIDs must specify their dependency + on this package. + + + + + + Individual GUID Declarations + + + + + + + + + + + + + + + + + + + + This section defines the mapping of Protocol C names to GUID + values as a Registry Format GUID. + Modules that use these Protocols must specify their + dependency on this package. + + + + + + Individual Protocol Declarations + + + + + + + + + + + + + + + + + + + + This section defines the mapping of Ppi C names to GUID + values as a Registry Format GUID. + Modules that use these Ppis must specify their dependency on + this package. + + + + + + Individual PPI Declarations + + + + + + + + + + + + + + + + + + + This section is used to declare platform configuration knobs + that are defined by this package. + Modules that use these PCD values must specify their + dependency on this package. + + + + + + + + + Specifies the C name of the Token + Space GUID of which this PCD Entry is a member. This C name should + also be listed in the GUIDs section, (specified above,) where the C + name is assigned to a GUID value. + + + + + Specifies the 32-bit token value for + this PCD Entry. The Token number must be unique to the Token Space + that declares the PCD. + The minLength of 3 is required to + handle the "0x" prefix to the hex number. + + + + + + + + + + + + A string that contains the data type + of this PCD Entry. PCD data types are restricted to the following + set:UINT8, UINT16, UINT32, UINT64, VOID*, BOOLEAN. + + + + + + A string that contains one or more + PCD Item types separated by spaces. The PCD Item types are + restricted to FeaturePcd, FixedPcd, PatchPcd, Pcd and/or PcdEx. + + + + + + + This is a recommended maximum data + size for VOID* data types, the actual value should be defined by the + Platform Integrator. It is not required for the other data types. + The minLength of 3 is required to + handle the "0x" prefix to the hex number. + + + + + + + + + + + This entry contains prompt + information, that may used by tools to assist platform integrators + with choosing the correct values + + + + + + + + + + + + + + Valid Error messages that may be + implemented in a module for the PCD Entry. Only One Error Number per + PcdError, (multiple ErrorMessage entries are permitted) and multiple + PcdError elements are permitted. + + + + + + One of the following + types of comparisons, which must be able to evaluate to + either true or false. + + + + The PCD Value must be + space separated list of values. Values are restricted to the + data type of this PCD. + + + + + + + + + + + + The PCD must be within a + specifed range of numeric values. Restricted to C style + Relational, Equality and Logicial Operators and parenthesis + are valid. Only the CName for this PCD is permitted in the + ValidValueRange expression. All other values must be + numeric. + LValue (op RValue)+ + + + + + + A in-fix logical + expression using C style logical operators. + + + + + + + A hexadecimal value for + the error message as defined by specifications. + The minLength of 3 is + required to handle the "0x" prefix to the hex number. + + + + + + + + + + + This string should be + defined by specifications. There are pre-defined error + number ranges in the UEFI/PI specificaiton. + + + + + + + + + + + + + + + + + + + + + + + + + This section is used to describe any PCD interdependencies + or relationships. + + + + + + This entry must used + TokenSpaceGuidCName.PcdCname for every named PCD. Restricted to Relational, + Equality and Logical Operators (NOT, AND, OR, GT, GE, EQ, LE, LT and XOR) and + parenthesis are valid. Only the TokenSpaceGuidCName.PcdCname us permitted to + name PCDs in the expression. All other values must be numeric. + LValue (op RValue)+ + + + + + + + + + This section contains files that are not part of the code + distributed with this package. + + + + + + Only required if different from the Package + Copyright. + + + + + Only required if different from the Package + License. + + + + + A one line description of this section's + content. + + + + + A complete description of the files in this + section. + + + + + This is the PackagePath relative path and + filename location within the ZIP file. + + + + + + + If true, used by installation + tools to ensure that a file that must be executable has the + correct properties to permit execution. + + + + + + + + + + + + + + + This section is used for any processing instructions that + may be custom to the content provided by this package that are common to this package. + + + + + + + + + This is a single word identifier for grouping + similar content that does not fit into previously defined sections or other sections + of the Distribution. + + + + + This can be used to differentiate multiple sections + with a grouping. + For example, a PRE_PROCESS Identifier might indicate + specific steps and tools required before processing module content, while a + different UserExtensions section with a POST_PROCESS Identifier might describe steps + that need to be executed after operations on the modules in this package. + + + + + + + + + + + + + + + + Each module is uniquely identified by it's GUID and Version number. + Backward compatible releases of a module need only change the version number, while non-backward + compatible changes require the GUID to change (resetting the version number to 1.0 is optional.) + + + + + + + + + + + This is the User Interface Name for this Module. + + + + + + + + This is a single word BaseName + that will be used to create a module meta-data file. + This name should also be used to + create output file names and directories. + + + + + + + + + This GUID and the Version attribute uniquely + identify a given Module. + + + + + + + This value, along with the GUID, + is used to uniquely identify this object. + Backward compatible changes must + make sure this number is incremented from the most recent + version. Non-backward compatible changes require a new GUID, and + the version can be reset. + + + + + + + + + This is only required if the Copyright is + different from either the Package or Distribution copyright. Multiple copyright + lines are permitted within this section. + + + + + + + + + + + + This is only required if the license is + different from either the Package or Distribution license. Multiple licenses are + permitted within this section. + + + + + + + + + + + + A brief text description of the module. + + + + + + + + + + + + + A complete description of the module contents + and/or features including a description of the updates since the previous module + release. + + + + + + + + + + + + + + + + + List general information about a module, including the + Supported Architectures, this module's type, specifications the module is coded against, and + other informational content. + + + + + + One of the Enumerated module types that limit + the use of a module. + + + + + For stand-alone modules that are NOT part of any + package, this is the path to the root of the module as listed in the ZIP file. + For modules included in a package, this is the location, relative to the root of + the package (PackagePath) this module belongs to. + + + + + This element is only required for the PEIM that + produces the PCD PPI or the DXE Driver that produces the PCD Protocol. + + + + + + + + + + + + + + + + + This is a list of other specifications that this + module is written against. These entries can be used in #define statements + (depending on the build system implementation, they may be autogenerated.) + + + + + + + + + + + + + + Different firmware execution paths may be taken + based on a given state of the hardware, firmware, or through feature settings. A + BootMode may be declared (PRODUCES) or discovered (CONSUMES) based on these + states and feature settings. If the usage is UNDEFINE, it implies that a Boot + Mode is used, but the package creator does not know how it is used. The + supported boot modes map to the PI specification Boot Modes. The boot modes + listed with Recovery are to indicate that the BootMode is valid during a + recovery boot. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The module always supports + the given boot modes. + + + + + The module may support a + given mode on some execution paths. + + + + + The module will change the + boot mode. + + + + + The module will change the + boot mode on some exection paths. + + + + + The package creator does not + know how the boot mode is used. + + + + + + + + + + + + + The functions that make up the Event, Timer, and + Task Priority Services are used during preboot to create, close, signal, and + wait for events; to set timers; and to raise and restore task priority levels as + defined in the UEFI specification. GUIDed events should be listed in the Guids + section. + + + + + + + + + + + The module will register a + notification function and calls the function when it is + signaled. + + + + + The module will register a + notification function and calls the function when it is + signaled on some execution paths. + + + + + The module will signal all + events in an event group. + + + + + The module will signal all + events in an event group under some execution paths. + + + + + + The package creator does not + know how an event is used. + + + + + + + + + + + + + + + + + + + + + + + + This is a list of non-GUIDed Hand Off Blocks + (HOBs) produced or consumed by this module. + + + + + + + + + + + + + + + + + + + + + + + A HOB must be present in the + system. + + + + + If present, the HOB will be + used. + + + + + The HOB is always produced + by the module. + + + + + The HOB may be produced by + the module under some execution paths. + + + + + The package creator knows + that a HOB is used, but does not know how it is used. + + + + + + + + + + + + + + + + + + + + This section may be included for Modules that are copied + from a different module. + + + + + + This GUID and the Version attribute uniquely + identify the Module that this Module was copied from. + + + + + + + This value, along with the GUID, + is used to uniquely identify this object. + + + + + + + + + + + + + + A list of the different Library Classes consumed by a + driver, core and/or application module, or produced by a Library module. + + + + + + + + + Used by tools to identify different + instances of libraries that provide the library class. This keyword + identifies the library class this module needs to be linked against. + + + + + + + + + This GUID and the + Version attribute uniquely identify the recommended Library + Instance for this module . + + + + + + + This value, along with + the GUID, is used to uniquely identify this object. + + + + + + + + + + + + + + + + Library instances can provide code + for a library class, or may require other library instances + themselves. Since different execution paths in a library (or module) + may need different library classes based on some setting, library + classes may not alway be required. + + + + + + + + + + + + + + A FeatureFlag attribute must evaluate to + either true or false - it may be a fixed value of true or false, a C + name or an in-fix expression. + + + + + + + + + + + + + + + This is the module relative + (ModuleProperties.Path) path and filename location within the ZIP file. + + + + + + + + The Family attribute is used to + restrict usage to a given family of compilers, such as GCC or + MSFT. Since not all code processing tools use the same syntax, + especially for assembly, this field can be used to identify + different syntax. + + + + + + + + + + + + + + + + + + + + + + + + This is the module relative + (ModuleProperties.Path) path and filename location within the ZIP + file. + + + + + + + + + Binary file distribution + is limited to UEFI/PI FFS leaf section file types. + + + + + + + + A UEFI/PI FFS Leaf + section file type, not a raw PE32 file. + + + + + + + + + + + + + + + + + + + + + + + + + + + This section contains information + about how the module was coded, such as Compiler Tools, Flags, PCDs + (only PatchPcd and/or PcdEx) and Library Class Instances used to + build the binary. + + + + + + + The element is the + Patchable PCD Value that was used during the build. + + + + + + + + + The minLength of 3 is + required to handle the "0x" prefix to the hex number. + + + + + + + + + + + + + This field is required + if the Pcd Datum Type is VOID* + The minLength of 3 is + required to handle the "0x" prefix to the hex number. + + + + + + + + + + + + The minLength of 3 is + required to handle the "0x" prefix to the hex number. + + + + + + + + + + + + Error information + implemented by the module. + + + + + + + + + + + + + + + + + + + The minLength of 3 is + required to handle the "0x" prefix to the hex number. + + + + + + + + + + + + + + + + + + + + + + + + + + + The element is the + DynamicEx PCD Value that was used during the build. + + + + + + + + The minLength of 3 is + required to handle the "0x" prefix to the hex number. + + + + + + + + + + + + + This field is required + if the Pcd Datum Type is VOID* + + + + + + + + + + + + Error information + implemented by the module. + + + + + + + + + + + + + + + + + + + The minLength of 3 is + required to handle the "0x" prefix to the hex number. + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the actual + library instance that was used to link against the module. + + + + + + + This GUID and the + Version attribute uniquely identify the actual Library + Instance linked in this module. + + + + + + + This value, along with + the GUID, is used to uniquely identify this object. + + + + + + + + + + + + + + + + Any description of OS, + Tool, and flags for the individual tool can go in this + section. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This GUID and the Version attribute + uniquely identify Package that this Module depends on. + + + + + + + + This value, along with + the GUID, is used to uniquely identify this object. If the + version attribute is not specified, the most recent version + of the package can be used. + + + + + + + + + + + + + + + + + + + + + + + + + + + + Only valid for Variable GUID types. + This can be either a Hex Array or C string in unicode + format: L"string" Data. + + + + + + + + + + The module does not install + the GUID, and the GUID must be present for the module to + execute. + + + + + The module does not install + the GUID, however, the GUID will be used if it is present. + + + + + + The module always installs + the GUID. + + + + + The Module will install the + GUID under certain execution paths. + + + + + The package creator knows + that a GUID is used, but does not know how it is used. + + + + + + + + + + + + + + + + + + + + A listing of protocols required or produced by this module. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A listing of PPIs required or produced by this module. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + These elements specify additional information about the + module. This area may be used by tools to generate code. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This section describes how a platform is coded with respect + to the platform configuration knobs. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the PEI dependency expression for a Dependency + Section. + + + + + + An in-fix expression, of C identifiers and TRUE, + FALSE, AND, OR, NOT, BEFORE, and AFTER as well as parenthesis () in the in-fix + notation. The operators are restricted to grammar defined in the PI + specification. + + + + + + + + + + + + + + This is the DXE dependency expression for a Dependency + Section. + + + + + + An in-fix expression, of C identifiers and TRUE, + FALSE, AND, OR, NOT, BEFORE, and AFTER as well as parenthesis () in the in-fix + notation. The operators are restricted to grammar defined in the PI + specification. + + + + + + + + + + + + + + This is the SMM dependency expression for a Dependency + Section. + + + + + + An in-fix expression, of C identifiers and TRUE, + FALSE, AND, OR, NOT, BEFORE, and AFTER as well as parenthesis () in the in-fix + notation. The operators are restricted to grammar defined in the PI + specification. + + + + + + + + + + + + + + + This section is used to provide comments and/or list + auxiliary files, such as pdb or map files. + + + + + + + + + + + + + + + This is the path and filename location within + the ZIP file. + + + + + + + If true, used by installation + tools to ensure that a file that must be executable has the + correct properties to permit execution. + + + + + + + + + + + + + + This section is used for any processing instructions that + may be custom to the content provided by the distribution that are common to module. + The content is vendor specific. + The content can be plain text as well as any user-defined, + properly formatted XML structure. + + + + + This is a single word identifier for grouping + similar content. For example, ReferenceBuild might be used to identify non-PI + compliant build steps, with two different UserExtensions sections, one with an + Identifier of Prebuild, and another of PostBuild. Both UserExtensions sections would + use the same UserId. + + + + + This can be any string used to differentiate or + identify this section from other UserExtensions sections. + For example, a PRE_PROCESS Identifier might indicate + specific steps and tools required before processing module content, while a + different UserExtensions section with a POST_PROCESS Identifier might describe steps + that need to be executed after operations on this module. + + + + + + + + + + + This attribute is used when the binaries are distributed for + this module and no code generation from source files is required. If set, then the BinaryFiles + section should be used, and any files listed in the SourceFiles section do not have to be built. + Additionally, the AsBuilt section for each binary file must be included. + + + + + + + + + + + + + + + + This is the User Interface Name for this Tools + Distribution. + + + + + This is only required if the Copyright is + different from the Distribution Package copyright. + + + + + This is only required if the License is + different from the Distribution Package license. + + + + + This is only required if the Abstract is + different from the Distribution Package Abstract. + + + + + + + + + + + + This is only required if the Description is + different from the Distribution Package Description. + + + + + + + + + + + + + + + + This is the path and filename location within the ZIP file. + + + + + + + + This is required for tools that execute; it + should not be used for configuration files. + + + + + If true, used by installation tools to + ensure that a file that must be executable has the correct properties to + permit execution. + + + + + + + + + + + + + + This section contains a list of files that are not part of the code + distributed with modules, packages or tools. + + + + + + + + + The User interface name for this content. + + + + + + This is only required if the Copyright is + different from the Distribution Package Copyright. + + + + + This is only required if the License is + different from the Distribution Package License. + + + + + + + + + + + + + + + + + + This is the path and filename location within the ZIP file. + + + + + + + + If true, used by installation tools to + ensure that a file that must be executable has the correct properties to + permit execution. + + + + + + + + + + + + + + + + + + + This is a single word identifier for grouping similar content. + For example, ReferenceBuild might be used to identify non-PI compliant build steps, with two + different UserExtensions sections, one with an Identifier of Prebuild, and another of PostBuild. + Both UserExtensions sections would use the same UserId. + + + + + This can be any string used to differentiate or identify this + section from other UserExtensions sections. + For example, a PRE_PROCESS Identifier might indicate specific + steps and tools required before processing distribution package content, while a different + UserExtensions section with a POST_PROCESS Identifier might describe steps that need to be + executed after operations on this content. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Any processor architecture not listed above. The Architecture + must be a target architecture of one or more compiler tool chains. + + + + + + + + + + + + + Any other family of build utilities for which compiler tools + exist. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The following module types are defined by specifications. + Module types for components and libraries defined for this distribution + mechanism. + + + + + Use of this module is not restricted. + + + + + This module is only applicable to the DXE core. + + + + + + This module is only applicable to a DXE driver. + + + + + + This module is only applicable to a DXE runtime driver. + + + + + + This module is only applicable to an IPF DXE runtime driver. + + + + + + This module is only applicable to a DXE SMM driver. + + + + + + This module is only applicable to the PEI core. + + + + + + This module is only valid for PEI modules. + + + + + This module is only applicable to Security phase. + + + + + + This module is only valid for UEFI drivers. + + + + + This module is only valid for UEFI runtime + drivers. + + + + + This module is only valid for UEFI applications. + + + + + + This module is only applicable to the SMM + core. + + + + + This content is restricted to a specific implementation. + + + + + + This enumeration is for use in a list that where the package + creator does not know the what module types are supported by a module. + + + + + This pattern has been added for use in a module lists - for + future expansion. + + + + + + + + The following data types are defined by the PCD specification (or PCD + section of the UEFI/PI specifications.) + + + + + + + + + + + + + + + + + + + + The Feature PCD is a binary, evaluating to either true or false. + This is used during build to include/exclude content. It can also be used during execution to + force execution paths within drivers, or to enable/disable features within a driver for a given + platform. + + + + + The Fixed PCD is a #define value that is set at build time. + + + + + + The Patch PCD is a #define that is set at build time, and that + can be modified within a binary file. Additional information, such as the offset location of the + value, along with it's length may need to be provided. + + + + + This PCD type has an overloaded definition. Prior to build, the + platform integrator may choose to implement a PCD as Fixed, Patchable or a Dynamic PCD. If the + platform integrator choose to use the PCD as dynamic, then a PCD driver is required in the + platform (PEI/DXE/both) to track the PCD in some sort of 'database' of these items. For Dynamic + PCDs, the PcdGet* must pass in the token space guid and the token number to retrieve data + (PcdSet* also needs these values.) + + + + + The PCD can only be used as Dynamic, and the platform firmware + must contain a driver to maintain a 'database' of these items. For Dynamic PCDs, the PcdGet* + must pass in the token space guid and the token number to retrieve data (PcdSet* also needs + these values.) + + + + + + + + A GUID must contain five different Hexadecimal character sets that are + separated by a dash (-) character. + + + + + + + + + The EDK II build system supports workstations running one of the + following supported operating systems. This is the OS for the developer's workstation, not the target + platform. + + + + + For Windows 2003, Windows XP and Windows Vista. + + + + + + For Windows 2003, Windows XP and Windows Vista. + + + + + + + + + + + + + + + Typically, this is used for Windows Batch files. + + + + + + Typically use for shell scripts - valid for any Linux and Mac + OS/X. + + + + + + + diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index ec4eb97527..a68218deac 100644 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -192,11 +192,6 @@ DEFINE IPHONE_TOOLS = /Developer/Platforms/iPhoneOS.platform/Develope DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G++ Lite/bin -# -# Change to the location clang was built -# -DEFINE CLANG_BIN = /usr/bin/ - #################################################################################### # # format: TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE = @@ -3136,11 +3131,11 @@ DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing - DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency -DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address +DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mcmodel=large -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections -DEFINE GCC_ARM_AARCH64_DLINK_COMMON= -Ttext=0x0 --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map +DEFINE GCC_ARM_AARCH64_DLINK_COMMON= -Ttext=0x0 --emit-relocs -nostdlib --gc-sections -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEFINE GCC_ARM_AARCH64_ASLDLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) --entry ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map @@ -3184,7 +3179,7 @@ DEFINE GCC46_IA32_X64_DLINK_FLAGS = DEF(GCC45_IA32_X64_DLINK_FLAGS) DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS) DEFINE GCC46_ASM_FLAGS = DEF(GCC45_ASM_FLAGS) DEFINE GCC46_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian -DEFINE GCC46_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums -save-temps -fsigned-char -mno-unaligned-access -Wno-address -fomit-frame-pointer +DEFINE GCC46_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_ARM_CC_FLAGS) -mno-unaligned-access DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) --oformat=elf32-littlearm DEFINE GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS) --oformat=elf32-littlearm @@ -3198,7 +3193,7 @@ DEFINE GCC47_ASM_FLAGS = DEF(GCC46_ASM_FLAGS) DEFINE GCC47_ARM_ASM_FLAGS = DEF(GCC46_ARM_ASM_FLAGS) DEFINE GCC47_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian DEFINE GCC47_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mcmodel=large -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address +DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS) DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) DEFINE GCC47_ARM_ASLDLINK_FLAGS = DEF(GCC46_ARM_ASLDLINK_FLAGS) @@ -3516,7 +3511,7 @@ DEFINE GCC48_AARCH64_ASLDLINK_FLAGS = DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS) *_GCC46_ARM_ASLPP_PATH = ENV(GCC46_ARM_PREFIX)gcc *_GCC46_ARM_RC_PATH = ENV(GCC46_ARM_PREFIX)objcopy -*_GCC46_ARM_ARCHCC_FLAGS = -mthumb +*_GCC46_ARM_ARCHCC_FLAGS = *_GCC46_ARM_PLATFORM_FLAGS = -march=armv7-a *_GCC46_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) @@ -3610,7 +3605,7 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-v *_GCC47_ARM_ASLPP_PATH = ENV(GCC47_ARM_PREFIX)gcc *_GCC47_ARM_RC_PATH = ENV(GCC47_ARM_PREFIX)objcopy -*_GCC47_ARM_ARCHCC_FLAGS = -mthumb +*_GCC47_ARM_ARCHCC_FLAGS = *_GCC47_ARM_PLATFORM_FLAGS = -march=armv7-a *_GCC47_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) @@ -5484,15 +5479,15 @@ RELEASE_XCODE32_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mthumb-inter RELEASE_XCLANG_*_MTOC_FLAGS = -align 0x20 -*_XCLANG_*_CC_PATH = DEF(CLANG_BIN)clang +*_XCLANG_*_CC_PATH = ENV(CLANG_BIN)clang *_XCLANG_*_SLINK_PATH = libtool *_XCLANG_*_DLINK_PATH = ld *_XCLANG_*_ASM_PATH = as -*_XCLANG_*_PP_PATH = DEF(CLANG_BIN)clang -*_XCLANG_*_VFRPP_PATH = DEF(CLANG_BIN)clang +*_XCLANG_*_PP_PATH = ENV(CLANG_BIN)clang +*_XCLANG_*_VFRPP_PATH = ENV(CLANG_BIN)clang *_XCLANG_*_ASL_PATH = iasl -*_XCLANG_*_ASLCC_PATH = DEF(CLANG_BIN)clang -*_XCLANG_*_ASLPP_PATH = DEF(CLANG_BIN)clang +*_XCLANG_*_ASLCC_PATH = ENV(CLANG_BIN)clang +*_XCLANG_*_ASLPP_PATH = ENV(CLANG_BIN)clang *_XCLANG_*_ASLDLINK_PATH = ld #################### @@ -5550,7 +5545,7 @@ DEFINE RVCT_ALL_DLINK_FLAGS = --ro-base 0 --no_scanlib --reloc --no_exceptions # # Use default values, or override in DSC file # -*_RVCT_ARM_ARCHCC_FLAGS = --thumb +*_RVCT_ARM_ARCHCC_FLAGS = --thumb --fpu=softvfp *_RVCT_ARM_ARCHASM_FLAGS = *_RVCT_ARM_ARCHDLINK_FLAGS = *_RVCT_ARM_PLATFORM_FLAGS = --cpu 7-A @@ -5592,7 +5587,7 @@ RELEASE_RVCT_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --diag_suppress=5 # # Use default values, or override in DSC file # -*_RVCTLINUX_ARM_ARCHCC_FLAGS = --thumb +*_RVCTLINUX_ARM_ARCHCC_FLAGS = --thumb --fpu=softvfp *_RVCTLINUX_ARM_ARCHASM_FLAGS = *_RVCTLINUX_ARM_ARCHDLINK_FLAGS = *_RVCTLINUX_ARM_PLATFORM_FLAGS = --cpu 7-A @@ -5639,7 +5634,7 @@ RELEASE_RVCTLINUX_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --diag_suppr # # Use default values, or override in DSC file # -*_RVCTCYGWIN_ARM_ARCHCC_FLAGS = --thumb +*_RVCTCYGWIN_ARM_ARCHCC_FLAGS = --thumb --fpu=softvfp *_RVCTCYGWIN_ARM_ARCHASM_FLAGS = *_RVCTCYGWIN_ARM_ARCHDLINK_FLAGS = *_RVCTCYGWIN_ARM_PLATFORM_FLAGS = --cpu 7-A @@ -5707,7 +5702,7 @@ RELEASE_RVCTCYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_F # # Use default values, or override in DSC file # -*_ARMGCC_ARM_ARCHCC_FLAGS = -mthumb +*_ARMGCC_ARM_ARCHCC_FLAGS = *_ARMGCC_ARM_ARCHASM_FLAGS = *_ARMGCC_ARM_ARCHDLINK_FLAGS = *_ARMGCC_ARM_PLATFORM_FLAGS = -march=armv7-a @@ -5719,7 +5714,7 @@ RELEASE_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -mlittle-end *_ARMGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h *_ARMGCC_ARM_SLINK_FLAGS = -rc -*_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -Ttext=0x0 --oformat=elf32-littlearm --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map +*_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(GCC_ARM_AARCH64_DLINK_COMMON) --oformat=elf32-littlearm DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -O0 RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -Wno-unused @@ -5755,7 +5750,7 @@ RELEASE_ARMGCC_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) *_ARMGCC_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h *_ARMGCC_AARCH64_SLINK_FLAGS = -rc -*_ARMGCC_AARCH64_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -Ttext=0x0 --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map +*_ARMGCC_AARCH64_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(GCC_ARM_AARCH64_DLINK_COMMON) DEBUG_ARMGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -O0 RELEASE_ARMGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable @@ -5801,7 +5796,7 @@ RELEASE_ARMGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARC # # Use default values, or override in DSC file # -*_ARMLINUXGCC_ARM_ARCHCC_FLAGS = -mthumb +*_ARMLINUXGCC_ARM_ARCHCC_FLAGS = *_ARMLINUXGCC_ARM_ARCHASM_FLAGS = *_ARMLINUXGCC_ARM_ARCHDLINK_FLAGS = *_ARMLINUXGCC_ARM_PLATFORM_FLAGS = -march=armv7-a @@ -5813,7 +5808,7 @@ RELEASE_ARMLINUXGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -mlittl *_ARMLINUXGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h *_ARMLINUXGCC_ARM_SLINK_FLAGS = -rc -*_ARMLINUXGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -Ttext=0x0 --oformat=elf32-littlearm --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map +*_ARMLINUXGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(GCC_ARM_AARCH64_DLINK_COMMON) --oformat=elf32-littlearm DEBUG_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fno-stack-protector -mno-unaligned-access -O0 RELEASE_ARMLINUXGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fno-stack-protector -mno-unaligned-access -Wno-unused-but-set-variable @@ -5849,7 +5844,7 @@ RELEASE_ARMLINUXGCC_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) *_ARMLINUXGCC_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h *_ARMLINUXGCC_AARCH64_SLINK_FLAGS = -rc -*_ARMLINUXGCC_AARCH64_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -Ttext=0x0 --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map +*_ARMLINUXGCC_AARCH64_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(GCC_ARM_AARCH64_DLINK_COMMON) DEBUG_ARMLINUXGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -O0 RELEASE_ARMLINUXGCC_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable diff --git a/BaseTools/Source/C/GNUmakefile b/BaseTools/Source/C/GNUmakefile index ae07509496..124517b6c1 100644 --- a/BaseTools/Source/C/GNUmakefile +++ b/BaseTools/Source/C/GNUmakefile @@ -1,87 +1,87 @@ -## @file -# GNU/Linux makefile for C tools build. -# -# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -ifndef ARCH - # - # If ARCH is not defined, then we use 'uname -m' to attempt - # try to figure out the appropriate ARCH. - # - uname_m = $(shell uname -m) - $(info Attempting to detect ARCH from 'uname -m': $(uname_m)) - ifeq ($(uname_m),x86_64) - ARCH=X64 - endif - ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32) - ARCH=IA32 - endif - ifndef ARCH - $(info Could not detected ARCH from uname results) - $(error ARCH is not defined!) - endif - $(info Detected ARCH of $(ARCH) using uname.) -endif - -export ARCH - -MAKEROOT = . - -include Makefiles/header.makefile - -all: makerootdir subdirs $(MAKEROOT)/libs - @echo Finished building BaseTools C Tools with ARCH=$(ARCH) - -LIBRARIES = Common -# NON_BUILDABLE_APPLICATIONS = GenBootSector BootSectImage -APPLICATIONS = \ - GnuGenBootSector \ - BootSectImage \ - EfiLdrImage \ - EfiRom \ - GenFfs \ - GenFv \ - GenFw \ - GenPage \ - GenSec \ - GenCrc32 \ - GenVtf \ - LzmaCompress \ - Split \ - TianoCompress \ - VolInfo \ - VfrCompile - -SUBDIRS := $(LIBRARIES) $(APPLICATIONS) - -.PHONY: outputdirs -makerootdir: - -mkdir -p $(MAKEROOT) - -.PHONY: subdirs $(SUBDIRS) -subdirs: $(SUBDIRS) -$(SUBDIRS): - $(MAKE) -C $@ - -.PHONY: $(patsubst %,%-clean,$(sort $(SUBDIRS))) -$(patsubst %,%-clean,$(sort $(SUBDIRS))): - -$(MAKE) -C $(@:-clean=) clean - -clean: $(patsubst %,%-clean,$(sort $(SUBDIRS))) - -clean: localClean - -localClean: - rm -f $(MAKEROOT)/bin/* - -rmdir $(MAKEROOT)/libs $(MAKEROOT)/bin - -include Makefiles/footer.makefile +## @file +# GNU/Linux makefile for C tools build. +# +# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +ifndef ARCH + # + # If ARCH is not defined, then we use 'uname -m' to attempt + # try to figure out the appropriate ARCH. + # + uname_m = $(shell uname -m) + $(info Attempting to detect ARCH from 'uname -m': $(uname_m)) + ifeq ($(uname_m),x86_64) + ARCH=X64 + endif + ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32) + ARCH=IA32 + endif + ifndef ARCH + $(info Could not detected ARCH from uname results) + $(error ARCH is not defined!) + endif + $(info Detected ARCH of $(ARCH) using uname.) +endif + +export ARCH + +MAKEROOT = . + +include Makefiles/header.makefile + +all: makerootdir subdirs $(MAKEROOT)/libs + @echo Finished building BaseTools C Tools with ARCH=$(ARCH) + +LIBRARIES = Common +# NON_BUILDABLE_APPLICATIONS = GenBootSector BootSectImage +APPLICATIONS = \ + GnuGenBootSector \ + BootSectImage \ + EfiLdrImage \ + EfiRom \ + GenFfs \ + GenFv \ + GenFw \ + GenPage \ + GenSec \ + GenCrc32 \ + GenVtf \ + LzmaCompress \ + Split \ + TianoCompress \ + VolInfo \ + VfrCompile + +SUBDIRS := $(LIBRARIES) $(APPLICATIONS) + +.PHONY: outputdirs +makerootdir: + -mkdir -p $(MAKEROOT) + +.PHONY: subdirs $(SUBDIRS) +subdirs: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: $(patsubst %,%-clean,$(sort $(SUBDIRS))) +$(patsubst %,%-clean,$(sort $(SUBDIRS))): + -$(MAKE) -C $(@:-clean=) clean + +clean: $(patsubst %,%-clean,$(sort $(SUBDIRS))) + +clean: localClean + +localClean: + rm -f $(MAKEROOT)/bin/* + -rmdir $(MAKEROOT)/libs $(MAKEROOT)/bin + +include Makefiles/footer.makefile diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c index 58ac333888..97c9380c8d 100644 --- a/BaseTools/Source/C/GenFw/Elf32Convert.c +++ b/BaseTools/Source/C/GenFw/Elf32Convert.c @@ -1,1047 +1,1047 @@ -/** @file - -Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
-Portions copyright (c) 2013, ARM Ltd. All rights reserved.
- -This program and the accompanying materials are licensed and made available -under the terms and conditions of the BSD License which accompanies this -distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "WinNtInclude.h" - -#ifndef __GNUC__ -#include -#include -#endif -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "PeCoffLib.h" -#include "EfiUtilityMsgs.h" - -#include "GenFw.h" -#include "ElfConvert.h" -#include "Elf32Convert.h" - -STATIC -VOID -ScanSections32 ( - VOID - ); - -STATIC -BOOLEAN -WriteSections32 ( - SECTION_FILTER_TYPES FilterType - ); - -STATIC -VOID -WriteRelocations32 ( - VOID - ); - -STATIC -VOID -WriteDebug32 ( - VOID - ); - -STATIC -VOID -SetImageSize32 ( - VOID - ); - -STATIC -VOID -CleanUp32 ( - VOID - ); - -// -// Rename ELF32 strucutres to common names to help when porting to ELF64. -// -typedef Elf32_Shdr Elf_Shdr; -typedef Elf32_Ehdr Elf_Ehdr; -typedef Elf32_Rel Elf_Rel; -typedef Elf32_Sym Elf_Sym; -typedef Elf32_Phdr Elf_Phdr; -typedef Elf32_Dyn Elf_Dyn; -#define ELFCLASS ELFCLASS32 -#define ELF_R_TYPE(r) ELF32_R_TYPE(r) -#define ELF_R_SYM(r) ELF32_R_SYM(r) - -// -// Well known ELF structures. -// -STATIC Elf_Ehdr *mEhdr; -STATIC Elf_Shdr *mShdrBase; -STATIC Elf_Phdr *mPhdrBase; - -// -// Coff information -// -STATIC const UINT32 mCoffAlignment = 0x20; - -// -// PE section alignment. -// -STATIC const UINT16 mCoffNbrSections = 5; - -// -// ELF sections to offset in Coff file. -// -STATIC UINT32 *mCoffSectionsOffset = NULL; - -// -// Offsets in COFF file -// -STATIC UINT32 mNtHdrOffset; -STATIC UINT32 mTextOffset; -STATIC UINT32 mDataOffset; -STATIC UINT32 mHiiRsrcOffset; -STATIC UINT32 mRelocOffset; - -// -// Initialization Function -// -BOOLEAN -InitializeElf32 ( - UINT8 *FileBuffer, - ELF_FUNCTION_TABLE *ElfFunctions - ) -{ - // - // Initialize data pointer and structures. - // - mEhdr = (Elf_Ehdr*) FileBuffer; - - // - // Check the ELF32 specific header information. - // - if (mEhdr->e_ident[EI_CLASS] != ELFCLASS32) { - Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFCLASS32"); - return FALSE; - } - if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) { - Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFDATA2LSB"); - return FALSE; - } - if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) { - Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN"); - return FALSE; - } - if (!((mEhdr->e_machine == EM_386) || (mEhdr->e_machine == EM_ARM))) { - Error (NULL, 0, 3000, "Unsupported", "ELF e_machine not EM_386 or EM_ARM"); - return FALSE; - } - if (mEhdr->e_version != EV_CURRENT) { - Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT); - return FALSE; - } - - // - // Update section header pointers - // - mShdrBase = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff); - mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff); - - // - // Create COFF Section offset buffer and zero. - // - mCoffSectionsOffset = (UINT32 *)malloc(mEhdr->e_shnum * sizeof (UINT32)); - memset(mCoffSectionsOffset, 0, mEhdr->e_shnum * sizeof(UINT32)); - - // - // Fill in function pointers. - // - ElfFunctions->ScanSections = ScanSections32; - ElfFunctions->WriteSections = WriteSections32; - ElfFunctions->WriteRelocations = WriteRelocations32; - ElfFunctions->WriteDebug = WriteDebug32; - ElfFunctions->SetImageSize = SetImageSize32; - ElfFunctions->CleanUp = CleanUp32; - - return TRUE; -} - - -// -// Header by Index functions -// -STATIC -Elf_Shdr* -GetShdrByIndex ( - UINT32 Num - ) -{ - if (Num >= mEhdr->e_shnum) - return NULL; - return (Elf_Shdr*)((UINT8*)mShdrBase + Num * mEhdr->e_shentsize); -} - -STATIC -Elf_Phdr* -GetPhdrByIndex ( - UINT32 num - ) -{ - if (num >= mEhdr->e_phnum) { - return NULL; - } - - return (Elf_Phdr *)((UINT8*)mPhdrBase + num * mEhdr->e_phentsize); -} - -STATIC -UINT32 -CoffAlign ( - UINT32 Offset - ) -{ - return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1); -} - -// -// filter functions -// -STATIC -BOOLEAN -IsTextShdr ( - Elf_Shdr *Shdr - ) -{ - return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC); -} - -STATIC -BOOLEAN -IsHiiRsrcShdr ( - Elf_Shdr *Shdr - ) -{ - Elf_Shdr *Namedr = GetShdrByIndex(mEhdr->e_shstrndx); - - return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_HII_SECTION_NAME) == 0); -} - -STATIC -BOOLEAN -IsDataShdr ( - Elf_Shdr *Shdr - ) -{ - if (IsHiiRsrcShdr(Shdr)) { - return FALSE; - } - return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE); -} - -// -// Elf functions interface implementation -// - -STATIC -VOID -ScanSections32 ( - VOID - ) -{ - UINT32 i; - EFI_IMAGE_DOS_HEADER *DosHdr; - EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; - UINT32 CoffEntry; - UINT32 SectionCount; - BOOLEAN FoundText; - - CoffEntry = 0; - mCoffOffset = 0; - mTextOffset = 0; - FoundText = FALSE; - - // - // Coff file start with a DOS header. - // - mCoffOffset = sizeof(EFI_IMAGE_DOS_HEADER) + 0x40; - mNtHdrOffset = mCoffOffset; - switch (mEhdr->e_machine) { - case EM_386: - case EM_ARM: - mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS32); - break; - default: - VerboseMsg ("%s unknown e_machine type. Assume IA-32", (UINTN)mEhdr->e_machine); - mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS32); - break; - } - - mTableOffset = mCoffOffset; - mCoffOffset += mCoffNbrSections * sizeof(EFI_IMAGE_SECTION_HEADER); - - // - // First text sections. - // - mCoffOffset = CoffAlign(mCoffOffset); - SectionCount = 0; - for (i = 0; i < mEhdr->e_shnum; i++) { - Elf_Shdr *shdr = GetShdrByIndex(i); - if (IsTextShdr(shdr)) { - if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { - // the alignment field is valid - if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { - // if the section address is aligned we must align PE/COFF - mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1); - } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { - // ARM RVCT tools have behavior outside of the ELF specification to try - // and make images smaller. If sh_addr is not aligned to sh_addralign - // then the section needs to preserve sh_addr MOD sh_addralign. - // Normally doing nothing here works great. - Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); - } - } - - /* Relocate entry. */ - if ((mEhdr->e_entry >= shdr->sh_addr) && - (mEhdr->e_entry < shdr->sh_addr + shdr->sh_size)) { - CoffEntry = mCoffOffset + mEhdr->e_entry - shdr->sh_addr; - } - - // - // Set mTextOffset with the offset of the first '.text' section - // - if (!FoundText) { - mTextOffset = mCoffOffset; - FoundText = TRUE; - } - - mCoffSectionsOffset[i] = mCoffOffset; - mCoffOffset += shdr->sh_size; - SectionCount ++; - } - } - - if (!FoundText) { - Error (NULL, 0, 3000, "Invalid", "Did not find any '.text' section."); - assert (FALSE); - } - - if (mEhdr->e_machine != EM_ARM) { - mCoffOffset = CoffAlign(mCoffOffset); - } - - if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) { - Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 text section. Source level debug might not work correctly.", mInImageName); - } - - // - // Then data sections. - // - mDataOffset = mCoffOffset; - SectionCount = 0; - for (i = 0; i < mEhdr->e_shnum; i++) { - Elf_Shdr *shdr = GetShdrByIndex(i); - if (IsDataShdr(shdr)) { - if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { - // the alignment field is valid - if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { - // if the section address is aligned we must align PE/COFF - mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1); - } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { - // ARM RVCT tools have behavior outside of the ELF specification to try - // and make images smaller. If sh_addr is not aligned to sh_addralign - // then the section needs to preserve sh_addr MOD sh_addralign. - // Normally doing nothing here works great. - Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); - } - } - mCoffSectionsOffset[i] = mCoffOffset; - mCoffOffset += shdr->sh_size; - SectionCount ++; - } - } - mCoffOffset = CoffAlign(mCoffOffset); - - if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) { - Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 data section. Source level debug might not work correctly.", mInImageName); - } - - // - // The HII resource sections. - // - mHiiRsrcOffset = mCoffOffset; - for (i = 0; i < mEhdr->e_shnum; i++) { - Elf_Shdr *shdr = GetShdrByIndex(i); - if (IsHiiRsrcShdr(shdr)) { - if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { - // the alignment field is valid - if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { - // if the section address is aligned we must align PE/COFF - mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1); - } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { - // ARM RVCT tools have behavior outside of the ELF specification to try - // and make images smaller. If sh_addr is not aligned to sh_addralign - // then the section needs to preserve sh_addr MOD sh_addralign. - // Normally doing nothing here works great. - Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); - } - } - if (shdr->sh_size != 0) { - mCoffSectionsOffset[i] = mCoffOffset; - mCoffOffset += shdr->sh_size; - mCoffOffset = CoffAlign(mCoffOffset); - SetHiiResourceHeader ((UINT8*) mEhdr + shdr->sh_offset, mHiiRsrcOffset); - } - break; - } - } - - mRelocOffset = mCoffOffset; - - // - // Allocate base Coff file. Will be expanded later for relocations. - // - mCoffFile = (UINT8 *)malloc(mCoffOffset); - memset(mCoffFile, 0, mCoffOffset); - - // - // Fill headers. - // - DosHdr = (EFI_IMAGE_DOS_HEADER *)mCoffFile; - DosHdr->e_magic = EFI_IMAGE_DOS_SIGNATURE; - DosHdr->e_lfanew = mNtHdrOffset; - - NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION*)(mCoffFile + mNtHdrOffset); - - NtHdr->Pe32.Signature = EFI_IMAGE_NT_SIGNATURE; - - switch (mEhdr->e_machine) { - case EM_386: - NtHdr->Pe32.FileHeader.Machine = EFI_IMAGE_MACHINE_IA32; - NtHdr->Pe32.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC; - break; - case EM_ARM: - NtHdr->Pe32.FileHeader.Machine = EFI_IMAGE_MACHINE_ARMT; - NtHdr->Pe32.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC; - break; - default: - VerboseMsg ("%s unknown e_machine type. Assume IA-32", (UINTN)mEhdr->e_machine); - NtHdr->Pe32.FileHeader.Machine = EFI_IMAGE_MACHINE_IA32; - NtHdr->Pe32.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC; - } - - NtHdr->Pe32.FileHeader.NumberOfSections = mCoffNbrSections; - NtHdr->Pe32.FileHeader.TimeDateStamp = (UINT32) time(NULL); - mImageTimeStamp = NtHdr->Pe32.FileHeader.TimeDateStamp; - NtHdr->Pe32.FileHeader.PointerToSymbolTable = 0; - NtHdr->Pe32.FileHeader.NumberOfSymbols = 0; - NtHdr->Pe32.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32.OptionalHeader); - NtHdr->Pe32.FileHeader.Characteristics = EFI_IMAGE_FILE_EXECUTABLE_IMAGE - | EFI_IMAGE_FILE_LINE_NUMS_STRIPPED - | EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED - | EFI_IMAGE_FILE_32BIT_MACHINE; - - NtHdr->Pe32.OptionalHeader.SizeOfCode = mDataOffset - mTextOffset; - NtHdr->Pe32.OptionalHeader.SizeOfInitializedData = mRelocOffset - mDataOffset; - NtHdr->Pe32.OptionalHeader.SizeOfUninitializedData = 0; - NtHdr->Pe32.OptionalHeader.AddressOfEntryPoint = CoffEntry; - - NtHdr->Pe32.OptionalHeader.BaseOfCode = mTextOffset; - - NtHdr->Pe32.OptionalHeader.BaseOfData = mDataOffset; - NtHdr->Pe32.OptionalHeader.ImageBase = 0; - NtHdr->Pe32.OptionalHeader.SectionAlignment = mCoffAlignment; - NtHdr->Pe32.OptionalHeader.FileAlignment = mCoffAlignment; - NtHdr->Pe32.OptionalHeader.SizeOfImage = 0; - - NtHdr->Pe32.OptionalHeader.SizeOfHeaders = mTextOffset; - NtHdr->Pe32.OptionalHeader.NumberOfRvaAndSizes = EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES; - - // - // Section headers. - // - if ((mDataOffset - mTextOffset) > 0) { - CreateSectionHeader (".text", mTextOffset, mDataOffset - mTextOffset, - EFI_IMAGE_SCN_CNT_CODE - | EFI_IMAGE_SCN_MEM_EXECUTE - | EFI_IMAGE_SCN_MEM_READ); - } else { - // Don't make a section of size 0. - NtHdr->Pe32.FileHeader.NumberOfSections--; - } - - if ((mHiiRsrcOffset - mDataOffset) > 0) { - CreateSectionHeader (".data", mDataOffset, mHiiRsrcOffset - mDataOffset, - EFI_IMAGE_SCN_CNT_INITIALIZED_DATA - | EFI_IMAGE_SCN_MEM_WRITE - | EFI_IMAGE_SCN_MEM_READ); - } else { - // Don't make a section of size 0. - NtHdr->Pe32.FileHeader.NumberOfSections--; - } - - if ((mRelocOffset - mHiiRsrcOffset) > 0) { - CreateSectionHeader (".rsrc", mHiiRsrcOffset, mRelocOffset - mHiiRsrcOffset, - EFI_IMAGE_SCN_CNT_INITIALIZED_DATA - | EFI_IMAGE_SCN_MEM_READ); - - NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = mRelocOffset - mHiiRsrcOffset; - NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = mHiiRsrcOffset; - } else { - // Don't make a section of size 0. - NtHdr->Pe32.FileHeader.NumberOfSections--; - } - -} - -STATIC -BOOLEAN -WriteSections32 ( - SECTION_FILTER_TYPES FilterType - ) -{ - UINT32 Idx; - Elf_Shdr *SecShdr; - UINT32 SecOffset; - BOOLEAN (*Filter)(Elf_Shdr *); - - // - // Initialize filter pointer - // - switch (FilterType) { - case SECTION_TEXT: - Filter = IsTextShdr; - break; - case SECTION_HII: - Filter = IsHiiRsrcShdr; - break; - case SECTION_DATA: - Filter = IsDataShdr; - break; - default: - return FALSE; - } - - // - // First: copy sections. - // - for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) { - Elf_Shdr *Shdr = GetShdrByIndex(Idx); - if ((*Filter)(Shdr)) { - switch (Shdr->sh_type) { - case SHT_PROGBITS: - /* Copy. */ - memcpy(mCoffFile + mCoffSectionsOffset[Idx], - (UINT8*)mEhdr + Shdr->sh_offset, - Shdr->sh_size); - break; - - case SHT_NOBITS: - memset(mCoffFile + mCoffSectionsOffset[Idx], 0, Shdr->sh_size); - break; - - default: - // - // Ignore for unkown section type. - // - VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (unsigned)Shdr->sh_type); - break; - } - } - } - - // - // Second: apply relocations. - // - for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) { - // - // Determine if this is a relocation section. - // - Elf_Shdr *RelShdr = GetShdrByIndex(Idx); - if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) { - continue; - } - - // - // Relocation section found. Now extract section information that the relocations - // apply to in the ELF data and the new COFF data. - // - SecShdr = GetShdrByIndex(RelShdr->sh_info); - SecOffset = mCoffSectionsOffset[RelShdr->sh_info]; - - // - // Only process relocations for the current filter type. - // - if (RelShdr->sh_type == SHT_REL && (*Filter)(SecShdr)) { - UINT32 RelOffset; - - // - // Determine the symbol table referenced by the relocation data. - // - Elf_Shdr *SymtabShdr = GetShdrByIndex(RelShdr->sh_link); - UINT8 *Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset; - - // - // Process all relocation entries for this section. - // - for (RelOffset = 0; RelOffset < RelShdr->sh_size; RelOffset += RelShdr->sh_entsize) { - // - // Set pointer to relocation entry - // - Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelOffset); - - // - // Set pointer to symbol table entry associated with the relocation entry. - // - Elf_Sym *Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize); - - Elf_Shdr *SymShdr; - UINT8 *Targ; - UINT16 Address; - - // - // Check section header index found in symbol table and get the section - // header location. - // - if (Sym->st_shndx == SHN_UNDEF - || Sym->st_shndx == SHN_ABS - || Sym->st_shndx > mEhdr->e_shnum) { - Error (NULL, 0, 3000, "Invalid", "%s bad symbol definition.", mInImageName); - } - SymShdr = GetShdrByIndex(Sym->st_shndx); - - // - // Convert the relocation data to a pointer into the coff file. - // - // Note: - // r_offset is the virtual address of the storage unit to be relocated. - // sh_addr is the virtual address for the base of the section. - // - Targ = mCoffFile + SecOffset + (Rel->r_offset - SecShdr->sh_addr); - - // - // Determine how to handle each relocation type based on the machine type. - // - if (mEhdr->e_machine == EM_386) { - switch (ELF_R_TYPE(Rel->r_info)) { - case R_386_NONE: - break; - case R_386_32: - // - // Absolute relocation. - // Converts Targ from a absolute virtual address to the absolute - // COFF address. - // - *(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr - + mCoffSectionsOffset[Sym->st_shndx]; - break; - case R_386_PC32: - // - // Relative relocation: Symbol - Ip + Addend - // - *(UINT32 *)Targ = *(UINT32 *)Targ - + (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr) - - (SecOffset - SecShdr->sh_addr); - break; - default: - Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_386 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); - } - } else if (mEhdr->e_machine == EM_ARM) { - switch (ELF32_R_TYPE(Rel->r_info)) { - case R_ARM_RBASE: - // No relocation - no action required - // break skipped - - case R_ARM_PC24: - case R_ARM_XPC25: - case R_ARM_THM_PC22: - case R_ARM_THM_JUMP19: - case R_ARM_CALL: - case R_ARM_JMP24: - case R_ARM_THM_JUMP24: - case R_ARM_PREL31: - case R_ARM_MOVW_PREL_NC: - case R_ARM_MOVT_PREL: - case R_ARM_THM_MOVW_PREL_NC: - case R_ARM_THM_MOVT_PREL: - case R_ARM_THM_JMP6: - case R_ARM_THM_ALU_PREL_11_0: - case R_ARM_THM_PC12: - case R_ARM_REL32_NOI: - case R_ARM_ALU_PC_G0_NC: - case R_ARM_ALU_PC_G0: - case R_ARM_ALU_PC_G1_NC: - case R_ARM_ALU_PC_G1: - case R_ARM_ALU_PC_G2: - case R_ARM_LDR_PC_G1: - case R_ARM_LDR_PC_G2: - case R_ARM_LDRS_PC_G0: - case R_ARM_LDRS_PC_G1: - case R_ARM_LDRS_PC_G2: - case R_ARM_LDC_PC_G0: - case R_ARM_LDC_PC_G1: - case R_ARM_LDC_PC_G2: - case R_ARM_GOT_PREL: - case R_ARM_THM_JUMP11: - case R_ARM_THM_JUMP8: - case R_ARM_TLS_GD32: - case R_ARM_TLS_LDM32: - case R_ARM_TLS_IE32: - // Thease are all PC-relative relocations and don't require modification - // GCC does not seem to have the concept of a application that just needs to get relocated. - break; - - case R_ARM_THM_MOVW_ABS_NC: - // MOVW is only lower 16-bits of the addres - Address = (UINT16)(Sym->st_value - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]); - ThumbMovtImmediatePatch ((UINT16 *)Targ, Address); - break; - - case R_ARM_THM_MOVT_ABS: - // MOVT is only upper 16-bits of the addres - Address = (UINT16)((Sym->st_value - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]) >> 16); - ThumbMovtImmediatePatch ((UINT16 *)Targ, Address); - break; - - case R_ARM_ABS32: - case R_ARM_RABS32: - // - // Absolute relocation. - // - *(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]; - break; - - default: - Error (NULL, 0, 3000, "Invalid", "WriteSections (): %s unsupported ELF EM_ARM relocation 0x%x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info)); - } - } - } - } - } - - return TRUE; -} - -UINTN gMovwOffset = 0; - -STATIC -VOID -WriteRelocations32 ( - VOID - ) -{ - UINT32 Index; - EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; - EFI_IMAGE_DATA_DIRECTORY *Dir; - BOOLEAN FoundRelocations; - Elf_Dyn *Dyn; - Elf_Rel *Rel; - UINTN RelElementSize; - UINTN RelSize; - UINTN RelOffset; - UINTN K; - UINT8 *Targ; - Elf32_Phdr *DynamicSegment; - Elf32_Phdr *TargetSegment; - - for (Index = 0, FoundRelocations = FALSE; Index < mEhdr->e_shnum; Index++) { - Elf_Shdr *RelShdr = GetShdrByIndex(Index); - if ((RelShdr->sh_type == SHT_REL) || (RelShdr->sh_type == SHT_RELA)) { - Elf_Shdr *SecShdr = GetShdrByIndex (RelShdr->sh_info); - if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) { - UINT32 RelIdx; - - FoundRelocations = TRUE; - for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) { - Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx); - - if (mEhdr->e_machine == EM_386) { - switch (ELF_R_TYPE(Rel->r_info)) { - case R_386_NONE: - case R_386_PC32: - // - // No fixup entry required. - // - break; - case R_386_32: - // - // Creates a relative relocation entry from the absolute entry. - // - CoffAddFixup(mCoffSectionsOffset[RelShdr->sh_info] - + (Rel->r_offset - SecShdr->sh_addr), - EFI_IMAGE_REL_BASED_HIGHLOW); - break; - default: - Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_386 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); - } - } else if (mEhdr->e_machine == EM_ARM) { - switch (ELF32_R_TYPE(Rel->r_info)) { - case R_ARM_RBASE: - // No relocation - no action required - // break skipped - - case R_ARM_PC24: - case R_ARM_XPC25: - case R_ARM_THM_PC22: - case R_ARM_THM_JUMP19: - case R_ARM_CALL: - case R_ARM_JMP24: - case R_ARM_THM_JUMP24: - case R_ARM_PREL31: - case R_ARM_MOVW_PREL_NC: - case R_ARM_MOVT_PREL: - case R_ARM_THM_MOVW_PREL_NC: - case R_ARM_THM_MOVT_PREL: - case R_ARM_THM_JMP6: - case R_ARM_THM_ALU_PREL_11_0: - case R_ARM_THM_PC12: - case R_ARM_REL32_NOI: - case R_ARM_ALU_PC_G0_NC: - case R_ARM_ALU_PC_G0: - case R_ARM_ALU_PC_G1_NC: - case R_ARM_ALU_PC_G1: - case R_ARM_ALU_PC_G2: - case R_ARM_LDR_PC_G1: - case R_ARM_LDR_PC_G2: - case R_ARM_LDRS_PC_G0: - case R_ARM_LDRS_PC_G1: - case R_ARM_LDRS_PC_G2: - case R_ARM_LDC_PC_G0: - case R_ARM_LDC_PC_G1: - case R_ARM_LDC_PC_G2: - case R_ARM_GOT_PREL: - case R_ARM_THM_JUMP11: - case R_ARM_THM_JUMP8: - case R_ARM_TLS_GD32: - case R_ARM_TLS_LDM32: - case R_ARM_TLS_IE32: - // Thease are all PC-relative relocations and don't require modification - break; - - case R_ARM_THM_MOVW_ABS_NC: - CoffAddFixup ( - mCoffSectionsOffset[RelShdr->sh_info] - + (Rel->r_offset - SecShdr->sh_addr), - EFI_IMAGE_REL_BASED_ARM_MOV32T - ); - - // PE/COFF treats MOVW/MOVT relocation as single 64-bit instruction - // Track this address so we can log an error for unsupported sequence of MOVW/MOVT - gMovwOffset = mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr); - break; - - case R_ARM_THM_MOVT_ABS: - if ((gMovwOffset + 4) != (mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr))) { - Error (NULL, 0, 3000, "Not Supported", "PE/COFF requires MOVW+MOVT instruction sequence %x +4 != %x.", gMovwOffset, mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr)); - } - break; - - case R_ARM_ABS32: - case R_ARM_RABS32: - CoffAddFixup ( - mCoffSectionsOffset[RelShdr->sh_info] - + (Rel->r_offset - SecShdr->sh_addr), - EFI_IMAGE_REL_BASED_HIGHLOW - ); - break; - - default: - Error (NULL, 0, 3000, "Invalid", "WriteRelocations(): %s unsupported ELF EM_ARM relocation 0x%x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info)); - } - } else { - Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) mEhdr->e_machine); - } - } - } - } - } - - if (!FoundRelocations && (mEhdr->e_machine == EM_ARM)) { - /* Try again, but look for PT_DYNAMIC instead of SHT_REL */ - - for (Index = 0; Index < mEhdr->e_phnum; Index++) { - RelElementSize = 0; - RelSize = 0; - RelOffset = 0; - - DynamicSegment = GetPhdrByIndex (Index); - - if (DynamicSegment->p_type == PT_DYNAMIC) { - Dyn = (Elf32_Dyn *) ((UINT8 *)mEhdr + DynamicSegment->p_offset); - - while (Dyn->d_tag != DT_NULL) { - switch (Dyn->d_tag) { - case DT_REL: - RelOffset = Dyn->d_un.d_val; - break; - - case DT_RELSZ: - RelSize = Dyn->d_un.d_val; - break; - - case DT_RELENT: - RelElementSize = Dyn->d_un.d_val; - break; - - default: - break; - } - Dyn++; - } - if (( RelOffset == 0 ) || ( RelSize == 0 ) || ( RelElementSize == 0 )) { - Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations.", mInImageName); - } - - for (K = 0; K < RelSize; K += RelElementSize) { - - if (DynamicSegment->p_paddr == 0) { - // Older versions of the ARM ELF (SWS ESPC 0003 B-02) specification define DT_REL - // as an offset in the dynamic segment. p_paddr is defined to be zero for ARM tools - Rel = (Elf32_Rel *) ((UINT8 *) mEhdr + DynamicSegment->p_offset + RelOffset + K); - } else { - // This is how it reads in the generic ELF specification - Rel = (Elf32_Rel *) ((UINT8 *) mEhdr + RelOffset + K); - } - - switch (ELF32_R_TYPE (Rel->r_info)) { - case R_ARM_RBASE: - break; - - case R_ARM_RABS32: - TargetSegment = GetPhdrByIndex (ELF32_R_SYM (Rel->r_info) - 1); - - // Note: r_offset in a memory address. Convert it to a pointer in the coff file. - Targ = mCoffFile + mCoffSectionsOffset[ ELF32_R_SYM( Rel->r_info ) ] + Rel->r_offset - TargetSegment->p_vaddr; - - *(UINT32 *)Targ = *(UINT32 *)Targ + mCoffSectionsOffset [ELF32_R_SYM( Rel->r_info )]; - - CoffAddFixup (mCoffSectionsOffset[ELF32_R_SYM (Rel->r_info)] + (Rel->r_offset - TargetSegment->p_vaddr), EFI_IMAGE_REL_BASED_HIGHLOW); - break; - - default: - Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations, unkown type %d.", mInImageName, ELF32_R_TYPE (Rel->r_info)); - break; - } - } - break; - } - } - } - - // - // Pad by adding empty entries. - // - while (mCoffOffset & (mCoffAlignment - 1)) { - CoffAddFixupEntry(0); - } - - NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); - Dir = &NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC]; - Dir->Size = mCoffOffset - mRelocOffset; - if (Dir->Size == 0) { - // If no relocations, null out the directory entry and don't add the .reloc section - Dir->VirtualAddress = 0; - NtHdr->Pe32.FileHeader.NumberOfSections--; - } else { - Dir->VirtualAddress = mRelocOffset; - CreateSectionHeader (".reloc", mRelocOffset, mCoffOffset - mRelocOffset, - EFI_IMAGE_SCN_CNT_INITIALIZED_DATA - | EFI_IMAGE_SCN_MEM_DISCARDABLE - | EFI_IMAGE_SCN_MEM_READ); - } - -} - -STATIC -VOID -WriteDebug32 ( - VOID - ) -{ - UINT32 Len; - UINT32 DebugOffset; - EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; - EFI_IMAGE_DATA_DIRECTORY *DataDir; - EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir; - EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10; - - Len = strlen(mInImageName) + 1; - DebugOffset = mCoffOffset; - - mCoffOffset += sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) - + sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) - + Len; - mCoffOffset = CoffAlign(mCoffOffset); - - mCoffFile = realloc(mCoffFile, mCoffOffset); - memset(mCoffFile + DebugOffset, 0, mCoffOffset - DebugOffset); - - Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(mCoffFile + DebugOffset); - Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW; - Dir->SizeOfData = sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + Len; - Dir->RVA = DebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); - Dir->FileOffset = DebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); - - Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1); - Nb10->Signature = CODEVIEW_SIGNATURE_NB10; - strcpy ((char *)(Nb10 + 1), mInImageName); - - - NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); - DataDir = &NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]; - DataDir->VirtualAddress = DebugOffset; - DataDir->Size = mCoffOffset - DebugOffset; - if (DataDir->Size == 0) { - // If no debug, null out the directory entry and don't add the .debug section - DataDir->VirtualAddress = 0; - NtHdr->Pe32.FileHeader.NumberOfSections--; - } else { - DataDir->VirtualAddress = DebugOffset; - CreateSectionHeader (".debug", DebugOffset, mCoffOffset - DebugOffset, - EFI_IMAGE_SCN_CNT_INITIALIZED_DATA - | EFI_IMAGE_SCN_MEM_DISCARDABLE - | EFI_IMAGE_SCN_MEM_READ); - - } -} - -STATIC -VOID -SetImageSize32 ( - VOID - ) -{ - EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; - - // - // Set image size - // - NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); - NtHdr->Pe32.OptionalHeader.SizeOfImage = mCoffOffset; -} - -STATIC -VOID -CleanUp32 ( - VOID - ) -{ - if (mCoffSectionsOffset != NULL) { - free (mCoffSectionsOffset); - } -} - - +/** @file + +Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+Portions copyright (c) 2013, ARM Ltd. All rights reserved.
+ +This program and the accompanying materials are licensed and made available +under the terms and conditions of the BSD License which accompanies this +distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "WinNtInclude.h" + +#ifndef __GNUC__ +#include +#include +#endif +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "PeCoffLib.h" +#include "EfiUtilityMsgs.h" + +#include "GenFw.h" +#include "ElfConvert.h" +#include "Elf32Convert.h" + +STATIC +VOID +ScanSections32 ( + VOID + ); + +STATIC +BOOLEAN +WriteSections32 ( + SECTION_FILTER_TYPES FilterType + ); + +STATIC +VOID +WriteRelocations32 ( + VOID + ); + +STATIC +VOID +WriteDebug32 ( + VOID + ); + +STATIC +VOID +SetImageSize32 ( + VOID + ); + +STATIC +VOID +CleanUp32 ( + VOID + ); + +// +// Rename ELF32 strucutres to common names to help when porting to ELF64. +// +typedef Elf32_Shdr Elf_Shdr; +typedef Elf32_Ehdr Elf_Ehdr; +typedef Elf32_Rel Elf_Rel; +typedef Elf32_Sym Elf_Sym; +typedef Elf32_Phdr Elf_Phdr; +typedef Elf32_Dyn Elf_Dyn; +#define ELFCLASS ELFCLASS32 +#define ELF_R_TYPE(r) ELF32_R_TYPE(r) +#define ELF_R_SYM(r) ELF32_R_SYM(r) + +// +// Well known ELF structures. +// +STATIC Elf_Ehdr *mEhdr; +STATIC Elf_Shdr *mShdrBase; +STATIC Elf_Phdr *mPhdrBase; + +// +// Coff information +// +STATIC const UINT32 mCoffAlignment = 0x20; + +// +// PE section alignment. +// +STATIC const UINT16 mCoffNbrSections = 5; + +// +// ELF sections to offset in Coff file. +// +STATIC UINT32 *mCoffSectionsOffset = NULL; + +// +// Offsets in COFF file +// +STATIC UINT32 mNtHdrOffset; +STATIC UINT32 mTextOffset; +STATIC UINT32 mDataOffset; +STATIC UINT32 mHiiRsrcOffset; +STATIC UINT32 mRelocOffset; + +// +// Initialization Function +// +BOOLEAN +InitializeElf32 ( + UINT8 *FileBuffer, + ELF_FUNCTION_TABLE *ElfFunctions + ) +{ + // + // Initialize data pointer and structures. + // + mEhdr = (Elf_Ehdr*) FileBuffer; + + // + // Check the ELF32 specific header information. + // + if (mEhdr->e_ident[EI_CLASS] != ELFCLASS32) { + Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFCLASS32"); + return FALSE; + } + if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) { + Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFDATA2LSB"); + return FALSE; + } + if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) { + Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN"); + return FALSE; + } + if (!((mEhdr->e_machine == EM_386) || (mEhdr->e_machine == EM_ARM))) { + Error (NULL, 0, 3000, "Unsupported", "ELF e_machine not EM_386 or EM_ARM"); + return FALSE; + } + if (mEhdr->e_version != EV_CURRENT) { + Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT); + return FALSE; + } + + // + // Update section header pointers + // + mShdrBase = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff); + mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff); + + // + // Create COFF Section offset buffer and zero. + // + mCoffSectionsOffset = (UINT32 *)malloc(mEhdr->e_shnum * sizeof (UINT32)); + memset(mCoffSectionsOffset, 0, mEhdr->e_shnum * sizeof(UINT32)); + + // + // Fill in function pointers. + // + ElfFunctions->ScanSections = ScanSections32; + ElfFunctions->WriteSections = WriteSections32; + ElfFunctions->WriteRelocations = WriteRelocations32; + ElfFunctions->WriteDebug = WriteDebug32; + ElfFunctions->SetImageSize = SetImageSize32; + ElfFunctions->CleanUp = CleanUp32; + + return TRUE; +} + + +// +// Header by Index functions +// +STATIC +Elf_Shdr* +GetShdrByIndex ( + UINT32 Num + ) +{ + if (Num >= mEhdr->e_shnum) + return NULL; + return (Elf_Shdr*)((UINT8*)mShdrBase + Num * mEhdr->e_shentsize); +} + +STATIC +Elf_Phdr* +GetPhdrByIndex ( + UINT32 num + ) +{ + if (num >= mEhdr->e_phnum) { + return NULL; + } + + return (Elf_Phdr *)((UINT8*)mPhdrBase + num * mEhdr->e_phentsize); +} + +STATIC +UINT32 +CoffAlign ( + UINT32 Offset + ) +{ + return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1); +} + +// +// filter functions +// +STATIC +BOOLEAN +IsTextShdr ( + Elf_Shdr *Shdr + ) +{ + return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC); +} + +STATIC +BOOLEAN +IsHiiRsrcShdr ( + Elf_Shdr *Shdr + ) +{ + Elf_Shdr *Namedr = GetShdrByIndex(mEhdr->e_shstrndx); + + return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_HII_SECTION_NAME) == 0); +} + +STATIC +BOOLEAN +IsDataShdr ( + Elf_Shdr *Shdr + ) +{ + if (IsHiiRsrcShdr(Shdr)) { + return FALSE; + } + return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE); +} + +// +// Elf functions interface implementation +// + +STATIC +VOID +ScanSections32 ( + VOID + ) +{ + UINT32 i; + EFI_IMAGE_DOS_HEADER *DosHdr; + EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; + UINT32 CoffEntry; + UINT32 SectionCount; + BOOLEAN FoundText; + + CoffEntry = 0; + mCoffOffset = 0; + mTextOffset = 0; + FoundText = FALSE; + + // + // Coff file start with a DOS header. + // + mCoffOffset = sizeof(EFI_IMAGE_DOS_HEADER) + 0x40; + mNtHdrOffset = mCoffOffset; + switch (mEhdr->e_machine) { + case EM_386: + case EM_ARM: + mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS32); + break; + default: + VerboseMsg ("%s unknown e_machine type. Assume IA-32", (UINTN)mEhdr->e_machine); + mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS32); + break; + } + + mTableOffset = mCoffOffset; + mCoffOffset += mCoffNbrSections * sizeof(EFI_IMAGE_SECTION_HEADER); + + // + // First text sections. + // + mCoffOffset = CoffAlign(mCoffOffset); + SectionCount = 0; + for (i = 0; i < mEhdr->e_shnum; i++) { + Elf_Shdr *shdr = GetShdrByIndex(i); + if (IsTextShdr(shdr)) { + if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { + // the alignment field is valid + if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { + // if the section address is aligned we must align PE/COFF + mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1); + } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { + // ARM RVCT tools have behavior outside of the ELF specification to try + // and make images smaller. If sh_addr is not aligned to sh_addralign + // then the section needs to preserve sh_addr MOD sh_addralign. + // Normally doing nothing here works great. + Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); + } + } + + /* Relocate entry. */ + if ((mEhdr->e_entry >= shdr->sh_addr) && + (mEhdr->e_entry < shdr->sh_addr + shdr->sh_size)) { + CoffEntry = mCoffOffset + mEhdr->e_entry - shdr->sh_addr; + } + + // + // Set mTextOffset with the offset of the first '.text' section + // + if (!FoundText) { + mTextOffset = mCoffOffset; + FoundText = TRUE; + } + + mCoffSectionsOffset[i] = mCoffOffset; + mCoffOffset += shdr->sh_size; + SectionCount ++; + } + } + + if (!FoundText) { + Error (NULL, 0, 3000, "Invalid", "Did not find any '.text' section."); + assert (FALSE); + } + + if (mEhdr->e_machine != EM_ARM) { + mCoffOffset = CoffAlign(mCoffOffset); + } + + if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) { + Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 text section. Source level debug might not work correctly.", mInImageName); + } + + // + // Then data sections. + // + mDataOffset = mCoffOffset; + SectionCount = 0; + for (i = 0; i < mEhdr->e_shnum; i++) { + Elf_Shdr *shdr = GetShdrByIndex(i); + if (IsDataShdr(shdr)) { + if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { + // the alignment field is valid + if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { + // if the section address is aligned we must align PE/COFF + mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1); + } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { + // ARM RVCT tools have behavior outside of the ELF specification to try + // and make images smaller. If sh_addr is not aligned to sh_addralign + // then the section needs to preserve sh_addr MOD sh_addralign. + // Normally doing nothing here works great. + Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); + } + } + mCoffSectionsOffset[i] = mCoffOffset; + mCoffOffset += shdr->sh_size; + SectionCount ++; + } + } + mCoffOffset = CoffAlign(mCoffOffset); + + if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) { + Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 data section. Source level debug might not work correctly.", mInImageName); + } + + // + // The HII resource sections. + // + mHiiRsrcOffset = mCoffOffset; + for (i = 0; i < mEhdr->e_shnum; i++) { + Elf_Shdr *shdr = GetShdrByIndex(i); + if (IsHiiRsrcShdr(shdr)) { + if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { + // the alignment field is valid + if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { + // if the section address is aligned we must align PE/COFF + mCoffOffset = (mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1); + } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { + // ARM RVCT tools have behavior outside of the ELF specification to try + // and make images smaller. If sh_addr is not aligned to sh_addralign + // then the section needs to preserve sh_addr MOD sh_addralign. + // Normally doing nothing here works great. + Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); + } + } + if (shdr->sh_size != 0) { + mCoffSectionsOffset[i] = mCoffOffset; + mCoffOffset += shdr->sh_size; + mCoffOffset = CoffAlign(mCoffOffset); + SetHiiResourceHeader ((UINT8*) mEhdr + shdr->sh_offset, mHiiRsrcOffset); + } + break; + } + } + + mRelocOffset = mCoffOffset; + + // + // Allocate base Coff file. Will be expanded later for relocations. + // + mCoffFile = (UINT8 *)malloc(mCoffOffset); + memset(mCoffFile, 0, mCoffOffset); + + // + // Fill headers. + // + DosHdr = (EFI_IMAGE_DOS_HEADER *)mCoffFile; + DosHdr->e_magic = EFI_IMAGE_DOS_SIGNATURE; + DosHdr->e_lfanew = mNtHdrOffset; + + NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION*)(mCoffFile + mNtHdrOffset); + + NtHdr->Pe32.Signature = EFI_IMAGE_NT_SIGNATURE; + + switch (mEhdr->e_machine) { + case EM_386: + NtHdr->Pe32.FileHeader.Machine = EFI_IMAGE_MACHINE_IA32; + NtHdr->Pe32.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC; + break; + case EM_ARM: + NtHdr->Pe32.FileHeader.Machine = EFI_IMAGE_MACHINE_ARMT; + NtHdr->Pe32.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC; + break; + default: + VerboseMsg ("%s unknown e_machine type. Assume IA-32", (UINTN)mEhdr->e_machine); + NtHdr->Pe32.FileHeader.Machine = EFI_IMAGE_MACHINE_IA32; + NtHdr->Pe32.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC; + } + + NtHdr->Pe32.FileHeader.NumberOfSections = mCoffNbrSections; + NtHdr->Pe32.FileHeader.TimeDateStamp = (UINT32) time(NULL); + mImageTimeStamp = NtHdr->Pe32.FileHeader.TimeDateStamp; + NtHdr->Pe32.FileHeader.PointerToSymbolTable = 0; + NtHdr->Pe32.FileHeader.NumberOfSymbols = 0; + NtHdr->Pe32.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32.OptionalHeader); + NtHdr->Pe32.FileHeader.Characteristics = EFI_IMAGE_FILE_EXECUTABLE_IMAGE + | EFI_IMAGE_FILE_LINE_NUMS_STRIPPED + | EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED + | EFI_IMAGE_FILE_32BIT_MACHINE; + + NtHdr->Pe32.OptionalHeader.SizeOfCode = mDataOffset - mTextOffset; + NtHdr->Pe32.OptionalHeader.SizeOfInitializedData = mRelocOffset - mDataOffset; + NtHdr->Pe32.OptionalHeader.SizeOfUninitializedData = 0; + NtHdr->Pe32.OptionalHeader.AddressOfEntryPoint = CoffEntry; + + NtHdr->Pe32.OptionalHeader.BaseOfCode = mTextOffset; + + NtHdr->Pe32.OptionalHeader.BaseOfData = mDataOffset; + NtHdr->Pe32.OptionalHeader.ImageBase = 0; + NtHdr->Pe32.OptionalHeader.SectionAlignment = mCoffAlignment; + NtHdr->Pe32.OptionalHeader.FileAlignment = mCoffAlignment; + NtHdr->Pe32.OptionalHeader.SizeOfImage = 0; + + NtHdr->Pe32.OptionalHeader.SizeOfHeaders = mTextOffset; + NtHdr->Pe32.OptionalHeader.NumberOfRvaAndSizes = EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES; + + // + // Section headers. + // + if ((mDataOffset - mTextOffset) > 0) { + CreateSectionHeader (".text", mTextOffset, mDataOffset - mTextOffset, + EFI_IMAGE_SCN_CNT_CODE + | EFI_IMAGE_SCN_MEM_EXECUTE + | EFI_IMAGE_SCN_MEM_READ); + } else { + // Don't make a section of size 0. + NtHdr->Pe32.FileHeader.NumberOfSections--; + } + + if ((mHiiRsrcOffset - mDataOffset) > 0) { + CreateSectionHeader (".data", mDataOffset, mHiiRsrcOffset - mDataOffset, + EFI_IMAGE_SCN_CNT_INITIALIZED_DATA + | EFI_IMAGE_SCN_MEM_WRITE + | EFI_IMAGE_SCN_MEM_READ); + } else { + // Don't make a section of size 0. + NtHdr->Pe32.FileHeader.NumberOfSections--; + } + + if ((mRelocOffset - mHiiRsrcOffset) > 0) { + CreateSectionHeader (".rsrc", mHiiRsrcOffset, mRelocOffset - mHiiRsrcOffset, + EFI_IMAGE_SCN_CNT_INITIALIZED_DATA + | EFI_IMAGE_SCN_MEM_READ); + + NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = mRelocOffset - mHiiRsrcOffset; + NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = mHiiRsrcOffset; + } else { + // Don't make a section of size 0. + NtHdr->Pe32.FileHeader.NumberOfSections--; + } + +} + +STATIC +BOOLEAN +WriteSections32 ( + SECTION_FILTER_TYPES FilterType + ) +{ + UINT32 Idx; + Elf_Shdr *SecShdr; + UINT32 SecOffset; + BOOLEAN (*Filter)(Elf_Shdr *); + + // + // Initialize filter pointer + // + switch (FilterType) { + case SECTION_TEXT: + Filter = IsTextShdr; + break; + case SECTION_HII: + Filter = IsHiiRsrcShdr; + break; + case SECTION_DATA: + Filter = IsDataShdr; + break; + default: + return FALSE; + } + + // + // First: copy sections. + // + for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) { + Elf_Shdr *Shdr = GetShdrByIndex(Idx); + if ((*Filter)(Shdr)) { + switch (Shdr->sh_type) { + case SHT_PROGBITS: + /* Copy. */ + memcpy(mCoffFile + mCoffSectionsOffset[Idx], + (UINT8*)mEhdr + Shdr->sh_offset, + Shdr->sh_size); + break; + + case SHT_NOBITS: + memset(mCoffFile + mCoffSectionsOffset[Idx], 0, Shdr->sh_size); + break; + + default: + // + // Ignore for unkown section type. + // + VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (unsigned)Shdr->sh_type); + break; + } + } + } + + // + // Second: apply relocations. + // + for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) { + // + // Determine if this is a relocation section. + // + Elf_Shdr *RelShdr = GetShdrByIndex(Idx); + if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) { + continue; + } + + // + // Relocation section found. Now extract section information that the relocations + // apply to in the ELF data and the new COFF data. + // + SecShdr = GetShdrByIndex(RelShdr->sh_info); + SecOffset = mCoffSectionsOffset[RelShdr->sh_info]; + + // + // Only process relocations for the current filter type. + // + if (RelShdr->sh_type == SHT_REL && (*Filter)(SecShdr)) { + UINT32 RelOffset; + + // + // Determine the symbol table referenced by the relocation data. + // + Elf_Shdr *SymtabShdr = GetShdrByIndex(RelShdr->sh_link); + UINT8 *Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset; + + // + // Process all relocation entries for this section. + // + for (RelOffset = 0; RelOffset < RelShdr->sh_size; RelOffset += RelShdr->sh_entsize) { + // + // Set pointer to relocation entry + // + Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelOffset); + + // + // Set pointer to symbol table entry associated with the relocation entry. + // + Elf_Sym *Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize); + + Elf_Shdr *SymShdr; + UINT8 *Targ; + UINT16 Address; + + // + // Check section header index found in symbol table and get the section + // header location. + // + if (Sym->st_shndx == SHN_UNDEF + || Sym->st_shndx == SHN_ABS + || Sym->st_shndx > mEhdr->e_shnum) { + Error (NULL, 0, 3000, "Invalid", "%s bad symbol definition.", mInImageName); + } + SymShdr = GetShdrByIndex(Sym->st_shndx); + + // + // Convert the relocation data to a pointer into the coff file. + // + // Note: + // r_offset is the virtual address of the storage unit to be relocated. + // sh_addr is the virtual address for the base of the section. + // + Targ = mCoffFile + SecOffset + (Rel->r_offset - SecShdr->sh_addr); + + // + // Determine how to handle each relocation type based on the machine type. + // + if (mEhdr->e_machine == EM_386) { + switch (ELF_R_TYPE(Rel->r_info)) { + case R_386_NONE: + break; + case R_386_32: + // + // Absolute relocation. + // Converts Targ from a absolute virtual address to the absolute + // COFF address. + // + *(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr + + mCoffSectionsOffset[Sym->st_shndx]; + break; + case R_386_PC32: + // + // Relative relocation: Symbol - Ip + Addend + // + *(UINT32 *)Targ = *(UINT32 *)Targ + + (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr) + - (SecOffset - SecShdr->sh_addr); + break; + default: + Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_386 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); + } + } else if (mEhdr->e_machine == EM_ARM) { + switch (ELF32_R_TYPE(Rel->r_info)) { + case R_ARM_RBASE: + // No relocation - no action required + // break skipped + + case R_ARM_PC24: + case R_ARM_XPC25: + case R_ARM_THM_PC22: + case R_ARM_THM_JUMP19: + case R_ARM_CALL: + case R_ARM_JMP24: + case R_ARM_THM_JUMP24: + case R_ARM_PREL31: + case R_ARM_MOVW_PREL_NC: + case R_ARM_MOVT_PREL: + case R_ARM_THM_MOVW_PREL_NC: + case R_ARM_THM_MOVT_PREL: + case R_ARM_THM_JMP6: + case R_ARM_THM_ALU_PREL_11_0: + case R_ARM_THM_PC12: + case R_ARM_REL32_NOI: + case R_ARM_ALU_PC_G0_NC: + case R_ARM_ALU_PC_G0: + case R_ARM_ALU_PC_G1_NC: + case R_ARM_ALU_PC_G1: + case R_ARM_ALU_PC_G2: + case R_ARM_LDR_PC_G1: + case R_ARM_LDR_PC_G2: + case R_ARM_LDRS_PC_G0: + case R_ARM_LDRS_PC_G1: + case R_ARM_LDRS_PC_G2: + case R_ARM_LDC_PC_G0: + case R_ARM_LDC_PC_G1: + case R_ARM_LDC_PC_G2: + case R_ARM_GOT_PREL: + case R_ARM_THM_JUMP11: + case R_ARM_THM_JUMP8: + case R_ARM_TLS_GD32: + case R_ARM_TLS_LDM32: + case R_ARM_TLS_IE32: + // Thease are all PC-relative relocations and don't require modification + // GCC does not seem to have the concept of a application that just needs to get relocated. + break; + + case R_ARM_THM_MOVW_ABS_NC: + // MOVW is only lower 16-bits of the addres + Address = (UINT16)(Sym->st_value - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]); + ThumbMovtImmediatePatch ((UINT16 *)Targ, Address); + break; + + case R_ARM_THM_MOVT_ABS: + // MOVT is only upper 16-bits of the addres + Address = (UINT16)((Sym->st_value - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]) >> 16); + ThumbMovtImmediatePatch ((UINT16 *)Targ, Address); + break; + + case R_ARM_ABS32: + case R_ARM_RABS32: + // + // Absolute relocation. + // + *(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]; + break; + + default: + Error (NULL, 0, 3000, "Invalid", "WriteSections (): %s unsupported ELF EM_ARM relocation 0x%x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info)); + } + } + } + } + } + + return TRUE; +} + +UINTN gMovwOffset = 0; + +STATIC +VOID +WriteRelocations32 ( + VOID + ) +{ + UINT32 Index; + EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; + EFI_IMAGE_DATA_DIRECTORY *Dir; + BOOLEAN FoundRelocations; + Elf_Dyn *Dyn; + Elf_Rel *Rel; + UINTN RelElementSize; + UINTN RelSize; + UINTN RelOffset; + UINTN K; + UINT8 *Targ; + Elf32_Phdr *DynamicSegment; + Elf32_Phdr *TargetSegment; + + for (Index = 0, FoundRelocations = FALSE; Index < mEhdr->e_shnum; Index++) { + Elf_Shdr *RelShdr = GetShdrByIndex(Index); + if ((RelShdr->sh_type == SHT_REL) || (RelShdr->sh_type == SHT_RELA)) { + Elf_Shdr *SecShdr = GetShdrByIndex (RelShdr->sh_info); + if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) { + UINT32 RelIdx; + + FoundRelocations = TRUE; + for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) { + Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx); + + if (mEhdr->e_machine == EM_386) { + switch (ELF_R_TYPE(Rel->r_info)) { + case R_386_NONE: + case R_386_PC32: + // + // No fixup entry required. + // + break; + case R_386_32: + // + // Creates a relative relocation entry from the absolute entry. + // + CoffAddFixup(mCoffSectionsOffset[RelShdr->sh_info] + + (Rel->r_offset - SecShdr->sh_addr), + EFI_IMAGE_REL_BASED_HIGHLOW); + break; + default: + Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_386 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); + } + } else if (mEhdr->e_machine == EM_ARM) { + switch (ELF32_R_TYPE(Rel->r_info)) { + case R_ARM_RBASE: + // No relocation - no action required + // break skipped + + case R_ARM_PC24: + case R_ARM_XPC25: + case R_ARM_THM_PC22: + case R_ARM_THM_JUMP19: + case R_ARM_CALL: + case R_ARM_JMP24: + case R_ARM_THM_JUMP24: + case R_ARM_PREL31: + case R_ARM_MOVW_PREL_NC: + case R_ARM_MOVT_PREL: + case R_ARM_THM_MOVW_PREL_NC: + case R_ARM_THM_MOVT_PREL: + case R_ARM_THM_JMP6: + case R_ARM_THM_ALU_PREL_11_0: + case R_ARM_THM_PC12: + case R_ARM_REL32_NOI: + case R_ARM_ALU_PC_G0_NC: + case R_ARM_ALU_PC_G0: + case R_ARM_ALU_PC_G1_NC: + case R_ARM_ALU_PC_G1: + case R_ARM_ALU_PC_G2: + case R_ARM_LDR_PC_G1: + case R_ARM_LDR_PC_G2: + case R_ARM_LDRS_PC_G0: + case R_ARM_LDRS_PC_G1: + case R_ARM_LDRS_PC_G2: + case R_ARM_LDC_PC_G0: + case R_ARM_LDC_PC_G1: + case R_ARM_LDC_PC_G2: + case R_ARM_GOT_PREL: + case R_ARM_THM_JUMP11: + case R_ARM_THM_JUMP8: + case R_ARM_TLS_GD32: + case R_ARM_TLS_LDM32: + case R_ARM_TLS_IE32: + // Thease are all PC-relative relocations and don't require modification + break; + + case R_ARM_THM_MOVW_ABS_NC: + CoffAddFixup ( + mCoffSectionsOffset[RelShdr->sh_info] + + (Rel->r_offset - SecShdr->sh_addr), + EFI_IMAGE_REL_BASED_ARM_MOV32T + ); + + // PE/COFF treats MOVW/MOVT relocation as single 64-bit instruction + // Track this address so we can log an error for unsupported sequence of MOVW/MOVT + gMovwOffset = mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr); + break; + + case R_ARM_THM_MOVT_ABS: + if ((gMovwOffset + 4) != (mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr))) { + Error (NULL, 0, 3000, "Not Supported", "PE/COFF requires MOVW+MOVT instruction sequence %x +4 != %x.", gMovwOffset, mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr)); + } + break; + + case R_ARM_ABS32: + case R_ARM_RABS32: + CoffAddFixup ( + mCoffSectionsOffset[RelShdr->sh_info] + + (Rel->r_offset - SecShdr->sh_addr), + EFI_IMAGE_REL_BASED_HIGHLOW + ); + break; + + default: + Error (NULL, 0, 3000, "Invalid", "WriteRelocations(): %s unsupported ELF EM_ARM relocation 0x%x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info)); + } + } else { + Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) mEhdr->e_machine); + } + } + } + } + } + + if (!FoundRelocations && (mEhdr->e_machine == EM_ARM)) { + /* Try again, but look for PT_DYNAMIC instead of SHT_REL */ + + for (Index = 0; Index < mEhdr->e_phnum; Index++) { + RelElementSize = 0; + RelSize = 0; + RelOffset = 0; + + DynamicSegment = GetPhdrByIndex (Index); + + if (DynamicSegment->p_type == PT_DYNAMIC) { + Dyn = (Elf32_Dyn *) ((UINT8 *)mEhdr + DynamicSegment->p_offset); + + while (Dyn->d_tag != DT_NULL) { + switch (Dyn->d_tag) { + case DT_REL: + RelOffset = Dyn->d_un.d_val; + break; + + case DT_RELSZ: + RelSize = Dyn->d_un.d_val; + break; + + case DT_RELENT: + RelElementSize = Dyn->d_un.d_val; + break; + + default: + break; + } + Dyn++; + } + if (( RelOffset == 0 ) || ( RelSize == 0 ) || ( RelElementSize == 0 )) { + Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations.", mInImageName); + } + + for (K = 0; K < RelSize; K += RelElementSize) { + + if (DynamicSegment->p_paddr == 0) { + // Older versions of the ARM ELF (SWS ESPC 0003 B-02) specification define DT_REL + // as an offset in the dynamic segment. p_paddr is defined to be zero for ARM tools + Rel = (Elf32_Rel *) ((UINT8 *) mEhdr + DynamicSegment->p_offset + RelOffset + K); + } else { + // This is how it reads in the generic ELF specification + Rel = (Elf32_Rel *) ((UINT8 *) mEhdr + RelOffset + K); + } + + switch (ELF32_R_TYPE (Rel->r_info)) { + case R_ARM_RBASE: + break; + + case R_ARM_RABS32: + TargetSegment = GetPhdrByIndex (ELF32_R_SYM (Rel->r_info) - 1); + + // Note: r_offset in a memory address. Convert it to a pointer in the coff file. + Targ = mCoffFile + mCoffSectionsOffset[ ELF32_R_SYM( Rel->r_info ) ] + Rel->r_offset - TargetSegment->p_vaddr; + + *(UINT32 *)Targ = *(UINT32 *)Targ + mCoffSectionsOffset [ELF32_R_SYM( Rel->r_info )]; + + CoffAddFixup (mCoffSectionsOffset[ELF32_R_SYM (Rel->r_info)] + (Rel->r_offset - TargetSegment->p_vaddr), EFI_IMAGE_REL_BASED_HIGHLOW); + break; + + default: + Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations, unkown type %d.", mInImageName, ELF32_R_TYPE (Rel->r_info)); + break; + } + } + break; + } + } + } + + // + // Pad by adding empty entries. + // + while (mCoffOffset & (mCoffAlignment - 1)) { + CoffAddFixupEntry(0); + } + + NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); + Dir = &NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC]; + Dir->Size = mCoffOffset - mRelocOffset; + if (Dir->Size == 0) { + // If no relocations, null out the directory entry and don't add the .reloc section + Dir->VirtualAddress = 0; + NtHdr->Pe32.FileHeader.NumberOfSections--; + } else { + Dir->VirtualAddress = mRelocOffset; + CreateSectionHeader (".reloc", mRelocOffset, mCoffOffset - mRelocOffset, + EFI_IMAGE_SCN_CNT_INITIALIZED_DATA + | EFI_IMAGE_SCN_MEM_DISCARDABLE + | EFI_IMAGE_SCN_MEM_READ); + } + +} + +STATIC +VOID +WriteDebug32 ( + VOID + ) +{ + UINT32 Len; + UINT32 DebugOffset; + EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; + EFI_IMAGE_DATA_DIRECTORY *DataDir; + EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir; + EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10; + + Len = strlen(mInImageName) + 1; + DebugOffset = mCoffOffset; + + mCoffOffset += sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) + + sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + + Len; + mCoffOffset = CoffAlign(mCoffOffset); + + mCoffFile = realloc(mCoffFile, mCoffOffset); + memset(mCoffFile + DebugOffset, 0, mCoffOffset - DebugOffset); + + Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(mCoffFile + DebugOffset); + Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW; + Dir->SizeOfData = sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + Len; + Dir->RVA = DebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); + Dir->FileOffset = DebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); + + Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1); + Nb10->Signature = CODEVIEW_SIGNATURE_NB10; + strcpy ((char *)(Nb10 + 1), mInImageName); + + + NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); + DataDir = &NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]; + DataDir->VirtualAddress = DebugOffset; + DataDir->Size = mCoffOffset - DebugOffset; + if (DataDir->Size == 0) { + // If no debug, null out the directory entry and don't add the .debug section + DataDir->VirtualAddress = 0; + NtHdr->Pe32.FileHeader.NumberOfSections--; + } else { + DataDir->VirtualAddress = DebugOffset; + CreateSectionHeader (".debug", DebugOffset, mCoffOffset - DebugOffset, + EFI_IMAGE_SCN_CNT_INITIALIZED_DATA + | EFI_IMAGE_SCN_MEM_DISCARDABLE + | EFI_IMAGE_SCN_MEM_READ); + + } +} + +STATIC +VOID +SetImageSize32 ( + VOID + ) +{ + EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; + + // + // Set image size + // + NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); + NtHdr->Pe32.OptionalHeader.SizeOfImage = mCoffOffset; +} + +STATIC +VOID +CleanUp32 ( + VOID + ) +{ + if (mCoffSectionsOffset != NULL) { + free (mCoffSectionsOffset); + } +} + + diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.h b/BaseTools/Source/C/GenFw/Elf32Convert.h index 2eafbec258..e6a11d57bc 100644 --- a/BaseTools/Source/C/GenFw/Elf32Convert.h +++ b/BaseTools/Source/C/GenFw/Elf32Convert.h @@ -1,24 +1,24 @@ -/** @file - -Copyright (c) 2010, Intel Corporation. All rights reserved.
- -This program and the accompanying materials are licensed and made available -under the terms and conditions of the BSD License which accompanies this -distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _ELF_32_CONVERT_ -#define _ELF_32_CONVERT_ - -BOOLEAN -InitializeElf32 ( - UINT8 *FileBuffer, - ELF_FUNCTION_TABLE *ElfFunctions - ); - -#endif +/** @file + +Copyright (c) 2010, Intel Corporation. All rights reserved.
+ +This program and the accompanying materials are licensed and made available +under the terms and conditions of the BSD License which accompanies this +distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _ELF_32_CONVERT_ +#define _ELF_32_CONVERT_ + +BOOLEAN +InitializeElf32 ( + UINT8 *FileBuffer, + ELF_FUNCTION_TABLE *ElfFunctions + ); + +#endif diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c index 713f8f7e47..606c7284f7 100644 --- a/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -1,933 +1,933 @@ -/** @file - -Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
-Portions copyright (c) 2013, ARM Ltd. All rights reserved.
- -This program and the accompanying materials are licensed and made available -under the terms and conditions of the BSD License which accompanies this -distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "WinNtInclude.h" - -#ifndef __GNUC__ -#include -#include -#endif -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "PeCoffLib.h" -#include "EfiUtilityMsgs.h" - -#include "GenFw.h" -#include "ElfConvert.h" -#include "Elf64Convert.h" - -STATIC -VOID -ScanSections64 ( - VOID - ); - -STATIC -BOOLEAN -WriteSections64 ( - SECTION_FILTER_TYPES FilterType - ); - -STATIC -VOID -WriteRelocations64 ( - VOID - ); - -STATIC -VOID -WriteDebug64 ( - VOID - ); - -STATIC -VOID -SetImageSize64 ( - VOID - ); - -STATIC -VOID -CleanUp64 ( - VOID - ); - -// -// Rename ELF32 strucutres to common names to help when porting to ELF64. -// -typedef Elf64_Shdr Elf_Shdr; -typedef Elf64_Ehdr Elf_Ehdr; -typedef Elf64_Rel Elf_Rel; -typedef Elf64_Rela Elf_Rela; -typedef Elf64_Sym Elf_Sym; -typedef Elf64_Phdr Elf_Phdr; -typedef Elf64_Dyn Elf_Dyn; -#define ELFCLASS ELFCLASS64 -#define ELF_R_TYPE(r) ELF64_R_TYPE(r) -#define ELF_R_SYM(r) ELF64_R_SYM(r) - -// -// Well known ELF structures. -// -STATIC Elf_Ehdr *mEhdr; -STATIC Elf_Shdr *mShdrBase; -STATIC Elf_Phdr *mPhdrBase; - -// -// Coff information -// -STATIC const UINT32 mCoffAlignment = 0x20; - -// -// PE section alignment. -// -STATIC const UINT16 mCoffNbrSections = 5; - -// -// ELF sections to offset in Coff file. -// -STATIC UINT32 *mCoffSectionsOffset = NULL; - -// -// Offsets in COFF file -// -STATIC UINT32 mNtHdrOffset; -STATIC UINT32 mTextOffset; -STATIC UINT32 mDataOffset; -STATIC UINT32 mHiiRsrcOffset; -STATIC UINT32 mRelocOffset; - -// -// Initialization Function -// -BOOLEAN -InitializeElf64 ( - UINT8 *FileBuffer, - ELF_FUNCTION_TABLE *ElfFunctions - ) -{ - // - // Initialize data pointer and structures. - // - VerboseMsg ("Set EHDR"); - mEhdr = (Elf_Ehdr*) FileBuffer; - - // - // Check the ELF64 specific header information. - // - VerboseMsg ("Check ELF64 Header Information"); - if (mEhdr->e_ident[EI_CLASS] != ELFCLASS64) { - Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFCLASS64"); - return FALSE; - } - if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) { - Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFDATA2LSB"); - return FALSE; - } - if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) { - Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN"); - return FALSE; - } - if (!((mEhdr->e_machine == EM_X86_64) || (mEhdr->e_machine == EM_AARCH64))) { - Error (NULL, 0, 3000, "Unsupported", "ELF e_machine not EM_X86_64 or EM_AARCH64"); - return FALSE; - } - if (mEhdr->e_version != EV_CURRENT) { - Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT); - return FALSE; - } - - // - // Update section header pointers - // - VerboseMsg ("Update Header Pointers"); - mShdrBase = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff); - mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff); - - // - // Create COFF Section offset buffer and zero. - // - VerboseMsg ("Create COFF Section Offset Buffer"); - mCoffSectionsOffset = (UINT32 *)malloc(mEhdr->e_shnum * sizeof (UINT32)); - memset(mCoffSectionsOffset, 0, mEhdr->e_shnum * sizeof(UINT32)); - - // - // Fill in function pointers. - // - VerboseMsg ("Fill in Function Pointers"); - ElfFunctions->ScanSections = ScanSections64; - ElfFunctions->WriteSections = WriteSections64; - ElfFunctions->WriteRelocations = WriteRelocations64; - ElfFunctions->WriteDebug = WriteDebug64; - ElfFunctions->SetImageSize = SetImageSize64; - ElfFunctions->CleanUp = CleanUp64; - - return TRUE; -} - - -// -// Header by Index functions -// -STATIC -Elf_Shdr* -GetShdrByIndex ( - UINT32 Num - ) -{ - if (Num >= mEhdr->e_shnum) - return NULL; - return (Elf_Shdr*)((UINT8*)mShdrBase + Num * mEhdr->e_shentsize); -} - -STATIC -UINT32 -CoffAlign ( - UINT32 Offset - ) -{ - return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1); -} - -// -// filter functions -// -STATIC -BOOLEAN -IsTextShdr ( - Elf_Shdr *Shdr - ) -{ - return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC); -} - -STATIC -BOOLEAN -IsHiiRsrcShdr ( - Elf_Shdr *Shdr - ) -{ - Elf_Shdr *Namedr = GetShdrByIndex(mEhdr->e_shstrndx); - - return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_HII_SECTION_NAME) == 0); -} - -STATIC -BOOLEAN -IsDataShdr ( - Elf_Shdr *Shdr - ) -{ - if (IsHiiRsrcShdr(Shdr)) { - return FALSE; - } - return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE); -} - -// -// Elf functions interface implementation -// - -STATIC -VOID -ScanSections64 ( - VOID - ) -{ - UINT32 i; - EFI_IMAGE_DOS_HEADER *DosHdr; - EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; - UINT32 CoffEntry; - UINT32 SectionCount; - BOOLEAN FoundText; - - CoffEntry = 0; - mCoffOffset = 0; - mTextOffset = 0; - FoundText = FALSE; - - // - // Coff file start with a DOS header. - // - mCoffOffset = sizeof(EFI_IMAGE_DOS_HEADER) + 0x40; - mNtHdrOffset = mCoffOffset; - switch (mEhdr->e_machine) { - case EM_X86_64: - case EM_IA_64: - case EM_AARCH64: - mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS64); - break; - default: - VerboseMsg ("%s unknown e_machine type. Assume X64", (UINTN)mEhdr->e_machine); - mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS64); - break; - } - - mTableOffset = mCoffOffset; - mCoffOffset += mCoffNbrSections * sizeof(EFI_IMAGE_SECTION_HEADER); - - // - // First text sections. - // - mCoffOffset = CoffAlign(mCoffOffset); - SectionCount = 0; - for (i = 0; i < mEhdr->e_shnum; i++) { - Elf_Shdr *shdr = GetShdrByIndex(i); - if (IsTextShdr(shdr)) { - if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { - // the alignment field is valid - if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { - // if the section address is aligned we must align PE/COFF - mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1)); - } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { - // ARM RVCT tools have behavior outside of the ELF specification to try - // and make images smaller. If sh_addr is not aligned to sh_addralign - // then the section needs to preserve sh_addr MOD sh_addralign. - // Normally doing nothing here works great. - Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); - } - } - - /* Relocate entry. */ - if ((mEhdr->e_entry >= shdr->sh_addr) && - (mEhdr->e_entry < shdr->sh_addr + shdr->sh_size)) { - CoffEntry = (UINT32) (mCoffOffset + mEhdr->e_entry - shdr->sh_addr); - } - - // - // Set mTextOffset with the offset of the first '.text' section - // - if (!FoundText) { - mTextOffset = mCoffOffset; - FoundText = TRUE; - } - - mCoffSectionsOffset[i] = mCoffOffset; - mCoffOffset += (UINT32) shdr->sh_size; - SectionCount ++; - } - } - - if (!FoundText) { - Error (NULL, 0, 3000, "Invalid", "Did not find any '.text' section."); - assert (FALSE); - } - - if (mEhdr->e_machine != EM_ARM) { - mCoffOffset = CoffAlign(mCoffOffset); - } - - if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) { - Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 text section. Source level debug might not work correctly.", mInImageName); - } - - // - // Then data sections. - // - mDataOffset = mCoffOffset; - SectionCount = 0; - for (i = 0; i < mEhdr->e_shnum; i++) { - Elf_Shdr *shdr = GetShdrByIndex(i); - if (IsDataShdr(shdr)) { - if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { - // the alignment field is valid - if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { - // if the section address is aligned we must align PE/COFF - mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1)); - } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { - // ARM RVCT tools have behavior outside of the ELF specification to try - // and make images smaller. If sh_addr is not aligned to sh_addralign - // then the section needs to preserve sh_addr MOD sh_addralign. - // Normally doing nothing here works great. - Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); - } - } - mCoffSectionsOffset[i] = mCoffOffset; - mCoffOffset += (UINT32) shdr->sh_size; - SectionCount ++; - } - } - mCoffOffset = CoffAlign(mCoffOffset); - - if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) { - Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 data section. Source level debug might not work correctly.", mInImageName); - } - - // - // The HII resource sections. - // - mHiiRsrcOffset = mCoffOffset; - for (i = 0; i < mEhdr->e_shnum; i++) { - Elf_Shdr *shdr = GetShdrByIndex(i); - if (IsHiiRsrcShdr(shdr)) { - if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { - // the alignment field is valid - if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { - // if the section address is aligned we must align PE/COFF - mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1)); - } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { - // ARM RVCT tools have behavior outside of the ELF specification to try - // and make images smaller. If sh_addr is not aligned to sh_addralign - // then the section needs to preserve sh_addr MOD sh_addralign. - // Normally doing nothing here works great. - Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); - } - } - if (shdr->sh_size != 0) { - mCoffSectionsOffset[i] = mCoffOffset; - mCoffOffset += (UINT32) shdr->sh_size; - mCoffOffset = CoffAlign(mCoffOffset); - SetHiiResourceHeader ((UINT8*) mEhdr + shdr->sh_offset, mHiiRsrcOffset); - } - break; - } - } - - mRelocOffset = mCoffOffset; - - // - // Allocate base Coff file. Will be expanded later for relocations. - // - mCoffFile = (UINT8 *)malloc(mCoffOffset); - memset(mCoffFile, 0, mCoffOffset); - - // - // Fill headers. - // - DosHdr = (EFI_IMAGE_DOS_HEADER *)mCoffFile; - DosHdr->e_magic = EFI_IMAGE_DOS_SIGNATURE; - DosHdr->e_lfanew = mNtHdrOffset; - - NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION*)(mCoffFile + mNtHdrOffset); - - NtHdr->Pe32Plus.Signature = EFI_IMAGE_NT_SIGNATURE; - - switch (mEhdr->e_machine) { - case EM_X86_64: - NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_X64; - NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC; - break; - case EM_IA_64: - NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_IPF; - NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC; - break; - case EM_AARCH64: - NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_AARCH64; - NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC; - break; - default: - VerboseMsg ("%s unknown e_machine type. Assume X64", (UINTN)mEhdr->e_machine); - NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_X64; - NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC; - } - - NtHdr->Pe32Plus.FileHeader.NumberOfSections = mCoffNbrSections; - NtHdr->Pe32Plus.FileHeader.TimeDateStamp = (UINT32) time(NULL); - mImageTimeStamp = NtHdr->Pe32Plus.FileHeader.TimeDateStamp; - NtHdr->Pe32Plus.FileHeader.PointerToSymbolTable = 0; - NtHdr->Pe32Plus.FileHeader.NumberOfSymbols = 0; - NtHdr->Pe32Plus.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32Plus.OptionalHeader); - NtHdr->Pe32Plus.FileHeader.Characteristics = EFI_IMAGE_FILE_EXECUTABLE_IMAGE - | EFI_IMAGE_FILE_LINE_NUMS_STRIPPED - | EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED - | EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE; - - NtHdr->Pe32Plus.OptionalHeader.SizeOfCode = mDataOffset - mTextOffset; - NtHdr->Pe32Plus.OptionalHeader.SizeOfInitializedData = mRelocOffset - mDataOffset; - NtHdr->Pe32Plus.OptionalHeader.SizeOfUninitializedData = 0; - NtHdr->Pe32Plus.OptionalHeader.AddressOfEntryPoint = CoffEntry; - - NtHdr->Pe32Plus.OptionalHeader.BaseOfCode = mTextOffset; - - NtHdr->Pe32Plus.OptionalHeader.ImageBase = 0; - NtHdr->Pe32Plus.OptionalHeader.SectionAlignment = mCoffAlignment; - NtHdr->Pe32Plus.OptionalHeader.FileAlignment = mCoffAlignment; - NtHdr->Pe32Plus.OptionalHeader.SizeOfImage = 0; - - NtHdr->Pe32Plus.OptionalHeader.SizeOfHeaders = mTextOffset; - NtHdr->Pe32Plus.OptionalHeader.NumberOfRvaAndSizes = EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES; - - // - // Section headers. - // - if ((mDataOffset - mTextOffset) > 0) { - CreateSectionHeader (".text", mTextOffset, mDataOffset - mTextOffset, - EFI_IMAGE_SCN_CNT_CODE - | EFI_IMAGE_SCN_MEM_EXECUTE - | EFI_IMAGE_SCN_MEM_READ); - } else { - // Don't make a section of size 0. - NtHdr->Pe32Plus.FileHeader.NumberOfSections--; - } - - if ((mHiiRsrcOffset - mDataOffset) > 0) { - CreateSectionHeader (".data", mDataOffset, mHiiRsrcOffset - mDataOffset, - EFI_IMAGE_SCN_CNT_INITIALIZED_DATA - | EFI_IMAGE_SCN_MEM_WRITE - | EFI_IMAGE_SCN_MEM_READ); - } else { - // Don't make a section of size 0. - NtHdr->Pe32Plus.FileHeader.NumberOfSections--; - } - - if ((mRelocOffset - mHiiRsrcOffset) > 0) { - CreateSectionHeader (".rsrc", mHiiRsrcOffset, mRelocOffset - mHiiRsrcOffset, - EFI_IMAGE_SCN_CNT_INITIALIZED_DATA - | EFI_IMAGE_SCN_MEM_READ); - - NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = mRelocOffset - mHiiRsrcOffset; - NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = mHiiRsrcOffset; - } else { - // Don't make a section of size 0. - NtHdr->Pe32Plus.FileHeader.NumberOfSections--; - } - -} - -STATIC -BOOLEAN -WriteSections64 ( - SECTION_FILTER_TYPES FilterType - ) -{ - UINT32 Idx; - Elf_Shdr *SecShdr; - UINT32 SecOffset; - BOOLEAN (*Filter)(Elf_Shdr *); - - // - // Initialize filter pointer - // - switch (FilterType) { - case SECTION_TEXT: - Filter = IsTextShdr; - break; - case SECTION_HII: - Filter = IsHiiRsrcShdr; - break; - case SECTION_DATA: - Filter = IsDataShdr; - break; - default: - return FALSE; - } - - // - // First: copy sections. - // - for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) { - Elf_Shdr *Shdr = GetShdrByIndex(Idx); - if ((*Filter)(Shdr)) { - switch (Shdr->sh_type) { - case SHT_PROGBITS: - /* Copy. */ - memcpy(mCoffFile + mCoffSectionsOffset[Idx], - (UINT8*)mEhdr + Shdr->sh_offset, - (size_t) Shdr->sh_size); - break; - - case SHT_NOBITS: - memset(mCoffFile + mCoffSectionsOffset[Idx], 0, (size_t) Shdr->sh_size); - break; - - default: - // - // Ignore for unkown section type. - // - VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (unsigned)Shdr->sh_type); - break; - } - } - } - - // - // Second: apply relocations. - // - VerboseMsg ("Applying Relocations..."); - for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) { - // - // Determine if this is a relocation section. - // - Elf_Shdr *RelShdr = GetShdrByIndex(Idx); - if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) { - continue; - } - - // - // Relocation section found. Now extract section information that the relocations - // apply to in the ELF data and the new COFF data. - // - SecShdr = GetShdrByIndex(RelShdr->sh_info); - SecOffset = mCoffSectionsOffset[RelShdr->sh_info]; - - // - // Only process relocations for the current filter type. - // - if (RelShdr->sh_type == SHT_RELA && (*Filter)(SecShdr)) { - UINT64 RelIdx; - - // - // Determine the symbol table referenced by the relocation data. - // - Elf_Shdr *SymtabShdr = GetShdrByIndex(RelShdr->sh_link); - UINT8 *Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset; - - // - // Process all relocation entries for this section. - // - for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += (UINT32) RelShdr->sh_entsize) { - - // - // Set pointer to relocation entry - // - Elf_Rela *Rel = (Elf_Rela *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx); - - // - // Set pointer to symbol table entry associated with the relocation entry. - // - Elf_Sym *Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize); - - Elf_Shdr *SymShdr; - UINT8 *Targ; - - // - // Check section header index found in symbol table and get the section - // header location. - // - if (Sym->st_shndx == SHN_UNDEF - || Sym->st_shndx == SHN_ABS - || Sym->st_shndx > mEhdr->e_shnum) { - Error (NULL, 0, 3000, "Invalid", "%s bad symbol definition.", mInImageName); - } - SymShdr = GetShdrByIndex(Sym->st_shndx); - - // - // Convert the relocation data to a pointer into the coff file. - // - // Note: - // r_offset is the virtual address of the storage unit to be relocated. - // sh_addr is the virtual address for the base of the section. - // - // r_offset in a memory address. - // Convert it to a pointer in the coff file. - // - Targ = mCoffFile + SecOffset + (Rel->r_offset - SecShdr->sh_addr); - - // - // Determine how to handle each relocation type based on the machine type. - // - if (mEhdr->e_machine == EM_X86_64) { - switch (ELF_R_TYPE(Rel->r_info)) { - case R_X86_64_NONE: - break; - case R_X86_64_64: - // - // Absolute relocation. - // - VerboseMsg ("R_X86_64_64"); - VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX", - (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), - *(UINT64 *)Targ); - *(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]; - VerboseMsg ("Relocation: 0x%016LX", *(UINT64*)Targ); - break; - case R_X86_64_32: - VerboseMsg ("R_X86_64_32"); - VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", - (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), - *(UINT32 *)Targ); - *(UINT32 *)Targ = (UINT32)((UINT64)(*(UINT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]); - VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ); - break; - case R_X86_64_32S: - VerboseMsg ("R_X86_64_32S"); - VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", - (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), - *(UINT32 *)Targ); - *(INT32 *)Targ = (INT32)((INT64)(*(INT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]); - VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ); - break; - case R_X86_64_PC32: - // - // Relative relocation: Symbol - Ip + Addend - // - VerboseMsg ("R_X86_64_PC32"); - VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", - (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), - *(UINT32 *)Targ); - *(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ - + (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr) - - (SecOffset - SecShdr->sh_addr)); - VerboseMsg ("Relocation: 0x%08X", *(UINT32 *)Targ); - break; - default: - Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_X86_64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); - } - } else if (mEhdr->e_machine == EM_AARCH64) { - - // AARCH64 GCC uses RELA relocation, so all relocations have to be fixed up. - // As opposed to ARM32 using REL. - - switch (ELF_R_TYPE(Rel->r_info)) { - - case R_AARCH64_LD_PREL_LO19: - if (Rel->r_addend != 0 ) { /* TODO */ - Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_LD_PREL_LO19 Need to fixup with addend!."); - } - break; - - case R_AARCH64_CALL26: - if (Rel->r_addend != 0 ) { /* TODO */ - Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_CALL26 Need to fixup with addend!."); - } - break; - - case R_AARCH64_JUMP26: - if (Rel->r_addend != 0 ) { /* TODO : AArch64 '-O2' optimisation. */ - Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_JUMP26 Need to fixup with addend!."); - } - break; - - case R_AARCH64_ADR_PREL_PG_HI21: - // TODO : AArch64 'small' memory model. - Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADR_PREL_PG_HI21.", mInImageName); - break; - - case R_AARCH64_ADD_ABS_LO12_NC: - // TODO : AArch64 'small' memory model. - Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADD_ABS_LO12_NC.", mInImageName); - break; - - // Absolute relocations. - case R_AARCH64_ABS64: - *(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]; - break; - - default: - Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_AARCH64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); - } - } else { - Error (NULL, 0, 3000, "Invalid", "Not a supported machine type"); - } - } - } - } - - return TRUE; -} - -STATIC -VOID -WriteRelocations64 ( - VOID - ) -{ - UINT32 Index; - EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; - EFI_IMAGE_DATA_DIRECTORY *Dir; - - for (Index = 0; Index < mEhdr->e_shnum; Index++) { - Elf_Shdr *RelShdr = GetShdrByIndex(Index); - if ((RelShdr->sh_type == SHT_REL) || (RelShdr->sh_type == SHT_RELA)) { - Elf_Shdr *SecShdr = GetShdrByIndex (RelShdr->sh_info); - if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) { - UINT64 RelIdx; - - for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) { - Elf_Rela *Rel = (Elf_Rela *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx); - - if (mEhdr->e_machine == EM_X86_64) { - switch (ELF_R_TYPE(Rel->r_info)) { - case R_X86_64_NONE: - case R_X86_64_PC32: - break; - case R_X86_64_64: - VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X", - mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr)); - CoffAddFixup( - (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info] - + (Rel->r_offset - SecShdr->sh_addr)), - EFI_IMAGE_REL_BASED_DIR64); - break; - case R_X86_64_32S: - case R_X86_64_32: - VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X", - mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr)); - CoffAddFixup( - (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info] - + (Rel->r_offset - SecShdr->sh_addr)), - EFI_IMAGE_REL_BASED_HIGHLOW); - break; - default: - Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_X86_64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); - } - } else if (mEhdr->e_machine == EM_AARCH64) { - // AArch64 GCC uses RELA relocation, so all relocations has to be fixed up. ARM32 uses REL. - switch (ELF_R_TYPE(Rel->r_info)) { - case R_AARCH64_LD_PREL_LO19: - break; - - case R_AARCH64_CALL26: - break; - - case R_AARCH64_JUMP26: - break; - - case R_AARCH64_ADR_PREL_PG_HI21: - // TODO : AArch64 'small' memory model. - Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADR_PREL_PG_HI21.", mInImageName); - break; - - case R_AARCH64_ADD_ABS_LO12_NC: - // TODO : AArch64 'small' memory model. - Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADD_ABS_LO12_NC.", mInImageName); - break; - - case R_AARCH64_ABS64: - CoffAddFixup( - (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info] - + (Rel->r_offset - SecShdr->sh_addr)), - EFI_IMAGE_REL_BASED_DIR64); - break; - - case R_AARCH64_ABS32: - CoffAddFixup( - (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info] - + (Rel->r_offset - SecShdr->sh_addr)), - EFI_IMAGE_REL_BASED_HIGHLOW); - break; - - default: - Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_AARCH64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); - } - } else { - Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) mEhdr->e_machine); - } - } - } - } - } - - // - // Pad by adding empty entries. - // - while (mCoffOffset & (mCoffAlignment - 1)) { - CoffAddFixupEntry(0); - } - - NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); - Dir = &NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC]; - Dir->Size = mCoffOffset - mRelocOffset; - if (Dir->Size == 0) { - // If no relocations, null out the directory entry and don't add the .reloc section - Dir->VirtualAddress = 0; - NtHdr->Pe32Plus.FileHeader.NumberOfSections--; - } else { - Dir->VirtualAddress = mRelocOffset; - CreateSectionHeader (".reloc", mRelocOffset, mCoffOffset - mRelocOffset, - EFI_IMAGE_SCN_CNT_INITIALIZED_DATA - | EFI_IMAGE_SCN_MEM_DISCARDABLE - | EFI_IMAGE_SCN_MEM_READ); - } -} - -STATIC -VOID -WriteDebug64 ( - VOID - ) -{ - UINT32 Len; - UINT32 DebugOffset; - EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; - EFI_IMAGE_DATA_DIRECTORY *DataDir; - EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir; - EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10; - - Len = strlen(mInImageName) + 1; - DebugOffset = mCoffOffset; - - mCoffOffset += sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) - + sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) - + Len; - mCoffOffset = CoffAlign(mCoffOffset); - - mCoffFile = realloc(mCoffFile, mCoffOffset); - memset(mCoffFile + DebugOffset, 0, mCoffOffset - DebugOffset); - - Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(mCoffFile + DebugOffset); - Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW; - Dir->SizeOfData = sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + Len; - Dir->RVA = DebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); - Dir->FileOffset = DebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); - - Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1); - Nb10->Signature = CODEVIEW_SIGNATURE_NB10; - strcpy ((char *)(Nb10 + 1), mInImageName); - - - NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); - DataDir = &NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]; - DataDir->VirtualAddress = DebugOffset; - DataDir->Size = mCoffOffset - DebugOffset; - if (DataDir->Size == 0) { - // If no debug, null out the directory entry and don't add the .debug section - DataDir->VirtualAddress = 0; - NtHdr->Pe32Plus.FileHeader.NumberOfSections--; - } else { - DataDir->VirtualAddress = DebugOffset; - CreateSectionHeader (".debug", DebugOffset, mCoffOffset - DebugOffset, - EFI_IMAGE_SCN_CNT_INITIALIZED_DATA - | EFI_IMAGE_SCN_MEM_DISCARDABLE - | EFI_IMAGE_SCN_MEM_READ); - - } -} - -STATIC -VOID -SetImageSize64 ( - VOID - ) -{ - EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; - - // - // Set image size - // - NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); - NtHdr->Pe32Plus.OptionalHeader.SizeOfImage = mCoffOffset; -} - -STATIC -VOID -CleanUp64 ( - VOID - ) -{ - if (mCoffSectionsOffset != NULL) { - free (mCoffSectionsOffset); - } -} - - +/** @file + +Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+Portions copyright (c) 2013, ARM Ltd. All rights reserved.
+ +This program and the accompanying materials are licensed and made available +under the terms and conditions of the BSD License which accompanies this +distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "WinNtInclude.h" + +#ifndef __GNUC__ +#include +#include +#endif +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "PeCoffLib.h" +#include "EfiUtilityMsgs.h" + +#include "GenFw.h" +#include "ElfConvert.h" +#include "Elf64Convert.h" + +STATIC +VOID +ScanSections64 ( + VOID + ); + +STATIC +BOOLEAN +WriteSections64 ( + SECTION_FILTER_TYPES FilterType + ); + +STATIC +VOID +WriteRelocations64 ( + VOID + ); + +STATIC +VOID +WriteDebug64 ( + VOID + ); + +STATIC +VOID +SetImageSize64 ( + VOID + ); + +STATIC +VOID +CleanUp64 ( + VOID + ); + +// +// Rename ELF32 strucutres to common names to help when porting to ELF64. +// +typedef Elf64_Shdr Elf_Shdr; +typedef Elf64_Ehdr Elf_Ehdr; +typedef Elf64_Rel Elf_Rel; +typedef Elf64_Rela Elf_Rela; +typedef Elf64_Sym Elf_Sym; +typedef Elf64_Phdr Elf_Phdr; +typedef Elf64_Dyn Elf_Dyn; +#define ELFCLASS ELFCLASS64 +#define ELF_R_TYPE(r) ELF64_R_TYPE(r) +#define ELF_R_SYM(r) ELF64_R_SYM(r) + +// +// Well known ELF structures. +// +STATIC Elf_Ehdr *mEhdr; +STATIC Elf_Shdr *mShdrBase; +STATIC Elf_Phdr *mPhdrBase; + +// +// Coff information +// +STATIC const UINT32 mCoffAlignment = 0x20; + +// +// PE section alignment. +// +STATIC const UINT16 mCoffNbrSections = 5; + +// +// ELF sections to offset in Coff file. +// +STATIC UINT32 *mCoffSectionsOffset = NULL; + +// +// Offsets in COFF file +// +STATIC UINT32 mNtHdrOffset; +STATIC UINT32 mTextOffset; +STATIC UINT32 mDataOffset; +STATIC UINT32 mHiiRsrcOffset; +STATIC UINT32 mRelocOffset; + +// +// Initialization Function +// +BOOLEAN +InitializeElf64 ( + UINT8 *FileBuffer, + ELF_FUNCTION_TABLE *ElfFunctions + ) +{ + // + // Initialize data pointer and structures. + // + VerboseMsg ("Set EHDR"); + mEhdr = (Elf_Ehdr*) FileBuffer; + + // + // Check the ELF64 specific header information. + // + VerboseMsg ("Check ELF64 Header Information"); + if (mEhdr->e_ident[EI_CLASS] != ELFCLASS64) { + Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFCLASS64"); + return FALSE; + } + if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) { + Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFDATA2LSB"); + return FALSE; + } + if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) { + Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN"); + return FALSE; + } + if (!((mEhdr->e_machine == EM_X86_64) || (mEhdr->e_machine == EM_AARCH64))) { + Error (NULL, 0, 3000, "Unsupported", "ELF e_machine not EM_X86_64 or EM_AARCH64"); + return FALSE; + } + if (mEhdr->e_version != EV_CURRENT) { + Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT); + return FALSE; + } + + // + // Update section header pointers + // + VerboseMsg ("Update Header Pointers"); + mShdrBase = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff); + mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff); + + // + // Create COFF Section offset buffer and zero. + // + VerboseMsg ("Create COFF Section Offset Buffer"); + mCoffSectionsOffset = (UINT32 *)malloc(mEhdr->e_shnum * sizeof (UINT32)); + memset(mCoffSectionsOffset, 0, mEhdr->e_shnum * sizeof(UINT32)); + + // + // Fill in function pointers. + // + VerboseMsg ("Fill in Function Pointers"); + ElfFunctions->ScanSections = ScanSections64; + ElfFunctions->WriteSections = WriteSections64; + ElfFunctions->WriteRelocations = WriteRelocations64; + ElfFunctions->WriteDebug = WriteDebug64; + ElfFunctions->SetImageSize = SetImageSize64; + ElfFunctions->CleanUp = CleanUp64; + + return TRUE; +} + + +// +// Header by Index functions +// +STATIC +Elf_Shdr* +GetShdrByIndex ( + UINT32 Num + ) +{ + if (Num >= mEhdr->e_shnum) + return NULL; + return (Elf_Shdr*)((UINT8*)mShdrBase + Num * mEhdr->e_shentsize); +} + +STATIC +UINT32 +CoffAlign ( + UINT32 Offset + ) +{ + return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1); +} + +// +// filter functions +// +STATIC +BOOLEAN +IsTextShdr ( + Elf_Shdr *Shdr + ) +{ + return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC); +} + +STATIC +BOOLEAN +IsHiiRsrcShdr ( + Elf_Shdr *Shdr + ) +{ + Elf_Shdr *Namedr = GetShdrByIndex(mEhdr->e_shstrndx); + + return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_HII_SECTION_NAME) == 0); +} + +STATIC +BOOLEAN +IsDataShdr ( + Elf_Shdr *Shdr + ) +{ + if (IsHiiRsrcShdr(Shdr)) { + return FALSE; + } + return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE); +} + +// +// Elf functions interface implementation +// + +STATIC +VOID +ScanSections64 ( + VOID + ) +{ + UINT32 i; + EFI_IMAGE_DOS_HEADER *DosHdr; + EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; + UINT32 CoffEntry; + UINT32 SectionCount; + BOOLEAN FoundText; + + CoffEntry = 0; + mCoffOffset = 0; + mTextOffset = 0; + FoundText = FALSE; + + // + // Coff file start with a DOS header. + // + mCoffOffset = sizeof(EFI_IMAGE_DOS_HEADER) + 0x40; + mNtHdrOffset = mCoffOffset; + switch (mEhdr->e_machine) { + case EM_X86_64: + case EM_IA_64: + case EM_AARCH64: + mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS64); + break; + default: + VerboseMsg ("%s unknown e_machine type. Assume X64", (UINTN)mEhdr->e_machine); + mCoffOffset += sizeof (EFI_IMAGE_NT_HEADERS64); + break; + } + + mTableOffset = mCoffOffset; + mCoffOffset += mCoffNbrSections * sizeof(EFI_IMAGE_SECTION_HEADER); + + // + // First text sections. + // + mCoffOffset = CoffAlign(mCoffOffset); + SectionCount = 0; + for (i = 0; i < mEhdr->e_shnum; i++) { + Elf_Shdr *shdr = GetShdrByIndex(i); + if (IsTextShdr(shdr)) { + if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { + // the alignment field is valid + if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { + // if the section address is aligned we must align PE/COFF + mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1)); + } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { + // ARM RVCT tools have behavior outside of the ELF specification to try + // and make images smaller. If sh_addr is not aligned to sh_addralign + // then the section needs to preserve sh_addr MOD sh_addralign. + // Normally doing nothing here works great. + Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); + } + } + + /* Relocate entry. */ + if ((mEhdr->e_entry >= shdr->sh_addr) && + (mEhdr->e_entry < shdr->sh_addr + shdr->sh_size)) { + CoffEntry = (UINT32) (mCoffOffset + mEhdr->e_entry - shdr->sh_addr); + } + + // + // Set mTextOffset with the offset of the first '.text' section + // + if (!FoundText) { + mTextOffset = mCoffOffset; + FoundText = TRUE; + } + + mCoffSectionsOffset[i] = mCoffOffset; + mCoffOffset += (UINT32) shdr->sh_size; + SectionCount ++; + } + } + + if (!FoundText) { + Error (NULL, 0, 3000, "Invalid", "Did not find any '.text' section."); + assert (FALSE); + } + + if (mEhdr->e_machine != EM_ARM) { + mCoffOffset = CoffAlign(mCoffOffset); + } + + if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) { + Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 text section. Source level debug might not work correctly.", mInImageName); + } + + // + // Then data sections. + // + mDataOffset = mCoffOffset; + SectionCount = 0; + for (i = 0; i < mEhdr->e_shnum; i++) { + Elf_Shdr *shdr = GetShdrByIndex(i); + if (IsDataShdr(shdr)) { + if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { + // the alignment field is valid + if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { + // if the section address is aligned we must align PE/COFF + mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1)); + } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { + // ARM RVCT tools have behavior outside of the ELF specification to try + // and make images smaller. If sh_addr is not aligned to sh_addralign + // then the section needs to preserve sh_addr MOD sh_addralign. + // Normally doing nothing here works great. + Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); + } + } + mCoffSectionsOffset[i] = mCoffOffset; + mCoffOffset += (UINT32) shdr->sh_size; + SectionCount ++; + } + } + mCoffOffset = CoffAlign(mCoffOffset); + + if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) { + Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 data section. Source level debug might not work correctly.", mInImageName); + } + + // + // The HII resource sections. + // + mHiiRsrcOffset = mCoffOffset; + for (i = 0; i < mEhdr->e_shnum; i++) { + Elf_Shdr *shdr = GetShdrByIndex(i); + if (IsHiiRsrcShdr(shdr)) { + if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) { + // the alignment field is valid + if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) { + // if the section address is aligned we must align PE/COFF + mCoffOffset = (UINT32) ((mCoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1)); + } else if ((shdr->sh_addr % shdr->sh_addralign) != (mCoffOffset % shdr->sh_addralign)) { + // ARM RVCT tools have behavior outside of the ELF specification to try + // and make images smaller. If sh_addr is not aligned to sh_addralign + // then the section needs to preserve sh_addr MOD sh_addralign. + // Normally doing nothing here works great. + Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment."); + } + } + if (shdr->sh_size != 0) { + mCoffSectionsOffset[i] = mCoffOffset; + mCoffOffset += (UINT32) shdr->sh_size; + mCoffOffset = CoffAlign(mCoffOffset); + SetHiiResourceHeader ((UINT8*) mEhdr + shdr->sh_offset, mHiiRsrcOffset); + } + break; + } + } + + mRelocOffset = mCoffOffset; + + // + // Allocate base Coff file. Will be expanded later for relocations. + // + mCoffFile = (UINT8 *)malloc(mCoffOffset); + memset(mCoffFile, 0, mCoffOffset); + + // + // Fill headers. + // + DosHdr = (EFI_IMAGE_DOS_HEADER *)mCoffFile; + DosHdr->e_magic = EFI_IMAGE_DOS_SIGNATURE; + DosHdr->e_lfanew = mNtHdrOffset; + + NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION*)(mCoffFile + mNtHdrOffset); + + NtHdr->Pe32Plus.Signature = EFI_IMAGE_NT_SIGNATURE; + + switch (mEhdr->e_machine) { + case EM_X86_64: + NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_X64; + NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC; + break; + case EM_IA_64: + NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_IPF; + NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC; + break; + case EM_AARCH64: + NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_AARCH64; + NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC; + break; + default: + VerboseMsg ("%s unknown e_machine type. Assume X64", (UINTN)mEhdr->e_machine); + NtHdr->Pe32Plus.FileHeader.Machine = EFI_IMAGE_MACHINE_X64; + NtHdr->Pe32Plus.OptionalHeader.Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC; + } + + NtHdr->Pe32Plus.FileHeader.NumberOfSections = mCoffNbrSections; + NtHdr->Pe32Plus.FileHeader.TimeDateStamp = (UINT32) time(NULL); + mImageTimeStamp = NtHdr->Pe32Plus.FileHeader.TimeDateStamp; + NtHdr->Pe32Plus.FileHeader.PointerToSymbolTable = 0; + NtHdr->Pe32Plus.FileHeader.NumberOfSymbols = 0; + NtHdr->Pe32Plus.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32Plus.OptionalHeader); + NtHdr->Pe32Plus.FileHeader.Characteristics = EFI_IMAGE_FILE_EXECUTABLE_IMAGE + | EFI_IMAGE_FILE_LINE_NUMS_STRIPPED + | EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED + | EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE; + + NtHdr->Pe32Plus.OptionalHeader.SizeOfCode = mDataOffset - mTextOffset; + NtHdr->Pe32Plus.OptionalHeader.SizeOfInitializedData = mRelocOffset - mDataOffset; + NtHdr->Pe32Plus.OptionalHeader.SizeOfUninitializedData = 0; + NtHdr->Pe32Plus.OptionalHeader.AddressOfEntryPoint = CoffEntry; + + NtHdr->Pe32Plus.OptionalHeader.BaseOfCode = mTextOffset; + + NtHdr->Pe32Plus.OptionalHeader.ImageBase = 0; + NtHdr->Pe32Plus.OptionalHeader.SectionAlignment = mCoffAlignment; + NtHdr->Pe32Plus.OptionalHeader.FileAlignment = mCoffAlignment; + NtHdr->Pe32Plus.OptionalHeader.SizeOfImage = 0; + + NtHdr->Pe32Plus.OptionalHeader.SizeOfHeaders = mTextOffset; + NtHdr->Pe32Plus.OptionalHeader.NumberOfRvaAndSizes = EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES; + + // + // Section headers. + // + if ((mDataOffset - mTextOffset) > 0) { + CreateSectionHeader (".text", mTextOffset, mDataOffset - mTextOffset, + EFI_IMAGE_SCN_CNT_CODE + | EFI_IMAGE_SCN_MEM_EXECUTE + | EFI_IMAGE_SCN_MEM_READ); + } else { + // Don't make a section of size 0. + NtHdr->Pe32Plus.FileHeader.NumberOfSections--; + } + + if ((mHiiRsrcOffset - mDataOffset) > 0) { + CreateSectionHeader (".data", mDataOffset, mHiiRsrcOffset - mDataOffset, + EFI_IMAGE_SCN_CNT_INITIALIZED_DATA + | EFI_IMAGE_SCN_MEM_WRITE + | EFI_IMAGE_SCN_MEM_READ); + } else { + // Don't make a section of size 0. + NtHdr->Pe32Plus.FileHeader.NumberOfSections--; + } + + if ((mRelocOffset - mHiiRsrcOffset) > 0) { + CreateSectionHeader (".rsrc", mHiiRsrcOffset, mRelocOffset - mHiiRsrcOffset, + EFI_IMAGE_SCN_CNT_INITIALIZED_DATA + | EFI_IMAGE_SCN_MEM_READ); + + NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = mRelocOffset - mHiiRsrcOffset; + NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = mHiiRsrcOffset; + } else { + // Don't make a section of size 0. + NtHdr->Pe32Plus.FileHeader.NumberOfSections--; + } + +} + +STATIC +BOOLEAN +WriteSections64 ( + SECTION_FILTER_TYPES FilterType + ) +{ + UINT32 Idx; + Elf_Shdr *SecShdr; + UINT32 SecOffset; + BOOLEAN (*Filter)(Elf_Shdr *); + + // + // Initialize filter pointer + // + switch (FilterType) { + case SECTION_TEXT: + Filter = IsTextShdr; + break; + case SECTION_HII: + Filter = IsHiiRsrcShdr; + break; + case SECTION_DATA: + Filter = IsDataShdr; + break; + default: + return FALSE; + } + + // + // First: copy sections. + // + for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) { + Elf_Shdr *Shdr = GetShdrByIndex(Idx); + if ((*Filter)(Shdr)) { + switch (Shdr->sh_type) { + case SHT_PROGBITS: + /* Copy. */ + memcpy(mCoffFile + mCoffSectionsOffset[Idx], + (UINT8*)mEhdr + Shdr->sh_offset, + (size_t) Shdr->sh_size); + break; + + case SHT_NOBITS: + memset(mCoffFile + mCoffSectionsOffset[Idx], 0, (size_t) Shdr->sh_size); + break; + + default: + // + // Ignore for unkown section type. + // + VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (unsigned)Shdr->sh_type); + break; + } + } + } + + // + // Second: apply relocations. + // + VerboseMsg ("Applying Relocations..."); + for (Idx = 0; Idx < mEhdr->e_shnum; Idx++) { + // + // Determine if this is a relocation section. + // + Elf_Shdr *RelShdr = GetShdrByIndex(Idx); + if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) { + continue; + } + + // + // Relocation section found. Now extract section information that the relocations + // apply to in the ELF data and the new COFF data. + // + SecShdr = GetShdrByIndex(RelShdr->sh_info); + SecOffset = mCoffSectionsOffset[RelShdr->sh_info]; + + // + // Only process relocations for the current filter type. + // + if (RelShdr->sh_type == SHT_RELA && (*Filter)(SecShdr)) { + UINT64 RelIdx; + + // + // Determine the symbol table referenced by the relocation data. + // + Elf_Shdr *SymtabShdr = GetShdrByIndex(RelShdr->sh_link); + UINT8 *Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset; + + // + // Process all relocation entries for this section. + // + for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += (UINT32) RelShdr->sh_entsize) { + + // + // Set pointer to relocation entry + // + Elf_Rela *Rel = (Elf_Rela *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx); + + // + // Set pointer to symbol table entry associated with the relocation entry. + // + Elf_Sym *Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize); + + Elf_Shdr *SymShdr; + UINT8 *Targ; + + // + // Check section header index found in symbol table and get the section + // header location. + // + if (Sym->st_shndx == SHN_UNDEF + || Sym->st_shndx == SHN_ABS + || Sym->st_shndx > mEhdr->e_shnum) { + Error (NULL, 0, 3000, "Invalid", "%s bad symbol definition.", mInImageName); + } + SymShdr = GetShdrByIndex(Sym->st_shndx); + + // + // Convert the relocation data to a pointer into the coff file. + // + // Note: + // r_offset is the virtual address of the storage unit to be relocated. + // sh_addr is the virtual address for the base of the section. + // + // r_offset in a memory address. + // Convert it to a pointer in the coff file. + // + Targ = mCoffFile + SecOffset + (Rel->r_offset - SecShdr->sh_addr); + + // + // Determine how to handle each relocation type based on the machine type. + // + if (mEhdr->e_machine == EM_X86_64) { + switch (ELF_R_TYPE(Rel->r_info)) { + case R_X86_64_NONE: + break; + case R_X86_64_64: + // + // Absolute relocation. + // + VerboseMsg ("R_X86_64_64"); + VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX", + (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), + *(UINT64 *)Targ); + *(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]; + VerboseMsg ("Relocation: 0x%016LX", *(UINT64*)Targ); + break; + case R_X86_64_32: + VerboseMsg ("R_X86_64_32"); + VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", + (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), + *(UINT32 *)Targ); + *(UINT32 *)Targ = (UINT32)((UINT64)(*(UINT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]); + VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ); + break; + case R_X86_64_32S: + VerboseMsg ("R_X86_64_32S"); + VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", + (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), + *(UINT32 *)Targ); + *(INT32 *)Targ = (INT32)((INT64)(*(INT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]); + VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ); + break; + case R_X86_64_PC32: + // + // Relative relocation: Symbol - Ip + Addend + // + VerboseMsg ("R_X86_64_PC32"); + VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", + (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), + *(UINT32 *)Targ); + *(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ + + (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr) + - (SecOffset - SecShdr->sh_addr)); + VerboseMsg ("Relocation: 0x%08X", *(UINT32 *)Targ); + break; + default: + Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_X86_64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); + } + } else if (mEhdr->e_machine == EM_AARCH64) { + + // AARCH64 GCC uses RELA relocation, so all relocations have to be fixed up. + // As opposed to ARM32 using REL. + + switch (ELF_R_TYPE(Rel->r_info)) { + + case R_AARCH64_LD_PREL_LO19: + if (Rel->r_addend != 0 ) { /* TODO */ + Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_LD_PREL_LO19 Need to fixup with addend!."); + } + break; + + case R_AARCH64_CALL26: + if (Rel->r_addend != 0 ) { /* TODO */ + Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_CALL26 Need to fixup with addend!."); + } + break; + + case R_AARCH64_JUMP26: + if (Rel->r_addend != 0 ) { /* TODO : AArch64 '-O2' optimisation. */ + Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_JUMP26 Need to fixup with addend!."); + } + break; + + case R_AARCH64_ADR_PREL_PG_HI21: + // TODO : AArch64 'small' memory model. + Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADR_PREL_PG_HI21.", mInImageName); + break; + + case R_AARCH64_ADD_ABS_LO12_NC: + // TODO : AArch64 'small' memory model. + Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADD_ABS_LO12_NC.", mInImageName); + break; + + // Absolute relocations. + case R_AARCH64_ABS64: + *(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]; + break; + + default: + Error (NULL, 0, 3000, "Invalid", "WriteSections64(): %s unsupported ELF EM_AARCH64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); + } + } else { + Error (NULL, 0, 3000, "Invalid", "Not a supported machine type"); + } + } + } + } + + return TRUE; +} + +STATIC +VOID +WriteRelocations64 ( + VOID + ) +{ + UINT32 Index; + EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; + EFI_IMAGE_DATA_DIRECTORY *Dir; + + for (Index = 0; Index < mEhdr->e_shnum; Index++) { + Elf_Shdr *RelShdr = GetShdrByIndex(Index); + if ((RelShdr->sh_type == SHT_REL) || (RelShdr->sh_type == SHT_RELA)) { + Elf_Shdr *SecShdr = GetShdrByIndex (RelShdr->sh_info); + if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) { + UINT64 RelIdx; + + for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) { + Elf_Rela *Rel = (Elf_Rela *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx); + + if (mEhdr->e_machine == EM_X86_64) { + switch (ELF_R_TYPE(Rel->r_info)) { + case R_X86_64_NONE: + case R_X86_64_PC32: + break; + case R_X86_64_64: + VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X", + mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr)); + CoffAddFixup( + (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info] + + (Rel->r_offset - SecShdr->sh_addr)), + EFI_IMAGE_REL_BASED_DIR64); + break; + case R_X86_64_32S: + case R_X86_64_32: + VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X", + mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr)); + CoffAddFixup( + (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info] + + (Rel->r_offset - SecShdr->sh_addr)), + EFI_IMAGE_REL_BASED_HIGHLOW); + break; + default: + Error (NULL, 0, 3000, "Invalid", "%s unsupported ELF EM_X86_64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); + } + } else if (mEhdr->e_machine == EM_AARCH64) { + // AArch64 GCC uses RELA relocation, so all relocations has to be fixed up. ARM32 uses REL. + switch (ELF_R_TYPE(Rel->r_info)) { + case R_AARCH64_LD_PREL_LO19: + break; + + case R_AARCH64_CALL26: + break; + + case R_AARCH64_JUMP26: + break; + + case R_AARCH64_ADR_PREL_PG_HI21: + // TODO : AArch64 'small' memory model. + Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADR_PREL_PG_HI21.", mInImageName); + break; + + case R_AARCH64_ADD_ABS_LO12_NC: + // TODO : AArch64 'small' memory model. + Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_AARCH64 relocation R_AARCH64_ADD_ABS_LO12_NC.", mInImageName); + break; + + case R_AARCH64_ABS64: + CoffAddFixup( + (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info] + + (Rel->r_offset - SecShdr->sh_addr)), + EFI_IMAGE_REL_BASED_DIR64); + break; + + case R_AARCH64_ABS32: + CoffAddFixup( + (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info] + + (Rel->r_offset - SecShdr->sh_addr)), + EFI_IMAGE_REL_BASED_HIGHLOW); + break; + + default: + Error (NULL, 0, 3000, "Invalid", "WriteRelocations64(): %s unsupported ELF EM_AARCH64 relocation 0x%x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info)); + } + } else { + Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) mEhdr->e_machine); + } + } + } + } + } + + // + // Pad by adding empty entries. + // + while (mCoffOffset & (mCoffAlignment - 1)) { + CoffAddFixupEntry(0); + } + + NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); + Dir = &NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC]; + Dir->Size = mCoffOffset - mRelocOffset; + if (Dir->Size == 0) { + // If no relocations, null out the directory entry and don't add the .reloc section + Dir->VirtualAddress = 0; + NtHdr->Pe32Plus.FileHeader.NumberOfSections--; + } else { + Dir->VirtualAddress = mRelocOffset; + CreateSectionHeader (".reloc", mRelocOffset, mCoffOffset - mRelocOffset, + EFI_IMAGE_SCN_CNT_INITIALIZED_DATA + | EFI_IMAGE_SCN_MEM_DISCARDABLE + | EFI_IMAGE_SCN_MEM_READ); + } +} + +STATIC +VOID +WriteDebug64 ( + VOID + ) +{ + UINT32 Len; + UINT32 DebugOffset; + EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; + EFI_IMAGE_DATA_DIRECTORY *DataDir; + EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir; + EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10; + + Len = strlen(mInImageName) + 1; + DebugOffset = mCoffOffset; + + mCoffOffset += sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) + + sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + + Len; + mCoffOffset = CoffAlign(mCoffOffset); + + mCoffFile = realloc(mCoffFile, mCoffOffset); + memset(mCoffFile + DebugOffset, 0, mCoffOffset - DebugOffset); + + Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(mCoffFile + DebugOffset); + Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW; + Dir->SizeOfData = sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + Len; + Dir->RVA = DebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); + Dir->FileOffset = DebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); + + Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1); + Nb10->Signature = CODEVIEW_SIGNATURE_NB10; + strcpy ((char *)(Nb10 + 1), mInImageName); + + + NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); + DataDir = &NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]; + DataDir->VirtualAddress = DebugOffset; + DataDir->Size = mCoffOffset - DebugOffset; + if (DataDir->Size == 0) { + // If no debug, null out the directory entry and don't add the .debug section + DataDir->VirtualAddress = 0; + NtHdr->Pe32Plus.FileHeader.NumberOfSections--; + } else { + DataDir->VirtualAddress = DebugOffset; + CreateSectionHeader (".debug", DebugOffset, mCoffOffset - DebugOffset, + EFI_IMAGE_SCN_CNT_INITIALIZED_DATA + | EFI_IMAGE_SCN_MEM_DISCARDABLE + | EFI_IMAGE_SCN_MEM_READ); + + } +} + +STATIC +VOID +SetImageSize64 ( + VOID + ) +{ + EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; + + // + // Set image size + // + NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); + NtHdr->Pe32Plus.OptionalHeader.SizeOfImage = mCoffOffset; +} + +STATIC +VOID +CleanUp64 ( + VOID + ) +{ + if (mCoffSectionsOffset != NULL) { + free (mCoffSectionsOffset); + } +} + + diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.h b/BaseTools/Source/C/GenFw/Elf64Convert.h index 1fb95a8e42..1e3a0dfcc2 100644 --- a/BaseTools/Source/C/GenFw/Elf64Convert.h +++ b/BaseTools/Source/C/GenFw/Elf64Convert.h @@ -1,24 +1,24 @@ -/** @file - -Copyright (c) 2010, Intel Corporation. All rights reserved.
- -This program and the accompanying materials are licensed and made available -under the terms and conditions of the BSD License which accompanies this -distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _ELF_64_CONVERT_ -#define _ELF_64_CONVERT_ - -BOOLEAN -InitializeElf64 ( - UINT8 *FileBuffer, - ELF_FUNCTION_TABLE *ElfFunctions - ); - -#endif +/** @file + +Copyright (c) 2010, Intel Corporation. All rights reserved.
+ +This program and the accompanying materials are licensed and made available +under the terms and conditions of the BSD License which accompanies this +distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _ELF_64_CONVERT_ +#define _ELF_64_CONVERT_ + +BOOLEAN +InitializeElf64 ( + UINT8 *FileBuffer, + ELF_FUNCTION_TABLE *ElfFunctions + ); + +#endif diff --git a/BaseTools/Source/C/GenFw/ElfConvert.c b/BaseTools/Source/C/GenFw/ElfConvert.c index e573554d03..17689cf27f 100644 --- a/BaseTools/Source/C/GenFw/ElfConvert.c +++ b/BaseTools/Source/C/GenFw/ElfConvert.c @@ -1,233 +1,233 @@ -/** @file - -Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
- -This program and the accompanying materials are licensed and made available -under the terms and conditions of the BSD License which accompanies this -distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "WinNtInclude.h" - -#ifndef __GNUC__ -#include -#include -#endif -#include -#include -#include -#include -#include - -#include -#include - -#include "EfiUtilityMsgs.h" - -#include "GenFw.h" -#include "ElfConvert.h" -#include "Elf32Convert.h" -#include "Elf64Convert.h" - -// -// Result Coff file in memory. -// -UINT8 *mCoffFile = NULL; - -// -// COFF relocation data -// -EFI_IMAGE_BASE_RELOCATION *mCoffBaseRel; -UINT16 *mCoffEntryRel; - -// -// Current offset in coff file. -// -UINT32 mCoffOffset; - -// -// Offset in Coff file of headers and sections. -// -UINT32 mTableOffset; - -// -//***************************************************************************** -// Common ELF Functions -//***************************************************************************** -// - -VOID -CoffAddFixupEntry( - UINT16 Val - ) -{ - *mCoffEntryRel = Val; - mCoffEntryRel++; - mCoffBaseRel->SizeOfBlock += 2; - mCoffOffset += 2; -} - -VOID -CoffAddFixup( - UINT32 Offset, - UINT8 Type - ) -{ - if (mCoffBaseRel == NULL - || mCoffBaseRel->VirtualAddress != (Offset & ~0xfff)) { - if (mCoffBaseRel != NULL) { - // - // Add a null entry (is it required ?) - // - CoffAddFixupEntry (0); - - // - // Pad for alignment. - // - if (mCoffOffset % 4 != 0) - CoffAddFixupEntry (0); - } - - mCoffFile = realloc ( - mCoffFile, - mCoffOffset + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000 - ); - memset ( - mCoffFile + mCoffOffset, 0, - sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000 - ); - - mCoffBaseRel = (EFI_IMAGE_BASE_RELOCATION*)(mCoffFile + mCoffOffset); - mCoffBaseRel->VirtualAddress = Offset & ~0xfff; - mCoffBaseRel->SizeOfBlock = sizeof(EFI_IMAGE_BASE_RELOCATION); - - mCoffEntryRel = (UINT16 *)(mCoffBaseRel + 1); - mCoffOffset += sizeof(EFI_IMAGE_BASE_RELOCATION); - } - - // - // Fill the entry. - // - CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff))); -} - -VOID -CreateSectionHeader ( - const CHAR8 *Name, - UINT32 Offset, - UINT32 Size, - UINT32 Flags - ) -{ - EFI_IMAGE_SECTION_HEADER *Hdr; - Hdr = (EFI_IMAGE_SECTION_HEADER*)(mCoffFile + mTableOffset); - - strcpy((char *)Hdr->Name, Name); - Hdr->Misc.VirtualSize = Size; - Hdr->VirtualAddress = Offset; - Hdr->SizeOfRawData = Size; - Hdr->PointerToRawData = Offset; - Hdr->PointerToRelocations = 0; - Hdr->PointerToLinenumbers = 0; - Hdr->NumberOfRelocations = 0; - Hdr->NumberOfLinenumbers = 0; - Hdr->Characteristics = Flags; - - mTableOffset += sizeof (EFI_IMAGE_SECTION_HEADER); -} - -// -//***************************************************************************** -// Functions called from GenFw main code. -//***************************************************************************** -// - -INTN -IsElfHeader ( - UINT8 *FileBuffer -) -{ - return (FileBuffer[EI_MAG0] == ELFMAG0 && - FileBuffer[EI_MAG1] == ELFMAG1 && - FileBuffer[EI_MAG2] == ELFMAG2 && - FileBuffer[EI_MAG3] == ELFMAG3); -} - -BOOLEAN -ConvertElf ( - UINT8 **FileBuffer, - UINT32 *FileLength - ) -{ - ELF_FUNCTION_TABLE ElfFunctions; - UINT8 EiClass; - - // - // Determine ELF type and set function table pointer correctly. - // - VerboseMsg ("Check Elf Image Header"); - EiClass = (*FileBuffer)[EI_CLASS]; - if (EiClass == ELFCLASS32) { - if (!InitializeElf32 (*FileBuffer, &ElfFunctions)) { - return FALSE; - } - } else if (EiClass == ELFCLASS64) { - if (!InitializeElf64 (*FileBuffer, &ElfFunctions)) { - return FALSE; - } - } else { - Error (NULL, 0, 3000, "Unsupported", "ELF EI_CLASS not supported."); - return FALSE; - } - - // - // Compute sections new address. - // - VerboseMsg ("Compute sections new address."); - ElfFunctions.ScanSections (); - - // - // Write and relocate sections. - // - VerboseMsg ("Write and relocate sections."); - ElfFunctions.WriteSections (SECTION_TEXT); - ElfFunctions.WriteSections (SECTION_DATA); - ElfFunctions.WriteSections (SECTION_HII); - - // - // Translate and write relocations. - // - VerboseMsg ("Translate and write relocations."); - ElfFunctions.WriteRelocations (); - - // - // Write debug info. - // - VerboseMsg ("Write debug info."); - ElfFunctions.WriteDebug (); - - // - // Make sure image size is correct before returning the new image. - // - VerboseMsg ("Set image size."); - ElfFunctions.SetImageSize (); - - // - // Replace. - // - free (*FileBuffer); - *FileBuffer = mCoffFile; - *FileLength = mCoffOffset; - - // - // Free resources used by ELF functions. - // - ElfFunctions.CleanUp (); - - return TRUE; -} +/** @file + +Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+ +This program and the accompanying materials are licensed and made available +under the terms and conditions of the BSD License which accompanies this +distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "WinNtInclude.h" + +#ifndef __GNUC__ +#include +#include +#endif +#include +#include +#include +#include +#include + +#include +#include + +#include "EfiUtilityMsgs.h" + +#include "GenFw.h" +#include "ElfConvert.h" +#include "Elf32Convert.h" +#include "Elf64Convert.h" + +// +// Result Coff file in memory. +// +UINT8 *mCoffFile = NULL; + +// +// COFF relocation data +// +EFI_IMAGE_BASE_RELOCATION *mCoffBaseRel; +UINT16 *mCoffEntryRel; + +// +// Current offset in coff file. +// +UINT32 mCoffOffset; + +// +// Offset in Coff file of headers and sections. +// +UINT32 mTableOffset; + +// +//***************************************************************************** +// Common ELF Functions +//***************************************************************************** +// + +VOID +CoffAddFixupEntry( + UINT16 Val + ) +{ + *mCoffEntryRel = Val; + mCoffEntryRel++; + mCoffBaseRel->SizeOfBlock += 2; + mCoffOffset += 2; +} + +VOID +CoffAddFixup( + UINT32 Offset, + UINT8 Type + ) +{ + if (mCoffBaseRel == NULL + || mCoffBaseRel->VirtualAddress != (Offset & ~0xfff)) { + if (mCoffBaseRel != NULL) { + // + // Add a null entry (is it required ?) + // + CoffAddFixupEntry (0); + + // + // Pad for alignment. + // + if (mCoffOffset % 4 != 0) + CoffAddFixupEntry (0); + } + + mCoffFile = realloc ( + mCoffFile, + mCoffOffset + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000 + ); + memset ( + mCoffFile + mCoffOffset, 0, + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000 + ); + + mCoffBaseRel = (EFI_IMAGE_BASE_RELOCATION*)(mCoffFile + mCoffOffset); + mCoffBaseRel->VirtualAddress = Offset & ~0xfff; + mCoffBaseRel->SizeOfBlock = sizeof(EFI_IMAGE_BASE_RELOCATION); + + mCoffEntryRel = (UINT16 *)(mCoffBaseRel + 1); + mCoffOffset += sizeof(EFI_IMAGE_BASE_RELOCATION); + } + + // + // Fill the entry. + // + CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff))); +} + +VOID +CreateSectionHeader ( + const CHAR8 *Name, + UINT32 Offset, + UINT32 Size, + UINT32 Flags + ) +{ + EFI_IMAGE_SECTION_HEADER *Hdr; + Hdr = (EFI_IMAGE_SECTION_HEADER*)(mCoffFile + mTableOffset); + + strcpy((char *)Hdr->Name, Name); + Hdr->Misc.VirtualSize = Size; + Hdr->VirtualAddress = Offset; + Hdr->SizeOfRawData = Size; + Hdr->PointerToRawData = Offset; + Hdr->PointerToRelocations = 0; + Hdr->PointerToLinenumbers = 0; + Hdr->NumberOfRelocations = 0; + Hdr->NumberOfLinenumbers = 0; + Hdr->Characteristics = Flags; + + mTableOffset += sizeof (EFI_IMAGE_SECTION_HEADER); +} + +// +//***************************************************************************** +// Functions called from GenFw main code. +//***************************************************************************** +// + +INTN +IsElfHeader ( + UINT8 *FileBuffer +) +{ + return (FileBuffer[EI_MAG0] == ELFMAG0 && + FileBuffer[EI_MAG1] == ELFMAG1 && + FileBuffer[EI_MAG2] == ELFMAG2 && + FileBuffer[EI_MAG3] == ELFMAG3); +} + +BOOLEAN +ConvertElf ( + UINT8 **FileBuffer, + UINT32 *FileLength + ) +{ + ELF_FUNCTION_TABLE ElfFunctions; + UINT8 EiClass; + + // + // Determine ELF type and set function table pointer correctly. + // + VerboseMsg ("Check Elf Image Header"); + EiClass = (*FileBuffer)[EI_CLASS]; + if (EiClass == ELFCLASS32) { + if (!InitializeElf32 (*FileBuffer, &ElfFunctions)) { + return FALSE; + } + } else if (EiClass == ELFCLASS64) { + if (!InitializeElf64 (*FileBuffer, &ElfFunctions)) { + return FALSE; + } + } else { + Error (NULL, 0, 3000, "Unsupported", "ELF EI_CLASS not supported."); + return FALSE; + } + + // + // Compute sections new address. + // + VerboseMsg ("Compute sections new address."); + ElfFunctions.ScanSections (); + + // + // Write and relocate sections. + // + VerboseMsg ("Write and relocate sections."); + ElfFunctions.WriteSections (SECTION_TEXT); + ElfFunctions.WriteSections (SECTION_DATA); + ElfFunctions.WriteSections (SECTION_HII); + + // + // Translate and write relocations. + // + VerboseMsg ("Translate and write relocations."); + ElfFunctions.WriteRelocations (); + + // + // Write debug info. + // + VerboseMsg ("Write debug info."); + ElfFunctions.WriteDebug (); + + // + // Make sure image size is correct before returning the new image. + // + VerboseMsg ("Set image size."); + ElfFunctions.SetImageSize (); + + // + // Replace. + // + free (*FileBuffer); + *FileBuffer = mCoffFile; + *FileLength = mCoffOffset; + + // + // Free resources used by ELF functions. + // + ElfFunctions.CleanUp (); + + return TRUE; +} diff --git a/BaseTools/Source/C/GenFw/ElfConvert.h b/BaseTools/Source/C/GenFw/ElfConvert.h index 185dbb759c..241dd6f44f 100644 --- a/BaseTools/Source/C/GenFw/ElfConvert.h +++ b/BaseTools/Source/C/GenFw/ElfConvert.h @@ -1,83 +1,83 @@ -/** @file - -Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
- -This program and the accompanying materials are licensed and made available -under the terms and conditions of the BSD License which accompanies this -distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _ELF_CONVERT_H_ -#define _ELF_CONVERT_H_ - -#include "elf_common.h" -#include "elf32.h" -#include "elf64.h" - -// -// Externally defined variables -// -extern UINT32 mCoffOffset; -extern CHAR8 *mInImageName; -extern UINT32 mImageTimeStamp; -extern UINT8 *mCoffFile; -extern UINT32 mTableOffset; -extern UINT32 mOutImageType; - -// -// Common EFI specific data. -// -#define ELF_HII_SECTION_NAME ".hii" - -// -// Filter Types -// -typedef enum { - SECTION_TEXT, - SECTION_HII, - SECTION_DATA - -} SECTION_FILTER_TYPES; - -// -// FunctionTalbe -// -typedef struct { - VOID (*ScanSections) (); - BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType); - VOID (*WriteRelocations) (); - VOID (*WriteDebug) (); - VOID (*SetImageSize) (); - VOID (*CleanUp) (); - -} ELF_FUNCTION_TABLE; - -// -// Common functions -// -VOID -CoffAddFixup ( - UINT32 Offset, - UINT8 Type - ); - -VOID -CoffAddFixupEntry ( - UINT16 Val - ); - - -VOID -CreateSectionHeader ( - const CHAR8 *Name, - UINT32 Offset, - UINT32 Size, - UINT32 Flags - ); - -#endif +/** @file + +Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+ +This program and the accompanying materials are licensed and made available +under the terms and conditions of the BSD License which accompanies this +distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _ELF_CONVERT_H_ +#define _ELF_CONVERT_H_ + +#include "elf_common.h" +#include "elf32.h" +#include "elf64.h" + +// +// Externally defined variables +// +extern UINT32 mCoffOffset; +extern CHAR8 *mInImageName; +extern UINT32 mImageTimeStamp; +extern UINT8 *mCoffFile; +extern UINT32 mTableOffset; +extern UINT32 mOutImageType; + +// +// Common EFI specific data. +// +#define ELF_HII_SECTION_NAME ".hii" + +// +// Filter Types +// +typedef enum { + SECTION_TEXT, + SECTION_HII, + SECTION_DATA + +} SECTION_FILTER_TYPES; + +// +// FunctionTalbe +// +typedef struct { + VOID (*ScanSections) (); + BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType); + VOID (*WriteRelocations) (); + VOID (*WriteDebug) (); + VOID (*SetImageSize) (); + VOID (*CleanUp) (); + +} ELF_FUNCTION_TABLE; + +// +// Common functions +// +VOID +CoffAddFixup ( + UINT32 Offset, + UINT8 Type + ); + +VOID +CoffAddFixupEntry ( + UINT16 Val + ); + + +VOID +CreateSectionHeader ( + const CHAR8 *Name, + UINT32 Offset, + UINT32 Size, + UINT32 Flags + ); + +#endif diff --git a/BaseTools/Source/C/GenFw/GenFw.h b/BaseTools/Source/C/GenFw/GenFw.h index e36dc085ff..5249337745 100644 --- a/BaseTools/Source/C/GenFw/GenFw.h +++ b/BaseTools/Source/C/GenFw/GenFw.h @@ -1,55 +1,55 @@ -/** @file - -Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
- -This program and the accompanying materials are licensed and made available -under the terms and conditions of the BSD License which accompanies this -distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _GEN_FW_H_ -#define _GEN_FW_H_ - -// -// Action for this tool. -// -#define FW_DUMMY_IMAGE 0 -#define FW_EFI_IMAGE 1 -#define FW_TE_IMAGE 2 -#define FW_ACPI_IMAGE 3 -#define FW_BIN_IMAGE 4 -#define FW_ZERO_DEBUG_IMAGE 5 -#define FW_SET_STAMP_IMAGE 6 -#define FW_MCI_IMAGE 7 -#define FW_MERGE_IMAGE 8 -#define FW_RELOC_STRIPEED_IMAGE 9 -#define FW_HII_PACKAGE_LIST_RCIMAGE 10 -#define FW_HII_PACKAGE_LIST_BINIMAGE 11 -#define FW_REBASE_IMAGE 12 -#define FW_SET_ADDRESS_IMAGE 13 - -#define DUMP_TE_HEADER 0x11 - -VOID -SetHiiResourceHeader ( - UINT8 *HiiBinData, - UINT32 OffsetToFile - ); - -INTN -IsElfHeader ( - UINT8 *FileBuffer - ); - -BOOLEAN -ConvertElf ( - UINT8 **FileBuffer, - UINT32 *FileLength - ); - -#endif +/** @file + +Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+ +This program and the accompanying materials are licensed and made available +under the terms and conditions of the BSD License which accompanies this +distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _GEN_FW_H_ +#define _GEN_FW_H_ + +// +// Action for this tool. +// +#define FW_DUMMY_IMAGE 0 +#define FW_EFI_IMAGE 1 +#define FW_TE_IMAGE 2 +#define FW_ACPI_IMAGE 3 +#define FW_BIN_IMAGE 4 +#define FW_ZERO_DEBUG_IMAGE 5 +#define FW_SET_STAMP_IMAGE 6 +#define FW_MCI_IMAGE 7 +#define FW_MERGE_IMAGE 8 +#define FW_RELOC_STRIPEED_IMAGE 9 +#define FW_HII_PACKAGE_LIST_RCIMAGE 10 +#define FW_HII_PACKAGE_LIST_BINIMAGE 11 +#define FW_REBASE_IMAGE 12 +#define FW_SET_ADDRESS_IMAGE 13 + +#define DUMP_TE_HEADER 0x11 + +VOID +SetHiiResourceHeader ( + UINT8 *HiiBinData, + UINT32 OffsetToFile + ); + +INTN +IsElfHeader ( + UINT8 *FileBuffer + ); + +BOOLEAN +ConvertElf ( + UINT8 **FileBuffer, + UINT32 *FileLength + ); + +#endif diff --git a/BaseTools/Source/C/GenFw/elf32.h b/BaseTools/Source/C/GenFw/elf32.h index 63946aad84..dd4e132598 100644 --- a/BaseTools/Source/C/GenFw/elf32.h +++ b/BaseTools/Source/C/GenFw/elf32.h @@ -1,258 +1,258 @@ -/** @file -Ported ELF include files from FreeBSD - -Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ -/*- - * Copyright (c) 1996-1998 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.2 2007/12/03 21:30:36 marius Exp $ - */ - -#ifndef _SYS_ELF32_H_ -#define _SYS_ELF32_H_ 1 - - -/* - * ELF definitions common to all 32-bit architectures. - */ - -typedef UINT32 Elf32_Addr; -typedef UINT16 Elf32_Half; -typedef UINT32 Elf32_Off; -typedef INT32 Elf32_Sword; -typedef UINT32 Elf32_Word; -typedef UINT64 Elf32_Lword; - -typedef Elf32_Word Elf32_Hashelt; - -/* Non-standard class-dependent datatype used for abstraction. */ -typedef Elf32_Word Elf32_Size; -typedef Elf32_Sword Elf32_Ssize; - -/* - * ELF header. - */ - -typedef struct { - unsigned char e_ident[EI_NIDENT]; /* File identification. */ - Elf32_Half e_type; /* File type. */ - Elf32_Half e_machine; /* Machine architecture. */ - Elf32_Word e_version; /* ELF format version. */ - Elf32_Addr e_entry; /* Entry point. */ - Elf32_Off e_phoff; /* Program header file offset. */ - Elf32_Off e_shoff; /* Section header file offset. */ - Elf32_Word e_flags; /* Architecture-specific flags. */ - Elf32_Half e_ehsize; /* Size of ELF header in bytes. */ - Elf32_Half e_phentsize; /* Size of program header entry. */ - Elf32_Half e_phnum; /* Number of program header entries. */ - Elf32_Half e_shentsize; /* Size of section header entry. */ - Elf32_Half e_shnum; /* Number of section header entries. */ - Elf32_Half e_shstrndx; /* Section name strings section. */ -} Elf32_Ehdr; - -/* - * Section header. - */ - -typedef struct { - Elf32_Word sh_name; /* Section name (index into the - section header string table). */ - Elf32_Word sh_type; /* Section type. */ - Elf32_Word sh_flags; /* Section flags. */ - Elf32_Addr sh_addr; /* Address in memory image. */ - Elf32_Off sh_offset; /* Offset in file. */ - Elf32_Word sh_size; /* Size in bytes. */ - Elf32_Word sh_link; /* Index of a related section. */ - Elf32_Word sh_info; /* Depends on section type. */ - Elf32_Word sh_addralign; /* Alignment in bytes. */ - Elf32_Word sh_entsize; /* Size of each entry in section. */ -} Elf32_Shdr; - -/* - * Program header. - */ - -typedef struct { - Elf32_Word p_type; /* Entry type. */ - Elf32_Off p_offset; /* File offset of contents. */ - Elf32_Addr p_vaddr; /* Virtual address in memory image. */ - Elf32_Addr p_paddr; /* Physical address (not used). */ - Elf32_Word p_filesz; /* Size of contents in file. */ - Elf32_Word p_memsz; /* Size of contents in memory. */ - Elf32_Word p_flags; /* Access permission flags. */ - Elf32_Word p_align; /* Alignment in memory and file. */ -} Elf32_Phdr; - -/* - * Dynamic structure. The ".dynamic" section contains an array of them. - */ - -typedef struct { - Elf32_Sword d_tag; /* Entry type. */ - union { - Elf32_Word d_val; /* Integer value. */ - Elf32_Addr d_ptr; /* Address value. */ - } d_un; -} Elf32_Dyn; - -/* - * Relocation entries. - */ - -/* Relocations that don't need an addend field. */ -typedef struct { - Elf32_Addr r_offset; /* Location to be relocated. */ - Elf32_Word r_info; /* Relocation type and symbol index. */ -} Elf32_Rel; - -/* Relocations that need an addend field. */ -typedef struct { - Elf32_Addr r_offset; /* Location to be relocated. */ - Elf32_Word r_info; /* Relocation type and symbol index. */ - Elf32_Sword r_addend; /* Addend. */ -} Elf32_Rela; - -/* Macros for accessing the fields of r_info. */ -#define ELF32_R_SYM(info) ((info) >> 8) -#define ELF32_R_TYPE(info) ((unsigned char)(info)) - -/* Macro for constructing r_info from field values. */ -#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type)) - -/* - * Note entry header - */ -typedef Elf_Note Elf32_Nhdr; - -/* - * Move entry - */ -typedef struct { - Elf32_Lword m_value; /* symbol value */ - Elf32_Word m_info; /* size + index */ - Elf32_Word m_poffset; /* symbol offset */ - Elf32_Half m_repeat; /* repeat count */ - Elf32_Half m_stride; /* stride info */ -} Elf32_Move; - -/* - * The macros compose and decompose values for Move.r_info - * - * sym = ELF32_M_SYM(M.m_info) - * size = ELF32_M_SIZE(M.m_info) - * M.m_info = ELF32_M_INFO(sym, size) - */ -#define ELF32_M_SYM(info) ((info)>>8) -#define ELF32_M_SIZE(info) ((unsigned char)(info)) -#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size)) - -/* - * Hardware/Software capabilities entry - */ -typedef struct { - Elf32_Word c_tag; /* how to interpret value */ - union { - Elf32_Word c_val; - Elf32_Addr c_ptr; - } c_un; -} Elf32_Cap; - -/* - * Symbol table entries. - */ - -typedef struct { - Elf32_Word st_name; /* String table index of name. */ - Elf32_Addr st_value; /* Symbol value. */ - Elf32_Word st_size; /* Size of associated object. */ - unsigned char st_info; /* Type and binding information. */ - unsigned char st_other; /* Reserved (not used). */ - Elf32_Half st_shndx; /* Section index of symbol. */ -} Elf32_Sym; - -/* Macros for accessing the fields of st_info. */ -#define ELF32_ST_BIND(info) ((info) >> 4) -#define ELF32_ST_TYPE(info) ((info) & 0xf) - -/* Macro for constructing st_info from field values. */ -#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) - -/* Macro for accessing the fields of st_other. */ -#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3) - -/* Structures used by Sun & GNU symbol versioning. */ -typedef struct -{ - Elf32_Half vd_version; - Elf32_Half vd_flags; - Elf32_Half vd_ndx; - Elf32_Half vd_cnt; - Elf32_Word vd_hash; - Elf32_Word vd_aux; - Elf32_Word vd_next; -} Elf32_Verdef; - -typedef struct -{ - Elf32_Word vda_name; - Elf32_Word vda_next; -} Elf32_Verdaux; - -typedef struct -{ - Elf32_Half vn_version; - Elf32_Half vn_cnt; - Elf32_Word vn_file; - Elf32_Word vn_aux; - Elf32_Word vn_next; -} Elf32_Verneed; - -typedef struct -{ - Elf32_Word vna_hash; - Elf32_Half vna_flags; - Elf32_Half vna_other; - Elf32_Word vna_name; - Elf32_Word vna_next; -} Elf32_Vernaux; - -typedef Elf32_Half Elf32_Versym; - -typedef struct { - Elf32_Half si_boundto; /* direct bindings - symbol bound to */ - Elf32_Half si_flags; /* per symbol flags */ -} Elf32_Syminfo; - -#endif /* !_SYS_ELF32_H_ */ +/** @file +Ported ELF include files from FreeBSD + +Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
+This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + +**/ +/*- + * Copyright (c) 1996-1998 John D. Polstra. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.2 2007/12/03 21:30:36 marius Exp $ + */ + +#ifndef _SYS_ELF32_H_ +#define _SYS_ELF32_H_ 1 + + +/* + * ELF definitions common to all 32-bit architectures. + */ + +typedef UINT32 Elf32_Addr; +typedef UINT16 Elf32_Half; +typedef UINT32 Elf32_Off; +typedef INT32 Elf32_Sword; +typedef UINT32 Elf32_Word; +typedef UINT64 Elf32_Lword; + +typedef Elf32_Word Elf32_Hashelt; + +/* Non-standard class-dependent datatype used for abstraction. */ +typedef Elf32_Word Elf32_Size; +typedef Elf32_Sword Elf32_Ssize; + +/* + * ELF header. + */ + +typedef struct { + unsigned char e_ident[EI_NIDENT]; /* File identification. */ + Elf32_Half e_type; /* File type. */ + Elf32_Half e_machine; /* Machine architecture. */ + Elf32_Word e_version; /* ELF format version. */ + Elf32_Addr e_entry; /* Entry point. */ + Elf32_Off e_phoff; /* Program header file offset. */ + Elf32_Off e_shoff; /* Section header file offset. */ + Elf32_Word e_flags; /* Architecture-specific flags. */ + Elf32_Half e_ehsize; /* Size of ELF header in bytes. */ + Elf32_Half e_phentsize; /* Size of program header entry. */ + Elf32_Half e_phnum; /* Number of program header entries. */ + Elf32_Half e_shentsize; /* Size of section header entry. */ + Elf32_Half e_shnum; /* Number of section header entries. */ + Elf32_Half e_shstrndx; /* Section name strings section. */ +} Elf32_Ehdr; + +/* + * Section header. + */ + +typedef struct { + Elf32_Word sh_name; /* Section name (index into the + section header string table). */ + Elf32_Word sh_type; /* Section type. */ + Elf32_Word sh_flags; /* Section flags. */ + Elf32_Addr sh_addr; /* Address in memory image. */ + Elf32_Off sh_offset; /* Offset in file. */ + Elf32_Word sh_size; /* Size in bytes. */ + Elf32_Word sh_link; /* Index of a related section. */ + Elf32_Word sh_info; /* Depends on section type. */ + Elf32_Word sh_addralign; /* Alignment in bytes. */ + Elf32_Word sh_entsize; /* Size of each entry in section. */ +} Elf32_Shdr; + +/* + * Program header. + */ + +typedef struct { + Elf32_Word p_type; /* Entry type. */ + Elf32_Off p_offset; /* File offset of contents. */ + Elf32_Addr p_vaddr; /* Virtual address in memory image. */ + Elf32_Addr p_paddr; /* Physical address (not used). */ + Elf32_Word p_filesz; /* Size of contents in file. */ + Elf32_Word p_memsz; /* Size of contents in memory. */ + Elf32_Word p_flags; /* Access permission flags. */ + Elf32_Word p_align; /* Alignment in memory and file. */ +} Elf32_Phdr; + +/* + * Dynamic structure. The ".dynamic" section contains an array of them. + */ + +typedef struct { + Elf32_Sword d_tag; /* Entry type. */ + union { + Elf32_Word d_val; /* Integer value. */ + Elf32_Addr d_ptr; /* Address value. */ + } d_un; +} Elf32_Dyn; + +/* + * Relocation entries. + */ + +/* Relocations that don't need an addend field. */ +typedef struct { + Elf32_Addr r_offset; /* Location to be relocated. */ + Elf32_Word r_info; /* Relocation type and symbol index. */ +} Elf32_Rel; + +/* Relocations that need an addend field. */ +typedef struct { + Elf32_Addr r_offset; /* Location to be relocated. */ + Elf32_Word r_info; /* Relocation type and symbol index. */ + Elf32_Sword r_addend; /* Addend. */ +} Elf32_Rela; + +/* Macros for accessing the fields of r_info. */ +#define ELF32_R_SYM(info) ((info) >> 8) +#define ELF32_R_TYPE(info) ((unsigned char)(info)) + +/* Macro for constructing r_info from field values. */ +#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type)) + +/* + * Note entry header + */ +typedef Elf_Note Elf32_Nhdr; + +/* + * Move entry + */ +typedef struct { + Elf32_Lword m_value; /* symbol value */ + Elf32_Word m_info; /* size + index */ + Elf32_Word m_poffset; /* symbol offset */ + Elf32_Half m_repeat; /* repeat count */ + Elf32_Half m_stride; /* stride info */ +} Elf32_Move; + +/* + * The macros compose and decompose values for Move.r_info + * + * sym = ELF32_M_SYM(M.m_info) + * size = ELF32_M_SIZE(M.m_info) + * M.m_info = ELF32_M_INFO(sym, size) + */ +#define ELF32_M_SYM(info) ((info)>>8) +#define ELF32_M_SIZE(info) ((unsigned char)(info)) +#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size)) + +/* + * Hardware/Software capabilities entry + */ +typedef struct { + Elf32_Word c_tag; /* how to interpret value */ + union { + Elf32_Word c_val; + Elf32_Addr c_ptr; + } c_un; +} Elf32_Cap; + +/* + * Symbol table entries. + */ + +typedef struct { + Elf32_Word st_name; /* String table index of name. */ + Elf32_Addr st_value; /* Symbol value. */ + Elf32_Word st_size; /* Size of associated object. */ + unsigned char st_info; /* Type and binding information. */ + unsigned char st_other; /* Reserved (not used). */ + Elf32_Half st_shndx; /* Section index of symbol. */ +} Elf32_Sym; + +/* Macros for accessing the fields of st_info. */ +#define ELF32_ST_BIND(info) ((info) >> 4) +#define ELF32_ST_TYPE(info) ((info) & 0xf) + +/* Macro for constructing st_info from field values. */ +#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) + +/* Macro for accessing the fields of st_other. */ +#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3) + +/* Structures used by Sun & GNU symbol versioning. */ +typedef struct +{ + Elf32_Half vd_version; + Elf32_Half vd_flags; + Elf32_Half vd_ndx; + Elf32_Half vd_cnt; + Elf32_Word vd_hash; + Elf32_Word vd_aux; + Elf32_Word vd_next; +} Elf32_Verdef; + +typedef struct +{ + Elf32_Word vda_name; + Elf32_Word vda_next; +} Elf32_Verdaux; + +typedef struct +{ + Elf32_Half vn_version; + Elf32_Half vn_cnt; + Elf32_Word vn_file; + Elf32_Word vn_aux; + Elf32_Word vn_next; +} Elf32_Verneed; + +typedef struct +{ + Elf32_Word vna_hash; + Elf32_Half vna_flags; + Elf32_Half vna_other; + Elf32_Word vna_name; + Elf32_Word vna_next; +} Elf32_Vernaux; + +typedef Elf32_Half Elf32_Versym; + +typedef struct { + Elf32_Half si_boundto; /* direct bindings - symbol bound to */ + Elf32_Half si_flags; /* per symbol flags */ +} Elf32_Syminfo; + +#endif /* !_SYS_ELF32_H_ */ diff --git a/BaseTools/Source/C/GenFw/elf64.h b/BaseTools/Source/C/GenFw/elf64.h index 6c87207ede..572085995d 100644 --- a/BaseTools/Source/C/GenFw/elf64.h +++ b/BaseTools/Source/C/GenFw/elf64.h @@ -1,260 +1,260 @@ -/** @file -Ported ELF include files from FreeBSD - -Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -/*- - * Copyright (c) 1996-1998 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.2 2007/12/03 21:30:36 marius Exp $ - */ - -#ifndef _SYS_ELF64_H_ -#define _SYS_ELF64_H_ 1 - - -/* - * ELF definitions common to all 64-bit architectures. - */ - -typedef UINT64 Elf64_Addr; -typedef UINT16 Elf64_Half; -typedef UINT64 Elf64_Off; -typedef INT32 Elf64_Sword; -typedef INT64 Elf64_Sxword; -typedef UINT32 Elf64_Word; -typedef UINT64 Elf64_Lword; -typedef UINT64 Elf64_Xword; - -/* - * Types of dynamic symbol hash table bucket and chain elements. - * - * This is inconsistent among 64 bit architectures, so a machine dependent - * typedef is required. - */ - -typedef Elf64_Word Elf64_Hashelt; - -/* Non-standard class-dependent datatype used for abstraction. */ -typedef Elf64_Xword Elf64_Size; -typedef Elf64_Sxword Elf64_Ssize; - -/* - * ELF header. - */ - -typedef struct { - unsigned char e_ident[EI_NIDENT]; /* File identification. */ - Elf64_Half e_type; /* File type. */ - Elf64_Half e_machine; /* Machine architecture. */ - Elf64_Word e_version; /* ELF format version. */ - Elf64_Addr e_entry; /* Entry point. */ - Elf64_Off e_phoff; /* Program header file offset. */ - Elf64_Off e_shoff; /* Section header file offset. */ - Elf64_Word e_flags; /* Architecture-specific flags. */ - Elf64_Half e_ehsize; /* Size of ELF header in bytes. */ - Elf64_Half e_phentsize; /* Size of program header entry. */ - Elf64_Half e_phnum; /* Number of program header entries. */ - Elf64_Half e_shentsize; /* Size of section header entry. */ - Elf64_Half e_shnum; /* Number of section header entries. */ - Elf64_Half e_shstrndx; /* Section name strings section. */ -} Elf64_Ehdr; - -/* - * Section header. - */ - -typedef struct { - Elf64_Word sh_name; /* Section name (index into the - section header string table). */ - Elf64_Word sh_type; /* Section type. */ - Elf64_Xword sh_flags; /* Section flags. */ - Elf64_Addr sh_addr; /* Address in memory image. */ - Elf64_Off sh_offset; /* Offset in file. */ - Elf64_Xword sh_size; /* Size in bytes. */ - Elf64_Word sh_link; /* Index of a related section. */ - Elf64_Word sh_info; /* Depends on section type. */ - Elf64_Xword sh_addralign; /* Alignment in bytes. */ - Elf64_Xword sh_entsize; /* Size of each entry in section. */ -} Elf64_Shdr; - -/* - * Program header. - */ - -typedef struct { - Elf64_Word p_type; /* Entry type. */ - Elf64_Word p_flags; /* Access permission flags. */ - Elf64_Off p_offset; /* File offset of contents. */ - Elf64_Addr p_vaddr; /* Virtual address in memory image. */ - Elf64_Addr p_paddr; /* Physical address (not used). */ - Elf64_Xword p_filesz; /* Size of contents in file. */ - Elf64_Xword p_memsz; /* Size of contents in memory. */ - Elf64_Xword p_align; /* Alignment in memory and file. */ -} Elf64_Phdr; - -/* - * Dynamic structure. The ".dynamic" section contains an array of them. - */ - -typedef struct { - Elf64_Sxword d_tag; /* Entry type. */ - union { - Elf64_Xword d_val; /* Integer value. */ - Elf64_Addr d_ptr; /* Address value. */ - } d_un; -} Elf64_Dyn; - -/* - * Relocation entries. - */ - -/* Relocations that don't need an addend field. */ -typedef struct { - Elf64_Addr r_offset; /* Location to be relocated. */ - Elf64_Xword r_info; /* Relocation type and symbol index. */ -} Elf64_Rel; - -/* Relocations that need an addend field. */ -typedef struct { - Elf64_Addr r_offset; /* Location to be relocated. */ - Elf64_Xword r_info; /* Relocation type and symbol index. */ - Elf64_Sxword r_addend; /* Addend. */ -} Elf64_Rela; - -/* Macros for accessing the fields of r_info. */ -#define ELF64_R_SYM(info) ((info) >> 32) -#define ELF64_R_TYPE(info) ((info) & 0xffffffffL) - -/* Macro for constructing r_info from field values. */ -#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL)) - -#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40) -#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56) -#define ELF64_R_TYPE_INFO(data, type) \ - (((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type)) - -/* - * Note entry header - */ -typedef Elf_Note Elf64_Nhdr; - -/* - * Move entry - */ -typedef struct { - Elf64_Lword m_value; /* symbol value */ - Elf64_Xword m_info; /* size + index */ - Elf64_Xword m_poffset; /* symbol offset */ - Elf64_Half m_repeat; /* repeat count */ - Elf64_Half m_stride; /* stride info */ -} Elf64_Move; - -#define ELF64_M_SYM(info) ((info)>>8) -#define ELF64_M_SIZE(info) ((unsigned char)(info)) -#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size)) - -/* - * Hardware/Software capabilities entry - */ -typedef struct { - Elf64_Xword c_tag; /* how to interpret value */ - union { - Elf64_Xword c_val; - Elf64_Addr c_ptr; - } c_un; -} Elf64_Cap; - -/* - * Symbol table entries. - */ - -typedef struct { - Elf64_Word st_name; /* String table index of name. */ - unsigned char st_info; /* Type and binding information. */ - unsigned char st_other; /* Reserved (not used). */ - Elf64_Half st_shndx; /* Section index of symbol. */ - Elf64_Addr st_value; /* Symbol value. */ - Elf64_Xword st_size; /* Size of associated object. */ -} Elf64_Sym; - -/* Macros for accessing the fields of st_info. */ -#define ELF64_ST_BIND(info) ((info) >> 4) -#define ELF64_ST_TYPE(info) ((info) & 0xf) - -/* Macro for constructing st_info from field values. */ -#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) - -/* Macro for accessing the fields of st_other. */ -#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3) - -/* Structures used by Sun & GNU-style symbol versioning. */ -typedef struct { - Elf64_Half vd_version; - Elf64_Half vd_flags; - Elf64_Half vd_ndx; - Elf64_Half vd_cnt; - Elf64_Word vd_hash; - Elf64_Word vd_aux; - Elf64_Word vd_next; -} Elf64_Verdef; - -typedef struct { - Elf64_Word vda_name; - Elf64_Word vda_next; -} Elf64_Verdaux; - -typedef struct { - Elf64_Half vn_version; - Elf64_Half vn_cnt; - Elf64_Word vn_file; - Elf64_Word vn_aux; - Elf64_Word vn_next; -} Elf64_Verneed; - -typedef struct { - Elf64_Word vna_hash; - Elf64_Half vna_flags; - Elf64_Half vna_other; - Elf64_Word vna_name; - Elf64_Word vna_next; -} Elf64_Vernaux; - -typedef Elf64_Half Elf64_Versym; - -typedef struct { - Elf64_Half si_boundto; /* direct bindings - symbol bound to */ - Elf64_Half si_flags; /* per symbol flags */ -} Elf64_Syminfo; - -#endif /* !_SYS_ELF64_H_ */ +/** @file +Ported ELF include files from FreeBSD + +Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
+This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ +/*- + * Copyright (c) 1996-1998 John D. Polstra. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.2 2007/12/03 21:30:36 marius Exp $ + */ + +#ifndef _SYS_ELF64_H_ +#define _SYS_ELF64_H_ 1 + + +/* + * ELF definitions common to all 64-bit architectures. + */ + +typedef UINT64 Elf64_Addr; +typedef UINT16 Elf64_Half; +typedef UINT64 Elf64_Off; +typedef INT32 Elf64_Sword; +typedef INT64 Elf64_Sxword; +typedef UINT32 Elf64_Word; +typedef UINT64 Elf64_Lword; +typedef UINT64 Elf64_Xword; + +/* + * Types of dynamic symbol hash table bucket and chain elements. + * + * This is inconsistent among 64 bit architectures, so a machine dependent + * typedef is required. + */ + +typedef Elf64_Word Elf64_Hashelt; + +/* Non-standard class-dependent datatype used for abstraction. */ +typedef Elf64_Xword Elf64_Size; +typedef Elf64_Sxword Elf64_Ssize; + +/* + * ELF header. + */ + +typedef struct { + unsigned char e_ident[EI_NIDENT]; /* File identification. */ + Elf64_Half e_type; /* File type. */ + Elf64_Half e_machine; /* Machine architecture. */ + Elf64_Word e_version; /* ELF format version. */ + Elf64_Addr e_entry; /* Entry point. */ + Elf64_Off e_phoff; /* Program header file offset. */ + Elf64_Off e_shoff; /* Section header file offset. */ + Elf64_Word e_flags; /* Architecture-specific flags. */ + Elf64_Half e_ehsize; /* Size of ELF header in bytes. */ + Elf64_Half e_phentsize; /* Size of program header entry. */ + Elf64_Half e_phnum; /* Number of program header entries. */ + Elf64_Half e_shentsize; /* Size of section header entry. */ + Elf64_Half e_shnum; /* Number of section header entries. */ + Elf64_Half e_shstrndx; /* Section name strings section. */ +} Elf64_Ehdr; + +/* + * Section header. + */ + +typedef struct { + Elf64_Word sh_name; /* Section name (index into the + section header string table). */ + Elf64_Word sh_type; /* Section type. */ + Elf64_Xword sh_flags; /* Section flags. */ + Elf64_Addr sh_addr; /* Address in memory image. */ + Elf64_Off sh_offset; /* Offset in file. */ + Elf64_Xword sh_size; /* Size in bytes. */ + Elf64_Word sh_link; /* Index of a related section. */ + Elf64_Word sh_info; /* Depends on section type. */ + Elf64_Xword sh_addralign; /* Alignment in bytes. */ + Elf64_Xword sh_entsize; /* Size of each entry in section. */ +} Elf64_Shdr; + +/* + * Program header. + */ + +typedef struct { + Elf64_Word p_type; /* Entry type. */ + Elf64_Word p_flags; /* Access permission flags. */ + Elf64_Off p_offset; /* File offset of contents. */ + Elf64_Addr p_vaddr; /* Virtual address in memory image. */ + Elf64_Addr p_paddr; /* Physical address (not used). */ + Elf64_Xword p_filesz; /* Size of contents in file. */ + Elf64_Xword p_memsz; /* Size of contents in memory. */ + Elf64_Xword p_align; /* Alignment in memory and file. */ +} Elf64_Phdr; + +/* + * Dynamic structure. The ".dynamic" section contains an array of them. + */ + +typedef struct { + Elf64_Sxword d_tag; /* Entry type. */ + union { + Elf64_Xword d_val; /* Integer value. */ + Elf64_Addr d_ptr; /* Address value. */ + } d_un; +} Elf64_Dyn; + +/* + * Relocation entries. + */ + +/* Relocations that don't need an addend field. */ +typedef struct { + Elf64_Addr r_offset; /* Location to be relocated. */ + Elf64_Xword r_info; /* Relocation type and symbol index. */ +} Elf64_Rel; + +/* Relocations that need an addend field. */ +typedef struct { + Elf64_Addr r_offset; /* Location to be relocated. */ + Elf64_Xword r_info; /* Relocation type and symbol index. */ + Elf64_Sxword r_addend; /* Addend. */ +} Elf64_Rela; + +/* Macros for accessing the fields of r_info. */ +#define ELF64_R_SYM(info) ((info) >> 32) +#define ELF64_R_TYPE(info) ((info) & 0xffffffffL) + +/* Macro for constructing r_info from field values. */ +#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL)) + +#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40) +#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56) +#define ELF64_R_TYPE_INFO(data, type) \ + (((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type)) + +/* + * Note entry header + */ +typedef Elf_Note Elf64_Nhdr; + +/* + * Move entry + */ +typedef struct { + Elf64_Lword m_value; /* symbol value */ + Elf64_Xword m_info; /* size + index */ + Elf64_Xword m_poffset; /* symbol offset */ + Elf64_Half m_repeat; /* repeat count */ + Elf64_Half m_stride; /* stride info */ +} Elf64_Move; + +#define ELF64_M_SYM(info) ((info)>>8) +#define ELF64_M_SIZE(info) ((unsigned char)(info)) +#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size)) + +/* + * Hardware/Software capabilities entry + */ +typedef struct { + Elf64_Xword c_tag; /* how to interpret value */ + union { + Elf64_Xword c_val; + Elf64_Addr c_ptr; + } c_un; +} Elf64_Cap; + +/* + * Symbol table entries. + */ + +typedef struct { + Elf64_Word st_name; /* String table index of name. */ + unsigned char st_info; /* Type and binding information. */ + unsigned char st_other; /* Reserved (not used). */ + Elf64_Half st_shndx; /* Section index of symbol. */ + Elf64_Addr st_value; /* Symbol value. */ + Elf64_Xword st_size; /* Size of associated object. */ +} Elf64_Sym; + +/* Macros for accessing the fields of st_info. */ +#define ELF64_ST_BIND(info) ((info) >> 4) +#define ELF64_ST_TYPE(info) ((info) & 0xf) + +/* Macro for constructing st_info from field values. */ +#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) + +/* Macro for accessing the fields of st_other. */ +#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3) + +/* Structures used by Sun & GNU-style symbol versioning. */ +typedef struct { + Elf64_Half vd_version; + Elf64_Half vd_flags; + Elf64_Half vd_ndx; + Elf64_Half vd_cnt; + Elf64_Word vd_hash; + Elf64_Word vd_aux; + Elf64_Word vd_next; +} Elf64_Verdef; + +typedef struct { + Elf64_Word vda_name; + Elf64_Word vda_next; +} Elf64_Verdaux; + +typedef struct { + Elf64_Half vn_version; + Elf64_Half vn_cnt; + Elf64_Word vn_file; + Elf64_Word vn_aux; + Elf64_Word vn_next; +} Elf64_Verneed; + +typedef struct { + Elf64_Word vna_hash; + Elf64_Half vna_flags; + Elf64_Half vna_other; + Elf64_Word vna_name; + Elf64_Word vna_next; +} Elf64_Vernaux; + +typedef Elf64_Half Elf64_Versym; + +typedef struct { + Elf64_Half si_boundto; /* direct bindings - symbol bound to */ + Elf64_Half si_flags; /* per symbol flags */ +} Elf64_Syminfo; + +#endif /* !_SYS_ELF64_H_ */ diff --git a/BaseTools/Source/C/GenFw/elf_common.h b/BaseTools/Source/C/GenFw/elf_common.h index df22472dc2..766d0e42ef 100644 --- a/BaseTools/Source/C/GenFw/elf_common.h +++ b/BaseTools/Source/C/GenFw/elf_common.h @@ -1,750 +1,750 @@ -/** @file -Ported ELF include files from FreeBSD - -Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -**/ -/*- - * Copyright (c) 1998 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/sys/elf_common.h,v 1.15.8.2 2007/12/03 21:30:36 marius Exp $ - */ - -#ifndef _SYS_ELF_COMMON_H_ -#define _SYS_ELF_COMMON_H_ 1 - -/* - * ELF definitions that are independent of architecture or word size. - */ - -/* - * Note header. The ".note" section contains an array of notes. Each - * begins with this header, aligned to a word boundary. Immediately - * following the note header is n_namesz bytes of name, padded to the - * next word boundary. Then comes n_descsz bytes of descriptor, again - * padded to a word boundary. The values of n_namesz and n_descsz do - * not include the padding. - */ - -typedef struct { - UINT32 n_namesz; /* Length of name. */ - UINT32 n_descsz; /* Length of descriptor. */ - UINT32 n_type; /* Type of this note. */ -} Elf_Note; - -/* Indexes into the e_ident array. Keep synced with - http://www.sco.com/developers/gabi/latest/ch4.eheader.html */ -#define EI_MAG0 0 /* Magic number, byte 0. */ -#define EI_MAG1 1 /* Magic number, byte 1. */ -#define EI_MAG2 2 /* Magic number, byte 2. */ -#define EI_MAG3 3 /* Magic number, byte 3. */ -#define EI_CLASS 4 /* Class of machine. */ -#define EI_DATA 5 /* Data format. */ -#define EI_VERSION 6 /* ELF format version. */ -#define EI_OSABI 7 /* Operating system / ABI identification */ -#define EI_ABIVERSION 8 /* ABI version */ -#define OLD_EI_BRAND 8 /* Start of architecture identification. */ -#define EI_PAD 9 /* Start of padding (per SVR4 ABI). */ -#define EI_NIDENT 16 /* Size of e_ident array. */ - -/* Values for the magic number bytes. */ -#define ELFMAG0 0x7f -#define ELFMAG1 'E' -#define ELFMAG2 'L' -#define ELFMAG3 'F' -#define ELFMAG "\177ELF" /* magic string */ -#define SELFMAG 4 /* magic string size */ - -/* Values for e_ident[EI_VERSION] and e_version. */ -#define EV_NONE 0 -#define EV_CURRENT 1 - -/* Values for e_ident[EI_CLASS]. */ -#define ELFCLASSNONE 0 /* Unknown class. */ -#define ELFCLASS32 1 /* 32-bit architecture. */ -#define ELFCLASS64 2 /* 64-bit architecture. */ - -/* Values for e_ident[EI_DATA]. */ -#define ELFDATANONE 0 /* Unknown data format. */ -#define ELFDATA2LSB 1 /* 2's complement little-endian. */ -#define ELFDATA2MSB 2 /* 2's complement big-endian. */ - -/* Values for e_ident[EI_OSABI]. */ -#define ELFOSABI_NONE 0 /* UNIX System V ABI */ -#define ELFOSABI_HPUX 1 /* HP-UX operating system */ -#define ELFOSABI_NETBSD 2 /* NetBSD */ -#define ELFOSABI_LINUX 3 /* GNU/Linux */ -#define ELFOSABI_HURD 4 /* GNU/Hurd */ -#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */ -#define ELFOSABI_SOLARIS 6 /* Solaris */ -#define ELFOSABI_AIX 7 /* AIX */ -#define ELFOSABI_IRIX 8 /* IRIX */ -#define ELFOSABI_FREEBSD 9 /* FreeBSD */ -#define ELFOSABI_TRU64 10 /* TRU64 UNIX */ -#define ELFOSABI_MODESTO 11 /* Novell Modesto */ -#define ELFOSABI_OPENBSD 12 /* OpenBSD */ -#define ELFOSABI_OPENVMS 13 /* Open VMS */ -#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */ -#define ELFOSABI_ARM 97 /* ARM */ -#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ - -#define ELFOSABI_SYSV ELFOSABI_NONE /* symbol used in old spec */ -#define ELFOSABI_MONTEREY ELFOSABI_AIX /* Monterey */ - -/* e_ident */ -#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ - (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ - (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ - (ehdr).e_ident[EI_MAG3] == ELFMAG3) - -/* Values for e_type. */ -#define ET_NONE 0 /* Unknown type. */ -#define ET_REL 1 /* Relocatable. */ -#define ET_EXEC 2 /* Executable. */ -#define ET_DYN 3 /* Shared object. */ -#define ET_CORE 4 /* Core file. */ -#define ET_LOOS 0xfe00 /* First operating system specific. */ -#define ET_HIOS 0xfeff /* Last operating system-specific. */ -#define ET_LOPROC 0xff00 /* First processor-specific. */ -#define ET_HIPROC 0xffff /* Last processor-specific. */ - -/* Values for e_machine. */ -#define EM_NONE 0 /* Unknown machine. */ -#define EM_M32 1 /* AT&T WE32100. */ -#define EM_SPARC 2 /* Sun SPARC. */ -#define EM_386 3 /* Intel i386. */ -#define EM_68K 4 /* Motorola 68000. */ -#define EM_88K 5 /* Motorola 88000. */ -#define EM_860 7 /* Intel i860. */ -#define EM_MIPS 8 /* MIPS R3000 Big-Endian only. */ -#define EM_S370 9 /* IBM System/370. */ -#define EM_MIPS_RS3_LE 10 /* MIPS R3000 Little-Endian. */ -#define EM_PARISC 15 /* HP PA-RISC. */ -#define EM_VPP500 17 /* Fujitsu VPP500. */ -#define EM_SPARC32PLUS 18 /* SPARC v8plus. */ -#define EM_960 19 /* Intel 80960. */ -#define EM_PPC 20 /* PowerPC 32-bit. */ -#define EM_PPC64 21 /* PowerPC 64-bit. */ -#define EM_S390 22 /* IBM System/390. */ -#define EM_V800 36 /* NEC V800. */ -#define EM_FR20 37 /* Fujitsu FR20. */ -#define EM_RH32 38 /* TRW RH-32. */ -#define EM_RCE 39 /* Motorola RCE. */ -#define EM_ARM 40 /* ARM. */ -#define EM_SH 42 /* Hitachi SH. */ -#define EM_SPARCV9 43 /* SPARC v9 64-bit. */ -#define EM_TRICORE 44 /* Siemens TriCore embedded processor. */ -#define EM_ARC 45 /* Argonaut RISC Core. */ -#define EM_H8_300 46 /* Hitachi H8/300. */ -#define EM_H8_300H 47 /* Hitachi H8/300H. */ -#define EM_H8S 48 /* Hitachi H8S. */ -#define EM_H8_500 49 /* Hitachi H8/500. */ -#define EM_IA_64 50 /* Intel IA-64 Processor. */ -#define EM_MIPS_X 51 /* Stanford MIPS-X. */ -#define EM_COLDFIRE 52 /* Motorola ColdFire. */ -#define EM_68HC12 53 /* Motorola M68HC12. */ -#define EM_MMA 54 /* Fujitsu MMA. */ -#define EM_PCP 55 /* Siemens PCP. */ -#define EM_NCPU 56 /* Sony nCPU. */ -#define EM_NDR1 57 /* Denso NDR1 microprocessor. */ -#define EM_STARCORE 58 /* Motorola Star*Core processor. */ -#define EM_ME16 59 /* Toyota ME16 processor. */ -#define EM_ST100 60 /* STMicroelectronics ST100 processor. */ -#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ processor. */ -#define EM_X86_64 62 /* Advanced Micro Devices x86-64 */ -#define EM_AMD64 EM_X86_64 /* Advanced Micro Devices x86-64 (compat) */ -#define EM_AARCH64 183 /* ARM 64bit Architecture */ - -/* Non-standard or deprecated. */ -#define EM_486 6 /* Intel i486. */ -#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ -#define EM_ALPHA_STD 41 /* Digital Alpha (standard value). */ -#define EM_ALPHA 0x9026 /* Alpha (written in the absence of an ABI) */ - -/* Special section indexes. */ -#define SHN_UNDEF 0 /* Undefined, missing, irrelevant. */ -#define SHN_LORESERVE 0xff00 /* First of reserved range. */ -#define SHN_LOPROC 0xff00 /* First processor-specific. */ -#define SHN_HIPROC 0xff1f /* Last processor-specific. */ -#define SHN_LOOS 0xff20 /* First operating system-specific. */ -#define SHN_HIOS 0xff3f /* Last operating system-specific. */ -#define SHN_ABS 0xfff1 /* Absolute values. */ -#define SHN_COMMON 0xfff2 /* Common data. */ -#define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere. */ -#define SHN_HIRESERVE 0xffff /* Last of reserved range. */ - -/* sh_type */ -#define SHT_NULL 0 /* inactive */ -#define SHT_PROGBITS 1 /* program defined information */ -#define SHT_SYMTAB 2 /* symbol table section */ -#define SHT_STRTAB 3 /* string table section */ -#define SHT_RELA 4 /* relocation section with addends */ -#define SHT_HASH 5 /* symbol hash table section */ -#define SHT_DYNAMIC 6 /* dynamic section */ -#define SHT_NOTE 7 /* note section */ -#define SHT_NOBITS 8 /* no space section */ -#define SHT_REL 9 /* relocation section - no addends */ -#define SHT_SHLIB 10 /* reserved - purpose unknown */ -#define SHT_DYNSYM 11 /* dynamic symbol table section */ -#define SHT_INIT_ARRAY 14 /* Initialization function pointers. */ -#define SHT_FINI_ARRAY 15 /* Termination function pointers. */ -#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs. */ -#define SHT_GROUP 17 /* Section group. */ -#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX). */ -#define SHT_LOOS 0x60000000 /* First of OS specific semantics */ -#define SHT_LOSUNW 0x6ffffff4 -#define SHT_SUNW_dof 0x6ffffff4 -#define SHT_SUNW_cap 0x6ffffff5 -#define SHT_SUNW_SIGNATURE 0x6ffffff6 -#define SHT_SUNW_ANNOTATE 0x6ffffff7 -#define SHT_SUNW_DEBUGSTR 0x6ffffff8 -#define SHT_SUNW_DEBUG 0x6ffffff9 -#define SHT_SUNW_move 0x6ffffffa -#define SHT_SUNW_COMDAT 0x6ffffffb -#define SHT_SUNW_syminfo 0x6ffffffc -#define SHT_SUNW_verdef 0x6ffffffd -#define SHT_GNU_verdef 0x6ffffffd /* Symbol versions provided */ -#define SHT_SUNW_verneed 0x6ffffffe -#define SHT_GNU_verneed 0x6ffffffe /* Symbol versions required */ -#define SHT_SUNW_versym 0x6fffffff -#define SHT_GNU_versym 0x6fffffff /* Symbol version table */ -#define SHT_HISUNW 0x6fffffff -#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */ -#define SHT_LOPROC 0x70000000 /* reserved range for processor */ -#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ -#define SHT_HIPROC 0x7fffffff /* specific section header types */ -#define SHT_LOUSER 0x80000000 /* reserved range for application */ -#define SHT_HIUSER 0xffffffff /* specific indexes */ - -/* Flags for sh_flags. */ -#define SHF_WRITE 0x1 /* Section contains writable data. */ -#define SHF_ALLOC 0x2 /* Section occupies memory. */ -#define SHF_EXECINSTR 0x4 /* Section contains instructions. */ -#define SHF_MERGE 0x10 /* Section may be merged. */ -#define SHF_STRINGS 0x20 /* Section contains strings. */ -#define SHF_INFO_LINK 0x40 /* sh_info holds section index. */ -#define SHF_LINK_ORDER 0x80 /* Special ordering requirements. */ -#define SHF_OS_NONCONFORMING 0x100 /* OS-specific processing required. */ -#define SHF_GROUP 0x200 /* Member of section group. */ -#define SHF_TLS 0x400 /* Section contains TLS data. */ -#define SHF_MASKOS 0x0ff00000 /* OS-specific semantics. */ -#define SHF_MASKPROC 0xf0000000 /* Processor-specific semantics. */ - -/* Values for p_type. */ -#define PT_NULL 0 /* Unused entry. */ -#define PT_LOAD 1 /* Loadable segment. */ -#define PT_DYNAMIC 2 /* Dynamic linking information segment. */ -#define PT_INTERP 3 /* Pathname of interpreter. */ -#define PT_NOTE 4 /* Auxiliary information. */ -#define PT_SHLIB 5 /* Reserved (not used). */ -#define PT_PHDR 6 /* Location of program header itself. */ -#define PT_TLS 7 /* Thread local storage segment */ -#define PT_LOOS 0x60000000 /* First OS-specific. */ -#define PT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */ -#define PT_GNU_EH_FRAME 0x6474e550 -#define PT_LOSUNW 0x6ffffffa -#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ -#define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */ -#define PT_SUNWDTRACE 0x6ffffffc /* private */ -#define PT_SUNWCAP 0x6ffffffd /* hard/soft capabilities segment */ -#define PT_HISUNW 0x6fffffff -#define PT_HIOS 0x6fffffff /* Last OS-specific. */ -#define PT_LOPROC 0x70000000 /* First processor-specific type. */ -#define PT_HIPROC 0x7fffffff /* Last processor-specific type. */ - -/* Values for p_flags. */ -#define PF_X 0x1 /* Executable. */ -#define PF_W 0x2 /* Writable. */ -#define PF_R 0x4 /* Readable. */ -#define PF_MASKOS 0x0ff00000 /* Operating system-specific. */ -#define PF_MASKPROC 0xf0000000 /* Processor-specific. */ - -/* Extended program header index. */ -#define PN_XNUM 0xffff - -/* Values for d_tag. */ -#define DT_NULL 0 /* Terminating entry. */ -#define DT_NEEDED 1 /* String table offset of a needed shared - library. */ -#define DT_PLTRELSZ 2 /* Total size in bytes of PLT relocations. */ -#define DT_PLTGOT 3 /* Processor-dependent address. */ -#define DT_HASH 4 /* Address of symbol hash table. */ -#define DT_STRTAB 5 /* Address of string table. */ -#define DT_SYMTAB 6 /* Address of symbol table. */ -#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */ -#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */ -#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */ -#define DT_STRSZ 10 /* Size of string table. */ -#define DT_SYMENT 11 /* Size of each symbol table entry. */ -#define DT_INIT 12 /* Address of initialization function. */ -#define DT_FINI 13 /* Address of finalization function. */ -#define DT_SONAME 14 /* String table offset of shared object - name. */ -#define DT_RPATH 15 /* String table offset of library path. [sup] */ -#define DT_SYMBOLIC 16 /* Indicates "symbolic" linking. [sup] */ -#define DT_REL 17 /* Address of ElfNN_Rel relocations. */ -#define DT_RELSZ 18 /* Total size of ElfNN_Rel relocations. */ -#define DT_RELENT 19 /* Size of each ElfNN_Rel relocation. */ -#define DT_PLTREL 20 /* Type of relocation used for PLT. */ -#define DT_DEBUG 21 /* Reserved (not used). */ -#define DT_TEXTREL 22 /* Indicates there may be relocations in - non-writable segments. [sup] */ -#define DT_JMPREL 23 /* Address of PLT relocations. */ -#define DT_BIND_NOW 24 /* [sup] */ -#define DT_INIT_ARRAY 25 /* Address of the array of pointers to - initialization functions */ -#define DT_FINI_ARRAY 26 /* Address of the array of pointers to - termination functions */ -#define DT_INIT_ARRAYSZ 27 /* Size in bytes of the array of - initialization functions. */ -#define DT_FINI_ARRAYSZ 28 /* Size in bytes of the array of - terminationfunctions. */ -#define DT_RUNPATH 29 /* String table offset of a null-terminated - library search path string. */ -#define DT_FLAGS 30 /* Object specific flag values. */ -#define DT_ENCODING 32 /* Values greater than or equal to DT_ENCODING - and less than DT_LOOS follow the rules for - the interpretation of the d_un union - as follows: even == 'd_ptr', even == 'd_val' - or none */ -#define DT_PREINIT_ARRAY 32 /* Address of the array of pointers to - pre-initialization functions. */ -#define DT_PREINIT_ARRAYSZ 33 /* Size in bytes of the array of - pre-initialization functions. */ -#define DT_MAXPOSTAGS 34 /* number of positive tags */ -#define DT_LOOS 0x6000000d /* First OS-specific */ -#define DT_SUNW_AUXILIARY 0x6000000d /* symbol auxiliary name */ -#define DT_SUNW_RTLDINF 0x6000000e /* ld.so.1 info (private) */ -#define DT_SUNW_FILTER 0x6000000f /* symbol filter name */ -#define DT_SUNW_CAP 0x60000010 /* hardware/software */ -#define DT_HIOS 0x6ffff000 /* Last OS-specific */ - -/* - * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the - * Dyn.d_un.d_val field of the Elf*_Dyn structure. - */ -#define DT_VALRNGLO 0x6ffffd00 -#define DT_CHECKSUM 0x6ffffdf8 /* elf checksum */ -#define DT_PLTPADSZ 0x6ffffdf9 /* pltpadding size */ -#define DT_MOVEENT 0x6ffffdfa /* move table entry size */ -#define DT_MOVESZ 0x6ffffdfb /* move table size */ -#define DT_FEATURE_1 0x6ffffdfc /* feature holder */ -#define DT_POSFLAG_1 0x6ffffdfd /* flags for DT_* entries, effecting */ - /* the following DT_* entry. */ - /* See DF_P1_* definitions */ -#define DT_SYMINSZ 0x6ffffdfe /* syminfo table size (in bytes) */ -#define DT_SYMINENT 0x6ffffdff /* syminfo entry size (in bytes) */ -#define DT_VALRNGHI 0x6ffffdff - -/* - * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the - * Dyn.d_un.d_ptr field of the Elf*_Dyn structure. - * - * If any adjustment is made to the ELF object after it has been - * built, these entries will need to be adjusted. - */ -#define DT_ADDRRNGLO 0x6ffffe00 -#define DT_CONFIG 0x6ffffefa /* configuration information */ -#define DT_DEPAUDIT 0x6ffffefb /* dependency auditing */ -#define DT_AUDIT 0x6ffffefc /* object auditing */ -#define DT_PLTPAD 0x6ffffefd /* pltpadding (sparcv9) */ -#define DT_MOVETAB 0x6ffffefe /* move table */ -#define DT_SYMINFO 0x6ffffeff /* syminfo table */ -#define DT_ADDRRNGHI 0x6ffffeff - -#define DT_VERSYM 0x6ffffff0 /* Address of versym section. */ -#define DT_RELACOUNT 0x6ffffff9 /* number of RELATIVE relocations */ -#define DT_RELCOUNT 0x6ffffffa /* number of RELATIVE relocations */ -#define DT_FLAGS_1 0x6ffffffb /* state flags - see DF_1_* defs */ -#define DT_VERDEF 0x6ffffffc /* Address of verdef section. */ -#define DT_VERDEFNUM 0x6ffffffd /* Number of elems in verdef section */ -#define DT_VERNEED 0x6ffffffe /* Address of verneed section. */ -#define DT_VERNEEDNUM 0x6fffffff /* Number of elems in verneed section */ - -#define DT_LOPROC 0x70000000 /* First processor-specific type. */ -#define DT_DEPRECATED_SPARC_REGISTER 0x7000001 -#define DT_AUXILIARY 0x7ffffffd /* shared library auxiliary name */ -#define DT_USED 0x7ffffffe /* ignored - same as needed */ -#define DT_FILTER 0x7fffffff /* shared library filter name */ -#define DT_HIPROC 0x7fffffff /* Last processor-specific type. */ - -/* Values for DT_FLAGS */ -#define DF_ORIGIN 0x0001 /* Indicates that the object being loaded may - make reference to the $ORIGIN substitution - string */ -#define DF_SYMBOLIC 0x0002 /* Indicates "symbolic" linking. */ -#define DF_TEXTREL 0x0004 /* Indicates there may be relocations in - non-writable segments. */ -#define DF_BIND_NOW 0x0008 /* Indicates that the dynamic linker should - process all relocations for the object - containing this entry before transferring - control to the program. */ -#define DF_STATIC_TLS 0x0010 /* Indicates that the shared object or - executable contains code using a static - thread-local storage scheme. */ - -/* Values for n_type. Used in core files. */ -#define NT_PRSTATUS 1 /* Process status. */ -#define NT_FPREGSET 2 /* Floating point registers. */ -#define NT_PRPSINFO 3 /* Process state info. */ - -/* Symbol Binding - ELFNN_ST_BIND - st_info */ -#define STB_LOCAL 0 /* Local symbol */ -#define STB_GLOBAL 1 /* Global symbol */ -#define STB_WEAK 2 /* like global - lower precedence */ -#define STB_LOOS 10 /* Reserved range for operating system */ -#define STB_HIOS 12 /* specific semantics. */ -#define STB_LOPROC 13 /* reserved range for processor */ -#define STB_HIPROC 15 /* specific semantics. */ - -/* Symbol type - ELFNN_ST_TYPE - st_info */ -#define STT_NOTYPE 0 /* Unspecified type. */ -#define STT_OBJECT 1 /* Data object. */ -#define STT_FUNC 2 /* Function. */ -#define STT_SECTION 3 /* Section. */ -#define STT_FILE 4 /* Source file. */ -#define STT_COMMON 5 /* Uninitialized common block. */ -#define STT_TLS 6 /* TLS object. */ -#define STT_NUM 7 -#define STT_LOOS 10 /* Reserved range for operating system */ -#define STT_HIOS 12 /* specific semantics. */ -#define STT_LOPROC 13 /* reserved range for processor */ -#define STT_HIPROC 15 /* specific semantics. */ - -/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */ -#define STV_DEFAULT 0x0 /* Default visibility (see binding). */ -#define STV_INTERNAL 0x1 /* Special meaning in relocatable objects. */ -#define STV_HIDDEN 0x2 /* Not visible. */ -#define STV_PROTECTED 0x3 /* Visible but not preemptible. */ - -/* Special symbol table indexes. */ -#define STN_UNDEF 0 /* Undefined symbol index. */ - -/* Symbol versioning flags. */ -#define VER_DEF_CURRENT 1 -#define VER_DEF_IDX(x) VER_NDX(x) - -#define VER_FLG_BASE 0x01 -#define VER_FLG_WEAK 0x02 - -#define VER_NEED_CURRENT 1 -#define VER_NEED_WEAK (1u << 15) -#define VER_NEED_HIDDEN VER_NDX_HIDDEN -#define VER_NEED_IDX(x) VER_NDX(x) - -#define VER_NDX_LOCAL 0 -#define VER_NDX_GLOBAL 1 -#define VER_NDX_GIVEN 2 - -#define VER_NDX_HIDDEN (1u << 15) -#define VER_NDX(x) ((x) & ~(1u << 15)) - -#define CA_SUNW_NULL 0 -#define CA_SUNW_HW_1 1 /* first hardware capabilities entry */ -#define CA_SUNW_SF_1 2 /* first software capabilities entry */ - -/* - * Syminfo flag values - */ -#define SYMINFO_FLG_DIRECT 0x0001 /* symbol ref has direct association */ - /* to object containing defn. */ -#define SYMINFO_FLG_PASSTHRU 0x0002 /* ignored - see SYMINFO_FLG_FILTER */ -#define SYMINFO_FLG_COPY 0x0004 /* symbol is a copy-reloc */ -#define SYMINFO_FLG_LAZYLOAD 0x0008 /* object containing defn should be */ - /* lazily-loaded */ -#define SYMINFO_FLG_DIRECTBIND 0x0010 /* ref should be bound directly to */ - /* object containing defn. */ -#define SYMINFO_FLG_NOEXTDIRECT 0x0020 /* don't let an external reference */ - /* directly bind to this symbol */ -#define SYMINFO_FLG_FILTER 0x0002 /* symbol ref is associated to a */ -#define SYMINFO_FLG_AUXILIARY 0x0040 /* standard or auxiliary filter */ - -/* - * Syminfo.si_boundto values. - */ -#define SYMINFO_BT_SELF 0xffff /* symbol bound to self */ -#define SYMINFO_BT_PARENT 0xfffe /* symbol bound to parent */ -#define SYMINFO_BT_NONE 0xfffd /* no special symbol binding */ -#define SYMINFO_BT_EXTERN 0xfffc /* symbol defined as external */ -#define SYMINFO_BT_LOWRESERVE 0xff00 /* beginning of reserved entries */ - -/* - * Syminfo version values. - */ -#define SYMINFO_NONE 0 /* Syminfo version */ -#define SYMINFO_CURRENT 1 -#define SYMINFO_NUM 2 - -/* - * Relocation types. - * - * All machine architectures are defined here to allow tools on one to - * handle others. - */ - -#define R_386_NONE 0 /* No relocation. */ -#define R_386_32 1 /* Add symbol value. */ -#define R_386_PC32 2 /* Add PC-relative symbol value. */ -#define R_386_GOT32 3 /* Add PC-relative GOT offset. */ -#define R_386_PLT32 4 /* Add PC-relative PLT offset. */ -#define R_386_COPY 5 /* Copy data from shared object. */ -#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */ -#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */ -#define R_386_RELATIVE 8 /* Add load address of shared object. */ -#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */ -#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */ -#define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */ -#define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */ -#define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */ -#define R_386_TLS_LE 17 /* Negative offset relative to static TLS */ -#define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */ -#define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */ -#define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */ -#define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */ -#define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */ -#define R_386_TLS_GD_POP 27 /* popl instruction for Sun ABI GD sequence */ -#define R_386_TLS_LDM_32 28 /* 32 bit offset to GOT (index,zero) pair */ -#define R_386_TLS_LDM_PUSH 29 /* pushl instruction for Sun ABI LD sequence */ -#define R_386_TLS_LDM_CALL 30 /* call instruction for Sun ABI LD sequence */ -#define R_386_TLS_LDM_POP 31 /* popl instruction for Sun ABI LD sequence */ -#define R_386_TLS_LDO_32 32 /* 32 bit offset from start of TLS block */ -#define R_386_TLS_IE_32 33 /* 32 bit offset to GOT static TLS offset entry */ -#define R_386_TLS_LE_32 34 /* 32 bit offset within static TLS block */ -#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */ -#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */ -#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */ - -/* Null relocation */ -#define R_AARCH64_NONE 256 /* No relocation */ -/* Static AArch64 relocations */ - /* Static data relocations */ -#define R_AARCH64_ABS64 257 /* S + A */ -#define R_AARCH64_ABS32 258 /* S + A */ -#define R_AARCH64_ABS16 259 /* S + A */ -#define R_AARCH64_PREL64 260 /* S + A - P */ -#define R_AARCH64_PREL32 261 /* S + A - P */ -#define R_AARCH64_PREL16 262 /* S + A - P */ - /* Group relocations to create a 16, 32, 48, or 64 bit unsigned data value or address inline */ -#define R_AARCH64_MOVW_UABS_G0 263 /* S + A */ -#define R_AARCH64_MOVW_UABS_G0_NC 264 /* S + A */ -#define R_AARCH64_MOVW_UABS_G1 265 /* S + A */ -#define R_AARCH64_MOVW_UABS_G1_NC 266 /* S + A */ -#define R_AARCH64_MOVW_UABS_G2 267 /* S + A */ -#define R_AARCH64_MOVW_UABS_G2_NC 268 /* S + A */ -#define R_AARCH64_MOVW_UABS_G3 269 /* S + A */ - /* Group relocations to create a 16, 32, 48, or 64 bit signed data or offset value inline */ -#define R_AARCH64_MOVW_SABS_G0 270 /* S + A */ -#define R_AARCH64_MOVW_SABS_G1 271 /* S + A */ -#define R_AARCH64_MOVW_SABS_G2 272 /* S + A */ - /* Relocations to generate 19, 21 and 33 bit PC-relative addresses */ -#define R_AARCH64_LD_PREL_LO19 273 /* S + A - P */ -#define R_AARCH64_ADR_PREL_LO21 274 /* S + A - P */ -#define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page(S+A) - Page(P) */ -#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Page(S+A) - Page(P) */ -#define R_AARCH64_ADD_ABS_LO12_NC 277 /* S + A */ -#define R_AARCH64_LDST8_ABS_LO12_NC 278 /* S + A */ -#define R_AARCH64_LDST16_ABS_LO12_NC 284 /* S + A */ -#define R_AARCH64_LDST32_ABS_LO12_NC 285 /* S + A */ -#define R_AARCH64_LDST64_ABS_LO12_NC 286 /* S + A */ -#define R_AARCH64_LDST128_ABS_LO12_NC 299 /* S + A */ - /* Relocations for control-flow instructions - all offsets are a multiple of 4 */ -#define R_AARCH64_TSTBR14 279 /* S+A-P */ -#define R_AARCH64_CONDBR19 280 /* S+A-P */ -#define R_AARCH64_JUMP26 282 /* S+A-P */ -#define R_AARCH64_CALL26 283 /* S+A-P */ - /* Group relocations to create a 16, 32, 48, or 64 bit PC-relative offset inline */ -#define R_AARCH64_MOVW_PREL_G0 287 /* S+A-P */ -#define R_AARCH64_MOVW_PREL_G0_NC 288 /* S+A-P */ -#define R_AARCH64_MOVW_PREL_G1 289 /* S+A-P */ -#define R_AARCH64_MOVW_PREL_G1_NC 290 /* S+A-P */ -#define R_AARCH64_MOVW_PREL_G2 291 /* S+A-P */ -#define R_AARCH64_MOVW_PREL_G2_NC 292 /* S+A-P */ -#define R_AARCH64_MOVW_PREL_G3 293 /* S+A-P */ - /* Group relocations to create a 16, 32, 48, or 64 bit GOT-relative offsets inline */ -#define R_AARCH64_MOVW_GOTOFF_G0 300 /* G(S)-GOT */ -#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* G(S)-GOT */ -#define R_AARCH64_MOVW_GOTOFF_G1 302 /* G(S)-GOT */ -#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* G(S)-GOT */ -#define R_AARCH64_MOVW_GOTOFF_G2 304 /* G(S)-GOT */ -#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* G(S)-GOT */ -#define R_AARCH64_MOVW_GOTOFF_G3 306 /* G(S)-GOT */ - /* GOT-relative data relocations */ -#define R_AARCH64_GOTREL64 307 /* S+A-GOT */ -#define R_AARCH64_GOTREL32 308 /* S+A-GOT */ - /* GOT-relative instruction relocations */ -#define R_AARCH64_GOT_LD_PREL19 309 /* G(S)-P */ -#define R_AARCH64_LD64_GOTOFF_LO15 310 /* G(S)-GOT */ -#define R_AARCH64_ADR_GOT_PAGE 311 /* Page(G(S))-Page(P) */ -#define R_AARCH64_LD64_GOT_LO12_NC 312 /* G(S) */ -#define R_AARCH64_LD64_GOTPAGE_LO15 313 /* G(S)-Page(GOT) */ -/* Relocations for thread-local storage */ - /* General Dynamic TLS relocations */ -#define R_AARCH64_TLSGD_ADR_PREL21 512 /* G(TLSIDX(S+A)) - P */ -#define R_AARCH64_TLSGD_ADR_PAGE21 513 /* Page(G(TLSIDX(S+A))) - Page(P) */ -#define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* G(TLSIDX(S+A)) */ -#define R_AARCH64_TLSGD_MOVW_G1 515 /* G(TLSIDX(S+A)) - GOT */ -#define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* G(TLSIDX(S+A)) - GOT */ - /* Local Dynamic TLS relocations */ -#define R_AARCH64_TLSLD_ADR_PREL21 517 /* G(LDM(S))) - P */ -#define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Page(G(LDM(S)))-Page(P) */ -#define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* G(LDM(S)) */ -#define R_AARCH64_TLSLD_MOVW_G1 520 /* G(LDM(S)) - GOT */ -#define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* G(LDM(S)) - GOT */ -#define R_AARCH64_TLSLD_LD_PREL19 522 /* G(LDM(S)) - P */ -#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTPREL(S+A) */ -#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* DTPREL(S+A) */ - /* Initial Exec TLS relocations */ -#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* G(TPREL(S+A)) - GOT */ -#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* G(TPREL(S+A)) - GOT */ -#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page(G(TPREL(S+A))) - Page(P) */ -#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* G(TPREL(S+A)) */ -#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* G(TPREL(S+A)) - P */ - /* Local Exec TLS relocations */ -#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TPREL(S+A) */ -#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* TPREL(S+A) */ -/* Dynamic relocations */ - /* Dynamic relocations */ -#define R_AARCH64_COPY 1024 -#define R_AARCH64_GLOB_DAT 1025 /* S + A */ -#define R_AARCH64_JUMP_SLOT 1026 /* S + A */ -#define R_AARCH64_RELATIVE 1027 /* Delta(S) + A , Delta(P) + A */ -#define R_AARCH64_TLS_DTPREL64 1028 /* DTPREL(S+A) */ -#define R_AARCH64_TLS_DTPMOD64 1029 /* LDM(S) */ -#define R_AARCH64_TLS_TPREL64 1030 /* TPREL(S+A) */ -#define R_AARCH64_TLS_DTPREL32 1031 /* DTPREL(S+A) */ -#define R_AARCH64_TLS_DTPMOD32 1032 /* LDM(S) */ -#define R_AARCH64_TLS_TPREL32 1033 /* DTPREL(S+A) */ - -#define R_ALPHA_NONE 0 /* No reloc */ -#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ -#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ -#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ -#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ -#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ -#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ -#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ -#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ -#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ -#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ -#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ -#define R_ALPHA_OP_PUSH 12 /* OP stack push */ -#define R_ALPHA_OP_STORE 13 /* OP stack pop and store */ -#define R_ALPHA_OP_PSUB 14 /* OP stack subtract */ -#define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */ -#define R_ALPHA_GPVALUE 16 -#define R_ALPHA_GPRELHIGH 17 -#define R_ALPHA_GPRELLOW 18 -#define R_ALPHA_IMMED_GP_16 19 -#define R_ALPHA_IMMED_GP_HI32 20 -#define R_ALPHA_IMMED_SCN_HI32 21 -#define R_ALPHA_IMMED_BR_HI32 22 -#define R_ALPHA_IMMED_LO32 23 -#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ -#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ -#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ -#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ - -#define R_ARM_NONE 0 /* No relocation. */ -#define R_ARM_PC24 1 -#define R_ARM_ABS32 2 -#define R_ARM_REL32 3 -#define R_ARM_PC13 4 -#define R_ARM_ABS16 5 -#define R_ARM_ABS12 6 -#define R_ARM_THM_ABS5 7 -#define R_ARM_ABS8 8 -#define R_ARM_SBREL32 9 -#define R_ARM_THM_PC22 10 -#define R_ARM_THM_PC8 11 -#define R_ARM_AMP_VCALL9 12 -#define R_ARM_SWI24 13 -#define R_ARM_THM_SWI8 14 -#define R_ARM_XPC25 15 -#define R_ARM_THM_XPC22 16 -#define R_ARM_COPY 20 /* Copy data from shared object. */ -#define R_ARM_GLOB_DAT 21 /* Set GOT entry to data address. */ -#define R_ARM_JUMP_SLOT 22 /* Set GOT entry to code address. */ -#define R_ARM_RELATIVE 23 /* Add load address of shared object. */ -#define R_ARM_GOTOFF 24 /* Add GOT-relative symbol address. */ -#define R_ARM_GOTPC 25 /* Add PC-relative GOT table address. */ -#define R_ARM_GOT32 26 /* Add PC-relative GOT offset. */ -#define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */ -#define R_ARM_CALL 28 -#define R_ARM_JMP24 29 -#define R_ARM_THM_MOVW_ABS_NC 47 -#define R_ARM_THM_MOVT_ABS 48 - -// Block of PC-relative relocations added to work around gcc putting -// object relocations in static executables. -#define R_ARM_THM_JUMP24 30 -#define R_ARM_PREL31 42 -#define R_ARM_MOVW_PREL_NC 45 -#define R_ARM_MOVT_PREL 46 -#define R_ARM_THM_MOVW_PREL_NC 49 -#define R_ARM_THM_MOVT_PREL 50 -#define R_ARM_THM_JMP6 52 -#define R_ARM_THM_ALU_PREL_11_0 53 -#define R_ARM_THM_PC12 54 -#define R_ARM_REL32_NOI 56 +/** @file +Ported ELF include files from FreeBSD + +Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
+Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
+This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + +**/ +/*- + * Copyright (c) 1998 John D. Polstra. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/elf_common.h,v 1.15.8.2 2007/12/03 21:30:36 marius Exp $ + */ + +#ifndef _SYS_ELF_COMMON_H_ +#define _SYS_ELF_COMMON_H_ 1 + +/* + * ELF definitions that are independent of architecture or word size. + */ + +/* + * Note header. The ".note" section contains an array of notes. Each + * begins with this header, aligned to a word boundary. Immediately + * following the note header is n_namesz bytes of name, padded to the + * next word boundary. Then comes n_descsz bytes of descriptor, again + * padded to a word boundary. The values of n_namesz and n_descsz do + * not include the padding. + */ + +typedef struct { + UINT32 n_namesz; /* Length of name. */ + UINT32 n_descsz; /* Length of descriptor. */ + UINT32 n_type; /* Type of this note. */ +} Elf_Note; + +/* Indexes into the e_ident array. Keep synced with + http://www.sco.com/developers/gabi/latest/ch4.eheader.html */ +#define EI_MAG0 0 /* Magic number, byte 0. */ +#define EI_MAG1 1 /* Magic number, byte 1. */ +#define EI_MAG2 2 /* Magic number, byte 2. */ +#define EI_MAG3 3 /* Magic number, byte 3. */ +#define EI_CLASS 4 /* Class of machine. */ +#define EI_DATA 5 /* Data format. */ +#define EI_VERSION 6 /* ELF format version. */ +#define EI_OSABI 7 /* Operating system / ABI identification */ +#define EI_ABIVERSION 8 /* ABI version */ +#define OLD_EI_BRAND 8 /* Start of architecture identification. */ +#define EI_PAD 9 /* Start of padding (per SVR4 ABI). */ +#define EI_NIDENT 16 /* Size of e_ident array. */ + +/* Values for the magic number bytes. */ +#define ELFMAG0 0x7f +#define ELFMAG1 'E' +#define ELFMAG2 'L' +#define ELFMAG3 'F' +#define ELFMAG "\177ELF" /* magic string */ +#define SELFMAG 4 /* magic string size */ + +/* Values for e_ident[EI_VERSION] and e_version. */ +#define EV_NONE 0 +#define EV_CURRENT 1 + +/* Values for e_ident[EI_CLASS]. */ +#define ELFCLASSNONE 0 /* Unknown class. */ +#define ELFCLASS32 1 /* 32-bit architecture. */ +#define ELFCLASS64 2 /* 64-bit architecture. */ + +/* Values for e_ident[EI_DATA]. */ +#define ELFDATANONE 0 /* Unknown data format. */ +#define ELFDATA2LSB 1 /* 2's complement little-endian. */ +#define ELFDATA2MSB 2 /* 2's complement big-endian. */ + +/* Values for e_ident[EI_OSABI]. */ +#define ELFOSABI_NONE 0 /* UNIX System V ABI */ +#define ELFOSABI_HPUX 1 /* HP-UX operating system */ +#define ELFOSABI_NETBSD 2 /* NetBSD */ +#define ELFOSABI_LINUX 3 /* GNU/Linux */ +#define ELFOSABI_HURD 4 /* GNU/Hurd */ +#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */ +#define ELFOSABI_SOLARIS 6 /* Solaris */ +#define ELFOSABI_AIX 7 /* AIX */ +#define ELFOSABI_IRIX 8 /* IRIX */ +#define ELFOSABI_FREEBSD 9 /* FreeBSD */ +#define ELFOSABI_TRU64 10 /* TRU64 UNIX */ +#define ELFOSABI_MODESTO 11 /* Novell Modesto */ +#define ELFOSABI_OPENBSD 12 /* OpenBSD */ +#define ELFOSABI_OPENVMS 13 /* Open VMS */ +#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */ +#define ELFOSABI_ARM 97 /* ARM */ +#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ + +#define ELFOSABI_SYSV ELFOSABI_NONE /* symbol used in old spec */ +#define ELFOSABI_MONTEREY ELFOSABI_AIX /* Monterey */ + +/* e_ident */ +#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ + (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ + (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ + (ehdr).e_ident[EI_MAG3] == ELFMAG3) + +/* Values for e_type. */ +#define ET_NONE 0 /* Unknown type. */ +#define ET_REL 1 /* Relocatable. */ +#define ET_EXEC 2 /* Executable. */ +#define ET_DYN 3 /* Shared object. */ +#define ET_CORE 4 /* Core file. */ +#define ET_LOOS 0xfe00 /* First operating system specific. */ +#define ET_HIOS 0xfeff /* Last operating system-specific. */ +#define ET_LOPROC 0xff00 /* First processor-specific. */ +#define ET_HIPROC 0xffff /* Last processor-specific. */ + +/* Values for e_machine. */ +#define EM_NONE 0 /* Unknown machine. */ +#define EM_M32 1 /* AT&T WE32100. */ +#define EM_SPARC 2 /* Sun SPARC. */ +#define EM_386 3 /* Intel i386. */ +#define EM_68K 4 /* Motorola 68000. */ +#define EM_88K 5 /* Motorola 88000. */ +#define EM_860 7 /* Intel i860. */ +#define EM_MIPS 8 /* MIPS R3000 Big-Endian only. */ +#define EM_S370 9 /* IBM System/370. */ +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 Little-Endian. */ +#define EM_PARISC 15 /* HP PA-RISC. */ +#define EM_VPP500 17 /* Fujitsu VPP500. */ +#define EM_SPARC32PLUS 18 /* SPARC v8plus. */ +#define EM_960 19 /* Intel 80960. */ +#define EM_PPC 20 /* PowerPC 32-bit. */ +#define EM_PPC64 21 /* PowerPC 64-bit. */ +#define EM_S390 22 /* IBM System/390. */ +#define EM_V800 36 /* NEC V800. */ +#define EM_FR20 37 /* Fujitsu FR20. */ +#define EM_RH32 38 /* TRW RH-32. */ +#define EM_RCE 39 /* Motorola RCE. */ +#define EM_ARM 40 /* ARM. */ +#define EM_SH 42 /* Hitachi SH. */ +#define EM_SPARCV9 43 /* SPARC v9 64-bit. */ +#define EM_TRICORE 44 /* Siemens TriCore embedded processor. */ +#define EM_ARC 45 /* Argonaut RISC Core. */ +#define EM_H8_300 46 /* Hitachi H8/300. */ +#define EM_H8_300H 47 /* Hitachi H8/300H. */ +#define EM_H8S 48 /* Hitachi H8S. */ +#define EM_H8_500 49 /* Hitachi H8/500. */ +#define EM_IA_64 50 /* Intel IA-64 Processor. */ +#define EM_MIPS_X 51 /* Stanford MIPS-X. */ +#define EM_COLDFIRE 52 /* Motorola ColdFire. */ +#define EM_68HC12 53 /* Motorola M68HC12. */ +#define EM_MMA 54 /* Fujitsu MMA. */ +#define EM_PCP 55 /* Siemens PCP. */ +#define EM_NCPU 56 /* Sony nCPU. */ +#define EM_NDR1 57 /* Denso NDR1 microprocessor. */ +#define EM_STARCORE 58 /* Motorola Star*Core processor. */ +#define EM_ME16 59 /* Toyota ME16 processor. */ +#define EM_ST100 60 /* STMicroelectronics ST100 processor. */ +#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ processor. */ +#define EM_X86_64 62 /* Advanced Micro Devices x86-64 */ +#define EM_AMD64 EM_X86_64 /* Advanced Micro Devices x86-64 (compat) */ +#define EM_AARCH64 183 /* ARM 64bit Architecture */ + +/* Non-standard or deprecated. */ +#define EM_486 6 /* Intel i486. */ +#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ +#define EM_ALPHA_STD 41 /* Digital Alpha (standard value). */ +#define EM_ALPHA 0x9026 /* Alpha (written in the absence of an ABI) */ + +/* Special section indexes. */ +#define SHN_UNDEF 0 /* Undefined, missing, irrelevant. */ +#define SHN_LORESERVE 0xff00 /* First of reserved range. */ +#define SHN_LOPROC 0xff00 /* First processor-specific. */ +#define SHN_HIPROC 0xff1f /* Last processor-specific. */ +#define SHN_LOOS 0xff20 /* First operating system-specific. */ +#define SHN_HIOS 0xff3f /* Last operating system-specific. */ +#define SHN_ABS 0xfff1 /* Absolute values. */ +#define SHN_COMMON 0xfff2 /* Common data. */ +#define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere. */ +#define SHN_HIRESERVE 0xffff /* Last of reserved range. */ + +/* sh_type */ +#define SHT_NULL 0 /* inactive */ +#define SHT_PROGBITS 1 /* program defined information */ +#define SHT_SYMTAB 2 /* symbol table section */ +#define SHT_STRTAB 3 /* string table section */ +#define SHT_RELA 4 /* relocation section with addends */ +#define SHT_HASH 5 /* symbol hash table section */ +#define SHT_DYNAMIC 6 /* dynamic section */ +#define SHT_NOTE 7 /* note section */ +#define SHT_NOBITS 8 /* no space section */ +#define SHT_REL 9 /* relocation section - no addends */ +#define SHT_SHLIB 10 /* reserved - purpose unknown */ +#define SHT_DYNSYM 11 /* dynamic symbol table section */ +#define SHT_INIT_ARRAY 14 /* Initialization function pointers. */ +#define SHT_FINI_ARRAY 15 /* Termination function pointers. */ +#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs. */ +#define SHT_GROUP 17 /* Section group. */ +#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX). */ +#define SHT_LOOS 0x60000000 /* First of OS specific semantics */ +#define SHT_LOSUNW 0x6ffffff4 +#define SHT_SUNW_dof 0x6ffffff4 +#define SHT_SUNW_cap 0x6ffffff5 +#define SHT_SUNW_SIGNATURE 0x6ffffff6 +#define SHT_SUNW_ANNOTATE 0x6ffffff7 +#define SHT_SUNW_DEBUGSTR 0x6ffffff8 +#define SHT_SUNW_DEBUG 0x6ffffff9 +#define SHT_SUNW_move 0x6ffffffa +#define SHT_SUNW_COMDAT 0x6ffffffb +#define SHT_SUNW_syminfo 0x6ffffffc +#define SHT_SUNW_verdef 0x6ffffffd +#define SHT_GNU_verdef 0x6ffffffd /* Symbol versions provided */ +#define SHT_SUNW_verneed 0x6ffffffe +#define SHT_GNU_verneed 0x6ffffffe /* Symbol versions required */ +#define SHT_SUNW_versym 0x6fffffff +#define SHT_GNU_versym 0x6fffffff /* Symbol version table */ +#define SHT_HISUNW 0x6fffffff +#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */ +#define SHT_LOPROC 0x70000000 /* reserved range for processor */ +#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ +#define SHT_HIPROC 0x7fffffff /* specific section header types */ +#define SHT_LOUSER 0x80000000 /* reserved range for application */ +#define SHT_HIUSER 0xffffffff /* specific indexes */ + +/* Flags for sh_flags. */ +#define SHF_WRITE 0x1 /* Section contains writable data. */ +#define SHF_ALLOC 0x2 /* Section occupies memory. */ +#define SHF_EXECINSTR 0x4 /* Section contains instructions. */ +#define SHF_MERGE 0x10 /* Section may be merged. */ +#define SHF_STRINGS 0x20 /* Section contains strings. */ +#define SHF_INFO_LINK 0x40 /* sh_info holds section index. */ +#define SHF_LINK_ORDER 0x80 /* Special ordering requirements. */ +#define SHF_OS_NONCONFORMING 0x100 /* OS-specific processing required. */ +#define SHF_GROUP 0x200 /* Member of section group. */ +#define SHF_TLS 0x400 /* Section contains TLS data. */ +#define SHF_MASKOS 0x0ff00000 /* OS-specific semantics. */ +#define SHF_MASKPROC 0xf0000000 /* Processor-specific semantics. */ + +/* Values for p_type. */ +#define PT_NULL 0 /* Unused entry. */ +#define PT_LOAD 1 /* Loadable segment. */ +#define PT_DYNAMIC 2 /* Dynamic linking information segment. */ +#define PT_INTERP 3 /* Pathname of interpreter. */ +#define PT_NOTE 4 /* Auxiliary information. */ +#define PT_SHLIB 5 /* Reserved (not used). */ +#define PT_PHDR 6 /* Location of program header itself. */ +#define PT_TLS 7 /* Thread local storage segment */ +#define PT_LOOS 0x60000000 /* First OS-specific. */ +#define PT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */ +#define PT_GNU_EH_FRAME 0x6474e550 +#define PT_LOSUNW 0x6ffffffa +#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ +#define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */ +#define PT_SUNWDTRACE 0x6ffffffc /* private */ +#define PT_SUNWCAP 0x6ffffffd /* hard/soft capabilities segment */ +#define PT_HISUNW 0x6fffffff +#define PT_HIOS 0x6fffffff /* Last OS-specific. */ +#define PT_LOPROC 0x70000000 /* First processor-specific type. */ +#define PT_HIPROC 0x7fffffff /* Last processor-specific type. */ + +/* Values for p_flags. */ +#define PF_X 0x1 /* Executable. */ +#define PF_W 0x2 /* Writable. */ +#define PF_R 0x4 /* Readable. */ +#define PF_MASKOS 0x0ff00000 /* Operating system-specific. */ +#define PF_MASKPROC 0xf0000000 /* Processor-specific. */ + +/* Extended program header index. */ +#define PN_XNUM 0xffff + +/* Values for d_tag. */ +#define DT_NULL 0 /* Terminating entry. */ +#define DT_NEEDED 1 /* String table offset of a needed shared + library. */ +#define DT_PLTRELSZ 2 /* Total size in bytes of PLT relocations. */ +#define DT_PLTGOT 3 /* Processor-dependent address. */ +#define DT_HASH 4 /* Address of symbol hash table. */ +#define DT_STRTAB 5 /* Address of string table. */ +#define DT_SYMTAB 6 /* Address of symbol table. */ +#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */ +#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */ +#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */ +#define DT_STRSZ 10 /* Size of string table. */ +#define DT_SYMENT 11 /* Size of each symbol table entry. */ +#define DT_INIT 12 /* Address of initialization function. */ +#define DT_FINI 13 /* Address of finalization function. */ +#define DT_SONAME 14 /* String table offset of shared object + name. */ +#define DT_RPATH 15 /* String table offset of library path. [sup] */ +#define DT_SYMBOLIC 16 /* Indicates "symbolic" linking. [sup] */ +#define DT_REL 17 /* Address of ElfNN_Rel relocations. */ +#define DT_RELSZ 18 /* Total size of ElfNN_Rel relocations. */ +#define DT_RELENT 19 /* Size of each ElfNN_Rel relocation. */ +#define DT_PLTREL 20 /* Type of relocation used for PLT. */ +#define DT_DEBUG 21 /* Reserved (not used). */ +#define DT_TEXTREL 22 /* Indicates there may be relocations in + non-writable segments. [sup] */ +#define DT_JMPREL 23 /* Address of PLT relocations. */ +#define DT_BIND_NOW 24 /* [sup] */ +#define DT_INIT_ARRAY 25 /* Address of the array of pointers to + initialization functions */ +#define DT_FINI_ARRAY 26 /* Address of the array of pointers to + termination functions */ +#define DT_INIT_ARRAYSZ 27 /* Size in bytes of the array of + initialization functions. */ +#define DT_FINI_ARRAYSZ 28 /* Size in bytes of the array of + terminationfunctions. */ +#define DT_RUNPATH 29 /* String table offset of a null-terminated + library search path string. */ +#define DT_FLAGS 30 /* Object specific flag values. */ +#define DT_ENCODING 32 /* Values greater than or equal to DT_ENCODING + and less than DT_LOOS follow the rules for + the interpretation of the d_un union + as follows: even == 'd_ptr', even == 'd_val' + or none */ +#define DT_PREINIT_ARRAY 32 /* Address of the array of pointers to + pre-initialization functions. */ +#define DT_PREINIT_ARRAYSZ 33 /* Size in bytes of the array of + pre-initialization functions. */ +#define DT_MAXPOSTAGS 34 /* number of positive tags */ +#define DT_LOOS 0x6000000d /* First OS-specific */ +#define DT_SUNW_AUXILIARY 0x6000000d /* symbol auxiliary name */ +#define DT_SUNW_RTLDINF 0x6000000e /* ld.so.1 info (private) */ +#define DT_SUNW_FILTER 0x6000000f /* symbol filter name */ +#define DT_SUNW_CAP 0x60000010 /* hardware/software */ +#define DT_HIOS 0x6ffff000 /* Last OS-specific */ + +/* + * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the + * Dyn.d_un.d_val field of the Elf*_Dyn structure. + */ +#define DT_VALRNGLO 0x6ffffd00 +#define DT_CHECKSUM 0x6ffffdf8 /* elf checksum */ +#define DT_PLTPADSZ 0x6ffffdf9 /* pltpadding size */ +#define DT_MOVEENT 0x6ffffdfa /* move table entry size */ +#define DT_MOVESZ 0x6ffffdfb /* move table size */ +#define DT_FEATURE_1 0x6ffffdfc /* feature holder */ +#define DT_POSFLAG_1 0x6ffffdfd /* flags for DT_* entries, effecting */ + /* the following DT_* entry. */ + /* See DF_P1_* definitions */ +#define DT_SYMINSZ 0x6ffffdfe /* syminfo table size (in bytes) */ +#define DT_SYMINENT 0x6ffffdff /* syminfo entry size (in bytes) */ +#define DT_VALRNGHI 0x6ffffdff + +/* + * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the + * Dyn.d_un.d_ptr field of the Elf*_Dyn structure. + * + * If any adjustment is made to the ELF object after it has been + * built, these entries will need to be adjusted. + */ +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_CONFIG 0x6ffffefa /* configuration information */ +#define DT_DEPAUDIT 0x6ffffefb /* dependency auditing */ +#define DT_AUDIT 0x6ffffefc /* object auditing */ +#define DT_PLTPAD 0x6ffffefd /* pltpadding (sparcv9) */ +#define DT_MOVETAB 0x6ffffefe /* move table */ +#define DT_SYMINFO 0x6ffffeff /* syminfo table */ +#define DT_ADDRRNGHI 0x6ffffeff + +#define DT_VERSYM 0x6ffffff0 /* Address of versym section. */ +#define DT_RELACOUNT 0x6ffffff9 /* number of RELATIVE relocations */ +#define DT_RELCOUNT 0x6ffffffa /* number of RELATIVE relocations */ +#define DT_FLAGS_1 0x6ffffffb /* state flags - see DF_1_* defs */ +#define DT_VERDEF 0x6ffffffc /* Address of verdef section. */ +#define DT_VERDEFNUM 0x6ffffffd /* Number of elems in verdef section */ +#define DT_VERNEED 0x6ffffffe /* Address of verneed section. */ +#define DT_VERNEEDNUM 0x6fffffff /* Number of elems in verneed section */ + +#define DT_LOPROC 0x70000000 /* First processor-specific type. */ +#define DT_DEPRECATED_SPARC_REGISTER 0x7000001 +#define DT_AUXILIARY 0x7ffffffd /* shared library auxiliary name */ +#define DT_USED 0x7ffffffe /* ignored - same as needed */ +#define DT_FILTER 0x7fffffff /* shared library filter name */ +#define DT_HIPROC 0x7fffffff /* Last processor-specific type. */ + +/* Values for DT_FLAGS */ +#define DF_ORIGIN 0x0001 /* Indicates that the object being loaded may + make reference to the $ORIGIN substitution + string */ +#define DF_SYMBOLIC 0x0002 /* Indicates "symbolic" linking. */ +#define DF_TEXTREL 0x0004 /* Indicates there may be relocations in + non-writable segments. */ +#define DF_BIND_NOW 0x0008 /* Indicates that the dynamic linker should + process all relocations for the object + containing this entry before transferring + control to the program. */ +#define DF_STATIC_TLS 0x0010 /* Indicates that the shared object or + executable contains code using a static + thread-local storage scheme. */ + +/* Values for n_type. Used in core files. */ +#define NT_PRSTATUS 1 /* Process status. */ +#define NT_FPREGSET 2 /* Floating point registers. */ +#define NT_PRPSINFO 3 /* Process state info. */ + +/* Symbol Binding - ELFNN_ST_BIND - st_info */ +#define STB_LOCAL 0 /* Local symbol */ +#define STB_GLOBAL 1 /* Global symbol */ +#define STB_WEAK 2 /* like global - lower precedence */ +#define STB_LOOS 10 /* Reserved range for operating system */ +#define STB_HIOS 12 /* specific semantics. */ +#define STB_LOPROC 13 /* reserved range for processor */ +#define STB_HIPROC 15 /* specific semantics. */ + +/* Symbol type - ELFNN_ST_TYPE - st_info */ +#define STT_NOTYPE 0 /* Unspecified type. */ +#define STT_OBJECT 1 /* Data object. */ +#define STT_FUNC 2 /* Function. */ +#define STT_SECTION 3 /* Section. */ +#define STT_FILE 4 /* Source file. */ +#define STT_COMMON 5 /* Uninitialized common block. */ +#define STT_TLS 6 /* TLS object. */ +#define STT_NUM 7 +#define STT_LOOS 10 /* Reserved range for operating system */ +#define STT_HIOS 12 /* specific semantics. */ +#define STT_LOPROC 13 /* reserved range for processor */ +#define STT_HIPROC 15 /* specific semantics. */ + +/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */ +#define STV_DEFAULT 0x0 /* Default visibility (see binding). */ +#define STV_INTERNAL 0x1 /* Special meaning in relocatable objects. */ +#define STV_HIDDEN 0x2 /* Not visible. */ +#define STV_PROTECTED 0x3 /* Visible but not preemptible. */ + +/* Special symbol table indexes. */ +#define STN_UNDEF 0 /* Undefined symbol index. */ + +/* Symbol versioning flags. */ +#define VER_DEF_CURRENT 1 +#define VER_DEF_IDX(x) VER_NDX(x) + +#define VER_FLG_BASE 0x01 +#define VER_FLG_WEAK 0x02 + +#define VER_NEED_CURRENT 1 +#define VER_NEED_WEAK (1u << 15) +#define VER_NEED_HIDDEN VER_NDX_HIDDEN +#define VER_NEED_IDX(x) VER_NDX(x) + +#define VER_NDX_LOCAL 0 +#define VER_NDX_GLOBAL 1 +#define VER_NDX_GIVEN 2 + +#define VER_NDX_HIDDEN (1u << 15) +#define VER_NDX(x) ((x) & ~(1u << 15)) + +#define CA_SUNW_NULL 0 +#define CA_SUNW_HW_1 1 /* first hardware capabilities entry */ +#define CA_SUNW_SF_1 2 /* first software capabilities entry */ + +/* + * Syminfo flag values + */ +#define SYMINFO_FLG_DIRECT 0x0001 /* symbol ref has direct association */ + /* to object containing defn. */ +#define SYMINFO_FLG_PASSTHRU 0x0002 /* ignored - see SYMINFO_FLG_FILTER */ +#define SYMINFO_FLG_COPY 0x0004 /* symbol is a copy-reloc */ +#define SYMINFO_FLG_LAZYLOAD 0x0008 /* object containing defn should be */ + /* lazily-loaded */ +#define SYMINFO_FLG_DIRECTBIND 0x0010 /* ref should be bound directly to */ + /* object containing defn. */ +#define SYMINFO_FLG_NOEXTDIRECT 0x0020 /* don't let an external reference */ + /* directly bind to this symbol */ +#define SYMINFO_FLG_FILTER 0x0002 /* symbol ref is associated to a */ +#define SYMINFO_FLG_AUXILIARY 0x0040 /* standard or auxiliary filter */ + +/* + * Syminfo.si_boundto values. + */ +#define SYMINFO_BT_SELF 0xffff /* symbol bound to self */ +#define SYMINFO_BT_PARENT 0xfffe /* symbol bound to parent */ +#define SYMINFO_BT_NONE 0xfffd /* no special symbol binding */ +#define SYMINFO_BT_EXTERN 0xfffc /* symbol defined as external */ +#define SYMINFO_BT_LOWRESERVE 0xff00 /* beginning of reserved entries */ + +/* + * Syminfo version values. + */ +#define SYMINFO_NONE 0 /* Syminfo version */ +#define SYMINFO_CURRENT 1 +#define SYMINFO_NUM 2 + +/* + * Relocation types. + * + * All machine architectures are defined here to allow tools on one to + * handle others. + */ + +#define R_386_NONE 0 /* No relocation. */ +#define R_386_32 1 /* Add symbol value. */ +#define R_386_PC32 2 /* Add PC-relative symbol value. */ +#define R_386_GOT32 3 /* Add PC-relative GOT offset. */ +#define R_386_PLT32 4 /* Add PC-relative PLT offset. */ +#define R_386_COPY 5 /* Copy data from shared object. */ +#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */ +#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */ +#define R_386_RELATIVE 8 /* Add load address of shared object. */ +#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */ +#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */ +#define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */ +#define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */ +#define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */ +#define R_386_TLS_LE 17 /* Negative offset relative to static TLS */ +#define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */ +#define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */ +#define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */ +#define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */ +#define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */ +#define R_386_TLS_GD_POP 27 /* popl instruction for Sun ABI GD sequence */ +#define R_386_TLS_LDM_32 28 /* 32 bit offset to GOT (index,zero) pair */ +#define R_386_TLS_LDM_PUSH 29 /* pushl instruction for Sun ABI LD sequence */ +#define R_386_TLS_LDM_CALL 30 /* call instruction for Sun ABI LD sequence */ +#define R_386_TLS_LDM_POP 31 /* popl instruction for Sun ABI LD sequence */ +#define R_386_TLS_LDO_32 32 /* 32 bit offset from start of TLS block */ +#define R_386_TLS_IE_32 33 /* 32 bit offset to GOT static TLS offset entry */ +#define R_386_TLS_LE_32 34 /* 32 bit offset within static TLS block */ +#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */ +#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */ +#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */ + +/* Null relocation */ +#define R_AARCH64_NONE 256 /* No relocation */ +/* Static AArch64 relocations */ + /* Static data relocations */ +#define R_AARCH64_ABS64 257 /* S + A */ +#define R_AARCH64_ABS32 258 /* S + A */ +#define R_AARCH64_ABS16 259 /* S + A */ +#define R_AARCH64_PREL64 260 /* S + A - P */ +#define R_AARCH64_PREL32 261 /* S + A - P */ +#define R_AARCH64_PREL16 262 /* S + A - P */ + /* Group relocations to create a 16, 32, 48, or 64 bit unsigned data value or address inline */ +#define R_AARCH64_MOVW_UABS_G0 263 /* S + A */ +#define R_AARCH64_MOVW_UABS_G0_NC 264 /* S + A */ +#define R_AARCH64_MOVW_UABS_G1 265 /* S + A */ +#define R_AARCH64_MOVW_UABS_G1_NC 266 /* S + A */ +#define R_AARCH64_MOVW_UABS_G2 267 /* S + A */ +#define R_AARCH64_MOVW_UABS_G2_NC 268 /* S + A */ +#define R_AARCH64_MOVW_UABS_G3 269 /* S + A */ + /* Group relocations to create a 16, 32, 48, or 64 bit signed data or offset value inline */ +#define R_AARCH64_MOVW_SABS_G0 270 /* S + A */ +#define R_AARCH64_MOVW_SABS_G1 271 /* S + A */ +#define R_AARCH64_MOVW_SABS_G2 272 /* S + A */ + /* Relocations to generate 19, 21 and 33 bit PC-relative addresses */ +#define R_AARCH64_LD_PREL_LO19 273 /* S + A - P */ +#define R_AARCH64_ADR_PREL_LO21 274 /* S + A - P */ +#define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page(S+A) - Page(P) */ +#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Page(S+A) - Page(P) */ +#define R_AARCH64_ADD_ABS_LO12_NC 277 /* S + A */ +#define R_AARCH64_LDST8_ABS_LO12_NC 278 /* S + A */ +#define R_AARCH64_LDST16_ABS_LO12_NC 284 /* S + A */ +#define R_AARCH64_LDST32_ABS_LO12_NC 285 /* S + A */ +#define R_AARCH64_LDST64_ABS_LO12_NC 286 /* S + A */ +#define R_AARCH64_LDST128_ABS_LO12_NC 299 /* S + A */ + /* Relocations for control-flow instructions - all offsets are a multiple of 4 */ +#define R_AARCH64_TSTBR14 279 /* S+A-P */ +#define R_AARCH64_CONDBR19 280 /* S+A-P */ +#define R_AARCH64_JUMP26 282 /* S+A-P */ +#define R_AARCH64_CALL26 283 /* S+A-P */ + /* Group relocations to create a 16, 32, 48, or 64 bit PC-relative offset inline */ +#define R_AARCH64_MOVW_PREL_G0 287 /* S+A-P */ +#define R_AARCH64_MOVW_PREL_G0_NC 288 /* S+A-P */ +#define R_AARCH64_MOVW_PREL_G1 289 /* S+A-P */ +#define R_AARCH64_MOVW_PREL_G1_NC 290 /* S+A-P */ +#define R_AARCH64_MOVW_PREL_G2 291 /* S+A-P */ +#define R_AARCH64_MOVW_PREL_G2_NC 292 /* S+A-P */ +#define R_AARCH64_MOVW_PREL_G3 293 /* S+A-P */ + /* Group relocations to create a 16, 32, 48, or 64 bit GOT-relative offsets inline */ +#define R_AARCH64_MOVW_GOTOFF_G0 300 /* G(S)-GOT */ +#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* G(S)-GOT */ +#define R_AARCH64_MOVW_GOTOFF_G1 302 /* G(S)-GOT */ +#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* G(S)-GOT */ +#define R_AARCH64_MOVW_GOTOFF_G2 304 /* G(S)-GOT */ +#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* G(S)-GOT */ +#define R_AARCH64_MOVW_GOTOFF_G3 306 /* G(S)-GOT */ + /* GOT-relative data relocations */ +#define R_AARCH64_GOTREL64 307 /* S+A-GOT */ +#define R_AARCH64_GOTREL32 308 /* S+A-GOT */ + /* GOT-relative instruction relocations */ +#define R_AARCH64_GOT_LD_PREL19 309 /* G(S)-P */ +#define R_AARCH64_LD64_GOTOFF_LO15 310 /* G(S)-GOT */ +#define R_AARCH64_ADR_GOT_PAGE 311 /* Page(G(S))-Page(P) */ +#define R_AARCH64_LD64_GOT_LO12_NC 312 /* G(S) */ +#define R_AARCH64_LD64_GOTPAGE_LO15 313 /* G(S)-Page(GOT) */ +/* Relocations for thread-local storage */ + /* General Dynamic TLS relocations */ +#define R_AARCH64_TLSGD_ADR_PREL21 512 /* G(TLSIDX(S+A)) - P */ +#define R_AARCH64_TLSGD_ADR_PAGE21 513 /* Page(G(TLSIDX(S+A))) - Page(P) */ +#define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* G(TLSIDX(S+A)) */ +#define R_AARCH64_TLSGD_MOVW_G1 515 /* G(TLSIDX(S+A)) - GOT */ +#define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* G(TLSIDX(S+A)) - GOT */ + /* Local Dynamic TLS relocations */ +#define R_AARCH64_TLSLD_ADR_PREL21 517 /* G(LDM(S))) - P */ +#define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Page(G(LDM(S)))-Page(P) */ +#define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* G(LDM(S)) */ +#define R_AARCH64_TLSLD_MOVW_G1 520 /* G(LDM(S)) - GOT */ +#define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* G(LDM(S)) - GOT */ +#define R_AARCH64_TLSLD_LD_PREL19 522 /* G(LDM(S)) - P */ +#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTPREL(S+A) */ +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* DTPREL(S+A) */ + /* Initial Exec TLS relocations */ +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* G(TPREL(S+A)) - GOT */ +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* G(TPREL(S+A)) - GOT */ +#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page(G(TPREL(S+A))) - Page(P) */ +#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* G(TPREL(S+A)) */ +#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* G(TPREL(S+A)) - P */ + /* Local Exec TLS relocations */ +#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TPREL(S+A) */ +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* TPREL(S+A) */ +/* Dynamic relocations */ + /* Dynamic relocations */ +#define R_AARCH64_COPY 1024 +#define R_AARCH64_GLOB_DAT 1025 /* S + A */ +#define R_AARCH64_JUMP_SLOT 1026 /* S + A */ +#define R_AARCH64_RELATIVE 1027 /* Delta(S) + A , Delta(P) + A */ +#define R_AARCH64_TLS_DTPREL64 1028 /* DTPREL(S+A) */ +#define R_AARCH64_TLS_DTPMOD64 1029 /* LDM(S) */ +#define R_AARCH64_TLS_TPREL64 1030 /* TPREL(S+A) */ +#define R_AARCH64_TLS_DTPREL32 1031 /* DTPREL(S+A) */ +#define R_AARCH64_TLS_DTPMOD32 1032 /* LDM(S) */ +#define R_AARCH64_TLS_TPREL32 1033 /* DTPREL(S+A) */ + +#define R_ALPHA_NONE 0 /* No reloc */ +#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ +#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ +#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ +#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ +#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ +#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ +#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ +#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ +#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ +#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ +#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ +#define R_ALPHA_OP_PUSH 12 /* OP stack push */ +#define R_ALPHA_OP_STORE 13 /* OP stack pop and store */ +#define R_ALPHA_OP_PSUB 14 /* OP stack subtract */ +#define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */ +#define R_ALPHA_GPVALUE 16 +#define R_ALPHA_GPRELHIGH 17 +#define R_ALPHA_GPRELLOW 18 +#define R_ALPHA_IMMED_GP_16 19 +#define R_ALPHA_IMMED_GP_HI32 20 +#define R_ALPHA_IMMED_SCN_HI32 21 +#define R_ALPHA_IMMED_BR_HI32 22 +#define R_ALPHA_IMMED_LO32 23 +#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ +#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ +#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ +#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ + +#define R_ARM_NONE 0 /* No relocation. */ +#define R_ARM_PC24 1 +#define R_ARM_ABS32 2 +#define R_ARM_REL32 3 +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 +#define R_ARM_ABS12 6 +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_SWI24 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#define R_ARM_COPY 20 /* Copy data from shared object. */ +#define R_ARM_GLOB_DAT 21 /* Set GOT entry to data address. */ +#define R_ARM_JUMP_SLOT 22 /* Set GOT entry to code address. */ +#define R_ARM_RELATIVE 23 /* Add load address of shared object. */ +#define R_ARM_GOTOFF 24 /* Add GOT-relative symbol address. */ +#define R_ARM_GOTPC 25 /* Add PC-relative GOT table address. */ +#define R_ARM_GOT32 26 /* Add PC-relative GOT offset. */ +#define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */ +#define R_ARM_CALL 28 +#define R_ARM_JMP24 29 +#define R_ARM_THM_MOVW_ABS_NC 47 +#define R_ARM_THM_MOVT_ABS 48 + +// Block of PC-relative relocations added to work around gcc putting +// object relocations in static executables. +#define R_ARM_THM_JUMP24 30 +#define R_ARM_PREL31 42 +#define R_ARM_MOVW_PREL_NC 45 +#define R_ARM_MOVT_PREL 46 +#define R_ARM_THM_MOVW_PREL_NC 49 +#define R_ARM_THM_MOVT_PREL 50 +#define R_ARM_THM_JMP6 52 +#define R_ARM_THM_ALU_PREL_11_0 53 +#define R_ARM_THM_PC12 54 +#define R_ARM_REL32_NOI 56 #define R_ARM_ALU_PC_G0_NC 57 #define R_ARM_ALU_PC_G0 58 #define R_ARM_ALU_PC_G1_NC 59 @@ -757,301 +757,301 @@ typedef struct { #define R_ARM_LDRS_PC_G2 66 #define R_ARM_LDC_PC_G0 67 #define R_ARM_LDC_PC_G1 68 -#define R_ARM_LDC_PC_G2 69 -#define R_ARM_GOT_PREL 96 -#define R_ARM_THM_JUMP11 102 -#define R_ARM_THM_JUMP8 103 -#define R_ARM_TLS_GD32 104 -#define R_ARM_TLS_LDM32 105 -#define R_ARM_TLS_IE32 107 - -#define R_ARM_THM_JUMP19 51 -#define R_ARM_GNU_VTENTRY 100 -#define R_ARM_GNU_VTINHERIT 101 -#define R_ARM_RSBREL32 250 -#define R_ARM_THM_RPC22 251 -#define R_ARM_RREL32 252 -#define R_ARM_RABS32 253 -#define R_ARM_RPC24 254 -#define R_ARM_RBASE 255 - - - -/* Name Value Field Calculation */ -#define R_IA_64_NONE 0 /* None */ -#define R_IA_64_IMM14 0x21 /* immediate14 S + A */ -#define R_IA_64_IMM22 0x22 /* immediate22 S + A */ -#define R_IA_64_IMM64 0x23 /* immediate64 S + A */ -#define R_IA_64_DIR32MSB 0x24 /* word32 MSB S + A */ -#define R_IA_64_DIR32LSB 0x25 /* word32 LSB S + A */ -#define R_IA_64_DIR64MSB 0x26 /* word64 MSB S + A */ -#define R_IA_64_DIR64LSB 0x27 /* word64 LSB S + A */ -#define R_IA_64_GPREL22 0x2a /* immediate22 @gprel(S + A) */ -#define R_IA_64_GPREL64I 0x2b /* immediate64 @gprel(S + A) */ -#define R_IA_64_GPREL32MSB 0x2c /* word32 MSB @gprel(S + A) */ -#define R_IA_64_GPREL32LSB 0x2d /* word32 LSB @gprel(S + A) */ -#define R_IA_64_GPREL64MSB 0x2e /* word64 MSB @gprel(S + A) */ -#define R_IA_64_GPREL64LSB 0x2f /* word64 LSB @gprel(S + A) */ -#define R_IA_64_LTOFF22 0x32 /* immediate22 @ltoff(S + A) */ -#define R_IA_64_LTOFF64I 0x33 /* immediate64 @ltoff(S + A) */ -#define R_IA_64_PLTOFF22 0x3a /* immediate22 @pltoff(S + A) */ -#define R_IA_64_PLTOFF64I 0x3b /* immediate64 @pltoff(S + A) */ -#define R_IA_64_PLTOFF64MSB 0x3e /* word64 MSB @pltoff(S + A) */ -#define R_IA_64_PLTOFF64LSB 0x3f /* word64 LSB @pltoff(S + A) */ -#define R_IA_64_FPTR64I 0x43 /* immediate64 @fptr(S + A) */ -#define R_IA_64_FPTR32MSB 0x44 /* word32 MSB @fptr(S + A) */ -#define R_IA_64_FPTR32LSB 0x45 /* word32 LSB @fptr(S + A) */ -#define R_IA_64_FPTR64MSB 0x46 /* word64 MSB @fptr(S + A) */ -#define R_IA_64_FPTR64LSB 0x47 /* word64 LSB @fptr(S + A) */ -#define R_IA_64_PCREL60B 0x48 /* immediate60 form1 S + A - P */ -#define R_IA_64_PCREL21B 0x49 /* immediate21 form1 S + A - P */ -#define R_IA_64_PCREL21M 0x4a /* immediate21 form2 S + A - P */ -#define R_IA_64_PCREL21F 0x4b /* immediate21 form3 S + A - P */ -#define R_IA_64_PCREL32MSB 0x4c /* word32 MSB S + A - P */ -#define R_IA_64_PCREL32LSB 0x4d /* word32 LSB S + A - P */ -#define R_IA_64_PCREL64MSB 0x4e /* word64 MSB S + A - P */ -#define R_IA_64_PCREL64LSB 0x4f /* word64 LSB S + A - P */ -#define R_IA_64_LTOFF_FPTR22 0x52 /* immediate22 @ltoff(@fptr(S + A)) */ -#define R_IA_64_LTOFF_FPTR64I 0x53 /* immediate64 @ltoff(@fptr(S + A)) */ -#define R_IA_64_LTOFF_FPTR32MSB 0x54 /* word32 MSB @ltoff(@fptr(S + A)) */ -#define R_IA_64_LTOFF_FPTR32LSB 0x55 /* word32 LSB @ltoff(@fptr(S + A)) */ -#define R_IA_64_LTOFF_FPTR64MSB 0x56 /* word64 MSB @ltoff(@fptr(S + A)) */ -#define R_IA_64_LTOFF_FPTR64LSB 0x57 /* word64 LSB @ltoff(@fptr(S + A)) */ -#define R_IA_64_SEGREL32MSB 0x5c /* word32 MSB @segrel(S + A) */ -#define R_IA_64_SEGREL32LSB 0x5d /* word32 LSB @segrel(S + A) */ -#define R_IA_64_SEGREL64MSB 0x5e /* word64 MSB @segrel(S + A) */ -#define R_IA_64_SEGREL64LSB 0x5f /* word64 LSB @segrel(S + A) */ -#define R_IA_64_SECREL32MSB 0x64 /* word32 MSB @secrel(S + A) */ -#define R_IA_64_SECREL32LSB 0x65 /* word32 LSB @secrel(S + A) */ -#define R_IA_64_SECREL64MSB 0x66 /* word64 MSB @secrel(S + A) */ -#define R_IA_64_SECREL64LSB 0x67 /* word64 LSB @secrel(S + A) */ -#define R_IA_64_REL32MSB 0x6c /* word32 MSB BD + A */ -#define R_IA_64_REL32LSB 0x6d /* word32 LSB BD + A */ -#define R_IA_64_REL64MSB 0x6e /* word64 MSB BD + A */ -#define R_IA_64_REL64LSB 0x6f /* word64 LSB BD + A */ -#define R_IA_64_LTV32MSB 0x74 /* word32 MSB S + A */ -#define R_IA_64_LTV32LSB 0x75 /* word32 LSB S + A */ -#define R_IA_64_LTV64MSB 0x76 /* word64 MSB S + A */ -#define R_IA_64_LTV64LSB 0x77 /* word64 LSB S + A */ -#define R_IA_64_PCREL21BI 0x79 /* immediate21 form1 S + A - P */ -#define R_IA_64_PCREL22 0x7a /* immediate22 S + A - P */ -#define R_IA_64_PCREL64I 0x7b /* immediate64 S + A - P */ -#define R_IA_64_IPLTMSB 0x80 /* function descriptor MSB special */ -#define R_IA_64_IPLTLSB 0x81 /* function descriptor LSB speciaal */ -#define R_IA_64_SUB 0x85 /* immediate64 A - S */ -#define R_IA_64_LTOFF22X 0x86 /* immediate22 special */ -#define R_IA_64_LDXMOV 0x87 /* immediate22 special */ -#define R_IA_64_TPREL14 0x91 /* imm14 @tprel(S + A) */ -#define R_IA_64_TPREL22 0x92 /* imm22 @tprel(S + A) */ -#define R_IA_64_TPREL64I 0x93 /* imm64 @tprel(S + A) */ -#define R_IA_64_TPREL64MSB 0x96 /* word64 MSB @tprel(S + A) */ -#define R_IA_64_TPREL64LSB 0x97 /* word64 LSB @tprel(S + A) */ -#define R_IA_64_LTOFF_TPREL22 0x9a /* imm22 @ltoff(@tprel(S+A)) */ -#define R_IA_64_DTPMOD64MSB 0xa6 /* word64 MSB @dtpmod(S + A) */ -#define R_IA_64_DTPMOD64LSB 0xa7 /* word64 LSB @dtpmod(S + A) */ -#define R_IA_64_LTOFF_DTPMOD22 0xaa /* imm22 @ltoff(@dtpmod(S+A)) */ -#define R_IA_64_DTPREL14 0xb1 /* imm14 @dtprel(S + A) */ -#define R_IA_64_DTPREL22 0xb2 /* imm22 @dtprel(S + A) */ -#define R_IA_64_DTPREL64I 0xb3 /* imm64 @dtprel(S + A) */ -#define R_IA_64_DTPREL32MSB 0xb4 /* word32 MSB @dtprel(S + A) */ -#define R_IA_64_DTPREL32LSB 0xb5 /* word32 LSB @dtprel(S + A) */ -#define R_IA_64_DTPREL64MSB 0xb6 /* word64 MSB @dtprel(S + A) */ -#define R_IA_64_DTPREL64LSB 0xb7 /* word64 LSB @dtprel(S + A) */ -#define R_IA_64_LTOFF_DTPREL22 0xba /* imm22 @ltoff(@dtprel(S+A)) */ - -#define R_PPC_NONE 0 /* No relocation. */ -#define R_PPC_ADDR32 1 -#define R_PPC_ADDR24 2 -#define R_PPC_ADDR16 3 -#define R_PPC_ADDR16_LO 4 -#define R_PPC_ADDR16_HI 5 -#define R_PPC_ADDR16_HA 6 -#define R_PPC_ADDR14 7 -#define R_PPC_ADDR14_BRTAKEN 8 -#define R_PPC_ADDR14_BRNTAKEN 9 -#define R_PPC_REL24 10 -#define R_PPC_REL14 11 -#define R_PPC_REL14_BRTAKEN 12 -#define R_PPC_REL14_BRNTAKEN 13 -#define R_PPC_GOT16 14 -#define R_PPC_GOT16_LO 15 -#define R_PPC_GOT16_HI 16 -#define R_PPC_GOT16_HA 17 -#define R_PPC_PLTREL24 18 -#define R_PPC_COPY 19 -#define R_PPC_GLOB_DAT 20 -#define R_PPC_JMP_SLOT 21 -#define R_PPC_RELATIVE 22 -#define R_PPC_LOCAL24PC 23 -#define R_PPC_UADDR32 24 -#define R_PPC_UADDR16 25 -#define R_PPC_REL32 26 -#define R_PPC_PLT32 27 -#define R_PPC_PLTREL32 28 -#define R_PPC_PLT16_LO 29 -#define R_PPC_PLT16_HI 30 -#define R_PPC_PLT16_HA 31 -#define R_PPC_SDAREL16 32 -#define R_PPC_SECTOFF 33 -#define R_PPC_SECTOFF_LO 34 -#define R_PPC_SECTOFF_HI 35 -#define R_PPC_SECTOFF_HA 36 - -/* - * TLS relocations - */ -#define R_PPC_TLS 67 -#define R_PPC_DTPMOD32 68 -#define R_PPC_TPREL16 69 -#define R_PPC_TPREL16_LO 70 -#define R_PPC_TPREL16_HI 71 -#define R_PPC_TPREL16_HA 72 -#define R_PPC_TPREL32 73 -#define R_PPC_DTPREL16 74 -#define R_PPC_DTPREL16_LO 75 -#define R_PPC_DTPREL16_HI 76 -#define R_PPC_DTPREL16_HA 77 -#define R_PPC_DTPREL32 78 -#define R_PPC_GOT_TLSGD16 79 -#define R_PPC_GOT_TLSGD16_LO 80 -#define R_PPC_GOT_TLSGD16_HI 81 -#define R_PPC_GOT_TLSGD16_HA 82 -#define R_PPC_GOT_TLSLD16 83 -#define R_PPC_GOT_TLSLD16_LO 84 -#define R_PPC_GOT_TLSLD16_HI 85 -#define R_PPC_GOT_TLSLD16_HA 86 -#define R_PPC_GOT_TPREL16 87 -#define R_PPC_GOT_TPREL16_LO 88 -#define R_PPC_GOT_TPREL16_HI 89 -#define R_PPC_GOT_TPREL16_HA 90 - -/* - * The remaining relocs are from the Embedded ELF ABI, and are not in the - * SVR4 ELF ABI. - */ - -#define R_PPC_EMB_NADDR32 101 -#define R_PPC_EMB_NADDR16 102 -#define R_PPC_EMB_NADDR16_LO 103 -#define R_PPC_EMB_NADDR16_HI 104 -#define R_PPC_EMB_NADDR16_HA 105 -#define R_PPC_EMB_SDAI16 106 -#define R_PPC_EMB_SDA2I16 107 -#define R_PPC_EMB_SDA2REL 108 -#define R_PPC_EMB_SDA21 109 -#define R_PPC_EMB_MRKREF 110 -#define R_PPC_EMB_RELSEC16 111 -#define R_PPC_EMB_RELST_LO 112 -#define R_PPC_EMB_RELST_HI 113 -#define R_PPC_EMB_RELST_HA 114 -#define R_PPC_EMB_BIT_FLD 115 -#define R_PPC_EMB_RELSDA 116 - -#define R_SPARC_NONE 0 -#define R_SPARC_8 1 -#define R_SPARC_16 2 -#define R_SPARC_32 3 -#define R_SPARC_DISP8 4 -#define R_SPARC_DISP16 5 -#define R_SPARC_DISP32 6 -#define R_SPARC_WDISP30 7 -#define R_SPARC_WDISP22 8 -#define R_SPARC_HI22 9 -#define R_SPARC_22 10 -#define R_SPARC_13 11 -#define R_SPARC_LO10 12 -#define R_SPARC_GOT10 13 -#define R_SPARC_GOT13 14 -#define R_SPARC_GOT22 15 -#define R_SPARC_PC10 16 -#define R_SPARC_PC22 17 -#define R_SPARC_WPLT30 18 -#define R_SPARC_COPY 19 -#define R_SPARC_GLOB_DAT 20 -#define R_SPARC_JMP_SLOT 21 -#define R_SPARC_RELATIVE 22 -#define R_SPARC_UA32 23 -#define R_SPARC_PLT32 24 -#define R_SPARC_HIPLT22 25 -#define R_SPARC_LOPLT10 26 -#define R_SPARC_PCPLT32 27 -#define R_SPARC_PCPLT22 28 -#define R_SPARC_PCPLT10 29 -#define R_SPARC_10 30 -#define R_SPARC_11 31 -#define R_SPARC_64 32 -#define R_SPARC_OLO10 33 -#define R_SPARC_HH22 34 -#define R_SPARC_HM10 35 -#define R_SPARC_LM22 36 -#define R_SPARC_PC_HH22 37 -#define R_SPARC_PC_HM10 38 -#define R_SPARC_PC_LM22 39 -#define R_SPARC_WDISP16 40 -#define R_SPARC_WDISP19 41 -#define R_SPARC_GLOB_JMP 42 -#define R_SPARC_7 43 -#define R_SPARC_5 44 -#define R_SPARC_6 45 -#define R_SPARC_DISP64 46 -#define R_SPARC_PLT64 47 -#define R_SPARC_HIX22 48 -#define R_SPARC_LOX10 49 -#define R_SPARC_H44 50 -#define R_SPARC_M44 51 -#define R_SPARC_L44 52 -#define R_SPARC_REGISTER 53 -#define R_SPARC_UA64 54 -#define R_SPARC_UA16 55 -#define R_SPARC_TLS_GD_HI22 56 -#define R_SPARC_TLS_GD_LO10 57 -#define R_SPARC_TLS_GD_ADD 58 -#define R_SPARC_TLS_GD_CALL 59 -#define R_SPARC_TLS_LDM_HI22 60 -#define R_SPARC_TLS_LDM_LO10 61 -#define R_SPARC_TLS_LDM_ADD 62 -#define R_SPARC_TLS_LDM_CALL 63 -#define R_SPARC_TLS_LDO_HIX22 64 -#define R_SPARC_TLS_LDO_LOX10 65 -#define R_SPARC_TLS_LDO_ADD 66 -#define R_SPARC_TLS_IE_HI22 67 -#define R_SPARC_TLS_IE_LO10 68 -#define R_SPARC_TLS_IE_LD 69 -#define R_SPARC_TLS_IE_LDX 70 -#define R_SPARC_TLS_IE_ADD 71 -#define R_SPARC_TLS_LE_HIX22 72 -#define R_SPARC_TLS_LE_LOX10 73 -#define R_SPARC_TLS_DTPMOD32 74 -#define R_SPARC_TLS_DTPMOD64 75 -#define R_SPARC_TLS_DTPOFF32 76 -#define R_SPARC_TLS_DTPOFF64 77 -#define R_SPARC_TLS_TPOFF32 78 -#define R_SPARC_TLS_TPOFF64 79 - -#define R_X86_64_NONE 0 /* No relocation. */ -#define R_X86_64_64 1 /* Add 64 bit symbol value. */ -#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */ -#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */ -#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */ -#define R_X86_64_COPY 5 /* Copy data from shared object. */ -#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */ -#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */ -#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */ -#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */ -#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */ -#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */ -#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */ -#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */ -#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */ -#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */ -#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ -#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */ -#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */ -#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */ -#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */ -#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ -#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */ -#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */ - - -#endif /* !_SYS_ELF_COMMON_H_ */ +#define R_ARM_LDC_PC_G2 69 +#define R_ARM_GOT_PREL 96 +#define R_ARM_THM_JUMP11 102 +#define R_ARM_THM_JUMP8 103 +#define R_ARM_TLS_GD32 104 +#define R_ARM_TLS_LDM32 105 +#define R_ARM_TLS_IE32 107 + +#define R_ARM_THM_JUMP19 51 +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS32 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 + + + +/* Name Value Field Calculation */ +#define R_IA_64_NONE 0 /* None */ +#define R_IA_64_IMM14 0x21 /* immediate14 S + A */ +#define R_IA_64_IMM22 0x22 /* immediate22 S + A */ +#define R_IA_64_IMM64 0x23 /* immediate64 S + A */ +#define R_IA_64_DIR32MSB 0x24 /* word32 MSB S + A */ +#define R_IA_64_DIR32LSB 0x25 /* word32 LSB S + A */ +#define R_IA_64_DIR64MSB 0x26 /* word64 MSB S + A */ +#define R_IA_64_DIR64LSB 0x27 /* word64 LSB S + A */ +#define R_IA_64_GPREL22 0x2a /* immediate22 @gprel(S + A) */ +#define R_IA_64_GPREL64I 0x2b /* immediate64 @gprel(S + A) */ +#define R_IA_64_GPREL32MSB 0x2c /* word32 MSB @gprel(S + A) */ +#define R_IA_64_GPREL32LSB 0x2d /* word32 LSB @gprel(S + A) */ +#define R_IA_64_GPREL64MSB 0x2e /* word64 MSB @gprel(S + A) */ +#define R_IA_64_GPREL64LSB 0x2f /* word64 LSB @gprel(S + A) */ +#define R_IA_64_LTOFF22 0x32 /* immediate22 @ltoff(S + A) */ +#define R_IA_64_LTOFF64I 0x33 /* immediate64 @ltoff(S + A) */ +#define R_IA_64_PLTOFF22 0x3a /* immediate22 @pltoff(S + A) */ +#define R_IA_64_PLTOFF64I 0x3b /* immediate64 @pltoff(S + A) */ +#define R_IA_64_PLTOFF64MSB 0x3e /* word64 MSB @pltoff(S + A) */ +#define R_IA_64_PLTOFF64LSB 0x3f /* word64 LSB @pltoff(S + A) */ +#define R_IA_64_FPTR64I 0x43 /* immediate64 @fptr(S + A) */ +#define R_IA_64_FPTR32MSB 0x44 /* word32 MSB @fptr(S + A) */ +#define R_IA_64_FPTR32LSB 0x45 /* word32 LSB @fptr(S + A) */ +#define R_IA_64_FPTR64MSB 0x46 /* word64 MSB @fptr(S + A) */ +#define R_IA_64_FPTR64LSB 0x47 /* word64 LSB @fptr(S + A) */ +#define R_IA_64_PCREL60B 0x48 /* immediate60 form1 S + A - P */ +#define R_IA_64_PCREL21B 0x49 /* immediate21 form1 S + A - P */ +#define R_IA_64_PCREL21M 0x4a /* immediate21 form2 S + A - P */ +#define R_IA_64_PCREL21F 0x4b /* immediate21 form3 S + A - P */ +#define R_IA_64_PCREL32MSB 0x4c /* word32 MSB S + A - P */ +#define R_IA_64_PCREL32LSB 0x4d /* word32 LSB S + A - P */ +#define R_IA_64_PCREL64MSB 0x4e /* word64 MSB S + A - P */ +#define R_IA_64_PCREL64LSB 0x4f /* word64 LSB S + A - P */ +#define R_IA_64_LTOFF_FPTR22 0x52 /* immediate22 @ltoff(@fptr(S + A)) */ +#define R_IA_64_LTOFF_FPTR64I 0x53 /* immediate64 @ltoff(@fptr(S + A)) */ +#define R_IA_64_LTOFF_FPTR32MSB 0x54 /* word32 MSB @ltoff(@fptr(S + A)) */ +#define R_IA_64_LTOFF_FPTR32LSB 0x55 /* word32 LSB @ltoff(@fptr(S + A)) */ +#define R_IA_64_LTOFF_FPTR64MSB 0x56 /* word64 MSB @ltoff(@fptr(S + A)) */ +#define R_IA_64_LTOFF_FPTR64LSB 0x57 /* word64 LSB @ltoff(@fptr(S + A)) */ +#define R_IA_64_SEGREL32MSB 0x5c /* word32 MSB @segrel(S + A) */ +#define R_IA_64_SEGREL32LSB 0x5d /* word32 LSB @segrel(S + A) */ +#define R_IA_64_SEGREL64MSB 0x5e /* word64 MSB @segrel(S + A) */ +#define R_IA_64_SEGREL64LSB 0x5f /* word64 LSB @segrel(S + A) */ +#define R_IA_64_SECREL32MSB 0x64 /* word32 MSB @secrel(S + A) */ +#define R_IA_64_SECREL32LSB 0x65 /* word32 LSB @secrel(S + A) */ +#define R_IA_64_SECREL64MSB 0x66 /* word64 MSB @secrel(S + A) */ +#define R_IA_64_SECREL64LSB 0x67 /* word64 LSB @secrel(S + A) */ +#define R_IA_64_REL32MSB 0x6c /* word32 MSB BD + A */ +#define R_IA_64_REL32LSB 0x6d /* word32 LSB BD + A */ +#define R_IA_64_REL64MSB 0x6e /* word64 MSB BD + A */ +#define R_IA_64_REL64LSB 0x6f /* word64 LSB BD + A */ +#define R_IA_64_LTV32MSB 0x74 /* word32 MSB S + A */ +#define R_IA_64_LTV32LSB 0x75 /* word32 LSB S + A */ +#define R_IA_64_LTV64MSB 0x76 /* word64 MSB S + A */ +#define R_IA_64_LTV64LSB 0x77 /* word64 LSB S + A */ +#define R_IA_64_PCREL21BI 0x79 /* immediate21 form1 S + A - P */ +#define R_IA_64_PCREL22 0x7a /* immediate22 S + A - P */ +#define R_IA_64_PCREL64I 0x7b /* immediate64 S + A - P */ +#define R_IA_64_IPLTMSB 0x80 /* function descriptor MSB special */ +#define R_IA_64_IPLTLSB 0x81 /* function descriptor LSB speciaal */ +#define R_IA_64_SUB 0x85 /* immediate64 A - S */ +#define R_IA_64_LTOFF22X 0x86 /* immediate22 special */ +#define R_IA_64_LDXMOV 0x87 /* immediate22 special */ +#define R_IA_64_TPREL14 0x91 /* imm14 @tprel(S + A) */ +#define R_IA_64_TPREL22 0x92 /* imm22 @tprel(S + A) */ +#define R_IA_64_TPREL64I 0x93 /* imm64 @tprel(S + A) */ +#define R_IA_64_TPREL64MSB 0x96 /* word64 MSB @tprel(S + A) */ +#define R_IA_64_TPREL64LSB 0x97 /* word64 LSB @tprel(S + A) */ +#define R_IA_64_LTOFF_TPREL22 0x9a /* imm22 @ltoff(@tprel(S+A)) */ +#define R_IA_64_DTPMOD64MSB 0xa6 /* word64 MSB @dtpmod(S + A) */ +#define R_IA_64_DTPMOD64LSB 0xa7 /* word64 LSB @dtpmod(S + A) */ +#define R_IA_64_LTOFF_DTPMOD22 0xaa /* imm22 @ltoff(@dtpmod(S+A)) */ +#define R_IA_64_DTPREL14 0xb1 /* imm14 @dtprel(S + A) */ +#define R_IA_64_DTPREL22 0xb2 /* imm22 @dtprel(S + A) */ +#define R_IA_64_DTPREL64I 0xb3 /* imm64 @dtprel(S + A) */ +#define R_IA_64_DTPREL32MSB 0xb4 /* word32 MSB @dtprel(S + A) */ +#define R_IA_64_DTPREL32LSB 0xb5 /* word32 LSB @dtprel(S + A) */ +#define R_IA_64_DTPREL64MSB 0xb6 /* word64 MSB @dtprel(S + A) */ +#define R_IA_64_DTPREL64LSB 0xb7 /* word64 LSB @dtprel(S + A) */ +#define R_IA_64_LTOFF_DTPREL22 0xba /* imm22 @ltoff(@dtprel(S+A)) */ + +#define R_PPC_NONE 0 /* No relocation. */ +#define R_PPC_ADDR32 1 +#define R_PPC_ADDR24 2 +#define R_PPC_ADDR16 3 +#define R_PPC_ADDR16_LO 4 +#define R_PPC_ADDR16_HI 5 +#define R_PPC_ADDR16_HA 6 +#define R_PPC_ADDR14 7 +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 +#define R_PPC_REL14 11 +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 + +/* + * TLS relocations + */ +#define R_PPC_TLS 67 +#define R_PPC_DTPMOD32 68 +#define R_PPC_TPREL16 69 +#define R_PPC_TPREL16_LO 70 +#define R_PPC_TPREL16_HI 71 +#define R_PPC_TPREL16_HA 72 +#define R_PPC_TPREL32 73 +#define R_PPC_DTPREL16 74 +#define R_PPC_DTPREL16_LO 75 +#define R_PPC_DTPREL16_HI 76 +#define R_PPC_DTPREL16_HA 77 +#define R_PPC_DTPREL32 78 +#define R_PPC_GOT_TLSGD16 79 +#define R_PPC_GOT_TLSGD16_LO 80 +#define R_PPC_GOT_TLSGD16_HI 81 +#define R_PPC_GOT_TLSGD16_HA 82 +#define R_PPC_GOT_TLSLD16 83 +#define R_PPC_GOT_TLSLD16_LO 84 +#define R_PPC_GOT_TLSLD16_HI 85 +#define R_PPC_GOT_TLSLD16_HA 86 +#define R_PPC_GOT_TPREL16 87 +#define R_PPC_GOT_TPREL16_LO 88 +#define R_PPC_GOT_TPREL16_HI 89 +#define R_PPC_GOT_TPREL16_HA 90 + +/* + * The remaining relocs are from the Embedded ELF ABI, and are not in the + * SVR4 ELF ABI. + */ + +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 + +#define R_SPARC_NONE 0 +#define R_SPARC_8 1 +#define R_SPARC_16 2 +#define R_SPARC_32 3 +#define R_SPARC_DISP8 4 +#define R_SPARC_DISP16 5 +#define R_SPARC_DISP32 6 +#define R_SPARC_WDISP30 7 +#define R_SPARC_WDISP22 8 +#define R_SPARC_HI22 9 +#define R_SPARC_22 10 +#define R_SPARC_13 11 +#define R_SPARC_LO10 12 +#define R_SPARC_GOT10 13 +#define R_SPARC_GOT13 14 +#define R_SPARC_GOT22 15 +#define R_SPARC_PC10 16 +#define R_SPARC_PC22 17 +#define R_SPARC_WPLT30 18 +#define R_SPARC_COPY 19 +#define R_SPARC_GLOB_DAT 20 +#define R_SPARC_JMP_SLOT 21 +#define R_SPARC_RELATIVE 22 +#define R_SPARC_UA32 23 +#define R_SPARC_PLT32 24 +#define R_SPARC_HIPLT22 25 +#define R_SPARC_LOPLT10 26 +#define R_SPARC_PCPLT32 27 +#define R_SPARC_PCPLT22 28 +#define R_SPARC_PCPLT10 29 +#define R_SPARC_10 30 +#define R_SPARC_11 31 +#define R_SPARC_64 32 +#define R_SPARC_OLO10 33 +#define R_SPARC_HH22 34 +#define R_SPARC_HM10 35 +#define R_SPARC_LM22 36 +#define R_SPARC_PC_HH22 37 +#define R_SPARC_PC_HM10 38 +#define R_SPARC_PC_LM22 39 +#define R_SPARC_WDISP16 40 +#define R_SPARC_WDISP19 41 +#define R_SPARC_GLOB_JMP 42 +#define R_SPARC_7 43 +#define R_SPARC_5 44 +#define R_SPARC_6 45 +#define R_SPARC_DISP64 46 +#define R_SPARC_PLT64 47 +#define R_SPARC_HIX22 48 +#define R_SPARC_LOX10 49 +#define R_SPARC_H44 50 +#define R_SPARC_M44 51 +#define R_SPARC_L44 52 +#define R_SPARC_REGISTER 53 +#define R_SPARC_UA64 54 +#define R_SPARC_UA16 55 +#define R_SPARC_TLS_GD_HI22 56 +#define R_SPARC_TLS_GD_LO10 57 +#define R_SPARC_TLS_GD_ADD 58 +#define R_SPARC_TLS_GD_CALL 59 +#define R_SPARC_TLS_LDM_HI22 60 +#define R_SPARC_TLS_LDM_LO10 61 +#define R_SPARC_TLS_LDM_ADD 62 +#define R_SPARC_TLS_LDM_CALL 63 +#define R_SPARC_TLS_LDO_HIX22 64 +#define R_SPARC_TLS_LDO_LOX10 65 +#define R_SPARC_TLS_LDO_ADD 66 +#define R_SPARC_TLS_IE_HI22 67 +#define R_SPARC_TLS_IE_LO10 68 +#define R_SPARC_TLS_IE_LD 69 +#define R_SPARC_TLS_IE_LDX 70 +#define R_SPARC_TLS_IE_ADD 71 +#define R_SPARC_TLS_LE_HIX22 72 +#define R_SPARC_TLS_LE_LOX10 73 +#define R_SPARC_TLS_DTPMOD32 74 +#define R_SPARC_TLS_DTPMOD64 75 +#define R_SPARC_TLS_DTPOFF32 76 +#define R_SPARC_TLS_DTPOFF64 77 +#define R_SPARC_TLS_TPOFF32 78 +#define R_SPARC_TLS_TPOFF64 79 + +#define R_X86_64_NONE 0 /* No relocation. */ +#define R_X86_64_64 1 /* Add 64 bit symbol value. */ +#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */ +#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */ +#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */ +#define R_X86_64_COPY 5 /* Copy data from shared object. */ +#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */ +#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */ +#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */ +#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */ +#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */ +#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */ +#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */ +#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */ +#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */ +#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */ +#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ +#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */ +#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */ +#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */ +#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */ +#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ +#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */ +#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */ + + +#endif /* !_SYS_ELF_COMMON_H_ */ diff --git a/BaseTools/Source/C/Include/Arm/ProcessorBind.h b/BaseTools/Source/C/Include/Arm/ProcessorBind.h index 1ca26ab6f3..d84f16e7ba 100644 --- a/BaseTools/Source/C/Include/Arm/ProcessorBind.h +++ b/BaseTools/Source/C/Include/Arm/ProcessorBind.h @@ -1,158 +1,158 @@ -/** @file - Processor or Compiler specific defines and types for ARM. - - Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __PROCESSOR_BIND_H__ -#define __PROCESSOR_BIND_H__ - -/// -/// Define the processor type so other code can make processor based choices -/// -#define MDE_CPU_ARM - -// -// Make sure we are using the correct packing rules per EFI specification -// -#ifndef __GNUC__ -#pragma pack() -#endif - -#if _MSC_EXTENSIONS - // - // use Microsoft* C complier dependent integer width types - // - typedef unsigned __int64 UINT64; - typedef __int64 INT64; - typedef unsigned __int32 UINT32; - typedef __int32 INT32; - typedef unsigned short UINT16; - typedef unsigned short CHAR16; - typedef short INT16; - typedef unsigned char BOOLEAN; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef signed char INT8; -#else - // - // Assume standard ARM alignment. - // - typedef unsigned long long UINT64; - typedef long long INT64; - typedef unsigned int UINT32; - typedef int INT32; - typedef unsigned short UINT16; - typedef unsigned short CHAR16; - typedef short INT16; - typedef unsigned char BOOLEAN; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef signed char INT8; - - #define UINT8_MAX 0xff -#endif - -/// -/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions, -/// 8 bytes on supported 64-bit processor instructions) -/// -typedef UINT32 UINTN; - -/// -/// Signed value of native width. (4 bytes on supported 32-bit processor instructions, -/// 8 bytes on supported 64-bit processor instructions) -/// -typedef INT32 INTN; - -// -// Processor specific defines -// - -/// -/// A value of native width with the highest bit set. -/// -#define MAX_BIT 0x80000000 - -/// -/// A value of native width with the two highest bits set. -/// -#define MAX_2_BITS 0xC0000000 - -/// -/// Maximum legal ARM address -/// -#define MAX_ADDRESS 0xFFFFFFFF - -/// -/// The stack alignment required for ARM -/// -#define CPU_STACK_ALIGNMENT sizeof(UINT64) - -// -// Modifier to ensure that all protocol member functions and EFI intrinsics -// use the correct C calling convention. All protocol member functions and -// EFI intrinsics are required to modify their member functions with EFIAPI. -// -#define EFIAPI - -#if defined(__GNUC__) - /// - /// For GNU assembly code, .global or .globl can declare global symbols. - /// Define this macro to unify the usage. - /// - #define ASM_GLOBAL .globl - - #if !defined(__APPLE__) - /// - /// ARM EABI defines that the linker should not manipulate call relocations - /// (do bl/blx conversion) unless the target symbol has function type. - /// CodeSourcery 2010.09 started requiring the .type to function properly - /// - #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function - - #define GCC_ASM_EXPORT(func__) \ - .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\ - .type ASM_PFX(func__), %function - - #define GCC_ASM_IMPORT(func__) \ - .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__) - - #else - // - // .type not supported by Apple Xcode tools - // - #define INTERWORK_FUNC(func__) - - #define GCC_ASM_EXPORT(func__) \ - .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \ - - #define GCC_ASM_IMPORT(name) - - #endif -#endif - -/** - Return the pointer to the first instruction of a function given a function pointer. - On ARM CPU architectures, these two pointer values are the same, - so the implementation of this macro is very simple. - - @param FunctionPointer A pointer to a function. - - @return The pointer to the first instruction of a function given a function pointer. - -**/ -#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer) - -#endif - - +/** @file + Processor or Compiler specific defines and types for ARM. + + Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+ Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __PROCESSOR_BIND_H__ +#define __PROCESSOR_BIND_H__ + +/// +/// Define the processor type so other code can make processor based choices +/// +#define MDE_CPU_ARM + +// +// Make sure we are using the correct packing rules per EFI specification +// +#ifndef __GNUC__ +#pragma pack() +#endif + +#if _MSC_EXTENSIONS + // + // use Microsoft* C complier dependent integer width types + // + typedef unsigned __int64 UINT64; + typedef __int64 INT64; + typedef unsigned __int32 UINT32; + typedef __int32 INT32; + typedef unsigned short UINT16; + typedef unsigned short CHAR16; + typedef short INT16; + typedef unsigned char BOOLEAN; + typedef unsigned char UINT8; + typedef char CHAR8; + typedef signed char INT8; +#else + // + // Assume standard ARM alignment. + // + typedef unsigned long long UINT64; + typedef long long INT64; + typedef unsigned int UINT32; + typedef int INT32; + typedef unsigned short UINT16; + typedef unsigned short CHAR16; + typedef short INT16; + typedef unsigned char BOOLEAN; + typedef unsigned char UINT8; + typedef char CHAR8; + typedef signed char INT8; + + #define UINT8_MAX 0xff +#endif + +/// +/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions, +/// 8 bytes on supported 64-bit processor instructions) +/// +typedef UINT32 UINTN; + +/// +/// Signed value of native width. (4 bytes on supported 32-bit processor instructions, +/// 8 bytes on supported 64-bit processor instructions) +/// +typedef INT32 INTN; + +// +// Processor specific defines +// + +/// +/// A value of native width with the highest bit set. +/// +#define MAX_BIT 0x80000000 + +/// +/// A value of native width with the two highest bits set. +/// +#define MAX_2_BITS 0xC0000000 + +/// +/// Maximum legal ARM address +/// +#define MAX_ADDRESS 0xFFFFFFFF + +/// +/// The stack alignment required for ARM +/// +#define CPU_STACK_ALIGNMENT sizeof(UINT64) + +// +// Modifier to ensure that all protocol member functions and EFI intrinsics +// use the correct C calling convention. All protocol member functions and +// EFI intrinsics are required to modify their member functions with EFIAPI. +// +#define EFIAPI + +#if defined(__GNUC__) + /// + /// For GNU assembly code, .global or .globl can declare global symbols. + /// Define this macro to unify the usage. + /// + #define ASM_GLOBAL .globl + + #if !defined(__APPLE__) + /// + /// ARM EABI defines that the linker should not manipulate call relocations + /// (do bl/blx conversion) unless the target symbol has function type. + /// CodeSourcery 2010.09 started requiring the .type to function properly + /// + #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function + + #define GCC_ASM_EXPORT(func__) \ + .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\ + .type ASM_PFX(func__), %function + + #define GCC_ASM_IMPORT(func__) \ + .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__) + + #else + // + // .type not supported by Apple Xcode tools + // + #define INTERWORK_FUNC(func__) + + #define GCC_ASM_EXPORT(func__) \ + .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \ + + #define GCC_ASM_IMPORT(name) + + #endif +#endif + +/** + Return the pointer to the first instruction of a function given a function pointer. + On ARM CPU architectures, these two pointer values are the same, + so the implementation of this macro is very simple. + + @param FunctionPointer A pointer to a function. + + @return The pointer to the first instruction of a function given a function pointer. + +**/ +#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer) + +#endif + + diff --git a/BaseTools/Source/C/Include/Common/BuildVersion.h b/BaseTools/Source/C/Include/Common/BuildVersion.h index dd9852bad3..d3ad7c265b 100644 --- a/BaseTools/Source/C/Include/Common/BuildVersion.h +++ b/BaseTools/Source/C/Include/Common/BuildVersion.h @@ -14,4 +14,4 @@ **/ -#define __BUILD_VERSION "Build 2640" +#define __BUILD_VERSION "Build 2649" diff --git a/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat b/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat index 25b8790ac5..fac89bd9ee 100644 --- a/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat +++ b/BaseTools/Source/C/Makefiles/NmakeSubdirs.bat @@ -7,7 +7,7 @@ @REM # http://opensource.org/licenses/bsd-license.php @REM # @REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @echo off diff --git a/BaseTools/Source/C/Makefiles/app.makefile b/BaseTools/Source/C/Makefiles/app.makefile index ed2e2fba08..19269a13a9 100644 --- a/BaseTools/Source/C/Makefiles/app.makefile +++ b/BaseTools/Source/C/Makefiles/app.makefile @@ -1,27 +1,27 @@ -## @file -# -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -MAKEROOT ?= ../.. - -include $(MAKEROOT)/Makefiles/header.makefile - -APPLICATION = $(MAKEROOT)/bin/$(APPNAME) - -.PHONY:all -all: $(MAKEROOT)/bin $(APPLICATION) - -$(APPLICATION): $(OBJECTS) - $(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS) - -$(OBJECTS): ../Include/Common/BuildVersion.h - -include $(MAKEROOT)/Makefiles/footer.makefile +## @file +# +# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +MAKEROOT ?= ../.. + +include $(MAKEROOT)/Makefiles/header.makefile + +APPLICATION = $(MAKEROOT)/bin/$(APPNAME) + +.PHONY:all +all: $(MAKEROOT)/bin $(APPLICATION) + +$(APPLICATION): $(OBJECTS) + $(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS) + +$(OBJECTS): ../Include/Common/BuildVersion.h + +include $(MAKEROOT)/Makefiles/footer.makefile diff --git a/BaseTools/Source/C/Makefiles/footer.makefile b/BaseTools/Source/C/Makefiles/footer.makefile index de7114257d..c10ad7aab4 100644 --- a/BaseTools/Source/C/Makefiles/footer.makefile +++ b/BaseTools/Source/C/Makefiles/footer.makefile @@ -7,28 +7,28 @@ # http://opensource.org/licenses/bsd-license.php # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -DEPFILES = $(OBJECTS:%.o=%.d) - -$(MAKEROOT)/libs-$(ARCH): - mkdir -p $(MAKEROOT)/libs-$(ARCH) - -.PHONY: install -install: $(MAKEROOT)/libs-$(ARCH) $(LIBRARY) - cp $(LIBRARY) $(MAKEROOT)/libs-$(ARCH) - -$(LIBRARY): $(OBJECTS) - $(AR) crs $@ $^ - -%.o : %.c - $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ - -%.o : %.S - $(AS) -c $(ASFLAGS) $< -o $@ - -.PHONY: clean -clean: - @rm -f $(OBJECTS) $(LIBRARY) $(DEPFILES) - --include $(DEPFILES) +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +DEPFILES = $(OBJECTS:%.o=%.d) + +$(MAKEROOT)/libs-$(ARCH): + mkdir -p $(MAKEROOT)/libs-$(ARCH) + +.PHONY: install +install: $(MAKEROOT)/libs-$(ARCH) $(LIBRARY) + cp $(LIBRARY) $(MAKEROOT)/libs-$(ARCH) + +$(LIBRARY): $(OBJECTS) + $(AR) crs $@ $^ + +%.o : %.c + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + +%.o : %.S + $(AS) -c $(ASFLAGS) $< -o $@ + +.PHONY: clean +clean: + @rm -f $(OBJECTS) $(LIBRARY) $(DEPFILES) + +-include $(DEPFILES) diff --git a/BaseTools/Source/C/Makefiles/ms.app b/BaseTools/Source/C/Makefiles/ms.app index 7812175e7f..455549c121 100644 --- a/BaseTools/Source/C/Makefiles/ms.app +++ b/BaseTools/Source/C/Makefiles/ms.app @@ -7,28 +7,28 @@ # http://opensource.org/licenses/bsd-license.php # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -!INCLUDE ..\Makefiles\ms.common - -APPLICATION = $(BIN_PATH)\$(APPNAME).exe - -all: $(APPLICATION) - -$(APPLICATION) : $(OBJECTS) - -@if not exist $(BIN_PATH) mkdir $(BIN_PATH) - $(LD) /nologo /debug /incremental:no /nodefaultlib:libc.lib /out:$@ $(LIBS) $** - +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +!INCLUDE ..\Makefiles\ms.common + +APPLICATION = $(BIN_PATH)\$(APPNAME).exe + +all: $(APPLICATION) + +$(APPLICATION) : $(OBJECTS) + -@if not exist $(BIN_PATH) mkdir $(BIN_PATH) + $(LD) /nologo /debug /incremental:no /nodefaultlib:libc.lib /out:$@ $(LIBS) $** + $(OBJECTS) : ..\Include\Common\BuildVersion.h -.PHONY:clean -.PHONY:cleanall - -clean: - del /f /q $(OBJECTS) *.pdb > nul - -cleanall: - del /f /q $(OBJECTS) $(APPLICATION) *.pdb $(BIN_PATH)\*.pdb > nul - -!INCLUDE ..\Makefiles\ms.rule - +.PHONY:clean +.PHONY:cleanall + +clean: + del /f /q $(OBJECTS) *.pdb > nul + +cleanall: + del /f /q $(OBJECTS) $(APPLICATION) *.pdb $(BIN_PATH)\*.pdb > nul + +!INCLUDE ..\Makefiles\ms.rule + diff --git a/BaseTools/Source/C/Makefiles/ms.common b/BaseTools/Source/C/Makefiles/ms.common index d2fbc453ee..fa9ffba563 100644 --- a/BaseTools/Source/C/Makefiles/ms.common +++ b/BaseTools/Source/C/Makefiles/ms.common @@ -7,54 +7,54 @@ # http://opensource.org/licenses/bsd-license.php # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -!IFNDEF EDK_TOOLS_PATH -!ERROR "Please set your EDK_TOOLS_PATH!" -!ENDIF - -!IFNDEF BASE_TOOLS_PATH -!ERROR "BASE_TOOLS_PATH is not set! Please run build_tools.bat at first!" -!ENDIF - -!IFNDEF ARCH -ARCH = IA32 -!ENDIF - -MAKE = nmake -nologo - -SOURCE_PATH = $(BASE_TOOLS_PATH)\Source\C -BIN_PATH = $(BASE_TOOLS_PATH)\Bin -LIB_PATH = $(BASE_TOOLS_PATH)\Lib - -SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin -SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib - -!IF "$(ARCH)"=="IA32" -ARCH_INCLUDE = $(SOURCE_PATH)\Include\Ia32 -BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32 -LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32 -SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32 -SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32 -!ENDIF - -!IF "$(ARCH)"=="X64" -ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64 -BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64 -LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64 -SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64 -SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64 -!ENDIF - -CC = cl.exe -CXX = cl.exe -AS = ml.exe -AR = lib.exe -LD = link.exe -LINKER = $(LD) - -INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC) - -CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE -CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE - +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +!IFNDEF EDK_TOOLS_PATH +!ERROR "Please set your EDK_TOOLS_PATH!" +!ENDIF + +!IFNDEF BASE_TOOLS_PATH +!ERROR "BASE_TOOLS_PATH is not set! Please run build_tools.bat at first!" +!ENDIF + +!IFNDEF ARCH +ARCH = IA32 +!ENDIF + +MAKE = nmake -nologo + +SOURCE_PATH = $(BASE_TOOLS_PATH)\Source\C +BIN_PATH = $(BASE_TOOLS_PATH)\Bin +LIB_PATH = $(BASE_TOOLS_PATH)\Lib + +SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin +SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib + +!IF "$(ARCH)"=="IA32" +ARCH_INCLUDE = $(SOURCE_PATH)\Include\Ia32 +BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32 +LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32 +SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32 +SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32 +!ENDIF + +!IF "$(ARCH)"=="X64" +ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64 +BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64 +LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64 +SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64 +SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64 +!ENDIF + +CC = cl.exe +CXX = cl.exe +AS = ml.exe +AR = lib.exe +LD = link.exe +LINKER = $(LD) + +INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC) + +CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE +CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE + diff --git a/BaseTools/Source/C/Makefiles/ms.lib b/BaseTools/Source/C/Makefiles/ms.lib index 0e418f3c8f..55f6a23118 100644 --- a/BaseTools/Source/C/Makefiles/ms.lib +++ b/BaseTools/Source/C/Makefiles/ms.lib @@ -7,25 +7,25 @@ # http://opensource.org/licenses/bsd-license.php # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -!INCLUDE ..\Makefiles\ms.common - -LIBRARY = $(LIB_PATH)\$(LIBNAME).lib - -all: $(LIBRARY) - -$(LIBRARY) : $(OBJECTS) - -@if not exist $(LIB_PATH) mkdir $(LIB_PATH) - $(AR) /nologo /out:$@ $** - -.PHONY:clean -clean: - del /f /q $(OBJECTS) *.pdb > nul - -.PHONY:cleanall -cleanall: - del /f /q $(OBJECTS) $(LIBRARY) *.pdb > nul - -!INCLUDE ..\Makefiles\ms.rule - +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +!INCLUDE ..\Makefiles\ms.common + +LIBRARY = $(LIB_PATH)\$(LIBNAME).lib + +all: $(LIBRARY) + +$(LIBRARY) : $(OBJECTS) + -@if not exist $(LIB_PATH) mkdir $(LIB_PATH) + $(AR) /nologo /out:$@ $** + +.PHONY:clean +clean: + del /f /q $(OBJECTS) *.pdb > nul + +.PHONY:cleanall +cleanall: + del /f /q $(OBJECTS) $(LIBRARY) *.pdb > nul + +!INCLUDE ..\Makefiles\ms.rule + diff --git a/BaseTools/Source/C/Makefiles/ms.rule b/BaseTools/Source/C/Makefiles/ms.rule index afbd5dcc4b..b73e504b29 100644 --- a/BaseTools/Source/C/Makefiles/ms.rule +++ b/BaseTools/Source/C/Makefiles/ms.rule @@ -7,18 +7,18 @@ # http://opensource.org/licenses/bsd-license.php # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -#DEPFILES = $(OBJECTS:%.o=%.d) - -.c.obj : - $(CC) -c $(CFLAGS) $(INC) $< -Fo$@ - -.S.obj : - $(AS) -c $(ASFLAGS) $< -Fo$@ - -.cpp.obj : - $(CXX) -c $(CPPFLAGS) $(INC) $< -Fo$@ - -#-include $(DEPFILES) - +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +#DEPFILES = $(OBJECTS:%.o=%.d) + +.c.obj : + $(CC) -c $(CFLAGS) $(INC) $< -Fo$@ + +.S.obj : + $(AS) -c $(ASFLAGS) $< -Fo$@ + +.cpp.obj : + $(CXX) -c $(CPPFLAGS) $(INC) $< -Fo$@ + +#-include $(DEPFILES) + diff --git a/BaseTools/Source/C/PyEfiCompressor/Makefile b/BaseTools/Source/C/PyEfiCompressor/Makefile index d52a3454b7..fdd2e391cb 100644 --- a/BaseTools/Source/C/PyEfiCompressor/Makefile +++ b/BaseTools/Source/C/PyEfiCompressor/Makefile @@ -7,17 +7,17 @@ # http://opensource.org/licenses/bsd-license.php # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -!INCLUDE ..\Makefiles\ms.common - -APPNAME = GenSec - -LIBS = $(LIB_PATH)\Common.lib - -OBJECTS = GenSec.obj - -#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib - -!INCLUDE ..\Makefiles\ms.app - +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +!INCLUDE ..\Makefiles\ms.common + +APPNAME = GenSec + +LIBS = $(LIB_PATH)\Common.lib + +OBJECTS = GenSec.obj + +#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib + +!INCLUDE ..\Makefiles\ms.app + diff --git a/BaseTools/Source/C/PyUtility/Makefile b/BaseTools/Source/C/PyUtility/Makefile index 71d4d542bd..0cc9ad7987 100644 --- a/BaseTools/Source/C/PyUtility/Makefile +++ b/BaseTools/Source/C/PyUtility/Makefile @@ -7,17 +7,17 @@ # http://opensource.org/licenses/bsd-license.php # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -!INCLUDE ..\Makefiles\ms.common - -APPNAME = GenSec - -LIBS = $(LIB_PATH)\Common.lib - -OBJECTS = PyUtility.obj - -#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib - -!INCLUDE ..\Makefiles\ms.app - +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +!INCLUDE ..\Makefiles\ms.common + +APPNAME = GenSec + +LIBS = $(LIB_PATH)\Common.lib + +OBJECTS = PyUtility.obj + +#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib + +!INCLUDE ..\Makefiles\ms.app + diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp index addff24cf6..6dfc118eea 100644 --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp @@ -82,7 +82,7 @@ SPendingAssign::AssignValue ( IN UINT32 Len ) { - memcpy (mAddr, Addr, (mLen < Len ? mLen : Len)); + memmove (mAddr, Addr, (mLen < Len ? mLen : Len)); mFlag = ASSIGNED; } @@ -685,7 +685,7 @@ CFormPkg::AdjustDynamicInsertOpcode ( // // Override the restore buffer data. // - memcpy (LastFormEndAddr, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr); + memmove (LastFormEndAddr, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr); InsertOpcodeNode->mBufferFree -= NeedRestoreCodeLen; memset (InsertOpcodeNode->mBufferFree, 0, NeedRestoreCodeLen); } else { @@ -733,7 +733,7 @@ CFormPkg::AdjustDynamicInsertOpcode ( // // Override the restore buffer data. // - memcpy (InsertOpcodeNode->mBufferStart, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr); + memmove (InsertOpcodeNode->mBufferStart, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr); InsertOpcodeNode->mBufferFree -= InsertOpcodeAddr - InsertOpcodeNode->mBufferStart; // @@ -1542,7 +1542,7 @@ CIfrObj::_EMIT_PENDING_OBJ ( // ObjBinBuf = gCFormPkg.IfrBinBufferGet (mObjBinLen); if (ObjBinBuf != NULL) { - memcpy (ObjBinBuf, mObjBinBuf, mObjBinLen); + memmove (ObjBinBuf, mObjBinBuf, mObjBinLen); } // diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h index 25280def9b..c69518af76 100644 --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h @@ -368,7 +368,7 @@ public: VOID VARSTORE_INFO (OUT EFI_VARSTORE_INFO *Info) { if (Info != NULL) { Info->mVarStoreId = mHeader->VarStoreId; - memcpy (&Info->mVarStoreId, &mHeader->VarStoreInfo, sizeof (Info->mVarStoreId)); + memmove (&Info->mVarStoreId, &mHeader->VarStoreInfo, sizeof (Info->mVarStoreId)); } } @@ -615,7 +615,7 @@ public: } VOID SetGuid (IN EFI_GUID *Guid) { - memcpy (&mFormSet->Guid, Guid, sizeof (EFI_GUID)); + memmove (&mFormSet->Guid, Guid, sizeof (EFI_GUID)); } VOID SetFormSetTitle (IN EFI_STRING_ID FormSetTitle) { @@ -627,7 +627,7 @@ public: } VOID SetClassGuid (IN EFI_GUID *Guid) { - memcpy (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID)); + memmove (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID)); } UINT8 GetFlags() { @@ -749,7 +749,7 @@ public: IncLength (sizeof (EFI_IFR_FORM_MAP_METHOD)); mMethodMap->MethodTitle = MethodTitle; - memcpy (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID)); + memmove (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID)); mMethodMap ++; } } @@ -769,7 +769,7 @@ public: } VOID SetGuid (IN EFI_GUID *Guid) { - memcpy (&mVarStore->Guid, Guid, sizeof (EFI_GUID)); + memmove (&mVarStore->Guid, Guid, sizeof (EFI_GUID)); } VOID SetVarStoreId (IN EFI_VARSTORE_ID VarStoreId) { @@ -809,7 +809,7 @@ public: } VOID SetGuid (IN EFI_GUID *Guid) { - memcpy (&mVarStoreEfi->Guid, Guid, sizeof (EFI_GUID)); + memmove (&mVarStoreEfi->Guid, Guid, sizeof (EFI_GUID)); } VOID SetVarStoreId (IN UINT16 VarStoreId) { @@ -863,7 +863,7 @@ public: } VOID SetGuid (IN EFI_GUID *Guid) { - memcpy (&mVarStoreNameValue->Guid, Guid, sizeof (EFI_GUID)); + memmove (&mVarStoreNameValue->Guid, Guid, sizeof (EFI_GUID)); } VOID SetVarStoreId (IN UINT16 VarStoreId) { @@ -938,7 +938,7 @@ public: CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header, Size) { mDefault->Type = Type; mDefault->DefaultId = DefaultId; - memcpy (&(mDefault->Value), &Value, Size - OFFSET_OF (EFI_IFR_DEFAULT, Value)); + memmove (&(mDefault->Value), &Value, Size - OFFSET_OF (EFI_IFR_DEFAULT, Value)); } VOID SetDefaultId (IN UINT16 DefaultId) { @@ -950,7 +950,7 @@ public: } VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) { - memcpy (&mDefault->Value, &Value, mDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value)); + memmove (&mDefault->Value, &Value, mDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value)); } }; @@ -1673,7 +1673,7 @@ public: } VOID SetRefreshEventGroutId (IN EFI_GUID *RefreshEventGroupId) { - memcpy (&mRefreshId->RefreshEventGroupId, RefreshEventGroupId, sizeof (EFI_GUID)); + memmove (&mRefreshId->RefreshEventGroupId, RefreshEventGroupId, sizeof (EFI_GUID)); } }; @@ -1755,7 +1755,7 @@ public: } VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) { - memcpy (&mOneOfOption->Value, &Value, mOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value)); + memmove (&mOneOfOption->Value, &Value, mOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value)); } UINT8 GetFlags (VOID) { @@ -1904,11 +1904,11 @@ public: } VOID SetGuid (IN EFI_GUID *Guid) { - memcpy (&mGuid->Guid, Guid, sizeof (EFI_GUID)); + memmove (&mGuid->Guid, Guid, sizeof (EFI_GUID)); } VOID SetData (IN UINT8* DataBuff, IN UINT8 Size) { - memcpy ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size); + memmove ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size); } }; @@ -2214,7 +2214,7 @@ public: } VOID SetPermissions (IN EFI_GUID *Permissions) { - memcpy (&mSecurity->Permissions, Permissions, sizeof (EFI_GUID)); + memmove (&mSecurity->Permissions, Permissions, sizeof (EFI_GUID)); } }; diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c index 7d127e1691..0f54c2a429 100644 --- a/BaseTools/Source/C/VolInfo/VolInfo.c +++ b/BaseTools/Source/C/VolInfo/VolInfo.c @@ -1,1826 +1,1826 @@ -/** @file - -Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - VolInfo.c - -Abstract: - - The tool dumps the contents of a firmware volume - -**/ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Compress.h" -#include "Decompress.h" -#include "VolInfo.h" -#include "CommonLib.h" -#include "EfiUtilityMsgs.h" -#include "FirmwareVolumeBufferLib.h" -#include "OsPath.h" -#include "ParseGuidedSectionTools.h" -#include "StringFuncs.h" - -// -// Utility global variables -// - -EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID; - -#define UTILITY_MAJOR_VERSION 0 -#define UTILITY_MINOR_VERSION 82 - -#define UTILITY_NAME "VolInfo" - -#define EFI_SECTION_ERROR EFIERR (100) - -#define MAX_BASENAME_LEN 60 // not good to hardcode, but let's be reasonable - -// -// Structure to keep a list of guid-to-basenames -// -typedef struct _GUID_TO_BASENAME { - struct _GUID_TO_BASENAME *Next; - INT8 Guid[PRINTED_GUID_BUFFER_SIZE]; - INT8 BaseName[MAX_BASENAME_LEN]; -} GUID_TO_BASENAME; - -static GUID_TO_BASENAME *mGuidBaseNameList = NULL; - -// -// Store GUIDed Section guid->tool mapping -// -EFI_HANDLE mParsedGuidedSectionTools = NULL; - -CHAR8* mUtilityFilename = NULL; - -EFI_STATUS -ParseGuidBaseNameFile ( - CHAR8 *FileName - ); - -EFI_STATUS -FreeGuidBaseNameList ( - VOID - ); - -EFI_STATUS -PrintGuidName ( - IN UINT8 *GuidStr - ); - -EFI_STATUS -ParseSection ( - IN UINT8 *SectionBuffer, - IN UINT32 BufferLength - ); - -EFI_STATUS -DumpDepexSection ( - IN UINT8 *Ptr, - IN UINT32 SectionLength - ); - -STATIC -EFI_STATUS -ReadHeader ( - IN FILE *InputFile, - OUT UINT32 *FvSize, - OUT BOOLEAN *ErasePolarity - ); - -STATIC -EFI_STATUS -PrintFileInfo ( - EFI_FIRMWARE_VOLUME_HEADER *FvImage, - EFI_FFS_FILE_HEADER *FileHeader, - BOOLEAN ErasePolarity - ); - -static -EFI_STATUS -PrintFvInfo ( - IN VOID *Fv, - IN BOOLEAN IsChildFv - ); - -static -VOID -LoadGuidedSectionToolsTxt ( - IN CHAR8* FirmwareVolumeFilename - ); - -void -Usage ( - VOID - ); - -int -main ( - int argc, - char *argv[] - ) -/*++ - -Routine Description: - - GC_TODO: Add function description - -Arguments: - - argc - GC_TODO: add argument description - ] - GC_TODO: add argument description - -Returns: - - GC_TODO: add return values - ---*/ -{ - FILE *InputFile; - int BytesRead; - EFI_FIRMWARE_VOLUME_HEADER *FvImage; - UINT32 FvSize; - EFI_STATUS Status; - int Offset; - BOOLEAN ErasePolarity; - - SetUtilityName (UTILITY_NAME); - // - // Print utility header - // - printf ("%s Tiano Firmware Volume FFS image info. Version %d.%d %s, %s\n", - UTILITY_NAME, - UTILITY_MAJOR_VERSION, - UTILITY_MINOR_VERSION, - __BUILD_VERSION, - __DATE__ - ); - - // - // Save, and then skip filename arg - // - mUtilityFilename = argv[0]; - argc--; - argv++; - - Offset = 0; - - // - // If they specified -x xref guid/basename cross-reference files, process it. - // This will print the basename beside each file guid. To use it, specify - // -x xref_filename to processdsc, then use xref_filename as a parameter - // here. - // - while (argc > 2) { - if ((strcmp(argv[0], "-x") == 0) || (strcmp(argv[0], "--xref") == 0)) { - ParseGuidBaseNameFile (argv[1]); - printf("ParseGuidBaseNameFile: %s\n", argv[1]); - argc -= 2; - argv += 2; - } else if (strcmp(argv[0], "--offset") == 0) { - // - // Hex or decimal? - // - if ((argv[1][0] == '0') && (tolower ((int)argv[1][1]) == 'x')) { - if (sscanf (argv[1], "%x", &Offset) != 1) { - Error (NULL, 0, 1003, "Invalid option value", "Offset = %s", argv[1]); - return GetUtilityStatus (); - } - } else { - if (sscanf (argv[1], "%d", &Offset) != 1) { - Error (NULL, 0, 1003, "Invalid option value", "Offset = %s", argv[1]); - return GetUtilityStatus (); - } - // - // See if they said something like "64K" - // - if (tolower ((int)argv[1][strlen (argv[1]) - 1]) == 'k') { - Offset *= 1024; - } - } - - argc -= 2; - argv += 2; - } else { - Usage (); - return -1; - } - } - // - // Check for proper number of arguments - // - if (argc != 1) { - Usage (); - return -1; - } - // - // Look for help options - // - if ((strcmp(argv[0], "-h") == 0) || (strcmp(argv[0], "--help") == 0) || - (strcmp(argv[0], "-?") == 0) || (strcmp(argv[0], "/?") == 0)) { - Usage(); - return STATUS_ERROR; - } - - // - // Open the file containing the FV - // - InputFile = fopen (argv[0], "rb"); - if (InputFile == NULL) { - Error (NULL, 0, 0001, "Error opening the input file", argv[0]); - return GetUtilityStatus (); - } - // - // Skip over pad bytes if specified. This is used if they prepend 0xff - // data to the FV image binary. - // - if (Offset != 0) { - fseek (InputFile, Offset, SEEK_SET); - } - // - // Determine size of FV - // - Status = ReadHeader (InputFile, &FvSize, &ErasePolarity); - if (EFI_ERROR (Status)) { - Error (NULL, 0, 0003, "error parsing FV image", "%s Header is invalid", argv[0]); - fclose (InputFile); - return GetUtilityStatus (); - } - // - // Allocate a buffer for the FV image - // - FvImage = malloc (FvSize); - if (FvImage == NULL) { - Error (NULL, 0, 4001, "Resource: Memory can't be allocated", NULL); - fclose (InputFile); - return GetUtilityStatus (); - } - // - // Seek to the start of the image, then read the entire FV to the buffer - // - fseek (InputFile, Offset, SEEK_SET); - BytesRead = fread (FvImage, 1, FvSize, InputFile); - fclose (InputFile); - if ((unsigned int) BytesRead != FvSize) { - Error (NULL, 0, 0004, "error reading FvImage from", argv[0]); - free (FvImage); - return GetUtilityStatus (); - } - - LoadGuidedSectionToolsTxt (argv[0]); - - PrintFvInfo (FvImage, FALSE); - - // - // Clean up - // - free (FvImage); - FreeGuidBaseNameList (); - return GetUtilityStatus (); -} - - -static -EFI_STATUS -PrintFvInfo ( - IN VOID *Fv, - IN BOOLEAN IsChildFv - ) -/*++ - -Routine Description: - - GC_TODO: Add function description - -Arguments: - - Fv - Firmware Volume to print information about - IsChildFv - Flag specifies whether the input FV is a child FV. - -Returns: - - EFI_STATUS - ---*/ -{ - EFI_STATUS Status; - UINTN NumberOfFiles; - BOOLEAN ErasePolarity; - UINTN FvSize; - EFI_FFS_FILE_HEADER *CurrentFile; - UINTN Key; - - Status = FvBufGetSize (Fv, &FvSize); - - NumberOfFiles = 0; - ErasePolarity = - (((EFI_FIRMWARE_VOLUME_HEADER*)Fv)->Attributes & EFI_FVB2_ERASE_POLARITY) ? - TRUE : FALSE; - - // - // Get the first file - // - Key = 0; - Status = FvBufFindNextFile (Fv, &Key, (VOID **) &CurrentFile); - if (EFI_ERROR (Status)) { - Error (NULL, 0, 0003, "error parsing FV image", "cannot find the first file in the FV image"); - return GetUtilityStatus (); - } - // - // Display information about files found - // - while (CurrentFile != NULL) { - // - // Increment the number of files counter - // - NumberOfFiles++; - - // - // Display info about this file - // - Status = PrintFileInfo (Fv, CurrentFile, ErasePolarity); - if (EFI_ERROR (Status)) { - Error (NULL, 0, 0003, "error parsing FV image", "failed to parse a file in the FV"); - return GetUtilityStatus (); - } - // - // Get the next file - // - Status = FvBufFindNextFile (Fv, &Key, (VOID **) &CurrentFile); - if (Status == EFI_NOT_FOUND) { - CurrentFile = NULL; - } else if (EFI_ERROR (Status)) { - Error (NULL, 0, 0003, "error parsing FV image", "cannot find the next file in the FV image"); - return GetUtilityStatus (); - } - } - - if (IsChildFv) { - printf ("There are a total of %d files in the child FV\n", (int) NumberOfFiles); - } else { - printf ("There are a total of %d files in this FV\n", (int) NumberOfFiles); - } - - return EFI_SUCCESS; -} - -UINT32 -GetOccupiedSize ( - IN UINT32 ActualSize, - IN UINT32 Alignment - ) -/*++ - -Routine Description: - - This function returns the next larger size that meets the alignment - requirement specified. - -Arguments: - - ActualSize The size. - Alignment The desired alignment. - -Returns: - - EFI_SUCCESS Function completed successfully. - EFI_ABORTED The function encountered an error. - ---*/ -{ - UINT32 OccupiedSize; - - OccupiedSize = ActualSize; - while ((OccupiedSize & (Alignment - 1)) != 0) { - OccupiedSize++; - } - - return OccupiedSize; -} - -static -CHAR8 * -SectionNameToStr ( - IN EFI_SECTION_TYPE Type - ) -/*++ - -Routine Description: - - Converts EFI Section names to Strings - -Arguments: - - Type - The EFI Section type - -Returns: - - CHAR8* - Pointer to the String containing the section name. - ---*/ -{ - CHAR8 *SectionStr; - CHAR8 *SectionTypeStringTable[] = { - // - // 0X00 - // - "EFI_SECTION_ALL", - // - // 0x01 - // - "EFI_SECTION_COMPRESSION", - // - // 0x02 - // - "EFI_SECTION_GUID_DEFINED", - // - // 0x03 - // - "Unknown section type - Reserved 0x03", - // - // 0x04 - // - "Unknown section type - Reserved 0x04", - // - // 0x05 - // - "Unknown section type - Reserved 0x05", - // - // 0x06 - // - "Unknown section type - Reserved 0x06", - // - // 0x07 - // - "Unknown section type - Reserved 0x07", - // - // 0x08 - // - "Unknown section type - Reserved 0x08", - // - // 0x09 - // - "Unknown section type - Reserved 0x09", - // - // 0x0A - // - "Unknown section type - Reserved 0x0A", - // - // 0x0B - // - "Unknown section type - Reserved 0x0B", - // - // 0x0C - // - "Unknown section type - Reserved 0x0C", - // - // 0x0D - // - "Unknown section type - Reserved 0x0D", - // - // 0x0E - // - "Unknown section type - Reserved 0x0E", - // - // 0x0F - // - "Unknown section type - Reserved 0x0E", - // - // 0x10 - // - "EFI_SECTION_PE32", - // - // 0x11 - // - "EFI_SECTION_PIC", - // - // 0x12 - // - "EFI_SECTION_TE", - // - // 0x13 - // - "EFI_SECTION_DXE_DEPEX", - // - // 0x14 - // - "EFI_SECTION_VERSION", - // - // 0x15 - // - "EFI_SECTION_USER_INTERFACE", - // - // 0x16 - // - "EFI_SECTION_COMPATIBILITY16", - // - // 0x17 - // - "EFI_SECTION_FIRMWARE_VOLUME_IMAGE ", - // - // 0x18 - // - "EFI_SECTION_FREEFORM_SUBTYPE_GUID ", - // - // 0x19 - // - "EFI_SECTION_RAW", - // - // 0x1A - // - "Unknown section type - 0x1A", - // - // 0x1B - // - "EFI_SECTION_PEI_DEPEX", - // - // 0x1C - // - "EFI_SECTION_SMM_DEPEX", - // - // 0x1C+ - // - "Unknown section type - Reserved - beyond last defined section" - }; - - if (Type > EFI_SECTION_LAST_SECTION_TYPE) { - Type = EFI_SECTION_LAST_SECTION_TYPE + 1; - } - - SectionStr = malloc (100); - if (SectionStr == NULL) { - printf ("Error: Out of memory resources.\n"); - return SectionStr; - } - strcpy (SectionStr, SectionTypeStringTable[Type]); - return SectionStr; -} - -STATIC -EFI_STATUS -ReadHeader ( - IN FILE *InputFile, - OUT UINT32 *FvSize, - OUT BOOLEAN *ErasePolarity - ) -/*++ - -Routine Description: - - This function determines the size of the FV and the erase polarity. The - erase polarity is the FALSE value for file state. - -Arguments: - - InputFile The file that contains the FV image. - FvSize The size of the FV. - ErasePolarity The FV erase polarity. - -Returns: - - EFI_SUCCESS Function completed successfully. - EFI_INVALID_PARAMETER A required parameter was NULL or is out of range. - EFI_ABORTED The function encountered an error. - ---*/ -{ - EFI_FIRMWARE_VOLUME_HEADER VolumeHeader; - EFI_FV_BLOCK_MAP_ENTRY BlockMap; - UINTN Signature[2]; - UINTN BytesRead; - UINT32 Size; - - BytesRead = 0; - Size = 0; - // - // Check input parameters - // - if (InputFile == NULL || FvSize == NULL || ErasePolarity == NULL) { - Error (__FILE__, __LINE__, 0, "application error", "invalid parameter to function"); - return EFI_INVALID_PARAMETER; - } - // - // Read the header - // - fread (&VolumeHeader, sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile); - BytesRead = sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY); - Signature[0] = VolumeHeader.Signature; - Signature[1] = 0; - - // - // Print FV header information - // - printf ("Signature: %s (%X)\n", (char *) Signature, (unsigned) VolumeHeader.Signature); - printf ("Attributes: %X\n", (unsigned) VolumeHeader.Attributes); - - if (VolumeHeader.Attributes & EFI_FVB2_READ_DISABLED_CAP) { - printf (" EFI_FVB2_READ_DISABLED_CAP\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_READ_ENABLED_CAP) { - printf (" EFI_FVB2_READ_ENABLED_CAP\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_READ_STATUS) { - printf (" EFI_FVB2_READ_STATUS\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_WRITE_DISABLED_CAP) { - printf (" EFI_FVB2_WRITE_DISABLED_CAP\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_WRITE_ENABLED_CAP) { - printf (" EFI_FVB2_WRITE_ENABLED_CAP\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_WRITE_STATUS) { - printf (" EFI_FVB2_WRITE_STATUS\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_LOCK_CAP) { - printf (" EFI_FVB2_LOCK_CAP\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_LOCK_STATUS) { - printf (" EFI_FVB2_LOCK_STATUS\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_STICKY_WRITE) { - printf (" EFI_FVB2_STICKY_WRITE\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_MEMORY_MAPPED) { - printf (" EFI_FVB2_MEMORY_MAPPED\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ERASE_POLARITY) { - printf (" EFI_FVB2_ERASE_POLARITY\n"); - *ErasePolarity = TRUE; - } - -#if (PI_SPECIFICATION_VERSION < 0x00010000) - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT) { - printf (" EFI_FVB2_ALIGNMENT\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) { - printf (" EFI_FVB2_ALIGNMENT_2\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4) { - printf (" EFI_FVB2_ALIGNMENT_4\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) { - printf (" EFI_FVB2_ALIGNMENT_8\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) { - printf (" EFI_FVB2_ALIGNMENT_16\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) { - printf (" EFI_FVB2_ALIGNMENT_32\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) { - printf (" EFI_FVB2_ALIGNMENT_64\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) { - printf (" EFI_FVB2_ALIGNMENT_128\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) { - printf (" EFI_FVB2_ALIGNMENT_256\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) { - printf (" EFI_FVB2_ALIGNMENT_512\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) { - printf (" EFI_FVB2_ALIGNMENT_1K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) { - printf (" EFI_FVB2_ALIGNMENT_2K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) { - printf (" EFI_FVB2_ALIGNMENT_4K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) { - printf (" EFI_FVB2_ALIGNMENT_8K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) { - printf (" EFI_FVB2_ALIGNMENT_16K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) { - printf (" EFI_FVB2_ALIGNMENT_32K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) { - printf (" EFI_FVB2_ALIGNMENT_64K\n"); - } - -#else - - if (VolumeHeader.Attributes & EFI_FVB2_READ_LOCK_CAP) { - printf (" EFI_FVB2_READ_LOCK_CAP\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_READ_LOCK_STATUS) { - printf (" EFI_FVB2_READ_LOCK_STATUS\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_WRITE_LOCK_CAP) { - printf (" EFI_FVB2_WRITE_LOCK_CAP\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_WRITE_LOCK_STATUS) { - printf (" EFI_FVB2_WRITE_LOCK_STATUS\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1) { - printf (" EFI_FVB2_ALIGNMENT_1\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) { - printf (" EFI_FVB2_ALIGNMENT_2\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4) { - printf (" EFI_FVB2_ALIGNMENT_4\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) { - printf (" EFI_FVB2_ALIGNMENT_8\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) { - printf (" EFI_FVB2_ALIGNMENT_16\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) { - printf (" EFI_FVB2_ALIGNMENT_32\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) { - printf (" EFI_FVB2_ALIGNMENT_64\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) { - printf (" EFI_FVB2_ALIGNMENT_128\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) { - printf (" EFI_FVB2_ALIGNMENT_256\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) { - printf (" EFI_FVB2_ALIGNMENT_512\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) { - printf (" EFI_FVB2_ALIGNMENT_1K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) { - printf (" EFI_FVB2_ALIGNMENT_2K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) { - printf (" EFI_FVB2_ALIGNMENT_4K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) { - printf (" EFI_FVB2_ALIGNMENT_8K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) { - printf (" EFI_FVB2_ALIGNMENT_16K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) { - printf (" EFI_FVB2_ALIGNMENT_32K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) { - printf (" EFI_FVB2_ALIGNMENT_64K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128K) { - printf (" EFI_FVB2_ALIGNMENT_128K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256K) { - printf (" EFI_FVB2_ALIGNMENT_256K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512K) { - printf (" EFI_FVB2_ALIGNMENT_512K\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1M) { - printf (" EFI_FVB2_ALIGNMENT_1M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2M) { - printf (" EFI_FVB2_ALIGNMENT_2M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4M) { - printf (" EFI_FVB2_ALIGNMENT_4M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8M) { - printf (" EFI_FVB2_ALIGNMENT_8M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16M) { - printf (" EFI_FVB2_ALIGNMENT_16M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32M) { - printf (" EFI_FVB2_ALIGNMENT_32M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) { - printf (" EFI_FVB2_ALIGNMENT_64M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) { - printf (" EFI_FVB2_ALIGNMENT_128M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) { - printf (" EFI_FVB2_ALIGNMENT_64M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) { - printf (" EFI_FVB2_ALIGNMENT_128M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256M) { - printf (" EFI_FVB2_ALIGNMENT_256M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512M) { - printf (" EFI_FVB2_ALIGNMENT_512M\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1G) { - printf (" EFI_FVB2_ALIGNMENT_1G\n"); - } - - if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2G) { - printf (" EFI_FVB2_ALIGNMENT_2G\n"); - } - -#endif - printf ("Header Length: 0x%08X\n", VolumeHeader.HeaderLength); - printf ("File System ID: "); - PrintGuid (&VolumeHeader.FileSystemGuid); - // - // printf ("\n"); - // - printf ("Revision: 0x%04X\n", VolumeHeader.Revision); - - do { - fread (&BlockMap, sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile); - BytesRead += sizeof (EFI_FV_BLOCK_MAP_ENTRY); - - if (BlockMap.NumBlocks != 0) { - printf ("Number of Blocks: 0x%08X\n", (unsigned) BlockMap.NumBlocks); - printf ("Block Length: 0x%08X\n", (unsigned) BlockMap.Length); - Size += BlockMap.NumBlocks * BlockMap.Length; - } - - } while (!(BlockMap.NumBlocks == 0 && BlockMap.Length == 0)); - - if (BytesRead != VolumeHeader.HeaderLength) { - printf ("ERROR: Header length not consistent with Block Maps!\n"); - return EFI_ABORTED; - } - - if (VolumeHeader.FvLength != Size) { - printf ("ERROR: Volume Size not consistant with Block Maps!\n"); - return EFI_ABORTED; - } - - printf ("Total Volume Size: 0x%08X\n", (unsigned) Size); - - *FvSize = Size; - - // - // rewind (InputFile); - // - return EFI_SUCCESS; -} - -STATIC -EFI_STATUS -PrintFileInfo ( - EFI_FIRMWARE_VOLUME_HEADER *FvImage, - EFI_FFS_FILE_HEADER *FileHeader, - BOOLEAN ErasePolarity - ) -/*++ - -Routine Description: - - GC_TODO: Add function description - -Arguments: - - FvImage - GC_TODO: add argument description - FileHeader - GC_TODO: add argument description - ErasePolarity - GC_TODO: add argument description - -Returns: - - EFI_SUCCESS - GC_TODO: Add description for return value - EFI_ABORTED - GC_TODO: Add description for return value - ---*/ -{ - UINT32 FileLength; - UINT8 FileState; - UINT8 Checksum; - EFI_FFS_FILE_HEADER BlankHeader; - EFI_STATUS Status; - UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE]; -#if (PI_SPECIFICATION_VERSION < 0x00010000) - UINT16 *Tail; -#endif - // - // Check if we have free space - // - if (ErasePolarity) { - memset (&BlankHeader, -1, sizeof (EFI_FFS_FILE_HEADER)); - } else { - memset (&BlankHeader, 0, sizeof (EFI_FFS_FILE_HEADER)); - } - - if (memcmp (&BlankHeader, FileHeader, sizeof (EFI_FFS_FILE_HEADER)) == 0) { - return EFI_SUCCESS; - } - // - // Print file information. - // - printf ("============================================================\n"); - - printf ("File Name: "); - PrintGuidToBuffer (&FileHeader->Name, GuidBuffer, sizeof (GuidBuffer), TRUE); - printf ("%s ", GuidBuffer); - PrintGuidName (GuidBuffer); - printf ("\n"); - - // - // PrintGuid (&FileHeader->Name); - // printf ("\n"); - // - FileLength = GetLength (FileHeader->Size); - printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage)); - printf ("File Length: 0x%08X\n", (unsigned) FileLength); - printf ("File Attributes: 0x%02X\n", FileHeader->Attributes); - printf ("File State: 0x%02X\n", FileHeader->State); - - // - // Print file state - // - FileState = GetFileState (ErasePolarity, FileHeader); - - switch (FileState) { - - case EFI_FILE_HEADER_CONSTRUCTION: - printf (" EFI_FILE_HEADER_CONSTRUCTION\n"); - return EFI_SUCCESS; - - case EFI_FILE_HEADER_INVALID: - printf (" EFI_FILE_HEADER_INVALID\n"); - return EFI_SUCCESS; - - case EFI_FILE_HEADER_VALID: - printf (" EFI_FILE_HEADER_VALID\n"); - Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER)); - Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File); - Checksum = (UINT8) (Checksum - FileHeader->State); - if (Checksum != 0) { - printf ("ERROR: Header checksum invalid.\n"); - return EFI_ABORTED; - } - - return EFI_SUCCESS; - - case EFI_FILE_DELETED: - printf (" EFI_FILE_DELETED\n"); - - case EFI_FILE_MARKED_FOR_UPDATE: - printf (" EFI_FILE_MARKED_FOR_UPDATE\n"); - - case EFI_FILE_DATA_VALID: - printf (" EFI_FILE_DATA_VALID\n"); - - // - // Calculate header checksum - // - Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER)); - Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File); - Checksum = (UINT8) (Checksum - FileHeader->State); - if (Checksum != 0) { - Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum", GuidBuffer); - return EFI_ABORTED; - } - - FileLength = GetLength (FileHeader->Size); - - if (FileHeader->Attributes & FFS_ATTRIB_CHECKSUM) { - // - // Calculate file checksum - // - Checksum = CalculateSum8 ((UINT8 *) (FileHeader + 1), FileLength - sizeof (EFI_FFS_FILE_HEADER)); - Checksum = Checksum + FileHeader->IntegrityCheck.Checksum.File; - if (Checksum != 0) { - Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer); - return EFI_ABORTED; - } - } else { - if (FileHeader->IntegrityCheck.Checksum.File != FFS_FIXED_CHECKSUM) { - Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum -- not set to fixed value of 0xAA", GuidBuffer); - return EFI_ABORTED; - } - } -#if (PI_SPECIFICATION_VERSION < 0x00010000) - // - // Verify tail if present - // - if (FileHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT) { - // - // Verify tail is complement of integrity check field in the header. - // - Tail = (UINT16 *) ((UINTN) FileHeader + GetLength (FileHeader->Size) - sizeof (EFI_FFS_INTEGRITY_CHECK)); - if (FileHeader->IntegrityCheck.TailReference != (UINT16)~(*Tail)) { - Error (NULL, 0, 0003, "error parsing FFS file", \ - "FFS file with Guid %s failed in the integrity check, tail is not the complement of the header field", GuidBuffer); - return EFI_ABORTED; - } - } - #endif - break; - - default: - Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has the invalid/unrecognized file state bits", GuidBuffer); - return EFI_ABORTED; - } - - printf ("File Type: 0x%02X ", FileHeader->Type); - - switch (FileHeader->Type) { - - case EFI_FV_FILETYPE_RAW: - printf ("EFI_FV_FILETYPE_RAW\n"); - break; - - case EFI_FV_FILETYPE_FREEFORM: - printf ("EFI_FV_FILETYPE_FREEFORM\n"); - break; - - case EFI_FV_FILETYPE_SECURITY_CORE: - printf ("EFI_FV_FILETYPE_SECURITY_CORE\n"); - break; - - case EFI_FV_FILETYPE_PEI_CORE: - printf ("EFI_FV_FILETYPE_PEI_CORE\n"); - break; - - case EFI_FV_FILETYPE_DXE_CORE: - printf ("EFI_FV_FILETYPE_DXE_CORE\n"); - break; - - case EFI_FV_FILETYPE_PEIM: - printf ("EFI_FV_FILETYPE_PEIM\n"); - break; - - case EFI_FV_FILETYPE_DRIVER: - printf ("EFI_FV_FILETYPE_DRIVER\n"); - break; - - case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER: - printf ("EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER\n"); - break; - - case EFI_FV_FILETYPE_APPLICATION: - printf ("EFI_FV_FILETYPE_APPLICATION\n"); - break; - - case EFI_FV_FILETYPE_SMM: - printf ("EFI_FV_FILETYPE_SMM\n"); - break; - - case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE: - printf ("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE\n"); - break; - - case EFI_FV_FILETYPE_COMBINED_SMM_DXE: - printf ("EFI_FV_FILETYPE_COMBINED_SMM_DXE\n"); - break; - - case EFI_FV_FILETYPE_SMM_CORE: - printf ("EFI_FV_FILETYPE_SMM_CORE\n"); - break; - - case EFI_FV_FILETYPE_FFS_PAD: - printf ("EFI_FV_FILETYPE_FFS_PAD\n"); - break; - - default: - printf ("\nERROR: Unrecognized file type %X.\n", FileHeader->Type); - return EFI_ABORTED; - break; - } - - switch (FileHeader->Type) { - - case EFI_FV_FILETYPE_ALL: - case EFI_FV_FILETYPE_RAW: - case EFI_FV_FILETYPE_FFS_PAD: - break; - - default: - // - // All other files have sections - // - Status = ParseSection ( - (UINT8 *) ((UINTN) FileHeader + sizeof (EFI_FFS_FILE_HEADER)), - GetLength (FileHeader->Size) - sizeof (EFI_FFS_FILE_HEADER) - ); - if (EFI_ERROR (Status)) { - // - // printf ("ERROR: Parsing the FFS file.\n"); - // - return EFI_ABORTED; - } - break; - } - - return EFI_SUCCESS; -} - -EFI_STATUS -ParseSection ( - IN UINT8 *SectionBuffer, - IN UINT32 BufferLength - ) -/*++ - -Routine Description: - - Parses EFI Sections - -Arguments: - - SectionBuffer - Buffer containing the section to parse. - BufferLength - Length of SectionBuffer - -Returns: - - EFI_SECTION_ERROR - Problem with section parsing. - (a) compression errors - (b) unrecognized section - EFI_UNSUPPORTED - Do not know how to parse the section. - EFI_SUCCESS - Section successfully parsed. - EFI_OUT_OF_RESOURCES - Memory allocation failed. - ---*/ -{ - EFI_SECTION_TYPE Type; - UINT8 *Ptr; - UINT32 SectionLength; - CHAR8 *SectionName; - EFI_STATUS Status; - UINT32 ParsedLength; - UINT8 *CompressedBuffer; - UINT32 CompressedLength; - UINT8 *UncompressedBuffer; - UINT32 UncompressedLength; - UINT8 *ToolOutputBuffer; - UINT32 ToolOutputLength; - UINT8 CompressionType; - UINT32 DstSize; - UINT32 ScratchSize; - UINT8 *ScratchBuffer; - DECOMPRESS_FUNCTION DecompressFunction; - GETINFO_FUNCTION GetInfoFunction; - // CHAR16 *name; - CHAR8 *ExtractionTool; - CHAR8 *ToolInputFile; - CHAR8 *ToolOutputFile; - CHAR8 *SystemCommandFormatString; - CHAR8 *SystemCommand; - - ParsedLength = 0; - while (ParsedLength < BufferLength) { - Ptr = SectionBuffer + ParsedLength; - - SectionLength = GetLength (((EFI_COMMON_SECTION_HEADER *) Ptr)->Size); - Type = ((EFI_COMMON_SECTION_HEADER *) Ptr)->Type; - - // - // This is sort of an odd check, but is necessary because FFS files are - // padded to a QWORD boundary, meaning there is potentially a whole section - // header worth of 0xFF bytes. - // - if (SectionLength == 0xffffff && Type == 0xff) { - ParsedLength += 4; - continue; - } - - SectionName = SectionNameToStr (Type); - printf ("------------------------------------------------------------\n"); - printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength); - free (SectionName); - - switch (Type) { - case EFI_SECTION_RAW: - case EFI_SECTION_PE32: - case EFI_SECTION_PIC: - case EFI_SECTION_TE: - // default is no more information - break; - - case EFI_SECTION_USER_INTERFACE: - // name = &((EFI_USER_INTERFACE_SECTION *) Ptr)->FileNameString; - // printf (" String: %s\n", &name); - break; - - case EFI_SECTION_FIRMWARE_VOLUME_IMAGE: - Status = PrintFvInfo (((EFI_FIRMWARE_VOLUME_IMAGE_SECTION*)Ptr) + 1, TRUE); - if (EFI_ERROR (Status)) { - Error (NULL, 0, 0003, "printing of FV section contents failed", NULL); - return EFI_SECTION_ERROR; - } - break; - - case EFI_SECTION_COMPATIBILITY16: - case EFI_SECTION_FREEFORM_SUBTYPE_GUID: - // - // Section does not contain any further header information. - // - break; - - case EFI_SECTION_PEI_DEPEX: - case EFI_SECTION_DXE_DEPEX: - case EFI_SECTION_SMM_DEPEX: - DumpDepexSection (Ptr, SectionLength); - break; - - case EFI_SECTION_VERSION: - printf (" Build Number: 0x%02X\n", ((EFI_VERSION_SECTION *) Ptr)->BuildNumber); - printf (" Version Strg: %s\n", (char*) ((EFI_VERSION_SECTION *) Ptr)->VersionString); - break; - - case EFI_SECTION_COMPRESSION: - UncompressedBuffer = NULL; - CompressedLength = SectionLength - sizeof (EFI_COMPRESSION_SECTION); - UncompressedLength = ((EFI_COMPRESSION_SECTION *) Ptr)->UncompressedLength; - CompressionType = ((EFI_COMPRESSION_SECTION *) Ptr)->CompressionType; - printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength); - - if (CompressionType == EFI_NOT_COMPRESSED) { - printf (" Compression Type: EFI_NOT_COMPRESSED\n"); - if (CompressedLength != UncompressedLength) { - Error ( - NULL, - 0, - 0, - "file is not compressed, but the compressed length does not match the uncompressed length", - NULL - ); - return EFI_SECTION_ERROR; - } - - UncompressedBuffer = Ptr + sizeof (EFI_COMPRESSION_SECTION); - } else if (CompressionType == EFI_STANDARD_COMPRESSION) { - GetInfoFunction = EfiGetInfo; - DecompressFunction = EfiDecompress; - printf (" Compression Type: EFI_STANDARD_COMPRESSION\n"); - - CompressedBuffer = Ptr + sizeof (EFI_COMPRESSION_SECTION); - - Status = GetInfoFunction (CompressedBuffer, CompressedLength, &DstSize, &ScratchSize); - if (EFI_ERROR (Status)) { - Error (NULL, 0, 0003, "error getting compression info from compression section", NULL); - return EFI_SECTION_ERROR; - } - - if (DstSize != UncompressedLength) { - Error (NULL, 0, 0003, "compression error in the compression section", NULL); - return EFI_SECTION_ERROR; - } - - ScratchBuffer = malloc (ScratchSize); - UncompressedBuffer = malloc (UncompressedLength); - if ((ScratchBuffer == NULL) || (UncompressedBuffer == NULL)) { - return EFI_OUT_OF_RESOURCES; - } - Status = DecompressFunction ( - CompressedBuffer, - CompressedLength, - UncompressedBuffer, - UncompressedLength, - ScratchBuffer, - ScratchSize - ); - free (ScratchBuffer); - if (EFI_ERROR (Status)) { - Error (NULL, 0, 0003, "decompress failed", NULL); - free (UncompressedBuffer); - return EFI_SECTION_ERROR; - } - } else { - Error (NULL, 0, 0003, "unrecognized compression type", "type 0x%X", CompressionType); - return EFI_SECTION_ERROR; - } - - Status = ParseSection (UncompressedBuffer, UncompressedLength); - - if (CompressionType == EFI_STANDARD_COMPRESSION) { - // - // We need to deallocate Buffer - // - free (UncompressedBuffer); - } - - if (EFI_ERROR (Status)) { - Error (NULL, 0, 0003, "failed to parse section", NULL); - return EFI_SECTION_ERROR; - } - break; - - case EFI_SECTION_GUID_DEFINED: - printf (" SectionDefinitionGuid: "); - PrintGuid (&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid); - printf ("\n"); - printf (" DataOffset: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset); - printf (" Attributes: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes); - - ExtractionTool = - LookupGuidedSectionToolPath ( - mParsedGuidedSectionTools, - &((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid - ); - - if (ExtractionTool != NULL) { - - ToolInputFile = CloneString (tmpnam (NULL)); - ToolOutputFile = CloneString (tmpnam (NULL)); - - // - // Construction 'system' command string - // - SystemCommandFormatString = "%s -d -o %s %s"; - SystemCommand = malloc ( - strlen (SystemCommandFormatString) + - strlen (ExtractionTool) + - strlen (ToolInputFile) + - strlen (ToolOutputFile) + - 1 - ); - sprintf ( - SystemCommand, - SystemCommandFormatString, - ExtractionTool, - ToolOutputFile, - ToolInputFile - ); - free (ExtractionTool); - - Status = - PutFileImage ( - ToolInputFile, - (CHAR8*) SectionBuffer + ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset, - BufferLength - ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset - ); - - system (SystemCommand); - remove (ToolInputFile); - free (ToolInputFile); - - Status = - GetFileImage ( - ToolOutputFile, - (CHAR8 **)&ToolOutputBuffer, - &ToolOutputLength - ); - remove (ToolOutputFile); - free (ToolOutputFile); - if (EFI_ERROR (Status)) { - Error (NULL, 0, 0004, "unable to read decoded GUIDED section", NULL); - return EFI_SECTION_ERROR; - } - - Status = ParseSection ( - ToolOutputBuffer, - ToolOutputLength - ); - if (EFI_ERROR (Status)) { - Error (NULL, 0, 0003, "parse of decoded GUIDED section failed", NULL); - return EFI_SECTION_ERROR; - } - - // - // Check for CRC32 sections which we can handle internally if needed. - // - } else if (!CompareGuid ( - &((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid, - &gEfiCrc32GuidedSectionExtractionProtocolGuid - ) - ) { - // - // CRC32 guided section - // - Status = ParseSection ( - SectionBuffer + ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset, - BufferLength - ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset - ); - if (EFI_ERROR (Status)) { - Error (NULL, 0, 0003, "parse of CRC32 GUIDED section failed", NULL); - return EFI_SECTION_ERROR; - } - } else { - // - // We don't know how to parse it now. - // - Error (NULL, 0, 0003, "Error parsing section", \ - "EFI_SECTION_GUID_DEFINED cannot be parsed at this time. Tool to decode this section should have been defined in GuidedSectionTools.txt (built in the FV directory)."); - return EFI_UNSUPPORTED; - } - break; - - default: - // - // Unknown section, return error - // - Error (NULL, 0, 0003, "unrecognized section type found", "section type = 0x%X", Type); - return EFI_SECTION_ERROR; - } - - ParsedLength += SectionLength; - // - // We make then next section begin on a 4-byte boundary - // - ParsedLength = GetOccupiedSize (ParsedLength, 4); - } - - if (ParsedLength < BufferLength) { - Error (NULL, 0, 0003, "sections do not completely fill the sectioned buffer being parsed", NULL); - return EFI_SECTION_ERROR; - } - - return EFI_SUCCESS; -} - -EFI_STATUS -DumpDepexSection ( - IN UINT8 *Ptr, - IN UINT32 SectionLength - ) -/*++ - -Routine Description: - - GC_TODO: Add function description - -Arguments: - - Ptr - GC_TODO: add argument description - SectionLength - GC_TODO: add argument description - -Returns: - - EFI_SUCCESS - GC_TODO: Add description for return value - ---*/ -{ - UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE]; - - // - // Need at least a section header + data - // - if (SectionLength <= sizeof (EFI_COMMON_SECTION_HEADER)) { - return EFI_SUCCESS; - } - - Ptr += sizeof (EFI_COMMON_SECTION_HEADER); - SectionLength -= sizeof (EFI_COMMON_SECTION_HEADER); - while (SectionLength > 0) { - printf (" "); - switch (*Ptr) { - case EFI_DEP_BEFORE: - printf ("BEFORE\n"); - Ptr++; - SectionLength--; - break; - - case EFI_DEP_AFTER: - printf ("AFTER\n"); - Ptr++; - SectionLength--; - break; - - case EFI_DEP_PUSH: - printf ("PUSH\n "); - PrintGuidToBuffer ((EFI_GUID *) (Ptr + 1), GuidBuffer, sizeof (GuidBuffer), TRUE); - printf ("%s ", GuidBuffer); - PrintGuidName (GuidBuffer); - printf ("\n"); - // - // PrintGuid ((EFI_GUID *)(Ptr + 1)); - // - Ptr += 17; - SectionLength -= 17; - break; - - case EFI_DEP_AND: - printf ("AND\n"); - Ptr++; - SectionLength--; - break; - - case EFI_DEP_OR: - printf ("OR\n"); - Ptr++; - SectionLength--; - break; - - case EFI_DEP_NOT: - printf ("NOT\n"); - Ptr++; - SectionLength--; - break; - - case EFI_DEP_TRUE: - printf ("TRUE\n"); - Ptr++; - SectionLength--; - break; - - case EFI_DEP_FALSE: - printf ("FALSE\n"); - Ptr++; - SectionLength--; - break; - - case EFI_DEP_END: - printf ("END DEPEX\n"); - Ptr++; - SectionLength--; - break; - - case EFI_DEP_SOR: - printf ("SOR\n"); - Ptr++; - SectionLength--; - break; - - default: - printf ("Unrecognized byte in depex: 0x%X\n", *Ptr); - return EFI_SUCCESS; - } - } - - return EFI_SUCCESS; -} - -EFI_STATUS -PrintGuidName ( - IN UINT8 *GuidStr - ) -/*++ - -Routine Description: - - GC_TODO: Add function description - -Arguments: - - GuidStr - GC_TODO: add argument description - -Returns: - - EFI_SUCCESS - GC_TODO: Add description for return value - EFI_INVALID_PARAMETER - GC_TODO: Add description for return value - ---*/ -{ - GUID_TO_BASENAME *GPtr; - // - // If we have a list of guid-to-basenames, then go through the list to - // look for a guid string match. If found, print the basename to stdout, - // otherwise return a failure. - // - GPtr = mGuidBaseNameList; - while (GPtr != NULL) { - if (_stricmp ((CHAR8*) GuidStr, (CHAR8*) GPtr->Guid) == 0) { - printf ("%s", GPtr->BaseName); - return EFI_SUCCESS; - } - - GPtr = GPtr->Next; - } - - return EFI_INVALID_PARAMETER; -} - -EFI_STATUS -ParseGuidBaseNameFile ( - CHAR8 *FileName - ) -/*++ - -Routine Description: - - GC_TODO: Add function description - -Arguments: - - FileName - GC_TODO: add argument description - -Returns: - - EFI_DEVICE_ERROR - GC_TODO: Add description for return value - EFI_OUT_OF_RESOURCES - GC_TODO: Add description for return value - EFI_SUCCESS - GC_TODO: Add description for return value - ---*/ -{ - FILE *Fptr; - CHAR8 Line[MAX_LINE_LEN]; - GUID_TO_BASENAME *GPtr; - - if ((Fptr = fopen (FileName, "r")) == NULL) { - printf ("ERROR: Failed to open input cross-reference file '%s'\n", FileName); - return EFI_DEVICE_ERROR; - } - - while (fgets (Line, sizeof (Line), Fptr) != NULL) { - // - // Allocate space for another guid/basename element - // - GPtr = malloc (sizeof (GUID_TO_BASENAME)); - if (GPtr == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - memset ((char *) GPtr, 0, sizeof (GUID_TO_BASENAME)); - if (sscanf (Line, "%s %s", GPtr->Guid, GPtr->BaseName) == 2) { - GPtr->Next = mGuidBaseNameList; - mGuidBaseNameList = GPtr; - } else { - // - // Some sort of error. Just continue. - // - free (GPtr); - } - } - - fclose (Fptr); - return EFI_SUCCESS; -} - -EFI_STATUS -FreeGuidBaseNameList ( - VOID - ) -/*++ - -Routine Description: - - GC_TODO: Add function description - -Arguments: - - None - -Returns: - - EFI_SUCCESS - GC_TODO: Add description for return value - ---*/ -{ - GUID_TO_BASENAME *Next; - - while (mGuidBaseNameList != NULL) { - Next = mGuidBaseNameList->Next; - free (mGuidBaseNameList); - mGuidBaseNameList = Next; - } - - return EFI_SUCCESS; -} - - -static -VOID -LoadGuidedSectionToolsTxt ( - IN CHAR8* FirmwareVolumeFilename - ) -{ - CHAR8* PeerFilename; - CHAR8* Places[] = { - NULL, - //NULL, - }; - UINTN Index; - - Places[0] = FirmwareVolumeFilename; - //Places[1] = mUtilityFilename; - - mParsedGuidedSectionTools = NULL; - - for (Index = 0; Index < (sizeof(Places)/sizeof(Places[0])); Index++) { - PeerFilename = OsPathPeerFilePath (Places[Index], "GuidedSectionTools.txt"); - //printf("Loading %s...\n", PeerFilename); - if (OsPathExists (PeerFilename)) { - mParsedGuidedSectionTools = ParseGuidedSectionToolsFile (PeerFilename); - } - free (PeerFilename); - if (mParsedGuidedSectionTools != NULL) { - return; - } - } -} - - -void -Usage ( - VOID - ) -/*++ - -Routine Description: - - GC_TODO: Add function description - -Arguments: - - None - -Returns: - - GC_TODO: add return values - ---*/ -{ - // - // Summary usage - // - fprintf (stdout, "Usage: %s [options] \n\n", UTILITY_NAME); - - // - // Copyright declaration - // - fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n"); - - // - // Details Option - // - fprintf (stdout, "Options:\n"); - fprintf (stdout, " -x xref, --xref xref\n\ - Parse basename to file-guid cross reference file(s).\n"); - fprintf (stdout, " --offset offset\n\ - Offset of file to start processing FV at.\n"); - fprintf (stdout, " -h, --help\n\ - Show this help message and exit.\n"); - -} - +/** @file + +Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.
+This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +Module Name: + + VolInfo.c + +Abstract: + + The tool dumps the contents of a firmware volume + +**/ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Compress.h" +#include "Decompress.h" +#include "VolInfo.h" +#include "CommonLib.h" +#include "EfiUtilityMsgs.h" +#include "FirmwareVolumeBufferLib.h" +#include "OsPath.h" +#include "ParseGuidedSectionTools.h" +#include "StringFuncs.h" + +// +// Utility global variables +// + +EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID; + +#define UTILITY_MAJOR_VERSION 0 +#define UTILITY_MINOR_VERSION 82 + +#define UTILITY_NAME "VolInfo" + +#define EFI_SECTION_ERROR EFIERR (100) + +#define MAX_BASENAME_LEN 60 // not good to hardcode, but let's be reasonable + +// +// Structure to keep a list of guid-to-basenames +// +typedef struct _GUID_TO_BASENAME { + struct _GUID_TO_BASENAME *Next; + INT8 Guid[PRINTED_GUID_BUFFER_SIZE]; + INT8 BaseName[MAX_BASENAME_LEN]; +} GUID_TO_BASENAME; + +static GUID_TO_BASENAME *mGuidBaseNameList = NULL; + +// +// Store GUIDed Section guid->tool mapping +// +EFI_HANDLE mParsedGuidedSectionTools = NULL; + +CHAR8* mUtilityFilename = NULL; + +EFI_STATUS +ParseGuidBaseNameFile ( + CHAR8 *FileName + ); + +EFI_STATUS +FreeGuidBaseNameList ( + VOID + ); + +EFI_STATUS +PrintGuidName ( + IN UINT8 *GuidStr + ); + +EFI_STATUS +ParseSection ( + IN UINT8 *SectionBuffer, + IN UINT32 BufferLength + ); + +EFI_STATUS +DumpDepexSection ( + IN UINT8 *Ptr, + IN UINT32 SectionLength + ); + +STATIC +EFI_STATUS +ReadHeader ( + IN FILE *InputFile, + OUT UINT32 *FvSize, + OUT BOOLEAN *ErasePolarity + ); + +STATIC +EFI_STATUS +PrintFileInfo ( + EFI_FIRMWARE_VOLUME_HEADER *FvImage, + EFI_FFS_FILE_HEADER *FileHeader, + BOOLEAN ErasePolarity + ); + +static +EFI_STATUS +PrintFvInfo ( + IN VOID *Fv, + IN BOOLEAN IsChildFv + ); + +static +VOID +LoadGuidedSectionToolsTxt ( + IN CHAR8* FirmwareVolumeFilename + ); + +void +Usage ( + VOID + ); + +int +main ( + int argc, + char *argv[] + ) +/*++ + +Routine Description: + + GC_TODO: Add function description + +Arguments: + + argc - GC_TODO: add argument description + ] - GC_TODO: add argument description + +Returns: + + GC_TODO: add return values + +--*/ +{ + FILE *InputFile; + int BytesRead; + EFI_FIRMWARE_VOLUME_HEADER *FvImage; + UINT32 FvSize; + EFI_STATUS Status; + int Offset; + BOOLEAN ErasePolarity; + + SetUtilityName (UTILITY_NAME); + // + // Print utility header + // + printf ("%s Tiano Firmware Volume FFS image info. Version %d.%d %s, %s\n", + UTILITY_NAME, + UTILITY_MAJOR_VERSION, + UTILITY_MINOR_VERSION, + __BUILD_VERSION, + __DATE__ + ); + + // + // Save, and then skip filename arg + // + mUtilityFilename = argv[0]; + argc--; + argv++; + + Offset = 0; + + // + // If they specified -x xref guid/basename cross-reference files, process it. + // This will print the basename beside each file guid. To use it, specify + // -x xref_filename to processdsc, then use xref_filename as a parameter + // here. + // + while (argc > 2) { + if ((strcmp(argv[0], "-x") == 0) || (strcmp(argv[0], "--xref") == 0)) { + ParseGuidBaseNameFile (argv[1]); + printf("ParseGuidBaseNameFile: %s\n", argv[1]); + argc -= 2; + argv += 2; + } else if (strcmp(argv[0], "--offset") == 0) { + // + // Hex or decimal? + // + if ((argv[1][0] == '0') && (tolower ((int)argv[1][1]) == 'x')) { + if (sscanf (argv[1], "%x", &Offset) != 1) { + Error (NULL, 0, 1003, "Invalid option value", "Offset = %s", argv[1]); + return GetUtilityStatus (); + } + } else { + if (sscanf (argv[1], "%d", &Offset) != 1) { + Error (NULL, 0, 1003, "Invalid option value", "Offset = %s", argv[1]); + return GetUtilityStatus (); + } + // + // See if they said something like "64K" + // + if (tolower ((int)argv[1][strlen (argv[1]) - 1]) == 'k') { + Offset *= 1024; + } + } + + argc -= 2; + argv += 2; + } else { + Usage (); + return -1; + } + } + // + // Check for proper number of arguments + // + if (argc != 1) { + Usage (); + return -1; + } + // + // Look for help options + // + if ((strcmp(argv[0], "-h") == 0) || (strcmp(argv[0], "--help") == 0) || + (strcmp(argv[0], "-?") == 0) || (strcmp(argv[0], "/?") == 0)) { + Usage(); + return STATUS_ERROR; + } + + // + // Open the file containing the FV + // + InputFile = fopen (argv[0], "rb"); + if (InputFile == NULL) { + Error (NULL, 0, 0001, "Error opening the input file", argv[0]); + return GetUtilityStatus (); + } + // + // Skip over pad bytes if specified. This is used if they prepend 0xff + // data to the FV image binary. + // + if (Offset != 0) { + fseek (InputFile, Offset, SEEK_SET); + } + // + // Determine size of FV + // + Status = ReadHeader (InputFile, &FvSize, &ErasePolarity); + if (EFI_ERROR (Status)) { + Error (NULL, 0, 0003, "error parsing FV image", "%s Header is invalid", argv[0]); + fclose (InputFile); + return GetUtilityStatus (); + } + // + // Allocate a buffer for the FV image + // + FvImage = malloc (FvSize); + if (FvImage == NULL) { + Error (NULL, 0, 4001, "Resource: Memory can't be allocated", NULL); + fclose (InputFile); + return GetUtilityStatus (); + } + // + // Seek to the start of the image, then read the entire FV to the buffer + // + fseek (InputFile, Offset, SEEK_SET); + BytesRead = fread (FvImage, 1, FvSize, InputFile); + fclose (InputFile); + if ((unsigned int) BytesRead != FvSize) { + Error (NULL, 0, 0004, "error reading FvImage from", argv[0]); + free (FvImage); + return GetUtilityStatus (); + } + + LoadGuidedSectionToolsTxt (argv[0]); + + PrintFvInfo (FvImage, FALSE); + + // + // Clean up + // + free (FvImage); + FreeGuidBaseNameList (); + return GetUtilityStatus (); +} + + +static +EFI_STATUS +PrintFvInfo ( + IN VOID *Fv, + IN BOOLEAN IsChildFv + ) +/*++ + +Routine Description: + + GC_TODO: Add function description + +Arguments: + + Fv - Firmware Volume to print information about + IsChildFv - Flag specifies whether the input FV is a child FV. + +Returns: + + EFI_STATUS + +--*/ +{ + EFI_STATUS Status; + UINTN NumberOfFiles; + BOOLEAN ErasePolarity; + UINTN FvSize; + EFI_FFS_FILE_HEADER *CurrentFile; + UINTN Key; + + Status = FvBufGetSize (Fv, &FvSize); + + NumberOfFiles = 0; + ErasePolarity = + (((EFI_FIRMWARE_VOLUME_HEADER*)Fv)->Attributes & EFI_FVB2_ERASE_POLARITY) ? + TRUE : FALSE; + + // + // Get the first file + // + Key = 0; + Status = FvBufFindNextFile (Fv, &Key, (VOID **) &CurrentFile); + if (EFI_ERROR (Status)) { + Error (NULL, 0, 0003, "error parsing FV image", "cannot find the first file in the FV image"); + return GetUtilityStatus (); + } + // + // Display information about files found + // + while (CurrentFile != NULL) { + // + // Increment the number of files counter + // + NumberOfFiles++; + + // + // Display info about this file + // + Status = PrintFileInfo (Fv, CurrentFile, ErasePolarity); + if (EFI_ERROR (Status)) { + Error (NULL, 0, 0003, "error parsing FV image", "failed to parse a file in the FV"); + return GetUtilityStatus (); + } + // + // Get the next file + // + Status = FvBufFindNextFile (Fv, &Key, (VOID **) &CurrentFile); + if (Status == EFI_NOT_FOUND) { + CurrentFile = NULL; + } else if (EFI_ERROR (Status)) { + Error (NULL, 0, 0003, "error parsing FV image", "cannot find the next file in the FV image"); + return GetUtilityStatus (); + } + } + + if (IsChildFv) { + printf ("There are a total of %d files in the child FV\n", (int) NumberOfFiles); + } else { + printf ("There are a total of %d files in this FV\n", (int) NumberOfFiles); + } + + return EFI_SUCCESS; +} + +UINT32 +GetOccupiedSize ( + IN UINT32 ActualSize, + IN UINT32 Alignment + ) +/*++ + +Routine Description: + + This function returns the next larger size that meets the alignment + requirement specified. + +Arguments: + + ActualSize The size. + Alignment The desired alignment. + +Returns: + + EFI_SUCCESS Function completed successfully. + EFI_ABORTED The function encountered an error. + +--*/ +{ + UINT32 OccupiedSize; + + OccupiedSize = ActualSize; + while ((OccupiedSize & (Alignment - 1)) != 0) { + OccupiedSize++; + } + + return OccupiedSize; +} + +static +CHAR8 * +SectionNameToStr ( + IN EFI_SECTION_TYPE Type + ) +/*++ + +Routine Description: + + Converts EFI Section names to Strings + +Arguments: + + Type - The EFI Section type + +Returns: + + CHAR8* - Pointer to the String containing the section name. + +--*/ +{ + CHAR8 *SectionStr; + CHAR8 *SectionTypeStringTable[] = { + // + // 0X00 + // + "EFI_SECTION_ALL", + // + // 0x01 + // + "EFI_SECTION_COMPRESSION", + // + // 0x02 + // + "EFI_SECTION_GUID_DEFINED", + // + // 0x03 + // + "Unknown section type - Reserved 0x03", + // + // 0x04 + // + "Unknown section type - Reserved 0x04", + // + // 0x05 + // + "Unknown section type - Reserved 0x05", + // + // 0x06 + // + "Unknown section type - Reserved 0x06", + // + // 0x07 + // + "Unknown section type - Reserved 0x07", + // + // 0x08 + // + "Unknown section type - Reserved 0x08", + // + // 0x09 + // + "Unknown section type - Reserved 0x09", + // + // 0x0A + // + "Unknown section type - Reserved 0x0A", + // + // 0x0B + // + "Unknown section type - Reserved 0x0B", + // + // 0x0C + // + "Unknown section type - Reserved 0x0C", + // + // 0x0D + // + "Unknown section type - Reserved 0x0D", + // + // 0x0E + // + "Unknown section type - Reserved 0x0E", + // + // 0x0F + // + "Unknown section type - Reserved 0x0E", + // + // 0x10 + // + "EFI_SECTION_PE32", + // + // 0x11 + // + "EFI_SECTION_PIC", + // + // 0x12 + // + "EFI_SECTION_TE", + // + // 0x13 + // + "EFI_SECTION_DXE_DEPEX", + // + // 0x14 + // + "EFI_SECTION_VERSION", + // + // 0x15 + // + "EFI_SECTION_USER_INTERFACE", + // + // 0x16 + // + "EFI_SECTION_COMPATIBILITY16", + // + // 0x17 + // + "EFI_SECTION_FIRMWARE_VOLUME_IMAGE ", + // + // 0x18 + // + "EFI_SECTION_FREEFORM_SUBTYPE_GUID ", + // + // 0x19 + // + "EFI_SECTION_RAW", + // + // 0x1A + // + "Unknown section type - 0x1A", + // + // 0x1B + // + "EFI_SECTION_PEI_DEPEX", + // + // 0x1C + // + "EFI_SECTION_SMM_DEPEX", + // + // 0x1C+ + // + "Unknown section type - Reserved - beyond last defined section" + }; + + if (Type > EFI_SECTION_LAST_SECTION_TYPE) { + Type = EFI_SECTION_LAST_SECTION_TYPE + 1; + } + + SectionStr = malloc (100); + if (SectionStr == NULL) { + printf ("Error: Out of memory resources.\n"); + return SectionStr; + } + strcpy (SectionStr, SectionTypeStringTable[Type]); + return SectionStr; +} + +STATIC +EFI_STATUS +ReadHeader ( + IN FILE *InputFile, + OUT UINT32 *FvSize, + OUT BOOLEAN *ErasePolarity + ) +/*++ + +Routine Description: + + This function determines the size of the FV and the erase polarity. The + erase polarity is the FALSE value for file state. + +Arguments: + + InputFile The file that contains the FV image. + FvSize The size of the FV. + ErasePolarity The FV erase polarity. + +Returns: + + EFI_SUCCESS Function completed successfully. + EFI_INVALID_PARAMETER A required parameter was NULL or is out of range. + EFI_ABORTED The function encountered an error. + +--*/ +{ + EFI_FIRMWARE_VOLUME_HEADER VolumeHeader; + EFI_FV_BLOCK_MAP_ENTRY BlockMap; + UINTN Signature[2]; + UINTN BytesRead; + UINT32 Size; + + BytesRead = 0; + Size = 0; + // + // Check input parameters + // + if (InputFile == NULL || FvSize == NULL || ErasePolarity == NULL) { + Error (__FILE__, __LINE__, 0, "application error", "invalid parameter to function"); + return EFI_INVALID_PARAMETER; + } + // + // Read the header + // + fread (&VolumeHeader, sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile); + BytesRead = sizeof (EFI_FIRMWARE_VOLUME_HEADER) - sizeof (EFI_FV_BLOCK_MAP_ENTRY); + Signature[0] = VolumeHeader.Signature; + Signature[1] = 0; + + // + // Print FV header information + // + printf ("Signature: %s (%X)\n", (char *) Signature, (unsigned) VolumeHeader.Signature); + printf ("Attributes: %X\n", (unsigned) VolumeHeader.Attributes); + + if (VolumeHeader.Attributes & EFI_FVB2_READ_DISABLED_CAP) { + printf (" EFI_FVB2_READ_DISABLED_CAP\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_READ_ENABLED_CAP) { + printf (" EFI_FVB2_READ_ENABLED_CAP\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_READ_STATUS) { + printf (" EFI_FVB2_READ_STATUS\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_WRITE_DISABLED_CAP) { + printf (" EFI_FVB2_WRITE_DISABLED_CAP\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_WRITE_ENABLED_CAP) { + printf (" EFI_FVB2_WRITE_ENABLED_CAP\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_WRITE_STATUS) { + printf (" EFI_FVB2_WRITE_STATUS\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_LOCK_CAP) { + printf (" EFI_FVB2_LOCK_CAP\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_LOCK_STATUS) { + printf (" EFI_FVB2_LOCK_STATUS\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_STICKY_WRITE) { + printf (" EFI_FVB2_STICKY_WRITE\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_MEMORY_MAPPED) { + printf (" EFI_FVB2_MEMORY_MAPPED\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ERASE_POLARITY) { + printf (" EFI_FVB2_ERASE_POLARITY\n"); + *ErasePolarity = TRUE; + } + +#if (PI_SPECIFICATION_VERSION < 0x00010000) + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT) { + printf (" EFI_FVB2_ALIGNMENT\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) { + printf (" EFI_FVB2_ALIGNMENT_2\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4) { + printf (" EFI_FVB2_ALIGNMENT_4\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) { + printf (" EFI_FVB2_ALIGNMENT_8\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) { + printf (" EFI_FVB2_ALIGNMENT_16\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) { + printf (" EFI_FVB2_ALIGNMENT_32\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) { + printf (" EFI_FVB2_ALIGNMENT_64\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) { + printf (" EFI_FVB2_ALIGNMENT_128\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) { + printf (" EFI_FVB2_ALIGNMENT_256\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) { + printf (" EFI_FVB2_ALIGNMENT_512\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) { + printf (" EFI_FVB2_ALIGNMENT_1K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) { + printf (" EFI_FVB2_ALIGNMENT_2K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) { + printf (" EFI_FVB2_ALIGNMENT_4K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) { + printf (" EFI_FVB2_ALIGNMENT_8K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) { + printf (" EFI_FVB2_ALIGNMENT_16K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) { + printf (" EFI_FVB2_ALIGNMENT_32K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) { + printf (" EFI_FVB2_ALIGNMENT_64K\n"); + } + +#else + + if (VolumeHeader.Attributes & EFI_FVB2_READ_LOCK_CAP) { + printf (" EFI_FVB2_READ_LOCK_CAP\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_READ_LOCK_STATUS) { + printf (" EFI_FVB2_READ_LOCK_STATUS\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_WRITE_LOCK_CAP) { + printf (" EFI_FVB2_WRITE_LOCK_CAP\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_WRITE_LOCK_STATUS) { + printf (" EFI_FVB2_WRITE_LOCK_STATUS\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1) { + printf (" EFI_FVB2_ALIGNMENT_1\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) { + printf (" EFI_FVB2_ALIGNMENT_2\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4) { + printf (" EFI_FVB2_ALIGNMENT_4\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) { + printf (" EFI_FVB2_ALIGNMENT_8\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) { + printf (" EFI_FVB2_ALIGNMENT_16\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) { + printf (" EFI_FVB2_ALIGNMENT_32\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) { + printf (" EFI_FVB2_ALIGNMENT_64\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) { + printf (" EFI_FVB2_ALIGNMENT_128\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) { + printf (" EFI_FVB2_ALIGNMENT_256\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) { + printf (" EFI_FVB2_ALIGNMENT_512\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) { + printf (" EFI_FVB2_ALIGNMENT_1K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) { + printf (" EFI_FVB2_ALIGNMENT_2K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) { + printf (" EFI_FVB2_ALIGNMENT_4K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) { + printf (" EFI_FVB2_ALIGNMENT_8K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) { + printf (" EFI_FVB2_ALIGNMENT_16K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) { + printf (" EFI_FVB2_ALIGNMENT_32K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) { + printf (" EFI_FVB2_ALIGNMENT_64K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128K) { + printf (" EFI_FVB2_ALIGNMENT_128K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256K) { + printf (" EFI_FVB2_ALIGNMENT_256K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512K) { + printf (" EFI_FVB2_ALIGNMENT_512K\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1M) { + printf (" EFI_FVB2_ALIGNMENT_1M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2M) { + printf (" EFI_FVB2_ALIGNMENT_2M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4M) { + printf (" EFI_FVB2_ALIGNMENT_4M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8M) { + printf (" EFI_FVB2_ALIGNMENT_8M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16M) { + printf (" EFI_FVB2_ALIGNMENT_16M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32M) { + printf (" EFI_FVB2_ALIGNMENT_32M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) { + printf (" EFI_FVB2_ALIGNMENT_64M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) { + printf (" EFI_FVB2_ALIGNMENT_128M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64M) { + printf (" EFI_FVB2_ALIGNMENT_64M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128M) { + printf (" EFI_FVB2_ALIGNMENT_128M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256M) { + printf (" EFI_FVB2_ALIGNMENT_256M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512M) { + printf (" EFI_FVB2_ALIGNMENT_512M\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1G) { + printf (" EFI_FVB2_ALIGNMENT_1G\n"); + } + + if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2G) { + printf (" EFI_FVB2_ALIGNMENT_2G\n"); + } + +#endif + printf ("Header Length: 0x%08X\n", VolumeHeader.HeaderLength); + printf ("File System ID: "); + PrintGuid (&VolumeHeader.FileSystemGuid); + // + // printf ("\n"); + // + printf ("Revision: 0x%04X\n", VolumeHeader.Revision); + + do { + fread (&BlockMap, sizeof (EFI_FV_BLOCK_MAP_ENTRY), 1, InputFile); + BytesRead += sizeof (EFI_FV_BLOCK_MAP_ENTRY); + + if (BlockMap.NumBlocks != 0) { + printf ("Number of Blocks: 0x%08X\n", (unsigned) BlockMap.NumBlocks); + printf ("Block Length: 0x%08X\n", (unsigned) BlockMap.Length); + Size += BlockMap.NumBlocks * BlockMap.Length; + } + + } while (!(BlockMap.NumBlocks == 0 && BlockMap.Length == 0)); + + if (BytesRead != VolumeHeader.HeaderLength) { + printf ("ERROR: Header length not consistent with Block Maps!\n"); + return EFI_ABORTED; + } + + if (VolumeHeader.FvLength != Size) { + printf ("ERROR: Volume Size not consistant with Block Maps!\n"); + return EFI_ABORTED; + } + + printf ("Total Volume Size: 0x%08X\n", (unsigned) Size); + + *FvSize = Size; + + // + // rewind (InputFile); + // + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +PrintFileInfo ( + EFI_FIRMWARE_VOLUME_HEADER *FvImage, + EFI_FFS_FILE_HEADER *FileHeader, + BOOLEAN ErasePolarity + ) +/*++ + +Routine Description: + + GC_TODO: Add function description + +Arguments: + + FvImage - GC_TODO: add argument description + FileHeader - GC_TODO: add argument description + ErasePolarity - GC_TODO: add argument description + +Returns: + + EFI_SUCCESS - GC_TODO: Add description for return value + EFI_ABORTED - GC_TODO: Add description for return value + +--*/ +{ + UINT32 FileLength; + UINT8 FileState; + UINT8 Checksum; + EFI_FFS_FILE_HEADER BlankHeader; + EFI_STATUS Status; + UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE]; +#if (PI_SPECIFICATION_VERSION < 0x00010000) + UINT16 *Tail; +#endif + // + // Check if we have free space + // + if (ErasePolarity) { + memset (&BlankHeader, -1, sizeof (EFI_FFS_FILE_HEADER)); + } else { + memset (&BlankHeader, 0, sizeof (EFI_FFS_FILE_HEADER)); + } + + if (memcmp (&BlankHeader, FileHeader, sizeof (EFI_FFS_FILE_HEADER)) == 0) { + return EFI_SUCCESS; + } + // + // Print file information. + // + printf ("============================================================\n"); + + printf ("File Name: "); + PrintGuidToBuffer (&FileHeader->Name, GuidBuffer, sizeof (GuidBuffer), TRUE); + printf ("%s ", GuidBuffer); + PrintGuidName (GuidBuffer); + printf ("\n"); + + // + // PrintGuid (&FileHeader->Name); + // printf ("\n"); + // + FileLength = GetLength (FileHeader->Size); + printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage)); + printf ("File Length: 0x%08X\n", (unsigned) FileLength); + printf ("File Attributes: 0x%02X\n", FileHeader->Attributes); + printf ("File State: 0x%02X\n", FileHeader->State); + + // + // Print file state + // + FileState = GetFileState (ErasePolarity, FileHeader); + + switch (FileState) { + + case EFI_FILE_HEADER_CONSTRUCTION: + printf (" EFI_FILE_HEADER_CONSTRUCTION\n"); + return EFI_SUCCESS; + + case EFI_FILE_HEADER_INVALID: + printf (" EFI_FILE_HEADER_INVALID\n"); + return EFI_SUCCESS; + + case EFI_FILE_HEADER_VALID: + printf (" EFI_FILE_HEADER_VALID\n"); + Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER)); + Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File); + Checksum = (UINT8) (Checksum - FileHeader->State); + if (Checksum != 0) { + printf ("ERROR: Header checksum invalid.\n"); + return EFI_ABORTED; + } + + return EFI_SUCCESS; + + case EFI_FILE_DELETED: + printf (" EFI_FILE_DELETED\n"); + + case EFI_FILE_MARKED_FOR_UPDATE: + printf (" EFI_FILE_MARKED_FOR_UPDATE\n"); + + case EFI_FILE_DATA_VALID: + printf (" EFI_FILE_DATA_VALID\n"); + + // + // Calculate header checksum + // + Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER)); + Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File); + Checksum = (UINT8) (Checksum - FileHeader->State); + if (Checksum != 0) { + Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum", GuidBuffer); + return EFI_ABORTED; + } + + FileLength = GetLength (FileHeader->Size); + + if (FileHeader->Attributes & FFS_ATTRIB_CHECKSUM) { + // + // Calculate file checksum + // + Checksum = CalculateSum8 ((UINT8 *) (FileHeader + 1), FileLength - sizeof (EFI_FFS_FILE_HEADER)); + Checksum = Checksum + FileHeader->IntegrityCheck.Checksum.File; + if (Checksum != 0) { + Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer); + return EFI_ABORTED; + } + } else { + if (FileHeader->IntegrityCheck.Checksum.File != FFS_FIXED_CHECKSUM) { + Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum -- not set to fixed value of 0xAA", GuidBuffer); + return EFI_ABORTED; + } + } +#if (PI_SPECIFICATION_VERSION < 0x00010000) + // + // Verify tail if present + // + if (FileHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT) { + // + // Verify tail is complement of integrity check field in the header. + // + Tail = (UINT16 *) ((UINTN) FileHeader + GetLength (FileHeader->Size) - sizeof (EFI_FFS_INTEGRITY_CHECK)); + if (FileHeader->IntegrityCheck.TailReference != (UINT16)~(*Tail)) { + Error (NULL, 0, 0003, "error parsing FFS file", \ + "FFS file with Guid %s failed in the integrity check, tail is not the complement of the header field", GuidBuffer); + return EFI_ABORTED; + } + } + #endif + break; + + default: + Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has the invalid/unrecognized file state bits", GuidBuffer); + return EFI_ABORTED; + } + + printf ("File Type: 0x%02X ", FileHeader->Type); + + switch (FileHeader->Type) { + + case EFI_FV_FILETYPE_RAW: + printf ("EFI_FV_FILETYPE_RAW\n"); + break; + + case EFI_FV_FILETYPE_FREEFORM: + printf ("EFI_FV_FILETYPE_FREEFORM\n"); + break; + + case EFI_FV_FILETYPE_SECURITY_CORE: + printf ("EFI_FV_FILETYPE_SECURITY_CORE\n"); + break; + + case EFI_FV_FILETYPE_PEI_CORE: + printf ("EFI_FV_FILETYPE_PEI_CORE\n"); + break; + + case EFI_FV_FILETYPE_DXE_CORE: + printf ("EFI_FV_FILETYPE_DXE_CORE\n"); + break; + + case EFI_FV_FILETYPE_PEIM: + printf ("EFI_FV_FILETYPE_PEIM\n"); + break; + + case EFI_FV_FILETYPE_DRIVER: + printf ("EFI_FV_FILETYPE_DRIVER\n"); + break; + + case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER: + printf ("EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER\n"); + break; + + case EFI_FV_FILETYPE_APPLICATION: + printf ("EFI_FV_FILETYPE_APPLICATION\n"); + break; + + case EFI_FV_FILETYPE_SMM: + printf ("EFI_FV_FILETYPE_SMM\n"); + break; + + case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE: + printf ("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE\n"); + break; + + case EFI_FV_FILETYPE_COMBINED_SMM_DXE: + printf ("EFI_FV_FILETYPE_COMBINED_SMM_DXE\n"); + break; + + case EFI_FV_FILETYPE_SMM_CORE: + printf ("EFI_FV_FILETYPE_SMM_CORE\n"); + break; + + case EFI_FV_FILETYPE_FFS_PAD: + printf ("EFI_FV_FILETYPE_FFS_PAD\n"); + break; + + default: + printf ("\nERROR: Unrecognized file type %X.\n", FileHeader->Type); + return EFI_ABORTED; + break; + } + + switch (FileHeader->Type) { + + case EFI_FV_FILETYPE_ALL: + case EFI_FV_FILETYPE_RAW: + case EFI_FV_FILETYPE_FFS_PAD: + break; + + default: + // + // All other files have sections + // + Status = ParseSection ( + (UINT8 *) ((UINTN) FileHeader + sizeof (EFI_FFS_FILE_HEADER)), + GetLength (FileHeader->Size) - sizeof (EFI_FFS_FILE_HEADER) + ); + if (EFI_ERROR (Status)) { + // + // printf ("ERROR: Parsing the FFS file.\n"); + // + return EFI_ABORTED; + } + break; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +ParseSection ( + IN UINT8 *SectionBuffer, + IN UINT32 BufferLength + ) +/*++ + +Routine Description: + + Parses EFI Sections + +Arguments: + + SectionBuffer - Buffer containing the section to parse. + BufferLength - Length of SectionBuffer + +Returns: + + EFI_SECTION_ERROR - Problem with section parsing. + (a) compression errors + (b) unrecognized section + EFI_UNSUPPORTED - Do not know how to parse the section. + EFI_SUCCESS - Section successfully parsed. + EFI_OUT_OF_RESOURCES - Memory allocation failed. + +--*/ +{ + EFI_SECTION_TYPE Type; + UINT8 *Ptr; + UINT32 SectionLength; + CHAR8 *SectionName; + EFI_STATUS Status; + UINT32 ParsedLength; + UINT8 *CompressedBuffer; + UINT32 CompressedLength; + UINT8 *UncompressedBuffer; + UINT32 UncompressedLength; + UINT8 *ToolOutputBuffer; + UINT32 ToolOutputLength; + UINT8 CompressionType; + UINT32 DstSize; + UINT32 ScratchSize; + UINT8 *ScratchBuffer; + DECOMPRESS_FUNCTION DecompressFunction; + GETINFO_FUNCTION GetInfoFunction; + // CHAR16 *name; + CHAR8 *ExtractionTool; + CHAR8 *ToolInputFile; + CHAR8 *ToolOutputFile; + CHAR8 *SystemCommandFormatString; + CHAR8 *SystemCommand; + + ParsedLength = 0; + while (ParsedLength < BufferLength) { + Ptr = SectionBuffer + ParsedLength; + + SectionLength = GetLength (((EFI_COMMON_SECTION_HEADER *) Ptr)->Size); + Type = ((EFI_COMMON_SECTION_HEADER *) Ptr)->Type; + + // + // This is sort of an odd check, but is necessary because FFS files are + // padded to a QWORD boundary, meaning there is potentially a whole section + // header worth of 0xFF bytes. + // + if (SectionLength == 0xffffff && Type == 0xff) { + ParsedLength += 4; + continue; + } + + SectionName = SectionNameToStr (Type); + printf ("------------------------------------------------------------\n"); + printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength); + free (SectionName); + + switch (Type) { + case EFI_SECTION_RAW: + case EFI_SECTION_PE32: + case EFI_SECTION_PIC: + case EFI_SECTION_TE: + // default is no more information + break; + + case EFI_SECTION_USER_INTERFACE: + // name = &((EFI_USER_INTERFACE_SECTION *) Ptr)->FileNameString; + // printf (" String: %s\n", &name); + break; + + case EFI_SECTION_FIRMWARE_VOLUME_IMAGE: + Status = PrintFvInfo (((EFI_FIRMWARE_VOLUME_IMAGE_SECTION*)Ptr) + 1, TRUE); + if (EFI_ERROR (Status)) { + Error (NULL, 0, 0003, "printing of FV section contents failed", NULL); + return EFI_SECTION_ERROR; + } + break; + + case EFI_SECTION_COMPATIBILITY16: + case EFI_SECTION_FREEFORM_SUBTYPE_GUID: + // + // Section does not contain any further header information. + // + break; + + case EFI_SECTION_PEI_DEPEX: + case EFI_SECTION_DXE_DEPEX: + case EFI_SECTION_SMM_DEPEX: + DumpDepexSection (Ptr, SectionLength); + break; + + case EFI_SECTION_VERSION: + printf (" Build Number: 0x%02X\n", ((EFI_VERSION_SECTION *) Ptr)->BuildNumber); + printf (" Version Strg: %s\n", (char*) ((EFI_VERSION_SECTION *) Ptr)->VersionString); + break; + + case EFI_SECTION_COMPRESSION: + UncompressedBuffer = NULL; + CompressedLength = SectionLength - sizeof (EFI_COMPRESSION_SECTION); + UncompressedLength = ((EFI_COMPRESSION_SECTION *) Ptr)->UncompressedLength; + CompressionType = ((EFI_COMPRESSION_SECTION *) Ptr)->CompressionType; + printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength); + + if (CompressionType == EFI_NOT_COMPRESSED) { + printf (" Compression Type: EFI_NOT_COMPRESSED\n"); + if (CompressedLength != UncompressedLength) { + Error ( + NULL, + 0, + 0, + "file is not compressed, but the compressed length does not match the uncompressed length", + NULL + ); + return EFI_SECTION_ERROR; + } + + UncompressedBuffer = Ptr + sizeof (EFI_COMPRESSION_SECTION); + } else if (CompressionType == EFI_STANDARD_COMPRESSION) { + GetInfoFunction = EfiGetInfo; + DecompressFunction = EfiDecompress; + printf (" Compression Type: EFI_STANDARD_COMPRESSION\n"); + + CompressedBuffer = Ptr + sizeof (EFI_COMPRESSION_SECTION); + + Status = GetInfoFunction (CompressedBuffer, CompressedLength, &DstSize, &ScratchSize); + if (EFI_ERROR (Status)) { + Error (NULL, 0, 0003, "error getting compression info from compression section", NULL); + return EFI_SECTION_ERROR; + } + + if (DstSize != UncompressedLength) { + Error (NULL, 0, 0003, "compression error in the compression section", NULL); + return EFI_SECTION_ERROR; + } + + ScratchBuffer = malloc (ScratchSize); + UncompressedBuffer = malloc (UncompressedLength); + if ((ScratchBuffer == NULL) || (UncompressedBuffer == NULL)) { + return EFI_OUT_OF_RESOURCES; + } + Status = DecompressFunction ( + CompressedBuffer, + CompressedLength, + UncompressedBuffer, + UncompressedLength, + ScratchBuffer, + ScratchSize + ); + free (ScratchBuffer); + if (EFI_ERROR (Status)) { + Error (NULL, 0, 0003, "decompress failed", NULL); + free (UncompressedBuffer); + return EFI_SECTION_ERROR; + } + } else { + Error (NULL, 0, 0003, "unrecognized compression type", "type 0x%X", CompressionType); + return EFI_SECTION_ERROR; + } + + Status = ParseSection (UncompressedBuffer, UncompressedLength); + + if (CompressionType == EFI_STANDARD_COMPRESSION) { + // + // We need to deallocate Buffer + // + free (UncompressedBuffer); + } + + if (EFI_ERROR (Status)) { + Error (NULL, 0, 0003, "failed to parse section", NULL); + return EFI_SECTION_ERROR; + } + break; + + case EFI_SECTION_GUID_DEFINED: + printf (" SectionDefinitionGuid: "); + PrintGuid (&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid); + printf ("\n"); + printf (" DataOffset: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset); + printf (" Attributes: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes); + + ExtractionTool = + LookupGuidedSectionToolPath ( + mParsedGuidedSectionTools, + &((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid + ); + + if (ExtractionTool != NULL) { + + ToolInputFile = CloneString (tmpnam (NULL)); + ToolOutputFile = CloneString (tmpnam (NULL)); + + // + // Construction 'system' command string + // + SystemCommandFormatString = "%s -d -o %s %s"; + SystemCommand = malloc ( + strlen (SystemCommandFormatString) + + strlen (ExtractionTool) + + strlen (ToolInputFile) + + strlen (ToolOutputFile) + + 1 + ); + sprintf ( + SystemCommand, + SystemCommandFormatString, + ExtractionTool, + ToolOutputFile, + ToolInputFile + ); + free (ExtractionTool); + + Status = + PutFileImage ( + ToolInputFile, + (CHAR8*) SectionBuffer + ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset, + BufferLength - ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset + ); + + system (SystemCommand); + remove (ToolInputFile); + free (ToolInputFile); + + Status = + GetFileImage ( + ToolOutputFile, + (CHAR8 **)&ToolOutputBuffer, + &ToolOutputLength + ); + remove (ToolOutputFile); + free (ToolOutputFile); + if (EFI_ERROR (Status)) { + Error (NULL, 0, 0004, "unable to read decoded GUIDED section", NULL); + return EFI_SECTION_ERROR; + } + + Status = ParseSection ( + ToolOutputBuffer, + ToolOutputLength + ); + if (EFI_ERROR (Status)) { + Error (NULL, 0, 0003, "parse of decoded GUIDED section failed", NULL); + return EFI_SECTION_ERROR; + } + + // + // Check for CRC32 sections which we can handle internally if needed. + // + } else if (!CompareGuid ( + &((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid, + &gEfiCrc32GuidedSectionExtractionProtocolGuid + ) + ) { + // + // CRC32 guided section + // + Status = ParseSection ( + SectionBuffer + ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset, + BufferLength - ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset + ); + if (EFI_ERROR (Status)) { + Error (NULL, 0, 0003, "parse of CRC32 GUIDED section failed", NULL); + return EFI_SECTION_ERROR; + } + } else { + // + // We don't know how to parse it now. + // + Error (NULL, 0, 0003, "Error parsing section", \ + "EFI_SECTION_GUID_DEFINED cannot be parsed at this time. Tool to decode this section should have been defined in GuidedSectionTools.txt (built in the FV directory)."); + return EFI_UNSUPPORTED; + } + break; + + default: + // + // Unknown section, return error + // + Error (NULL, 0, 0003, "unrecognized section type found", "section type = 0x%X", Type); + return EFI_SECTION_ERROR; + } + + ParsedLength += SectionLength; + // + // We make then next section begin on a 4-byte boundary + // + ParsedLength = GetOccupiedSize (ParsedLength, 4); + } + + if (ParsedLength < BufferLength) { + Error (NULL, 0, 0003, "sections do not completely fill the sectioned buffer being parsed", NULL); + return EFI_SECTION_ERROR; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +DumpDepexSection ( + IN UINT8 *Ptr, + IN UINT32 SectionLength + ) +/*++ + +Routine Description: + + GC_TODO: Add function description + +Arguments: + + Ptr - GC_TODO: add argument description + SectionLength - GC_TODO: add argument description + +Returns: + + EFI_SUCCESS - GC_TODO: Add description for return value + +--*/ +{ + UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE]; + + // + // Need at least a section header + data + // + if (SectionLength <= sizeof (EFI_COMMON_SECTION_HEADER)) { + return EFI_SUCCESS; + } + + Ptr += sizeof (EFI_COMMON_SECTION_HEADER); + SectionLength -= sizeof (EFI_COMMON_SECTION_HEADER); + while (SectionLength > 0) { + printf (" "); + switch (*Ptr) { + case EFI_DEP_BEFORE: + printf ("BEFORE\n"); + Ptr++; + SectionLength--; + break; + + case EFI_DEP_AFTER: + printf ("AFTER\n"); + Ptr++; + SectionLength--; + break; + + case EFI_DEP_PUSH: + printf ("PUSH\n "); + PrintGuidToBuffer ((EFI_GUID *) (Ptr + 1), GuidBuffer, sizeof (GuidBuffer), TRUE); + printf ("%s ", GuidBuffer); + PrintGuidName (GuidBuffer); + printf ("\n"); + // + // PrintGuid ((EFI_GUID *)(Ptr + 1)); + // + Ptr += 17; + SectionLength -= 17; + break; + + case EFI_DEP_AND: + printf ("AND\n"); + Ptr++; + SectionLength--; + break; + + case EFI_DEP_OR: + printf ("OR\n"); + Ptr++; + SectionLength--; + break; + + case EFI_DEP_NOT: + printf ("NOT\n"); + Ptr++; + SectionLength--; + break; + + case EFI_DEP_TRUE: + printf ("TRUE\n"); + Ptr++; + SectionLength--; + break; + + case EFI_DEP_FALSE: + printf ("FALSE\n"); + Ptr++; + SectionLength--; + break; + + case EFI_DEP_END: + printf ("END DEPEX\n"); + Ptr++; + SectionLength--; + break; + + case EFI_DEP_SOR: + printf ("SOR\n"); + Ptr++; + SectionLength--; + break; + + default: + printf ("Unrecognized byte in depex: 0x%X\n", *Ptr); + return EFI_SUCCESS; + } + } + + return EFI_SUCCESS; +} + +EFI_STATUS +PrintGuidName ( + IN UINT8 *GuidStr + ) +/*++ + +Routine Description: + + GC_TODO: Add function description + +Arguments: + + GuidStr - GC_TODO: add argument description + +Returns: + + EFI_SUCCESS - GC_TODO: Add description for return value + EFI_INVALID_PARAMETER - GC_TODO: Add description for return value + +--*/ +{ + GUID_TO_BASENAME *GPtr; + // + // If we have a list of guid-to-basenames, then go through the list to + // look for a guid string match. If found, print the basename to stdout, + // otherwise return a failure. + // + GPtr = mGuidBaseNameList; + while (GPtr != NULL) { + if (_stricmp ((CHAR8*) GuidStr, (CHAR8*) GPtr->Guid) == 0) { + printf ("%s", GPtr->BaseName); + return EFI_SUCCESS; + } + + GPtr = GPtr->Next; + } + + return EFI_INVALID_PARAMETER; +} + +EFI_STATUS +ParseGuidBaseNameFile ( + CHAR8 *FileName + ) +/*++ + +Routine Description: + + GC_TODO: Add function description + +Arguments: + + FileName - GC_TODO: add argument description + +Returns: + + EFI_DEVICE_ERROR - GC_TODO: Add description for return value + EFI_OUT_OF_RESOURCES - GC_TODO: Add description for return value + EFI_SUCCESS - GC_TODO: Add description for return value + +--*/ +{ + FILE *Fptr; + CHAR8 Line[MAX_LINE_LEN]; + GUID_TO_BASENAME *GPtr; + + if ((Fptr = fopen (FileName, "r")) == NULL) { + printf ("ERROR: Failed to open input cross-reference file '%s'\n", FileName); + return EFI_DEVICE_ERROR; + } + + while (fgets (Line, sizeof (Line), Fptr) != NULL) { + // + // Allocate space for another guid/basename element + // + GPtr = malloc (sizeof (GUID_TO_BASENAME)); + if (GPtr == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + memset ((char *) GPtr, 0, sizeof (GUID_TO_BASENAME)); + if (sscanf (Line, "%s %s", GPtr->Guid, GPtr->BaseName) == 2) { + GPtr->Next = mGuidBaseNameList; + mGuidBaseNameList = GPtr; + } else { + // + // Some sort of error. Just continue. + // + free (GPtr); + } + } + + fclose (Fptr); + return EFI_SUCCESS; +} + +EFI_STATUS +FreeGuidBaseNameList ( + VOID + ) +/*++ + +Routine Description: + + GC_TODO: Add function description + +Arguments: + + None + +Returns: + + EFI_SUCCESS - GC_TODO: Add description for return value + +--*/ +{ + GUID_TO_BASENAME *Next; + + while (mGuidBaseNameList != NULL) { + Next = mGuidBaseNameList->Next; + free (mGuidBaseNameList); + mGuidBaseNameList = Next; + } + + return EFI_SUCCESS; +} + + +static +VOID +LoadGuidedSectionToolsTxt ( + IN CHAR8* FirmwareVolumeFilename + ) +{ + CHAR8* PeerFilename; + CHAR8* Places[] = { + NULL, + //NULL, + }; + UINTN Index; + + Places[0] = FirmwareVolumeFilename; + //Places[1] = mUtilityFilename; + + mParsedGuidedSectionTools = NULL; + + for (Index = 0; Index < (sizeof(Places)/sizeof(Places[0])); Index++) { + PeerFilename = OsPathPeerFilePath (Places[Index], "GuidedSectionTools.txt"); + //printf("Loading %s...\n", PeerFilename); + if (OsPathExists (PeerFilename)) { + mParsedGuidedSectionTools = ParseGuidedSectionToolsFile (PeerFilename); + } + free (PeerFilename); + if (mParsedGuidedSectionTools != NULL) { + return; + } + } +} + + +void +Usage ( + VOID + ) +/*++ + +Routine Description: + + GC_TODO: Add function description + +Arguments: + + None + +Returns: + + GC_TODO: add return values + +--*/ +{ + // + // Summary usage + // + fprintf (stdout, "Usage: %s [options] \n\n", UTILITY_NAME); + + // + // Copyright declaration + // + fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n"); + + // + // Details Option + // + fprintf (stdout, "Options:\n"); + fprintf (stdout, " -x xref, --xref xref\n\ + Parse basename to file-guid cross reference file(s).\n"); + fprintf (stdout, " --offset offset\n\ + Offset of file to start processing FV at.\n"); + fprintf (stdout, " -h, --help\n\ + Show this help message and exit.\n"); + +} + diff --git a/BaseTools/Source/C/VolInfo/VolInfo.h b/BaseTools/Source/C/VolInfo/VolInfo.h index c2831293ba..0e2d181911 100644 --- a/BaseTools/Source/C/VolInfo/VolInfo.h +++ b/BaseTools/Source/C/VolInfo/VolInfo.h @@ -1,41 +1,41 @@ -/** @file - -Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - VolInfo.c - -Abstract: - - Local Definitions for the VolInfo utility - -**/ - -#ifndef _VOLINFO_H_ -#define _VOLINFO_H_ 1 - -#define PI_SPECIFICATION_VERSION 0x00010000 - -#define EFI_DEP_BEFORE 0x00 -#define EFI_DEP_AFTER 0x01 -#define EFI_DEP_PUSH 0x02 -#define EFI_DEP_AND 0x03 -#define EFI_DEP_OR 0x04 -#define EFI_DEP_NOT 0x05 -#define EFI_DEP_TRUE 0x06 -#define EFI_DEP_FALSE 0x07 -#define EFI_DEP_END 0x08 -#define EFI_DEP_SOR 0x09 - -#define EFI_SECTION_LAST_LEAF_SECTION_TYPE 0x1B -#define EFI_SECTION_LAST_SECTION_TYPE 0x1B - -#endif +/** @file + +Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.
+This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +Module Name: + + VolInfo.c + +Abstract: + + Local Definitions for the VolInfo utility + +**/ + +#ifndef _VOLINFO_H_ +#define _VOLINFO_H_ 1 + +#define PI_SPECIFICATION_VERSION 0x00010000 + +#define EFI_DEP_BEFORE 0x00 +#define EFI_DEP_AFTER 0x01 +#define EFI_DEP_PUSH 0x02 +#define EFI_DEP_AND 0x03 +#define EFI_DEP_OR 0x04 +#define EFI_DEP_NOT 0x05 +#define EFI_DEP_TRUE 0x06 +#define EFI_DEP_FALSE 0x07 +#define EFI_DEP_END 0x08 +#define EFI_DEP_SOR 0x09 + +#define EFI_SECTION_LAST_LEAF_SECTION_TYPE 0x1B +#define EFI_SECTION_LAST_SECTION_TYPE 0x1B + +#endif diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py index 5a7527ef4b..b3083d0395 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -1,627 +1,627 @@ -## @file -# The engine for building files -# -# Copyright (c) 2007, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import re -import copy -import string - -from Common.GlobalData import * -from Common.BuildToolError import * -from Common.Misc import tdict, PathClass -from Common.String import NormPath -from Common.DataType import * - -import Common.EdkLogger as EdkLogger - -## Convert file type to file list macro name -# -# @param FileType The name of file type -# -# @retval string The name of macro -# -def FileListMacro(FileType): - return "%sS" % FileType.replace("-", "_").upper() - -## Convert file type to list file macro name -# -# @param FileType The name of file type -# -# @retval string The name of macro -# -def ListFileMacro(FileType): - return "%s_LIST" % FileListMacro(FileType) - -class TargetDescBlock(object): - _Cache_ = {} # {TargetFile : TargetDescBlock object} - - # Factory method - def __new__(Class, Inputs, Outputs, Commands, Dependencies): - if Outputs[0] in Class._Cache_: - Tdb = Class._Cache_[Outputs[0]] - for File in Inputs: - Tdb.AddInput(File) - else: - Tdb = super(TargetDescBlock, Class).__new__(Class) - Tdb._Init(Inputs, Outputs, Commands, Dependencies) - #Class._Cache_[Outputs[0]] = Tdb - return Tdb - - def _Init(self, Inputs, Outputs, Commands, Dependencies): - self.Inputs = Inputs - self.Outputs = Outputs - self.Commands = Commands - self.Dependencies = Dependencies - if self.Outputs: - self.Target = self.Outputs[0] - else: - self.Target = None - - def __str__(self): - return self.Target.Path - - def __hash__(self): - return hash(self.Target.Path) - - def __eq__(self, Other): - if type(Other) == type(self): - return Other.Target.Path == self.Target.Path - else: - return str(Other) == self.Target.Path - - def AddInput(self, Input): - if Input not in self.Inputs: - self.Inputs.append(Input) - - def IsMultipleInput(self): - return len(self.Inputs) > 1 - - @staticmethod - def Renew(): - TargetDescBlock._Cache_ = {} - -## Class for one build rule -# -# This represents a build rule which can give out corresponding command list for -# building the given source file(s). The result can be used for generating the -# target for makefile. -# -class FileBuildRule: - INC_LIST_MACRO = "INC_LIST" - INC_MACRO = "INC" - - ## constructor - # - # @param Input The dictionary represeting input file(s) for a rule - # @param Output The list represeting output file(s) for a rule - # @param Command The list containing commands to generate the output from input - # - def __init__(self, Type, Input, Output, Command, ExtraDependency=None): - # The Input should not be empty - if not Input: - Input = [] - if not Output: - Output = [] - if not Command: - Command = [] - - self.FileListMacro = FileListMacro(Type) - self.ListFileMacro = ListFileMacro(Type) - self.IncListFileMacro = self.INC_LIST_MACRO - - self.SourceFileType = Type - # source files listed not in "*" or "?" pattern format - if not ExtraDependency: - self.ExtraSourceFileList = [] - else: - self.ExtraSourceFileList = ExtraDependency - - # - # Search macros used in command lines for _LIST and INC_LIST. - # If found, generate a file to keep the input files used to get over the - # limitation of command line length - # - self.MacroList = [] - self.CommandList = [] - for CmdLine in Command: - self.MacroList.extend(gMacroRefPattern.findall(CmdLine)) - # replace path separator with native one - self.CommandList.append(CmdLine) - - # Indicate what should be generated - if self.FileListMacro in self.MacroList: - self.GenFileListMacro = True - else: - self.GenFileListMacro = False - - if self.ListFileMacro in self.MacroList: - self.GenListFile = True - self.GenFileListMacro = True - else: - self.GenListFile = False - - if self.INC_LIST_MACRO in self.MacroList: - self.GenIncListFile = True - else: - self.GenIncListFile = False - - # Check input files - self.IsMultipleInput = False - self.SourceFileExtList = [] - for File in Input: - Base, Ext = os.path.splitext(File) - if Base.find("*") >= 0: - # There's "*" in the file name - self.IsMultipleInput = True - self.GenFileListMacro = True - elif Base.find("?") < 0: - # There's no "*" and "?" in file name - self.ExtraSourceFileList.append(File) - continue - if Ext not in self.SourceFileExtList: - self.SourceFileExtList.append(Ext) - - # Check output files - self.DestFileList = [] - for File in Output: - self.DestFileList.append(File) - - # All build targets generated by this rule for a module - self.BuildTargets = {} - - ## str() function support - # - # @retval string - # - def __str__(self): - SourceString = "" - SourceString += " %s %s %s" % (self.SourceFileType, " ".join(self.SourceFileExtList), self.ExtraSourceFileList) - DestString = ", ".join(self.DestFileList) - CommandString = "\n\t".join(self.CommandList) - return "%s : %s\n\t%s" % (DestString, SourceString, CommandString) - - ## Check if given file extension is supported by this rule - # - # @param FileExt The extension of a file - # - # @retval True If the extension is supported - # @retval False If the extension is not supported - # - def IsSupported(self, FileExt): - return FileExt in self.SourceFileExtList - - def Instantiate(self, Macros={}): - NewRuleObject = copy.copy(self) - NewRuleObject.BuildTargets = {} - NewRuleObject.DestFileList = [] - for File in self.DestFileList: - NewRuleObject.DestFileList.append(PathClass(NormPath(File, Macros))) - return NewRuleObject - - ## Apply the rule to given source file(s) - # - # @param SourceFile One file or a list of files to be built - # @param RelativeToDir The relative path of the source file - # @param PathSeparator Path separator - # - # @retval tuple (Source file in full path, List of individual sourcefiles, Destionation file, List of build commands) - # - def Apply(self, SourceFile): - if not self.CommandList or not self.DestFileList: - return None - - # source file - if self.IsMultipleInput: - SrcFileName = "" - SrcFileBase = "" - SrcFileExt = "" - SrcFileDir = "" - SrcPath = "" - # SourceFile must be a list - SrcFile = "$(%s)" % self.FileListMacro - else: - SrcFileName, SrcFileBase, SrcFileExt = SourceFile.Name, SourceFile.BaseName, SourceFile.Ext - if SourceFile.Root: - SrcFileDir = SourceFile.SubDir - if SrcFileDir == "": - SrcFileDir = "." - else: - SrcFileDir = "." - SrcFile = SourceFile.Path - SrcPath = SourceFile.Dir - - # destination file (the first one) - if self.DestFileList: - DestFile = self.DestFileList[0].Path - DestPath = self.DestFileList[0].Dir - DestFileName = self.DestFileList[0].Name - DestFileBase, DestFileExt = self.DestFileList[0].BaseName, self.DestFileList[0].Ext - else: - DestFile = "" - DestPath = "" - DestFileName = "" - DestFileBase = "" - DestFileExt = "" - - BuildRulePlaceholderDict = { - # source file - "src" : SrcFile, - "s_path" : SrcPath, - "s_dir" : SrcFileDir, - "s_name" : SrcFileName, - "s_base" : SrcFileBase, - "s_ext" : SrcFileExt, - # destination file - "dst" : DestFile, - "d_path" : DestPath, - "d_name" : DestFileName, - "d_base" : DestFileBase, - "d_ext" : DestFileExt, - } - - DstFile = [] - for File in self.DestFileList: - File = string.Template(str(File)).safe_substitute(BuildRulePlaceholderDict) - File = string.Template(str(File)).safe_substitute(BuildRulePlaceholderDict) - DstFile.append(PathClass(File, IsBinary=True)) - - if DstFile[0] in self.BuildTargets: - TargetDesc = self.BuildTargets[DstFile[0]] - TargetDesc.AddInput(SourceFile) - else: - CommandList = [] - for CommandString in self.CommandList: - CommandString = string.Template(CommandString).safe_substitute(BuildRulePlaceholderDict) - CommandString = string.Template(CommandString).safe_substitute(BuildRulePlaceholderDict) - CommandList.append(CommandString) - TargetDesc = TargetDescBlock([SourceFile], DstFile, CommandList, self.ExtraSourceFileList) - TargetDesc.ListFileMacro = self.ListFileMacro - TargetDesc.FileListMacro = self.FileListMacro - TargetDesc.IncListFileMacro = self.IncListFileMacro - TargetDesc.GenFileListMacro = self.GenFileListMacro - TargetDesc.GenListFile = self.GenListFile - TargetDesc.GenIncListFile = self.GenIncListFile - self.BuildTargets[DstFile[0]] = TargetDesc - return TargetDesc - -## Class for build rules -# -# BuildRule class parses rules defined in a file or passed by caller, and converts -# the rule into FileBuildRule object. -# -class BuildRule: - _SectionHeader = "SECTIONHEADER" - _Section = "SECTION" - _SubSectionHeader = "SUBSECTIONHEADER" - _SubSection = "SUBSECTION" - _InputFile = "INPUTFILE" - _OutputFile = "OUTPUTFILE" - _ExtraDependency = "EXTRADEPENDENCY" - _Command = "COMMAND" - _UnknownSection = "UNKNOWNSECTION" - - _SubSectionList = [_InputFile, _OutputFile, _Command] - - _PATH_SEP = "(+)" - _FileTypePattern = re.compile("^[_a-zA-Z][_\-0-9a-zA-Z]*$") - _BinaryFileRule = FileBuildRule(TAB_DEFAULT_BINARY_FILE, [], [os.path.join("$(OUTPUT_DIR)", "${s_name}")], - ["$(CP) ${src} ${dst}"], []) - - ## Constructor - # - # @param File The file containing build rules in a well defined format - # @param Content The string list of build rules in a well defined format - # @param LineIndex The line number from which the parsing will begin - # @param SupportedFamily The list of supported tool chain families - # - def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=["MSFT", "INTEL", "GCC", "RVCT"]): - self.RuleFile = File - # Read build rules from file if it's not none - if File != None: - try: - self.RuleContent = open(File, 'r').readlines() - except: - EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File) - elif Content != None: - self.RuleContent = Content - else: - EdkLogger.error("build", PARAMETER_MISSING, ExtraData="No rule file or string given") - - self.SupportedToolChainFamilyList = SupportedFamily - self.RuleDatabase = tdict(True, 4) # {FileExt, ModuleType, Arch, Family : FileBuildRule object} - self.Ext2FileType = {} # {ext : file-type} - self.FileTypeList = set() - - self._LineIndex = LineIndex - self._State = "" - self._RuleInfo = tdict(True, 2) # {toolchain family : {"InputFile": {}, "OutputFile" : [], "Command" : []}} - self._FileType = '' - self._BuildTypeList = [] - self._ArchList = [] - self._FamilyList = [] - self._TotalToolChainFamilySet = set() - self._RuleObjectList = [] # FileBuildRule object list - self._FileVersion = "" - - self.Parse() - - # some intrinsic rules - self.RuleDatabase[TAB_DEFAULT_BINARY_FILE, "COMMON", "COMMON", "COMMON"] = self._BinaryFileRule - self.FileTypeList.add(TAB_DEFAULT_BINARY_FILE) - - ## Parse the build rule strings - def Parse(self): - self._State = self._Section - for Index in range(self._LineIndex, len(self.RuleContent)): - # Clean up the line and replace path separator with native one - Line = self.RuleContent[Index].strip().replace(self._PATH_SEP, os.path.sep) - self.RuleContent[Index] = Line - - # find the build_rule_version - if Line and Line[0] == "#" and Line.find(TAB_BUILD_RULE_VERSION) <> -1: - if Line.find("=") <> -1 and Line.find("=") < (len(Line)-1) and (Line[(Line.find("=") + 1):]).split(): - self._FileVersion = (Line[(Line.find("=") + 1):]).split()[0] - # skip empty or comment line - if Line == "" or Line[0] == "#": - continue - - # find out section header, enclosed by [] - if Line[0] == '[' and Line[-1] == ']': - # merge last section information into rule database - self.EndOfSection() - self._State = self._SectionHeader - # find out sub-section header, enclosed by <> - elif Line[0] == '<' and Line[-1] == '>': - if self._State != self._UnknownSection: - self._State = self._SubSectionHeader - - # call section handler to parse each (sub)section - self._StateHandler[self._State](self, Index) - # merge last section information into rule database - self.EndOfSection() - - ## Parse definitions under a section - # - # @param LineIndex The line index of build rule text - # - def ParseSection(self, LineIndex): - pass - - ## Parse definitions under a subsection - # - # @param LineIndex The line index of build rule text - # - def ParseSubSection(self, LineIndex): - # currenly nothing here - pass - - ## Placeholder for not supported sections - # - # @param LineIndex The line index of build rule text - # - def SkipSection(self, LineIndex): - pass - - ## Merge section information just got into rule database - def EndOfSection(self): - Database = self.RuleDatabase - # if there's specific toochain family, 'COMMON' doesn't make sense any more - if len(self._TotalToolChainFamilySet) > 1 and 'COMMON' in self._TotalToolChainFamilySet: - self._TotalToolChainFamilySet.remove('COMMON') - for Family in self._TotalToolChainFamilySet: - Input = self._RuleInfo[Family, self._InputFile] - Output = self._RuleInfo[Family, self._OutputFile] - Command = self._RuleInfo[Family, self._Command] - ExtraDependency = self._RuleInfo[Family, self._ExtraDependency] - - BuildRule = FileBuildRule(self._FileType, Input, Output, Command, ExtraDependency) - for BuildType in self._BuildTypeList: - for Arch in self._ArchList: - Database[self._FileType, BuildType, Arch, Family] = BuildRule - for FileExt in BuildRule.SourceFileExtList: - self.Ext2FileType[FileExt] = self._FileType - - ## Parse section header - # - # @param LineIndex The line index of build rule text - # - def ParseSectionHeader(self, LineIndex): - self._RuleInfo = tdict(True, 2) - self._BuildTypeList = [] - self._ArchList = [] - self._FamilyList = [] - self._TotalToolChainFamilySet = set() - FileType = '' - RuleNameList = self.RuleContent[LineIndex][1:-1].split(',') - for RuleName in RuleNameList: - Arch = 'COMMON' - BuildType = 'COMMON' - TokenList = [Token.strip().upper() for Token in RuleName.split('.')] - # old format: Build.File-Type - if TokenList[0] == "BUILD": - if len(TokenList) == 1: - EdkLogger.error("build", FORMAT_INVALID, "Invalid rule section", - File=self.RuleFile, Line=LineIndex+1, - ExtraData=self.RuleContent[LineIndex]) - - FileType = TokenList[1] - if FileType == '': - EdkLogger.error("build", FORMAT_INVALID, "No file type given", - File=self.RuleFile, Line=LineIndex+1, - ExtraData=self.RuleContent[LineIndex]) - if self._FileTypePattern.match(FileType) == None: - EdkLogger.error("build", FORMAT_INVALID, File=self.RuleFile, Line=LineIndex+1, - ExtraData="Only character, number (non-first character), '_' and '-' are allowed in file type") - # new format: File-Type.Build-Type.Arch - else: - if FileType == '': - FileType = TokenList[0] - elif FileType != TokenList[0]: - EdkLogger.error("build", FORMAT_INVALID, - "Different file types are not allowed in the same rule section", - File=self.RuleFile, Line=LineIndex+1, - ExtraData=self.RuleContent[LineIndex]) - if len(TokenList) > 1: - BuildType = TokenList[1] - if len(TokenList) > 2: - Arch = TokenList[2] - if BuildType not in self._BuildTypeList: - self._BuildTypeList.append(BuildType) - if Arch not in self._ArchList: - self._ArchList.append(Arch) - - if 'COMMON' in self._BuildTypeList and len(self._BuildTypeList) > 1: - EdkLogger.error("build", FORMAT_INVALID, - "Specific build types must not be mixed with common one", - File=self.RuleFile, Line=LineIndex+1, - ExtraData=self.RuleContent[LineIndex]) - if 'COMMON' in self._ArchList and len(self._ArchList) > 1: - EdkLogger.error("build", FORMAT_INVALID, - "Specific ARCH must not be mixed with common one", - File=self.RuleFile, Line=LineIndex+1, - ExtraData=self.RuleContent[LineIndex]) - - self._FileType = FileType - self._State = self._Section - self.FileTypeList.add(FileType) - - ## Parse sub-section header - # - # @param LineIndex The line index of build rule text - # - def ParseSubSectionHeader(self, LineIndex): - SectionType = "" - List = self.RuleContent[LineIndex][1:-1].split(',') - FamilyList = [] - for Section in List: - TokenList = Section.split('.') - Type = TokenList[0].strip().upper() - - if SectionType == "": - SectionType = Type - elif SectionType != Type: - EdkLogger.error("build", FORMAT_INVALID, - "Two different section types are not allowed in the same sub-section", - File=self.RuleFile, Line=LineIndex+1, - ExtraData=self.RuleContent[LineIndex]) - - if len(TokenList) > 1: - Family = TokenList[1].strip().upper() - else: - Family = "COMMON" - - if Family not in FamilyList: - FamilyList.append(Family) - - self._FamilyList = FamilyList - self._TotalToolChainFamilySet.update(FamilyList) - self._State = SectionType.upper() - if 'COMMON' in FamilyList and len(FamilyList) > 1: - EdkLogger.error("build", FORMAT_INVALID, - "Specific tool chain family should not be mixed with general one", - File=self.RuleFile, Line=LineIndex+1, - ExtraData=self.RuleContent[LineIndex]) - if self._State not in self._StateHandler: - EdkLogger.error("build", FORMAT_INVALID, File=self.RuleFile, Line=LineIndex+1, - ExtraData="Unknown subsection: %s" % self.RuleContent[LineIndex]) - ## Parse sub-section - # - # @param LineIndex The line index of build rule text - # - def ParseInputFile(self, LineIndex): - FileList = [File.strip() for File in self.RuleContent[LineIndex].split(",")] - for ToolChainFamily in self._FamilyList: - InputFiles = self._RuleInfo[ToolChainFamily, self._State] - if InputFiles == None: - InputFiles = [] - self._RuleInfo[ToolChainFamily, self._State] = InputFiles - InputFiles.extend(FileList) - - ## Parse sub-section - # - # @param LineIndex The line index of build rule text - # - def ParseCommon(self, LineIndex): - for ToolChainFamily in self._FamilyList: - Items = self._RuleInfo[ToolChainFamily, self._State] - if Items == None: - Items = [] - self._RuleInfo[ToolChainFamily, self._State] = Items - Items.append(self.RuleContent[LineIndex]) - - ## Get a build rule via [] operator - # - # @param FileExt The extension of a file - # @param ToolChainFamily The tool chain family name - # @param BuildVersion The build version number. "*" means any rule - # is applicalbe. - # - # @retval FileType The file type string - # @retval FileBuildRule The object of FileBuildRule - # - # Key = (FileExt, ModuleType, Arch, ToolChainFamily) - def __getitem__(self, Key): - if not Key: - return None - - if Key[0] in self.Ext2FileType: - Type = self.Ext2FileType[Key[0]] - elif Key[0].upper() in self.FileTypeList: - Type = Key[0].upper() - else: - return None - - if len(Key) > 1: - Key = (Type,) + Key[1:] - else: - Key = (Type,) - return self.RuleDatabase[Key] - - _StateHandler = { - _SectionHeader : ParseSectionHeader, - _Section : ParseSection, - _SubSectionHeader : ParseSubSectionHeader, - _SubSection : ParseSubSection, - _InputFile : ParseInputFile, - _OutputFile : ParseCommon, - _ExtraDependency : ParseCommon, - _Command : ParseCommon, - _UnknownSection : SkipSection, - } - -# This acts like the main() function for the script, unless it is 'import'ed into another -# script. -if __name__ == '__main__': - import sys - EdkLogger.Initialize() - if len(sys.argv) > 1: - Br = BuildRule(sys.argv[1]) - print str(Br[".c", "DXE_DRIVER", "IA32", "MSFT"][1]) - print - print str(Br[".c", "DXE_DRIVER", "IA32", "INTEL"][1]) - print - print str(Br[".c", "DXE_DRIVER", "IA32", "GCC"][1]) - print - print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) - print - print str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1]) - print - print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) - print - print str(Br[".s", "SEC", "IPF", "COMMON"][1]) - print - print str(Br[".s", "SEC"][1]) - +## @file +# The engine for building files +# +# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import re +import copy +import string + +from Common.GlobalData import * +from Common.BuildToolError import * +from Common.Misc import tdict, PathClass +from Common.String import NormPath +from Common.DataType import * + +import Common.EdkLogger as EdkLogger + +## Convert file type to file list macro name +# +# @param FileType The name of file type +# +# @retval string The name of macro +# +def FileListMacro(FileType): + return "%sS" % FileType.replace("-", "_").upper() + +## Convert file type to list file macro name +# +# @param FileType The name of file type +# +# @retval string The name of macro +# +def ListFileMacro(FileType): + return "%s_LIST" % FileListMacro(FileType) + +class TargetDescBlock(object): + _Cache_ = {} # {TargetFile : TargetDescBlock object} + + # Factory method + def __new__(Class, Inputs, Outputs, Commands, Dependencies): + if Outputs[0] in Class._Cache_: + Tdb = Class._Cache_[Outputs[0]] + for File in Inputs: + Tdb.AddInput(File) + else: + Tdb = super(TargetDescBlock, Class).__new__(Class) + Tdb._Init(Inputs, Outputs, Commands, Dependencies) + #Class._Cache_[Outputs[0]] = Tdb + return Tdb + + def _Init(self, Inputs, Outputs, Commands, Dependencies): + self.Inputs = Inputs + self.Outputs = Outputs + self.Commands = Commands + self.Dependencies = Dependencies + if self.Outputs: + self.Target = self.Outputs[0] + else: + self.Target = None + + def __str__(self): + return self.Target.Path + + def __hash__(self): + return hash(self.Target.Path) + + def __eq__(self, Other): + if type(Other) == type(self): + return Other.Target.Path == self.Target.Path + else: + return str(Other) == self.Target.Path + + def AddInput(self, Input): + if Input not in self.Inputs: + self.Inputs.append(Input) + + def IsMultipleInput(self): + return len(self.Inputs) > 1 + + @staticmethod + def Renew(): + TargetDescBlock._Cache_ = {} + +## Class for one build rule +# +# This represents a build rule which can give out corresponding command list for +# building the given source file(s). The result can be used for generating the +# target for makefile. +# +class FileBuildRule: + INC_LIST_MACRO = "INC_LIST" + INC_MACRO = "INC" + + ## constructor + # + # @param Input The dictionary represeting input file(s) for a rule + # @param Output The list represeting output file(s) for a rule + # @param Command The list containing commands to generate the output from input + # + def __init__(self, Type, Input, Output, Command, ExtraDependency=None): + # The Input should not be empty + if not Input: + Input = [] + if not Output: + Output = [] + if not Command: + Command = [] + + self.FileListMacro = FileListMacro(Type) + self.ListFileMacro = ListFileMacro(Type) + self.IncListFileMacro = self.INC_LIST_MACRO + + self.SourceFileType = Type + # source files listed not in "*" or "?" pattern format + if not ExtraDependency: + self.ExtraSourceFileList = [] + else: + self.ExtraSourceFileList = ExtraDependency + + # + # Search macros used in command lines for _LIST and INC_LIST. + # If found, generate a file to keep the input files used to get over the + # limitation of command line length + # + self.MacroList = [] + self.CommandList = [] + for CmdLine in Command: + self.MacroList.extend(gMacroRefPattern.findall(CmdLine)) + # replace path separator with native one + self.CommandList.append(CmdLine) + + # Indicate what should be generated + if self.FileListMacro in self.MacroList: + self.GenFileListMacro = True + else: + self.GenFileListMacro = False + + if self.ListFileMacro in self.MacroList: + self.GenListFile = True + self.GenFileListMacro = True + else: + self.GenListFile = False + + if self.INC_LIST_MACRO in self.MacroList: + self.GenIncListFile = True + else: + self.GenIncListFile = False + + # Check input files + self.IsMultipleInput = False + self.SourceFileExtList = [] + for File in Input: + Base, Ext = os.path.splitext(File) + if Base.find("*") >= 0: + # There's "*" in the file name + self.IsMultipleInput = True + self.GenFileListMacro = True + elif Base.find("?") < 0: + # There's no "*" and "?" in file name + self.ExtraSourceFileList.append(File) + continue + if Ext not in self.SourceFileExtList: + self.SourceFileExtList.append(Ext) + + # Check output files + self.DestFileList = [] + for File in Output: + self.DestFileList.append(File) + + # All build targets generated by this rule for a module + self.BuildTargets = {} + + ## str() function support + # + # @retval string + # + def __str__(self): + SourceString = "" + SourceString += " %s %s %s" % (self.SourceFileType, " ".join(self.SourceFileExtList), self.ExtraSourceFileList) + DestString = ", ".join(self.DestFileList) + CommandString = "\n\t".join(self.CommandList) + return "%s : %s\n\t%s" % (DestString, SourceString, CommandString) + + ## Check if given file extension is supported by this rule + # + # @param FileExt The extension of a file + # + # @retval True If the extension is supported + # @retval False If the extension is not supported + # + def IsSupported(self, FileExt): + return FileExt in self.SourceFileExtList + + def Instantiate(self, Macros={}): + NewRuleObject = copy.copy(self) + NewRuleObject.BuildTargets = {} + NewRuleObject.DestFileList = [] + for File in self.DestFileList: + NewRuleObject.DestFileList.append(PathClass(NormPath(File, Macros))) + return NewRuleObject + + ## Apply the rule to given source file(s) + # + # @param SourceFile One file or a list of files to be built + # @param RelativeToDir The relative path of the source file + # @param PathSeparator Path separator + # + # @retval tuple (Source file in full path, List of individual sourcefiles, Destionation file, List of build commands) + # + def Apply(self, SourceFile): + if not self.CommandList or not self.DestFileList: + return None + + # source file + if self.IsMultipleInput: + SrcFileName = "" + SrcFileBase = "" + SrcFileExt = "" + SrcFileDir = "" + SrcPath = "" + # SourceFile must be a list + SrcFile = "$(%s)" % self.FileListMacro + else: + SrcFileName, SrcFileBase, SrcFileExt = SourceFile.Name, SourceFile.BaseName, SourceFile.Ext + if SourceFile.Root: + SrcFileDir = SourceFile.SubDir + if SrcFileDir == "": + SrcFileDir = "." + else: + SrcFileDir = "." + SrcFile = SourceFile.Path + SrcPath = SourceFile.Dir + + # destination file (the first one) + if self.DestFileList: + DestFile = self.DestFileList[0].Path + DestPath = self.DestFileList[0].Dir + DestFileName = self.DestFileList[0].Name + DestFileBase, DestFileExt = self.DestFileList[0].BaseName, self.DestFileList[0].Ext + else: + DestFile = "" + DestPath = "" + DestFileName = "" + DestFileBase = "" + DestFileExt = "" + + BuildRulePlaceholderDict = { + # source file + "src" : SrcFile, + "s_path" : SrcPath, + "s_dir" : SrcFileDir, + "s_name" : SrcFileName, + "s_base" : SrcFileBase, + "s_ext" : SrcFileExt, + # destination file + "dst" : DestFile, + "d_path" : DestPath, + "d_name" : DestFileName, + "d_base" : DestFileBase, + "d_ext" : DestFileExt, + } + + DstFile = [] + for File in self.DestFileList: + File = string.Template(str(File)).safe_substitute(BuildRulePlaceholderDict) + File = string.Template(str(File)).safe_substitute(BuildRulePlaceholderDict) + DstFile.append(PathClass(File, IsBinary=True)) + + if DstFile[0] in self.BuildTargets: + TargetDesc = self.BuildTargets[DstFile[0]] + TargetDesc.AddInput(SourceFile) + else: + CommandList = [] + for CommandString in self.CommandList: + CommandString = string.Template(CommandString).safe_substitute(BuildRulePlaceholderDict) + CommandString = string.Template(CommandString).safe_substitute(BuildRulePlaceholderDict) + CommandList.append(CommandString) + TargetDesc = TargetDescBlock([SourceFile], DstFile, CommandList, self.ExtraSourceFileList) + TargetDesc.ListFileMacro = self.ListFileMacro + TargetDesc.FileListMacro = self.FileListMacro + TargetDesc.IncListFileMacro = self.IncListFileMacro + TargetDesc.GenFileListMacro = self.GenFileListMacro + TargetDesc.GenListFile = self.GenListFile + TargetDesc.GenIncListFile = self.GenIncListFile + self.BuildTargets[DstFile[0]] = TargetDesc + return TargetDesc + +## Class for build rules +# +# BuildRule class parses rules defined in a file or passed by caller, and converts +# the rule into FileBuildRule object. +# +class BuildRule: + _SectionHeader = "SECTIONHEADER" + _Section = "SECTION" + _SubSectionHeader = "SUBSECTIONHEADER" + _SubSection = "SUBSECTION" + _InputFile = "INPUTFILE" + _OutputFile = "OUTPUTFILE" + _ExtraDependency = "EXTRADEPENDENCY" + _Command = "COMMAND" + _UnknownSection = "UNKNOWNSECTION" + + _SubSectionList = [_InputFile, _OutputFile, _Command] + + _PATH_SEP = "(+)" + _FileTypePattern = re.compile("^[_a-zA-Z][_\-0-9a-zA-Z]*$") + _BinaryFileRule = FileBuildRule(TAB_DEFAULT_BINARY_FILE, [], [os.path.join("$(OUTPUT_DIR)", "${s_name}")], + ["$(CP) ${src} ${dst}"], []) + + ## Constructor + # + # @param File The file containing build rules in a well defined format + # @param Content The string list of build rules in a well defined format + # @param LineIndex The line number from which the parsing will begin + # @param SupportedFamily The list of supported tool chain families + # + def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=["MSFT", "INTEL", "GCC", "RVCT"]): + self.RuleFile = File + # Read build rules from file if it's not none + if File != None: + try: + self.RuleContent = open(File, 'r').readlines() + except: + EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File) + elif Content != None: + self.RuleContent = Content + else: + EdkLogger.error("build", PARAMETER_MISSING, ExtraData="No rule file or string given") + + self.SupportedToolChainFamilyList = SupportedFamily + self.RuleDatabase = tdict(True, 4) # {FileExt, ModuleType, Arch, Family : FileBuildRule object} + self.Ext2FileType = {} # {ext : file-type} + self.FileTypeList = set() + + self._LineIndex = LineIndex + self._State = "" + self._RuleInfo = tdict(True, 2) # {toolchain family : {"InputFile": {}, "OutputFile" : [], "Command" : []}} + self._FileType = '' + self._BuildTypeList = [] + self._ArchList = [] + self._FamilyList = [] + self._TotalToolChainFamilySet = set() + self._RuleObjectList = [] # FileBuildRule object list + self._FileVersion = "" + + self.Parse() + + # some intrinsic rules + self.RuleDatabase[TAB_DEFAULT_BINARY_FILE, "COMMON", "COMMON", "COMMON"] = self._BinaryFileRule + self.FileTypeList.add(TAB_DEFAULT_BINARY_FILE) + + ## Parse the build rule strings + def Parse(self): + self._State = self._Section + for Index in range(self._LineIndex, len(self.RuleContent)): + # Clean up the line and replace path separator with native one + Line = self.RuleContent[Index].strip().replace(self._PATH_SEP, os.path.sep) + self.RuleContent[Index] = Line + + # find the build_rule_version + if Line and Line[0] == "#" and Line.find(TAB_BUILD_RULE_VERSION) <> -1: + if Line.find("=") <> -1 and Line.find("=") < (len(Line)-1) and (Line[(Line.find("=") + 1):]).split(): + self._FileVersion = (Line[(Line.find("=") + 1):]).split()[0] + # skip empty or comment line + if Line == "" or Line[0] == "#": + continue + + # find out section header, enclosed by [] + if Line[0] == '[' and Line[-1] == ']': + # merge last section information into rule database + self.EndOfSection() + self._State = self._SectionHeader + # find out sub-section header, enclosed by <> + elif Line[0] == '<' and Line[-1] == '>': + if self._State != self._UnknownSection: + self._State = self._SubSectionHeader + + # call section handler to parse each (sub)section + self._StateHandler[self._State](self, Index) + # merge last section information into rule database + self.EndOfSection() + + ## Parse definitions under a section + # + # @param LineIndex The line index of build rule text + # + def ParseSection(self, LineIndex): + pass + + ## Parse definitions under a subsection + # + # @param LineIndex The line index of build rule text + # + def ParseSubSection(self, LineIndex): + # currenly nothing here + pass + + ## Placeholder for not supported sections + # + # @param LineIndex The line index of build rule text + # + def SkipSection(self, LineIndex): + pass + + ## Merge section information just got into rule database + def EndOfSection(self): + Database = self.RuleDatabase + # if there's specific toochain family, 'COMMON' doesn't make sense any more + if len(self._TotalToolChainFamilySet) > 1 and 'COMMON' in self._TotalToolChainFamilySet: + self._TotalToolChainFamilySet.remove('COMMON') + for Family in self._TotalToolChainFamilySet: + Input = self._RuleInfo[Family, self._InputFile] + Output = self._RuleInfo[Family, self._OutputFile] + Command = self._RuleInfo[Family, self._Command] + ExtraDependency = self._RuleInfo[Family, self._ExtraDependency] + + BuildRule = FileBuildRule(self._FileType, Input, Output, Command, ExtraDependency) + for BuildType in self._BuildTypeList: + for Arch in self._ArchList: + Database[self._FileType, BuildType, Arch, Family] = BuildRule + for FileExt in BuildRule.SourceFileExtList: + self.Ext2FileType[FileExt] = self._FileType + + ## Parse section header + # + # @param LineIndex The line index of build rule text + # + def ParseSectionHeader(self, LineIndex): + self._RuleInfo = tdict(True, 2) + self._BuildTypeList = [] + self._ArchList = [] + self._FamilyList = [] + self._TotalToolChainFamilySet = set() + FileType = '' + RuleNameList = self.RuleContent[LineIndex][1:-1].split(',') + for RuleName in RuleNameList: + Arch = 'COMMON' + BuildType = 'COMMON' + TokenList = [Token.strip().upper() for Token in RuleName.split('.')] + # old format: Build.File-Type + if TokenList[0] == "BUILD": + if len(TokenList) == 1: + EdkLogger.error("build", FORMAT_INVALID, "Invalid rule section", + File=self.RuleFile, Line=LineIndex+1, + ExtraData=self.RuleContent[LineIndex]) + + FileType = TokenList[1] + if FileType == '': + EdkLogger.error("build", FORMAT_INVALID, "No file type given", + File=self.RuleFile, Line=LineIndex+1, + ExtraData=self.RuleContent[LineIndex]) + if self._FileTypePattern.match(FileType) == None: + EdkLogger.error("build", FORMAT_INVALID, File=self.RuleFile, Line=LineIndex+1, + ExtraData="Only character, number (non-first character), '_' and '-' are allowed in file type") + # new format: File-Type.Build-Type.Arch + else: + if FileType == '': + FileType = TokenList[0] + elif FileType != TokenList[0]: + EdkLogger.error("build", FORMAT_INVALID, + "Different file types are not allowed in the same rule section", + File=self.RuleFile, Line=LineIndex+1, + ExtraData=self.RuleContent[LineIndex]) + if len(TokenList) > 1: + BuildType = TokenList[1] + if len(TokenList) > 2: + Arch = TokenList[2] + if BuildType not in self._BuildTypeList: + self._BuildTypeList.append(BuildType) + if Arch not in self._ArchList: + self._ArchList.append(Arch) + + if 'COMMON' in self._BuildTypeList and len(self._BuildTypeList) > 1: + EdkLogger.error("build", FORMAT_INVALID, + "Specific build types must not be mixed with common one", + File=self.RuleFile, Line=LineIndex+1, + ExtraData=self.RuleContent[LineIndex]) + if 'COMMON' in self._ArchList and len(self._ArchList) > 1: + EdkLogger.error("build", FORMAT_INVALID, + "Specific ARCH must not be mixed with common one", + File=self.RuleFile, Line=LineIndex+1, + ExtraData=self.RuleContent[LineIndex]) + + self._FileType = FileType + self._State = self._Section + self.FileTypeList.add(FileType) + + ## Parse sub-section header + # + # @param LineIndex The line index of build rule text + # + def ParseSubSectionHeader(self, LineIndex): + SectionType = "" + List = self.RuleContent[LineIndex][1:-1].split(',') + FamilyList = [] + for Section in List: + TokenList = Section.split('.') + Type = TokenList[0].strip().upper() + + if SectionType == "": + SectionType = Type + elif SectionType != Type: + EdkLogger.error("build", FORMAT_INVALID, + "Two different section types are not allowed in the same sub-section", + File=self.RuleFile, Line=LineIndex+1, + ExtraData=self.RuleContent[LineIndex]) + + if len(TokenList) > 1: + Family = TokenList[1].strip().upper() + else: + Family = "COMMON" + + if Family not in FamilyList: + FamilyList.append(Family) + + self._FamilyList = FamilyList + self._TotalToolChainFamilySet.update(FamilyList) + self._State = SectionType.upper() + if 'COMMON' in FamilyList and len(FamilyList) > 1: + EdkLogger.error("build", FORMAT_INVALID, + "Specific tool chain family should not be mixed with general one", + File=self.RuleFile, Line=LineIndex+1, + ExtraData=self.RuleContent[LineIndex]) + if self._State not in self._StateHandler: + EdkLogger.error("build", FORMAT_INVALID, File=self.RuleFile, Line=LineIndex+1, + ExtraData="Unknown subsection: %s" % self.RuleContent[LineIndex]) + ## Parse sub-section + # + # @param LineIndex The line index of build rule text + # + def ParseInputFile(self, LineIndex): + FileList = [File.strip() for File in self.RuleContent[LineIndex].split(",")] + for ToolChainFamily in self._FamilyList: + InputFiles = self._RuleInfo[ToolChainFamily, self._State] + if InputFiles == None: + InputFiles = [] + self._RuleInfo[ToolChainFamily, self._State] = InputFiles + InputFiles.extend(FileList) + + ## Parse sub-section + # + # @param LineIndex The line index of build rule text + # + def ParseCommon(self, LineIndex): + for ToolChainFamily in self._FamilyList: + Items = self._RuleInfo[ToolChainFamily, self._State] + if Items == None: + Items = [] + self._RuleInfo[ToolChainFamily, self._State] = Items + Items.append(self.RuleContent[LineIndex]) + + ## Get a build rule via [] operator + # + # @param FileExt The extension of a file + # @param ToolChainFamily The tool chain family name + # @param BuildVersion The build version number. "*" means any rule + # is applicalbe. + # + # @retval FileType The file type string + # @retval FileBuildRule The object of FileBuildRule + # + # Key = (FileExt, ModuleType, Arch, ToolChainFamily) + def __getitem__(self, Key): + if not Key: + return None + + if Key[0] in self.Ext2FileType: + Type = self.Ext2FileType[Key[0]] + elif Key[0].upper() in self.FileTypeList: + Type = Key[0].upper() + else: + return None + + if len(Key) > 1: + Key = (Type,) + Key[1:] + else: + Key = (Type,) + return self.RuleDatabase[Key] + + _StateHandler = { + _SectionHeader : ParseSectionHeader, + _Section : ParseSection, + _SubSectionHeader : ParseSubSectionHeader, + _SubSection : ParseSubSection, + _InputFile : ParseInputFile, + _OutputFile : ParseCommon, + _ExtraDependency : ParseCommon, + _Command : ParseCommon, + _UnknownSection : SkipSection, + } + +# This acts like the main() function for the script, unless it is 'import'ed into another +# script. +if __name__ == '__main__': + import sys + EdkLogger.Initialize() + if len(sys.argv) > 1: + Br = BuildRule(sys.argv[1]) + print str(Br[".c", "DXE_DRIVER", "IA32", "MSFT"][1]) + print + print str(Br[".c", "DXE_DRIVER", "IA32", "INTEL"][1]) + print + print str(Br[".c", "DXE_DRIVER", "IA32", "GCC"][1]) + print + print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) + print + print str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1]) + print + print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) + print + print str(Br[".s", "SEC", "IPF", "COMMON"][1]) + print + print str(Br[".s", "SEC"][1]) + diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index 621b57282d..2646b29697 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1,1573 +1,1573 @@ -## @file -# Routines for generating AutoGen.h and AutoGen.c -# -# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## Import Modules -# -import string - -from Common import EdkLogger - -from Common.BuildToolError import * -from Common.DataType import * -from Common.Misc import * -from Common.String import StringToArray -from StrGather import * -from GenPcdDb import CreatePcdDatabaseCode - -## PCD type string -gItemTypeStringDatabase = { - TAB_PCDS_FEATURE_FLAG : 'FixedAtBuild', - TAB_PCDS_FIXED_AT_BUILD : 'FixedAtBuild', - TAB_PCDS_PATCHABLE_IN_MODULE: 'BinaryPatch', - TAB_PCDS_DYNAMIC : '', - TAB_PCDS_DYNAMIC_DEFAULT : '', - TAB_PCDS_DYNAMIC_VPD : '', - TAB_PCDS_DYNAMIC_HII : '', - TAB_PCDS_DYNAMIC_EX : '', - TAB_PCDS_DYNAMIC_EX_DEFAULT : '', - TAB_PCDS_DYNAMIC_EX_VPD : '', - TAB_PCDS_DYNAMIC_EX_HII : '', -} - -## Dynamic PCD types -gDynamicPcd = [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII] - -## Dynamic-ex PCD types -gDynamicExPcd = [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII] - -## Datum size -gDatumSizeStringDatabase = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'BOOLEAN','VOID*':'8'} -gDatumSizeStringDatabaseH = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'BOOL','VOID*':'PTR'} -gDatumSizeStringDatabaseLib = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'Bool','VOID*':'Ptr'} - -## AutoGen File Header Templates -gAutoGenHeaderString = TemplateString("""\ -/** - DO NOT EDIT - FILE auto-generated - Module name: - ${FileName} - Abstract: Auto-generated ${FileName} for building module or library. -**/ -""") - -gAutoGenHPrologueString = TemplateString(""" -#ifndef _${File}_${Guid} -#define _${File}_${Guid} - -""") - -gAutoGenHCppPrologueString = """\ -#ifdef __cplusplus -extern "C" { -#endif - -""" - -gAutoGenHEpilogueString = """ - -#ifdef __cplusplus -} -#endif - -#endif -""" - -## PEI Core Entry Point Templates -gPeiCoreEntryPointPrototype = TemplateString(""" -${BEGIN} -VOID -EFIAPI -${Function} ( - IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, - IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList, - IN VOID *Context - ); -${END} -""") - -gPeiCoreEntryPointString = TemplateString(""" -${BEGIN} -VOID -EFIAPI -ProcessModuleEntryPointList ( - IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, - IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList, - IN VOID *Context - ) - -{ - ${Function} (SecCoreData, PpiList, Context); -} -${END} -""") - - -## DXE Core Entry Point Templates -gDxeCoreEntryPointPrototype = TemplateString(""" -${BEGIN} -VOID -EFIAPI -${Function} ( - IN VOID *HobStart - ); -${END} -""") - -gDxeCoreEntryPointString = TemplateString(""" -${BEGIN} -VOID -EFIAPI -ProcessModuleEntryPointList ( - IN VOID *HobStart - ) - -{ - ${Function} (HobStart); -} -${END} -""") - -## PEIM Entry Point Templates -gPeimEntryPointPrototype = TemplateString(""" -${BEGIN} -EFI_STATUS -EFIAPI -${Function} ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ); -${END} -""") - -gPeimEntryPointString = [ -TemplateString(""" -GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion}; - -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) - -{ - return EFI_SUCCESS; -} -"""), -TemplateString(""" -GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion}; -${BEGIN} -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) - -{ - return ${Function} (FileHandle, PeiServices); -} -${END} -"""), -TemplateString(""" -GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion}; - -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) - -{ - EFI_STATUS Status; - EFI_STATUS CombinedStatus; - - CombinedStatus = EFI_LOAD_ERROR; -${BEGIN} - Status = ${Function} (FileHandle, PeiServices); - if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) { - CombinedStatus = Status; - } -${END} - return CombinedStatus; -} -""") -] - -## SMM_CORE Entry Point Templates -gSmmCoreEntryPointPrototype = TemplateString(""" -${BEGIN} -EFI_STATUS -EFIAPI -${Function} ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); -${END} -""") - -gSmmCoreEntryPointString = TemplateString(""" -${BEGIN} -const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; -const UINT32 _gDxeRevision = ${PiSpecVersion}; - -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - return ${Function} (ImageHandle, SystemTable); -} -${END} -""") - -## DXE SMM Entry Point Templates -gDxeSmmEntryPointPrototype = TemplateString(""" -${BEGIN} -EFI_STATUS -EFIAPI -${Function} ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); -${END} -""") - -gDxeSmmEntryPointString = [ -TemplateString(""" -const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; -const UINT32 _gDxeRevision = ${PiSpecVersion}; - -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) - -{ - return EFI_SUCCESS; -} -"""), -TemplateString(""" -const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; -const UINT32 _gDxeRevision = ${PiSpecVersion}; - -static BASE_LIBRARY_JUMP_BUFFER mJumpContext; -static EFI_STATUS mDriverEntryPointStatus; - -VOID -EFIAPI -ExitDriver ( - IN EFI_STATUS Status - ) -{ - if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) { - mDriverEntryPointStatus = Status; - } - LongJump (&mJumpContext, (UINTN)-1); - ASSERT (FALSE); -} - -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - mDriverEntryPointStatus = EFI_LOAD_ERROR; - -${BEGIN} - if (SetJump (&mJumpContext) == 0) { - ExitDriver (${Function} (ImageHandle, SystemTable)); - ASSERT (FALSE); - } -${END} - - return mDriverEntryPointStatus; -} -""") -] - -## UEFI Driver Entry Point Templates -gUefiDriverEntryPointPrototype = TemplateString(""" -${BEGIN} -EFI_STATUS -EFIAPI -${Function} ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); -${END} -""") - -gUefiDriverEntryPointString = [ -TemplateString(""" -const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; -const UINT32 _gDxeRevision = ${PiSpecVersion}; - -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - return EFI_SUCCESS; -} -"""), -TemplateString(""" -const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; -const UINT32 _gDxeRevision = ${PiSpecVersion}; - -${BEGIN} -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) - -{ - return ${Function} (ImageHandle, SystemTable); -} -${END} -VOID -EFIAPI -ExitDriver ( - IN EFI_STATUS Status - ) -{ - if (EFI_ERROR (Status)) { - ProcessLibraryDestructorList (gImageHandle, gST); - } - gBS->Exit (gImageHandle, Status, 0, NULL); -} -"""), -TemplateString(""" -const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; -const UINT32 _gDxeRevision = ${PiSpecVersion}; - -static BASE_LIBRARY_JUMP_BUFFER mJumpContext; -static EFI_STATUS mDriverEntryPointStatus; - -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - mDriverEntryPointStatus = EFI_LOAD_ERROR; - ${BEGIN} - if (SetJump (&mJumpContext) == 0) { - ExitDriver (${Function} (ImageHandle, SystemTable)); - ASSERT (FALSE); - } - ${END} - return mDriverEntryPointStatus; -} - -VOID -EFIAPI -ExitDriver ( - IN EFI_STATUS Status - ) -{ - if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) { - mDriverEntryPointStatus = Status; - } - LongJump (&mJumpContext, (UINTN)-1); - ASSERT (FALSE); -} -""") -] - - -## UEFI Application Entry Point Templates -gUefiApplicationEntryPointPrototype = TemplateString(""" -${BEGIN} -EFI_STATUS -EFIAPI -${Function} ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); -${END} -""") - -gUefiApplicationEntryPointString = [ -TemplateString(""" -const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; - -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - return EFI_SUCCESS; -} -"""), -TemplateString(""" -const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; - -${BEGIN} -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) - -{ - return ${Function} (ImageHandle, SystemTable); -} -${END} -VOID -EFIAPI -ExitDriver ( - IN EFI_STATUS Status - ) -{ - if (EFI_ERROR (Status)) { - ProcessLibraryDestructorList (gImageHandle, gST); - } - gBS->Exit (gImageHandle, Status, 0, NULL); -} -"""), -TemplateString(""" -const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; - -EFI_STATUS -EFIAPI -ProcessModuleEntryPointList ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) - -{ - ${BEGIN} - if (SetJump (&mJumpContext) == 0) { - ExitDriver (${Function} (ImageHandle, SystemTable)); - ASSERT (FALSE); - } - ${END} - return mDriverEntryPointStatus; -} - -static BASE_LIBRARY_JUMP_BUFFER mJumpContext; -static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR; - -VOID -EFIAPI -ExitDriver ( - IN EFI_STATUS Status - ) -{ - if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) { - mDriverEntryPointStatus = Status; - } - LongJump (&mJumpContext, (UINTN)-1); - ASSERT (FALSE); -} -""") -] - -## UEFI Unload Image Templates -gUefiUnloadImagePrototype = TemplateString(""" -${BEGIN} -EFI_STATUS -EFIAPI -${Function} ( - IN EFI_HANDLE ImageHandle - ); -${END} -""") - -gUefiUnloadImageString = [ -TemplateString(""" -GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ${Count}; - -EFI_STATUS -EFIAPI -ProcessModuleUnloadList ( - IN EFI_HANDLE ImageHandle - ) -{ - return EFI_SUCCESS; -} -"""), -TemplateString(""" -GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ${Count}; - -${BEGIN} -EFI_STATUS -EFIAPI -ProcessModuleUnloadList ( - IN EFI_HANDLE ImageHandle - ) -{ - return ${Function} (ImageHandle); -} -${END} -"""), -TemplateString(""" -GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ${Count}; - -EFI_STATUS -EFIAPI -ProcessModuleUnloadList ( - IN EFI_HANDLE ImageHandle - ) -{ - EFI_STATUS Status; - - Status = EFI_SUCCESS; -${BEGIN} - if (EFI_ERROR (Status)) { - ${Function} (ImageHandle); - } else { - Status = ${Function} (ImageHandle); - } -${END} - return Status; -} -""") -] - -gLibraryStructorPrototype = { -'BASE' : TemplateString("""${BEGIN} -RETURN_STATUS -EFIAPI -${Function} ( - VOID - );${END} -"""), - -'PEI' : TemplateString("""${BEGIN} -EFI_STATUS -EFIAPI -${Function} ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - );${END} -"""), - -'DXE' : TemplateString("""${BEGIN} -EFI_STATUS -EFIAPI -${Function} ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - );${END} -"""), -} - -gLibraryStructorCall = { -'BASE' : TemplateString("""${BEGIN} - Status = ${Function} (); - ASSERT_EFI_ERROR (Status);${END} -"""), - -'PEI' : TemplateString("""${BEGIN} - Status = ${Function} (FileHandle, PeiServices); - ASSERT_EFI_ERROR (Status);${END} -"""), - -'DXE' : TemplateString("""${BEGIN} - Status = ${Function} (ImageHandle, SystemTable); - ASSERT_EFI_ERROR (Status);${END} -"""), -} - -## Library Constructor and Destructor Templates -gLibraryString = { -'BASE' : TemplateString(""" -${BEGIN}${FunctionPrototype}${END} - -VOID -EFIAPI -ProcessLibrary${Type}List ( - VOID - ) -{ -${BEGIN} EFI_STATUS Status; -${FunctionCall}${END} -} -"""), - -'PEI' : TemplateString(""" -${BEGIN}${FunctionPrototype}${END} - -VOID -EFIAPI -ProcessLibrary${Type}List ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) -{ -${BEGIN} EFI_STATUS Status; -${FunctionCall}${END} -} -"""), - -'DXE' : TemplateString(""" -${BEGIN}${FunctionPrototype}${END} - -VOID -EFIAPI -ProcessLibrary${Type}List ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ -${BEGIN} EFI_STATUS Status; -${FunctionCall}${END} -} -"""), -} - -gBasicHeaderFile = "Base.h" - -gModuleTypeHeaderFile = { - "BASE" : [gBasicHeaderFile], - "SEC" : ["PiPei.h", "Library/DebugLib.h"], - "PEI_CORE" : ["PiPei.h", "Library/DebugLib.h", "Library/PeiCoreEntryPoint.h"], - "PEIM" : ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"], - "DXE_CORE" : ["PiDxe.h", "Library/DebugLib.h", "Library/DxeCoreEntryPoint.h"], - "DXE_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], - "DXE_SMM_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], - "DXE_RUNTIME_DRIVER": ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], - "DXE_SAL_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], - "UEFI_DRIVER" : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], - "UEFI_APPLICATION" : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"], - "SMM_CORE" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"], - "USER_DEFINED" : [gBasicHeaderFile] -} - -## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName -# the TokenName and Guid comparison to avoid define name collisions. -# -# @param Info The ModuleAutoGen object -# @param AutoGenH The TemplateString object for header file -# -# -def DynExPcdTokenNumberMapping(Info, AutoGenH): - ExTokenCNameList = [] - PcdExList = [] - if Info.IsLibrary: - PcdList = Info.LibraryPcdList - else: - PcdList = Info.ModulePcdList - for Pcd in PcdList: - if Pcd.Type in gDynamicExPcd: - ExTokenCNameList.append(Pcd.TokenCName) - PcdExList.append(Pcd) - if len(ExTokenCNameList) == 0: - return - AutoGenH.Append('\n#define COMPAREGUID(Guid1, Guid2) (BOOLEAN)(*(CONST UINT64*)Guid1 == *(CONST UINT64*)Guid2 && *((CONST UINT64*)Guid1 + 1) == *((CONST UINT64*)Guid2 + 1))\n') - # AutoGen for each PCD listed in a [PcdEx] section of a Module/Lib INF file. - # Auto generate a macro for each TokenName that takes a Guid pointer as a parameter. - # Use the Guid pointer to see if it matches any of the token space GUIDs. - TokenCNameList = [] - for TokenCName in ExTokenCNameList: - if TokenCName in TokenCNameList: - continue - Index = 0 - Count = ExTokenCNameList.count(TokenCName) - for Pcd in PcdExList: - if Pcd.TokenCName == TokenCName: - Index = Index + 1 - if Index == 1: - AutoGenH.Append('\n#define __PCD_%s_ADDR_CMP(GuidPtr) (' % (Pcd.TokenCName)) - AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:' - % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) - else: - AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:' - % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) - if Index == Count: - AutoGenH.Append('0 \\\n )\n') - TokenCNameList.append(TokenCName) - - TokenCNameList = [] - for TokenCName in ExTokenCNameList: - if TokenCName in TokenCNameList: - continue - Index = 0 - Count = ExTokenCNameList.count(TokenCName) - for Pcd in PcdExList: - if Pcd.Type in gDynamicExPcd and Pcd.TokenCName == TokenCName: - Index = Index + 1 - if Index == 1: - AutoGenH.Append('\n#define __PCD_%s_VAL_CMP(GuidPtr) (' % (Pcd.TokenCName)) - AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:' - % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) - else: - AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:' - % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) - if Index == Count: - AutoGenH.Append('0 \\\n )\n') - # Autogen internal worker macro to compare GUIDs. Guid1 is a pointer to a GUID. - # Guid2 is a C name for a GUID. Compare pointers first because optimizing compiler - # can do this at build time on CONST GUID pointers and optimize away call to COMPAREGUID(). - # COMPAREGUID() will only be used if the Guid passed in is local to the module. - AutoGenH.Append('#define _PCD_TOKEN_EX_%s(GuidPtr) __PCD_%s_ADDR_CMP(GuidPtr) ? __PCD_%s_ADDR_CMP(GuidPtr) : __PCD_%s_VAL_CMP(GuidPtr) \n' - % (Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName)) - TokenCNameList.append(TokenCName) - -## Create code for module PCDs -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# @param Pcd The PCD object -# -def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): - TokenSpaceGuidValue = Pcd.TokenSpaceGuidValue #Info.GuidList[Pcd.TokenSpaceGuidCName] - PcdTokenNumber = Info.PlatformInfo.PcdTokenNumber - # - # Write PCDs - # - PcdTokenName = '_PCD_TOKEN_' + Pcd.TokenCName - if Pcd.Type in gDynamicExPcd: - TokenNumber = int(Pcd.TokenValue, 0) - # Add TokenSpaceGuidValue value to PcdTokenName to discriminate the DynamicEx PCDs with - # different Guids but same TokenCName - PcdExTokenName = '_PCD_TOKEN_' + Pcd.TokenSpaceGuidCName + '_' + Pcd.TokenCName - AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumber)) - else: - if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber: - # If one of the Source built modules listed in the DSC is not listed in FDF modules, - # and the INF lists a PCD can only use the PcdsDynamic access method (it is only - # listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will - # report warning message notify the PI that they are attempting to build a module - # that must be included in a flash image in order to be functional. These Dynamic PCD - # will not be added into the Database unless it is used by other modules that are - # included in the FDF file. - # In this case, just assign an invalid token number to make it pass build. - if Pcd.Type in PCD_DYNAMIC_TYPE_LIST: - TokenNumber = 0 - else: - EdkLogger.error("build", AUTOGEN_ERROR, - "No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - else: - TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] - AutoGenH.Append('\n#define %s %dU\n' % (PcdTokenName, TokenNumber)) - - EdkLogger.debug(EdkLogger.DEBUG_3, "Creating code for " + Pcd.TokenCName + "." + Pcd.TokenSpaceGuidCName) - if Pcd.Type not in gItemTypeStringDatabase: - EdkLogger.error("build", AUTOGEN_ERROR, - "Unknown PCD type [%s] of PCD %s.%s" % (Pcd.Type, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - if Pcd.DatumType not in gDatumSizeStringDatabase: - EdkLogger.error("build", AUTOGEN_ERROR, - "Unknown datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - - DatumSize = gDatumSizeStringDatabase[Pcd.DatumType] - DatumSizeLib = gDatumSizeStringDatabaseLib[Pcd.DatumType] - GetModeName = '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + Pcd.TokenCName - SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + Pcd.TokenCName - - PcdExCNameList = [] - if Pcd.Type in gDynamicExPcd: - if Info.IsLibrary: - PcdList = Info.LibraryPcdList - else: - PcdList = Info.ModulePcdList - for PcdModule in PcdList: - if PcdModule.Type in gDynamicExPcd: - PcdExCNameList.append(PcdModule.TokenCName) - # Be compatible with the current code which using PcdToken and PcdGet/Set for DynamicEx Pcd. - # If only PcdToken and PcdGet/Set used in all Pcds with different CName, it should succeed to build. - # If PcdToken and PcdGet/Set used in the Pcds with different Guids but same CName, it should failed to build. - if PcdExCNameList.count(Pcd.TokenCName) > 1: - AutoGenH.Append('// Disabled the macros, as PcdToken and PcdGet/Set are not allowed in the case that more than one DynamicEx Pcds are different Guids but same CName.\n') - AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTokenName)) - AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - if Pcd.DatumType == 'VOID*': - AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - else: - AutoGenH.Append('// #define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - else: - AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExTokenName)) - AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - if Pcd.DatumType == 'VOID*': - AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - else: - AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - elif Pcd.Type in gDynamicPcd: - AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName, DatumSizeLib, PcdTokenName)) - if Pcd.DatumType == 'VOID*': - AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdTokenName)) - else: - AutoGenH.Append('#define %s(Value) LibPcdSet%s(%s, (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName)) - else: - PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_' + Pcd.TokenCName - Const = 'const' - if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: - Const = '' - Type = '' - Array = '' - Value = Pcd.DefaultValue - Unicode = False - ValueNumber = 0 - - if Pcd.DatumType == 'BOOLEAN': - BoolValue = Value.upper() - if BoolValue == 'TRUE' or BoolValue == '1': - Value = '1U' - elif BoolValue == 'FALSE' or BoolValue == '0': - Value = '0U' - - if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']: - try: - if Value.upper().startswith('0X'): - ValueNumber = int (Value, 16) - else: - ValueNumber = int (Value) - except: - EdkLogger.error("build", AUTOGEN_ERROR, - "PCD value is not valid dec or hex number for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - if Pcd.DatumType == 'UINT64': - if ValueNumber < 0: - EdkLogger.error("build", AUTOGEN_ERROR, - "PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - elif ValueNumber >= 0x10000000000000000: - EdkLogger.error("build", AUTOGEN_ERROR, - "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - if not Value.endswith('ULL'): - Value += 'ULL' - elif Pcd.DatumType == 'UINT32': - if ValueNumber < 0: - EdkLogger.error("build", AUTOGEN_ERROR, - "PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - elif ValueNumber >= 0x100000000: - EdkLogger.error("build", AUTOGEN_ERROR, - "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - if not Value.endswith('U'): - Value += 'U' - elif Pcd.DatumType == 'UINT16': - if ValueNumber < 0: - EdkLogger.error("build", AUTOGEN_ERROR, - "PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - elif ValueNumber >= 0x10000: - EdkLogger.error("build", AUTOGEN_ERROR, - "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - if not Value.endswith('U'): - Value += 'U' - elif Pcd.DatumType == 'UINT8': - if ValueNumber < 0: - EdkLogger.error("build", AUTOGEN_ERROR, - "PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - elif ValueNumber >= 0x100: - EdkLogger.error("build", AUTOGEN_ERROR, - "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - if not Value.endswith('U'): - Value += 'U' - if Pcd.DatumType == 'VOID*': - if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '': - EdkLogger.error("build", AUTOGEN_ERROR, - "Unknown [MaxDatumSize] of PCD [%s.%s]" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - - ArraySize = int(Pcd.MaxDatumSize, 0) - if Value[0] == '{': - Type = '(VOID *)' - else: - if Value[0] == 'L': - Unicode = True - Value = Value.lstrip('L') #.strip('"') - Value = eval(Value) # translate escape character - NewValue = '{' - for Index in range(0,len(Value)): - if Unicode: - NewValue = NewValue + str(ord(Value[Index]) % 0x10000) + ', ' - else: - NewValue = NewValue + str(ord(Value[Index]) % 0x100) + ', ' - if Unicode: - ArraySize = ArraySize / 2; - - if ArraySize < (len(Value) + 1): - EdkLogger.error("build", AUTOGEN_ERROR, - "The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - Value = NewValue + '0 }' - Array = '[%d]' % ArraySize - # - # skip casting for fixed at build since it breaks ARM assembly. - # Long term we need PCD macros that work in assembly - # - elif Pcd.Type != TAB_PCDS_FIXED_AT_BUILD: - Value = "((%s)%s)" % (Pcd.DatumType, Value) - - if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: - PcdValueName = '_PCD_PATCHABLE_VALUE_' + Pcd.TokenCName - else: - PcdValueName = '_PCD_VALUE_' + Pcd.TokenCName - - if Pcd.DatumType == 'VOID*': - # - # For unicode, UINT16 array will be generated, so the alignment of unicode is guaranteed. - # - if Unicode: - AutoGenH.Append('#define _PCD_PATCHABLE_%s_SIZE %s\n' % (Pcd.TokenCName, Pcd.MaxDatumSize)) - AutoGenH.Append('#define %s %s%s\n' %(PcdValueName, Type, PcdVariableName)) - AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s UINT16 %s%s = %s;\n' % (Const, PcdVariableName, Array, Value)) - AutoGenH.Append('extern %s UINT16 %s%s;\n' %(Const, PcdVariableName, Array)) - AutoGenH.Append('#define %s %s%s\n' %(GetModeName, Type, PcdVariableName)) - else: - AutoGenH.Append('#define _PCD_PATCHABLE_%s_SIZE %s\n' % (Pcd.TokenCName, Pcd.MaxDatumSize)) - AutoGenH.Append('#define %s %s%s\n' %(PcdValueName, Type, PcdVariableName)) - AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s UINT8 %s%s = %s;\n' % (Const, PcdVariableName, Array, Value)) - AutoGenH.Append('extern %s UINT8 %s%s;\n' %(Const, PcdVariableName, Array)) - AutoGenH.Append('#define %s %s%s\n' %(GetModeName, Type, PcdVariableName)) - elif Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: - AutoGenH.Append('#define %s %s\n' %(PcdValueName, Value)) - AutoGenC.Append('volatile %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName)) - AutoGenH.Append('extern volatile %s %s %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array)) - AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, PcdVariableName)) - else: - AutoGenH.Append('#define %s %s\n' %(PcdValueName, Value)) - AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName)) - AutoGenH.Append('extern %s %s %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array)) - AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, PcdVariableName)) - - if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: - if Pcd.DatumType == 'VOID*': - AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtr(_gPcd_BinaryPatch_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeName, Pcd.TokenCName, Pcd.TokenCName)) - else: - AutoGenH.Append('#define %s(Value) (%s = (Value))\n' % (SetModeName, PcdVariableName)) - else: - AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName) - -## Create code for library module PCDs -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# @param Pcd The PCD object -# -def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd): - PcdTokenNumber = Info.PlatformInfo.PcdTokenNumber - TokenSpaceGuidCName = Pcd.TokenSpaceGuidCName - TokenCName = Pcd.TokenCName - PcdTokenName = '_PCD_TOKEN_' + TokenCName - # - # Write PCDs - # - if Pcd.Type in gDynamicExPcd: - TokenNumber = int(Pcd.TokenValue, 0) - else: - if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber: - # If one of the Source built modules listed in the DSC is not listed in FDF modules, - # and the INF lists a PCD can only use the PcdsDynamic access method (it is only - # listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will - # report warning message notify the PI that they are attempting to build a module - # that must be included in a flash image in order to be functional. These Dynamic PCD - # will not be added into the Database unless it is used by other modules that are - # included in the FDF file. - # In this case, just assign an invalid token number to make it pass build. - if Pcd.Type in PCD_DYNAMIC_TYPE_LIST: - TokenNumber = 0 - else: - EdkLogger.error("build", AUTOGEN_ERROR, - "No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - else: - TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] - - if Pcd.Type not in gItemTypeStringDatabase: - EdkLogger.error("build", AUTOGEN_ERROR, - "Unknown PCD type [%s] of PCD %s.%s" % (Pcd.Type, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - if Pcd.DatumType not in gDatumSizeStringDatabase: - EdkLogger.error("build", AUTOGEN_ERROR, - "Unknown datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), - ExtraData="[%s]" % str(Info)) - - DatumType = Pcd.DatumType - DatumSize = gDatumSizeStringDatabaseH[DatumType] - DatumSizeLib= gDatumSizeStringDatabaseLib[DatumType] - GetModeName = '_PCD_GET_MODE_' + DatumSize + '_' + TokenCName - SetModeName = '_PCD_SET_MODE_' + DatumSize + '_' + TokenCName - - Type = '' - Array = '' - if Pcd.DatumType == 'VOID*': - Type = '(VOID *)' - Array = '[]' - PcdItemType = Pcd.Type - PcdExCNameList = [] - if PcdItemType in gDynamicExPcd: - PcdExTokenName = '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + Pcd.TokenCName - AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumber)) - - if Info.IsLibrary: - PcdList = Info.LibraryPcdList - else: - PcdList = Info.ModulePcdList - for PcdModule in PcdList: - if PcdModule.Type in gDynamicExPcd: - PcdExCNameList.append(PcdModule.TokenCName) - # Be compatible with the current code which using PcdGet/Set for DynamicEx Pcd. - # If only PcdGet/Set used in all Pcds with different CName, it should succeed to build. - # If PcdGet/Set used in the Pcds with different Guids but same CName, it should failed to build. - if PcdExCNameList.count(Pcd.TokenCName) > 1: - AutoGenH.Append('// Disabled the macros, as PcdToken and PcdGet/Set are not allowed in the case that more than one DynamicEx Pcds are different Guids but same CName.\n') - AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTokenName)) - AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - if Pcd.DatumType == 'VOID*': - AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - else: - AutoGenH.Append('// #define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - else: - AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExTokenName)) - AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - if Pcd.DatumType == 'VOID*': - AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - else: - AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) - else: - AutoGenH.Append('#define _PCD_TOKEN_%s %dU\n' % (TokenCName, TokenNumber)) - if PcdItemType in gDynamicPcd: - AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName, DatumSizeLib, PcdTokenName)) - if DatumType == 'VOID*': - AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdTokenName)) - else: - AutoGenH.Append('#define %s(Value) LibPcdSet%s(%s, (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName)) - if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE: - PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName - AutoGenH.Append('extern volatile %s _gPcd_BinaryPatch_%s%s;\n' %(DatumType, TokenCName, Array) ) - AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeName, Type, TokenCName)) - AutoGenH.Append('#define %s(Value) (%s = (Value))\n' % (SetModeName, PcdVariableName)) - if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG: - key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName)) - - AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array)) - AutoGenH.Append('#define %s %s_gPcd_FixedAtBuild_%s\n' %(GetModeName, Type, TokenCName)) - AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName) - - if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and key in Info.ConstPcd: - AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue)) - - - -## Create code for library constructor -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# -def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH): - # - # Library Constructors - # - ConstructorPrototypeString = TemplateString() - ConstructorCallingString = TemplateString() - if Info.IsLibrary: - DependentLibraryList = [Info.Module] - else: - DependentLibraryList = Info.DependentLibraryList - for Lib in DependentLibraryList: - if len(Lib.ConstructorList) <= 0: - continue - Dict = {'Function':Lib.ConstructorList} - if Lib.ModuleType in ['BASE', 'SEC']: - ConstructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict)) - ConstructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict)) - elif Lib.ModuleType in ['PEI_CORE','PEIM']: - ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict)) - ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict)) - elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: - ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict)) - ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict)) - - if str(ConstructorPrototypeString) == '': - ConstructorPrototypeList = [] - else: - ConstructorPrototypeList = [str(ConstructorPrototypeString)] - if str(ConstructorCallingString) == '': - ConstructorCallingList = [] - else: - ConstructorCallingList = [str(ConstructorCallingString)] - - Dict = { - 'Type' : 'Constructor', - 'FunctionPrototype' : ConstructorPrototypeList, - 'FunctionCall' : ConstructorCallingList - } - if Info.IsLibrary: - AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) - else: - if Info.ModuleType in ['BASE', 'SEC']: - AutoGenC.Append(gLibraryString['BASE'].Replace(Dict)) - elif Info.ModuleType in ['PEI_CORE','PEIM']: - AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) - elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: - AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) - -## Create code for library destructor -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# -def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH): - # - # Library Destructors - # - DestructorPrototypeString = TemplateString() - DestructorCallingString = TemplateString() - if Info.IsLibrary: - DependentLibraryList = [Info.Module] - else: - DependentLibraryList = Info.DependentLibraryList - for Index in range(len(DependentLibraryList)-1, -1, -1): - Lib = DependentLibraryList[Index] - if len(Lib.DestructorList) <= 0: - continue - Dict = {'Function':Lib.DestructorList} - if Lib.ModuleType in ['BASE', 'SEC']: - DestructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict)) - DestructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict)) - elif Lib.ModuleType in ['PEI_CORE','PEIM']: - DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict)) - DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict)) - elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_CORE']: - DestructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict)) - DestructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict)) - - if str(DestructorPrototypeString) == '': - DestructorPrototypeList = [] - else: - DestructorPrototypeList = [str(DestructorPrototypeString)] - if str(DestructorCallingString) == '': - DestructorCallingList = [] - else: - DestructorCallingList = [str(DestructorCallingString)] - - Dict = { - 'Type' : 'Destructor', - 'FunctionPrototype' : DestructorPrototypeList, - 'FunctionCall' : DestructorCallingList - } - if Info.IsLibrary: - AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) - else: - if Info.ModuleType in ['BASE', 'SEC']: - AutoGenC.Append(gLibraryString['BASE'].Replace(Dict)) - elif Info.ModuleType in ['PEI_CORE','PEIM']: - AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) - elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: - AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) - - -## Create code for ModuleEntryPoint -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# -def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']: - return - # - # Module Entry Points - # - NumEntryPoints = len(Info.Module.ModuleEntryPointList) - if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification: - PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION'] - else: - PiSpecVersion = '0x00000000' - if 'UEFI_SPECIFICATION_VERSION' in Info.Module.Specification: - UefiSpecVersion = Info.Module.Specification['UEFI_SPECIFICATION_VERSION'] - else: - UefiSpecVersion = '0x00000000' - Dict = { - 'Function' : Info.Module.ModuleEntryPointList, - 'PiSpecVersion' : PiSpecVersion + 'U', - 'UefiSpecVersion': UefiSpecVersion + 'U' - } - - if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE']: - if Info.SourceFileList <> None and Info.SourceFileList <> []: - if NumEntryPoints != 1: - EdkLogger.error( - "build", - AUTOGEN_ERROR, - '%s must have exactly one entry point' % Info.ModuleType, - File=str(Info), - ExtraData= ", ".join(Info.Module.ModuleEntryPointList) - ) - if Info.ModuleType == 'PEI_CORE': - AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict)) - AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType == 'DXE_CORE': - AutoGenC.Append(gDxeCoreEntryPointString.Replace(Dict)) - AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType == 'SMM_CORE': - AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict)) - AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType == 'PEIM': - if NumEntryPoints < 2: - AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(Dict)) - else: - AutoGenC.Append(gPeimEntryPointString[2].Replace(Dict)) - AutoGenH.Append(gPeimEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType in ['DXE_RUNTIME_DRIVER','DXE_DRIVER','DXE_SAL_DRIVER','UEFI_DRIVER']: - if NumEntryPoints < 2: - AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Replace(Dict)) - else: - AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict)) - AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType == 'DXE_SMM_DRIVER': - if NumEntryPoints == 0: - AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict)) - else: - AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict)) - AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType == 'UEFI_APPLICATION': - if NumEntryPoints < 2: - AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(Dict)) - else: - AutoGenC.Append(gUefiApplicationEntryPointString[2].Replace(Dict)) - AutoGenH.Append(gUefiApplicationEntryPointPrototype.Replace(Dict)) - -## Create code for ModuleUnloadImage -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# -def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']: - return - # - # Unload Image Handlers - # - NumUnloadImage = len(Info.Module.ModuleUnloadImageList) - Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':Info.Module.ModuleUnloadImageList} - if NumUnloadImage < 2: - AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dict)) - else: - AutoGenC.Append(gUefiUnloadImageString[2].Replace(Dict)) - AutoGenH.Append(gUefiUnloadImagePrototype.Replace(Dict)) - -## Create code for GUID -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# -def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary: - return - - if Info.ModuleType in ["USER_DEFINED", "BASE"]: - GuidType = "GUID" - else: - GuidType = "EFI_GUID" - - if Info.GuidList: - AutoGenC.Append("\n// Guids\n") - # - # GUIDs - # - for Key in Info.GuidList: - AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key])) - -## Create code for protocol -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# -def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary: - return - - if Info.ModuleType in ["USER_DEFINED", "BASE"]: - GuidType = "GUID" - else: - GuidType = "EFI_GUID" - - if Info.ProtocolList: - AutoGenC.Append("\n// Protocols\n") - # - # Protocol GUIDs - # - for Key in Info.ProtocolList: - AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key])) - -## Create code for PPI -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# -def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary: - return - - if Info.ModuleType in ["USER_DEFINED", "BASE"]: - GuidType = "GUID" - else: - GuidType = "EFI_GUID" - - if Info.PpiList: - AutoGenC.Append("\n// PPIs\n") - # - # PPI GUIDs - # - for Key in Info.PpiList: - AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key])) - -## Create code for PCD -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# -def CreatePcdCode(Info, AutoGenC, AutoGenH): - - # Collect Token Space GUIDs used by DynamicEc PCDs - TokenSpaceList = [] - for Pcd in Info.ModulePcdList: - if Pcd.Type in gDynamicExPcd and Pcd.TokenSpaceGuidCName not in TokenSpaceList: - TokenSpaceList += [Pcd.TokenSpaceGuidCName] - - # Add extern declarations to AutoGen.h if one or more Token Space GUIDs were found - if TokenSpaceList <> []: - AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in this module\n\n") - if Info.ModuleType in ["USER_DEFINED", "BASE"]: - GuidType = "GUID" - else: - GuidType = "EFI_GUID" - for Item in TokenSpaceList: - AutoGenH.Append('extern %s %s;\n' % (GuidType, Item)) - - if Info.IsLibrary: - if Info.ModulePcdList: - AutoGenH.Append("\n// PCD definitions\n") - for Pcd in Info.ModulePcdList: - CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd) - DynExPcdTokenNumberMapping (Info, AutoGenH) - else: - if Info.ModulePcdList: - AutoGenH.Append("\n// Definition of PCDs used in this module\n") - AutoGenC.Append("\n// Definition of PCDs used in this module\n") - for Pcd in Info.ModulePcdList: - CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd) - DynExPcdTokenNumberMapping (Info, AutoGenH) - if Info.LibraryPcdList: - AutoGenH.Append("\n// Definition of PCDs used in libraries is in AutoGen.c\n") - AutoGenC.Append("\n// Definition of PCDs used in libraries\n") - for Pcd in Info.LibraryPcdList: - CreateModulePcdCode(Info, AutoGenC, AutoGenC, Pcd) - CreatePcdDatabaseCode(Info, AutoGenC, AutoGenH) - -## Create code for unicode string definition -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True -# @param UniGenBinBuffer Buffer to store uni string package data -# -def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH, UniGenCFlag, UniGenBinBuffer): - WorkingDir = os.getcwd() - os.chdir(Info.WorkspaceDir) - - IncList = [Info.MetaFile.Dir] - # Get all files under [Sources] section in inf file for EDK-II module - EDK2Module = True - SrcList = [F for F in Info.SourceFileList] - if Info.AutoGenVersion < 0x00010005: - EDK2Module = False - # Get all files under the module directory for EDK-I module - Cwd = os.getcwd() - os.chdir(Info.MetaFile.Dir) - for Root, Dirs, Files in os.walk("."): - if 'CVS' in Dirs: - Dirs.remove('CVS') - if '.svn' in Dirs: - Dirs.remove('.svn') - for File in Files: - File = PathClass(os.path.join(Root, File), Info.MetaFile.Dir) - if File in SrcList: - continue - SrcList.append(File) - os.chdir(Cwd) - - if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-c') > -1: - CompatibleMode = True - else: - CompatibleMode = False - - # - # -s is a temporary option dedicated for building .UNI files with ISO 639-2 language codes of EDK Shell in EDK2 - # - if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-s') > -1: - if CompatibleMode: - EdkLogger.error("build", AUTOGEN_ERROR, - "-c and -s build options should be used exclusively", - ExtraData="[%s]" % str(Info)) - ShellMode = True - else: - ShellMode = False - - #RFC4646 is only for EDKII modules and ISO639-2 for EDK modules - if EDK2Module: - FilterInfo = [EDK2Module] + [Info.PlatformInfo.Platform.RFCLanguages] - else: - FilterInfo = [EDK2Module] + [Info.PlatformInfo.Platform.ISOLanguages] - Header, Code = GetStringFiles(Info.UnicodeFileList, SrcList, IncList, Info.IncludePathList, ['.uni', '.inf'], Info.Name, CompatibleMode, ShellMode, UniGenCFlag, UniGenBinBuffer, FilterInfo) - if CompatibleMode or UniGenCFlag: - AutoGenC.Append("\n//\n//Unicode String Pack Definition\n//\n") - AutoGenC.Append(Code) - AutoGenC.Append("\n") - AutoGenH.Append("\n//\n//Unicode String ID\n//\n") - AutoGenH.Append(Header) - if CompatibleMode or UniGenCFlag: - AutoGenH.Append("\n#define STRING_ARRAY_NAME %sStrings\n" % Info.Name) - os.chdir(WorkingDir) - -## Create common code -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# -def CreateHeaderCode(Info, AutoGenC, AutoGenH): - # file header - AutoGenH.Append(gAutoGenHeaderString.Replace({'FileName':'AutoGen.h'})) - # header file Prologue - AutoGenH.Append(gAutoGenHPrologueString.Replace({'File':'AUTOGENH','Guid':Info.Guid.replace('-','_')})) - AutoGenH.Append(gAutoGenHCppPrologueString) - if Info.AutoGenVersion >= 0x00010005: - # header files includes - AutoGenH.Append("#include <%s>\n" % gBasicHeaderFile) - if Info.ModuleType in gModuleTypeHeaderFile \ - and gModuleTypeHeaderFile[Info.ModuleType][0] != gBasicHeaderFile: - AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0]) - # - # if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h - # As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section. - # - if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds: - AutoGenH.Append("#include \n") - - AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;') - AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n') - - if Info.IsLibrary: - return - - AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid)) - - if Info.IsLibrary: - return - # C file header - AutoGenC.Append(gAutoGenHeaderString.Replace({'FileName':'AutoGen.c'})) - if Info.AutoGenVersion >= 0x00010005: - # C file header files includes - if Info.ModuleType in gModuleTypeHeaderFile: - for Inc in gModuleTypeHeaderFile[Info.ModuleType]: - AutoGenC.Append("#include <%s>\n" % Inc) - else: - AutoGenC.Append("#include <%s>\n" % gBasicHeaderFile) - - # - # Publish the CallerId Guid - # - AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid)) - AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name) - -## Create common code for header file -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# -def CreateFooterCode(Info, AutoGenC, AutoGenH): - AutoGenH.Append(gAutoGenHEpilogueString) - -## Create code for a module -# -# @param Info The ModuleAutoGen object -# @param AutoGenC The TemplateString object for C code -# @param AutoGenH The TemplateString object for header file -# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True -# @param UniGenBinBuffer Buffer to store uni string package data -# -def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer): - CreateHeaderCode(Info, AutoGenC, AutoGenH) - - if Info.AutoGenVersion >= 0x00010005: - CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH) - CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH) - CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH) - CreatePcdCode(Info, AutoGenC, AutoGenH) - CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH) - CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH) - CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH) - CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH) - - if Info.UnicodeFileList: - FileName = "%sStrDefs.h" % Info.Name - StringH.Append(gAutoGenHeaderString.Replace({'FileName':FileName})) - StringH.Append(gAutoGenHPrologueString.Replace({'File':'STRDEFS', 'Guid':Info.Guid.replace('-','_')})) - CreateUnicodeStringCode(Info, AutoGenC, StringH, UniGenCFlag, UniGenBinBuffer) - StringH.Append("\n#endif\n") - AutoGenH.Append('#include "%s"\n' % FileName) - - CreateFooterCode(Info, AutoGenC, AutoGenH) - - # no generation of AutoGen.c for Edk modules without unicode file - if Info.AutoGenVersion < 0x00010005 and len(Info.UnicodeFileList) == 0: - AutoGenC.String = '' - -## Create the code file -# -# @param FilePath The path of code file -# @param Content The content of code file -# @param IsBinaryFile The flag indicating if the file is binary file or not -# -# @retval True If file content is changed or file doesn't exist -# @retval False If the file exists and the content is not changed -# -def Generate(FilePath, Content, IsBinaryFile): - return SaveFileOnChange(FilePath, Content, IsBinaryFile) - +## @file +# Routines for generating AutoGen.h and AutoGen.c +# +# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## Import Modules +# +import string + +from Common import EdkLogger + +from Common.BuildToolError import * +from Common.DataType import * +from Common.Misc import * +from Common.String import StringToArray +from StrGather import * +from GenPcdDb import CreatePcdDatabaseCode + +## PCD type string +gItemTypeStringDatabase = { + TAB_PCDS_FEATURE_FLAG : 'FixedAtBuild', + TAB_PCDS_FIXED_AT_BUILD : 'FixedAtBuild', + TAB_PCDS_PATCHABLE_IN_MODULE: 'BinaryPatch', + TAB_PCDS_DYNAMIC : '', + TAB_PCDS_DYNAMIC_DEFAULT : '', + TAB_PCDS_DYNAMIC_VPD : '', + TAB_PCDS_DYNAMIC_HII : '', + TAB_PCDS_DYNAMIC_EX : '', + TAB_PCDS_DYNAMIC_EX_DEFAULT : '', + TAB_PCDS_DYNAMIC_EX_VPD : '', + TAB_PCDS_DYNAMIC_EX_HII : '', +} + +## Dynamic PCD types +gDynamicPcd = [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII] + +## Dynamic-ex PCD types +gDynamicExPcd = [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII] + +## Datum size +gDatumSizeStringDatabase = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'BOOLEAN','VOID*':'8'} +gDatumSizeStringDatabaseH = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'BOOL','VOID*':'PTR'} +gDatumSizeStringDatabaseLib = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'Bool','VOID*':'Ptr'} + +## AutoGen File Header Templates +gAutoGenHeaderString = TemplateString("""\ +/** + DO NOT EDIT + FILE auto-generated + Module name: + ${FileName} + Abstract: Auto-generated ${FileName} for building module or library. +**/ +""") + +gAutoGenHPrologueString = TemplateString(""" +#ifndef _${File}_${Guid} +#define _${File}_${Guid} + +""") + +gAutoGenHCppPrologueString = """\ +#ifdef __cplusplus +extern "C" { +#endif + +""" + +gAutoGenHEpilogueString = """ + +#ifdef __cplusplus +} +#endif + +#endif +""" + +## PEI Core Entry Point Templates +gPeiCoreEntryPointPrototype = TemplateString(""" +${BEGIN} +VOID +EFIAPI +${Function} ( + IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList, + IN VOID *Context + ); +${END} +""") + +gPeiCoreEntryPointString = TemplateString(""" +${BEGIN} +VOID +EFIAPI +ProcessModuleEntryPointList ( + IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList, + IN VOID *Context + ) + +{ + ${Function} (SecCoreData, PpiList, Context); +} +${END} +""") + + +## DXE Core Entry Point Templates +gDxeCoreEntryPointPrototype = TemplateString(""" +${BEGIN} +VOID +EFIAPI +${Function} ( + IN VOID *HobStart + ); +${END} +""") + +gDxeCoreEntryPointString = TemplateString(""" +${BEGIN} +VOID +EFIAPI +ProcessModuleEntryPointList ( + IN VOID *HobStart + ) + +{ + ${Function} (HobStart); +} +${END} +""") + +## PEIM Entry Point Templates +gPeimEntryPointPrototype = TemplateString(""" +${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ); +${END} +""") + +gPeimEntryPointString = [ +TemplateString(""" +GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion}; + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) + +{ + return EFI_SUCCESS; +} +"""), +TemplateString(""" +GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion}; +${BEGIN} +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) + +{ + return ${Function} (FileHandle, PeiServices); +} +${END} +"""), +TemplateString(""" +GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion}; + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) + +{ + EFI_STATUS Status; + EFI_STATUS CombinedStatus; + + CombinedStatus = EFI_LOAD_ERROR; +${BEGIN} + Status = ${Function} (FileHandle, PeiServices); + if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) { + CombinedStatus = Status; + } +${END} + return CombinedStatus; +} +""") +] + +## SMM_CORE Entry Point Templates +gSmmCoreEntryPointPrototype = TemplateString(""" +${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); +${END} +""") + +gSmmCoreEntryPointString = TemplateString(""" +${BEGIN} +const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; +const UINT32 _gDxeRevision = ${PiSpecVersion}; + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + return ${Function} (ImageHandle, SystemTable); +} +${END} +""") + +## DXE SMM Entry Point Templates +gDxeSmmEntryPointPrototype = TemplateString(""" +${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); +${END} +""") + +gDxeSmmEntryPointString = [ +TemplateString(""" +const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; +const UINT32 _gDxeRevision = ${PiSpecVersion}; + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) + +{ + return EFI_SUCCESS; +} +"""), +TemplateString(""" +const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; +const UINT32 _gDxeRevision = ${PiSpecVersion}; + +static BASE_LIBRARY_JUMP_BUFFER mJumpContext; +static EFI_STATUS mDriverEntryPointStatus; + +VOID +EFIAPI +ExitDriver ( + IN EFI_STATUS Status + ) +{ + if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) { + mDriverEntryPointStatus = Status; + } + LongJump (&mJumpContext, (UINTN)-1); + ASSERT (FALSE); +} + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + mDriverEntryPointStatus = EFI_LOAD_ERROR; + +${BEGIN} + if (SetJump (&mJumpContext) == 0) { + ExitDriver (${Function} (ImageHandle, SystemTable)); + ASSERT (FALSE); + } +${END} + + return mDriverEntryPointStatus; +} +""") +] + +## UEFI Driver Entry Point Templates +gUefiDriverEntryPointPrototype = TemplateString(""" +${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); +${END} +""") + +gUefiDriverEntryPointString = [ +TemplateString(""" +const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; +const UINT32 _gDxeRevision = ${PiSpecVersion}; + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + return EFI_SUCCESS; +} +"""), +TemplateString(""" +const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; +const UINT32 _gDxeRevision = ${PiSpecVersion}; + +${BEGIN} +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) + +{ + return ${Function} (ImageHandle, SystemTable); +} +${END} +VOID +EFIAPI +ExitDriver ( + IN EFI_STATUS Status + ) +{ + if (EFI_ERROR (Status)) { + ProcessLibraryDestructorList (gImageHandle, gST); + } + gBS->Exit (gImageHandle, Status, 0, NULL); +} +"""), +TemplateString(""" +const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; +const UINT32 _gDxeRevision = ${PiSpecVersion}; + +static BASE_LIBRARY_JUMP_BUFFER mJumpContext; +static EFI_STATUS mDriverEntryPointStatus; + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + mDriverEntryPointStatus = EFI_LOAD_ERROR; + ${BEGIN} + if (SetJump (&mJumpContext) == 0) { + ExitDriver (${Function} (ImageHandle, SystemTable)); + ASSERT (FALSE); + } + ${END} + return mDriverEntryPointStatus; +} + +VOID +EFIAPI +ExitDriver ( + IN EFI_STATUS Status + ) +{ + if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) { + mDriverEntryPointStatus = Status; + } + LongJump (&mJumpContext, (UINTN)-1); + ASSERT (FALSE); +} +""") +] + + +## UEFI Application Entry Point Templates +gUefiApplicationEntryPointPrototype = TemplateString(""" +${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); +${END} +""") + +gUefiApplicationEntryPointString = [ +TemplateString(""" +const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + return EFI_SUCCESS; +} +"""), +TemplateString(""" +const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; + +${BEGIN} +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) + +{ + return ${Function} (ImageHandle, SystemTable); +} +${END} +VOID +EFIAPI +ExitDriver ( + IN EFI_STATUS Status + ) +{ + if (EFI_ERROR (Status)) { + ProcessLibraryDestructorList (gImageHandle, gST); + } + gBS->Exit (gImageHandle, Status, 0, NULL); +} +"""), +TemplateString(""" +const UINT32 _gUefiDriverRevision = ${UefiSpecVersion}; + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) + +{ + ${BEGIN} + if (SetJump (&mJumpContext) == 0) { + ExitDriver (${Function} (ImageHandle, SystemTable)); + ASSERT (FALSE); + } + ${END} + return mDriverEntryPointStatus; +} + +static BASE_LIBRARY_JUMP_BUFFER mJumpContext; +static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR; + +VOID +EFIAPI +ExitDriver ( + IN EFI_STATUS Status + ) +{ + if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) { + mDriverEntryPointStatus = Status; + } + LongJump (&mJumpContext, (UINTN)-1); + ASSERT (FALSE); +} +""") +] + +## UEFI Unload Image Templates +gUefiUnloadImagePrototype = TemplateString(""" +${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN EFI_HANDLE ImageHandle + ); +${END} +""") + +gUefiUnloadImageString = [ +TemplateString(""" +GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ${Count}; + +EFI_STATUS +EFIAPI +ProcessModuleUnloadList ( + IN EFI_HANDLE ImageHandle + ) +{ + return EFI_SUCCESS; +} +"""), +TemplateString(""" +GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ${Count}; + +${BEGIN} +EFI_STATUS +EFIAPI +ProcessModuleUnloadList ( + IN EFI_HANDLE ImageHandle + ) +{ + return ${Function} (ImageHandle); +} +${END} +"""), +TemplateString(""" +GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ${Count}; + +EFI_STATUS +EFIAPI +ProcessModuleUnloadList ( + IN EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + + Status = EFI_SUCCESS; +${BEGIN} + if (EFI_ERROR (Status)) { + ${Function} (ImageHandle); + } else { + Status = ${Function} (ImageHandle); + } +${END} + return Status; +} +""") +] + +gLibraryStructorPrototype = { +'BASE' : TemplateString("""${BEGIN} +RETURN_STATUS +EFIAPI +${Function} ( + VOID + );${END} +"""), + +'PEI' : TemplateString("""${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + );${END} +"""), + +'DXE' : TemplateString("""${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + );${END} +"""), +} + +gLibraryStructorCall = { +'BASE' : TemplateString("""${BEGIN} + Status = ${Function} (); + ASSERT_EFI_ERROR (Status);${END} +"""), + +'PEI' : TemplateString("""${BEGIN} + Status = ${Function} (FileHandle, PeiServices); + ASSERT_EFI_ERROR (Status);${END} +"""), + +'DXE' : TemplateString("""${BEGIN} + Status = ${Function} (ImageHandle, SystemTable); + ASSERT_EFI_ERROR (Status);${END} +"""), +} + +## Library Constructor and Destructor Templates +gLibraryString = { +'BASE' : TemplateString(""" +${BEGIN}${FunctionPrototype}${END} + +VOID +EFIAPI +ProcessLibrary${Type}List ( + VOID + ) +{ +${BEGIN} EFI_STATUS Status; +${FunctionCall}${END} +} +"""), + +'PEI' : TemplateString(""" +${BEGIN}${FunctionPrototype}${END} + +VOID +EFIAPI +ProcessLibrary${Type}List ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ +${BEGIN} EFI_STATUS Status; +${FunctionCall}${END} +} +"""), + +'DXE' : TemplateString(""" +${BEGIN}${FunctionPrototype}${END} + +VOID +EFIAPI +ProcessLibrary${Type}List ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ +${BEGIN} EFI_STATUS Status; +${FunctionCall}${END} +} +"""), +} + +gBasicHeaderFile = "Base.h" + +gModuleTypeHeaderFile = { + "BASE" : [gBasicHeaderFile], + "SEC" : ["PiPei.h", "Library/DebugLib.h"], + "PEI_CORE" : ["PiPei.h", "Library/DebugLib.h", "Library/PeiCoreEntryPoint.h"], + "PEIM" : ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"], + "DXE_CORE" : ["PiDxe.h", "Library/DebugLib.h", "Library/DxeCoreEntryPoint.h"], + "DXE_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], + "DXE_SMM_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], + "DXE_RUNTIME_DRIVER": ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], + "DXE_SAL_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], + "UEFI_DRIVER" : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"], + "UEFI_APPLICATION" : ["Uefi.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"], + "SMM_CORE" : ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"], + "USER_DEFINED" : [gBasicHeaderFile] +} + +## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName +# the TokenName and Guid comparison to avoid define name collisions. +# +# @param Info The ModuleAutoGen object +# @param AutoGenH The TemplateString object for header file +# +# +def DynExPcdTokenNumberMapping(Info, AutoGenH): + ExTokenCNameList = [] + PcdExList = [] + if Info.IsLibrary: + PcdList = Info.LibraryPcdList + else: + PcdList = Info.ModulePcdList + for Pcd in PcdList: + if Pcd.Type in gDynamicExPcd: + ExTokenCNameList.append(Pcd.TokenCName) + PcdExList.append(Pcd) + if len(ExTokenCNameList) == 0: + return + AutoGenH.Append('\n#define COMPAREGUID(Guid1, Guid2) (BOOLEAN)(*(CONST UINT64*)Guid1 == *(CONST UINT64*)Guid2 && *((CONST UINT64*)Guid1 + 1) == *((CONST UINT64*)Guid2 + 1))\n') + # AutoGen for each PCD listed in a [PcdEx] section of a Module/Lib INF file. + # Auto generate a macro for each TokenName that takes a Guid pointer as a parameter. + # Use the Guid pointer to see if it matches any of the token space GUIDs. + TokenCNameList = [] + for TokenCName in ExTokenCNameList: + if TokenCName in TokenCNameList: + continue + Index = 0 + Count = ExTokenCNameList.count(TokenCName) + for Pcd in PcdExList: + if Pcd.TokenCName == TokenCName: + Index = Index + 1 + if Index == 1: + AutoGenH.Append('\n#define __PCD_%s_ADDR_CMP(GuidPtr) (' % (Pcd.TokenCName)) + AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:' + % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) + else: + AutoGenH.Append('\\\n (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:' + % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) + if Index == Count: + AutoGenH.Append('0 \\\n )\n') + TokenCNameList.append(TokenCName) + + TokenCNameList = [] + for TokenCName in ExTokenCNameList: + if TokenCName in TokenCNameList: + continue + Index = 0 + Count = ExTokenCNameList.count(TokenCName) + for Pcd in PcdExList: + if Pcd.Type in gDynamicExPcd and Pcd.TokenCName == TokenCName: + Index = Index + 1 + if Index == 1: + AutoGenH.Append('\n#define __PCD_%s_VAL_CMP(GuidPtr) (' % (Pcd.TokenCName)) + AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:' + % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) + else: + AutoGenH.Append('\\\n COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:' + % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) + if Index == Count: + AutoGenH.Append('0 \\\n )\n') + # Autogen internal worker macro to compare GUIDs. Guid1 is a pointer to a GUID. + # Guid2 is a C name for a GUID. Compare pointers first because optimizing compiler + # can do this at build time on CONST GUID pointers and optimize away call to COMPAREGUID(). + # COMPAREGUID() will only be used if the Guid passed in is local to the module. + AutoGenH.Append('#define _PCD_TOKEN_EX_%s(GuidPtr) __PCD_%s_ADDR_CMP(GuidPtr) ? __PCD_%s_ADDR_CMP(GuidPtr) : __PCD_%s_VAL_CMP(GuidPtr) \n' + % (Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName)) + TokenCNameList.append(TokenCName) + +## Create code for module PCDs +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# @param Pcd The PCD object +# +def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): + TokenSpaceGuidValue = Pcd.TokenSpaceGuidValue #Info.GuidList[Pcd.TokenSpaceGuidCName] + PcdTokenNumber = Info.PlatformInfo.PcdTokenNumber + # + # Write PCDs + # + PcdTokenName = '_PCD_TOKEN_' + Pcd.TokenCName + if Pcd.Type in gDynamicExPcd: + TokenNumber = int(Pcd.TokenValue, 0) + # Add TokenSpaceGuidValue value to PcdTokenName to discriminate the DynamicEx PCDs with + # different Guids but same TokenCName + PcdExTokenName = '_PCD_TOKEN_' + Pcd.TokenSpaceGuidCName + '_' + Pcd.TokenCName + AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumber)) + else: + if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber: + # If one of the Source built modules listed in the DSC is not listed in FDF modules, + # and the INF lists a PCD can only use the PcdsDynamic access method (it is only + # listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will + # report warning message notify the PI that they are attempting to build a module + # that must be included in a flash image in order to be functional. These Dynamic PCD + # will not be added into the Database unless it is used by other modules that are + # included in the FDF file. + # In this case, just assign an invalid token number to make it pass build. + if Pcd.Type in PCD_DYNAMIC_TYPE_LIST: + TokenNumber = 0 + else: + EdkLogger.error("build", AUTOGEN_ERROR, + "No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + else: + TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] + AutoGenH.Append('\n#define %s %dU\n' % (PcdTokenName, TokenNumber)) + + EdkLogger.debug(EdkLogger.DEBUG_3, "Creating code for " + Pcd.TokenCName + "." + Pcd.TokenSpaceGuidCName) + if Pcd.Type not in gItemTypeStringDatabase: + EdkLogger.error("build", AUTOGEN_ERROR, + "Unknown PCD type [%s] of PCD %s.%s" % (Pcd.Type, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + if Pcd.DatumType not in gDatumSizeStringDatabase: + EdkLogger.error("build", AUTOGEN_ERROR, + "Unknown datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + + DatumSize = gDatumSizeStringDatabase[Pcd.DatumType] + DatumSizeLib = gDatumSizeStringDatabaseLib[Pcd.DatumType] + GetModeName = '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + Pcd.TokenCName + SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + Pcd.TokenCName + + PcdExCNameList = [] + if Pcd.Type in gDynamicExPcd: + if Info.IsLibrary: + PcdList = Info.LibraryPcdList + else: + PcdList = Info.ModulePcdList + for PcdModule in PcdList: + if PcdModule.Type in gDynamicExPcd: + PcdExCNameList.append(PcdModule.TokenCName) + # Be compatible with the current code which using PcdToken and PcdGet/Set for DynamicEx Pcd. + # If only PcdToken and PcdGet/Set used in all Pcds with different CName, it should succeed to build. + # If PcdToken and PcdGet/Set used in the Pcds with different Guids but same CName, it should failed to build. + if PcdExCNameList.count(Pcd.TokenCName) > 1: + AutoGenH.Append('// Disabled the macros, as PcdToken and PcdGet/Set are not allowed in the case that more than one DynamicEx Pcds are different Guids but same CName.\n') + AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTokenName)) + AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + if Pcd.DatumType == 'VOID*': + AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + else: + AutoGenH.Append('// #define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + else: + AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExTokenName)) + AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + if Pcd.DatumType == 'VOID*': + AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + else: + AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + elif Pcd.Type in gDynamicPcd: + AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName, DatumSizeLib, PcdTokenName)) + if Pcd.DatumType == 'VOID*': + AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdTokenName)) + else: + AutoGenH.Append('#define %s(Value) LibPcdSet%s(%s, (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName)) + else: + PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_' + Pcd.TokenCName + Const = 'const' + if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: + Const = '' + Type = '' + Array = '' + Value = Pcd.DefaultValue + Unicode = False + ValueNumber = 0 + + if Pcd.DatumType == 'BOOLEAN': + BoolValue = Value.upper() + if BoolValue == 'TRUE' or BoolValue == '1': + Value = '1U' + elif BoolValue == 'FALSE' or BoolValue == '0': + Value = '0U' + + if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']: + try: + if Value.upper().startswith('0X'): + ValueNumber = int (Value, 16) + else: + ValueNumber = int (Value) + except: + EdkLogger.error("build", AUTOGEN_ERROR, + "PCD value is not valid dec or hex number for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + if Pcd.DatumType == 'UINT64': + if ValueNumber < 0: + EdkLogger.error("build", AUTOGEN_ERROR, + "PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + elif ValueNumber >= 0x10000000000000000: + EdkLogger.error("build", AUTOGEN_ERROR, + "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + if not Value.endswith('ULL'): + Value += 'ULL' + elif Pcd.DatumType == 'UINT32': + if ValueNumber < 0: + EdkLogger.error("build", AUTOGEN_ERROR, + "PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + elif ValueNumber >= 0x100000000: + EdkLogger.error("build", AUTOGEN_ERROR, + "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + if not Value.endswith('U'): + Value += 'U' + elif Pcd.DatumType == 'UINT16': + if ValueNumber < 0: + EdkLogger.error("build", AUTOGEN_ERROR, + "PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + elif ValueNumber >= 0x10000: + EdkLogger.error("build", AUTOGEN_ERROR, + "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + if not Value.endswith('U'): + Value += 'U' + elif Pcd.DatumType == 'UINT8': + if ValueNumber < 0: + EdkLogger.error("build", AUTOGEN_ERROR, + "PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + elif ValueNumber >= 0x100: + EdkLogger.error("build", AUTOGEN_ERROR, + "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + if not Value.endswith('U'): + Value += 'U' + if Pcd.DatumType == 'VOID*': + if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '': + EdkLogger.error("build", AUTOGEN_ERROR, + "Unknown [MaxDatumSize] of PCD [%s.%s]" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + + ArraySize = int(Pcd.MaxDatumSize, 0) + if Value[0] == '{': + Type = '(VOID *)' + else: + if Value[0] == 'L': + Unicode = True + Value = Value.lstrip('L') #.strip('"') + Value = eval(Value) # translate escape character + NewValue = '{' + for Index in range(0,len(Value)): + if Unicode: + NewValue = NewValue + str(ord(Value[Index]) % 0x10000) + ', ' + else: + NewValue = NewValue + str(ord(Value[Index]) % 0x100) + ', ' + if Unicode: + ArraySize = ArraySize / 2; + + if ArraySize < (len(Value) + 1): + EdkLogger.error("build", AUTOGEN_ERROR, + "The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + Value = NewValue + '0 }' + Array = '[%d]' % ArraySize + # + # skip casting for fixed at build since it breaks ARM assembly. + # Long term we need PCD macros that work in assembly + # + elif Pcd.Type != TAB_PCDS_FIXED_AT_BUILD: + Value = "((%s)%s)" % (Pcd.DatumType, Value) + + if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: + PcdValueName = '_PCD_PATCHABLE_VALUE_' + Pcd.TokenCName + else: + PcdValueName = '_PCD_VALUE_' + Pcd.TokenCName + + if Pcd.DatumType == 'VOID*': + # + # For unicode, UINT16 array will be generated, so the alignment of unicode is guaranteed. + # + if Unicode: + AutoGenH.Append('#define _PCD_PATCHABLE_%s_SIZE %s\n' % (Pcd.TokenCName, Pcd.MaxDatumSize)) + AutoGenH.Append('#define %s %s%s\n' %(PcdValueName, Type, PcdVariableName)) + AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s UINT16 %s%s = %s;\n' % (Const, PcdVariableName, Array, Value)) + AutoGenH.Append('extern %s UINT16 %s%s;\n' %(Const, PcdVariableName, Array)) + AutoGenH.Append('#define %s %s%s\n' %(GetModeName, Type, PcdVariableName)) + else: + AutoGenH.Append('#define _PCD_PATCHABLE_%s_SIZE %s\n' % (Pcd.TokenCName, Pcd.MaxDatumSize)) + AutoGenH.Append('#define %s %s%s\n' %(PcdValueName, Type, PcdVariableName)) + AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s UINT8 %s%s = %s;\n' % (Const, PcdVariableName, Array, Value)) + AutoGenH.Append('extern %s UINT8 %s%s;\n' %(Const, PcdVariableName, Array)) + AutoGenH.Append('#define %s %s%s\n' %(GetModeName, Type, PcdVariableName)) + elif Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: + AutoGenH.Append('#define %s %s\n' %(PcdValueName, Value)) + AutoGenC.Append('volatile %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName)) + AutoGenH.Append('extern volatile %s %s %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array)) + AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, PcdVariableName)) + else: + AutoGenH.Append('#define %s %s\n' %(PcdValueName, Value)) + AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName)) + AutoGenH.Append('extern %s %s %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array)) + AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, PcdVariableName)) + + if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: + if Pcd.DatumType == 'VOID*': + AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtr(_gPcd_BinaryPatch_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeName, Pcd.TokenCName, Pcd.TokenCName)) + else: + AutoGenH.Append('#define %s(Value) (%s = (Value))\n' % (SetModeName, PcdVariableName)) + else: + AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName) + +## Create code for library module PCDs +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# @param Pcd The PCD object +# +def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd): + PcdTokenNumber = Info.PlatformInfo.PcdTokenNumber + TokenSpaceGuidCName = Pcd.TokenSpaceGuidCName + TokenCName = Pcd.TokenCName + PcdTokenName = '_PCD_TOKEN_' + TokenCName + # + # Write PCDs + # + if Pcd.Type in gDynamicExPcd: + TokenNumber = int(Pcd.TokenValue, 0) + else: + if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber: + # If one of the Source built modules listed in the DSC is not listed in FDF modules, + # and the INF lists a PCD can only use the PcdsDynamic access method (it is only + # listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will + # report warning message notify the PI that they are attempting to build a module + # that must be included in a flash image in order to be functional. These Dynamic PCD + # will not be added into the Database unless it is used by other modules that are + # included in the FDF file. + # In this case, just assign an invalid token number to make it pass build. + if Pcd.Type in PCD_DYNAMIC_TYPE_LIST: + TokenNumber = 0 + else: + EdkLogger.error("build", AUTOGEN_ERROR, + "No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + else: + TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] + + if Pcd.Type not in gItemTypeStringDatabase: + EdkLogger.error("build", AUTOGEN_ERROR, + "Unknown PCD type [%s] of PCD %s.%s" % (Pcd.Type, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + if Pcd.DatumType not in gDatumSizeStringDatabase: + EdkLogger.error("build", AUTOGEN_ERROR, + "Unknown datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), + ExtraData="[%s]" % str(Info)) + + DatumType = Pcd.DatumType + DatumSize = gDatumSizeStringDatabaseH[DatumType] + DatumSizeLib= gDatumSizeStringDatabaseLib[DatumType] + GetModeName = '_PCD_GET_MODE_' + DatumSize + '_' + TokenCName + SetModeName = '_PCD_SET_MODE_' + DatumSize + '_' + TokenCName + + Type = '' + Array = '' + if Pcd.DatumType == 'VOID*': + Type = '(VOID *)' + Array = '[]' + PcdItemType = Pcd.Type + PcdExCNameList = [] + if PcdItemType in gDynamicExPcd: + PcdExTokenName = '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + Pcd.TokenCName + AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumber)) + + if Info.IsLibrary: + PcdList = Info.LibraryPcdList + else: + PcdList = Info.ModulePcdList + for PcdModule in PcdList: + if PcdModule.Type in gDynamicExPcd: + PcdExCNameList.append(PcdModule.TokenCName) + # Be compatible with the current code which using PcdGet/Set for DynamicEx Pcd. + # If only PcdGet/Set used in all Pcds with different CName, it should succeed to build. + # If PcdGet/Set used in the Pcds with different Guids but same CName, it should failed to build. + if PcdExCNameList.count(Pcd.TokenCName) > 1: + AutoGenH.Append('// Disabled the macros, as PcdToken and PcdGet/Set are not allowed in the case that more than one DynamicEx Pcds are different Guids but same CName.\n') + AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTokenName)) + AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + if Pcd.DatumType == 'VOID*': + AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + else: + AutoGenH.Append('// #define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + else: + AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExTokenName)) + AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + if Pcd.DatumType == 'VOID*': + AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + else: + AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s, (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) + else: + AutoGenH.Append('#define _PCD_TOKEN_%s %dU\n' % (TokenCName, TokenNumber)) + if PcdItemType in gDynamicPcd: + AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName, DatumSizeLib, PcdTokenName)) + if DatumType == 'VOID*': + AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdTokenName)) + else: + AutoGenH.Append('#define %s(Value) LibPcdSet%s(%s, (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName)) + if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE: + PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName + AutoGenH.Append('extern volatile %s _gPcd_BinaryPatch_%s%s;\n' %(DatumType, TokenCName, Array) ) + AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeName, Type, TokenCName)) + AutoGenH.Append('#define %s(Value) (%s = (Value))\n' % (SetModeName, PcdVariableName)) + if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG: + key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName)) + + AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array)) + AutoGenH.Append('#define %s %s_gPcd_FixedAtBuild_%s\n' %(GetModeName, Type, TokenCName)) + AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName) + + if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and key in Info.ConstPcd: + AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue)) + + + +## Create code for library constructor +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# +def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH): + # + # Library Constructors + # + ConstructorPrototypeString = TemplateString() + ConstructorCallingString = TemplateString() + if Info.IsLibrary: + DependentLibraryList = [Info.Module] + else: + DependentLibraryList = Info.DependentLibraryList + for Lib in DependentLibraryList: + if len(Lib.ConstructorList) <= 0: + continue + Dict = {'Function':Lib.ConstructorList} + if Lib.ModuleType in ['BASE', 'SEC']: + ConstructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict)) + ConstructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict)) + elif Lib.ModuleType in ['PEI_CORE','PEIM']: + ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict)) + ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict)) + elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', + 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: + ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict)) + ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict)) + + if str(ConstructorPrototypeString) == '': + ConstructorPrototypeList = [] + else: + ConstructorPrototypeList = [str(ConstructorPrototypeString)] + if str(ConstructorCallingString) == '': + ConstructorCallingList = [] + else: + ConstructorCallingList = [str(ConstructorCallingString)] + + Dict = { + 'Type' : 'Constructor', + 'FunctionPrototype' : ConstructorPrototypeList, + 'FunctionCall' : ConstructorCallingList + } + if Info.IsLibrary: + AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) + else: + if Info.ModuleType in ['BASE', 'SEC']: + AutoGenC.Append(gLibraryString['BASE'].Replace(Dict)) + elif Info.ModuleType in ['PEI_CORE','PEIM']: + AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) + elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', + 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: + AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) + +## Create code for library destructor +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# +def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH): + # + # Library Destructors + # + DestructorPrototypeString = TemplateString() + DestructorCallingString = TemplateString() + if Info.IsLibrary: + DependentLibraryList = [Info.Module] + else: + DependentLibraryList = Info.DependentLibraryList + for Index in range(len(DependentLibraryList)-1, -1, -1): + Lib = DependentLibraryList[Index] + if len(Lib.DestructorList) <= 0: + continue + Dict = {'Function':Lib.DestructorList} + if Lib.ModuleType in ['BASE', 'SEC']: + DestructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict)) + DestructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict)) + elif Lib.ModuleType in ['PEI_CORE','PEIM']: + DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict)) + DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict)) + elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', + 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_CORE']: + DestructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict)) + DestructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict)) + + if str(DestructorPrototypeString) == '': + DestructorPrototypeList = [] + else: + DestructorPrototypeList = [str(DestructorPrototypeString)] + if str(DestructorCallingString) == '': + DestructorCallingList = [] + else: + DestructorCallingList = [str(DestructorCallingString)] + + Dict = { + 'Type' : 'Destructor', + 'FunctionPrototype' : DestructorPrototypeList, + 'FunctionCall' : DestructorCallingList + } + if Info.IsLibrary: + AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) + else: + if Info.ModuleType in ['BASE', 'SEC']: + AutoGenC.Append(gLibraryString['BASE'].Replace(Dict)) + elif Info.ModuleType in ['PEI_CORE','PEIM']: + AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) + elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER', + 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']: + AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) + + +## Create code for ModuleEntryPoint +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# +def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): + if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']: + return + # + # Module Entry Points + # + NumEntryPoints = len(Info.Module.ModuleEntryPointList) + if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification: + PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION'] + else: + PiSpecVersion = '0x00000000' + if 'UEFI_SPECIFICATION_VERSION' in Info.Module.Specification: + UefiSpecVersion = Info.Module.Specification['UEFI_SPECIFICATION_VERSION'] + else: + UefiSpecVersion = '0x00000000' + Dict = { + 'Function' : Info.Module.ModuleEntryPointList, + 'PiSpecVersion' : PiSpecVersion + 'U', + 'UefiSpecVersion': UefiSpecVersion + 'U' + } + + if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE']: + if Info.SourceFileList <> None and Info.SourceFileList <> []: + if NumEntryPoints != 1: + EdkLogger.error( + "build", + AUTOGEN_ERROR, + '%s must have exactly one entry point' % Info.ModuleType, + File=str(Info), + ExtraData= ", ".join(Info.Module.ModuleEntryPointList) + ) + if Info.ModuleType == 'PEI_CORE': + AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict)) + AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict)) + elif Info.ModuleType == 'DXE_CORE': + AutoGenC.Append(gDxeCoreEntryPointString.Replace(Dict)) + AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict)) + elif Info.ModuleType == 'SMM_CORE': + AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict)) + AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict)) + elif Info.ModuleType == 'PEIM': + if NumEntryPoints < 2: + AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(Dict)) + else: + AutoGenC.Append(gPeimEntryPointString[2].Replace(Dict)) + AutoGenH.Append(gPeimEntryPointPrototype.Replace(Dict)) + elif Info.ModuleType in ['DXE_RUNTIME_DRIVER','DXE_DRIVER','DXE_SAL_DRIVER','UEFI_DRIVER']: + if NumEntryPoints < 2: + AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Replace(Dict)) + else: + AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict)) + AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict)) + elif Info.ModuleType == 'DXE_SMM_DRIVER': + if NumEntryPoints == 0: + AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict)) + else: + AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict)) + AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict)) + elif Info.ModuleType == 'UEFI_APPLICATION': + if NumEntryPoints < 2: + AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(Dict)) + else: + AutoGenC.Append(gUefiApplicationEntryPointString[2].Replace(Dict)) + AutoGenH.Append(gUefiApplicationEntryPointPrototype.Replace(Dict)) + +## Create code for ModuleUnloadImage +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# +def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): + if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']: + return + # + # Unload Image Handlers + # + NumUnloadImage = len(Info.Module.ModuleUnloadImageList) + Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':Info.Module.ModuleUnloadImageList} + if NumUnloadImage < 2: + AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dict)) + else: + AutoGenC.Append(gUefiUnloadImageString[2].Replace(Dict)) + AutoGenH.Append(gUefiUnloadImagePrototype.Replace(Dict)) + +## Create code for GUID +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# +def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH): + if Info.IsLibrary: + return + + if Info.ModuleType in ["USER_DEFINED", "BASE"]: + GuidType = "GUID" + else: + GuidType = "EFI_GUID" + + if Info.GuidList: + AutoGenC.Append("\n// Guids\n") + # + # GUIDs + # + for Key in Info.GuidList: + AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key])) + +## Create code for protocol +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# +def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH): + if Info.IsLibrary: + return + + if Info.ModuleType in ["USER_DEFINED", "BASE"]: + GuidType = "GUID" + else: + GuidType = "EFI_GUID" + + if Info.ProtocolList: + AutoGenC.Append("\n// Protocols\n") + # + # Protocol GUIDs + # + for Key in Info.ProtocolList: + AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key])) + +## Create code for PPI +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# +def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH): + if Info.IsLibrary: + return + + if Info.ModuleType in ["USER_DEFINED", "BASE"]: + GuidType = "GUID" + else: + GuidType = "EFI_GUID" + + if Info.PpiList: + AutoGenC.Append("\n// PPIs\n") + # + # PPI GUIDs + # + for Key in Info.PpiList: + AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key])) + +## Create code for PCD +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# +def CreatePcdCode(Info, AutoGenC, AutoGenH): + + # Collect Token Space GUIDs used by DynamicEc PCDs + TokenSpaceList = [] + for Pcd in Info.ModulePcdList: + if Pcd.Type in gDynamicExPcd and Pcd.TokenSpaceGuidCName not in TokenSpaceList: + TokenSpaceList += [Pcd.TokenSpaceGuidCName] + + # Add extern declarations to AutoGen.h if one or more Token Space GUIDs were found + if TokenSpaceList <> []: + AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in this module\n\n") + if Info.ModuleType in ["USER_DEFINED", "BASE"]: + GuidType = "GUID" + else: + GuidType = "EFI_GUID" + for Item in TokenSpaceList: + AutoGenH.Append('extern %s %s;\n' % (GuidType, Item)) + + if Info.IsLibrary: + if Info.ModulePcdList: + AutoGenH.Append("\n// PCD definitions\n") + for Pcd in Info.ModulePcdList: + CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd) + DynExPcdTokenNumberMapping (Info, AutoGenH) + else: + if Info.ModulePcdList: + AutoGenH.Append("\n// Definition of PCDs used in this module\n") + AutoGenC.Append("\n// Definition of PCDs used in this module\n") + for Pcd in Info.ModulePcdList: + CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd) + DynExPcdTokenNumberMapping (Info, AutoGenH) + if Info.LibraryPcdList: + AutoGenH.Append("\n// Definition of PCDs used in libraries is in AutoGen.c\n") + AutoGenC.Append("\n// Definition of PCDs used in libraries\n") + for Pcd in Info.LibraryPcdList: + CreateModulePcdCode(Info, AutoGenC, AutoGenC, Pcd) + CreatePcdDatabaseCode(Info, AutoGenC, AutoGenH) + +## Create code for unicode string definition +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True +# @param UniGenBinBuffer Buffer to store uni string package data +# +def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH, UniGenCFlag, UniGenBinBuffer): + WorkingDir = os.getcwd() + os.chdir(Info.WorkspaceDir) + + IncList = [Info.MetaFile.Dir] + # Get all files under [Sources] section in inf file for EDK-II module + EDK2Module = True + SrcList = [F for F in Info.SourceFileList] + if Info.AutoGenVersion < 0x00010005: + EDK2Module = False + # Get all files under the module directory for EDK-I module + Cwd = os.getcwd() + os.chdir(Info.MetaFile.Dir) + for Root, Dirs, Files in os.walk("."): + if 'CVS' in Dirs: + Dirs.remove('CVS') + if '.svn' in Dirs: + Dirs.remove('.svn') + for File in Files: + File = PathClass(os.path.join(Root, File), Info.MetaFile.Dir) + if File in SrcList: + continue + SrcList.append(File) + os.chdir(Cwd) + + if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-c') > -1: + CompatibleMode = True + else: + CompatibleMode = False + + # + # -s is a temporary option dedicated for building .UNI files with ISO 639-2 language codes of EDK Shell in EDK2 + # + if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-s') > -1: + if CompatibleMode: + EdkLogger.error("build", AUTOGEN_ERROR, + "-c and -s build options should be used exclusively", + ExtraData="[%s]" % str(Info)) + ShellMode = True + else: + ShellMode = False + + #RFC4646 is only for EDKII modules and ISO639-2 for EDK modules + if EDK2Module: + FilterInfo = [EDK2Module] + [Info.PlatformInfo.Platform.RFCLanguages] + else: + FilterInfo = [EDK2Module] + [Info.PlatformInfo.Platform.ISOLanguages] + Header, Code = GetStringFiles(Info.UnicodeFileList, SrcList, IncList, Info.IncludePathList, ['.uni', '.inf'], Info.Name, CompatibleMode, ShellMode, UniGenCFlag, UniGenBinBuffer, FilterInfo) + if CompatibleMode or UniGenCFlag: + AutoGenC.Append("\n//\n//Unicode String Pack Definition\n//\n") + AutoGenC.Append(Code) + AutoGenC.Append("\n") + AutoGenH.Append("\n//\n//Unicode String ID\n//\n") + AutoGenH.Append(Header) + if CompatibleMode or UniGenCFlag: + AutoGenH.Append("\n#define STRING_ARRAY_NAME %sStrings\n" % Info.Name) + os.chdir(WorkingDir) + +## Create common code +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# +def CreateHeaderCode(Info, AutoGenC, AutoGenH): + # file header + AutoGenH.Append(gAutoGenHeaderString.Replace({'FileName':'AutoGen.h'})) + # header file Prologue + AutoGenH.Append(gAutoGenHPrologueString.Replace({'File':'AUTOGENH','Guid':Info.Guid.replace('-','_')})) + AutoGenH.Append(gAutoGenHCppPrologueString) + if Info.AutoGenVersion >= 0x00010005: + # header files includes + AutoGenH.Append("#include <%s>\n" % gBasicHeaderFile) + if Info.ModuleType in gModuleTypeHeaderFile \ + and gModuleTypeHeaderFile[Info.ModuleType][0] != gBasicHeaderFile: + AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0]) + # + # if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h + # As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section. + # + if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds: + AutoGenH.Append("#include \n") + + AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;') + AutoGenH.Append('\nextern CHAR8 *gEfiCallerBaseName;\n\n') + + if Info.IsLibrary: + return + + AutoGenH.Append("#define EFI_CALLER_ID_GUID \\\n %s\n" % GuidStringToGuidStructureString(Info.Guid)) + + if Info.IsLibrary: + return + # C file header + AutoGenC.Append(gAutoGenHeaderString.Replace({'FileName':'AutoGen.c'})) + if Info.AutoGenVersion >= 0x00010005: + # C file header files includes + if Info.ModuleType in gModuleTypeHeaderFile: + for Inc in gModuleTypeHeaderFile[Info.ModuleType]: + AutoGenC.Append("#include <%s>\n" % Inc) + else: + AutoGenC.Append("#include <%s>\n" % gBasicHeaderFile) + + # + # Publish the CallerId Guid + # + AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = %s;\n' % GuidStringToGuidStructureString(Info.Guid)) + AutoGenC.Append('\nGLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "%s";\n' % Info.Name) + +## Create common code for header file +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# +def CreateFooterCode(Info, AutoGenC, AutoGenH): + AutoGenH.Append(gAutoGenHEpilogueString) + +## Create code for a module +# +# @param Info The ModuleAutoGen object +# @param AutoGenC The TemplateString object for C code +# @param AutoGenH The TemplateString object for header file +# @param UniGenCFlag UniString is generated into AutoGen C file when it is set to True +# @param UniGenBinBuffer Buffer to store uni string package data +# +def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer): + CreateHeaderCode(Info, AutoGenC, AutoGenH) + + if Info.AutoGenVersion >= 0x00010005: + CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH) + CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH) + CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH) + CreatePcdCode(Info, AutoGenC, AutoGenH) + CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH) + CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH) + CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH) + CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH) + + if Info.UnicodeFileList: + FileName = "%sStrDefs.h" % Info.Name + StringH.Append(gAutoGenHeaderString.Replace({'FileName':FileName})) + StringH.Append(gAutoGenHPrologueString.Replace({'File':'STRDEFS', 'Guid':Info.Guid.replace('-','_')})) + CreateUnicodeStringCode(Info, AutoGenC, StringH, UniGenCFlag, UniGenBinBuffer) + StringH.Append("\n#endif\n") + AutoGenH.Append('#include "%s"\n' % FileName) + + CreateFooterCode(Info, AutoGenC, AutoGenH) + + # no generation of AutoGen.c for Edk modules without unicode file + if Info.AutoGenVersion < 0x00010005 and len(Info.UnicodeFileList) == 0: + AutoGenC.String = '' + +## Create the code file +# +# @param FilePath The path of code file +# @param Content The content of code file +# @param IsBinaryFile The flag indicating if the file is binary file or not +# +# @retval True If file content is changed or file doesn't exist +# @retval False If the file exists and the content is not changed +# +def Generate(FilePath, Content, IsBinaryFile): + return SaveFileOnChange(FilePath, Content, IsBinaryFile) + diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index b2ebff324d..00d0af0cb7 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1,1411 +1,1411 @@ -## @file -# Create makefile for MS nmake and GNU make -# -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## Import Modules -# -import os -import sys -import string -import re -import os.path as path - -from Common.BuildToolError import * -from Common.Misc import * -from Common.String import * -from BuildEngine import * -import Common.GlobalData as GlobalData - -## Regular expression for finding header file inclusions -gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE|re.UNICODE|re.IGNORECASE) - -## Regular expression for matching macro used in header file inclusion -gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE) - -gIsFileMap = {} - -## pattern for include style in Edk.x code -gProtocolDefinition = "Protocol/%(HeaderKey)s/%(HeaderKey)s.h" -gGuidDefinition = "Guid/%(HeaderKey)s/%(HeaderKey)s.h" -gArchProtocolDefinition = "ArchProtocol/%(HeaderKey)s/%(HeaderKey)s.h" -gPpiDefinition = "Ppi/%(HeaderKey)s/%(HeaderKey)s.h" -gIncludeMacroConversion = { - "EFI_PROTOCOL_DEFINITION" : gProtocolDefinition, - "EFI_GUID_DEFINITION" : gGuidDefinition, - "EFI_ARCH_PROTOCOL_DEFINITION" : gArchProtocolDefinition, - "EFI_PROTOCOL_PRODUCER" : gProtocolDefinition, - "EFI_PROTOCOL_CONSUMER" : gProtocolDefinition, - "EFI_PROTOCOL_DEPENDENCY" : gProtocolDefinition, - "EFI_ARCH_PROTOCOL_PRODUCER" : gArchProtocolDefinition, - "EFI_ARCH_PROTOCOL_CONSUMER" : gArchProtocolDefinition, - "EFI_ARCH_PROTOCOL_DEPENDENCY" : gArchProtocolDefinition, - "EFI_PPI_DEFINITION" : gPpiDefinition, - "EFI_PPI_PRODUCER" : gPpiDefinition, - "EFI_PPI_CONSUMER" : gPpiDefinition, - "EFI_PPI_DEPENDENCY" : gPpiDefinition, -} - -## default makefile type -gMakeType = "" -if sys.platform == "win32": - gMakeType = "nmake" -else: - gMakeType = "gmake" - - -## BuildFile class -# -# This base class encapsules build file and its generation. It uses template to generate -# the content of build file. The content of build file will be got from AutoGen objects. -# -class BuildFile(object): - ## template used to generate the build file (i.e. makefile if using make) - _TEMPLATE_ = TemplateString('') - - _DEFAULT_FILE_NAME_ = "Makefile" - - ## default file name for each type of build file - _FILE_NAME_ = { - "nmake" : "Makefile", - "gmake" : "GNUmakefile" - } - - ## Fixed header string for makefile - _MAKEFILE_HEADER = '''# -# DO NOT EDIT -# This file is auto-generated by build utility -# -# Module Name: -# -# %s -# -# Abstract: -# -# Auto-generated makefile for building modules, libraries or platform -# - ''' - - ## Header string for each type of build file - _FILE_HEADER_ = { - "nmake" : _MAKEFILE_HEADER % _FILE_NAME_["nmake"], - "gmake" : _MAKEFILE_HEADER % _FILE_NAME_["gmake"] - } - - ## shell commands which can be used in build file in the form of macro - # $(CP) copy file command - # $(MV) move file command - # $(RM) remove file command - # $(MD) create dir command - # $(RD) remove dir command - # - _SHELL_CMD_ = { - "nmake" : { - "CP" : "copy /y", - "MV" : "move /y", - "RM" : "del /f /q", - "MD" : "mkdir", - "RD" : "rmdir /s /q", - }, - - "gmake" : { - "CP" : "cp -f", - "MV" : "mv -f", - "RM" : "rm -f", - "MD" : "mkdir -p", - "RD" : "rm -r -f", - } - } - - ## directory separator - _SEP_ = { - "nmake" : "\\", - "gmake" : "/" - } - - ## directory creation template - _MD_TEMPLATE_ = { - "nmake" : 'if not exist %(dir)s $(MD) %(dir)s', - "gmake" : "$(MD) %(dir)s" - } - - ## directory removal template - _RD_TEMPLATE_ = { - "nmake" : 'if exist %(dir)s $(RD) %(dir)s', - "gmake" : "$(RD) %(dir)s" - } - - _CD_TEMPLATE_ = { - "nmake" : 'if exist %(dir)s cd %(dir)s', - "gmake" : "test -e %(dir)s && cd %(dir)s" - } - - _MAKE_TEMPLATE_ = { - "nmake" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)s', - "gmake" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(file)s' - } - - _INCLUDE_CMD_ = { - "nmake" : '!INCLUDE', - "gmake" : "include" - } - - _INC_FLAG_ = {"MSFT" : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"} - - ## Constructor of BuildFile - # - # @param AutoGenObject Object of AutoGen class - # - def __init__(self, AutoGenObject): - self._AutoGenObject = AutoGenObject - self._FileType = gMakeType - - ## Create build file - # - # @param FileType Type of build file. Only nmake and gmake are supported now. - # - # @retval TRUE The build file is created or re-created successfully - # @retval FALSE The build file exists and is the same as the one to be generated - # - def Generate(self, FileType=gMakeType): - if FileType not in self._FILE_NAME_: - EdkLogger.error("build", PARAMETER_INVALID, "Invalid build type [%s]" % FileType, - ExtraData="[%s]" % str(self._AutoGenObject)) - self._FileType = FileType - FileContent = self._TEMPLATE_.Replace(self._TemplateDict) - FileName = self._FILE_NAME_[FileType] - return SaveFileOnChange(os.path.join(self._AutoGenObject.MakeFileDir, FileName), FileContent, False) - - ## Return a list of directory creation command string - # - # @param DirList The list of directory to be created - # - # @retval list The directory creation command list - # - def GetCreateDirectoryCommand(self, DirList): - return [self._MD_TEMPLATE_[self._FileType] % {'dir':Dir} for Dir in DirList] - - ## Return a list of directory removal command string - # - # @param DirList The list of directory to be removed - # - # @retval list The directory removal command list - # - def GetRemoveDirectoryCommand(self, DirList): - return [self._RD_TEMPLATE_[self._FileType] % {'dir':Dir} for Dir in DirList] - - def PlaceMacro(self, Path, MacroDefinitions={}): - if Path.startswith("$("): - return Path - else: - PathLength = len(Path) - for MacroName in MacroDefinitions: - MacroValue = MacroDefinitions[MacroName] - MacroValueLength = len(MacroValue) - if MacroValueLength <= PathLength and Path.startswith(MacroValue): - Path = "$(%s)%s" % (MacroName, Path[MacroValueLength:]) - break - return Path - -## ModuleMakefile class -# -# This class encapsules makefie and its generation for module. It uses template to generate -# the content of makefile. The content of makefile will be got from ModuleAutoGen object. -# -class ModuleMakefile(BuildFile): - ## template used to generate the makefile for module - _TEMPLATE_ = TemplateString('''\ -${makefile_header} - -# -# Platform Macro Definition -# -PLATFORM_NAME = ${platform_name} -PLATFORM_GUID = ${platform_guid} -PLATFORM_VERSION = ${platform_version} -PLATFORM_RELATIVE_DIR = ${platform_relative_directory} -PLATFORM_DIR = $(WORKSPACE)${separator}${platform_relative_directory} -PLATFORM_OUTPUT_DIR = ${platform_output_directory} - -# -# Module Macro Definition -# -MODULE_NAME = ${module_name} -MODULE_GUID = ${module_guid} -MODULE_VERSION = ${module_version} -MODULE_TYPE = ${module_type} -MODULE_FILE = ${module_file} -MODULE_FILE_BASE_NAME = ${module_file_base_name} -BASE_NAME = $(MODULE_NAME) -MODULE_RELATIVE_DIR = ${module_relative_directory} -MODULE_DIR = $(WORKSPACE)${separator}${module_relative_directory} - -MODULE_ENTRY_POINT = ${module_entry_point} -ARCH_ENTRY_POINT = ${arch_entry_point} -IMAGE_ENTRY_POINT = ${image_entry_point} - -${BEGIN}${module_extra_defines} -${END} -# -# Build Configuration Macro Definition -# -ARCH = ${architecture} -TOOLCHAIN = ${toolchain_tag} -TOOLCHAIN_TAG = ${toolchain_tag} -TARGET = ${build_target} - -# -# Build Directory Macro Definition -# -# PLATFORM_BUILD_DIR = ${platform_build_directory} -BUILD_DIR = ${platform_build_directory} -BIN_DIR = $(BUILD_DIR)${separator}${architecture} -LIB_DIR = $(BIN_DIR) -MODULE_BUILD_DIR = ${module_build_directory} -OUTPUT_DIR = ${module_output_directory} -DEBUG_DIR = ${module_debug_directory} -DEST_DIR_OUTPUT = $(OUTPUT_DIR) -DEST_DIR_DEBUG = $(DEBUG_DIR) - -# -# Shell Command Macro -# -${BEGIN}${shell_command_code} = ${shell_command} -${END} - -# -# Tools definitions specific to this module -# -${BEGIN}${module_tool_definitions} -${END} -MAKE_FILE = ${makefile_path} - -# -# Build Macro -# -${BEGIN}${file_macro} -${END} - -COMMON_DEPS = ${BEGIN}${common_dependency_file} \\ - ${END} - -# -# Overridable Target Macro Definitions -# -FORCE_REBUILD = force_build -INIT_TARGET = init -PCH_TARGET = -BC_TARGET = ${BEGIN}${backward_compatible_target} ${END} -CODA_TARGET = ${BEGIN}${remaining_build_target} \\ - ${END} - -# -# Default target, which will build dependent libraries in addition to source files -# - -all: mbuild - - -# -# Target used when called from platform makefile, which will bypass the build of dependent libraries -# - -pbuild: $(INIT_TARGET) $(BC_TARGET) $(PCH_TARGET) $(CODA_TARGET) - -# -# ModuleTarget -# - -mbuild: $(INIT_TARGET) $(BC_TARGET) gen_libs $(PCH_TARGET) $(CODA_TARGET) - -# -# Build Target used in multi-thread build mode, which will bypass the init and gen_libs targets -# - -tbuild: $(BC_TARGET) $(PCH_TARGET) $(CODA_TARGET) - -# -# Phony target which is used to force executing commands for a target -# -force_build: -\t-@ - -# -# Target to update the FD -# - -fds: mbuild gen_fds - -# -# Initialization target: print build information and create necessary directories -# -init: info dirs - -info: -\t-@echo Building ... $(MODULE_DIR)${separator}$(MODULE_FILE) [$(ARCH)] - -dirs: -${BEGIN}\t-@${create_directory_command}\n${END} - -strdefs: -\t-@$(CP) $(DEBUG_DIR)${separator}AutoGen.h $(DEBUG_DIR)${separator}$(MODULE_NAME)StrDefs.h - -# -# GenLibsTarget -# -gen_libs: -\t${BEGIN}@"$(MAKE)" $(MAKE_FLAGS) -f ${dependent_library_build_directory}${separator}${makefile_name} -\t${END}@cd $(MODULE_BUILD_DIR) - -# -# Build Flash Device Image -# -gen_fds: -\t@"$(MAKE)" $(MAKE_FLAGS) -f $(BUILD_DIR)${separator}${makefile_name} fds -\t@cd $(MODULE_BUILD_DIR) - -# -# Individual Object Build Targets -# -${BEGIN}${file_build_target} -${END} - -# -# clean all intermediate files -# -clean: -\t${BEGIN}${clean_command} -\t${END} - -# -# clean all generated files -# -cleanall: -${BEGIN}\t${cleanall_command} -${END}\t$(RM) *.pdb *.idb > NUL 2>&1 -\t$(RM) $(BIN_DIR)${separator}$(MODULE_NAME).efi - -# -# clean all dependent libraries built -# -cleanlib: -\t${BEGIN}-@${library_build_command} cleanall -\t${END}@cd $(MODULE_BUILD_DIR)\n\n''') - - _FILE_MACRO_TEMPLATE = TemplateString("${macro_name} = ${BEGIN} \\\n ${source_file}${END}\n") - _BUILD_TARGET_TEMPLATE = TemplateString("${BEGIN}${target} : ${deps}\n${END}\t${cmd}\n") - - ## Constructor of ModuleMakefile - # - # @param ModuleAutoGen Object of ModuleAutoGen class - # - def __init__(self, ModuleAutoGen): - BuildFile.__init__(self, ModuleAutoGen) - self.PlatformInfo = self._AutoGenObject.PlatformInfo - - self.ResultFileList = [] - self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"] - - self.SourceFileDatabase = {} # {file type : file path} - self.DestFileDatabase = {} # {file type : file path} - self.FileBuildTargetList = [] # [(src, target string)] - self.BuildTargetList = [] # [target string] - self.PendingBuildTargetList = [] # [FileBuildRule objects] - self.CommonFileDependency = [] - self.FileListMacros = {} - self.ListFileMacros = {} - - self.FileCache = {} - self.FileDependency = [] - self.LibraryBuildCommandList = [] - self.LibraryFileList = [] - self.LibraryMakefileList = [] - self.LibraryBuildDirectoryList = [] - self.SystemLibraryList = [] - self.Macros = sdict() - self.Macros["OUTPUT_DIR" ] = self._AutoGenObject.Macros["OUTPUT_DIR"] - self.Macros["DEBUG_DIR" ] = self._AutoGenObject.Macros["DEBUG_DIR"] - self.Macros["MODULE_BUILD_DIR"] = self._AutoGenObject.Macros["MODULE_BUILD_DIR"] - self.Macros["BIN_DIR" ] = self._AutoGenObject.Macros["BIN_DIR"] - self.Macros["BUILD_DIR" ] = self._AutoGenObject.Macros["BUILD_DIR"] - self.Macros["WORKSPACE" ] = self._AutoGenObject.Macros["WORKSPACE"] - - # Compose a dict object containing information used to do replacement in template - def _CreateTemplateDict(self): - if self._FileType not in self._SEP_: - EdkLogger.error("build", PARAMETER_INVALID, "Invalid Makefile type [%s]" % self._FileType, - ExtraData="[%s]" % str(self._AutoGenObject)) - Separator = self._SEP_[self._FileType] - - # break build if no source files and binary files are found - if len(self._AutoGenObject.SourceFileList) == 0 and len(self._AutoGenObject.BinaryFileList) == 0: - EdkLogger.error("build", AUTOGEN_ERROR, "No files to be built in module [%s, %s, %s]" - % (self._AutoGenObject.BuildTarget, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), - ExtraData="[%s]" % str(self._AutoGenObject)) - - # convert dependent libraries to build command - self.ProcessDependentLibrary() - if len(self._AutoGenObject.Module.ModuleEntryPointList) > 0: - ModuleEntryPoint = self._AutoGenObject.Module.ModuleEntryPointList[0] - else: - ModuleEntryPoint = "_ModuleEntryPoint" - - # Intel EBC compiler enforces EfiMain - if self._AutoGenObject.AutoGenVersion < 0x00010005 and self._AutoGenObject.Arch == "EBC": - ArchEntryPoint = "EfiMain" - else: - ArchEntryPoint = ModuleEntryPoint - - if self._AutoGenObject.Arch == "EBC": - # EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules - ImageEntryPoint = "EfiStart" - elif self._AutoGenObject.AutoGenVersion < 0x00010005: - # Edk modules use entry point specified in INF file - ImageEntryPoint = ModuleEntryPoint - else: - # EdkII modules always use "_ModuleEntryPoint" as entry point - ImageEntryPoint = "_ModuleEntryPoint" - - # tools definitions - ToolsDef = [] - IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily] - for Tool in self._AutoGenObject.BuildOption: - for Attr in self._AutoGenObject.BuildOption[Tool]: - Value = self._AutoGenObject.BuildOption[Tool][Attr] - if Attr == "FAMILY": - continue - elif Attr == "PATH": - ToolsDef.append("%s = %s" % (Tool, Value)) - else: - # Don't generate MAKE_FLAGS in makefile. It's put in environment variable. - if Tool == "MAKE": - continue - # Remove duplicated include path, if any - if Attr == "FLAGS": - Value = RemoveDupOption(Value, IncPrefix, self._AutoGenObject.IncludePathList) - ToolsDef.append("%s_%s = %s" % (Tool, Attr, Value)) - ToolsDef.append("") - - # convert source files and binary files to build targets - self.ResultFileList = [str(T.Target) for T in self._AutoGenObject.CodaTargetList] - if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) <> 0: - EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build", - ExtraData="[%s]" % str(self._AutoGenObject)) - - self.ProcessBuildTargetList() - - # Generate macros used to represent input files - FileMacroList = [] # macro name = file list - for FileListMacro in self.FileListMacros: - FileMacro = self._FILE_MACRO_TEMPLATE.Replace( - { - "macro_name" : FileListMacro, - "source_file" : self.FileListMacros[FileListMacro] - } - ) - FileMacroList.append(FileMacro) - - # INC_LIST is special - FileMacro = "" - IncludePathList = [] - for P in self._AutoGenObject.IncludePathList: - IncludePathList.append(IncPrefix+self.PlaceMacro(P, self.Macros)) - if FileBuildRule.INC_LIST_MACRO in self.ListFileMacros: - self.ListFileMacros[FileBuildRule.INC_LIST_MACRO].append(IncPrefix+P) - FileMacro += self._FILE_MACRO_TEMPLATE.Replace( - { - "macro_name" : "INC", - "source_file" : IncludePathList - } - ) - FileMacroList.append(FileMacro) - - # Generate macros used to represent files containing list of input files - for ListFileMacro in self.ListFileMacros: - ListFileName = os.path.join(self._AutoGenObject.OutputDir, "%s.lst" % ListFileMacro.lower()[:len(ListFileMacro)-5]) - FileMacroList.append("%s = %s" % (ListFileMacro, ListFileName)) - SaveFileOnChange( - ListFileName, - "\n".join(self.ListFileMacros[ListFileMacro]), - False - ) - - # Edk modules need StrDefs.h for string ID - #if self._AutoGenObject.AutoGenVersion < 0x00010005 and len(self._AutoGenObject.UnicodeFileList) > 0: - # BcTargetList = ['strdefs'] - #else: - # BcTargetList = [] - BcTargetList = [] - - MakefileName = self._FILE_NAME_[self._FileType] - LibraryMakeCommandList = [] - for D in self.LibraryBuildDirectoryList: - Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":os.path.join(D, MakefileName)} - LibraryMakeCommandList.append(Command) - - MakefileTemplateDict = { - "makefile_header" : self._FILE_HEADER_[self._FileType], - "makefile_path" : os.path.join("$(MODULE_BUILD_DIR)", MakefileName), - "makefile_name" : MakefileName, - "platform_name" : self.PlatformInfo.Name, - "platform_guid" : self.PlatformInfo.Guid, - "platform_version" : self.PlatformInfo.Version, - "platform_relative_directory": self.PlatformInfo.SourceDir, - "platform_output_directory" : self.PlatformInfo.OutputDir, - - "module_name" : self._AutoGenObject.Name, - "module_guid" : self._AutoGenObject.Guid, - "module_version" : self._AutoGenObject.Version, - "module_type" : self._AutoGenObject.ModuleType, - "module_file" : self._AutoGenObject.MetaFile.Name, - "module_file_base_name" : self._AutoGenObject.MetaFile.BaseName, - "module_relative_directory" : self._AutoGenObject.SourceDir, - "module_extra_defines" : ["%s = %s" % (k, v) for k,v in self._AutoGenObject.Module.Defines.iteritems()], - - "architecture" : self._AutoGenObject.Arch, - "toolchain_tag" : self._AutoGenObject.ToolChain, - "build_target" : self._AutoGenObject.BuildTarget, - - "platform_build_directory" : self.PlatformInfo.BuildDir, - "module_build_directory" : self._AutoGenObject.BuildDir, - "module_output_directory" : self._AutoGenObject.OutputDir, - "module_debug_directory" : self._AutoGenObject.DebugDir, - - "separator" : Separator, - "module_tool_definitions" : ToolsDef, - - "shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), - "shell_command" : self._SHELL_CMD_[self._FileType].values(), - - "module_entry_point" : ModuleEntryPoint, - "image_entry_point" : ImageEntryPoint, - "arch_entry_point" : ArchEntryPoint, - "remaining_build_target" : self.ResultFileList, - "common_dependency_file" : self.CommonFileDependency, - "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList), - "clean_command" : self.GetRemoveDirectoryCommand(["$(OUTPUT_DIR)"]), - "cleanall_command" : self.GetRemoveDirectoryCommand(["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]), - "dependent_library_build_directory" : self.LibraryBuildDirectoryList, - "library_build_command" : LibraryMakeCommandList, - "file_macro" : FileMacroList, - "file_build_target" : self.BuildTargetList, - "backward_compatible_target": BcTargetList, - } - - return MakefileTemplateDict - - def ProcessBuildTargetList(self): - # - # Search dependency file list for each source file - # - ForceIncludedFile = [] - for File in self._AutoGenObject.AutoGenFileList: - if File.Ext == '.h': - ForceIncludedFile.append(File) - SourceFileList = [] - for Target in self._AutoGenObject.IntroTargetList: - SourceFileList.extend(Target.Inputs) - - self.FileDependency = self.GetFileDependency( - SourceFileList, - ForceIncludedFile, - self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList - ) - DepSet = None - for File in self.FileDependency: - if not self.FileDependency[File]: - self.FileDependency[File] = ['$(FORCE_REBUILD)'] - continue - # skip non-C files - if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c": - continue - elif DepSet == None: - DepSet = set(self.FileDependency[File]) - else: - DepSet &= set(self.FileDependency[File]) - # in case nothing in SourceFileList - if DepSet == None: - DepSet = set() - # - # Extract common files list in the dependency files - # - for File in DepSet: - self.CommonFileDependency.append(self.PlaceMacro(File.Path, self.Macros)) - - for File in self.FileDependency: - # skip non-C files - if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c": - continue - NewDepSet = set(self.FileDependency[File]) - NewDepSet -= DepSet - self.FileDependency[File] = ["$(COMMON_DEPS)"] + list(NewDepSet) - - # Convert target description object to target string in makefile - for Type in self._AutoGenObject.Targets: - for T in self._AutoGenObject.Targets[Type]: - # Generate related macros if needed - if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros: - self.FileListMacros[T.FileListMacro] = [] - if T.GenListFile and T.ListFileMacro not in self.ListFileMacros: - self.ListFileMacros[T.ListFileMacro] = [] - if T.GenIncListFile and T.IncListFileMacro not in self.ListFileMacros: - self.ListFileMacros[T.IncListFileMacro] = [] - - Deps = [] - # Add force-dependencies - for Dep in T.Dependencies: - Deps.append(self.PlaceMacro(str(Dep), self.Macros)) - # Add inclusion-dependencies - if len(T.Inputs) == 1 and T.Inputs[0] in self.FileDependency: - for F in self.FileDependency[T.Inputs[0]]: - Deps.append(self.PlaceMacro(str(F), self.Macros)) - # Add source-dependencies - for F in T.Inputs: - NewFile = self.PlaceMacro(str(F), self.Macros) - # In order to use file list macro as dependency - if T.GenListFile: - self.ListFileMacros[T.ListFileMacro].append(str(F)) - self.FileListMacros[T.FileListMacro].append(NewFile) - elif T.GenFileListMacro: - self.FileListMacros[T.FileListMacro].append(NewFile) - else: - Deps.append(NewFile) - - # Use file list macro as dependency - if T.GenFileListMacro: - Deps.append("$(%s)" % T.FileListMacro) - - TargetDict = { - "target" : self.PlaceMacro(T.Target.Path, self.Macros), - "cmd" : "\n\t".join(T.Commands), - "deps" : Deps - } - self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(TargetDict)) - - ## For creating makefile targets for dependent libraries - def ProcessDependentLibrary(self): - for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList: - self.LibraryBuildDirectoryList.append(self.PlaceMacro(LibraryAutoGen.BuildDir, self.Macros)) - - ## Return a list containing source file's dependencies - # - # @param FileList The list of source files - # @param ForceInculeList The list of files which will be included forcely - # @param SearchPathList The list of search path - # - # @retval dict The mapping between source file path and its dependencies - # - def GetFileDependency(self, FileList, ForceInculeList, SearchPathList): - Dependency = {} - for F in FileList: - Dependency[F] = self.GetDependencyList(F, ForceInculeList, SearchPathList) - return Dependency - - ## Find dependencies for one source file - # - # By searching recursively "#include" directive in file, find out all the - # files needed by given source file. The dependecies will be only searched - # in given search path list. - # - # @param File The source file - # @param ForceInculeList The list of files which will be included forcely - # @param SearchPathList The list of search path - # - # @retval list The list of files the given source file depends on - # - def GetDependencyList(self, File, ForceList, SearchPathList): - EdkLogger.debug(EdkLogger.DEBUG_1, "Try to get dependency files for %s" % File) - FileStack = [File] + ForceList - DependencySet = set() - - if self._AutoGenObject.Arch not in gDependencyDatabase: - gDependencyDatabase[self._AutoGenObject.Arch] = {} - DepDb = gDependencyDatabase[self._AutoGenObject.Arch] - - while len(FileStack) > 0: - F = FileStack.pop() - - FullPathDependList = [] - if F in self.FileCache: - for CacheFile in self.FileCache[F]: - FullPathDependList.append(CacheFile) - if CacheFile not in DependencySet: - FileStack.append(CacheFile) - DependencySet.update(FullPathDependList) - continue - - CurrentFileDependencyList = [] - if F in DepDb: - CurrentFileDependencyList = DepDb[F] - else: - try: - Fd = open(F.Path, 'r') - except BaseException, X: - EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=F.Path+"\n\t"+str(X)) - - FileContent = Fd.read() - Fd.close() - if len(FileContent) == 0: - continue - - if FileContent[0] == 0xff or FileContent[0] == 0xfe: - FileContent = unicode(FileContent, "utf-16") - IncludedFileList = gIncludePattern.findall(FileContent) - - for Inc in IncludedFileList: - Inc = Inc.strip() - # if there's macro used to reference header file, expand it - HeaderList = gMacroPattern.findall(Inc) - if len(HeaderList) == 1 and len(HeaderList[0]) == 2: - HeaderType = HeaderList[0][0] - HeaderKey = HeaderList[0][1] - if HeaderType in gIncludeMacroConversion: - Inc = gIncludeMacroConversion[HeaderType] % {"HeaderKey" : HeaderKey} - else: - # not known macro used in #include, always build the file by - # returning a empty dependency - self.FileCache[File] = [] - return [] - Inc = os.path.normpath(Inc) - CurrentFileDependencyList.append(Inc) - DepDb[F] = CurrentFileDependencyList - - CurrentFilePath = F.Dir - PathList = [CurrentFilePath] + SearchPathList - for Inc in CurrentFileDependencyList: - for SearchPath in PathList: - FilePath = os.path.join(SearchPath, Inc) - if FilePath in gIsFileMap: - if not gIsFileMap[FilePath]: - continue - # If isfile is called too many times, the performance is slow down. - elif not os.path.isfile(FilePath): - gIsFileMap[FilePath] = False - continue - else: - gIsFileMap[FilePath] = True - FilePath = PathClass(FilePath) - FullPathDependList.append(FilePath) - if FilePath not in DependencySet: - FileStack.append(FilePath) - break - else: - EdkLogger.debug(EdkLogger.DEBUG_9, "%s included by %s was not found "\ - "in any given path:\n\t%s" % (Inc, F, "\n\t".join(SearchPathList))) - - self.FileCache[F] = FullPathDependList - DependencySet.update(FullPathDependList) - - DependencySet.update(ForceList) - if File in DependencySet: - DependencySet.remove(File) - DependencyList = list(DependencySet) # remove duplicate ones - - return DependencyList - - _TemplateDict = property(_CreateTemplateDict) - -## CustomMakefile class -# -# This class encapsules makefie and its generation for module. It uses template to generate -# the content of makefile. The content of makefile will be got from ModuleAutoGen object. -# -class CustomMakefile(BuildFile): - ## template used to generate the makefile for module with custom makefile - _TEMPLATE_ = TemplateString('''\ -${makefile_header} - -# -# Platform Macro Definition -# -PLATFORM_NAME = ${platform_name} -PLATFORM_GUID = ${platform_guid} -PLATFORM_VERSION = ${platform_version} -PLATFORM_RELATIVE_DIR = ${platform_relative_directory} -PLATFORM_DIR = $(WORKSPACE)${separator}${platform_relative_directory} -PLATFORM_OUTPUT_DIR = ${platform_output_directory} - -# -# Module Macro Definition -# -MODULE_NAME = ${module_name} -MODULE_GUID = ${module_guid} -MODULE_VERSION = ${module_version} -MODULE_TYPE = ${module_type} -MODULE_FILE = ${module_file} -MODULE_FILE_BASE_NAME = ${module_file_base_name} -BASE_NAME = $(MODULE_NAME) -MODULE_RELATIVE_DIR = ${module_relative_directory} -MODULE_DIR = $(WORKSPACE)${separator}${module_relative_directory} - -# -# Build Configuration Macro Definition -# -ARCH = ${architecture} -TOOLCHAIN = ${toolchain_tag} -TOOLCHAIN_TAG = ${toolchain_tag} -TARGET = ${build_target} - -# -# Build Directory Macro Definition -# -# PLATFORM_BUILD_DIR = ${platform_build_directory} -BUILD_DIR = ${platform_build_directory} -BIN_DIR = $(BUILD_DIR)${separator}${architecture} -LIB_DIR = $(BIN_DIR) -MODULE_BUILD_DIR = ${module_build_directory} -OUTPUT_DIR = ${module_output_directory} -DEBUG_DIR = ${module_debug_directory} -DEST_DIR_OUTPUT = $(OUTPUT_DIR) -DEST_DIR_DEBUG = $(DEBUG_DIR) - -# -# Tools definitions specific to this module -# -${BEGIN}${module_tool_definitions} -${END} -MAKE_FILE = ${makefile_path} - -# -# Shell Command Macro -# -${BEGIN}${shell_command_code} = ${shell_command} -${END} - -${custom_makefile_content} - -# -# Target used when called from platform makefile, which will bypass the build of dependent libraries -# - -pbuild: init all - - -# -# ModuleTarget -# - -mbuild: init all - -# -# Build Target used in multi-thread build mode, which no init target is needed -# - -tbuild: all - -# -# Initialization target: print build information and create necessary directories -# -init: -\t-@echo Building ... $(MODULE_DIR)${separator}$(MODULE_FILE) [$(ARCH)] -${BEGIN}\t-@${create_directory_command}\n${END}\ - -''') - - ## Constructor of CustomMakefile - # - # @param ModuleAutoGen Object of ModuleAutoGen class - # - def __init__(self, ModuleAutoGen): - BuildFile.__init__(self, ModuleAutoGen) - self.PlatformInfo = self._AutoGenObject.PlatformInfo - self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"] - - # Compose a dict object containing information used to do replacement in template - def _CreateTemplateDict(self): - Separator = self._SEP_[self._FileType] - if self._FileType not in self._AutoGenObject.CustomMakefile: - EdkLogger.error('build', OPTION_NOT_SUPPORTED, "No custom makefile for %s" % self._FileType, - ExtraData="[%s]" % str(self._AutoGenObject)) - MakefilePath = os.path.join( - self._AutoGenObject.WorkspaceDir, - self._AutoGenObject.CustomMakefile[self._FileType] - ) - try: - CustomMakefile = open(MakefilePath, 'r').read() - except: - EdkLogger.error('build', FILE_OPEN_FAILURE, File=str(self._AutoGenObject), - ExtraData=self._AutoGenObject.CustomMakefile[self._FileType]) - - # tools definitions - ToolsDef = [] - for Tool in self._AutoGenObject.BuildOption: - # Don't generate MAKE_FLAGS in makefile. It's put in environment variable. - if Tool == "MAKE": - continue - for Attr in self._AutoGenObject.BuildOption[Tool]: - if Attr == "FAMILY": - continue - elif Attr == "PATH": - ToolsDef.append("%s = %s" % (Tool, self._AutoGenObject.BuildOption[Tool][Attr])) - else: - ToolsDef.append("%s_%s = %s" % (Tool, Attr, self._AutoGenObject.BuildOption[Tool][Attr])) - ToolsDef.append("") - - MakefileName = self._FILE_NAME_[self._FileType] - MakefileTemplateDict = { - "makefile_header" : self._FILE_HEADER_[self._FileType], - "makefile_path" : os.path.join("$(MODULE_BUILD_DIR)", MakefileName), - "platform_name" : self.PlatformInfo.Name, - "platform_guid" : self.PlatformInfo.Guid, - "platform_version" : self.PlatformInfo.Version, - "platform_relative_directory": self.PlatformInfo.SourceDir, - "platform_output_directory" : self.PlatformInfo.OutputDir, - - "module_name" : self._AutoGenObject.Name, - "module_guid" : self._AutoGenObject.Guid, - "module_version" : self._AutoGenObject.Version, - "module_type" : self._AutoGenObject.ModuleType, - "module_file" : self._AutoGenObject.MetaFile, - "module_file_base_name" : self._AutoGenObject.MetaFile.BaseName, - "module_relative_directory" : self._AutoGenObject.SourceDir, - - "architecture" : self._AutoGenObject.Arch, - "toolchain_tag" : self._AutoGenObject.ToolChain, - "build_target" : self._AutoGenObject.BuildTarget, - - "platform_build_directory" : self.PlatformInfo.BuildDir, - "module_build_directory" : self._AutoGenObject.BuildDir, - "module_output_directory" : self._AutoGenObject.OutputDir, - "module_debug_directory" : self._AutoGenObject.DebugDir, - - "separator" : Separator, - "module_tool_definitions" : ToolsDef, - - "shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), - "shell_command" : self._SHELL_CMD_[self._FileType].values(), - - "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList), - "custom_makefile_content" : CustomMakefile - } - - return MakefileTemplateDict - - _TemplateDict = property(_CreateTemplateDict) - -## PlatformMakefile class -# -# This class encapsules makefie and its generation for platform. It uses -# template to generate the content of makefile. The content of makefile will be -# got from PlatformAutoGen object. -# -class PlatformMakefile(BuildFile): - ## template used to generate the makefile for platform - _TEMPLATE_ = TemplateString('''\ -${makefile_header} - -# -# Platform Macro Definition -# -PLATFORM_NAME = ${platform_name} -PLATFORM_GUID = ${platform_guid} -PLATFORM_VERSION = ${platform_version} -PLATFORM_FILE = ${platform_file} -PLATFORM_DIR = $(WORKSPACE)${separator}${platform_relative_directory} -PLATFORM_OUTPUT_DIR = ${platform_output_directory} - -# -# Build Configuration Macro Definition -# -TOOLCHAIN = ${toolchain_tag} -TOOLCHAIN_TAG = ${toolchain_tag} -TARGET = ${build_target} - -# -# Build Directory Macro Definition -# -BUILD_DIR = ${platform_build_directory} -FV_DIR = ${platform_build_directory}${separator}FV - -# -# Shell Command Macro -# -${BEGIN}${shell_command_code} = ${shell_command} -${END} - -MAKE = ${make_path} -MAKE_FILE = ${makefile_path} - -# -# Default target -# -all: init build_libraries build_modules - -# -# Initialization target: print build information and create necessary directories -# -init: -\t-@echo Building ... $(PLATFORM_FILE) [${build_architecture_list}] -\t${BEGIN}-@${create_directory_command} -\t${END} -# -# library build target -# -libraries: init build_libraries - -# -# module build target -# -modules: init build_libraries build_modules - -# -# Build all libraries: -# -build_libraries: -${BEGIN}\t@"$(MAKE)" $(MAKE_FLAGS) -f ${library_makefile_list} pbuild -${END}\t@cd $(BUILD_DIR) - -# -# Build all modules: -# -build_modules: -${BEGIN}\t@"$(MAKE)" $(MAKE_FLAGS) -f ${module_makefile_list} pbuild -${END}\t@cd $(BUILD_DIR) - -# -# Clean intermediate files -# -clean: -\t${BEGIN}-@${library_build_command} clean -\t${END}${BEGIN}-@${module_build_command} clean -\t${END}@cd $(BUILD_DIR) - -# -# Clean all generated files except to makefile -# -cleanall: -${BEGIN}\t${cleanall_command} -${END} - -# -# Clean all library files -# -cleanlib: -\t${BEGIN}-@${library_build_command} cleanall -\t${END}@cd $(BUILD_DIR)\n -''') - - ## Constructor of PlatformMakefile - # - # @param ModuleAutoGen Object of PlatformAutoGen class - # - def __init__(self, PlatformAutoGen): - BuildFile.__init__(self, PlatformAutoGen) - self.ModuleBuildCommandList = [] - self.ModuleMakefileList = [] - self.IntermediateDirectoryList = [] - self.ModuleBuildDirectoryList = [] - self.LibraryBuildDirectoryList = [] - - # Compose a dict object containing information used to do replacement in template - def _CreateTemplateDict(self): - Separator = self._SEP_[self._FileType] - - PlatformInfo = self._AutoGenObject - if "MAKE" not in PlatformInfo.ToolDefinition or "PATH" not in PlatformInfo.ToolDefinition["MAKE"]: - EdkLogger.error("build", OPTION_MISSING, "No MAKE command defined. Please check your tools_def.txt!", - ExtraData="[%s]" % str(self._AutoGenObject)) - - self.IntermediateDirectoryList = ["$(BUILD_DIR)"] - self.ModuleBuildDirectoryList = self.GetModuleBuildDirectoryList() - self.LibraryBuildDirectoryList = self.GetLibraryBuildDirectoryList() - - MakefileName = self._FILE_NAME_[self._FileType] - LibraryMakefileList = [] - LibraryMakeCommandList = [] - for D in self.LibraryBuildDirectoryList: - D = self.PlaceMacro(D, {"BUILD_DIR":PlatformInfo.BuildDir}) - Makefile = os.path.join(D, MakefileName) - Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":Makefile} - LibraryMakefileList.append(Makefile) - LibraryMakeCommandList.append(Command) - - ModuleMakefileList = [] - ModuleMakeCommandList = [] - for D in self.ModuleBuildDirectoryList: - D = self.PlaceMacro(D, {"BUILD_DIR":PlatformInfo.BuildDir}) - Makefile = os.path.join(D, MakefileName) - Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":Makefile} - ModuleMakefileList.append(Makefile) - ModuleMakeCommandList.append(Command) - - MakefileTemplateDict = { - "makefile_header" : self._FILE_HEADER_[self._FileType], - "makefile_path" : os.path.join("$(BUILD_DIR)", MakefileName), - "make_path" : PlatformInfo.ToolDefinition["MAKE"]["PATH"], - "makefile_name" : MakefileName, - "platform_name" : PlatformInfo.Name, - "platform_guid" : PlatformInfo.Guid, - "platform_version" : PlatformInfo.Version, - "platform_file" : self._AutoGenObject.MetaFile, - "platform_relative_directory": PlatformInfo.SourceDir, - "platform_output_directory" : PlatformInfo.OutputDir, - "platform_build_directory" : PlatformInfo.BuildDir, - - "toolchain_tag" : PlatformInfo.ToolChain, - "build_target" : PlatformInfo.BuildTarget, - "shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), - "shell_command" : self._SHELL_CMD_[self._FileType].values(), - "build_architecture_list" : self._AutoGenObject.Arch, - "architecture" : self._AutoGenObject.Arch, - "separator" : Separator, - "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList), - "cleanall_command" : self.GetRemoveDirectoryCommand(self.IntermediateDirectoryList), - "library_makefile_list" : LibraryMakefileList, - "module_makefile_list" : ModuleMakefileList, - "library_build_command" : LibraryMakeCommandList, - "module_build_command" : ModuleMakeCommandList, - } - - return MakefileTemplateDict - - ## Get the root directory list for intermediate files of all modules build - # - # @retval list The list of directory - # - def GetModuleBuildDirectoryList(self): - DirList = [] - for ModuleAutoGen in self._AutoGenObject.ModuleAutoGenList: - DirList.append(os.path.join(self._AutoGenObject.BuildDir, ModuleAutoGen.BuildDir)) - return DirList - - ## Get the root directory list for intermediate files of all libraries build - # - # @retval list The list of directory - # - def GetLibraryBuildDirectoryList(self): - DirList = [] - for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList: - DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir)) - return DirList - - _TemplateDict = property(_CreateTemplateDict) - -## TopLevelMakefile class -# -# This class encapsules makefie and its generation for entrance makefile. It -# uses template to generate the content of makefile. The content of makefile -# will be got from WorkspaceAutoGen object. -# -class TopLevelMakefile(BuildFile): - ## template used to generate toplevel makefile - _TEMPLATE_ = TemplateString('''\ -${makefile_header} - -# -# Platform Macro Definition -# -PLATFORM_NAME = ${platform_name} -PLATFORM_GUID = ${platform_guid} -PLATFORM_VERSION = ${platform_version} - -# -# Build Configuration Macro Definition -# -TOOLCHAIN = ${toolchain_tag} -TOOLCHAIN_TAG = ${toolchain_tag} -TARGET = ${build_target} - -# -# Build Directory Macro Definition -# -BUILD_DIR = ${platform_build_directory} -FV_DIR = ${platform_build_directory}${separator}FV - -# -# Shell Command Macro -# -${BEGIN}${shell_command_code} = ${shell_command} -${END} - -MAKE = ${make_path} -MAKE_FILE = ${makefile_path} - -# -# Default target -# -all: modules fds - -# -# Initialization target: print build information and create necessary directories -# -init: -\t-@ -\t${BEGIN}-@${create_directory_command} -\t${END} -# -# library build target -# -libraries: init -${BEGIN}\t@cd $(BUILD_DIR)${separator}${arch} && "$(MAKE)" $(MAKE_FLAGS) libraries -${END}\t@cd $(BUILD_DIR) - -# -# module build target -# -modules: init -${BEGIN}\t@cd $(BUILD_DIR)${separator}${arch} && "$(MAKE)" $(MAKE_FLAGS) modules -${END}\t@cd $(BUILD_DIR) - -# -# Flash Device Image Target -# -fds: init -\t-@cd $(FV_DIR) -${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -C ${cap} ${END}${BEGIN} -D ${macro} ${END} - -# -# run command for emulator platform only -# -run: -\tcd $(BUILD_DIR)${separator}IA32 && ".${separator}SecMain" -\tcd $(BUILD_DIR) - -# -# Clean intermediate files -# -clean: -${BEGIN}\t-@${sub_build_command} clean -${END}\t@cd $(BUILD_DIR) - -# -# Clean all generated files except to makefile -# -cleanall: -${BEGIN}\t${cleanall_command} -${END} - -# -# Clean all library files -# -cleanlib: -${BEGIN}\t-@${sub_build_command} cleanlib -${END}\t@cd $(BUILD_DIR)\n -''') - - ## Constructor of TopLevelMakefile - # - # @param Workspace Object of WorkspaceAutoGen class - # - def __init__(self, Workspace): - BuildFile.__init__(self, Workspace) - self.IntermediateDirectoryList = [] - - # Compose a dict object containing information used to do replacement in template - def _CreateTemplateDict(self): - Separator = self._SEP_[self._FileType] - - # any platform autogen object is ok because we just need common information - PlatformInfo = self._AutoGenObject - - if "MAKE" not in PlatformInfo.ToolDefinition or "PATH" not in PlatformInfo.ToolDefinition["MAKE"]: - EdkLogger.error("build", OPTION_MISSING, "No MAKE command defined. Please check your tools_def.txt!", - ExtraData="[%s]" % str(self._AutoGenObject)) - - for Arch in PlatformInfo.ArchList: - self.IntermediateDirectoryList.append(Separator.join(["$(BUILD_DIR)", Arch])) - self.IntermediateDirectoryList.append("$(FV_DIR)") - - # TRICK: for not generating GenFds call in makefile if no FDF file - MacroList = [] - if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "": - FdfFileList = [PlatformInfo.FdfFile] - # macros passed to GenFds - MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\'))) - MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource.replace('\\', '\\\\'))) - MacroDict = {} - MacroDict.update(GlobalData.gGlobalDefines) - MacroDict.update(GlobalData.gCommandLineDefines) - MacroDict.pop("EFI_SOURCE", "dummy") - MacroDict.pop("EDK_SOURCE", "dummy") - for MacroName in MacroDict: - if MacroDict[MacroName] != "": - MacroList.append('"%s=%s"' % (MacroName, MacroDict[MacroName].replace('\\', '\\\\'))) - else: - MacroList.append('"%s"' % MacroName) - else: - FdfFileList = [] - - # pass extra common options to external program called in makefile, currently GenFds.exe - ExtraOption = '' - LogLevel = EdkLogger.GetLevel() - if LogLevel == EdkLogger.VERBOSE: - ExtraOption += " -v" - elif LogLevel <= EdkLogger.DEBUG_9: - ExtraOption += " -d %d" % (LogLevel - 1) - elif LogLevel == EdkLogger.QUIET: - ExtraOption += " -q" - - if GlobalData.gCaseInsensitive: - ExtraOption += " -c" - - MakefileName = self._FILE_NAME_[self._FileType] - SubBuildCommandList = [] - for A in PlatformInfo.ArchList: - Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":os.path.join("$(BUILD_DIR)", A, MakefileName)} - SubBuildCommandList.append(Command) - - MakefileTemplateDict = { - "makefile_header" : self._FILE_HEADER_[self._FileType], - "makefile_path" : os.path.join("$(BUILD_DIR)", MakefileName), - "make_path" : PlatformInfo.ToolDefinition["MAKE"]["PATH"], - "platform_name" : PlatformInfo.Name, - "platform_guid" : PlatformInfo.Guid, - "platform_version" : PlatformInfo.Version, - "platform_build_directory" : PlatformInfo.BuildDir, - - "toolchain_tag" : PlatformInfo.ToolChain, - "build_target" : PlatformInfo.BuildTarget, - "shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), - "shell_command" : self._SHELL_CMD_[self._FileType].values(), - 'arch' : list(PlatformInfo.ArchList), - "build_architecture_list" : ','.join(PlatformInfo.ArchList), - "separator" : Separator, - "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList), - "cleanall_command" : self.GetRemoveDirectoryCommand(self.IntermediateDirectoryList), - "sub_build_command" : SubBuildCommandList, - "fdf_file" : FdfFileList, - "active_platform" : str(PlatformInfo), - "fd" : PlatformInfo.FdTargetList, - "fv" : PlatformInfo.FvTargetList, - "cap" : PlatformInfo.CapTargetList, - "extra_options" : ExtraOption, - "macro" : MacroList, - } - - return MakefileTemplateDict - - ## Get the root directory list for intermediate files of all modules build - # - # @retval list The list of directory - # - def GetModuleBuildDirectoryList(self): - DirList = [] - for ModuleAutoGen in self._AutoGenObject.ModuleAutoGenList: - DirList.append(os.path.join(self._AutoGenObject.BuildDir, ModuleAutoGen.BuildDir)) - return DirList - - ## Get the root directory list for intermediate files of all libraries build - # - # @retval list The list of directory - # - def GetLibraryBuildDirectoryList(self): - DirList = [] - for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList: - DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir)) - return DirList - - _TemplateDict = property(_CreateTemplateDict) - -# This acts like the main() function for the script, unless it is 'import'ed into another script. -if __name__ == '__main__': - pass - +## @file +# Create makefile for MS nmake and GNU make +# +# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## Import Modules +# +import os +import sys +import string +import re +import os.path as path + +from Common.BuildToolError import * +from Common.Misc import * +from Common.String import * +from BuildEngine import * +import Common.GlobalData as GlobalData + +## Regular expression for finding header file inclusions +gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE|re.UNICODE|re.IGNORECASE) + +## Regular expression for matching macro used in header file inclusion +gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE) + +gIsFileMap = {} + +## pattern for include style in Edk.x code +gProtocolDefinition = "Protocol/%(HeaderKey)s/%(HeaderKey)s.h" +gGuidDefinition = "Guid/%(HeaderKey)s/%(HeaderKey)s.h" +gArchProtocolDefinition = "ArchProtocol/%(HeaderKey)s/%(HeaderKey)s.h" +gPpiDefinition = "Ppi/%(HeaderKey)s/%(HeaderKey)s.h" +gIncludeMacroConversion = { + "EFI_PROTOCOL_DEFINITION" : gProtocolDefinition, + "EFI_GUID_DEFINITION" : gGuidDefinition, + "EFI_ARCH_PROTOCOL_DEFINITION" : gArchProtocolDefinition, + "EFI_PROTOCOL_PRODUCER" : gProtocolDefinition, + "EFI_PROTOCOL_CONSUMER" : gProtocolDefinition, + "EFI_PROTOCOL_DEPENDENCY" : gProtocolDefinition, + "EFI_ARCH_PROTOCOL_PRODUCER" : gArchProtocolDefinition, + "EFI_ARCH_PROTOCOL_CONSUMER" : gArchProtocolDefinition, + "EFI_ARCH_PROTOCOL_DEPENDENCY" : gArchProtocolDefinition, + "EFI_PPI_DEFINITION" : gPpiDefinition, + "EFI_PPI_PRODUCER" : gPpiDefinition, + "EFI_PPI_CONSUMER" : gPpiDefinition, + "EFI_PPI_DEPENDENCY" : gPpiDefinition, +} + +## default makefile type +gMakeType = "" +if sys.platform == "win32": + gMakeType = "nmake" +else: + gMakeType = "gmake" + + +## BuildFile class +# +# This base class encapsules build file and its generation. It uses template to generate +# the content of build file. The content of build file will be got from AutoGen objects. +# +class BuildFile(object): + ## template used to generate the build file (i.e. makefile if using make) + _TEMPLATE_ = TemplateString('') + + _DEFAULT_FILE_NAME_ = "Makefile" + + ## default file name for each type of build file + _FILE_NAME_ = { + "nmake" : "Makefile", + "gmake" : "GNUmakefile" + } + + ## Fixed header string for makefile + _MAKEFILE_HEADER = '''# +# DO NOT EDIT +# This file is auto-generated by build utility +# +# Module Name: +# +# %s +# +# Abstract: +# +# Auto-generated makefile for building modules, libraries or platform +# + ''' + + ## Header string for each type of build file + _FILE_HEADER_ = { + "nmake" : _MAKEFILE_HEADER % _FILE_NAME_["nmake"], + "gmake" : _MAKEFILE_HEADER % _FILE_NAME_["gmake"] + } + + ## shell commands which can be used in build file in the form of macro + # $(CP) copy file command + # $(MV) move file command + # $(RM) remove file command + # $(MD) create dir command + # $(RD) remove dir command + # + _SHELL_CMD_ = { + "nmake" : { + "CP" : "copy /y", + "MV" : "move /y", + "RM" : "del /f /q", + "MD" : "mkdir", + "RD" : "rmdir /s /q", + }, + + "gmake" : { + "CP" : "cp -f", + "MV" : "mv -f", + "RM" : "rm -f", + "MD" : "mkdir -p", + "RD" : "rm -r -f", + } + } + + ## directory separator + _SEP_ = { + "nmake" : "\\", + "gmake" : "/" + } + + ## directory creation template + _MD_TEMPLATE_ = { + "nmake" : 'if not exist %(dir)s $(MD) %(dir)s', + "gmake" : "$(MD) %(dir)s" + } + + ## directory removal template + _RD_TEMPLATE_ = { + "nmake" : 'if exist %(dir)s $(RD) %(dir)s', + "gmake" : "$(RD) %(dir)s" + } + + _CD_TEMPLATE_ = { + "nmake" : 'if exist %(dir)s cd %(dir)s', + "gmake" : "test -e %(dir)s && cd %(dir)s" + } + + _MAKE_TEMPLATE_ = { + "nmake" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)s', + "gmake" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(file)s' + } + + _INCLUDE_CMD_ = { + "nmake" : '!INCLUDE', + "gmake" : "include" + } + + _INC_FLAG_ = {"MSFT" : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"} + + ## Constructor of BuildFile + # + # @param AutoGenObject Object of AutoGen class + # + def __init__(self, AutoGenObject): + self._AutoGenObject = AutoGenObject + self._FileType = gMakeType + + ## Create build file + # + # @param FileType Type of build file. Only nmake and gmake are supported now. + # + # @retval TRUE The build file is created or re-created successfully + # @retval FALSE The build file exists and is the same as the one to be generated + # + def Generate(self, FileType=gMakeType): + if FileType not in self._FILE_NAME_: + EdkLogger.error("build", PARAMETER_INVALID, "Invalid build type [%s]" % FileType, + ExtraData="[%s]" % str(self._AutoGenObject)) + self._FileType = FileType + FileContent = self._TEMPLATE_.Replace(self._TemplateDict) + FileName = self._FILE_NAME_[FileType] + return SaveFileOnChange(os.path.join(self._AutoGenObject.MakeFileDir, FileName), FileContent, False) + + ## Return a list of directory creation command string + # + # @param DirList The list of directory to be created + # + # @retval list The directory creation command list + # + def GetCreateDirectoryCommand(self, DirList): + return [self._MD_TEMPLATE_[self._FileType] % {'dir':Dir} for Dir in DirList] + + ## Return a list of directory removal command string + # + # @param DirList The list of directory to be removed + # + # @retval list The directory removal command list + # + def GetRemoveDirectoryCommand(self, DirList): + return [self._RD_TEMPLATE_[self._FileType] % {'dir':Dir} for Dir in DirList] + + def PlaceMacro(self, Path, MacroDefinitions={}): + if Path.startswith("$("): + return Path + else: + PathLength = len(Path) + for MacroName in MacroDefinitions: + MacroValue = MacroDefinitions[MacroName] + MacroValueLength = len(MacroValue) + if MacroValueLength <= PathLength and Path.startswith(MacroValue): + Path = "$(%s)%s" % (MacroName, Path[MacroValueLength:]) + break + return Path + +## ModuleMakefile class +# +# This class encapsules makefie and its generation for module. It uses template to generate +# the content of makefile. The content of makefile will be got from ModuleAutoGen object. +# +class ModuleMakefile(BuildFile): + ## template used to generate the makefile for module + _TEMPLATE_ = TemplateString('''\ +${makefile_header} + +# +# Platform Macro Definition +# +PLATFORM_NAME = ${platform_name} +PLATFORM_GUID = ${platform_guid} +PLATFORM_VERSION = ${platform_version} +PLATFORM_RELATIVE_DIR = ${platform_relative_directory} +PLATFORM_DIR = $(WORKSPACE)${separator}${platform_relative_directory} +PLATFORM_OUTPUT_DIR = ${platform_output_directory} + +# +# Module Macro Definition +# +MODULE_NAME = ${module_name} +MODULE_GUID = ${module_guid} +MODULE_VERSION = ${module_version} +MODULE_TYPE = ${module_type} +MODULE_FILE = ${module_file} +MODULE_FILE_BASE_NAME = ${module_file_base_name} +BASE_NAME = $(MODULE_NAME) +MODULE_RELATIVE_DIR = ${module_relative_directory} +MODULE_DIR = $(WORKSPACE)${separator}${module_relative_directory} + +MODULE_ENTRY_POINT = ${module_entry_point} +ARCH_ENTRY_POINT = ${arch_entry_point} +IMAGE_ENTRY_POINT = ${image_entry_point} + +${BEGIN}${module_extra_defines} +${END} +# +# Build Configuration Macro Definition +# +ARCH = ${architecture} +TOOLCHAIN = ${toolchain_tag} +TOOLCHAIN_TAG = ${toolchain_tag} +TARGET = ${build_target} + +# +# Build Directory Macro Definition +# +# PLATFORM_BUILD_DIR = ${platform_build_directory} +BUILD_DIR = ${platform_build_directory} +BIN_DIR = $(BUILD_DIR)${separator}${architecture} +LIB_DIR = $(BIN_DIR) +MODULE_BUILD_DIR = ${module_build_directory} +OUTPUT_DIR = ${module_output_directory} +DEBUG_DIR = ${module_debug_directory} +DEST_DIR_OUTPUT = $(OUTPUT_DIR) +DEST_DIR_DEBUG = $(DEBUG_DIR) + +# +# Shell Command Macro +# +${BEGIN}${shell_command_code} = ${shell_command} +${END} + +# +# Tools definitions specific to this module +# +${BEGIN}${module_tool_definitions} +${END} +MAKE_FILE = ${makefile_path} + +# +# Build Macro +# +${BEGIN}${file_macro} +${END} + +COMMON_DEPS = ${BEGIN}${common_dependency_file} \\ + ${END} + +# +# Overridable Target Macro Definitions +# +FORCE_REBUILD = force_build +INIT_TARGET = init +PCH_TARGET = +BC_TARGET = ${BEGIN}${backward_compatible_target} ${END} +CODA_TARGET = ${BEGIN}${remaining_build_target} \\ + ${END} + +# +# Default target, which will build dependent libraries in addition to source files +# + +all: mbuild + + +# +# Target used when called from platform makefile, which will bypass the build of dependent libraries +# + +pbuild: $(INIT_TARGET) $(BC_TARGET) $(PCH_TARGET) $(CODA_TARGET) + +# +# ModuleTarget +# + +mbuild: $(INIT_TARGET) $(BC_TARGET) gen_libs $(PCH_TARGET) $(CODA_TARGET) + +# +# Build Target used in multi-thread build mode, which will bypass the init and gen_libs targets +# + +tbuild: $(BC_TARGET) $(PCH_TARGET) $(CODA_TARGET) + +# +# Phony target which is used to force executing commands for a target +# +force_build: +\t-@ + +# +# Target to update the FD +# + +fds: mbuild gen_fds + +# +# Initialization target: print build information and create necessary directories +# +init: info dirs + +info: +\t-@echo Building ... $(MODULE_DIR)${separator}$(MODULE_FILE) [$(ARCH)] + +dirs: +${BEGIN}\t-@${create_directory_command}\n${END} + +strdefs: +\t-@$(CP) $(DEBUG_DIR)${separator}AutoGen.h $(DEBUG_DIR)${separator}$(MODULE_NAME)StrDefs.h + +# +# GenLibsTarget +# +gen_libs: +\t${BEGIN}@"$(MAKE)" $(MAKE_FLAGS) -f ${dependent_library_build_directory}${separator}${makefile_name} +\t${END}@cd $(MODULE_BUILD_DIR) + +# +# Build Flash Device Image +# +gen_fds: +\t@"$(MAKE)" $(MAKE_FLAGS) -f $(BUILD_DIR)${separator}${makefile_name} fds +\t@cd $(MODULE_BUILD_DIR) + +# +# Individual Object Build Targets +# +${BEGIN}${file_build_target} +${END} + +# +# clean all intermediate files +# +clean: +\t${BEGIN}${clean_command} +\t${END} + +# +# clean all generated files +# +cleanall: +${BEGIN}\t${cleanall_command} +${END}\t$(RM) *.pdb *.idb > NUL 2>&1 +\t$(RM) $(BIN_DIR)${separator}$(MODULE_NAME).efi + +# +# clean all dependent libraries built +# +cleanlib: +\t${BEGIN}-@${library_build_command} cleanall +\t${END}@cd $(MODULE_BUILD_DIR)\n\n''') + + _FILE_MACRO_TEMPLATE = TemplateString("${macro_name} = ${BEGIN} \\\n ${source_file}${END}\n") + _BUILD_TARGET_TEMPLATE = TemplateString("${BEGIN}${target} : ${deps}\n${END}\t${cmd}\n") + + ## Constructor of ModuleMakefile + # + # @param ModuleAutoGen Object of ModuleAutoGen class + # + def __init__(self, ModuleAutoGen): + BuildFile.__init__(self, ModuleAutoGen) + self.PlatformInfo = self._AutoGenObject.PlatformInfo + + self.ResultFileList = [] + self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"] + + self.SourceFileDatabase = {} # {file type : file path} + self.DestFileDatabase = {} # {file type : file path} + self.FileBuildTargetList = [] # [(src, target string)] + self.BuildTargetList = [] # [target string] + self.PendingBuildTargetList = [] # [FileBuildRule objects] + self.CommonFileDependency = [] + self.FileListMacros = {} + self.ListFileMacros = {} + + self.FileCache = {} + self.FileDependency = [] + self.LibraryBuildCommandList = [] + self.LibraryFileList = [] + self.LibraryMakefileList = [] + self.LibraryBuildDirectoryList = [] + self.SystemLibraryList = [] + self.Macros = sdict() + self.Macros["OUTPUT_DIR" ] = self._AutoGenObject.Macros["OUTPUT_DIR"] + self.Macros["DEBUG_DIR" ] = self._AutoGenObject.Macros["DEBUG_DIR"] + self.Macros["MODULE_BUILD_DIR"] = self._AutoGenObject.Macros["MODULE_BUILD_DIR"] + self.Macros["BIN_DIR" ] = self._AutoGenObject.Macros["BIN_DIR"] + self.Macros["BUILD_DIR" ] = self._AutoGenObject.Macros["BUILD_DIR"] + self.Macros["WORKSPACE" ] = self._AutoGenObject.Macros["WORKSPACE"] + + # Compose a dict object containing information used to do replacement in template + def _CreateTemplateDict(self): + if self._FileType not in self._SEP_: + EdkLogger.error("build", PARAMETER_INVALID, "Invalid Makefile type [%s]" % self._FileType, + ExtraData="[%s]" % str(self._AutoGenObject)) + Separator = self._SEP_[self._FileType] + + # break build if no source files and binary files are found + if len(self._AutoGenObject.SourceFileList) == 0 and len(self._AutoGenObject.BinaryFileList) == 0: + EdkLogger.error("build", AUTOGEN_ERROR, "No files to be built in module [%s, %s, %s]" + % (self._AutoGenObject.BuildTarget, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), + ExtraData="[%s]" % str(self._AutoGenObject)) + + # convert dependent libraries to build command + self.ProcessDependentLibrary() + if len(self._AutoGenObject.Module.ModuleEntryPointList) > 0: + ModuleEntryPoint = self._AutoGenObject.Module.ModuleEntryPointList[0] + else: + ModuleEntryPoint = "_ModuleEntryPoint" + + # Intel EBC compiler enforces EfiMain + if self._AutoGenObject.AutoGenVersion < 0x00010005 and self._AutoGenObject.Arch == "EBC": + ArchEntryPoint = "EfiMain" + else: + ArchEntryPoint = ModuleEntryPoint + + if self._AutoGenObject.Arch == "EBC": + # EBC compiler always use "EfiStart" as entry point. Only applies to EdkII modules + ImageEntryPoint = "EfiStart" + elif self._AutoGenObject.AutoGenVersion < 0x00010005: + # Edk modules use entry point specified in INF file + ImageEntryPoint = ModuleEntryPoint + else: + # EdkII modules always use "_ModuleEntryPoint" as entry point + ImageEntryPoint = "_ModuleEntryPoint" + + # tools definitions + ToolsDef = [] + IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily] + for Tool in self._AutoGenObject.BuildOption: + for Attr in self._AutoGenObject.BuildOption[Tool]: + Value = self._AutoGenObject.BuildOption[Tool][Attr] + if Attr == "FAMILY": + continue + elif Attr == "PATH": + ToolsDef.append("%s = %s" % (Tool, Value)) + else: + # Don't generate MAKE_FLAGS in makefile. It's put in environment variable. + if Tool == "MAKE": + continue + # Remove duplicated include path, if any + if Attr == "FLAGS": + Value = RemoveDupOption(Value, IncPrefix, self._AutoGenObject.IncludePathList) + ToolsDef.append("%s_%s = %s" % (Tool, Attr, Value)) + ToolsDef.append("") + + # convert source files and binary files to build targets + self.ResultFileList = [str(T.Target) for T in self._AutoGenObject.CodaTargetList] + if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) <> 0: + EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build", + ExtraData="[%s]" % str(self._AutoGenObject)) + + self.ProcessBuildTargetList() + + # Generate macros used to represent input files + FileMacroList = [] # macro name = file list + for FileListMacro in self.FileListMacros: + FileMacro = self._FILE_MACRO_TEMPLATE.Replace( + { + "macro_name" : FileListMacro, + "source_file" : self.FileListMacros[FileListMacro] + } + ) + FileMacroList.append(FileMacro) + + # INC_LIST is special + FileMacro = "" + IncludePathList = [] + for P in self._AutoGenObject.IncludePathList: + IncludePathList.append(IncPrefix+self.PlaceMacro(P, self.Macros)) + if FileBuildRule.INC_LIST_MACRO in self.ListFileMacros: + self.ListFileMacros[FileBuildRule.INC_LIST_MACRO].append(IncPrefix+P) + FileMacro += self._FILE_MACRO_TEMPLATE.Replace( + { + "macro_name" : "INC", + "source_file" : IncludePathList + } + ) + FileMacroList.append(FileMacro) + + # Generate macros used to represent files containing list of input files + for ListFileMacro in self.ListFileMacros: + ListFileName = os.path.join(self._AutoGenObject.OutputDir, "%s.lst" % ListFileMacro.lower()[:len(ListFileMacro)-5]) + FileMacroList.append("%s = %s" % (ListFileMacro, ListFileName)) + SaveFileOnChange( + ListFileName, + "\n".join(self.ListFileMacros[ListFileMacro]), + False + ) + + # Edk modules need StrDefs.h for string ID + #if self._AutoGenObject.AutoGenVersion < 0x00010005 and len(self._AutoGenObject.UnicodeFileList) > 0: + # BcTargetList = ['strdefs'] + #else: + # BcTargetList = [] + BcTargetList = [] + + MakefileName = self._FILE_NAME_[self._FileType] + LibraryMakeCommandList = [] + for D in self.LibraryBuildDirectoryList: + Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":os.path.join(D, MakefileName)} + LibraryMakeCommandList.append(Command) + + MakefileTemplateDict = { + "makefile_header" : self._FILE_HEADER_[self._FileType], + "makefile_path" : os.path.join("$(MODULE_BUILD_DIR)", MakefileName), + "makefile_name" : MakefileName, + "platform_name" : self.PlatformInfo.Name, + "platform_guid" : self.PlatformInfo.Guid, + "platform_version" : self.PlatformInfo.Version, + "platform_relative_directory": self.PlatformInfo.SourceDir, + "platform_output_directory" : self.PlatformInfo.OutputDir, + + "module_name" : self._AutoGenObject.Name, + "module_guid" : self._AutoGenObject.Guid, + "module_version" : self._AutoGenObject.Version, + "module_type" : self._AutoGenObject.ModuleType, + "module_file" : self._AutoGenObject.MetaFile.Name, + "module_file_base_name" : self._AutoGenObject.MetaFile.BaseName, + "module_relative_directory" : self._AutoGenObject.SourceDir, + "module_extra_defines" : ["%s = %s" % (k, v) for k,v in self._AutoGenObject.Module.Defines.iteritems()], + + "architecture" : self._AutoGenObject.Arch, + "toolchain_tag" : self._AutoGenObject.ToolChain, + "build_target" : self._AutoGenObject.BuildTarget, + + "platform_build_directory" : self.PlatformInfo.BuildDir, + "module_build_directory" : self._AutoGenObject.BuildDir, + "module_output_directory" : self._AutoGenObject.OutputDir, + "module_debug_directory" : self._AutoGenObject.DebugDir, + + "separator" : Separator, + "module_tool_definitions" : ToolsDef, + + "shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), + "shell_command" : self._SHELL_CMD_[self._FileType].values(), + + "module_entry_point" : ModuleEntryPoint, + "image_entry_point" : ImageEntryPoint, + "arch_entry_point" : ArchEntryPoint, + "remaining_build_target" : self.ResultFileList, + "common_dependency_file" : self.CommonFileDependency, + "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList), + "clean_command" : self.GetRemoveDirectoryCommand(["$(OUTPUT_DIR)"]), + "cleanall_command" : self.GetRemoveDirectoryCommand(["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]), + "dependent_library_build_directory" : self.LibraryBuildDirectoryList, + "library_build_command" : LibraryMakeCommandList, + "file_macro" : FileMacroList, + "file_build_target" : self.BuildTargetList, + "backward_compatible_target": BcTargetList, + } + + return MakefileTemplateDict + + def ProcessBuildTargetList(self): + # + # Search dependency file list for each source file + # + ForceIncludedFile = [] + for File in self._AutoGenObject.AutoGenFileList: + if File.Ext == '.h': + ForceIncludedFile.append(File) + SourceFileList = [] + for Target in self._AutoGenObject.IntroTargetList: + SourceFileList.extend(Target.Inputs) + + self.FileDependency = self.GetFileDependency( + SourceFileList, + ForceIncludedFile, + self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList + ) + DepSet = None + for File in self.FileDependency: + if not self.FileDependency[File]: + self.FileDependency[File] = ['$(FORCE_REBUILD)'] + continue + # skip non-C files + if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c": + continue + elif DepSet == None: + DepSet = set(self.FileDependency[File]) + else: + DepSet &= set(self.FileDependency[File]) + # in case nothing in SourceFileList + if DepSet == None: + DepSet = set() + # + # Extract common files list in the dependency files + # + for File in DepSet: + self.CommonFileDependency.append(self.PlaceMacro(File.Path, self.Macros)) + + for File in self.FileDependency: + # skip non-C files + if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c": + continue + NewDepSet = set(self.FileDependency[File]) + NewDepSet -= DepSet + self.FileDependency[File] = ["$(COMMON_DEPS)"] + list(NewDepSet) + + # Convert target description object to target string in makefile + for Type in self._AutoGenObject.Targets: + for T in self._AutoGenObject.Targets[Type]: + # Generate related macros if needed + if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros: + self.FileListMacros[T.FileListMacro] = [] + if T.GenListFile and T.ListFileMacro not in self.ListFileMacros: + self.ListFileMacros[T.ListFileMacro] = [] + if T.GenIncListFile and T.IncListFileMacro not in self.ListFileMacros: + self.ListFileMacros[T.IncListFileMacro] = [] + + Deps = [] + # Add force-dependencies + for Dep in T.Dependencies: + Deps.append(self.PlaceMacro(str(Dep), self.Macros)) + # Add inclusion-dependencies + if len(T.Inputs) == 1 and T.Inputs[0] in self.FileDependency: + for F in self.FileDependency[T.Inputs[0]]: + Deps.append(self.PlaceMacro(str(F), self.Macros)) + # Add source-dependencies + for F in T.Inputs: + NewFile = self.PlaceMacro(str(F), self.Macros) + # In order to use file list macro as dependency + if T.GenListFile: + self.ListFileMacros[T.ListFileMacro].append(str(F)) + self.FileListMacros[T.FileListMacro].append(NewFile) + elif T.GenFileListMacro: + self.FileListMacros[T.FileListMacro].append(NewFile) + else: + Deps.append(NewFile) + + # Use file list macro as dependency + if T.GenFileListMacro: + Deps.append("$(%s)" % T.FileListMacro) + + TargetDict = { + "target" : self.PlaceMacro(T.Target.Path, self.Macros), + "cmd" : "\n\t".join(T.Commands), + "deps" : Deps + } + self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(TargetDict)) + + ## For creating makefile targets for dependent libraries + def ProcessDependentLibrary(self): + for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList: + self.LibraryBuildDirectoryList.append(self.PlaceMacro(LibraryAutoGen.BuildDir, self.Macros)) + + ## Return a list containing source file's dependencies + # + # @param FileList The list of source files + # @param ForceInculeList The list of files which will be included forcely + # @param SearchPathList The list of search path + # + # @retval dict The mapping between source file path and its dependencies + # + def GetFileDependency(self, FileList, ForceInculeList, SearchPathList): + Dependency = {} + for F in FileList: + Dependency[F] = self.GetDependencyList(F, ForceInculeList, SearchPathList) + return Dependency + + ## Find dependencies for one source file + # + # By searching recursively "#include" directive in file, find out all the + # files needed by given source file. The dependecies will be only searched + # in given search path list. + # + # @param File The source file + # @param ForceInculeList The list of files which will be included forcely + # @param SearchPathList The list of search path + # + # @retval list The list of files the given source file depends on + # + def GetDependencyList(self, File, ForceList, SearchPathList): + EdkLogger.debug(EdkLogger.DEBUG_1, "Try to get dependency files for %s" % File) + FileStack = [File] + ForceList + DependencySet = set() + + if self._AutoGenObject.Arch not in gDependencyDatabase: + gDependencyDatabase[self._AutoGenObject.Arch] = {} + DepDb = gDependencyDatabase[self._AutoGenObject.Arch] + + while len(FileStack) > 0: + F = FileStack.pop() + + FullPathDependList = [] + if F in self.FileCache: + for CacheFile in self.FileCache[F]: + FullPathDependList.append(CacheFile) + if CacheFile not in DependencySet: + FileStack.append(CacheFile) + DependencySet.update(FullPathDependList) + continue + + CurrentFileDependencyList = [] + if F in DepDb: + CurrentFileDependencyList = DepDb[F] + else: + try: + Fd = open(F.Path, 'r') + except BaseException, X: + EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=F.Path+"\n\t"+str(X)) + + FileContent = Fd.read() + Fd.close() + if len(FileContent) == 0: + continue + + if FileContent[0] == 0xff or FileContent[0] == 0xfe: + FileContent = unicode(FileContent, "utf-16") + IncludedFileList = gIncludePattern.findall(FileContent) + + for Inc in IncludedFileList: + Inc = Inc.strip() + # if there's macro used to reference header file, expand it + HeaderList = gMacroPattern.findall(Inc) + if len(HeaderList) == 1 and len(HeaderList[0]) == 2: + HeaderType = HeaderList[0][0] + HeaderKey = HeaderList[0][1] + if HeaderType in gIncludeMacroConversion: + Inc = gIncludeMacroConversion[HeaderType] % {"HeaderKey" : HeaderKey} + else: + # not known macro used in #include, always build the file by + # returning a empty dependency + self.FileCache[File] = [] + return [] + Inc = os.path.normpath(Inc) + CurrentFileDependencyList.append(Inc) + DepDb[F] = CurrentFileDependencyList + + CurrentFilePath = F.Dir + PathList = [CurrentFilePath] + SearchPathList + for Inc in CurrentFileDependencyList: + for SearchPath in PathList: + FilePath = os.path.join(SearchPath, Inc) + if FilePath in gIsFileMap: + if not gIsFileMap[FilePath]: + continue + # If isfile is called too many times, the performance is slow down. + elif not os.path.isfile(FilePath): + gIsFileMap[FilePath] = False + continue + else: + gIsFileMap[FilePath] = True + FilePath = PathClass(FilePath) + FullPathDependList.append(FilePath) + if FilePath not in DependencySet: + FileStack.append(FilePath) + break + else: + EdkLogger.debug(EdkLogger.DEBUG_9, "%s included by %s was not found "\ + "in any given path:\n\t%s" % (Inc, F, "\n\t".join(SearchPathList))) + + self.FileCache[F] = FullPathDependList + DependencySet.update(FullPathDependList) + + DependencySet.update(ForceList) + if File in DependencySet: + DependencySet.remove(File) + DependencyList = list(DependencySet) # remove duplicate ones + + return DependencyList + + _TemplateDict = property(_CreateTemplateDict) + +## CustomMakefile class +# +# This class encapsules makefie and its generation for module. It uses template to generate +# the content of makefile. The content of makefile will be got from ModuleAutoGen object. +# +class CustomMakefile(BuildFile): + ## template used to generate the makefile for module with custom makefile + _TEMPLATE_ = TemplateString('''\ +${makefile_header} + +# +# Platform Macro Definition +# +PLATFORM_NAME = ${platform_name} +PLATFORM_GUID = ${platform_guid} +PLATFORM_VERSION = ${platform_version} +PLATFORM_RELATIVE_DIR = ${platform_relative_directory} +PLATFORM_DIR = $(WORKSPACE)${separator}${platform_relative_directory} +PLATFORM_OUTPUT_DIR = ${platform_output_directory} + +# +# Module Macro Definition +# +MODULE_NAME = ${module_name} +MODULE_GUID = ${module_guid} +MODULE_VERSION = ${module_version} +MODULE_TYPE = ${module_type} +MODULE_FILE = ${module_file} +MODULE_FILE_BASE_NAME = ${module_file_base_name} +BASE_NAME = $(MODULE_NAME) +MODULE_RELATIVE_DIR = ${module_relative_directory} +MODULE_DIR = $(WORKSPACE)${separator}${module_relative_directory} + +# +# Build Configuration Macro Definition +# +ARCH = ${architecture} +TOOLCHAIN = ${toolchain_tag} +TOOLCHAIN_TAG = ${toolchain_tag} +TARGET = ${build_target} + +# +# Build Directory Macro Definition +# +# PLATFORM_BUILD_DIR = ${platform_build_directory} +BUILD_DIR = ${platform_build_directory} +BIN_DIR = $(BUILD_DIR)${separator}${architecture} +LIB_DIR = $(BIN_DIR) +MODULE_BUILD_DIR = ${module_build_directory} +OUTPUT_DIR = ${module_output_directory} +DEBUG_DIR = ${module_debug_directory} +DEST_DIR_OUTPUT = $(OUTPUT_DIR) +DEST_DIR_DEBUG = $(DEBUG_DIR) + +# +# Tools definitions specific to this module +# +${BEGIN}${module_tool_definitions} +${END} +MAKE_FILE = ${makefile_path} + +# +# Shell Command Macro +# +${BEGIN}${shell_command_code} = ${shell_command} +${END} + +${custom_makefile_content} + +# +# Target used when called from platform makefile, which will bypass the build of dependent libraries +# + +pbuild: init all + + +# +# ModuleTarget +# + +mbuild: init all + +# +# Build Target used in multi-thread build mode, which no init target is needed +# + +tbuild: all + +# +# Initialization target: print build information and create necessary directories +# +init: +\t-@echo Building ... $(MODULE_DIR)${separator}$(MODULE_FILE) [$(ARCH)] +${BEGIN}\t-@${create_directory_command}\n${END}\ + +''') + + ## Constructor of CustomMakefile + # + # @param ModuleAutoGen Object of ModuleAutoGen class + # + def __init__(self, ModuleAutoGen): + BuildFile.__init__(self, ModuleAutoGen) + self.PlatformInfo = self._AutoGenObject.PlatformInfo + self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"] + + # Compose a dict object containing information used to do replacement in template + def _CreateTemplateDict(self): + Separator = self._SEP_[self._FileType] + if self._FileType not in self._AutoGenObject.CustomMakefile: + EdkLogger.error('build', OPTION_NOT_SUPPORTED, "No custom makefile for %s" % self._FileType, + ExtraData="[%s]" % str(self._AutoGenObject)) + MakefilePath = os.path.join( + self._AutoGenObject.WorkspaceDir, + self._AutoGenObject.CustomMakefile[self._FileType] + ) + try: + CustomMakefile = open(MakefilePath, 'r').read() + except: + EdkLogger.error('build', FILE_OPEN_FAILURE, File=str(self._AutoGenObject), + ExtraData=self._AutoGenObject.CustomMakefile[self._FileType]) + + # tools definitions + ToolsDef = [] + for Tool in self._AutoGenObject.BuildOption: + # Don't generate MAKE_FLAGS in makefile. It's put in environment variable. + if Tool == "MAKE": + continue + for Attr in self._AutoGenObject.BuildOption[Tool]: + if Attr == "FAMILY": + continue + elif Attr == "PATH": + ToolsDef.append("%s = %s" % (Tool, self._AutoGenObject.BuildOption[Tool][Attr])) + else: + ToolsDef.append("%s_%s = %s" % (Tool, Attr, self._AutoGenObject.BuildOption[Tool][Attr])) + ToolsDef.append("") + + MakefileName = self._FILE_NAME_[self._FileType] + MakefileTemplateDict = { + "makefile_header" : self._FILE_HEADER_[self._FileType], + "makefile_path" : os.path.join("$(MODULE_BUILD_DIR)", MakefileName), + "platform_name" : self.PlatformInfo.Name, + "platform_guid" : self.PlatformInfo.Guid, + "platform_version" : self.PlatformInfo.Version, + "platform_relative_directory": self.PlatformInfo.SourceDir, + "platform_output_directory" : self.PlatformInfo.OutputDir, + + "module_name" : self._AutoGenObject.Name, + "module_guid" : self._AutoGenObject.Guid, + "module_version" : self._AutoGenObject.Version, + "module_type" : self._AutoGenObject.ModuleType, + "module_file" : self._AutoGenObject.MetaFile, + "module_file_base_name" : self._AutoGenObject.MetaFile.BaseName, + "module_relative_directory" : self._AutoGenObject.SourceDir, + + "architecture" : self._AutoGenObject.Arch, + "toolchain_tag" : self._AutoGenObject.ToolChain, + "build_target" : self._AutoGenObject.BuildTarget, + + "platform_build_directory" : self.PlatformInfo.BuildDir, + "module_build_directory" : self._AutoGenObject.BuildDir, + "module_output_directory" : self._AutoGenObject.OutputDir, + "module_debug_directory" : self._AutoGenObject.DebugDir, + + "separator" : Separator, + "module_tool_definitions" : ToolsDef, + + "shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), + "shell_command" : self._SHELL_CMD_[self._FileType].values(), + + "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList), + "custom_makefile_content" : CustomMakefile + } + + return MakefileTemplateDict + + _TemplateDict = property(_CreateTemplateDict) + +## PlatformMakefile class +# +# This class encapsules makefie and its generation for platform. It uses +# template to generate the content of makefile. The content of makefile will be +# got from PlatformAutoGen object. +# +class PlatformMakefile(BuildFile): + ## template used to generate the makefile for platform + _TEMPLATE_ = TemplateString('''\ +${makefile_header} + +# +# Platform Macro Definition +# +PLATFORM_NAME = ${platform_name} +PLATFORM_GUID = ${platform_guid} +PLATFORM_VERSION = ${platform_version} +PLATFORM_FILE = ${platform_file} +PLATFORM_DIR = $(WORKSPACE)${separator}${platform_relative_directory} +PLATFORM_OUTPUT_DIR = ${platform_output_directory} + +# +# Build Configuration Macro Definition +# +TOOLCHAIN = ${toolchain_tag} +TOOLCHAIN_TAG = ${toolchain_tag} +TARGET = ${build_target} + +# +# Build Directory Macro Definition +# +BUILD_DIR = ${platform_build_directory} +FV_DIR = ${platform_build_directory}${separator}FV + +# +# Shell Command Macro +# +${BEGIN}${shell_command_code} = ${shell_command} +${END} + +MAKE = ${make_path} +MAKE_FILE = ${makefile_path} + +# +# Default target +# +all: init build_libraries build_modules + +# +# Initialization target: print build information and create necessary directories +# +init: +\t-@echo Building ... $(PLATFORM_FILE) [${build_architecture_list}] +\t${BEGIN}-@${create_directory_command} +\t${END} +# +# library build target +# +libraries: init build_libraries + +# +# module build target +# +modules: init build_libraries build_modules + +# +# Build all libraries: +# +build_libraries: +${BEGIN}\t@"$(MAKE)" $(MAKE_FLAGS) -f ${library_makefile_list} pbuild +${END}\t@cd $(BUILD_DIR) + +# +# Build all modules: +# +build_modules: +${BEGIN}\t@"$(MAKE)" $(MAKE_FLAGS) -f ${module_makefile_list} pbuild +${END}\t@cd $(BUILD_DIR) + +# +# Clean intermediate files +# +clean: +\t${BEGIN}-@${library_build_command} clean +\t${END}${BEGIN}-@${module_build_command} clean +\t${END}@cd $(BUILD_DIR) + +# +# Clean all generated files except to makefile +# +cleanall: +${BEGIN}\t${cleanall_command} +${END} + +# +# Clean all library files +# +cleanlib: +\t${BEGIN}-@${library_build_command} cleanall +\t${END}@cd $(BUILD_DIR)\n +''') + + ## Constructor of PlatformMakefile + # + # @param ModuleAutoGen Object of PlatformAutoGen class + # + def __init__(self, PlatformAutoGen): + BuildFile.__init__(self, PlatformAutoGen) + self.ModuleBuildCommandList = [] + self.ModuleMakefileList = [] + self.IntermediateDirectoryList = [] + self.ModuleBuildDirectoryList = [] + self.LibraryBuildDirectoryList = [] + + # Compose a dict object containing information used to do replacement in template + def _CreateTemplateDict(self): + Separator = self._SEP_[self._FileType] + + PlatformInfo = self._AutoGenObject + if "MAKE" not in PlatformInfo.ToolDefinition or "PATH" not in PlatformInfo.ToolDefinition["MAKE"]: + EdkLogger.error("build", OPTION_MISSING, "No MAKE command defined. Please check your tools_def.txt!", + ExtraData="[%s]" % str(self._AutoGenObject)) + + self.IntermediateDirectoryList = ["$(BUILD_DIR)"] + self.ModuleBuildDirectoryList = self.GetModuleBuildDirectoryList() + self.LibraryBuildDirectoryList = self.GetLibraryBuildDirectoryList() + + MakefileName = self._FILE_NAME_[self._FileType] + LibraryMakefileList = [] + LibraryMakeCommandList = [] + for D in self.LibraryBuildDirectoryList: + D = self.PlaceMacro(D, {"BUILD_DIR":PlatformInfo.BuildDir}) + Makefile = os.path.join(D, MakefileName) + Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":Makefile} + LibraryMakefileList.append(Makefile) + LibraryMakeCommandList.append(Command) + + ModuleMakefileList = [] + ModuleMakeCommandList = [] + for D in self.ModuleBuildDirectoryList: + D = self.PlaceMacro(D, {"BUILD_DIR":PlatformInfo.BuildDir}) + Makefile = os.path.join(D, MakefileName) + Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":Makefile} + ModuleMakefileList.append(Makefile) + ModuleMakeCommandList.append(Command) + + MakefileTemplateDict = { + "makefile_header" : self._FILE_HEADER_[self._FileType], + "makefile_path" : os.path.join("$(BUILD_DIR)", MakefileName), + "make_path" : PlatformInfo.ToolDefinition["MAKE"]["PATH"], + "makefile_name" : MakefileName, + "platform_name" : PlatformInfo.Name, + "platform_guid" : PlatformInfo.Guid, + "platform_version" : PlatformInfo.Version, + "platform_file" : self._AutoGenObject.MetaFile, + "platform_relative_directory": PlatformInfo.SourceDir, + "platform_output_directory" : PlatformInfo.OutputDir, + "platform_build_directory" : PlatformInfo.BuildDir, + + "toolchain_tag" : PlatformInfo.ToolChain, + "build_target" : PlatformInfo.BuildTarget, + "shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), + "shell_command" : self._SHELL_CMD_[self._FileType].values(), + "build_architecture_list" : self._AutoGenObject.Arch, + "architecture" : self._AutoGenObject.Arch, + "separator" : Separator, + "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList), + "cleanall_command" : self.GetRemoveDirectoryCommand(self.IntermediateDirectoryList), + "library_makefile_list" : LibraryMakefileList, + "module_makefile_list" : ModuleMakefileList, + "library_build_command" : LibraryMakeCommandList, + "module_build_command" : ModuleMakeCommandList, + } + + return MakefileTemplateDict + + ## Get the root directory list for intermediate files of all modules build + # + # @retval list The list of directory + # + def GetModuleBuildDirectoryList(self): + DirList = [] + for ModuleAutoGen in self._AutoGenObject.ModuleAutoGenList: + DirList.append(os.path.join(self._AutoGenObject.BuildDir, ModuleAutoGen.BuildDir)) + return DirList + + ## Get the root directory list for intermediate files of all libraries build + # + # @retval list The list of directory + # + def GetLibraryBuildDirectoryList(self): + DirList = [] + for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList: + DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir)) + return DirList + + _TemplateDict = property(_CreateTemplateDict) + +## TopLevelMakefile class +# +# This class encapsules makefie and its generation for entrance makefile. It +# uses template to generate the content of makefile. The content of makefile +# will be got from WorkspaceAutoGen object. +# +class TopLevelMakefile(BuildFile): + ## template used to generate toplevel makefile + _TEMPLATE_ = TemplateString('''\ +${makefile_header} + +# +# Platform Macro Definition +# +PLATFORM_NAME = ${platform_name} +PLATFORM_GUID = ${platform_guid} +PLATFORM_VERSION = ${platform_version} + +# +# Build Configuration Macro Definition +# +TOOLCHAIN = ${toolchain_tag} +TOOLCHAIN_TAG = ${toolchain_tag} +TARGET = ${build_target} + +# +# Build Directory Macro Definition +# +BUILD_DIR = ${platform_build_directory} +FV_DIR = ${platform_build_directory}${separator}FV + +# +# Shell Command Macro +# +${BEGIN}${shell_command_code} = ${shell_command} +${END} + +MAKE = ${make_path} +MAKE_FILE = ${makefile_path} + +# +# Default target +# +all: modules fds + +# +# Initialization target: print build information and create necessary directories +# +init: +\t-@ +\t${BEGIN}-@${create_directory_command} +\t${END} +# +# library build target +# +libraries: init +${BEGIN}\t@cd $(BUILD_DIR)${separator}${arch} && "$(MAKE)" $(MAKE_FLAGS) libraries +${END}\t@cd $(BUILD_DIR) + +# +# module build target +# +modules: init +${BEGIN}\t@cd $(BUILD_DIR)${separator}${arch} && "$(MAKE)" $(MAKE_FLAGS) modules +${END}\t@cd $(BUILD_DIR) + +# +# Flash Device Image Target +# +fds: init +\t-@cd $(FV_DIR) +${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -C ${cap} ${END}${BEGIN} -D ${macro} ${END} + +# +# run command for emulator platform only +# +run: +\tcd $(BUILD_DIR)${separator}IA32 && ".${separator}SecMain" +\tcd $(BUILD_DIR) + +# +# Clean intermediate files +# +clean: +${BEGIN}\t-@${sub_build_command} clean +${END}\t@cd $(BUILD_DIR) + +# +# Clean all generated files except to makefile +# +cleanall: +${BEGIN}\t${cleanall_command} +${END} + +# +# Clean all library files +# +cleanlib: +${BEGIN}\t-@${sub_build_command} cleanlib +${END}\t@cd $(BUILD_DIR)\n +''') + + ## Constructor of TopLevelMakefile + # + # @param Workspace Object of WorkspaceAutoGen class + # + def __init__(self, Workspace): + BuildFile.__init__(self, Workspace) + self.IntermediateDirectoryList = [] + + # Compose a dict object containing information used to do replacement in template + def _CreateTemplateDict(self): + Separator = self._SEP_[self._FileType] + + # any platform autogen object is ok because we just need common information + PlatformInfo = self._AutoGenObject + + if "MAKE" not in PlatformInfo.ToolDefinition or "PATH" not in PlatformInfo.ToolDefinition["MAKE"]: + EdkLogger.error("build", OPTION_MISSING, "No MAKE command defined. Please check your tools_def.txt!", + ExtraData="[%s]" % str(self._AutoGenObject)) + + for Arch in PlatformInfo.ArchList: + self.IntermediateDirectoryList.append(Separator.join(["$(BUILD_DIR)", Arch])) + self.IntermediateDirectoryList.append("$(FV_DIR)") + + # TRICK: for not generating GenFds call in makefile if no FDF file + MacroList = [] + if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "": + FdfFileList = [PlatformInfo.FdfFile] + # macros passed to GenFds + MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\'))) + MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource.replace('\\', '\\\\'))) + MacroDict = {} + MacroDict.update(GlobalData.gGlobalDefines) + MacroDict.update(GlobalData.gCommandLineDefines) + MacroDict.pop("EFI_SOURCE", "dummy") + MacroDict.pop("EDK_SOURCE", "dummy") + for MacroName in MacroDict: + if MacroDict[MacroName] != "": + MacroList.append('"%s=%s"' % (MacroName, MacroDict[MacroName].replace('\\', '\\\\'))) + else: + MacroList.append('"%s"' % MacroName) + else: + FdfFileList = [] + + # pass extra common options to external program called in makefile, currently GenFds.exe + ExtraOption = '' + LogLevel = EdkLogger.GetLevel() + if LogLevel == EdkLogger.VERBOSE: + ExtraOption += " -v" + elif LogLevel <= EdkLogger.DEBUG_9: + ExtraOption += " -d %d" % (LogLevel - 1) + elif LogLevel == EdkLogger.QUIET: + ExtraOption += " -q" + + if GlobalData.gCaseInsensitive: + ExtraOption += " -c" + + MakefileName = self._FILE_NAME_[self._FileType] + SubBuildCommandList = [] + for A in PlatformInfo.ArchList: + Command = self._MAKE_TEMPLATE_[self._FileType] % {"file":os.path.join("$(BUILD_DIR)", A, MakefileName)} + SubBuildCommandList.append(Command) + + MakefileTemplateDict = { + "makefile_header" : self._FILE_HEADER_[self._FileType], + "makefile_path" : os.path.join("$(BUILD_DIR)", MakefileName), + "make_path" : PlatformInfo.ToolDefinition["MAKE"]["PATH"], + "platform_name" : PlatformInfo.Name, + "platform_guid" : PlatformInfo.Guid, + "platform_version" : PlatformInfo.Version, + "platform_build_directory" : PlatformInfo.BuildDir, + + "toolchain_tag" : PlatformInfo.ToolChain, + "build_target" : PlatformInfo.BuildTarget, + "shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), + "shell_command" : self._SHELL_CMD_[self._FileType].values(), + 'arch' : list(PlatformInfo.ArchList), + "build_architecture_list" : ','.join(PlatformInfo.ArchList), + "separator" : Separator, + "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList), + "cleanall_command" : self.GetRemoveDirectoryCommand(self.IntermediateDirectoryList), + "sub_build_command" : SubBuildCommandList, + "fdf_file" : FdfFileList, + "active_platform" : str(PlatformInfo), + "fd" : PlatformInfo.FdTargetList, + "fv" : PlatformInfo.FvTargetList, + "cap" : PlatformInfo.CapTargetList, + "extra_options" : ExtraOption, + "macro" : MacroList, + } + + return MakefileTemplateDict + + ## Get the root directory list for intermediate files of all modules build + # + # @retval list The list of directory + # + def GetModuleBuildDirectoryList(self): + DirList = [] + for ModuleAutoGen in self._AutoGenObject.ModuleAutoGenList: + DirList.append(os.path.join(self._AutoGenObject.BuildDir, ModuleAutoGen.BuildDir)) + return DirList + + ## Get the root directory list for intermediate files of all libraries build + # + # @retval list The list of directory + # + def GetLibraryBuildDirectoryList(self): + DirList = [] + for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList: + DirList.append(os.path.join(self._AutoGenObject.BuildDir, LibraryAutoGen.BuildDir)) + return DirList + + _TemplateDict = property(_CreateTemplateDict) + +# This acts like the main() function for the script, unless it is 'import'ed into another script. +if __name__ == '__main__': + pass + diff --git a/BaseTools/Source/Python/Common/BuildToolError.py b/BaseTools/Source/Python/Common/BuildToolError.py index 4d4e07bd70..b9512a1b4d 100644 --- a/BaseTools/Source/Python/Common/BuildToolError.py +++ b/BaseTools/Source/Python/Common/BuildToolError.py @@ -1,154 +1,154 @@ -## @file -# Standardized Error Hanlding infrastructures. -# -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -FILE_OPEN_FAILURE = 1 -FILE_WRITE_FAILURE = 2 -FILE_PARSE_FAILURE = 3 -FILE_READ_FAILURE = 4 -FILE_CREATE_FAILURE = 5 -FILE_CHECKSUM_FAILURE = 6 -FILE_COMPRESS_FAILURE = 7 -FILE_DECOMPRESS_FAILURE = 8 -FILE_MOVE_FAILURE = 9 -FILE_DELETE_FAILURE = 10 -FILE_COPY_FAILURE = 11 -FILE_POSITIONING_FAILURE = 12 -FILE_ALREADY_EXIST = 13 -FILE_NOT_FOUND = 14 -FILE_TYPE_MISMATCH = 15 -FILE_CASE_MISMATCH = 16 -FILE_DUPLICATED = 17 -FILE_UNKNOWN_ERROR = 0x0FFF - -OPTION_UNKNOWN = 0x1000 -OPTION_MISSING = 0x1001 -OPTION_CONFLICT = 0x1002 -OPTION_VALUE_INVALID = 0x1003 -OPTION_DEPRECATED = 0x1004 -OPTION_NOT_SUPPORTED = 0x1005 -OPTION_UNKNOWN_ERROR = 0x1FFF - -PARAMETER_INVALID = 0x2000 -PARAMETER_MISSING = 0x2001 -PARAMETER_UNKNOWN_ERROR =0x2FFF - -FORMAT_INVALID = 0x3000 -FORMAT_NOT_SUPPORTED = 0x3001 -FORMAT_UNKNOWN = 0x3002 -FORMAT_UNKNOWN_ERROR = 0x3FFF - -RESOURCE_NOT_AVAILABLE = 0x4000 -RESOURCE_ALLOCATE_FAILURE = 0x4001 -RESOURCE_FULL = 0x4002 -RESOURCE_OVERFLOW = 0x4003 -RESOURCE_UNDERRUN = 0x4004 -RESOURCE_UNKNOWN_ERROR = 0x4FFF - -ATTRIBUTE_NOT_AVAILABLE = 0x5000 -ATTRIBUTE_GET_FAILURE = 0x5001 -ATTRIBUTE_SET_FAILURE = 0x5002 -ATTRIBUTE_UPDATE_FAILURE = 0x5003 -ATTRIBUTE_ACCESS_DENIED = 0x5004 -ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF - -IO_NOT_READY = 0x6000 -IO_BUSY = 0x6001 -IO_TIMEOUT = 0x6002 -IO_UNKNOWN_ERROR = 0x6FFF - -COMMAND_FAILURE = 0x7000 - -PERMISSION_FAILURE = 0x8000 - -CODE_ERROR = 0xC0DE - -AUTOGEN_ERROR = 0xF000 -PARSER_ERROR = 0xF001 -BUILD_ERROR = 0xF002 -GENFDS_ERROR = 0xF003 -ECC_ERROR = 0xF004 -EOT_ERROR = 0xF005 -DDC_ERROR = 0xF009 -WARNING_AS_ERROR = 0xF006 -MIGRATION_ERROR = 0xF010 -ABORT_ERROR = 0xFFFE -UNKNOWN_ERROR = 0xFFFF - -## Error message of each error code -gErrorMessage = { - FILE_NOT_FOUND : "File/directory not found in workspace", - FILE_OPEN_FAILURE : "File open failure", - FILE_WRITE_FAILURE : "File write failure", - FILE_PARSE_FAILURE : "File parse failure", - FILE_READ_FAILURE : "File read failure", - FILE_CREATE_FAILURE : "File create failure", - FILE_CHECKSUM_FAILURE : "Invalid checksum of file", - FILE_COMPRESS_FAILURE : "File compress failure", - FILE_DECOMPRESS_FAILURE : "File decompress failure", - FILE_MOVE_FAILURE : "File move failure", - FILE_DELETE_FAILURE : "File delete failure", - FILE_COPY_FAILURE : "File copy failure", - FILE_POSITIONING_FAILURE: "Failed to seeking position", - FILE_ALREADY_EXIST : "File or directory already exists", - FILE_TYPE_MISMATCH : "Incorrect file type", - FILE_CASE_MISMATCH : "File name case mismatch", - FILE_DUPLICATED : "Duplicated file found", - FILE_UNKNOWN_ERROR : "Unknown error encountered on file", - - OPTION_UNKNOWN : "Unknown option", - OPTION_MISSING : "Missing option", - OPTION_CONFLICT : "Conflict options", - OPTION_VALUE_INVALID : "Invalid value of option", - OPTION_DEPRECATED : "Deprecated option", - OPTION_NOT_SUPPORTED : "Unsupported option", - OPTION_UNKNOWN_ERROR : "Unknown error when processing options", - - PARAMETER_INVALID : "Invalid parameter", - PARAMETER_MISSING : "Missing parameter", - PARAMETER_UNKNOWN_ERROR : "Unknown error in parameters", - - FORMAT_INVALID : "Invalid syntax/format", - FORMAT_NOT_SUPPORTED : "Not supported syntax/format", - FORMAT_UNKNOWN : "Unknown format", - FORMAT_UNKNOWN_ERROR : "Unknown error in syntax/format ", - - RESOURCE_NOT_AVAILABLE : "Not available", - RESOURCE_ALLOCATE_FAILURE : "Allocate failure", - RESOURCE_FULL : "Full", - RESOURCE_OVERFLOW : "Overflow", - RESOURCE_UNDERRUN : "Underrun", - RESOURCE_UNKNOWN_ERROR : "Unknown error", - - ATTRIBUTE_NOT_AVAILABLE : "Not available", - ATTRIBUTE_GET_FAILURE : "Failed to retrieve", - ATTRIBUTE_SET_FAILURE : "Failed to set", - ATTRIBUTE_UPDATE_FAILURE: "Failed to update", - ATTRIBUTE_ACCESS_DENIED : "Access denied", - ATTRIBUTE_UNKNOWN_ERROR : "Unknown error when accessing", - - COMMAND_FAILURE : "Failed to execute command", - - IO_NOT_READY : "Not ready", - IO_BUSY : "Busy", - IO_TIMEOUT : "Timeout", - IO_UNKNOWN_ERROR : "Unknown error in IO operation", - - UNKNOWN_ERROR : "Unknown error", -} - -## Exception indicating a fatal error -class FatalError(Exception): - pass - -if __name__ == "__main__": - pass +## @file +# Standardized Error Hanlding infrastructures. +# +# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +FILE_OPEN_FAILURE = 1 +FILE_WRITE_FAILURE = 2 +FILE_PARSE_FAILURE = 3 +FILE_READ_FAILURE = 4 +FILE_CREATE_FAILURE = 5 +FILE_CHECKSUM_FAILURE = 6 +FILE_COMPRESS_FAILURE = 7 +FILE_DECOMPRESS_FAILURE = 8 +FILE_MOVE_FAILURE = 9 +FILE_DELETE_FAILURE = 10 +FILE_COPY_FAILURE = 11 +FILE_POSITIONING_FAILURE = 12 +FILE_ALREADY_EXIST = 13 +FILE_NOT_FOUND = 14 +FILE_TYPE_MISMATCH = 15 +FILE_CASE_MISMATCH = 16 +FILE_DUPLICATED = 17 +FILE_UNKNOWN_ERROR = 0x0FFF + +OPTION_UNKNOWN = 0x1000 +OPTION_MISSING = 0x1001 +OPTION_CONFLICT = 0x1002 +OPTION_VALUE_INVALID = 0x1003 +OPTION_DEPRECATED = 0x1004 +OPTION_NOT_SUPPORTED = 0x1005 +OPTION_UNKNOWN_ERROR = 0x1FFF + +PARAMETER_INVALID = 0x2000 +PARAMETER_MISSING = 0x2001 +PARAMETER_UNKNOWN_ERROR =0x2FFF + +FORMAT_INVALID = 0x3000 +FORMAT_NOT_SUPPORTED = 0x3001 +FORMAT_UNKNOWN = 0x3002 +FORMAT_UNKNOWN_ERROR = 0x3FFF + +RESOURCE_NOT_AVAILABLE = 0x4000 +RESOURCE_ALLOCATE_FAILURE = 0x4001 +RESOURCE_FULL = 0x4002 +RESOURCE_OVERFLOW = 0x4003 +RESOURCE_UNDERRUN = 0x4004 +RESOURCE_UNKNOWN_ERROR = 0x4FFF + +ATTRIBUTE_NOT_AVAILABLE = 0x5000 +ATTRIBUTE_GET_FAILURE = 0x5001 +ATTRIBUTE_SET_FAILURE = 0x5002 +ATTRIBUTE_UPDATE_FAILURE = 0x5003 +ATTRIBUTE_ACCESS_DENIED = 0x5004 +ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF + +IO_NOT_READY = 0x6000 +IO_BUSY = 0x6001 +IO_TIMEOUT = 0x6002 +IO_UNKNOWN_ERROR = 0x6FFF + +COMMAND_FAILURE = 0x7000 + +PERMISSION_FAILURE = 0x8000 + +CODE_ERROR = 0xC0DE + +AUTOGEN_ERROR = 0xF000 +PARSER_ERROR = 0xF001 +BUILD_ERROR = 0xF002 +GENFDS_ERROR = 0xF003 +ECC_ERROR = 0xF004 +EOT_ERROR = 0xF005 +DDC_ERROR = 0xF009 +WARNING_AS_ERROR = 0xF006 +MIGRATION_ERROR = 0xF010 +ABORT_ERROR = 0xFFFE +UNKNOWN_ERROR = 0xFFFF + +## Error message of each error code +gErrorMessage = { + FILE_NOT_FOUND : "File/directory not found in workspace", + FILE_OPEN_FAILURE : "File open failure", + FILE_WRITE_FAILURE : "File write failure", + FILE_PARSE_FAILURE : "File parse failure", + FILE_READ_FAILURE : "File read failure", + FILE_CREATE_FAILURE : "File create failure", + FILE_CHECKSUM_FAILURE : "Invalid checksum of file", + FILE_COMPRESS_FAILURE : "File compress failure", + FILE_DECOMPRESS_FAILURE : "File decompress failure", + FILE_MOVE_FAILURE : "File move failure", + FILE_DELETE_FAILURE : "File delete failure", + FILE_COPY_FAILURE : "File copy failure", + FILE_POSITIONING_FAILURE: "Failed to seeking position", + FILE_ALREADY_EXIST : "File or directory already exists", + FILE_TYPE_MISMATCH : "Incorrect file type", + FILE_CASE_MISMATCH : "File name case mismatch", + FILE_DUPLICATED : "Duplicated file found", + FILE_UNKNOWN_ERROR : "Unknown error encountered on file", + + OPTION_UNKNOWN : "Unknown option", + OPTION_MISSING : "Missing option", + OPTION_CONFLICT : "Conflict options", + OPTION_VALUE_INVALID : "Invalid value of option", + OPTION_DEPRECATED : "Deprecated option", + OPTION_NOT_SUPPORTED : "Unsupported option", + OPTION_UNKNOWN_ERROR : "Unknown error when processing options", + + PARAMETER_INVALID : "Invalid parameter", + PARAMETER_MISSING : "Missing parameter", + PARAMETER_UNKNOWN_ERROR : "Unknown error in parameters", + + FORMAT_INVALID : "Invalid syntax/format", + FORMAT_NOT_SUPPORTED : "Not supported syntax/format", + FORMAT_UNKNOWN : "Unknown format", + FORMAT_UNKNOWN_ERROR : "Unknown error in syntax/format ", + + RESOURCE_NOT_AVAILABLE : "Not available", + RESOURCE_ALLOCATE_FAILURE : "Allocate failure", + RESOURCE_FULL : "Full", + RESOURCE_OVERFLOW : "Overflow", + RESOURCE_UNDERRUN : "Underrun", + RESOURCE_UNKNOWN_ERROR : "Unknown error", + + ATTRIBUTE_NOT_AVAILABLE : "Not available", + ATTRIBUTE_GET_FAILURE : "Failed to retrieve", + ATTRIBUTE_SET_FAILURE : "Failed to set", + ATTRIBUTE_UPDATE_FAILURE: "Failed to update", + ATTRIBUTE_ACCESS_DENIED : "Access denied", + ATTRIBUTE_UNKNOWN_ERROR : "Unknown error when accessing", + + COMMAND_FAILURE : "Failed to execute command", + + IO_NOT_READY : "Not ready", + IO_BUSY : "Busy", + IO_TIMEOUT : "Timeout", + IO_UNKNOWN_ERROR : "Unknown error in IO operation", + + UNKNOWN_ERROR : "Unknown error", +} + +## Exception indicating a fatal error +class FatalError(Exception): + pass + +if __name__ == "__main__": + pass diff --git a/BaseTools/Source/Python/Common/BuildVersion.py b/BaseTools/Source/Python/Common/BuildVersion.py index 4decd82c70..bfd4d43bb9 100644 --- a/BaseTools/Source/Python/Common/BuildVersion.py +++ b/BaseTools/Source/Python/Common/BuildVersion.py @@ -13,4 +13,4 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -gBUILD_VERSION = "Build 2640" +gBUILD_VERSION = "Build 2649" diff --git a/BaseTools/Source/Python/Common/EdkLogger.py b/BaseTools/Source/Python/Common/EdkLogger.py index a3bcb3a147..10e7222b3d 100644 --- a/BaseTools/Source/Python/Common/EdkLogger.py +++ b/BaseTools/Source/Python/Common/EdkLogger.py @@ -1,269 +1,269 @@ -## @file -# This file implements the log mechanism for Python tools. -# -# Copyright (c) 2007, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## Import modules -import sys, os, logging -import traceback -from BuildToolError import * - -## Log level constants -DEBUG_0 = 1 -DEBUG_1 = 2 -DEBUG_2 = 3 -DEBUG_3 = 4 -DEBUG_4 = 5 -DEBUG_5 = 6 -DEBUG_6 = 7 -DEBUG_7 = 8 -DEBUG_8 = 9 -DEBUG_9 = 10 -VERBOSE = 15 -INFO = 20 -WARN = 30 -QUIET = 40 -ERROR = 50 - -IsRaiseError = True - -# Tool name -_ToolName = os.path.basename(sys.argv[0]) - -# For validation purpose -_LogLevels = [DEBUG_0, DEBUG_1, DEBUG_2, DEBUG_3, DEBUG_4, DEBUG_5, DEBUG_6, DEBUG_7, DEBUG_8, DEBUG_9, VERBOSE, WARN, INFO, ERROR, QUIET] - -# For DEBUG level (All DEBUG_0~9 are applicable) -_DebugLogger = logging.getLogger("tool_debug") -_DebugFormatter = logging.Formatter("[%(asctime)s.%(msecs)d]: %(message)s", datefmt="%H:%M:%S") - -# For VERBOSE, INFO, WARN level -_InfoLogger = logging.getLogger("tool_info") -_InfoFormatter = logging.Formatter("%(message)s") - -# For ERROR level -_ErrorLogger = logging.getLogger("tool_error") -_ErrorFormatter = logging.Formatter("%(message)s") - -# String templates for ERROR/WARN/DEBUG log message -_ErrorMessageTemplate = '\n\n%(tool)s...\n%(file)s(%(line)s): error %(errorcode)04X: %(msg)s\n\t%(extra)s' -_ErrorMessageTemplateWithoutFile = '\n\n%(tool)s...\n : error %(errorcode)04X: %(msg)s\n\t%(extra)s' -_WarningMessageTemplate = '%(tool)s...\n%(file)s(%(line)s): warning: %(msg)s' -_WarningMessageTemplateWithoutFile = '%(tool)s: : warning: %(msg)s' -_DebugMessageTemplate = '%(file)s(%(line)s): debug: \n %(msg)s' - -# -# Flag used to take WARN as ERROR. -# By default, only ERROR message will break the tools execution. -# -_WarningAsError = False - -## Log debug message -# -# @param Level DEBUG level (DEBUG0~9) -# @param Message Debug information -# @param ExtraData More information associated with "Message" -# -def debug(Level, Message, ExtraData=None): - if _DebugLogger.level > Level: - return - if Level > DEBUG_9: - return - - # Find out the caller method information - CallerStack = traceback.extract_stack()[-2] - TemplateDict = { - "file" : CallerStack[0], - "line" : CallerStack[1], - "msg" : Message, - } - - if ExtraData != None: - LogText = _DebugMessageTemplate % TemplateDict + "\n %s" % ExtraData - else: - LogText = _DebugMessageTemplate % TemplateDict - - _DebugLogger.log(Level, LogText) - -## Log verbose message -# -# @param Message Verbose information -# -def verbose(Message): - return _InfoLogger.log(VERBOSE, Message) - -## Log warning message -# -# Warning messages are those which might be wrong but won't fail the tool. -# -# @param ToolName The name of the tool. If not given, the name of caller -# method will be used. -# @param Message Warning information -# @param File The name of file which caused the warning. -# @param Line The line number in the "File" which caused the warning. -# @param ExtraData More information associated with "Message" -# -def warn(ToolName, Message, File=None, Line=None, ExtraData=None): - if _InfoLogger.level > WARN: - return - - # if no tool name given, use caller's source file name as tool name - if ToolName == None or ToolName == "": - ToolName = os.path.basename(traceback.extract_stack()[-2][0]) - - if Line == None: - Line = "..." - else: - Line = "%d" % Line - - TemplateDict = { - "tool" : ToolName, - "file" : File, - "line" : Line, - "msg" : Message, - } - - if File != None: - LogText = _WarningMessageTemplate % TemplateDict - else: - LogText = _WarningMessageTemplateWithoutFile % TemplateDict - - if ExtraData != None: - LogText += "\n %s" % ExtraData - - _InfoLogger.log(WARN, LogText) - - # Raise an execption if indicated - if _WarningAsError == True: - raise FatalError(WARNING_AS_ERROR) - -## Log INFO message -info = _InfoLogger.info - -## Log ERROR message -# -# Once an error messages is logged, the tool's execution will be broken by raising -# an execption. If you don't want to break the execution later, you can give -# "RaiseError" with "False" value. -# -# @param ToolName The name of the tool. If not given, the name of caller -# method will be used. -# @param ErrorCode The error code -# @param Message Warning information -# @param File The name of file which caused the error. -# @param Line The line number in the "File" which caused the warning. -# @param ExtraData More information associated with "Message" -# @param RaiseError Raise an exception to break the tool's executuion if -# it's True. This is the default behavior. -# -def error(ToolName, ErrorCode, Message=None, File=None, Line=None, ExtraData=None, RaiseError=IsRaiseError): - if Line == None: - Line = "..." - else: - Line = "%d" % Line - - if Message == None: - if ErrorCode in gErrorMessage: - Message = gErrorMessage[ErrorCode] - else: - Message = gErrorMessage[UNKNOWN_ERROR] - - if ExtraData == None: - ExtraData = "" - - TemplateDict = { - "tool" : _ToolName, - "file" : File, - "line" : Line, - "errorcode" : ErrorCode, - "msg" : Message, - "extra" : ExtraData - } - - if File != None: - LogText = _ErrorMessageTemplate % TemplateDict - else: - LogText = _ErrorMessageTemplateWithoutFile % TemplateDict - - _ErrorLogger.log(ERROR, LogText) - if RaiseError: - raise FatalError(ErrorCode) - -# Log information which should be always put out -quiet = _ErrorLogger.error - -## Initialize log system -def Initialize(): - # - # Since we use different format to log different levels of message into different - # place (stdout or stderr), we have to use different "Logger" objects to do this. - # - # For DEBUG level (All DEBUG_0~9 are applicable) - _DebugLogger.setLevel(INFO) - _DebugChannel = logging.StreamHandler(sys.stdout) - _DebugChannel.setFormatter(_DebugFormatter) - _DebugLogger.addHandler(_DebugChannel) - - # For VERBOSE, INFO, WARN level - _InfoLogger.setLevel(INFO) - _InfoChannel = logging.StreamHandler(sys.stdout) - _InfoChannel.setFormatter(_InfoFormatter) - _InfoLogger.addHandler(_InfoChannel) - - # For ERROR level - _ErrorLogger.setLevel(INFO) - _ErrorCh = logging.StreamHandler(sys.stderr) - _ErrorCh.setFormatter(_ErrorFormatter) - _ErrorLogger.addHandler(_ErrorCh) - -## Set log level -# -# @param Level One of log level in _LogLevel -def SetLevel(Level): - if Level not in _LogLevels: - info("Not supported log level (%d). Use default level instead." % Level) - Level = INFO - _DebugLogger.setLevel(Level) - _InfoLogger.setLevel(Level) - _ErrorLogger.setLevel(Level) - -## Get current log level -def GetLevel(): - return _InfoLogger.getEffectiveLevel() - -## Raise up warning as error -def SetWarningAsError(): - global _WarningAsError - _WarningAsError = True - -## Specify a file to store the log message as well as put on console -# -# @param LogFile The file path used to store the log message -# -def SetLogFile(LogFile): - if os.path.exists(LogFile): - os.remove(LogFile) - - _Ch = logging.FileHandler(LogFile) - _Ch.setFormatter(_DebugFormatter) - _DebugLogger.addHandler(_Ch) - - _Ch= logging.FileHandler(LogFile) - _Ch.setFormatter(_InfoFormatter) - _InfoLogger.addHandler(_Ch) - - _Ch = logging.FileHandler(LogFile) - _Ch.setFormatter(_ErrorFormatter) - _ErrorLogger.addHandler(_Ch) - -if __name__ == '__main__': - pass - +## @file +# This file implements the log mechanism for Python tools. +# +# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## Import modules +import sys, os, logging +import traceback +from BuildToolError import * + +## Log level constants +DEBUG_0 = 1 +DEBUG_1 = 2 +DEBUG_2 = 3 +DEBUG_3 = 4 +DEBUG_4 = 5 +DEBUG_5 = 6 +DEBUG_6 = 7 +DEBUG_7 = 8 +DEBUG_8 = 9 +DEBUG_9 = 10 +VERBOSE = 15 +INFO = 20 +WARN = 30 +QUIET = 40 +ERROR = 50 + +IsRaiseError = True + +# Tool name +_ToolName = os.path.basename(sys.argv[0]) + +# For validation purpose +_LogLevels = [DEBUG_0, DEBUG_1, DEBUG_2, DEBUG_3, DEBUG_4, DEBUG_5, DEBUG_6, DEBUG_7, DEBUG_8, DEBUG_9, VERBOSE, WARN, INFO, ERROR, QUIET] + +# For DEBUG level (All DEBUG_0~9 are applicable) +_DebugLogger = logging.getLogger("tool_debug") +_DebugFormatter = logging.Formatter("[%(asctime)s.%(msecs)d]: %(message)s", datefmt="%H:%M:%S") + +# For VERBOSE, INFO, WARN level +_InfoLogger = logging.getLogger("tool_info") +_InfoFormatter = logging.Formatter("%(message)s") + +# For ERROR level +_ErrorLogger = logging.getLogger("tool_error") +_ErrorFormatter = logging.Formatter("%(message)s") + +# String templates for ERROR/WARN/DEBUG log message +_ErrorMessageTemplate = '\n\n%(tool)s...\n%(file)s(%(line)s): error %(errorcode)04X: %(msg)s\n\t%(extra)s' +_ErrorMessageTemplateWithoutFile = '\n\n%(tool)s...\n : error %(errorcode)04X: %(msg)s\n\t%(extra)s' +_WarningMessageTemplate = '%(tool)s...\n%(file)s(%(line)s): warning: %(msg)s' +_WarningMessageTemplateWithoutFile = '%(tool)s: : warning: %(msg)s' +_DebugMessageTemplate = '%(file)s(%(line)s): debug: \n %(msg)s' + +# +# Flag used to take WARN as ERROR. +# By default, only ERROR message will break the tools execution. +# +_WarningAsError = False + +## Log debug message +# +# @param Level DEBUG level (DEBUG0~9) +# @param Message Debug information +# @param ExtraData More information associated with "Message" +# +def debug(Level, Message, ExtraData=None): + if _DebugLogger.level > Level: + return + if Level > DEBUG_9: + return + + # Find out the caller method information + CallerStack = traceback.extract_stack()[-2] + TemplateDict = { + "file" : CallerStack[0], + "line" : CallerStack[1], + "msg" : Message, + } + + if ExtraData != None: + LogText = _DebugMessageTemplate % TemplateDict + "\n %s" % ExtraData + else: + LogText = _DebugMessageTemplate % TemplateDict + + _DebugLogger.log(Level, LogText) + +## Log verbose message +# +# @param Message Verbose information +# +def verbose(Message): + return _InfoLogger.log(VERBOSE, Message) + +## Log warning message +# +# Warning messages are those which might be wrong but won't fail the tool. +# +# @param ToolName The name of the tool. If not given, the name of caller +# method will be used. +# @param Message Warning information +# @param File The name of file which caused the warning. +# @param Line The line number in the "File" which caused the warning. +# @param ExtraData More information associated with "Message" +# +def warn(ToolName, Message, File=None, Line=None, ExtraData=None): + if _InfoLogger.level > WARN: + return + + # if no tool name given, use caller's source file name as tool name + if ToolName == None or ToolName == "": + ToolName = os.path.basename(traceback.extract_stack()[-2][0]) + + if Line == None: + Line = "..." + else: + Line = "%d" % Line + + TemplateDict = { + "tool" : ToolName, + "file" : File, + "line" : Line, + "msg" : Message, + } + + if File != None: + LogText = _WarningMessageTemplate % TemplateDict + else: + LogText = _WarningMessageTemplateWithoutFile % TemplateDict + + if ExtraData != None: + LogText += "\n %s" % ExtraData + + _InfoLogger.log(WARN, LogText) + + # Raise an execption if indicated + if _WarningAsError == True: + raise FatalError(WARNING_AS_ERROR) + +## Log INFO message +info = _InfoLogger.info + +## Log ERROR message +# +# Once an error messages is logged, the tool's execution will be broken by raising +# an execption. If you don't want to break the execution later, you can give +# "RaiseError" with "False" value. +# +# @param ToolName The name of the tool. If not given, the name of caller +# method will be used. +# @param ErrorCode The error code +# @param Message Warning information +# @param File The name of file which caused the error. +# @param Line The line number in the "File" which caused the warning. +# @param ExtraData More information associated with "Message" +# @param RaiseError Raise an exception to break the tool's executuion if +# it's True. This is the default behavior. +# +def error(ToolName, ErrorCode, Message=None, File=None, Line=None, ExtraData=None, RaiseError=IsRaiseError): + if Line == None: + Line = "..." + else: + Line = "%d" % Line + + if Message == None: + if ErrorCode in gErrorMessage: + Message = gErrorMessage[ErrorCode] + else: + Message = gErrorMessage[UNKNOWN_ERROR] + + if ExtraData == None: + ExtraData = "" + + TemplateDict = { + "tool" : _ToolName, + "file" : File, + "line" : Line, + "errorcode" : ErrorCode, + "msg" : Message, + "extra" : ExtraData + } + + if File != None: + LogText = _ErrorMessageTemplate % TemplateDict + else: + LogText = _ErrorMessageTemplateWithoutFile % TemplateDict + + _ErrorLogger.log(ERROR, LogText) + if RaiseError: + raise FatalError(ErrorCode) + +# Log information which should be always put out +quiet = _ErrorLogger.error + +## Initialize log system +def Initialize(): + # + # Since we use different format to log different levels of message into different + # place (stdout or stderr), we have to use different "Logger" objects to do this. + # + # For DEBUG level (All DEBUG_0~9 are applicable) + _DebugLogger.setLevel(INFO) + _DebugChannel = logging.StreamHandler(sys.stdout) + _DebugChannel.setFormatter(_DebugFormatter) + _DebugLogger.addHandler(_DebugChannel) + + # For VERBOSE, INFO, WARN level + _InfoLogger.setLevel(INFO) + _InfoChannel = logging.StreamHandler(sys.stdout) + _InfoChannel.setFormatter(_InfoFormatter) + _InfoLogger.addHandler(_InfoChannel) + + # For ERROR level + _ErrorLogger.setLevel(INFO) + _ErrorCh = logging.StreamHandler(sys.stderr) + _ErrorCh.setFormatter(_ErrorFormatter) + _ErrorLogger.addHandler(_ErrorCh) + +## Set log level +# +# @param Level One of log level in _LogLevel +def SetLevel(Level): + if Level not in _LogLevels: + info("Not supported log level (%d). Use default level instead." % Level) + Level = INFO + _DebugLogger.setLevel(Level) + _InfoLogger.setLevel(Level) + _ErrorLogger.setLevel(Level) + +## Get current log level +def GetLevel(): + return _InfoLogger.getEffectiveLevel() + +## Raise up warning as error +def SetWarningAsError(): + global _WarningAsError + _WarningAsError = True + +## Specify a file to store the log message as well as put on console +# +# @param LogFile The file path used to store the log message +# +def SetLogFile(LogFile): + if os.path.exists(LogFile): + os.remove(LogFile) + + _Ch = logging.FileHandler(LogFile) + _Ch.setFormatter(_DebugFormatter) + _DebugLogger.addHandler(_Ch) + + _Ch= logging.FileHandler(LogFile) + _Ch.setFormatter(_InfoFormatter) + _InfoLogger.addHandler(_Ch) + + _Ch = logging.FileHandler(LogFile) + _Ch.setFormatter(_ErrorFormatter) + _ErrorLogger.addHandler(_Ch) + +if __name__ == '__main__': + pass + diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py index 4fbe721823..1f9d91c5d8 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -1,71 +1,71 @@ -## @file -# This file is used to define common static strings used by INF/DEC/DSC files -# -# Copyright (c) 2007, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -import re - -gIsWindows = None - -gEdkCompatibilityPkg = "EdkCompatibilityPkg" -gWorkspace = "." -gEdkSource = "EdkCompatibilityPkg" -gEfiSource = "." -gEcpSource = "EdkCompatibilityPkg" - -gOptions = None -gCaseInsensitive = False -gAllFiles = None - -gGlobalDefines = {} -gPlatformDefines = {} -# PCD name and value pair for fixed at build and feature flag -gPlatformPcds = {} -# PCDs with type that are not fixed at build and feature flag -gPlatformOtherPcds = {} -gActivePlatform = None -gCommandLineDefines = {} -gEdkGlobal = {} -gOverrideDir = {} - -# for debug trace purpose when problem occurs -gProcessingFile = '' -gBuildingModule = '' - -## Regular expression for matching macro used in DSC/DEC/INF file inclusion -gMacroRefPattern = re.compile("\$\(([A-Z][_A-Z0-9]*)\)", re.UNICODE) -gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+") -gMacroNamePattern = re.compile("^[A-Z][A-Z0-9_]*$") -# C-style wide string pattern -gWideStringPattern = re.compile('(\W|\A)L"') -# -# A global variable for whether current build in AutoGen phase or not. -# -gAutoGenPhase = False - -# -# The Conf dir outside the workspace dir -# -gConfDirectory = '' - -# -# The relative default database file path -# -gDatabasePath = ".cache/build.db" - -# -# Build flag for binary build -# -gIgnoreSource = False - -# -# FDF parser -# -gFdfParser = None +## @file +# This file is used to define common static strings used by INF/DEC/DSC files +# +# Copyright (c) 2007, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +import re + +gIsWindows = None + +gEdkCompatibilityPkg = "EdkCompatibilityPkg" +gWorkspace = "." +gEdkSource = "EdkCompatibilityPkg" +gEfiSource = "." +gEcpSource = "EdkCompatibilityPkg" + +gOptions = None +gCaseInsensitive = False +gAllFiles = None + +gGlobalDefines = {} +gPlatformDefines = {} +# PCD name and value pair for fixed at build and feature flag +gPlatformPcds = {} +# PCDs with type that are not fixed at build and feature flag +gPlatformOtherPcds = {} +gActivePlatform = None +gCommandLineDefines = {} +gEdkGlobal = {} +gOverrideDir = {} + +# for debug trace purpose when problem occurs +gProcessingFile = '' +gBuildingModule = '' + +## Regular expression for matching macro used in DSC/DEC/INF file inclusion +gMacroRefPattern = re.compile("\$\(([A-Z][_A-Z0-9]*)\)", re.UNICODE) +gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+") +gMacroNamePattern = re.compile("^[A-Z][A-Z0-9_]*$") +# C-style wide string pattern +gWideStringPattern = re.compile('(\W|\A)L"') +# +# A global variable for whether current build in AutoGen phase or not. +# +gAutoGenPhase = False + +# +# The Conf dir outside the workspace dir +# +gConfDirectory = '' + +# +# The relative default database file path +# +gDatabasePath = ".cache/build.db" + +# +# Build flag for binary build +# +gIgnoreSource = False + +# +# FDF parser +# +gFdfParser = None diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index fafd84a0eb..7b568dc3e5 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1,1749 +1,1749 @@ -## @file -# Common routines used by all tools -# -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import sys -import string -import thread -import threading -import time -import re -import cPickle -import array -from UserDict import IterableUserDict -from UserList import UserList - -from Common import EdkLogger as EdkLogger -from Common import GlobalData as GlobalData -from DataType import * -from BuildToolError import * -from CommonDataClass.DataClass import * -from Parsing import GetSplitValueList - -## Regular expression used to find out place holders in string template -gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE|re.UNICODE) - -## Dictionary used to store file time stamp for quick re-access -gFileTimeStampCache = {} # {file path : file time stamp} - -## Dictionary used to store dependencies of files -gDependencyDatabase = {} # arch : {file path : [dependent files list]} - -## callback routine for processing variable option -# -# This function can be used to process variable number of option values. The -# typical usage of it is specify architecure list on command line. -# (e.g. -a IA32 X64 IPF) -# -# @param Option Standard callback function parameter -# @param OptionString Standard callback function parameter -# @param Value Standard callback function parameter -# @param Parser Standard callback function parameter -# -# @retval -# -def ProcessVariableArgument(Option, OptionString, Value, Parser): - assert Value is None - Value = [] - RawArgs = Parser.rargs - while RawArgs: - Arg = RawArgs[0] - if (Arg[:2] == "--" and len(Arg) > 2) or \ - (Arg[:1] == "-" and len(Arg) > 1 and Arg[1] != "-"): - break - Value.append(Arg) - del RawArgs[0] - setattr(Parser.values, Option.dest, Value) - -## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C structure style -# -# @param Guid The GUID string -# -# @retval string The GUID string in C structure style -# -def GuidStringToGuidStructureString(Guid): - GuidList = Guid.split('-') - Result = '{' - for Index in range(0,3,1): - Result = Result + '0x' + GuidList[Index] + ', ' - Result = Result + '{0x' + GuidList[3][0:2] + ', 0x' + GuidList[3][2:4] - for Index in range(0,12,2): - Result = Result + ', 0x' + GuidList[4][Index:Index+2] - Result += '}}' - return Result - -## Convert GUID structure in byte array to xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -# -# @param GuidValue The GUID value in byte array -# -# @retval string The GUID value in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format -# -def GuidStructureByteArrayToGuidString(GuidValue): - guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "").replace(";", "") - guidValueList = guidValueString.split(",") - if len(guidValueList) != 16: - return '' - #EdkLogger.error(None, None, "Invalid GUID value string %s" % GuidValue) - try: - return "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" % ( - int(guidValueList[3], 16), - int(guidValueList[2], 16), - int(guidValueList[1], 16), - int(guidValueList[0], 16), - int(guidValueList[5], 16), - int(guidValueList[4], 16), - int(guidValueList[7], 16), - int(guidValueList[6], 16), - int(guidValueList[8], 16), - int(guidValueList[9], 16), - int(guidValueList[10], 16), - int(guidValueList[11], 16), - int(guidValueList[12], 16), - int(guidValueList[13], 16), - int(guidValueList[14], 16), - int(guidValueList[15], 16) - ) - except: - return '' - -## Convert GUID string in C structure style to xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -# -# @param GuidValue The GUID value in C structure format -# -# @retval string The GUID value in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format -# -def GuidStructureStringToGuidString(GuidValue): - guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "").replace(";", "") - guidValueList = guidValueString.split(",") - if len(guidValueList) != 11: - return '' - #EdkLogger.error(None, None, "Invalid GUID value string %s" % GuidValue) - try: - return "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % ( - int(guidValueList[0], 16), - int(guidValueList[1], 16), - int(guidValueList[2], 16), - int(guidValueList[3], 16), - int(guidValueList[4], 16), - int(guidValueList[5], 16), - int(guidValueList[6], 16), - int(guidValueList[7], 16), - int(guidValueList[8], 16), - int(guidValueList[9], 16), - int(guidValueList[10], 16) - ) - except: - return '' - -## Convert GUID string in C structure style to xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx -# -# @param GuidValue The GUID value in C structure format -# -# @retval string The GUID value in xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx format -# -def GuidStructureStringToGuidValueName(GuidValue): - guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "") - guidValueList = guidValueString.split(",") - if len(guidValueList) != 11: - EdkLogger.error(None, FORMAT_INVALID, "Invalid GUID value string [%s]" % GuidValue) - return "%08x_%04x_%04x_%02x%02x_%02x%02x%02x%02x%02x%02x" % ( - int(guidValueList[0], 16), - int(guidValueList[1], 16), - int(guidValueList[2], 16), - int(guidValueList[3], 16), - int(guidValueList[4], 16), - int(guidValueList[5], 16), - int(guidValueList[6], 16), - int(guidValueList[7], 16), - int(guidValueList[8], 16), - int(guidValueList[9], 16), - int(guidValueList[10], 16) - ) - -## Create directories -# -# @param Directory The directory name -# -def CreateDirectory(Directory): - if Directory == None or Directory.strip() == "": - return True - try: - if not os.access(Directory, os.F_OK): - os.makedirs(Directory) - except: - return False - return True - -## Remove directories, including files and sub-directories in it -# -# @param Directory The directory name -# -def RemoveDirectory(Directory, Recursively=False): - if Directory == None or Directory.strip() == "" or not os.path.exists(Directory): - return - if Recursively: - CurrentDirectory = os.getcwd() - os.chdir(Directory) - for File in os.listdir("."): - if os.path.isdir(File): - RemoveDirectory(File, Recursively) - else: - os.remove(File) - os.chdir(CurrentDirectory) - os.rmdir(Directory) - -## Check if given file is changed or not -# -# This method is used to check if a file is changed or not between two build -# actions. It makes use a cache to store files timestamp. -# -# @param File The path of file -# -# @retval True If the given file is changed, doesn't exist, or can't be -# found in timestamp cache -# @retval False If the given file is changed -# -def IsChanged(File): - if not os.path.exists(File): - return True - - FileState = os.stat(File) - TimeStamp = FileState[-2] - - if File in gFileTimeStampCache and TimeStamp == gFileTimeStampCache[File]: - FileChanged = False - else: - FileChanged = True - gFileTimeStampCache[File] = TimeStamp - - return FileChanged - -## Store content in file -# -# This method is used to save file only when its content is changed. This is -# quite useful for "make" system to decide what will be re-built and what won't. -# -# @param File The path of file -# @param Content The new content of the file -# @param IsBinaryFile The flag indicating if the file is binary file or not -# -# @retval True If the file content is changed and the file is renewed -# @retval False If the file content is the same -# -def SaveFileOnChange(File, Content, IsBinaryFile=True): - if not IsBinaryFile: - Content = Content.replace("\n", os.linesep) - - if os.path.exists(File): - try: - if Content == open(File, "rb").read(): - return False - except: - EdkLogger.error(None, FILE_OPEN_FAILURE, ExtraData=File) - - DirName = os.path.dirname(File) - if not CreateDirectory(DirName): - EdkLogger.error(None, FILE_CREATE_FAILURE, "Could not create directory %s" % DirName) - else: - if DirName == '': - DirName = os.getcwd() - if not os.access(DirName, os.W_OK): - EdkLogger.error(None, PERMISSION_FAILURE, "Do not have write permission on directory %s" % DirName) - - try: - if GlobalData.gIsWindows: - try: - from PyUtility import SaveFileToDisk - if not SaveFileToDisk(File, Content): - EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData=File) - except: - Fd = open(File, "wb") - Fd.write(Content) - Fd.close() - else: - Fd = open(File, "wb") - Fd.write(Content) - Fd.close() - except IOError, X: - EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData='IOError %s'%X) - - return True - -## Make a Python object persistent on file system -# -# @param Data The object to be stored in file -# @param File The path of file to store the object -# -def DataDump(Data, File): - Fd = None - try: - Fd = open(File, 'wb') - cPickle.dump(Data, Fd, cPickle.HIGHEST_PROTOCOL) - except: - EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, RaiseError=False) - finally: - if Fd != None: - Fd.close() - -## Restore a Python object from a file -# -# @param File The path of file stored the object -# -# @retval object A python object -# @retval None If failure in file operation -# -def DataRestore(File): - Data = None - Fd = None - try: - Fd = open(File, 'rb') - Data = cPickle.load(Fd) - except Exception, e: - EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e))) - Data = None - finally: - if Fd != None: - Fd.close() - return Data - -## Retrieve and cache the real path name in file system -# -# @param Root The root directory of path relative to -# -# @retval str The path string if the path exists -# @retval None If path doesn't exist -# -class DirCache: - _CACHE_ = set() - _UPPER_CACHE_ = {} - - def __init__(self, Root): - self._Root = Root - for F in os.listdir(Root): - self._CACHE_.add(F) - self._UPPER_CACHE_[F.upper()] = F - - # =[] operator - def __getitem__(self, Path): - Path = Path[len(os.path.commonprefix([Path, self._Root])):] - if not Path: - return self._Root - if Path and Path[0] == os.path.sep: - Path = Path[1:] - if Path in self._CACHE_: - return os.path.join(self._Root, Path) - UpperPath = Path.upper() - if UpperPath in self._UPPER_CACHE_: - return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath]) - - IndexList = [] - LastSepIndex = -1 - SepIndex = Path.find(os.path.sep) - while SepIndex > -1: - Parent = UpperPath[:SepIndex] - if Parent not in self._UPPER_CACHE_: - break - LastSepIndex = SepIndex - SepIndex = Path.find(os.path.sep, LastSepIndex + 1) - - if LastSepIndex == -1: - return None - - Cwd = os.getcwd() - os.chdir(self._Root) - SepIndex = LastSepIndex - while SepIndex > -1: - Parent = Path[:SepIndex] - ParentKey = UpperPath[:SepIndex] - if ParentKey not in self._UPPER_CACHE_: - os.chdir(Cwd) - return None - - if Parent in self._CACHE_: - ParentDir = Parent - else: - ParentDir = self._UPPER_CACHE_[ParentKey] - for F in os.listdir(ParentDir): - Dir = os.path.join(ParentDir, F) - self._CACHE_.add(Dir) - self._UPPER_CACHE_[Dir.upper()] = Dir - - SepIndex = Path.find(os.path.sep, SepIndex + 1) - - os.chdir(Cwd) - if Path in self._CACHE_: - return os.path.join(self._Root, Path) - elif UpperPath in self._UPPER_CACHE_: - return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath]) - return None - -## Get all files of a directory -# -# @param Root: Root dir -# @param SkipList : The files need be skipped -# -# @retval A list of all files -# -def GetFiles(Root, SkipList=None, FullPath = True): - OriPath = Root - FileList = [] - for Root, Dirs, Files in os.walk(Root): - if SkipList: - for Item in SkipList: - if Item in Dirs: - Dirs.remove(Item) - - for File in Files: - File = os.path.normpath(os.path.join(Root, File)) - if not FullPath: - File = File[len(OriPath) + 1:] - FileList.append(File) - - return FileList - -## Check if gvien file exists or not -# -# @param File File name or path to be checked -# @param Dir The directory the file is relative to -# -# @retval True if file exists -# @retval False if file doesn't exists -# -def ValidFile(File, Ext=None): - if Ext != None: - Dummy, FileExt = os.path.splitext(File) - if FileExt.lower() != Ext.lower(): - return False - if not os.path.exists(File): - return False - return True - -def RealPath(File, Dir='', OverrideDir=''): - NewFile = os.path.normpath(os.path.join(Dir, File)) - NewFile = GlobalData.gAllFiles[NewFile] - if not NewFile and OverrideDir: - NewFile = os.path.normpath(os.path.join(OverrideDir, File)) - NewFile = GlobalData.gAllFiles[NewFile] - return NewFile - -def RealPath2(File, Dir='', OverrideDir=''): - if OverrideDir: - NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(OverrideDir, File))] - if NewFile: - if OverrideDir[-1] == os.path.sep: - return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)] - else: - return NewFile[len(OverrideDir)+1:], NewFile[0:len(OverrideDir)] - if GlobalData.gAllFiles: - NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(Dir, File))] - else: - NewFile = os.path.normpath(os.path.join(Dir, File)) - if NewFile: - if Dir: - if Dir[-1] == os.path.sep: - return NewFile[len(Dir):], NewFile[0:len(Dir)] - else: - return NewFile[len(Dir)+1:], NewFile[0:len(Dir)] - else: - return NewFile, '' - - return None, None - -## Check if gvien file exists or not -# -# -def ValidFile2(AllFiles, File, Ext=None, Workspace='', EfiSource='', EdkSource='', Dir='.', OverrideDir=''): - NewFile = File - if Ext != None: - Dummy, FileExt = os.path.splitext(File) - if FileExt.lower() != Ext.lower(): - return False, File - - # Replace the Edk macros - if OverrideDir != '' and OverrideDir != None: - if OverrideDir.find('$(EFI_SOURCE)') > -1: - OverrideDir = OverrideDir.replace('$(EFI_SOURCE)', EfiSource) - if OverrideDir.find('$(EDK_SOURCE)') > -1: - OverrideDir = OverrideDir.replace('$(EDK_SOURCE)', EdkSource) - - # Replace the default dir to current dir - if Dir == '.': - Dir = os.getcwd() - Dir = Dir[len(Workspace)+1:] - - # First check if File has Edk definition itself - if File.find('$(EFI_SOURCE)') > -1 or File.find('$(EDK_SOURCE)') > -1: - NewFile = File.replace('$(EFI_SOURCE)', EfiSource) - NewFile = NewFile.replace('$(EDK_SOURCE)', EdkSource) - NewFile = AllFiles[os.path.normpath(NewFile)] - if NewFile != None: - return True, NewFile - - # Second check the path with override value - if OverrideDir != '' and OverrideDir != None: - NewFile = AllFiles[os.path.normpath(os.path.join(OverrideDir, File))] - if NewFile != None: - return True, NewFile - - # Last check the path with normal definitions - File = os.path.join(Dir, File) - NewFile = AllFiles[os.path.normpath(File)] - if NewFile != None: - return True, NewFile - - return False, File - -## Check if gvien file exists or not -# -# -def ValidFile3(AllFiles, File, Workspace='', EfiSource='', EdkSource='', Dir='.', OverrideDir=''): - # Replace the Edk macros - if OverrideDir != '' and OverrideDir != None: - if OverrideDir.find('$(EFI_SOURCE)') > -1: - OverrideDir = OverrideDir.replace('$(EFI_SOURCE)', EfiSource) - if OverrideDir.find('$(EDK_SOURCE)') > -1: - OverrideDir = OverrideDir.replace('$(EDK_SOURCE)', EdkSource) - - # Replace the default dir to current dir - # Dir is current module dir related to workspace - if Dir == '.': - Dir = os.getcwd() - Dir = Dir[len(Workspace)+1:] - - NewFile = File - RelaPath = AllFiles[os.path.normpath(Dir)] - NewRelaPath = RelaPath - - while(True): - # First check if File has Edk definition itself - if File.find('$(EFI_SOURCE)') > -1 or File.find('$(EDK_SOURCE)') > -1: - File = File.replace('$(EFI_SOURCE)', EfiSource) - File = File.replace('$(EDK_SOURCE)', EdkSource) - NewFile = AllFiles[os.path.normpath(File)] - if NewFile != None: - NewRelaPath = os.path.dirname(NewFile) - File = os.path.basename(NewFile) - #NewRelaPath = NewFile[:len(NewFile) - len(File.replace("..\\", '').replace("../", '')) - 1] - break - - # Second check the path with override value - if OverrideDir != '' and OverrideDir != None: - NewFile = AllFiles[os.path.normpath(os.path.join(OverrideDir, File))] - if NewFile != None: - #NewRelaPath = os.path.dirname(NewFile) - NewRelaPath = NewFile[:len(NewFile) - len(File.replace("..\\", '').replace("../", '')) - 1] - break - - # Last check the path with normal definitions - NewFile = AllFiles[os.path.normpath(os.path.join(Dir, File))] - if NewFile != None: - break - - # No file found - break - - return NewRelaPath, RelaPath, File - - -def GetRelPath(Path1, Path2): - FileName = os.path.basename(Path2) - L1 = os.path.normpath(Path1).split(os.path.normpath('/')) - L2 = os.path.normpath(Path2).split(os.path.normpath('/')) - for Index in range(0, len(L1)): - if L1[Index] != L2[Index]: - FileName = '../' * (len(L1) - Index) - for Index2 in range(Index, len(L2)): - FileName = os.path.join(FileName, L2[Index2]) - break - return os.path.normpath(FileName) - - -## Get GUID value from given packages -# -# @param CName The CName of the GUID -# @param PackageList List of packages looking-up in -# -# @retval GuidValue if the CName is found in any given package -# @retval None if the CName is not found in all given packages -# -def GuidValue(CName, PackageList): - for P in PackageList: - if CName in P.Guids: - return P.Guids[CName] - return None - -## Get Protocol value from given packages -# -# @param CName The CName of the GUID -# @param PackageList List of packages looking-up in -# -# @retval GuidValue if the CName is found in any given package -# @retval None if the CName is not found in all given packages -# -def ProtocolValue(CName, PackageList): - for P in PackageList: - if CName in P.Protocols: - return P.Protocols[CName] - return None - -## Get PPI value from given packages -# -# @param CName The CName of the GUID -# @param PackageList List of packages looking-up in -# -# @retval GuidValue if the CName is found in any given package -# @retval None if the CName is not found in all given packages -# -def PpiValue(CName, PackageList): - for P in PackageList: - if CName in P.Ppis: - return P.Ppis[CName] - return None - -## A string template class -# -# This class implements a template for string replacement. A string template -# looks like following -# -# ${BEGIN} other_string ${placeholder_name} other_string ${END} -# -# The string between ${BEGIN} and ${END} will be repeated as many times as the -# length of "placeholder_name", which is a list passed through a dict. The -# "placeholder_name" is the key name of the dict. The ${BEGIN} and ${END} can -# be not used and, in this case, the "placeholder_name" must not a list and it -# will just be replaced once. -# -class TemplateString(object): - _REPEAT_START_FLAG = "BEGIN" - _REPEAT_END_FLAG = "END" - - class Section(object): - _LIST_TYPES = [type([]), type(set()), type((0,))] - - def __init__(self, TemplateSection, PlaceHolderList): - self._Template = TemplateSection - self._PlaceHolderList = [] - - # Split the section into sub-sections according to the position of placeholders - if PlaceHolderList: - self._SubSectionList = [] - SubSectionStart = 0 - # - # The placeholders passed in must be in the format of - # - # PlaceHolderName, PlaceHolderStartPoint, PlaceHolderEndPoint - # - for PlaceHolder,Start,End in PlaceHolderList: - self._SubSectionList.append(TemplateSection[SubSectionStart:Start]) - self._SubSectionList.append(TemplateSection[Start:End]) - self._PlaceHolderList.append(PlaceHolder) - SubSectionStart = End - if SubSectionStart < len(TemplateSection): - self._SubSectionList.append(TemplateSection[SubSectionStart:]) - else: - self._SubSectionList = [TemplateSection] - - def __str__(self): - return self._Template + " : " + str(self._PlaceHolderList) - - def Instantiate(self, PlaceHolderValues): - RepeatTime = -1 - RepeatPlaceHolders = {} - NonRepeatPlaceHolders = {} - - for PlaceHolder in self._PlaceHolderList: - if PlaceHolder not in PlaceHolderValues: - continue - Value = PlaceHolderValues[PlaceHolder] - if type(Value) in self._LIST_TYPES: - if RepeatTime < 0: - RepeatTime = len(Value) - elif RepeatTime != len(Value): - EdkLogger.error( - "TemplateString", - PARAMETER_INVALID, - "${%s} has different repeat time from others!" % PlaceHolder, - ExtraData=str(self._Template) - ) - RepeatPlaceHolders["${%s}" % PlaceHolder] = Value - else: - NonRepeatPlaceHolders["${%s}" % PlaceHolder] = Value - - if NonRepeatPlaceHolders: - StringList = [] - for S in self._SubSectionList: - if S not in NonRepeatPlaceHolders: - StringList.append(S) - else: - StringList.append(str(NonRepeatPlaceHolders[S])) - else: - StringList = self._SubSectionList - - if RepeatPlaceHolders: - TempStringList = [] - for Index in range(RepeatTime): - for S in StringList: - if S not in RepeatPlaceHolders: - TempStringList.append(S) - else: - TempStringList.append(str(RepeatPlaceHolders[S][Index])) - StringList = TempStringList - - return "".join(StringList) - - ## Constructor - def __init__(self, Template=None): - self.String = '' - self.IsBinary = False - self._Template = Template - self._TemplateSectionList = self._Parse(Template) - - ## str() operator - # - # @retval string The string replaced - # - def __str__(self): - return self.String - - ## Split the template string into fragments per the ${BEGIN} and ${END} flags - # - # @retval list A list of TemplateString.Section objects - # - def _Parse(self, Template): - SectionStart = 0 - SearchFrom = 0 - MatchEnd = 0 - PlaceHolderList = [] - TemplateSectionList = [] - while Template: - MatchObj = gPlaceholderPattern.search(Template, SearchFrom) - if not MatchObj: - if MatchEnd <= len(Template): - TemplateSection = TemplateString.Section(Template[SectionStart:], PlaceHolderList) - TemplateSectionList.append(TemplateSection) - break - - MatchString = MatchObj.group(1) - MatchStart = MatchObj.start() - MatchEnd = MatchObj.end() - - if MatchString == self._REPEAT_START_FLAG: - if MatchStart > SectionStart: - TemplateSection = TemplateString.Section(Template[SectionStart:MatchStart], PlaceHolderList) - TemplateSectionList.append(TemplateSection) - SectionStart = MatchEnd - PlaceHolderList = [] - elif MatchString == self._REPEAT_END_FLAG: - TemplateSection = TemplateString.Section(Template[SectionStart:MatchStart], PlaceHolderList) - TemplateSectionList.append(TemplateSection) - SectionStart = MatchEnd - PlaceHolderList = [] - else: - PlaceHolderList.append((MatchString, MatchStart - SectionStart, MatchEnd - SectionStart)) - SearchFrom = MatchEnd - return TemplateSectionList - - ## Replace the string template with dictionary of placeholders and append it to previous one - # - # @param AppendString The string template to append - # @param Dictionary The placeholder dictionaries - # - def Append(self, AppendString, Dictionary=None): - if Dictionary: - SectionList = self._Parse(AppendString) - self.String += "".join([S.Instantiate(Dictionary) for S in SectionList]) - else: - self.String += AppendString - - ## Replace the string template with dictionary of placeholders - # - # @param Dictionary The placeholder dictionaries - # - # @retval str The string replaced with placeholder values - # - def Replace(self, Dictionary=None): - return "".join([S.Instantiate(Dictionary) for S in self._TemplateSectionList]) - -## Progress indicator class -# -# This class makes use of thread to print progress on console. -# -class Progressor: - # for avoiding deadloop - _StopFlag = None - _ProgressThread = None - _CheckInterval = 0.25 - - ## Constructor - # - # @param OpenMessage The string printed before progress charaters - # @param CloseMessage The string printed after progress charaters - # @param ProgressChar The charater used to indicate the progress - # @param Interval The interval in seconds between two progress charaters - # - def __init__(self, OpenMessage="", CloseMessage="", ProgressChar='.', Interval=1.0): - self.PromptMessage = OpenMessage - self.CodaMessage = CloseMessage - self.ProgressChar = ProgressChar - self.Interval = Interval - if Progressor._StopFlag == None: - Progressor._StopFlag = threading.Event() - - ## Start to print progress charater - # - # @param OpenMessage The string printed before progress charaters - # - def Start(self, OpenMessage=None): - if OpenMessage != None: - self.PromptMessage = OpenMessage - Progressor._StopFlag.clear() - if Progressor._ProgressThread == None: - Progressor._ProgressThread = threading.Thread(target=self._ProgressThreadEntry) - Progressor._ProgressThread.setDaemon(False) - Progressor._ProgressThread.start() - - ## Stop printing progress charater - # - # @param CloseMessage The string printed after progress charaters - # - def Stop(self, CloseMessage=None): - OriginalCodaMessage = self.CodaMessage - if CloseMessage != None: - self.CodaMessage = CloseMessage - self.Abort() - self.CodaMessage = OriginalCodaMessage - - ## Thread entry method - def _ProgressThreadEntry(self): - sys.stdout.write(self.PromptMessage + " ") - sys.stdout.flush() - TimeUp = 0.0 - while not Progressor._StopFlag.isSet(): - if TimeUp <= 0.0: - sys.stdout.write(self.ProgressChar) - sys.stdout.flush() - TimeUp = self.Interval - time.sleep(self._CheckInterval) - TimeUp -= self._CheckInterval - sys.stdout.write(" " + self.CodaMessage + "\n") - sys.stdout.flush() - - ## Abort the progress display - @staticmethod - def Abort(): - if Progressor._StopFlag != None: - Progressor._StopFlag.set() - if Progressor._ProgressThread != None: - Progressor._ProgressThread.join() - Progressor._ProgressThread = None - -## A dict which can access its keys and/or values orderly -# -# The class implements a new kind of dict which its keys or values can be -# accessed in the order they are added into the dict. It guarantees the order -# by making use of an internal list to keep a copy of keys. -# -class sdict(IterableUserDict): - ## Constructor - def __init__(self): - IterableUserDict.__init__(self) - self._key_list = [] - - ## [] operator - def __setitem__(self, key, value): - if key not in self._key_list: - self._key_list.append(key) - IterableUserDict.__setitem__(self, key, value) - - ## del operator - def __delitem__(self, key): - self._key_list.remove(key) - IterableUserDict.__delitem__(self, key) - - ## used in "for k in dict" loop to ensure the correct order - def __iter__(self): - return self.iterkeys() - - ## len() support - def __len__(self): - return len(self._key_list) - - ## "in" test support - def __contains__(self, key): - return key in self._key_list - - ## indexof support - def index(self, key): - return self._key_list.index(key) - - ## insert support - def insert(self, key, newkey, newvalue, order): - index = self._key_list.index(key) - if order == 'BEFORE': - self._key_list.insert(index, newkey) - IterableUserDict.__setitem__(self, newkey, newvalue) - elif order == 'AFTER': - self._key_list.insert(index + 1, newkey) - IterableUserDict.__setitem__(self, newkey, newvalue) - - ## append support - def append(self, sdict): - for key in sdict: - if key not in self._key_list: - self._key_list.append(key) - IterableUserDict.__setitem__(self, key, sdict[key]) - - def has_key(self, key): - return key in self._key_list - - ## Empty the dict - def clear(self): - self._key_list = [] - IterableUserDict.clear(self) - - ## Return a copy of keys - def keys(self): - keys = [] - for key in self._key_list: - keys.append(key) - return keys - - ## Return a copy of values - def values(self): - values = [] - for key in self._key_list: - values.append(self[key]) - return values - - ## Return a copy of (key, value) list - def items(self): - items = [] - for key in self._key_list: - items.append((key, self[key])) - return items - - ## Iteration support - def iteritems(self): - return iter(self.items()) - - ## Keys interation support - def iterkeys(self): - return iter(self.keys()) - - ## Values interation support - def itervalues(self): - return iter(self.values()) - - ## Return value related to a key, and remove the (key, value) from the dict - def pop(self, key, *dv): - value = None - if key in self._key_list: - value = self[key] - self.__delitem__(key) - elif len(dv) != 0 : - value = kv[0] - return value - - ## Return (key, value) pair, and remove the (key, value) from the dict - def popitem(self): - key = self._key_list[-1] - value = self[key] - self.__delitem__(key) - return key, value - - def update(self, dict=None, **kwargs): - if dict != None: - for k, v in dict.items(): - self[k] = v - if len(kwargs): - for k, v in kwargs.items(): - self[k] = v - -## Dictionary with restricted keys -# -class rdict(dict): - ## Constructor - def __init__(self, KeyList): - for Key in KeyList: - dict.__setitem__(self, Key, "") - - ## []= operator - def __setitem__(self, key, value): - if key not in self: - EdkLogger.error("RestrictedDict", ATTRIBUTE_SET_FAILURE, "Key [%s] is not allowed" % key, - ExtraData=", ".join(dict.keys(self))) - dict.__setitem__(self, key, value) - - ## =[] operator - def __getitem__(self, key): - if key not in self: - return "" - return dict.__getitem__(self, key) - - ## del operator - def __delitem__(self, key): - EdkLogger.error("RestrictedDict", ATTRIBUTE_ACCESS_DENIED, ExtraData="del") - - ## Empty the dict - def clear(self): - for Key in self: - self.__setitem__(Key, "") - - ## Return value related to a key, and remove the (key, value) from the dict - def pop(self, key, *dv): - EdkLogger.error("RestrictedDict", ATTRIBUTE_ACCESS_DENIED, ExtraData="pop") - - ## Return (key, value) pair, and remove the (key, value) from the dict - def popitem(self): - EdkLogger.error("RestrictedDict", ATTRIBUTE_ACCESS_DENIED, ExtraData="popitem") - -## Dictionary using prioritized list as key -# -class tdict: - _ListType = type([]) - _TupleType = type(()) - _Wildcard = 'COMMON' - _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM'] - - def __init__(self, _Single_=False, _Level_=2): - self._Level_ = _Level_ - self.data = {} - self._Single_ = _Single_ - - # =[] operator - def __getitem__(self, key): - KeyType = type(key) - RestKeys = None - if KeyType == self._ListType or KeyType == self._TupleType: - FirstKey = key[0] - if len(key) > 1: - RestKeys = key[1:] - elif self._Level_ > 1: - RestKeys = [self._Wildcard for i in range(0, self._Level_-1)] - else: - FirstKey = key - if self._Level_ > 1: - RestKeys = [self._Wildcard for i in range(0, self._Level_-1)] - - if FirstKey == None or str(FirstKey).upper() in self._ValidWildcardList: - FirstKey = self._Wildcard - - if self._Single_: - return self._GetSingleValue(FirstKey, RestKeys) - else: - return self._GetAllValues(FirstKey, RestKeys) - - def _GetSingleValue(self, FirstKey, RestKeys): - Value = None - #print "%s-%s" % (FirstKey, self._Level_) , - if self._Level_ > 1: - if FirstKey == self._Wildcard: - if FirstKey in self.data: - Value = self.data[FirstKey][RestKeys] - if Value == None: - for Key in self.data: - Value = self.data[Key][RestKeys] - if Value != None: break - else: - if FirstKey in self.data: - Value = self.data[FirstKey][RestKeys] - if Value == None and self._Wildcard in self.data: - #print "Value=None" - Value = self.data[self._Wildcard][RestKeys] - else: - if FirstKey == self._Wildcard: - if FirstKey in self.data: - Value = self.data[FirstKey] - if Value == None: - for Key in self.data: - Value = self.data[Key] - if Value != None: break - else: - if FirstKey in self.data: - Value = self.data[FirstKey] - elif self._Wildcard in self.data: - Value = self.data[self._Wildcard] - return Value - - def _GetAllValues(self, FirstKey, RestKeys): - Value = [] - if self._Level_ > 1: - if FirstKey == self._Wildcard: - for Key in self.data: - Value += self.data[Key][RestKeys] - else: - if FirstKey in self.data: - Value += self.data[FirstKey][RestKeys] - if self._Wildcard in self.data: - Value += self.data[self._Wildcard][RestKeys] - else: - if FirstKey == self._Wildcard: - for Key in self.data: - Value.append(self.data[Key]) - else: - if FirstKey in self.data: - Value.append(self.data[FirstKey]) - if self._Wildcard in self.data: - Value.append(self.data[self._Wildcard]) - return Value - - ## []= operator - def __setitem__(self, key, value): - KeyType = type(key) - RestKeys = None - if KeyType == self._ListType or KeyType == self._TupleType: - FirstKey = key[0] - if len(key) > 1: - RestKeys = key[1:] - else: - RestKeys = [self._Wildcard for i in range(0, self._Level_-1)] - else: - FirstKey = key - if self._Level_ > 1: - RestKeys = [self._Wildcard for i in range(0, self._Level_-1)] - - if FirstKey in self._ValidWildcardList: - FirstKey = self._Wildcard - - if FirstKey not in self.data and self._Level_ > 0: - self.data[FirstKey] = tdict(self._Single_, self._Level_ - 1) - - if self._Level_ > 1: - self.data[FirstKey][RestKeys] = value - else: - self.data[FirstKey] = value - - def SetGreedyMode(self): - self._Single_ = False - if self._Level_ > 1: - for Key in self.data: - self.data[Key].SetGreedyMode() - - def SetSingleMode(self): - self._Single_ = True - if self._Level_ > 1: - for Key in self.data: - self.data[Key].SetSingleMode() - - def GetKeys(self, KeyIndex=0): - assert KeyIndex >= 0 - if KeyIndex == 0: - return set(self.data.keys()) - else: - keys = set() - for Key in self.data: - keys |= self.data[Key].GetKeys(KeyIndex - 1) - return keys - -## Boolean chain list -# -class Blist(UserList): - def __init__(self, initlist=None): - UserList.__init__(self, initlist) - def __setitem__(self, i, item): - if item not in [True, False]: - if item == 0: - item = False - else: - item = True - self.data[i] = item - def _GetResult(self): - Value = True - for item in self.data: - Value &= item - return Value - Result = property(_GetResult) - -def ParseConsoleLog(Filename): - Opr = open(os.path.normpath(Filename), 'r') - Opw = open(os.path.normpath(Filename + '.New'), 'w+') - for Line in Opr.readlines(): - if Line.find('.efi') > -1: - Line = Line[Line.rfind(' ') : Line.rfind('.efi')].strip() - Opw.write('%s\n' % Line) - - Opr.close() - Opw.close() - -## AnalyzeDscPcd -# -# Analyze DSC PCD value, since there is no data type info in DSC -# This fuction is used to match functions (AnalyzePcdData, AnalyzeHiiPcdData, AnalyzeVpdPcdData) used for retrieving PCD value from database -# 1. Feature flag: TokenSpace.PcdCName|PcdValue -# 2. Fix and Patch:TokenSpace.PcdCName|PcdValue[|MaxSize] -# 3. Dynamic default: -# TokenSpace.PcdCName|PcdValue[|VOID*[|MaxSize]] -# TokenSpace.PcdCName|PcdValue -# 4. Dynamic VPD: -# TokenSpace.PcdCName|VpdOffset[|VpdValue] -# TokenSpace.PcdCName|VpdOffset[|MaxSize[|VpdValue]] -# 5. Dynamic HII: -# TokenSpace.PcdCName|HiiString|VaiableGuid|VariableOffset[|HiiValue] -# PCD value needs to be located in such kind of string, and the PCD value might be an expression in which -# there might have "|" operator, also in string value. -# -# @param Setting: String contain information described above with "TokenSpace.PcdCName|" stripped -# @param PcdType: PCD type: feature, fixed, dynamic default VPD HII -# @param DataType: The datum type of PCD: VOID*, UNIT, BOOL -# @retval: -# ValueList: A List contain fields described above -# IsValid: True if conforming EBNF, otherwise False -# Index: The index where PcdValue is in ValueList -# -def AnalyzeDscPcd(Setting, PcdType, DataType=''): - Setting = Setting.strip() - # There might be escaped quote in a string: \", \\\" - Data = Setting.replace('\\\\', '//').replace('\\\"', '\\\'') - # There might be '|' in string and in ( ... | ... ), replace it with '-' - NewStr = '' - InStr = False - Pair = 0 - for ch in Data: - if ch == '"': - InStr = not InStr - elif ch == '(' and not InStr: - Pair += 1 - elif ch == ')' and not InStr: - Pair -= 1 - - if (Pair > 0 or InStr) and ch == TAB_VALUE_SPLIT: - NewStr += '-' - else: - NewStr += ch - FieldList = [] - StartPos = 0 - while True: - Pos = NewStr.find(TAB_VALUE_SPLIT, StartPos) - if Pos < 0: - FieldList.append(Setting[StartPos:].strip()) - break - FieldList.append(Setting[StartPos:Pos].strip()) - StartPos = Pos + 1 - - IsValid = True - if PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_FEATURE_FLAG): - Value = FieldList[0] - Size = '' - if len(FieldList) > 1: - Type = FieldList[1] - # Fix the PCD type when no DataType input - if Type == 'VOID*': - DataType = 'VOID*' - else: - Size = FieldList[1] - if len(FieldList) > 2: - Size = FieldList[2] - if DataType == 'VOID*': - IsValid = (len(FieldList) <= 3) - else: - IsValid = (len(FieldList) <= 1) - return [Value, '', Size], IsValid, 0 - elif PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT): - Value = FieldList[0] - Size = Type = '' - if len(FieldList) > 1: - Type = FieldList[1] - else: - Type = DataType - if len(FieldList) > 2: - Size = FieldList[2] - else: - if Type == 'VOID*': - if Value.startswith("L"): - Size = str((len(Value)- 3 + 1) * 2) - elif Value.startswith("{"): - Size = str(len(Value.split(","))) - else: - Size = str(len(Value) -2 + 1 ) - if DataType == 'VOID*': - IsValid = (len(FieldList) <= 3) - else: - IsValid = (len(FieldList) <= 1) - return [Value, Type, Size], IsValid, 0 - elif PcdType in (MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_VPD): - VpdOffset = FieldList[0] - Value = Size = '' - if not DataType == 'VOID*': - if len(FieldList) > 1: - Value = FieldList[1] - else: - if len(FieldList) > 1: - Size = FieldList[1] - if len(FieldList) > 2: - Value = FieldList[2] - if DataType == 'VOID*': - IsValid = (len(FieldList) <= 3) - else: - IsValid = (len(FieldList) <= 2) - return [VpdOffset, Size, Value], IsValid, 2 - elif PcdType in (MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII): - HiiString = FieldList[0] - Guid = Offset = Value = '' - if len(FieldList) > 1: - Guid = FieldList[1] - if len(FieldList) > 2: - Offset = FieldList[2] - if len(FieldList) > 3: - Value = FieldList[3] - IsValid = (3 <= len(FieldList) <= 4) - return [HiiString, Guid, Offset, Value], IsValid, 3 - return [], False, 0 - -## AnalyzePcdData -# -# Analyze the pcd Value, Datum type and TokenNumber. -# Used to avoid split issue while the value string contain "|" character -# -# @param[in] Setting: A String contain value/datum type/token number information; -# -# @retval ValueList: A List contain value, datum type and toke number. -# -def AnalyzePcdData(Setting): - ValueList = ['', '', ''] - - ValueRe = re.compile(r'^\s*L?\".*\|.*\"') - PtrValue = ValueRe.findall(Setting) - - ValueUpdateFlag = False - - if len(PtrValue) >= 1: - Setting = re.sub(ValueRe, '', Setting) - ValueUpdateFlag = True - - TokenList = Setting.split(TAB_VALUE_SPLIT) - ValueList[0:len(TokenList)] = TokenList - - if ValueUpdateFlag: - ValueList[0] = PtrValue[0] - - return ValueList - -## AnalyzeHiiPcdData -# -# Analyze the pcd Value, variable name, variable Guid and variable offset. -# Used to avoid split issue while the value string contain "|" character -# -# @param[in] Setting: A String contain VariableName, VariableGuid, VariableOffset, DefaultValue information; -# -# @retval ValueList: A List contaian VariableName, VariableGuid, VariableOffset, DefaultValue. -# -def AnalyzeHiiPcdData(Setting): - ValueList = ['', '', '', ''] - - TokenList = GetSplitValueList(Setting) - ValueList[0:len(TokenList)] = TokenList - - return ValueList - -## AnalyzeVpdPcdData -# -# Analyze the vpd pcd VpdOffset, MaxDatumSize and InitialValue. -# Used to avoid split issue while the value string contain "|" character -# -# @param[in] Setting: A String contain VpdOffset/MaxDatumSize/InitialValue information; -# -# @retval ValueList: A List contain VpdOffset, MaxDatumSize and InitialValue. -# -def AnalyzeVpdPcdData(Setting): - ValueList = ['', '', ''] - - ValueRe = re.compile(r'\s*L?\".*\|.*\"\s*$') - PtrValue = ValueRe.findall(Setting) - - ValueUpdateFlag = False - - if len(PtrValue) >= 1: - Setting = re.sub(ValueRe, '', Setting) - ValueUpdateFlag = True - - TokenList = Setting.split(TAB_VALUE_SPLIT) - ValueList[0:len(TokenList)] = TokenList - - if ValueUpdateFlag: - ValueList[2] = PtrValue[0] - - return ValueList - -## check format of PCD value against its the datum type -# -# For PCD value setting -# -def CheckPcdDatum(Type, Value): - if Type == "VOID*": - ValueRe = re.compile(r'\s*L?\".*\"\s*$') - if not (((Value.startswith('L"') or Value.startswith('"')) and Value.endswith('"')) - or (Value.startswith('{') and Value.endswith('}')) - ): - return False, "Invalid value [%s] of type [%s]; must be in the form of {...} for array"\ - ", or \"...\" for string, or L\"...\" for unicode string" % (Value, Type) - elif ValueRe.match(Value): - # Check the chars in UnicodeString or CString is printable - if Value.startswith("L"): - Value = Value[2:-1] - else: - Value = Value[1:-1] - Printset = set(string.printable) - Printset.remove(TAB_PRINTCHAR_VT) - Printset.add(TAB_PRINTCHAR_BS) - Printset.add(TAB_PRINTCHAR_NUL) - if not set(Value).issubset(Printset): - PrintList = list(Printset) - PrintList.sort() - return False, "Invalid PCD string value of type [%s]; must be printable chars %s." % (Type, PrintList) - elif Type == 'BOOLEAN': - if Value not in ['TRUE', 'True', 'true', '0x1', '0x01', '1', 'FALSE', 'False', 'false', '0x0', '0x00', '0']: - return False, "Invalid value [%s] of type [%s]; must be one of TRUE, True, true, 0x1, 0x01, 1"\ - ", FALSE, False, false, 0x0, 0x00, 0" % (Value, Type) - elif Type in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64]: - try: - Value = long(Value, 0) - except: - return False, "Invalid value [%s] of type [%s];"\ - " must be a hexadecimal, decimal or octal in C language format." % (Value, Type) - else: - return False, "Invalid type [%s]; must be one of VOID*, BOOLEAN, UINT8, UINT16, UINT32, UINT64." % (Type) - - return True, "" - -## Split command line option string to list -# -# subprocess.Popen needs the args to be a sequence. Otherwise there's problem -# in non-windows platform to launch command -# -def SplitOption(OptionString): - OptionList = [] - LastChar = " " - OptionStart = 0 - QuotationMark = "" - for Index in range(0, len(OptionString)): - CurrentChar = OptionString[Index] - if CurrentChar in ['"', "'"]: - if QuotationMark == CurrentChar: - QuotationMark = "" - elif QuotationMark == "": - QuotationMark = CurrentChar - continue - elif QuotationMark: - continue - - if CurrentChar in ["/", "-"] and LastChar in [" ", "\t", "\r", "\n"]: - if Index > OptionStart: - OptionList.append(OptionString[OptionStart:Index-1]) - OptionStart = Index - LastChar = CurrentChar - OptionList.append(OptionString[OptionStart:]) - return OptionList - -def CommonPath(PathList): - P1 = min(PathList).split(os.path.sep) - P2 = max(PathList).split(os.path.sep) - for Index in xrange(min(len(P1), len(P2))): - if P1[Index] != P2[Index]: - return os.path.sep.join(P1[:Index]) - return os.path.sep.join(P1) - -class PathClass(object): - def __init__(self, File='', Root='', AlterRoot='', Type='', IsBinary=False, - Arch='COMMON', ToolChainFamily='', Target='', TagName='', ToolCode=''): - self.Arch = Arch - self.File = str(File) - if os.path.isabs(self.File): - self.Root = '' - self.AlterRoot = '' - else: - self.Root = str(Root) - self.AlterRoot = str(AlterRoot) - - # Remove any '.' and '..' in path - if self.Root: - self.Path = os.path.normpath(os.path.join(self.Root, self.File)) - self.Root = os.path.normpath(CommonPath([self.Root, self.Path])) - # eliminate the side-effect of 'C:' - if self.Root[-1] == ':': - self.Root += os.path.sep - # file path should not start with path separator - if self.Root[-1] == os.path.sep: - self.File = self.Path[len(self.Root):] - else: - self.File = self.Path[len(self.Root)+1:] - else: - self.Path = os.path.normpath(self.File) - - self.SubDir, self.Name = os.path.split(self.File) - self.BaseName, self.Ext = os.path.splitext(self.Name) - - if self.Root: - if self.SubDir: - self.Dir = os.path.join(self.Root, self.SubDir) - else: - self.Dir = self.Root - else: - self.Dir = self.SubDir - - if IsBinary: - self.Type = Type - else: - self.Type = self.Ext.lower() - - self.IsBinary = IsBinary - self.Target = Target - self.TagName = TagName - self.ToolCode = ToolCode - self.ToolChainFamily = ToolChainFamily - - self._Key = None - - ## Convert the object of this class to a string - # - # Convert member Path of the class to a string - # - # @retval string Formatted String - # - def __str__(self): - return self.Path - - ## Override __eq__ function - # - # Check whether PathClass are the same - # - # @retval False The two PathClass are different - # @retval True The two PathClass are the same - # - def __eq__(self, Other): - if type(Other) == type(self): - return self.Path == Other.Path - else: - return self.Path == str(Other) - - ## Override __cmp__ function - # - # Customize the comparsion operation of two PathClass - # - # @retval 0 The two PathClass are different - # @retval -1 The first PathClass is less than the second PathClass - # @retval 1 The first PathClass is Bigger than the second PathClass - def __cmp__(self, Other): - if type(Other) == type(self): - OtherKey = Other.Path - else: - OtherKey = str(Other) - - SelfKey = self.Path - if SelfKey == OtherKey: - return 0 - elif SelfKey > OtherKey: - return 1 - else: - return -1 - - ## Override __hash__ function - # - # Use Path as key in hash table - # - # @retval string Key for hash table - # - def __hash__(self): - return hash(self.Path) - - def _GetFileKey(self): - if self._Key == None: - self._Key = self.Path.upper() # + self.ToolChainFamily + self.TagName + self.ToolCode + self.Target - return self._Key - - def _GetTimeStamp(self): - return os.stat(self.Path)[8] - - def Validate(self, Type='', CaseSensitive=True): - if GlobalData.gCaseInsensitive: - CaseSensitive = False - if Type and Type.lower() != self.Type: - return FILE_TYPE_MISMATCH, '%s (expect %s but got %s)' % (self.File, Type, self.Type) - - RealFile, RealRoot = RealPath2(self.File, self.Root, self.AlterRoot) - if not RealRoot and not RealFile: - RealFile = self.File - if self.AlterRoot: - RealFile = os.path.join(self.AlterRoot, self.File) - elif self.Root: - RealFile = os.path.join(self.Root, self.File) - return FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile) - - ErrorCode = 0 - ErrorInfo = '' - if RealRoot != self.Root or RealFile != self.File: - if CaseSensitive and (RealFile != self.File or (RealRoot != self.Root and RealRoot != self.AlterRoot)): - ErrorCode = FILE_CASE_MISMATCH - ErrorInfo = self.File + '\n\t' + RealFile + " [in file system]" - - self.SubDir, self.Name = os.path.split(RealFile) - self.BaseName, self.Ext = os.path.splitext(self.Name) - if self.SubDir: - self.Dir = os.path.join(RealRoot, self.SubDir) - else: - self.Dir = RealRoot - self.File = RealFile - self.Root = RealRoot - self.Path = os.path.join(RealRoot, RealFile) - return ErrorCode, ErrorInfo - - Key = property(_GetFileKey) - TimeStamp = property(_GetTimeStamp) - -## Parse PE image to get the required PE informaion. -# -class PeImageClass(): - ## Constructor - # - # @param File FilePath of PeImage - # - def __init__(self, PeFile): - self.FileName = PeFile - self.IsValid = False - self.Size = 0 - self.EntryPoint = 0 - self.SectionAlignment = 0 - self.SectionHeaderList = [] - self.ErrorInfo = '' - try: - PeObject = open(PeFile, 'rb') - except: - self.ErrorInfo = self.FileName + ' can not be found\n' - return - # Read DOS header - ByteArray = array.array('B') - ByteArray.fromfile(PeObject, 0x3E) - ByteList = ByteArray.tolist() - # DOS signature should be 'MZ' - if self._ByteListToStr (ByteList[0x0:0x2]) != 'MZ': - self.ErrorInfo = self.FileName + ' has no valid DOS signature MZ' - return - - # Read 4 byte PE Signature - PeOffset = self._ByteListToInt(ByteList[0x3C:0x3E]) - PeObject.seek(PeOffset) - ByteArray = array.array('B') - ByteArray.fromfile(PeObject, 4) - # PE signature should be 'PE\0\0' - if ByteArray.tostring() != 'PE\0\0': - self.ErrorInfo = self.FileName + ' has no valid PE signature PE00' - return - - # Read PE file header - ByteArray = array.array('B') - ByteArray.fromfile(PeObject, 0x14) - ByteList = ByteArray.tolist() - SecNumber = self._ByteListToInt(ByteList[0x2:0x4]) - if SecNumber == 0: - self.ErrorInfo = self.FileName + ' has no section header' - return - - # Read PE optional header - OptionalHeaderSize = self._ByteListToInt(ByteArray[0x10:0x12]) - ByteArray = array.array('B') - ByteArray.fromfile(PeObject, OptionalHeaderSize) - ByteList = ByteArray.tolist() - self.EntryPoint = self._ByteListToInt(ByteList[0x10:0x14]) - self.SectionAlignment = self._ByteListToInt(ByteList[0x20:0x24]) - self.Size = self._ByteListToInt(ByteList[0x38:0x3C]) - - # Read each Section Header - for Index in range(SecNumber): - ByteArray = array.array('B') - ByteArray.fromfile(PeObject, 0x28) - ByteList = ByteArray.tolist() - SecName = self._ByteListToStr(ByteList[0:8]) - SecVirtualSize = self._ByteListToInt(ByteList[8:12]) - SecRawAddress = self._ByteListToInt(ByteList[20:24]) - SecVirtualAddress = self._ByteListToInt(ByteList[12:16]) - self.SectionHeaderList.append((SecName, SecVirtualAddress, SecRawAddress, SecVirtualSize)) - self.IsValid = True - PeObject.close() - - def _ByteListToStr(self, ByteList): - String = '' - for index in range(len(ByteList)): - if ByteList[index] == 0: - break - String += chr(ByteList[index]) - return String - - def _ByteListToInt(self, ByteList): - Value = 0 - for index in range(len(ByteList) - 1, -1, -1): - Value = (Value << 8) | int(ByteList[index]) - return Value - - -class SkuClass(): - - DEFAULT = 0 - SINGLE = 1 - MULTIPLE =2 - - def __init__(self,SkuIdentifier='', SkuIds={}): - - self.AvailableSkuIds = sdict() - self.SkuIdSet = [] - - if SkuIdentifier == '' or SkuIdentifier is None: - self.SkuIdSet = ['DEFAULT'] - elif SkuIdentifier == 'ALL': - self.SkuIdSet = SkuIds.keys() - else: - r = SkuIdentifier.split('|') - self.SkuIdSet=[r[k].strip() for k in range(len(r))] - if len(self.SkuIdSet) == 2 and 'DEFAULT' in self.SkuIdSet and SkuIdentifier != 'ALL': - self.SkuIdSet.remove('DEFAULT') - - for each in self.SkuIdSet: - if each in SkuIds: - self.AvailableSkuIds[each] = SkuIds[each] - else: - EdkLogger.error("build", PARAMETER_INVALID, - ExtraData="SKU-ID [%s] is not supported by the platform. [Valid SKU-ID: %s]" - % (each, " ".join(SkuIds.keys()))) - - def __SkuUsageType(self): - - if len(self.SkuIdSet) == 1: - if self.SkuIdSet[0] == 'DEFAULT': - return SkuClass.DEFAULT - else: - return SkuClass.SINGLE - else: - return SkuClass.MULTIPLE - - def __GetAvailableSkuIds(self): - return self.AvailableSkuIds - - def __GetSystemSkuID(self): - if self.__SkuUsageType() == SkuClass.SINGLE: - return self.SkuIdSet[0] - else: - return 'DEFAULT' - - SystemSkuId = property(__GetSystemSkuID) - AvailableSkuIdSet = property(__GetAvailableSkuIds) - SkuUsageType = property(__SkuUsageType) - -## -# -# This acts like the main() function for the script, unless it is 'import'ed into another -# script. -# -if __name__ == '__main__': - pass - +## @file +# Common routines used by all tools +# +# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import sys +import string +import thread +import threading +import time +import re +import cPickle +import array +from UserDict import IterableUserDict +from UserList import UserList + +from Common import EdkLogger as EdkLogger +from Common import GlobalData as GlobalData +from DataType import * +from BuildToolError import * +from CommonDataClass.DataClass import * +from Parsing import GetSplitValueList + +## Regular expression used to find out place holders in string template +gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE|re.UNICODE) + +## Dictionary used to store file time stamp for quick re-access +gFileTimeStampCache = {} # {file path : file time stamp} + +## Dictionary used to store dependencies of files +gDependencyDatabase = {} # arch : {file path : [dependent files list]} + +## callback routine for processing variable option +# +# This function can be used to process variable number of option values. The +# typical usage of it is specify architecure list on command line. +# (e.g. -a IA32 X64 IPF) +# +# @param Option Standard callback function parameter +# @param OptionString Standard callback function parameter +# @param Value Standard callback function parameter +# @param Parser Standard callback function parameter +# +# @retval +# +def ProcessVariableArgument(Option, OptionString, Value, Parser): + assert Value is None + Value = [] + RawArgs = Parser.rargs + while RawArgs: + Arg = RawArgs[0] + if (Arg[:2] == "--" and len(Arg) > 2) or \ + (Arg[:1] == "-" and len(Arg) > 1 and Arg[1] != "-"): + break + Value.append(Arg) + del RawArgs[0] + setattr(Parser.values, Option.dest, Value) + +## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C structure style +# +# @param Guid The GUID string +# +# @retval string The GUID string in C structure style +# +def GuidStringToGuidStructureString(Guid): + GuidList = Guid.split('-') + Result = '{' + for Index in range(0,3,1): + Result = Result + '0x' + GuidList[Index] + ', ' + Result = Result + '{0x' + GuidList[3][0:2] + ', 0x' + GuidList[3][2:4] + for Index in range(0,12,2): + Result = Result + ', 0x' + GuidList[4][Index:Index+2] + Result += '}}' + return Result + +## Convert GUID structure in byte array to xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +# +# @param GuidValue The GUID value in byte array +# +# @retval string The GUID value in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format +# +def GuidStructureByteArrayToGuidString(GuidValue): + guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "").replace(";", "") + guidValueList = guidValueString.split(",") + if len(guidValueList) != 16: + return '' + #EdkLogger.error(None, None, "Invalid GUID value string %s" % GuidValue) + try: + return "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" % ( + int(guidValueList[3], 16), + int(guidValueList[2], 16), + int(guidValueList[1], 16), + int(guidValueList[0], 16), + int(guidValueList[5], 16), + int(guidValueList[4], 16), + int(guidValueList[7], 16), + int(guidValueList[6], 16), + int(guidValueList[8], 16), + int(guidValueList[9], 16), + int(guidValueList[10], 16), + int(guidValueList[11], 16), + int(guidValueList[12], 16), + int(guidValueList[13], 16), + int(guidValueList[14], 16), + int(guidValueList[15], 16) + ) + except: + return '' + +## Convert GUID string in C structure style to xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +# +# @param GuidValue The GUID value in C structure format +# +# @retval string The GUID value in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format +# +def GuidStructureStringToGuidString(GuidValue): + guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "").replace(";", "") + guidValueList = guidValueString.split(",") + if len(guidValueList) != 11: + return '' + #EdkLogger.error(None, None, "Invalid GUID value string %s" % GuidValue) + try: + return "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % ( + int(guidValueList[0], 16), + int(guidValueList[1], 16), + int(guidValueList[2], 16), + int(guidValueList[3], 16), + int(guidValueList[4], 16), + int(guidValueList[5], 16), + int(guidValueList[6], 16), + int(guidValueList[7], 16), + int(guidValueList[8], 16), + int(guidValueList[9], 16), + int(guidValueList[10], 16) + ) + except: + return '' + +## Convert GUID string in C structure style to xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx +# +# @param GuidValue The GUID value in C structure format +# +# @retval string The GUID value in xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx format +# +def GuidStructureStringToGuidValueName(GuidValue): + guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "") + guidValueList = guidValueString.split(",") + if len(guidValueList) != 11: + EdkLogger.error(None, FORMAT_INVALID, "Invalid GUID value string [%s]" % GuidValue) + return "%08x_%04x_%04x_%02x%02x_%02x%02x%02x%02x%02x%02x" % ( + int(guidValueList[0], 16), + int(guidValueList[1], 16), + int(guidValueList[2], 16), + int(guidValueList[3], 16), + int(guidValueList[4], 16), + int(guidValueList[5], 16), + int(guidValueList[6], 16), + int(guidValueList[7], 16), + int(guidValueList[8], 16), + int(guidValueList[9], 16), + int(guidValueList[10], 16) + ) + +## Create directories +# +# @param Directory The directory name +# +def CreateDirectory(Directory): + if Directory == None or Directory.strip() == "": + return True + try: + if not os.access(Directory, os.F_OK): + os.makedirs(Directory) + except: + return False + return True + +## Remove directories, including files and sub-directories in it +# +# @param Directory The directory name +# +def RemoveDirectory(Directory, Recursively=False): + if Directory == None or Directory.strip() == "" or not os.path.exists(Directory): + return + if Recursively: + CurrentDirectory = os.getcwd() + os.chdir(Directory) + for File in os.listdir("."): + if os.path.isdir(File): + RemoveDirectory(File, Recursively) + else: + os.remove(File) + os.chdir(CurrentDirectory) + os.rmdir(Directory) + +## Check if given file is changed or not +# +# This method is used to check if a file is changed or not between two build +# actions. It makes use a cache to store files timestamp. +# +# @param File The path of file +# +# @retval True If the given file is changed, doesn't exist, or can't be +# found in timestamp cache +# @retval False If the given file is changed +# +def IsChanged(File): + if not os.path.exists(File): + return True + + FileState = os.stat(File) + TimeStamp = FileState[-2] + + if File in gFileTimeStampCache and TimeStamp == gFileTimeStampCache[File]: + FileChanged = False + else: + FileChanged = True + gFileTimeStampCache[File] = TimeStamp + + return FileChanged + +## Store content in file +# +# This method is used to save file only when its content is changed. This is +# quite useful for "make" system to decide what will be re-built and what won't. +# +# @param File The path of file +# @param Content The new content of the file +# @param IsBinaryFile The flag indicating if the file is binary file or not +# +# @retval True If the file content is changed and the file is renewed +# @retval False If the file content is the same +# +def SaveFileOnChange(File, Content, IsBinaryFile=True): + if not IsBinaryFile: + Content = Content.replace("\n", os.linesep) + + if os.path.exists(File): + try: + if Content == open(File, "rb").read(): + return False + except: + EdkLogger.error(None, FILE_OPEN_FAILURE, ExtraData=File) + + DirName = os.path.dirname(File) + if not CreateDirectory(DirName): + EdkLogger.error(None, FILE_CREATE_FAILURE, "Could not create directory %s" % DirName) + else: + if DirName == '': + DirName = os.getcwd() + if not os.access(DirName, os.W_OK): + EdkLogger.error(None, PERMISSION_FAILURE, "Do not have write permission on directory %s" % DirName) + + try: + if GlobalData.gIsWindows: + try: + from PyUtility import SaveFileToDisk + if not SaveFileToDisk(File, Content): + EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData=File) + except: + Fd = open(File, "wb") + Fd.write(Content) + Fd.close() + else: + Fd = open(File, "wb") + Fd.write(Content) + Fd.close() + except IOError, X: + EdkLogger.error(None, FILE_CREATE_FAILURE, ExtraData='IOError %s'%X) + + return True + +## Make a Python object persistent on file system +# +# @param Data The object to be stored in file +# @param File The path of file to store the object +# +def DataDump(Data, File): + Fd = None + try: + Fd = open(File, 'wb') + cPickle.dump(Data, Fd, cPickle.HIGHEST_PROTOCOL) + except: + EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, RaiseError=False) + finally: + if Fd != None: + Fd.close() + +## Restore a Python object from a file +# +# @param File The path of file stored the object +# +# @retval object A python object +# @retval None If failure in file operation +# +def DataRestore(File): + Data = None + Fd = None + try: + Fd = open(File, 'rb') + Data = cPickle.load(Fd) + except Exception, e: + EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e))) + Data = None + finally: + if Fd != None: + Fd.close() + return Data + +## Retrieve and cache the real path name in file system +# +# @param Root The root directory of path relative to +# +# @retval str The path string if the path exists +# @retval None If path doesn't exist +# +class DirCache: + _CACHE_ = set() + _UPPER_CACHE_ = {} + + def __init__(self, Root): + self._Root = Root + for F in os.listdir(Root): + self._CACHE_.add(F) + self._UPPER_CACHE_[F.upper()] = F + + # =[] operator + def __getitem__(self, Path): + Path = Path[len(os.path.commonprefix([Path, self._Root])):] + if not Path: + return self._Root + if Path and Path[0] == os.path.sep: + Path = Path[1:] + if Path in self._CACHE_: + return os.path.join(self._Root, Path) + UpperPath = Path.upper() + if UpperPath in self._UPPER_CACHE_: + return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath]) + + IndexList = [] + LastSepIndex = -1 + SepIndex = Path.find(os.path.sep) + while SepIndex > -1: + Parent = UpperPath[:SepIndex] + if Parent not in self._UPPER_CACHE_: + break + LastSepIndex = SepIndex + SepIndex = Path.find(os.path.sep, LastSepIndex + 1) + + if LastSepIndex == -1: + return None + + Cwd = os.getcwd() + os.chdir(self._Root) + SepIndex = LastSepIndex + while SepIndex > -1: + Parent = Path[:SepIndex] + ParentKey = UpperPath[:SepIndex] + if ParentKey not in self._UPPER_CACHE_: + os.chdir(Cwd) + return None + + if Parent in self._CACHE_: + ParentDir = Parent + else: + ParentDir = self._UPPER_CACHE_[ParentKey] + for F in os.listdir(ParentDir): + Dir = os.path.join(ParentDir, F) + self._CACHE_.add(Dir) + self._UPPER_CACHE_[Dir.upper()] = Dir + + SepIndex = Path.find(os.path.sep, SepIndex + 1) + + os.chdir(Cwd) + if Path in self._CACHE_: + return os.path.join(self._Root, Path) + elif UpperPath in self._UPPER_CACHE_: + return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath]) + return None + +## Get all files of a directory +# +# @param Root: Root dir +# @param SkipList : The files need be skipped +# +# @retval A list of all files +# +def GetFiles(Root, SkipList=None, FullPath = True): + OriPath = Root + FileList = [] + for Root, Dirs, Files in os.walk(Root): + if SkipList: + for Item in SkipList: + if Item in Dirs: + Dirs.remove(Item) + + for File in Files: + File = os.path.normpath(os.path.join(Root, File)) + if not FullPath: + File = File[len(OriPath) + 1:] + FileList.append(File) + + return FileList + +## Check if gvien file exists or not +# +# @param File File name or path to be checked +# @param Dir The directory the file is relative to +# +# @retval True if file exists +# @retval False if file doesn't exists +# +def ValidFile(File, Ext=None): + if Ext != None: + Dummy, FileExt = os.path.splitext(File) + if FileExt.lower() != Ext.lower(): + return False + if not os.path.exists(File): + return False + return True + +def RealPath(File, Dir='', OverrideDir=''): + NewFile = os.path.normpath(os.path.join(Dir, File)) + NewFile = GlobalData.gAllFiles[NewFile] + if not NewFile and OverrideDir: + NewFile = os.path.normpath(os.path.join(OverrideDir, File)) + NewFile = GlobalData.gAllFiles[NewFile] + return NewFile + +def RealPath2(File, Dir='', OverrideDir=''): + if OverrideDir: + NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(OverrideDir, File))] + if NewFile: + if OverrideDir[-1] == os.path.sep: + return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)] + else: + return NewFile[len(OverrideDir)+1:], NewFile[0:len(OverrideDir)] + if GlobalData.gAllFiles: + NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(Dir, File))] + else: + NewFile = os.path.normpath(os.path.join(Dir, File)) + if NewFile: + if Dir: + if Dir[-1] == os.path.sep: + return NewFile[len(Dir):], NewFile[0:len(Dir)] + else: + return NewFile[len(Dir)+1:], NewFile[0:len(Dir)] + else: + return NewFile, '' + + return None, None + +## Check if gvien file exists or not +# +# +def ValidFile2(AllFiles, File, Ext=None, Workspace='', EfiSource='', EdkSource='', Dir='.', OverrideDir=''): + NewFile = File + if Ext != None: + Dummy, FileExt = os.path.splitext(File) + if FileExt.lower() != Ext.lower(): + return False, File + + # Replace the Edk macros + if OverrideDir != '' and OverrideDir != None: + if OverrideDir.find('$(EFI_SOURCE)') > -1: + OverrideDir = OverrideDir.replace('$(EFI_SOURCE)', EfiSource) + if OverrideDir.find('$(EDK_SOURCE)') > -1: + OverrideDir = OverrideDir.replace('$(EDK_SOURCE)', EdkSource) + + # Replace the default dir to current dir + if Dir == '.': + Dir = os.getcwd() + Dir = Dir[len(Workspace)+1:] + + # First check if File has Edk definition itself + if File.find('$(EFI_SOURCE)') > -1 or File.find('$(EDK_SOURCE)') > -1: + NewFile = File.replace('$(EFI_SOURCE)', EfiSource) + NewFile = NewFile.replace('$(EDK_SOURCE)', EdkSource) + NewFile = AllFiles[os.path.normpath(NewFile)] + if NewFile != None: + return True, NewFile + + # Second check the path with override value + if OverrideDir != '' and OverrideDir != None: + NewFile = AllFiles[os.path.normpath(os.path.join(OverrideDir, File))] + if NewFile != None: + return True, NewFile + + # Last check the path with normal definitions + File = os.path.join(Dir, File) + NewFile = AllFiles[os.path.normpath(File)] + if NewFile != None: + return True, NewFile + + return False, File + +## Check if gvien file exists or not +# +# +def ValidFile3(AllFiles, File, Workspace='', EfiSource='', EdkSource='', Dir='.', OverrideDir=''): + # Replace the Edk macros + if OverrideDir != '' and OverrideDir != None: + if OverrideDir.find('$(EFI_SOURCE)') > -1: + OverrideDir = OverrideDir.replace('$(EFI_SOURCE)', EfiSource) + if OverrideDir.find('$(EDK_SOURCE)') > -1: + OverrideDir = OverrideDir.replace('$(EDK_SOURCE)', EdkSource) + + # Replace the default dir to current dir + # Dir is current module dir related to workspace + if Dir == '.': + Dir = os.getcwd() + Dir = Dir[len(Workspace)+1:] + + NewFile = File + RelaPath = AllFiles[os.path.normpath(Dir)] + NewRelaPath = RelaPath + + while(True): + # First check if File has Edk definition itself + if File.find('$(EFI_SOURCE)') > -1 or File.find('$(EDK_SOURCE)') > -1: + File = File.replace('$(EFI_SOURCE)', EfiSource) + File = File.replace('$(EDK_SOURCE)', EdkSource) + NewFile = AllFiles[os.path.normpath(File)] + if NewFile != None: + NewRelaPath = os.path.dirname(NewFile) + File = os.path.basename(NewFile) + #NewRelaPath = NewFile[:len(NewFile) - len(File.replace("..\\", '').replace("../", '')) - 1] + break + + # Second check the path with override value + if OverrideDir != '' and OverrideDir != None: + NewFile = AllFiles[os.path.normpath(os.path.join(OverrideDir, File))] + if NewFile != None: + #NewRelaPath = os.path.dirname(NewFile) + NewRelaPath = NewFile[:len(NewFile) - len(File.replace("..\\", '').replace("../", '')) - 1] + break + + # Last check the path with normal definitions + NewFile = AllFiles[os.path.normpath(os.path.join(Dir, File))] + if NewFile != None: + break + + # No file found + break + + return NewRelaPath, RelaPath, File + + +def GetRelPath(Path1, Path2): + FileName = os.path.basename(Path2) + L1 = os.path.normpath(Path1).split(os.path.normpath('/')) + L2 = os.path.normpath(Path2).split(os.path.normpath('/')) + for Index in range(0, len(L1)): + if L1[Index] != L2[Index]: + FileName = '../' * (len(L1) - Index) + for Index2 in range(Index, len(L2)): + FileName = os.path.join(FileName, L2[Index2]) + break + return os.path.normpath(FileName) + + +## Get GUID value from given packages +# +# @param CName The CName of the GUID +# @param PackageList List of packages looking-up in +# +# @retval GuidValue if the CName is found in any given package +# @retval None if the CName is not found in all given packages +# +def GuidValue(CName, PackageList): + for P in PackageList: + if CName in P.Guids: + return P.Guids[CName] + return None + +## Get Protocol value from given packages +# +# @param CName The CName of the GUID +# @param PackageList List of packages looking-up in +# +# @retval GuidValue if the CName is found in any given package +# @retval None if the CName is not found in all given packages +# +def ProtocolValue(CName, PackageList): + for P in PackageList: + if CName in P.Protocols: + return P.Protocols[CName] + return None + +## Get PPI value from given packages +# +# @param CName The CName of the GUID +# @param PackageList List of packages looking-up in +# +# @retval GuidValue if the CName is found in any given package +# @retval None if the CName is not found in all given packages +# +def PpiValue(CName, PackageList): + for P in PackageList: + if CName in P.Ppis: + return P.Ppis[CName] + return None + +## A string template class +# +# This class implements a template for string replacement. A string template +# looks like following +# +# ${BEGIN} other_string ${placeholder_name} other_string ${END} +# +# The string between ${BEGIN} and ${END} will be repeated as many times as the +# length of "placeholder_name", which is a list passed through a dict. The +# "placeholder_name" is the key name of the dict. The ${BEGIN} and ${END} can +# be not used and, in this case, the "placeholder_name" must not a list and it +# will just be replaced once. +# +class TemplateString(object): + _REPEAT_START_FLAG = "BEGIN" + _REPEAT_END_FLAG = "END" + + class Section(object): + _LIST_TYPES = [type([]), type(set()), type((0,))] + + def __init__(self, TemplateSection, PlaceHolderList): + self._Template = TemplateSection + self._PlaceHolderList = [] + + # Split the section into sub-sections according to the position of placeholders + if PlaceHolderList: + self._SubSectionList = [] + SubSectionStart = 0 + # + # The placeholders passed in must be in the format of + # + # PlaceHolderName, PlaceHolderStartPoint, PlaceHolderEndPoint + # + for PlaceHolder,Start,End in PlaceHolderList: + self._SubSectionList.append(TemplateSection[SubSectionStart:Start]) + self._SubSectionList.append(TemplateSection[Start:End]) + self._PlaceHolderList.append(PlaceHolder) + SubSectionStart = End + if SubSectionStart < len(TemplateSection): + self._SubSectionList.append(TemplateSection[SubSectionStart:]) + else: + self._SubSectionList = [TemplateSection] + + def __str__(self): + return self._Template + " : " + str(self._PlaceHolderList) + + def Instantiate(self, PlaceHolderValues): + RepeatTime = -1 + RepeatPlaceHolders = {} + NonRepeatPlaceHolders = {} + + for PlaceHolder in self._PlaceHolderList: + if PlaceHolder not in PlaceHolderValues: + continue + Value = PlaceHolderValues[PlaceHolder] + if type(Value) in self._LIST_TYPES: + if RepeatTime < 0: + RepeatTime = len(Value) + elif RepeatTime != len(Value): + EdkLogger.error( + "TemplateString", + PARAMETER_INVALID, + "${%s} has different repeat time from others!" % PlaceHolder, + ExtraData=str(self._Template) + ) + RepeatPlaceHolders["${%s}" % PlaceHolder] = Value + else: + NonRepeatPlaceHolders["${%s}" % PlaceHolder] = Value + + if NonRepeatPlaceHolders: + StringList = [] + for S in self._SubSectionList: + if S not in NonRepeatPlaceHolders: + StringList.append(S) + else: + StringList.append(str(NonRepeatPlaceHolders[S])) + else: + StringList = self._SubSectionList + + if RepeatPlaceHolders: + TempStringList = [] + for Index in range(RepeatTime): + for S in StringList: + if S not in RepeatPlaceHolders: + TempStringList.append(S) + else: + TempStringList.append(str(RepeatPlaceHolders[S][Index])) + StringList = TempStringList + + return "".join(StringList) + + ## Constructor + def __init__(self, Template=None): + self.String = '' + self.IsBinary = False + self._Template = Template + self._TemplateSectionList = self._Parse(Template) + + ## str() operator + # + # @retval string The string replaced + # + def __str__(self): + return self.String + + ## Split the template string into fragments per the ${BEGIN} and ${END} flags + # + # @retval list A list of TemplateString.Section objects + # + def _Parse(self, Template): + SectionStart = 0 + SearchFrom = 0 + MatchEnd = 0 + PlaceHolderList = [] + TemplateSectionList = [] + while Template: + MatchObj = gPlaceholderPattern.search(Template, SearchFrom) + if not MatchObj: + if MatchEnd <= len(Template): + TemplateSection = TemplateString.Section(Template[SectionStart:], PlaceHolderList) + TemplateSectionList.append(TemplateSection) + break + + MatchString = MatchObj.group(1) + MatchStart = MatchObj.start() + MatchEnd = MatchObj.end() + + if MatchString == self._REPEAT_START_FLAG: + if MatchStart > SectionStart: + TemplateSection = TemplateString.Section(Template[SectionStart:MatchStart], PlaceHolderList) + TemplateSectionList.append(TemplateSection) + SectionStart = MatchEnd + PlaceHolderList = [] + elif MatchString == self._REPEAT_END_FLAG: + TemplateSection = TemplateString.Section(Template[SectionStart:MatchStart], PlaceHolderList) + TemplateSectionList.append(TemplateSection) + SectionStart = MatchEnd + PlaceHolderList = [] + else: + PlaceHolderList.append((MatchString, MatchStart - SectionStart, MatchEnd - SectionStart)) + SearchFrom = MatchEnd + return TemplateSectionList + + ## Replace the string template with dictionary of placeholders and append it to previous one + # + # @param AppendString The string template to append + # @param Dictionary The placeholder dictionaries + # + def Append(self, AppendString, Dictionary=None): + if Dictionary: + SectionList = self._Parse(AppendString) + self.String += "".join([S.Instantiate(Dictionary) for S in SectionList]) + else: + self.String += AppendString + + ## Replace the string template with dictionary of placeholders + # + # @param Dictionary The placeholder dictionaries + # + # @retval str The string replaced with placeholder values + # + def Replace(self, Dictionary=None): + return "".join([S.Instantiate(Dictionary) for S in self._TemplateSectionList]) + +## Progress indicator class +# +# This class makes use of thread to print progress on console. +# +class Progressor: + # for avoiding deadloop + _StopFlag = None + _ProgressThread = None + _CheckInterval = 0.25 + + ## Constructor + # + # @param OpenMessage The string printed before progress charaters + # @param CloseMessage The string printed after progress charaters + # @param ProgressChar The charater used to indicate the progress + # @param Interval The interval in seconds between two progress charaters + # + def __init__(self, OpenMessage="", CloseMessage="", ProgressChar='.', Interval=1.0): + self.PromptMessage = OpenMessage + self.CodaMessage = CloseMessage + self.ProgressChar = ProgressChar + self.Interval = Interval + if Progressor._StopFlag == None: + Progressor._StopFlag = threading.Event() + + ## Start to print progress charater + # + # @param OpenMessage The string printed before progress charaters + # + def Start(self, OpenMessage=None): + if OpenMessage != None: + self.PromptMessage = OpenMessage + Progressor._StopFlag.clear() + if Progressor._ProgressThread == None: + Progressor._ProgressThread = threading.Thread(target=self._ProgressThreadEntry) + Progressor._ProgressThread.setDaemon(False) + Progressor._ProgressThread.start() + + ## Stop printing progress charater + # + # @param CloseMessage The string printed after progress charaters + # + def Stop(self, CloseMessage=None): + OriginalCodaMessage = self.CodaMessage + if CloseMessage != None: + self.CodaMessage = CloseMessage + self.Abort() + self.CodaMessage = OriginalCodaMessage + + ## Thread entry method + def _ProgressThreadEntry(self): + sys.stdout.write(self.PromptMessage + " ") + sys.stdout.flush() + TimeUp = 0.0 + while not Progressor._StopFlag.isSet(): + if TimeUp <= 0.0: + sys.stdout.write(self.ProgressChar) + sys.stdout.flush() + TimeUp = self.Interval + time.sleep(self._CheckInterval) + TimeUp -= self._CheckInterval + sys.stdout.write(" " + self.CodaMessage + "\n") + sys.stdout.flush() + + ## Abort the progress display + @staticmethod + def Abort(): + if Progressor._StopFlag != None: + Progressor._StopFlag.set() + if Progressor._ProgressThread != None: + Progressor._ProgressThread.join() + Progressor._ProgressThread = None + +## A dict which can access its keys and/or values orderly +# +# The class implements a new kind of dict which its keys or values can be +# accessed in the order they are added into the dict. It guarantees the order +# by making use of an internal list to keep a copy of keys. +# +class sdict(IterableUserDict): + ## Constructor + def __init__(self): + IterableUserDict.__init__(self) + self._key_list = [] + + ## [] operator + def __setitem__(self, key, value): + if key not in self._key_list: + self._key_list.append(key) + IterableUserDict.__setitem__(self, key, value) + + ## del operator + def __delitem__(self, key): + self._key_list.remove(key) + IterableUserDict.__delitem__(self, key) + + ## used in "for k in dict" loop to ensure the correct order + def __iter__(self): + return self.iterkeys() + + ## len() support + def __len__(self): + return len(self._key_list) + + ## "in" test support + def __contains__(self, key): + return key in self._key_list + + ## indexof support + def index(self, key): + return self._key_list.index(key) + + ## insert support + def insert(self, key, newkey, newvalue, order): + index = self._key_list.index(key) + if order == 'BEFORE': + self._key_list.insert(index, newkey) + IterableUserDict.__setitem__(self, newkey, newvalue) + elif order == 'AFTER': + self._key_list.insert(index + 1, newkey) + IterableUserDict.__setitem__(self, newkey, newvalue) + + ## append support + def append(self, sdict): + for key in sdict: + if key not in self._key_list: + self._key_list.append(key) + IterableUserDict.__setitem__(self, key, sdict[key]) + + def has_key(self, key): + return key in self._key_list + + ## Empty the dict + def clear(self): + self._key_list = [] + IterableUserDict.clear(self) + + ## Return a copy of keys + def keys(self): + keys = [] + for key in self._key_list: + keys.append(key) + return keys + + ## Return a copy of values + def values(self): + values = [] + for key in self._key_list: + values.append(self[key]) + return values + + ## Return a copy of (key, value) list + def items(self): + items = [] + for key in self._key_list: + items.append((key, self[key])) + return items + + ## Iteration support + def iteritems(self): + return iter(self.items()) + + ## Keys interation support + def iterkeys(self): + return iter(self.keys()) + + ## Values interation support + def itervalues(self): + return iter(self.values()) + + ## Return value related to a key, and remove the (key, value) from the dict + def pop(self, key, *dv): + value = None + if key in self._key_list: + value = self[key] + self.__delitem__(key) + elif len(dv) != 0 : + value = kv[0] + return value + + ## Return (key, value) pair, and remove the (key, value) from the dict + def popitem(self): + key = self._key_list[-1] + value = self[key] + self.__delitem__(key) + return key, value + + def update(self, dict=None, **kwargs): + if dict != None: + for k, v in dict.items(): + self[k] = v + if len(kwargs): + for k, v in kwargs.items(): + self[k] = v + +## Dictionary with restricted keys +# +class rdict(dict): + ## Constructor + def __init__(self, KeyList): + for Key in KeyList: + dict.__setitem__(self, Key, "") + + ## []= operator + def __setitem__(self, key, value): + if key not in self: + EdkLogger.error("RestrictedDict", ATTRIBUTE_SET_FAILURE, "Key [%s] is not allowed" % key, + ExtraData=", ".join(dict.keys(self))) + dict.__setitem__(self, key, value) + + ## =[] operator + def __getitem__(self, key): + if key not in self: + return "" + return dict.__getitem__(self, key) + + ## del operator + def __delitem__(self, key): + EdkLogger.error("RestrictedDict", ATTRIBUTE_ACCESS_DENIED, ExtraData="del") + + ## Empty the dict + def clear(self): + for Key in self: + self.__setitem__(Key, "") + + ## Return value related to a key, and remove the (key, value) from the dict + def pop(self, key, *dv): + EdkLogger.error("RestrictedDict", ATTRIBUTE_ACCESS_DENIED, ExtraData="pop") + + ## Return (key, value) pair, and remove the (key, value) from the dict + def popitem(self): + EdkLogger.error("RestrictedDict", ATTRIBUTE_ACCESS_DENIED, ExtraData="popitem") + +## Dictionary using prioritized list as key +# +class tdict: + _ListType = type([]) + _TupleType = type(()) + _Wildcard = 'COMMON' + _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM'] + + def __init__(self, _Single_=False, _Level_=2): + self._Level_ = _Level_ + self.data = {} + self._Single_ = _Single_ + + # =[] operator + def __getitem__(self, key): + KeyType = type(key) + RestKeys = None + if KeyType == self._ListType or KeyType == self._TupleType: + FirstKey = key[0] + if len(key) > 1: + RestKeys = key[1:] + elif self._Level_ > 1: + RestKeys = [self._Wildcard for i in range(0, self._Level_-1)] + else: + FirstKey = key + if self._Level_ > 1: + RestKeys = [self._Wildcard for i in range(0, self._Level_-1)] + + if FirstKey == None or str(FirstKey).upper() in self._ValidWildcardList: + FirstKey = self._Wildcard + + if self._Single_: + return self._GetSingleValue(FirstKey, RestKeys) + else: + return self._GetAllValues(FirstKey, RestKeys) + + def _GetSingleValue(self, FirstKey, RestKeys): + Value = None + #print "%s-%s" % (FirstKey, self._Level_) , + if self._Level_ > 1: + if FirstKey == self._Wildcard: + if FirstKey in self.data: + Value = self.data[FirstKey][RestKeys] + if Value == None: + for Key in self.data: + Value = self.data[Key][RestKeys] + if Value != None: break + else: + if FirstKey in self.data: + Value = self.data[FirstKey][RestKeys] + if Value == None and self._Wildcard in self.data: + #print "Value=None" + Value = self.data[self._Wildcard][RestKeys] + else: + if FirstKey == self._Wildcard: + if FirstKey in self.data: + Value = self.data[FirstKey] + if Value == None: + for Key in self.data: + Value = self.data[Key] + if Value != None: break + else: + if FirstKey in self.data: + Value = self.data[FirstKey] + elif self._Wildcard in self.data: + Value = self.data[self._Wildcard] + return Value + + def _GetAllValues(self, FirstKey, RestKeys): + Value = [] + if self._Level_ > 1: + if FirstKey == self._Wildcard: + for Key in self.data: + Value += self.data[Key][RestKeys] + else: + if FirstKey in self.data: + Value += self.data[FirstKey][RestKeys] + if self._Wildcard in self.data: + Value += self.data[self._Wildcard][RestKeys] + else: + if FirstKey == self._Wildcard: + for Key in self.data: + Value.append(self.data[Key]) + else: + if FirstKey in self.data: + Value.append(self.data[FirstKey]) + if self._Wildcard in self.data: + Value.append(self.data[self._Wildcard]) + return Value + + ## []= operator + def __setitem__(self, key, value): + KeyType = type(key) + RestKeys = None + if KeyType == self._ListType or KeyType == self._TupleType: + FirstKey = key[0] + if len(key) > 1: + RestKeys = key[1:] + else: + RestKeys = [self._Wildcard for i in range(0, self._Level_-1)] + else: + FirstKey = key + if self._Level_ > 1: + RestKeys = [self._Wildcard for i in range(0, self._Level_-1)] + + if FirstKey in self._ValidWildcardList: + FirstKey = self._Wildcard + + if FirstKey not in self.data and self._Level_ > 0: + self.data[FirstKey] = tdict(self._Single_, self._Level_ - 1) + + if self._Level_ > 1: + self.data[FirstKey][RestKeys] = value + else: + self.data[FirstKey] = value + + def SetGreedyMode(self): + self._Single_ = False + if self._Level_ > 1: + for Key in self.data: + self.data[Key].SetGreedyMode() + + def SetSingleMode(self): + self._Single_ = True + if self._Level_ > 1: + for Key in self.data: + self.data[Key].SetSingleMode() + + def GetKeys(self, KeyIndex=0): + assert KeyIndex >= 0 + if KeyIndex == 0: + return set(self.data.keys()) + else: + keys = set() + for Key in self.data: + keys |= self.data[Key].GetKeys(KeyIndex - 1) + return keys + +## Boolean chain list +# +class Blist(UserList): + def __init__(self, initlist=None): + UserList.__init__(self, initlist) + def __setitem__(self, i, item): + if item not in [True, False]: + if item == 0: + item = False + else: + item = True + self.data[i] = item + def _GetResult(self): + Value = True + for item in self.data: + Value &= item + return Value + Result = property(_GetResult) + +def ParseConsoleLog(Filename): + Opr = open(os.path.normpath(Filename), 'r') + Opw = open(os.path.normpath(Filename + '.New'), 'w+') + for Line in Opr.readlines(): + if Line.find('.efi') > -1: + Line = Line[Line.rfind(' ') : Line.rfind('.efi')].strip() + Opw.write('%s\n' % Line) + + Opr.close() + Opw.close() + +## AnalyzeDscPcd +# +# Analyze DSC PCD value, since there is no data type info in DSC +# This fuction is used to match functions (AnalyzePcdData, AnalyzeHiiPcdData, AnalyzeVpdPcdData) used for retrieving PCD value from database +# 1. Feature flag: TokenSpace.PcdCName|PcdValue +# 2. Fix and Patch:TokenSpace.PcdCName|PcdValue[|MaxSize] +# 3. Dynamic default: +# TokenSpace.PcdCName|PcdValue[|VOID*[|MaxSize]] +# TokenSpace.PcdCName|PcdValue +# 4. Dynamic VPD: +# TokenSpace.PcdCName|VpdOffset[|VpdValue] +# TokenSpace.PcdCName|VpdOffset[|MaxSize[|VpdValue]] +# 5. Dynamic HII: +# TokenSpace.PcdCName|HiiString|VaiableGuid|VariableOffset[|HiiValue] +# PCD value needs to be located in such kind of string, and the PCD value might be an expression in which +# there might have "|" operator, also in string value. +# +# @param Setting: String contain information described above with "TokenSpace.PcdCName|" stripped +# @param PcdType: PCD type: feature, fixed, dynamic default VPD HII +# @param DataType: The datum type of PCD: VOID*, UNIT, BOOL +# @retval: +# ValueList: A List contain fields described above +# IsValid: True if conforming EBNF, otherwise False +# Index: The index where PcdValue is in ValueList +# +def AnalyzeDscPcd(Setting, PcdType, DataType=''): + Setting = Setting.strip() + # There might be escaped quote in a string: \", \\\" + Data = Setting.replace('\\\\', '//').replace('\\\"', '\\\'') + # There might be '|' in string and in ( ... | ... ), replace it with '-' + NewStr = '' + InStr = False + Pair = 0 + for ch in Data: + if ch == '"': + InStr = not InStr + elif ch == '(' and not InStr: + Pair += 1 + elif ch == ')' and not InStr: + Pair -= 1 + + if (Pair > 0 or InStr) and ch == TAB_VALUE_SPLIT: + NewStr += '-' + else: + NewStr += ch + FieldList = [] + StartPos = 0 + while True: + Pos = NewStr.find(TAB_VALUE_SPLIT, StartPos) + if Pos < 0: + FieldList.append(Setting[StartPos:].strip()) + break + FieldList.append(Setting[StartPos:Pos].strip()) + StartPos = Pos + 1 + + IsValid = True + if PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_FEATURE_FLAG): + Value = FieldList[0] + Size = '' + if len(FieldList) > 1: + Type = FieldList[1] + # Fix the PCD type when no DataType input + if Type == 'VOID*': + DataType = 'VOID*' + else: + Size = FieldList[1] + if len(FieldList) > 2: + Size = FieldList[2] + if DataType == 'VOID*': + IsValid = (len(FieldList) <= 3) + else: + IsValid = (len(FieldList) <= 1) + return [Value, '', Size], IsValid, 0 + elif PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT): + Value = FieldList[0] + Size = Type = '' + if len(FieldList) > 1: + Type = FieldList[1] + else: + Type = DataType + if len(FieldList) > 2: + Size = FieldList[2] + else: + if Type == 'VOID*': + if Value.startswith("L"): + Size = str((len(Value)- 3 + 1) * 2) + elif Value.startswith("{"): + Size = str(len(Value.split(","))) + else: + Size = str(len(Value) -2 + 1 ) + if DataType == 'VOID*': + IsValid = (len(FieldList) <= 3) + else: + IsValid = (len(FieldList) <= 1) + return [Value, Type, Size], IsValid, 0 + elif PcdType in (MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_VPD): + VpdOffset = FieldList[0] + Value = Size = '' + if not DataType == 'VOID*': + if len(FieldList) > 1: + Value = FieldList[1] + else: + if len(FieldList) > 1: + Size = FieldList[1] + if len(FieldList) > 2: + Value = FieldList[2] + if DataType == 'VOID*': + IsValid = (len(FieldList) <= 3) + else: + IsValid = (len(FieldList) <= 2) + return [VpdOffset, Size, Value], IsValid, 2 + elif PcdType in (MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII): + HiiString = FieldList[0] + Guid = Offset = Value = '' + if len(FieldList) > 1: + Guid = FieldList[1] + if len(FieldList) > 2: + Offset = FieldList[2] + if len(FieldList) > 3: + Value = FieldList[3] + IsValid = (3 <= len(FieldList) <= 4) + return [HiiString, Guid, Offset, Value], IsValid, 3 + return [], False, 0 + +## AnalyzePcdData +# +# Analyze the pcd Value, Datum type and TokenNumber. +# Used to avoid split issue while the value string contain "|" character +# +# @param[in] Setting: A String contain value/datum type/token number information; +# +# @retval ValueList: A List contain value, datum type and toke number. +# +def AnalyzePcdData(Setting): + ValueList = ['', '', ''] + + ValueRe = re.compile(r'^\s*L?\".*\|.*\"') + PtrValue = ValueRe.findall(Setting) + + ValueUpdateFlag = False + + if len(PtrValue) >= 1: + Setting = re.sub(ValueRe, '', Setting) + ValueUpdateFlag = True + + TokenList = Setting.split(TAB_VALUE_SPLIT) + ValueList[0:len(TokenList)] = TokenList + + if ValueUpdateFlag: + ValueList[0] = PtrValue[0] + + return ValueList + +## AnalyzeHiiPcdData +# +# Analyze the pcd Value, variable name, variable Guid and variable offset. +# Used to avoid split issue while the value string contain "|" character +# +# @param[in] Setting: A String contain VariableName, VariableGuid, VariableOffset, DefaultValue information; +# +# @retval ValueList: A List contaian VariableName, VariableGuid, VariableOffset, DefaultValue. +# +def AnalyzeHiiPcdData(Setting): + ValueList = ['', '', '', ''] + + TokenList = GetSplitValueList(Setting) + ValueList[0:len(TokenList)] = TokenList + + return ValueList + +## AnalyzeVpdPcdData +# +# Analyze the vpd pcd VpdOffset, MaxDatumSize and InitialValue. +# Used to avoid split issue while the value string contain "|" character +# +# @param[in] Setting: A String contain VpdOffset/MaxDatumSize/InitialValue information; +# +# @retval ValueList: A List contain VpdOffset, MaxDatumSize and InitialValue. +# +def AnalyzeVpdPcdData(Setting): + ValueList = ['', '', ''] + + ValueRe = re.compile(r'\s*L?\".*\|.*\"\s*$') + PtrValue = ValueRe.findall(Setting) + + ValueUpdateFlag = False + + if len(PtrValue) >= 1: + Setting = re.sub(ValueRe, '', Setting) + ValueUpdateFlag = True + + TokenList = Setting.split(TAB_VALUE_SPLIT) + ValueList[0:len(TokenList)] = TokenList + + if ValueUpdateFlag: + ValueList[2] = PtrValue[0] + + return ValueList + +## check format of PCD value against its the datum type +# +# For PCD value setting +# +def CheckPcdDatum(Type, Value): + if Type == "VOID*": + ValueRe = re.compile(r'\s*L?\".*\"\s*$') + if not (((Value.startswith('L"') or Value.startswith('"')) and Value.endswith('"')) + or (Value.startswith('{') and Value.endswith('}')) + ): + return False, "Invalid value [%s] of type [%s]; must be in the form of {...} for array"\ + ", or \"...\" for string, or L\"...\" for unicode string" % (Value, Type) + elif ValueRe.match(Value): + # Check the chars in UnicodeString or CString is printable + if Value.startswith("L"): + Value = Value[2:-1] + else: + Value = Value[1:-1] + Printset = set(string.printable) + Printset.remove(TAB_PRINTCHAR_VT) + Printset.add(TAB_PRINTCHAR_BS) + Printset.add(TAB_PRINTCHAR_NUL) + if not set(Value).issubset(Printset): + PrintList = list(Printset) + PrintList.sort() + return False, "Invalid PCD string value of type [%s]; must be printable chars %s." % (Type, PrintList) + elif Type == 'BOOLEAN': + if Value not in ['TRUE', 'True', 'true', '0x1', '0x01', '1', 'FALSE', 'False', 'false', '0x0', '0x00', '0']: + return False, "Invalid value [%s] of type [%s]; must be one of TRUE, True, true, 0x1, 0x01, 1"\ + ", FALSE, False, false, 0x0, 0x00, 0" % (Value, Type) + elif Type in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64]: + try: + Value = long(Value, 0) + except: + return False, "Invalid value [%s] of type [%s];"\ + " must be a hexadecimal, decimal or octal in C language format." % (Value, Type) + else: + return False, "Invalid type [%s]; must be one of VOID*, BOOLEAN, UINT8, UINT16, UINT32, UINT64." % (Type) + + return True, "" + +## Split command line option string to list +# +# subprocess.Popen needs the args to be a sequence. Otherwise there's problem +# in non-windows platform to launch command +# +def SplitOption(OptionString): + OptionList = [] + LastChar = " " + OptionStart = 0 + QuotationMark = "" + for Index in range(0, len(OptionString)): + CurrentChar = OptionString[Index] + if CurrentChar in ['"', "'"]: + if QuotationMark == CurrentChar: + QuotationMark = "" + elif QuotationMark == "": + QuotationMark = CurrentChar + continue + elif QuotationMark: + continue + + if CurrentChar in ["/", "-"] and LastChar in [" ", "\t", "\r", "\n"]: + if Index > OptionStart: + OptionList.append(OptionString[OptionStart:Index-1]) + OptionStart = Index + LastChar = CurrentChar + OptionList.append(OptionString[OptionStart:]) + return OptionList + +def CommonPath(PathList): + P1 = min(PathList).split(os.path.sep) + P2 = max(PathList).split(os.path.sep) + for Index in xrange(min(len(P1), len(P2))): + if P1[Index] != P2[Index]: + return os.path.sep.join(P1[:Index]) + return os.path.sep.join(P1) + +class PathClass(object): + def __init__(self, File='', Root='', AlterRoot='', Type='', IsBinary=False, + Arch='COMMON', ToolChainFamily='', Target='', TagName='', ToolCode=''): + self.Arch = Arch + self.File = str(File) + if os.path.isabs(self.File): + self.Root = '' + self.AlterRoot = '' + else: + self.Root = str(Root) + self.AlterRoot = str(AlterRoot) + + # Remove any '.' and '..' in path + if self.Root: + self.Path = os.path.normpath(os.path.join(self.Root, self.File)) + self.Root = os.path.normpath(CommonPath([self.Root, self.Path])) + # eliminate the side-effect of 'C:' + if self.Root[-1] == ':': + self.Root += os.path.sep + # file path should not start with path separator + if self.Root[-1] == os.path.sep: + self.File = self.Path[len(self.Root):] + else: + self.File = self.Path[len(self.Root)+1:] + else: + self.Path = os.path.normpath(self.File) + + self.SubDir, self.Name = os.path.split(self.File) + self.BaseName, self.Ext = os.path.splitext(self.Name) + + if self.Root: + if self.SubDir: + self.Dir = os.path.join(self.Root, self.SubDir) + else: + self.Dir = self.Root + else: + self.Dir = self.SubDir + + if IsBinary: + self.Type = Type + else: + self.Type = self.Ext.lower() + + self.IsBinary = IsBinary + self.Target = Target + self.TagName = TagName + self.ToolCode = ToolCode + self.ToolChainFamily = ToolChainFamily + + self._Key = None + + ## Convert the object of this class to a string + # + # Convert member Path of the class to a string + # + # @retval string Formatted String + # + def __str__(self): + return self.Path + + ## Override __eq__ function + # + # Check whether PathClass are the same + # + # @retval False The two PathClass are different + # @retval True The two PathClass are the same + # + def __eq__(self, Other): + if type(Other) == type(self): + return self.Path == Other.Path + else: + return self.Path == str(Other) + + ## Override __cmp__ function + # + # Customize the comparsion operation of two PathClass + # + # @retval 0 The two PathClass are different + # @retval -1 The first PathClass is less than the second PathClass + # @retval 1 The first PathClass is Bigger than the second PathClass + def __cmp__(self, Other): + if type(Other) == type(self): + OtherKey = Other.Path + else: + OtherKey = str(Other) + + SelfKey = self.Path + if SelfKey == OtherKey: + return 0 + elif SelfKey > OtherKey: + return 1 + else: + return -1 + + ## Override __hash__ function + # + # Use Path as key in hash table + # + # @retval string Key for hash table + # + def __hash__(self): + return hash(self.Path) + + def _GetFileKey(self): + if self._Key == None: + self._Key = self.Path.upper() # + self.ToolChainFamily + self.TagName + self.ToolCode + self.Target + return self._Key + + def _GetTimeStamp(self): + return os.stat(self.Path)[8] + + def Validate(self, Type='', CaseSensitive=True): + if GlobalData.gCaseInsensitive: + CaseSensitive = False + if Type and Type.lower() != self.Type: + return FILE_TYPE_MISMATCH, '%s (expect %s but got %s)' % (self.File, Type, self.Type) + + RealFile, RealRoot = RealPath2(self.File, self.Root, self.AlterRoot) + if not RealRoot and not RealFile: + RealFile = self.File + if self.AlterRoot: + RealFile = os.path.join(self.AlterRoot, self.File) + elif self.Root: + RealFile = os.path.join(self.Root, self.File) + return FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile) + + ErrorCode = 0 + ErrorInfo = '' + if RealRoot != self.Root or RealFile != self.File: + if CaseSensitive and (RealFile != self.File or (RealRoot != self.Root and RealRoot != self.AlterRoot)): + ErrorCode = FILE_CASE_MISMATCH + ErrorInfo = self.File + '\n\t' + RealFile + " [in file system]" + + self.SubDir, self.Name = os.path.split(RealFile) + self.BaseName, self.Ext = os.path.splitext(self.Name) + if self.SubDir: + self.Dir = os.path.join(RealRoot, self.SubDir) + else: + self.Dir = RealRoot + self.File = RealFile + self.Root = RealRoot + self.Path = os.path.join(RealRoot, RealFile) + return ErrorCode, ErrorInfo + + Key = property(_GetFileKey) + TimeStamp = property(_GetTimeStamp) + +## Parse PE image to get the required PE informaion. +# +class PeImageClass(): + ## Constructor + # + # @param File FilePath of PeImage + # + def __init__(self, PeFile): + self.FileName = PeFile + self.IsValid = False + self.Size = 0 + self.EntryPoint = 0 + self.SectionAlignment = 0 + self.SectionHeaderList = [] + self.ErrorInfo = '' + try: + PeObject = open(PeFile, 'rb') + except: + self.ErrorInfo = self.FileName + ' can not be found\n' + return + # Read DOS header + ByteArray = array.array('B') + ByteArray.fromfile(PeObject, 0x3E) + ByteList = ByteArray.tolist() + # DOS signature should be 'MZ' + if self._ByteListToStr (ByteList[0x0:0x2]) != 'MZ': + self.ErrorInfo = self.FileName + ' has no valid DOS signature MZ' + return + + # Read 4 byte PE Signature + PeOffset = self._ByteListToInt(ByteList[0x3C:0x3E]) + PeObject.seek(PeOffset) + ByteArray = array.array('B') + ByteArray.fromfile(PeObject, 4) + # PE signature should be 'PE\0\0' + if ByteArray.tostring() != 'PE\0\0': + self.ErrorInfo = self.FileName + ' has no valid PE signature PE00' + return + + # Read PE file header + ByteArray = array.array('B') + ByteArray.fromfile(PeObject, 0x14) + ByteList = ByteArray.tolist() + SecNumber = self._ByteListToInt(ByteList[0x2:0x4]) + if SecNumber == 0: + self.ErrorInfo = self.FileName + ' has no section header' + return + + # Read PE optional header + OptionalHeaderSize = self._ByteListToInt(ByteArray[0x10:0x12]) + ByteArray = array.array('B') + ByteArray.fromfile(PeObject, OptionalHeaderSize) + ByteList = ByteArray.tolist() + self.EntryPoint = self._ByteListToInt(ByteList[0x10:0x14]) + self.SectionAlignment = self._ByteListToInt(ByteList[0x20:0x24]) + self.Size = self._ByteListToInt(ByteList[0x38:0x3C]) + + # Read each Section Header + for Index in range(SecNumber): + ByteArray = array.array('B') + ByteArray.fromfile(PeObject, 0x28) + ByteList = ByteArray.tolist() + SecName = self._ByteListToStr(ByteList[0:8]) + SecVirtualSize = self._ByteListToInt(ByteList[8:12]) + SecRawAddress = self._ByteListToInt(ByteList[20:24]) + SecVirtualAddress = self._ByteListToInt(ByteList[12:16]) + self.SectionHeaderList.append((SecName, SecVirtualAddress, SecRawAddress, SecVirtualSize)) + self.IsValid = True + PeObject.close() + + def _ByteListToStr(self, ByteList): + String = '' + for index in range(len(ByteList)): + if ByteList[index] == 0: + break + String += chr(ByteList[index]) + return String + + def _ByteListToInt(self, ByteList): + Value = 0 + for index in range(len(ByteList) - 1, -1, -1): + Value = (Value << 8) | int(ByteList[index]) + return Value + + +class SkuClass(): + + DEFAULT = 0 + SINGLE = 1 + MULTIPLE =2 + + def __init__(self,SkuIdentifier='', SkuIds={}): + + self.AvailableSkuIds = sdict() + self.SkuIdSet = [] + + if SkuIdentifier == '' or SkuIdentifier is None: + self.SkuIdSet = ['DEFAULT'] + elif SkuIdentifier == 'ALL': + self.SkuIdSet = SkuIds.keys() + else: + r = SkuIdentifier.split('|') + self.SkuIdSet=[r[k].strip() for k in range(len(r))] + if len(self.SkuIdSet) == 2 and 'DEFAULT' in self.SkuIdSet and SkuIdentifier != 'ALL': + self.SkuIdSet.remove('DEFAULT') + + for each in self.SkuIdSet: + if each in SkuIds: + self.AvailableSkuIds[each] = SkuIds[each] + else: + EdkLogger.error("build", PARAMETER_INVALID, + ExtraData="SKU-ID [%s] is not supported by the platform. [Valid SKU-ID: %s]" + % (each, " ".join(SkuIds.keys()))) + + def __SkuUsageType(self): + + if len(self.SkuIdSet) == 1: + if self.SkuIdSet[0] == 'DEFAULT': + return SkuClass.DEFAULT + else: + return SkuClass.SINGLE + else: + return SkuClass.MULTIPLE + + def __GetAvailableSkuIds(self): + return self.AvailableSkuIds + + def __GetSystemSkuID(self): + if self.__SkuUsageType() == SkuClass.SINGLE: + return self.SkuIdSet[0] + else: + return 'DEFAULT' + + SystemSkuId = property(__GetSystemSkuID) + AvailableSkuIdSet = property(__GetAvailableSkuIds) + SkuUsageType = property(__SkuUsageType) + +## +# +# This acts like the main() function for the script, unless it is 'import'ed into another +# script. +# +if __name__ == '__main__': + pass + diff --git a/BaseTools/Source/Python/Ecc/CLexer.py b/BaseTools/Source/Python/Ecc/CLexer.py index a72d4ee3c2..a496f43440 100644 --- a/BaseTools/Source/Python/Ecc/CLexer.py +++ b/BaseTools/Source/Python/Ecc/CLexer.py @@ -1,7 +1,7 @@ -# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53 - -from antlr3 import * -from antlr3.compat import set, frozenset +# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53 + +from antlr3 import * +from antlr3.compat import set, frozenset ## @file # The file defines the Lexer for C source files. @@ -21,4927 +21,4927 @@ from antlr3.compat import set, frozenset # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # ## - - - -# for convenience in actions -HIDDEN = BaseRecognizer.HIDDEN - -# token types -T114=114 -T115=115 -T116=116 -T117=117 -FloatTypeSuffix=16 -LETTER=11 -T29=29 -T28=28 -T27=27 -T26=26 -T25=25 -EOF=-1 -STRING_LITERAL=9 -FLOATING_POINT_LITERAL=10 -T38=38 -T37=37 -T39=39 -T34=34 -COMMENT=22 -T33=33 -T36=36 -T35=35 -T30=30 -T32=32 -T31=31 -LINE_COMMENT=23 -IntegerTypeSuffix=14 -CHARACTER_LITERAL=8 -T49=49 -T48=48 -T100=100 -T43=43 -T42=42 -T102=102 -T41=41 -T101=101 -T40=40 -T47=47 -T46=46 -T45=45 -T44=44 -T109=109 -T107=107 -T108=108 -T105=105 -WS=19 -T106=106 -T103=103 -T104=104 -T50=50 -LINE_COMMAND=24 -T59=59 -T113=113 -T52=52 -T112=112 -T51=51 -T111=111 -T54=54 -T110=110 -EscapeSequence=12 -DECIMAL_LITERAL=7 -T53=53 -T56=56 -T55=55 -T58=58 -T57=57 -T75=75 -T76=76 -T73=73 -T74=74 -T79=79 -T77=77 -T78=78 -Exponent=15 -HexDigit=13 -T72=72 -T71=71 -T70=70 -T62=62 -T63=63 -T64=64 -T65=65 -T66=66 -T67=67 -T68=68 -T69=69 -IDENTIFIER=4 -UnicodeVocabulary=21 -HEX_LITERAL=5 -T61=61 -T60=60 -T99=99 -T97=97 -BS=20 -T98=98 -T95=95 -T96=96 -OCTAL_LITERAL=6 -T94=94 -Tokens=118 -T93=93 -T92=92 -T91=91 -T90=90 -T88=88 -T89=89 -T84=84 -T85=85 -T86=86 -T87=87 -UnicodeEscape=18 -T81=81 -T80=80 -T83=83 -OctalEscape=17 -T82=82 - -class CLexer(Lexer): - - grammarFileName = "C.g" - - def __init__(self, input=None): - Lexer.__init__(self, input) - self.dfa25 = self.DFA25( - self, 25, - eot = self.DFA25_eot, - eof = self.DFA25_eof, - min = self.DFA25_min, - max = self.DFA25_max, - accept = self.DFA25_accept, - special = self.DFA25_special, - transition = self.DFA25_transition - ) - self.dfa35 = self.DFA35( - self, 35, - eot = self.DFA35_eot, - eof = self.DFA35_eof, - min = self.DFA35_min, - max = self.DFA35_max, - accept = self.DFA35_accept, - special = self.DFA35_special, - transition = self.DFA35_transition - ) - - - - - - - # $ANTLR start T25 - def mT25(self, ): - - try: - self.type = T25 - - # C.g:27:5: ( ';' ) - # C.g:27:7: ';' - self.match(u';') - - - - - - finally: - - pass - - # $ANTLR end T25 - - - - # $ANTLR start T26 - def mT26(self, ): - - try: - self.type = T26 - - # C.g:28:5: ( 'typedef' ) - # C.g:28:7: 'typedef' - self.match("typedef") - - - - - - - finally: - - pass - - # $ANTLR end T26 - - - - # $ANTLR start T27 - def mT27(self, ): - - try: - self.type = T27 - - # C.g:29:5: ( ',' ) - # C.g:29:7: ',' - self.match(u',') - - - - - - finally: - - pass - - # $ANTLR end T27 - - - - # $ANTLR start T28 - def mT28(self, ): - - try: - self.type = T28 - - # C.g:30:5: ( '=' ) - # C.g:30:7: '=' - self.match(u'=') - - - - - - finally: - - pass - - # $ANTLR end T28 - - - - # $ANTLR start T29 - def mT29(self, ): - - try: - self.type = T29 - - # C.g:31:5: ( 'extern' ) - # C.g:31:7: 'extern' - self.match("extern") - - - - - - - finally: - - pass - - # $ANTLR end T29 - - - - # $ANTLR start T30 - def mT30(self, ): - - try: - self.type = T30 - - # C.g:32:5: ( 'static' ) - # C.g:32:7: 'static' - self.match("static") - - - - - - - finally: - - pass - - # $ANTLR end T30 - - - - # $ANTLR start T31 - def mT31(self, ): - - try: - self.type = T31 - - # C.g:33:5: ( 'auto' ) - # C.g:33:7: 'auto' - self.match("auto") - - - - - - - finally: - - pass - - # $ANTLR end T31 - - - - # $ANTLR start T32 - def mT32(self, ): - - try: - self.type = T32 - - # C.g:34:5: ( 'register' ) - # C.g:34:7: 'register' - self.match("register") - - - - - - - finally: - - pass - - # $ANTLR end T32 - - - - # $ANTLR start T33 - def mT33(self, ): - - try: - self.type = T33 - - # C.g:35:5: ( 'STATIC' ) - # C.g:35:7: 'STATIC' - self.match("STATIC") - - - - - - - finally: - - pass - - # $ANTLR end T33 - - - - # $ANTLR start T34 - def mT34(self, ): - - try: - self.type = T34 - - # C.g:36:5: ( 'void' ) - # C.g:36:7: 'void' - self.match("void") - - - - - - - finally: - - pass - - # $ANTLR end T34 - - - - # $ANTLR start T35 - def mT35(self, ): - - try: - self.type = T35 - - # C.g:37:5: ( 'char' ) - # C.g:37:7: 'char' - self.match("char") - - - - - - - finally: - - pass - - # $ANTLR end T35 - - - - # $ANTLR start T36 - def mT36(self, ): - - try: - self.type = T36 - - # C.g:38:5: ( 'short' ) - # C.g:38:7: 'short' - self.match("short") - - - - - - - finally: - - pass - - # $ANTLR end T36 - - - - # $ANTLR start T37 - def mT37(self, ): - - try: - self.type = T37 - - # C.g:39:5: ( 'int' ) - # C.g:39:7: 'int' - self.match("int") - - - - - - - finally: - - pass - - # $ANTLR end T37 - - - - # $ANTLR start T38 - def mT38(self, ): - - try: - self.type = T38 - - # C.g:40:5: ( 'long' ) - # C.g:40:7: 'long' - self.match("long") - - - - - - - finally: - - pass - - # $ANTLR end T38 - - - - # $ANTLR start T39 - def mT39(self, ): - - try: - self.type = T39 - - # C.g:41:5: ( 'float' ) - # C.g:41:7: 'float' - self.match("float") - - - - - - - finally: - - pass - - # $ANTLR end T39 - - - - # $ANTLR start T40 - def mT40(self, ): - - try: - self.type = T40 - - # C.g:42:5: ( 'double' ) - # C.g:42:7: 'double' - self.match("double") - - - - - - - finally: - - pass - - # $ANTLR end T40 - - - - # $ANTLR start T41 - def mT41(self, ): - - try: - self.type = T41 - - # C.g:43:5: ( 'signed' ) - # C.g:43:7: 'signed' - self.match("signed") - - - - - - - finally: - - pass - - # $ANTLR end T41 - - - - # $ANTLR start T42 - def mT42(self, ): - - try: - self.type = T42 - - # C.g:44:5: ( 'unsigned' ) - # C.g:44:7: 'unsigned' - self.match("unsigned") - - - - - - - finally: - - pass - - # $ANTLR end T42 - - - - # $ANTLR start T43 - def mT43(self, ): - - try: - self.type = T43 - - # C.g:45:5: ( '{' ) - # C.g:45:7: '{' - self.match(u'{') - - - - - - finally: - - pass - - # $ANTLR end T43 - - - - # $ANTLR start T44 - def mT44(self, ): - - try: - self.type = T44 - - # C.g:46:5: ( '}' ) - # C.g:46:7: '}' - self.match(u'}') - - - - - - finally: - - pass - - # $ANTLR end T44 - - - - # $ANTLR start T45 - def mT45(self, ): - - try: - self.type = T45 - - # C.g:47:5: ( 'struct' ) - # C.g:47:7: 'struct' - self.match("struct") - - - - - - - finally: - - pass - - # $ANTLR end T45 - - - - # $ANTLR start T46 - def mT46(self, ): - - try: - self.type = T46 - - # C.g:48:5: ( 'union' ) - # C.g:48:7: 'union' - self.match("union") - - - - - - - finally: - - pass - - # $ANTLR end T46 - - - - # $ANTLR start T47 - def mT47(self, ): - - try: - self.type = T47 - - # C.g:49:5: ( ':' ) - # C.g:49:7: ':' - self.match(u':') - - - - - - finally: - - pass - - # $ANTLR end T47 - - - - # $ANTLR start T48 - def mT48(self, ): - - try: - self.type = T48 - - # C.g:50:5: ( 'enum' ) - # C.g:50:7: 'enum' - self.match("enum") - - - - - - - finally: - - pass - - # $ANTLR end T48 - - - - # $ANTLR start T49 - def mT49(self, ): - - try: - self.type = T49 - - # C.g:51:5: ( 'const' ) - # C.g:51:7: 'const' - self.match("const") - - - - - - - finally: - - pass - - # $ANTLR end T49 - - - - # $ANTLR start T50 - def mT50(self, ): - - try: - self.type = T50 - - # C.g:52:5: ( 'volatile' ) - # C.g:52:7: 'volatile' - self.match("volatile") - - - - - - - finally: - - pass - - # $ANTLR end T50 - - - - # $ANTLR start T51 - def mT51(self, ): - - try: - self.type = T51 - - # C.g:53:5: ( 'IN' ) - # C.g:53:7: 'IN' - self.match("IN") - - - - - - - finally: - - pass - - # $ANTLR end T51 - - - - # $ANTLR start T52 - def mT52(self, ): - - try: - self.type = T52 - - # C.g:54:5: ( 'OUT' ) - # C.g:54:7: 'OUT' - self.match("OUT") - - - - - - - finally: - - pass - - # $ANTLR end T52 - - - - # $ANTLR start T53 - def mT53(self, ): - - try: - self.type = T53 - - # C.g:55:5: ( 'OPTIONAL' ) - # C.g:55:7: 'OPTIONAL' - self.match("OPTIONAL") - - - - - - - finally: - - pass - - # $ANTLR end T53 - - - - # $ANTLR start T54 - def mT54(self, ): - - try: - self.type = T54 - - # C.g:56:5: ( 'CONST' ) - # C.g:56:7: 'CONST' - self.match("CONST") - - - - - - - finally: - - pass - - # $ANTLR end T54 - - - - # $ANTLR start T55 - def mT55(self, ): - - try: - self.type = T55 - - # C.g:57:5: ( 'UNALIGNED' ) - # C.g:57:7: 'UNALIGNED' - self.match("UNALIGNED") - - - - - - - finally: - - pass - - # $ANTLR end T55 - - - - # $ANTLR start T56 - def mT56(self, ): - - try: - self.type = T56 - - # C.g:58:5: ( 'VOLATILE' ) - # C.g:58:7: 'VOLATILE' - self.match("VOLATILE") - - - - - - - finally: - - pass - - # $ANTLR end T56 - - - - # $ANTLR start T57 - def mT57(self, ): - - try: - self.type = T57 - - # C.g:59:5: ( 'GLOBAL_REMOVE_IF_UNREFERENCED' ) - # C.g:59:7: 'GLOBAL_REMOVE_IF_UNREFERENCED' - self.match("GLOBAL_REMOVE_IF_UNREFERENCED") - - - - - - - finally: - - pass - - # $ANTLR end T57 - - - - # $ANTLR start T58 - def mT58(self, ): - - try: - self.type = T58 - - # C.g:60:5: ( 'EFIAPI' ) - # C.g:60:7: 'EFIAPI' - self.match("EFIAPI") - - - - - - - finally: - - pass - - # $ANTLR end T58 - - - - # $ANTLR start T59 - def mT59(self, ): - - try: - self.type = T59 - - # C.g:61:5: ( 'EFI_BOOTSERVICE' ) - # C.g:61:7: 'EFI_BOOTSERVICE' - self.match("EFI_BOOTSERVICE") - - - - - - - finally: - - pass - - # $ANTLR end T59 - - - - # $ANTLR start T60 - def mT60(self, ): - - try: - self.type = T60 - - # C.g:62:5: ( 'EFI_RUNTIMESERVICE' ) - # C.g:62:7: 'EFI_RUNTIMESERVICE' - self.match("EFI_RUNTIMESERVICE") - - - - - - - finally: - - pass - - # $ANTLR end T60 - - - - # $ANTLR start T61 - def mT61(self, ): - - try: - self.type = T61 - - # C.g:63:5: ( 'PACKED' ) - # C.g:63:7: 'PACKED' - self.match("PACKED") - - - - - - - finally: - - pass - - # $ANTLR end T61 - - - - # $ANTLR start T62 - def mT62(self, ): - - try: - self.type = T62 - - # C.g:64:5: ( '(' ) - # C.g:64:7: '(' - self.match(u'(') - - - - - - finally: - - pass - - # $ANTLR end T62 - - - - # $ANTLR start T63 - def mT63(self, ): - - try: - self.type = T63 - - # C.g:65:5: ( ')' ) - # C.g:65:7: ')' - self.match(u')') - - - - - - finally: - - pass - - # $ANTLR end T63 - - - - # $ANTLR start T64 - def mT64(self, ): - - try: - self.type = T64 - - # C.g:66:5: ( '[' ) - # C.g:66:7: '[' - self.match(u'[') - - - - - - finally: - - pass - - # $ANTLR end T64 - - - - # $ANTLR start T65 - def mT65(self, ): - - try: - self.type = T65 - - # C.g:67:5: ( ']' ) - # C.g:67:7: ']' - self.match(u']') - - - - - - finally: - - pass - - # $ANTLR end T65 - - - - # $ANTLR start T66 - def mT66(self, ): - - try: - self.type = T66 - - # C.g:68:5: ( '*' ) - # C.g:68:7: '*' - self.match(u'*') - - - - - - finally: - - pass - - # $ANTLR end T66 - - - - # $ANTLR start T67 - def mT67(self, ): - - try: - self.type = T67 - - # C.g:69:5: ( '...' ) - # C.g:69:7: '...' - self.match("...") - - - - - - - finally: - - pass - - # $ANTLR end T67 - - - - # $ANTLR start T68 - def mT68(self, ): - - try: - self.type = T68 - - # C.g:70:5: ( '+' ) - # C.g:70:7: '+' - self.match(u'+') - - - - - - finally: - - pass - - # $ANTLR end T68 - - - - # $ANTLR start T69 - def mT69(self, ): - - try: - self.type = T69 - - # C.g:71:5: ( '-' ) - # C.g:71:7: '-' - self.match(u'-') - - - - - - finally: - - pass - - # $ANTLR end T69 - - - - # $ANTLR start T70 - def mT70(self, ): - - try: - self.type = T70 - - # C.g:72:5: ( '/' ) - # C.g:72:7: '/' - self.match(u'/') - - - - - - finally: - - pass - - # $ANTLR end T70 - - - - # $ANTLR start T71 - def mT71(self, ): - - try: - self.type = T71 - - # C.g:73:5: ( '%' ) - # C.g:73:7: '%' - self.match(u'%') - - - - - - finally: - - pass - - # $ANTLR end T71 - - - - # $ANTLR start T72 - def mT72(self, ): - - try: - self.type = T72 - - # C.g:74:5: ( '++' ) - # C.g:74:7: '++' - self.match("++") - - - - - - - finally: - - pass - - # $ANTLR end T72 - - - - # $ANTLR start T73 - def mT73(self, ): - - try: - self.type = T73 - - # C.g:75:5: ( '--' ) - # C.g:75:7: '--' - self.match("--") - - - - - - - finally: - - pass - - # $ANTLR end T73 - - - - # $ANTLR start T74 - def mT74(self, ): - - try: - self.type = T74 - - # C.g:76:5: ( 'sizeof' ) - # C.g:76:7: 'sizeof' - self.match("sizeof") - - - - - - - finally: - - pass - - # $ANTLR end T74 - - - - # $ANTLR start T75 - def mT75(self, ): - - try: - self.type = T75 - - # C.g:77:5: ( '.' ) - # C.g:77:7: '.' - self.match(u'.') - - - - - - finally: - - pass - - # $ANTLR end T75 - - - - # $ANTLR start T76 - def mT76(self, ): - - try: - self.type = T76 - - # C.g:78:5: ( '->' ) - # C.g:78:7: '->' - self.match("->") - - - - - - - finally: - - pass - - # $ANTLR end T76 - - - - # $ANTLR start T77 - def mT77(self, ): - - try: - self.type = T77 - - # C.g:79:5: ( '&' ) - # C.g:79:7: '&' - self.match(u'&') - - - - - - finally: - - pass - - # $ANTLR end T77 - - - - # $ANTLR start T78 - def mT78(self, ): - - try: - self.type = T78 - - # C.g:80:5: ( '~' ) - # C.g:80:7: '~' - self.match(u'~') - - - - - - finally: - - pass - - # $ANTLR end T78 - - - - # $ANTLR start T79 - def mT79(self, ): - - try: - self.type = T79 - - # C.g:81:5: ( '!' ) - # C.g:81:7: '!' - self.match(u'!') - - - - - - finally: - - pass - - # $ANTLR end T79 - - - - # $ANTLR start T80 - def mT80(self, ): - - try: - self.type = T80 - - # C.g:82:5: ( '*=' ) - # C.g:82:7: '*=' - self.match("*=") - - - - - - - finally: - - pass - - # $ANTLR end T80 - - - - # $ANTLR start T81 - def mT81(self, ): - - try: - self.type = T81 - - # C.g:83:5: ( '/=' ) - # C.g:83:7: '/=' - self.match("/=") - - - - - - - finally: - - pass - - # $ANTLR end T81 - - - - # $ANTLR start T82 - def mT82(self, ): - - try: - self.type = T82 - - # C.g:84:5: ( '%=' ) - # C.g:84:7: '%=' - self.match("%=") - - - - - - - finally: - - pass - - # $ANTLR end T82 - - - - # $ANTLR start T83 - def mT83(self, ): - - try: - self.type = T83 - - # C.g:85:5: ( '+=' ) - # C.g:85:7: '+=' - self.match("+=") - - - - - - - finally: - - pass - - # $ANTLR end T83 - - - - # $ANTLR start T84 - def mT84(self, ): - - try: - self.type = T84 - - # C.g:86:5: ( '-=' ) - # C.g:86:7: '-=' - self.match("-=") - - - - - - - finally: - - pass - - # $ANTLR end T84 - - - - # $ANTLR start T85 - def mT85(self, ): - - try: - self.type = T85 - - # C.g:87:5: ( '<<=' ) - # C.g:87:7: '<<=' - self.match("<<=") - - - - - - - finally: - - pass - - # $ANTLR end T85 - - - - # $ANTLR start T86 - def mT86(self, ): - - try: - self.type = T86 - - # C.g:88:5: ( '>>=' ) - # C.g:88:7: '>>=' - self.match(">>=") - - - - - - - finally: - - pass - - # $ANTLR end T86 - - - - # $ANTLR start T87 - def mT87(self, ): - - try: - self.type = T87 - - # C.g:89:5: ( '&=' ) - # C.g:89:7: '&=' - self.match("&=") - - - - - - - finally: - - pass - - # $ANTLR end T87 - - - - # $ANTLR start T88 - def mT88(self, ): - - try: - self.type = T88 - - # C.g:90:5: ( '^=' ) - # C.g:90:7: '^=' - self.match("^=") - - - - - - - finally: - - pass - - # $ANTLR end T88 - - - - # $ANTLR start T89 - def mT89(self, ): - - try: - self.type = T89 - - # C.g:91:5: ( '|=' ) - # C.g:91:7: '|=' - self.match("|=") - - - - - - - finally: - - pass - - # $ANTLR end T89 - - - - # $ANTLR start T90 - def mT90(self, ): - - try: - self.type = T90 - - # C.g:92:5: ( '?' ) - # C.g:92:7: '?' - self.match(u'?') - - - - - - finally: - - pass - - # $ANTLR end T90 - - - - # $ANTLR start T91 - def mT91(self, ): - - try: - self.type = T91 - - # C.g:93:5: ( '||' ) - # C.g:93:7: '||' - self.match("||") - - - - - - - finally: - - pass - - # $ANTLR end T91 - - - - # $ANTLR start T92 - def mT92(self, ): - - try: - self.type = T92 - - # C.g:94:5: ( '&&' ) - # C.g:94:7: '&&' - self.match("&&") - - - - - - - finally: - - pass - - # $ANTLR end T92 - - - - # $ANTLR start T93 - def mT93(self, ): - - try: - self.type = T93 - - # C.g:95:5: ( '|' ) - # C.g:95:7: '|' - self.match(u'|') - - - - - - finally: - - pass - - # $ANTLR end T93 - - - - # $ANTLR start T94 - def mT94(self, ): - - try: - self.type = T94 - - # C.g:96:5: ( '^' ) - # C.g:96:7: '^' - self.match(u'^') - - - - - - finally: - - pass - - # $ANTLR end T94 - - - - # $ANTLR start T95 - def mT95(self, ): - - try: - self.type = T95 - - # C.g:97:5: ( '==' ) - # C.g:97:7: '==' - self.match("==") - - - - - - - finally: - - pass - - # $ANTLR end T95 - - - - # $ANTLR start T96 - def mT96(self, ): - - try: - self.type = T96 - - # C.g:98:5: ( '!=' ) - # C.g:98:7: '!=' - self.match("!=") - - - - - - - finally: - - pass - - # $ANTLR end T96 - - - - # $ANTLR start T97 - def mT97(self, ): - - try: - self.type = T97 - - # C.g:99:5: ( '<' ) - # C.g:99:7: '<' - self.match(u'<') - - - - - - finally: - - pass - - # $ANTLR end T97 - - - - # $ANTLR start T98 - def mT98(self, ): - - try: - self.type = T98 - - # C.g:100:5: ( '>' ) - # C.g:100:7: '>' - self.match(u'>') - - - - - - finally: - - pass - - # $ANTLR end T98 - - - - # $ANTLR start T99 - def mT99(self, ): - - try: - self.type = T99 - - # C.g:101:5: ( '<=' ) - # C.g:101:7: '<=' - self.match("<=") - - - - - - - finally: - - pass - - # $ANTLR end T99 - - - - # $ANTLR start T100 - def mT100(self, ): - - try: - self.type = T100 - - # C.g:102:6: ( '>=' ) - # C.g:102:8: '>=' - self.match(">=") - - - - - - - finally: - - pass - - # $ANTLR end T100 - - - - # $ANTLR start T101 - def mT101(self, ): - - try: - self.type = T101 - - # C.g:103:6: ( '<<' ) - # C.g:103:8: '<<' - self.match("<<") - - - - - - - finally: - - pass - - # $ANTLR end T101 - - - - # $ANTLR start T102 - def mT102(self, ): - - try: - self.type = T102 - - # C.g:104:6: ( '>>' ) - # C.g:104:8: '>>' - self.match(">>") - - - - - - - finally: - - pass - - # $ANTLR end T102 - - - - # $ANTLR start T103 - def mT103(self, ): - - try: - self.type = T103 - - # C.g:105:6: ( '__asm__' ) - # C.g:105:8: '__asm__' - self.match("__asm__") - - - - - - - finally: - - pass - - # $ANTLR end T103 - - - - # $ANTLR start T104 - def mT104(self, ): - - try: - self.type = T104 - - # C.g:106:6: ( '_asm' ) - # C.g:106:8: '_asm' - self.match("_asm") - - - - - - - finally: - - pass - - # $ANTLR end T104 - - - - # $ANTLR start T105 - def mT105(self, ): - - try: - self.type = T105 - - # C.g:107:6: ( '__asm' ) - # C.g:107:8: '__asm' - self.match("__asm") - - - - - - - finally: - - pass - - # $ANTLR end T105 - - - - # $ANTLR start T106 - def mT106(self, ): - - try: - self.type = T106 - - # C.g:108:6: ( 'case' ) - # C.g:108:8: 'case' - self.match("case") - - - - - - - finally: - - pass - - # $ANTLR end T106 - - - - # $ANTLR start T107 - def mT107(self, ): - - try: - self.type = T107 - - # C.g:109:6: ( 'default' ) - # C.g:109:8: 'default' - self.match("default") - - - - - - - finally: - - pass - - # $ANTLR end T107 - - - - # $ANTLR start T108 - def mT108(self, ): - - try: - self.type = T108 - - # C.g:110:6: ( 'if' ) - # C.g:110:8: 'if' - self.match("if") - - - - - - - finally: - - pass - - # $ANTLR end T108 - - - - # $ANTLR start T109 - def mT109(self, ): - - try: - self.type = T109 - - # C.g:111:6: ( 'else' ) - # C.g:111:8: 'else' - self.match("else") - - - - - - - finally: - - pass - - # $ANTLR end T109 - - - - # $ANTLR start T110 - def mT110(self, ): - - try: - self.type = T110 - - # C.g:112:6: ( 'switch' ) - # C.g:112:8: 'switch' - self.match("switch") - - - - - - - finally: - - pass - - # $ANTLR end T110 - - - - # $ANTLR start T111 - def mT111(self, ): - - try: - self.type = T111 - - # C.g:113:6: ( 'while' ) - # C.g:113:8: 'while' - self.match("while") - - - - - - - finally: - - pass - - # $ANTLR end T111 - - - - # $ANTLR start T112 - def mT112(self, ): - - try: - self.type = T112 - - # C.g:114:6: ( 'do' ) - # C.g:114:8: 'do' - self.match("do") - - - - - - - finally: - - pass - - # $ANTLR end T112 - - - - # $ANTLR start T113 - def mT113(self, ): - - try: - self.type = T113 - - # C.g:115:6: ( 'for' ) - # C.g:115:8: 'for' - self.match("for") - - - - - - - finally: - - pass - - # $ANTLR end T113 - - - - # $ANTLR start T114 - def mT114(self, ): - - try: - self.type = T114 - - # C.g:116:6: ( 'goto' ) - # C.g:116:8: 'goto' - self.match("goto") - - - - - - - finally: - - pass - - # $ANTLR end T114 - - - - # $ANTLR start T115 - def mT115(self, ): - - try: - self.type = T115 - - # C.g:117:6: ( 'continue' ) - # C.g:117:8: 'continue' - self.match("continue") - - - - - - - finally: - - pass - - # $ANTLR end T115 - - - - # $ANTLR start T116 - def mT116(self, ): - - try: - self.type = T116 - - # C.g:118:6: ( 'break' ) - # C.g:118:8: 'break' - self.match("break") - - - - - - - finally: - - pass - - # $ANTLR end T116 - - - - # $ANTLR start T117 - def mT117(self, ): - - try: - self.type = T117 - - # C.g:119:6: ( 'return' ) - # C.g:119:8: 'return' - self.match("return") - - - - - - - finally: - - pass - - # $ANTLR end T117 - - - - # $ANTLR start IDENTIFIER - def mIDENTIFIER(self, ): - - try: - self.type = IDENTIFIER - - # C.g:586:2: ( LETTER ( LETTER | '0' .. '9' )* ) - # C.g:586:4: LETTER ( LETTER | '0' .. '9' )* - self.mLETTER() - - # C.g:586:11: ( LETTER | '0' .. '9' )* - while True: #loop1 - alt1 = 2 - LA1_0 = self.input.LA(1) - - if (LA1_0 == u'$' or (u'0' <= LA1_0 <= u'9') or (u'A' <= LA1_0 <= u'Z') or LA1_0 == u'_' or (u'a' <= LA1_0 <= u'z')) : - alt1 = 1 - - - if alt1 == 1: - # C.g: - if self.input.LA(1) == u'$' or (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - else: - break #loop1 - - - - - - - finally: - - pass - - # $ANTLR end IDENTIFIER - - - - # $ANTLR start LETTER - def mLETTER(self, ): - - try: - # C.g:591:2: ( '$' | 'A' .. 'Z' | 'a' .. 'z' | '_' ) - # C.g: - if self.input.LA(1) == u'$' or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - - finally: - - pass - - # $ANTLR end LETTER - - - - # $ANTLR start CHARACTER_LITERAL - def mCHARACTER_LITERAL(self, ): - - try: - self.type = CHARACTER_LITERAL - - # C.g:598:5: ( ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' ) - # C.g:598:9: ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' - # C.g:598:9: ( 'L' )? - alt2 = 2 - LA2_0 = self.input.LA(1) - - if (LA2_0 == u'L') : - alt2 = 1 - if alt2 == 1: - # C.g:598:10: 'L' - self.match(u'L') - - - - - self.match(u'\'') - - # C.g:598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) - alt3 = 2 - LA3_0 = self.input.LA(1) - - if (LA3_0 == u'\\') : - alt3 = 1 - elif ((u'\u0000' <= LA3_0 <= u'&') or (u'(' <= LA3_0 <= u'[') or (u']' <= LA3_0 <= u'\uFFFE')) : - alt3 = 2 - else: - nvae = NoViableAltException("598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) )", 3, 0, self.input) - - raise nvae - - if alt3 == 1: - # C.g:598:23: EscapeSequence - self.mEscapeSequence() - - - - elif alt3 == 2: - # C.g:598:40: ~ ( '\\'' | '\\\\' ) - if (u'\u0000' <= self.input.LA(1) <= u'&') or (u'(' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - self.match(u'\'') - - - - - - finally: - - pass - - # $ANTLR end CHARACTER_LITERAL - - - - # $ANTLR start STRING_LITERAL - def mSTRING_LITERAL(self, ): - - try: - self.type = STRING_LITERAL - - # C.g:602:5: ( ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) - # C.g:602:8: ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' - # C.g:602:8: ( 'L' )? - alt4 = 2 - LA4_0 = self.input.LA(1) - - if (LA4_0 == u'L') : - alt4 = 1 - if alt4 == 1: - # C.g:602:9: 'L' - self.match(u'L') - - - - - self.match(u'"') - - # C.g:602:19: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* - while True: #loop5 - alt5 = 3 - LA5_0 = self.input.LA(1) - - if (LA5_0 == u'\\') : - alt5 = 1 - elif ((u'\u0000' <= LA5_0 <= u'!') or (u'#' <= LA5_0 <= u'[') or (u']' <= LA5_0 <= u'\uFFFE')) : - alt5 = 2 - - - if alt5 == 1: - # C.g:602:21: EscapeSequence - self.mEscapeSequence() - - - - elif alt5 == 2: - # C.g:602:38: ~ ( '\\\\' | '\"' ) - if (u'\u0000' <= self.input.LA(1) <= u'!') or (u'#' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - else: - break #loop5 - - - self.match(u'"') - - - - - - finally: - - pass - - # $ANTLR end STRING_LITERAL - - - - # $ANTLR start HEX_LITERAL - def mHEX_LITERAL(self, ): - - try: - self.type = HEX_LITERAL - - # C.g:605:13: ( '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? ) - # C.g:605:15: '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? - self.match(u'0') - - if self.input.LA(1) == u'X' or self.input.LA(1) == u'x': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - # C.g:605:29: ( HexDigit )+ - cnt6 = 0 - while True: #loop6 - alt6 = 2 - LA6_0 = self.input.LA(1) - - if ((u'0' <= LA6_0 <= u'9') or (u'A' <= LA6_0 <= u'F') or (u'a' <= LA6_0 <= u'f')) : - alt6 = 1 - - - if alt6 == 1: - # C.g:605:29: HexDigit - self.mHexDigit() - - - - else: - if cnt6 >= 1: - break #loop6 - - eee = EarlyExitException(6, self.input) - raise eee - - cnt6 += 1 - - - # C.g:605:39: ( IntegerTypeSuffix )? - alt7 = 2 - LA7_0 = self.input.LA(1) - - if (LA7_0 == u'L' or LA7_0 == u'U' or LA7_0 == u'l' or LA7_0 == u'u') : - alt7 = 1 - if alt7 == 1: - # C.g:605:39: IntegerTypeSuffix - self.mIntegerTypeSuffix() - - - - - - - - - finally: - - pass - - # $ANTLR end HEX_LITERAL - - - - # $ANTLR start DECIMAL_LITERAL - def mDECIMAL_LITERAL(self, ): - - try: - self.type = DECIMAL_LITERAL - - # C.g:607:17: ( ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? ) - # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? - # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* ) - alt9 = 2 - LA9_0 = self.input.LA(1) - - if (LA9_0 == u'0') : - alt9 = 1 - elif ((u'1' <= LA9_0 <= u'9')) : - alt9 = 2 - else: - nvae = NoViableAltException("607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* )", 9, 0, self.input) - - raise nvae - - if alt9 == 1: - # C.g:607:20: '0' - self.match(u'0') - - - - elif alt9 == 2: - # C.g:607:26: '1' .. '9' ( '0' .. '9' )* - self.matchRange(u'1', u'9') - - # C.g:607:35: ( '0' .. '9' )* - while True: #loop8 - alt8 = 2 - LA8_0 = self.input.LA(1) - - if ((u'0' <= LA8_0 <= u'9')) : - alt8 = 1 - - - if alt8 == 1: - # C.g:607:35: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - break #loop8 - - - - - - # C.g:607:46: ( IntegerTypeSuffix )? - alt10 = 2 - LA10_0 = self.input.LA(1) - - if (LA10_0 == u'L' or LA10_0 == u'U' or LA10_0 == u'l' or LA10_0 == u'u') : - alt10 = 1 - if alt10 == 1: - # C.g:607:46: IntegerTypeSuffix - self.mIntegerTypeSuffix() - - - - - - - - - finally: - - pass - - # $ANTLR end DECIMAL_LITERAL - - - - # $ANTLR start OCTAL_LITERAL - def mOCTAL_LITERAL(self, ): - - try: - self.type = OCTAL_LITERAL - - # C.g:609:15: ( '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? ) - # C.g:609:17: '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? - self.match(u'0') - - # C.g:609:21: ( '0' .. '7' )+ - cnt11 = 0 - while True: #loop11 - alt11 = 2 - LA11_0 = self.input.LA(1) - - if ((u'0' <= LA11_0 <= u'7')) : - alt11 = 1 - - - if alt11 == 1: - # C.g:609:22: '0' .. '7' - self.matchRange(u'0', u'7') - - - - else: - if cnt11 >= 1: - break #loop11 - - eee = EarlyExitException(11, self.input) - raise eee - - cnt11 += 1 - - - # C.g:609:33: ( IntegerTypeSuffix )? - alt12 = 2 - LA12_0 = self.input.LA(1) - - if (LA12_0 == u'L' or LA12_0 == u'U' or LA12_0 == u'l' or LA12_0 == u'u') : - alt12 = 1 - if alt12 == 1: - # C.g:609:33: IntegerTypeSuffix - self.mIntegerTypeSuffix() - - - - - - - - - finally: - - pass - - # $ANTLR end OCTAL_LITERAL - - - - # $ANTLR start HexDigit - def mHexDigit(self, ): - - try: - # C.g:612:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) ) - # C.g:612:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) - if (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'F') or (u'a' <= self.input.LA(1) <= u'f'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - - finally: - - pass - - # $ANTLR end HexDigit - - - - # $ANTLR start IntegerTypeSuffix - def mIntegerTypeSuffix(self, ): - - try: - # C.g:616:2: ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) ) - alt13 = 4 - LA13_0 = self.input.LA(1) - - if (LA13_0 == u'U' or LA13_0 == u'u') : - LA13_1 = self.input.LA(2) - - if (LA13_1 == u'L' or LA13_1 == u'l') : - LA13_3 = self.input.LA(3) - - if (LA13_3 == u'L' or LA13_3 == u'l') : - alt13 = 4 - else: - alt13 = 3 - else: - alt13 = 1 - elif (LA13_0 == u'L' or LA13_0 == u'l') : - alt13 = 2 - else: - nvae = NoViableAltException("614:1: fragment IntegerTypeSuffix : ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) );", 13, 0, self.input) - - raise nvae - - if alt13 == 1: - # C.g:616:4: ( 'u' | 'U' ) - if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - elif alt13 == 2: - # C.g:617:4: ( 'l' | 'L' ) - if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - elif alt13 == 3: - # C.g:618:4: ( 'u' | 'U' ) ( 'l' | 'L' ) - if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - elif alt13 == 4: - # C.g:619:4: ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) - if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - finally: - - pass - - # $ANTLR end IntegerTypeSuffix - - - - # $ANTLR start FLOATING_POINT_LITERAL - def mFLOATING_POINT_LITERAL(self, ): - - try: - self.type = FLOATING_POINT_LITERAL - - # C.g:623:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? | '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix ) - alt25 = 4 - alt25 = self.dfa25.predict(self.input) - if alt25 == 1: - # C.g:623:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? - # C.g:623:9: ( '0' .. '9' )+ - cnt14 = 0 - while True: #loop14 - alt14 = 2 - LA14_0 = self.input.LA(1) - - if ((u'0' <= LA14_0 <= u'9')) : - alt14 = 1 - - - if alt14 == 1: - # C.g:623:10: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - if cnt14 >= 1: - break #loop14 - - eee = EarlyExitException(14, self.input) - raise eee - - cnt14 += 1 - - - self.match(u'.') - - # C.g:623:25: ( '0' .. '9' )* - while True: #loop15 - alt15 = 2 - LA15_0 = self.input.LA(1) - - if ((u'0' <= LA15_0 <= u'9')) : - alt15 = 1 - - - if alt15 == 1: - # C.g:623:26: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - break #loop15 - - - # C.g:623:37: ( Exponent )? - alt16 = 2 - LA16_0 = self.input.LA(1) - - if (LA16_0 == u'E' or LA16_0 == u'e') : - alt16 = 1 - if alt16 == 1: - # C.g:623:37: Exponent - self.mExponent() - - - - - # C.g:623:47: ( FloatTypeSuffix )? - alt17 = 2 - LA17_0 = self.input.LA(1) - - if (LA17_0 == u'D' or LA17_0 == u'F' or LA17_0 == u'd' or LA17_0 == u'f') : - alt17 = 1 - if alt17 == 1: - # C.g:623:47: FloatTypeSuffix - self.mFloatTypeSuffix() - - - - - - - elif alt25 == 2: - # C.g:624:9: '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? - self.match(u'.') - - # C.g:624:13: ( '0' .. '9' )+ - cnt18 = 0 - while True: #loop18 - alt18 = 2 - LA18_0 = self.input.LA(1) - - if ((u'0' <= LA18_0 <= u'9')) : - alt18 = 1 - - - if alt18 == 1: - # C.g:624:14: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - if cnt18 >= 1: - break #loop18 - - eee = EarlyExitException(18, self.input) - raise eee - - cnt18 += 1 - - - # C.g:624:25: ( Exponent )? - alt19 = 2 - LA19_0 = self.input.LA(1) - - if (LA19_0 == u'E' or LA19_0 == u'e') : - alt19 = 1 - if alt19 == 1: - # C.g:624:25: Exponent - self.mExponent() - - - - - # C.g:624:35: ( FloatTypeSuffix )? - alt20 = 2 - LA20_0 = self.input.LA(1) - - if (LA20_0 == u'D' or LA20_0 == u'F' or LA20_0 == u'd' or LA20_0 == u'f') : - alt20 = 1 - if alt20 == 1: - # C.g:624:35: FloatTypeSuffix - self.mFloatTypeSuffix() - - - - - - - elif alt25 == 3: - # C.g:625:9: ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? - # C.g:625:9: ( '0' .. '9' )+ - cnt21 = 0 - while True: #loop21 - alt21 = 2 - LA21_0 = self.input.LA(1) - - if ((u'0' <= LA21_0 <= u'9')) : - alt21 = 1 - - - if alt21 == 1: - # C.g:625:10: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - if cnt21 >= 1: - break #loop21 - - eee = EarlyExitException(21, self.input) - raise eee - - cnt21 += 1 - - - self.mExponent() - - # C.g:625:30: ( FloatTypeSuffix )? - alt22 = 2 - LA22_0 = self.input.LA(1) - - if (LA22_0 == u'D' or LA22_0 == u'F' or LA22_0 == u'd' or LA22_0 == u'f') : - alt22 = 1 - if alt22 == 1: - # C.g:625:30: FloatTypeSuffix - self.mFloatTypeSuffix() - - - - - - - elif alt25 == 4: - # C.g:626:9: ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix - # C.g:626:9: ( '0' .. '9' )+ - cnt23 = 0 - while True: #loop23 - alt23 = 2 - LA23_0 = self.input.LA(1) - - if ((u'0' <= LA23_0 <= u'9')) : - alt23 = 1 - - - if alt23 == 1: - # C.g:626:10: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - if cnt23 >= 1: - break #loop23 - - eee = EarlyExitException(23, self.input) - raise eee - - cnt23 += 1 - - - # C.g:626:21: ( Exponent )? - alt24 = 2 - LA24_0 = self.input.LA(1) - - if (LA24_0 == u'E' or LA24_0 == u'e') : - alt24 = 1 - if alt24 == 1: - # C.g:626:21: Exponent - self.mExponent() - - - - - self.mFloatTypeSuffix() - - - - - finally: - - pass - - # $ANTLR end FLOATING_POINT_LITERAL - - - - # $ANTLR start Exponent - def mExponent(self, ): - - try: - # C.g:630:10: ( ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ ) - # C.g:630:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ - if self.input.LA(1) == u'E' or self.input.LA(1) == u'e': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - # C.g:630:22: ( '+' | '-' )? - alt26 = 2 - LA26_0 = self.input.LA(1) - - if (LA26_0 == u'+' or LA26_0 == u'-') : - alt26 = 1 - if alt26 == 1: - # C.g: - if self.input.LA(1) == u'+' or self.input.LA(1) == u'-': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - # C.g:630:33: ( '0' .. '9' )+ - cnt27 = 0 - while True: #loop27 - alt27 = 2 - LA27_0 = self.input.LA(1) - - if ((u'0' <= LA27_0 <= u'9')) : - alt27 = 1 - - - if alt27 == 1: - # C.g:630:34: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - if cnt27 >= 1: - break #loop27 - - eee = EarlyExitException(27, self.input) - raise eee - - cnt27 += 1 - - - - - - - finally: - - pass - - # $ANTLR end Exponent - - - - # $ANTLR start FloatTypeSuffix - def mFloatTypeSuffix(self, ): - - try: - # C.g:633:17: ( ( 'f' | 'F' | 'd' | 'D' ) ) - # C.g:633:19: ( 'f' | 'F' | 'd' | 'D' ) - if self.input.LA(1) == u'D' or self.input.LA(1) == u'F' or self.input.LA(1) == u'd' or self.input.LA(1) == u'f': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - - finally: - - pass - - # $ANTLR end FloatTypeSuffix - - - - # $ANTLR start EscapeSequence - def mEscapeSequence(self, ): - - try: - # C.g:637:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape ) - alt28 = 2 - LA28_0 = self.input.LA(1) - - if (LA28_0 == u'\\') : - LA28_1 = self.input.LA(2) - - if (LA28_1 == u'"' or LA28_1 == u'\'' or LA28_1 == u'\\' or LA28_1 == u'b' or LA28_1 == u'f' or LA28_1 == u'n' or LA28_1 == u'r' or LA28_1 == u't') : - alt28 = 1 - elif ((u'0' <= LA28_1 <= u'7')) : - alt28 = 2 - else: - nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 1, self.input) - - raise nvae - - else: - nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 0, self.input) - - raise nvae - - if alt28 == 1: - # C.g:637:8: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) - self.match(u'\\') - - if self.input.LA(1) == u'"' or self.input.LA(1) == u'\'' or self.input.LA(1) == u'\\' or self.input.LA(1) == u'b' or self.input.LA(1) == u'f' or self.input.LA(1) == u'n' or self.input.LA(1) == u'r' or self.input.LA(1) == u't': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - elif alt28 == 2: - # C.g:638:9: OctalEscape - self.mOctalEscape() - - - - - finally: - - pass - - # $ANTLR end EscapeSequence - - - - # $ANTLR start OctalEscape - def mOctalEscape(self, ): - - try: - # C.g:643:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ) - alt29 = 3 - LA29_0 = self.input.LA(1) - - if (LA29_0 == u'\\') : - LA29_1 = self.input.LA(2) - - if ((u'0' <= LA29_1 <= u'3')) : - LA29_2 = self.input.LA(3) - - if ((u'0' <= LA29_2 <= u'7')) : - LA29_4 = self.input.LA(4) - - if ((u'0' <= LA29_4 <= u'7')) : - alt29 = 1 - else: - alt29 = 2 - else: - alt29 = 3 - elif ((u'4' <= LA29_1 <= u'7')) : - LA29_3 = self.input.LA(3) - - if ((u'0' <= LA29_3 <= u'7')) : - alt29 = 2 - else: - alt29 = 3 - else: - nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 1, self.input) - - raise nvae - - else: - nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 0, self.input) - - raise nvae - - if alt29 == 1: - # C.g:643:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) - self.match(u'\\') - - # C.g:643:14: ( '0' .. '3' ) - # C.g:643:15: '0' .. '3' - self.matchRange(u'0', u'3') - - - - - # C.g:643:25: ( '0' .. '7' ) - # C.g:643:26: '0' .. '7' - self.matchRange(u'0', u'7') - - - - - # C.g:643:36: ( '0' .. '7' ) - # C.g:643:37: '0' .. '7' - self.matchRange(u'0', u'7') - - - - - - - elif alt29 == 2: - # C.g:644:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) - self.match(u'\\') - - # C.g:644:14: ( '0' .. '7' ) - # C.g:644:15: '0' .. '7' - self.matchRange(u'0', u'7') - - - - - # C.g:644:25: ( '0' .. '7' ) - # C.g:644:26: '0' .. '7' - self.matchRange(u'0', u'7') - - - - - - - elif alt29 == 3: - # C.g:645:9: '\\\\' ( '0' .. '7' ) - self.match(u'\\') - - # C.g:645:14: ( '0' .. '7' ) - # C.g:645:15: '0' .. '7' - self.matchRange(u'0', u'7') - - - - - - - - finally: - - pass - - # $ANTLR end OctalEscape - - - - # $ANTLR start UnicodeEscape - def mUnicodeEscape(self, ): - - try: - # C.g:650:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit ) - # C.g:650:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit - self.match(u'\\') - - self.match(u'u') - - self.mHexDigit() - - self.mHexDigit() - - self.mHexDigit() - - self.mHexDigit() - - - - - - finally: - - pass - - # $ANTLR end UnicodeEscape - - - - # $ANTLR start WS - def mWS(self, ): - - try: - self.type = WS - - # C.g:653:5: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) ) - # C.g:653:8: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) - if (u'\t' <= self.input.LA(1) <= u'\n') or (u'\f' <= self.input.LA(1) <= u'\r') or self.input.LA(1) == u' ': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - #action start - self.channel=HIDDEN; - #action end - - - - - finally: - - pass - - # $ANTLR end WS - - - - # $ANTLR start BS - def mBS(self, ): - - try: - self.type = BS - - # C.g:657:5: ( ( '\\\\' ) ) - # C.g:657:7: ( '\\\\' ) - # C.g:657:7: ( '\\\\' ) - # C.g:657:8: '\\\\' - self.match(u'\\') - - - - - #action start - self.channel=HIDDEN; - #action end - - - - - finally: - - pass - - # $ANTLR end BS - - - - # $ANTLR start UnicodeVocabulary - def mUnicodeVocabulary(self, ): - - try: - self.type = UnicodeVocabulary - - # C.g:665:5: ( '\\u0003' .. '\\uFFFE' ) - # C.g:665:7: '\\u0003' .. '\\uFFFE' - self.matchRange(u'\u0003', u'\uFFFE') - - - - - - finally: - - pass - - # $ANTLR end UnicodeVocabulary - - - - # $ANTLR start COMMENT - def mCOMMENT(self, ): - - try: - self.type = COMMENT - - # C.g:668:5: ( '/*' ( options {greedy=false; } : . )* '*/' ) - # C.g:668:9: '/*' ( options {greedy=false; } : . )* '*/' - self.match("/*") - - - # C.g:668:14: ( options {greedy=false; } : . )* - while True: #loop30 - alt30 = 2 - LA30_0 = self.input.LA(1) - - if (LA30_0 == u'*') : - LA30_1 = self.input.LA(2) - - if (LA30_1 == u'/') : - alt30 = 2 - elif ((u'\u0000' <= LA30_1 <= u'.') or (u'0' <= LA30_1 <= u'\uFFFE')) : - alt30 = 1 - - - elif ((u'\u0000' <= LA30_0 <= u')') or (u'+' <= LA30_0 <= u'\uFFFE')) : - alt30 = 1 - - - if alt30 == 1: - # C.g:668:42: . - self.matchAny() - - - - else: - break #loop30 - - - self.match("*/") - - - #action start - self.channel=HIDDEN; - #action end - - - - - finally: - - pass - - # $ANTLR end COMMENT - - - - # $ANTLR start LINE_COMMENT - def mLINE_COMMENT(self, ): - - try: - self.type = LINE_COMMENT - - # C.g:673:5: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) - # C.g:673:7: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' - self.match("//") - - - # C.g:673:12: (~ ( '\\n' | '\\r' ) )* - while True: #loop31 - alt31 = 2 - LA31_0 = self.input.LA(1) - - if ((u'\u0000' <= LA31_0 <= u'\t') or (u'\u000B' <= LA31_0 <= u'\f') or (u'\u000E' <= LA31_0 <= u'\uFFFE')) : - alt31 = 1 - - - if alt31 == 1: - # C.g:673:12: ~ ( '\\n' | '\\r' ) - if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - else: - break #loop31 - - - # C.g:673:26: ( '\\r' )? - alt32 = 2 - LA32_0 = self.input.LA(1) - - if (LA32_0 == u'\r') : - alt32 = 1 - if alt32 == 1: - # C.g:673:26: '\\r' - self.match(u'\r') - - - - - self.match(u'\n') - - #action start - self.channel=HIDDEN; - #action end - - - - - finally: - - pass - - # $ANTLR end LINE_COMMENT - - - - # $ANTLR start LINE_COMMAND - def mLINE_COMMAND(self, ): - - try: - self.type = LINE_COMMAND - - # C.g:678:5: ( '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) - # C.g:678:7: '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' - self.match(u'#') - - # C.g:678:11: (~ ( '\\n' | '\\r' ) )* - while True: #loop33 - alt33 = 2 - LA33_0 = self.input.LA(1) - - if ((u'\u0000' <= LA33_0 <= u'\t') or (u'\u000B' <= LA33_0 <= u'\f') or (u'\u000E' <= LA33_0 <= u'\uFFFE')) : - alt33 = 1 - - - if alt33 == 1: - # C.g:678:11: ~ ( '\\n' | '\\r' ) - if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - else: - break #loop33 - - - # C.g:678:25: ( '\\r' )? - alt34 = 2 - LA34_0 = self.input.LA(1) - - if (LA34_0 == u'\r') : - alt34 = 1 - if alt34 == 1: - # C.g:678:25: '\\r' - self.match(u'\r') - - - - - self.match(u'\n') - - #action start - self.channel=HIDDEN; - #action end - - - - - finally: - - pass - - # $ANTLR end LINE_COMMAND - - - - def mTokens(self): - # C.g:1:8: ( T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | T41 | T42 | T43 | T44 | T45 | T46 | T47 | T48 | T49 | T50 | T51 | T52 | T53 | T54 | T55 | T56 | T57 | T58 | T59 | T60 | T61 | T62 | T63 | T64 | T65 | T66 | T67 | T68 | T69 | T70 | T71 | T72 | T73 | T74 | T75 | T76 | T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | T87 | T88 | T89 | T90 | T91 | T92 | T93 | T94 | T95 | T96 | T97 | T98 | T99 | T100 | T101 | T102 | T103 | T104 | T105 | T106 | T107 | T108 | T109 | T110 | T111 | T112 | T113 | T114 | T115 | T116 | T117 | IDENTIFIER | CHARACTER_LITERAL | STRING_LITERAL | HEX_LITERAL | DECIMAL_LITERAL | OCTAL_LITERAL | FLOATING_POINT_LITERAL | WS | BS | UnicodeVocabulary | COMMENT | LINE_COMMENT | LINE_COMMAND ) - alt35 = 106 - alt35 = self.dfa35.predict(self.input) - if alt35 == 1: - # C.g:1:10: T25 - self.mT25() - - - - elif alt35 == 2: - # C.g:1:14: T26 - self.mT26() - - - - elif alt35 == 3: - # C.g:1:18: T27 - self.mT27() - - - - elif alt35 == 4: - # C.g:1:22: T28 - self.mT28() - - - - elif alt35 == 5: - # C.g:1:26: T29 - self.mT29() - - - - elif alt35 == 6: - # C.g:1:30: T30 - self.mT30() - - - - elif alt35 == 7: - # C.g:1:34: T31 - self.mT31() - - - - elif alt35 == 8: - # C.g:1:38: T32 - self.mT32() - - - - elif alt35 == 9: - # C.g:1:42: T33 - self.mT33() - - - - elif alt35 == 10: - # C.g:1:46: T34 - self.mT34() - - - - elif alt35 == 11: - # C.g:1:50: T35 - self.mT35() - - - - elif alt35 == 12: - # C.g:1:54: T36 - self.mT36() - - - - elif alt35 == 13: - # C.g:1:58: T37 - self.mT37() - - - - elif alt35 == 14: - # C.g:1:62: T38 - self.mT38() - - - - elif alt35 == 15: - # C.g:1:66: T39 - self.mT39() - - - - elif alt35 == 16: - # C.g:1:70: T40 - self.mT40() - - - - elif alt35 == 17: - # C.g:1:74: T41 - self.mT41() - - - - elif alt35 == 18: - # C.g:1:78: T42 - self.mT42() - - - - elif alt35 == 19: - # C.g:1:82: T43 - self.mT43() - - - - elif alt35 == 20: - # C.g:1:86: T44 - self.mT44() - - - - elif alt35 == 21: - # C.g:1:90: T45 - self.mT45() - - - - elif alt35 == 22: - # C.g:1:94: T46 - self.mT46() - - - - elif alt35 == 23: - # C.g:1:98: T47 - self.mT47() - - - - elif alt35 == 24: - # C.g:1:102: T48 - self.mT48() - - - - elif alt35 == 25: - # C.g:1:106: T49 - self.mT49() - - - - elif alt35 == 26: - # C.g:1:110: T50 - self.mT50() - - - - elif alt35 == 27: - # C.g:1:114: T51 - self.mT51() - - - - elif alt35 == 28: - # C.g:1:118: T52 - self.mT52() - - - - elif alt35 == 29: - # C.g:1:122: T53 - self.mT53() - - - - elif alt35 == 30: - # C.g:1:126: T54 - self.mT54() - - - - elif alt35 == 31: - # C.g:1:130: T55 - self.mT55() - - - - elif alt35 == 32: - # C.g:1:134: T56 - self.mT56() - - - - elif alt35 == 33: - # C.g:1:138: T57 - self.mT57() - - - - elif alt35 == 34: - # C.g:1:142: T58 - self.mT58() - - - - elif alt35 == 35: - # C.g:1:146: T59 - self.mT59() - - - - elif alt35 == 36: - # C.g:1:150: T60 - self.mT60() - - - - elif alt35 == 37: - # C.g:1:154: T61 - self.mT61() - - - - elif alt35 == 38: - # C.g:1:158: T62 - self.mT62() - - - - elif alt35 == 39: - # C.g:1:162: T63 - self.mT63() - - - - elif alt35 == 40: - # C.g:1:166: T64 - self.mT64() - - - - elif alt35 == 41: - # C.g:1:170: T65 - self.mT65() - - - - elif alt35 == 42: - # C.g:1:174: T66 - self.mT66() - - - - elif alt35 == 43: - # C.g:1:178: T67 - self.mT67() - - - - elif alt35 == 44: - # C.g:1:182: T68 - self.mT68() - - - - elif alt35 == 45: - # C.g:1:186: T69 - self.mT69() - - - - elif alt35 == 46: - # C.g:1:190: T70 - self.mT70() - - - - elif alt35 == 47: - # C.g:1:194: T71 - self.mT71() - - - - elif alt35 == 48: - # C.g:1:198: T72 - self.mT72() - - - - elif alt35 == 49: - # C.g:1:202: T73 - self.mT73() - - - - elif alt35 == 50: - # C.g:1:206: T74 - self.mT74() - - - - elif alt35 == 51: - # C.g:1:210: T75 - self.mT75() - - - - elif alt35 == 52: - # C.g:1:214: T76 - self.mT76() - - - - elif alt35 == 53: - # C.g:1:218: T77 - self.mT77() - - - - elif alt35 == 54: - # C.g:1:222: T78 - self.mT78() - - - - elif alt35 == 55: - # C.g:1:226: T79 - self.mT79() - - - - elif alt35 == 56: - # C.g:1:230: T80 - self.mT80() - - - - elif alt35 == 57: - # C.g:1:234: T81 - self.mT81() - - - - elif alt35 == 58: - # C.g:1:238: T82 - self.mT82() - - - - elif alt35 == 59: - # C.g:1:242: T83 - self.mT83() - - - - elif alt35 == 60: - # C.g:1:246: T84 - self.mT84() - - - - elif alt35 == 61: - # C.g:1:250: T85 - self.mT85() - - - - elif alt35 == 62: - # C.g:1:254: T86 - self.mT86() - - - - elif alt35 == 63: - # C.g:1:258: T87 - self.mT87() - - - - elif alt35 == 64: - # C.g:1:262: T88 - self.mT88() - - - - elif alt35 == 65: - # C.g:1:266: T89 - self.mT89() - - - - elif alt35 == 66: - # C.g:1:270: T90 - self.mT90() - - - - elif alt35 == 67: - # C.g:1:274: T91 - self.mT91() - - - - elif alt35 == 68: - # C.g:1:278: T92 - self.mT92() - - - - elif alt35 == 69: - # C.g:1:282: T93 - self.mT93() - - - - elif alt35 == 70: - # C.g:1:286: T94 - self.mT94() - - - - elif alt35 == 71: - # C.g:1:290: T95 - self.mT95() - - - - elif alt35 == 72: - # C.g:1:294: T96 - self.mT96() - - - - elif alt35 == 73: - # C.g:1:298: T97 - self.mT97() - - - - elif alt35 == 74: - # C.g:1:302: T98 - self.mT98() - - - - elif alt35 == 75: - # C.g:1:306: T99 - self.mT99() - - - - elif alt35 == 76: - # C.g:1:310: T100 - self.mT100() - - - - elif alt35 == 77: - # C.g:1:315: T101 - self.mT101() - - - - elif alt35 == 78: - # C.g:1:320: T102 - self.mT102() - - - - elif alt35 == 79: - # C.g:1:325: T103 - self.mT103() - - - - elif alt35 == 80: - # C.g:1:330: T104 - self.mT104() - - - - elif alt35 == 81: - # C.g:1:335: T105 - self.mT105() - - - - elif alt35 == 82: - # C.g:1:340: T106 - self.mT106() - - - - elif alt35 == 83: - # C.g:1:345: T107 - self.mT107() - - - - elif alt35 == 84: - # C.g:1:350: T108 - self.mT108() - - - - elif alt35 == 85: - # C.g:1:355: T109 - self.mT109() - - - - elif alt35 == 86: - # C.g:1:360: T110 - self.mT110() - - - - elif alt35 == 87: - # C.g:1:365: T111 - self.mT111() - - - - elif alt35 == 88: - # C.g:1:370: T112 - self.mT112() - - - - elif alt35 == 89: - # C.g:1:375: T113 - self.mT113() - - - - elif alt35 == 90: - # C.g:1:380: T114 - self.mT114() - - - - elif alt35 == 91: - # C.g:1:385: T115 - self.mT115() - - - - elif alt35 == 92: - # C.g:1:390: T116 - self.mT116() - - - - elif alt35 == 93: - # C.g:1:395: T117 - self.mT117() - - - - elif alt35 == 94: - # C.g:1:400: IDENTIFIER - self.mIDENTIFIER() - - - - elif alt35 == 95: - # C.g:1:411: CHARACTER_LITERAL - self.mCHARACTER_LITERAL() - - - - elif alt35 == 96: - # C.g:1:429: STRING_LITERAL - self.mSTRING_LITERAL() - - - - elif alt35 == 97: - # C.g:1:444: HEX_LITERAL - self.mHEX_LITERAL() - - - - elif alt35 == 98: - # C.g:1:456: DECIMAL_LITERAL - self.mDECIMAL_LITERAL() - - - - elif alt35 == 99: - # C.g:1:472: OCTAL_LITERAL - self.mOCTAL_LITERAL() - - - - elif alt35 == 100: - # C.g:1:486: FLOATING_POINT_LITERAL - self.mFLOATING_POINT_LITERAL() - - - - elif alt35 == 101: - # C.g:1:509: WS - self.mWS() - - - - elif alt35 == 102: - # C.g:1:512: BS - self.mBS() - - - - elif alt35 == 103: - # C.g:1:515: UnicodeVocabulary - self.mUnicodeVocabulary() - - - - elif alt35 == 104: - # C.g:1:533: COMMENT - self.mCOMMENT() - - - - elif alt35 == 105: - # C.g:1:541: LINE_COMMENT - self.mLINE_COMMENT() - - - - elif alt35 == 106: - # C.g:1:554: LINE_COMMAND - self.mLINE_COMMAND() - - - - - - - - - # lookup tables for DFA #25 - - DFA25_eot = DFA.unpack( - u"\7\uffff\1\10\2\uffff" - ) - - DFA25_eof = DFA.unpack( - u"\12\uffff" - ) - - DFA25_min = DFA.unpack( - u"\2\56\2\uffff\1\53\1\uffff\2\60\2\uffff" - ) - - DFA25_max = DFA.unpack( - u"\1\71\1\146\2\uffff\1\71\1\uffff\1\71\1\146\2\uffff" - ) - - DFA25_accept = DFA.unpack( - u"\2\uffff\1\2\1\1\1\uffff\1\4\2\uffff\2\3" - ) - - DFA25_special = DFA.unpack( - u"\12\uffff" - ) - - - DFA25_transition = [ - DFA.unpack(u"\1\2\1\uffff\12\1"), - DFA.unpack(u"\1\3\1\uffff\12\1\12\uffff\1\5\1\4\1\5\35\uffff\1\5" - u"\1\4\1\5"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\6\1\uffff\1\6\2\uffff\12\7"), - DFA.unpack(u""), - DFA.unpack(u"\12\7"), - DFA.unpack(u"\12\7\12\uffff\1\11\1\uffff\1\11\35\uffff\1\11\1\uffff" - u"\1\11"), - DFA.unpack(u""), - DFA.unpack(u"") - ] - - # class definition for DFA #25 - - DFA25 = DFA - # lookup tables for DFA #35 - - DFA35_eot = DFA.unpack( - u"\2\uffff\1\76\1\uffff\1\101\14\76\3\uffff\10\76\4\uffff\1\151\1" - u"\153\1\157\1\163\1\167\1\171\1\174\1\uffff\1\177\1\u0082\1\u0085" - u"\1\u0087\1\u008a\1\uffff\5\76\1\uffff\2\73\2\u0095\2\uffff\1\73" - u"\2\uffff\1\76\4\uffff\16\76\1\u00ad\5\76\1\u00b4\1\76\3\uffff\1" - u"\u00b7\10\76\34\uffff\1\u00c1\2\uffff\1\u00c3\10\uffff\5\76\3\uffff" - u"\1\u00c9\1\uffff\1\u0095\3\uffff\23\76\1\uffff\1\u00de\1\76\1\u00e0" - u"\3\76\1\uffff\2\76\1\uffff\1\76\1\u00e7\6\76\4\uffff\5\76\1\uffff" - u"\1\76\1\u00f5\1\76\1\u00f7\6\76\1\u00fe\4\76\1\u0103\1\u0104\2" - u"\76\1\u0107\1\uffff\1\u0108\1\uffff\6\76\1\uffff\10\76\1\u0118" - u"\1\76\1\u011a\2\76\1\uffff\1\76\1\uffff\5\76\1\u0123\1\uffff\4" - u"\76\2\uffff\1\76\1\u0129\2\uffff\1\u012a\3\76\1\u012e\1\76\1\u0130" - u"\7\76\1\u0139\1\uffff\1\u013a\1\uffff\1\u013b\1\76\1\u013d\1\u013e" - u"\1\u013f\1\u0140\1\u0141\1\u0142\1\uffff\1\76\1\u0144\1\u0145\2" - u"\76\2\uffff\1\76\1\u0149\1\76\1\uffff\1\76\1\uffff\5\76\1\u0151" - u"\1\u0152\1\76\3\uffff\1\u0154\6\uffff\1\76\2\uffff\2\76\1\u0158" - u"\1\uffff\7\76\2\uffff\1\u0160\1\uffff\1\u0161\1\u0162\1\u0163\1" - u"\uffff\1\u0164\1\u0165\1\76\1\u0167\3\76\6\uffff\1\u016b\1\uffff" - u"\3\76\1\uffff\21\76\1\u0180\2\76\1\uffff\3\76\1\u0186\1\76\1\uffff" - u"\11\76\1\u0191\1\uffff" - ) - - DFA35_eof = DFA.unpack( - u"\u0192\uffff" - ) - - DFA35_min = DFA.unpack( - u"\1\3\1\uffff\1\171\1\uffff\1\75\1\154\1\150\1\165\1\145\1\124\1" - u"\157\1\141\1\146\1\157\1\154\1\145\1\156\3\uffff\1\116\1\120\1" - u"\117\1\116\1\117\1\114\1\106\1\101\4\uffff\1\75\1\56\1\53\1\55" - u"\1\52\1\75\1\46\1\uffff\1\75\1\74\3\75\1\uffff\1\137\1\150\1\157" - u"\1\162\1\42\1\uffff\2\0\2\56\2\uffff\1\0\2\uffff\1\160\4\uffff" - u"\1\163\1\164\1\165\1\151\1\141\1\147\1\157\1\164\1\147\1\101\1" - u"\151\1\163\1\156\1\141\1\44\1\164\1\156\1\162\1\157\1\146\1\44" - u"\1\151\3\uffff\1\44\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34" - u"\uffff\1\75\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145" - u"\3\uffff\1\56\1\uffff\1\56\3\uffff\3\145\1\155\2\164\1\165\1\145" - u"\1\156\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\163\1" - u"\162\1\uffff\1\44\1\147\1\44\2\141\1\142\1\uffff\1\151\1\157\1" - u"\uffff\1\111\1\44\1\123\1\114\1\101\1\102\1\101\1\113\4\uffff\1" - u"\163\1\155\1\154\1\157\1\141\1\uffff\1\144\1\44\1\162\1\44\1\143" - u"\1\151\1\143\1\157\1\145\1\164\1\44\1\163\1\162\1\111\1\164\2\44" - u"\1\151\1\164\1\44\1\uffff\1\44\1\uffff\1\164\1\165\1\154\1\147" - u"\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\102\1\120\1\105" - u"\1\155\1\44\1\145\1\44\1\153\1\145\1\uffff\1\156\1\uffff\1\150" - u"\1\143\1\164\1\146\1\144\1\44\1\uffff\1\164\1\156\1\103\1\151\2" - u"\uffff\1\156\1\44\2\uffff\1\44\1\154\1\145\1\156\1\44\1\116\1\44" - u"\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\44\1\uffff\1\44\1" - u"\uffff\1\44\1\146\6\44\1\uffff\1\145\2\44\1\154\1\165\2\uffff\1" - u"\164\1\44\1\145\1\uffff\1\101\1\uffff\1\116\1\114\1\137\1\116\1" - u"\117\2\44\1\137\3\uffff\1\44\6\uffff\1\162\2\uffff\2\145\1\44\1" - u"\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff\1\44\1\uffff\3\44" - u"\1\uffff\2\44\1\104\1\44\1\105\1\111\1\123\6\uffff\1\44\1\uffff" - u"\2\115\1\105\1\uffff\1\117\1\105\1\122\1\126\1\123\1\126\2\105" - u"\1\111\1\137\1\122\1\103\1\111\1\126\1\105\1\106\1\111\1\44\1\137" - u"\1\103\1\uffff\1\125\1\105\1\116\1\44\1\122\1\uffff\1\105\1\106" - u"\1\105\1\122\1\105\1\116\1\103\1\105\1\104\1\44\1\uffff" - ) - - DFA35_max = DFA.unpack( - u"\1\ufffe\1\uffff\1\171\1\uffff\1\75\1\170\1\167\1\165\1\145\1\124" - u"\2\157\1\156\3\157\1\156\3\uffff\1\116\1\125\1\117\1\116\1\117" - u"\1\114\1\106\1\101\4\uffff\1\75\1\71\1\75\1\76\3\75\1\uffff\2\75" - u"\1\76\1\75\1\174\1\uffff\1\141\1\150\1\157\1\162\1\47\1\uffff\2" - u"\ufffe\1\170\1\146\2\uffff\1\ufffe\2\uffff\1\160\4\uffff\1\163" - u"\1\164\1\165\1\151\1\162\1\172\1\157\2\164\1\101\1\154\1\163\1" - u"\156\1\141\1\172\1\164\1\156\1\162\1\157\1\146\1\172\1\163\3\uffff" - u"\1\172\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34\uffff\1\75" - u"\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145\3\uffff\1" - u"\146\1\uffff\1\146\3\uffff\3\145\1\155\2\164\1\165\1\145\1\156" - u"\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\164\1\162\1" - u"\uffff\1\172\1\147\1\172\2\141\1\142\1\uffff\1\151\1\157\1\uffff" - u"\1\111\1\172\1\123\1\114\1\101\1\102\1\137\1\113\4\uffff\1\163" - u"\1\155\1\154\1\157\1\141\1\uffff\1\144\1\172\1\162\1\172\1\143" - u"\1\151\1\143\1\157\1\145\1\164\1\172\1\163\1\162\1\111\1\164\2" - u"\172\1\151\1\164\1\172\1\uffff\1\172\1\uffff\1\164\1\165\1\154" - u"\1\147\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\122\1\120" - u"\1\105\1\155\1\172\1\145\1\172\1\153\1\145\1\uffff\1\156\1\uffff" - u"\1\150\1\143\1\164\1\146\1\144\1\172\1\uffff\1\164\1\156\1\103" - u"\1\151\2\uffff\1\156\1\172\2\uffff\1\172\1\154\1\145\1\156\1\172" - u"\1\116\1\172\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\172\1" - u"\uffff\1\172\1\uffff\1\172\1\146\6\172\1\uffff\1\145\2\172\1\154" - u"\1\165\2\uffff\1\164\1\172\1\145\1\uffff\1\101\1\uffff\1\116\1" - u"\114\1\137\1\116\1\117\2\172\1\137\3\uffff\1\172\6\uffff\1\162" - u"\2\uffff\2\145\1\172\1\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff" - u"\1\172\1\uffff\3\172\1\uffff\2\172\1\104\1\172\1\105\1\111\1\123" - u"\6\uffff\1\172\1\uffff\2\115\1\105\1\uffff\1\117\1\105\1\122\1" - u"\126\1\123\1\126\2\105\1\111\1\137\1\122\1\103\1\111\1\126\1\105" - u"\1\106\1\111\1\172\1\137\1\103\1\uffff\1\125\1\105\1\116\1\172" - u"\1\122\1\uffff\1\105\1\106\1\105\1\122\1\105\1\116\1\103\1\105" - u"\1\104\1\172\1\uffff" - ) - - DFA35_accept = DFA.unpack( - u"\1\uffff\1\1\1\uffff\1\3\15\uffff\1\23\1\24\1\27\10\uffff\1\46" - u"\1\47\1\50\1\51\7\uffff\1\66\5\uffff\1\102\5\uffff\1\136\4\uffff" - u"\1\145\1\146\1\uffff\1\147\1\1\1\uffff\1\136\1\3\1\107\1\4\26\uffff" - u"\1\23\1\24\1\27\11\uffff\1\46\1\47\1\50\1\51\1\70\1\52\1\53\1\63" - u"\1\144\1\73\1\60\1\54\1\74\1\64\1\61\1\55\1\150\1\151\1\71\1\56" - u"\1\72\1\57\1\77\1\104\1\65\1\66\1\110\1\67\1\uffff\1\113\1\111" - u"\1\uffff\1\114\1\112\1\100\1\106\1\103\1\101\1\105\1\102\5\uffff" - u"\1\140\1\137\1\141\1\uffff\1\142\1\uffff\1\145\1\146\1\152\23\uffff" - u"\1\124\6\uffff\1\130\2\uffff\1\33\10\uffff\1\75\1\115\1\76\1\116" - u"\5\uffff\1\143\24\uffff\1\15\1\uffff\1\131\6\uffff\1\34\15\uffff" - u"\1\125\1\uffff\1\30\6\uffff\1\7\4\uffff\1\12\1\122\2\uffff\1\13" - u"\1\16\17\uffff\1\120\1\uffff\1\132\10\uffff\1\14\5\uffff\1\31\1" - u"\17\3\uffff\1\26\1\uffff\1\36\10\uffff\1\121\1\127\1\134\1\uffff" - u"\1\5\1\126\1\6\1\25\1\62\1\21\1\uffff\1\135\1\11\3\uffff\1\20\7" - u"\uffff\1\42\1\45\1\uffff\1\2\3\uffff\1\123\7\uffff\1\117\1\10\1" - u"\32\1\133\1\22\1\35\1\uffff\1\40\3\uffff\1\37\24\uffff\1\43\5\uffff" - u"\1\44\12\uffff\1\41" - ) - - DFA35_special = DFA.unpack( - u"\u0192\uffff" - ) - - - DFA35_transition = [ - DFA.unpack(u"\6\73\2\70\1\73\2\70\22\73\1\70\1\50\1\65\1\72\1\63" - u"\1\45\1\46\1\64\1\34\1\35\1\40\1\42\1\3\1\43\1\41\1\44\1\66\11" - u"\67\1\23\1\1\1\51\1\4\1\52\1\55\1\73\2\63\1\26\1\63\1\32\1\63\1" - u"\31\1\63\1\24\2\63\1\62\2\63\1\25\1\33\2\63\1\11\1\63\1\27\1\30" - u"\4\63\1\36\1\71\1\37\1\53\1\56\1\73\1\7\1\61\1\13\1\17\1\5\1\16" - u"\1\60\1\63\1\14\2\63\1\15\5\63\1\10\1\6\1\2\1\20\1\12\1\57\3\63" - u"\1\21\1\54\1\22\1\47\uff80\73"), - DFA.unpack(u""), - DFA.unpack(u"\1\75"), - DFA.unpack(u""), - DFA.unpack(u"\1\100"), - DFA.unpack(u"\1\102\1\uffff\1\104\11\uffff\1\103"), - DFA.unpack(u"\1\110\1\107\12\uffff\1\106\2\uffff\1\105"), - DFA.unpack(u"\1\111"), - DFA.unpack(u"\1\112"), - DFA.unpack(u"\1\113"), - DFA.unpack(u"\1\114"), - DFA.unpack(u"\1\115\6\uffff\1\117\6\uffff\1\116"), - DFA.unpack(u"\1\120\7\uffff\1\121"), - DFA.unpack(u"\1\122"), - DFA.unpack(u"\1\124\2\uffff\1\123"), - DFA.unpack(u"\1\125\11\uffff\1\126"), - DFA.unpack(u"\1\127"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\133"), - DFA.unpack(u"\1\134\4\uffff\1\135"), - DFA.unpack(u"\1\136"), - DFA.unpack(u"\1\137"), - DFA.unpack(u"\1\140"), - DFA.unpack(u"\1\141"), - DFA.unpack(u"\1\142"), - DFA.unpack(u"\1\143"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\150"), - DFA.unpack(u"\1\152\1\uffff\12\154"), - DFA.unpack(u"\1\156\21\uffff\1\155"), - DFA.unpack(u"\1\162\17\uffff\1\160\1\161"), - DFA.unpack(u"\1\164\4\uffff\1\165\15\uffff\1\166"), - DFA.unpack(u"\1\170"), - DFA.unpack(u"\1\173\26\uffff\1\172"), - DFA.unpack(u""), - DFA.unpack(u"\1\176"), - DFA.unpack(u"\1\u0080\1\u0081"), - DFA.unpack(u"\1\u0084\1\u0083"), - DFA.unpack(u"\1\u0086"), - DFA.unpack(u"\1\u0089\76\uffff\1\u0088"), - DFA.unpack(u""), - DFA.unpack(u"\1\u008c\1\uffff\1\u008d"), - DFA.unpack(u"\1\u008e"), - DFA.unpack(u"\1\u008f"), - DFA.unpack(u"\1\u0090"), - DFA.unpack(u"\1\u0091\4\uffff\1\u0092"), - DFA.unpack(u""), - DFA.unpack(u"\47\u0092\1\uffff\uffd7\u0092"), - DFA.unpack(u"\uffff\u0091"), - DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\21\uffff" - u"\1\u0093\13\uffff\3\154\21\uffff\1\u0093"), - DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\uffff\u0099"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u009a"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u009b"), - DFA.unpack(u"\1\u009c"), - DFA.unpack(u"\1\u009d"), - DFA.unpack(u"\1\u009e"), - DFA.unpack(u"\1\u009f\20\uffff\1\u00a0"), - DFA.unpack(u"\1\u00a2\22\uffff\1\u00a1"), - DFA.unpack(u"\1\u00a3"), - DFA.unpack(u"\1\u00a4"), - DFA.unpack(u"\1\u00a5\14\uffff\1\u00a6"), - DFA.unpack(u"\1\u00a7"), - DFA.unpack(u"\1\u00a9\2\uffff\1\u00a8"), - DFA.unpack(u"\1\u00aa"), - DFA.unpack(u"\1\u00ab"), - DFA.unpack(u"\1\u00ac"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00ae"), - DFA.unpack(u"\1\u00af"), - DFA.unpack(u"\1\u00b0"), - DFA.unpack(u"\1\u00b1"), - DFA.unpack(u"\1\u00b2"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\24\76\1\u00b3\5\76"), - DFA.unpack(u"\1\u00b6\11\uffff\1\u00b5"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00b8"), - DFA.unpack(u"\1\u00b9"), - DFA.unpack(u"\1\u00ba"), - DFA.unpack(u"\1\u00bb"), - DFA.unpack(u"\1\u00bc"), - DFA.unpack(u"\1\u00bd"), - DFA.unpack(u"\1\u00be"), - DFA.unpack(u"\1\u00bf"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u00c0"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u00c2"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u00c4"), - DFA.unpack(u"\1\u00c5"), - DFA.unpack(u"\1\u00c6"), - DFA.unpack(u"\1\u00c7"), - DFA.unpack(u"\1\u00c8"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\35\uffff" - u"\3\154"), - DFA.unpack(u""), - DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u00ca"), - DFA.unpack(u"\1\u00cb"), - DFA.unpack(u"\1\u00cc"), - DFA.unpack(u"\1\u00cd"), - DFA.unpack(u"\1\u00ce"), - DFA.unpack(u"\1\u00cf"), - DFA.unpack(u"\1\u00d0"), - DFA.unpack(u"\1\u00d1"), - DFA.unpack(u"\1\u00d2"), - DFA.unpack(u"\1\u00d3"), - DFA.unpack(u"\1\u00d4"), - DFA.unpack(u"\1\u00d5"), - DFA.unpack(u"\1\u00d6"), - DFA.unpack(u"\1\u00d7"), - DFA.unpack(u"\1\u00d8"), - DFA.unpack(u"\1\u00d9"), - DFA.unpack(u"\1\u00da"), - DFA.unpack(u"\1\u00dc\1\u00db"), - DFA.unpack(u"\1\u00dd"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00df"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00e1"), - DFA.unpack(u"\1\u00e2"), - DFA.unpack(u"\1\u00e3"), - DFA.unpack(u""), - DFA.unpack(u"\1\u00e4"), - DFA.unpack(u"\1\u00e5"), - DFA.unpack(u""), - DFA.unpack(u"\1\u00e6"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00e8"), - DFA.unpack(u"\1\u00e9"), - DFA.unpack(u"\1\u00ea"), - DFA.unpack(u"\1\u00eb"), - DFA.unpack(u"\1\u00ed\35\uffff\1\u00ec"), - DFA.unpack(u"\1\u00ee"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u00ef"), - DFA.unpack(u"\1\u00f0"), - DFA.unpack(u"\1\u00f1"), - DFA.unpack(u"\1\u00f2"), - DFA.unpack(u"\1\u00f3"), - DFA.unpack(u""), - DFA.unpack(u"\1\u00f4"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00f6"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00f8"), - DFA.unpack(u"\1\u00f9"), - DFA.unpack(u"\1\u00fa"), - DFA.unpack(u"\1\u00fb"), - DFA.unpack(u"\1\u00fc"), - DFA.unpack(u"\1\u00fd"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00ff"), - DFA.unpack(u"\1\u0100"), - DFA.unpack(u"\1\u0101"), - DFA.unpack(u"\1\u0102"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0105"), - DFA.unpack(u"\1\u0106"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0109"), - DFA.unpack(u"\1\u010a"), - DFA.unpack(u"\1\u010b"), - DFA.unpack(u"\1\u010c"), - DFA.unpack(u"\1\u010d"), - DFA.unpack(u"\1\u010e"), - DFA.unpack(u""), - DFA.unpack(u"\1\u010f"), - DFA.unpack(u"\1\u0110"), - DFA.unpack(u"\1\u0111"), - DFA.unpack(u"\1\u0112"), - DFA.unpack(u"\1\u0114\17\uffff\1\u0113"), - DFA.unpack(u"\1\u0115"), - DFA.unpack(u"\1\u0116"), - DFA.unpack(u"\1\u0117"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0119"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u011b"), - DFA.unpack(u"\1\u011c"), - DFA.unpack(u""), - DFA.unpack(u"\1\u011d"), - DFA.unpack(u""), - DFA.unpack(u"\1\u011e"), - DFA.unpack(u"\1\u011f"), - DFA.unpack(u"\1\u0120"), - DFA.unpack(u"\1\u0121"), - DFA.unpack(u"\1\u0122"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0124"), - DFA.unpack(u"\1\u0125"), - DFA.unpack(u"\1\u0126"), - DFA.unpack(u"\1\u0127"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u0128"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u012b"), - DFA.unpack(u"\1\u012c"), - DFA.unpack(u"\1\u012d"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u012f"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0131"), - DFA.unpack(u"\1\u0132"), - DFA.unpack(u"\1\u0133"), - DFA.unpack(u"\1\u0134"), - DFA.unpack(u"\1\u0135"), - DFA.unpack(u"\1\u0136"), - DFA.unpack(u"\1\u0137"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\u0138\1" - u"\uffff\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u013c"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0143"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0146"), - DFA.unpack(u"\1\u0147"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u0148"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u014a"), - DFA.unpack(u""), - DFA.unpack(u"\1\u014b"), - DFA.unpack(u""), - DFA.unpack(u"\1\u014c"), - DFA.unpack(u"\1\u014d"), - DFA.unpack(u"\1\u014e"), - DFA.unpack(u"\1\u014f"), - DFA.unpack(u"\1\u0150"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0153"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u0155"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u0156"), - DFA.unpack(u"\1\u0157"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0159"), - DFA.unpack(u"\1\u015a"), - DFA.unpack(u"\1\u015b"), - DFA.unpack(u"\1\u015c"), - DFA.unpack(u"\1\u015d"), - DFA.unpack(u"\1\u015e"), - DFA.unpack(u"\1\u015f"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0166"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0168"), - DFA.unpack(u"\1\u0169"), - DFA.unpack(u"\1\u016a"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\u016c"), - DFA.unpack(u"\1\u016d"), - DFA.unpack(u"\1\u016e"), - DFA.unpack(u""), - DFA.unpack(u"\1\u016f"), - DFA.unpack(u"\1\u0170"), - DFA.unpack(u"\1\u0171"), - DFA.unpack(u"\1\u0172"), - DFA.unpack(u"\1\u0173"), - DFA.unpack(u"\1\u0174"), - DFA.unpack(u"\1\u0175"), - DFA.unpack(u"\1\u0176"), - DFA.unpack(u"\1\u0177"), - DFA.unpack(u"\1\u0178"), - DFA.unpack(u"\1\u0179"), - DFA.unpack(u"\1\u017a"), - DFA.unpack(u"\1\u017b"), - DFA.unpack(u"\1\u017c"), - DFA.unpack(u"\1\u017d"), - DFA.unpack(u"\1\u017e"), - DFA.unpack(u"\1\u017f"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0181"), - DFA.unpack(u"\1\u0182"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0183"), - DFA.unpack(u"\1\u0184"), - DFA.unpack(u"\1\u0185"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0187"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0188"), - DFA.unpack(u"\1\u0189"), - DFA.unpack(u"\1\u018a"), - DFA.unpack(u"\1\u018b"), - DFA.unpack(u"\1\u018c"), - DFA.unpack(u"\1\u018d"), - DFA.unpack(u"\1\u018e"), - DFA.unpack(u"\1\u018f"), - DFA.unpack(u"\1\u0190"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"") - ] - - # class definition for DFA #35 - - DFA35 = DFA - - + + + +# for convenience in actions +HIDDEN = BaseRecognizer.HIDDEN + +# token types +T114=114 +T115=115 +T116=116 +T117=117 +FloatTypeSuffix=16 +LETTER=11 +T29=29 +T28=28 +T27=27 +T26=26 +T25=25 +EOF=-1 +STRING_LITERAL=9 +FLOATING_POINT_LITERAL=10 +T38=38 +T37=37 +T39=39 +T34=34 +COMMENT=22 +T33=33 +T36=36 +T35=35 +T30=30 +T32=32 +T31=31 +LINE_COMMENT=23 +IntegerTypeSuffix=14 +CHARACTER_LITERAL=8 +T49=49 +T48=48 +T100=100 +T43=43 +T42=42 +T102=102 +T41=41 +T101=101 +T40=40 +T47=47 +T46=46 +T45=45 +T44=44 +T109=109 +T107=107 +T108=108 +T105=105 +WS=19 +T106=106 +T103=103 +T104=104 +T50=50 +LINE_COMMAND=24 +T59=59 +T113=113 +T52=52 +T112=112 +T51=51 +T111=111 +T54=54 +T110=110 +EscapeSequence=12 +DECIMAL_LITERAL=7 +T53=53 +T56=56 +T55=55 +T58=58 +T57=57 +T75=75 +T76=76 +T73=73 +T74=74 +T79=79 +T77=77 +T78=78 +Exponent=15 +HexDigit=13 +T72=72 +T71=71 +T70=70 +T62=62 +T63=63 +T64=64 +T65=65 +T66=66 +T67=67 +T68=68 +T69=69 +IDENTIFIER=4 +UnicodeVocabulary=21 +HEX_LITERAL=5 +T61=61 +T60=60 +T99=99 +T97=97 +BS=20 +T98=98 +T95=95 +T96=96 +OCTAL_LITERAL=6 +T94=94 +Tokens=118 +T93=93 +T92=92 +T91=91 +T90=90 +T88=88 +T89=89 +T84=84 +T85=85 +T86=86 +T87=87 +UnicodeEscape=18 +T81=81 +T80=80 +T83=83 +OctalEscape=17 +T82=82 + +class CLexer(Lexer): + + grammarFileName = "C.g" + + def __init__(self, input=None): + Lexer.__init__(self, input) + self.dfa25 = self.DFA25( + self, 25, + eot = self.DFA25_eot, + eof = self.DFA25_eof, + min = self.DFA25_min, + max = self.DFA25_max, + accept = self.DFA25_accept, + special = self.DFA25_special, + transition = self.DFA25_transition + ) + self.dfa35 = self.DFA35( + self, 35, + eot = self.DFA35_eot, + eof = self.DFA35_eof, + min = self.DFA35_min, + max = self.DFA35_max, + accept = self.DFA35_accept, + special = self.DFA35_special, + transition = self.DFA35_transition + ) + + + + + + + # $ANTLR start T25 + def mT25(self, ): + + try: + self.type = T25 + + # C.g:27:5: ( ';' ) + # C.g:27:7: ';' + self.match(u';') + + + + + + finally: + + pass + + # $ANTLR end T25 + + + + # $ANTLR start T26 + def mT26(self, ): + + try: + self.type = T26 + + # C.g:28:5: ( 'typedef' ) + # C.g:28:7: 'typedef' + self.match("typedef") + + + + + + + finally: + + pass + + # $ANTLR end T26 + + + + # $ANTLR start T27 + def mT27(self, ): + + try: + self.type = T27 + + # C.g:29:5: ( ',' ) + # C.g:29:7: ',' + self.match(u',') + + + + + + finally: + + pass + + # $ANTLR end T27 + + + + # $ANTLR start T28 + def mT28(self, ): + + try: + self.type = T28 + + # C.g:30:5: ( '=' ) + # C.g:30:7: '=' + self.match(u'=') + + + + + + finally: + + pass + + # $ANTLR end T28 + + + + # $ANTLR start T29 + def mT29(self, ): + + try: + self.type = T29 + + # C.g:31:5: ( 'extern' ) + # C.g:31:7: 'extern' + self.match("extern") + + + + + + + finally: + + pass + + # $ANTLR end T29 + + + + # $ANTLR start T30 + def mT30(self, ): + + try: + self.type = T30 + + # C.g:32:5: ( 'static' ) + # C.g:32:7: 'static' + self.match("static") + + + + + + + finally: + + pass + + # $ANTLR end T30 + + + + # $ANTLR start T31 + def mT31(self, ): + + try: + self.type = T31 + + # C.g:33:5: ( 'auto' ) + # C.g:33:7: 'auto' + self.match("auto") + + + + + + + finally: + + pass + + # $ANTLR end T31 + + + + # $ANTLR start T32 + def mT32(self, ): + + try: + self.type = T32 + + # C.g:34:5: ( 'register' ) + # C.g:34:7: 'register' + self.match("register") + + + + + + + finally: + + pass + + # $ANTLR end T32 + + + + # $ANTLR start T33 + def mT33(self, ): + + try: + self.type = T33 + + # C.g:35:5: ( 'STATIC' ) + # C.g:35:7: 'STATIC' + self.match("STATIC") + + + + + + + finally: + + pass + + # $ANTLR end T33 + + + + # $ANTLR start T34 + def mT34(self, ): + + try: + self.type = T34 + + # C.g:36:5: ( 'void' ) + # C.g:36:7: 'void' + self.match("void") + + + + + + + finally: + + pass + + # $ANTLR end T34 + + + + # $ANTLR start T35 + def mT35(self, ): + + try: + self.type = T35 + + # C.g:37:5: ( 'char' ) + # C.g:37:7: 'char' + self.match("char") + + + + + + + finally: + + pass + + # $ANTLR end T35 + + + + # $ANTLR start T36 + def mT36(self, ): + + try: + self.type = T36 + + # C.g:38:5: ( 'short' ) + # C.g:38:7: 'short' + self.match("short") + + + + + + + finally: + + pass + + # $ANTLR end T36 + + + + # $ANTLR start T37 + def mT37(self, ): + + try: + self.type = T37 + + # C.g:39:5: ( 'int' ) + # C.g:39:7: 'int' + self.match("int") + + + + + + + finally: + + pass + + # $ANTLR end T37 + + + + # $ANTLR start T38 + def mT38(self, ): + + try: + self.type = T38 + + # C.g:40:5: ( 'long' ) + # C.g:40:7: 'long' + self.match("long") + + + + + + + finally: + + pass + + # $ANTLR end T38 + + + + # $ANTLR start T39 + def mT39(self, ): + + try: + self.type = T39 + + # C.g:41:5: ( 'float' ) + # C.g:41:7: 'float' + self.match("float") + + + + + + + finally: + + pass + + # $ANTLR end T39 + + + + # $ANTLR start T40 + def mT40(self, ): + + try: + self.type = T40 + + # C.g:42:5: ( 'double' ) + # C.g:42:7: 'double' + self.match("double") + + + + + + + finally: + + pass + + # $ANTLR end T40 + + + + # $ANTLR start T41 + def mT41(self, ): + + try: + self.type = T41 + + # C.g:43:5: ( 'signed' ) + # C.g:43:7: 'signed' + self.match("signed") + + + + + + + finally: + + pass + + # $ANTLR end T41 + + + + # $ANTLR start T42 + def mT42(self, ): + + try: + self.type = T42 + + # C.g:44:5: ( 'unsigned' ) + # C.g:44:7: 'unsigned' + self.match("unsigned") + + + + + + + finally: + + pass + + # $ANTLR end T42 + + + + # $ANTLR start T43 + def mT43(self, ): + + try: + self.type = T43 + + # C.g:45:5: ( '{' ) + # C.g:45:7: '{' + self.match(u'{') + + + + + + finally: + + pass + + # $ANTLR end T43 + + + + # $ANTLR start T44 + def mT44(self, ): + + try: + self.type = T44 + + # C.g:46:5: ( '}' ) + # C.g:46:7: '}' + self.match(u'}') + + + + + + finally: + + pass + + # $ANTLR end T44 + + + + # $ANTLR start T45 + def mT45(self, ): + + try: + self.type = T45 + + # C.g:47:5: ( 'struct' ) + # C.g:47:7: 'struct' + self.match("struct") + + + + + + + finally: + + pass + + # $ANTLR end T45 + + + + # $ANTLR start T46 + def mT46(self, ): + + try: + self.type = T46 + + # C.g:48:5: ( 'union' ) + # C.g:48:7: 'union' + self.match("union") + + + + + + + finally: + + pass + + # $ANTLR end T46 + + + + # $ANTLR start T47 + def mT47(self, ): + + try: + self.type = T47 + + # C.g:49:5: ( ':' ) + # C.g:49:7: ':' + self.match(u':') + + + + + + finally: + + pass + + # $ANTLR end T47 + + + + # $ANTLR start T48 + def mT48(self, ): + + try: + self.type = T48 + + # C.g:50:5: ( 'enum' ) + # C.g:50:7: 'enum' + self.match("enum") + + + + + + + finally: + + pass + + # $ANTLR end T48 + + + + # $ANTLR start T49 + def mT49(self, ): + + try: + self.type = T49 + + # C.g:51:5: ( 'const' ) + # C.g:51:7: 'const' + self.match("const") + + + + + + + finally: + + pass + + # $ANTLR end T49 + + + + # $ANTLR start T50 + def mT50(self, ): + + try: + self.type = T50 + + # C.g:52:5: ( 'volatile' ) + # C.g:52:7: 'volatile' + self.match("volatile") + + + + + + + finally: + + pass + + # $ANTLR end T50 + + + + # $ANTLR start T51 + def mT51(self, ): + + try: + self.type = T51 + + # C.g:53:5: ( 'IN' ) + # C.g:53:7: 'IN' + self.match("IN") + + + + + + + finally: + + pass + + # $ANTLR end T51 + + + + # $ANTLR start T52 + def mT52(self, ): + + try: + self.type = T52 + + # C.g:54:5: ( 'OUT' ) + # C.g:54:7: 'OUT' + self.match("OUT") + + + + + + + finally: + + pass + + # $ANTLR end T52 + + + + # $ANTLR start T53 + def mT53(self, ): + + try: + self.type = T53 + + # C.g:55:5: ( 'OPTIONAL' ) + # C.g:55:7: 'OPTIONAL' + self.match("OPTIONAL") + + + + + + + finally: + + pass + + # $ANTLR end T53 + + + + # $ANTLR start T54 + def mT54(self, ): + + try: + self.type = T54 + + # C.g:56:5: ( 'CONST' ) + # C.g:56:7: 'CONST' + self.match("CONST") + + + + + + + finally: + + pass + + # $ANTLR end T54 + + + + # $ANTLR start T55 + def mT55(self, ): + + try: + self.type = T55 + + # C.g:57:5: ( 'UNALIGNED' ) + # C.g:57:7: 'UNALIGNED' + self.match("UNALIGNED") + + + + + + + finally: + + pass + + # $ANTLR end T55 + + + + # $ANTLR start T56 + def mT56(self, ): + + try: + self.type = T56 + + # C.g:58:5: ( 'VOLATILE' ) + # C.g:58:7: 'VOLATILE' + self.match("VOLATILE") + + + + + + + finally: + + pass + + # $ANTLR end T56 + + + + # $ANTLR start T57 + def mT57(self, ): + + try: + self.type = T57 + + # C.g:59:5: ( 'GLOBAL_REMOVE_IF_UNREFERENCED' ) + # C.g:59:7: 'GLOBAL_REMOVE_IF_UNREFERENCED' + self.match("GLOBAL_REMOVE_IF_UNREFERENCED") + + + + + + + finally: + + pass + + # $ANTLR end T57 + + + + # $ANTLR start T58 + def mT58(self, ): + + try: + self.type = T58 + + # C.g:60:5: ( 'EFIAPI' ) + # C.g:60:7: 'EFIAPI' + self.match("EFIAPI") + + + + + + + finally: + + pass + + # $ANTLR end T58 + + + + # $ANTLR start T59 + def mT59(self, ): + + try: + self.type = T59 + + # C.g:61:5: ( 'EFI_BOOTSERVICE' ) + # C.g:61:7: 'EFI_BOOTSERVICE' + self.match("EFI_BOOTSERVICE") + + + + + + + finally: + + pass + + # $ANTLR end T59 + + + + # $ANTLR start T60 + def mT60(self, ): + + try: + self.type = T60 + + # C.g:62:5: ( 'EFI_RUNTIMESERVICE' ) + # C.g:62:7: 'EFI_RUNTIMESERVICE' + self.match("EFI_RUNTIMESERVICE") + + + + + + + finally: + + pass + + # $ANTLR end T60 + + + + # $ANTLR start T61 + def mT61(self, ): + + try: + self.type = T61 + + # C.g:63:5: ( 'PACKED' ) + # C.g:63:7: 'PACKED' + self.match("PACKED") + + + + + + + finally: + + pass + + # $ANTLR end T61 + + + + # $ANTLR start T62 + def mT62(self, ): + + try: + self.type = T62 + + # C.g:64:5: ( '(' ) + # C.g:64:7: '(' + self.match(u'(') + + + + + + finally: + + pass + + # $ANTLR end T62 + + + + # $ANTLR start T63 + def mT63(self, ): + + try: + self.type = T63 + + # C.g:65:5: ( ')' ) + # C.g:65:7: ')' + self.match(u')') + + + + + + finally: + + pass + + # $ANTLR end T63 + + + + # $ANTLR start T64 + def mT64(self, ): + + try: + self.type = T64 + + # C.g:66:5: ( '[' ) + # C.g:66:7: '[' + self.match(u'[') + + + + + + finally: + + pass + + # $ANTLR end T64 + + + + # $ANTLR start T65 + def mT65(self, ): + + try: + self.type = T65 + + # C.g:67:5: ( ']' ) + # C.g:67:7: ']' + self.match(u']') + + + + + + finally: + + pass + + # $ANTLR end T65 + + + + # $ANTLR start T66 + def mT66(self, ): + + try: + self.type = T66 + + # C.g:68:5: ( '*' ) + # C.g:68:7: '*' + self.match(u'*') + + + + + + finally: + + pass + + # $ANTLR end T66 + + + + # $ANTLR start T67 + def mT67(self, ): + + try: + self.type = T67 + + # C.g:69:5: ( '...' ) + # C.g:69:7: '...' + self.match("...") + + + + + + + finally: + + pass + + # $ANTLR end T67 + + + + # $ANTLR start T68 + def mT68(self, ): + + try: + self.type = T68 + + # C.g:70:5: ( '+' ) + # C.g:70:7: '+' + self.match(u'+') + + + + + + finally: + + pass + + # $ANTLR end T68 + + + + # $ANTLR start T69 + def mT69(self, ): + + try: + self.type = T69 + + # C.g:71:5: ( '-' ) + # C.g:71:7: '-' + self.match(u'-') + + + + + + finally: + + pass + + # $ANTLR end T69 + + + + # $ANTLR start T70 + def mT70(self, ): + + try: + self.type = T70 + + # C.g:72:5: ( '/' ) + # C.g:72:7: '/' + self.match(u'/') + + + + + + finally: + + pass + + # $ANTLR end T70 + + + + # $ANTLR start T71 + def mT71(self, ): + + try: + self.type = T71 + + # C.g:73:5: ( '%' ) + # C.g:73:7: '%' + self.match(u'%') + + + + + + finally: + + pass + + # $ANTLR end T71 + + + + # $ANTLR start T72 + def mT72(self, ): + + try: + self.type = T72 + + # C.g:74:5: ( '++' ) + # C.g:74:7: '++' + self.match("++") + + + + + + + finally: + + pass + + # $ANTLR end T72 + + + + # $ANTLR start T73 + def mT73(self, ): + + try: + self.type = T73 + + # C.g:75:5: ( '--' ) + # C.g:75:7: '--' + self.match("--") + + + + + + + finally: + + pass + + # $ANTLR end T73 + + + + # $ANTLR start T74 + def mT74(self, ): + + try: + self.type = T74 + + # C.g:76:5: ( 'sizeof' ) + # C.g:76:7: 'sizeof' + self.match("sizeof") + + + + + + + finally: + + pass + + # $ANTLR end T74 + + + + # $ANTLR start T75 + def mT75(self, ): + + try: + self.type = T75 + + # C.g:77:5: ( '.' ) + # C.g:77:7: '.' + self.match(u'.') + + + + + + finally: + + pass + + # $ANTLR end T75 + + + + # $ANTLR start T76 + def mT76(self, ): + + try: + self.type = T76 + + # C.g:78:5: ( '->' ) + # C.g:78:7: '->' + self.match("->") + + + + + + + finally: + + pass + + # $ANTLR end T76 + + + + # $ANTLR start T77 + def mT77(self, ): + + try: + self.type = T77 + + # C.g:79:5: ( '&' ) + # C.g:79:7: '&' + self.match(u'&') + + + + + + finally: + + pass + + # $ANTLR end T77 + + + + # $ANTLR start T78 + def mT78(self, ): + + try: + self.type = T78 + + # C.g:80:5: ( '~' ) + # C.g:80:7: '~' + self.match(u'~') + + + + + + finally: + + pass + + # $ANTLR end T78 + + + + # $ANTLR start T79 + def mT79(self, ): + + try: + self.type = T79 + + # C.g:81:5: ( '!' ) + # C.g:81:7: '!' + self.match(u'!') + + + + + + finally: + + pass + + # $ANTLR end T79 + + + + # $ANTLR start T80 + def mT80(self, ): + + try: + self.type = T80 + + # C.g:82:5: ( '*=' ) + # C.g:82:7: '*=' + self.match("*=") + + + + + + + finally: + + pass + + # $ANTLR end T80 + + + + # $ANTLR start T81 + def mT81(self, ): + + try: + self.type = T81 + + # C.g:83:5: ( '/=' ) + # C.g:83:7: '/=' + self.match("/=") + + + + + + + finally: + + pass + + # $ANTLR end T81 + + + + # $ANTLR start T82 + def mT82(self, ): + + try: + self.type = T82 + + # C.g:84:5: ( '%=' ) + # C.g:84:7: '%=' + self.match("%=") + + + + + + + finally: + + pass + + # $ANTLR end T82 + + + + # $ANTLR start T83 + def mT83(self, ): + + try: + self.type = T83 + + # C.g:85:5: ( '+=' ) + # C.g:85:7: '+=' + self.match("+=") + + + + + + + finally: + + pass + + # $ANTLR end T83 + + + + # $ANTLR start T84 + def mT84(self, ): + + try: + self.type = T84 + + # C.g:86:5: ( '-=' ) + # C.g:86:7: '-=' + self.match("-=") + + + + + + + finally: + + pass + + # $ANTLR end T84 + + + + # $ANTLR start T85 + def mT85(self, ): + + try: + self.type = T85 + + # C.g:87:5: ( '<<=' ) + # C.g:87:7: '<<=' + self.match("<<=") + + + + + + + finally: + + pass + + # $ANTLR end T85 + + + + # $ANTLR start T86 + def mT86(self, ): + + try: + self.type = T86 + + # C.g:88:5: ( '>>=' ) + # C.g:88:7: '>>=' + self.match(">>=") + + + + + + + finally: + + pass + + # $ANTLR end T86 + + + + # $ANTLR start T87 + def mT87(self, ): + + try: + self.type = T87 + + # C.g:89:5: ( '&=' ) + # C.g:89:7: '&=' + self.match("&=") + + + + + + + finally: + + pass + + # $ANTLR end T87 + + + + # $ANTLR start T88 + def mT88(self, ): + + try: + self.type = T88 + + # C.g:90:5: ( '^=' ) + # C.g:90:7: '^=' + self.match("^=") + + + + + + + finally: + + pass + + # $ANTLR end T88 + + + + # $ANTLR start T89 + def mT89(self, ): + + try: + self.type = T89 + + # C.g:91:5: ( '|=' ) + # C.g:91:7: '|=' + self.match("|=") + + + + + + + finally: + + pass + + # $ANTLR end T89 + + + + # $ANTLR start T90 + def mT90(self, ): + + try: + self.type = T90 + + # C.g:92:5: ( '?' ) + # C.g:92:7: '?' + self.match(u'?') + + + + + + finally: + + pass + + # $ANTLR end T90 + + + + # $ANTLR start T91 + def mT91(self, ): + + try: + self.type = T91 + + # C.g:93:5: ( '||' ) + # C.g:93:7: '||' + self.match("||") + + + + + + + finally: + + pass + + # $ANTLR end T91 + + + + # $ANTLR start T92 + def mT92(self, ): + + try: + self.type = T92 + + # C.g:94:5: ( '&&' ) + # C.g:94:7: '&&' + self.match("&&") + + + + + + + finally: + + pass + + # $ANTLR end T92 + + + + # $ANTLR start T93 + def mT93(self, ): + + try: + self.type = T93 + + # C.g:95:5: ( '|' ) + # C.g:95:7: '|' + self.match(u'|') + + + + + + finally: + + pass + + # $ANTLR end T93 + + + + # $ANTLR start T94 + def mT94(self, ): + + try: + self.type = T94 + + # C.g:96:5: ( '^' ) + # C.g:96:7: '^' + self.match(u'^') + + + + + + finally: + + pass + + # $ANTLR end T94 + + + + # $ANTLR start T95 + def mT95(self, ): + + try: + self.type = T95 + + # C.g:97:5: ( '==' ) + # C.g:97:7: '==' + self.match("==") + + + + + + + finally: + + pass + + # $ANTLR end T95 + + + + # $ANTLR start T96 + def mT96(self, ): + + try: + self.type = T96 + + # C.g:98:5: ( '!=' ) + # C.g:98:7: '!=' + self.match("!=") + + + + + + + finally: + + pass + + # $ANTLR end T96 + + + + # $ANTLR start T97 + def mT97(self, ): + + try: + self.type = T97 + + # C.g:99:5: ( '<' ) + # C.g:99:7: '<' + self.match(u'<') + + + + + + finally: + + pass + + # $ANTLR end T97 + + + + # $ANTLR start T98 + def mT98(self, ): + + try: + self.type = T98 + + # C.g:100:5: ( '>' ) + # C.g:100:7: '>' + self.match(u'>') + + + + + + finally: + + pass + + # $ANTLR end T98 + + + + # $ANTLR start T99 + def mT99(self, ): + + try: + self.type = T99 + + # C.g:101:5: ( '<=' ) + # C.g:101:7: '<=' + self.match("<=") + + + + + + + finally: + + pass + + # $ANTLR end T99 + + + + # $ANTLR start T100 + def mT100(self, ): + + try: + self.type = T100 + + # C.g:102:6: ( '>=' ) + # C.g:102:8: '>=' + self.match(">=") + + + + + + + finally: + + pass + + # $ANTLR end T100 + + + + # $ANTLR start T101 + def mT101(self, ): + + try: + self.type = T101 + + # C.g:103:6: ( '<<' ) + # C.g:103:8: '<<' + self.match("<<") + + + + + + + finally: + + pass + + # $ANTLR end T101 + + + + # $ANTLR start T102 + def mT102(self, ): + + try: + self.type = T102 + + # C.g:104:6: ( '>>' ) + # C.g:104:8: '>>' + self.match(">>") + + + + + + + finally: + + pass + + # $ANTLR end T102 + + + + # $ANTLR start T103 + def mT103(self, ): + + try: + self.type = T103 + + # C.g:105:6: ( '__asm__' ) + # C.g:105:8: '__asm__' + self.match("__asm__") + + + + + + + finally: + + pass + + # $ANTLR end T103 + + + + # $ANTLR start T104 + def mT104(self, ): + + try: + self.type = T104 + + # C.g:106:6: ( '_asm' ) + # C.g:106:8: '_asm' + self.match("_asm") + + + + + + + finally: + + pass + + # $ANTLR end T104 + + + + # $ANTLR start T105 + def mT105(self, ): + + try: + self.type = T105 + + # C.g:107:6: ( '__asm' ) + # C.g:107:8: '__asm' + self.match("__asm") + + + + + + + finally: + + pass + + # $ANTLR end T105 + + + + # $ANTLR start T106 + def mT106(self, ): + + try: + self.type = T106 + + # C.g:108:6: ( 'case' ) + # C.g:108:8: 'case' + self.match("case") + + + + + + + finally: + + pass + + # $ANTLR end T106 + + + + # $ANTLR start T107 + def mT107(self, ): + + try: + self.type = T107 + + # C.g:109:6: ( 'default' ) + # C.g:109:8: 'default' + self.match("default") + + + + + + + finally: + + pass + + # $ANTLR end T107 + + + + # $ANTLR start T108 + def mT108(self, ): + + try: + self.type = T108 + + # C.g:110:6: ( 'if' ) + # C.g:110:8: 'if' + self.match("if") + + + + + + + finally: + + pass + + # $ANTLR end T108 + + + + # $ANTLR start T109 + def mT109(self, ): + + try: + self.type = T109 + + # C.g:111:6: ( 'else' ) + # C.g:111:8: 'else' + self.match("else") + + + + + + + finally: + + pass + + # $ANTLR end T109 + + + + # $ANTLR start T110 + def mT110(self, ): + + try: + self.type = T110 + + # C.g:112:6: ( 'switch' ) + # C.g:112:8: 'switch' + self.match("switch") + + + + + + + finally: + + pass + + # $ANTLR end T110 + + + + # $ANTLR start T111 + def mT111(self, ): + + try: + self.type = T111 + + # C.g:113:6: ( 'while' ) + # C.g:113:8: 'while' + self.match("while") + + + + + + + finally: + + pass + + # $ANTLR end T111 + + + + # $ANTLR start T112 + def mT112(self, ): + + try: + self.type = T112 + + # C.g:114:6: ( 'do' ) + # C.g:114:8: 'do' + self.match("do") + + + + + + + finally: + + pass + + # $ANTLR end T112 + + + + # $ANTLR start T113 + def mT113(self, ): + + try: + self.type = T113 + + # C.g:115:6: ( 'for' ) + # C.g:115:8: 'for' + self.match("for") + + + + + + + finally: + + pass + + # $ANTLR end T113 + + + + # $ANTLR start T114 + def mT114(self, ): + + try: + self.type = T114 + + # C.g:116:6: ( 'goto' ) + # C.g:116:8: 'goto' + self.match("goto") + + + + + + + finally: + + pass + + # $ANTLR end T114 + + + + # $ANTLR start T115 + def mT115(self, ): + + try: + self.type = T115 + + # C.g:117:6: ( 'continue' ) + # C.g:117:8: 'continue' + self.match("continue") + + + + + + + finally: + + pass + + # $ANTLR end T115 + + + + # $ANTLR start T116 + def mT116(self, ): + + try: + self.type = T116 + + # C.g:118:6: ( 'break' ) + # C.g:118:8: 'break' + self.match("break") + + + + + + + finally: + + pass + + # $ANTLR end T116 + + + + # $ANTLR start T117 + def mT117(self, ): + + try: + self.type = T117 + + # C.g:119:6: ( 'return' ) + # C.g:119:8: 'return' + self.match("return") + + + + + + + finally: + + pass + + # $ANTLR end T117 + + + + # $ANTLR start IDENTIFIER + def mIDENTIFIER(self, ): + + try: + self.type = IDENTIFIER + + # C.g:586:2: ( LETTER ( LETTER | '0' .. '9' )* ) + # C.g:586:4: LETTER ( LETTER | '0' .. '9' )* + self.mLETTER() + + # C.g:586:11: ( LETTER | '0' .. '9' )* + while True: #loop1 + alt1 = 2 + LA1_0 = self.input.LA(1) + + if (LA1_0 == u'$' or (u'0' <= LA1_0 <= u'9') or (u'A' <= LA1_0 <= u'Z') or LA1_0 == u'_' or (u'a' <= LA1_0 <= u'z')) : + alt1 = 1 + + + if alt1 == 1: + # C.g: + if self.input.LA(1) == u'$' or (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + else: + break #loop1 + + + + + + + finally: + + pass + + # $ANTLR end IDENTIFIER + + + + # $ANTLR start LETTER + def mLETTER(self, ): + + try: + # C.g:591:2: ( '$' | 'A' .. 'Z' | 'a' .. 'z' | '_' ) + # C.g: + if self.input.LA(1) == u'$' or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + + finally: + + pass + + # $ANTLR end LETTER + + + + # $ANTLR start CHARACTER_LITERAL + def mCHARACTER_LITERAL(self, ): + + try: + self.type = CHARACTER_LITERAL + + # C.g:598:5: ( ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' ) + # C.g:598:9: ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' + # C.g:598:9: ( 'L' )? + alt2 = 2 + LA2_0 = self.input.LA(1) + + if (LA2_0 == u'L') : + alt2 = 1 + if alt2 == 1: + # C.g:598:10: 'L' + self.match(u'L') + + + + + self.match(u'\'') + + # C.g:598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) + alt3 = 2 + LA3_0 = self.input.LA(1) + + if (LA3_0 == u'\\') : + alt3 = 1 + elif ((u'\u0000' <= LA3_0 <= u'&') or (u'(' <= LA3_0 <= u'[') or (u']' <= LA3_0 <= u'\uFFFE')) : + alt3 = 2 + else: + nvae = NoViableAltException("598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) )", 3, 0, self.input) + + raise nvae + + if alt3 == 1: + # C.g:598:23: EscapeSequence + self.mEscapeSequence() + + + + elif alt3 == 2: + # C.g:598:40: ~ ( '\\'' | '\\\\' ) + if (u'\u0000' <= self.input.LA(1) <= u'&') or (u'(' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + self.match(u'\'') + + + + + + finally: + + pass + + # $ANTLR end CHARACTER_LITERAL + + + + # $ANTLR start STRING_LITERAL + def mSTRING_LITERAL(self, ): + + try: + self.type = STRING_LITERAL + + # C.g:602:5: ( ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) + # C.g:602:8: ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' + # C.g:602:8: ( 'L' )? + alt4 = 2 + LA4_0 = self.input.LA(1) + + if (LA4_0 == u'L') : + alt4 = 1 + if alt4 == 1: + # C.g:602:9: 'L' + self.match(u'L') + + + + + self.match(u'"') + + # C.g:602:19: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* + while True: #loop5 + alt5 = 3 + LA5_0 = self.input.LA(1) + + if (LA5_0 == u'\\') : + alt5 = 1 + elif ((u'\u0000' <= LA5_0 <= u'!') or (u'#' <= LA5_0 <= u'[') or (u']' <= LA5_0 <= u'\uFFFE')) : + alt5 = 2 + + + if alt5 == 1: + # C.g:602:21: EscapeSequence + self.mEscapeSequence() + + + + elif alt5 == 2: + # C.g:602:38: ~ ( '\\\\' | '\"' ) + if (u'\u0000' <= self.input.LA(1) <= u'!') or (u'#' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + else: + break #loop5 + + + self.match(u'"') + + + + + + finally: + + pass + + # $ANTLR end STRING_LITERAL + + + + # $ANTLR start HEX_LITERAL + def mHEX_LITERAL(self, ): + + try: + self.type = HEX_LITERAL + + # C.g:605:13: ( '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? ) + # C.g:605:15: '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? + self.match(u'0') + + if self.input.LA(1) == u'X' or self.input.LA(1) == u'x': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + # C.g:605:29: ( HexDigit )+ + cnt6 = 0 + while True: #loop6 + alt6 = 2 + LA6_0 = self.input.LA(1) + + if ((u'0' <= LA6_0 <= u'9') or (u'A' <= LA6_0 <= u'F') or (u'a' <= LA6_0 <= u'f')) : + alt6 = 1 + + + if alt6 == 1: + # C.g:605:29: HexDigit + self.mHexDigit() + + + + else: + if cnt6 >= 1: + break #loop6 + + eee = EarlyExitException(6, self.input) + raise eee + + cnt6 += 1 + + + # C.g:605:39: ( IntegerTypeSuffix )? + alt7 = 2 + LA7_0 = self.input.LA(1) + + if (LA7_0 == u'L' or LA7_0 == u'U' or LA7_0 == u'l' or LA7_0 == u'u') : + alt7 = 1 + if alt7 == 1: + # C.g:605:39: IntegerTypeSuffix + self.mIntegerTypeSuffix() + + + + + + + + + finally: + + pass + + # $ANTLR end HEX_LITERAL + + + + # $ANTLR start DECIMAL_LITERAL + def mDECIMAL_LITERAL(self, ): + + try: + self.type = DECIMAL_LITERAL + + # C.g:607:17: ( ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? ) + # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? + # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* ) + alt9 = 2 + LA9_0 = self.input.LA(1) + + if (LA9_0 == u'0') : + alt9 = 1 + elif ((u'1' <= LA9_0 <= u'9')) : + alt9 = 2 + else: + nvae = NoViableAltException("607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* )", 9, 0, self.input) + + raise nvae + + if alt9 == 1: + # C.g:607:20: '0' + self.match(u'0') + + + + elif alt9 == 2: + # C.g:607:26: '1' .. '9' ( '0' .. '9' )* + self.matchRange(u'1', u'9') + + # C.g:607:35: ( '0' .. '9' )* + while True: #loop8 + alt8 = 2 + LA8_0 = self.input.LA(1) + + if ((u'0' <= LA8_0 <= u'9')) : + alt8 = 1 + + + if alt8 == 1: + # C.g:607:35: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + break #loop8 + + + + + + # C.g:607:46: ( IntegerTypeSuffix )? + alt10 = 2 + LA10_0 = self.input.LA(1) + + if (LA10_0 == u'L' or LA10_0 == u'U' or LA10_0 == u'l' or LA10_0 == u'u') : + alt10 = 1 + if alt10 == 1: + # C.g:607:46: IntegerTypeSuffix + self.mIntegerTypeSuffix() + + + + + + + + + finally: + + pass + + # $ANTLR end DECIMAL_LITERAL + + + + # $ANTLR start OCTAL_LITERAL + def mOCTAL_LITERAL(self, ): + + try: + self.type = OCTAL_LITERAL + + # C.g:609:15: ( '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? ) + # C.g:609:17: '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? + self.match(u'0') + + # C.g:609:21: ( '0' .. '7' )+ + cnt11 = 0 + while True: #loop11 + alt11 = 2 + LA11_0 = self.input.LA(1) + + if ((u'0' <= LA11_0 <= u'7')) : + alt11 = 1 + + + if alt11 == 1: + # C.g:609:22: '0' .. '7' + self.matchRange(u'0', u'7') + + + + else: + if cnt11 >= 1: + break #loop11 + + eee = EarlyExitException(11, self.input) + raise eee + + cnt11 += 1 + + + # C.g:609:33: ( IntegerTypeSuffix )? + alt12 = 2 + LA12_0 = self.input.LA(1) + + if (LA12_0 == u'L' or LA12_0 == u'U' or LA12_0 == u'l' or LA12_0 == u'u') : + alt12 = 1 + if alt12 == 1: + # C.g:609:33: IntegerTypeSuffix + self.mIntegerTypeSuffix() + + + + + + + + + finally: + + pass + + # $ANTLR end OCTAL_LITERAL + + + + # $ANTLR start HexDigit + def mHexDigit(self, ): + + try: + # C.g:612:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) ) + # C.g:612:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) + if (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'F') or (u'a' <= self.input.LA(1) <= u'f'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + + finally: + + pass + + # $ANTLR end HexDigit + + + + # $ANTLR start IntegerTypeSuffix + def mIntegerTypeSuffix(self, ): + + try: + # C.g:616:2: ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) ) + alt13 = 4 + LA13_0 = self.input.LA(1) + + if (LA13_0 == u'U' or LA13_0 == u'u') : + LA13_1 = self.input.LA(2) + + if (LA13_1 == u'L' or LA13_1 == u'l') : + LA13_3 = self.input.LA(3) + + if (LA13_3 == u'L' or LA13_3 == u'l') : + alt13 = 4 + else: + alt13 = 3 + else: + alt13 = 1 + elif (LA13_0 == u'L' or LA13_0 == u'l') : + alt13 = 2 + else: + nvae = NoViableAltException("614:1: fragment IntegerTypeSuffix : ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) );", 13, 0, self.input) + + raise nvae + + if alt13 == 1: + # C.g:616:4: ( 'u' | 'U' ) + if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + elif alt13 == 2: + # C.g:617:4: ( 'l' | 'L' ) + if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + elif alt13 == 3: + # C.g:618:4: ( 'u' | 'U' ) ( 'l' | 'L' ) + if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + elif alt13 == 4: + # C.g:619:4: ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) + if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + finally: + + pass + + # $ANTLR end IntegerTypeSuffix + + + + # $ANTLR start FLOATING_POINT_LITERAL + def mFLOATING_POINT_LITERAL(self, ): + + try: + self.type = FLOATING_POINT_LITERAL + + # C.g:623:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? | '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix ) + alt25 = 4 + alt25 = self.dfa25.predict(self.input) + if alt25 == 1: + # C.g:623:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? + # C.g:623:9: ( '0' .. '9' )+ + cnt14 = 0 + while True: #loop14 + alt14 = 2 + LA14_0 = self.input.LA(1) + + if ((u'0' <= LA14_0 <= u'9')) : + alt14 = 1 + + + if alt14 == 1: + # C.g:623:10: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + if cnt14 >= 1: + break #loop14 + + eee = EarlyExitException(14, self.input) + raise eee + + cnt14 += 1 + + + self.match(u'.') + + # C.g:623:25: ( '0' .. '9' )* + while True: #loop15 + alt15 = 2 + LA15_0 = self.input.LA(1) + + if ((u'0' <= LA15_0 <= u'9')) : + alt15 = 1 + + + if alt15 == 1: + # C.g:623:26: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + break #loop15 + + + # C.g:623:37: ( Exponent )? + alt16 = 2 + LA16_0 = self.input.LA(1) + + if (LA16_0 == u'E' or LA16_0 == u'e') : + alt16 = 1 + if alt16 == 1: + # C.g:623:37: Exponent + self.mExponent() + + + + + # C.g:623:47: ( FloatTypeSuffix )? + alt17 = 2 + LA17_0 = self.input.LA(1) + + if (LA17_0 == u'D' or LA17_0 == u'F' or LA17_0 == u'd' or LA17_0 == u'f') : + alt17 = 1 + if alt17 == 1: + # C.g:623:47: FloatTypeSuffix + self.mFloatTypeSuffix() + + + + + + + elif alt25 == 2: + # C.g:624:9: '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? + self.match(u'.') + + # C.g:624:13: ( '0' .. '9' )+ + cnt18 = 0 + while True: #loop18 + alt18 = 2 + LA18_0 = self.input.LA(1) + + if ((u'0' <= LA18_0 <= u'9')) : + alt18 = 1 + + + if alt18 == 1: + # C.g:624:14: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + if cnt18 >= 1: + break #loop18 + + eee = EarlyExitException(18, self.input) + raise eee + + cnt18 += 1 + + + # C.g:624:25: ( Exponent )? + alt19 = 2 + LA19_0 = self.input.LA(1) + + if (LA19_0 == u'E' or LA19_0 == u'e') : + alt19 = 1 + if alt19 == 1: + # C.g:624:25: Exponent + self.mExponent() + + + + + # C.g:624:35: ( FloatTypeSuffix )? + alt20 = 2 + LA20_0 = self.input.LA(1) + + if (LA20_0 == u'D' or LA20_0 == u'F' or LA20_0 == u'd' or LA20_0 == u'f') : + alt20 = 1 + if alt20 == 1: + # C.g:624:35: FloatTypeSuffix + self.mFloatTypeSuffix() + + + + + + + elif alt25 == 3: + # C.g:625:9: ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? + # C.g:625:9: ( '0' .. '9' )+ + cnt21 = 0 + while True: #loop21 + alt21 = 2 + LA21_0 = self.input.LA(1) + + if ((u'0' <= LA21_0 <= u'9')) : + alt21 = 1 + + + if alt21 == 1: + # C.g:625:10: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + if cnt21 >= 1: + break #loop21 + + eee = EarlyExitException(21, self.input) + raise eee + + cnt21 += 1 + + + self.mExponent() + + # C.g:625:30: ( FloatTypeSuffix )? + alt22 = 2 + LA22_0 = self.input.LA(1) + + if (LA22_0 == u'D' or LA22_0 == u'F' or LA22_0 == u'd' or LA22_0 == u'f') : + alt22 = 1 + if alt22 == 1: + # C.g:625:30: FloatTypeSuffix + self.mFloatTypeSuffix() + + + + + + + elif alt25 == 4: + # C.g:626:9: ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix + # C.g:626:9: ( '0' .. '9' )+ + cnt23 = 0 + while True: #loop23 + alt23 = 2 + LA23_0 = self.input.LA(1) + + if ((u'0' <= LA23_0 <= u'9')) : + alt23 = 1 + + + if alt23 == 1: + # C.g:626:10: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + if cnt23 >= 1: + break #loop23 + + eee = EarlyExitException(23, self.input) + raise eee + + cnt23 += 1 + + + # C.g:626:21: ( Exponent )? + alt24 = 2 + LA24_0 = self.input.LA(1) + + if (LA24_0 == u'E' or LA24_0 == u'e') : + alt24 = 1 + if alt24 == 1: + # C.g:626:21: Exponent + self.mExponent() + + + + + self.mFloatTypeSuffix() + + + + + finally: + + pass + + # $ANTLR end FLOATING_POINT_LITERAL + + + + # $ANTLR start Exponent + def mExponent(self, ): + + try: + # C.g:630:10: ( ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ ) + # C.g:630:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ + if self.input.LA(1) == u'E' or self.input.LA(1) == u'e': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + # C.g:630:22: ( '+' | '-' )? + alt26 = 2 + LA26_0 = self.input.LA(1) + + if (LA26_0 == u'+' or LA26_0 == u'-') : + alt26 = 1 + if alt26 == 1: + # C.g: + if self.input.LA(1) == u'+' or self.input.LA(1) == u'-': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + # C.g:630:33: ( '0' .. '9' )+ + cnt27 = 0 + while True: #loop27 + alt27 = 2 + LA27_0 = self.input.LA(1) + + if ((u'0' <= LA27_0 <= u'9')) : + alt27 = 1 + + + if alt27 == 1: + # C.g:630:34: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + if cnt27 >= 1: + break #loop27 + + eee = EarlyExitException(27, self.input) + raise eee + + cnt27 += 1 + + + + + + + finally: + + pass + + # $ANTLR end Exponent + + + + # $ANTLR start FloatTypeSuffix + def mFloatTypeSuffix(self, ): + + try: + # C.g:633:17: ( ( 'f' | 'F' | 'd' | 'D' ) ) + # C.g:633:19: ( 'f' | 'F' | 'd' | 'D' ) + if self.input.LA(1) == u'D' or self.input.LA(1) == u'F' or self.input.LA(1) == u'd' or self.input.LA(1) == u'f': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + + finally: + + pass + + # $ANTLR end FloatTypeSuffix + + + + # $ANTLR start EscapeSequence + def mEscapeSequence(self, ): + + try: + # C.g:637:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape ) + alt28 = 2 + LA28_0 = self.input.LA(1) + + if (LA28_0 == u'\\') : + LA28_1 = self.input.LA(2) + + if (LA28_1 == u'"' or LA28_1 == u'\'' or LA28_1 == u'\\' or LA28_1 == u'b' or LA28_1 == u'f' or LA28_1 == u'n' or LA28_1 == u'r' or LA28_1 == u't') : + alt28 = 1 + elif ((u'0' <= LA28_1 <= u'7')) : + alt28 = 2 + else: + nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 1, self.input) + + raise nvae + + else: + nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 0, self.input) + + raise nvae + + if alt28 == 1: + # C.g:637:8: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) + self.match(u'\\') + + if self.input.LA(1) == u'"' or self.input.LA(1) == u'\'' or self.input.LA(1) == u'\\' or self.input.LA(1) == u'b' or self.input.LA(1) == u'f' or self.input.LA(1) == u'n' or self.input.LA(1) == u'r' or self.input.LA(1) == u't': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + elif alt28 == 2: + # C.g:638:9: OctalEscape + self.mOctalEscape() + + + + + finally: + + pass + + # $ANTLR end EscapeSequence + + + + # $ANTLR start OctalEscape + def mOctalEscape(self, ): + + try: + # C.g:643:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ) + alt29 = 3 + LA29_0 = self.input.LA(1) + + if (LA29_0 == u'\\') : + LA29_1 = self.input.LA(2) + + if ((u'0' <= LA29_1 <= u'3')) : + LA29_2 = self.input.LA(3) + + if ((u'0' <= LA29_2 <= u'7')) : + LA29_4 = self.input.LA(4) + + if ((u'0' <= LA29_4 <= u'7')) : + alt29 = 1 + else: + alt29 = 2 + else: + alt29 = 3 + elif ((u'4' <= LA29_1 <= u'7')) : + LA29_3 = self.input.LA(3) + + if ((u'0' <= LA29_3 <= u'7')) : + alt29 = 2 + else: + alt29 = 3 + else: + nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 1, self.input) + + raise nvae + + else: + nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 0, self.input) + + raise nvae + + if alt29 == 1: + # C.g:643:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) + self.match(u'\\') + + # C.g:643:14: ( '0' .. '3' ) + # C.g:643:15: '0' .. '3' + self.matchRange(u'0', u'3') + + + + + # C.g:643:25: ( '0' .. '7' ) + # C.g:643:26: '0' .. '7' + self.matchRange(u'0', u'7') + + + + + # C.g:643:36: ( '0' .. '7' ) + # C.g:643:37: '0' .. '7' + self.matchRange(u'0', u'7') + + + + + + + elif alt29 == 2: + # C.g:644:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) + self.match(u'\\') + + # C.g:644:14: ( '0' .. '7' ) + # C.g:644:15: '0' .. '7' + self.matchRange(u'0', u'7') + + + + + # C.g:644:25: ( '0' .. '7' ) + # C.g:644:26: '0' .. '7' + self.matchRange(u'0', u'7') + + + + + + + elif alt29 == 3: + # C.g:645:9: '\\\\' ( '0' .. '7' ) + self.match(u'\\') + + # C.g:645:14: ( '0' .. '7' ) + # C.g:645:15: '0' .. '7' + self.matchRange(u'0', u'7') + + + + + + + + finally: + + pass + + # $ANTLR end OctalEscape + + + + # $ANTLR start UnicodeEscape + def mUnicodeEscape(self, ): + + try: + # C.g:650:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit ) + # C.g:650:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit + self.match(u'\\') + + self.match(u'u') + + self.mHexDigit() + + self.mHexDigit() + + self.mHexDigit() + + self.mHexDigit() + + + + + + finally: + + pass + + # $ANTLR end UnicodeEscape + + + + # $ANTLR start WS + def mWS(self, ): + + try: + self.type = WS + + # C.g:653:5: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) ) + # C.g:653:8: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) + if (u'\t' <= self.input.LA(1) <= u'\n') or (u'\f' <= self.input.LA(1) <= u'\r') or self.input.LA(1) == u' ': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + #action start + self.channel=HIDDEN; + #action end + + + + + finally: + + pass + + # $ANTLR end WS + + + + # $ANTLR start BS + def mBS(self, ): + + try: + self.type = BS + + # C.g:657:5: ( ( '\\\\' ) ) + # C.g:657:7: ( '\\\\' ) + # C.g:657:7: ( '\\\\' ) + # C.g:657:8: '\\\\' + self.match(u'\\') + + + + + #action start + self.channel=HIDDEN; + #action end + + + + + finally: + + pass + + # $ANTLR end BS + + + + # $ANTLR start UnicodeVocabulary + def mUnicodeVocabulary(self, ): + + try: + self.type = UnicodeVocabulary + + # C.g:665:5: ( '\\u0003' .. '\\uFFFE' ) + # C.g:665:7: '\\u0003' .. '\\uFFFE' + self.matchRange(u'\u0003', u'\uFFFE') + + + + + + finally: + + pass + + # $ANTLR end UnicodeVocabulary + + + + # $ANTLR start COMMENT + def mCOMMENT(self, ): + + try: + self.type = COMMENT + + # C.g:668:5: ( '/*' ( options {greedy=false; } : . )* '*/' ) + # C.g:668:9: '/*' ( options {greedy=false; } : . )* '*/' + self.match("/*") + + + # C.g:668:14: ( options {greedy=false; } : . )* + while True: #loop30 + alt30 = 2 + LA30_0 = self.input.LA(1) + + if (LA30_0 == u'*') : + LA30_1 = self.input.LA(2) + + if (LA30_1 == u'/') : + alt30 = 2 + elif ((u'\u0000' <= LA30_1 <= u'.') or (u'0' <= LA30_1 <= u'\uFFFE')) : + alt30 = 1 + + + elif ((u'\u0000' <= LA30_0 <= u')') or (u'+' <= LA30_0 <= u'\uFFFE')) : + alt30 = 1 + + + if alt30 == 1: + # C.g:668:42: . + self.matchAny() + + + + else: + break #loop30 + + + self.match("*/") + + + #action start + self.channel=HIDDEN; + #action end + + + + + finally: + + pass + + # $ANTLR end COMMENT + + + + # $ANTLR start LINE_COMMENT + def mLINE_COMMENT(self, ): + + try: + self.type = LINE_COMMENT + + # C.g:673:5: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) + # C.g:673:7: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' + self.match("//") + + + # C.g:673:12: (~ ( '\\n' | '\\r' ) )* + while True: #loop31 + alt31 = 2 + LA31_0 = self.input.LA(1) + + if ((u'\u0000' <= LA31_0 <= u'\t') or (u'\u000B' <= LA31_0 <= u'\f') or (u'\u000E' <= LA31_0 <= u'\uFFFE')) : + alt31 = 1 + + + if alt31 == 1: + # C.g:673:12: ~ ( '\\n' | '\\r' ) + if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + else: + break #loop31 + + + # C.g:673:26: ( '\\r' )? + alt32 = 2 + LA32_0 = self.input.LA(1) + + if (LA32_0 == u'\r') : + alt32 = 1 + if alt32 == 1: + # C.g:673:26: '\\r' + self.match(u'\r') + + + + + self.match(u'\n') + + #action start + self.channel=HIDDEN; + #action end + + + + + finally: + + pass + + # $ANTLR end LINE_COMMENT + + + + # $ANTLR start LINE_COMMAND + def mLINE_COMMAND(self, ): + + try: + self.type = LINE_COMMAND + + # C.g:678:5: ( '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) + # C.g:678:7: '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' + self.match(u'#') + + # C.g:678:11: (~ ( '\\n' | '\\r' ) )* + while True: #loop33 + alt33 = 2 + LA33_0 = self.input.LA(1) + + if ((u'\u0000' <= LA33_0 <= u'\t') or (u'\u000B' <= LA33_0 <= u'\f') or (u'\u000E' <= LA33_0 <= u'\uFFFE')) : + alt33 = 1 + + + if alt33 == 1: + # C.g:678:11: ~ ( '\\n' | '\\r' ) + if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + else: + break #loop33 + + + # C.g:678:25: ( '\\r' )? + alt34 = 2 + LA34_0 = self.input.LA(1) + + if (LA34_0 == u'\r') : + alt34 = 1 + if alt34 == 1: + # C.g:678:25: '\\r' + self.match(u'\r') + + + + + self.match(u'\n') + + #action start + self.channel=HIDDEN; + #action end + + + + + finally: + + pass + + # $ANTLR end LINE_COMMAND + + + + def mTokens(self): + # C.g:1:8: ( T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | T41 | T42 | T43 | T44 | T45 | T46 | T47 | T48 | T49 | T50 | T51 | T52 | T53 | T54 | T55 | T56 | T57 | T58 | T59 | T60 | T61 | T62 | T63 | T64 | T65 | T66 | T67 | T68 | T69 | T70 | T71 | T72 | T73 | T74 | T75 | T76 | T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | T87 | T88 | T89 | T90 | T91 | T92 | T93 | T94 | T95 | T96 | T97 | T98 | T99 | T100 | T101 | T102 | T103 | T104 | T105 | T106 | T107 | T108 | T109 | T110 | T111 | T112 | T113 | T114 | T115 | T116 | T117 | IDENTIFIER | CHARACTER_LITERAL | STRING_LITERAL | HEX_LITERAL | DECIMAL_LITERAL | OCTAL_LITERAL | FLOATING_POINT_LITERAL | WS | BS | UnicodeVocabulary | COMMENT | LINE_COMMENT | LINE_COMMAND ) + alt35 = 106 + alt35 = self.dfa35.predict(self.input) + if alt35 == 1: + # C.g:1:10: T25 + self.mT25() + + + + elif alt35 == 2: + # C.g:1:14: T26 + self.mT26() + + + + elif alt35 == 3: + # C.g:1:18: T27 + self.mT27() + + + + elif alt35 == 4: + # C.g:1:22: T28 + self.mT28() + + + + elif alt35 == 5: + # C.g:1:26: T29 + self.mT29() + + + + elif alt35 == 6: + # C.g:1:30: T30 + self.mT30() + + + + elif alt35 == 7: + # C.g:1:34: T31 + self.mT31() + + + + elif alt35 == 8: + # C.g:1:38: T32 + self.mT32() + + + + elif alt35 == 9: + # C.g:1:42: T33 + self.mT33() + + + + elif alt35 == 10: + # C.g:1:46: T34 + self.mT34() + + + + elif alt35 == 11: + # C.g:1:50: T35 + self.mT35() + + + + elif alt35 == 12: + # C.g:1:54: T36 + self.mT36() + + + + elif alt35 == 13: + # C.g:1:58: T37 + self.mT37() + + + + elif alt35 == 14: + # C.g:1:62: T38 + self.mT38() + + + + elif alt35 == 15: + # C.g:1:66: T39 + self.mT39() + + + + elif alt35 == 16: + # C.g:1:70: T40 + self.mT40() + + + + elif alt35 == 17: + # C.g:1:74: T41 + self.mT41() + + + + elif alt35 == 18: + # C.g:1:78: T42 + self.mT42() + + + + elif alt35 == 19: + # C.g:1:82: T43 + self.mT43() + + + + elif alt35 == 20: + # C.g:1:86: T44 + self.mT44() + + + + elif alt35 == 21: + # C.g:1:90: T45 + self.mT45() + + + + elif alt35 == 22: + # C.g:1:94: T46 + self.mT46() + + + + elif alt35 == 23: + # C.g:1:98: T47 + self.mT47() + + + + elif alt35 == 24: + # C.g:1:102: T48 + self.mT48() + + + + elif alt35 == 25: + # C.g:1:106: T49 + self.mT49() + + + + elif alt35 == 26: + # C.g:1:110: T50 + self.mT50() + + + + elif alt35 == 27: + # C.g:1:114: T51 + self.mT51() + + + + elif alt35 == 28: + # C.g:1:118: T52 + self.mT52() + + + + elif alt35 == 29: + # C.g:1:122: T53 + self.mT53() + + + + elif alt35 == 30: + # C.g:1:126: T54 + self.mT54() + + + + elif alt35 == 31: + # C.g:1:130: T55 + self.mT55() + + + + elif alt35 == 32: + # C.g:1:134: T56 + self.mT56() + + + + elif alt35 == 33: + # C.g:1:138: T57 + self.mT57() + + + + elif alt35 == 34: + # C.g:1:142: T58 + self.mT58() + + + + elif alt35 == 35: + # C.g:1:146: T59 + self.mT59() + + + + elif alt35 == 36: + # C.g:1:150: T60 + self.mT60() + + + + elif alt35 == 37: + # C.g:1:154: T61 + self.mT61() + + + + elif alt35 == 38: + # C.g:1:158: T62 + self.mT62() + + + + elif alt35 == 39: + # C.g:1:162: T63 + self.mT63() + + + + elif alt35 == 40: + # C.g:1:166: T64 + self.mT64() + + + + elif alt35 == 41: + # C.g:1:170: T65 + self.mT65() + + + + elif alt35 == 42: + # C.g:1:174: T66 + self.mT66() + + + + elif alt35 == 43: + # C.g:1:178: T67 + self.mT67() + + + + elif alt35 == 44: + # C.g:1:182: T68 + self.mT68() + + + + elif alt35 == 45: + # C.g:1:186: T69 + self.mT69() + + + + elif alt35 == 46: + # C.g:1:190: T70 + self.mT70() + + + + elif alt35 == 47: + # C.g:1:194: T71 + self.mT71() + + + + elif alt35 == 48: + # C.g:1:198: T72 + self.mT72() + + + + elif alt35 == 49: + # C.g:1:202: T73 + self.mT73() + + + + elif alt35 == 50: + # C.g:1:206: T74 + self.mT74() + + + + elif alt35 == 51: + # C.g:1:210: T75 + self.mT75() + + + + elif alt35 == 52: + # C.g:1:214: T76 + self.mT76() + + + + elif alt35 == 53: + # C.g:1:218: T77 + self.mT77() + + + + elif alt35 == 54: + # C.g:1:222: T78 + self.mT78() + + + + elif alt35 == 55: + # C.g:1:226: T79 + self.mT79() + + + + elif alt35 == 56: + # C.g:1:230: T80 + self.mT80() + + + + elif alt35 == 57: + # C.g:1:234: T81 + self.mT81() + + + + elif alt35 == 58: + # C.g:1:238: T82 + self.mT82() + + + + elif alt35 == 59: + # C.g:1:242: T83 + self.mT83() + + + + elif alt35 == 60: + # C.g:1:246: T84 + self.mT84() + + + + elif alt35 == 61: + # C.g:1:250: T85 + self.mT85() + + + + elif alt35 == 62: + # C.g:1:254: T86 + self.mT86() + + + + elif alt35 == 63: + # C.g:1:258: T87 + self.mT87() + + + + elif alt35 == 64: + # C.g:1:262: T88 + self.mT88() + + + + elif alt35 == 65: + # C.g:1:266: T89 + self.mT89() + + + + elif alt35 == 66: + # C.g:1:270: T90 + self.mT90() + + + + elif alt35 == 67: + # C.g:1:274: T91 + self.mT91() + + + + elif alt35 == 68: + # C.g:1:278: T92 + self.mT92() + + + + elif alt35 == 69: + # C.g:1:282: T93 + self.mT93() + + + + elif alt35 == 70: + # C.g:1:286: T94 + self.mT94() + + + + elif alt35 == 71: + # C.g:1:290: T95 + self.mT95() + + + + elif alt35 == 72: + # C.g:1:294: T96 + self.mT96() + + + + elif alt35 == 73: + # C.g:1:298: T97 + self.mT97() + + + + elif alt35 == 74: + # C.g:1:302: T98 + self.mT98() + + + + elif alt35 == 75: + # C.g:1:306: T99 + self.mT99() + + + + elif alt35 == 76: + # C.g:1:310: T100 + self.mT100() + + + + elif alt35 == 77: + # C.g:1:315: T101 + self.mT101() + + + + elif alt35 == 78: + # C.g:1:320: T102 + self.mT102() + + + + elif alt35 == 79: + # C.g:1:325: T103 + self.mT103() + + + + elif alt35 == 80: + # C.g:1:330: T104 + self.mT104() + + + + elif alt35 == 81: + # C.g:1:335: T105 + self.mT105() + + + + elif alt35 == 82: + # C.g:1:340: T106 + self.mT106() + + + + elif alt35 == 83: + # C.g:1:345: T107 + self.mT107() + + + + elif alt35 == 84: + # C.g:1:350: T108 + self.mT108() + + + + elif alt35 == 85: + # C.g:1:355: T109 + self.mT109() + + + + elif alt35 == 86: + # C.g:1:360: T110 + self.mT110() + + + + elif alt35 == 87: + # C.g:1:365: T111 + self.mT111() + + + + elif alt35 == 88: + # C.g:1:370: T112 + self.mT112() + + + + elif alt35 == 89: + # C.g:1:375: T113 + self.mT113() + + + + elif alt35 == 90: + # C.g:1:380: T114 + self.mT114() + + + + elif alt35 == 91: + # C.g:1:385: T115 + self.mT115() + + + + elif alt35 == 92: + # C.g:1:390: T116 + self.mT116() + + + + elif alt35 == 93: + # C.g:1:395: T117 + self.mT117() + + + + elif alt35 == 94: + # C.g:1:400: IDENTIFIER + self.mIDENTIFIER() + + + + elif alt35 == 95: + # C.g:1:411: CHARACTER_LITERAL + self.mCHARACTER_LITERAL() + + + + elif alt35 == 96: + # C.g:1:429: STRING_LITERAL + self.mSTRING_LITERAL() + + + + elif alt35 == 97: + # C.g:1:444: HEX_LITERAL + self.mHEX_LITERAL() + + + + elif alt35 == 98: + # C.g:1:456: DECIMAL_LITERAL + self.mDECIMAL_LITERAL() + + + + elif alt35 == 99: + # C.g:1:472: OCTAL_LITERAL + self.mOCTAL_LITERAL() + + + + elif alt35 == 100: + # C.g:1:486: FLOATING_POINT_LITERAL + self.mFLOATING_POINT_LITERAL() + + + + elif alt35 == 101: + # C.g:1:509: WS + self.mWS() + + + + elif alt35 == 102: + # C.g:1:512: BS + self.mBS() + + + + elif alt35 == 103: + # C.g:1:515: UnicodeVocabulary + self.mUnicodeVocabulary() + + + + elif alt35 == 104: + # C.g:1:533: COMMENT + self.mCOMMENT() + + + + elif alt35 == 105: + # C.g:1:541: LINE_COMMENT + self.mLINE_COMMENT() + + + + elif alt35 == 106: + # C.g:1:554: LINE_COMMAND + self.mLINE_COMMAND() + + + + + + + + + # lookup tables for DFA #25 + + DFA25_eot = DFA.unpack( + u"\7\uffff\1\10\2\uffff" + ) + + DFA25_eof = DFA.unpack( + u"\12\uffff" + ) + + DFA25_min = DFA.unpack( + u"\2\56\2\uffff\1\53\1\uffff\2\60\2\uffff" + ) + + DFA25_max = DFA.unpack( + u"\1\71\1\146\2\uffff\1\71\1\uffff\1\71\1\146\2\uffff" + ) + + DFA25_accept = DFA.unpack( + u"\2\uffff\1\2\1\1\1\uffff\1\4\2\uffff\2\3" + ) + + DFA25_special = DFA.unpack( + u"\12\uffff" + ) + + + DFA25_transition = [ + DFA.unpack(u"\1\2\1\uffff\12\1"), + DFA.unpack(u"\1\3\1\uffff\12\1\12\uffff\1\5\1\4\1\5\35\uffff\1\5" + u"\1\4\1\5"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\6\1\uffff\1\6\2\uffff\12\7"), + DFA.unpack(u""), + DFA.unpack(u"\12\7"), + DFA.unpack(u"\12\7\12\uffff\1\11\1\uffff\1\11\35\uffff\1\11\1\uffff" + u"\1\11"), + DFA.unpack(u""), + DFA.unpack(u"") + ] + + # class definition for DFA #25 + + DFA25 = DFA + # lookup tables for DFA #35 + + DFA35_eot = DFA.unpack( + u"\2\uffff\1\76\1\uffff\1\101\14\76\3\uffff\10\76\4\uffff\1\151\1" + u"\153\1\157\1\163\1\167\1\171\1\174\1\uffff\1\177\1\u0082\1\u0085" + u"\1\u0087\1\u008a\1\uffff\5\76\1\uffff\2\73\2\u0095\2\uffff\1\73" + u"\2\uffff\1\76\4\uffff\16\76\1\u00ad\5\76\1\u00b4\1\76\3\uffff\1" + u"\u00b7\10\76\34\uffff\1\u00c1\2\uffff\1\u00c3\10\uffff\5\76\3\uffff" + u"\1\u00c9\1\uffff\1\u0095\3\uffff\23\76\1\uffff\1\u00de\1\76\1\u00e0" + u"\3\76\1\uffff\2\76\1\uffff\1\76\1\u00e7\6\76\4\uffff\5\76\1\uffff" + u"\1\76\1\u00f5\1\76\1\u00f7\6\76\1\u00fe\4\76\1\u0103\1\u0104\2" + u"\76\1\u0107\1\uffff\1\u0108\1\uffff\6\76\1\uffff\10\76\1\u0118" + u"\1\76\1\u011a\2\76\1\uffff\1\76\1\uffff\5\76\1\u0123\1\uffff\4" + u"\76\2\uffff\1\76\1\u0129\2\uffff\1\u012a\3\76\1\u012e\1\76\1\u0130" + u"\7\76\1\u0139\1\uffff\1\u013a\1\uffff\1\u013b\1\76\1\u013d\1\u013e" + u"\1\u013f\1\u0140\1\u0141\1\u0142\1\uffff\1\76\1\u0144\1\u0145\2" + u"\76\2\uffff\1\76\1\u0149\1\76\1\uffff\1\76\1\uffff\5\76\1\u0151" + u"\1\u0152\1\76\3\uffff\1\u0154\6\uffff\1\76\2\uffff\2\76\1\u0158" + u"\1\uffff\7\76\2\uffff\1\u0160\1\uffff\1\u0161\1\u0162\1\u0163\1" + u"\uffff\1\u0164\1\u0165\1\76\1\u0167\3\76\6\uffff\1\u016b\1\uffff" + u"\3\76\1\uffff\21\76\1\u0180\2\76\1\uffff\3\76\1\u0186\1\76\1\uffff" + u"\11\76\1\u0191\1\uffff" + ) + + DFA35_eof = DFA.unpack( + u"\u0192\uffff" + ) + + DFA35_min = DFA.unpack( + u"\1\3\1\uffff\1\171\1\uffff\1\75\1\154\1\150\1\165\1\145\1\124\1" + u"\157\1\141\1\146\1\157\1\154\1\145\1\156\3\uffff\1\116\1\120\1" + u"\117\1\116\1\117\1\114\1\106\1\101\4\uffff\1\75\1\56\1\53\1\55" + u"\1\52\1\75\1\46\1\uffff\1\75\1\74\3\75\1\uffff\1\137\1\150\1\157" + u"\1\162\1\42\1\uffff\2\0\2\56\2\uffff\1\0\2\uffff\1\160\4\uffff" + u"\1\163\1\164\1\165\1\151\1\141\1\147\1\157\1\164\1\147\1\101\1" + u"\151\1\163\1\156\1\141\1\44\1\164\1\156\1\162\1\157\1\146\1\44" + u"\1\151\3\uffff\1\44\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34" + u"\uffff\1\75\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145" + u"\3\uffff\1\56\1\uffff\1\56\3\uffff\3\145\1\155\2\164\1\165\1\145" + u"\1\156\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\163\1" + u"\162\1\uffff\1\44\1\147\1\44\2\141\1\142\1\uffff\1\151\1\157\1" + u"\uffff\1\111\1\44\1\123\1\114\1\101\1\102\1\101\1\113\4\uffff\1" + u"\163\1\155\1\154\1\157\1\141\1\uffff\1\144\1\44\1\162\1\44\1\143" + u"\1\151\1\143\1\157\1\145\1\164\1\44\1\163\1\162\1\111\1\164\2\44" + u"\1\151\1\164\1\44\1\uffff\1\44\1\uffff\1\164\1\165\1\154\1\147" + u"\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\102\1\120\1\105" + u"\1\155\1\44\1\145\1\44\1\153\1\145\1\uffff\1\156\1\uffff\1\150" + u"\1\143\1\164\1\146\1\144\1\44\1\uffff\1\164\1\156\1\103\1\151\2" + u"\uffff\1\156\1\44\2\uffff\1\44\1\154\1\145\1\156\1\44\1\116\1\44" + u"\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\44\1\uffff\1\44\1" + u"\uffff\1\44\1\146\6\44\1\uffff\1\145\2\44\1\154\1\165\2\uffff\1" + u"\164\1\44\1\145\1\uffff\1\101\1\uffff\1\116\1\114\1\137\1\116\1" + u"\117\2\44\1\137\3\uffff\1\44\6\uffff\1\162\2\uffff\2\145\1\44\1" + u"\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff\1\44\1\uffff\3\44" + u"\1\uffff\2\44\1\104\1\44\1\105\1\111\1\123\6\uffff\1\44\1\uffff" + u"\2\115\1\105\1\uffff\1\117\1\105\1\122\1\126\1\123\1\126\2\105" + u"\1\111\1\137\1\122\1\103\1\111\1\126\1\105\1\106\1\111\1\44\1\137" + u"\1\103\1\uffff\1\125\1\105\1\116\1\44\1\122\1\uffff\1\105\1\106" + u"\1\105\1\122\1\105\1\116\1\103\1\105\1\104\1\44\1\uffff" + ) + + DFA35_max = DFA.unpack( + u"\1\ufffe\1\uffff\1\171\1\uffff\1\75\1\170\1\167\1\165\1\145\1\124" + u"\2\157\1\156\3\157\1\156\3\uffff\1\116\1\125\1\117\1\116\1\117" + u"\1\114\1\106\1\101\4\uffff\1\75\1\71\1\75\1\76\3\75\1\uffff\2\75" + u"\1\76\1\75\1\174\1\uffff\1\141\1\150\1\157\1\162\1\47\1\uffff\2" + u"\ufffe\1\170\1\146\2\uffff\1\ufffe\2\uffff\1\160\4\uffff\1\163" + u"\1\164\1\165\1\151\1\162\1\172\1\157\2\164\1\101\1\154\1\163\1" + u"\156\1\141\1\172\1\164\1\156\1\162\1\157\1\146\1\172\1\163\3\uffff" + u"\1\172\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34\uffff\1\75" + u"\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145\3\uffff\1" + u"\146\1\uffff\1\146\3\uffff\3\145\1\155\2\164\1\165\1\145\1\156" + u"\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\164\1\162\1" + u"\uffff\1\172\1\147\1\172\2\141\1\142\1\uffff\1\151\1\157\1\uffff" + u"\1\111\1\172\1\123\1\114\1\101\1\102\1\137\1\113\4\uffff\1\163" + u"\1\155\1\154\1\157\1\141\1\uffff\1\144\1\172\1\162\1\172\1\143" + u"\1\151\1\143\1\157\1\145\1\164\1\172\1\163\1\162\1\111\1\164\2" + u"\172\1\151\1\164\1\172\1\uffff\1\172\1\uffff\1\164\1\165\1\154" + u"\1\147\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\122\1\120" + u"\1\105\1\155\1\172\1\145\1\172\1\153\1\145\1\uffff\1\156\1\uffff" + u"\1\150\1\143\1\164\1\146\1\144\1\172\1\uffff\1\164\1\156\1\103" + u"\1\151\2\uffff\1\156\1\172\2\uffff\1\172\1\154\1\145\1\156\1\172" + u"\1\116\1\172\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\172\1" + u"\uffff\1\172\1\uffff\1\172\1\146\6\172\1\uffff\1\145\2\172\1\154" + u"\1\165\2\uffff\1\164\1\172\1\145\1\uffff\1\101\1\uffff\1\116\1" + u"\114\1\137\1\116\1\117\2\172\1\137\3\uffff\1\172\6\uffff\1\162" + u"\2\uffff\2\145\1\172\1\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff" + u"\1\172\1\uffff\3\172\1\uffff\2\172\1\104\1\172\1\105\1\111\1\123" + u"\6\uffff\1\172\1\uffff\2\115\1\105\1\uffff\1\117\1\105\1\122\1" + u"\126\1\123\1\126\2\105\1\111\1\137\1\122\1\103\1\111\1\126\1\105" + u"\1\106\1\111\1\172\1\137\1\103\1\uffff\1\125\1\105\1\116\1\172" + u"\1\122\1\uffff\1\105\1\106\1\105\1\122\1\105\1\116\1\103\1\105" + u"\1\104\1\172\1\uffff" + ) + + DFA35_accept = DFA.unpack( + u"\1\uffff\1\1\1\uffff\1\3\15\uffff\1\23\1\24\1\27\10\uffff\1\46" + u"\1\47\1\50\1\51\7\uffff\1\66\5\uffff\1\102\5\uffff\1\136\4\uffff" + u"\1\145\1\146\1\uffff\1\147\1\1\1\uffff\1\136\1\3\1\107\1\4\26\uffff" + u"\1\23\1\24\1\27\11\uffff\1\46\1\47\1\50\1\51\1\70\1\52\1\53\1\63" + u"\1\144\1\73\1\60\1\54\1\74\1\64\1\61\1\55\1\150\1\151\1\71\1\56" + u"\1\72\1\57\1\77\1\104\1\65\1\66\1\110\1\67\1\uffff\1\113\1\111" + u"\1\uffff\1\114\1\112\1\100\1\106\1\103\1\101\1\105\1\102\5\uffff" + u"\1\140\1\137\1\141\1\uffff\1\142\1\uffff\1\145\1\146\1\152\23\uffff" + u"\1\124\6\uffff\1\130\2\uffff\1\33\10\uffff\1\75\1\115\1\76\1\116" + u"\5\uffff\1\143\24\uffff\1\15\1\uffff\1\131\6\uffff\1\34\15\uffff" + u"\1\125\1\uffff\1\30\6\uffff\1\7\4\uffff\1\12\1\122\2\uffff\1\13" + u"\1\16\17\uffff\1\120\1\uffff\1\132\10\uffff\1\14\5\uffff\1\31\1" + u"\17\3\uffff\1\26\1\uffff\1\36\10\uffff\1\121\1\127\1\134\1\uffff" + u"\1\5\1\126\1\6\1\25\1\62\1\21\1\uffff\1\135\1\11\3\uffff\1\20\7" + u"\uffff\1\42\1\45\1\uffff\1\2\3\uffff\1\123\7\uffff\1\117\1\10\1" + u"\32\1\133\1\22\1\35\1\uffff\1\40\3\uffff\1\37\24\uffff\1\43\5\uffff" + u"\1\44\12\uffff\1\41" + ) + + DFA35_special = DFA.unpack( + u"\u0192\uffff" + ) + + + DFA35_transition = [ + DFA.unpack(u"\6\73\2\70\1\73\2\70\22\73\1\70\1\50\1\65\1\72\1\63" + u"\1\45\1\46\1\64\1\34\1\35\1\40\1\42\1\3\1\43\1\41\1\44\1\66\11" + u"\67\1\23\1\1\1\51\1\4\1\52\1\55\1\73\2\63\1\26\1\63\1\32\1\63\1" + u"\31\1\63\1\24\2\63\1\62\2\63\1\25\1\33\2\63\1\11\1\63\1\27\1\30" + u"\4\63\1\36\1\71\1\37\1\53\1\56\1\73\1\7\1\61\1\13\1\17\1\5\1\16" + u"\1\60\1\63\1\14\2\63\1\15\5\63\1\10\1\6\1\2\1\20\1\12\1\57\3\63" + u"\1\21\1\54\1\22\1\47\uff80\73"), + DFA.unpack(u""), + DFA.unpack(u"\1\75"), + DFA.unpack(u""), + DFA.unpack(u"\1\100"), + DFA.unpack(u"\1\102\1\uffff\1\104\11\uffff\1\103"), + DFA.unpack(u"\1\110\1\107\12\uffff\1\106\2\uffff\1\105"), + DFA.unpack(u"\1\111"), + DFA.unpack(u"\1\112"), + DFA.unpack(u"\1\113"), + DFA.unpack(u"\1\114"), + DFA.unpack(u"\1\115\6\uffff\1\117\6\uffff\1\116"), + DFA.unpack(u"\1\120\7\uffff\1\121"), + DFA.unpack(u"\1\122"), + DFA.unpack(u"\1\124\2\uffff\1\123"), + DFA.unpack(u"\1\125\11\uffff\1\126"), + DFA.unpack(u"\1\127"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\133"), + DFA.unpack(u"\1\134\4\uffff\1\135"), + DFA.unpack(u"\1\136"), + DFA.unpack(u"\1\137"), + DFA.unpack(u"\1\140"), + DFA.unpack(u"\1\141"), + DFA.unpack(u"\1\142"), + DFA.unpack(u"\1\143"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\150"), + DFA.unpack(u"\1\152\1\uffff\12\154"), + DFA.unpack(u"\1\156\21\uffff\1\155"), + DFA.unpack(u"\1\162\17\uffff\1\160\1\161"), + DFA.unpack(u"\1\164\4\uffff\1\165\15\uffff\1\166"), + DFA.unpack(u"\1\170"), + DFA.unpack(u"\1\173\26\uffff\1\172"), + DFA.unpack(u""), + DFA.unpack(u"\1\176"), + DFA.unpack(u"\1\u0080\1\u0081"), + DFA.unpack(u"\1\u0084\1\u0083"), + DFA.unpack(u"\1\u0086"), + DFA.unpack(u"\1\u0089\76\uffff\1\u0088"), + DFA.unpack(u""), + DFA.unpack(u"\1\u008c\1\uffff\1\u008d"), + DFA.unpack(u"\1\u008e"), + DFA.unpack(u"\1\u008f"), + DFA.unpack(u"\1\u0090"), + DFA.unpack(u"\1\u0091\4\uffff\1\u0092"), + DFA.unpack(u""), + DFA.unpack(u"\47\u0092\1\uffff\uffd7\u0092"), + DFA.unpack(u"\uffff\u0091"), + DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\21\uffff" + u"\1\u0093\13\uffff\3\154\21\uffff\1\u0093"), + DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\uffff\u0099"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u009a"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u009b"), + DFA.unpack(u"\1\u009c"), + DFA.unpack(u"\1\u009d"), + DFA.unpack(u"\1\u009e"), + DFA.unpack(u"\1\u009f\20\uffff\1\u00a0"), + DFA.unpack(u"\1\u00a2\22\uffff\1\u00a1"), + DFA.unpack(u"\1\u00a3"), + DFA.unpack(u"\1\u00a4"), + DFA.unpack(u"\1\u00a5\14\uffff\1\u00a6"), + DFA.unpack(u"\1\u00a7"), + DFA.unpack(u"\1\u00a9\2\uffff\1\u00a8"), + DFA.unpack(u"\1\u00aa"), + DFA.unpack(u"\1\u00ab"), + DFA.unpack(u"\1\u00ac"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00ae"), + DFA.unpack(u"\1\u00af"), + DFA.unpack(u"\1\u00b0"), + DFA.unpack(u"\1\u00b1"), + DFA.unpack(u"\1\u00b2"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\24\76\1\u00b3\5\76"), + DFA.unpack(u"\1\u00b6\11\uffff\1\u00b5"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00b8"), + DFA.unpack(u"\1\u00b9"), + DFA.unpack(u"\1\u00ba"), + DFA.unpack(u"\1\u00bb"), + DFA.unpack(u"\1\u00bc"), + DFA.unpack(u"\1\u00bd"), + DFA.unpack(u"\1\u00be"), + DFA.unpack(u"\1\u00bf"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u00c0"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u00c2"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u00c4"), + DFA.unpack(u"\1\u00c5"), + DFA.unpack(u"\1\u00c6"), + DFA.unpack(u"\1\u00c7"), + DFA.unpack(u"\1\u00c8"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\35\uffff" + u"\3\154"), + DFA.unpack(u""), + DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u00ca"), + DFA.unpack(u"\1\u00cb"), + DFA.unpack(u"\1\u00cc"), + DFA.unpack(u"\1\u00cd"), + DFA.unpack(u"\1\u00ce"), + DFA.unpack(u"\1\u00cf"), + DFA.unpack(u"\1\u00d0"), + DFA.unpack(u"\1\u00d1"), + DFA.unpack(u"\1\u00d2"), + DFA.unpack(u"\1\u00d3"), + DFA.unpack(u"\1\u00d4"), + DFA.unpack(u"\1\u00d5"), + DFA.unpack(u"\1\u00d6"), + DFA.unpack(u"\1\u00d7"), + DFA.unpack(u"\1\u00d8"), + DFA.unpack(u"\1\u00d9"), + DFA.unpack(u"\1\u00da"), + DFA.unpack(u"\1\u00dc\1\u00db"), + DFA.unpack(u"\1\u00dd"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00df"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00e1"), + DFA.unpack(u"\1\u00e2"), + DFA.unpack(u"\1\u00e3"), + DFA.unpack(u""), + DFA.unpack(u"\1\u00e4"), + DFA.unpack(u"\1\u00e5"), + DFA.unpack(u""), + DFA.unpack(u"\1\u00e6"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00e8"), + DFA.unpack(u"\1\u00e9"), + DFA.unpack(u"\1\u00ea"), + DFA.unpack(u"\1\u00eb"), + DFA.unpack(u"\1\u00ed\35\uffff\1\u00ec"), + DFA.unpack(u"\1\u00ee"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u00ef"), + DFA.unpack(u"\1\u00f0"), + DFA.unpack(u"\1\u00f1"), + DFA.unpack(u"\1\u00f2"), + DFA.unpack(u"\1\u00f3"), + DFA.unpack(u""), + DFA.unpack(u"\1\u00f4"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00f6"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00f8"), + DFA.unpack(u"\1\u00f9"), + DFA.unpack(u"\1\u00fa"), + DFA.unpack(u"\1\u00fb"), + DFA.unpack(u"\1\u00fc"), + DFA.unpack(u"\1\u00fd"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00ff"), + DFA.unpack(u"\1\u0100"), + DFA.unpack(u"\1\u0101"), + DFA.unpack(u"\1\u0102"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0105"), + DFA.unpack(u"\1\u0106"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0109"), + DFA.unpack(u"\1\u010a"), + DFA.unpack(u"\1\u010b"), + DFA.unpack(u"\1\u010c"), + DFA.unpack(u"\1\u010d"), + DFA.unpack(u"\1\u010e"), + DFA.unpack(u""), + DFA.unpack(u"\1\u010f"), + DFA.unpack(u"\1\u0110"), + DFA.unpack(u"\1\u0111"), + DFA.unpack(u"\1\u0112"), + DFA.unpack(u"\1\u0114\17\uffff\1\u0113"), + DFA.unpack(u"\1\u0115"), + DFA.unpack(u"\1\u0116"), + DFA.unpack(u"\1\u0117"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0119"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u011b"), + DFA.unpack(u"\1\u011c"), + DFA.unpack(u""), + DFA.unpack(u"\1\u011d"), + DFA.unpack(u""), + DFA.unpack(u"\1\u011e"), + DFA.unpack(u"\1\u011f"), + DFA.unpack(u"\1\u0120"), + DFA.unpack(u"\1\u0121"), + DFA.unpack(u"\1\u0122"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0124"), + DFA.unpack(u"\1\u0125"), + DFA.unpack(u"\1\u0126"), + DFA.unpack(u"\1\u0127"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u0128"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u012b"), + DFA.unpack(u"\1\u012c"), + DFA.unpack(u"\1\u012d"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u012f"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0131"), + DFA.unpack(u"\1\u0132"), + DFA.unpack(u"\1\u0133"), + DFA.unpack(u"\1\u0134"), + DFA.unpack(u"\1\u0135"), + DFA.unpack(u"\1\u0136"), + DFA.unpack(u"\1\u0137"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\u0138\1" + u"\uffff\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u013c"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0143"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0146"), + DFA.unpack(u"\1\u0147"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u0148"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u014a"), + DFA.unpack(u""), + DFA.unpack(u"\1\u014b"), + DFA.unpack(u""), + DFA.unpack(u"\1\u014c"), + DFA.unpack(u"\1\u014d"), + DFA.unpack(u"\1\u014e"), + DFA.unpack(u"\1\u014f"), + DFA.unpack(u"\1\u0150"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0153"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u0155"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u0156"), + DFA.unpack(u"\1\u0157"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0159"), + DFA.unpack(u"\1\u015a"), + DFA.unpack(u"\1\u015b"), + DFA.unpack(u"\1\u015c"), + DFA.unpack(u"\1\u015d"), + DFA.unpack(u"\1\u015e"), + DFA.unpack(u"\1\u015f"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0166"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0168"), + DFA.unpack(u"\1\u0169"), + DFA.unpack(u"\1\u016a"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\u016c"), + DFA.unpack(u"\1\u016d"), + DFA.unpack(u"\1\u016e"), + DFA.unpack(u""), + DFA.unpack(u"\1\u016f"), + DFA.unpack(u"\1\u0170"), + DFA.unpack(u"\1\u0171"), + DFA.unpack(u"\1\u0172"), + DFA.unpack(u"\1\u0173"), + DFA.unpack(u"\1\u0174"), + DFA.unpack(u"\1\u0175"), + DFA.unpack(u"\1\u0176"), + DFA.unpack(u"\1\u0177"), + DFA.unpack(u"\1\u0178"), + DFA.unpack(u"\1\u0179"), + DFA.unpack(u"\1\u017a"), + DFA.unpack(u"\1\u017b"), + DFA.unpack(u"\1\u017c"), + DFA.unpack(u"\1\u017d"), + DFA.unpack(u"\1\u017e"), + DFA.unpack(u"\1\u017f"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0181"), + DFA.unpack(u"\1\u0182"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0183"), + DFA.unpack(u"\1\u0184"), + DFA.unpack(u"\1\u0185"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0187"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0188"), + DFA.unpack(u"\1\u0189"), + DFA.unpack(u"\1\u018a"), + DFA.unpack(u"\1\u018b"), + DFA.unpack(u"\1\u018c"), + DFA.unpack(u"\1\u018d"), + DFA.unpack(u"\1\u018e"), + DFA.unpack(u"\1\u018f"), + DFA.unpack(u"\1\u0190"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"") + ] + + # class definition for DFA #35 + + DFA35 = DFA + + diff --git a/BaseTools/Source/Python/Ecc/CParser.py b/BaseTools/Source/Python/Ecc/CParser.py index 511d429f26..baa521f43c 100644 --- a/BaseTools/Source/Python/Ecc/CParser.py +++ b/BaseTools/Source/Python/Ecc/CParser.py @@ -1,7 +1,7 @@ -# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53 - -from antlr3 import * -from antlr3.compat import set, frozenset +# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53 + +from antlr3 import * +from antlr3.compat import set, frozenset ## @file # The file defines the parser for C source files. @@ -24,88 +24,88 @@ from antlr3.compat import set, frozenset import CodeFragment import FileProfile - - - -# for convenience in actions -HIDDEN = BaseRecognizer.HIDDEN - -# token types -BS=20 -LINE_COMMENT=23 -FloatTypeSuffix=16 -IntegerTypeSuffix=14 -LETTER=11 -OCTAL_LITERAL=6 -CHARACTER_LITERAL=8 -Exponent=15 -EOF=-1 -HexDigit=13 -STRING_LITERAL=9 -WS=19 -FLOATING_POINT_LITERAL=10 -IDENTIFIER=4 -UnicodeEscape=18 -LINE_COMMAND=24 -UnicodeVocabulary=21 -HEX_LITERAL=5 -COMMENT=22 -DECIMAL_LITERAL=7 -EscapeSequence=12 -OctalEscape=17 - -# token names -tokenNames = [ - "", "", "", "", - "IDENTIFIER", "HEX_LITERAL", "OCTAL_LITERAL", "DECIMAL_LITERAL", "CHARACTER_LITERAL", - "STRING_LITERAL", "FLOATING_POINT_LITERAL", "LETTER", "EscapeSequence", - "HexDigit", "IntegerTypeSuffix", "Exponent", "FloatTypeSuffix", "OctalEscape", - "UnicodeEscape", "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT", - "LINE_COMMAND", "';'", "'typedef'", "','", "'='", "'extern'", "'static'", - "'auto'", "'register'", "'STATIC'", "'void'", "'char'", "'short'", "'int'", - "'long'", "'float'", "'double'", "'signed'", "'unsigned'", "'{'", "'}'", - "'struct'", "'union'", "':'", "'enum'", "'const'", "'volatile'", "'IN'", - "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'", "'VOLATILE'", "'GLOBAL_REMOVE_IF_UNREFERENCED'", - "'EFIAPI'", "'EFI_BOOTSERVICE'", "'EFI_RUNTIMESERVICE'", "'PACKED'", - "'('", "')'", "'['", "']'", "'*'", "'...'", "'+'", "'-'", "'/'", "'%'", - "'++'", "'--'", "'sizeof'", "'.'", "'->'", "'&'", "'~'", "'!'", "'*='", - "'/='", "'%='", "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='", - "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='", "'<'", "'>'", "'<='", - "'>='", "'<<'", "'>>'", "'__asm__'", "'_asm'", "'__asm'", "'case'", - "'default'", "'if'", "'else'", "'switch'", "'while'", "'do'", "'for'", - "'goto'", "'continue'", "'break'", "'return'" -] - - -class function_definition_scope(object): - def __init__(self): - self.ModifierText = None - self.DeclText = None - self.LBLine = None - self.LBOffset = None - self.DeclLine = None - self.DeclOffset = None -class postfix_expression_scope(object): - def __init__(self): - self.FuncCallText = None - - -class CParser(Parser): - grammarFileName = "C.g" - tokenNames = tokenNames - - def __init__(self, input): - Parser.__init__(self, input) - self.ruleMemo = {} - - self.function_definition_stack = [] - self.postfix_expression_stack = [] - - - - - - + + + +# for convenience in actions +HIDDEN = BaseRecognizer.HIDDEN + +# token types +BS=20 +LINE_COMMENT=23 +FloatTypeSuffix=16 +IntegerTypeSuffix=14 +LETTER=11 +OCTAL_LITERAL=6 +CHARACTER_LITERAL=8 +Exponent=15 +EOF=-1 +HexDigit=13 +STRING_LITERAL=9 +WS=19 +FLOATING_POINT_LITERAL=10 +IDENTIFIER=4 +UnicodeEscape=18 +LINE_COMMAND=24 +UnicodeVocabulary=21 +HEX_LITERAL=5 +COMMENT=22 +DECIMAL_LITERAL=7 +EscapeSequence=12 +OctalEscape=17 + +# token names +tokenNames = [ + "", "", "", "", + "IDENTIFIER", "HEX_LITERAL", "OCTAL_LITERAL", "DECIMAL_LITERAL", "CHARACTER_LITERAL", + "STRING_LITERAL", "FLOATING_POINT_LITERAL", "LETTER", "EscapeSequence", + "HexDigit", "IntegerTypeSuffix", "Exponent", "FloatTypeSuffix", "OctalEscape", + "UnicodeEscape", "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT", + "LINE_COMMAND", "';'", "'typedef'", "','", "'='", "'extern'", "'static'", + "'auto'", "'register'", "'STATIC'", "'void'", "'char'", "'short'", "'int'", + "'long'", "'float'", "'double'", "'signed'", "'unsigned'", "'{'", "'}'", + "'struct'", "'union'", "':'", "'enum'", "'const'", "'volatile'", "'IN'", + "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'", "'VOLATILE'", "'GLOBAL_REMOVE_IF_UNREFERENCED'", + "'EFIAPI'", "'EFI_BOOTSERVICE'", "'EFI_RUNTIMESERVICE'", "'PACKED'", + "'('", "')'", "'['", "']'", "'*'", "'...'", "'+'", "'-'", "'/'", "'%'", + "'++'", "'--'", "'sizeof'", "'.'", "'->'", "'&'", "'~'", "'!'", "'*='", + "'/='", "'%='", "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='", + "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='", "'<'", "'>'", "'<='", + "'>='", "'<<'", "'>>'", "'__asm__'", "'_asm'", "'__asm'", "'case'", + "'default'", "'if'", "'else'", "'switch'", "'while'", "'do'", "'for'", + "'goto'", "'continue'", "'break'", "'return'" +] + + +class function_definition_scope(object): + def __init__(self): + self.ModifierText = None + self.DeclText = None + self.LBLine = None + self.LBOffset = None + self.DeclLine = None + self.DeclOffset = None +class postfix_expression_scope(object): + def __init__(self): + self.FuncCallText = None + + +class CParser(Parser): + grammarFileName = "C.g" + tokenNames = tokenNames + + def __init__(self, input): + Parser.__init__(self, input) + self.ruleMemo = {} + + self.function_definition_stack = [] + self.postfix_expression_stack = [] + + + + + + def printTokenInfo(self, line, offset, tokenText): @@ -139,442 +139,442 @@ class CParser(Parser): FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset)) FileProfile.FunctionCallingList.append(FuncCall) - - - - # $ANTLR start translation_unit - # C.g:102:1: translation_unit : ( external_declaration )* ; - def translation_unit(self, ): - - translation_unit_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 1): - return - - # C.g:103:2: ( ( external_declaration )* ) - # C.g:103:4: ( external_declaration )* - # C.g:103:4: ( external_declaration )* - while True: #loop1 - alt1 = 2 - LA1_0 = self.input.LA(1) - - if (LA1_0 == IDENTIFIER or LA1_0 == 26 or (29 <= LA1_0 <= 42) or (45 <= LA1_0 <= 46) or (48 <= LA1_0 <= 62) or LA1_0 == 66) : - alt1 = 1 - - - if alt1 == 1: - # C.g:0:0: external_declaration - self.following.append(self.FOLLOW_external_declaration_in_translation_unit74) - self.external_declaration() - self.following.pop() - if self.failed: - return - - - else: - break #loop1 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 1, translation_unit_StartIndex) - - pass - - return - - # $ANTLR end translation_unit - - - # $ANTLR start external_declaration - # C.g:114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? ); - def external_declaration(self, ): - - external_declaration_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 2): - return - - # C.g:119:2: ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? ) - alt3 = 3 - LA3_0 = self.input.LA(1) - - if ((29 <= LA3_0 <= 33)) : - LA3_1 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 1, self.input) - - raise nvae - - elif (LA3_0 == 34) : - LA3_2 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 2, self.input) - - raise nvae - - elif (LA3_0 == 35) : - LA3_3 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 3, self.input) - - raise nvae - - elif (LA3_0 == 36) : - LA3_4 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 4, self.input) - - raise nvae - - elif (LA3_0 == 37) : - LA3_5 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 5, self.input) - - raise nvae - - elif (LA3_0 == 38) : - LA3_6 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 6, self.input) - - raise nvae - - elif (LA3_0 == 39) : - LA3_7 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 7, self.input) - - raise nvae - - elif (LA3_0 == 40) : - LA3_8 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 8, self.input) - - raise nvae - - elif (LA3_0 == 41) : - LA3_9 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 9, self.input) - - raise nvae - - elif (LA3_0 == 42) : - LA3_10 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 10, self.input) - - raise nvae - - elif ((45 <= LA3_0 <= 46)) : - LA3_11 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 11, self.input) - - raise nvae - - elif (LA3_0 == 48) : - LA3_12 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 12, self.input) - - raise nvae - - elif (LA3_0 == IDENTIFIER) : - LA3_13 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - elif (True) : - alt3 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 13, self.input) - - raise nvae - - elif (LA3_0 == 58) : - LA3_14 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 14, self.input) - - raise nvae - - elif (LA3_0 == 66) and (self.synpred4()): - alt3 = 1 - elif (LA3_0 == 59) : - LA3_16 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 16, self.input) - - raise nvae - - elif (LA3_0 == 60) : - LA3_17 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 17, self.input) - - raise nvae - - elif ((49 <= LA3_0 <= 57) or LA3_0 == 61) : - LA3_18 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 18, self.input) - - raise nvae - - elif (LA3_0 == 62) and (self.synpred4()): - alt3 = 1 - elif (LA3_0 == 26) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 0, self.input) - - raise nvae - - if alt3 == 1: - # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition - self.following.append(self.FOLLOW_function_definition_in_external_declaration113) - self.function_definition() - self.following.pop() - if self.failed: - return - - - elif alt3 == 2: - # C.g:120:4: declaration - self.following.append(self.FOLLOW_declaration_in_external_declaration118) - self.declaration() - self.following.pop() - if self.failed: - return - - - elif alt3 == 3: - # C.g:121:4: macro_statement ( ';' )? - self.following.append(self.FOLLOW_macro_statement_in_external_declaration123) - self.macro_statement() - self.following.pop() - if self.failed: - return - # C.g:121:20: ( ';' )? - alt2 = 2 - LA2_0 = self.input.LA(1) - - if (LA2_0 == 25) : - alt2 = 1 - if alt2 == 1: - # C.g:121:21: ';' - self.match(self.input, 25, self.FOLLOW_25_in_external_declaration126) - if self.failed: - return - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 2, external_declaration_StartIndex) - - pass - - return - - # $ANTLR end external_declaration - - class function_definition_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start function_definition - # C.g:126:1: function_definition : (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ; - def function_definition(self, ): - self.function_definition_stack.append(function_definition_scope()) - retval = self.function_definition_return() - retval.start = self.input.LT(1) - function_definition_StartIndex = self.input.index() - d = None - - a = None - - b = None - - declarator1 = None - - + + + + # $ANTLR start translation_unit + # C.g:102:1: translation_unit : ( external_declaration )* ; + def translation_unit(self, ): + + translation_unit_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 1): + return + + # C.g:103:2: ( ( external_declaration )* ) + # C.g:103:4: ( external_declaration )* + # C.g:103:4: ( external_declaration )* + while True: #loop1 + alt1 = 2 + LA1_0 = self.input.LA(1) + + if (LA1_0 == IDENTIFIER or LA1_0 == 26 or (29 <= LA1_0 <= 42) or (45 <= LA1_0 <= 46) or (48 <= LA1_0 <= 62) or LA1_0 == 66) : + alt1 = 1 + + + if alt1 == 1: + # C.g:0:0: external_declaration + self.following.append(self.FOLLOW_external_declaration_in_translation_unit74) + self.external_declaration() + self.following.pop() + if self.failed: + return + + + else: + break #loop1 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 1, translation_unit_StartIndex) + + pass + + return + + # $ANTLR end translation_unit + + + # $ANTLR start external_declaration + # C.g:114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? ); + def external_declaration(self, ): + + external_declaration_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 2): + return + + # C.g:119:2: ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? ) + alt3 = 3 + LA3_0 = self.input.LA(1) + + if ((29 <= LA3_0 <= 33)) : + LA3_1 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 1, self.input) + + raise nvae + + elif (LA3_0 == 34) : + LA3_2 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 2, self.input) + + raise nvae + + elif (LA3_0 == 35) : + LA3_3 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 3, self.input) + + raise nvae + + elif (LA3_0 == 36) : + LA3_4 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 4, self.input) + + raise nvae + + elif (LA3_0 == 37) : + LA3_5 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 5, self.input) + + raise nvae + + elif (LA3_0 == 38) : + LA3_6 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 6, self.input) + + raise nvae + + elif (LA3_0 == 39) : + LA3_7 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 7, self.input) + + raise nvae + + elif (LA3_0 == 40) : + LA3_8 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 8, self.input) + + raise nvae + + elif (LA3_0 == 41) : + LA3_9 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 9, self.input) + + raise nvae + + elif (LA3_0 == 42) : + LA3_10 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 10, self.input) + + raise nvae + + elif ((45 <= LA3_0 <= 46)) : + LA3_11 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 11, self.input) + + raise nvae + + elif (LA3_0 == 48) : + LA3_12 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 12, self.input) + + raise nvae + + elif (LA3_0 == IDENTIFIER) : + LA3_13 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + elif (True) : + alt3 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 13, self.input) + + raise nvae + + elif (LA3_0 == 58) : + LA3_14 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 14, self.input) + + raise nvae + + elif (LA3_0 == 66) and (self.synpred4()): + alt3 = 1 + elif (LA3_0 == 59) : + LA3_16 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 16, self.input) + + raise nvae + + elif (LA3_0 == 60) : + LA3_17 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 17, self.input) + + raise nvae + + elif ((49 <= LA3_0 <= 57) or LA3_0 == 61) : + LA3_18 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 18, self.input) + + raise nvae + + elif (LA3_0 == 62) and (self.synpred4()): + alt3 = 1 + elif (LA3_0 == 26) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 0, self.input) + + raise nvae + + if alt3 == 1: + # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition + self.following.append(self.FOLLOW_function_definition_in_external_declaration113) + self.function_definition() + self.following.pop() + if self.failed: + return + + + elif alt3 == 2: + # C.g:120:4: declaration + self.following.append(self.FOLLOW_declaration_in_external_declaration118) + self.declaration() + self.following.pop() + if self.failed: + return + + + elif alt3 == 3: + # C.g:121:4: macro_statement ( ';' )? + self.following.append(self.FOLLOW_macro_statement_in_external_declaration123) + self.macro_statement() + self.following.pop() + if self.failed: + return + # C.g:121:20: ( ';' )? + alt2 = 2 + LA2_0 = self.input.LA(1) + + if (LA2_0 == 25) : + alt2 = 1 + if alt2 == 1: + # C.g:121:21: ';' + self.match(self.input, 25, self.FOLLOW_25_in_external_declaration126) + if self.failed: + return + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 2, external_declaration_StartIndex) + + pass + + return + + # $ANTLR end external_declaration + + class function_definition_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start function_definition + # C.g:126:1: function_definition : (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ; + def function_definition(self, ): + self.function_definition_stack.append(function_definition_scope()) + retval = self.function_definition_return() + retval.start = self.input.LT(1) + function_definition_StartIndex = self.input.index() + d = None + + a = None + + b = None + + declarator1 = None + + self.function_definition_stack[-1].ModifierText = '' self.function_definition_stack[-1].DeclText = '' @@ -582,213 +582,213 @@ class CParser(Parser): self.function_definition_stack[-1].LBOffset = 0 self.function_definition_stack[-1].DeclLine = 0 self.function_definition_stack[-1].DeclOffset = 0 - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 3): - return retval - - # C.g:146:2: ( (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ) - # C.g:146:4: (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) - # C.g:146:5: (d= declaration_specifiers )? - alt4 = 2 - LA4 = self.input.LA(1) - if LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33 or LA4 == 34 or LA4 == 35 or LA4 == 36 or LA4 == 37 or LA4 == 38 or LA4 == 39 or LA4 == 40 or LA4 == 41 or LA4 == 42 or LA4 == 45 or LA4 == 46 or LA4 == 48 or LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61: - alt4 = 1 - elif LA4 == IDENTIFIER: - LA4 = self.input.LA(2) - if LA4 == 66: - alt4 = 1 - elif LA4 == 58: - LA4_21 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 59: - LA4_22 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 60: - LA4_23 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == IDENTIFIER: - LA4_24 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 62: - LA4_25 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33: - LA4_26 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 34: - LA4_27 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 35: - LA4_28 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 36: - LA4_29 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 37: - LA4_30 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 38: - LA4_31 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 39: - LA4_32 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 40: - LA4_33 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 41: - LA4_34 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 42: - LA4_35 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 45 or LA4 == 46: - LA4_36 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 48: - LA4_37 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61: - LA4_38 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 58: - LA4_14 = self.input.LA(2) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 59: - LA4_16 = self.input.LA(2) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 60: - LA4_17 = self.input.LA(2) - - if (self.synpred7()) : - alt4 = 1 - if alt4 == 1: - # C.g:0:0: d= declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_function_definition157) - d = self.declaration_specifiers() - self.following.pop() - if self.failed: - return retval - - - - self.following.append(self.FOLLOW_declarator_in_function_definition160) - declarator1 = self.declarator() - self.following.pop() - if self.failed: - return retval - # C.g:147:3: ( ( declaration )+ a= compound_statement | b= compound_statement ) - alt6 = 2 - LA6_0 = self.input.LA(1) - - if (LA6_0 == IDENTIFIER or LA6_0 == 26 or (29 <= LA6_0 <= 42) or (45 <= LA6_0 <= 46) or (48 <= LA6_0 <= 61)) : - alt6 = 1 - elif (LA6_0 == 43) : - alt6 = 2 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("147:3: ( ( declaration )+ a= compound_statement | b= compound_statement )", 6, 0, self.input) - - raise nvae - - if alt6 == 1: - # C.g:147:5: ( declaration )+ a= compound_statement - # C.g:147:5: ( declaration )+ - cnt5 = 0 - while True: #loop5 - alt5 = 2 - LA5_0 = self.input.LA(1) - - if (LA5_0 == IDENTIFIER or LA5_0 == 26 or (29 <= LA5_0 <= 42) or (45 <= LA5_0 <= 46) or (48 <= LA5_0 <= 61)) : - alt5 = 1 - - - if alt5 == 1: - # C.g:0:0: declaration - self.following.append(self.FOLLOW_declaration_in_function_definition166) - self.declaration() - self.following.pop() - if self.failed: - return retval - - - else: - if cnt5 >= 1: - break #loop5 - - if self.backtracking > 0: - self.failed = True - return retval - - eee = EarlyExitException(5, self.input) - raise eee - - cnt5 += 1 - - - self.following.append(self.FOLLOW_compound_statement_in_function_definition171) - a = self.compound_statement() - self.following.pop() - if self.failed: - return retval - - - elif alt6 == 2: - # C.g:148:5: b= compound_statement - self.following.append(self.FOLLOW_compound_statement_in_function_definition180) - b = self.compound_statement() - self.following.pop() - if self.failed: - return retval - - - - if self.backtracking == 0: + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 3): + return retval + + # C.g:146:2: ( (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ) + # C.g:146:4: (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) + # C.g:146:5: (d= declaration_specifiers )? + alt4 = 2 + LA4 = self.input.LA(1) + if LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33 or LA4 == 34 or LA4 == 35 or LA4 == 36 or LA4 == 37 or LA4 == 38 or LA4 == 39 or LA4 == 40 or LA4 == 41 or LA4 == 42 or LA4 == 45 or LA4 == 46 or LA4 == 48 or LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61: + alt4 = 1 + elif LA4 == IDENTIFIER: + LA4 = self.input.LA(2) + if LA4 == 66: + alt4 = 1 + elif LA4 == 58: + LA4_21 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 59: + LA4_22 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 60: + LA4_23 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == IDENTIFIER: + LA4_24 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 62: + LA4_25 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33: + LA4_26 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 34: + LA4_27 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 35: + LA4_28 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 36: + LA4_29 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 37: + LA4_30 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 38: + LA4_31 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 39: + LA4_32 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 40: + LA4_33 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 41: + LA4_34 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 42: + LA4_35 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 45 or LA4 == 46: + LA4_36 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 48: + LA4_37 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61: + LA4_38 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 58: + LA4_14 = self.input.LA(2) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 59: + LA4_16 = self.input.LA(2) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 60: + LA4_17 = self.input.LA(2) + + if (self.synpred7()) : + alt4 = 1 + if alt4 == 1: + # C.g:0:0: d= declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_function_definition157) + d = self.declaration_specifiers() + self.following.pop() + if self.failed: + return retval + + + + self.following.append(self.FOLLOW_declarator_in_function_definition160) + declarator1 = self.declarator() + self.following.pop() + if self.failed: + return retval + # C.g:147:3: ( ( declaration )+ a= compound_statement | b= compound_statement ) + alt6 = 2 + LA6_0 = self.input.LA(1) + + if (LA6_0 == IDENTIFIER or LA6_0 == 26 or (29 <= LA6_0 <= 42) or (45 <= LA6_0 <= 46) or (48 <= LA6_0 <= 61)) : + alt6 = 1 + elif (LA6_0 == 43) : + alt6 = 2 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("147:3: ( ( declaration )+ a= compound_statement | b= compound_statement )", 6, 0, self.input) + + raise nvae + + if alt6 == 1: + # C.g:147:5: ( declaration )+ a= compound_statement + # C.g:147:5: ( declaration )+ + cnt5 = 0 + while True: #loop5 + alt5 = 2 + LA5_0 = self.input.LA(1) + + if (LA5_0 == IDENTIFIER or LA5_0 == 26 or (29 <= LA5_0 <= 42) or (45 <= LA5_0 <= 46) or (48 <= LA5_0 <= 61)) : + alt5 = 1 + + + if alt5 == 1: + # C.g:0:0: declaration + self.following.append(self.FOLLOW_declaration_in_function_definition166) + self.declaration() + self.following.pop() + if self.failed: + return retval + + + else: + if cnt5 >= 1: + break #loop5 + + if self.backtracking > 0: + self.failed = True + return retval + + eee = EarlyExitException(5, self.input) + raise eee + + cnt5 += 1 + + + self.following.append(self.FOLLOW_compound_statement_in_function_definition171) + a = self.compound_statement() + self.following.pop() + if self.failed: + return retval + + + elif alt6 == 2: + # C.g:148:5: b= compound_statement + self.following.append(self.FOLLOW_compound_statement_in_function_definition180) + b = self.compound_statement() + self.following.pop() + if self.failed: + return retval + + + + if self.backtracking == 0: if d != None: self.function_definition_stack[-1].ModifierText = self.input.toString(d.start,d.stop) @@ -803,18042 +803,18042 @@ class CParser(Parser): else: self.function_definition_stack[-1].LBLine = b.start.line self.function_definition_stack[-1].LBOffset = b.start.charPositionInLine - - - - - - retval.stop = self.input.LT(-1) - - if self.backtracking == 0: + + + + + + retval.stop = self.input.LT(-1) + + if self.backtracking == 0: self.StoreFunctionDefinition(retval.start.line, retval.start.charPositionInLine, retval.stop.line, retval.stop.charPositionInLine, self.function_definition_stack[-1].ModifierText, self.function_definition_stack[-1].DeclText, self.function_definition_stack[-1].LBLine, self.function_definition_stack[-1].LBOffset, self.function_definition_stack[-1].DeclLine, self.function_definition_stack[-1].DeclOffset) - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 3, function_definition_StartIndex) - - self.function_definition_stack.pop() - pass - - return retval - - # $ANTLR end function_definition - - - # $ANTLR start declaration - # C.g:166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' ); - def declaration(self, ): - - declaration_StartIndex = self.input.index() - a = None - d = None - e = None - b = None - - c = None - - s = None - - t = None - - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 4): - return - - # C.g:167:2: (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' ) - alt9 = 2 - LA9_0 = self.input.LA(1) - - if (LA9_0 == 26) : - alt9 = 1 - elif (LA9_0 == IDENTIFIER or (29 <= LA9_0 <= 42) or (45 <= LA9_0 <= 46) or (48 <= LA9_0 <= 61)) : - alt9 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' );", 9, 0, self.input) - - raise nvae - - if alt9 == 1: - # C.g:167:4: a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' - a = self.input.LT(1) - self.match(self.input, 26, self.FOLLOW_26_in_declaration203) - if self.failed: - return - # C.g:167:17: (b= declaration_specifiers )? - alt7 = 2 - LA7 = self.input.LA(1) - if LA7 == 29 or LA7 == 30 or LA7 == 31 or LA7 == 32 or LA7 == 33 or LA7 == 34 or LA7 == 35 or LA7 == 36 or LA7 == 37 or LA7 == 38 or LA7 == 39 or LA7 == 40 or LA7 == 41 or LA7 == 42 or LA7 == 45 or LA7 == 46 or LA7 == 48 or LA7 == 49 or LA7 == 50 or LA7 == 51 or LA7 == 52 or LA7 == 53 or LA7 == 54 or LA7 == 55 or LA7 == 56 or LA7 == 57 or LA7 == 61: - alt7 = 1 - elif LA7 == IDENTIFIER: - LA7_13 = self.input.LA(2) - - if (LA7_13 == 62) : - LA7_21 = self.input.LA(3) - - if (self.synpred10()) : - alt7 = 1 - elif (LA7_13 == IDENTIFIER or (29 <= LA7_13 <= 42) or (45 <= LA7_13 <= 46) or (48 <= LA7_13 <= 61) or LA7_13 == 66) : - alt7 = 1 - elif LA7 == 58: - LA7_14 = self.input.LA(2) - - if (self.synpred10()) : - alt7 = 1 - elif LA7 == 59: - LA7_16 = self.input.LA(2) - - if (self.synpred10()) : - alt7 = 1 - elif LA7 == 60: - LA7_17 = self.input.LA(2) - - if (self.synpred10()) : - alt7 = 1 - if alt7 == 1: - # C.g:0:0: b= declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_declaration207) - b = self.declaration_specifiers() - self.following.pop() - if self.failed: - return - - - - self.following.append(self.FOLLOW_init_declarator_list_in_declaration216) - c = self.init_declarator_list() - self.following.pop() - if self.failed: - return - d = self.input.LT(1) - self.match(self.input, 25, self.FOLLOW_25_in_declaration220) - if self.failed: - return - if self.backtracking == 0: + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 3, function_definition_StartIndex) + + self.function_definition_stack.pop() + pass + + return retval + + # $ANTLR end function_definition + + + # $ANTLR start declaration + # C.g:166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' ); + def declaration(self, ): + + declaration_StartIndex = self.input.index() + a = None + d = None + e = None + b = None + + c = None + + s = None + + t = None + + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 4): + return + + # C.g:167:2: (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' ) + alt9 = 2 + LA9_0 = self.input.LA(1) + + if (LA9_0 == 26) : + alt9 = 1 + elif (LA9_0 == IDENTIFIER or (29 <= LA9_0 <= 42) or (45 <= LA9_0 <= 46) or (48 <= LA9_0 <= 61)) : + alt9 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' );", 9, 0, self.input) + + raise nvae + + if alt9 == 1: + # C.g:167:4: a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' + a = self.input.LT(1) + self.match(self.input, 26, self.FOLLOW_26_in_declaration203) + if self.failed: + return + # C.g:167:17: (b= declaration_specifiers )? + alt7 = 2 + LA7 = self.input.LA(1) + if LA7 == 29 or LA7 == 30 or LA7 == 31 or LA7 == 32 or LA7 == 33 or LA7 == 34 or LA7 == 35 or LA7 == 36 or LA7 == 37 or LA7 == 38 or LA7 == 39 or LA7 == 40 or LA7 == 41 or LA7 == 42 or LA7 == 45 or LA7 == 46 or LA7 == 48 or LA7 == 49 or LA7 == 50 or LA7 == 51 or LA7 == 52 or LA7 == 53 or LA7 == 54 or LA7 == 55 or LA7 == 56 or LA7 == 57 or LA7 == 61: + alt7 = 1 + elif LA7 == IDENTIFIER: + LA7_13 = self.input.LA(2) + + if (LA7_13 == 62) : + LA7_21 = self.input.LA(3) + + if (self.synpred10()) : + alt7 = 1 + elif (LA7_13 == IDENTIFIER or (29 <= LA7_13 <= 42) or (45 <= LA7_13 <= 46) or (48 <= LA7_13 <= 61) or LA7_13 == 66) : + alt7 = 1 + elif LA7 == 58: + LA7_14 = self.input.LA(2) + + if (self.synpred10()) : + alt7 = 1 + elif LA7 == 59: + LA7_16 = self.input.LA(2) + + if (self.synpred10()) : + alt7 = 1 + elif LA7 == 60: + LA7_17 = self.input.LA(2) + + if (self.synpred10()) : + alt7 = 1 + if alt7 == 1: + # C.g:0:0: b= declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_declaration207) + b = self.declaration_specifiers() + self.following.pop() + if self.failed: + return + + + + self.following.append(self.FOLLOW_init_declarator_list_in_declaration216) + c = self.init_declarator_list() + self.following.pop() + if self.failed: + return + d = self.input.LT(1) + self.match(self.input, 25, self.FOLLOW_25_in_declaration220) + if self.failed: + return + if self.backtracking == 0: if b != None: self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, self.input.toString(b.start,b.stop), self.input.toString(c.start,c.stop)) else: self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, '', self.input.toString(c.start,c.stop)) - - - - - elif alt9 == 2: - # C.g:175:4: s= declaration_specifiers (t= init_declarator_list )? e= ';' - self.following.append(self.FOLLOW_declaration_specifiers_in_declaration234) - s = self.declaration_specifiers() - self.following.pop() - if self.failed: - return - # C.g:175:30: (t= init_declarator_list )? - alt8 = 2 - LA8_0 = self.input.LA(1) - - if (LA8_0 == IDENTIFIER or (58 <= LA8_0 <= 60) or LA8_0 == 62 or LA8_0 == 66) : - alt8 = 1 - if alt8 == 1: - # C.g:0:0: t= init_declarator_list - self.following.append(self.FOLLOW_init_declarator_list_in_declaration238) - t = self.init_declarator_list() - self.following.pop() - if self.failed: - return - - - - e = self.input.LT(1) - self.match(self.input, 25, self.FOLLOW_25_in_declaration243) - if self.failed: - return - if self.backtracking == 0: + + + + + elif alt9 == 2: + # C.g:175:4: s= declaration_specifiers (t= init_declarator_list )? e= ';' + self.following.append(self.FOLLOW_declaration_specifiers_in_declaration234) + s = self.declaration_specifiers() + self.following.pop() + if self.failed: + return + # C.g:175:30: (t= init_declarator_list )? + alt8 = 2 + LA8_0 = self.input.LA(1) + + if (LA8_0 == IDENTIFIER or (58 <= LA8_0 <= 60) or LA8_0 == 62 or LA8_0 == 66) : + alt8 = 1 + if alt8 == 1: + # C.g:0:0: t= init_declarator_list + self.following.append(self.FOLLOW_init_declarator_list_in_declaration238) + t = self.init_declarator_list() + self.following.pop() + if self.failed: + return + + + + e = self.input.LT(1) + self.match(self.input, 25, self.FOLLOW_25_in_declaration243) + if self.failed: + return + if self.backtracking == 0: if t != None: self.StoreVariableDeclaration(s.start.line, s.start.charPositionInLine, t.start.line, t.start.charPositionInLine, self.input.toString(s.start,s.stop), self.input.toString(t.start,t.stop)) - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 4, declaration_StartIndex) - - pass - - return - - # $ANTLR end declaration - - class declaration_specifiers_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start declaration_specifiers - # C.g:182:1: declaration_specifiers : ( storage_class_specifier | type_specifier | type_qualifier )+ ; - def declaration_specifiers(self, ): - - retval = self.declaration_specifiers_return() - retval.start = self.input.LT(1) - declaration_specifiers_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 5): - return retval - - # C.g:183:2: ( ( storage_class_specifier | type_specifier | type_qualifier )+ ) - # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+ - # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+ - cnt10 = 0 - while True: #loop10 - alt10 = 4 - LA10 = self.input.LA(1) - if LA10 == 58: - LA10_2 = self.input.LA(2) - - if (self.synpred15()) : - alt10 = 3 - - - elif LA10 == 59: - LA10_3 = self.input.LA(2) - - if (self.synpred15()) : - alt10 = 3 - - - elif LA10 == 60: - LA10_4 = self.input.LA(2) - - if (self.synpred15()) : - alt10 = 3 - - - elif LA10 == IDENTIFIER: - LA10_5 = self.input.LA(2) - - if (self.synpred14()) : - alt10 = 2 - - - elif LA10 == 53: - LA10_9 = self.input.LA(2) - - if (self.synpred15()) : - alt10 = 3 - - - elif LA10 == 29 or LA10 == 30 or LA10 == 31 or LA10 == 32 or LA10 == 33: - alt10 = 1 - elif LA10 == 34 or LA10 == 35 or LA10 == 36 or LA10 == 37 or LA10 == 38 or LA10 == 39 or LA10 == 40 or LA10 == 41 or LA10 == 42 or LA10 == 45 or LA10 == 46 or LA10 == 48: - alt10 = 2 - elif LA10 == 49 or LA10 == 50 or LA10 == 51 or LA10 == 52 or LA10 == 54 or LA10 == 55 or LA10 == 56 or LA10 == 57 or LA10 == 61: - alt10 = 3 - - if alt10 == 1: - # C.g:183:10: storage_class_specifier - self.following.append(self.FOLLOW_storage_class_specifier_in_declaration_specifiers264) - self.storage_class_specifier() - self.following.pop() - if self.failed: - return retval - - - elif alt10 == 2: - # C.g:184:7: type_specifier - self.following.append(self.FOLLOW_type_specifier_in_declaration_specifiers272) - self.type_specifier() - self.following.pop() - if self.failed: - return retval - - - elif alt10 == 3: - # C.g:185:13: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_declaration_specifiers286) - self.type_qualifier() - self.following.pop() - if self.failed: - return retval - - - else: - if cnt10 >= 1: - break #loop10 - - if self.backtracking > 0: - self.failed = True - return retval - - eee = EarlyExitException(10, self.input) - raise eee - - cnt10 += 1 - - - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 5, declaration_specifiers_StartIndex) - - pass - - return retval - - # $ANTLR end declaration_specifiers - - class init_declarator_list_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start init_declarator_list - # C.g:189:1: init_declarator_list : init_declarator ( ',' init_declarator )* ; - def init_declarator_list(self, ): - - retval = self.init_declarator_list_return() - retval.start = self.input.LT(1) - init_declarator_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 6): - return retval - - # C.g:190:2: ( init_declarator ( ',' init_declarator )* ) - # C.g:190:4: init_declarator ( ',' init_declarator )* - self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list308) - self.init_declarator() - self.following.pop() - if self.failed: - return retval - # C.g:190:20: ( ',' init_declarator )* - while True: #loop11 - alt11 = 2 - LA11_0 = self.input.LA(1) - - if (LA11_0 == 27) : - alt11 = 1 - - - if alt11 == 1: - # C.g:190:21: ',' init_declarator - self.match(self.input, 27, self.FOLLOW_27_in_init_declarator_list311) - if self.failed: - return retval - self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list313) - self.init_declarator() - self.following.pop() - if self.failed: - return retval - - - else: - break #loop11 - - - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 6, init_declarator_list_StartIndex) - - pass - - return retval - - # $ANTLR end init_declarator_list - - - # $ANTLR start init_declarator - # C.g:193:1: init_declarator : declarator ( '=' initializer )? ; - def init_declarator(self, ): - - init_declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 7): - return - - # C.g:194:2: ( declarator ( '=' initializer )? ) - # C.g:194:4: declarator ( '=' initializer )? - self.following.append(self.FOLLOW_declarator_in_init_declarator326) - self.declarator() - self.following.pop() - if self.failed: - return - # C.g:194:15: ( '=' initializer )? - alt12 = 2 - LA12_0 = self.input.LA(1) - - if (LA12_0 == 28) : - alt12 = 1 - if alt12 == 1: - # C.g:194:16: '=' initializer - self.match(self.input, 28, self.FOLLOW_28_in_init_declarator329) - if self.failed: - return - self.following.append(self.FOLLOW_initializer_in_init_declarator331) - self.initializer() - self.following.pop() - if self.failed: - return - - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 7, init_declarator_StartIndex) - - pass - - return - - # $ANTLR end init_declarator - - - # $ANTLR start storage_class_specifier - # C.g:197:1: storage_class_specifier : ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' ); - def storage_class_specifier(self, ): - - storage_class_specifier_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 8): - return - - # C.g:198:2: ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' ) - # C.g: - if (29 <= self.input.LA(1) <= 33): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_storage_class_specifier0 - ) - raise mse - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 8, storage_class_specifier_StartIndex) - - pass - - return - - # $ANTLR end storage_class_specifier - - - # $ANTLR start type_specifier - # C.g:205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id ); - def type_specifier(self, ): - - type_specifier_StartIndex = self.input.index() - s = None - - e = None - - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 9): - return - - # C.g:206:2: ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id ) - alt13 = 12 - LA13_0 = self.input.LA(1) - - if (LA13_0 == 34) : - alt13 = 1 - elif (LA13_0 == 35) : - alt13 = 2 - elif (LA13_0 == 36) : - alt13 = 3 - elif (LA13_0 == 37) : - alt13 = 4 - elif (LA13_0 == 38) : - alt13 = 5 - elif (LA13_0 == 39) : - alt13 = 6 - elif (LA13_0 == 40) : - alt13 = 7 - elif (LA13_0 == 41) : - alt13 = 8 - elif (LA13_0 == 42) : - alt13 = 9 - elif ((45 <= LA13_0 <= 46)) : - alt13 = 10 - elif (LA13_0 == 48) : - alt13 = 11 - elif (LA13_0 == IDENTIFIER) and (self.synpred34()): - alt13 = 12 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id );", 13, 0, self.input) - - raise nvae - - if alt13 == 1: - # C.g:206:4: 'void' - self.match(self.input, 34, self.FOLLOW_34_in_type_specifier376) - if self.failed: - return - - - elif alt13 == 2: - # C.g:207:4: 'char' - self.match(self.input, 35, self.FOLLOW_35_in_type_specifier381) - if self.failed: - return - - - elif alt13 == 3: - # C.g:208:4: 'short' - self.match(self.input, 36, self.FOLLOW_36_in_type_specifier386) - if self.failed: - return - - - elif alt13 == 4: - # C.g:209:4: 'int' - self.match(self.input, 37, self.FOLLOW_37_in_type_specifier391) - if self.failed: - return - - - elif alt13 == 5: - # C.g:210:4: 'long' - self.match(self.input, 38, self.FOLLOW_38_in_type_specifier396) - if self.failed: - return - - - elif alt13 == 6: - # C.g:211:4: 'float' - self.match(self.input, 39, self.FOLLOW_39_in_type_specifier401) - if self.failed: - return - - - elif alt13 == 7: - # C.g:212:4: 'double' - self.match(self.input, 40, self.FOLLOW_40_in_type_specifier406) - if self.failed: - return - - - elif alt13 == 8: - # C.g:213:4: 'signed' - self.match(self.input, 41, self.FOLLOW_41_in_type_specifier411) - if self.failed: - return - - - elif alt13 == 9: - # C.g:214:4: 'unsigned' - self.match(self.input, 42, self.FOLLOW_42_in_type_specifier416) - if self.failed: - return - - - elif alt13 == 10: - # C.g:215:4: s= struct_or_union_specifier - self.following.append(self.FOLLOW_struct_or_union_specifier_in_type_specifier423) - s = self.struct_or_union_specifier() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - - if s.stop != None: - self.StoreStructUnionDefinition(s.start.line, s.start.charPositionInLine, s.stop.line, s.stop.charPositionInLine, self.input.toString(s.start,s.stop)) - - - - - elif alt13 == 11: - # C.g:220:4: e= enum_specifier - self.following.append(self.FOLLOW_enum_specifier_in_type_specifier433) - e = self.enum_specifier() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - - if e.stop != None: - self.StoreEnumerationDefinition(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - - - - elif alt13 == 12: - # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator )=> type_id - self.following.append(self.FOLLOW_type_id_in_type_specifier451) - self.type_id() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 9, type_specifier_StartIndex) - - pass - - return - - # $ANTLR end type_specifier - - - # $ANTLR start type_id - # C.g:228:1: type_id : IDENTIFIER ; - def type_id(self, ): - - type_id_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 10): - return - - # C.g:229:5: ( IDENTIFIER ) - # C.g:229:9: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_type_id467) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 10, type_id_StartIndex) - - pass - - return - - # $ANTLR end type_id - - class struct_or_union_specifier_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start struct_or_union_specifier - # C.g:233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER ); - def struct_or_union_specifier(self, ): - - retval = self.struct_or_union_specifier_return() - retval.start = self.input.LT(1) - struct_or_union_specifier_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 11): - return retval - - # C.g:235:2: ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER ) - alt15 = 2 - LA15_0 = self.input.LA(1) - - if ((45 <= LA15_0 <= 46)) : - LA15_1 = self.input.LA(2) - - if (LA15_1 == IDENTIFIER) : - LA15_2 = self.input.LA(3) - - if (LA15_2 == 43) : - alt15 = 1 - elif (LA15_2 == EOF or LA15_2 == IDENTIFIER or LA15_2 == 25 or LA15_2 == 27 or (29 <= LA15_2 <= 42) or (45 <= LA15_2 <= 64) or LA15_2 == 66) : - alt15 = 2 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 2, self.input) - - raise nvae - - elif (LA15_1 == 43) : - alt15 = 1 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 1, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 0, self.input) - - raise nvae - - if alt15 == 1: - # C.g:235:4: struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' - self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier494) - self.struct_or_union() - self.following.pop() - if self.failed: - return retval - # C.g:235:20: ( IDENTIFIER )? - alt14 = 2 - LA14_0 = self.input.LA(1) - - if (LA14_0 == IDENTIFIER) : - alt14 = 1 - if alt14 == 1: - # C.g:0:0: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier496) - if self.failed: - return retval - - - - self.match(self.input, 43, self.FOLLOW_43_in_struct_or_union_specifier499) - if self.failed: - return retval - self.following.append(self.FOLLOW_struct_declaration_list_in_struct_or_union_specifier501) - self.struct_declaration_list() - self.following.pop() - if self.failed: - return retval - self.match(self.input, 44, self.FOLLOW_44_in_struct_or_union_specifier503) - if self.failed: - return retval - - - elif alt15 == 2: - # C.g:236:4: struct_or_union IDENTIFIER - self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier508) - self.struct_or_union() - self.following.pop() - if self.failed: - return retval - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier510) - if self.failed: - return retval - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 11, struct_or_union_specifier_StartIndex) - - pass - - return retval - - # $ANTLR end struct_or_union_specifier - - - # $ANTLR start struct_or_union - # C.g:239:1: struct_or_union : ( 'struct' | 'union' ); - def struct_or_union(self, ): - - struct_or_union_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 12): - return - - # C.g:240:2: ( 'struct' | 'union' ) - # C.g: - if (45 <= self.input.LA(1) <= 46): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_struct_or_union0 - ) - raise mse - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 12, struct_or_union_StartIndex) - - pass - - return - - # $ANTLR end struct_or_union - - - # $ANTLR start struct_declaration_list - # C.g:244:1: struct_declaration_list : ( struct_declaration )+ ; - def struct_declaration_list(self, ): - - struct_declaration_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 13): - return - - # C.g:245:2: ( ( struct_declaration )+ ) - # C.g:245:4: ( struct_declaration )+ - # C.g:245:4: ( struct_declaration )+ - cnt16 = 0 - while True: #loop16 - alt16 = 2 - LA16_0 = self.input.LA(1) - - if (LA16_0 == IDENTIFIER or (34 <= LA16_0 <= 42) or (45 <= LA16_0 <= 46) or (48 <= LA16_0 <= 61)) : - alt16 = 1 - - - if alt16 == 1: - # C.g:0:0: struct_declaration - self.following.append(self.FOLLOW_struct_declaration_in_struct_declaration_list537) - self.struct_declaration() - self.following.pop() - if self.failed: - return - - - else: - if cnt16 >= 1: - break #loop16 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(16, self.input) - raise eee - - cnt16 += 1 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 13, struct_declaration_list_StartIndex) - - pass - - return - - # $ANTLR end struct_declaration_list - - - # $ANTLR start struct_declaration - # C.g:248:1: struct_declaration : specifier_qualifier_list struct_declarator_list ';' ; - def struct_declaration(self, ): - - struct_declaration_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 14): - return - - # C.g:249:2: ( specifier_qualifier_list struct_declarator_list ';' ) - # C.g:249:4: specifier_qualifier_list struct_declarator_list ';' - self.following.append(self.FOLLOW_specifier_qualifier_list_in_struct_declaration549) - self.specifier_qualifier_list() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_struct_declarator_list_in_struct_declaration551) - self.struct_declarator_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_struct_declaration553) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 14, struct_declaration_StartIndex) - - pass - - return - - # $ANTLR end struct_declaration - - - # $ANTLR start specifier_qualifier_list - # C.g:252:1: specifier_qualifier_list : ( type_qualifier | type_specifier )+ ; - def specifier_qualifier_list(self, ): - - specifier_qualifier_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 15): - return - - # C.g:253:2: ( ( type_qualifier | type_specifier )+ ) - # C.g:253:4: ( type_qualifier | type_specifier )+ - # C.g:253:4: ( type_qualifier | type_specifier )+ - cnt17 = 0 - while True: #loop17 - alt17 = 3 - LA17 = self.input.LA(1) - if LA17 == 58: - LA17_2 = self.input.LA(2) - - if (self.synpred39()) : - alt17 = 1 - - - elif LA17 == 59: - LA17_3 = self.input.LA(2) - - if (self.synpred39()) : - alt17 = 1 - - - elif LA17 == 60: - LA17_4 = self.input.LA(2) - - if (self.synpred39()) : - alt17 = 1 - - - elif LA17 == IDENTIFIER: - LA17 = self.input.LA(2) - if LA17 == EOF or LA17 == IDENTIFIER or LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48 or LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 58 or LA17 == 59 or LA17 == 60 or LA17 == 61 or LA17 == 63 or LA17 == 66: - alt17 = 2 - elif LA17 == 62: - LA17_94 = self.input.LA(3) - - if (self.synpred40()) : - alt17 = 2 - - - elif LA17 == 47: - LA17_95 = self.input.LA(3) - - if (self.synpred40()) : - alt17 = 2 - - - elif LA17 == 64: - LA17_96 = self.input.LA(3) - - if (self.synpred40()) : - alt17 = 2 - - - - elif LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 61: - alt17 = 1 - elif LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48: - alt17 = 2 - - if alt17 == 1: - # C.g:253:6: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_specifier_qualifier_list566) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - elif alt17 == 2: - # C.g:253:23: type_specifier - self.following.append(self.FOLLOW_type_specifier_in_specifier_qualifier_list570) - self.type_specifier() - self.following.pop() - if self.failed: - return - - - else: - if cnt17 >= 1: - break #loop17 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(17, self.input) - raise eee - - cnt17 += 1 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 15, specifier_qualifier_list_StartIndex) - - pass - - return - - # $ANTLR end specifier_qualifier_list - - - # $ANTLR start struct_declarator_list - # C.g:256:1: struct_declarator_list : struct_declarator ( ',' struct_declarator )* ; - def struct_declarator_list(self, ): - - struct_declarator_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 16): - return - - # C.g:257:2: ( struct_declarator ( ',' struct_declarator )* ) - # C.g:257:4: struct_declarator ( ',' struct_declarator )* - self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list584) - self.struct_declarator() - self.following.pop() - if self.failed: - return - # C.g:257:22: ( ',' struct_declarator )* - while True: #loop18 - alt18 = 2 - LA18_0 = self.input.LA(1) - - if (LA18_0 == 27) : - alt18 = 1 - - - if alt18 == 1: - # C.g:257:23: ',' struct_declarator - self.match(self.input, 27, self.FOLLOW_27_in_struct_declarator_list587) - if self.failed: - return - self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list589) - self.struct_declarator() - self.following.pop() - if self.failed: - return - - - else: - break #loop18 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 16, struct_declarator_list_StartIndex) - - pass - - return - - # $ANTLR end struct_declarator_list - - - # $ANTLR start struct_declarator - # C.g:260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression ); - def struct_declarator(self, ): - - struct_declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 17): - return - - # C.g:261:2: ( declarator ( ':' constant_expression )? | ':' constant_expression ) - alt20 = 2 - LA20_0 = self.input.LA(1) - - if (LA20_0 == IDENTIFIER or (58 <= LA20_0 <= 60) or LA20_0 == 62 or LA20_0 == 66) : - alt20 = 1 - elif (LA20_0 == 47) : - alt20 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression );", 20, 0, self.input) - - raise nvae - - if alt20 == 1: - # C.g:261:4: declarator ( ':' constant_expression )? - self.following.append(self.FOLLOW_declarator_in_struct_declarator602) - self.declarator() - self.following.pop() - if self.failed: - return - # C.g:261:15: ( ':' constant_expression )? - alt19 = 2 - LA19_0 = self.input.LA(1) - - if (LA19_0 == 47) : - alt19 = 1 - if alt19 == 1: - # C.g:261:16: ':' constant_expression - self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator605) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_struct_declarator607) - self.constant_expression() - self.following.pop() - if self.failed: - return - - - - - - elif alt20 == 2: - # C.g:262:4: ':' constant_expression - self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator614) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_struct_declarator616) - self.constant_expression() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 17, struct_declarator_StartIndex) - - pass - - return - - # $ANTLR end struct_declarator - - class enum_specifier_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start enum_specifier - # C.g:265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER ); - def enum_specifier(self, ): - - retval = self.enum_specifier_return() - retval.start = self.input.LT(1) - enum_specifier_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 18): - return retval - - # C.g:267:2: ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER ) - alt23 = 3 - LA23_0 = self.input.LA(1) - - if (LA23_0 == 48) : - LA23_1 = self.input.LA(2) - - if (LA23_1 == IDENTIFIER) : - LA23_2 = self.input.LA(3) - - if (LA23_2 == 43) : - alt23 = 2 - elif (LA23_2 == EOF or LA23_2 == IDENTIFIER or LA23_2 == 25 or LA23_2 == 27 or (29 <= LA23_2 <= 42) or (45 <= LA23_2 <= 64) or LA23_2 == 66) : - alt23 = 3 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 2, self.input) - - raise nvae - - elif (LA23_1 == 43) : - alt23 = 1 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 1, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 0, self.input) - - raise nvae - - if alt23 == 1: - # C.g:267:4: 'enum' '{' enumerator_list ( ',' )? '}' - self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier634) - if self.failed: - return retval - self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier636) - if self.failed: - return retval - self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier638) - self.enumerator_list() - self.following.pop() - if self.failed: - return retval - # C.g:267:31: ( ',' )? - alt21 = 2 - LA21_0 = self.input.LA(1) - - if (LA21_0 == 27) : - alt21 = 1 - if alt21 == 1: - # C.g:0:0: ',' - self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier640) - if self.failed: - return retval - - - - self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier643) - if self.failed: - return retval - - - elif alt23 == 2: - # C.g:268:4: 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' - self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier648) - if self.failed: - return retval - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier650) - if self.failed: - return retval - self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier652) - if self.failed: - return retval - self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier654) - self.enumerator_list() - self.following.pop() - if self.failed: - return retval - # C.g:268:42: ( ',' )? - alt22 = 2 - LA22_0 = self.input.LA(1) - - if (LA22_0 == 27) : - alt22 = 1 - if alt22 == 1: - # C.g:0:0: ',' - self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier656) - if self.failed: - return retval - - - - self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier659) - if self.failed: - return retval - - - elif alt23 == 3: - # C.g:269:4: 'enum' IDENTIFIER - self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier664) - if self.failed: - return retval - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier666) - if self.failed: - return retval - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 18, enum_specifier_StartIndex) - - pass - - return retval - - # $ANTLR end enum_specifier - - - # $ANTLR start enumerator_list - # C.g:272:1: enumerator_list : enumerator ( ',' enumerator )* ; - def enumerator_list(self, ): - - enumerator_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 19): - return - - # C.g:273:2: ( enumerator ( ',' enumerator )* ) - # C.g:273:4: enumerator ( ',' enumerator )* - self.following.append(self.FOLLOW_enumerator_in_enumerator_list677) - self.enumerator() - self.following.pop() - if self.failed: - return - # C.g:273:15: ( ',' enumerator )* - while True: #loop24 - alt24 = 2 - LA24_0 = self.input.LA(1) - - if (LA24_0 == 27) : - LA24_1 = self.input.LA(2) - - if (LA24_1 == IDENTIFIER) : - alt24 = 1 - - - - - if alt24 == 1: - # C.g:273:16: ',' enumerator - self.match(self.input, 27, self.FOLLOW_27_in_enumerator_list680) - if self.failed: - return - self.following.append(self.FOLLOW_enumerator_in_enumerator_list682) - self.enumerator() - self.following.pop() - if self.failed: - return - - - else: - break #loop24 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 19, enumerator_list_StartIndex) - - pass - - return - - # $ANTLR end enumerator_list - - - # $ANTLR start enumerator - # C.g:276:1: enumerator : IDENTIFIER ( '=' constant_expression )? ; - def enumerator(self, ): - - enumerator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 20): - return - - # C.g:277:2: ( IDENTIFIER ( '=' constant_expression )? ) - # C.g:277:4: IDENTIFIER ( '=' constant_expression )? - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enumerator695) - if self.failed: - return - # C.g:277:15: ( '=' constant_expression )? - alt25 = 2 - LA25_0 = self.input.LA(1) - - if (LA25_0 == 28) : - alt25 = 1 - if alt25 == 1: - # C.g:277:16: '=' constant_expression - self.match(self.input, 28, self.FOLLOW_28_in_enumerator698) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_enumerator700) - self.constant_expression() - self.following.pop() - if self.failed: - return - - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 20, enumerator_StartIndex) - - pass - - return - - # $ANTLR end enumerator - - - # $ANTLR start type_qualifier - # C.g:280:1: type_qualifier : ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' ); - def type_qualifier(self, ): - - type_qualifier_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 21): - return - - # C.g:281:2: ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' ) - # C.g: - if (49 <= self.input.LA(1) <= 61): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_type_qualifier0 - ) - raise mse - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 21, type_qualifier_StartIndex) - - pass - - return - - # $ANTLR end type_qualifier - - class declarator_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start declarator - # C.g:296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer ); - def declarator(self, ): - - retval = self.declarator_return() - retval.start = self.input.LT(1) - declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 22): - return retval - - # C.g:297:2: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer ) - alt30 = 2 - LA30_0 = self.input.LA(1) - - if (LA30_0 == 66) : - LA30_1 = self.input.LA(2) - - if (self.synpred66()) : - alt30 = 1 - elif (True) : - alt30 = 2 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 1, self.input) - - raise nvae - - elif (LA30_0 == IDENTIFIER or (58 <= LA30_0 <= 60) or LA30_0 == 62) : - alt30 = 1 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 0, self.input) - - raise nvae - - if alt30 == 1: - # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator - # C.g:297:4: ( pointer )? - alt26 = 2 - LA26_0 = self.input.LA(1) - - if (LA26_0 == 66) : - alt26 = 1 - if alt26 == 1: - # C.g:0:0: pointer - self.following.append(self.FOLLOW_pointer_in_declarator784) - self.pointer() - self.following.pop() - if self.failed: - return retval - - - - # C.g:297:13: ( 'EFIAPI' )? - alt27 = 2 - LA27_0 = self.input.LA(1) - - if (LA27_0 == 58) : - alt27 = 1 - if alt27 == 1: - # C.g:297:14: 'EFIAPI' - self.match(self.input, 58, self.FOLLOW_58_in_declarator788) - if self.failed: - return retval - - - - # C.g:297:25: ( 'EFI_BOOTSERVICE' )? - alt28 = 2 - LA28_0 = self.input.LA(1) - - if (LA28_0 == 59) : - alt28 = 1 - if alt28 == 1: - # C.g:297:26: 'EFI_BOOTSERVICE' - self.match(self.input, 59, self.FOLLOW_59_in_declarator793) - if self.failed: - return retval - - - - # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )? - alt29 = 2 - LA29_0 = self.input.LA(1) - - if (LA29_0 == 60) : - alt29 = 1 - if alt29 == 1: - # C.g:297:47: 'EFI_RUNTIMESERVICE' - self.match(self.input, 60, self.FOLLOW_60_in_declarator798) - if self.failed: - return retval - - - - self.following.append(self.FOLLOW_direct_declarator_in_declarator802) - self.direct_declarator() - self.following.pop() - if self.failed: - return retval - - - elif alt30 == 2: - # C.g:299:4: pointer - self.following.append(self.FOLLOW_pointer_in_declarator808) - self.pointer() - self.following.pop() - if self.failed: - return retval - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 22, declarator_StartIndex) - - pass - - return retval - - # $ANTLR end declarator - - - # $ANTLR start direct_declarator - # C.g:302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ ); - def direct_declarator(self, ): - - direct_declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 23): - return - - # C.g:303:2: ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ ) - alt34 = 2 - LA34_0 = self.input.LA(1) - - if (LA34_0 == IDENTIFIER) : - alt34 = 1 - elif (LA34_0 == 62) : - alt34 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ );", 34, 0, self.input) - - raise nvae - - if alt34 == 1: - # C.g:303:4: IDENTIFIER ( declarator_suffix )* - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_direct_declarator819) - if self.failed: - return - # C.g:303:15: ( declarator_suffix )* - while True: #loop31 - alt31 = 2 - LA31_0 = self.input.LA(1) - - if (LA31_0 == 62) : - LA31 = self.input.LA(2) - if LA31 == 63: - LA31_30 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 58: - LA31_31 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 66: - LA31_32 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 59: - LA31_33 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 60: - LA31_34 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == IDENTIFIER: - LA31_35 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 29 or LA31 == 30 or LA31 == 31 or LA31 == 32 or LA31 == 33: - LA31_37 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 34: - LA31_38 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 35: - LA31_39 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 36: - LA31_40 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 37: - LA31_41 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 38: - LA31_42 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 39: - LA31_43 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 40: - LA31_44 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 41: - LA31_45 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 42: - LA31_46 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 45 or LA31 == 46: - LA31_47 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 48: - LA31_48 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 49 or LA31 == 50 or LA31 == 51 or LA31 == 52 or LA31 == 53 or LA31 == 54 or LA31 == 55 or LA31 == 56 or LA31 == 57 or LA31 == 61: - LA31_49 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - - elif (LA31_0 == 64) : - LA31 = self.input.LA(2) - if LA31 == 65: - LA31_51 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 62: - LA31_52 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == IDENTIFIER: - LA31_53 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == HEX_LITERAL: - LA31_54 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == OCTAL_LITERAL: - LA31_55 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == DECIMAL_LITERAL: - LA31_56 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == CHARACTER_LITERAL: - LA31_57 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == STRING_LITERAL: - LA31_58 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == FLOATING_POINT_LITERAL: - LA31_59 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 72: - LA31_60 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 73: - LA31_61 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 66 or LA31 == 68 or LA31 == 69 or LA31 == 77 or LA31 == 78 or LA31 == 79: - LA31_62 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 74: - LA31_63 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - - - - if alt31 == 1: - # C.g:0:0: declarator_suffix - self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator821) - self.declarator_suffix() - self.following.pop() - if self.failed: - return - - - else: - break #loop31 - - - - - elif alt34 == 2: - # C.g:304:4: '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ - self.match(self.input, 62, self.FOLLOW_62_in_direct_declarator827) - if self.failed: - return - # C.g:304:8: ( 'EFIAPI' )? - alt32 = 2 - LA32_0 = self.input.LA(1) - - if (LA32_0 == 58) : - LA32_1 = self.input.LA(2) - - if (self.synpred69()) : - alt32 = 1 - if alt32 == 1: - # C.g:304:9: 'EFIAPI' - self.match(self.input, 58, self.FOLLOW_58_in_direct_declarator830) - if self.failed: - return - - - - self.following.append(self.FOLLOW_declarator_in_direct_declarator834) - self.declarator() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_direct_declarator836) - if self.failed: - return - # C.g:304:35: ( declarator_suffix )+ - cnt33 = 0 - while True: #loop33 - alt33 = 2 - LA33_0 = self.input.LA(1) - - if (LA33_0 == 62) : - LA33 = self.input.LA(2) - if LA33 == 63: - LA33_30 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 58: - LA33_31 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 66: - LA33_32 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 59: - LA33_33 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 60: - LA33_34 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == IDENTIFIER: - LA33_35 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 29 or LA33 == 30 or LA33 == 31 or LA33 == 32 or LA33 == 33: - LA33_37 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 34: - LA33_38 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 35: - LA33_39 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 36: - LA33_40 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 37: - LA33_41 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 38: - LA33_42 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 39: - LA33_43 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 40: - LA33_44 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 41: - LA33_45 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 42: - LA33_46 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 45 or LA33 == 46: - LA33_47 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 48: - LA33_48 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 49 or LA33 == 50 or LA33 == 51 or LA33 == 52 or LA33 == 53 or LA33 == 54 or LA33 == 55 or LA33 == 56 or LA33 == 57 or LA33 == 61: - LA33_49 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - - elif (LA33_0 == 64) : - LA33 = self.input.LA(2) - if LA33 == 65: - LA33_51 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 62: - LA33_52 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == IDENTIFIER: - LA33_53 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == HEX_LITERAL: - LA33_54 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == OCTAL_LITERAL: - LA33_55 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == DECIMAL_LITERAL: - LA33_56 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == CHARACTER_LITERAL: - LA33_57 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == STRING_LITERAL: - LA33_58 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == FLOATING_POINT_LITERAL: - LA33_59 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 72: - LA33_60 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 73: - LA33_61 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 66 or LA33 == 68 or LA33 == 69 or LA33 == 77 or LA33 == 78 or LA33 == 79: - LA33_62 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 74: - LA33_63 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - - - - if alt33 == 1: - # C.g:0:0: declarator_suffix - self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator838) - self.declarator_suffix() - self.following.pop() - if self.failed: - return - - - else: - if cnt33 >= 1: - break #loop33 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(33, self.input) - raise eee - - cnt33 += 1 - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 23, direct_declarator_StartIndex) - - pass - - return - - # $ANTLR end direct_declarator - - - # $ANTLR start declarator_suffix - # C.g:307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' ); - def declarator_suffix(self, ): - - declarator_suffix_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 24): - return - - # C.g:308:2: ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' ) - alt35 = 5 - LA35_0 = self.input.LA(1) - - if (LA35_0 == 64) : - LA35_1 = self.input.LA(2) - - if (LA35_1 == 65) : - alt35 = 2 - elif ((IDENTIFIER <= LA35_1 <= FLOATING_POINT_LITERAL) or LA35_1 == 62 or LA35_1 == 66 or (68 <= LA35_1 <= 69) or (72 <= LA35_1 <= 74) or (77 <= LA35_1 <= 79)) : - alt35 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 1, self.input) - - raise nvae - - elif (LA35_0 == 62) : - LA35 = self.input.LA(2) - if LA35 == 63: - alt35 = 5 - elif LA35 == 29 or LA35 == 30 or LA35 == 31 or LA35 == 32 or LA35 == 33 or LA35 == 34 or LA35 == 35 or LA35 == 36 or LA35 == 37 or LA35 == 38 or LA35 == 39 or LA35 == 40 or LA35 == 41 or LA35 == 42 or LA35 == 45 or LA35 == 46 or LA35 == 48 or LA35 == 49 or LA35 == 50 or LA35 == 51 or LA35 == 52 or LA35 == 53 or LA35 == 54 or LA35 == 55 or LA35 == 56 or LA35 == 57 or LA35 == 58 or LA35 == 59 or LA35 == 60 or LA35 == 61 or LA35 == 66: - alt35 = 3 - elif LA35 == IDENTIFIER: - LA35_29 = self.input.LA(3) - - if (self.synpred73()) : - alt35 = 3 - elif (self.synpred74()) : - alt35 = 4 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 29, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 2, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 0, self.input) - - raise nvae - - if alt35 == 1: - # C.g:308:6: '[' constant_expression ']' - self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix852) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_declarator_suffix854) - self.constant_expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix856) - if self.failed: - return - - - elif alt35 == 2: - # C.g:309:9: '[' ']' - self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix866) - if self.failed: - return - self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix868) - if self.failed: - return - - - elif alt35 == 3: - # C.g:310:9: '(' parameter_type_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix878) - if self.failed: - return - self.following.append(self.FOLLOW_parameter_type_list_in_declarator_suffix880) - self.parameter_type_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix882) - if self.failed: - return - - - elif alt35 == 4: - # C.g:311:9: '(' identifier_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix892) - if self.failed: - return - self.following.append(self.FOLLOW_identifier_list_in_declarator_suffix894) - self.identifier_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix896) - if self.failed: - return - - - elif alt35 == 5: - # C.g:312:9: '(' ')' - self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix906) - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix908) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 24, declarator_suffix_StartIndex) - - pass - - return - - # $ANTLR end declarator_suffix - - - # $ANTLR start pointer - # C.g:315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' ); - def pointer(self, ): - - pointer_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 25): - return - - # C.g:316:2: ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' ) - alt38 = 3 - LA38_0 = self.input.LA(1) - - if (LA38_0 == 66) : - LA38 = self.input.LA(2) - if LA38 == 66: - LA38_2 = self.input.LA(3) - - if (self.synpred78()) : - alt38 = 2 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 2, self.input) - - raise nvae - - elif LA38 == 58: - LA38_3 = self.input.LA(3) - - if (self.synpred77()) : - alt38 = 1 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 3, self.input) - - raise nvae - - elif LA38 == 59: - LA38_4 = self.input.LA(3) - - if (self.synpred77()) : - alt38 = 1 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 4, self.input) - - raise nvae - - elif LA38 == 60: - LA38_5 = self.input.LA(3) - - if (self.synpred77()) : - alt38 = 1 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 5, self.input) - - raise nvae - - elif LA38 == EOF or LA38 == IDENTIFIER or LA38 == 25 or LA38 == 26 or LA38 == 27 or LA38 == 28 or LA38 == 29 or LA38 == 30 or LA38 == 31 or LA38 == 32 or LA38 == 33 or LA38 == 34 or LA38 == 35 or LA38 == 36 or LA38 == 37 or LA38 == 38 or LA38 == 39 or LA38 == 40 or LA38 == 41 or LA38 == 42 or LA38 == 43 or LA38 == 45 or LA38 == 46 or LA38 == 47 or LA38 == 48 or LA38 == 62 or LA38 == 63 or LA38 == 64: - alt38 = 3 - elif LA38 == 53: - LA38_21 = self.input.LA(3) - - if (self.synpred77()) : - alt38 = 1 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 21, self.input) - - raise nvae - - elif LA38 == 49 or LA38 == 50 or LA38 == 51 or LA38 == 52 or LA38 == 54 or LA38 == 55 or LA38 == 56 or LA38 == 57 or LA38 == 61: - LA38_29 = self.input.LA(3) - - if (self.synpred77()) : - alt38 = 1 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 29, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 1, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 0, self.input) - - raise nvae - - if alt38 == 1: - # C.g:316:4: '*' ( type_qualifier )+ ( pointer )? - self.match(self.input, 66, self.FOLLOW_66_in_pointer919) - if self.failed: - return - # C.g:316:8: ( type_qualifier )+ - cnt36 = 0 - while True: #loop36 - alt36 = 2 - LA36 = self.input.LA(1) - if LA36 == 58: - LA36_2 = self.input.LA(2) - - if (self.synpred75()) : - alt36 = 1 - - - elif LA36 == 59: - LA36_3 = self.input.LA(2) - - if (self.synpred75()) : - alt36 = 1 - - - elif LA36 == 60: - LA36_4 = self.input.LA(2) - - if (self.synpred75()) : - alt36 = 1 - - - elif LA36 == 53: - LA36_20 = self.input.LA(2) - - if (self.synpred75()) : - alt36 = 1 - - - elif LA36 == 49 or LA36 == 50 or LA36 == 51 or LA36 == 52 or LA36 == 54 or LA36 == 55 or LA36 == 56 or LA36 == 57 or LA36 == 61: - LA36_28 = self.input.LA(2) - - if (self.synpred75()) : - alt36 = 1 - - - - if alt36 == 1: - # C.g:0:0: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_pointer921) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - else: - if cnt36 >= 1: - break #loop36 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(36, self.input) - raise eee - - cnt36 += 1 - - - # C.g:316:24: ( pointer )? - alt37 = 2 - LA37_0 = self.input.LA(1) - - if (LA37_0 == 66) : - LA37_1 = self.input.LA(2) - - if (self.synpred76()) : - alt37 = 1 - if alt37 == 1: - # C.g:0:0: pointer - self.following.append(self.FOLLOW_pointer_in_pointer924) - self.pointer() - self.following.pop() - if self.failed: - return - - - - - - elif alt38 == 2: - # C.g:317:4: '*' pointer - self.match(self.input, 66, self.FOLLOW_66_in_pointer930) - if self.failed: - return - self.following.append(self.FOLLOW_pointer_in_pointer932) - self.pointer() - self.following.pop() - if self.failed: - return - - - elif alt38 == 3: - # C.g:318:4: '*' - self.match(self.input, 66, self.FOLLOW_66_in_pointer937) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 25, pointer_StartIndex) - - pass - - return - - # $ANTLR end pointer - - - # $ANTLR start parameter_type_list - # C.g:321:1: parameter_type_list : parameter_list ( ',' ( 'OPTIONAL' )? '...' )? ; - def parameter_type_list(self, ): - - parameter_type_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 26): - return - - # C.g:322:2: ( parameter_list ( ',' ( 'OPTIONAL' )? '...' )? ) - # C.g:322:4: parameter_list ( ',' ( 'OPTIONAL' )? '...' )? - self.following.append(self.FOLLOW_parameter_list_in_parameter_type_list948) - self.parameter_list() - self.following.pop() - if self.failed: - return - # C.g:322:19: ( ',' ( 'OPTIONAL' )? '...' )? - alt40 = 2 - LA40_0 = self.input.LA(1) - - if (LA40_0 == 27) : - alt40 = 1 - if alt40 == 1: - # C.g:322:20: ',' ( 'OPTIONAL' )? '...' - self.match(self.input, 27, self.FOLLOW_27_in_parameter_type_list951) - if self.failed: - return - # C.g:322:24: ( 'OPTIONAL' )? - alt39 = 2 - LA39_0 = self.input.LA(1) - - if (LA39_0 == 53) : - alt39 = 1 - if alt39 == 1: - # C.g:322:25: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_parameter_type_list954) - if self.failed: - return - - - - self.match(self.input, 67, self.FOLLOW_67_in_parameter_type_list958) - if self.failed: - return - - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 26, parameter_type_list_StartIndex) - - pass - - return - - # $ANTLR end parameter_type_list - - - # $ANTLR start parameter_list - # C.g:325:1: parameter_list : parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* ; - def parameter_list(self, ): - - parameter_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 27): - return - - # C.g:326:2: ( parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* ) - # C.g:326:4: parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* - self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list971) - self.parameter_declaration() - self.following.pop() - if self.failed: - return - # C.g:326:26: ( ',' ( 'OPTIONAL' )? parameter_declaration )* - while True: #loop42 - alt42 = 2 - LA42_0 = self.input.LA(1) - - if (LA42_0 == 27) : - LA42_1 = self.input.LA(2) - - if (LA42_1 == 53) : - LA42_3 = self.input.LA(3) - - if (self.synpred82()) : - alt42 = 1 - - - elif (LA42_1 == IDENTIFIER or (29 <= LA42_1 <= 42) or (45 <= LA42_1 <= 46) or (48 <= LA42_1 <= 52) or (54 <= LA42_1 <= 61) or LA42_1 == 66) : - alt42 = 1 - - - - - if alt42 == 1: - # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration - self.match(self.input, 27, self.FOLLOW_27_in_parameter_list974) - if self.failed: - return - # C.g:326:31: ( 'OPTIONAL' )? - alt41 = 2 - LA41_0 = self.input.LA(1) - - if (LA41_0 == 53) : - LA41_1 = self.input.LA(2) - - if (self.synpred81()) : - alt41 = 1 - if alt41 == 1: - # C.g:326:32: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_parameter_list977) - if self.failed: - return - - - - self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list981) - self.parameter_declaration() - self.following.pop() - if self.failed: - return - - - else: - break #loop42 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 27, parameter_list_StartIndex) - - pass - - return - - # $ANTLR end parameter_list - - - # $ANTLR start parameter_declaration - # C.g:329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER ); - def parameter_declaration(self, ): - - parameter_declaration_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 28): - return - - # C.g:330:2: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER ) - alt46 = 2 - LA46 = self.input.LA(1) - if LA46 == 29 or LA46 == 30 or LA46 == 31 or LA46 == 32 or LA46 == 33 or LA46 == 34 or LA46 == 35 or LA46 == 36 or LA46 == 37 or LA46 == 38 or LA46 == 39 or LA46 == 40 or LA46 == 41 or LA46 == 42 or LA46 == 45 or LA46 == 46 or LA46 == 48 or LA46 == 49 or LA46 == 50 or LA46 == 51 or LA46 == 52 or LA46 == 53 or LA46 == 54 or LA46 == 55 or LA46 == 56 or LA46 == 57 or LA46 == 58 or LA46 == 59 or LA46 == 60 or LA46 == 61: - alt46 = 1 - elif LA46 == IDENTIFIER: - LA46_13 = self.input.LA(2) - - if (self.synpred86()) : - alt46 = 1 - elif (True) : - alt46 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 13, self.input) - - raise nvae - - elif LA46 == 66: - alt46 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 0, self.input) - - raise nvae - - if alt46 == 1: - # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? - self.following.append(self.FOLLOW_declaration_specifiers_in_parameter_declaration994) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - # C.g:330:27: ( declarator | abstract_declarator )* - while True: #loop43 - alt43 = 3 - LA43 = self.input.LA(1) - if LA43 == 66: - LA43_5 = self.input.LA(2) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == IDENTIFIER or LA43 == 58 or LA43 == 59 or LA43 == 60: - alt43 = 1 - elif LA43 == 62: - LA43 = self.input.LA(2) - if LA43 == 29 or LA43 == 30 or LA43 == 31 or LA43 == 32 or LA43 == 33 or LA43 == 34 or LA43 == 35 or LA43 == 36 or LA43 == 37 or LA43 == 38 or LA43 == 39 or LA43 == 40 or LA43 == 41 or LA43 == 42 or LA43 == 45 or LA43 == 46 or LA43 == 48 or LA43 == 49 or LA43 == 50 or LA43 == 51 or LA43 == 52 or LA43 == 53 or LA43 == 54 or LA43 == 55 or LA43 == 56 or LA43 == 57 or LA43 == 61 or LA43 == 63 or LA43 == 64: - alt43 = 2 - elif LA43 == IDENTIFIER: - LA43_37 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == 58: - LA43_38 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == 66: - LA43_39 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == 59: - LA43_40 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == 60: - LA43_41 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == 62: - LA43_43 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - - elif LA43 == 64: - alt43 = 2 - - if alt43 == 1: - # C.g:330:28: declarator - self.following.append(self.FOLLOW_declarator_in_parameter_declaration997) - self.declarator() - self.following.pop() - if self.failed: - return - - - elif alt43 == 2: - # C.g:330:39: abstract_declarator - self.following.append(self.FOLLOW_abstract_declarator_in_parameter_declaration999) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - - - else: - break #loop43 - - - # C.g:330:61: ( 'OPTIONAL' )? - alt44 = 2 - LA44_0 = self.input.LA(1) - - if (LA44_0 == 53) : - alt44 = 1 - if alt44 == 1: - # C.g:330:62: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_parameter_declaration1004) - if self.failed: - return - - - - - - elif alt46 == 2: - # C.g:332:4: ( pointer )* IDENTIFIER - # C.g:332:4: ( pointer )* - while True: #loop45 - alt45 = 2 - LA45_0 = self.input.LA(1) - - if (LA45_0 == 66) : - alt45 = 1 - - - if alt45 == 1: - # C.g:0:0: pointer - self.following.append(self.FOLLOW_pointer_in_parameter_declaration1013) - self.pointer() - self.following.pop() - if self.failed: - return - - - else: - break #loop45 - - - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_parameter_declaration1016) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 28, parameter_declaration_StartIndex) - - pass - - return - - # $ANTLR end parameter_declaration - - - # $ANTLR start identifier_list - # C.g:335:1: identifier_list : IDENTIFIER ( ',' IDENTIFIER )* ; - def identifier_list(self, ): - - identifier_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 29): - return - - # C.g:336:2: ( IDENTIFIER ( ',' IDENTIFIER )* ) - # C.g:336:4: IDENTIFIER ( ',' IDENTIFIER )* - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1027) - if self.failed: - return - # C.g:337:2: ( ',' IDENTIFIER )* - while True: #loop47 - alt47 = 2 - LA47_0 = self.input.LA(1) - - if (LA47_0 == 27) : - alt47 = 1 - - - if alt47 == 1: - # C.g:337:3: ',' IDENTIFIER - self.match(self.input, 27, self.FOLLOW_27_in_identifier_list1031) - if self.failed: - return - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1033) - if self.failed: - return - - - else: - break #loop47 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 29, identifier_list_StartIndex) - - pass - - return - - # $ANTLR end identifier_list - - - # $ANTLR start type_name - # C.g:340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id ); - def type_name(self, ): - - type_name_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 30): - return - - # C.g:341:2: ( specifier_qualifier_list ( abstract_declarator )? | type_id ) - alt49 = 2 - LA49_0 = self.input.LA(1) - - if ((34 <= LA49_0 <= 42) or (45 <= LA49_0 <= 46) or (48 <= LA49_0 <= 61)) : - alt49 = 1 - elif (LA49_0 == IDENTIFIER) : - LA49_13 = self.input.LA(2) - - if (self.synpred90()) : - alt49 = 1 - elif (True) : - alt49 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 13, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 0, self.input) - - raise nvae - - if alt49 == 1: - # C.g:341:4: specifier_qualifier_list ( abstract_declarator )? - self.following.append(self.FOLLOW_specifier_qualifier_list_in_type_name1046) - self.specifier_qualifier_list() - self.following.pop() - if self.failed: - return - # C.g:341:29: ( abstract_declarator )? - alt48 = 2 - LA48_0 = self.input.LA(1) - - if (LA48_0 == 62 or LA48_0 == 64 or LA48_0 == 66) : - alt48 = 1 - if alt48 == 1: - # C.g:0:0: abstract_declarator - self.following.append(self.FOLLOW_abstract_declarator_in_type_name1048) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - - - - - - elif alt49 == 2: - # C.g:342:4: type_id - self.following.append(self.FOLLOW_type_id_in_type_name1054) - self.type_id() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 30, type_name_StartIndex) - - pass - - return - - # $ANTLR end type_name - - - # $ANTLR start abstract_declarator - # C.g:345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator ); - def abstract_declarator(self, ): - - abstract_declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 31): - return - - # C.g:346:2: ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator ) - alt51 = 2 - LA51_0 = self.input.LA(1) - - if (LA51_0 == 66) : - alt51 = 1 - elif (LA51_0 == 62 or LA51_0 == 64) : - alt51 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator );", 51, 0, self.input) - - raise nvae - - if alt51 == 1: - # C.g:346:4: pointer ( direct_abstract_declarator )? - self.following.append(self.FOLLOW_pointer_in_abstract_declarator1065) - self.pointer() - self.following.pop() - if self.failed: - return - # C.g:346:12: ( direct_abstract_declarator )? - alt50 = 2 - LA50_0 = self.input.LA(1) - - if (LA50_0 == 62) : - LA50 = self.input.LA(2) - if LA50 == 63: - LA50_12 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 58: - LA50_13 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 66: - LA50_14 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 59: - LA50_15 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 60: - LA50_16 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == IDENTIFIER: - LA50_17 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 62: - LA50_18 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 64: - LA50_19 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 29 or LA50 == 30 or LA50 == 31 or LA50 == 32 or LA50 == 33: - LA50_20 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 34: - LA50_21 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 35: - LA50_22 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 36: - LA50_23 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 37: - LA50_24 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 38: - LA50_25 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 39: - LA50_26 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 40: - LA50_27 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 41: - LA50_28 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 42: - LA50_29 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 45 or LA50 == 46: - LA50_30 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 48: - LA50_31 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 49 or LA50 == 50 or LA50 == 51 or LA50 == 52 or LA50 == 53 or LA50 == 54 or LA50 == 55 or LA50 == 56 or LA50 == 57 or LA50 == 61: - LA50_32 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif (LA50_0 == 64) : - LA50 = self.input.LA(2) - if LA50 == 65: - LA50_33 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 62: - LA50_34 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == IDENTIFIER: - LA50_35 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == HEX_LITERAL: - LA50_36 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == OCTAL_LITERAL: - LA50_37 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == DECIMAL_LITERAL: - LA50_38 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == CHARACTER_LITERAL: - LA50_39 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == STRING_LITERAL: - LA50_40 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == FLOATING_POINT_LITERAL: - LA50_41 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 72: - LA50_42 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 73: - LA50_43 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 66 or LA50 == 68 or LA50 == 69 or LA50 == 77 or LA50 == 78 or LA50 == 79: - LA50_44 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 74: - LA50_45 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - if alt50 == 1: - # C.g:0:0: direct_abstract_declarator - self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1067) - self.direct_abstract_declarator() - self.following.pop() - if self.failed: - return - - - - - - elif alt51 == 2: - # C.g:347:4: direct_abstract_declarator - self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1073) - self.direct_abstract_declarator() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 31, abstract_declarator_StartIndex) - - pass - - return - - # $ANTLR end abstract_declarator - - - # $ANTLR start direct_abstract_declarator - # C.g:350:1: direct_abstract_declarator : ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* ; - def direct_abstract_declarator(self, ): - - direct_abstract_declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 32): - return - - # C.g:351:2: ( ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* ) - # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* - # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix ) - alt52 = 2 - LA52_0 = self.input.LA(1) - - if (LA52_0 == 62) : - LA52 = self.input.LA(2) - if LA52 == IDENTIFIER or LA52 == 29 or LA52 == 30 or LA52 == 31 or LA52 == 32 or LA52 == 33 or LA52 == 34 or LA52 == 35 or LA52 == 36 or LA52 == 37 or LA52 == 38 or LA52 == 39 or LA52 == 40 or LA52 == 41 or LA52 == 42 or LA52 == 45 or LA52 == 46 or LA52 == 48 or LA52 == 49 or LA52 == 50 or LA52 == 51 or LA52 == 52 or LA52 == 53 or LA52 == 54 or LA52 == 55 or LA52 == 56 or LA52 == 57 or LA52 == 58 or LA52 == 59 or LA52 == 60 or LA52 == 61 or LA52 == 63: - alt52 = 2 - elif LA52 == 66: - LA52_18 = self.input.LA(3) - - if (self.synpred93()) : - alt52 = 1 - elif (True) : - alt52 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 18, self.input) - - raise nvae - - elif LA52 == 62 or LA52 == 64: - alt52 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 1, self.input) - - raise nvae - - elif (LA52_0 == 64) : - alt52 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 0, self.input) - - raise nvae - - if alt52 == 1: - # C.g:351:6: '(' abstract_declarator ')' - self.match(self.input, 62, self.FOLLOW_62_in_direct_abstract_declarator1086) - if self.failed: - return - self.following.append(self.FOLLOW_abstract_declarator_in_direct_abstract_declarator1088) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_direct_abstract_declarator1090) - if self.failed: - return - - - elif alt52 == 2: - # C.g:351:36: abstract_declarator_suffix - self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094) - self.abstract_declarator_suffix() - self.following.pop() - if self.failed: - return - - - - # C.g:351:65: ( abstract_declarator_suffix )* - while True: #loop53 - alt53 = 2 - LA53_0 = self.input.LA(1) - - if (LA53_0 == 62) : - LA53 = self.input.LA(2) - if LA53 == 63: - LA53_12 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 58: - LA53_13 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 66: - LA53_14 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 59: - LA53_15 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 60: - LA53_16 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == IDENTIFIER: - LA53_17 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 29 or LA53 == 30 or LA53 == 31 or LA53 == 32 or LA53 == 33: - LA53_19 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 34: - LA53_20 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 35: - LA53_21 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 36: - LA53_22 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 37: - LA53_23 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 38: - LA53_24 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 39: - LA53_25 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 40: - LA53_26 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 41: - LA53_27 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 42: - LA53_28 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 45 or LA53 == 46: - LA53_29 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 48: - LA53_30 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 49 or LA53 == 50 or LA53 == 51 or LA53 == 52 or LA53 == 53 or LA53 == 54 or LA53 == 55 or LA53 == 56 or LA53 == 57 or LA53 == 61: - LA53_31 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - - elif (LA53_0 == 64) : - LA53 = self.input.LA(2) - if LA53 == 65: - LA53_33 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 62: - LA53_34 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == IDENTIFIER: - LA53_35 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == HEX_LITERAL: - LA53_36 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == OCTAL_LITERAL: - LA53_37 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == DECIMAL_LITERAL: - LA53_38 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == CHARACTER_LITERAL: - LA53_39 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == STRING_LITERAL: - LA53_40 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == FLOATING_POINT_LITERAL: - LA53_41 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 72: - LA53_42 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 73: - LA53_43 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 66 or LA53 == 68 or LA53 == 69 or LA53 == 77 or LA53 == 78 or LA53 == 79: - LA53_44 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 74: - LA53_45 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - - - - if alt53 == 1: - # C.g:0:0: abstract_declarator_suffix - self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098) - self.abstract_declarator_suffix() - self.following.pop() - if self.failed: - return - - - else: - break #loop53 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 32, direct_abstract_declarator_StartIndex) - - pass - - return - - # $ANTLR end direct_abstract_declarator - - - # $ANTLR start abstract_declarator_suffix - # C.g:354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' ); - def abstract_declarator_suffix(self, ): - - abstract_declarator_suffix_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 33): - return - - # C.g:355:2: ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' ) - alt54 = 4 - LA54_0 = self.input.LA(1) - - if (LA54_0 == 64) : - LA54_1 = self.input.LA(2) - - if (LA54_1 == 65) : - alt54 = 1 - elif ((IDENTIFIER <= LA54_1 <= FLOATING_POINT_LITERAL) or LA54_1 == 62 or LA54_1 == 66 or (68 <= LA54_1 <= 69) or (72 <= LA54_1 <= 74) or (77 <= LA54_1 <= 79)) : - alt54 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 1, self.input) - - raise nvae - - elif (LA54_0 == 62) : - LA54_2 = self.input.LA(2) - - if (LA54_2 == 63) : - alt54 = 3 - elif (LA54_2 == IDENTIFIER or (29 <= LA54_2 <= 42) or (45 <= LA54_2 <= 46) or (48 <= LA54_2 <= 61) or LA54_2 == 66) : - alt54 = 4 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 2, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 0, self.input) - - raise nvae - - if alt54 == 1: - # C.g:355:4: '[' ']' - self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1110) - if self.failed: - return - self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1112) - if self.failed: - return - - - elif alt54 == 2: - # C.g:356:4: '[' constant_expression ']' - self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1117) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_abstract_declarator_suffix1119) - self.constant_expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1121) - if self.failed: - return - - - elif alt54 == 3: - # C.g:357:4: '(' ')' - self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1126) - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1128) - if self.failed: - return - - - elif alt54 == 4: - # C.g:358:4: '(' parameter_type_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1133) - if self.failed: - return - self.following.append(self.FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135) - self.parameter_type_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1137) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 33, abstract_declarator_suffix_StartIndex) - - pass - - return - - # $ANTLR end abstract_declarator_suffix - - - # $ANTLR start initializer - # C.g:361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' ); - def initializer(self, ): - - initializer_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 34): - return - - # C.g:363:2: ( assignment_expression | '{' initializer_list ( ',' )? '}' ) - alt56 = 2 - LA56_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA56_0 <= FLOATING_POINT_LITERAL) or LA56_0 == 62 or LA56_0 == 66 or (68 <= LA56_0 <= 69) or (72 <= LA56_0 <= 74) or (77 <= LA56_0 <= 79)) : - alt56 = 1 - elif (LA56_0 == 43) : - alt56 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' );", 56, 0, self.input) - - raise nvae - - if alt56 == 1: - # C.g:363:4: assignment_expression - self.following.append(self.FOLLOW_assignment_expression_in_initializer1150) - self.assignment_expression() - self.following.pop() - if self.failed: - return - - - elif alt56 == 2: - # C.g:364:4: '{' initializer_list ( ',' )? '}' - self.match(self.input, 43, self.FOLLOW_43_in_initializer1155) - if self.failed: - return - self.following.append(self.FOLLOW_initializer_list_in_initializer1157) - self.initializer_list() - self.following.pop() - if self.failed: - return - # C.g:364:25: ( ',' )? - alt55 = 2 - LA55_0 = self.input.LA(1) - - if (LA55_0 == 27) : - alt55 = 1 - if alt55 == 1: - # C.g:0:0: ',' - self.match(self.input, 27, self.FOLLOW_27_in_initializer1159) - if self.failed: - return - - - - self.match(self.input, 44, self.FOLLOW_44_in_initializer1162) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 34, initializer_StartIndex) - - pass - - return - - # $ANTLR end initializer - - - # $ANTLR start initializer_list - # C.g:367:1: initializer_list : initializer ( ',' initializer )* ; - def initializer_list(self, ): - - initializer_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 35): - return - - # C.g:368:2: ( initializer ( ',' initializer )* ) - # C.g:368:4: initializer ( ',' initializer )* - self.following.append(self.FOLLOW_initializer_in_initializer_list1173) - self.initializer() - self.following.pop() - if self.failed: - return - # C.g:368:16: ( ',' initializer )* - while True: #loop57 - alt57 = 2 - LA57_0 = self.input.LA(1) - - if (LA57_0 == 27) : - LA57_1 = self.input.LA(2) - - if ((IDENTIFIER <= LA57_1 <= FLOATING_POINT_LITERAL) or LA57_1 == 43 or LA57_1 == 62 or LA57_1 == 66 or (68 <= LA57_1 <= 69) or (72 <= LA57_1 <= 74) or (77 <= LA57_1 <= 79)) : - alt57 = 1 - - - - - if alt57 == 1: - # C.g:368:17: ',' initializer - self.match(self.input, 27, self.FOLLOW_27_in_initializer_list1176) - if self.failed: - return - self.following.append(self.FOLLOW_initializer_in_initializer_list1178) - self.initializer() - self.following.pop() - if self.failed: - return - - - else: - break #loop57 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 35, initializer_list_StartIndex) - - pass - - return - - # $ANTLR end initializer_list - - class argument_expression_list_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start argument_expression_list - # C.g:373:1: argument_expression_list : assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* ; - def argument_expression_list(self, ): - - retval = self.argument_expression_list_return() - retval.start = self.input.LT(1) - argument_expression_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 36): - return retval - - # C.g:374:2: ( assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* ) - # C.g:374:6: assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* - self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1196) - self.assignment_expression() - self.following.pop() - if self.failed: - return retval - # C.g:374:28: ( 'OPTIONAL' )? - alt58 = 2 - LA58_0 = self.input.LA(1) - - if (LA58_0 == 53) : - alt58 = 1 - if alt58 == 1: - # C.g:374:29: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1199) - if self.failed: - return retval - - - - # C.g:374:42: ( ',' assignment_expression ( 'OPTIONAL' )? )* - while True: #loop60 - alt60 = 2 - LA60_0 = self.input.LA(1) - - if (LA60_0 == 27) : - alt60 = 1 - - - if alt60 == 1: - # C.g:374:43: ',' assignment_expression ( 'OPTIONAL' )? - self.match(self.input, 27, self.FOLLOW_27_in_argument_expression_list1204) - if self.failed: - return retval - self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1206) - self.assignment_expression() - self.following.pop() - if self.failed: - return retval - # C.g:374:69: ( 'OPTIONAL' )? - alt59 = 2 - LA59_0 = self.input.LA(1) - - if (LA59_0 == 53) : - alt59 = 1 - if alt59 == 1: - # C.g:374:70: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1209) - if self.failed: - return retval - - - - - - else: - break #loop60 - - - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 36, argument_expression_list_StartIndex) - - pass - - return retval - - # $ANTLR end argument_expression_list - - - # $ANTLR start additive_expression - # C.g:377:1: additive_expression : ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* ; - def additive_expression(self, ): - - additive_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 37): - return - - # C.g:378:2: ( ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* ) - # C.g:378:4: ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* - # C.g:378:4: ( multiplicative_expression ) - # C.g:378:5: multiplicative_expression - self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1225) - self.multiplicative_expression() - self.following.pop() - if self.failed: - return - - - - # C.g:378:32: ( '+' multiplicative_expression | '-' multiplicative_expression )* - while True: #loop61 - alt61 = 3 - LA61_0 = self.input.LA(1) - - if (LA61_0 == 68) : - alt61 = 1 - elif (LA61_0 == 69) : - alt61 = 2 - - - if alt61 == 1: - # C.g:378:33: '+' multiplicative_expression - self.match(self.input, 68, self.FOLLOW_68_in_additive_expression1229) - if self.failed: - return - self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1231) - self.multiplicative_expression() - self.following.pop() - if self.failed: - return - - - elif alt61 == 2: - # C.g:378:65: '-' multiplicative_expression - self.match(self.input, 69, self.FOLLOW_69_in_additive_expression1235) - if self.failed: - return - self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1237) - self.multiplicative_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop61 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 37, additive_expression_StartIndex) - - pass - - return - - # $ANTLR end additive_expression - - - # $ANTLR start multiplicative_expression - # C.g:381:1: multiplicative_expression : ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* ; - def multiplicative_expression(self, ): - - multiplicative_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 38): - return - - # C.g:382:2: ( ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* ) - # C.g:382:4: ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* - # C.g:382:4: ( cast_expression ) - # C.g:382:5: cast_expression - self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1251) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - - # C.g:382:22: ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* - while True: #loop62 - alt62 = 4 - LA62 = self.input.LA(1) - if LA62 == 66: - alt62 = 1 - elif LA62 == 70: - alt62 = 2 - elif LA62 == 71: - alt62 = 3 - - if alt62 == 1: - # C.g:382:23: '*' cast_expression - self.match(self.input, 66, self.FOLLOW_66_in_multiplicative_expression1255) - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1257) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - elif alt62 == 2: - # C.g:382:45: '/' cast_expression - self.match(self.input, 70, self.FOLLOW_70_in_multiplicative_expression1261) - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1263) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - elif alt62 == 3: - # C.g:382:67: '%' cast_expression - self.match(self.input, 71, self.FOLLOW_71_in_multiplicative_expression1267) - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1269) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop62 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 38, multiplicative_expression_StartIndex) - - pass - - return - - # $ANTLR end multiplicative_expression - - - # $ANTLR start cast_expression - # C.g:385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression ); - def cast_expression(self, ): - - cast_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 39): - return - - # C.g:386:2: ( '(' type_name ')' cast_expression | unary_expression ) - alt63 = 2 - LA63_0 = self.input.LA(1) - - if (LA63_0 == 62) : - LA63 = self.input.LA(2) - if LA63 == 34 or LA63 == 35 or LA63 == 36 or LA63 == 37 or LA63 == 38 or LA63 == 39 or LA63 == 40 or LA63 == 41 or LA63 == 42 or LA63 == 45 or LA63 == 46 or LA63 == 48 or LA63 == 49 or LA63 == 50 or LA63 == 51 or LA63 == 52 or LA63 == 53 or LA63 == 54 or LA63 == 55 or LA63 == 56 or LA63 == 57 or LA63 == 58 or LA63 == 59 or LA63 == 60 or LA63 == 61: - alt63 = 1 - elif LA63 == IDENTIFIER: - LA63_25 = self.input.LA(3) - - if (self.synpred109()) : - alt63 = 1 - elif (True) : - alt63 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 25, self.input) - - raise nvae - - elif LA63 == HEX_LITERAL or LA63 == OCTAL_LITERAL or LA63 == DECIMAL_LITERAL or LA63 == CHARACTER_LITERAL or LA63 == STRING_LITERAL or LA63 == FLOATING_POINT_LITERAL or LA63 == 62 or LA63 == 66 or LA63 == 68 or LA63 == 69 or LA63 == 72 or LA63 == 73 or LA63 == 74 or LA63 == 77 or LA63 == 78 or LA63 == 79: - alt63 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 1, self.input) - - raise nvae - - elif ((IDENTIFIER <= LA63_0 <= FLOATING_POINT_LITERAL) or LA63_0 == 66 or (68 <= LA63_0 <= 69) or (72 <= LA63_0 <= 74) or (77 <= LA63_0 <= 79)) : - alt63 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 0, self.input) - - raise nvae - - if alt63 == 1: - # C.g:386:4: '(' type_name ')' cast_expression - self.match(self.input, 62, self.FOLLOW_62_in_cast_expression1282) - if self.failed: - return - self.following.append(self.FOLLOW_type_name_in_cast_expression1284) - self.type_name() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_cast_expression1286) - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_cast_expression1288) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - elif alt63 == 2: - # C.g:387:4: unary_expression - self.following.append(self.FOLLOW_unary_expression_in_cast_expression1293) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 39, cast_expression_StartIndex) - - pass - - return - - # $ANTLR end cast_expression - - - # $ANTLR start unary_expression - # C.g:390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' ); - def unary_expression(self, ): - - unary_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 40): - return - - # C.g:391:2: ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' ) - alt64 = 6 - LA64 = self.input.LA(1) - if LA64 == IDENTIFIER or LA64 == HEX_LITERAL or LA64 == OCTAL_LITERAL or LA64 == DECIMAL_LITERAL or LA64 == CHARACTER_LITERAL or LA64 == STRING_LITERAL or LA64 == FLOATING_POINT_LITERAL or LA64 == 62: - alt64 = 1 - elif LA64 == 72: - alt64 = 2 - elif LA64 == 73: - alt64 = 3 - elif LA64 == 66 or LA64 == 68 or LA64 == 69 or LA64 == 77 or LA64 == 78 or LA64 == 79: - alt64 = 4 - elif LA64 == 74: - LA64_12 = self.input.LA(2) - - if (LA64_12 == 62) : - LA64_13 = self.input.LA(3) - - if (self.synpred114()) : - alt64 = 5 - elif (True) : - alt64 = 6 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 13, self.input) - - raise nvae - - elif ((IDENTIFIER <= LA64_12 <= FLOATING_POINT_LITERAL) or LA64_12 == 66 or (68 <= LA64_12 <= 69) or (72 <= LA64_12 <= 74) or (77 <= LA64_12 <= 79)) : - alt64 = 5 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 12, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 0, self.input) - - raise nvae - - if alt64 == 1: - # C.g:391:4: postfix_expression - self.following.append(self.FOLLOW_postfix_expression_in_unary_expression1304) - self.postfix_expression() - self.following.pop() - if self.failed: - return - - - elif alt64 == 2: - # C.g:392:4: '++' unary_expression - self.match(self.input, 72, self.FOLLOW_72_in_unary_expression1309) - if self.failed: - return - self.following.append(self.FOLLOW_unary_expression_in_unary_expression1311) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - elif alt64 == 3: - # C.g:393:4: '--' unary_expression - self.match(self.input, 73, self.FOLLOW_73_in_unary_expression1316) - if self.failed: - return - self.following.append(self.FOLLOW_unary_expression_in_unary_expression1318) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - elif alt64 == 4: - # C.g:394:4: unary_operator cast_expression - self.following.append(self.FOLLOW_unary_operator_in_unary_expression1323) - self.unary_operator() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_unary_expression1325) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - elif alt64 == 5: - # C.g:395:4: 'sizeof' unary_expression - self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1330) - if self.failed: - return - self.following.append(self.FOLLOW_unary_expression_in_unary_expression1332) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - elif alt64 == 6: - # C.g:396:4: 'sizeof' '(' type_name ')' - self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1337) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_unary_expression1339) - if self.failed: - return - self.following.append(self.FOLLOW_type_name_in_unary_expression1341) - self.type_name() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_unary_expression1343) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 40, unary_expression_StartIndex) - - pass - - return - - # $ANTLR end unary_expression - - - # $ANTLR start postfix_expression - # C.g:399:1: postfix_expression : p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* ; - def postfix_expression(self, ): - self.postfix_expression_stack.append(postfix_expression_scope()) - postfix_expression_StartIndex = self.input.index() - a = None - b = None - x = None - y = None - z = None - p = None - - c = None - - - - self.postfix_expression_stack[-1].FuncCallText = '' - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 41): - return - - # C.g:406:2: (p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* ) - # C.g:406:6: p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* - self.following.append(self.FOLLOW_primary_expression_in_postfix_expression1367) - p = self.primary_expression() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - self.postfix_expression_stack[-1].FuncCallText += self.input.toString(p.start,p.stop) - - # C.g:407:9: ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* - while True: #loop65 - alt65 = 10 - LA65 = self.input.LA(1) - if LA65 == 66: - LA65_1 = self.input.LA(2) - - if (LA65_1 == IDENTIFIER) : - LA65_30 = self.input.LA(3) - - if (self.synpred120()) : - alt65 = 6 - - - - - elif LA65 == 64: - alt65 = 1 - elif LA65 == 62: - LA65 = self.input.LA(2) - if LA65 == 63: - alt65 = 2 - elif LA65 == 29 or LA65 == 30 or LA65 == 31 or LA65 == 32 or LA65 == 33 or LA65 == 34 or LA65 == 35 or LA65 == 36 or LA65 == 37 or LA65 == 38 or LA65 == 39 or LA65 == 40 or LA65 == 41 or LA65 == 42 or LA65 == 45 or LA65 == 46 or LA65 == 48 or LA65 == 49 or LA65 == 50 or LA65 == 51 or LA65 == 52 or LA65 == 53 or LA65 == 54 or LA65 == 55 or LA65 == 56 or LA65 == 57 or LA65 == 58 or LA65 == 59 or LA65 == 60 or LA65 == 61: - alt65 = 4 - elif LA65 == IDENTIFIER: - LA65_55 = self.input.LA(3) - - if (self.synpred117()) : - alt65 = 3 - elif (self.synpred118()) : - alt65 = 4 - - - elif LA65 == 66: - LA65_57 = self.input.LA(3) - - if (self.synpred117()) : - alt65 = 3 - elif (self.synpred118()) : - alt65 = 4 - - - elif LA65 == HEX_LITERAL or LA65 == OCTAL_LITERAL or LA65 == DECIMAL_LITERAL or LA65 == CHARACTER_LITERAL or LA65 == STRING_LITERAL or LA65 == FLOATING_POINT_LITERAL or LA65 == 62 or LA65 == 68 or LA65 == 69 or LA65 == 72 or LA65 == 73 or LA65 == 74 or LA65 == 77 or LA65 == 78 or LA65 == 79: - alt65 = 3 - - elif LA65 == 75: - alt65 = 5 - elif LA65 == 76: - alt65 = 7 - elif LA65 == 72: - alt65 = 8 - elif LA65 == 73: - alt65 = 9 - - if alt65 == 1: - # C.g:407:13: '[' expression ']' - self.match(self.input, 64, self.FOLLOW_64_in_postfix_expression1383) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_postfix_expression1385) - self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 65, self.FOLLOW_65_in_postfix_expression1387) - if self.failed: - return - - - elif alt65 == 2: - # C.g:408:13: '(' a= ')' - self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1401) - if self.failed: - return - a = self.input.LT(1) - self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1405) - if self.failed: - return - if self.backtracking == 0: - self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, a.line, a.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, '') - - - - elif alt65 == 3: - # C.g:409:13: '(' c= argument_expression_list b= ')' - self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1420) - if self.failed: - return - self.following.append(self.FOLLOW_argument_expression_list_in_postfix_expression1424) - c = self.argument_expression_list() - self.following.pop() - if self.failed: - return - b = self.input.LT(1) - self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1428) - if self.failed: - return - if self.backtracking == 0: - self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, b.line, b.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, self.input.toString(c.start,c.stop)) - - - - elif alt65 == 4: - # C.g:410:13: '(' macro_parameter_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1444) - if self.failed: - return - self.following.append(self.FOLLOW_macro_parameter_list_in_postfix_expression1446) - self.macro_parameter_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1448) - if self.failed: - return - - - elif alt65 == 5: - # C.g:411:13: '.' x= IDENTIFIER - self.match(self.input, 75, self.FOLLOW_75_in_postfix_expression1462) - if self.failed: - return - x = self.input.LT(1) - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1466) - if self.failed: - return - if self.backtracking == 0: - self.postfix_expression_stack[-1].FuncCallText += '.' + x.text - - - - elif alt65 == 6: - # C.g:412:13: '*' y= IDENTIFIER - self.match(self.input, 66, self.FOLLOW_66_in_postfix_expression1482) - if self.failed: - return - y = self.input.LT(1) - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1486) - if self.failed: - return - if self.backtracking == 0: - self.postfix_expression_stack[-1].FuncCallText = y.text - - - - elif alt65 == 7: - # C.g:413:13: '->' z= IDENTIFIER - self.match(self.input, 76, self.FOLLOW_76_in_postfix_expression1502) - if self.failed: - return - z = self.input.LT(1) - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1506) - if self.failed: - return - if self.backtracking == 0: - self.postfix_expression_stack[-1].FuncCallText += '->' + z.text - - - - elif alt65 == 8: - # C.g:414:13: '++' - self.match(self.input, 72, self.FOLLOW_72_in_postfix_expression1522) - if self.failed: - return - - - elif alt65 == 9: - # C.g:415:13: '--' - self.match(self.input, 73, self.FOLLOW_73_in_postfix_expression1536) - if self.failed: - return - - - else: - break #loop65 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 41, postfix_expression_StartIndex) - - self.postfix_expression_stack.pop() - pass - - return - - # $ANTLR end postfix_expression - - - # $ANTLR start macro_parameter_list - # C.g:419:1: macro_parameter_list : parameter_declaration ( ',' parameter_declaration )* ; - def macro_parameter_list(self, ): - - macro_parameter_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 42): - return - - # C.g:420:2: ( parameter_declaration ( ',' parameter_declaration )* ) - # C.g:420:4: parameter_declaration ( ',' parameter_declaration )* - self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1559) - self.parameter_declaration() - self.following.pop() - if self.failed: - return - # C.g:420:26: ( ',' parameter_declaration )* - while True: #loop66 - alt66 = 2 - LA66_0 = self.input.LA(1) - - if (LA66_0 == 27) : - alt66 = 1 - - - if alt66 == 1: - # C.g:420:27: ',' parameter_declaration - self.match(self.input, 27, self.FOLLOW_27_in_macro_parameter_list1562) - if self.failed: - return - self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1564) - self.parameter_declaration() - self.following.pop() - if self.failed: - return - - - else: - break #loop66 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 42, macro_parameter_list_StartIndex) - - pass - - return - - # $ANTLR end macro_parameter_list - - - # $ANTLR start unary_operator - # C.g:423:1: unary_operator : ( '&' | '*' | '+' | '-' | '~' | '!' ); - def unary_operator(self, ): - - unary_operator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 43): - return - - # C.g:424:2: ( '&' | '*' | '+' | '-' | '~' | '!' ) - # C.g: - if self.input.LA(1) == 66 or (68 <= self.input.LA(1) <= 69) or (77 <= self.input.LA(1) <= 79): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_unary_operator0 - ) - raise mse - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 43, unary_operator_StartIndex) - - pass - - return - - # $ANTLR end unary_operator - - class primary_expression_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start primary_expression - # C.g:432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' ); - def primary_expression(self, ): - - retval = self.primary_expression_return() - retval.start = self.input.LT(1) - primary_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 44): - return retval - - # C.g:433:2: ( IDENTIFIER | constant | '(' expression ')' ) - alt67 = 3 - LA67 = self.input.LA(1) - if LA67 == IDENTIFIER: - LA67_1 = self.input.LA(2) - - if (LA67_1 == EOF or LA67_1 == 25 or (27 <= LA67_1 <= 28) or LA67_1 == 44 or LA67_1 == 47 or LA67_1 == 53 or (62 <= LA67_1 <= 66) or (68 <= LA67_1 <= 73) or (75 <= LA67_1 <= 77) or (80 <= LA67_1 <= 102)) : - alt67 = 1 - elif (LA67_1 == IDENTIFIER or LA67_1 == STRING_LITERAL) : - alt67 = 2 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 1, self.input) - - raise nvae - - elif LA67 == HEX_LITERAL or LA67 == OCTAL_LITERAL or LA67 == DECIMAL_LITERAL or LA67 == CHARACTER_LITERAL or LA67 == STRING_LITERAL or LA67 == FLOATING_POINT_LITERAL: - alt67 = 2 - elif LA67 == 62: - alt67 = 3 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 0, self.input) - - raise nvae - - if alt67 == 1: - # C.g:433:4: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_primary_expression1613) - if self.failed: - return retval - - - elif alt67 == 2: - # C.g:434:4: constant - self.following.append(self.FOLLOW_constant_in_primary_expression1618) - self.constant() - self.following.pop() - if self.failed: - return retval - - - elif alt67 == 3: - # C.g:435:4: '(' expression ')' - self.match(self.input, 62, self.FOLLOW_62_in_primary_expression1623) - if self.failed: - return retval - self.following.append(self.FOLLOW_expression_in_primary_expression1625) - self.expression() - self.following.pop() - if self.failed: - return retval - self.match(self.input, 63, self.FOLLOW_63_in_primary_expression1627) - if self.failed: - return retval - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 44, primary_expression_StartIndex) - - pass - - return retval - - # $ANTLR end primary_expression - - - # $ANTLR start constant - # C.g:438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL ); - def constant(self, ): - - constant_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 45): - return - - # C.g:439:5: ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL ) - alt72 = 6 - LA72 = self.input.LA(1) - if LA72 == HEX_LITERAL: - alt72 = 1 - elif LA72 == OCTAL_LITERAL: - alt72 = 2 - elif LA72 == DECIMAL_LITERAL: - alt72 = 3 - elif LA72 == CHARACTER_LITERAL: - alt72 = 4 - elif LA72 == IDENTIFIER or LA72 == STRING_LITERAL: - alt72 = 5 - elif LA72 == FLOATING_POINT_LITERAL: - alt72 = 6 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL );", 72, 0, self.input) - - raise nvae - - if alt72 == 1: - # C.g:439:9: HEX_LITERAL - self.match(self.input, HEX_LITERAL, self.FOLLOW_HEX_LITERAL_in_constant1643) - if self.failed: - return - - - elif alt72 == 2: - # C.g:440:9: OCTAL_LITERAL - self.match(self.input, OCTAL_LITERAL, self.FOLLOW_OCTAL_LITERAL_in_constant1653) - if self.failed: - return - - - elif alt72 == 3: - # C.g:441:9: DECIMAL_LITERAL - self.match(self.input, DECIMAL_LITERAL, self.FOLLOW_DECIMAL_LITERAL_in_constant1663) - if self.failed: - return - - - elif alt72 == 4: - # C.g:442:7: CHARACTER_LITERAL - self.match(self.input, CHARACTER_LITERAL, self.FOLLOW_CHARACTER_LITERAL_in_constant1671) - if self.failed: - return - - - elif alt72 == 5: - # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* - # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ - cnt70 = 0 - while True: #loop70 - alt70 = 2 - LA70_0 = self.input.LA(1) - - if (LA70_0 == IDENTIFIER) : - LA70_1 = self.input.LA(2) - - if (LA70_1 == STRING_LITERAL) : - alt70 = 1 - elif (LA70_1 == IDENTIFIER) : - LA70_33 = self.input.LA(3) - - if (self.synpred138()) : - alt70 = 1 - - - - - elif (LA70_0 == STRING_LITERAL) : - alt70 = 1 - - - if alt70 == 1: - # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+ - # C.g:443:8: ( IDENTIFIER )* - while True: #loop68 - alt68 = 2 - LA68_0 = self.input.LA(1) - - if (LA68_0 == IDENTIFIER) : - alt68 = 1 - - - if alt68 == 1: - # C.g:0:0: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1680) - if self.failed: - return - - - else: - break #loop68 - - - # C.g:443:20: ( STRING_LITERAL )+ - cnt69 = 0 - while True: #loop69 - alt69 = 2 - LA69_0 = self.input.LA(1) - - if (LA69_0 == STRING_LITERAL) : - LA69_31 = self.input.LA(2) - - if (self.synpred137()) : - alt69 = 1 - - - - - if alt69 == 1: - # C.g:0:0: STRING_LITERAL - self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_constant1683) - if self.failed: - return - - - else: - if cnt69 >= 1: - break #loop69 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(69, self.input) - raise eee - - cnt69 += 1 - - - - - else: - if cnt70 >= 1: - break #loop70 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(70, self.input) - raise eee - - cnt70 += 1 - - - # C.g:443:38: ( IDENTIFIER )* - while True: #loop71 - alt71 = 2 - LA71_0 = self.input.LA(1) - - if (LA71_0 == IDENTIFIER) : - alt71 = 1 - - - if alt71 == 1: - # C.g:0:0: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1688) - if self.failed: - return - - - else: - break #loop71 - - - - - elif alt72 == 6: - # C.g:444:9: FLOATING_POINT_LITERAL - self.match(self.input, FLOATING_POINT_LITERAL, self.FOLLOW_FLOATING_POINT_LITERAL_in_constant1699) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 45, constant_StartIndex) - - pass - - return - - # $ANTLR end constant - - class expression_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start expression - # C.g:449:1: expression : assignment_expression ( ',' assignment_expression )* ; - def expression(self, ): - - retval = self.expression_return() - retval.start = self.input.LT(1) - expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 46): - return retval - - # C.g:450:2: ( assignment_expression ( ',' assignment_expression )* ) - # C.g:450:4: assignment_expression ( ',' assignment_expression )* - self.following.append(self.FOLLOW_assignment_expression_in_expression1715) - self.assignment_expression() - self.following.pop() - if self.failed: - return retval - # C.g:450:26: ( ',' assignment_expression )* - while True: #loop73 - alt73 = 2 - LA73_0 = self.input.LA(1) - - if (LA73_0 == 27) : - alt73 = 1 - - - if alt73 == 1: - # C.g:450:27: ',' assignment_expression - self.match(self.input, 27, self.FOLLOW_27_in_expression1718) - if self.failed: - return retval - self.following.append(self.FOLLOW_assignment_expression_in_expression1720) - self.assignment_expression() - self.following.pop() - if self.failed: - return retval - - - else: - break #loop73 - - - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 46, expression_StartIndex) - - pass - - return retval - - # $ANTLR end expression - - - # $ANTLR start constant_expression - # C.g:453:1: constant_expression : conditional_expression ; - def constant_expression(self, ): - - constant_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 47): - return - - # C.g:454:2: ( conditional_expression ) - # C.g:454:4: conditional_expression - self.following.append(self.FOLLOW_conditional_expression_in_constant_expression1733) - self.conditional_expression() - self.following.pop() - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 47, constant_expression_StartIndex) - - pass - - return - - # $ANTLR end constant_expression - - - # $ANTLR start assignment_expression - # C.g:457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression ); - def assignment_expression(self, ): - - assignment_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 48): - return - - # C.g:458:2: ( lvalue assignment_operator assignment_expression | conditional_expression ) - alt74 = 2 - LA74 = self.input.LA(1) - if LA74 == IDENTIFIER: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_13 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 13, self.input) - - raise nvae - - elif LA74 == 62: - LA74_14 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 14, self.input) - - raise nvae - - elif LA74 == 75: - LA74_15 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 15, self.input) - - raise nvae - - elif LA74 == 66: - LA74_16 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 16, self.input) - - raise nvae - - elif LA74 == 76: - LA74_17 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 17, self.input) - - raise nvae - - elif LA74 == 72: - LA74_18 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 18, self.input) - - raise nvae - - elif LA74 == 73: - LA74_19 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 19, self.input) - - raise nvae - - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - elif LA74 == STRING_LITERAL: - LA74_21 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 21, self.input) - - raise nvae - - elif LA74 == IDENTIFIER: - LA74_22 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 22, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 1, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_44 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 44, self.input) - - raise nvae - - elif LA74 == 62: - LA74_45 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 45, self.input) - - raise nvae - - elif LA74 == 75: - LA74_46 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 46, self.input) - - raise nvae - - elif LA74 == 66: - LA74_47 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 47, self.input) - - raise nvae - - elif LA74 == 76: - LA74_48 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 48, self.input) - - raise nvae - - elif LA74 == 72: - LA74_49 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 49, self.input) - - raise nvae - - elif LA74 == 73: - LA74_50 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 50, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 2, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_73 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 73, self.input) - - raise nvae - - elif LA74 == 62: - LA74_74 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 74, self.input) - - raise nvae - - elif LA74 == 75: - LA74_75 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 75, self.input) - - raise nvae - - elif LA74 == 66: - LA74_76 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 76, self.input) - - raise nvae - - elif LA74 == 76: - LA74_77 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 77, self.input) - - raise nvae - - elif LA74 == 72: - LA74_78 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 78, self.input) - - raise nvae - - elif LA74 == 73: - LA74_79 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 79, self.input) - - raise nvae - - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 3, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_102 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 102, self.input) - - raise nvae - - elif LA74 == 62: - LA74_103 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 103, self.input) - - raise nvae - - elif LA74 == 75: - LA74_104 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 104, self.input) - - raise nvae - - elif LA74 == 66: - LA74_105 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 105, self.input) - - raise nvae - - elif LA74 == 76: - LA74_106 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 106, self.input) - - raise nvae - - elif LA74 == 72: - LA74_107 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 107, self.input) - - raise nvae - - elif LA74 == 73: - LA74_108 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 108, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 4, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_131 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 131, self.input) - - raise nvae - - elif LA74 == 62: - LA74_132 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 132, self.input) - - raise nvae - - elif LA74 == 75: - LA74_133 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 133, self.input) - - raise nvae - - elif LA74 == 66: - LA74_134 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 134, self.input) - - raise nvae - - elif LA74 == 76: - LA74_135 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 135, self.input) - - raise nvae - - elif LA74 == 72: - LA74_136 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 136, self.input) - - raise nvae - - elif LA74 == 73: - LA74_137 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 137, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 5, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74 = self.input.LA(2) - if LA74 == IDENTIFIER: - LA74_160 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 160, self.input) - - raise nvae - - elif LA74 == 64: - LA74_161 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 161, self.input) - - raise nvae - - elif LA74 == 62: - LA74_162 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 162, self.input) - - raise nvae - - elif LA74 == 75: - LA74_163 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 163, self.input) - - raise nvae - - elif LA74 == 66: - LA74_164 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 164, self.input) - - raise nvae - - elif LA74 == 76: - LA74_165 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 165, self.input) - - raise nvae - - elif LA74 == 72: - LA74_166 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 166, self.input) - - raise nvae - - elif LA74 == 73: - LA74_167 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 167, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - elif LA74 == STRING_LITERAL: - LA74_189 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 189, self.input) - - raise nvae - - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 6, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_191 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 191, self.input) - - raise nvae - - elif LA74 == 62: - LA74_192 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 192, self.input) - - raise nvae - - elif LA74 == 75: - LA74_193 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 193, self.input) - - raise nvae - - elif LA74 == 66: - LA74_194 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 194, self.input) - - raise nvae - - elif LA74 == 76: - LA74_195 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 195, self.input) - - raise nvae - - elif LA74 == 72: - LA74_196 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 196, self.input) - - raise nvae - - elif LA74 == 73: - LA74_197 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 197, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 7, self.input) - - raise nvae - - elif LA74 == 62: - LA74 = self.input.LA(2) - if LA74 == IDENTIFIER: - LA74_220 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 220, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74_221 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 221, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74_222 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 222, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74_223 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 223, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74_224 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 224, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74_225 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 225, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74_226 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 226, self.input) - - raise nvae - - elif LA74 == 62: - LA74_227 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 227, self.input) - - raise nvae - - elif LA74 == 72: - LA74_228 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 228, self.input) - - raise nvae - - elif LA74 == 73: - LA74_229 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 229, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74_230 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 230, self.input) - - raise nvae - - elif LA74 == 74: - LA74_231 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 231, self.input) - - raise nvae - - elif LA74 == 34 or LA74 == 35 or LA74 == 36 or LA74 == 37 or LA74 == 38 or LA74 == 39 or LA74 == 40 or LA74 == 41 or LA74 == 42 or LA74 == 45 or LA74 == 46 or LA74 == 48 or LA74 == 49 or LA74 == 50 or LA74 == 51 or LA74 == 52 or LA74 == 53 or LA74 == 54 or LA74 == 55 or LA74 == 56 or LA74 == 57 or LA74 == 58 or LA74 == 59 or LA74 == 60 or LA74 == 61: - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 8, self.input) - - raise nvae - - elif LA74 == 72: - LA74 = self.input.LA(2) - if LA74 == IDENTIFIER: - LA74_244 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 244, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74_245 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 245, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74_246 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 246, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74_247 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 247, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74_248 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 248, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74_249 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 249, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74_250 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 250, self.input) - - raise nvae - - elif LA74 == 62: - LA74_251 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 251, self.input) - - raise nvae - - elif LA74 == 72: - LA74_252 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 252, self.input) - - raise nvae - - elif LA74 == 73: - LA74_253 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 253, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74_254 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 254, self.input) - - raise nvae - - elif LA74 == 74: - LA74_255 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 255, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 9, self.input) - - raise nvae - - elif LA74 == 73: - LA74 = self.input.LA(2) - if LA74 == IDENTIFIER: - LA74_256 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 256, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74_257 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 257, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74_258 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 258, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74_259 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 259, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74_260 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 260, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74_261 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 261, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74_262 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 262, self.input) - - raise nvae - - elif LA74 == 62: - LA74_263 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 263, self.input) - - raise nvae - - elif LA74 == 72: - LA74_264 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 264, self.input) - - raise nvae - - elif LA74 == 73: - LA74_265 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 265, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74_266 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 266, self.input) - - raise nvae - - elif LA74 == 74: - LA74_267 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 267, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 10, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74 = self.input.LA(2) - if LA74 == 62: - LA74_268 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 268, self.input) - - raise nvae - - elif LA74 == IDENTIFIER: - LA74_269 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 269, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74_270 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 270, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74_271 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 271, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74_272 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 272, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74_273 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 273, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74_274 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 274, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74_275 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 275, self.input) - - raise nvae - - elif LA74 == 72: - LA74_276 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 276, self.input) - - raise nvae - - elif LA74 == 73: - LA74_277 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 277, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74_278 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 278, self.input) - - raise nvae - - elif LA74 == 74: - LA74_279 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 279, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 11, self.input) - - raise nvae - - elif LA74 == 74: - LA74 = self.input.LA(2) - if LA74 == 62: - LA74_280 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 280, self.input) - - raise nvae - - elif LA74 == IDENTIFIER: - LA74_281 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 281, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74_282 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 282, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74_283 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 283, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74_284 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 284, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74_285 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 285, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74_286 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 286, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74_287 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 287, self.input) - - raise nvae - - elif LA74 == 72: - LA74_288 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 288, self.input) - - raise nvae - - elif LA74 == 73: - LA74_289 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 289, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74_290 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 290, self.input) - - raise nvae - - elif LA74 == 74: - LA74_291 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 291, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 12, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 0, self.input) - - raise nvae - - if alt74 == 1: - # C.g:458:4: lvalue assignment_operator assignment_expression - self.following.append(self.FOLLOW_lvalue_in_assignment_expression1744) - self.lvalue() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_assignment_operator_in_assignment_expression1746) - self.assignment_operator() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_assignment_expression_in_assignment_expression1748) - self.assignment_expression() - self.following.pop() - if self.failed: - return - - - elif alt74 == 2: - # C.g:459:4: conditional_expression - self.following.append(self.FOLLOW_conditional_expression_in_assignment_expression1753) - self.conditional_expression() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 48, assignment_expression_StartIndex) - - pass - - return - - # $ANTLR end assignment_expression - - - # $ANTLR start lvalue - # C.g:462:1: lvalue : unary_expression ; - def lvalue(self, ): - - lvalue_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 49): - return - - # C.g:463:2: ( unary_expression ) - # C.g:463:4: unary_expression - self.following.append(self.FOLLOW_unary_expression_in_lvalue1765) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 49, lvalue_StartIndex) - - pass - - return - - # $ANTLR end lvalue - - - # $ANTLR start assignment_operator - # C.g:466:1: assignment_operator : ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' ); - def assignment_operator(self, ): - - assignment_operator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 50): - return - - # C.g:467:2: ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' ) - # C.g: - if self.input.LA(1) == 28 or (80 <= self.input.LA(1) <= 89): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_assignment_operator0 - ) - raise mse - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 50, assignment_operator_StartIndex) - - pass - - return - - # $ANTLR end assignment_operator - - - # $ANTLR start conditional_expression - # C.g:480:1: conditional_expression : e= logical_or_expression ( '?' expression ':' conditional_expression )? ; - def conditional_expression(self, ): - - conditional_expression_StartIndex = self.input.index() - e = None - - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 51): - return - - # C.g:481:2: (e= logical_or_expression ( '?' expression ':' conditional_expression )? ) - # C.g:481:4: e= logical_or_expression ( '?' expression ':' conditional_expression )? - self.following.append(self.FOLLOW_logical_or_expression_in_conditional_expression1839) - e = self.logical_or_expression() - self.following.pop() - if self.failed: - return - # C.g:481:28: ( '?' expression ':' conditional_expression )? - alt75 = 2 - LA75_0 = self.input.LA(1) - - if (LA75_0 == 90) : - alt75 = 1 - if alt75 == 1: - # C.g:481:29: '?' expression ':' conditional_expression - self.match(self.input, 90, self.FOLLOW_90_in_conditional_expression1842) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_conditional_expression1844) - self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 47, self.FOLLOW_47_in_conditional_expression1846) - if self.failed: - return - self.following.append(self.FOLLOW_conditional_expression_in_conditional_expression1848) - self.conditional_expression() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 51, conditional_expression_StartIndex) - - pass - - return - - # $ANTLR end conditional_expression - - class logical_or_expression_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start logical_or_expression - # C.g:484:1: logical_or_expression : logical_and_expression ( '||' logical_and_expression )* ; - def logical_or_expression(self, ): - - retval = self.logical_or_expression_return() - retval.start = self.input.LT(1) - logical_or_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 52): - return retval - - # C.g:485:2: ( logical_and_expression ( '||' logical_and_expression )* ) - # C.g:485:4: logical_and_expression ( '||' logical_and_expression )* - self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1863) - self.logical_and_expression() - self.following.pop() - if self.failed: - return retval - # C.g:485:27: ( '||' logical_and_expression )* - while True: #loop76 - alt76 = 2 - LA76_0 = self.input.LA(1) - - if (LA76_0 == 91) : - alt76 = 1 - - - if alt76 == 1: - # C.g:485:28: '||' logical_and_expression - self.match(self.input, 91, self.FOLLOW_91_in_logical_or_expression1866) - if self.failed: - return retval - self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1868) - self.logical_and_expression() - self.following.pop() - if self.failed: - return retval - - - else: - break #loop76 - - - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 52, logical_or_expression_StartIndex) - - pass - - return retval - - # $ANTLR end logical_or_expression - - - # $ANTLR start logical_and_expression - # C.g:488:1: logical_and_expression : inclusive_or_expression ( '&&' inclusive_or_expression )* ; - def logical_and_expression(self, ): - - logical_and_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 53): - return - - # C.g:489:2: ( inclusive_or_expression ( '&&' inclusive_or_expression )* ) - # C.g:489:4: inclusive_or_expression ( '&&' inclusive_or_expression )* - self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1881) - self.inclusive_or_expression() - self.following.pop() - if self.failed: - return - # C.g:489:28: ( '&&' inclusive_or_expression )* - while True: #loop77 - alt77 = 2 - LA77_0 = self.input.LA(1) - - if (LA77_0 == 92) : - alt77 = 1 - - - if alt77 == 1: - # C.g:489:29: '&&' inclusive_or_expression - self.match(self.input, 92, self.FOLLOW_92_in_logical_and_expression1884) - if self.failed: - return - self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1886) - self.inclusive_or_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop77 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 53, logical_and_expression_StartIndex) - - pass - - return - - # $ANTLR end logical_and_expression - - - # $ANTLR start inclusive_or_expression - # C.g:492:1: inclusive_or_expression : exclusive_or_expression ( '|' exclusive_or_expression )* ; - def inclusive_or_expression(self, ): - - inclusive_or_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 54): - return - - # C.g:493:2: ( exclusive_or_expression ( '|' exclusive_or_expression )* ) - # C.g:493:4: exclusive_or_expression ( '|' exclusive_or_expression )* - self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899) - self.exclusive_or_expression() - self.following.pop() - if self.failed: - return - # C.g:493:28: ( '|' exclusive_or_expression )* - while True: #loop78 - alt78 = 2 - LA78_0 = self.input.LA(1) - - if (LA78_0 == 93) : - alt78 = 1 - - - if alt78 == 1: - # C.g:493:29: '|' exclusive_or_expression - self.match(self.input, 93, self.FOLLOW_93_in_inclusive_or_expression1902) - if self.failed: - return - self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904) - self.exclusive_or_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop78 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 54, inclusive_or_expression_StartIndex) - - pass - - return - - # $ANTLR end inclusive_or_expression - - - # $ANTLR start exclusive_or_expression - # C.g:496:1: exclusive_or_expression : and_expression ( '^' and_expression )* ; - def exclusive_or_expression(self, ): - - exclusive_or_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 55): - return - - # C.g:497:2: ( and_expression ( '^' and_expression )* ) - # C.g:497:4: and_expression ( '^' and_expression )* - self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1917) - self.and_expression() - self.following.pop() - if self.failed: - return - # C.g:497:19: ( '^' and_expression )* - while True: #loop79 - alt79 = 2 - LA79_0 = self.input.LA(1) - - if (LA79_0 == 94) : - alt79 = 1 - - - if alt79 == 1: - # C.g:497:20: '^' and_expression - self.match(self.input, 94, self.FOLLOW_94_in_exclusive_or_expression1920) - if self.failed: - return - self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1922) - self.and_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop79 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 55, exclusive_or_expression_StartIndex) - - pass - - return - - # $ANTLR end exclusive_or_expression - - - # $ANTLR start and_expression - # C.g:500:1: and_expression : equality_expression ( '&' equality_expression )* ; - def and_expression(self, ): - - and_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 56): - return - - # C.g:501:2: ( equality_expression ( '&' equality_expression )* ) - # C.g:501:4: equality_expression ( '&' equality_expression )* - self.following.append(self.FOLLOW_equality_expression_in_and_expression1935) - self.equality_expression() - self.following.pop() - if self.failed: - return - # C.g:501:24: ( '&' equality_expression )* - while True: #loop80 - alt80 = 2 - LA80_0 = self.input.LA(1) - - if (LA80_0 == 77) : - alt80 = 1 - - - if alt80 == 1: - # C.g:501:25: '&' equality_expression - self.match(self.input, 77, self.FOLLOW_77_in_and_expression1938) - if self.failed: - return - self.following.append(self.FOLLOW_equality_expression_in_and_expression1940) - self.equality_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop80 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 56, and_expression_StartIndex) - - pass - - return - - # $ANTLR end and_expression - - - # $ANTLR start equality_expression - # C.g:503:1: equality_expression : relational_expression ( ( '==' | '!=' ) relational_expression )* ; - def equality_expression(self, ): - - equality_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 57): - return - - # C.g:504:2: ( relational_expression ( ( '==' | '!=' ) relational_expression )* ) - # C.g:504:4: relational_expression ( ( '==' | '!=' ) relational_expression )* - self.following.append(self.FOLLOW_relational_expression_in_equality_expression1952) - self.relational_expression() - self.following.pop() - if self.failed: - return - # C.g:504:26: ( ( '==' | '!=' ) relational_expression )* - while True: #loop81 - alt81 = 2 - LA81_0 = self.input.LA(1) - - if ((95 <= LA81_0 <= 96)) : - alt81 = 1 - - - if alt81 == 1: - # C.g:504:27: ( '==' | '!=' ) relational_expression - if (95 <= self.input.LA(1) <= 96): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_equality_expression1955 - ) - raise mse - - - self.following.append(self.FOLLOW_relational_expression_in_equality_expression1961) - self.relational_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop81 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 57, equality_expression_StartIndex) - - pass - - return - - # $ANTLR end equality_expression - - - # $ANTLR start relational_expression - # C.g:507:1: relational_expression : shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* ; - def relational_expression(self, ): - - relational_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 58): - return - - # C.g:508:2: ( shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* ) - # C.g:508:4: shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* - self.following.append(self.FOLLOW_shift_expression_in_relational_expression1975) - self.shift_expression() - self.following.pop() - if self.failed: - return - # C.g:508:21: ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* - while True: #loop82 - alt82 = 2 - LA82_0 = self.input.LA(1) - - if ((97 <= LA82_0 <= 100)) : - alt82 = 1 - - - if alt82 == 1: - # C.g:508:22: ( '<' | '>' | '<=' | '>=' ) shift_expression - if (97 <= self.input.LA(1) <= 100): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_relational_expression1978 - ) - raise mse - - - self.following.append(self.FOLLOW_shift_expression_in_relational_expression1988) - self.shift_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop82 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 58, relational_expression_StartIndex) - - pass - - return - - # $ANTLR end relational_expression - - - # $ANTLR start shift_expression - # C.g:511:1: shift_expression : additive_expression ( ( '<<' | '>>' ) additive_expression )* ; - def shift_expression(self, ): - - shift_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 59): - return - - # C.g:512:2: ( additive_expression ( ( '<<' | '>>' ) additive_expression )* ) - # C.g:512:4: additive_expression ( ( '<<' | '>>' ) additive_expression )* - self.following.append(self.FOLLOW_additive_expression_in_shift_expression2001) - self.additive_expression() - self.following.pop() - if self.failed: - return - # C.g:512:24: ( ( '<<' | '>>' ) additive_expression )* - while True: #loop83 - alt83 = 2 - LA83_0 = self.input.LA(1) - - if ((101 <= LA83_0 <= 102)) : - alt83 = 1 - - - if alt83 == 1: - # C.g:512:25: ( '<<' | '>>' ) additive_expression - if (101 <= self.input.LA(1) <= 102): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_shift_expression2004 - ) - raise mse - - - self.following.append(self.FOLLOW_additive_expression_in_shift_expression2010) - self.additive_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop83 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 59, shift_expression_StartIndex) - - pass - - return - - # $ANTLR end shift_expression - - - # $ANTLR start statement - # C.g:517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration ); - def statement(self, ): - - statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 60): - return - - # C.g:518:2: ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration ) - alt84 = 11 - LA84 = self.input.LA(1) - if LA84 == IDENTIFIER: - LA84 = self.input.LA(2) - if LA84 == 62: - LA84_43 = self.input.LA(3) - - if (self.synpred169()) : - alt84 = 3 - elif (self.synpred173()) : - alt84 = 7 - elif (self.synpred174()) : - alt84 = 8 - elif (True) : - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 43, self.input) - - raise nvae - - elif LA84 == 47: - alt84 = 1 - elif LA84 == STRING_LITERAL or LA84 == 27 or LA84 == 28 or LA84 == 64 or LA84 == 68 or LA84 == 69 or LA84 == 70 or LA84 == 71 or LA84 == 72 or LA84 == 73 or LA84 == 75 or LA84 == 76 or LA84 == 77 or LA84 == 80 or LA84 == 81 or LA84 == 82 or LA84 == 83 or LA84 == 84 or LA84 == 85 or LA84 == 86 or LA84 == 87 or LA84 == 88 or LA84 == 89 or LA84 == 90 or LA84 == 91 or LA84 == 92 or LA84 == 93 or LA84 == 94 or LA84 == 95 or LA84 == 96 or LA84 == 97 or LA84 == 98 or LA84 == 99 or LA84 == 100 or LA84 == 101 or LA84 == 102: - alt84 = 3 - elif LA84 == 66: - LA84_47 = self.input.LA(3) - - if (self.synpred169()) : - alt84 = 3 - elif (True) : - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 47, self.input) - - raise nvae - - elif LA84 == IDENTIFIER: - LA84_53 = self.input.LA(3) - - if (self.synpred169()) : - alt84 = 3 - elif (True) : - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 53, self.input) - - raise nvae - - elif LA84 == 25: - LA84_68 = self.input.LA(3) - - if (self.synpred169()) : - alt84 = 3 - elif (True) : - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 68, self.input) - - raise nvae - - elif LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61: - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 1, self.input) - - raise nvae - - elif LA84 == 106 or LA84 == 107: - alt84 = 1 - elif LA84 == 43: - alt84 = 2 - elif LA84 == HEX_LITERAL or LA84 == OCTAL_LITERAL or LA84 == DECIMAL_LITERAL or LA84 == CHARACTER_LITERAL or LA84 == STRING_LITERAL or LA84 == FLOATING_POINT_LITERAL or LA84 == 25 or LA84 == 62 or LA84 == 66 or LA84 == 68 or LA84 == 69 or LA84 == 72 or LA84 == 73 or LA84 == 74 or LA84 == 77 or LA84 == 78 or LA84 == 79: - alt84 = 3 - elif LA84 == 108 or LA84 == 110: - alt84 = 4 - elif LA84 == 111 or LA84 == 112 or LA84 == 113: - alt84 = 5 - elif LA84 == 114 or LA84 == 115 or LA84 == 116 or LA84 == 117: - alt84 = 6 - elif LA84 == 103: - alt84 = 8 - elif LA84 == 104: - alt84 = 9 - elif LA84 == 105: - alt84 = 10 - elif LA84 == 26 or LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61: - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 0, self.input) - - raise nvae - - if alt84 == 1: - # C.g:518:4: labeled_statement - self.following.append(self.FOLLOW_labeled_statement_in_statement2025) - self.labeled_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 2: - # C.g:519:4: compound_statement - self.following.append(self.FOLLOW_compound_statement_in_statement2030) - self.compound_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 3: - # C.g:520:4: expression_statement - self.following.append(self.FOLLOW_expression_statement_in_statement2035) - self.expression_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 4: - # C.g:521:4: selection_statement - self.following.append(self.FOLLOW_selection_statement_in_statement2040) - self.selection_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 5: - # C.g:522:4: iteration_statement - self.following.append(self.FOLLOW_iteration_statement_in_statement2045) - self.iteration_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 6: - # C.g:523:4: jump_statement - self.following.append(self.FOLLOW_jump_statement_in_statement2050) - self.jump_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 7: - # C.g:524:4: macro_statement - self.following.append(self.FOLLOW_macro_statement_in_statement2055) - self.macro_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 8: - # C.g:525:4: asm2_statement - self.following.append(self.FOLLOW_asm2_statement_in_statement2060) - self.asm2_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 9: - # C.g:526:4: asm1_statement - self.following.append(self.FOLLOW_asm1_statement_in_statement2065) - self.asm1_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 10: - # C.g:527:4: asm_statement - self.following.append(self.FOLLOW_asm_statement_in_statement2070) - self.asm_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 11: - # C.g:528:4: declaration - self.following.append(self.FOLLOW_declaration_in_statement2075) - self.declaration() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 60, statement_StartIndex) - - pass - - return - - # $ANTLR end statement - - - # $ANTLR start asm2_statement - # C.g:531:1: asm2_statement : ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' ; - def asm2_statement(self, ): - - asm2_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 61): - return - - # C.g:532:2: ( ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' ) - # C.g:532:4: ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' - # C.g:532:4: ( '__asm__' )? - alt85 = 2 - LA85_0 = self.input.LA(1) - - if (LA85_0 == 103) : - alt85 = 1 - if alt85 == 1: - # C.g:0:0: '__asm__' - self.match(self.input, 103, self.FOLLOW_103_in_asm2_statement2086) - if self.failed: - return - - - - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_asm2_statement2089) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_asm2_statement2091) - if self.failed: - return - # C.g:532:30: (~ ( ';' ) )* - while True: #loop86 - alt86 = 2 - LA86_0 = self.input.LA(1) - - if (LA86_0 == 63) : - LA86_1 = self.input.LA(2) - - if ((IDENTIFIER <= LA86_1 <= LINE_COMMAND) or (26 <= LA86_1 <= 117)) : - alt86 = 1 - - - elif ((IDENTIFIER <= LA86_0 <= LINE_COMMAND) or (26 <= LA86_0 <= 62) or (64 <= LA86_0 <= 117)) : - alt86 = 1 - - - if alt86 == 1: - # C.g:532:31: ~ ( ';' ) - if (IDENTIFIER <= self.input.LA(1) <= LINE_COMMAND) or (26 <= self.input.LA(1) <= 117): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_asm2_statement2094 - ) - raise mse - - - - - else: - break #loop86 - - - self.match(self.input, 63, self.FOLLOW_63_in_asm2_statement2101) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_asm2_statement2103) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 61, asm2_statement_StartIndex) - - pass - - return - - # $ANTLR end asm2_statement - - - # $ANTLR start asm1_statement - # C.g:535:1: asm1_statement : '_asm' '{' (~ ( '}' ) )* '}' ; - def asm1_statement(self, ): - - asm1_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 62): - return - - # C.g:536:2: ( '_asm' '{' (~ ( '}' ) )* '}' ) - # C.g:536:4: '_asm' '{' (~ ( '}' ) )* '}' - self.match(self.input, 104, self.FOLLOW_104_in_asm1_statement2115) - if self.failed: - return - self.match(self.input, 43, self.FOLLOW_43_in_asm1_statement2117) - if self.failed: - return - # C.g:536:15: (~ ( '}' ) )* - while True: #loop87 - alt87 = 2 - LA87_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA87_0 <= 43) or (45 <= LA87_0 <= 117)) : - alt87 = 1 - - - if alt87 == 1: - # C.g:536:16: ~ ( '}' ) - if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_asm1_statement2120 - ) - raise mse - - - - - else: - break #loop87 - - - self.match(self.input, 44, self.FOLLOW_44_in_asm1_statement2127) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 62, asm1_statement_StartIndex) - - pass - - return - - # $ANTLR end asm1_statement - - - # $ANTLR start asm_statement - # C.g:539:1: asm_statement : '__asm' '{' (~ ( '}' ) )* '}' ; - def asm_statement(self, ): - - asm_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 63): - return - - # C.g:540:2: ( '__asm' '{' (~ ( '}' ) )* '}' ) - # C.g:540:4: '__asm' '{' (~ ( '}' ) )* '}' - self.match(self.input, 105, self.FOLLOW_105_in_asm_statement2138) - if self.failed: - return - self.match(self.input, 43, self.FOLLOW_43_in_asm_statement2140) - if self.failed: - return - # C.g:540:16: (~ ( '}' ) )* - while True: #loop88 - alt88 = 2 - LA88_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA88_0 <= 43) or (45 <= LA88_0 <= 117)) : - alt88 = 1 - - - if alt88 == 1: - # C.g:540:17: ~ ( '}' ) - if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_asm_statement2143 - ) - raise mse - - - - - else: - break #loop88 - - - self.match(self.input, 44, self.FOLLOW_44_in_asm_statement2150) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 63, asm_statement_StartIndex) - - pass - - return - - # $ANTLR end asm_statement - - - # $ANTLR start macro_statement - # C.g:543:1: macro_statement : IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' ; - def macro_statement(self, ): - - macro_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 64): - return - - # C.g:544:2: ( IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' ) - # C.g:544:4: IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_macro_statement2162) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_macro_statement2164) - if self.failed: - return - # C.g:544:19: ( declaration )* - while True: #loop89 - alt89 = 2 - LA89 = self.input.LA(1) - if LA89 == IDENTIFIER: - LA89 = self.input.LA(2) - if LA89 == 62: - LA89_45 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_47 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 66: - LA89_50 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_68 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_71 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_72 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_73 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_74 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_75 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_76 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_77 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_78 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_79 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_80 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_81 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_82 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_83 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_84 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_85 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_86 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 26: - LA89 = self.input.LA(2) - if LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_87 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_88 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_89 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_90 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_91 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_92 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_93 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_94 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_95 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_96 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_97 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_98 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_99 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_100 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 66: - LA89_101 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_102 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_103 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_104 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_105 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_106 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_107 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_108 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_109 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_110 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_111 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_112 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_113 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_114 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_115 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_116 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_117 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_118 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_119 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_120 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_121 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_122 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_123 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_124 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_125 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 34: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_126 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_127 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_128 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_129 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_130 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_131 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_132 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_133 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_134 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_135 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_136 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_137 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_138 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_139 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_140 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_141 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_142 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_143 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_144 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_145 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 35: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_146 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_147 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_148 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_149 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_150 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_151 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_152 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_153 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_154 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_155 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_156 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_157 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_158 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_159 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_160 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_161 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_162 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_163 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_164 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_165 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 36: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_166 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_167 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_168 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_169 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_170 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_171 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_172 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_173 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_174 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_175 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_176 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_177 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_178 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_179 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_180 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_181 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_182 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_183 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_184 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_185 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 37: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_186 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_187 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_188 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_189 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_190 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_191 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_192 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_193 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_194 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_195 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_196 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_197 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_198 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_199 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_200 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_201 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_202 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_203 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_204 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_205 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 38: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_206 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_207 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_208 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_209 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_210 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_211 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_212 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_213 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_214 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_215 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_216 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_217 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_218 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_219 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_220 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_221 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_222 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_223 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_224 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_225 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 39: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_226 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_227 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_228 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_229 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_230 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_231 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_232 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_233 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_234 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_235 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_236 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_237 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_238 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_239 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_240 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_241 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_242 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_243 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_244 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_245 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 40: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_246 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_247 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_248 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_249 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_250 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_251 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_252 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_253 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_254 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_255 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_256 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_257 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_258 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_259 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_260 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_261 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_262 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_263 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_264 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_265 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 41: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_266 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_267 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_268 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_269 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_270 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_271 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_272 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_273 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_274 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_275 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_276 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_277 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_278 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_279 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_280 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_281 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_282 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_283 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_284 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_285 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 42: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_286 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_287 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_288 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_289 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_290 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_291 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_292 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_293 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_294 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_295 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_296 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_297 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_298 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_299 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_300 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_301 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_302 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_303 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_304 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_305 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 45 or LA89 == 46: - LA89_40 = self.input.LA(2) - - if (LA89_40 == IDENTIFIER) : - LA89_306 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif (LA89_40 == 43) : - LA89_307 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - - elif LA89 == 48: - LA89_41 = self.input.LA(2) - - if (LA89_41 == 43) : - LA89_308 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif (LA89_41 == IDENTIFIER) : - LA89_309 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 58 or LA89 == 59 or LA89 == 60 or LA89 == 61: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_310 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_311 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_312 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_313 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_314 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_315 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_316 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_317 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_318 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_319 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_320 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_321 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_322 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_323 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_324 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_325 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_326 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_327 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_328 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_329 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - - if alt89 == 1: - # C.g:0:0: declaration - self.following.append(self.FOLLOW_declaration_in_macro_statement2166) - self.declaration() - self.following.pop() - if self.failed: - return - - - else: - break #loop89 - - - # C.g:544:33: ( statement_list )? - alt90 = 2 - LA90 = self.input.LA(1) - if LA90 == IDENTIFIER: - LA90 = self.input.LA(2) - if LA90 == 25 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 45 or LA90 == 46 or LA90 == 47 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61: - alt90 = 1 - elif LA90 == 62: - LA90_45 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_46 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == IDENTIFIER: - LA90_47 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 64: - LA90_48 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_49 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_50 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_51 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_52 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_53 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_54 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_55 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_56 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_57 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_58 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_59 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_60 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_61 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_62 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_63 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_64 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_65 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_66 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_67 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_70 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25 or LA90 == 26 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 43 or LA90 == 45 or LA90 == 46 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61 or LA90 == 103 or LA90 == 104 or LA90 == 105 or LA90 == 106 or LA90 == 107 or LA90 == 108 or LA90 == 110 or LA90 == 111 or LA90 == 112 or LA90 == 113 or LA90 == 114 or LA90 == 115 or LA90 == 116 or LA90 == 117: - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90 = self.input.LA(2) - if LA90 == 64: - LA90_87 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_88 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_89 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_90 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_91 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_92 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_93 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_94 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_95 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_96 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_97 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_98 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_99 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_100 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_101 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_102 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_103 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_104 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_105 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_106 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_107 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_108 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90 = self.input.LA(2) - if LA90 == 64: - LA90_111 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_112 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_113 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_114 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_115 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_116 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_117 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_118 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_119 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_120 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_121 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_122 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_123 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_124 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_125 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_126 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_127 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_128 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_129 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_130 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_131 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_134 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90 = self.input.LA(2) - if LA90 == 64: - LA90_135 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_136 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_137 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_138 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_139 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_140 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_141 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_142 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_143 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_144 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_145 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_146 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_147 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_148 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_149 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_150 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_151 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_152 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_153 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_154 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_155 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_156 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90 = self.input.LA(2) - if LA90 == 64: - LA90_159 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_160 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_161 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_162 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_163 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_164 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_165 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_166 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_167 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_168 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_169 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_170 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_171 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_172 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_173 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_174 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_175 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_176 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_177 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_178 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_179 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_181 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90 = self.input.LA(2) - if LA90 == IDENTIFIER: - LA90_183 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 64: - LA90_184 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_185 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_186 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_187 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_188 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_189 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_190 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_191 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_192 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_193 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_194 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_195 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_196 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_197 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_198 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_199 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_200 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_201 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_202 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_203 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_204 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_205 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_206 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90 = self.input.LA(2) - if LA90 == 64: - LA90_209 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_210 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_211 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_212 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_213 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_214 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_215 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_216 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_217 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_218 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_219 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_220 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_221 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_222 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_223 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_224 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_225 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_226 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_227 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_228 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_229 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_230 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == 62: - LA90 = self.input.LA(2) - if LA90 == IDENTIFIER: - LA90_233 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90_234 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90_235 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90_236 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90_237 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_238 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90_239 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_240 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_241 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_242 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90_243 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90_244 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61: - LA90_245 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 34: - LA90_246 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 35: - LA90_247 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 36: - LA90_248 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 37: - LA90_249 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 38: - LA90_250 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 39: - LA90_251 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 40: - LA90_252 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 41: - LA90_253 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 42: - LA90_254 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 45 or LA90 == 46: - LA90_255 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 48: - LA90_256 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90 = self.input.LA(2) - if LA90 == IDENTIFIER: - LA90_257 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90_258 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90_259 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90_260 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90_261 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_262 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90_263 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_264 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_265 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_266 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90_267 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90_268 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90 = self.input.LA(2) - if LA90 == IDENTIFIER: - LA90_269 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90_270 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90_271 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90_272 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90_273 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_274 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90_275 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_276 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_277 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_278 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90_279 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90_280 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90 = self.input.LA(2) - if LA90 == 62: - LA90_281 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == IDENTIFIER: - LA90_282 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90_283 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90_284 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90_285 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90_286 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_287 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90_288 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_289 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_290 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90_291 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90_292 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90 = self.input.LA(2) - if LA90 == 62: - LA90_293 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == IDENTIFIER: - LA90_294 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90_295 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90_296 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90_297 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90_298 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_299 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90_300 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_301 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_302 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90_303 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90_304 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - if alt90 == 1: - # C.g:0:0: statement_list - self.following.append(self.FOLLOW_statement_list_in_macro_statement2170) - self.statement_list() - self.following.pop() - if self.failed: - return - - - - # C.g:544:49: ( expression )? - alt91 = 2 - LA91_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA91_0 <= FLOATING_POINT_LITERAL) or LA91_0 == 62 or LA91_0 == 66 or (68 <= LA91_0 <= 69) or (72 <= LA91_0 <= 74) or (77 <= LA91_0 <= 79)) : - alt91 = 1 - if alt91 == 1: - # C.g:0:0: expression - self.following.append(self.FOLLOW_expression_in_macro_statement2173) - self.expression() - self.following.pop() - if self.failed: - return - - - - self.match(self.input, 63, self.FOLLOW_63_in_macro_statement2176) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 64, macro_statement_StartIndex) - - pass - - return - - # $ANTLR end macro_statement - - - # $ANTLR start labeled_statement - # C.g:547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement ); - def labeled_statement(self, ): - - labeled_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 65): - return - - # C.g:548:2: ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement ) - alt92 = 3 - LA92 = self.input.LA(1) - if LA92 == IDENTIFIER: - alt92 = 1 - elif LA92 == 106: - alt92 = 2 - elif LA92 == 107: - alt92 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement );", 92, 0, self.input) - - raise nvae - - if alt92 == 1: - # C.g:548:4: IDENTIFIER ':' statement - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_labeled_statement2188) - if self.failed: - return - self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2190) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_labeled_statement2192) - self.statement() - self.following.pop() - if self.failed: - return - - - elif alt92 == 2: - # C.g:549:4: 'case' constant_expression ':' statement - self.match(self.input, 106, self.FOLLOW_106_in_labeled_statement2197) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_labeled_statement2199) - self.constant_expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2201) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_labeled_statement2203) - self.statement() - self.following.pop() - if self.failed: - return - - - elif alt92 == 3: - # C.g:550:4: 'default' ':' statement - self.match(self.input, 107, self.FOLLOW_107_in_labeled_statement2208) - if self.failed: - return - self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2210) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_labeled_statement2212) - self.statement() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 65, labeled_statement_StartIndex) - - pass - - return - - # $ANTLR end labeled_statement - - class compound_statement_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start compound_statement - # C.g:553:1: compound_statement : '{' ( declaration )* ( statement_list )? '}' ; - def compound_statement(self, ): - - retval = self.compound_statement_return() - retval.start = self.input.LT(1) - compound_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 66): - return retval - - # C.g:554:2: ( '{' ( declaration )* ( statement_list )? '}' ) - # C.g:554:4: '{' ( declaration )* ( statement_list )? '}' - self.match(self.input, 43, self.FOLLOW_43_in_compound_statement2223) - if self.failed: - return retval - # C.g:554:8: ( declaration )* - while True: #loop93 - alt93 = 2 - LA93 = self.input.LA(1) - if LA93 == IDENTIFIER: - LA93 = self.input.LA(2) - if LA93 == 62: - LA93_44 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_47 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 66: - LA93_48 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_49 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_50 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_51 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_52 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_53 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_54 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_55 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_56 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_57 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_58 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_59 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_60 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_61 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_62 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_63 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_64 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_65 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 26: - LA93 = self.input.LA(2) - if LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_86 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_87 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_88 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_89 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_90 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_91 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_92 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_93 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_94 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_95 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_96 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_97 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_98 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_99 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 66: - LA93_100 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_101 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_102 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_103 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_104 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_105 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_106 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_107 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_108 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_109 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_110 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_111 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_112 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_113 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_114 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_115 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_116 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_117 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_118 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_119 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_120 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_121 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_122 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_123 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_124 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 34: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_125 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_126 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_127 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_128 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_129 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_130 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_131 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_132 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_133 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_134 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_135 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_136 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_137 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_138 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_139 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_140 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_141 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_142 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_143 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_144 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 35: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_145 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_146 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_147 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_148 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_149 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_150 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_151 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_152 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_153 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_154 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_155 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_156 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_157 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_158 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_159 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_160 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_161 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_162 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_163 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_164 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 36: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_165 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_166 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_167 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_168 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_169 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_170 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_171 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_172 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_173 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_174 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_175 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_176 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_177 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_178 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_179 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_180 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_181 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_182 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_183 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_184 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 37: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_185 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_186 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_187 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_188 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_189 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_190 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_191 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_192 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_193 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_194 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_195 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_196 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_197 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_198 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_199 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_200 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_201 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_202 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_203 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_204 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 38: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_205 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_206 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_207 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_208 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_209 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_210 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_211 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_212 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_213 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_214 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_215 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_216 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_217 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_218 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_219 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_220 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_221 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_222 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_223 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_224 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 39: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_225 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_226 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_227 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_228 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_229 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_230 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_231 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_232 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_233 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_234 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_235 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_236 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_237 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_238 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_239 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_240 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_241 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_242 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_243 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_244 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 40: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_245 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_246 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_247 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_248 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_249 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_250 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_251 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_252 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_253 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_254 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_255 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_256 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_257 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_258 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_259 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_260 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_261 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_262 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_263 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_264 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 41: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_265 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_266 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_267 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_268 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_269 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_270 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_271 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_272 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_273 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_274 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_275 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_276 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_277 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_278 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_279 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_280 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_281 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_282 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_283 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_284 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 42: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_285 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_286 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_287 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_288 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_289 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_290 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_291 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_292 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_293 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_294 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_295 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_296 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_297 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_298 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_299 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_300 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_301 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_302 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_303 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_304 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 45 or LA93 == 46: - LA93_40 = self.input.LA(2) - - if (LA93_40 == IDENTIFIER) : - LA93_305 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif (LA93_40 == 43) : - LA93_306 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - - elif LA93 == 48: - LA93_41 = self.input.LA(2) - - if (LA93_41 == 43) : - LA93_307 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif (LA93_41 == IDENTIFIER) : - LA93_308 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 58 or LA93 == 59 or LA93 == 60 or LA93 == 61: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_309 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_310 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_311 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_312 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_313 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_314 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_315 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_316 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_317 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_318 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_319 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_320 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_321 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_322 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_323 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_324 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_325 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_326 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_327 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_328 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - - if alt93 == 1: - # C.g:0:0: declaration - self.following.append(self.FOLLOW_declaration_in_compound_statement2225) - self.declaration() - self.following.pop() - if self.failed: - return retval - - - else: - break #loop93 - - - # C.g:554:21: ( statement_list )? - alt94 = 2 - LA94_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA94_0 <= FLOATING_POINT_LITERAL) or (25 <= LA94_0 <= 26) or (29 <= LA94_0 <= 43) or (45 <= LA94_0 <= 46) or (48 <= LA94_0 <= 62) or LA94_0 == 66 or (68 <= LA94_0 <= 69) or (72 <= LA94_0 <= 74) or (77 <= LA94_0 <= 79) or (103 <= LA94_0 <= 108) or (110 <= LA94_0 <= 117)) : - alt94 = 1 - if alt94 == 1: - # C.g:0:0: statement_list - self.following.append(self.FOLLOW_statement_list_in_compound_statement2228) - self.statement_list() - self.following.pop() - if self.failed: - return retval - - - - self.match(self.input, 44, self.FOLLOW_44_in_compound_statement2231) - if self.failed: - return retval - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 66, compound_statement_StartIndex) - - pass - - return retval - - # $ANTLR end compound_statement - - - # $ANTLR start statement_list - # C.g:557:1: statement_list : ( statement )+ ; - def statement_list(self, ): - - statement_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 67): - return - - # C.g:558:2: ( ( statement )+ ) - # C.g:558:4: ( statement )+ - # C.g:558:4: ( statement )+ - cnt95 = 0 - while True: #loop95 - alt95 = 2 - LA95 = self.input.LA(1) - if LA95 == IDENTIFIER: - LA95 = self.input.LA(2) - if LA95 == 62: - LA95_46 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 45 or LA95 == 46 or LA95 == 47 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61: - alt95 = 1 - elif LA95 == STRING_LITERAL: - LA95_48 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == IDENTIFIER: - LA95_49 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 64: - LA95_50 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_51 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_52 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_53 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_54 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_55 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_56 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_57 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_58 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_59 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_60 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_61 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_62 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_63 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_64 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_65 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_66 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_67 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_68 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_69 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_88 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == HEX_LITERAL: - LA95 = self.input.LA(2) - if LA95 == 64: - LA95_89 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_90 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_91 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_92 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_93 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_94 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_95 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_96 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_97 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_98 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_99 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_100 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_101 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_102 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_103 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_104 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_105 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_106 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_107 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_108 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_109 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_110 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - - elif LA95 == OCTAL_LITERAL: - LA95 = self.input.LA(2) - if LA95 == 64: - LA95_113 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_114 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_115 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_116 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_117 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_118 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_119 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_120 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_121 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_122 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_123 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_124 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_125 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_126 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_127 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_128 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_129 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_130 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_131 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_132 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_133 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_135 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - - elif LA95 == DECIMAL_LITERAL: - LA95 = self.input.LA(2) - if LA95 == 64: - LA95_137 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_138 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_139 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_140 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_141 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_142 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_143 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_144 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_145 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_146 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_147 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_148 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_149 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_150 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_151 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_152 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_153 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_154 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_155 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_156 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_157 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_158 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - - elif LA95 == CHARACTER_LITERAL: - LA95 = self.input.LA(2) - if LA95 == 64: - LA95_161 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_162 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_163 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_164 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_165 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_166 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_167 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_168 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_169 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_170 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_171 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_172 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_173 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_174 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_175 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_176 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_177 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_178 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_179 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_180 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_181 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_182 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - - elif LA95 == STRING_LITERAL: - LA95 = self.input.LA(2) - if LA95 == IDENTIFIER: - LA95_185 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 64: - LA95_186 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_187 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_188 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_189 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_190 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_191 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_192 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_193 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_194 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_195 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_196 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_197 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_198 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_199 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_200 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_201 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_202 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_203 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_204 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_205 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_206 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - elif LA95 == STRING_LITERAL: - LA95_208 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_209 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95 = self.input.LA(2) - if LA95 == 64: - LA95_211 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_212 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_213 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_214 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_215 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_216 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_217 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_218 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_219 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_220 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_221 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_222 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_223 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_224 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_225 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_226 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_227 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_228 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_229 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_230 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_231 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_234 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 62: - LA95 = self.input.LA(2) - if LA95 == IDENTIFIER: - LA95_235 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == HEX_LITERAL: - LA95_236 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == OCTAL_LITERAL: - LA95_237 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == DECIMAL_LITERAL: - LA95_238 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == CHARACTER_LITERAL: - LA95_239 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == STRING_LITERAL: - LA95_240 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95_241 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_242 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_243 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_244 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95_245 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 74: - LA95_246 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61: - LA95_247 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 34: - LA95_248 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 35: - LA95_249 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 36: - LA95_250 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 37: - LA95_251 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 38: - LA95_252 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 39: - LA95_253 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 40: - LA95_254 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 41: - LA95_255 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 42: - LA95_256 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 45 or LA95 == 46: - LA95_257 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 48: - LA95_258 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 72: - LA95 = self.input.LA(2) - if LA95 == IDENTIFIER: - LA95_259 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == HEX_LITERAL: - LA95_260 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == OCTAL_LITERAL: - LA95_261 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == DECIMAL_LITERAL: - LA95_262 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == CHARACTER_LITERAL: - LA95_263 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == STRING_LITERAL: - LA95_264 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95_265 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_266 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_267 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_268 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95_269 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 74: - LA95_270 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 73: - LA95 = self.input.LA(2) - if LA95 == IDENTIFIER: - LA95_271 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == HEX_LITERAL: - LA95_272 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == OCTAL_LITERAL: - LA95_273 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == DECIMAL_LITERAL: - LA95_274 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == CHARACTER_LITERAL: - LA95_275 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == STRING_LITERAL: - LA95_276 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95_277 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_278 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_279 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_280 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95_281 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 74: - LA95_282 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95 = self.input.LA(2) - if LA95 == 62: - LA95_283 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == IDENTIFIER: - LA95_284 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == HEX_LITERAL: - LA95_285 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == OCTAL_LITERAL: - LA95_286 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == DECIMAL_LITERAL: - LA95_287 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == CHARACTER_LITERAL: - LA95_288 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == STRING_LITERAL: - LA95_289 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95_290 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_291 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_292 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95_293 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 74: - LA95_294 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 74: - LA95 = self.input.LA(2) - if LA95 == 62: - LA95_295 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == IDENTIFIER: - LA95_296 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == HEX_LITERAL: - LA95_297 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == OCTAL_LITERAL: - LA95_298 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == DECIMAL_LITERAL: - LA95_299 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == CHARACTER_LITERAL: - LA95_300 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == STRING_LITERAL: - LA95_301 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95_302 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_303 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_304 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95_305 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 74: - LA95_306 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 25 or LA95 == 26 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 43 or LA95 == 45 or LA95 == 46 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61 or LA95 == 103 or LA95 == 104 or LA95 == 105 or LA95 == 106 or LA95 == 107 or LA95 == 108 or LA95 == 110 or LA95 == 111 or LA95 == 112 or LA95 == 113 or LA95 == 114 or LA95 == 115 or LA95 == 116 or LA95 == 117: - alt95 = 1 - - if alt95 == 1: - # C.g:0:0: statement - self.following.append(self.FOLLOW_statement_in_statement_list2242) - self.statement() - self.following.pop() - if self.failed: - return - - - else: - if cnt95 >= 1: - break #loop95 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(95, self.input) - raise eee - - cnt95 += 1 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 67, statement_list_StartIndex) - - pass - - return - - # $ANTLR end statement_list - - class expression_statement_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start expression_statement - # C.g:561:1: expression_statement : ( ';' | expression ';' ); - def expression_statement(self, ): - - retval = self.expression_statement_return() - retval.start = self.input.LT(1) - expression_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 68): - return retval - - # C.g:562:2: ( ';' | expression ';' ) - alt96 = 2 - LA96_0 = self.input.LA(1) - - if (LA96_0 == 25) : - alt96 = 1 - elif ((IDENTIFIER <= LA96_0 <= FLOATING_POINT_LITERAL) or LA96_0 == 62 or LA96_0 == 66 or (68 <= LA96_0 <= 69) or (72 <= LA96_0 <= 74) or (77 <= LA96_0 <= 79)) : - alt96 = 2 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("561:1: expression_statement : ( ';' | expression ';' );", 96, 0, self.input) - - raise nvae - - if alt96 == 1: - # C.g:562:4: ';' - self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2254) - if self.failed: - return retval - - - elif alt96 == 2: - # C.g:563:4: expression ';' - self.following.append(self.FOLLOW_expression_in_expression_statement2259) - self.expression() - self.following.pop() - if self.failed: - return retval - self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2261) - if self.failed: - return retval - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 68, expression_statement_StartIndex) - - pass - - return retval - - # $ANTLR end expression_statement - - - # $ANTLR start selection_statement - # C.g:566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement ); - def selection_statement(self, ): - - selection_statement_StartIndex = self.input.index() - e = None - - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 69): - return - - # C.g:567:2: ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement ) - alt98 = 2 - LA98_0 = self.input.LA(1) - - if (LA98_0 == 108) : - alt98 = 1 - elif (LA98_0 == 110) : - alt98 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement );", 98, 0, self.input) - - raise nvae - - if alt98 == 1: - # C.g:567:4: 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? - self.match(self.input, 108, self.FOLLOW_108_in_selection_statement2272) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2274) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_selection_statement2278) - e = self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2280) - if self.failed: - return - if self.backtracking == 0: - self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - self.following.append(self.FOLLOW_statement_in_selection_statement2284) - self.statement() - self.following.pop() - if self.failed: - return - # C.g:567:167: ( options {k=1; backtrack=false; } : 'else' statement )? - alt97 = 2 - LA97_0 = self.input.LA(1) - - if (LA97_0 == 109) : - alt97 = 1 - if alt97 == 1: - # C.g:567:200: 'else' statement - self.match(self.input, 109, self.FOLLOW_109_in_selection_statement2299) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_selection_statement2301) - self.statement() - self.following.pop() - if self.failed: - return - - - - - - elif alt98 == 2: - # C.g:568:4: 'switch' '(' expression ')' statement - self.match(self.input, 110, self.FOLLOW_110_in_selection_statement2308) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2310) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_selection_statement2312) - self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2314) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_selection_statement2316) - self.statement() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 69, selection_statement_StartIndex) - - pass - - return - - # $ANTLR end selection_statement - - - # $ANTLR start iteration_statement - # C.g:571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement ); - def iteration_statement(self, ): - - iteration_statement_StartIndex = self.input.index() - e = None - - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 70): - return - - # C.g:572:2: ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement ) - alt100 = 3 - LA100 = self.input.LA(1) - if LA100 == 111: - alt100 = 1 - elif LA100 == 112: - alt100 = 2 - elif LA100 == 113: - alt100 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement );", 100, 0, self.input) - - raise nvae - - if alt100 == 1: - # C.g:572:4: 'while' '(' e= expression ')' statement - self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2327) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2329) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_iteration_statement2333) - e = self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2335) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_iteration_statement2337) - self.statement() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - - - elif alt100 == 2: - # C.g:573:4: 'do' statement 'while' '(' e= expression ')' ';' - self.match(self.input, 112, self.FOLLOW_112_in_iteration_statement2344) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_iteration_statement2346) - self.statement() - self.following.pop() - if self.failed: - return - self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2348) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2350) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_iteration_statement2354) - e = self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2356) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_iteration_statement2358) - if self.failed: - return - if self.backtracking == 0: - self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - - - elif alt100 == 3: - # C.g:574:4: 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement - self.match(self.input, 113, self.FOLLOW_113_in_iteration_statement2365) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2367) - if self.failed: - return - self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2369) - self.expression_statement() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2373) - e = self.expression_statement() - self.following.pop() - if self.failed: - return - # C.g:574:58: ( expression )? - alt99 = 2 - LA99_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA99_0 <= FLOATING_POINT_LITERAL) or LA99_0 == 62 or LA99_0 == 66 or (68 <= LA99_0 <= 69) or (72 <= LA99_0 <= 74) or (77 <= LA99_0 <= 79)) : - alt99 = 1 - if alt99 == 1: - # C.g:0:0: expression - self.following.append(self.FOLLOW_expression_in_iteration_statement2375) - self.expression() - self.following.pop() - if self.failed: - return - - - - self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2378) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_iteration_statement2380) - self.statement() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 70, iteration_statement_StartIndex) - - pass - - return - - # $ANTLR end iteration_statement - - - # $ANTLR start jump_statement - # C.g:577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' ); - def jump_statement(self, ): - - jump_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 71): - return - - # C.g:578:2: ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' ) - alt101 = 5 - LA101 = self.input.LA(1) - if LA101 == 114: - alt101 = 1 - elif LA101 == 115: - alt101 = 2 - elif LA101 == 116: - alt101 = 3 - elif LA101 == 117: - LA101_4 = self.input.LA(2) - - if (LA101_4 == 25) : - alt101 = 4 - elif ((IDENTIFIER <= LA101_4 <= FLOATING_POINT_LITERAL) or LA101_4 == 62 or LA101_4 == 66 or (68 <= LA101_4 <= 69) or (72 <= LA101_4 <= 74) or (77 <= LA101_4 <= 79)) : - alt101 = 5 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 4, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 0, self.input) - - raise nvae - - if alt101 == 1: - # C.g:578:4: 'goto' IDENTIFIER ';' - self.match(self.input, 114, self.FOLLOW_114_in_jump_statement2393) - if self.failed: - return - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_jump_statement2395) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2397) - if self.failed: - return - - - elif alt101 == 2: - # C.g:579:4: 'continue' ';' - self.match(self.input, 115, self.FOLLOW_115_in_jump_statement2402) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2404) - if self.failed: - return - - - elif alt101 == 3: - # C.g:580:4: 'break' ';' - self.match(self.input, 116, self.FOLLOW_116_in_jump_statement2409) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2411) - if self.failed: - return - - - elif alt101 == 4: - # C.g:581:4: 'return' ';' - self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2416) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2418) - if self.failed: - return - - - elif alt101 == 5: - # C.g:582:4: 'return' expression ';' - self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2423) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_jump_statement2425) - self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2427) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 71, jump_statement_StartIndex) - - pass - - return - - # $ANTLR end jump_statement - - # $ANTLR start synpred2 - def synpred2_fragment(self, ): - # C.g:119:6: ( declaration_specifiers ) - # C.g:119:6: declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_synpred2100) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred2 - - - - # $ANTLR start synpred4 - def synpred4_fragment(self, ): - # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' ) - # C.g:119:6: ( declaration_specifiers )? declarator ( declaration )* '{' - # C.g:119:6: ( declaration_specifiers )? - alt102 = 2 - LA102 = self.input.LA(1) - if LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33 or LA102 == 34 or LA102 == 35 or LA102 == 36 or LA102 == 37 or LA102 == 38 or LA102 == 39 or LA102 == 40 or LA102 == 41 or LA102 == 42 or LA102 == 45 or LA102 == 46 or LA102 == 48 or LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61: - alt102 = 1 - elif LA102 == IDENTIFIER: - LA102 = self.input.LA(2) - if LA102 == 62: - LA102_21 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33: - LA102_23 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 34: - LA102_24 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 35: - LA102_25 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 36: - LA102_26 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 37: - LA102_27 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 38: - LA102_28 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 39: - LA102_29 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 40: - LA102_30 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 41: - LA102_31 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 42: - LA102_32 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 45 or LA102 == 46: - LA102_33 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 48: - LA102_34 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == IDENTIFIER: - LA102_35 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 58: - LA102_36 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 66: - alt102 = 1 - elif LA102 == 59: - LA102_39 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 60: - LA102_40 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61: - LA102_41 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 58: - LA102_14 = self.input.LA(2) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 59: - LA102_16 = self.input.LA(2) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 60: - LA102_17 = self.input.LA(2) - - if (self.synpred2()) : - alt102 = 1 - if alt102 == 1: - # C.g:0:0: declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_synpred4100) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - - - - self.following.append(self.FOLLOW_declarator_in_synpred4103) - self.declarator() - self.following.pop() - if self.failed: - return - # C.g:119:41: ( declaration )* - while True: #loop103 - alt103 = 2 - LA103_0 = self.input.LA(1) - - if (LA103_0 == IDENTIFIER or LA103_0 == 26 or (29 <= LA103_0 <= 42) or (45 <= LA103_0 <= 46) or (48 <= LA103_0 <= 61)) : - alt103 = 1 - - - if alt103 == 1: - # C.g:0:0: declaration - self.following.append(self.FOLLOW_declaration_in_synpred4105) - self.declaration() - self.following.pop() - if self.failed: - return - - - else: - break #loop103 - - - self.match(self.input, 43, self.FOLLOW_43_in_synpred4108) - if self.failed: - return - - - # $ANTLR end synpred4 - - - - # $ANTLR start synpred5 - def synpred5_fragment(self, ): - # C.g:120:4: ( declaration ) - # C.g:120:4: declaration - self.following.append(self.FOLLOW_declaration_in_synpred5118) - self.declaration() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred5 - - - - # $ANTLR start synpred7 - def synpred7_fragment(self, ): - # C.g:146:6: ( declaration_specifiers ) - # C.g:146:6: declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_synpred7157) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred7 - - - - # $ANTLR start synpred10 - def synpred10_fragment(self, ): - # C.g:167:18: ( declaration_specifiers ) - # C.g:167:18: declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_synpred10207) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred10 - - - - # $ANTLR start synpred14 - def synpred14_fragment(self, ): - # C.g:184:7: ( type_specifier ) - # C.g:184:7: type_specifier - self.following.append(self.FOLLOW_type_specifier_in_synpred14272) - self.type_specifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred14 - - - - # $ANTLR start synpred15 - def synpred15_fragment(self, ): - # C.g:185:13: ( type_qualifier ) - # C.g:185:13: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred15286) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred15 - - - - # $ANTLR start synpred33 - def synpred33_fragment(self, ): - # C.g:225:16: ( type_qualifier ) - # C.g:225:16: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred33444) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred33 - - - - # $ANTLR start synpred34 - def synpred34_fragment(self, ): - # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator ) - # C.g:225:5: IDENTIFIER ( type_qualifier )* declarator - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred34442) - if self.failed: - return - # C.g:225:16: ( type_qualifier )* - while True: #loop106 - alt106 = 2 - LA106 = self.input.LA(1) - if LA106 == 58: - LA106_2 = self.input.LA(2) - - if (self.synpred33()) : - alt106 = 1 - - - elif LA106 == 59: - LA106_3 = self.input.LA(2) - - if (self.synpred33()) : - alt106 = 1 - - - elif LA106 == 60: - LA106_4 = self.input.LA(2) - - if (self.synpred33()) : - alt106 = 1 - - - elif LA106 == 49 or LA106 == 50 or LA106 == 51 or LA106 == 52 or LA106 == 53 or LA106 == 54 or LA106 == 55 or LA106 == 56 or LA106 == 57 or LA106 == 61: - alt106 = 1 - - if alt106 == 1: - # C.g:0:0: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred34444) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - else: - break #loop106 - - - self.following.append(self.FOLLOW_declarator_in_synpred34447) - self.declarator() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred34 - - - - # $ANTLR start synpred39 - def synpred39_fragment(self, ): - # C.g:253:6: ( type_qualifier ) - # C.g:253:6: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred39566) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred39 - - - - # $ANTLR start synpred40 - def synpred40_fragment(self, ): - # C.g:253:23: ( type_specifier ) - # C.g:253:23: type_specifier - self.following.append(self.FOLLOW_type_specifier_in_synpred40570) - self.type_specifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred40 - - - - # $ANTLR start synpred66 - def synpred66_fragment(self, ): - # C.g:297:4: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator ) - # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator - # C.g:297:4: ( pointer )? - alt111 = 2 - LA111_0 = self.input.LA(1) - - if (LA111_0 == 66) : - alt111 = 1 - if alt111 == 1: - # C.g:0:0: pointer - self.following.append(self.FOLLOW_pointer_in_synpred66784) - self.pointer() - self.following.pop() - if self.failed: - return - - - - # C.g:297:13: ( 'EFIAPI' )? - alt112 = 2 - LA112_0 = self.input.LA(1) - - if (LA112_0 == 58) : - alt112 = 1 - if alt112 == 1: - # C.g:297:14: 'EFIAPI' - self.match(self.input, 58, self.FOLLOW_58_in_synpred66788) - if self.failed: - return - - - - # C.g:297:25: ( 'EFI_BOOTSERVICE' )? - alt113 = 2 - LA113_0 = self.input.LA(1) - - if (LA113_0 == 59) : - alt113 = 1 - if alt113 == 1: - # C.g:297:26: 'EFI_BOOTSERVICE' - self.match(self.input, 59, self.FOLLOW_59_in_synpred66793) - if self.failed: - return - - - - # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )? - alt114 = 2 - LA114_0 = self.input.LA(1) - - if (LA114_0 == 60) : - alt114 = 1 - if alt114 == 1: - # C.g:297:47: 'EFI_RUNTIMESERVICE' - self.match(self.input, 60, self.FOLLOW_60_in_synpred66798) - if self.failed: - return - - - - self.following.append(self.FOLLOW_direct_declarator_in_synpred66802) - self.direct_declarator() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred66 - - - - # $ANTLR start synpred67 - def synpred67_fragment(self, ): - # C.g:303:15: ( declarator_suffix ) - # C.g:303:15: declarator_suffix - self.following.append(self.FOLLOW_declarator_suffix_in_synpred67821) - self.declarator_suffix() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred67 - - - - # $ANTLR start synpred69 - def synpred69_fragment(self, ): - # C.g:304:9: ( 'EFIAPI' ) - # C.g:304:9: 'EFIAPI' - self.match(self.input, 58, self.FOLLOW_58_in_synpred69830) - if self.failed: - return - - - # $ANTLR end synpred69 - - - - # $ANTLR start synpred70 - def synpred70_fragment(self, ): - # C.g:304:35: ( declarator_suffix ) - # C.g:304:35: declarator_suffix - self.following.append(self.FOLLOW_declarator_suffix_in_synpred70838) - self.declarator_suffix() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred70 - - - - # $ANTLR start synpred73 - def synpred73_fragment(self, ): - # C.g:310:9: ( '(' parameter_type_list ')' ) - # C.g:310:9: '(' parameter_type_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_synpred73878) - if self.failed: - return - self.following.append(self.FOLLOW_parameter_type_list_in_synpred73880) - self.parameter_type_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred73882) - if self.failed: - return - - - # $ANTLR end synpred73 - - - - # $ANTLR start synpred74 - def synpred74_fragment(self, ): - # C.g:311:9: ( '(' identifier_list ')' ) - # C.g:311:9: '(' identifier_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_synpred74892) - if self.failed: - return - self.following.append(self.FOLLOW_identifier_list_in_synpred74894) - self.identifier_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred74896) - if self.failed: - return - - - # $ANTLR end synpred74 - - - - # $ANTLR start synpred75 - def synpred75_fragment(self, ): - # C.g:316:8: ( type_qualifier ) - # C.g:316:8: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred75921) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred75 - - - - # $ANTLR start synpred76 - def synpred76_fragment(self, ): - # C.g:316:24: ( pointer ) - # C.g:316:24: pointer - self.following.append(self.FOLLOW_pointer_in_synpred76924) - self.pointer() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred76 - - - - # $ANTLR start synpred77 - def synpred77_fragment(self, ): - # C.g:316:4: ( '*' ( type_qualifier )+ ( pointer )? ) - # C.g:316:4: '*' ( type_qualifier )+ ( pointer )? - self.match(self.input, 66, self.FOLLOW_66_in_synpred77919) - if self.failed: - return - # C.g:316:8: ( type_qualifier )+ - cnt116 = 0 - while True: #loop116 - alt116 = 2 - LA116_0 = self.input.LA(1) - - if ((49 <= LA116_0 <= 61)) : - alt116 = 1 - - - if alt116 == 1: - # C.g:0:0: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred77921) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - else: - if cnt116 >= 1: - break #loop116 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(116, self.input) - raise eee - - cnt116 += 1 - - - # C.g:316:24: ( pointer )? - alt117 = 2 - LA117_0 = self.input.LA(1) - - if (LA117_0 == 66) : - alt117 = 1 - if alt117 == 1: - # C.g:0:0: pointer - self.following.append(self.FOLLOW_pointer_in_synpred77924) - self.pointer() - self.following.pop() - if self.failed: - return - - - - - - # $ANTLR end synpred77 - - - - # $ANTLR start synpred78 - def synpred78_fragment(self, ): - # C.g:317:4: ( '*' pointer ) - # C.g:317:4: '*' pointer - self.match(self.input, 66, self.FOLLOW_66_in_synpred78930) - if self.failed: - return - self.following.append(self.FOLLOW_pointer_in_synpred78932) - self.pointer() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred78 - - - - # $ANTLR start synpred81 - def synpred81_fragment(self, ): - # C.g:326:32: ( 'OPTIONAL' ) - # C.g:326:32: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_synpred81977) - if self.failed: - return - - - # $ANTLR end synpred81 - - - - # $ANTLR start synpred82 - def synpred82_fragment(self, ): - # C.g:326:27: ( ',' ( 'OPTIONAL' )? parameter_declaration ) - # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration - self.match(self.input, 27, self.FOLLOW_27_in_synpred82974) - if self.failed: - return - # C.g:326:31: ( 'OPTIONAL' )? - alt119 = 2 - LA119_0 = self.input.LA(1) - - if (LA119_0 == 53) : - LA119_1 = self.input.LA(2) - - if (self.synpred81()) : - alt119 = 1 - if alt119 == 1: - # C.g:326:32: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_synpred82977) - if self.failed: - return - - - - self.following.append(self.FOLLOW_parameter_declaration_in_synpred82981) - self.parameter_declaration() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred82 - - - - # $ANTLR start synpred83 - def synpred83_fragment(self, ): - # C.g:330:28: ( declarator ) - # C.g:330:28: declarator - self.following.append(self.FOLLOW_declarator_in_synpred83997) - self.declarator() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred83 - - - - # $ANTLR start synpred84 - def synpred84_fragment(self, ): - # C.g:330:39: ( abstract_declarator ) - # C.g:330:39: abstract_declarator - self.following.append(self.FOLLOW_abstract_declarator_in_synpred84999) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred84 - - - - # $ANTLR start synpred86 - def synpred86_fragment(self, ): - # C.g:330:4: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? ) - # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? - self.following.append(self.FOLLOW_declaration_specifiers_in_synpred86994) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - # C.g:330:27: ( declarator | abstract_declarator )* - while True: #loop120 - alt120 = 3 - LA120 = self.input.LA(1) - if LA120 == 66: - LA120_3 = self.input.LA(2) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == IDENTIFIER or LA120 == 58 or LA120 == 59 or LA120 == 60: - alt120 = 1 - elif LA120 == 62: - LA120 = self.input.LA(2) - if LA120 == 29 or LA120 == 30 or LA120 == 31 or LA120 == 32 or LA120 == 33 or LA120 == 34 or LA120 == 35 or LA120 == 36 or LA120 == 37 or LA120 == 38 or LA120 == 39 or LA120 == 40 or LA120 == 41 or LA120 == 42 or LA120 == 45 or LA120 == 46 or LA120 == 48 or LA120 == 49 or LA120 == 50 or LA120 == 51 or LA120 == 52 or LA120 == 53 or LA120 == 54 or LA120 == 55 or LA120 == 56 or LA120 == 57 or LA120 == 61 or LA120 == 63 or LA120 == 64: - alt120 = 2 - elif LA120 == 58: - LA120_21 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == 66: - LA120_22 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == 59: - LA120_23 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == 60: - LA120_24 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == IDENTIFIER: - LA120_25 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == 62: - LA120_26 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - - elif LA120 == 64: - alt120 = 2 - - if alt120 == 1: - # C.g:330:28: declarator - self.following.append(self.FOLLOW_declarator_in_synpred86997) - self.declarator() - self.following.pop() - if self.failed: - return - - - elif alt120 == 2: - # C.g:330:39: abstract_declarator - self.following.append(self.FOLLOW_abstract_declarator_in_synpred86999) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - - - else: - break #loop120 - - - # C.g:330:61: ( 'OPTIONAL' )? - alt121 = 2 - LA121_0 = self.input.LA(1) - - if (LA121_0 == 53) : - alt121 = 1 - if alt121 == 1: - # C.g:330:62: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_synpred861004) - if self.failed: - return - - - - - - # $ANTLR end synpred86 - - - - # $ANTLR start synpred90 - def synpred90_fragment(self, ): - # C.g:341:4: ( specifier_qualifier_list ( abstract_declarator )? ) - # C.g:341:4: specifier_qualifier_list ( abstract_declarator )? - self.following.append(self.FOLLOW_specifier_qualifier_list_in_synpred901046) - self.specifier_qualifier_list() - self.following.pop() - if self.failed: - return - # C.g:341:29: ( abstract_declarator )? - alt122 = 2 - LA122_0 = self.input.LA(1) - - if (LA122_0 == 62 or LA122_0 == 64 or LA122_0 == 66) : - alt122 = 1 - if alt122 == 1: - # C.g:0:0: abstract_declarator - self.following.append(self.FOLLOW_abstract_declarator_in_synpred901048) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - - - - - - # $ANTLR end synpred90 - - - - # $ANTLR start synpred91 - def synpred91_fragment(self, ): - # C.g:346:12: ( direct_abstract_declarator ) - # C.g:346:12: direct_abstract_declarator - self.following.append(self.FOLLOW_direct_abstract_declarator_in_synpred911067) - self.direct_abstract_declarator() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred91 - - - - # $ANTLR start synpred93 - def synpred93_fragment(self, ): - # C.g:351:6: ( '(' abstract_declarator ')' ) - # C.g:351:6: '(' abstract_declarator ')' - self.match(self.input, 62, self.FOLLOW_62_in_synpred931086) - if self.failed: - return - self.following.append(self.FOLLOW_abstract_declarator_in_synpred931088) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred931090) - if self.failed: - return - - - # $ANTLR end synpred93 - - - - # $ANTLR start synpred94 - def synpred94_fragment(self, ): - # C.g:351:65: ( abstract_declarator_suffix ) - # C.g:351:65: abstract_declarator_suffix - self.following.append(self.FOLLOW_abstract_declarator_suffix_in_synpred941098) - self.abstract_declarator_suffix() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred94 - - - - # $ANTLR start synpred109 - def synpred109_fragment(self, ): - # C.g:386:4: ( '(' type_name ')' cast_expression ) - # C.g:386:4: '(' type_name ')' cast_expression - self.match(self.input, 62, self.FOLLOW_62_in_synpred1091282) - if self.failed: - return - self.following.append(self.FOLLOW_type_name_in_synpred1091284) - self.type_name() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred1091286) - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_synpred1091288) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred109 - - - - # $ANTLR start synpred114 - def synpred114_fragment(self, ): - # C.g:395:4: ( 'sizeof' unary_expression ) - # C.g:395:4: 'sizeof' unary_expression - self.match(self.input, 74, self.FOLLOW_74_in_synpred1141330) - if self.failed: - return - self.following.append(self.FOLLOW_unary_expression_in_synpred1141332) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred114 - - - - # $ANTLR start synpred117 - def synpred117_fragment(self, ): - # C.g:409:13: ( '(' argument_expression_list ')' ) - # C.g:409:13: '(' argument_expression_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_synpred1171420) - if self.failed: - return - self.following.append(self.FOLLOW_argument_expression_list_in_synpred1171424) - self.argument_expression_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred1171428) - if self.failed: - return - - - # $ANTLR end synpred117 - - - - # $ANTLR start synpred118 - def synpred118_fragment(self, ): - # C.g:410:13: ( '(' macro_parameter_list ')' ) - # C.g:410:13: '(' macro_parameter_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_synpred1181444) - if self.failed: - return - self.following.append(self.FOLLOW_macro_parameter_list_in_synpred1181446) - self.macro_parameter_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred1181448) - if self.failed: - return - - - # $ANTLR end synpred118 - - - - # $ANTLR start synpred120 - def synpred120_fragment(self, ): - # C.g:412:13: ( '*' IDENTIFIER ) - # C.g:412:13: '*' IDENTIFIER - self.match(self.input, 66, self.FOLLOW_66_in_synpred1201482) - if self.failed: - return - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1201486) - if self.failed: - return - - - # $ANTLR end synpred120 - - - - # $ANTLR start synpred137 - def synpred137_fragment(self, ): - # C.g:443:20: ( STRING_LITERAL ) - # C.g:443:20: STRING_LITERAL - self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1371683) - if self.failed: - return - - - # $ANTLR end synpred137 - - - - # $ANTLR start synpred138 - def synpred138_fragment(self, ): - # C.g:443:8: ( ( IDENTIFIER )* ( STRING_LITERAL )+ ) - # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+ - # C.g:443:8: ( IDENTIFIER )* - while True: #loop125 - alt125 = 2 - LA125_0 = self.input.LA(1) - - if (LA125_0 == IDENTIFIER) : - alt125 = 1 - - - if alt125 == 1: - # C.g:0:0: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1381680) - if self.failed: - return - - - else: - break #loop125 - - - # C.g:443:20: ( STRING_LITERAL )+ - cnt126 = 0 - while True: #loop126 - alt126 = 2 - LA126_0 = self.input.LA(1) - - if (LA126_0 == STRING_LITERAL) : - alt126 = 1 - - - if alt126 == 1: - # C.g:0:0: STRING_LITERAL - self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1381683) - if self.failed: - return - - - else: - if cnt126 >= 1: - break #loop126 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(126, self.input) - raise eee - - cnt126 += 1 - - - - - # $ANTLR end synpred138 - - - - # $ANTLR start synpred142 - def synpred142_fragment(self, ): - # C.g:458:4: ( lvalue assignment_operator assignment_expression ) - # C.g:458:4: lvalue assignment_operator assignment_expression - self.following.append(self.FOLLOW_lvalue_in_synpred1421744) - self.lvalue() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_assignment_operator_in_synpred1421746) - self.assignment_operator() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_assignment_expression_in_synpred1421748) - self.assignment_expression() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred142 - - - - # $ANTLR start synpred169 - def synpred169_fragment(self, ): - # C.g:520:4: ( expression_statement ) - # C.g:520:4: expression_statement - self.following.append(self.FOLLOW_expression_statement_in_synpred1692035) - self.expression_statement() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred169 - - - - # $ANTLR start synpred173 - def synpred173_fragment(self, ): - # C.g:524:4: ( macro_statement ) - # C.g:524:4: macro_statement - self.following.append(self.FOLLOW_macro_statement_in_synpred1732055) - self.macro_statement() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred173 - - - - # $ANTLR start synpred174 - def synpred174_fragment(self, ): - # C.g:525:4: ( asm2_statement ) - # C.g:525:4: asm2_statement - self.following.append(self.FOLLOW_asm2_statement_in_synpred1742060) - self.asm2_statement() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred174 - - - - # $ANTLR start synpred181 - def synpred181_fragment(self, ): - # C.g:544:19: ( declaration ) - # C.g:544:19: declaration - self.following.append(self.FOLLOW_declaration_in_synpred1812166) - self.declaration() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred181 - - - - # $ANTLR start synpred182 - def synpred182_fragment(self, ): - # C.g:544:33: ( statement_list ) - # C.g:544:33: statement_list - self.following.append(self.FOLLOW_statement_list_in_synpred1822170) - self.statement_list() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred182 - - - - # $ANTLR start synpred186 - def synpred186_fragment(self, ): - # C.g:554:8: ( declaration ) - # C.g:554:8: declaration - self.following.append(self.FOLLOW_declaration_in_synpred1862225) - self.declaration() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred186 - - - - # $ANTLR start synpred188 - def synpred188_fragment(self, ): - # C.g:558:4: ( statement ) - # C.g:558:4: statement - self.following.append(self.FOLLOW_statement_in_synpred1882242) - self.statement() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred188 - - - - def synpred69(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred69_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred81(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred81_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred82(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred82_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred66(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred66_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred83(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred83_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred84(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred84_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred67(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred67_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred86(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred86_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred120(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred120_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred40(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred40_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred142(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred142_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred182(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred182_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred109(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred109_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred181(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred181_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred186(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred186_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred188(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred188_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred169(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred169_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred117(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred117_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred70(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred70_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred118(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred118_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred34(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred34_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred33(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred33_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred94(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred94_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred39(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred39_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred74(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred74_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred114(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred114_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred93(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred93_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred75(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred75_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred137(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred137_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred90(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred90_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred138(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred138_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred91(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred91_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred73(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred73_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred5(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred5_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred78(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred78_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred7(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred7_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred76(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred76_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred77(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred77_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred2(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred2_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred4(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred4_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred174(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred174_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred173(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred173_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred14(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred14_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred15(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred15_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred10(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred10_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - - - - - FOLLOW_external_declaration_in_translation_unit74 = frozenset([1, 4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) - FOLLOW_function_definition_in_external_declaration113 = frozenset([1]) - FOLLOW_declaration_in_external_declaration118 = frozenset([1]) - FOLLOW_macro_statement_in_external_declaration123 = frozenset([1, 25]) - FOLLOW_25_in_external_declaration126 = frozenset([1]) - FOLLOW_declaration_specifiers_in_function_definition157 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_declarator_in_function_definition160 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_declaration_in_function_definition166 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_compound_statement_in_function_definition171 = frozenset([1]) - FOLLOW_compound_statement_in_function_definition180 = frozenset([1]) - FOLLOW_26_in_declaration203 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) - FOLLOW_declaration_specifiers_in_declaration207 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_init_declarator_list_in_declaration216 = frozenset([25]) - FOLLOW_25_in_declaration220 = frozenset([1]) - FOLLOW_declaration_specifiers_in_declaration234 = frozenset([4, 25, 58, 59, 60, 62, 66]) - FOLLOW_init_declarator_list_in_declaration238 = frozenset([25]) - FOLLOW_25_in_declaration243 = frozenset([1]) - FOLLOW_storage_class_specifier_in_declaration_specifiers264 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_specifier_in_declaration_specifiers272 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_qualifier_in_declaration_specifiers286 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_init_declarator_in_init_declarator_list308 = frozenset([1, 27]) - FOLLOW_27_in_init_declarator_list311 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_init_declarator_in_init_declarator_list313 = frozenset([1, 27]) - FOLLOW_declarator_in_init_declarator326 = frozenset([1, 28]) - FOLLOW_28_in_init_declarator329 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_initializer_in_init_declarator331 = frozenset([1]) - FOLLOW_set_in_storage_class_specifier0 = frozenset([1]) - FOLLOW_34_in_type_specifier376 = frozenset([1]) - FOLLOW_35_in_type_specifier381 = frozenset([1]) - FOLLOW_36_in_type_specifier386 = frozenset([1]) - FOLLOW_37_in_type_specifier391 = frozenset([1]) - FOLLOW_38_in_type_specifier396 = frozenset([1]) - FOLLOW_39_in_type_specifier401 = frozenset([1]) - FOLLOW_40_in_type_specifier406 = frozenset([1]) - FOLLOW_41_in_type_specifier411 = frozenset([1]) - FOLLOW_42_in_type_specifier416 = frozenset([1]) - FOLLOW_struct_or_union_specifier_in_type_specifier423 = frozenset([1]) - FOLLOW_enum_specifier_in_type_specifier433 = frozenset([1]) - FOLLOW_type_id_in_type_specifier451 = frozenset([1]) - FOLLOW_IDENTIFIER_in_type_id467 = frozenset([1]) - FOLLOW_struct_or_union_in_struct_or_union_specifier494 = frozenset([4, 43]) - FOLLOW_IDENTIFIER_in_struct_or_union_specifier496 = frozenset([43]) - FOLLOW_43_in_struct_or_union_specifier499 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_struct_declaration_list_in_struct_or_union_specifier501 = frozenset([44]) - FOLLOW_44_in_struct_or_union_specifier503 = frozenset([1]) - FOLLOW_struct_or_union_in_struct_or_union_specifier508 = frozenset([4]) - FOLLOW_IDENTIFIER_in_struct_or_union_specifier510 = frozenset([1]) - FOLLOW_set_in_struct_or_union0 = frozenset([1]) - FOLLOW_struct_declaration_in_struct_declaration_list537 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_specifier_qualifier_list_in_struct_declaration549 = frozenset([4, 47, 58, 59, 60, 62, 66]) - FOLLOW_struct_declarator_list_in_struct_declaration551 = frozenset([25]) - FOLLOW_25_in_struct_declaration553 = frozenset([1]) - FOLLOW_type_qualifier_in_specifier_qualifier_list566 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_specifier_in_specifier_qualifier_list570 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_struct_declarator_in_struct_declarator_list584 = frozenset([1, 27]) - FOLLOW_27_in_struct_declarator_list587 = frozenset([4, 47, 58, 59, 60, 62, 66]) - FOLLOW_struct_declarator_in_struct_declarator_list589 = frozenset([1, 27]) - FOLLOW_declarator_in_struct_declarator602 = frozenset([1, 47]) - FOLLOW_47_in_struct_declarator605 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_struct_declarator607 = frozenset([1]) - FOLLOW_47_in_struct_declarator614 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_struct_declarator616 = frozenset([1]) - FOLLOW_48_in_enum_specifier634 = frozenset([43]) - FOLLOW_43_in_enum_specifier636 = frozenset([4]) - FOLLOW_enumerator_list_in_enum_specifier638 = frozenset([27, 44]) - FOLLOW_27_in_enum_specifier640 = frozenset([44]) - FOLLOW_44_in_enum_specifier643 = frozenset([1]) - FOLLOW_48_in_enum_specifier648 = frozenset([4]) - FOLLOW_IDENTIFIER_in_enum_specifier650 = frozenset([43]) - FOLLOW_43_in_enum_specifier652 = frozenset([4]) - FOLLOW_enumerator_list_in_enum_specifier654 = frozenset([27, 44]) - FOLLOW_27_in_enum_specifier656 = frozenset([44]) - FOLLOW_44_in_enum_specifier659 = frozenset([1]) - FOLLOW_48_in_enum_specifier664 = frozenset([4]) - FOLLOW_IDENTIFIER_in_enum_specifier666 = frozenset([1]) - FOLLOW_enumerator_in_enumerator_list677 = frozenset([1, 27]) - FOLLOW_27_in_enumerator_list680 = frozenset([4]) - FOLLOW_enumerator_in_enumerator_list682 = frozenset([1, 27]) - FOLLOW_IDENTIFIER_in_enumerator695 = frozenset([1, 28]) - FOLLOW_28_in_enumerator698 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_enumerator700 = frozenset([1]) - FOLLOW_set_in_type_qualifier0 = frozenset([1]) - FOLLOW_pointer_in_declarator784 = frozenset([4, 58, 59, 60, 62]) - FOLLOW_58_in_declarator788 = frozenset([4, 59, 60, 62]) - FOLLOW_59_in_declarator793 = frozenset([4, 60, 62]) - FOLLOW_60_in_declarator798 = frozenset([4, 62]) - FOLLOW_direct_declarator_in_declarator802 = frozenset([1]) - FOLLOW_pointer_in_declarator808 = frozenset([1]) - FOLLOW_IDENTIFIER_in_direct_declarator819 = frozenset([1, 62, 64]) - FOLLOW_declarator_suffix_in_direct_declarator821 = frozenset([1, 62, 64]) - FOLLOW_62_in_direct_declarator827 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_58_in_direct_declarator830 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_declarator_in_direct_declarator834 = frozenset([63]) - FOLLOW_63_in_direct_declarator836 = frozenset([62, 64]) - FOLLOW_declarator_suffix_in_direct_declarator838 = frozenset([1, 62, 64]) - FOLLOW_64_in_declarator_suffix852 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_declarator_suffix854 = frozenset([65]) - FOLLOW_65_in_declarator_suffix856 = frozenset([1]) - FOLLOW_64_in_declarator_suffix866 = frozenset([65]) - FOLLOW_65_in_declarator_suffix868 = frozenset([1]) - FOLLOW_62_in_declarator_suffix878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_type_list_in_declarator_suffix880 = frozenset([63]) - FOLLOW_63_in_declarator_suffix882 = frozenset([1]) - FOLLOW_62_in_declarator_suffix892 = frozenset([4]) - FOLLOW_identifier_list_in_declarator_suffix894 = frozenset([63]) - FOLLOW_63_in_declarator_suffix896 = frozenset([1]) - FOLLOW_62_in_declarator_suffix906 = frozenset([63]) - FOLLOW_63_in_declarator_suffix908 = frozenset([1]) - FOLLOW_66_in_pointer919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_qualifier_in_pointer921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_pointer_in_pointer924 = frozenset([1]) - FOLLOW_66_in_pointer930 = frozenset([66]) - FOLLOW_pointer_in_pointer932 = frozenset([1]) - FOLLOW_66_in_pointer937 = frozenset([1]) - FOLLOW_parameter_list_in_parameter_type_list948 = frozenset([1, 27]) - FOLLOW_27_in_parameter_type_list951 = frozenset([53, 67]) - FOLLOW_53_in_parameter_type_list954 = frozenset([67]) - FOLLOW_67_in_parameter_type_list958 = frozenset([1]) - FOLLOW_parameter_declaration_in_parameter_list971 = frozenset([1, 27]) - FOLLOW_27_in_parameter_list974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_53_in_parameter_list977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_declaration_in_parameter_list981 = frozenset([1, 27]) - FOLLOW_declaration_specifiers_in_parameter_declaration994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_declarator_in_parameter_declaration997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_abstract_declarator_in_parameter_declaration999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_53_in_parameter_declaration1004 = frozenset([1]) - FOLLOW_pointer_in_parameter_declaration1013 = frozenset([4, 66]) - FOLLOW_IDENTIFIER_in_parameter_declaration1016 = frozenset([1]) - FOLLOW_IDENTIFIER_in_identifier_list1027 = frozenset([1, 27]) - FOLLOW_27_in_identifier_list1031 = frozenset([4]) - FOLLOW_IDENTIFIER_in_identifier_list1033 = frozenset([1, 27]) - FOLLOW_specifier_qualifier_list_in_type_name1046 = frozenset([1, 62, 64, 66]) - FOLLOW_abstract_declarator_in_type_name1048 = frozenset([1]) - FOLLOW_type_id_in_type_name1054 = frozenset([1]) - FOLLOW_pointer_in_abstract_declarator1065 = frozenset([1, 62, 64]) - FOLLOW_direct_abstract_declarator_in_abstract_declarator1067 = frozenset([1]) - FOLLOW_direct_abstract_declarator_in_abstract_declarator1073 = frozenset([1]) - FOLLOW_62_in_direct_abstract_declarator1086 = frozenset([62, 64, 66]) - FOLLOW_abstract_declarator_in_direct_abstract_declarator1088 = frozenset([63]) - FOLLOW_63_in_direct_abstract_declarator1090 = frozenset([1, 62, 64]) - FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094 = frozenset([1, 62, 64]) - FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098 = frozenset([1, 62, 64]) - FOLLOW_64_in_abstract_declarator_suffix1110 = frozenset([65]) - FOLLOW_65_in_abstract_declarator_suffix1112 = frozenset([1]) - FOLLOW_64_in_abstract_declarator_suffix1117 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_abstract_declarator_suffix1119 = frozenset([65]) - FOLLOW_65_in_abstract_declarator_suffix1121 = frozenset([1]) - FOLLOW_62_in_abstract_declarator_suffix1126 = frozenset([63]) - FOLLOW_63_in_abstract_declarator_suffix1128 = frozenset([1]) - FOLLOW_62_in_abstract_declarator_suffix1133 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135 = frozenset([63]) - FOLLOW_63_in_abstract_declarator_suffix1137 = frozenset([1]) - FOLLOW_assignment_expression_in_initializer1150 = frozenset([1]) - FOLLOW_43_in_initializer1155 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_initializer_list_in_initializer1157 = frozenset([27, 44]) - FOLLOW_27_in_initializer1159 = frozenset([44]) - FOLLOW_44_in_initializer1162 = frozenset([1]) - FOLLOW_initializer_in_initializer_list1173 = frozenset([1, 27]) - FOLLOW_27_in_initializer_list1176 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_initializer_in_initializer_list1178 = frozenset([1, 27]) - FOLLOW_assignment_expression_in_argument_expression_list1196 = frozenset([1, 27, 53]) - FOLLOW_53_in_argument_expression_list1199 = frozenset([1, 27]) - FOLLOW_27_in_argument_expression_list1204 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_assignment_expression_in_argument_expression_list1206 = frozenset([1, 27, 53]) - FOLLOW_53_in_argument_expression_list1209 = frozenset([1, 27]) - FOLLOW_multiplicative_expression_in_additive_expression1225 = frozenset([1, 68, 69]) - FOLLOW_68_in_additive_expression1229 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_multiplicative_expression_in_additive_expression1231 = frozenset([1, 68, 69]) - FOLLOW_69_in_additive_expression1235 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_multiplicative_expression_in_additive_expression1237 = frozenset([1, 68, 69]) - FOLLOW_cast_expression_in_multiplicative_expression1251 = frozenset([1, 66, 70, 71]) - FOLLOW_66_in_multiplicative_expression1255 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_multiplicative_expression1257 = frozenset([1, 66, 70, 71]) - FOLLOW_70_in_multiplicative_expression1261 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_multiplicative_expression1263 = frozenset([1, 66, 70, 71]) - FOLLOW_71_in_multiplicative_expression1267 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_multiplicative_expression1269 = frozenset([1, 66, 70, 71]) - FOLLOW_62_in_cast_expression1282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_name_in_cast_expression1284 = frozenset([63]) - FOLLOW_63_in_cast_expression1286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_cast_expression1288 = frozenset([1]) - FOLLOW_unary_expression_in_cast_expression1293 = frozenset([1]) - FOLLOW_postfix_expression_in_unary_expression1304 = frozenset([1]) - FOLLOW_72_in_unary_expression1309 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_unary_expression_in_unary_expression1311 = frozenset([1]) - FOLLOW_73_in_unary_expression1316 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_unary_expression_in_unary_expression1318 = frozenset([1]) - FOLLOW_unary_operator_in_unary_expression1323 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_unary_expression1325 = frozenset([1]) - FOLLOW_74_in_unary_expression1330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_unary_expression_in_unary_expression1332 = frozenset([1]) - FOLLOW_74_in_unary_expression1337 = frozenset([62]) - FOLLOW_62_in_unary_expression1339 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_name_in_unary_expression1341 = frozenset([63]) - FOLLOW_63_in_unary_expression1343 = frozenset([1]) - FOLLOW_primary_expression_in_postfix_expression1367 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_64_in_postfix_expression1383 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_postfix_expression1385 = frozenset([65]) - FOLLOW_65_in_postfix_expression1387 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_62_in_postfix_expression1401 = frozenset([63]) - FOLLOW_63_in_postfix_expression1405 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_62_in_postfix_expression1420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_argument_expression_list_in_postfix_expression1424 = frozenset([63]) - FOLLOW_63_in_postfix_expression1428 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_62_in_postfix_expression1444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_macro_parameter_list_in_postfix_expression1446 = frozenset([63]) - FOLLOW_63_in_postfix_expression1448 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_75_in_postfix_expression1462 = frozenset([4]) - FOLLOW_IDENTIFIER_in_postfix_expression1466 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_66_in_postfix_expression1482 = frozenset([4]) - FOLLOW_IDENTIFIER_in_postfix_expression1486 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_76_in_postfix_expression1502 = frozenset([4]) - FOLLOW_IDENTIFIER_in_postfix_expression1506 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_72_in_postfix_expression1522 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_73_in_postfix_expression1536 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_parameter_declaration_in_macro_parameter_list1559 = frozenset([1, 27]) - FOLLOW_27_in_macro_parameter_list1562 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_declaration_in_macro_parameter_list1564 = frozenset([1, 27]) - FOLLOW_set_in_unary_operator0 = frozenset([1]) - FOLLOW_IDENTIFIER_in_primary_expression1613 = frozenset([1]) - FOLLOW_constant_in_primary_expression1618 = frozenset([1]) - FOLLOW_62_in_primary_expression1623 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_primary_expression1625 = frozenset([63]) - FOLLOW_63_in_primary_expression1627 = frozenset([1]) - FOLLOW_HEX_LITERAL_in_constant1643 = frozenset([1]) - FOLLOW_OCTAL_LITERAL_in_constant1653 = frozenset([1]) - FOLLOW_DECIMAL_LITERAL_in_constant1663 = frozenset([1]) - FOLLOW_CHARACTER_LITERAL_in_constant1671 = frozenset([1]) - FOLLOW_IDENTIFIER_in_constant1680 = frozenset([4, 9]) - FOLLOW_STRING_LITERAL_in_constant1683 = frozenset([1, 4, 9]) - FOLLOW_IDENTIFIER_in_constant1688 = frozenset([1, 4]) - FOLLOW_FLOATING_POINT_LITERAL_in_constant1699 = frozenset([1]) - FOLLOW_assignment_expression_in_expression1715 = frozenset([1, 27]) - FOLLOW_27_in_expression1718 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_assignment_expression_in_expression1720 = frozenset([1, 27]) - FOLLOW_conditional_expression_in_constant_expression1733 = frozenset([1]) - FOLLOW_lvalue_in_assignment_expression1744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]) - FOLLOW_assignment_operator_in_assignment_expression1746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_assignment_expression_in_assignment_expression1748 = frozenset([1]) - FOLLOW_conditional_expression_in_assignment_expression1753 = frozenset([1]) - FOLLOW_unary_expression_in_lvalue1765 = frozenset([1]) - FOLLOW_set_in_assignment_operator0 = frozenset([1]) - FOLLOW_logical_or_expression_in_conditional_expression1839 = frozenset([1, 90]) - FOLLOW_90_in_conditional_expression1842 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_conditional_expression1844 = frozenset([47]) - FOLLOW_47_in_conditional_expression1846 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_conditional_expression_in_conditional_expression1848 = frozenset([1]) - FOLLOW_logical_and_expression_in_logical_or_expression1863 = frozenset([1, 91]) - FOLLOW_91_in_logical_or_expression1866 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_logical_and_expression_in_logical_or_expression1868 = frozenset([1, 91]) - FOLLOW_inclusive_or_expression_in_logical_and_expression1881 = frozenset([1, 92]) - FOLLOW_92_in_logical_and_expression1884 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_inclusive_or_expression_in_logical_and_expression1886 = frozenset([1, 92]) - FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899 = frozenset([1, 93]) - FOLLOW_93_in_inclusive_or_expression1902 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904 = frozenset([1, 93]) - FOLLOW_and_expression_in_exclusive_or_expression1917 = frozenset([1, 94]) - FOLLOW_94_in_exclusive_or_expression1920 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_and_expression_in_exclusive_or_expression1922 = frozenset([1, 94]) - FOLLOW_equality_expression_in_and_expression1935 = frozenset([1, 77]) - FOLLOW_77_in_and_expression1938 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_equality_expression_in_and_expression1940 = frozenset([1, 77]) - FOLLOW_relational_expression_in_equality_expression1952 = frozenset([1, 95, 96]) - FOLLOW_set_in_equality_expression1955 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_relational_expression_in_equality_expression1961 = frozenset([1, 95, 96]) - FOLLOW_shift_expression_in_relational_expression1975 = frozenset([1, 97, 98, 99, 100]) - FOLLOW_set_in_relational_expression1978 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_shift_expression_in_relational_expression1988 = frozenset([1, 97, 98, 99, 100]) - FOLLOW_additive_expression_in_shift_expression2001 = frozenset([1, 101, 102]) - FOLLOW_set_in_shift_expression2004 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_additive_expression_in_shift_expression2010 = frozenset([1, 101, 102]) - FOLLOW_labeled_statement_in_statement2025 = frozenset([1]) - FOLLOW_compound_statement_in_statement2030 = frozenset([1]) - FOLLOW_expression_statement_in_statement2035 = frozenset([1]) - FOLLOW_selection_statement_in_statement2040 = frozenset([1]) - FOLLOW_iteration_statement_in_statement2045 = frozenset([1]) - FOLLOW_jump_statement_in_statement2050 = frozenset([1]) - FOLLOW_macro_statement_in_statement2055 = frozenset([1]) - FOLLOW_asm2_statement_in_statement2060 = frozenset([1]) - FOLLOW_asm1_statement_in_statement2065 = frozenset([1]) - FOLLOW_asm_statement_in_statement2070 = frozenset([1]) - FOLLOW_declaration_in_statement2075 = frozenset([1]) - FOLLOW_103_in_asm2_statement2086 = frozenset([4]) - FOLLOW_IDENTIFIER_in_asm2_statement2089 = frozenset([62]) - FOLLOW_62_in_asm2_statement2091 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_set_in_asm2_statement2094 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_63_in_asm2_statement2101 = frozenset([25]) - FOLLOW_25_in_asm2_statement2103 = frozenset([1]) - FOLLOW_104_in_asm1_statement2115 = frozenset([43]) - FOLLOW_43_in_asm1_statement2117 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_set_in_asm1_statement2120 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_44_in_asm1_statement2127 = frozenset([1]) - FOLLOW_105_in_asm_statement2138 = frozenset([43]) - FOLLOW_43_in_asm_statement2140 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_set_in_asm_statement2143 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_44_in_asm_statement2150 = frozenset([1]) - FOLLOW_IDENTIFIER_in_macro_statement2162 = frozenset([62]) - FOLLOW_62_in_macro_statement2164 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_declaration_in_macro_statement2166 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_list_in_macro_statement2170 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_macro_statement2173 = frozenset([63]) - FOLLOW_63_in_macro_statement2176 = frozenset([1]) - FOLLOW_IDENTIFIER_in_labeled_statement2188 = frozenset([47]) - FOLLOW_47_in_labeled_statement2190 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_labeled_statement2192 = frozenset([1]) - FOLLOW_106_in_labeled_statement2197 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_labeled_statement2199 = frozenset([47]) - FOLLOW_47_in_labeled_statement2201 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_labeled_statement2203 = frozenset([1]) - FOLLOW_107_in_labeled_statement2208 = frozenset([47]) - FOLLOW_47_in_labeled_statement2210 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_labeled_statement2212 = frozenset([1]) - FOLLOW_43_in_compound_statement2223 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_declaration_in_compound_statement2225 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_list_in_compound_statement2228 = frozenset([44]) - FOLLOW_44_in_compound_statement2231 = frozenset([1]) - FOLLOW_statement_in_statement_list2242 = frozenset([1, 4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_25_in_expression_statement2254 = frozenset([1]) - FOLLOW_expression_in_expression_statement2259 = frozenset([25]) - FOLLOW_25_in_expression_statement2261 = frozenset([1]) - FOLLOW_108_in_selection_statement2272 = frozenset([62]) - FOLLOW_62_in_selection_statement2274 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_selection_statement2278 = frozenset([63]) - FOLLOW_63_in_selection_statement2280 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_selection_statement2284 = frozenset([1, 109]) - FOLLOW_109_in_selection_statement2299 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_selection_statement2301 = frozenset([1]) - FOLLOW_110_in_selection_statement2308 = frozenset([62]) - FOLLOW_62_in_selection_statement2310 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_selection_statement2312 = frozenset([63]) - FOLLOW_63_in_selection_statement2314 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_selection_statement2316 = frozenset([1]) - FOLLOW_111_in_iteration_statement2327 = frozenset([62]) - FOLLOW_62_in_iteration_statement2329 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_iteration_statement2333 = frozenset([63]) - FOLLOW_63_in_iteration_statement2335 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_iteration_statement2337 = frozenset([1]) - FOLLOW_112_in_iteration_statement2344 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_iteration_statement2346 = frozenset([111]) - FOLLOW_111_in_iteration_statement2348 = frozenset([62]) - FOLLOW_62_in_iteration_statement2350 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_iteration_statement2354 = frozenset([63]) - FOLLOW_63_in_iteration_statement2356 = frozenset([25]) - FOLLOW_25_in_iteration_statement2358 = frozenset([1]) - FOLLOW_113_in_iteration_statement2365 = frozenset([62]) - FOLLOW_62_in_iteration_statement2367 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_statement_in_iteration_statement2369 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_statement_in_iteration_statement2373 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_iteration_statement2375 = frozenset([63]) - FOLLOW_63_in_iteration_statement2378 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_iteration_statement2380 = frozenset([1]) - FOLLOW_114_in_jump_statement2393 = frozenset([4]) - FOLLOW_IDENTIFIER_in_jump_statement2395 = frozenset([25]) - FOLLOW_25_in_jump_statement2397 = frozenset([1]) - FOLLOW_115_in_jump_statement2402 = frozenset([25]) - FOLLOW_25_in_jump_statement2404 = frozenset([1]) - FOLLOW_116_in_jump_statement2409 = frozenset([25]) - FOLLOW_25_in_jump_statement2411 = frozenset([1]) - FOLLOW_117_in_jump_statement2416 = frozenset([25]) - FOLLOW_25_in_jump_statement2418 = frozenset([1]) - FOLLOW_117_in_jump_statement2423 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_jump_statement2425 = frozenset([25]) - FOLLOW_25_in_jump_statement2427 = frozenset([1]) - FOLLOW_declaration_specifiers_in_synpred2100 = frozenset([1]) - FOLLOW_declaration_specifiers_in_synpred4100 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_declarator_in_synpred4103 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_declaration_in_synpred4105 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_43_in_synpred4108 = frozenset([1]) - FOLLOW_declaration_in_synpred5118 = frozenset([1]) - FOLLOW_declaration_specifiers_in_synpred7157 = frozenset([1]) - FOLLOW_declaration_specifiers_in_synpred10207 = frozenset([1]) - FOLLOW_type_specifier_in_synpred14272 = frozenset([1]) - FOLLOW_type_qualifier_in_synpred15286 = frozenset([1]) - FOLLOW_type_qualifier_in_synpred33444 = frozenset([1]) - FOLLOW_IDENTIFIER_in_synpred34442 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) - FOLLOW_type_qualifier_in_synpred34444 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) - FOLLOW_declarator_in_synpred34447 = frozenset([1]) - FOLLOW_type_qualifier_in_synpred39566 = frozenset([1]) - FOLLOW_type_specifier_in_synpred40570 = frozenset([1]) - FOLLOW_pointer_in_synpred66784 = frozenset([4, 58, 59, 60, 62]) - FOLLOW_58_in_synpred66788 = frozenset([4, 59, 60, 62]) - FOLLOW_59_in_synpred66793 = frozenset([4, 60, 62]) - FOLLOW_60_in_synpred66798 = frozenset([4, 62]) - FOLLOW_direct_declarator_in_synpred66802 = frozenset([1]) - FOLLOW_declarator_suffix_in_synpred67821 = frozenset([1]) - FOLLOW_58_in_synpred69830 = frozenset([1]) - FOLLOW_declarator_suffix_in_synpred70838 = frozenset([1]) - FOLLOW_62_in_synpred73878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_type_list_in_synpred73880 = frozenset([63]) - FOLLOW_63_in_synpred73882 = frozenset([1]) - FOLLOW_62_in_synpred74892 = frozenset([4]) - FOLLOW_identifier_list_in_synpred74894 = frozenset([63]) - FOLLOW_63_in_synpred74896 = frozenset([1]) - FOLLOW_type_qualifier_in_synpred75921 = frozenset([1]) - FOLLOW_pointer_in_synpred76924 = frozenset([1]) - FOLLOW_66_in_synpred77919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_qualifier_in_synpred77921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_pointer_in_synpred77924 = frozenset([1]) - FOLLOW_66_in_synpred78930 = frozenset([66]) - FOLLOW_pointer_in_synpred78932 = frozenset([1]) - FOLLOW_53_in_synpred81977 = frozenset([1]) - FOLLOW_27_in_synpred82974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_53_in_synpred82977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_declaration_in_synpred82981 = frozenset([1]) - FOLLOW_declarator_in_synpred83997 = frozenset([1]) - FOLLOW_abstract_declarator_in_synpred84999 = frozenset([1]) - FOLLOW_declaration_specifiers_in_synpred86994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_declarator_in_synpred86997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_abstract_declarator_in_synpred86999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_53_in_synpred861004 = frozenset([1]) - FOLLOW_specifier_qualifier_list_in_synpred901046 = frozenset([1, 62, 64, 66]) - FOLLOW_abstract_declarator_in_synpred901048 = frozenset([1]) - FOLLOW_direct_abstract_declarator_in_synpred911067 = frozenset([1]) - FOLLOW_62_in_synpred931086 = frozenset([62, 64, 66]) - FOLLOW_abstract_declarator_in_synpred931088 = frozenset([63]) - FOLLOW_63_in_synpred931090 = frozenset([1]) - FOLLOW_abstract_declarator_suffix_in_synpred941098 = frozenset([1]) - FOLLOW_62_in_synpred1091282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_name_in_synpred1091284 = frozenset([63]) - FOLLOW_63_in_synpred1091286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_synpred1091288 = frozenset([1]) - FOLLOW_74_in_synpred1141330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_unary_expression_in_synpred1141332 = frozenset([1]) - FOLLOW_62_in_synpred1171420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_argument_expression_list_in_synpred1171424 = frozenset([63]) - FOLLOW_63_in_synpred1171428 = frozenset([1]) - FOLLOW_62_in_synpred1181444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_macro_parameter_list_in_synpred1181446 = frozenset([63]) - FOLLOW_63_in_synpred1181448 = frozenset([1]) - FOLLOW_66_in_synpred1201482 = frozenset([4]) - FOLLOW_IDENTIFIER_in_synpred1201486 = frozenset([1]) - FOLLOW_STRING_LITERAL_in_synpred1371683 = frozenset([1]) - FOLLOW_IDENTIFIER_in_synpred1381680 = frozenset([4, 9]) - FOLLOW_STRING_LITERAL_in_synpred1381683 = frozenset([1, 9]) - FOLLOW_lvalue_in_synpred1421744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]) - FOLLOW_assignment_operator_in_synpred1421746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_assignment_expression_in_synpred1421748 = frozenset([1]) - FOLLOW_expression_statement_in_synpred1692035 = frozenset([1]) - FOLLOW_macro_statement_in_synpred1732055 = frozenset([1]) - FOLLOW_asm2_statement_in_synpred1742060 = frozenset([1]) - FOLLOW_declaration_in_synpred1812166 = frozenset([1]) - FOLLOW_statement_list_in_synpred1822170 = frozenset([1]) - FOLLOW_declaration_in_synpred1862225 = frozenset([1]) - FOLLOW_statement_in_synpred1882242 = frozenset([1]) - + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 4, declaration_StartIndex) + + pass + + return + + # $ANTLR end declaration + + class declaration_specifiers_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start declaration_specifiers + # C.g:182:1: declaration_specifiers : ( storage_class_specifier | type_specifier | type_qualifier )+ ; + def declaration_specifiers(self, ): + + retval = self.declaration_specifiers_return() + retval.start = self.input.LT(1) + declaration_specifiers_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 5): + return retval + + # C.g:183:2: ( ( storage_class_specifier | type_specifier | type_qualifier )+ ) + # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+ + # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+ + cnt10 = 0 + while True: #loop10 + alt10 = 4 + LA10 = self.input.LA(1) + if LA10 == 58: + LA10_2 = self.input.LA(2) + + if (self.synpred15()) : + alt10 = 3 + + + elif LA10 == 59: + LA10_3 = self.input.LA(2) + + if (self.synpred15()) : + alt10 = 3 + + + elif LA10 == 60: + LA10_4 = self.input.LA(2) + + if (self.synpred15()) : + alt10 = 3 + + + elif LA10 == IDENTIFIER: + LA10_5 = self.input.LA(2) + + if (self.synpred14()) : + alt10 = 2 + + + elif LA10 == 53: + LA10_9 = self.input.LA(2) + + if (self.synpred15()) : + alt10 = 3 + + + elif LA10 == 29 or LA10 == 30 or LA10 == 31 or LA10 == 32 or LA10 == 33: + alt10 = 1 + elif LA10 == 34 or LA10 == 35 or LA10 == 36 or LA10 == 37 or LA10 == 38 or LA10 == 39 or LA10 == 40 or LA10 == 41 or LA10 == 42 or LA10 == 45 or LA10 == 46 or LA10 == 48: + alt10 = 2 + elif LA10 == 49 or LA10 == 50 or LA10 == 51 or LA10 == 52 or LA10 == 54 or LA10 == 55 or LA10 == 56 or LA10 == 57 or LA10 == 61: + alt10 = 3 + + if alt10 == 1: + # C.g:183:10: storage_class_specifier + self.following.append(self.FOLLOW_storage_class_specifier_in_declaration_specifiers264) + self.storage_class_specifier() + self.following.pop() + if self.failed: + return retval + + + elif alt10 == 2: + # C.g:184:7: type_specifier + self.following.append(self.FOLLOW_type_specifier_in_declaration_specifiers272) + self.type_specifier() + self.following.pop() + if self.failed: + return retval + + + elif alt10 == 3: + # C.g:185:13: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_declaration_specifiers286) + self.type_qualifier() + self.following.pop() + if self.failed: + return retval + + + else: + if cnt10 >= 1: + break #loop10 + + if self.backtracking > 0: + self.failed = True + return retval + + eee = EarlyExitException(10, self.input) + raise eee + + cnt10 += 1 + + + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 5, declaration_specifiers_StartIndex) + + pass + + return retval + + # $ANTLR end declaration_specifiers + + class init_declarator_list_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start init_declarator_list + # C.g:189:1: init_declarator_list : init_declarator ( ',' init_declarator )* ; + def init_declarator_list(self, ): + + retval = self.init_declarator_list_return() + retval.start = self.input.LT(1) + init_declarator_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 6): + return retval + + # C.g:190:2: ( init_declarator ( ',' init_declarator )* ) + # C.g:190:4: init_declarator ( ',' init_declarator )* + self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list308) + self.init_declarator() + self.following.pop() + if self.failed: + return retval + # C.g:190:20: ( ',' init_declarator )* + while True: #loop11 + alt11 = 2 + LA11_0 = self.input.LA(1) + + if (LA11_0 == 27) : + alt11 = 1 + + + if alt11 == 1: + # C.g:190:21: ',' init_declarator + self.match(self.input, 27, self.FOLLOW_27_in_init_declarator_list311) + if self.failed: + return retval + self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list313) + self.init_declarator() + self.following.pop() + if self.failed: + return retval + + + else: + break #loop11 + + + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 6, init_declarator_list_StartIndex) + + pass + + return retval + + # $ANTLR end init_declarator_list + + + # $ANTLR start init_declarator + # C.g:193:1: init_declarator : declarator ( '=' initializer )? ; + def init_declarator(self, ): + + init_declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 7): + return + + # C.g:194:2: ( declarator ( '=' initializer )? ) + # C.g:194:4: declarator ( '=' initializer )? + self.following.append(self.FOLLOW_declarator_in_init_declarator326) + self.declarator() + self.following.pop() + if self.failed: + return + # C.g:194:15: ( '=' initializer )? + alt12 = 2 + LA12_0 = self.input.LA(1) + + if (LA12_0 == 28) : + alt12 = 1 + if alt12 == 1: + # C.g:194:16: '=' initializer + self.match(self.input, 28, self.FOLLOW_28_in_init_declarator329) + if self.failed: + return + self.following.append(self.FOLLOW_initializer_in_init_declarator331) + self.initializer() + self.following.pop() + if self.failed: + return + + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 7, init_declarator_StartIndex) + + pass + + return + + # $ANTLR end init_declarator + + + # $ANTLR start storage_class_specifier + # C.g:197:1: storage_class_specifier : ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' ); + def storage_class_specifier(self, ): + + storage_class_specifier_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 8): + return + + # C.g:198:2: ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' ) + # C.g: + if (29 <= self.input.LA(1) <= 33): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_storage_class_specifier0 + ) + raise mse + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 8, storage_class_specifier_StartIndex) + + pass + + return + + # $ANTLR end storage_class_specifier + + + # $ANTLR start type_specifier + # C.g:205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id ); + def type_specifier(self, ): + + type_specifier_StartIndex = self.input.index() + s = None + + e = None + + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 9): + return + + # C.g:206:2: ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id ) + alt13 = 12 + LA13_0 = self.input.LA(1) + + if (LA13_0 == 34) : + alt13 = 1 + elif (LA13_0 == 35) : + alt13 = 2 + elif (LA13_0 == 36) : + alt13 = 3 + elif (LA13_0 == 37) : + alt13 = 4 + elif (LA13_0 == 38) : + alt13 = 5 + elif (LA13_0 == 39) : + alt13 = 6 + elif (LA13_0 == 40) : + alt13 = 7 + elif (LA13_0 == 41) : + alt13 = 8 + elif (LA13_0 == 42) : + alt13 = 9 + elif ((45 <= LA13_0 <= 46)) : + alt13 = 10 + elif (LA13_0 == 48) : + alt13 = 11 + elif (LA13_0 == IDENTIFIER) and (self.synpred34()): + alt13 = 12 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id );", 13, 0, self.input) + + raise nvae + + if alt13 == 1: + # C.g:206:4: 'void' + self.match(self.input, 34, self.FOLLOW_34_in_type_specifier376) + if self.failed: + return + + + elif alt13 == 2: + # C.g:207:4: 'char' + self.match(self.input, 35, self.FOLLOW_35_in_type_specifier381) + if self.failed: + return + + + elif alt13 == 3: + # C.g:208:4: 'short' + self.match(self.input, 36, self.FOLLOW_36_in_type_specifier386) + if self.failed: + return + + + elif alt13 == 4: + # C.g:209:4: 'int' + self.match(self.input, 37, self.FOLLOW_37_in_type_specifier391) + if self.failed: + return + + + elif alt13 == 5: + # C.g:210:4: 'long' + self.match(self.input, 38, self.FOLLOW_38_in_type_specifier396) + if self.failed: + return + + + elif alt13 == 6: + # C.g:211:4: 'float' + self.match(self.input, 39, self.FOLLOW_39_in_type_specifier401) + if self.failed: + return + + + elif alt13 == 7: + # C.g:212:4: 'double' + self.match(self.input, 40, self.FOLLOW_40_in_type_specifier406) + if self.failed: + return + + + elif alt13 == 8: + # C.g:213:4: 'signed' + self.match(self.input, 41, self.FOLLOW_41_in_type_specifier411) + if self.failed: + return + + + elif alt13 == 9: + # C.g:214:4: 'unsigned' + self.match(self.input, 42, self.FOLLOW_42_in_type_specifier416) + if self.failed: + return + + + elif alt13 == 10: + # C.g:215:4: s= struct_or_union_specifier + self.following.append(self.FOLLOW_struct_or_union_specifier_in_type_specifier423) + s = self.struct_or_union_specifier() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + + if s.stop != None: + self.StoreStructUnionDefinition(s.start.line, s.start.charPositionInLine, s.stop.line, s.stop.charPositionInLine, self.input.toString(s.start,s.stop)) + + + + + elif alt13 == 11: + # C.g:220:4: e= enum_specifier + self.following.append(self.FOLLOW_enum_specifier_in_type_specifier433) + e = self.enum_specifier() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + + if e.stop != None: + self.StoreEnumerationDefinition(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + + + + elif alt13 == 12: + # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator )=> type_id + self.following.append(self.FOLLOW_type_id_in_type_specifier451) + self.type_id() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 9, type_specifier_StartIndex) + + pass + + return + + # $ANTLR end type_specifier + + + # $ANTLR start type_id + # C.g:228:1: type_id : IDENTIFIER ; + def type_id(self, ): + + type_id_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 10): + return + + # C.g:229:5: ( IDENTIFIER ) + # C.g:229:9: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_type_id467) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 10, type_id_StartIndex) + + pass + + return + + # $ANTLR end type_id + + class struct_or_union_specifier_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start struct_or_union_specifier + # C.g:233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER ); + def struct_or_union_specifier(self, ): + + retval = self.struct_or_union_specifier_return() + retval.start = self.input.LT(1) + struct_or_union_specifier_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 11): + return retval + + # C.g:235:2: ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER ) + alt15 = 2 + LA15_0 = self.input.LA(1) + + if ((45 <= LA15_0 <= 46)) : + LA15_1 = self.input.LA(2) + + if (LA15_1 == IDENTIFIER) : + LA15_2 = self.input.LA(3) + + if (LA15_2 == 43) : + alt15 = 1 + elif (LA15_2 == EOF or LA15_2 == IDENTIFIER or LA15_2 == 25 or LA15_2 == 27 or (29 <= LA15_2 <= 42) or (45 <= LA15_2 <= 64) or LA15_2 == 66) : + alt15 = 2 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 2, self.input) + + raise nvae + + elif (LA15_1 == 43) : + alt15 = 1 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 1, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 0, self.input) + + raise nvae + + if alt15 == 1: + # C.g:235:4: struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' + self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier494) + self.struct_or_union() + self.following.pop() + if self.failed: + return retval + # C.g:235:20: ( IDENTIFIER )? + alt14 = 2 + LA14_0 = self.input.LA(1) + + if (LA14_0 == IDENTIFIER) : + alt14 = 1 + if alt14 == 1: + # C.g:0:0: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier496) + if self.failed: + return retval + + + + self.match(self.input, 43, self.FOLLOW_43_in_struct_or_union_specifier499) + if self.failed: + return retval + self.following.append(self.FOLLOW_struct_declaration_list_in_struct_or_union_specifier501) + self.struct_declaration_list() + self.following.pop() + if self.failed: + return retval + self.match(self.input, 44, self.FOLLOW_44_in_struct_or_union_specifier503) + if self.failed: + return retval + + + elif alt15 == 2: + # C.g:236:4: struct_or_union IDENTIFIER + self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier508) + self.struct_or_union() + self.following.pop() + if self.failed: + return retval + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier510) + if self.failed: + return retval + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 11, struct_or_union_specifier_StartIndex) + + pass + + return retval + + # $ANTLR end struct_or_union_specifier + + + # $ANTLR start struct_or_union + # C.g:239:1: struct_or_union : ( 'struct' | 'union' ); + def struct_or_union(self, ): + + struct_or_union_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 12): + return + + # C.g:240:2: ( 'struct' | 'union' ) + # C.g: + if (45 <= self.input.LA(1) <= 46): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_struct_or_union0 + ) + raise mse + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 12, struct_or_union_StartIndex) + + pass + + return + + # $ANTLR end struct_or_union + + + # $ANTLR start struct_declaration_list + # C.g:244:1: struct_declaration_list : ( struct_declaration )+ ; + def struct_declaration_list(self, ): + + struct_declaration_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 13): + return + + # C.g:245:2: ( ( struct_declaration )+ ) + # C.g:245:4: ( struct_declaration )+ + # C.g:245:4: ( struct_declaration )+ + cnt16 = 0 + while True: #loop16 + alt16 = 2 + LA16_0 = self.input.LA(1) + + if (LA16_0 == IDENTIFIER or (34 <= LA16_0 <= 42) or (45 <= LA16_0 <= 46) or (48 <= LA16_0 <= 61)) : + alt16 = 1 + + + if alt16 == 1: + # C.g:0:0: struct_declaration + self.following.append(self.FOLLOW_struct_declaration_in_struct_declaration_list537) + self.struct_declaration() + self.following.pop() + if self.failed: + return + + + else: + if cnt16 >= 1: + break #loop16 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(16, self.input) + raise eee + + cnt16 += 1 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 13, struct_declaration_list_StartIndex) + + pass + + return + + # $ANTLR end struct_declaration_list + + + # $ANTLR start struct_declaration + # C.g:248:1: struct_declaration : specifier_qualifier_list struct_declarator_list ';' ; + def struct_declaration(self, ): + + struct_declaration_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 14): + return + + # C.g:249:2: ( specifier_qualifier_list struct_declarator_list ';' ) + # C.g:249:4: specifier_qualifier_list struct_declarator_list ';' + self.following.append(self.FOLLOW_specifier_qualifier_list_in_struct_declaration549) + self.specifier_qualifier_list() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_struct_declarator_list_in_struct_declaration551) + self.struct_declarator_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_struct_declaration553) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 14, struct_declaration_StartIndex) + + pass + + return + + # $ANTLR end struct_declaration + + + # $ANTLR start specifier_qualifier_list + # C.g:252:1: specifier_qualifier_list : ( type_qualifier | type_specifier )+ ; + def specifier_qualifier_list(self, ): + + specifier_qualifier_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 15): + return + + # C.g:253:2: ( ( type_qualifier | type_specifier )+ ) + # C.g:253:4: ( type_qualifier | type_specifier )+ + # C.g:253:4: ( type_qualifier | type_specifier )+ + cnt17 = 0 + while True: #loop17 + alt17 = 3 + LA17 = self.input.LA(1) + if LA17 == 58: + LA17_2 = self.input.LA(2) + + if (self.synpred39()) : + alt17 = 1 + + + elif LA17 == 59: + LA17_3 = self.input.LA(2) + + if (self.synpred39()) : + alt17 = 1 + + + elif LA17 == 60: + LA17_4 = self.input.LA(2) + + if (self.synpred39()) : + alt17 = 1 + + + elif LA17 == IDENTIFIER: + LA17 = self.input.LA(2) + if LA17 == EOF or LA17 == IDENTIFIER or LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48 or LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 58 or LA17 == 59 or LA17 == 60 or LA17 == 61 or LA17 == 63 or LA17 == 66: + alt17 = 2 + elif LA17 == 62: + LA17_94 = self.input.LA(3) + + if (self.synpred40()) : + alt17 = 2 + + + elif LA17 == 47: + LA17_95 = self.input.LA(3) + + if (self.synpred40()) : + alt17 = 2 + + + elif LA17 == 64: + LA17_96 = self.input.LA(3) + + if (self.synpred40()) : + alt17 = 2 + + + + elif LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 61: + alt17 = 1 + elif LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48: + alt17 = 2 + + if alt17 == 1: + # C.g:253:6: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_specifier_qualifier_list566) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + elif alt17 == 2: + # C.g:253:23: type_specifier + self.following.append(self.FOLLOW_type_specifier_in_specifier_qualifier_list570) + self.type_specifier() + self.following.pop() + if self.failed: + return + + + else: + if cnt17 >= 1: + break #loop17 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(17, self.input) + raise eee + + cnt17 += 1 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 15, specifier_qualifier_list_StartIndex) + + pass + + return + + # $ANTLR end specifier_qualifier_list + + + # $ANTLR start struct_declarator_list + # C.g:256:1: struct_declarator_list : struct_declarator ( ',' struct_declarator )* ; + def struct_declarator_list(self, ): + + struct_declarator_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 16): + return + + # C.g:257:2: ( struct_declarator ( ',' struct_declarator )* ) + # C.g:257:4: struct_declarator ( ',' struct_declarator )* + self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list584) + self.struct_declarator() + self.following.pop() + if self.failed: + return + # C.g:257:22: ( ',' struct_declarator )* + while True: #loop18 + alt18 = 2 + LA18_0 = self.input.LA(1) + + if (LA18_0 == 27) : + alt18 = 1 + + + if alt18 == 1: + # C.g:257:23: ',' struct_declarator + self.match(self.input, 27, self.FOLLOW_27_in_struct_declarator_list587) + if self.failed: + return + self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list589) + self.struct_declarator() + self.following.pop() + if self.failed: + return + + + else: + break #loop18 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 16, struct_declarator_list_StartIndex) + + pass + + return + + # $ANTLR end struct_declarator_list + + + # $ANTLR start struct_declarator + # C.g:260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression ); + def struct_declarator(self, ): + + struct_declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 17): + return + + # C.g:261:2: ( declarator ( ':' constant_expression )? | ':' constant_expression ) + alt20 = 2 + LA20_0 = self.input.LA(1) + + if (LA20_0 == IDENTIFIER or (58 <= LA20_0 <= 60) or LA20_0 == 62 or LA20_0 == 66) : + alt20 = 1 + elif (LA20_0 == 47) : + alt20 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression );", 20, 0, self.input) + + raise nvae + + if alt20 == 1: + # C.g:261:4: declarator ( ':' constant_expression )? + self.following.append(self.FOLLOW_declarator_in_struct_declarator602) + self.declarator() + self.following.pop() + if self.failed: + return + # C.g:261:15: ( ':' constant_expression )? + alt19 = 2 + LA19_0 = self.input.LA(1) + + if (LA19_0 == 47) : + alt19 = 1 + if alt19 == 1: + # C.g:261:16: ':' constant_expression + self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator605) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_struct_declarator607) + self.constant_expression() + self.following.pop() + if self.failed: + return + + + + + + elif alt20 == 2: + # C.g:262:4: ':' constant_expression + self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator614) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_struct_declarator616) + self.constant_expression() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 17, struct_declarator_StartIndex) + + pass + + return + + # $ANTLR end struct_declarator + + class enum_specifier_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start enum_specifier + # C.g:265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER ); + def enum_specifier(self, ): + + retval = self.enum_specifier_return() + retval.start = self.input.LT(1) + enum_specifier_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 18): + return retval + + # C.g:267:2: ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER ) + alt23 = 3 + LA23_0 = self.input.LA(1) + + if (LA23_0 == 48) : + LA23_1 = self.input.LA(2) + + if (LA23_1 == IDENTIFIER) : + LA23_2 = self.input.LA(3) + + if (LA23_2 == 43) : + alt23 = 2 + elif (LA23_2 == EOF or LA23_2 == IDENTIFIER or LA23_2 == 25 or LA23_2 == 27 or (29 <= LA23_2 <= 42) or (45 <= LA23_2 <= 64) or LA23_2 == 66) : + alt23 = 3 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 2, self.input) + + raise nvae + + elif (LA23_1 == 43) : + alt23 = 1 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 1, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 0, self.input) + + raise nvae + + if alt23 == 1: + # C.g:267:4: 'enum' '{' enumerator_list ( ',' )? '}' + self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier634) + if self.failed: + return retval + self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier636) + if self.failed: + return retval + self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier638) + self.enumerator_list() + self.following.pop() + if self.failed: + return retval + # C.g:267:31: ( ',' )? + alt21 = 2 + LA21_0 = self.input.LA(1) + + if (LA21_0 == 27) : + alt21 = 1 + if alt21 == 1: + # C.g:0:0: ',' + self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier640) + if self.failed: + return retval + + + + self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier643) + if self.failed: + return retval + + + elif alt23 == 2: + # C.g:268:4: 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' + self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier648) + if self.failed: + return retval + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier650) + if self.failed: + return retval + self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier652) + if self.failed: + return retval + self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier654) + self.enumerator_list() + self.following.pop() + if self.failed: + return retval + # C.g:268:42: ( ',' )? + alt22 = 2 + LA22_0 = self.input.LA(1) + + if (LA22_0 == 27) : + alt22 = 1 + if alt22 == 1: + # C.g:0:0: ',' + self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier656) + if self.failed: + return retval + + + + self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier659) + if self.failed: + return retval + + + elif alt23 == 3: + # C.g:269:4: 'enum' IDENTIFIER + self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier664) + if self.failed: + return retval + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier666) + if self.failed: + return retval + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 18, enum_specifier_StartIndex) + + pass + + return retval + + # $ANTLR end enum_specifier + + + # $ANTLR start enumerator_list + # C.g:272:1: enumerator_list : enumerator ( ',' enumerator )* ; + def enumerator_list(self, ): + + enumerator_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 19): + return + + # C.g:273:2: ( enumerator ( ',' enumerator )* ) + # C.g:273:4: enumerator ( ',' enumerator )* + self.following.append(self.FOLLOW_enumerator_in_enumerator_list677) + self.enumerator() + self.following.pop() + if self.failed: + return + # C.g:273:15: ( ',' enumerator )* + while True: #loop24 + alt24 = 2 + LA24_0 = self.input.LA(1) + + if (LA24_0 == 27) : + LA24_1 = self.input.LA(2) + + if (LA24_1 == IDENTIFIER) : + alt24 = 1 + + + + + if alt24 == 1: + # C.g:273:16: ',' enumerator + self.match(self.input, 27, self.FOLLOW_27_in_enumerator_list680) + if self.failed: + return + self.following.append(self.FOLLOW_enumerator_in_enumerator_list682) + self.enumerator() + self.following.pop() + if self.failed: + return + + + else: + break #loop24 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 19, enumerator_list_StartIndex) + + pass + + return + + # $ANTLR end enumerator_list + + + # $ANTLR start enumerator + # C.g:276:1: enumerator : IDENTIFIER ( '=' constant_expression )? ; + def enumerator(self, ): + + enumerator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 20): + return + + # C.g:277:2: ( IDENTIFIER ( '=' constant_expression )? ) + # C.g:277:4: IDENTIFIER ( '=' constant_expression )? + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enumerator695) + if self.failed: + return + # C.g:277:15: ( '=' constant_expression )? + alt25 = 2 + LA25_0 = self.input.LA(1) + + if (LA25_0 == 28) : + alt25 = 1 + if alt25 == 1: + # C.g:277:16: '=' constant_expression + self.match(self.input, 28, self.FOLLOW_28_in_enumerator698) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_enumerator700) + self.constant_expression() + self.following.pop() + if self.failed: + return + + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 20, enumerator_StartIndex) + + pass + + return + + # $ANTLR end enumerator + + + # $ANTLR start type_qualifier + # C.g:280:1: type_qualifier : ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' ); + def type_qualifier(self, ): + + type_qualifier_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 21): + return + + # C.g:281:2: ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' ) + # C.g: + if (49 <= self.input.LA(1) <= 61): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_type_qualifier0 + ) + raise mse + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 21, type_qualifier_StartIndex) + + pass + + return + + # $ANTLR end type_qualifier + + class declarator_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start declarator + # C.g:296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer ); + def declarator(self, ): + + retval = self.declarator_return() + retval.start = self.input.LT(1) + declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 22): + return retval + + # C.g:297:2: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer ) + alt30 = 2 + LA30_0 = self.input.LA(1) + + if (LA30_0 == 66) : + LA30_1 = self.input.LA(2) + + if (self.synpred66()) : + alt30 = 1 + elif (True) : + alt30 = 2 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 1, self.input) + + raise nvae + + elif (LA30_0 == IDENTIFIER or (58 <= LA30_0 <= 60) or LA30_0 == 62) : + alt30 = 1 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 0, self.input) + + raise nvae + + if alt30 == 1: + # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator + # C.g:297:4: ( pointer )? + alt26 = 2 + LA26_0 = self.input.LA(1) + + if (LA26_0 == 66) : + alt26 = 1 + if alt26 == 1: + # C.g:0:0: pointer + self.following.append(self.FOLLOW_pointer_in_declarator784) + self.pointer() + self.following.pop() + if self.failed: + return retval + + + + # C.g:297:13: ( 'EFIAPI' )? + alt27 = 2 + LA27_0 = self.input.LA(1) + + if (LA27_0 == 58) : + alt27 = 1 + if alt27 == 1: + # C.g:297:14: 'EFIAPI' + self.match(self.input, 58, self.FOLLOW_58_in_declarator788) + if self.failed: + return retval + + + + # C.g:297:25: ( 'EFI_BOOTSERVICE' )? + alt28 = 2 + LA28_0 = self.input.LA(1) + + if (LA28_0 == 59) : + alt28 = 1 + if alt28 == 1: + # C.g:297:26: 'EFI_BOOTSERVICE' + self.match(self.input, 59, self.FOLLOW_59_in_declarator793) + if self.failed: + return retval + + + + # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )? + alt29 = 2 + LA29_0 = self.input.LA(1) + + if (LA29_0 == 60) : + alt29 = 1 + if alt29 == 1: + # C.g:297:47: 'EFI_RUNTIMESERVICE' + self.match(self.input, 60, self.FOLLOW_60_in_declarator798) + if self.failed: + return retval + + + + self.following.append(self.FOLLOW_direct_declarator_in_declarator802) + self.direct_declarator() + self.following.pop() + if self.failed: + return retval + + + elif alt30 == 2: + # C.g:299:4: pointer + self.following.append(self.FOLLOW_pointer_in_declarator808) + self.pointer() + self.following.pop() + if self.failed: + return retval + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 22, declarator_StartIndex) + + pass + + return retval + + # $ANTLR end declarator + + + # $ANTLR start direct_declarator + # C.g:302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ ); + def direct_declarator(self, ): + + direct_declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 23): + return + + # C.g:303:2: ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ ) + alt34 = 2 + LA34_0 = self.input.LA(1) + + if (LA34_0 == IDENTIFIER) : + alt34 = 1 + elif (LA34_0 == 62) : + alt34 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ );", 34, 0, self.input) + + raise nvae + + if alt34 == 1: + # C.g:303:4: IDENTIFIER ( declarator_suffix )* + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_direct_declarator819) + if self.failed: + return + # C.g:303:15: ( declarator_suffix )* + while True: #loop31 + alt31 = 2 + LA31_0 = self.input.LA(1) + + if (LA31_0 == 62) : + LA31 = self.input.LA(2) + if LA31 == 63: + LA31_30 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 58: + LA31_31 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 66: + LA31_32 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 59: + LA31_33 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 60: + LA31_34 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == IDENTIFIER: + LA31_35 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 29 or LA31 == 30 or LA31 == 31 or LA31 == 32 or LA31 == 33: + LA31_37 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 34: + LA31_38 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 35: + LA31_39 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 36: + LA31_40 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 37: + LA31_41 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 38: + LA31_42 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 39: + LA31_43 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 40: + LA31_44 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 41: + LA31_45 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 42: + LA31_46 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 45 or LA31 == 46: + LA31_47 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 48: + LA31_48 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 49 or LA31 == 50 or LA31 == 51 or LA31 == 52 or LA31 == 53 or LA31 == 54 or LA31 == 55 or LA31 == 56 or LA31 == 57 or LA31 == 61: + LA31_49 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + + elif (LA31_0 == 64) : + LA31 = self.input.LA(2) + if LA31 == 65: + LA31_51 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 62: + LA31_52 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == IDENTIFIER: + LA31_53 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == HEX_LITERAL: + LA31_54 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == OCTAL_LITERAL: + LA31_55 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == DECIMAL_LITERAL: + LA31_56 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == CHARACTER_LITERAL: + LA31_57 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == STRING_LITERAL: + LA31_58 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == FLOATING_POINT_LITERAL: + LA31_59 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 72: + LA31_60 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 73: + LA31_61 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 66 or LA31 == 68 or LA31 == 69 or LA31 == 77 or LA31 == 78 or LA31 == 79: + LA31_62 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 74: + LA31_63 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + + + + if alt31 == 1: + # C.g:0:0: declarator_suffix + self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator821) + self.declarator_suffix() + self.following.pop() + if self.failed: + return + + + else: + break #loop31 + + + + + elif alt34 == 2: + # C.g:304:4: '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ + self.match(self.input, 62, self.FOLLOW_62_in_direct_declarator827) + if self.failed: + return + # C.g:304:8: ( 'EFIAPI' )? + alt32 = 2 + LA32_0 = self.input.LA(1) + + if (LA32_0 == 58) : + LA32_1 = self.input.LA(2) + + if (self.synpred69()) : + alt32 = 1 + if alt32 == 1: + # C.g:304:9: 'EFIAPI' + self.match(self.input, 58, self.FOLLOW_58_in_direct_declarator830) + if self.failed: + return + + + + self.following.append(self.FOLLOW_declarator_in_direct_declarator834) + self.declarator() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_direct_declarator836) + if self.failed: + return + # C.g:304:35: ( declarator_suffix )+ + cnt33 = 0 + while True: #loop33 + alt33 = 2 + LA33_0 = self.input.LA(1) + + if (LA33_0 == 62) : + LA33 = self.input.LA(2) + if LA33 == 63: + LA33_30 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 58: + LA33_31 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 66: + LA33_32 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 59: + LA33_33 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 60: + LA33_34 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == IDENTIFIER: + LA33_35 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 29 or LA33 == 30 or LA33 == 31 or LA33 == 32 or LA33 == 33: + LA33_37 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 34: + LA33_38 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 35: + LA33_39 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 36: + LA33_40 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 37: + LA33_41 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 38: + LA33_42 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 39: + LA33_43 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 40: + LA33_44 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 41: + LA33_45 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 42: + LA33_46 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 45 or LA33 == 46: + LA33_47 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 48: + LA33_48 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 49 or LA33 == 50 or LA33 == 51 or LA33 == 52 or LA33 == 53 or LA33 == 54 or LA33 == 55 or LA33 == 56 or LA33 == 57 or LA33 == 61: + LA33_49 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + + elif (LA33_0 == 64) : + LA33 = self.input.LA(2) + if LA33 == 65: + LA33_51 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 62: + LA33_52 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == IDENTIFIER: + LA33_53 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == HEX_LITERAL: + LA33_54 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == OCTAL_LITERAL: + LA33_55 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == DECIMAL_LITERAL: + LA33_56 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == CHARACTER_LITERAL: + LA33_57 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == STRING_LITERAL: + LA33_58 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == FLOATING_POINT_LITERAL: + LA33_59 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 72: + LA33_60 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 73: + LA33_61 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 66 or LA33 == 68 or LA33 == 69 or LA33 == 77 or LA33 == 78 or LA33 == 79: + LA33_62 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 74: + LA33_63 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + + + + if alt33 == 1: + # C.g:0:0: declarator_suffix + self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator838) + self.declarator_suffix() + self.following.pop() + if self.failed: + return + + + else: + if cnt33 >= 1: + break #loop33 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(33, self.input) + raise eee + + cnt33 += 1 + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 23, direct_declarator_StartIndex) + + pass + + return + + # $ANTLR end direct_declarator + + + # $ANTLR start declarator_suffix + # C.g:307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' ); + def declarator_suffix(self, ): + + declarator_suffix_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 24): + return + + # C.g:308:2: ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' ) + alt35 = 5 + LA35_0 = self.input.LA(1) + + if (LA35_0 == 64) : + LA35_1 = self.input.LA(2) + + if (LA35_1 == 65) : + alt35 = 2 + elif ((IDENTIFIER <= LA35_1 <= FLOATING_POINT_LITERAL) or LA35_1 == 62 or LA35_1 == 66 or (68 <= LA35_1 <= 69) or (72 <= LA35_1 <= 74) or (77 <= LA35_1 <= 79)) : + alt35 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 1, self.input) + + raise nvae + + elif (LA35_0 == 62) : + LA35 = self.input.LA(2) + if LA35 == 63: + alt35 = 5 + elif LA35 == 29 or LA35 == 30 or LA35 == 31 or LA35 == 32 or LA35 == 33 or LA35 == 34 or LA35 == 35 or LA35 == 36 or LA35 == 37 or LA35 == 38 or LA35 == 39 or LA35 == 40 or LA35 == 41 or LA35 == 42 or LA35 == 45 or LA35 == 46 or LA35 == 48 or LA35 == 49 or LA35 == 50 or LA35 == 51 or LA35 == 52 or LA35 == 53 or LA35 == 54 or LA35 == 55 or LA35 == 56 or LA35 == 57 or LA35 == 58 or LA35 == 59 or LA35 == 60 or LA35 == 61 or LA35 == 66: + alt35 = 3 + elif LA35 == IDENTIFIER: + LA35_29 = self.input.LA(3) + + if (self.synpred73()) : + alt35 = 3 + elif (self.synpred74()) : + alt35 = 4 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 29, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 2, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 0, self.input) + + raise nvae + + if alt35 == 1: + # C.g:308:6: '[' constant_expression ']' + self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix852) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_declarator_suffix854) + self.constant_expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix856) + if self.failed: + return + + + elif alt35 == 2: + # C.g:309:9: '[' ']' + self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix866) + if self.failed: + return + self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix868) + if self.failed: + return + + + elif alt35 == 3: + # C.g:310:9: '(' parameter_type_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix878) + if self.failed: + return + self.following.append(self.FOLLOW_parameter_type_list_in_declarator_suffix880) + self.parameter_type_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix882) + if self.failed: + return + + + elif alt35 == 4: + # C.g:311:9: '(' identifier_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix892) + if self.failed: + return + self.following.append(self.FOLLOW_identifier_list_in_declarator_suffix894) + self.identifier_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix896) + if self.failed: + return + + + elif alt35 == 5: + # C.g:312:9: '(' ')' + self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix906) + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix908) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 24, declarator_suffix_StartIndex) + + pass + + return + + # $ANTLR end declarator_suffix + + + # $ANTLR start pointer + # C.g:315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' ); + def pointer(self, ): + + pointer_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 25): + return + + # C.g:316:2: ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' ) + alt38 = 3 + LA38_0 = self.input.LA(1) + + if (LA38_0 == 66) : + LA38 = self.input.LA(2) + if LA38 == 66: + LA38_2 = self.input.LA(3) + + if (self.synpred78()) : + alt38 = 2 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 2, self.input) + + raise nvae + + elif LA38 == 58: + LA38_3 = self.input.LA(3) + + if (self.synpred77()) : + alt38 = 1 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 3, self.input) + + raise nvae + + elif LA38 == 59: + LA38_4 = self.input.LA(3) + + if (self.synpred77()) : + alt38 = 1 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 4, self.input) + + raise nvae + + elif LA38 == 60: + LA38_5 = self.input.LA(3) + + if (self.synpred77()) : + alt38 = 1 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 5, self.input) + + raise nvae + + elif LA38 == EOF or LA38 == IDENTIFIER or LA38 == 25 or LA38 == 26 or LA38 == 27 or LA38 == 28 or LA38 == 29 or LA38 == 30 or LA38 == 31 or LA38 == 32 or LA38 == 33 or LA38 == 34 or LA38 == 35 or LA38 == 36 or LA38 == 37 or LA38 == 38 or LA38 == 39 or LA38 == 40 or LA38 == 41 or LA38 == 42 or LA38 == 43 or LA38 == 45 or LA38 == 46 or LA38 == 47 or LA38 == 48 or LA38 == 62 or LA38 == 63 or LA38 == 64: + alt38 = 3 + elif LA38 == 53: + LA38_21 = self.input.LA(3) + + if (self.synpred77()) : + alt38 = 1 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 21, self.input) + + raise nvae + + elif LA38 == 49 or LA38 == 50 or LA38 == 51 or LA38 == 52 or LA38 == 54 or LA38 == 55 or LA38 == 56 or LA38 == 57 or LA38 == 61: + LA38_29 = self.input.LA(3) + + if (self.synpred77()) : + alt38 = 1 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 29, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 1, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 0, self.input) + + raise nvae + + if alt38 == 1: + # C.g:316:4: '*' ( type_qualifier )+ ( pointer )? + self.match(self.input, 66, self.FOLLOW_66_in_pointer919) + if self.failed: + return + # C.g:316:8: ( type_qualifier )+ + cnt36 = 0 + while True: #loop36 + alt36 = 2 + LA36 = self.input.LA(1) + if LA36 == 58: + LA36_2 = self.input.LA(2) + + if (self.synpred75()) : + alt36 = 1 + + + elif LA36 == 59: + LA36_3 = self.input.LA(2) + + if (self.synpred75()) : + alt36 = 1 + + + elif LA36 == 60: + LA36_4 = self.input.LA(2) + + if (self.synpred75()) : + alt36 = 1 + + + elif LA36 == 53: + LA36_20 = self.input.LA(2) + + if (self.synpred75()) : + alt36 = 1 + + + elif LA36 == 49 or LA36 == 50 or LA36 == 51 or LA36 == 52 or LA36 == 54 or LA36 == 55 or LA36 == 56 or LA36 == 57 or LA36 == 61: + LA36_28 = self.input.LA(2) + + if (self.synpred75()) : + alt36 = 1 + + + + if alt36 == 1: + # C.g:0:0: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_pointer921) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + else: + if cnt36 >= 1: + break #loop36 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(36, self.input) + raise eee + + cnt36 += 1 + + + # C.g:316:24: ( pointer )? + alt37 = 2 + LA37_0 = self.input.LA(1) + + if (LA37_0 == 66) : + LA37_1 = self.input.LA(2) + + if (self.synpred76()) : + alt37 = 1 + if alt37 == 1: + # C.g:0:0: pointer + self.following.append(self.FOLLOW_pointer_in_pointer924) + self.pointer() + self.following.pop() + if self.failed: + return + + + + + + elif alt38 == 2: + # C.g:317:4: '*' pointer + self.match(self.input, 66, self.FOLLOW_66_in_pointer930) + if self.failed: + return + self.following.append(self.FOLLOW_pointer_in_pointer932) + self.pointer() + self.following.pop() + if self.failed: + return + + + elif alt38 == 3: + # C.g:318:4: '*' + self.match(self.input, 66, self.FOLLOW_66_in_pointer937) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 25, pointer_StartIndex) + + pass + + return + + # $ANTLR end pointer + + + # $ANTLR start parameter_type_list + # C.g:321:1: parameter_type_list : parameter_list ( ',' ( 'OPTIONAL' )? '...' )? ; + def parameter_type_list(self, ): + + parameter_type_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 26): + return + + # C.g:322:2: ( parameter_list ( ',' ( 'OPTIONAL' )? '...' )? ) + # C.g:322:4: parameter_list ( ',' ( 'OPTIONAL' )? '...' )? + self.following.append(self.FOLLOW_parameter_list_in_parameter_type_list948) + self.parameter_list() + self.following.pop() + if self.failed: + return + # C.g:322:19: ( ',' ( 'OPTIONAL' )? '...' )? + alt40 = 2 + LA40_0 = self.input.LA(1) + + if (LA40_0 == 27) : + alt40 = 1 + if alt40 == 1: + # C.g:322:20: ',' ( 'OPTIONAL' )? '...' + self.match(self.input, 27, self.FOLLOW_27_in_parameter_type_list951) + if self.failed: + return + # C.g:322:24: ( 'OPTIONAL' )? + alt39 = 2 + LA39_0 = self.input.LA(1) + + if (LA39_0 == 53) : + alt39 = 1 + if alt39 == 1: + # C.g:322:25: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_parameter_type_list954) + if self.failed: + return + + + + self.match(self.input, 67, self.FOLLOW_67_in_parameter_type_list958) + if self.failed: + return + + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 26, parameter_type_list_StartIndex) + + pass + + return + + # $ANTLR end parameter_type_list + + + # $ANTLR start parameter_list + # C.g:325:1: parameter_list : parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* ; + def parameter_list(self, ): + + parameter_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 27): + return + + # C.g:326:2: ( parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* ) + # C.g:326:4: parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* + self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list971) + self.parameter_declaration() + self.following.pop() + if self.failed: + return + # C.g:326:26: ( ',' ( 'OPTIONAL' )? parameter_declaration )* + while True: #loop42 + alt42 = 2 + LA42_0 = self.input.LA(1) + + if (LA42_0 == 27) : + LA42_1 = self.input.LA(2) + + if (LA42_1 == 53) : + LA42_3 = self.input.LA(3) + + if (self.synpred82()) : + alt42 = 1 + + + elif (LA42_1 == IDENTIFIER or (29 <= LA42_1 <= 42) or (45 <= LA42_1 <= 46) or (48 <= LA42_1 <= 52) or (54 <= LA42_1 <= 61) or LA42_1 == 66) : + alt42 = 1 + + + + + if alt42 == 1: + # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration + self.match(self.input, 27, self.FOLLOW_27_in_parameter_list974) + if self.failed: + return + # C.g:326:31: ( 'OPTIONAL' )? + alt41 = 2 + LA41_0 = self.input.LA(1) + + if (LA41_0 == 53) : + LA41_1 = self.input.LA(2) + + if (self.synpred81()) : + alt41 = 1 + if alt41 == 1: + # C.g:326:32: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_parameter_list977) + if self.failed: + return + + + + self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list981) + self.parameter_declaration() + self.following.pop() + if self.failed: + return + + + else: + break #loop42 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 27, parameter_list_StartIndex) + + pass + + return + + # $ANTLR end parameter_list + + + # $ANTLR start parameter_declaration + # C.g:329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER ); + def parameter_declaration(self, ): + + parameter_declaration_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 28): + return + + # C.g:330:2: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER ) + alt46 = 2 + LA46 = self.input.LA(1) + if LA46 == 29 or LA46 == 30 or LA46 == 31 or LA46 == 32 or LA46 == 33 or LA46 == 34 or LA46 == 35 or LA46 == 36 or LA46 == 37 or LA46 == 38 or LA46 == 39 or LA46 == 40 or LA46 == 41 or LA46 == 42 or LA46 == 45 or LA46 == 46 or LA46 == 48 or LA46 == 49 or LA46 == 50 or LA46 == 51 or LA46 == 52 or LA46 == 53 or LA46 == 54 or LA46 == 55 or LA46 == 56 or LA46 == 57 or LA46 == 58 or LA46 == 59 or LA46 == 60 or LA46 == 61: + alt46 = 1 + elif LA46 == IDENTIFIER: + LA46_13 = self.input.LA(2) + + if (self.synpred86()) : + alt46 = 1 + elif (True) : + alt46 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 13, self.input) + + raise nvae + + elif LA46 == 66: + alt46 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 0, self.input) + + raise nvae + + if alt46 == 1: + # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? + self.following.append(self.FOLLOW_declaration_specifiers_in_parameter_declaration994) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + # C.g:330:27: ( declarator | abstract_declarator )* + while True: #loop43 + alt43 = 3 + LA43 = self.input.LA(1) + if LA43 == 66: + LA43_5 = self.input.LA(2) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == IDENTIFIER or LA43 == 58 or LA43 == 59 or LA43 == 60: + alt43 = 1 + elif LA43 == 62: + LA43 = self.input.LA(2) + if LA43 == 29 or LA43 == 30 or LA43 == 31 or LA43 == 32 or LA43 == 33 or LA43 == 34 or LA43 == 35 or LA43 == 36 or LA43 == 37 or LA43 == 38 or LA43 == 39 or LA43 == 40 or LA43 == 41 or LA43 == 42 or LA43 == 45 or LA43 == 46 or LA43 == 48 or LA43 == 49 or LA43 == 50 or LA43 == 51 or LA43 == 52 or LA43 == 53 or LA43 == 54 or LA43 == 55 or LA43 == 56 or LA43 == 57 or LA43 == 61 or LA43 == 63 or LA43 == 64: + alt43 = 2 + elif LA43 == IDENTIFIER: + LA43_37 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == 58: + LA43_38 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == 66: + LA43_39 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == 59: + LA43_40 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == 60: + LA43_41 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == 62: + LA43_43 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + + elif LA43 == 64: + alt43 = 2 + + if alt43 == 1: + # C.g:330:28: declarator + self.following.append(self.FOLLOW_declarator_in_parameter_declaration997) + self.declarator() + self.following.pop() + if self.failed: + return + + + elif alt43 == 2: + # C.g:330:39: abstract_declarator + self.following.append(self.FOLLOW_abstract_declarator_in_parameter_declaration999) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + + + else: + break #loop43 + + + # C.g:330:61: ( 'OPTIONAL' )? + alt44 = 2 + LA44_0 = self.input.LA(1) + + if (LA44_0 == 53) : + alt44 = 1 + if alt44 == 1: + # C.g:330:62: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_parameter_declaration1004) + if self.failed: + return + + + + + + elif alt46 == 2: + # C.g:332:4: ( pointer )* IDENTIFIER + # C.g:332:4: ( pointer )* + while True: #loop45 + alt45 = 2 + LA45_0 = self.input.LA(1) + + if (LA45_0 == 66) : + alt45 = 1 + + + if alt45 == 1: + # C.g:0:0: pointer + self.following.append(self.FOLLOW_pointer_in_parameter_declaration1013) + self.pointer() + self.following.pop() + if self.failed: + return + + + else: + break #loop45 + + + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_parameter_declaration1016) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 28, parameter_declaration_StartIndex) + + pass + + return + + # $ANTLR end parameter_declaration + + + # $ANTLR start identifier_list + # C.g:335:1: identifier_list : IDENTIFIER ( ',' IDENTIFIER )* ; + def identifier_list(self, ): + + identifier_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 29): + return + + # C.g:336:2: ( IDENTIFIER ( ',' IDENTIFIER )* ) + # C.g:336:4: IDENTIFIER ( ',' IDENTIFIER )* + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1027) + if self.failed: + return + # C.g:337:2: ( ',' IDENTIFIER )* + while True: #loop47 + alt47 = 2 + LA47_0 = self.input.LA(1) + + if (LA47_0 == 27) : + alt47 = 1 + + + if alt47 == 1: + # C.g:337:3: ',' IDENTIFIER + self.match(self.input, 27, self.FOLLOW_27_in_identifier_list1031) + if self.failed: + return + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1033) + if self.failed: + return + + + else: + break #loop47 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 29, identifier_list_StartIndex) + + pass + + return + + # $ANTLR end identifier_list + + + # $ANTLR start type_name + # C.g:340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id ); + def type_name(self, ): + + type_name_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 30): + return + + # C.g:341:2: ( specifier_qualifier_list ( abstract_declarator )? | type_id ) + alt49 = 2 + LA49_0 = self.input.LA(1) + + if ((34 <= LA49_0 <= 42) or (45 <= LA49_0 <= 46) or (48 <= LA49_0 <= 61)) : + alt49 = 1 + elif (LA49_0 == IDENTIFIER) : + LA49_13 = self.input.LA(2) + + if (self.synpred90()) : + alt49 = 1 + elif (True) : + alt49 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 13, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 0, self.input) + + raise nvae + + if alt49 == 1: + # C.g:341:4: specifier_qualifier_list ( abstract_declarator )? + self.following.append(self.FOLLOW_specifier_qualifier_list_in_type_name1046) + self.specifier_qualifier_list() + self.following.pop() + if self.failed: + return + # C.g:341:29: ( abstract_declarator )? + alt48 = 2 + LA48_0 = self.input.LA(1) + + if (LA48_0 == 62 or LA48_0 == 64 or LA48_0 == 66) : + alt48 = 1 + if alt48 == 1: + # C.g:0:0: abstract_declarator + self.following.append(self.FOLLOW_abstract_declarator_in_type_name1048) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + + + + + + elif alt49 == 2: + # C.g:342:4: type_id + self.following.append(self.FOLLOW_type_id_in_type_name1054) + self.type_id() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 30, type_name_StartIndex) + + pass + + return + + # $ANTLR end type_name + + + # $ANTLR start abstract_declarator + # C.g:345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator ); + def abstract_declarator(self, ): + + abstract_declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 31): + return + + # C.g:346:2: ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator ) + alt51 = 2 + LA51_0 = self.input.LA(1) + + if (LA51_0 == 66) : + alt51 = 1 + elif (LA51_0 == 62 or LA51_0 == 64) : + alt51 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator );", 51, 0, self.input) + + raise nvae + + if alt51 == 1: + # C.g:346:4: pointer ( direct_abstract_declarator )? + self.following.append(self.FOLLOW_pointer_in_abstract_declarator1065) + self.pointer() + self.following.pop() + if self.failed: + return + # C.g:346:12: ( direct_abstract_declarator )? + alt50 = 2 + LA50_0 = self.input.LA(1) + + if (LA50_0 == 62) : + LA50 = self.input.LA(2) + if LA50 == 63: + LA50_12 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 58: + LA50_13 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 66: + LA50_14 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 59: + LA50_15 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 60: + LA50_16 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == IDENTIFIER: + LA50_17 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 62: + LA50_18 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 64: + LA50_19 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 29 or LA50 == 30 or LA50 == 31 or LA50 == 32 or LA50 == 33: + LA50_20 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 34: + LA50_21 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 35: + LA50_22 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 36: + LA50_23 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 37: + LA50_24 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 38: + LA50_25 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 39: + LA50_26 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 40: + LA50_27 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 41: + LA50_28 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 42: + LA50_29 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 45 or LA50 == 46: + LA50_30 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 48: + LA50_31 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 49 or LA50 == 50 or LA50 == 51 or LA50 == 52 or LA50 == 53 or LA50 == 54 or LA50 == 55 or LA50 == 56 or LA50 == 57 or LA50 == 61: + LA50_32 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif (LA50_0 == 64) : + LA50 = self.input.LA(2) + if LA50 == 65: + LA50_33 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 62: + LA50_34 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == IDENTIFIER: + LA50_35 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == HEX_LITERAL: + LA50_36 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == OCTAL_LITERAL: + LA50_37 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == DECIMAL_LITERAL: + LA50_38 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == CHARACTER_LITERAL: + LA50_39 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == STRING_LITERAL: + LA50_40 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == FLOATING_POINT_LITERAL: + LA50_41 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 72: + LA50_42 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 73: + LA50_43 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 66 or LA50 == 68 or LA50 == 69 or LA50 == 77 or LA50 == 78 or LA50 == 79: + LA50_44 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 74: + LA50_45 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + if alt50 == 1: + # C.g:0:0: direct_abstract_declarator + self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1067) + self.direct_abstract_declarator() + self.following.pop() + if self.failed: + return + + + + + + elif alt51 == 2: + # C.g:347:4: direct_abstract_declarator + self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1073) + self.direct_abstract_declarator() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 31, abstract_declarator_StartIndex) + + pass + + return + + # $ANTLR end abstract_declarator + + + # $ANTLR start direct_abstract_declarator + # C.g:350:1: direct_abstract_declarator : ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* ; + def direct_abstract_declarator(self, ): + + direct_abstract_declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 32): + return + + # C.g:351:2: ( ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* ) + # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* + # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix ) + alt52 = 2 + LA52_0 = self.input.LA(1) + + if (LA52_0 == 62) : + LA52 = self.input.LA(2) + if LA52 == IDENTIFIER or LA52 == 29 or LA52 == 30 or LA52 == 31 or LA52 == 32 or LA52 == 33 or LA52 == 34 or LA52 == 35 or LA52 == 36 or LA52 == 37 or LA52 == 38 or LA52 == 39 or LA52 == 40 or LA52 == 41 or LA52 == 42 or LA52 == 45 or LA52 == 46 or LA52 == 48 or LA52 == 49 or LA52 == 50 or LA52 == 51 or LA52 == 52 or LA52 == 53 or LA52 == 54 or LA52 == 55 or LA52 == 56 or LA52 == 57 or LA52 == 58 or LA52 == 59 or LA52 == 60 or LA52 == 61 or LA52 == 63: + alt52 = 2 + elif LA52 == 66: + LA52_18 = self.input.LA(3) + + if (self.synpred93()) : + alt52 = 1 + elif (True) : + alt52 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 18, self.input) + + raise nvae + + elif LA52 == 62 or LA52 == 64: + alt52 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 1, self.input) + + raise nvae + + elif (LA52_0 == 64) : + alt52 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 0, self.input) + + raise nvae + + if alt52 == 1: + # C.g:351:6: '(' abstract_declarator ')' + self.match(self.input, 62, self.FOLLOW_62_in_direct_abstract_declarator1086) + if self.failed: + return + self.following.append(self.FOLLOW_abstract_declarator_in_direct_abstract_declarator1088) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_direct_abstract_declarator1090) + if self.failed: + return + + + elif alt52 == 2: + # C.g:351:36: abstract_declarator_suffix + self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094) + self.abstract_declarator_suffix() + self.following.pop() + if self.failed: + return + + + + # C.g:351:65: ( abstract_declarator_suffix )* + while True: #loop53 + alt53 = 2 + LA53_0 = self.input.LA(1) + + if (LA53_0 == 62) : + LA53 = self.input.LA(2) + if LA53 == 63: + LA53_12 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 58: + LA53_13 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 66: + LA53_14 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 59: + LA53_15 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 60: + LA53_16 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == IDENTIFIER: + LA53_17 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 29 or LA53 == 30 or LA53 == 31 or LA53 == 32 or LA53 == 33: + LA53_19 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 34: + LA53_20 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 35: + LA53_21 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 36: + LA53_22 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 37: + LA53_23 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 38: + LA53_24 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 39: + LA53_25 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 40: + LA53_26 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 41: + LA53_27 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 42: + LA53_28 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 45 or LA53 == 46: + LA53_29 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 48: + LA53_30 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 49 or LA53 == 50 or LA53 == 51 or LA53 == 52 or LA53 == 53 or LA53 == 54 or LA53 == 55 or LA53 == 56 or LA53 == 57 or LA53 == 61: + LA53_31 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + + elif (LA53_0 == 64) : + LA53 = self.input.LA(2) + if LA53 == 65: + LA53_33 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 62: + LA53_34 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == IDENTIFIER: + LA53_35 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == HEX_LITERAL: + LA53_36 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == OCTAL_LITERAL: + LA53_37 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == DECIMAL_LITERAL: + LA53_38 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == CHARACTER_LITERAL: + LA53_39 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == STRING_LITERAL: + LA53_40 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == FLOATING_POINT_LITERAL: + LA53_41 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 72: + LA53_42 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 73: + LA53_43 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 66 or LA53 == 68 or LA53 == 69 or LA53 == 77 or LA53 == 78 or LA53 == 79: + LA53_44 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 74: + LA53_45 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + + + + if alt53 == 1: + # C.g:0:0: abstract_declarator_suffix + self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098) + self.abstract_declarator_suffix() + self.following.pop() + if self.failed: + return + + + else: + break #loop53 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 32, direct_abstract_declarator_StartIndex) + + pass + + return + + # $ANTLR end direct_abstract_declarator + + + # $ANTLR start abstract_declarator_suffix + # C.g:354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' ); + def abstract_declarator_suffix(self, ): + + abstract_declarator_suffix_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 33): + return + + # C.g:355:2: ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' ) + alt54 = 4 + LA54_0 = self.input.LA(1) + + if (LA54_0 == 64) : + LA54_1 = self.input.LA(2) + + if (LA54_1 == 65) : + alt54 = 1 + elif ((IDENTIFIER <= LA54_1 <= FLOATING_POINT_LITERAL) or LA54_1 == 62 or LA54_1 == 66 or (68 <= LA54_1 <= 69) or (72 <= LA54_1 <= 74) or (77 <= LA54_1 <= 79)) : + alt54 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 1, self.input) + + raise nvae + + elif (LA54_0 == 62) : + LA54_2 = self.input.LA(2) + + if (LA54_2 == 63) : + alt54 = 3 + elif (LA54_2 == IDENTIFIER or (29 <= LA54_2 <= 42) or (45 <= LA54_2 <= 46) or (48 <= LA54_2 <= 61) or LA54_2 == 66) : + alt54 = 4 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 2, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 0, self.input) + + raise nvae + + if alt54 == 1: + # C.g:355:4: '[' ']' + self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1110) + if self.failed: + return + self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1112) + if self.failed: + return + + + elif alt54 == 2: + # C.g:356:4: '[' constant_expression ']' + self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1117) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_abstract_declarator_suffix1119) + self.constant_expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1121) + if self.failed: + return + + + elif alt54 == 3: + # C.g:357:4: '(' ')' + self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1126) + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1128) + if self.failed: + return + + + elif alt54 == 4: + # C.g:358:4: '(' parameter_type_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1133) + if self.failed: + return + self.following.append(self.FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135) + self.parameter_type_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1137) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 33, abstract_declarator_suffix_StartIndex) + + pass + + return + + # $ANTLR end abstract_declarator_suffix + + + # $ANTLR start initializer + # C.g:361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' ); + def initializer(self, ): + + initializer_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 34): + return + + # C.g:363:2: ( assignment_expression | '{' initializer_list ( ',' )? '}' ) + alt56 = 2 + LA56_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA56_0 <= FLOATING_POINT_LITERAL) or LA56_0 == 62 or LA56_0 == 66 or (68 <= LA56_0 <= 69) or (72 <= LA56_0 <= 74) or (77 <= LA56_0 <= 79)) : + alt56 = 1 + elif (LA56_0 == 43) : + alt56 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' );", 56, 0, self.input) + + raise nvae + + if alt56 == 1: + # C.g:363:4: assignment_expression + self.following.append(self.FOLLOW_assignment_expression_in_initializer1150) + self.assignment_expression() + self.following.pop() + if self.failed: + return + + + elif alt56 == 2: + # C.g:364:4: '{' initializer_list ( ',' )? '}' + self.match(self.input, 43, self.FOLLOW_43_in_initializer1155) + if self.failed: + return + self.following.append(self.FOLLOW_initializer_list_in_initializer1157) + self.initializer_list() + self.following.pop() + if self.failed: + return + # C.g:364:25: ( ',' )? + alt55 = 2 + LA55_0 = self.input.LA(1) + + if (LA55_0 == 27) : + alt55 = 1 + if alt55 == 1: + # C.g:0:0: ',' + self.match(self.input, 27, self.FOLLOW_27_in_initializer1159) + if self.failed: + return + + + + self.match(self.input, 44, self.FOLLOW_44_in_initializer1162) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 34, initializer_StartIndex) + + pass + + return + + # $ANTLR end initializer + + + # $ANTLR start initializer_list + # C.g:367:1: initializer_list : initializer ( ',' initializer )* ; + def initializer_list(self, ): + + initializer_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 35): + return + + # C.g:368:2: ( initializer ( ',' initializer )* ) + # C.g:368:4: initializer ( ',' initializer )* + self.following.append(self.FOLLOW_initializer_in_initializer_list1173) + self.initializer() + self.following.pop() + if self.failed: + return + # C.g:368:16: ( ',' initializer )* + while True: #loop57 + alt57 = 2 + LA57_0 = self.input.LA(1) + + if (LA57_0 == 27) : + LA57_1 = self.input.LA(2) + + if ((IDENTIFIER <= LA57_1 <= FLOATING_POINT_LITERAL) or LA57_1 == 43 or LA57_1 == 62 or LA57_1 == 66 or (68 <= LA57_1 <= 69) or (72 <= LA57_1 <= 74) or (77 <= LA57_1 <= 79)) : + alt57 = 1 + + + + + if alt57 == 1: + # C.g:368:17: ',' initializer + self.match(self.input, 27, self.FOLLOW_27_in_initializer_list1176) + if self.failed: + return + self.following.append(self.FOLLOW_initializer_in_initializer_list1178) + self.initializer() + self.following.pop() + if self.failed: + return + + + else: + break #loop57 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 35, initializer_list_StartIndex) + + pass + + return + + # $ANTLR end initializer_list + + class argument_expression_list_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start argument_expression_list + # C.g:373:1: argument_expression_list : assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* ; + def argument_expression_list(self, ): + + retval = self.argument_expression_list_return() + retval.start = self.input.LT(1) + argument_expression_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 36): + return retval + + # C.g:374:2: ( assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* ) + # C.g:374:6: assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* + self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1196) + self.assignment_expression() + self.following.pop() + if self.failed: + return retval + # C.g:374:28: ( 'OPTIONAL' )? + alt58 = 2 + LA58_0 = self.input.LA(1) + + if (LA58_0 == 53) : + alt58 = 1 + if alt58 == 1: + # C.g:374:29: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1199) + if self.failed: + return retval + + + + # C.g:374:42: ( ',' assignment_expression ( 'OPTIONAL' )? )* + while True: #loop60 + alt60 = 2 + LA60_0 = self.input.LA(1) + + if (LA60_0 == 27) : + alt60 = 1 + + + if alt60 == 1: + # C.g:374:43: ',' assignment_expression ( 'OPTIONAL' )? + self.match(self.input, 27, self.FOLLOW_27_in_argument_expression_list1204) + if self.failed: + return retval + self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1206) + self.assignment_expression() + self.following.pop() + if self.failed: + return retval + # C.g:374:69: ( 'OPTIONAL' )? + alt59 = 2 + LA59_0 = self.input.LA(1) + + if (LA59_0 == 53) : + alt59 = 1 + if alt59 == 1: + # C.g:374:70: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1209) + if self.failed: + return retval + + + + + + else: + break #loop60 + + + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 36, argument_expression_list_StartIndex) + + pass + + return retval + + # $ANTLR end argument_expression_list + + + # $ANTLR start additive_expression + # C.g:377:1: additive_expression : ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* ; + def additive_expression(self, ): + + additive_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 37): + return + + # C.g:378:2: ( ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* ) + # C.g:378:4: ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* + # C.g:378:4: ( multiplicative_expression ) + # C.g:378:5: multiplicative_expression + self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1225) + self.multiplicative_expression() + self.following.pop() + if self.failed: + return + + + + # C.g:378:32: ( '+' multiplicative_expression | '-' multiplicative_expression )* + while True: #loop61 + alt61 = 3 + LA61_0 = self.input.LA(1) + + if (LA61_0 == 68) : + alt61 = 1 + elif (LA61_0 == 69) : + alt61 = 2 + + + if alt61 == 1: + # C.g:378:33: '+' multiplicative_expression + self.match(self.input, 68, self.FOLLOW_68_in_additive_expression1229) + if self.failed: + return + self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1231) + self.multiplicative_expression() + self.following.pop() + if self.failed: + return + + + elif alt61 == 2: + # C.g:378:65: '-' multiplicative_expression + self.match(self.input, 69, self.FOLLOW_69_in_additive_expression1235) + if self.failed: + return + self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1237) + self.multiplicative_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop61 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 37, additive_expression_StartIndex) + + pass + + return + + # $ANTLR end additive_expression + + + # $ANTLR start multiplicative_expression + # C.g:381:1: multiplicative_expression : ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* ; + def multiplicative_expression(self, ): + + multiplicative_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 38): + return + + # C.g:382:2: ( ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* ) + # C.g:382:4: ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* + # C.g:382:4: ( cast_expression ) + # C.g:382:5: cast_expression + self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1251) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + + # C.g:382:22: ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* + while True: #loop62 + alt62 = 4 + LA62 = self.input.LA(1) + if LA62 == 66: + alt62 = 1 + elif LA62 == 70: + alt62 = 2 + elif LA62 == 71: + alt62 = 3 + + if alt62 == 1: + # C.g:382:23: '*' cast_expression + self.match(self.input, 66, self.FOLLOW_66_in_multiplicative_expression1255) + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1257) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + elif alt62 == 2: + # C.g:382:45: '/' cast_expression + self.match(self.input, 70, self.FOLLOW_70_in_multiplicative_expression1261) + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1263) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + elif alt62 == 3: + # C.g:382:67: '%' cast_expression + self.match(self.input, 71, self.FOLLOW_71_in_multiplicative_expression1267) + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1269) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop62 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 38, multiplicative_expression_StartIndex) + + pass + + return + + # $ANTLR end multiplicative_expression + + + # $ANTLR start cast_expression + # C.g:385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression ); + def cast_expression(self, ): + + cast_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 39): + return + + # C.g:386:2: ( '(' type_name ')' cast_expression | unary_expression ) + alt63 = 2 + LA63_0 = self.input.LA(1) + + if (LA63_0 == 62) : + LA63 = self.input.LA(2) + if LA63 == 34 or LA63 == 35 or LA63 == 36 or LA63 == 37 or LA63 == 38 or LA63 == 39 or LA63 == 40 or LA63 == 41 or LA63 == 42 or LA63 == 45 or LA63 == 46 or LA63 == 48 or LA63 == 49 or LA63 == 50 or LA63 == 51 or LA63 == 52 or LA63 == 53 or LA63 == 54 or LA63 == 55 or LA63 == 56 or LA63 == 57 or LA63 == 58 or LA63 == 59 or LA63 == 60 or LA63 == 61: + alt63 = 1 + elif LA63 == IDENTIFIER: + LA63_25 = self.input.LA(3) + + if (self.synpred109()) : + alt63 = 1 + elif (True) : + alt63 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 25, self.input) + + raise nvae + + elif LA63 == HEX_LITERAL or LA63 == OCTAL_LITERAL or LA63 == DECIMAL_LITERAL or LA63 == CHARACTER_LITERAL or LA63 == STRING_LITERAL or LA63 == FLOATING_POINT_LITERAL or LA63 == 62 or LA63 == 66 or LA63 == 68 or LA63 == 69 or LA63 == 72 or LA63 == 73 or LA63 == 74 or LA63 == 77 or LA63 == 78 or LA63 == 79: + alt63 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 1, self.input) + + raise nvae + + elif ((IDENTIFIER <= LA63_0 <= FLOATING_POINT_LITERAL) or LA63_0 == 66 or (68 <= LA63_0 <= 69) or (72 <= LA63_0 <= 74) or (77 <= LA63_0 <= 79)) : + alt63 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 0, self.input) + + raise nvae + + if alt63 == 1: + # C.g:386:4: '(' type_name ')' cast_expression + self.match(self.input, 62, self.FOLLOW_62_in_cast_expression1282) + if self.failed: + return + self.following.append(self.FOLLOW_type_name_in_cast_expression1284) + self.type_name() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_cast_expression1286) + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_cast_expression1288) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + elif alt63 == 2: + # C.g:387:4: unary_expression + self.following.append(self.FOLLOW_unary_expression_in_cast_expression1293) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 39, cast_expression_StartIndex) + + pass + + return + + # $ANTLR end cast_expression + + + # $ANTLR start unary_expression + # C.g:390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' ); + def unary_expression(self, ): + + unary_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 40): + return + + # C.g:391:2: ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' ) + alt64 = 6 + LA64 = self.input.LA(1) + if LA64 == IDENTIFIER or LA64 == HEX_LITERAL or LA64 == OCTAL_LITERAL or LA64 == DECIMAL_LITERAL or LA64 == CHARACTER_LITERAL or LA64 == STRING_LITERAL or LA64 == FLOATING_POINT_LITERAL or LA64 == 62: + alt64 = 1 + elif LA64 == 72: + alt64 = 2 + elif LA64 == 73: + alt64 = 3 + elif LA64 == 66 or LA64 == 68 or LA64 == 69 or LA64 == 77 or LA64 == 78 or LA64 == 79: + alt64 = 4 + elif LA64 == 74: + LA64_12 = self.input.LA(2) + + if (LA64_12 == 62) : + LA64_13 = self.input.LA(3) + + if (self.synpred114()) : + alt64 = 5 + elif (True) : + alt64 = 6 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 13, self.input) + + raise nvae + + elif ((IDENTIFIER <= LA64_12 <= FLOATING_POINT_LITERAL) or LA64_12 == 66 or (68 <= LA64_12 <= 69) or (72 <= LA64_12 <= 74) or (77 <= LA64_12 <= 79)) : + alt64 = 5 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 12, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 0, self.input) + + raise nvae + + if alt64 == 1: + # C.g:391:4: postfix_expression + self.following.append(self.FOLLOW_postfix_expression_in_unary_expression1304) + self.postfix_expression() + self.following.pop() + if self.failed: + return + + + elif alt64 == 2: + # C.g:392:4: '++' unary_expression + self.match(self.input, 72, self.FOLLOW_72_in_unary_expression1309) + if self.failed: + return + self.following.append(self.FOLLOW_unary_expression_in_unary_expression1311) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + elif alt64 == 3: + # C.g:393:4: '--' unary_expression + self.match(self.input, 73, self.FOLLOW_73_in_unary_expression1316) + if self.failed: + return + self.following.append(self.FOLLOW_unary_expression_in_unary_expression1318) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + elif alt64 == 4: + # C.g:394:4: unary_operator cast_expression + self.following.append(self.FOLLOW_unary_operator_in_unary_expression1323) + self.unary_operator() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_unary_expression1325) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + elif alt64 == 5: + # C.g:395:4: 'sizeof' unary_expression + self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1330) + if self.failed: + return + self.following.append(self.FOLLOW_unary_expression_in_unary_expression1332) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + elif alt64 == 6: + # C.g:396:4: 'sizeof' '(' type_name ')' + self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1337) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_unary_expression1339) + if self.failed: + return + self.following.append(self.FOLLOW_type_name_in_unary_expression1341) + self.type_name() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_unary_expression1343) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 40, unary_expression_StartIndex) + + pass + + return + + # $ANTLR end unary_expression + + + # $ANTLR start postfix_expression + # C.g:399:1: postfix_expression : p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* ; + def postfix_expression(self, ): + self.postfix_expression_stack.append(postfix_expression_scope()) + postfix_expression_StartIndex = self.input.index() + a = None + b = None + x = None + y = None + z = None + p = None + + c = None + + + + self.postfix_expression_stack[-1].FuncCallText = '' + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 41): + return + + # C.g:406:2: (p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* ) + # C.g:406:6: p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* + self.following.append(self.FOLLOW_primary_expression_in_postfix_expression1367) + p = self.primary_expression() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + self.postfix_expression_stack[-1].FuncCallText += self.input.toString(p.start,p.stop) + + # C.g:407:9: ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* + while True: #loop65 + alt65 = 10 + LA65 = self.input.LA(1) + if LA65 == 66: + LA65_1 = self.input.LA(2) + + if (LA65_1 == IDENTIFIER) : + LA65_30 = self.input.LA(3) + + if (self.synpred120()) : + alt65 = 6 + + + + + elif LA65 == 64: + alt65 = 1 + elif LA65 == 62: + LA65 = self.input.LA(2) + if LA65 == 63: + alt65 = 2 + elif LA65 == 29 or LA65 == 30 or LA65 == 31 or LA65 == 32 or LA65 == 33 or LA65 == 34 or LA65 == 35 or LA65 == 36 or LA65 == 37 or LA65 == 38 or LA65 == 39 or LA65 == 40 or LA65 == 41 or LA65 == 42 or LA65 == 45 or LA65 == 46 or LA65 == 48 or LA65 == 49 or LA65 == 50 or LA65 == 51 or LA65 == 52 or LA65 == 53 or LA65 == 54 or LA65 == 55 or LA65 == 56 or LA65 == 57 or LA65 == 58 or LA65 == 59 or LA65 == 60 or LA65 == 61: + alt65 = 4 + elif LA65 == IDENTIFIER: + LA65_55 = self.input.LA(3) + + if (self.synpred117()) : + alt65 = 3 + elif (self.synpred118()) : + alt65 = 4 + + + elif LA65 == 66: + LA65_57 = self.input.LA(3) + + if (self.synpred117()) : + alt65 = 3 + elif (self.synpred118()) : + alt65 = 4 + + + elif LA65 == HEX_LITERAL or LA65 == OCTAL_LITERAL or LA65 == DECIMAL_LITERAL or LA65 == CHARACTER_LITERAL or LA65 == STRING_LITERAL or LA65 == FLOATING_POINT_LITERAL or LA65 == 62 or LA65 == 68 or LA65 == 69 or LA65 == 72 or LA65 == 73 or LA65 == 74 or LA65 == 77 or LA65 == 78 or LA65 == 79: + alt65 = 3 + + elif LA65 == 75: + alt65 = 5 + elif LA65 == 76: + alt65 = 7 + elif LA65 == 72: + alt65 = 8 + elif LA65 == 73: + alt65 = 9 + + if alt65 == 1: + # C.g:407:13: '[' expression ']' + self.match(self.input, 64, self.FOLLOW_64_in_postfix_expression1383) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_postfix_expression1385) + self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 65, self.FOLLOW_65_in_postfix_expression1387) + if self.failed: + return + + + elif alt65 == 2: + # C.g:408:13: '(' a= ')' + self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1401) + if self.failed: + return + a = self.input.LT(1) + self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1405) + if self.failed: + return + if self.backtracking == 0: + self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, a.line, a.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, '') + + + + elif alt65 == 3: + # C.g:409:13: '(' c= argument_expression_list b= ')' + self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1420) + if self.failed: + return + self.following.append(self.FOLLOW_argument_expression_list_in_postfix_expression1424) + c = self.argument_expression_list() + self.following.pop() + if self.failed: + return + b = self.input.LT(1) + self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1428) + if self.failed: + return + if self.backtracking == 0: + self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, b.line, b.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, self.input.toString(c.start,c.stop)) + + + + elif alt65 == 4: + # C.g:410:13: '(' macro_parameter_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1444) + if self.failed: + return + self.following.append(self.FOLLOW_macro_parameter_list_in_postfix_expression1446) + self.macro_parameter_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1448) + if self.failed: + return + + + elif alt65 == 5: + # C.g:411:13: '.' x= IDENTIFIER + self.match(self.input, 75, self.FOLLOW_75_in_postfix_expression1462) + if self.failed: + return + x = self.input.LT(1) + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1466) + if self.failed: + return + if self.backtracking == 0: + self.postfix_expression_stack[-1].FuncCallText += '.' + x.text + + + + elif alt65 == 6: + # C.g:412:13: '*' y= IDENTIFIER + self.match(self.input, 66, self.FOLLOW_66_in_postfix_expression1482) + if self.failed: + return + y = self.input.LT(1) + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1486) + if self.failed: + return + if self.backtracking == 0: + self.postfix_expression_stack[-1].FuncCallText = y.text + + + + elif alt65 == 7: + # C.g:413:13: '->' z= IDENTIFIER + self.match(self.input, 76, self.FOLLOW_76_in_postfix_expression1502) + if self.failed: + return + z = self.input.LT(1) + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1506) + if self.failed: + return + if self.backtracking == 0: + self.postfix_expression_stack[-1].FuncCallText += '->' + z.text + + + + elif alt65 == 8: + # C.g:414:13: '++' + self.match(self.input, 72, self.FOLLOW_72_in_postfix_expression1522) + if self.failed: + return + + + elif alt65 == 9: + # C.g:415:13: '--' + self.match(self.input, 73, self.FOLLOW_73_in_postfix_expression1536) + if self.failed: + return + + + else: + break #loop65 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 41, postfix_expression_StartIndex) + + self.postfix_expression_stack.pop() + pass + + return + + # $ANTLR end postfix_expression + + + # $ANTLR start macro_parameter_list + # C.g:419:1: macro_parameter_list : parameter_declaration ( ',' parameter_declaration )* ; + def macro_parameter_list(self, ): + + macro_parameter_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 42): + return + + # C.g:420:2: ( parameter_declaration ( ',' parameter_declaration )* ) + # C.g:420:4: parameter_declaration ( ',' parameter_declaration )* + self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1559) + self.parameter_declaration() + self.following.pop() + if self.failed: + return + # C.g:420:26: ( ',' parameter_declaration )* + while True: #loop66 + alt66 = 2 + LA66_0 = self.input.LA(1) + + if (LA66_0 == 27) : + alt66 = 1 + + + if alt66 == 1: + # C.g:420:27: ',' parameter_declaration + self.match(self.input, 27, self.FOLLOW_27_in_macro_parameter_list1562) + if self.failed: + return + self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1564) + self.parameter_declaration() + self.following.pop() + if self.failed: + return + + + else: + break #loop66 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 42, macro_parameter_list_StartIndex) + + pass + + return + + # $ANTLR end macro_parameter_list + + + # $ANTLR start unary_operator + # C.g:423:1: unary_operator : ( '&' | '*' | '+' | '-' | '~' | '!' ); + def unary_operator(self, ): + + unary_operator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 43): + return + + # C.g:424:2: ( '&' | '*' | '+' | '-' | '~' | '!' ) + # C.g: + if self.input.LA(1) == 66 or (68 <= self.input.LA(1) <= 69) or (77 <= self.input.LA(1) <= 79): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_unary_operator0 + ) + raise mse + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 43, unary_operator_StartIndex) + + pass + + return + + # $ANTLR end unary_operator + + class primary_expression_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start primary_expression + # C.g:432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' ); + def primary_expression(self, ): + + retval = self.primary_expression_return() + retval.start = self.input.LT(1) + primary_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 44): + return retval + + # C.g:433:2: ( IDENTIFIER | constant | '(' expression ')' ) + alt67 = 3 + LA67 = self.input.LA(1) + if LA67 == IDENTIFIER: + LA67_1 = self.input.LA(2) + + if (LA67_1 == EOF or LA67_1 == 25 or (27 <= LA67_1 <= 28) or LA67_1 == 44 or LA67_1 == 47 or LA67_1 == 53 or (62 <= LA67_1 <= 66) or (68 <= LA67_1 <= 73) or (75 <= LA67_1 <= 77) or (80 <= LA67_1 <= 102)) : + alt67 = 1 + elif (LA67_1 == IDENTIFIER or LA67_1 == STRING_LITERAL) : + alt67 = 2 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 1, self.input) + + raise nvae + + elif LA67 == HEX_LITERAL or LA67 == OCTAL_LITERAL or LA67 == DECIMAL_LITERAL or LA67 == CHARACTER_LITERAL or LA67 == STRING_LITERAL or LA67 == FLOATING_POINT_LITERAL: + alt67 = 2 + elif LA67 == 62: + alt67 = 3 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 0, self.input) + + raise nvae + + if alt67 == 1: + # C.g:433:4: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_primary_expression1613) + if self.failed: + return retval + + + elif alt67 == 2: + # C.g:434:4: constant + self.following.append(self.FOLLOW_constant_in_primary_expression1618) + self.constant() + self.following.pop() + if self.failed: + return retval + + + elif alt67 == 3: + # C.g:435:4: '(' expression ')' + self.match(self.input, 62, self.FOLLOW_62_in_primary_expression1623) + if self.failed: + return retval + self.following.append(self.FOLLOW_expression_in_primary_expression1625) + self.expression() + self.following.pop() + if self.failed: + return retval + self.match(self.input, 63, self.FOLLOW_63_in_primary_expression1627) + if self.failed: + return retval + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 44, primary_expression_StartIndex) + + pass + + return retval + + # $ANTLR end primary_expression + + + # $ANTLR start constant + # C.g:438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL ); + def constant(self, ): + + constant_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 45): + return + + # C.g:439:5: ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL ) + alt72 = 6 + LA72 = self.input.LA(1) + if LA72 == HEX_LITERAL: + alt72 = 1 + elif LA72 == OCTAL_LITERAL: + alt72 = 2 + elif LA72 == DECIMAL_LITERAL: + alt72 = 3 + elif LA72 == CHARACTER_LITERAL: + alt72 = 4 + elif LA72 == IDENTIFIER or LA72 == STRING_LITERAL: + alt72 = 5 + elif LA72 == FLOATING_POINT_LITERAL: + alt72 = 6 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL );", 72, 0, self.input) + + raise nvae + + if alt72 == 1: + # C.g:439:9: HEX_LITERAL + self.match(self.input, HEX_LITERAL, self.FOLLOW_HEX_LITERAL_in_constant1643) + if self.failed: + return + + + elif alt72 == 2: + # C.g:440:9: OCTAL_LITERAL + self.match(self.input, OCTAL_LITERAL, self.FOLLOW_OCTAL_LITERAL_in_constant1653) + if self.failed: + return + + + elif alt72 == 3: + # C.g:441:9: DECIMAL_LITERAL + self.match(self.input, DECIMAL_LITERAL, self.FOLLOW_DECIMAL_LITERAL_in_constant1663) + if self.failed: + return + + + elif alt72 == 4: + # C.g:442:7: CHARACTER_LITERAL + self.match(self.input, CHARACTER_LITERAL, self.FOLLOW_CHARACTER_LITERAL_in_constant1671) + if self.failed: + return + + + elif alt72 == 5: + # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* + # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ + cnt70 = 0 + while True: #loop70 + alt70 = 2 + LA70_0 = self.input.LA(1) + + if (LA70_0 == IDENTIFIER) : + LA70_1 = self.input.LA(2) + + if (LA70_1 == STRING_LITERAL) : + alt70 = 1 + elif (LA70_1 == IDENTIFIER) : + LA70_33 = self.input.LA(3) + + if (self.synpred138()) : + alt70 = 1 + + + + + elif (LA70_0 == STRING_LITERAL) : + alt70 = 1 + + + if alt70 == 1: + # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+ + # C.g:443:8: ( IDENTIFIER )* + while True: #loop68 + alt68 = 2 + LA68_0 = self.input.LA(1) + + if (LA68_0 == IDENTIFIER) : + alt68 = 1 + + + if alt68 == 1: + # C.g:0:0: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1680) + if self.failed: + return + + + else: + break #loop68 + + + # C.g:443:20: ( STRING_LITERAL )+ + cnt69 = 0 + while True: #loop69 + alt69 = 2 + LA69_0 = self.input.LA(1) + + if (LA69_0 == STRING_LITERAL) : + LA69_31 = self.input.LA(2) + + if (self.synpred137()) : + alt69 = 1 + + + + + if alt69 == 1: + # C.g:0:0: STRING_LITERAL + self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_constant1683) + if self.failed: + return + + + else: + if cnt69 >= 1: + break #loop69 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(69, self.input) + raise eee + + cnt69 += 1 + + + + + else: + if cnt70 >= 1: + break #loop70 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(70, self.input) + raise eee + + cnt70 += 1 + + + # C.g:443:38: ( IDENTIFIER )* + while True: #loop71 + alt71 = 2 + LA71_0 = self.input.LA(1) + + if (LA71_0 == IDENTIFIER) : + alt71 = 1 + + + if alt71 == 1: + # C.g:0:0: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1688) + if self.failed: + return + + + else: + break #loop71 + + + + + elif alt72 == 6: + # C.g:444:9: FLOATING_POINT_LITERAL + self.match(self.input, FLOATING_POINT_LITERAL, self.FOLLOW_FLOATING_POINT_LITERAL_in_constant1699) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 45, constant_StartIndex) + + pass + + return + + # $ANTLR end constant + + class expression_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start expression + # C.g:449:1: expression : assignment_expression ( ',' assignment_expression )* ; + def expression(self, ): + + retval = self.expression_return() + retval.start = self.input.LT(1) + expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 46): + return retval + + # C.g:450:2: ( assignment_expression ( ',' assignment_expression )* ) + # C.g:450:4: assignment_expression ( ',' assignment_expression )* + self.following.append(self.FOLLOW_assignment_expression_in_expression1715) + self.assignment_expression() + self.following.pop() + if self.failed: + return retval + # C.g:450:26: ( ',' assignment_expression )* + while True: #loop73 + alt73 = 2 + LA73_0 = self.input.LA(1) + + if (LA73_0 == 27) : + alt73 = 1 + + + if alt73 == 1: + # C.g:450:27: ',' assignment_expression + self.match(self.input, 27, self.FOLLOW_27_in_expression1718) + if self.failed: + return retval + self.following.append(self.FOLLOW_assignment_expression_in_expression1720) + self.assignment_expression() + self.following.pop() + if self.failed: + return retval + + + else: + break #loop73 + + + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 46, expression_StartIndex) + + pass + + return retval + + # $ANTLR end expression + + + # $ANTLR start constant_expression + # C.g:453:1: constant_expression : conditional_expression ; + def constant_expression(self, ): + + constant_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 47): + return + + # C.g:454:2: ( conditional_expression ) + # C.g:454:4: conditional_expression + self.following.append(self.FOLLOW_conditional_expression_in_constant_expression1733) + self.conditional_expression() + self.following.pop() + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 47, constant_expression_StartIndex) + + pass + + return + + # $ANTLR end constant_expression + + + # $ANTLR start assignment_expression + # C.g:457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression ); + def assignment_expression(self, ): + + assignment_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 48): + return + + # C.g:458:2: ( lvalue assignment_operator assignment_expression | conditional_expression ) + alt74 = 2 + LA74 = self.input.LA(1) + if LA74 == IDENTIFIER: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_13 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 13, self.input) + + raise nvae + + elif LA74 == 62: + LA74_14 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 14, self.input) + + raise nvae + + elif LA74 == 75: + LA74_15 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 15, self.input) + + raise nvae + + elif LA74 == 66: + LA74_16 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 16, self.input) + + raise nvae + + elif LA74 == 76: + LA74_17 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 17, self.input) + + raise nvae + + elif LA74 == 72: + LA74_18 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 18, self.input) + + raise nvae + + elif LA74 == 73: + LA74_19 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 19, self.input) + + raise nvae + + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + elif LA74 == STRING_LITERAL: + LA74_21 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 21, self.input) + + raise nvae + + elif LA74 == IDENTIFIER: + LA74_22 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 22, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 1, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_44 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 44, self.input) + + raise nvae + + elif LA74 == 62: + LA74_45 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 45, self.input) + + raise nvae + + elif LA74 == 75: + LA74_46 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 46, self.input) + + raise nvae + + elif LA74 == 66: + LA74_47 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 47, self.input) + + raise nvae + + elif LA74 == 76: + LA74_48 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 48, self.input) + + raise nvae + + elif LA74 == 72: + LA74_49 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 49, self.input) + + raise nvae + + elif LA74 == 73: + LA74_50 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 50, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 2, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_73 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 73, self.input) + + raise nvae + + elif LA74 == 62: + LA74_74 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 74, self.input) + + raise nvae + + elif LA74 == 75: + LA74_75 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 75, self.input) + + raise nvae + + elif LA74 == 66: + LA74_76 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 76, self.input) + + raise nvae + + elif LA74 == 76: + LA74_77 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 77, self.input) + + raise nvae + + elif LA74 == 72: + LA74_78 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 78, self.input) + + raise nvae + + elif LA74 == 73: + LA74_79 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 79, self.input) + + raise nvae + + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 3, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_102 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 102, self.input) + + raise nvae + + elif LA74 == 62: + LA74_103 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 103, self.input) + + raise nvae + + elif LA74 == 75: + LA74_104 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 104, self.input) + + raise nvae + + elif LA74 == 66: + LA74_105 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 105, self.input) + + raise nvae + + elif LA74 == 76: + LA74_106 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 106, self.input) + + raise nvae + + elif LA74 == 72: + LA74_107 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 107, self.input) + + raise nvae + + elif LA74 == 73: + LA74_108 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 108, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 4, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_131 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 131, self.input) + + raise nvae + + elif LA74 == 62: + LA74_132 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 132, self.input) + + raise nvae + + elif LA74 == 75: + LA74_133 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 133, self.input) + + raise nvae + + elif LA74 == 66: + LA74_134 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 134, self.input) + + raise nvae + + elif LA74 == 76: + LA74_135 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 135, self.input) + + raise nvae + + elif LA74 == 72: + LA74_136 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 136, self.input) + + raise nvae + + elif LA74 == 73: + LA74_137 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 137, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 5, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74 = self.input.LA(2) + if LA74 == IDENTIFIER: + LA74_160 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 160, self.input) + + raise nvae + + elif LA74 == 64: + LA74_161 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 161, self.input) + + raise nvae + + elif LA74 == 62: + LA74_162 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 162, self.input) + + raise nvae + + elif LA74 == 75: + LA74_163 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 163, self.input) + + raise nvae + + elif LA74 == 66: + LA74_164 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 164, self.input) + + raise nvae + + elif LA74 == 76: + LA74_165 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 165, self.input) + + raise nvae + + elif LA74 == 72: + LA74_166 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 166, self.input) + + raise nvae + + elif LA74 == 73: + LA74_167 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 167, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + elif LA74 == STRING_LITERAL: + LA74_189 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 189, self.input) + + raise nvae + + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 6, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_191 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 191, self.input) + + raise nvae + + elif LA74 == 62: + LA74_192 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 192, self.input) + + raise nvae + + elif LA74 == 75: + LA74_193 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 193, self.input) + + raise nvae + + elif LA74 == 66: + LA74_194 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 194, self.input) + + raise nvae + + elif LA74 == 76: + LA74_195 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 195, self.input) + + raise nvae + + elif LA74 == 72: + LA74_196 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 196, self.input) + + raise nvae + + elif LA74 == 73: + LA74_197 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 197, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 7, self.input) + + raise nvae + + elif LA74 == 62: + LA74 = self.input.LA(2) + if LA74 == IDENTIFIER: + LA74_220 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 220, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74_221 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 221, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74_222 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 222, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74_223 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 223, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74_224 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 224, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74_225 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 225, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74_226 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 226, self.input) + + raise nvae + + elif LA74 == 62: + LA74_227 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 227, self.input) + + raise nvae + + elif LA74 == 72: + LA74_228 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 228, self.input) + + raise nvae + + elif LA74 == 73: + LA74_229 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 229, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74_230 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 230, self.input) + + raise nvae + + elif LA74 == 74: + LA74_231 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 231, self.input) + + raise nvae + + elif LA74 == 34 or LA74 == 35 or LA74 == 36 or LA74 == 37 or LA74 == 38 or LA74 == 39 or LA74 == 40 or LA74 == 41 or LA74 == 42 or LA74 == 45 or LA74 == 46 or LA74 == 48 or LA74 == 49 or LA74 == 50 or LA74 == 51 or LA74 == 52 or LA74 == 53 or LA74 == 54 or LA74 == 55 or LA74 == 56 or LA74 == 57 or LA74 == 58 or LA74 == 59 or LA74 == 60 or LA74 == 61: + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 8, self.input) + + raise nvae + + elif LA74 == 72: + LA74 = self.input.LA(2) + if LA74 == IDENTIFIER: + LA74_244 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 244, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74_245 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 245, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74_246 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 246, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74_247 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 247, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74_248 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 248, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74_249 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 249, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74_250 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 250, self.input) + + raise nvae + + elif LA74 == 62: + LA74_251 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 251, self.input) + + raise nvae + + elif LA74 == 72: + LA74_252 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 252, self.input) + + raise nvae + + elif LA74 == 73: + LA74_253 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 253, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74_254 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 254, self.input) + + raise nvae + + elif LA74 == 74: + LA74_255 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 255, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 9, self.input) + + raise nvae + + elif LA74 == 73: + LA74 = self.input.LA(2) + if LA74 == IDENTIFIER: + LA74_256 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 256, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74_257 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 257, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74_258 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 258, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74_259 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 259, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74_260 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 260, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74_261 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 261, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74_262 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 262, self.input) + + raise nvae + + elif LA74 == 62: + LA74_263 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 263, self.input) + + raise nvae + + elif LA74 == 72: + LA74_264 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 264, self.input) + + raise nvae + + elif LA74 == 73: + LA74_265 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 265, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74_266 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 266, self.input) + + raise nvae + + elif LA74 == 74: + LA74_267 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 267, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 10, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74 = self.input.LA(2) + if LA74 == 62: + LA74_268 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 268, self.input) + + raise nvae + + elif LA74 == IDENTIFIER: + LA74_269 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 269, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74_270 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 270, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74_271 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 271, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74_272 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 272, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74_273 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 273, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74_274 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 274, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74_275 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 275, self.input) + + raise nvae + + elif LA74 == 72: + LA74_276 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 276, self.input) + + raise nvae + + elif LA74 == 73: + LA74_277 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 277, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74_278 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 278, self.input) + + raise nvae + + elif LA74 == 74: + LA74_279 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 279, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 11, self.input) + + raise nvae + + elif LA74 == 74: + LA74 = self.input.LA(2) + if LA74 == 62: + LA74_280 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 280, self.input) + + raise nvae + + elif LA74 == IDENTIFIER: + LA74_281 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 281, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74_282 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 282, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74_283 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 283, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74_284 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 284, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74_285 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 285, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74_286 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 286, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74_287 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 287, self.input) + + raise nvae + + elif LA74 == 72: + LA74_288 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 288, self.input) + + raise nvae + + elif LA74 == 73: + LA74_289 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 289, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74_290 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 290, self.input) + + raise nvae + + elif LA74 == 74: + LA74_291 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 291, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 12, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 0, self.input) + + raise nvae + + if alt74 == 1: + # C.g:458:4: lvalue assignment_operator assignment_expression + self.following.append(self.FOLLOW_lvalue_in_assignment_expression1744) + self.lvalue() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_assignment_operator_in_assignment_expression1746) + self.assignment_operator() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_assignment_expression_in_assignment_expression1748) + self.assignment_expression() + self.following.pop() + if self.failed: + return + + + elif alt74 == 2: + # C.g:459:4: conditional_expression + self.following.append(self.FOLLOW_conditional_expression_in_assignment_expression1753) + self.conditional_expression() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 48, assignment_expression_StartIndex) + + pass + + return + + # $ANTLR end assignment_expression + + + # $ANTLR start lvalue + # C.g:462:1: lvalue : unary_expression ; + def lvalue(self, ): + + lvalue_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 49): + return + + # C.g:463:2: ( unary_expression ) + # C.g:463:4: unary_expression + self.following.append(self.FOLLOW_unary_expression_in_lvalue1765) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 49, lvalue_StartIndex) + + pass + + return + + # $ANTLR end lvalue + + + # $ANTLR start assignment_operator + # C.g:466:1: assignment_operator : ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' ); + def assignment_operator(self, ): + + assignment_operator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 50): + return + + # C.g:467:2: ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' ) + # C.g: + if self.input.LA(1) == 28 or (80 <= self.input.LA(1) <= 89): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_assignment_operator0 + ) + raise mse + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 50, assignment_operator_StartIndex) + + pass + + return + + # $ANTLR end assignment_operator + + + # $ANTLR start conditional_expression + # C.g:480:1: conditional_expression : e= logical_or_expression ( '?' expression ':' conditional_expression )? ; + def conditional_expression(self, ): + + conditional_expression_StartIndex = self.input.index() + e = None + + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 51): + return + + # C.g:481:2: (e= logical_or_expression ( '?' expression ':' conditional_expression )? ) + # C.g:481:4: e= logical_or_expression ( '?' expression ':' conditional_expression )? + self.following.append(self.FOLLOW_logical_or_expression_in_conditional_expression1839) + e = self.logical_or_expression() + self.following.pop() + if self.failed: + return + # C.g:481:28: ( '?' expression ':' conditional_expression )? + alt75 = 2 + LA75_0 = self.input.LA(1) + + if (LA75_0 == 90) : + alt75 = 1 + if alt75 == 1: + # C.g:481:29: '?' expression ':' conditional_expression + self.match(self.input, 90, self.FOLLOW_90_in_conditional_expression1842) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_conditional_expression1844) + self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 47, self.FOLLOW_47_in_conditional_expression1846) + if self.failed: + return + self.following.append(self.FOLLOW_conditional_expression_in_conditional_expression1848) + self.conditional_expression() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 51, conditional_expression_StartIndex) + + pass + + return + + # $ANTLR end conditional_expression + + class logical_or_expression_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start logical_or_expression + # C.g:484:1: logical_or_expression : logical_and_expression ( '||' logical_and_expression )* ; + def logical_or_expression(self, ): + + retval = self.logical_or_expression_return() + retval.start = self.input.LT(1) + logical_or_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 52): + return retval + + # C.g:485:2: ( logical_and_expression ( '||' logical_and_expression )* ) + # C.g:485:4: logical_and_expression ( '||' logical_and_expression )* + self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1863) + self.logical_and_expression() + self.following.pop() + if self.failed: + return retval + # C.g:485:27: ( '||' logical_and_expression )* + while True: #loop76 + alt76 = 2 + LA76_0 = self.input.LA(1) + + if (LA76_0 == 91) : + alt76 = 1 + + + if alt76 == 1: + # C.g:485:28: '||' logical_and_expression + self.match(self.input, 91, self.FOLLOW_91_in_logical_or_expression1866) + if self.failed: + return retval + self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1868) + self.logical_and_expression() + self.following.pop() + if self.failed: + return retval + + + else: + break #loop76 + + + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 52, logical_or_expression_StartIndex) + + pass + + return retval + + # $ANTLR end logical_or_expression + + + # $ANTLR start logical_and_expression + # C.g:488:1: logical_and_expression : inclusive_or_expression ( '&&' inclusive_or_expression )* ; + def logical_and_expression(self, ): + + logical_and_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 53): + return + + # C.g:489:2: ( inclusive_or_expression ( '&&' inclusive_or_expression )* ) + # C.g:489:4: inclusive_or_expression ( '&&' inclusive_or_expression )* + self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1881) + self.inclusive_or_expression() + self.following.pop() + if self.failed: + return + # C.g:489:28: ( '&&' inclusive_or_expression )* + while True: #loop77 + alt77 = 2 + LA77_0 = self.input.LA(1) + + if (LA77_0 == 92) : + alt77 = 1 + + + if alt77 == 1: + # C.g:489:29: '&&' inclusive_or_expression + self.match(self.input, 92, self.FOLLOW_92_in_logical_and_expression1884) + if self.failed: + return + self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1886) + self.inclusive_or_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop77 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 53, logical_and_expression_StartIndex) + + pass + + return + + # $ANTLR end logical_and_expression + + + # $ANTLR start inclusive_or_expression + # C.g:492:1: inclusive_or_expression : exclusive_or_expression ( '|' exclusive_or_expression )* ; + def inclusive_or_expression(self, ): + + inclusive_or_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 54): + return + + # C.g:493:2: ( exclusive_or_expression ( '|' exclusive_or_expression )* ) + # C.g:493:4: exclusive_or_expression ( '|' exclusive_or_expression )* + self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899) + self.exclusive_or_expression() + self.following.pop() + if self.failed: + return + # C.g:493:28: ( '|' exclusive_or_expression )* + while True: #loop78 + alt78 = 2 + LA78_0 = self.input.LA(1) + + if (LA78_0 == 93) : + alt78 = 1 + + + if alt78 == 1: + # C.g:493:29: '|' exclusive_or_expression + self.match(self.input, 93, self.FOLLOW_93_in_inclusive_or_expression1902) + if self.failed: + return + self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904) + self.exclusive_or_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop78 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 54, inclusive_or_expression_StartIndex) + + pass + + return + + # $ANTLR end inclusive_or_expression + + + # $ANTLR start exclusive_or_expression + # C.g:496:1: exclusive_or_expression : and_expression ( '^' and_expression )* ; + def exclusive_or_expression(self, ): + + exclusive_or_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 55): + return + + # C.g:497:2: ( and_expression ( '^' and_expression )* ) + # C.g:497:4: and_expression ( '^' and_expression )* + self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1917) + self.and_expression() + self.following.pop() + if self.failed: + return + # C.g:497:19: ( '^' and_expression )* + while True: #loop79 + alt79 = 2 + LA79_0 = self.input.LA(1) + + if (LA79_0 == 94) : + alt79 = 1 + + + if alt79 == 1: + # C.g:497:20: '^' and_expression + self.match(self.input, 94, self.FOLLOW_94_in_exclusive_or_expression1920) + if self.failed: + return + self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1922) + self.and_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop79 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 55, exclusive_or_expression_StartIndex) + + pass + + return + + # $ANTLR end exclusive_or_expression + + + # $ANTLR start and_expression + # C.g:500:1: and_expression : equality_expression ( '&' equality_expression )* ; + def and_expression(self, ): + + and_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 56): + return + + # C.g:501:2: ( equality_expression ( '&' equality_expression )* ) + # C.g:501:4: equality_expression ( '&' equality_expression )* + self.following.append(self.FOLLOW_equality_expression_in_and_expression1935) + self.equality_expression() + self.following.pop() + if self.failed: + return + # C.g:501:24: ( '&' equality_expression )* + while True: #loop80 + alt80 = 2 + LA80_0 = self.input.LA(1) + + if (LA80_0 == 77) : + alt80 = 1 + + + if alt80 == 1: + # C.g:501:25: '&' equality_expression + self.match(self.input, 77, self.FOLLOW_77_in_and_expression1938) + if self.failed: + return + self.following.append(self.FOLLOW_equality_expression_in_and_expression1940) + self.equality_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop80 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 56, and_expression_StartIndex) + + pass + + return + + # $ANTLR end and_expression + + + # $ANTLR start equality_expression + # C.g:503:1: equality_expression : relational_expression ( ( '==' | '!=' ) relational_expression )* ; + def equality_expression(self, ): + + equality_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 57): + return + + # C.g:504:2: ( relational_expression ( ( '==' | '!=' ) relational_expression )* ) + # C.g:504:4: relational_expression ( ( '==' | '!=' ) relational_expression )* + self.following.append(self.FOLLOW_relational_expression_in_equality_expression1952) + self.relational_expression() + self.following.pop() + if self.failed: + return + # C.g:504:26: ( ( '==' | '!=' ) relational_expression )* + while True: #loop81 + alt81 = 2 + LA81_0 = self.input.LA(1) + + if ((95 <= LA81_0 <= 96)) : + alt81 = 1 + + + if alt81 == 1: + # C.g:504:27: ( '==' | '!=' ) relational_expression + if (95 <= self.input.LA(1) <= 96): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_equality_expression1955 + ) + raise mse + + + self.following.append(self.FOLLOW_relational_expression_in_equality_expression1961) + self.relational_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop81 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 57, equality_expression_StartIndex) + + pass + + return + + # $ANTLR end equality_expression + + + # $ANTLR start relational_expression + # C.g:507:1: relational_expression : shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* ; + def relational_expression(self, ): + + relational_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 58): + return + + # C.g:508:2: ( shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* ) + # C.g:508:4: shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* + self.following.append(self.FOLLOW_shift_expression_in_relational_expression1975) + self.shift_expression() + self.following.pop() + if self.failed: + return + # C.g:508:21: ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* + while True: #loop82 + alt82 = 2 + LA82_0 = self.input.LA(1) + + if ((97 <= LA82_0 <= 100)) : + alt82 = 1 + + + if alt82 == 1: + # C.g:508:22: ( '<' | '>' | '<=' | '>=' ) shift_expression + if (97 <= self.input.LA(1) <= 100): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_relational_expression1978 + ) + raise mse + + + self.following.append(self.FOLLOW_shift_expression_in_relational_expression1988) + self.shift_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop82 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 58, relational_expression_StartIndex) + + pass + + return + + # $ANTLR end relational_expression + + + # $ANTLR start shift_expression + # C.g:511:1: shift_expression : additive_expression ( ( '<<' | '>>' ) additive_expression )* ; + def shift_expression(self, ): + + shift_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 59): + return + + # C.g:512:2: ( additive_expression ( ( '<<' | '>>' ) additive_expression )* ) + # C.g:512:4: additive_expression ( ( '<<' | '>>' ) additive_expression )* + self.following.append(self.FOLLOW_additive_expression_in_shift_expression2001) + self.additive_expression() + self.following.pop() + if self.failed: + return + # C.g:512:24: ( ( '<<' | '>>' ) additive_expression )* + while True: #loop83 + alt83 = 2 + LA83_0 = self.input.LA(1) + + if ((101 <= LA83_0 <= 102)) : + alt83 = 1 + + + if alt83 == 1: + # C.g:512:25: ( '<<' | '>>' ) additive_expression + if (101 <= self.input.LA(1) <= 102): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_shift_expression2004 + ) + raise mse + + + self.following.append(self.FOLLOW_additive_expression_in_shift_expression2010) + self.additive_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop83 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 59, shift_expression_StartIndex) + + pass + + return + + # $ANTLR end shift_expression + + + # $ANTLR start statement + # C.g:517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration ); + def statement(self, ): + + statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 60): + return + + # C.g:518:2: ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration ) + alt84 = 11 + LA84 = self.input.LA(1) + if LA84 == IDENTIFIER: + LA84 = self.input.LA(2) + if LA84 == 62: + LA84_43 = self.input.LA(3) + + if (self.synpred169()) : + alt84 = 3 + elif (self.synpred173()) : + alt84 = 7 + elif (self.synpred174()) : + alt84 = 8 + elif (True) : + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 43, self.input) + + raise nvae + + elif LA84 == 47: + alt84 = 1 + elif LA84 == STRING_LITERAL or LA84 == 27 or LA84 == 28 or LA84 == 64 or LA84 == 68 or LA84 == 69 or LA84 == 70 or LA84 == 71 or LA84 == 72 or LA84 == 73 or LA84 == 75 or LA84 == 76 or LA84 == 77 or LA84 == 80 or LA84 == 81 or LA84 == 82 or LA84 == 83 or LA84 == 84 or LA84 == 85 or LA84 == 86 or LA84 == 87 or LA84 == 88 or LA84 == 89 or LA84 == 90 or LA84 == 91 or LA84 == 92 or LA84 == 93 or LA84 == 94 or LA84 == 95 or LA84 == 96 or LA84 == 97 or LA84 == 98 or LA84 == 99 or LA84 == 100 or LA84 == 101 or LA84 == 102: + alt84 = 3 + elif LA84 == 66: + LA84_47 = self.input.LA(3) + + if (self.synpred169()) : + alt84 = 3 + elif (True) : + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 47, self.input) + + raise nvae + + elif LA84 == IDENTIFIER: + LA84_53 = self.input.LA(3) + + if (self.synpred169()) : + alt84 = 3 + elif (True) : + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 53, self.input) + + raise nvae + + elif LA84 == 25: + LA84_68 = self.input.LA(3) + + if (self.synpred169()) : + alt84 = 3 + elif (True) : + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 68, self.input) + + raise nvae + + elif LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61: + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 1, self.input) + + raise nvae + + elif LA84 == 106 or LA84 == 107: + alt84 = 1 + elif LA84 == 43: + alt84 = 2 + elif LA84 == HEX_LITERAL or LA84 == OCTAL_LITERAL or LA84 == DECIMAL_LITERAL or LA84 == CHARACTER_LITERAL or LA84 == STRING_LITERAL or LA84 == FLOATING_POINT_LITERAL or LA84 == 25 or LA84 == 62 or LA84 == 66 or LA84 == 68 or LA84 == 69 or LA84 == 72 or LA84 == 73 or LA84 == 74 or LA84 == 77 or LA84 == 78 or LA84 == 79: + alt84 = 3 + elif LA84 == 108 or LA84 == 110: + alt84 = 4 + elif LA84 == 111 or LA84 == 112 or LA84 == 113: + alt84 = 5 + elif LA84 == 114 or LA84 == 115 or LA84 == 116 or LA84 == 117: + alt84 = 6 + elif LA84 == 103: + alt84 = 8 + elif LA84 == 104: + alt84 = 9 + elif LA84 == 105: + alt84 = 10 + elif LA84 == 26 or LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61: + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 0, self.input) + + raise nvae + + if alt84 == 1: + # C.g:518:4: labeled_statement + self.following.append(self.FOLLOW_labeled_statement_in_statement2025) + self.labeled_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 2: + # C.g:519:4: compound_statement + self.following.append(self.FOLLOW_compound_statement_in_statement2030) + self.compound_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 3: + # C.g:520:4: expression_statement + self.following.append(self.FOLLOW_expression_statement_in_statement2035) + self.expression_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 4: + # C.g:521:4: selection_statement + self.following.append(self.FOLLOW_selection_statement_in_statement2040) + self.selection_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 5: + # C.g:522:4: iteration_statement + self.following.append(self.FOLLOW_iteration_statement_in_statement2045) + self.iteration_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 6: + # C.g:523:4: jump_statement + self.following.append(self.FOLLOW_jump_statement_in_statement2050) + self.jump_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 7: + # C.g:524:4: macro_statement + self.following.append(self.FOLLOW_macro_statement_in_statement2055) + self.macro_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 8: + # C.g:525:4: asm2_statement + self.following.append(self.FOLLOW_asm2_statement_in_statement2060) + self.asm2_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 9: + # C.g:526:4: asm1_statement + self.following.append(self.FOLLOW_asm1_statement_in_statement2065) + self.asm1_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 10: + # C.g:527:4: asm_statement + self.following.append(self.FOLLOW_asm_statement_in_statement2070) + self.asm_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 11: + # C.g:528:4: declaration + self.following.append(self.FOLLOW_declaration_in_statement2075) + self.declaration() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 60, statement_StartIndex) + + pass + + return + + # $ANTLR end statement + + + # $ANTLR start asm2_statement + # C.g:531:1: asm2_statement : ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' ; + def asm2_statement(self, ): + + asm2_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 61): + return + + # C.g:532:2: ( ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' ) + # C.g:532:4: ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' + # C.g:532:4: ( '__asm__' )? + alt85 = 2 + LA85_0 = self.input.LA(1) + + if (LA85_0 == 103) : + alt85 = 1 + if alt85 == 1: + # C.g:0:0: '__asm__' + self.match(self.input, 103, self.FOLLOW_103_in_asm2_statement2086) + if self.failed: + return + + + + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_asm2_statement2089) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_asm2_statement2091) + if self.failed: + return + # C.g:532:30: (~ ( ';' ) )* + while True: #loop86 + alt86 = 2 + LA86_0 = self.input.LA(1) + + if (LA86_0 == 63) : + LA86_1 = self.input.LA(2) + + if ((IDENTIFIER <= LA86_1 <= LINE_COMMAND) or (26 <= LA86_1 <= 117)) : + alt86 = 1 + + + elif ((IDENTIFIER <= LA86_0 <= LINE_COMMAND) or (26 <= LA86_0 <= 62) or (64 <= LA86_0 <= 117)) : + alt86 = 1 + + + if alt86 == 1: + # C.g:532:31: ~ ( ';' ) + if (IDENTIFIER <= self.input.LA(1) <= LINE_COMMAND) or (26 <= self.input.LA(1) <= 117): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_asm2_statement2094 + ) + raise mse + + + + + else: + break #loop86 + + + self.match(self.input, 63, self.FOLLOW_63_in_asm2_statement2101) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_asm2_statement2103) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 61, asm2_statement_StartIndex) + + pass + + return + + # $ANTLR end asm2_statement + + + # $ANTLR start asm1_statement + # C.g:535:1: asm1_statement : '_asm' '{' (~ ( '}' ) )* '}' ; + def asm1_statement(self, ): + + asm1_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 62): + return + + # C.g:536:2: ( '_asm' '{' (~ ( '}' ) )* '}' ) + # C.g:536:4: '_asm' '{' (~ ( '}' ) )* '}' + self.match(self.input, 104, self.FOLLOW_104_in_asm1_statement2115) + if self.failed: + return + self.match(self.input, 43, self.FOLLOW_43_in_asm1_statement2117) + if self.failed: + return + # C.g:536:15: (~ ( '}' ) )* + while True: #loop87 + alt87 = 2 + LA87_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA87_0 <= 43) or (45 <= LA87_0 <= 117)) : + alt87 = 1 + + + if alt87 == 1: + # C.g:536:16: ~ ( '}' ) + if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_asm1_statement2120 + ) + raise mse + + + + + else: + break #loop87 + + + self.match(self.input, 44, self.FOLLOW_44_in_asm1_statement2127) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 62, asm1_statement_StartIndex) + + pass + + return + + # $ANTLR end asm1_statement + + + # $ANTLR start asm_statement + # C.g:539:1: asm_statement : '__asm' '{' (~ ( '}' ) )* '}' ; + def asm_statement(self, ): + + asm_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 63): + return + + # C.g:540:2: ( '__asm' '{' (~ ( '}' ) )* '}' ) + # C.g:540:4: '__asm' '{' (~ ( '}' ) )* '}' + self.match(self.input, 105, self.FOLLOW_105_in_asm_statement2138) + if self.failed: + return + self.match(self.input, 43, self.FOLLOW_43_in_asm_statement2140) + if self.failed: + return + # C.g:540:16: (~ ( '}' ) )* + while True: #loop88 + alt88 = 2 + LA88_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA88_0 <= 43) or (45 <= LA88_0 <= 117)) : + alt88 = 1 + + + if alt88 == 1: + # C.g:540:17: ~ ( '}' ) + if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_asm_statement2143 + ) + raise mse + + + + + else: + break #loop88 + + + self.match(self.input, 44, self.FOLLOW_44_in_asm_statement2150) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 63, asm_statement_StartIndex) + + pass + + return + + # $ANTLR end asm_statement + + + # $ANTLR start macro_statement + # C.g:543:1: macro_statement : IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' ; + def macro_statement(self, ): + + macro_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 64): + return + + # C.g:544:2: ( IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' ) + # C.g:544:4: IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_macro_statement2162) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_macro_statement2164) + if self.failed: + return + # C.g:544:19: ( declaration )* + while True: #loop89 + alt89 = 2 + LA89 = self.input.LA(1) + if LA89 == IDENTIFIER: + LA89 = self.input.LA(2) + if LA89 == 62: + LA89_45 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_47 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 66: + LA89_50 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_68 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_71 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_72 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_73 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_74 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_75 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_76 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_77 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_78 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_79 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_80 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_81 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_82 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_83 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_84 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_85 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_86 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 26: + LA89 = self.input.LA(2) + if LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_87 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_88 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_89 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_90 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_91 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_92 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_93 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_94 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_95 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_96 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_97 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_98 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_99 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_100 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 66: + LA89_101 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_102 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_103 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_104 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_105 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_106 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_107 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_108 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_109 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_110 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_111 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_112 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_113 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_114 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_115 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_116 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_117 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_118 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_119 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_120 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_121 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_122 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_123 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_124 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_125 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 34: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_126 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_127 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_128 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_129 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_130 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_131 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_132 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_133 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_134 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_135 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_136 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_137 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_138 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_139 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_140 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_141 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_142 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_143 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_144 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_145 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 35: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_146 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_147 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_148 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_149 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_150 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_151 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_152 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_153 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_154 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_155 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_156 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_157 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_158 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_159 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_160 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_161 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_162 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_163 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_164 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_165 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 36: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_166 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_167 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_168 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_169 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_170 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_171 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_172 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_173 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_174 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_175 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_176 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_177 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_178 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_179 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_180 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_181 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_182 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_183 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_184 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_185 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 37: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_186 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_187 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_188 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_189 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_190 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_191 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_192 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_193 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_194 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_195 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_196 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_197 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_198 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_199 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_200 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_201 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_202 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_203 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_204 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_205 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 38: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_206 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_207 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_208 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_209 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_210 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_211 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_212 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_213 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_214 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_215 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_216 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_217 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_218 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_219 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_220 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_221 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_222 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_223 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_224 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_225 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 39: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_226 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_227 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_228 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_229 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_230 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_231 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_232 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_233 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_234 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_235 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_236 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_237 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_238 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_239 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_240 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_241 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_242 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_243 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_244 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_245 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 40: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_246 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_247 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_248 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_249 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_250 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_251 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_252 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_253 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_254 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_255 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_256 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_257 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_258 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_259 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_260 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_261 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_262 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_263 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_264 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_265 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 41: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_266 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_267 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_268 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_269 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_270 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_271 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_272 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_273 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_274 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_275 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_276 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_277 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_278 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_279 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_280 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_281 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_282 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_283 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_284 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_285 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 42: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_286 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_287 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_288 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_289 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_290 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_291 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_292 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_293 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_294 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_295 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_296 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_297 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_298 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_299 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_300 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_301 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_302 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_303 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_304 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_305 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 45 or LA89 == 46: + LA89_40 = self.input.LA(2) + + if (LA89_40 == IDENTIFIER) : + LA89_306 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif (LA89_40 == 43) : + LA89_307 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + + elif LA89 == 48: + LA89_41 = self.input.LA(2) + + if (LA89_41 == 43) : + LA89_308 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif (LA89_41 == IDENTIFIER) : + LA89_309 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 58 or LA89 == 59 or LA89 == 60 or LA89 == 61: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_310 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_311 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_312 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_313 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_314 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_315 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_316 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_317 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_318 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_319 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_320 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_321 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_322 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_323 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_324 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_325 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_326 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_327 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_328 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_329 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + + if alt89 == 1: + # C.g:0:0: declaration + self.following.append(self.FOLLOW_declaration_in_macro_statement2166) + self.declaration() + self.following.pop() + if self.failed: + return + + + else: + break #loop89 + + + # C.g:544:33: ( statement_list )? + alt90 = 2 + LA90 = self.input.LA(1) + if LA90 == IDENTIFIER: + LA90 = self.input.LA(2) + if LA90 == 25 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 45 or LA90 == 46 or LA90 == 47 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61: + alt90 = 1 + elif LA90 == 62: + LA90_45 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_46 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == IDENTIFIER: + LA90_47 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 64: + LA90_48 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_49 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_50 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_51 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_52 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_53 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_54 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_55 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_56 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_57 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_58 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_59 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_60 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_61 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_62 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_63 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_64 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_65 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_66 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_67 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_70 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25 or LA90 == 26 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 43 or LA90 == 45 or LA90 == 46 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61 or LA90 == 103 or LA90 == 104 or LA90 == 105 or LA90 == 106 or LA90 == 107 or LA90 == 108 or LA90 == 110 or LA90 == 111 or LA90 == 112 or LA90 == 113 or LA90 == 114 or LA90 == 115 or LA90 == 116 or LA90 == 117: + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90 = self.input.LA(2) + if LA90 == 64: + LA90_87 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_88 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_89 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_90 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_91 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_92 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_93 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_94 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_95 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_96 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_97 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_98 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_99 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_100 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_101 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_102 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_103 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_104 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_105 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_106 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_107 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_108 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90 = self.input.LA(2) + if LA90 == 64: + LA90_111 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_112 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_113 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_114 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_115 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_116 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_117 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_118 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_119 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_120 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_121 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_122 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_123 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_124 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_125 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_126 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_127 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_128 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_129 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_130 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_131 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_134 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90 = self.input.LA(2) + if LA90 == 64: + LA90_135 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_136 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_137 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_138 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_139 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_140 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_141 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_142 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_143 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_144 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_145 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_146 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_147 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_148 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_149 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_150 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_151 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_152 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_153 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_154 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_155 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_156 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90 = self.input.LA(2) + if LA90 == 64: + LA90_159 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_160 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_161 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_162 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_163 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_164 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_165 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_166 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_167 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_168 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_169 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_170 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_171 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_172 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_173 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_174 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_175 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_176 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_177 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_178 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_179 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_181 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90 = self.input.LA(2) + if LA90 == IDENTIFIER: + LA90_183 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 64: + LA90_184 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_185 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_186 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_187 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_188 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_189 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_190 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_191 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_192 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_193 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_194 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_195 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_196 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_197 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_198 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_199 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_200 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_201 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_202 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_203 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_204 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_205 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_206 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90 = self.input.LA(2) + if LA90 == 64: + LA90_209 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_210 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_211 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_212 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_213 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_214 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_215 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_216 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_217 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_218 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_219 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_220 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_221 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_222 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_223 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_224 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_225 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_226 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_227 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_228 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_229 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_230 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == 62: + LA90 = self.input.LA(2) + if LA90 == IDENTIFIER: + LA90_233 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90_234 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90_235 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90_236 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90_237 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_238 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90_239 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_240 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_241 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_242 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90_243 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90_244 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61: + LA90_245 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 34: + LA90_246 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 35: + LA90_247 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 36: + LA90_248 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 37: + LA90_249 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 38: + LA90_250 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 39: + LA90_251 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 40: + LA90_252 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 41: + LA90_253 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 42: + LA90_254 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 45 or LA90 == 46: + LA90_255 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 48: + LA90_256 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90 = self.input.LA(2) + if LA90 == IDENTIFIER: + LA90_257 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90_258 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90_259 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90_260 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90_261 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_262 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90_263 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_264 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_265 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_266 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90_267 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90_268 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90 = self.input.LA(2) + if LA90 == IDENTIFIER: + LA90_269 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90_270 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90_271 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90_272 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90_273 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_274 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90_275 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_276 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_277 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_278 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90_279 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90_280 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90 = self.input.LA(2) + if LA90 == 62: + LA90_281 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == IDENTIFIER: + LA90_282 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90_283 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90_284 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90_285 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90_286 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_287 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90_288 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_289 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_290 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90_291 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90_292 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90 = self.input.LA(2) + if LA90 == 62: + LA90_293 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == IDENTIFIER: + LA90_294 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90_295 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90_296 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90_297 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90_298 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_299 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90_300 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_301 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_302 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90_303 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90_304 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + if alt90 == 1: + # C.g:0:0: statement_list + self.following.append(self.FOLLOW_statement_list_in_macro_statement2170) + self.statement_list() + self.following.pop() + if self.failed: + return + + + + # C.g:544:49: ( expression )? + alt91 = 2 + LA91_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA91_0 <= FLOATING_POINT_LITERAL) or LA91_0 == 62 or LA91_0 == 66 or (68 <= LA91_0 <= 69) or (72 <= LA91_0 <= 74) or (77 <= LA91_0 <= 79)) : + alt91 = 1 + if alt91 == 1: + # C.g:0:0: expression + self.following.append(self.FOLLOW_expression_in_macro_statement2173) + self.expression() + self.following.pop() + if self.failed: + return + + + + self.match(self.input, 63, self.FOLLOW_63_in_macro_statement2176) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 64, macro_statement_StartIndex) + + pass + + return + + # $ANTLR end macro_statement + + + # $ANTLR start labeled_statement + # C.g:547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement ); + def labeled_statement(self, ): + + labeled_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 65): + return + + # C.g:548:2: ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement ) + alt92 = 3 + LA92 = self.input.LA(1) + if LA92 == IDENTIFIER: + alt92 = 1 + elif LA92 == 106: + alt92 = 2 + elif LA92 == 107: + alt92 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement );", 92, 0, self.input) + + raise nvae + + if alt92 == 1: + # C.g:548:4: IDENTIFIER ':' statement + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_labeled_statement2188) + if self.failed: + return + self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2190) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_labeled_statement2192) + self.statement() + self.following.pop() + if self.failed: + return + + + elif alt92 == 2: + # C.g:549:4: 'case' constant_expression ':' statement + self.match(self.input, 106, self.FOLLOW_106_in_labeled_statement2197) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_labeled_statement2199) + self.constant_expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2201) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_labeled_statement2203) + self.statement() + self.following.pop() + if self.failed: + return + + + elif alt92 == 3: + # C.g:550:4: 'default' ':' statement + self.match(self.input, 107, self.FOLLOW_107_in_labeled_statement2208) + if self.failed: + return + self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2210) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_labeled_statement2212) + self.statement() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 65, labeled_statement_StartIndex) + + pass + + return + + # $ANTLR end labeled_statement + + class compound_statement_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start compound_statement + # C.g:553:1: compound_statement : '{' ( declaration )* ( statement_list )? '}' ; + def compound_statement(self, ): + + retval = self.compound_statement_return() + retval.start = self.input.LT(1) + compound_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 66): + return retval + + # C.g:554:2: ( '{' ( declaration )* ( statement_list )? '}' ) + # C.g:554:4: '{' ( declaration )* ( statement_list )? '}' + self.match(self.input, 43, self.FOLLOW_43_in_compound_statement2223) + if self.failed: + return retval + # C.g:554:8: ( declaration )* + while True: #loop93 + alt93 = 2 + LA93 = self.input.LA(1) + if LA93 == IDENTIFIER: + LA93 = self.input.LA(2) + if LA93 == 62: + LA93_44 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_47 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 66: + LA93_48 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_49 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_50 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_51 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_52 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_53 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_54 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_55 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_56 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_57 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_58 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_59 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_60 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_61 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_62 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_63 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_64 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_65 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 26: + LA93 = self.input.LA(2) + if LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_86 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_87 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_88 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_89 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_90 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_91 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_92 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_93 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_94 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_95 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_96 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_97 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_98 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_99 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 66: + LA93_100 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_101 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_102 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_103 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_104 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_105 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_106 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_107 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_108 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_109 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_110 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_111 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_112 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_113 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_114 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_115 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_116 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_117 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_118 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_119 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_120 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_121 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_122 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_123 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_124 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 34: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_125 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_126 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_127 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_128 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_129 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_130 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_131 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_132 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_133 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_134 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_135 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_136 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_137 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_138 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_139 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_140 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_141 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_142 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_143 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_144 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 35: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_145 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_146 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_147 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_148 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_149 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_150 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_151 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_152 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_153 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_154 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_155 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_156 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_157 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_158 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_159 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_160 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_161 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_162 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_163 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_164 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 36: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_165 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_166 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_167 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_168 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_169 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_170 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_171 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_172 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_173 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_174 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_175 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_176 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_177 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_178 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_179 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_180 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_181 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_182 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_183 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_184 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 37: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_185 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_186 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_187 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_188 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_189 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_190 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_191 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_192 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_193 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_194 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_195 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_196 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_197 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_198 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_199 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_200 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_201 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_202 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_203 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_204 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 38: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_205 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_206 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_207 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_208 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_209 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_210 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_211 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_212 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_213 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_214 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_215 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_216 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_217 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_218 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_219 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_220 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_221 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_222 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_223 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_224 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 39: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_225 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_226 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_227 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_228 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_229 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_230 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_231 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_232 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_233 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_234 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_235 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_236 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_237 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_238 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_239 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_240 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_241 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_242 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_243 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_244 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 40: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_245 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_246 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_247 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_248 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_249 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_250 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_251 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_252 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_253 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_254 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_255 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_256 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_257 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_258 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_259 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_260 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_261 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_262 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_263 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_264 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 41: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_265 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_266 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_267 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_268 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_269 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_270 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_271 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_272 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_273 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_274 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_275 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_276 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_277 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_278 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_279 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_280 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_281 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_282 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_283 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_284 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 42: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_285 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_286 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_287 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_288 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_289 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_290 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_291 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_292 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_293 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_294 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_295 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_296 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_297 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_298 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_299 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_300 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_301 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_302 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_303 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_304 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 45 or LA93 == 46: + LA93_40 = self.input.LA(2) + + if (LA93_40 == IDENTIFIER) : + LA93_305 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif (LA93_40 == 43) : + LA93_306 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + + elif LA93 == 48: + LA93_41 = self.input.LA(2) + + if (LA93_41 == 43) : + LA93_307 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif (LA93_41 == IDENTIFIER) : + LA93_308 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 58 or LA93 == 59 or LA93 == 60 or LA93 == 61: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_309 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_310 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_311 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_312 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_313 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_314 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_315 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_316 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_317 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_318 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_319 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_320 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_321 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_322 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_323 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_324 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_325 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_326 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_327 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_328 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + + if alt93 == 1: + # C.g:0:0: declaration + self.following.append(self.FOLLOW_declaration_in_compound_statement2225) + self.declaration() + self.following.pop() + if self.failed: + return retval + + + else: + break #loop93 + + + # C.g:554:21: ( statement_list )? + alt94 = 2 + LA94_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA94_0 <= FLOATING_POINT_LITERAL) or (25 <= LA94_0 <= 26) or (29 <= LA94_0 <= 43) or (45 <= LA94_0 <= 46) or (48 <= LA94_0 <= 62) or LA94_0 == 66 or (68 <= LA94_0 <= 69) or (72 <= LA94_0 <= 74) or (77 <= LA94_0 <= 79) or (103 <= LA94_0 <= 108) or (110 <= LA94_0 <= 117)) : + alt94 = 1 + if alt94 == 1: + # C.g:0:0: statement_list + self.following.append(self.FOLLOW_statement_list_in_compound_statement2228) + self.statement_list() + self.following.pop() + if self.failed: + return retval + + + + self.match(self.input, 44, self.FOLLOW_44_in_compound_statement2231) + if self.failed: + return retval + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 66, compound_statement_StartIndex) + + pass + + return retval + + # $ANTLR end compound_statement + + + # $ANTLR start statement_list + # C.g:557:1: statement_list : ( statement )+ ; + def statement_list(self, ): + + statement_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 67): + return + + # C.g:558:2: ( ( statement )+ ) + # C.g:558:4: ( statement )+ + # C.g:558:4: ( statement )+ + cnt95 = 0 + while True: #loop95 + alt95 = 2 + LA95 = self.input.LA(1) + if LA95 == IDENTIFIER: + LA95 = self.input.LA(2) + if LA95 == 62: + LA95_46 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 45 or LA95 == 46 or LA95 == 47 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61: + alt95 = 1 + elif LA95 == STRING_LITERAL: + LA95_48 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == IDENTIFIER: + LA95_49 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 64: + LA95_50 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_51 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_52 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_53 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_54 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_55 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_56 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_57 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_58 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_59 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_60 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_61 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_62 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_63 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_64 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_65 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_66 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_67 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_68 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_69 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_88 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == HEX_LITERAL: + LA95 = self.input.LA(2) + if LA95 == 64: + LA95_89 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_90 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_91 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_92 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_93 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_94 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_95 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_96 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_97 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_98 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_99 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_100 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_101 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_102 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_103 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_104 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_105 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_106 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_107 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_108 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_109 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_110 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + + elif LA95 == OCTAL_LITERAL: + LA95 = self.input.LA(2) + if LA95 == 64: + LA95_113 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_114 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_115 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_116 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_117 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_118 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_119 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_120 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_121 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_122 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_123 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_124 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_125 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_126 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_127 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_128 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_129 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_130 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_131 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_132 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_133 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_135 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + + elif LA95 == DECIMAL_LITERAL: + LA95 = self.input.LA(2) + if LA95 == 64: + LA95_137 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_138 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_139 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_140 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_141 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_142 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_143 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_144 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_145 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_146 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_147 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_148 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_149 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_150 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_151 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_152 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_153 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_154 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_155 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_156 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_157 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_158 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + + elif LA95 == CHARACTER_LITERAL: + LA95 = self.input.LA(2) + if LA95 == 64: + LA95_161 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_162 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_163 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_164 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_165 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_166 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_167 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_168 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_169 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_170 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_171 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_172 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_173 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_174 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_175 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_176 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_177 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_178 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_179 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_180 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_181 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_182 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + + elif LA95 == STRING_LITERAL: + LA95 = self.input.LA(2) + if LA95 == IDENTIFIER: + LA95_185 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 64: + LA95_186 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_187 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_188 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_189 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_190 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_191 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_192 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_193 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_194 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_195 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_196 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_197 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_198 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_199 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_200 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_201 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_202 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_203 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_204 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_205 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_206 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + elif LA95 == STRING_LITERAL: + LA95_208 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_209 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95 = self.input.LA(2) + if LA95 == 64: + LA95_211 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_212 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_213 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_214 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_215 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_216 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_217 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_218 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_219 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_220 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_221 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_222 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_223 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_224 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_225 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_226 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_227 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_228 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_229 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_230 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_231 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_234 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 62: + LA95 = self.input.LA(2) + if LA95 == IDENTIFIER: + LA95_235 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == HEX_LITERAL: + LA95_236 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == OCTAL_LITERAL: + LA95_237 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == DECIMAL_LITERAL: + LA95_238 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == CHARACTER_LITERAL: + LA95_239 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == STRING_LITERAL: + LA95_240 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95_241 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_242 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_243 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_244 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95_245 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 74: + LA95_246 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61: + LA95_247 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 34: + LA95_248 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 35: + LA95_249 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 36: + LA95_250 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 37: + LA95_251 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 38: + LA95_252 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 39: + LA95_253 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 40: + LA95_254 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 41: + LA95_255 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 42: + LA95_256 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 45 or LA95 == 46: + LA95_257 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 48: + LA95_258 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 72: + LA95 = self.input.LA(2) + if LA95 == IDENTIFIER: + LA95_259 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == HEX_LITERAL: + LA95_260 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == OCTAL_LITERAL: + LA95_261 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == DECIMAL_LITERAL: + LA95_262 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == CHARACTER_LITERAL: + LA95_263 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == STRING_LITERAL: + LA95_264 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95_265 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_266 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_267 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_268 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95_269 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 74: + LA95_270 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 73: + LA95 = self.input.LA(2) + if LA95 == IDENTIFIER: + LA95_271 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == HEX_LITERAL: + LA95_272 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == OCTAL_LITERAL: + LA95_273 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == DECIMAL_LITERAL: + LA95_274 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == CHARACTER_LITERAL: + LA95_275 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == STRING_LITERAL: + LA95_276 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95_277 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_278 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_279 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_280 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95_281 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 74: + LA95_282 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95 = self.input.LA(2) + if LA95 == 62: + LA95_283 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == IDENTIFIER: + LA95_284 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == HEX_LITERAL: + LA95_285 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == OCTAL_LITERAL: + LA95_286 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == DECIMAL_LITERAL: + LA95_287 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == CHARACTER_LITERAL: + LA95_288 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == STRING_LITERAL: + LA95_289 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95_290 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_291 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_292 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95_293 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 74: + LA95_294 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 74: + LA95 = self.input.LA(2) + if LA95 == 62: + LA95_295 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == IDENTIFIER: + LA95_296 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == HEX_LITERAL: + LA95_297 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == OCTAL_LITERAL: + LA95_298 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == DECIMAL_LITERAL: + LA95_299 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == CHARACTER_LITERAL: + LA95_300 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == STRING_LITERAL: + LA95_301 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95_302 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_303 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_304 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95_305 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 74: + LA95_306 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 25 or LA95 == 26 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 43 or LA95 == 45 or LA95 == 46 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61 or LA95 == 103 or LA95 == 104 or LA95 == 105 or LA95 == 106 or LA95 == 107 or LA95 == 108 or LA95 == 110 or LA95 == 111 or LA95 == 112 or LA95 == 113 or LA95 == 114 or LA95 == 115 or LA95 == 116 or LA95 == 117: + alt95 = 1 + + if alt95 == 1: + # C.g:0:0: statement + self.following.append(self.FOLLOW_statement_in_statement_list2242) + self.statement() + self.following.pop() + if self.failed: + return + + + else: + if cnt95 >= 1: + break #loop95 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(95, self.input) + raise eee + + cnt95 += 1 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 67, statement_list_StartIndex) + + pass + + return + + # $ANTLR end statement_list + + class expression_statement_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start expression_statement + # C.g:561:1: expression_statement : ( ';' | expression ';' ); + def expression_statement(self, ): + + retval = self.expression_statement_return() + retval.start = self.input.LT(1) + expression_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 68): + return retval + + # C.g:562:2: ( ';' | expression ';' ) + alt96 = 2 + LA96_0 = self.input.LA(1) + + if (LA96_0 == 25) : + alt96 = 1 + elif ((IDENTIFIER <= LA96_0 <= FLOATING_POINT_LITERAL) or LA96_0 == 62 or LA96_0 == 66 or (68 <= LA96_0 <= 69) or (72 <= LA96_0 <= 74) or (77 <= LA96_0 <= 79)) : + alt96 = 2 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("561:1: expression_statement : ( ';' | expression ';' );", 96, 0, self.input) + + raise nvae + + if alt96 == 1: + # C.g:562:4: ';' + self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2254) + if self.failed: + return retval + + + elif alt96 == 2: + # C.g:563:4: expression ';' + self.following.append(self.FOLLOW_expression_in_expression_statement2259) + self.expression() + self.following.pop() + if self.failed: + return retval + self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2261) + if self.failed: + return retval + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 68, expression_statement_StartIndex) + + pass + + return retval + + # $ANTLR end expression_statement + + + # $ANTLR start selection_statement + # C.g:566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement ); + def selection_statement(self, ): + + selection_statement_StartIndex = self.input.index() + e = None + + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 69): + return + + # C.g:567:2: ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement ) + alt98 = 2 + LA98_0 = self.input.LA(1) + + if (LA98_0 == 108) : + alt98 = 1 + elif (LA98_0 == 110) : + alt98 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement );", 98, 0, self.input) + + raise nvae + + if alt98 == 1: + # C.g:567:4: 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? + self.match(self.input, 108, self.FOLLOW_108_in_selection_statement2272) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2274) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_selection_statement2278) + e = self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2280) + if self.failed: + return + if self.backtracking == 0: + self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + self.following.append(self.FOLLOW_statement_in_selection_statement2284) + self.statement() + self.following.pop() + if self.failed: + return + # C.g:567:167: ( options {k=1; backtrack=false; } : 'else' statement )? + alt97 = 2 + LA97_0 = self.input.LA(1) + + if (LA97_0 == 109) : + alt97 = 1 + if alt97 == 1: + # C.g:567:200: 'else' statement + self.match(self.input, 109, self.FOLLOW_109_in_selection_statement2299) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_selection_statement2301) + self.statement() + self.following.pop() + if self.failed: + return + + + + + + elif alt98 == 2: + # C.g:568:4: 'switch' '(' expression ')' statement + self.match(self.input, 110, self.FOLLOW_110_in_selection_statement2308) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2310) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_selection_statement2312) + self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2314) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_selection_statement2316) + self.statement() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 69, selection_statement_StartIndex) + + pass + + return + + # $ANTLR end selection_statement + + + # $ANTLR start iteration_statement + # C.g:571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement ); + def iteration_statement(self, ): + + iteration_statement_StartIndex = self.input.index() + e = None + + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 70): + return + + # C.g:572:2: ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement ) + alt100 = 3 + LA100 = self.input.LA(1) + if LA100 == 111: + alt100 = 1 + elif LA100 == 112: + alt100 = 2 + elif LA100 == 113: + alt100 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement );", 100, 0, self.input) + + raise nvae + + if alt100 == 1: + # C.g:572:4: 'while' '(' e= expression ')' statement + self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2327) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2329) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_iteration_statement2333) + e = self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2335) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_iteration_statement2337) + self.statement() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + + + elif alt100 == 2: + # C.g:573:4: 'do' statement 'while' '(' e= expression ')' ';' + self.match(self.input, 112, self.FOLLOW_112_in_iteration_statement2344) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_iteration_statement2346) + self.statement() + self.following.pop() + if self.failed: + return + self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2348) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2350) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_iteration_statement2354) + e = self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2356) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_iteration_statement2358) + if self.failed: + return + if self.backtracking == 0: + self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + + + elif alt100 == 3: + # C.g:574:4: 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement + self.match(self.input, 113, self.FOLLOW_113_in_iteration_statement2365) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2367) + if self.failed: + return + self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2369) + self.expression_statement() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2373) + e = self.expression_statement() + self.following.pop() + if self.failed: + return + # C.g:574:58: ( expression )? + alt99 = 2 + LA99_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA99_0 <= FLOATING_POINT_LITERAL) or LA99_0 == 62 or LA99_0 == 66 or (68 <= LA99_0 <= 69) or (72 <= LA99_0 <= 74) or (77 <= LA99_0 <= 79)) : + alt99 = 1 + if alt99 == 1: + # C.g:0:0: expression + self.following.append(self.FOLLOW_expression_in_iteration_statement2375) + self.expression() + self.following.pop() + if self.failed: + return + + + + self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2378) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_iteration_statement2380) + self.statement() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 70, iteration_statement_StartIndex) + + pass + + return + + # $ANTLR end iteration_statement + + + # $ANTLR start jump_statement + # C.g:577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' ); + def jump_statement(self, ): + + jump_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 71): + return + + # C.g:578:2: ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' ) + alt101 = 5 + LA101 = self.input.LA(1) + if LA101 == 114: + alt101 = 1 + elif LA101 == 115: + alt101 = 2 + elif LA101 == 116: + alt101 = 3 + elif LA101 == 117: + LA101_4 = self.input.LA(2) + + if (LA101_4 == 25) : + alt101 = 4 + elif ((IDENTIFIER <= LA101_4 <= FLOATING_POINT_LITERAL) or LA101_4 == 62 or LA101_4 == 66 or (68 <= LA101_4 <= 69) or (72 <= LA101_4 <= 74) or (77 <= LA101_4 <= 79)) : + alt101 = 5 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 4, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 0, self.input) + + raise nvae + + if alt101 == 1: + # C.g:578:4: 'goto' IDENTIFIER ';' + self.match(self.input, 114, self.FOLLOW_114_in_jump_statement2393) + if self.failed: + return + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_jump_statement2395) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2397) + if self.failed: + return + + + elif alt101 == 2: + # C.g:579:4: 'continue' ';' + self.match(self.input, 115, self.FOLLOW_115_in_jump_statement2402) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2404) + if self.failed: + return + + + elif alt101 == 3: + # C.g:580:4: 'break' ';' + self.match(self.input, 116, self.FOLLOW_116_in_jump_statement2409) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2411) + if self.failed: + return + + + elif alt101 == 4: + # C.g:581:4: 'return' ';' + self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2416) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2418) + if self.failed: + return + + + elif alt101 == 5: + # C.g:582:4: 'return' expression ';' + self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2423) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_jump_statement2425) + self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2427) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 71, jump_statement_StartIndex) + + pass + + return + + # $ANTLR end jump_statement + + # $ANTLR start synpred2 + def synpred2_fragment(self, ): + # C.g:119:6: ( declaration_specifiers ) + # C.g:119:6: declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_synpred2100) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred2 + + + + # $ANTLR start synpred4 + def synpred4_fragment(self, ): + # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' ) + # C.g:119:6: ( declaration_specifiers )? declarator ( declaration )* '{' + # C.g:119:6: ( declaration_specifiers )? + alt102 = 2 + LA102 = self.input.LA(1) + if LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33 or LA102 == 34 or LA102 == 35 or LA102 == 36 or LA102 == 37 or LA102 == 38 or LA102 == 39 or LA102 == 40 or LA102 == 41 or LA102 == 42 or LA102 == 45 or LA102 == 46 or LA102 == 48 or LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61: + alt102 = 1 + elif LA102 == IDENTIFIER: + LA102 = self.input.LA(2) + if LA102 == 62: + LA102_21 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33: + LA102_23 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 34: + LA102_24 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 35: + LA102_25 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 36: + LA102_26 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 37: + LA102_27 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 38: + LA102_28 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 39: + LA102_29 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 40: + LA102_30 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 41: + LA102_31 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 42: + LA102_32 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 45 or LA102 == 46: + LA102_33 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 48: + LA102_34 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == IDENTIFIER: + LA102_35 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 58: + LA102_36 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 66: + alt102 = 1 + elif LA102 == 59: + LA102_39 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 60: + LA102_40 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61: + LA102_41 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 58: + LA102_14 = self.input.LA(2) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 59: + LA102_16 = self.input.LA(2) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 60: + LA102_17 = self.input.LA(2) + + if (self.synpred2()) : + alt102 = 1 + if alt102 == 1: + # C.g:0:0: declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_synpred4100) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + + + + self.following.append(self.FOLLOW_declarator_in_synpred4103) + self.declarator() + self.following.pop() + if self.failed: + return + # C.g:119:41: ( declaration )* + while True: #loop103 + alt103 = 2 + LA103_0 = self.input.LA(1) + + if (LA103_0 == IDENTIFIER or LA103_0 == 26 or (29 <= LA103_0 <= 42) or (45 <= LA103_0 <= 46) or (48 <= LA103_0 <= 61)) : + alt103 = 1 + + + if alt103 == 1: + # C.g:0:0: declaration + self.following.append(self.FOLLOW_declaration_in_synpred4105) + self.declaration() + self.following.pop() + if self.failed: + return + + + else: + break #loop103 + + + self.match(self.input, 43, self.FOLLOW_43_in_synpred4108) + if self.failed: + return + + + # $ANTLR end synpred4 + + + + # $ANTLR start synpred5 + def synpred5_fragment(self, ): + # C.g:120:4: ( declaration ) + # C.g:120:4: declaration + self.following.append(self.FOLLOW_declaration_in_synpred5118) + self.declaration() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred5 + + + + # $ANTLR start synpred7 + def synpred7_fragment(self, ): + # C.g:146:6: ( declaration_specifiers ) + # C.g:146:6: declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_synpred7157) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred7 + + + + # $ANTLR start synpred10 + def synpred10_fragment(self, ): + # C.g:167:18: ( declaration_specifiers ) + # C.g:167:18: declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_synpred10207) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred10 + + + + # $ANTLR start synpred14 + def synpred14_fragment(self, ): + # C.g:184:7: ( type_specifier ) + # C.g:184:7: type_specifier + self.following.append(self.FOLLOW_type_specifier_in_synpred14272) + self.type_specifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred14 + + + + # $ANTLR start synpred15 + def synpred15_fragment(self, ): + # C.g:185:13: ( type_qualifier ) + # C.g:185:13: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred15286) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred15 + + + + # $ANTLR start synpred33 + def synpred33_fragment(self, ): + # C.g:225:16: ( type_qualifier ) + # C.g:225:16: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred33444) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred33 + + + + # $ANTLR start synpred34 + def synpred34_fragment(self, ): + # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator ) + # C.g:225:5: IDENTIFIER ( type_qualifier )* declarator + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred34442) + if self.failed: + return + # C.g:225:16: ( type_qualifier )* + while True: #loop106 + alt106 = 2 + LA106 = self.input.LA(1) + if LA106 == 58: + LA106_2 = self.input.LA(2) + + if (self.synpred33()) : + alt106 = 1 + + + elif LA106 == 59: + LA106_3 = self.input.LA(2) + + if (self.synpred33()) : + alt106 = 1 + + + elif LA106 == 60: + LA106_4 = self.input.LA(2) + + if (self.synpred33()) : + alt106 = 1 + + + elif LA106 == 49 or LA106 == 50 or LA106 == 51 or LA106 == 52 or LA106 == 53 or LA106 == 54 or LA106 == 55 or LA106 == 56 or LA106 == 57 or LA106 == 61: + alt106 = 1 + + if alt106 == 1: + # C.g:0:0: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred34444) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + else: + break #loop106 + + + self.following.append(self.FOLLOW_declarator_in_synpred34447) + self.declarator() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred34 + + + + # $ANTLR start synpred39 + def synpred39_fragment(self, ): + # C.g:253:6: ( type_qualifier ) + # C.g:253:6: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred39566) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred39 + + + + # $ANTLR start synpred40 + def synpred40_fragment(self, ): + # C.g:253:23: ( type_specifier ) + # C.g:253:23: type_specifier + self.following.append(self.FOLLOW_type_specifier_in_synpred40570) + self.type_specifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred40 + + + + # $ANTLR start synpred66 + def synpred66_fragment(self, ): + # C.g:297:4: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator ) + # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator + # C.g:297:4: ( pointer )? + alt111 = 2 + LA111_0 = self.input.LA(1) + + if (LA111_0 == 66) : + alt111 = 1 + if alt111 == 1: + # C.g:0:0: pointer + self.following.append(self.FOLLOW_pointer_in_synpred66784) + self.pointer() + self.following.pop() + if self.failed: + return + + + + # C.g:297:13: ( 'EFIAPI' )? + alt112 = 2 + LA112_0 = self.input.LA(1) + + if (LA112_0 == 58) : + alt112 = 1 + if alt112 == 1: + # C.g:297:14: 'EFIAPI' + self.match(self.input, 58, self.FOLLOW_58_in_synpred66788) + if self.failed: + return + + + + # C.g:297:25: ( 'EFI_BOOTSERVICE' )? + alt113 = 2 + LA113_0 = self.input.LA(1) + + if (LA113_0 == 59) : + alt113 = 1 + if alt113 == 1: + # C.g:297:26: 'EFI_BOOTSERVICE' + self.match(self.input, 59, self.FOLLOW_59_in_synpred66793) + if self.failed: + return + + + + # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )? + alt114 = 2 + LA114_0 = self.input.LA(1) + + if (LA114_0 == 60) : + alt114 = 1 + if alt114 == 1: + # C.g:297:47: 'EFI_RUNTIMESERVICE' + self.match(self.input, 60, self.FOLLOW_60_in_synpred66798) + if self.failed: + return + + + + self.following.append(self.FOLLOW_direct_declarator_in_synpred66802) + self.direct_declarator() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred66 + + + + # $ANTLR start synpred67 + def synpred67_fragment(self, ): + # C.g:303:15: ( declarator_suffix ) + # C.g:303:15: declarator_suffix + self.following.append(self.FOLLOW_declarator_suffix_in_synpred67821) + self.declarator_suffix() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred67 + + + + # $ANTLR start synpred69 + def synpred69_fragment(self, ): + # C.g:304:9: ( 'EFIAPI' ) + # C.g:304:9: 'EFIAPI' + self.match(self.input, 58, self.FOLLOW_58_in_synpred69830) + if self.failed: + return + + + # $ANTLR end synpred69 + + + + # $ANTLR start synpred70 + def synpred70_fragment(self, ): + # C.g:304:35: ( declarator_suffix ) + # C.g:304:35: declarator_suffix + self.following.append(self.FOLLOW_declarator_suffix_in_synpred70838) + self.declarator_suffix() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred70 + + + + # $ANTLR start synpred73 + def synpred73_fragment(self, ): + # C.g:310:9: ( '(' parameter_type_list ')' ) + # C.g:310:9: '(' parameter_type_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_synpred73878) + if self.failed: + return + self.following.append(self.FOLLOW_parameter_type_list_in_synpred73880) + self.parameter_type_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred73882) + if self.failed: + return + + + # $ANTLR end synpred73 + + + + # $ANTLR start synpred74 + def synpred74_fragment(self, ): + # C.g:311:9: ( '(' identifier_list ')' ) + # C.g:311:9: '(' identifier_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_synpred74892) + if self.failed: + return + self.following.append(self.FOLLOW_identifier_list_in_synpred74894) + self.identifier_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred74896) + if self.failed: + return + + + # $ANTLR end synpred74 + + + + # $ANTLR start synpred75 + def synpred75_fragment(self, ): + # C.g:316:8: ( type_qualifier ) + # C.g:316:8: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred75921) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred75 + + + + # $ANTLR start synpred76 + def synpred76_fragment(self, ): + # C.g:316:24: ( pointer ) + # C.g:316:24: pointer + self.following.append(self.FOLLOW_pointer_in_synpred76924) + self.pointer() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred76 + + + + # $ANTLR start synpred77 + def synpred77_fragment(self, ): + # C.g:316:4: ( '*' ( type_qualifier )+ ( pointer )? ) + # C.g:316:4: '*' ( type_qualifier )+ ( pointer )? + self.match(self.input, 66, self.FOLLOW_66_in_synpred77919) + if self.failed: + return + # C.g:316:8: ( type_qualifier )+ + cnt116 = 0 + while True: #loop116 + alt116 = 2 + LA116_0 = self.input.LA(1) + + if ((49 <= LA116_0 <= 61)) : + alt116 = 1 + + + if alt116 == 1: + # C.g:0:0: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred77921) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + else: + if cnt116 >= 1: + break #loop116 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(116, self.input) + raise eee + + cnt116 += 1 + + + # C.g:316:24: ( pointer )? + alt117 = 2 + LA117_0 = self.input.LA(1) + + if (LA117_0 == 66) : + alt117 = 1 + if alt117 == 1: + # C.g:0:0: pointer + self.following.append(self.FOLLOW_pointer_in_synpred77924) + self.pointer() + self.following.pop() + if self.failed: + return + + + + + + # $ANTLR end synpred77 + + + + # $ANTLR start synpred78 + def synpred78_fragment(self, ): + # C.g:317:4: ( '*' pointer ) + # C.g:317:4: '*' pointer + self.match(self.input, 66, self.FOLLOW_66_in_synpred78930) + if self.failed: + return + self.following.append(self.FOLLOW_pointer_in_synpred78932) + self.pointer() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred78 + + + + # $ANTLR start synpred81 + def synpred81_fragment(self, ): + # C.g:326:32: ( 'OPTIONAL' ) + # C.g:326:32: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_synpred81977) + if self.failed: + return + + + # $ANTLR end synpred81 + + + + # $ANTLR start synpred82 + def synpred82_fragment(self, ): + # C.g:326:27: ( ',' ( 'OPTIONAL' )? parameter_declaration ) + # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration + self.match(self.input, 27, self.FOLLOW_27_in_synpred82974) + if self.failed: + return + # C.g:326:31: ( 'OPTIONAL' )? + alt119 = 2 + LA119_0 = self.input.LA(1) + + if (LA119_0 == 53) : + LA119_1 = self.input.LA(2) + + if (self.synpred81()) : + alt119 = 1 + if alt119 == 1: + # C.g:326:32: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_synpred82977) + if self.failed: + return + + + + self.following.append(self.FOLLOW_parameter_declaration_in_synpred82981) + self.parameter_declaration() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred82 + + + + # $ANTLR start synpred83 + def synpred83_fragment(self, ): + # C.g:330:28: ( declarator ) + # C.g:330:28: declarator + self.following.append(self.FOLLOW_declarator_in_synpred83997) + self.declarator() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred83 + + + + # $ANTLR start synpred84 + def synpred84_fragment(self, ): + # C.g:330:39: ( abstract_declarator ) + # C.g:330:39: abstract_declarator + self.following.append(self.FOLLOW_abstract_declarator_in_synpred84999) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred84 + + + + # $ANTLR start synpred86 + def synpred86_fragment(self, ): + # C.g:330:4: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? ) + # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? + self.following.append(self.FOLLOW_declaration_specifiers_in_synpred86994) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + # C.g:330:27: ( declarator | abstract_declarator )* + while True: #loop120 + alt120 = 3 + LA120 = self.input.LA(1) + if LA120 == 66: + LA120_3 = self.input.LA(2) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == IDENTIFIER or LA120 == 58 or LA120 == 59 or LA120 == 60: + alt120 = 1 + elif LA120 == 62: + LA120 = self.input.LA(2) + if LA120 == 29 or LA120 == 30 or LA120 == 31 or LA120 == 32 or LA120 == 33 or LA120 == 34 or LA120 == 35 or LA120 == 36 or LA120 == 37 or LA120 == 38 or LA120 == 39 or LA120 == 40 or LA120 == 41 or LA120 == 42 or LA120 == 45 or LA120 == 46 or LA120 == 48 or LA120 == 49 or LA120 == 50 or LA120 == 51 or LA120 == 52 or LA120 == 53 or LA120 == 54 or LA120 == 55 or LA120 == 56 or LA120 == 57 or LA120 == 61 or LA120 == 63 or LA120 == 64: + alt120 = 2 + elif LA120 == 58: + LA120_21 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == 66: + LA120_22 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == 59: + LA120_23 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == 60: + LA120_24 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == IDENTIFIER: + LA120_25 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == 62: + LA120_26 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + + elif LA120 == 64: + alt120 = 2 + + if alt120 == 1: + # C.g:330:28: declarator + self.following.append(self.FOLLOW_declarator_in_synpred86997) + self.declarator() + self.following.pop() + if self.failed: + return + + + elif alt120 == 2: + # C.g:330:39: abstract_declarator + self.following.append(self.FOLLOW_abstract_declarator_in_synpred86999) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + + + else: + break #loop120 + + + # C.g:330:61: ( 'OPTIONAL' )? + alt121 = 2 + LA121_0 = self.input.LA(1) + + if (LA121_0 == 53) : + alt121 = 1 + if alt121 == 1: + # C.g:330:62: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_synpred861004) + if self.failed: + return + + + + + + # $ANTLR end synpred86 + + + + # $ANTLR start synpred90 + def synpred90_fragment(self, ): + # C.g:341:4: ( specifier_qualifier_list ( abstract_declarator )? ) + # C.g:341:4: specifier_qualifier_list ( abstract_declarator )? + self.following.append(self.FOLLOW_specifier_qualifier_list_in_synpred901046) + self.specifier_qualifier_list() + self.following.pop() + if self.failed: + return + # C.g:341:29: ( abstract_declarator )? + alt122 = 2 + LA122_0 = self.input.LA(1) + + if (LA122_0 == 62 or LA122_0 == 64 or LA122_0 == 66) : + alt122 = 1 + if alt122 == 1: + # C.g:0:0: abstract_declarator + self.following.append(self.FOLLOW_abstract_declarator_in_synpred901048) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + + + + + + # $ANTLR end synpred90 + + + + # $ANTLR start synpred91 + def synpred91_fragment(self, ): + # C.g:346:12: ( direct_abstract_declarator ) + # C.g:346:12: direct_abstract_declarator + self.following.append(self.FOLLOW_direct_abstract_declarator_in_synpred911067) + self.direct_abstract_declarator() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred91 + + + + # $ANTLR start synpred93 + def synpred93_fragment(self, ): + # C.g:351:6: ( '(' abstract_declarator ')' ) + # C.g:351:6: '(' abstract_declarator ')' + self.match(self.input, 62, self.FOLLOW_62_in_synpred931086) + if self.failed: + return + self.following.append(self.FOLLOW_abstract_declarator_in_synpred931088) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred931090) + if self.failed: + return + + + # $ANTLR end synpred93 + + + + # $ANTLR start synpred94 + def synpred94_fragment(self, ): + # C.g:351:65: ( abstract_declarator_suffix ) + # C.g:351:65: abstract_declarator_suffix + self.following.append(self.FOLLOW_abstract_declarator_suffix_in_synpred941098) + self.abstract_declarator_suffix() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred94 + + + + # $ANTLR start synpred109 + def synpred109_fragment(self, ): + # C.g:386:4: ( '(' type_name ')' cast_expression ) + # C.g:386:4: '(' type_name ')' cast_expression + self.match(self.input, 62, self.FOLLOW_62_in_synpred1091282) + if self.failed: + return + self.following.append(self.FOLLOW_type_name_in_synpred1091284) + self.type_name() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred1091286) + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_synpred1091288) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred109 + + + + # $ANTLR start synpred114 + def synpred114_fragment(self, ): + # C.g:395:4: ( 'sizeof' unary_expression ) + # C.g:395:4: 'sizeof' unary_expression + self.match(self.input, 74, self.FOLLOW_74_in_synpred1141330) + if self.failed: + return + self.following.append(self.FOLLOW_unary_expression_in_synpred1141332) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred114 + + + + # $ANTLR start synpred117 + def synpred117_fragment(self, ): + # C.g:409:13: ( '(' argument_expression_list ')' ) + # C.g:409:13: '(' argument_expression_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_synpred1171420) + if self.failed: + return + self.following.append(self.FOLLOW_argument_expression_list_in_synpred1171424) + self.argument_expression_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred1171428) + if self.failed: + return + + + # $ANTLR end synpred117 + + + + # $ANTLR start synpred118 + def synpred118_fragment(self, ): + # C.g:410:13: ( '(' macro_parameter_list ')' ) + # C.g:410:13: '(' macro_parameter_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_synpred1181444) + if self.failed: + return + self.following.append(self.FOLLOW_macro_parameter_list_in_synpred1181446) + self.macro_parameter_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred1181448) + if self.failed: + return + + + # $ANTLR end synpred118 + + + + # $ANTLR start synpred120 + def synpred120_fragment(self, ): + # C.g:412:13: ( '*' IDENTIFIER ) + # C.g:412:13: '*' IDENTIFIER + self.match(self.input, 66, self.FOLLOW_66_in_synpred1201482) + if self.failed: + return + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1201486) + if self.failed: + return + + + # $ANTLR end synpred120 + + + + # $ANTLR start synpred137 + def synpred137_fragment(self, ): + # C.g:443:20: ( STRING_LITERAL ) + # C.g:443:20: STRING_LITERAL + self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1371683) + if self.failed: + return + + + # $ANTLR end synpred137 + + + + # $ANTLR start synpred138 + def synpred138_fragment(self, ): + # C.g:443:8: ( ( IDENTIFIER )* ( STRING_LITERAL )+ ) + # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+ + # C.g:443:8: ( IDENTIFIER )* + while True: #loop125 + alt125 = 2 + LA125_0 = self.input.LA(1) + + if (LA125_0 == IDENTIFIER) : + alt125 = 1 + + + if alt125 == 1: + # C.g:0:0: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1381680) + if self.failed: + return + + + else: + break #loop125 + + + # C.g:443:20: ( STRING_LITERAL )+ + cnt126 = 0 + while True: #loop126 + alt126 = 2 + LA126_0 = self.input.LA(1) + + if (LA126_0 == STRING_LITERAL) : + alt126 = 1 + + + if alt126 == 1: + # C.g:0:0: STRING_LITERAL + self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1381683) + if self.failed: + return + + + else: + if cnt126 >= 1: + break #loop126 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(126, self.input) + raise eee + + cnt126 += 1 + + + + + # $ANTLR end synpred138 + + + + # $ANTLR start synpred142 + def synpred142_fragment(self, ): + # C.g:458:4: ( lvalue assignment_operator assignment_expression ) + # C.g:458:4: lvalue assignment_operator assignment_expression + self.following.append(self.FOLLOW_lvalue_in_synpred1421744) + self.lvalue() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_assignment_operator_in_synpred1421746) + self.assignment_operator() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_assignment_expression_in_synpred1421748) + self.assignment_expression() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred142 + + + + # $ANTLR start synpred169 + def synpred169_fragment(self, ): + # C.g:520:4: ( expression_statement ) + # C.g:520:4: expression_statement + self.following.append(self.FOLLOW_expression_statement_in_synpred1692035) + self.expression_statement() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred169 + + + + # $ANTLR start synpred173 + def synpred173_fragment(self, ): + # C.g:524:4: ( macro_statement ) + # C.g:524:4: macro_statement + self.following.append(self.FOLLOW_macro_statement_in_synpred1732055) + self.macro_statement() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred173 + + + + # $ANTLR start synpred174 + def synpred174_fragment(self, ): + # C.g:525:4: ( asm2_statement ) + # C.g:525:4: asm2_statement + self.following.append(self.FOLLOW_asm2_statement_in_synpred1742060) + self.asm2_statement() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred174 + + + + # $ANTLR start synpred181 + def synpred181_fragment(self, ): + # C.g:544:19: ( declaration ) + # C.g:544:19: declaration + self.following.append(self.FOLLOW_declaration_in_synpred1812166) + self.declaration() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred181 + + + + # $ANTLR start synpred182 + def synpred182_fragment(self, ): + # C.g:544:33: ( statement_list ) + # C.g:544:33: statement_list + self.following.append(self.FOLLOW_statement_list_in_synpred1822170) + self.statement_list() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred182 + + + + # $ANTLR start synpred186 + def synpred186_fragment(self, ): + # C.g:554:8: ( declaration ) + # C.g:554:8: declaration + self.following.append(self.FOLLOW_declaration_in_synpred1862225) + self.declaration() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred186 + + + + # $ANTLR start synpred188 + def synpred188_fragment(self, ): + # C.g:558:4: ( statement ) + # C.g:558:4: statement + self.following.append(self.FOLLOW_statement_in_synpred1882242) + self.statement() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred188 + + + + def synpred69(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred69_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred81(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred81_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred82(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred82_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred66(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred66_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred83(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred83_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred84(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred84_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred67(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred67_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred86(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred86_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred120(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred120_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred40(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred40_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred142(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred142_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred182(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred182_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred109(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred109_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred181(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred181_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred186(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred186_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred188(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred188_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred169(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred169_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred117(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred117_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred70(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred70_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred118(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred118_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred34(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred34_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred33(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred33_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred94(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred94_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred39(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred39_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred74(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred74_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred114(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred114_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred93(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred93_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred75(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred75_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred137(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred137_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred90(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred90_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred138(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred138_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred91(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred91_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred73(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred73_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred5(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred5_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred78(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred78_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred7(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred7_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred76(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred76_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred77(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred77_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred2(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred2_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred4(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred4_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred174(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred174_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred173(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred173_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred14(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred14_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred15(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred15_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred10(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred10_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + + + + + FOLLOW_external_declaration_in_translation_unit74 = frozenset([1, 4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) + FOLLOW_function_definition_in_external_declaration113 = frozenset([1]) + FOLLOW_declaration_in_external_declaration118 = frozenset([1]) + FOLLOW_macro_statement_in_external_declaration123 = frozenset([1, 25]) + FOLLOW_25_in_external_declaration126 = frozenset([1]) + FOLLOW_declaration_specifiers_in_function_definition157 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_declarator_in_function_definition160 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_declaration_in_function_definition166 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_compound_statement_in_function_definition171 = frozenset([1]) + FOLLOW_compound_statement_in_function_definition180 = frozenset([1]) + FOLLOW_26_in_declaration203 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) + FOLLOW_declaration_specifiers_in_declaration207 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_init_declarator_list_in_declaration216 = frozenset([25]) + FOLLOW_25_in_declaration220 = frozenset([1]) + FOLLOW_declaration_specifiers_in_declaration234 = frozenset([4, 25, 58, 59, 60, 62, 66]) + FOLLOW_init_declarator_list_in_declaration238 = frozenset([25]) + FOLLOW_25_in_declaration243 = frozenset([1]) + FOLLOW_storage_class_specifier_in_declaration_specifiers264 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_specifier_in_declaration_specifiers272 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_qualifier_in_declaration_specifiers286 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_init_declarator_in_init_declarator_list308 = frozenset([1, 27]) + FOLLOW_27_in_init_declarator_list311 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_init_declarator_in_init_declarator_list313 = frozenset([1, 27]) + FOLLOW_declarator_in_init_declarator326 = frozenset([1, 28]) + FOLLOW_28_in_init_declarator329 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_initializer_in_init_declarator331 = frozenset([1]) + FOLLOW_set_in_storage_class_specifier0 = frozenset([1]) + FOLLOW_34_in_type_specifier376 = frozenset([1]) + FOLLOW_35_in_type_specifier381 = frozenset([1]) + FOLLOW_36_in_type_specifier386 = frozenset([1]) + FOLLOW_37_in_type_specifier391 = frozenset([1]) + FOLLOW_38_in_type_specifier396 = frozenset([1]) + FOLLOW_39_in_type_specifier401 = frozenset([1]) + FOLLOW_40_in_type_specifier406 = frozenset([1]) + FOLLOW_41_in_type_specifier411 = frozenset([1]) + FOLLOW_42_in_type_specifier416 = frozenset([1]) + FOLLOW_struct_or_union_specifier_in_type_specifier423 = frozenset([1]) + FOLLOW_enum_specifier_in_type_specifier433 = frozenset([1]) + FOLLOW_type_id_in_type_specifier451 = frozenset([1]) + FOLLOW_IDENTIFIER_in_type_id467 = frozenset([1]) + FOLLOW_struct_or_union_in_struct_or_union_specifier494 = frozenset([4, 43]) + FOLLOW_IDENTIFIER_in_struct_or_union_specifier496 = frozenset([43]) + FOLLOW_43_in_struct_or_union_specifier499 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_struct_declaration_list_in_struct_or_union_specifier501 = frozenset([44]) + FOLLOW_44_in_struct_or_union_specifier503 = frozenset([1]) + FOLLOW_struct_or_union_in_struct_or_union_specifier508 = frozenset([4]) + FOLLOW_IDENTIFIER_in_struct_or_union_specifier510 = frozenset([1]) + FOLLOW_set_in_struct_or_union0 = frozenset([1]) + FOLLOW_struct_declaration_in_struct_declaration_list537 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_specifier_qualifier_list_in_struct_declaration549 = frozenset([4, 47, 58, 59, 60, 62, 66]) + FOLLOW_struct_declarator_list_in_struct_declaration551 = frozenset([25]) + FOLLOW_25_in_struct_declaration553 = frozenset([1]) + FOLLOW_type_qualifier_in_specifier_qualifier_list566 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_specifier_in_specifier_qualifier_list570 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_struct_declarator_in_struct_declarator_list584 = frozenset([1, 27]) + FOLLOW_27_in_struct_declarator_list587 = frozenset([4, 47, 58, 59, 60, 62, 66]) + FOLLOW_struct_declarator_in_struct_declarator_list589 = frozenset([1, 27]) + FOLLOW_declarator_in_struct_declarator602 = frozenset([1, 47]) + FOLLOW_47_in_struct_declarator605 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_struct_declarator607 = frozenset([1]) + FOLLOW_47_in_struct_declarator614 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_struct_declarator616 = frozenset([1]) + FOLLOW_48_in_enum_specifier634 = frozenset([43]) + FOLLOW_43_in_enum_specifier636 = frozenset([4]) + FOLLOW_enumerator_list_in_enum_specifier638 = frozenset([27, 44]) + FOLLOW_27_in_enum_specifier640 = frozenset([44]) + FOLLOW_44_in_enum_specifier643 = frozenset([1]) + FOLLOW_48_in_enum_specifier648 = frozenset([4]) + FOLLOW_IDENTIFIER_in_enum_specifier650 = frozenset([43]) + FOLLOW_43_in_enum_specifier652 = frozenset([4]) + FOLLOW_enumerator_list_in_enum_specifier654 = frozenset([27, 44]) + FOLLOW_27_in_enum_specifier656 = frozenset([44]) + FOLLOW_44_in_enum_specifier659 = frozenset([1]) + FOLLOW_48_in_enum_specifier664 = frozenset([4]) + FOLLOW_IDENTIFIER_in_enum_specifier666 = frozenset([1]) + FOLLOW_enumerator_in_enumerator_list677 = frozenset([1, 27]) + FOLLOW_27_in_enumerator_list680 = frozenset([4]) + FOLLOW_enumerator_in_enumerator_list682 = frozenset([1, 27]) + FOLLOW_IDENTIFIER_in_enumerator695 = frozenset([1, 28]) + FOLLOW_28_in_enumerator698 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_enumerator700 = frozenset([1]) + FOLLOW_set_in_type_qualifier0 = frozenset([1]) + FOLLOW_pointer_in_declarator784 = frozenset([4, 58, 59, 60, 62]) + FOLLOW_58_in_declarator788 = frozenset([4, 59, 60, 62]) + FOLLOW_59_in_declarator793 = frozenset([4, 60, 62]) + FOLLOW_60_in_declarator798 = frozenset([4, 62]) + FOLLOW_direct_declarator_in_declarator802 = frozenset([1]) + FOLLOW_pointer_in_declarator808 = frozenset([1]) + FOLLOW_IDENTIFIER_in_direct_declarator819 = frozenset([1, 62, 64]) + FOLLOW_declarator_suffix_in_direct_declarator821 = frozenset([1, 62, 64]) + FOLLOW_62_in_direct_declarator827 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_58_in_direct_declarator830 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_declarator_in_direct_declarator834 = frozenset([63]) + FOLLOW_63_in_direct_declarator836 = frozenset([62, 64]) + FOLLOW_declarator_suffix_in_direct_declarator838 = frozenset([1, 62, 64]) + FOLLOW_64_in_declarator_suffix852 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_declarator_suffix854 = frozenset([65]) + FOLLOW_65_in_declarator_suffix856 = frozenset([1]) + FOLLOW_64_in_declarator_suffix866 = frozenset([65]) + FOLLOW_65_in_declarator_suffix868 = frozenset([1]) + FOLLOW_62_in_declarator_suffix878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_type_list_in_declarator_suffix880 = frozenset([63]) + FOLLOW_63_in_declarator_suffix882 = frozenset([1]) + FOLLOW_62_in_declarator_suffix892 = frozenset([4]) + FOLLOW_identifier_list_in_declarator_suffix894 = frozenset([63]) + FOLLOW_63_in_declarator_suffix896 = frozenset([1]) + FOLLOW_62_in_declarator_suffix906 = frozenset([63]) + FOLLOW_63_in_declarator_suffix908 = frozenset([1]) + FOLLOW_66_in_pointer919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_qualifier_in_pointer921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_pointer_in_pointer924 = frozenset([1]) + FOLLOW_66_in_pointer930 = frozenset([66]) + FOLLOW_pointer_in_pointer932 = frozenset([1]) + FOLLOW_66_in_pointer937 = frozenset([1]) + FOLLOW_parameter_list_in_parameter_type_list948 = frozenset([1, 27]) + FOLLOW_27_in_parameter_type_list951 = frozenset([53, 67]) + FOLLOW_53_in_parameter_type_list954 = frozenset([67]) + FOLLOW_67_in_parameter_type_list958 = frozenset([1]) + FOLLOW_parameter_declaration_in_parameter_list971 = frozenset([1, 27]) + FOLLOW_27_in_parameter_list974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_53_in_parameter_list977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_declaration_in_parameter_list981 = frozenset([1, 27]) + FOLLOW_declaration_specifiers_in_parameter_declaration994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_declarator_in_parameter_declaration997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_abstract_declarator_in_parameter_declaration999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_53_in_parameter_declaration1004 = frozenset([1]) + FOLLOW_pointer_in_parameter_declaration1013 = frozenset([4, 66]) + FOLLOW_IDENTIFIER_in_parameter_declaration1016 = frozenset([1]) + FOLLOW_IDENTIFIER_in_identifier_list1027 = frozenset([1, 27]) + FOLLOW_27_in_identifier_list1031 = frozenset([4]) + FOLLOW_IDENTIFIER_in_identifier_list1033 = frozenset([1, 27]) + FOLLOW_specifier_qualifier_list_in_type_name1046 = frozenset([1, 62, 64, 66]) + FOLLOW_abstract_declarator_in_type_name1048 = frozenset([1]) + FOLLOW_type_id_in_type_name1054 = frozenset([1]) + FOLLOW_pointer_in_abstract_declarator1065 = frozenset([1, 62, 64]) + FOLLOW_direct_abstract_declarator_in_abstract_declarator1067 = frozenset([1]) + FOLLOW_direct_abstract_declarator_in_abstract_declarator1073 = frozenset([1]) + FOLLOW_62_in_direct_abstract_declarator1086 = frozenset([62, 64, 66]) + FOLLOW_abstract_declarator_in_direct_abstract_declarator1088 = frozenset([63]) + FOLLOW_63_in_direct_abstract_declarator1090 = frozenset([1, 62, 64]) + FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094 = frozenset([1, 62, 64]) + FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098 = frozenset([1, 62, 64]) + FOLLOW_64_in_abstract_declarator_suffix1110 = frozenset([65]) + FOLLOW_65_in_abstract_declarator_suffix1112 = frozenset([1]) + FOLLOW_64_in_abstract_declarator_suffix1117 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_abstract_declarator_suffix1119 = frozenset([65]) + FOLLOW_65_in_abstract_declarator_suffix1121 = frozenset([1]) + FOLLOW_62_in_abstract_declarator_suffix1126 = frozenset([63]) + FOLLOW_63_in_abstract_declarator_suffix1128 = frozenset([1]) + FOLLOW_62_in_abstract_declarator_suffix1133 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135 = frozenset([63]) + FOLLOW_63_in_abstract_declarator_suffix1137 = frozenset([1]) + FOLLOW_assignment_expression_in_initializer1150 = frozenset([1]) + FOLLOW_43_in_initializer1155 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_initializer_list_in_initializer1157 = frozenset([27, 44]) + FOLLOW_27_in_initializer1159 = frozenset([44]) + FOLLOW_44_in_initializer1162 = frozenset([1]) + FOLLOW_initializer_in_initializer_list1173 = frozenset([1, 27]) + FOLLOW_27_in_initializer_list1176 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_initializer_in_initializer_list1178 = frozenset([1, 27]) + FOLLOW_assignment_expression_in_argument_expression_list1196 = frozenset([1, 27, 53]) + FOLLOW_53_in_argument_expression_list1199 = frozenset([1, 27]) + FOLLOW_27_in_argument_expression_list1204 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_assignment_expression_in_argument_expression_list1206 = frozenset([1, 27, 53]) + FOLLOW_53_in_argument_expression_list1209 = frozenset([1, 27]) + FOLLOW_multiplicative_expression_in_additive_expression1225 = frozenset([1, 68, 69]) + FOLLOW_68_in_additive_expression1229 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_multiplicative_expression_in_additive_expression1231 = frozenset([1, 68, 69]) + FOLLOW_69_in_additive_expression1235 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_multiplicative_expression_in_additive_expression1237 = frozenset([1, 68, 69]) + FOLLOW_cast_expression_in_multiplicative_expression1251 = frozenset([1, 66, 70, 71]) + FOLLOW_66_in_multiplicative_expression1255 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_multiplicative_expression1257 = frozenset([1, 66, 70, 71]) + FOLLOW_70_in_multiplicative_expression1261 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_multiplicative_expression1263 = frozenset([1, 66, 70, 71]) + FOLLOW_71_in_multiplicative_expression1267 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_multiplicative_expression1269 = frozenset([1, 66, 70, 71]) + FOLLOW_62_in_cast_expression1282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_name_in_cast_expression1284 = frozenset([63]) + FOLLOW_63_in_cast_expression1286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_cast_expression1288 = frozenset([1]) + FOLLOW_unary_expression_in_cast_expression1293 = frozenset([1]) + FOLLOW_postfix_expression_in_unary_expression1304 = frozenset([1]) + FOLLOW_72_in_unary_expression1309 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_unary_expression_in_unary_expression1311 = frozenset([1]) + FOLLOW_73_in_unary_expression1316 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_unary_expression_in_unary_expression1318 = frozenset([1]) + FOLLOW_unary_operator_in_unary_expression1323 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_unary_expression1325 = frozenset([1]) + FOLLOW_74_in_unary_expression1330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_unary_expression_in_unary_expression1332 = frozenset([1]) + FOLLOW_74_in_unary_expression1337 = frozenset([62]) + FOLLOW_62_in_unary_expression1339 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_name_in_unary_expression1341 = frozenset([63]) + FOLLOW_63_in_unary_expression1343 = frozenset([1]) + FOLLOW_primary_expression_in_postfix_expression1367 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_64_in_postfix_expression1383 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_postfix_expression1385 = frozenset([65]) + FOLLOW_65_in_postfix_expression1387 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_62_in_postfix_expression1401 = frozenset([63]) + FOLLOW_63_in_postfix_expression1405 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_62_in_postfix_expression1420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_argument_expression_list_in_postfix_expression1424 = frozenset([63]) + FOLLOW_63_in_postfix_expression1428 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_62_in_postfix_expression1444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_macro_parameter_list_in_postfix_expression1446 = frozenset([63]) + FOLLOW_63_in_postfix_expression1448 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_75_in_postfix_expression1462 = frozenset([4]) + FOLLOW_IDENTIFIER_in_postfix_expression1466 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_66_in_postfix_expression1482 = frozenset([4]) + FOLLOW_IDENTIFIER_in_postfix_expression1486 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_76_in_postfix_expression1502 = frozenset([4]) + FOLLOW_IDENTIFIER_in_postfix_expression1506 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_72_in_postfix_expression1522 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_73_in_postfix_expression1536 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_parameter_declaration_in_macro_parameter_list1559 = frozenset([1, 27]) + FOLLOW_27_in_macro_parameter_list1562 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_declaration_in_macro_parameter_list1564 = frozenset([1, 27]) + FOLLOW_set_in_unary_operator0 = frozenset([1]) + FOLLOW_IDENTIFIER_in_primary_expression1613 = frozenset([1]) + FOLLOW_constant_in_primary_expression1618 = frozenset([1]) + FOLLOW_62_in_primary_expression1623 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_primary_expression1625 = frozenset([63]) + FOLLOW_63_in_primary_expression1627 = frozenset([1]) + FOLLOW_HEX_LITERAL_in_constant1643 = frozenset([1]) + FOLLOW_OCTAL_LITERAL_in_constant1653 = frozenset([1]) + FOLLOW_DECIMAL_LITERAL_in_constant1663 = frozenset([1]) + FOLLOW_CHARACTER_LITERAL_in_constant1671 = frozenset([1]) + FOLLOW_IDENTIFIER_in_constant1680 = frozenset([4, 9]) + FOLLOW_STRING_LITERAL_in_constant1683 = frozenset([1, 4, 9]) + FOLLOW_IDENTIFIER_in_constant1688 = frozenset([1, 4]) + FOLLOW_FLOATING_POINT_LITERAL_in_constant1699 = frozenset([1]) + FOLLOW_assignment_expression_in_expression1715 = frozenset([1, 27]) + FOLLOW_27_in_expression1718 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_assignment_expression_in_expression1720 = frozenset([1, 27]) + FOLLOW_conditional_expression_in_constant_expression1733 = frozenset([1]) + FOLLOW_lvalue_in_assignment_expression1744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]) + FOLLOW_assignment_operator_in_assignment_expression1746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_assignment_expression_in_assignment_expression1748 = frozenset([1]) + FOLLOW_conditional_expression_in_assignment_expression1753 = frozenset([1]) + FOLLOW_unary_expression_in_lvalue1765 = frozenset([1]) + FOLLOW_set_in_assignment_operator0 = frozenset([1]) + FOLLOW_logical_or_expression_in_conditional_expression1839 = frozenset([1, 90]) + FOLLOW_90_in_conditional_expression1842 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_conditional_expression1844 = frozenset([47]) + FOLLOW_47_in_conditional_expression1846 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_conditional_expression_in_conditional_expression1848 = frozenset([1]) + FOLLOW_logical_and_expression_in_logical_or_expression1863 = frozenset([1, 91]) + FOLLOW_91_in_logical_or_expression1866 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_logical_and_expression_in_logical_or_expression1868 = frozenset([1, 91]) + FOLLOW_inclusive_or_expression_in_logical_and_expression1881 = frozenset([1, 92]) + FOLLOW_92_in_logical_and_expression1884 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_inclusive_or_expression_in_logical_and_expression1886 = frozenset([1, 92]) + FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899 = frozenset([1, 93]) + FOLLOW_93_in_inclusive_or_expression1902 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904 = frozenset([1, 93]) + FOLLOW_and_expression_in_exclusive_or_expression1917 = frozenset([1, 94]) + FOLLOW_94_in_exclusive_or_expression1920 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_and_expression_in_exclusive_or_expression1922 = frozenset([1, 94]) + FOLLOW_equality_expression_in_and_expression1935 = frozenset([1, 77]) + FOLLOW_77_in_and_expression1938 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_equality_expression_in_and_expression1940 = frozenset([1, 77]) + FOLLOW_relational_expression_in_equality_expression1952 = frozenset([1, 95, 96]) + FOLLOW_set_in_equality_expression1955 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_relational_expression_in_equality_expression1961 = frozenset([1, 95, 96]) + FOLLOW_shift_expression_in_relational_expression1975 = frozenset([1, 97, 98, 99, 100]) + FOLLOW_set_in_relational_expression1978 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_shift_expression_in_relational_expression1988 = frozenset([1, 97, 98, 99, 100]) + FOLLOW_additive_expression_in_shift_expression2001 = frozenset([1, 101, 102]) + FOLLOW_set_in_shift_expression2004 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_additive_expression_in_shift_expression2010 = frozenset([1, 101, 102]) + FOLLOW_labeled_statement_in_statement2025 = frozenset([1]) + FOLLOW_compound_statement_in_statement2030 = frozenset([1]) + FOLLOW_expression_statement_in_statement2035 = frozenset([1]) + FOLLOW_selection_statement_in_statement2040 = frozenset([1]) + FOLLOW_iteration_statement_in_statement2045 = frozenset([1]) + FOLLOW_jump_statement_in_statement2050 = frozenset([1]) + FOLLOW_macro_statement_in_statement2055 = frozenset([1]) + FOLLOW_asm2_statement_in_statement2060 = frozenset([1]) + FOLLOW_asm1_statement_in_statement2065 = frozenset([1]) + FOLLOW_asm_statement_in_statement2070 = frozenset([1]) + FOLLOW_declaration_in_statement2075 = frozenset([1]) + FOLLOW_103_in_asm2_statement2086 = frozenset([4]) + FOLLOW_IDENTIFIER_in_asm2_statement2089 = frozenset([62]) + FOLLOW_62_in_asm2_statement2091 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_set_in_asm2_statement2094 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_63_in_asm2_statement2101 = frozenset([25]) + FOLLOW_25_in_asm2_statement2103 = frozenset([1]) + FOLLOW_104_in_asm1_statement2115 = frozenset([43]) + FOLLOW_43_in_asm1_statement2117 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_set_in_asm1_statement2120 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_44_in_asm1_statement2127 = frozenset([1]) + FOLLOW_105_in_asm_statement2138 = frozenset([43]) + FOLLOW_43_in_asm_statement2140 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_set_in_asm_statement2143 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_44_in_asm_statement2150 = frozenset([1]) + FOLLOW_IDENTIFIER_in_macro_statement2162 = frozenset([62]) + FOLLOW_62_in_macro_statement2164 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_declaration_in_macro_statement2166 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_list_in_macro_statement2170 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_macro_statement2173 = frozenset([63]) + FOLLOW_63_in_macro_statement2176 = frozenset([1]) + FOLLOW_IDENTIFIER_in_labeled_statement2188 = frozenset([47]) + FOLLOW_47_in_labeled_statement2190 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_labeled_statement2192 = frozenset([1]) + FOLLOW_106_in_labeled_statement2197 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_labeled_statement2199 = frozenset([47]) + FOLLOW_47_in_labeled_statement2201 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_labeled_statement2203 = frozenset([1]) + FOLLOW_107_in_labeled_statement2208 = frozenset([47]) + FOLLOW_47_in_labeled_statement2210 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_labeled_statement2212 = frozenset([1]) + FOLLOW_43_in_compound_statement2223 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_declaration_in_compound_statement2225 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_list_in_compound_statement2228 = frozenset([44]) + FOLLOW_44_in_compound_statement2231 = frozenset([1]) + FOLLOW_statement_in_statement_list2242 = frozenset([1, 4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_25_in_expression_statement2254 = frozenset([1]) + FOLLOW_expression_in_expression_statement2259 = frozenset([25]) + FOLLOW_25_in_expression_statement2261 = frozenset([1]) + FOLLOW_108_in_selection_statement2272 = frozenset([62]) + FOLLOW_62_in_selection_statement2274 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_selection_statement2278 = frozenset([63]) + FOLLOW_63_in_selection_statement2280 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_selection_statement2284 = frozenset([1, 109]) + FOLLOW_109_in_selection_statement2299 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_selection_statement2301 = frozenset([1]) + FOLLOW_110_in_selection_statement2308 = frozenset([62]) + FOLLOW_62_in_selection_statement2310 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_selection_statement2312 = frozenset([63]) + FOLLOW_63_in_selection_statement2314 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_selection_statement2316 = frozenset([1]) + FOLLOW_111_in_iteration_statement2327 = frozenset([62]) + FOLLOW_62_in_iteration_statement2329 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_iteration_statement2333 = frozenset([63]) + FOLLOW_63_in_iteration_statement2335 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_iteration_statement2337 = frozenset([1]) + FOLLOW_112_in_iteration_statement2344 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_iteration_statement2346 = frozenset([111]) + FOLLOW_111_in_iteration_statement2348 = frozenset([62]) + FOLLOW_62_in_iteration_statement2350 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_iteration_statement2354 = frozenset([63]) + FOLLOW_63_in_iteration_statement2356 = frozenset([25]) + FOLLOW_25_in_iteration_statement2358 = frozenset([1]) + FOLLOW_113_in_iteration_statement2365 = frozenset([62]) + FOLLOW_62_in_iteration_statement2367 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_statement_in_iteration_statement2369 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_statement_in_iteration_statement2373 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_iteration_statement2375 = frozenset([63]) + FOLLOW_63_in_iteration_statement2378 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_iteration_statement2380 = frozenset([1]) + FOLLOW_114_in_jump_statement2393 = frozenset([4]) + FOLLOW_IDENTIFIER_in_jump_statement2395 = frozenset([25]) + FOLLOW_25_in_jump_statement2397 = frozenset([1]) + FOLLOW_115_in_jump_statement2402 = frozenset([25]) + FOLLOW_25_in_jump_statement2404 = frozenset([1]) + FOLLOW_116_in_jump_statement2409 = frozenset([25]) + FOLLOW_25_in_jump_statement2411 = frozenset([1]) + FOLLOW_117_in_jump_statement2416 = frozenset([25]) + FOLLOW_25_in_jump_statement2418 = frozenset([1]) + FOLLOW_117_in_jump_statement2423 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_jump_statement2425 = frozenset([25]) + FOLLOW_25_in_jump_statement2427 = frozenset([1]) + FOLLOW_declaration_specifiers_in_synpred2100 = frozenset([1]) + FOLLOW_declaration_specifiers_in_synpred4100 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_declarator_in_synpred4103 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_declaration_in_synpred4105 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_43_in_synpred4108 = frozenset([1]) + FOLLOW_declaration_in_synpred5118 = frozenset([1]) + FOLLOW_declaration_specifiers_in_synpred7157 = frozenset([1]) + FOLLOW_declaration_specifiers_in_synpred10207 = frozenset([1]) + FOLLOW_type_specifier_in_synpred14272 = frozenset([1]) + FOLLOW_type_qualifier_in_synpred15286 = frozenset([1]) + FOLLOW_type_qualifier_in_synpred33444 = frozenset([1]) + FOLLOW_IDENTIFIER_in_synpred34442 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) + FOLLOW_type_qualifier_in_synpred34444 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) + FOLLOW_declarator_in_synpred34447 = frozenset([1]) + FOLLOW_type_qualifier_in_synpred39566 = frozenset([1]) + FOLLOW_type_specifier_in_synpred40570 = frozenset([1]) + FOLLOW_pointer_in_synpred66784 = frozenset([4, 58, 59, 60, 62]) + FOLLOW_58_in_synpred66788 = frozenset([4, 59, 60, 62]) + FOLLOW_59_in_synpred66793 = frozenset([4, 60, 62]) + FOLLOW_60_in_synpred66798 = frozenset([4, 62]) + FOLLOW_direct_declarator_in_synpred66802 = frozenset([1]) + FOLLOW_declarator_suffix_in_synpred67821 = frozenset([1]) + FOLLOW_58_in_synpred69830 = frozenset([1]) + FOLLOW_declarator_suffix_in_synpred70838 = frozenset([1]) + FOLLOW_62_in_synpred73878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_type_list_in_synpred73880 = frozenset([63]) + FOLLOW_63_in_synpred73882 = frozenset([1]) + FOLLOW_62_in_synpred74892 = frozenset([4]) + FOLLOW_identifier_list_in_synpred74894 = frozenset([63]) + FOLLOW_63_in_synpred74896 = frozenset([1]) + FOLLOW_type_qualifier_in_synpred75921 = frozenset([1]) + FOLLOW_pointer_in_synpred76924 = frozenset([1]) + FOLLOW_66_in_synpred77919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_qualifier_in_synpred77921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_pointer_in_synpred77924 = frozenset([1]) + FOLLOW_66_in_synpred78930 = frozenset([66]) + FOLLOW_pointer_in_synpred78932 = frozenset([1]) + FOLLOW_53_in_synpred81977 = frozenset([1]) + FOLLOW_27_in_synpred82974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_53_in_synpred82977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_declaration_in_synpred82981 = frozenset([1]) + FOLLOW_declarator_in_synpred83997 = frozenset([1]) + FOLLOW_abstract_declarator_in_synpred84999 = frozenset([1]) + FOLLOW_declaration_specifiers_in_synpred86994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_declarator_in_synpred86997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_abstract_declarator_in_synpred86999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_53_in_synpred861004 = frozenset([1]) + FOLLOW_specifier_qualifier_list_in_synpred901046 = frozenset([1, 62, 64, 66]) + FOLLOW_abstract_declarator_in_synpred901048 = frozenset([1]) + FOLLOW_direct_abstract_declarator_in_synpred911067 = frozenset([1]) + FOLLOW_62_in_synpred931086 = frozenset([62, 64, 66]) + FOLLOW_abstract_declarator_in_synpred931088 = frozenset([63]) + FOLLOW_63_in_synpred931090 = frozenset([1]) + FOLLOW_abstract_declarator_suffix_in_synpred941098 = frozenset([1]) + FOLLOW_62_in_synpred1091282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_name_in_synpred1091284 = frozenset([63]) + FOLLOW_63_in_synpred1091286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_synpred1091288 = frozenset([1]) + FOLLOW_74_in_synpred1141330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_unary_expression_in_synpred1141332 = frozenset([1]) + FOLLOW_62_in_synpred1171420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_argument_expression_list_in_synpred1171424 = frozenset([63]) + FOLLOW_63_in_synpred1171428 = frozenset([1]) + FOLLOW_62_in_synpred1181444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_macro_parameter_list_in_synpred1181446 = frozenset([63]) + FOLLOW_63_in_synpred1181448 = frozenset([1]) + FOLLOW_66_in_synpred1201482 = frozenset([4]) + FOLLOW_IDENTIFIER_in_synpred1201486 = frozenset([1]) + FOLLOW_STRING_LITERAL_in_synpred1371683 = frozenset([1]) + FOLLOW_IDENTIFIER_in_synpred1381680 = frozenset([4, 9]) + FOLLOW_STRING_LITERAL_in_synpred1381683 = frozenset([1, 9]) + FOLLOW_lvalue_in_synpred1421744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]) + FOLLOW_assignment_operator_in_synpred1421746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_assignment_expression_in_synpred1421748 = frozenset([1]) + FOLLOW_expression_statement_in_synpred1692035 = frozenset([1]) + FOLLOW_macro_statement_in_synpred1732055 = frozenset([1]) + FOLLOW_asm2_statement_in_synpred1742060 = frozenset([1]) + FOLLOW_declaration_in_synpred1812166 = frozenset([1]) + FOLLOW_statement_list_in_synpred1822170 = frozenset([1]) + FOLLOW_declaration_in_synpred1862225 = frozenset([1]) + FOLLOW_statement_in_synpred1882242 = frozenset([1]) + diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index 98a899e76b..6da2b6babe 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -1,1853 +1,1853 @@ -## @file -# This file is used to parse meta files -# -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import re -import time -import copy - -import Common.EdkLogger as EdkLogger -import Common.GlobalData as GlobalData -import EccGlobalData - -from CommonDataClass.DataClass import * -from Common.DataType import * -from Common.String import * -from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData -from Common.Expression import * -from CommonDataClass.Exceptions import * - -from MetaFileTable import MetaFileStorage -from GenFds.FdfParser import FdfParser - -## A decorator used to parse macro definition -def ParseMacro(Parser): - def MacroParser(self): - Match = gMacroDefPattern.match(self._CurrentLine) - if not Match: - # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method - Parser(self) - return - - TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):], TAB_EQUAL_SPLIT, 1) - # Syntax check - if not TokenList[0]: - EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - if len(TokenList) < 2: - TokenList.append('') - - Type = Match.group(1) - Name, Value = TokenList - # Global macros can be only defined via environment variable - if Name in GlobalData.gGlobalDefines: - EdkLogger.error('Parser', FORMAT_INVALID, "%s can only be defined via environment variable" % Name, - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - # Only upper case letters, digit and '_' are allowed - if not gMacroNamePattern.match(Name): - EdkLogger.error('Parser', FORMAT_INVALID, "The macro name must be in the pattern [A-Z][A-Z0-9_]*", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - - Value = ReplaceMacro(Value, self._Macros) - self._ItemType = MODEL_META_DATA_DEFINE - # DEFINE defined macros - if Type == TAB_DSC_DEFINES_DEFINE: - if type(self) == DecParser: - if MODEL_META_DATA_HEADER in self._SectionType: - self._FileLocalMacros[Name] = Value - else: - for Scope in self._Scope: - self._SectionsMacroDict.setdefault((Scope[2], Scope[0], Scope[1]), {})[Name] = Value - elif self._SectionType == MODEL_META_DATA_HEADER: - self._FileLocalMacros[Name] = Value - else: - SectionDictKey = self._SectionType, self._Scope[0][0], self._Scope[0][1] - if SectionDictKey not in self._SectionsMacroDict: - self._SectionsMacroDict[SectionDictKey] = {} - SectionLocalMacros = self._SectionsMacroDict[SectionDictKey] - SectionLocalMacros[Name] = Value - # EDK_GLOBAL defined macros - elif type(self) != DscParser: - EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - elif self._SectionType != MODEL_META_DATA_HEADER: - EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used under [Defines] section", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] != Value): - EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a macro with the same name and different value as one defined by 'DEFINE'", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - - self._ValueList = [Type, Name, Value] - - return MacroParser - -## Base class of parser -# -# This class is used for derivation purpose. The specific parser for one kind -# type file must derive this class and implement some public interfaces. -# -# @param FilePath The path of platform description file -# @param FileType The raw data of DSC file -# @param Table Database used to retrieve module/package information -# @param Macros Macros used for replacement in file -# @param Owner Owner ID (for sub-section parsing) -# @param From ID from which the data comes (for !INCLUDE directive) -# -class MetaFileParser(object): - # data type (file content) for specific file type - DataType = {} - - # Parser objects used to implement singleton - MetaFiles = {} - - ## Factory method - # - # One file, one parser object. This factory method makes sure that there's - # only one object constructed for one meta file. - # - # @param Class class object of real AutoGen class - # (InfParser, DecParser or DscParser) - # @param FilePath The path of meta file - # @param *args The specific class related parameters - # @param **kwargs The specific class related dict parameters - # - def __new__(Class, FilePath, *args, **kwargs): - if FilePath in Class.MetaFiles: - return Class.MetaFiles[FilePath] - else: - ParserObject = super(MetaFileParser, Class).__new__(Class) - Class.MetaFiles[FilePath] = ParserObject - return ParserObject - - ## Constructor of MetaFileParser - # - # Initialize object of MetaFileParser - # - # @param FilePath The path of platform description file - # @param FileType The raw data of DSC file - # @param Table Database used to retrieve module/package information - # @param Macros Macros used for replacement in file - # @param Owner Owner ID (for sub-section parsing) - # @param From ID from which the data comes (for !INCLUDE directive) - # - def __init__(self, FilePath, FileType, Table, Owner=-1, From=-1): - self._Table = Table - self._RawTable = Table - self._FileType = FileType - self.MetaFile = FilePath - self._Defines = {} - self._FileLocalMacros = {} - self._SectionsMacroDict = {} - - # for recursive parsing - self._Owner = [Owner] - self._From = From - - # parsr status for parsing - self._ValueList = ['', '', '', '', ''] - self._Scope = [] - self._LineIndex = 0 - self._CurrentLine = '' - self._SectionType = MODEL_UNKNOWN - self._SectionName = '' - self._InSubsection = False - self._SubsectionType = MODEL_UNKNOWN - self._SubsectionName = '' - self._ItemType = MODEL_UNKNOWN - self._LastItem = -1 - self._Enabled = 0 - self._Finished = False - self._PostProcessed = False - # Different version of meta-file has different way to parse. - self._Version = 0 - - ## Store the parsed data in table - def _Store(self, *Args): - return self._Table.Insert(*Args) - - ## Virtual method for starting parse - def Start(self): - raise NotImplementedError - - ## Notify a post-process is needed - def DoPostProcess(self): - self._PostProcessed = False - - ## Set parsing complete flag in both class and table - def _Done(self): - self._Finished = True - ## Do not set end flag when processing included files - if self._From == -1: - self._Table.SetEndFlag() - - def _PostProcess(self): - self._PostProcessed = True - - ## Get the parse complete flag - def _GetFinished(self): - return self._Finished - - ## Set the complete flag - def _SetFinished(self, Value): - self._Finished = Value - - ## Use [] style to query data in table, just for readability - # - # DataInfo = [data_type, scope1(arch), scope2(platform/moduletype)] - # - def __getitem__(self, DataInfo): - if type(DataInfo) != type(()): - DataInfo = (DataInfo,) - - # Parse the file first, if necessary - if not self._Finished: - if self._RawTable.IsIntegrity(): - self._Finished = True - else: - self._Table = self._RawTable - self._PostProcessed = False - self.Start() - - # No specific ARCH or Platform given, use raw data - if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] == None): - return self._RawTable.Query(*DataInfo) - - # Do post-process if necessary - if not self._PostProcessed: - self._PostProcess() - - return self._Table.Query(*DataInfo) - - ## Data parser for the common format in different type of file - # - # The common format in the meatfile is like - # - # xxx1 | xxx2 | xxx3 - # - @ParseMacro - def _CommonParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - self._ValueList[0:len(TokenList)] = TokenList - - ## Data parser for the format in which there's path - # - # Only path can have macro used. So we need to replace them before use. - # - @ParseMacro - def _PathParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - self._ValueList[0:len(TokenList)] = TokenList - # Don't do macro replacement for dsc file at this point - if type(self) != DscParser: - Macros = self._Macros - self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList] - - ## Skip unsupported data - def _Skip(self): - EdkLogger.warn("Parser", "Unrecognized content", File=self.MetaFile, - Line=self._LineIndex+1, ExtraData=self._CurrentLine); - self._ValueList[0:1] = [self._CurrentLine] - - ## Section header parser - # - # The section header is always in following format: - # - # [section_name.arch<.platform|module_type>] - # - def _SectionHeaderParser(self): - self._Scope = [] - self._SectionName = '' - ArchList = set() - for Item in GetSplitValueList(self._CurrentLine[1:-1], TAB_COMMA_SPLIT): - if Item == '': - continue - ItemList = GetSplitValueList(Item, TAB_SPLIT) - # different section should not mix in one section - if self._SectionName != '' and self._SectionName != ItemList[0].upper(): - EdkLogger.error('Parser', FORMAT_INVALID, "Different section names in the same section", - File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine) - self._SectionName = ItemList[0].upper() - if self._SectionName in self.DataType: - self._SectionType = self.DataType[self._SectionName] - else: - self._SectionType = MODEL_UNKNOWN - EdkLogger.warn("Parser", "Unrecognized section", File=self.MetaFile, - Line=self._LineIndex+1, ExtraData=self._CurrentLine) - # S1 is always Arch - if len(ItemList) > 1: - S1 = ItemList[1].upper() - else: - S1 = 'COMMON' - ArchList.add(S1) - # S2 may be Platform or ModuleType - if len(ItemList) > 2: - S2 = ItemList[2].upper() - else: - S2 = 'COMMON' - self._Scope.append([S1, S2]) - - # 'COMMON' must not be used with specific ARCHs at the same section - if 'COMMON' in ArchList and len(ArchList) > 1: - EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs", - File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine) - # If the section information is needed later, it should be stored in database - self._ValueList[0] = self._SectionName - - ## [defines] section parser - @ParseMacro - def _DefineParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - self._ValueList[1:len(TokenList)] = TokenList - if not self._ValueList[1]: - EdkLogger.error('Parser', FORMAT_INVALID, "No name specified", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - if not self._ValueList[2]: - EdkLogger.error('Parser', FORMAT_INVALID, "No value specified", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - - self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList] - Name, Value = self._ValueList[1], self._ValueList[2] - # Sometimes, we need to make differences between EDK and EDK2 modules - if Name == 'INF_VERSION': - try: - self._Version = int(Value, 0) - except: - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - - if type(self) == InfParser and self._Version < 0x00010005: - # EDK module allows using defines as macros - self._FileLocalMacros[Name] = Value - self._Defines[Name] = Value - - ## [BuildOptions] section parser - @ParseMacro - def _BuildOptionParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - TokenList2 = GetSplitValueList(TokenList[0], ':', 1) - if len(TokenList2) == 2: - self._ValueList[0] = TokenList2[0] # toolchain family - self._ValueList[1] = TokenList2[1] # keys - else: - self._ValueList[1] = TokenList[0] - if len(TokenList) == 2 and type(self) != DscParser: # value - self._ValueList[2] = ReplaceMacro(TokenList[1], self._Macros) - - if self._ValueList[1].count('_') != 4: - EdkLogger.error( - 'Parser', - FORMAT_INVALID, - "'%s' must be in format of ____FLAGS" % self._ValueList[1], - ExtraData=self._CurrentLine, - File=self.MetaFile, - Line=self._LineIndex+1 - ) - - def _GetMacros(self): - Macros = {} - Macros.update(self._FileLocalMacros) - Macros.update(self._GetApplicableSectionMacro()) - return Macros - - - ## Get section Macros that are applicable to current line, which may come from other sections - ## that share the same name while scope is wider - def _GetApplicableSectionMacro(self): - Macros = {} - for Scope1, Scope2 in [("COMMON", "COMMON"), ("COMMON", self._Scope[0][1]), - (self._Scope[0][0], "COMMON"), (self._Scope[0][0], self._Scope[0][1])]: - if (self._SectionType, Scope1, Scope2) in self._SectionsMacroDict: - Macros.update(self._SectionsMacroDict[(self._SectionType, Scope1, Scope2)]) - return Macros - - _SectionParser = {} - Finished = property(_GetFinished, _SetFinished) - _Macros = property(_GetMacros) - - -## INF file parser class -# -# @param FilePath The path of platform description file -# @param FileType The raw data of DSC file -# @param Table Database used to retrieve module/package information -# @param Macros Macros used for replacement in file -# -class InfParser(MetaFileParser): - # INF file supported data types (one type per section) - DataType = { - TAB_UNKNOWN.upper() : MODEL_UNKNOWN, - TAB_INF_DEFINES.upper() : MODEL_META_DATA_HEADER, - TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, - TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION, - TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE, - TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE, - TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, - TAB_PACKAGES.upper() : MODEL_META_DATA_PACKAGE, - TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE, - TAB_INF_FIXED_PCD.upper() : MODEL_PCD_FIXED_AT_BUILD, - TAB_INF_PATCH_PCD.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, - TAB_INF_FEATURE_PCD.upper() : MODEL_PCD_FEATURE_FLAG, - TAB_INF_PCD_EX.upper() : MODEL_PCD_DYNAMIC_EX, - TAB_INF_PCD.upper() : MODEL_PCD_DYNAMIC, - TAB_SOURCES.upper() : MODEL_EFI_SOURCE_FILE, - TAB_GUIDS.upper() : MODEL_EFI_GUID, - TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL, - TAB_PPIS.upper() : MODEL_EFI_PPI, - TAB_DEPEX.upper() : MODEL_EFI_DEPEX, - TAB_BINARIES.upper() : MODEL_EFI_BINARY_FILE, - TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION - } - - ## Constructor of InfParser - # - # Initialize object of InfParser - # - # @param FilePath The path of module description file - # @param FileType The raw data of DSC file - # @param Table Database used to retrieve module/package information - # @param Macros Macros used for replacement in file - # - def __init__(self, FilePath, FileType, Table): - # prevent re-initialization - if hasattr(self, "_Table"): - return - MetaFileParser.__init__(self, FilePath, FileType, Table) - self.TblFile = EccGlobalData.gDb.TblFile - self.FileID = -1 - - ## Parser starter - def Start(self): - NmakeLine = '' - Content = '' - try: - Content = open(str(self.MetaFile), 'r').readlines() - except: - EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) - # - # Insert a record for file - # - Filename = NormPath(self.MetaFile) - FileID = self.TblFile.GetFileId(Filename) - if FileID: - self.FileID = FileID - else: - self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_INF) - - # parse the file line by line - IsFindBlockComment = False - - for Index in range(0, len(Content)): - # skip empty, commented, block commented lines - Line = CleanString(Content[Index], AllowCppStyleComment=True) - NextLine = '' - if Index + 1 < len(Content): - NextLine = CleanString(Content[Index + 1]) - if Line == '': - continue - if Line.find(DataType.TAB_COMMENT_EDK_START) > -1: - IsFindBlockComment = True - continue - if Line.find(DataType.TAB_COMMENT_EDK_END) > -1: - IsFindBlockComment = False - continue - if IsFindBlockComment: - continue - - self._LineIndex = Index - self._CurrentLine = Line - - # section header - if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: - self._SectionHeaderParser() - # Check invalid sections - if self._Version < 0x00010005: - if self._SectionType in [MODEL_META_DATA_BUILD_OPTION, - MODEL_EFI_LIBRARY_CLASS, - MODEL_META_DATA_PACKAGE, - MODEL_PCD_FIXED_AT_BUILD, - MODEL_PCD_PATCHABLE_IN_MODULE, - MODEL_PCD_FEATURE_FLAG, - MODEL_PCD_DYNAMIC_EX, - MODEL_PCD_DYNAMIC, - MODEL_EFI_GUID, - MODEL_EFI_PROTOCOL, - MODEL_EFI_PPI, - MODEL_META_DATA_USER_EXTENSION]: - EdkLogger.error('Parser', FORMAT_INVALID, - "Section [%s] is not allowed in inf file without version" % (self._SectionName), - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - elif self._SectionType in [MODEL_EFI_INCLUDE, - MODEL_EFI_LIBRARY_INSTANCE, - MODEL_META_DATA_NMAKE]: - EdkLogger.error('Parser', FORMAT_INVALID, - "Section [%s] is not allowed in inf file with version 0x%08x" % (self._SectionName, self._Version), - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - continue - # merge two lines specified by '\' in section NMAKE - elif self._SectionType == MODEL_META_DATA_NMAKE: - if Line[-1] == '\\': - if NextLine == '': - self._CurrentLine = NmakeLine + Line[0:-1] - NmakeLine = '' - else: - if NextLine[0] == TAB_SECTION_START and NextLine[-1] == TAB_SECTION_END: - self._CurrentLine = NmakeLine + Line[0:-1] - NmakeLine = '' - else: - NmakeLine = NmakeLine + ' ' + Line[0:-1] - continue - else: - self._CurrentLine = NmakeLine + Line - NmakeLine = '' - - # section content - self._ValueList = ['','',''] - # parse current line, result will be put in self._ValueList - self._SectionParser[self._SectionType](self) - if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE: - self._ItemType = -1 - continue - # - # Model, Value1, Value2, Value3, Arch, Platform, BelongsToItem=-1, - # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 - # - self._ValueList[0] = self._ValueList[0].replace('/', '\\') - for Arch, Platform in self._Scope: - self._Store(self._SectionType, - self._ValueList[0], - self._ValueList[1], - self._ValueList[2], - Arch, - Platform, - self._Owner[-1], - self.FileID, - self._LineIndex+1, - -1, - self._LineIndex+1, - -1, - 0 - ) - if IsFindBlockComment: - EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */", - File=self.MetaFile) - self._Done() - - ## Data parser for the format in which there's path - # - # Only path can have macro used. So we need to replace them before use. - # - def _IncludeParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - self._ValueList[0:len(TokenList)] = TokenList - Macros = self._Macros - if Macros: - for Index in range(0, len(self._ValueList)): - Value = self._ValueList[Index] - if not Value: - continue - - if Value.upper().find('$(EFI_SOURCE)\Edk'.upper()) > -1 or Value.upper().find('$(EFI_SOURCE)/Edk'.upper()) > -1: - Value = '$(EDK_SOURCE)' + Value[17:] - if Value.find('$(EFI_SOURCE)') > -1 or Value.find('$(EDK_SOURCE)') > -1: - pass - elif Value.startswith('.'): - pass - elif Value.startswith('$('): - pass - else: - Value = '$(EFI_SOURCE)/' + Value - - self._ValueList[Index] = ReplaceMacro(Value, Macros) - - ## Parse [Sources] section - # - # Only path can have macro used. So we need to replace them before use. - # - @ParseMacro - def _SourceFileParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - self._ValueList[0:len(TokenList)] = TokenList - Macros = self._Macros - # For Acpi tables, remove macro like ' TABLE_NAME=Sata1' - if 'COMPONENT_TYPE' in Macros: - if self._Defines['COMPONENT_TYPE'].upper() == 'ACPITABLE': - self._ValueList[0] = GetSplitValueList(self._ValueList[0], ' ', 1)[0] - if self._Defines['BASE_NAME'] == 'Microcode': - pass - self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList] - - ## Parse [Binaries] section - # - # Only path can have macro used. So we need to replace them before use. - # - @ParseMacro - def _BinaryFileParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 2) - if len(TokenList) < 2: - EdkLogger.error('Parser', FORMAT_INVALID, "No file type or path specified", - ExtraData=self._CurrentLine + " ( | [| ])", - File=self.MetaFile, Line=self._LineIndex+1) - if not TokenList[0]: - EdkLogger.error('Parser', FORMAT_INVALID, "No file type specified", - ExtraData=self._CurrentLine + " ( | [| ])", - File=self.MetaFile, Line=self._LineIndex+1) - if not TokenList[1]: - EdkLogger.error('Parser', FORMAT_INVALID, "No file path specified", - ExtraData=self._CurrentLine + " ( | [| ])", - File=self.MetaFile, Line=self._LineIndex+1) - self._ValueList[0:len(TokenList)] = TokenList - self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros) - - ## [nmake] section parser (Edk.x style only) - def _NmakeParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - self._ValueList[0:len(TokenList)] = TokenList - # remove macros - self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros) - # remove self-reference in macro setting - #self._ValueList[1] = ReplaceMacro(self._ValueList[1], {self._ValueList[0]:''}) - - ## [FixedPcd], [FeaturePcd], [PatchPcd], [Pcd] and [PcdEx] sections parser - @ParseMacro - def _PcdParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) - ValueList = GetSplitValueList(TokenList[0], TAB_SPLIT) - if len(ValueList) != 2: - EdkLogger.error('Parser', FORMAT_INVALID, "Illegal token space GUID and PCD name format", - ExtraData=self._CurrentLine + " (.)", - File=self.MetaFile, Line=self._LineIndex+1) - self._ValueList[0:1] = ValueList - if len(TokenList) > 1: - self._ValueList[2] = TokenList[1] - if self._ValueList[0] == '' or self._ValueList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", - ExtraData=self._CurrentLine + " (.)", - File=self.MetaFile, Line=self._LineIndex+1) - - # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0. - if self._ValueList[2] != '': - InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1) - if InfPcdValueList[0] in ['True', 'true', 'TRUE']: - self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1); - elif InfPcdValueList[0] in ['False', 'false', 'FALSE']: - self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1); - - ## [depex] section parser - @ParseMacro - def _DepexParser(self): - self._ValueList[0:1] = [self._CurrentLine] - - _SectionParser = { - MODEL_UNKNOWN : MetaFileParser._Skip, - MODEL_META_DATA_HEADER : MetaFileParser._DefineParser, - MODEL_META_DATA_BUILD_OPTION : MetaFileParser._BuildOptionParser, - MODEL_EFI_INCLUDE : _IncludeParser, # for Edk.x modules - MODEL_EFI_LIBRARY_INSTANCE : MetaFileParser._CommonParser, # for Edk.x modules - MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser, - MODEL_META_DATA_PACKAGE : MetaFileParser._PathParser, - MODEL_META_DATA_NMAKE : _NmakeParser, # for Edk.x modules - MODEL_PCD_FIXED_AT_BUILD : _PcdParser, - MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, - MODEL_PCD_FEATURE_FLAG : _PcdParser, - MODEL_PCD_DYNAMIC_EX : _PcdParser, - MODEL_PCD_DYNAMIC : _PcdParser, - MODEL_EFI_SOURCE_FILE : _SourceFileParser, - MODEL_EFI_GUID : MetaFileParser._CommonParser, - MODEL_EFI_PROTOCOL : MetaFileParser._CommonParser, - MODEL_EFI_PPI : MetaFileParser._CommonParser, - MODEL_EFI_DEPEX : _DepexParser, - MODEL_EFI_BINARY_FILE : _BinaryFileParser, - MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, - } - -## DSC file parser class -# -# @param FilePath The path of platform description file -# @param FileType The raw data of DSC file -# @param Table Database used to retrieve module/package information -# @param Macros Macros used for replacement in file -# @param Owner Owner ID (for sub-section parsing) -# @param From ID from which the data comes (for !INCLUDE directive) -# -class DscParser(MetaFileParser): - # DSC file supported data types (one type per section) - DataType = { - TAB_SKUIDS.upper() : MODEL_EFI_SKU_ID, - TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE, - TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, - TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION, - TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD, - TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, - TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG, - TAB_PCDS_DYNAMIC_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_DEFAULT, - TAB_PCDS_DYNAMIC_HII_NULL.upper() : MODEL_PCD_DYNAMIC_HII, - TAB_PCDS_DYNAMIC_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_VPD, - TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_EX_DEFAULT, - TAB_PCDS_DYNAMIC_EX_HII_NULL.upper() : MODEL_PCD_DYNAMIC_EX_HII, - TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_EX_VPD, - TAB_COMPONENTS.upper() : MODEL_META_DATA_COMPONENT, - TAB_COMPONENTS_SOURCE_OVERRIDE_PATH.upper() : MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH, - TAB_DSC_DEFINES.upper() : MODEL_META_DATA_HEADER, - TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, - TAB_DSC_DEFINES_EDKGLOBAL : MODEL_META_DATA_GLOBAL_DEFINE, - TAB_INCLUDE.upper() : MODEL_META_DATA_INCLUDE, - TAB_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, - TAB_IF_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, - TAB_IF_N_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF, - TAB_ELSE_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF, - TAB_ELSE.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE, - TAB_END_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF, - } - - # Valid names in define section - DefineKeywords = [ - "DSC_SPECIFICATION", - "PLATFORM_NAME", - "PLATFORM_GUID", - "PLATFORM_VERSION", - "SKUID_IDENTIFIER", - "PCD_INFO_GENERATION", - "SUPPORTED_ARCHITECTURES", - "BUILD_TARGETS", - "OUTPUT_DIRECTORY", - "FLASH_DEFINITION", - "BUILD_NUMBER", - "RFC_LANGUAGES", - "ISO_LANGUAGES", - "TIME_STAMP_FILE", - "VPD_TOOL_GUID", - "FIX_LOAD_TOP_MEMORY_ADDRESS" - ] - - SymbolPattern = ValueExpression.SymbolPattern - - ## Constructor of DscParser - # - # Initialize object of DscParser - # - # @param FilePath The path of platform description file - # @param FileType The raw data of DSC file - # @param Table Database used to retrieve module/package information - # @param Macros Macros used for replacement in file - # @param Owner Owner ID (for sub-section parsing) - # @param From ID from which the data comes (for !INCLUDE directive) - # - def __init__(self, FilePath, FileType, Table, Owner=-1, From=-1): - # prevent re-initialization - if hasattr(self, "_Table"): - return - MetaFileParser.__init__(self, FilePath, FileType, Table, Owner, From) - self._Version = 0x00010005 # Only EDK2 dsc file is supported - # to store conditional directive evaluation result - self._DirectiveStack = [] - self._DirectiveEvalStack = [] - self._Enabled = 1 - - # Final valid replacable symbols - self._Symbols = {} - # - # Map the ID between the original table and new table to track - # the owner item - # - self._IdMapping = {-1:-1} - - self.TblFile = EccGlobalData.gDb.TblFile - self.FileID = -1 - - ## Parser starter - def Start(self): - Content = '' - try: - Content = open(str(self.MetaFile.Path), 'r').readlines() - except: - EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) - # - # Insert a record for file - # - Filename = NormPath(self.MetaFile.Path) - FileID = self.TblFile.GetFileId(Filename) - if FileID: - self.FileID = FileID - else: - self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_DSC) - - - for Index in range(0, len(Content)): - Line = CleanString(Content[Index]) - # skip empty line - if Line == '': - continue - - self._CurrentLine = Line - self._LineIndex = Index - if self._InSubsection and self._Owner[-1] == -1: - self._Owner.append(self._LastItem) - - # section header - if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: - self._SectionType = MODEL_META_DATA_SECTION_HEADER - # subsection ending - elif Line[0] == '}' and self._InSubsection: - self._InSubsection = False - self._SubsectionType = MODEL_UNKNOWN - self._SubsectionName = '' - self._Owner[-1] = -1 - continue - # subsection header - elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END: - self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER - # directive line - elif Line[0] == '!': - self._DirectiveParser() - continue - - if self._InSubsection: - SectionType = self._SubsectionType - else: - SectionType = self._SectionType - self._ItemType = SectionType - - self._ValueList = ['', '', ''] - self._SectionParser[SectionType](self) - if self._ValueList == None: - continue - # - # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1, - # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 - # - for Arch, ModuleType in self._Scope: - self._LastItem = self._Store( - self._ItemType, - self._ValueList[0], - self._ValueList[1], - self._ValueList[2], - Arch, - ModuleType, - self._Owner[-1], - self.FileID, - self._From, - self._LineIndex+1, - -1, - self._LineIndex+1, - -1, - self._Enabled - ) - - if self._DirectiveStack: - Type, Line, Text = self._DirectiveStack[-1] - EdkLogger.error('Parser', FORMAT_INVALID, "No matching '!endif' found", - ExtraData=Text, File=self.MetaFile, Line=Line) - self._Done() - - ## parser - def _SubsectionHeaderParser(self): - self._SubsectionName = self._CurrentLine[1:-1].upper() - if self._SubsectionName in self.DataType: - self._SubsectionType = self.DataType[self._SubsectionName] - else: - self._SubsectionType = MODEL_UNKNOWN - EdkLogger.warn("Parser", "Unrecognized sub-section", File=self.MetaFile, - Line=self._LineIndex+1, ExtraData=self._CurrentLine) - self._ValueList[0] = self._SubsectionName - - ## Directive statement parser - def _DirectiveParser(self): - self._ValueList = ['','',''] - TokenList = GetSplitValueList(self._CurrentLine, ' ', 1) - self._ValueList[0:len(TokenList)] = TokenList - - # Syntax check - DirectiveName = self._ValueList[0].upper() - if DirectiveName not in self.DataType: - EdkLogger.error("Parser", FORMAT_INVALID, "Unknown directive [%s]" % DirectiveName, - File=self.MetaFile, Line=self._LineIndex+1) - if DirectiveName in ['!IF', '!IFDEF', '!INCLUDE', '!IFNDEF', '!ELSEIF'] and self._ValueList[1] == '': - EdkLogger.error("Parser", FORMAT_INVALID, "Missing expression", - File=self.MetaFile, Line=self._LineIndex+1, - ExtraData=self._CurrentLine) - - ItemType = self.DataType[DirectiveName] - if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF: - # Remove all directives between !if and !endif, including themselves - while self._DirectiveStack: - # Remove any !else or !elseif - DirectiveInfo = self._DirectiveStack.pop() - if DirectiveInfo[0] in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: - break - else: - EdkLogger.error("Parser", FORMAT_INVALID, "Redundant '!endif'", - File=self.MetaFile, Line=self._LineIndex+1, - ExtraData=self._CurrentLine) - elif ItemType != MODEL_META_DATA_INCLUDE: - # Break if there's a !else is followed by a !elseif - if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF and \ - self._DirectiveStack and \ - self._DirectiveStack[-1][0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE: - EdkLogger.error("Parser", FORMAT_INVALID, "'!elseif' after '!else'", - File=self.MetaFile, Line=self._LineIndex+1, - ExtraData=self._CurrentLine) - self._DirectiveStack.append((ItemType, self._LineIndex+1, self._CurrentLine)) - elif self._From > 0: - EdkLogger.error('Parser', FORMAT_INVALID, - "No '!include' allowed in included file", - ExtraData=self._CurrentLine, File=self.MetaFile, - Line=self._LineIndex+1) - - # - # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1, - # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 - # - self._LastItem = self._Store( - ItemType, - self._ValueList[0], - self._ValueList[1], - self._ValueList[2], - 'COMMON', - 'COMMON', - self._Owner[-1], - self.FileID, - self._From, - self._LineIndex+1, - -1, - self._LineIndex+1, - -1, - 0 - ) - - ## [defines] section parser - @ParseMacro - def _DefineParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - self._ValueList[1:len(TokenList)] = TokenList - - # Syntax check - if not self._ValueList[1]: - EdkLogger.error('Parser', FORMAT_INVALID, "No name specified", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - if not self._ValueList[2]: - EdkLogger.error('Parser', FORMAT_INVALID, "No value specified", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - if not self._ValueList[1] in self.DefineKeywords: - EdkLogger.error('Parser', FORMAT_INVALID, - "Unknown keyword found: %s. " - "If this is a macro you must " - "add it as a DEFINE in the DSC" % self._ValueList[1], - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - self._Defines[self._ValueList[1]] = self._ValueList[2] - self._ItemType = self.DataType[TAB_DSC_DEFINES.upper()] - - @ParseMacro - def _SkuIdParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - if len(TokenList) != 2: - EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '|'", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) - self._ValueList[0:len(TokenList)] = TokenList - - ## Parse Edk style of library modules - def _LibraryInstanceParser(self): - self._ValueList[0] = self._CurrentLine - - ## PCD sections parser - # - # [PcdsFixedAtBuild] - # [PcdsPatchableInModule] - # [PcdsFeatureFlag] - # [PcdsDynamicEx - # [PcdsDynamicExDefault] - # [PcdsDynamicExVpd] - # [PcdsDynamicExHii] - # [PcdsDynamic] - # [PcdsDynamicDefault] - # [PcdsDynamicVpd] - # [PcdsDynamicHii] - # - @ParseMacro - def _PcdParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) - self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT) - if len(TokenList) == 2: - self._ValueList[2] = TokenList[1] - if self._ValueList[0] == '' or self._ValueList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", - ExtraData=self._CurrentLine + " (.|)", - File=self.MetaFile, Line=self._LineIndex+1) - if self._ValueList[2] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given", - ExtraData=self._CurrentLine + " (.|)", - File=self.MetaFile, Line=self._LineIndex+1) - # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0. - DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1) - if DscPcdValueList[0] in ['True', 'true', 'TRUE']: - self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '1', 1); - elif DscPcdValueList[0] in ['False', 'false', 'FALSE']: - self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '0', 1); - - ## [components] section parser - @ParseMacro - def _ComponentParser(self): - if self._CurrentLine[-1] == '{': - self._ValueList[0] = self._CurrentLine[0:-1].strip() - self._InSubsection = True - else: - self._ValueList[0] = self._CurrentLine - - ## [LibraryClasses] section - @ParseMacro - def _LibraryClassParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - if len(TokenList) < 2: - EdkLogger.error('Parser', FORMAT_INVALID, "No library class or instance specified", - ExtraData=self._CurrentLine + " (|)", - File=self.MetaFile, Line=self._LineIndex+1) - if TokenList[0] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No library class specified", - ExtraData=self._CurrentLine + " (|)", - File=self.MetaFile, Line=self._LineIndex+1) - if TokenList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No library instance specified", - ExtraData=self._CurrentLine + " (|)", - File=self.MetaFile, Line=self._LineIndex+1) - - self._ValueList[0:len(TokenList)] = TokenList - - def _CompponentSourceOverridePathParser(self): - self._ValueList[0] = self._CurrentLine - - ## [BuildOptions] section parser - @ParseMacro - def _BuildOptionParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - TokenList2 = GetSplitValueList(TokenList[0], ':', 1) - if len(TokenList2) == 2: - self._ValueList[0] = TokenList2[0] # toolchain family - self._ValueList[1] = TokenList2[1] # keys - else: - self._ValueList[1] = TokenList[0] - if len(TokenList) == 2: # value - self._ValueList[2] = TokenList[1] - - if self._ValueList[1].count('_') != 4: - EdkLogger.error( - 'Parser', - FORMAT_INVALID, - "'%s' must be in format of ____FLAGS" % self._ValueList[1], - ExtraData=self._CurrentLine, - File=self.MetaFile, - Line=self._LineIndex+1 - ) - - ## Override parent's method since we'll do all macro replacements in parser - def _GetMacros(self): - Macros = {} - Macros.update(self._FileLocalMacros) - Macros.update(self._GetApplicableSectionMacro()) - Macros.update(GlobalData.gEdkGlobal) - Macros.update(GlobalData.gPlatformDefines) - Macros.update(GlobalData.gCommandLineDefines) - # PCD cannot be referenced in macro definition - if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_GLOBAL_DEFINE]: - Macros.update(self._Symbols) - return Macros - - def _PostProcess(self): - Processer = { - MODEL_META_DATA_SECTION_HEADER : self.__ProcessSectionHeader, - MODEL_META_DATA_SUBSECTION_HEADER : self.__ProcessSubsectionHeader, - MODEL_META_DATA_HEADER : self.__ProcessDefine, - MODEL_META_DATA_DEFINE : self.__ProcessDefine, - MODEL_META_DATA_GLOBAL_DEFINE : self.__ProcessDefine, - MODEL_META_DATA_INCLUDE : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IF : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF : self.__ProcessDirective, - MODEL_EFI_SKU_ID : self.__ProcessSkuId, - MODEL_EFI_LIBRARY_INSTANCE : self.__ProcessLibraryInstance, - MODEL_EFI_LIBRARY_CLASS : self.__ProcessLibraryClass, - MODEL_PCD_FIXED_AT_BUILD : self.__ProcessPcd, - MODEL_PCD_PATCHABLE_IN_MODULE : self.__ProcessPcd, - MODEL_PCD_FEATURE_FLAG : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_DEFAULT : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_HII : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_VPD : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_EX_DEFAULT : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_EX_HII : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_EX_VPD : self.__ProcessPcd, - MODEL_META_DATA_COMPONENT : self.__ProcessComponent, - MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH : self.__ProcessSourceOverridePath, - MODEL_META_DATA_BUILD_OPTION : self.__ProcessBuildOption, - MODEL_UNKNOWN : self._Skip, - MODEL_META_DATA_USER_EXTENSION : self._Skip, - } - - self._RawTable = self._Table - self._Table = MetaFileStorage(self._RawTable.Cur, self.MetaFile, MODEL_FILE_DSC, True) - self._DirectiveStack = [] - self._DirectiveEvalStack = [] - self._FileWithError = self.MetaFile - self._FileLocalMacros = {} - self._SectionsMacroDict = {} - GlobalData.gPlatformDefines = {} - - # Get all macro and PCD which has straitforward value - self.__RetrievePcdValue() - self._Content = self._RawTable.GetAll() - self._ContentIndex = 0 - while self._ContentIndex < len(self._Content) : - Id, self._ItemType, V1, V2, V3, S1, S2, Owner, BelongsToFile, self._From, \ - LineStart, ColStart, LineEnd, ColEnd, Enabled = self._Content[self._ContentIndex] - - if self._From < 0: - self._FileWithError = self.MetaFile - - self._ContentIndex += 1 - - self._Scope = [[S1, S2]] - self._LineIndex = LineStart - 1 - self._ValueList = [V1, V2, V3] - - try: - Processer[self._ItemType]() - except EvaluationException, Excpt: - # - # Only catch expression evaluation error here. We need to report - # the precise number of line on which the error occurred - # - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt), - File=self._FileWithError, ExtraData=' '.join(self._ValueList), - Line=self._LineIndex+1) - except MacroException, Excpt: - EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt), - File=self._FileWithError, ExtraData=' '.join(self._ValueList), - Line=self._LineIndex+1) - - if self._ValueList == None: - continue - - NewOwner = self._IdMapping.get(Owner, -1) - self._Enabled = int((not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack)) - self._LastItem = self._Store( - self._ItemType, - self._ValueList[0], - self._ValueList[1], - self._ValueList[2], - S1, - S2, - NewOwner, - BelongsToFile, - self._From, - self._LineIndex+1, - -1, - self._LineIndex+1, - -1, - self._Enabled - ) - self._IdMapping[Id] = self._LastItem - - RecordList = self._Table.GetAll() - - self._RawTable.Drop() - self._Table.Drop() - for Record in RecordList: - EccGlobalData.gDb.TblDsc.Insert(Record[1],Record[2],Record[3],Record[4],Record[5],Record[6],Record[7],Record[8],Record[9],Record[10],Record[11],Record[12],Record[13],Record[14]) - GlobalData.gPlatformDefines.update(self._FileLocalMacros) - self._PostProcessed = True - self._Content = None - - def __ProcessSectionHeader(self): - self._SectionName = self._ValueList[0] - if self._SectionName in self.DataType: - self._SectionType = self.DataType[self._SectionName] - else: - self._SectionType = MODEL_UNKNOWN - - def __ProcessSubsectionHeader(self): - self._SubsectionName = self._ValueList[0] - if self._SubsectionName in self.DataType: - self._SubsectionType = self.DataType[self._SubsectionName] - else: - self._SubsectionType = MODEL_UNKNOWN - - def __RetrievePcdValue(self): - Records = self._RawTable.Query(MODEL_PCD_FEATURE_FLAG, BelongsToItem=-1.0) - for TokenSpaceGuid,PcdName,Value,Dummy2,Dummy3,ID,Line in Records: - Value, DatumType, MaxDatumSize = AnalyzePcdData(Value) - # Only use PCD whose value is straitforward (no macro and PCD) - if self.SymbolPattern.findall(Value): - continue - Name = TokenSpaceGuid + '.' + PcdName - # Don't use PCD with different values. - if Name in self._Symbols and self._Symbols[Name] != Value: - self._Symbols.pop(Name) - continue - self._Symbols[Name] = Value - - Records = self._RawTable.Query(MODEL_PCD_FIXED_AT_BUILD, BelongsToItem=-1.0) - for TokenSpaceGuid,PcdName,Value,Dummy2,Dummy3,ID,Line in Records: - Value, DatumType, MaxDatumSize = AnalyzePcdData(Value) - # Only use PCD whose value is straitforward (no macro and PCD) - if self.SymbolPattern.findall(Value): - continue - Name = TokenSpaceGuid+'.'+PcdName - # Don't use PCD with different values. - if Name in self._Symbols and self._Symbols[Name] != Value: - self._Symbols.pop(Name) - continue - self._Symbols[Name] = Value - - def __ProcessDefine(self): - if not self._Enabled: - return - - Type, Name, Value = self._ValueList - Value = ReplaceMacro(Value, self._Macros, False) - if self._ItemType == MODEL_META_DATA_DEFINE: - if self._SectionType == MODEL_META_DATA_HEADER: - self._FileLocalMacros[Name] = Value - else: - SectionDictKey = self._SectionType, self._Scope[0][0], self._Scope[0][1] - if SectionDictKey not in self._SectionsMacroDict: - self._SectionsMacroDict[SectionDictKey] = {} - SectionLocalMacros = self._SectionsMacroDict[SectionDictKey] - SectionLocalMacros[Name] = Value - elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE: - GlobalData.gEdkGlobal[Name] = Value - - # - # Keyword in [Defines] section can be used as Macros - # - if (self._ItemType == MODEL_META_DATA_HEADER) and (self._SectionType == MODEL_META_DATA_HEADER): - self._FileLocalMacros[Name] = Value - - self._ValueList = [Type, Name, Value] - - def __ProcessDirective(self): - Result = None - if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF]: - Macros = self._Macros - Macros.update(GlobalData.gGlobalDefines) - try: - Result = ValueExpression(self._ValueList[1], Macros)() - except SymbolNotFound, Exc: - EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1]) - Result = False - except WrnExpression, Excpt: - # - # Catch expression evaluation warning here. We need to report - # the precise number of line and return the evaluation result - # - EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt), - File=self._FileWithError, ExtraData=' '.join(self._ValueList), - Line=self._LineIndex+1) - Result = Excpt.result - - if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: - self._DirectiveStack.append(self._ItemType) - if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF: - Result = bool(Result) - else: - Macro = self._ValueList[1] - Macro = Macro[2:-1] if (Macro.startswith("$(") and Macro.endswith(")")) else Macro - Result = Macro in self._Macros - if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF: - Result = not Result - self._DirectiveEvalStack.append(Result) - elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF: - self._DirectiveStack.append(self._ItemType) - self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1] - self._DirectiveEvalStack.append(bool(Result)) - elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE: - self._DirectiveStack[-1] = self._ItemType - self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1] - elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF: - # Back to the nearest !if/!ifdef/!ifndef - while self._DirectiveStack: - self._DirectiveEvalStack.pop() - Directive = self._DirectiveStack.pop() - if Directive in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: - break - elif self._ItemType == MODEL_META_DATA_INCLUDE: - # The included file must be relative to workspace or same directory as DSC file - __IncludeMacros = {} - # - # Allow using system environment variables in path after !include - # - __IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE'] - if "ECP_SOURCE" in GlobalData.gGlobalDefines.keys(): - __IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE'] - # - # During GenFds phase call DSC parser, will go into this branch. - # - elif "ECP_SOURCE" in GlobalData.gCommandLineDefines.keys(): - __IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE'] - - __IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE'] - __IncludeMacros['EDK_SOURCE'] = GlobalData.gGlobalDefines['EDK_SOURCE'] - # - # Allow using MACROs comes from [Defines] section to keep compatible. - # - __IncludeMacros.update(self._Macros) - - IncludedFile = NormPath(ReplaceMacro(self._ValueList[1], __IncludeMacros, RaiseError=True)) - # - # First search the include file under the same directory as DSC file - # - IncludedFile1 = PathClass(IncludedFile, self.MetaFile.Dir) - ErrorCode, ErrorInfo1 = IncludedFile1.Validate() - if ErrorCode != 0: - # - # Also search file under the WORKSPACE directory - # - IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace) - ErrorCode, ErrorInfo2 = IncludedFile1.Validate() - if ErrorCode != 0: - EdkLogger.error('parser', ErrorCode, File=self._FileWithError, - Line=self._LineIndex+1, ExtraData=ErrorInfo1 + "\n"+ ErrorInfo2) - - self._FileWithError = IncludedFile1 - - IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile1, MODEL_FILE_DSC, True) - Owner = self._Content[self._ContentIndex-1][0] - Parser = DscParser(IncludedFile1, self._FileType, IncludedFileTable, - Owner=Owner, From=Owner) - - # set the parser status with current status - Parser._SectionName = self._SectionName - Parser._SectionType = self._SectionType - Parser._Scope = self._Scope - Parser._Enabled = self._Enabled - # Parse the included file - Parser.Start() - - # update current status with sub-parser's status - self._SectionName = Parser._SectionName - self._SectionType = Parser._SectionType - self._Scope = Parser._Scope - self._Enabled = Parser._Enabled - - # Insert all records in the table for the included file into dsc file table - Records = IncludedFileTable.GetAll() - if Records: - self._Content[self._ContentIndex:self._ContentIndex] = Records - self._Content.pop(self._ContentIndex-1) - self._ValueList = None - self._ContentIndex -= 1 - - def __ProcessSkuId(self): - self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=True) - for Value in self._ValueList] - - def __ProcessLibraryInstance(self): - self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList] - - def __ProcessLibraryClass(self): - self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True) - - def __ProcessPcd(self): - ValueList = GetSplitValueList(self._ValueList[2]) - # - # PCD value can be an expression - # - if len(ValueList) > 1 and ValueList[1] == 'VOID*': - PcdValue = ValueList[0] - try: - ValueList[0] = ValueExpression(PcdValue, self._Macros)(True) - except WrnExpression, Value: - ValueList[0] = Value.result - else: - PcdValue = ValueList[-1] - try: - ValueList[-1] = ValueExpression(PcdValue, self._Macros)(True) - except WrnExpression, Value: - ValueList[-1] = Value.result - - if ValueList[-1] == 'True': - ValueList[-1] = '1' - if ValueList[-1] == 'False': - ValueList[-1] = '0' - - self._ValueList[2] = '|'.join(ValueList) - - def __ProcessComponent(self): - self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros) - - def __ProcessSourceOverridePath(self): - self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros) - - def __ProcessBuildOption(self): - self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=False) - for Value in self._ValueList] - - _SectionParser = { - MODEL_META_DATA_HEADER : _DefineParser, - MODEL_EFI_SKU_ID : _SkuIdParser, - MODEL_EFI_LIBRARY_INSTANCE : _LibraryInstanceParser, - MODEL_EFI_LIBRARY_CLASS : _LibraryClassParser, - MODEL_PCD_FIXED_AT_BUILD : _PcdParser, - MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, - MODEL_PCD_FEATURE_FLAG : _PcdParser, - MODEL_PCD_DYNAMIC_DEFAULT : _PcdParser, - MODEL_PCD_DYNAMIC_HII : _PcdParser, - MODEL_PCD_DYNAMIC_VPD : _PcdParser, - MODEL_PCD_DYNAMIC_EX_DEFAULT : _PcdParser, - MODEL_PCD_DYNAMIC_EX_HII : _PcdParser, - MODEL_PCD_DYNAMIC_EX_VPD : _PcdParser, - MODEL_META_DATA_COMPONENT : _ComponentParser, - MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH : _CompponentSourceOverridePathParser, - MODEL_META_DATA_BUILD_OPTION : _BuildOptionParser, - MODEL_UNKNOWN : MetaFileParser._Skip, - MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, - MODEL_META_DATA_SECTION_HEADER : MetaFileParser._SectionHeaderParser, - MODEL_META_DATA_SUBSECTION_HEADER : _SubsectionHeaderParser, - } - - _Macros = property(_GetMacros) - -## DEC file parser class -# -# @param FilePath The path of platform description file -# @param FileType The raw data of DSC file -# @param Table Database used to retrieve module/package information -# @param Macros Macros used for replacement in file -# -class DecParser(MetaFileParser): - # DEC file supported data types (one type per section) - DataType = { - TAB_DEC_DEFINES.upper() : MODEL_META_DATA_HEADER, - TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, - TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE, - TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, - TAB_GUIDS.upper() : MODEL_EFI_GUID, - TAB_PPIS.upper() : MODEL_EFI_PPI, - TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL, - TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD, - TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, - TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG, - TAB_PCDS_DYNAMIC_NULL.upper() : MODEL_PCD_DYNAMIC, - TAB_PCDS_DYNAMIC_EX_NULL.upper() : MODEL_PCD_DYNAMIC_EX, - } - - ## Constructor of DecParser - # - # Initialize object of DecParser - # - # @param FilePath The path of platform description file - # @param FileType The raw data of DSC file - # @param Table Database used to retrieve module/package information - # @param Macros Macros used for replacement in file - # - def __init__(self, FilePath, FileType, Table): - # prevent re-initialization - if hasattr(self, "_Table"): - return - MetaFileParser.__init__(self, FilePath, FileType, Table) - self._Comments = [] - self._Version = 0x00010005 # Only EDK2 dec file is supported - self.TblFile = EccGlobalData.gDb.TblFile - self.FileID = -1 - - ## Parser starter - def Start(self): - Content = '' - try: - Content = open(str(self.MetaFile), 'r').readlines() - except: - EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) - - # - # Insert a record for file - # - Filename = NormPath(self.MetaFile) - FileID = self.TblFile.GetFileId(Filename) - if FileID: - self.FileID = FileID - else: - self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_DEC) - - for Index in range(0, len(Content)): - Line, Comment = CleanString2(Content[Index]) - self._CurrentLine = Line - self._LineIndex = Index - - # save comment for later use - if Comment: - self._Comments.append((Comment, self._LineIndex+1)) - # skip empty line - if Line == '': - continue - - # section header - if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: - self._SectionHeaderParser() - self._Comments = [] - continue - elif len(self._SectionType) == 0: - self._Comments = [] - continue - - # section content - self._ValueList = ['','',''] - self._SectionParser[self._SectionType[0]](self) - if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE: - self._ItemType = -1 - self._Comments = [] - continue - - # - # Model, Value1, Value2, Value3, Arch, BelongsToItem=-1, LineBegin=-1, - # ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, FeatureFlag='', Enabled=-1 - # - for Arch, ModuleType, Type in self._Scope: - self._LastItem = self._Store( - Type, - self._ValueList[0], - self._ValueList[1], - self._ValueList[2], - Arch, - ModuleType, - self._Owner[-1], - self.FileID, - self._LineIndex+1, - -1, - self._LineIndex+1, - -1, - 0 - ) - for Comment, LineNo in self._Comments: - self._Store( - MODEL_META_DATA_COMMENT, - Comment, - self._ValueList[0], - self._ValueList[1], - Arch, - ModuleType, - self._LastItem, - self.FileID, - LineNo, - -1, - LineNo, - -1, - 0 - ) - self._Comments = [] - self._Done() - - def _GetApplicableSectionMacro(self): - Macros = {} - for S1, S2, SectionType in self._Scope: - for Scope1, Scope2 in [("COMMON", "COMMON"), ("COMMON", S2), (S1, "COMMON"), (S1, S2)]: - if (SectionType, Scope1, Scope2) in self._SectionsMacroDict: - Macros.update(self._SectionsMacroDict[(SectionType, Scope1, Scope2)]) - return Macros - - ## Section header parser - # - # The section header is always in following format: - # - # [section_name.arch<.platform|module_type>] - # - def _SectionHeaderParser(self): - self._Scope = [] - self._SectionName = '' - self._SectionType = [] - ArchList = set() - for Item in GetSplitValueList(self._CurrentLine[1:-1], TAB_COMMA_SPLIT): - if Item == '': - continue - ItemList = GetSplitValueList(Item, TAB_SPLIT) - - # different types of PCD are permissible in one section - self._SectionName = ItemList[0].upper() - if self._SectionName in self.DataType: - if self.DataType[self._SectionName] not in self._SectionType: - self._SectionType.append(self.DataType[self._SectionName]) - else: - EdkLogger.warn("Parser", "Unrecognized section", File=self.MetaFile, - Line=self._LineIndex+1, ExtraData=self._CurrentLine) - continue - - if MODEL_PCD_FEATURE_FLAG in self._SectionType and len(self._SectionType) > 1: - EdkLogger.error( - 'Parser', - FORMAT_INVALID, - "%s must not be in the same section of other types of PCD" % TAB_PCDS_FEATURE_FLAG_NULL, - File=self.MetaFile, - Line=self._LineIndex+1, - ExtraData=self._CurrentLine - ) - # S1 is always Arch - if len(ItemList) > 1: - S1 = ItemList[1].upper() - else: - S1 = 'COMMON' - ArchList.add(S1) - # S2 may be Platform or ModuleType - if len(ItemList) > 2: - S2 = ItemList[2].upper() - else: - S2 = 'COMMON' - if [S1, S2, self.DataType[self._SectionName]] not in self._Scope: - self._Scope.append([S1, S2, self.DataType[self._SectionName]]) - - # 'COMMON' must not be used with specific ARCHs at the same section - if 'COMMON' in ArchList and len(ArchList) > 1: - EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs", - File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine) - - ## [guids], [ppis] and [protocols] section parser - @ParseMacro - def _GuidParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - if len(TokenList) < 2: - EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name or value specified", - ExtraData=self._CurrentLine + " ( = )", - File=self.MetaFile, Line=self._LineIndex+1) - if TokenList[0] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name specified", - ExtraData=self._CurrentLine + " ( = )", - File=self.MetaFile, Line=self._LineIndex+1) - if TokenList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No GUID value specified", - ExtraData=self._CurrentLine + " ( = )", - File=self.MetaFile, Line=self._LineIndex+1) - if TokenList[1][0] != '{' or TokenList[1][-1] != '}' or GuidStructureStringToGuidString(TokenList[1]) == '': - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid GUID value format", - ExtraData=self._CurrentLine + \ - " ( = )", - File=self.MetaFile, Line=self._LineIndex+1) - self._ValueList[0] = TokenList[0] - #Parse the Guid value format - GuidValueList = TokenList[1].strip(' {}').split(',') - Index = 0 - HexList = [] - if len(GuidValueList) == 11: - for GuidValue in GuidValueList: - GuidValue = GuidValue.strip() - if GuidValue.startswith('0x') or GuidValue.startswith('0X'): - HexList.append('0x' + str(GuidValue[2:])) - Index += 1 - continue - else: - if GuidValue.startswith('{'): - HexList.append('0x' + str(GuidValue[3:])) - Index += 1 - self._ValueList[1] = "{ %s, %s, %s, { %s, %s, %s, %s, %s, %s, %s, %s }}" % (HexList[0], HexList[1], HexList[2],HexList[3],HexList[4],HexList[5],HexList[6],HexList[7],HexList[8],HexList[9],HexList[10]) - else: - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid GUID value format", - ExtraData=self._CurrentLine + \ - " ( = )", - File=self.MetaFile, Line=self._LineIndex+1) - self._ValueList[0] = '' - - ## PCD sections parser - # - # [PcdsFixedAtBuild] - # [PcdsPatchableInModule] - # [PcdsFeatureFlag] - # [PcdsDynamicEx - # [PcdsDynamic] - # - @ParseMacro - def _PcdParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) - self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT) - # check PCD information - if self._ValueList[0] == '' or self._ValueList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex+1) - # check PCD datum information - if len(TokenList) < 2 or TokenList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum information given", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex+1) - - - ValueRe = re.compile(r'^\s*L?\".*\|.*\"') - PtrValue = ValueRe.findall(TokenList[1]) - - # Has VOID* type string, may contain "|" character in the string. - if len(PtrValue) != 0: - ptrValueList = re.sub(ValueRe, '', TokenList[1]) - ValueList = GetSplitValueList(ptrValueList) - ValueList[0] = PtrValue[0] - else: - ValueList = GetSplitValueList(TokenList[1]) - - - # check if there's enough datum information given - if len(ValueList) != 3: - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information given", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex+1) - # check default value - if ValueList[0] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum information", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex+1) - # check datum type - if ValueList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum information", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex+1) - # check token of the PCD - if ValueList[2] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum information", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex+1) - # check format of default value against the datum type - IsValid, Cause = CheckPcdDatum(ValueList[1], ValueList[0]) - if not IsValid: - EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine, - File=self.MetaFile, Line=self._LineIndex+1) - - if ValueList[0] in ['True', 'true', 'TRUE']: - ValueList[0] = '1' - elif ValueList[0] in ['False', 'false', 'FALSE']: - ValueList[0] = '0' - - self._ValueList[2] = ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip() - - _SectionParser = { - MODEL_META_DATA_HEADER : MetaFileParser._DefineParser, - MODEL_EFI_INCLUDE : MetaFileParser._PathParser, - MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser, - MODEL_EFI_GUID : _GuidParser, - MODEL_EFI_PPI : _GuidParser, - MODEL_EFI_PROTOCOL : _GuidParser, - MODEL_PCD_FIXED_AT_BUILD : _PcdParser, - MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, - MODEL_PCD_FEATURE_FLAG : _PcdParser, - MODEL_PCD_DYNAMIC : _PcdParser, - MODEL_PCD_DYNAMIC_EX : _PcdParser, - MODEL_UNKNOWN : MetaFileParser._Skip, - MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, - } - - -## FdfObject -# -# This class defined basic Fdf object which is used by inheriting -# -# @param object: Inherited from object class -# -class FdfObject(object): - def __init__(self): - object.__init__() - -## Fdf -# -# This class defined the structure used in Fdf object -# -# @param FdfObject: Inherited from FdfObject class -# @param Filename: Input value for Ffilename of Fdf file, default is None -# @param WorkspaceDir: Input value for current workspace directory, default is None -# -class Fdf(FdfObject): - def __init__(self, Filename = None, IsToDatabase = False, WorkspaceDir = None, Database = None): - self.WorkspaceDir = WorkspaceDir - self.IsToDatabase = IsToDatabase - - self.Cur = Database.Cur - self.TblFile = Database.TblFile - self.TblFdf = Database.TblFdf - self.FileID = -1 - self.FileList = {} - - # - # Load Fdf file if filename is not None - # - if Filename != None: - self.LoadFdfFile(Filename) - - # - # Insert a FDF file record into database - # - def InsertFile(self, Filename): - FileID = -1 - Filename = NormPath(Filename) - if Filename not in self.FileList: - FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_FDF) - self.FileList[Filename] = FileID - - return self.FileList[Filename] - - - ## Load Fdf file - # - # Load the file if it exists - # - # @param Filename: Input value for filename of Fdf file - # - def LoadFdfFile(self, Filename): - FileList = [] - # - # Parse Fdf file - # - Filename = NormPath(Filename) - Fdf = FdfParser(Filename) - Fdf.ParseFile() - - # - # Insert inf file and pcd information - # - if self.IsToDatabase: - (Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled) = \ - (0, '', '', '', 'COMMON', 'COMMON', -1, -1, -1, -1, -1, -1, 0) - for Index in range(0, len(Fdf.Profile.PcdDict)): - pass - for Key in Fdf.Profile.PcdDict.keys(): - Model = MODEL_PCD - Value1 = Key[1] - Value2 = Key[0] - FileName = Fdf.Profile.PcdFileLineDict[Key][0] - StartLine = Fdf.Profile.PcdFileLineDict[Key][1] - BelongsToFile = self.InsertFile(FileName) - self.TblFdf.Insert(Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled) - for Index in range(0, len(Fdf.Profile.InfList)): - Model = MODEL_META_DATA_COMPONENT - Value1 = Fdf.Profile.InfList[Index] - Value2 = '' - FileName = Fdf.Profile.InfFileLineList[Index][0] - StartLine = Fdf.Profile.InfFileLineList[Index][1] - BelongsToFile = self.InsertFile(FileName) - self.TblFdf.Insert(Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled) - -## -# -# This acts like the main() function for the script, unless it is 'import'ed into another -# script. -# -if __name__ == '__main__': - pass - +## @file +# This file is used to parse meta files +# +# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import re +import time +import copy + +import Common.EdkLogger as EdkLogger +import Common.GlobalData as GlobalData +import EccGlobalData + +from CommonDataClass.DataClass import * +from Common.DataType import * +from Common.String import * +from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData +from Common.Expression import * +from CommonDataClass.Exceptions import * + +from MetaFileTable import MetaFileStorage +from GenFds.FdfParser import FdfParser + +## A decorator used to parse macro definition +def ParseMacro(Parser): + def MacroParser(self): + Match = gMacroDefPattern.match(self._CurrentLine) + if not Match: + # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method + Parser(self) + return + + TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):], TAB_EQUAL_SPLIT, 1) + # Syntax check + if not TokenList[0]: + EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + if len(TokenList) < 2: + TokenList.append('') + + Type = Match.group(1) + Name, Value = TokenList + # Global macros can be only defined via environment variable + if Name in GlobalData.gGlobalDefines: + EdkLogger.error('Parser', FORMAT_INVALID, "%s can only be defined via environment variable" % Name, + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + # Only upper case letters, digit and '_' are allowed + if not gMacroNamePattern.match(Name): + EdkLogger.error('Parser', FORMAT_INVALID, "The macro name must be in the pattern [A-Z][A-Z0-9_]*", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + + Value = ReplaceMacro(Value, self._Macros) + self._ItemType = MODEL_META_DATA_DEFINE + # DEFINE defined macros + if Type == TAB_DSC_DEFINES_DEFINE: + if type(self) == DecParser: + if MODEL_META_DATA_HEADER in self._SectionType: + self._FileLocalMacros[Name] = Value + else: + for Scope in self._Scope: + self._SectionsMacroDict.setdefault((Scope[2], Scope[0], Scope[1]), {})[Name] = Value + elif self._SectionType == MODEL_META_DATA_HEADER: + self._FileLocalMacros[Name] = Value + else: + SectionDictKey = self._SectionType, self._Scope[0][0], self._Scope[0][1] + if SectionDictKey not in self._SectionsMacroDict: + self._SectionsMacroDict[SectionDictKey] = {} + SectionLocalMacros = self._SectionsMacroDict[SectionDictKey] + SectionLocalMacros[Name] = Value + # EDK_GLOBAL defined macros + elif type(self) != DscParser: + EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + elif self._SectionType != MODEL_META_DATA_HEADER: + EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used under [Defines] section", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] != Value): + EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a macro with the same name and different value as one defined by 'DEFINE'", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + + self._ValueList = [Type, Name, Value] + + return MacroParser + +## Base class of parser +# +# This class is used for derivation purpose. The specific parser for one kind +# type file must derive this class and implement some public interfaces. +# +# @param FilePath The path of platform description file +# @param FileType The raw data of DSC file +# @param Table Database used to retrieve module/package information +# @param Macros Macros used for replacement in file +# @param Owner Owner ID (for sub-section parsing) +# @param From ID from which the data comes (for !INCLUDE directive) +# +class MetaFileParser(object): + # data type (file content) for specific file type + DataType = {} + + # Parser objects used to implement singleton + MetaFiles = {} + + ## Factory method + # + # One file, one parser object. This factory method makes sure that there's + # only one object constructed for one meta file. + # + # @param Class class object of real AutoGen class + # (InfParser, DecParser or DscParser) + # @param FilePath The path of meta file + # @param *args The specific class related parameters + # @param **kwargs The specific class related dict parameters + # + def __new__(Class, FilePath, *args, **kwargs): + if FilePath in Class.MetaFiles: + return Class.MetaFiles[FilePath] + else: + ParserObject = super(MetaFileParser, Class).__new__(Class) + Class.MetaFiles[FilePath] = ParserObject + return ParserObject + + ## Constructor of MetaFileParser + # + # Initialize object of MetaFileParser + # + # @param FilePath The path of platform description file + # @param FileType The raw data of DSC file + # @param Table Database used to retrieve module/package information + # @param Macros Macros used for replacement in file + # @param Owner Owner ID (for sub-section parsing) + # @param From ID from which the data comes (for !INCLUDE directive) + # + def __init__(self, FilePath, FileType, Table, Owner=-1, From=-1): + self._Table = Table + self._RawTable = Table + self._FileType = FileType + self.MetaFile = FilePath + self._Defines = {} + self._FileLocalMacros = {} + self._SectionsMacroDict = {} + + # for recursive parsing + self._Owner = [Owner] + self._From = From + + # parsr status for parsing + self._ValueList = ['', '', '', '', ''] + self._Scope = [] + self._LineIndex = 0 + self._CurrentLine = '' + self._SectionType = MODEL_UNKNOWN + self._SectionName = '' + self._InSubsection = False + self._SubsectionType = MODEL_UNKNOWN + self._SubsectionName = '' + self._ItemType = MODEL_UNKNOWN + self._LastItem = -1 + self._Enabled = 0 + self._Finished = False + self._PostProcessed = False + # Different version of meta-file has different way to parse. + self._Version = 0 + + ## Store the parsed data in table + def _Store(self, *Args): + return self._Table.Insert(*Args) + + ## Virtual method for starting parse + def Start(self): + raise NotImplementedError + + ## Notify a post-process is needed + def DoPostProcess(self): + self._PostProcessed = False + + ## Set parsing complete flag in both class and table + def _Done(self): + self._Finished = True + ## Do not set end flag when processing included files + if self._From == -1: + self._Table.SetEndFlag() + + def _PostProcess(self): + self._PostProcessed = True + + ## Get the parse complete flag + def _GetFinished(self): + return self._Finished + + ## Set the complete flag + def _SetFinished(self, Value): + self._Finished = Value + + ## Use [] style to query data in table, just for readability + # + # DataInfo = [data_type, scope1(arch), scope2(platform/moduletype)] + # + def __getitem__(self, DataInfo): + if type(DataInfo) != type(()): + DataInfo = (DataInfo,) + + # Parse the file first, if necessary + if not self._Finished: + if self._RawTable.IsIntegrity(): + self._Finished = True + else: + self._Table = self._RawTable + self._PostProcessed = False + self.Start() + + # No specific ARCH or Platform given, use raw data + if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] == None): + return self._RawTable.Query(*DataInfo) + + # Do post-process if necessary + if not self._PostProcessed: + self._PostProcess() + + return self._Table.Query(*DataInfo) + + ## Data parser for the common format in different type of file + # + # The common format in the meatfile is like + # + # xxx1 | xxx2 | xxx3 + # + @ParseMacro + def _CommonParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + self._ValueList[0:len(TokenList)] = TokenList + + ## Data parser for the format in which there's path + # + # Only path can have macro used. So we need to replace them before use. + # + @ParseMacro + def _PathParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + self._ValueList[0:len(TokenList)] = TokenList + # Don't do macro replacement for dsc file at this point + if type(self) != DscParser: + Macros = self._Macros + self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList] + + ## Skip unsupported data + def _Skip(self): + EdkLogger.warn("Parser", "Unrecognized content", File=self.MetaFile, + Line=self._LineIndex+1, ExtraData=self._CurrentLine); + self._ValueList[0:1] = [self._CurrentLine] + + ## Section header parser + # + # The section header is always in following format: + # + # [section_name.arch<.platform|module_type>] + # + def _SectionHeaderParser(self): + self._Scope = [] + self._SectionName = '' + ArchList = set() + for Item in GetSplitValueList(self._CurrentLine[1:-1], TAB_COMMA_SPLIT): + if Item == '': + continue + ItemList = GetSplitValueList(Item, TAB_SPLIT) + # different section should not mix in one section + if self._SectionName != '' and self._SectionName != ItemList[0].upper(): + EdkLogger.error('Parser', FORMAT_INVALID, "Different section names in the same section", + File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine) + self._SectionName = ItemList[0].upper() + if self._SectionName in self.DataType: + self._SectionType = self.DataType[self._SectionName] + else: + self._SectionType = MODEL_UNKNOWN + EdkLogger.warn("Parser", "Unrecognized section", File=self.MetaFile, + Line=self._LineIndex+1, ExtraData=self._CurrentLine) + # S1 is always Arch + if len(ItemList) > 1: + S1 = ItemList[1].upper() + else: + S1 = 'COMMON' + ArchList.add(S1) + # S2 may be Platform or ModuleType + if len(ItemList) > 2: + S2 = ItemList[2].upper() + else: + S2 = 'COMMON' + self._Scope.append([S1, S2]) + + # 'COMMON' must not be used with specific ARCHs at the same section + if 'COMMON' in ArchList and len(ArchList) > 1: + EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs", + File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine) + # If the section information is needed later, it should be stored in database + self._ValueList[0] = self._SectionName + + ## [defines] section parser + @ParseMacro + def _DefineParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + self._ValueList[1:len(TokenList)] = TokenList + if not self._ValueList[1]: + EdkLogger.error('Parser', FORMAT_INVALID, "No name specified", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + if not self._ValueList[2]: + EdkLogger.error('Parser', FORMAT_INVALID, "No value specified", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + + self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList] + Name, Value = self._ValueList[1], self._ValueList[2] + # Sometimes, we need to make differences between EDK and EDK2 modules + if Name == 'INF_VERSION': + try: + self._Version = int(Value, 0) + except: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + + if type(self) == InfParser and self._Version < 0x00010005: + # EDK module allows using defines as macros + self._FileLocalMacros[Name] = Value + self._Defines[Name] = Value + + ## [BuildOptions] section parser + @ParseMacro + def _BuildOptionParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + TokenList2 = GetSplitValueList(TokenList[0], ':', 1) + if len(TokenList2) == 2: + self._ValueList[0] = TokenList2[0] # toolchain family + self._ValueList[1] = TokenList2[1] # keys + else: + self._ValueList[1] = TokenList[0] + if len(TokenList) == 2 and type(self) != DscParser: # value + self._ValueList[2] = ReplaceMacro(TokenList[1], self._Macros) + + if self._ValueList[1].count('_') != 4: + EdkLogger.error( + 'Parser', + FORMAT_INVALID, + "'%s' must be in format of ____FLAGS" % self._ValueList[1], + ExtraData=self._CurrentLine, + File=self.MetaFile, + Line=self._LineIndex+1 + ) + + def _GetMacros(self): + Macros = {} + Macros.update(self._FileLocalMacros) + Macros.update(self._GetApplicableSectionMacro()) + return Macros + + + ## Get section Macros that are applicable to current line, which may come from other sections + ## that share the same name while scope is wider + def _GetApplicableSectionMacro(self): + Macros = {} + for Scope1, Scope2 in [("COMMON", "COMMON"), ("COMMON", self._Scope[0][1]), + (self._Scope[0][0], "COMMON"), (self._Scope[0][0], self._Scope[0][1])]: + if (self._SectionType, Scope1, Scope2) in self._SectionsMacroDict: + Macros.update(self._SectionsMacroDict[(self._SectionType, Scope1, Scope2)]) + return Macros + + _SectionParser = {} + Finished = property(_GetFinished, _SetFinished) + _Macros = property(_GetMacros) + + +## INF file parser class +# +# @param FilePath The path of platform description file +# @param FileType The raw data of DSC file +# @param Table Database used to retrieve module/package information +# @param Macros Macros used for replacement in file +# +class InfParser(MetaFileParser): + # INF file supported data types (one type per section) + DataType = { + TAB_UNKNOWN.upper() : MODEL_UNKNOWN, + TAB_INF_DEFINES.upper() : MODEL_META_DATA_HEADER, + TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, + TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION, + TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE, + TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE, + TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, + TAB_PACKAGES.upper() : MODEL_META_DATA_PACKAGE, + TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE, + TAB_INF_FIXED_PCD.upper() : MODEL_PCD_FIXED_AT_BUILD, + TAB_INF_PATCH_PCD.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, + TAB_INF_FEATURE_PCD.upper() : MODEL_PCD_FEATURE_FLAG, + TAB_INF_PCD_EX.upper() : MODEL_PCD_DYNAMIC_EX, + TAB_INF_PCD.upper() : MODEL_PCD_DYNAMIC, + TAB_SOURCES.upper() : MODEL_EFI_SOURCE_FILE, + TAB_GUIDS.upper() : MODEL_EFI_GUID, + TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL, + TAB_PPIS.upper() : MODEL_EFI_PPI, + TAB_DEPEX.upper() : MODEL_EFI_DEPEX, + TAB_BINARIES.upper() : MODEL_EFI_BINARY_FILE, + TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION + } + + ## Constructor of InfParser + # + # Initialize object of InfParser + # + # @param FilePath The path of module description file + # @param FileType The raw data of DSC file + # @param Table Database used to retrieve module/package information + # @param Macros Macros used for replacement in file + # + def __init__(self, FilePath, FileType, Table): + # prevent re-initialization + if hasattr(self, "_Table"): + return + MetaFileParser.__init__(self, FilePath, FileType, Table) + self.TblFile = EccGlobalData.gDb.TblFile + self.FileID = -1 + + ## Parser starter + def Start(self): + NmakeLine = '' + Content = '' + try: + Content = open(str(self.MetaFile), 'r').readlines() + except: + EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) + # + # Insert a record for file + # + Filename = NormPath(self.MetaFile) + FileID = self.TblFile.GetFileId(Filename) + if FileID: + self.FileID = FileID + else: + self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_INF) + + # parse the file line by line + IsFindBlockComment = False + + for Index in range(0, len(Content)): + # skip empty, commented, block commented lines + Line = CleanString(Content[Index], AllowCppStyleComment=True) + NextLine = '' + if Index + 1 < len(Content): + NextLine = CleanString(Content[Index + 1]) + if Line == '': + continue + if Line.find(DataType.TAB_COMMENT_EDK_START) > -1: + IsFindBlockComment = True + continue + if Line.find(DataType.TAB_COMMENT_EDK_END) > -1: + IsFindBlockComment = False + continue + if IsFindBlockComment: + continue + + self._LineIndex = Index + self._CurrentLine = Line + + # section header + if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: + self._SectionHeaderParser() + # Check invalid sections + if self._Version < 0x00010005: + if self._SectionType in [MODEL_META_DATA_BUILD_OPTION, + MODEL_EFI_LIBRARY_CLASS, + MODEL_META_DATA_PACKAGE, + MODEL_PCD_FIXED_AT_BUILD, + MODEL_PCD_PATCHABLE_IN_MODULE, + MODEL_PCD_FEATURE_FLAG, + MODEL_PCD_DYNAMIC_EX, + MODEL_PCD_DYNAMIC, + MODEL_EFI_GUID, + MODEL_EFI_PROTOCOL, + MODEL_EFI_PPI, + MODEL_META_DATA_USER_EXTENSION]: + EdkLogger.error('Parser', FORMAT_INVALID, + "Section [%s] is not allowed in inf file without version" % (self._SectionName), + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + elif self._SectionType in [MODEL_EFI_INCLUDE, + MODEL_EFI_LIBRARY_INSTANCE, + MODEL_META_DATA_NMAKE]: + EdkLogger.error('Parser', FORMAT_INVALID, + "Section [%s] is not allowed in inf file with version 0x%08x" % (self._SectionName, self._Version), + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + continue + # merge two lines specified by '\' in section NMAKE + elif self._SectionType == MODEL_META_DATA_NMAKE: + if Line[-1] == '\\': + if NextLine == '': + self._CurrentLine = NmakeLine + Line[0:-1] + NmakeLine = '' + else: + if NextLine[0] == TAB_SECTION_START and NextLine[-1] == TAB_SECTION_END: + self._CurrentLine = NmakeLine + Line[0:-1] + NmakeLine = '' + else: + NmakeLine = NmakeLine + ' ' + Line[0:-1] + continue + else: + self._CurrentLine = NmakeLine + Line + NmakeLine = '' + + # section content + self._ValueList = ['','',''] + # parse current line, result will be put in self._ValueList + self._SectionParser[self._SectionType](self) + if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE: + self._ItemType = -1 + continue + # + # Model, Value1, Value2, Value3, Arch, Platform, BelongsToItem=-1, + # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 + # + self._ValueList[0] = self._ValueList[0].replace('/', '\\') + for Arch, Platform in self._Scope: + self._Store(self._SectionType, + self._ValueList[0], + self._ValueList[1], + self._ValueList[2], + Arch, + Platform, + self._Owner[-1], + self.FileID, + self._LineIndex+1, + -1, + self._LineIndex+1, + -1, + 0 + ) + if IsFindBlockComment: + EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */", + File=self.MetaFile) + self._Done() + + ## Data parser for the format in which there's path + # + # Only path can have macro used. So we need to replace them before use. + # + def _IncludeParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + self._ValueList[0:len(TokenList)] = TokenList + Macros = self._Macros + if Macros: + for Index in range(0, len(self._ValueList)): + Value = self._ValueList[Index] + if not Value: + continue + + if Value.upper().find('$(EFI_SOURCE)\Edk'.upper()) > -1 or Value.upper().find('$(EFI_SOURCE)/Edk'.upper()) > -1: + Value = '$(EDK_SOURCE)' + Value[17:] + if Value.find('$(EFI_SOURCE)') > -1 or Value.find('$(EDK_SOURCE)') > -1: + pass + elif Value.startswith('.'): + pass + elif Value.startswith('$('): + pass + else: + Value = '$(EFI_SOURCE)/' + Value + + self._ValueList[Index] = ReplaceMacro(Value, Macros) + + ## Parse [Sources] section + # + # Only path can have macro used. So we need to replace them before use. + # + @ParseMacro + def _SourceFileParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + self._ValueList[0:len(TokenList)] = TokenList + Macros = self._Macros + # For Acpi tables, remove macro like ' TABLE_NAME=Sata1' + if 'COMPONENT_TYPE' in Macros: + if self._Defines['COMPONENT_TYPE'].upper() == 'ACPITABLE': + self._ValueList[0] = GetSplitValueList(self._ValueList[0], ' ', 1)[0] + if self._Defines['BASE_NAME'] == 'Microcode': + pass + self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList] + + ## Parse [Binaries] section + # + # Only path can have macro used. So we need to replace them before use. + # + @ParseMacro + def _BinaryFileParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 2) + if len(TokenList) < 2: + EdkLogger.error('Parser', FORMAT_INVALID, "No file type or path specified", + ExtraData=self._CurrentLine + " ( | [| ])", + File=self.MetaFile, Line=self._LineIndex+1) + if not TokenList[0]: + EdkLogger.error('Parser', FORMAT_INVALID, "No file type specified", + ExtraData=self._CurrentLine + " ( | [| ])", + File=self.MetaFile, Line=self._LineIndex+1) + if not TokenList[1]: + EdkLogger.error('Parser', FORMAT_INVALID, "No file path specified", + ExtraData=self._CurrentLine + " ( | [| ])", + File=self.MetaFile, Line=self._LineIndex+1) + self._ValueList[0:len(TokenList)] = TokenList + self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros) + + ## [nmake] section parser (Edk.x style only) + def _NmakeParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + self._ValueList[0:len(TokenList)] = TokenList + # remove macros + self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros) + # remove self-reference in macro setting + #self._ValueList[1] = ReplaceMacro(self._ValueList[1], {self._ValueList[0]:''}) + + ## [FixedPcd], [FeaturePcd], [PatchPcd], [Pcd] and [PcdEx] sections parser + @ParseMacro + def _PcdParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) + ValueList = GetSplitValueList(TokenList[0], TAB_SPLIT) + if len(ValueList) != 2: + EdkLogger.error('Parser', FORMAT_INVALID, "Illegal token space GUID and PCD name format", + ExtraData=self._CurrentLine + " (.)", + File=self.MetaFile, Line=self._LineIndex+1) + self._ValueList[0:1] = ValueList + if len(TokenList) > 1: + self._ValueList[2] = TokenList[1] + if self._ValueList[0] == '' or self._ValueList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", + ExtraData=self._CurrentLine + " (.)", + File=self.MetaFile, Line=self._LineIndex+1) + + # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0. + if self._ValueList[2] != '': + InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1) + if InfPcdValueList[0] in ['True', 'true', 'TRUE']: + self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1); + elif InfPcdValueList[0] in ['False', 'false', 'FALSE']: + self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1); + + ## [depex] section parser + @ParseMacro + def _DepexParser(self): + self._ValueList[0:1] = [self._CurrentLine] + + _SectionParser = { + MODEL_UNKNOWN : MetaFileParser._Skip, + MODEL_META_DATA_HEADER : MetaFileParser._DefineParser, + MODEL_META_DATA_BUILD_OPTION : MetaFileParser._BuildOptionParser, + MODEL_EFI_INCLUDE : _IncludeParser, # for Edk.x modules + MODEL_EFI_LIBRARY_INSTANCE : MetaFileParser._CommonParser, # for Edk.x modules + MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser, + MODEL_META_DATA_PACKAGE : MetaFileParser._PathParser, + MODEL_META_DATA_NMAKE : _NmakeParser, # for Edk.x modules + MODEL_PCD_FIXED_AT_BUILD : _PcdParser, + MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, + MODEL_PCD_FEATURE_FLAG : _PcdParser, + MODEL_PCD_DYNAMIC_EX : _PcdParser, + MODEL_PCD_DYNAMIC : _PcdParser, + MODEL_EFI_SOURCE_FILE : _SourceFileParser, + MODEL_EFI_GUID : MetaFileParser._CommonParser, + MODEL_EFI_PROTOCOL : MetaFileParser._CommonParser, + MODEL_EFI_PPI : MetaFileParser._CommonParser, + MODEL_EFI_DEPEX : _DepexParser, + MODEL_EFI_BINARY_FILE : _BinaryFileParser, + MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, + } + +## DSC file parser class +# +# @param FilePath The path of platform description file +# @param FileType The raw data of DSC file +# @param Table Database used to retrieve module/package information +# @param Macros Macros used for replacement in file +# @param Owner Owner ID (for sub-section parsing) +# @param From ID from which the data comes (for !INCLUDE directive) +# +class DscParser(MetaFileParser): + # DSC file supported data types (one type per section) + DataType = { + TAB_SKUIDS.upper() : MODEL_EFI_SKU_ID, + TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE, + TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, + TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION, + TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD, + TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, + TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG, + TAB_PCDS_DYNAMIC_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_DEFAULT, + TAB_PCDS_DYNAMIC_HII_NULL.upper() : MODEL_PCD_DYNAMIC_HII, + TAB_PCDS_DYNAMIC_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_VPD, + TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_EX_DEFAULT, + TAB_PCDS_DYNAMIC_EX_HII_NULL.upper() : MODEL_PCD_DYNAMIC_EX_HII, + TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_EX_VPD, + TAB_COMPONENTS.upper() : MODEL_META_DATA_COMPONENT, + TAB_COMPONENTS_SOURCE_OVERRIDE_PATH.upper() : MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH, + TAB_DSC_DEFINES.upper() : MODEL_META_DATA_HEADER, + TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, + TAB_DSC_DEFINES_EDKGLOBAL : MODEL_META_DATA_GLOBAL_DEFINE, + TAB_INCLUDE.upper() : MODEL_META_DATA_INCLUDE, + TAB_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, + TAB_IF_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, + TAB_IF_N_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF, + TAB_ELSE_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF, + TAB_ELSE.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE, + TAB_END_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF, + } + + # Valid names in define section + DefineKeywords = [ + "DSC_SPECIFICATION", + "PLATFORM_NAME", + "PLATFORM_GUID", + "PLATFORM_VERSION", + "SKUID_IDENTIFIER", + "PCD_INFO_GENERATION", + "SUPPORTED_ARCHITECTURES", + "BUILD_TARGETS", + "OUTPUT_DIRECTORY", + "FLASH_DEFINITION", + "BUILD_NUMBER", + "RFC_LANGUAGES", + "ISO_LANGUAGES", + "TIME_STAMP_FILE", + "VPD_TOOL_GUID", + "FIX_LOAD_TOP_MEMORY_ADDRESS" + ] + + SymbolPattern = ValueExpression.SymbolPattern + + ## Constructor of DscParser + # + # Initialize object of DscParser + # + # @param FilePath The path of platform description file + # @param FileType The raw data of DSC file + # @param Table Database used to retrieve module/package information + # @param Macros Macros used for replacement in file + # @param Owner Owner ID (for sub-section parsing) + # @param From ID from which the data comes (for !INCLUDE directive) + # + def __init__(self, FilePath, FileType, Table, Owner=-1, From=-1): + # prevent re-initialization + if hasattr(self, "_Table"): + return + MetaFileParser.__init__(self, FilePath, FileType, Table, Owner, From) + self._Version = 0x00010005 # Only EDK2 dsc file is supported + # to store conditional directive evaluation result + self._DirectiveStack = [] + self._DirectiveEvalStack = [] + self._Enabled = 1 + + # Final valid replacable symbols + self._Symbols = {} + # + # Map the ID between the original table and new table to track + # the owner item + # + self._IdMapping = {-1:-1} + + self.TblFile = EccGlobalData.gDb.TblFile + self.FileID = -1 + + ## Parser starter + def Start(self): + Content = '' + try: + Content = open(str(self.MetaFile.Path), 'r').readlines() + except: + EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) + # + # Insert a record for file + # + Filename = NormPath(self.MetaFile.Path) + FileID = self.TblFile.GetFileId(Filename) + if FileID: + self.FileID = FileID + else: + self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_DSC) + + + for Index in range(0, len(Content)): + Line = CleanString(Content[Index]) + # skip empty line + if Line == '': + continue + + self._CurrentLine = Line + self._LineIndex = Index + if self._InSubsection and self._Owner[-1] == -1: + self._Owner.append(self._LastItem) + + # section header + if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: + self._SectionType = MODEL_META_DATA_SECTION_HEADER + # subsection ending + elif Line[0] == '}' and self._InSubsection: + self._InSubsection = False + self._SubsectionType = MODEL_UNKNOWN + self._SubsectionName = '' + self._Owner[-1] = -1 + continue + # subsection header + elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END: + self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER + # directive line + elif Line[0] == '!': + self._DirectiveParser() + continue + + if self._InSubsection: + SectionType = self._SubsectionType + else: + SectionType = self._SectionType + self._ItemType = SectionType + + self._ValueList = ['', '', ''] + self._SectionParser[SectionType](self) + if self._ValueList == None: + continue + # + # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1, + # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 + # + for Arch, ModuleType in self._Scope: + self._LastItem = self._Store( + self._ItemType, + self._ValueList[0], + self._ValueList[1], + self._ValueList[2], + Arch, + ModuleType, + self._Owner[-1], + self.FileID, + self._From, + self._LineIndex+1, + -1, + self._LineIndex+1, + -1, + self._Enabled + ) + + if self._DirectiveStack: + Type, Line, Text = self._DirectiveStack[-1] + EdkLogger.error('Parser', FORMAT_INVALID, "No matching '!endif' found", + ExtraData=Text, File=self.MetaFile, Line=Line) + self._Done() + + ## parser + def _SubsectionHeaderParser(self): + self._SubsectionName = self._CurrentLine[1:-1].upper() + if self._SubsectionName in self.DataType: + self._SubsectionType = self.DataType[self._SubsectionName] + else: + self._SubsectionType = MODEL_UNKNOWN + EdkLogger.warn("Parser", "Unrecognized sub-section", File=self.MetaFile, + Line=self._LineIndex+1, ExtraData=self._CurrentLine) + self._ValueList[0] = self._SubsectionName + + ## Directive statement parser + def _DirectiveParser(self): + self._ValueList = ['','',''] + TokenList = GetSplitValueList(self._CurrentLine, ' ', 1) + self._ValueList[0:len(TokenList)] = TokenList + + # Syntax check + DirectiveName = self._ValueList[0].upper() + if DirectiveName not in self.DataType: + EdkLogger.error("Parser", FORMAT_INVALID, "Unknown directive [%s]" % DirectiveName, + File=self.MetaFile, Line=self._LineIndex+1) + if DirectiveName in ['!IF', '!IFDEF', '!INCLUDE', '!IFNDEF', '!ELSEIF'] and self._ValueList[1] == '': + EdkLogger.error("Parser", FORMAT_INVALID, "Missing expression", + File=self.MetaFile, Line=self._LineIndex+1, + ExtraData=self._CurrentLine) + + ItemType = self.DataType[DirectiveName] + if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF: + # Remove all directives between !if and !endif, including themselves + while self._DirectiveStack: + # Remove any !else or !elseif + DirectiveInfo = self._DirectiveStack.pop() + if DirectiveInfo[0] in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: + break + else: + EdkLogger.error("Parser", FORMAT_INVALID, "Redundant '!endif'", + File=self.MetaFile, Line=self._LineIndex+1, + ExtraData=self._CurrentLine) + elif ItemType != MODEL_META_DATA_INCLUDE: + # Break if there's a !else is followed by a !elseif + if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF and \ + self._DirectiveStack and \ + self._DirectiveStack[-1][0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE: + EdkLogger.error("Parser", FORMAT_INVALID, "'!elseif' after '!else'", + File=self.MetaFile, Line=self._LineIndex+1, + ExtraData=self._CurrentLine) + self._DirectiveStack.append((ItemType, self._LineIndex+1, self._CurrentLine)) + elif self._From > 0: + EdkLogger.error('Parser', FORMAT_INVALID, + "No '!include' allowed in included file", + ExtraData=self._CurrentLine, File=self.MetaFile, + Line=self._LineIndex+1) + + # + # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1, + # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 + # + self._LastItem = self._Store( + ItemType, + self._ValueList[0], + self._ValueList[1], + self._ValueList[2], + 'COMMON', + 'COMMON', + self._Owner[-1], + self.FileID, + self._From, + self._LineIndex+1, + -1, + self._LineIndex+1, + -1, + 0 + ) + + ## [defines] section parser + @ParseMacro + def _DefineParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + self._ValueList[1:len(TokenList)] = TokenList + + # Syntax check + if not self._ValueList[1]: + EdkLogger.error('Parser', FORMAT_INVALID, "No name specified", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + if not self._ValueList[2]: + EdkLogger.error('Parser', FORMAT_INVALID, "No value specified", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + if not self._ValueList[1] in self.DefineKeywords: + EdkLogger.error('Parser', FORMAT_INVALID, + "Unknown keyword found: %s. " + "If this is a macro you must " + "add it as a DEFINE in the DSC" % self._ValueList[1], + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + self._Defines[self._ValueList[1]] = self._ValueList[2] + self._ItemType = self.DataType[TAB_DSC_DEFINES.upper()] + + @ParseMacro + def _SkuIdParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + if len(TokenList) != 2: + EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '|'", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) + self._ValueList[0:len(TokenList)] = TokenList + + ## Parse Edk style of library modules + def _LibraryInstanceParser(self): + self._ValueList[0] = self._CurrentLine + + ## PCD sections parser + # + # [PcdsFixedAtBuild] + # [PcdsPatchableInModule] + # [PcdsFeatureFlag] + # [PcdsDynamicEx + # [PcdsDynamicExDefault] + # [PcdsDynamicExVpd] + # [PcdsDynamicExHii] + # [PcdsDynamic] + # [PcdsDynamicDefault] + # [PcdsDynamicVpd] + # [PcdsDynamicHii] + # + @ParseMacro + def _PcdParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) + self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT) + if len(TokenList) == 2: + self._ValueList[2] = TokenList[1] + if self._ValueList[0] == '' or self._ValueList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", + ExtraData=self._CurrentLine + " (.|)", + File=self.MetaFile, Line=self._LineIndex+1) + if self._ValueList[2] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given", + ExtraData=self._CurrentLine + " (.|)", + File=self.MetaFile, Line=self._LineIndex+1) + # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0. + DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1) + if DscPcdValueList[0] in ['True', 'true', 'TRUE']: + self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '1', 1); + elif DscPcdValueList[0] in ['False', 'false', 'FALSE']: + self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '0', 1); + + ## [components] section parser + @ParseMacro + def _ComponentParser(self): + if self._CurrentLine[-1] == '{': + self._ValueList[0] = self._CurrentLine[0:-1].strip() + self._InSubsection = True + else: + self._ValueList[0] = self._CurrentLine + + ## [LibraryClasses] section + @ParseMacro + def _LibraryClassParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + if len(TokenList) < 2: + EdkLogger.error('Parser', FORMAT_INVALID, "No library class or instance specified", + ExtraData=self._CurrentLine + " (|)", + File=self.MetaFile, Line=self._LineIndex+1) + if TokenList[0] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No library class specified", + ExtraData=self._CurrentLine + " (|)", + File=self.MetaFile, Line=self._LineIndex+1) + if TokenList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No library instance specified", + ExtraData=self._CurrentLine + " (|)", + File=self.MetaFile, Line=self._LineIndex+1) + + self._ValueList[0:len(TokenList)] = TokenList + + def _CompponentSourceOverridePathParser(self): + self._ValueList[0] = self._CurrentLine + + ## [BuildOptions] section parser + @ParseMacro + def _BuildOptionParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + TokenList2 = GetSplitValueList(TokenList[0], ':', 1) + if len(TokenList2) == 2: + self._ValueList[0] = TokenList2[0] # toolchain family + self._ValueList[1] = TokenList2[1] # keys + else: + self._ValueList[1] = TokenList[0] + if len(TokenList) == 2: # value + self._ValueList[2] = TokenList[1] + + if self._ValueList[1].count('_') != 4: + EdkLogger.error( + 'Parser', + FORMAT_INVALID, + "'%s' must be in format of ____FLAGS" % self._ValueList[1], + ExtraData=self._CurrentLine, + File=self.MetaFile, + Line=self._LineIndex+1 + ) + + ## Override parent's method since we'll do all macro replacements in parser + def _GetMacros(self): + Macros = {} + Macros.update(self._FileLocalMacros) + Macros.update(self._GetApplicableSectionMacro()) + Macros.update(GlobalData.gEdkGlobal) + Macros.update(GlobalData.gPlatformDefines) + Macros.update(GlobalData.gCommandLineDefines) + # PCD cannot be referenced in macro definition + if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_GLOBAL_DEFINE]: + Macros.update(self._Symbols) + return Macros + + def _PostProcess(self): + Processer = { + MODEL_META_DATA_SECTION_HEADER : self.__ProcessSectionHeader, + MODEL_META_DATA_SUBSECTION_HEADER : self.__ProcessSubsectionHeader, + MODEL_META_DATA_HEADER : self.__ProcessDefine, + MODEL_META_DATA_DEFINE : self.__ProcessDefine, + MODEL_META_DATA_GLOBAL_DEFINE : self.__ProcessDefine, + MODEL_META_DATA_INCLUDE : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IF : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF : self.__ProcessDirective, + MODEL_EFI_SKU_ID : self.__ProcessSkuId, + MODEL_EFI_LIBRARY_INSTANCE : self.__ProcessLibraryInstance, + MODEL_EFI_LIBRARY_CLASS : self.__ProcessLibraryClass, + MODEL_PCD_FIXED_AT_BUILD : self.__ProcessPcd, + MODEL_PCD_PATCHABLE_IN_MODULE : self.__ProcessPcd, + MODEL_PCD_FEATURE_FLAG : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_DEFAULT : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_HII : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_VPD : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_EX_DEFAULT : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_EX_HII : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_EX_VPD : self.__ProcessPcd, + MODEL_META_DATA_COMPONENT : self.__ProcessComponent, + MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH : self.__ProcessSourceOverridePath, + MODEL_META_DATA_BUILD_OPTION : self.__ProcessBuildOption, + MODEL_UNKNOWN : self._Skip, + MODEL_META_DATA_USER_EXTENSION : self._Skip, + } + + self._RawTable = self._Table + self._Table = MetaFileStorage(self._RawTable.Cur, self.MetaFile, MODEL_FILE_DSC, True) + self._DirectiveStack = [] + self._DirectiveEvalStack = [] + self._FileWithError = self.MetaFile + self._FileLocalMacros = {} + self._SectionsMacroDict = {} + GlobalData.gPlatformDefines = {} + + # Get all macro and PCD which has straitforward value + self.__RetrievePcdValue() + self._Content = self._RawTable.GetAll() + self._ContentIndex = 0 + while self._ContentIndex < len(self._Content) : + Id, self._ItemType, V1, V2, V3, S1, S2, Owner, BelongsToFile, self._From, \ + LineStart, ColStart, LineEnd, ColEnd, Enabled = self._Content[self._ContentIndex] + + if self._From < 0: + self._FileWithError = self.MetaFile + + self._ContentIndex += 1 + + self._Scope = [[S1, S2]] + self._LineIndex = LineStart - 1 + self._ValueList = [V1, V2, V3] + + try: + Processer[self._ItemType]() + except EvaluationException, Excpt: + # + # Only catch expression evaluation error here. We need to report + # the precise number of line on which the error occurred + # + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt), + File=self._FileWithError, ExtraData=' '.join(self._ValueList), + Line=self._LineIndex+1) + except MacroException, Excpt: + EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt), + File=self._FileWithError, ExtraData=' '.join(self._ValueList), + Line=self._LineIndex+1) + + if self._ValueList == None: + continue + + NewOwner = self._IdMapping.get(Owner, -1) + self._Enabled = int((not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack)) + self._LastItem = self._Store( + self._ItemType, + self._ValueList[0], + self._ValueList[1], + self._ValueList[2], + S1, + S2, + NewOwner, + BelongsToFile, + self._From, + self._LineIndex+1, + -1, + self._LineIndex+1, + -1, + self._Enabled + ) + self._IdMapping[Id] = self._LastItem + + RecordList = self._Table.GetAll() + + self._RawTable.Drop() + self._Table.Drop() + for Record in RecordList: + EccGlobalData.gDb.TblDsc.Insert(Record[1],Record[2],Record[3],Record[4],Record[5],Record[6],Record[7],Record[8],Record[9],Record[10],Record[11],Record[12],Record[13],Record[14]) + GlobalData.gPlatformDefines.update(self._FileLocalMacros) + self._PostProcessed = True + self._Content = None + + def __ProcessSectionHeader(self): + self._SectionName = self._ValueList[0] + if self._SectionName in self.DataType: + self._SectionType = self.DataType[self._SectionName] + else: + self._SectionType = MODEL_UNKNOWN + + def __ProcessSubsectionHeader(self): + self._SubsectionName = self._ValueList[0] + if self._SubsectionName in self.DataType: + self._SubsectionType = self.DataType[self._SubsectionName] + else: + self._SubsectionType = MODEL_UNKNOWN + + def __RetrievePcdValue(self): + Records = self._RawTable.Query(MODEL_PCD_FEATURE_FLAG, BelongsToItem=-1.0) + for TokenSpaceGuid,PcdName,Value,Dummy2,Dummy3,ID,Line in Records: + Value, DatumType, MaxDatumSize = AnalyzePcdData(Value) + # Only use PCD whose value is straitforward (no macro and PCD) + if self.SymbolPattern.findall(Value): + continue + Name = TokenSpaceGuid + '.' + PcdName + # Don't use PCD with different values. + if Name in self._Symbols and self._Symbols[Name] != Value: + self._Symbols.pop(Name) + continue + self._Symbols[Name] = Value + + Records = self._RawTable.Query(MODEL_PCD_FIXED_AT_BUILD, BelongsToItem=-1.0) + for TokenSpaceGuid,PcdName,Value,Dummy2,Dummy3,ID,Line in Records: + Value, DatumType, MaxDatumSize = AnalyzePcdData(Value) + # Only use PCD whose value is straitforward (no macro and PCD) + if self.SymbolPattern.findall(Value): + continue + Name = TokenSpaceGuid+'.'+PcdName + # Don't use PCD with different values. + if Name in self._Symbols and self._Symbols[Name] != Value: + self._Symbols.pop(Name) + continue + self._Symbols[Name] = Value + + def __ProcessDefine(self): + if not self._Enabled: + return + + Type, Name, Value = self._ValueList + Value = ReplaceMacro(Value, self._Macros, False) + if self._ItemType == MODEL_META_DATA_DEFINE: + if self._SectionType == MODEL_META_DATA_HEADER: + self._FileLocalMacros[Name] = Value + else: + SectionDictKey = self._SectionType, self._Scope[0][0], self._Scope[0][1] + if SectionDictKey not in self._SectionsMacroDict: + self._SectionsMacroDict[SectionDictKey] = {} + SectionLocalMacros = self._SectionsMacroDict[SectionDictKey] + SectionLocalMacros[Name] = Value + elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE: + GlobalData.gEdkGlobal[Name] = Value + + # + # Keyword in [Defines] section can be used as Macros + # + if (self._ItemType == MODEL_META_DATA_HEADER) and (self._SectionType == MODEL_META_DATA_HEADER): + self._FileLocalMacros[Name] = Value + + self._ValueList = [Type, Name, Value] + + def __ProcessDirective(self): + Result = None + if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF]: + Macros = self._Macros + Macros.update(GlobalData.gGlobalDefines) + try: + Result = ValueExpression(self._ValueList[1], Macros)() + except SymbolNotFound, Exc: + EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1]) + Result = False + except WrnExpression, Excpt: + # + # Catch expression evaluation warning here. We need to report + # the precise number of line and return the evaluation result + # + EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt), + File=self._FileWithError, ExtraData=' '.join(self._ValueList), + Line=self._LineIndex+1) + Result = Excpt.result + + if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: + self._DirectiveStack.append(self._ItemType) + if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF: + Result = bool(Result) + else: + Macro = self._ValueList[1] + Macro = Macro[2:-1] if (Macro.startswith("$(") and Macro.endswith(")")) else Macro + Result = Macro in self._Macros + if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF: + Result = not Result + self._DirectiveEvalStack.append(Result) + elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF: + self._DirectiveStack.append(self._ItemType) + self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1] + self._DirectiveEvalStack.append(bool(Result)) + elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE: + self._DirectiveStack[-1] = self._ItemType + self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1] + elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF: + # Back to the nearest !if/!ifdef/!ifndef + while self._DirectiveStack: + self._DirectiveEvalStack.pop() + Directive = self._DirectiveStack.pop() + if Directive in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: + break + elif self._ItemType == MODEL_META_DATA_INCLUDE: + # The included file must be relative to workspace or same directory as DSC file + __IncludeMacros = {} + # + # Allow using system environment variables in path after !include + # + __IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE'] + if "ECP_SOURCE" in GlobalData.gGlobalDefines.keys(): + __IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE'] + # + # During GenFds phase call DSC parser, will go into this branch. + # + elif "ECP_SOURCE" in GlobalData.gCommandLineDefines.keys(): + __IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE'] + + __IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE'] + __IncludeMacros['EDK_SOURCE'] = GlobalData.gGlobalDefines['EDK_SOURCE'] + # + # Allow using MACROs comes from [Defines] section to keep compatible. + # + __IncludeMacros.update(self._Macros) + + IncludedFile = NormPath(ReplaceMacro(self._ValueList[1], __IncludeMacros, RaiseError=True)) + # + # First search the include file under the same directory as DSC file + # + IncludedFile1 = PathClass(IncludedFile, self.MetaFile.Dir) + ErrorCode, ErrorInfo1 = IncludedFile1.Validate() + if ErrorCode != 0: + # + # Also search file under the WORKSPACE directory + # + IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace) + ErrorCode, ErrorInfo2 = IncludedFile1.Validate() + if ErrorCode != 0: + EdkLogger.error('parser', ErrorCode, File=self._FileWithError, + Line=self._LineIndex+1, ExtraData=ErrorInfo1 + "\n"+ ErrorInfo2) + + self._FileWithError = IncludedFile1 + + IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile1, MODEL_FILE_DSC, True) + Owner = self._Content[self._ContentIndex-1][0] + Parser = DscParser(IncludedFile1, self._FileType, IncludedFileTable, + Owner=Owner, From=Owner) + + # set the parser status with current status + Parser._SectionName = self._SectionName + Parser._SectionType = self._SectionType + Parser._Scope = self._Scope + Parser._Enabled = self._Enabled + # Parse the included file + Parser.Start() + + # update current status with sub-parser's status + self._SectionName = Parser._SectionName + self._SectionType = Parser._SectionType + self._Scope = Parser._Scope + self._Enabled = Parser._Enabled + + # Insert all records in the table for the included file into dsc file table + Records = IncludedFileTable.GetAll() + if Records: + self._Content[self._ContentIndex:self._ContentIndex] = Records + self._Content.pop(self._ContentIndex-1) + self._ValueList = None + self._ContentIndex -= 1 + + def __ProcessSkuId(self): + self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=True) + for Value in self._ValueList] + + def __ProcessLibraryInstance(self): + self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList] + + def __ProcessLibraryClass(self): + self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True) + + def __ProcessPcd(self): + ValueList = GetSplitValueList(self._ValueList[2]) + # + # PCD value can be an expression + # + if len(ValueList) > 1 and ValueList[1] == 'VOID*': + PcdValue = ValueList[0] + try: + ValueList[0] = ValueExpression(PcdValue, self._Macros)(True) + except WrnExpression, Value: + ValueList[0] = Value.result + else: + PcdValue = ValueList[-1] + try: + ValueList[-1] = ValueExpression(PcdValue, self._Macros)(True) + except WrnExpression, Value: + ValueList[-1] = Value.result + + if ValueList[-1] == 'True': + ValueList[-1] = '1' + if ValueList[-1] == 'False': + ValueList[-1] = '0' + + self._ValueList[2] = '|'.join(ValueList) + + def __ProcessComponent(self): + self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros) + + def __ProcessSourceOverridePath(self): + self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros) + + def __ProcessBuildOption(self): + self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=False) + for Value in self._ValueList] + + _SectionParser = { + MODEL_META_DATA_HEADER : _DefineParser, + MODEL_EFI_SKU_ID : _SkuIdParser, + MODEL_EFI_LIBRARY_INSTANCE : _LibraryInstanceParser, + MODEL_EFI_LIBRARY_CLASS : _LibraryClassParser, + MODEL_PCD_FIXED_AT_BUILD : _PcdParser, + MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, + MODEL_PCD_FEATURE_FLAG : _PcdParser, + MODEL_PCD_DYNAMIC_DEFAULT : _PcdParser, + MODEL_PCD_DYNAMIC_HII : _PcdParser, + MODEL_PCD_DYNAMIC_VPD : _PcdParser, + MODEL_PCD_DYNAMIC_EX_DEFAULT : _PcdParser, + MODEL_PCD_DYNAMIC_EX_HII : _PcdParser, + MODEL_PCD_DYNAMIC_EX_VPD : _PcdParser, + MODEL_META_DATA_COMPONENT : _ComponentParser, + MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH : _CompponentSourceOverridePathParser, + MODEL_META_DATA_BUILD_OPTION : _BuildOptionParser, + MODEL_UNKNOWN : MetaFileParser._Skip, + MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, + MODEL_META_DATA_SECTION_HEADER : MetaFileParser._SectionHeaderParser, + MODEL_META_DATA_SUBSECTION_HEADER : _SubsectionHeaderParser, + } + + _Macros = property(_GetMacros) + +## DEC file parser class +# +# @param FilePath The path of platform description file +# @param FileType The raw data of DSC file +# @param Table Database used to retrieve module/package information +# @param Macros Macros used for replacement in file +# +class DecParser(MetaFileParser): + # DEC file supported data types (one type per section) + DataType = { + TAB_DEC_DEFINES.upper() : MODEL_META_DATA_HEADER, + TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, + TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE, + TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, + TAB_GUIDS.upper() : MODEL_EFI_GUID, + TAB_PPIS.upper() : MODEL_EFI_PPI, + TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL, + TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD, + TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, + TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG, + TAB_PCDS_DYNAMIC_NULL.upper() : MODEL_PCD_DYNAMIC, + TAB_PCDS_DYNAMIC_EX_NULL.upper() : MODEL_PCD_DYNAMIC_EX, + } + + ## Constructor of DecParser + # + # Initialize object of DecParser + # + # @param FilePath The path of platform description file + # @param FileType The raw data of DSC file + # @param Table Database used to retrieve module/package information + # @param Macros Macros used for replacement in file + # + def __init__(self, FilePath, FileType, Table): + # prevent re-initialization + if hasattr(self, "_Table"): + return + MetaFileParser.__init__(self, FilePath, FileType, Table) + self._Comments = [] + self._Version = 0x00010005 # Only EDK2 dec file is supported + self.TblFile = EccGlobalData.gDb.TblFile + self.FileID = -1 + + ## Parser starter + def Start(self): + Content = '' + try: + Content = open(str(self.MetaFile), 'r').readlines() + except: + EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) + + # + # Insert a record for file + # + Filename = NormPath(self.MetaFile) + FileID = self.TblFile.GetFileId(Filename) + if FileID: + self.FileID = FileID + else: + self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_DEC) + + for Index in range(0, len(Content)): + Line, Comment = CleanString2(Content[Index]) + self._CurrentLine = Line + self._LineIndex = Index + + # save comment for later use + if Comment: + self._Comments.append((Comment, self._LineIndex+1)) + # skip empty line + if Line == '': + continue + + # section header + if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: + self._SectionHeaderParser() + self._Comments = [] + continue + elif len(self._SectionType) == 0: + self._Comments = [] + continue + + # section content + self._ValueList = ['','',''] + self._SectionParser[self._SectionType[0]](self) + if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE: + self._ItemType = -1 + self._Comments = [] + continue + + # + # Model, Value1, Value2, Value3, Arch, BelongsToItem=-1, LineBegin=-1, + # ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, FeatureFlag='', Enabled=-1 + # + for Arch, ModuleType, Type in self._Scope: + self._LastItem = self._Store( + Type, + self._ValueList[0], + self._ValueList[1], + self._ValueList[2], + Arch, + ModuleType, + self._Owner[-1], + self.FileID, + self._LineIndex+1, + -1, + self._LineIndex+1, + -1, + 0 + ) + for Comment, LineNo in self._Comments: + self._Store( + MODEL_META_DATA_COMMENT, + Comment, + self._ValueList[0], + self._ValueList[1], + Arch, + ModuleType, + self._LastItem, + self.FileID, + LineNo, + -1, + LineNo, + -1, + 0 + ) + self._Comments = [] + self._Done() + + def _GetApplicableSectionMacro(self): + Macros = {} + for S1, S2, SectionType in self._Scope: + for Scope1, Scope2 in [("COMMON", "COMMON"), ("COMMON", S2), (S1, "COMMON"), (S1, S2)]: + if (SectionType, Scope1, Scope2) in self._SectionsMacroDict: + Macros.update(self._SectionsMacroDict[(SectionType, Scope1, Scope2)]) + return Macros + + ## Section header parser + # + # The section header is always in following format: + # + # [section_name.arch<.platform|module_type>] + # + def _SectionHeaderParser(self): + self._Scope = [] + self._SectionName = '' + self._SectionType = [] + ArchList = set() + for Item in GetSplitValueList(self._CurrentLine[1:-1], TAB_COMMA_SPLIT): + if Item == '': + continue + ItemList = GetSplitValueList(Item, TAB_SPLIT) + + # different types of PCD are permissible in one section + self._SectionName = ItemList[0].upper() + if self._SectionName in self.DataType: + if self.DataType[self._SectionName] not in self._SectionType: + self._SectionType.append(self.DataType[self._SectionName]) + else: + EdkLogger.warn("Parser", "Unrecognized section", File=self.MetaFile, + Line=self._LineIndex+1, ExtraData=self._CurrentLine) + continue + + if MODEL_PCD_FEATURE_FLAG in self._SectionType and len(self._SectionType) > 1: + EdkLogger.error( + 'Parser', + FORMAT_INVALID, + "%s must not be in the same section of other types of PCD" % TAB_PCDS_FEATURE_FLAG_NULL, + File=self.MetaFile, + Line=self._LineIndex+1, + ExtraData=self._CurrentLine + ) + # S1 is always Arch + if len(ItemList) > 1: + S1 = ItemList[1].upper() + else: + S1 = 'COMMON' + ArchList.add(S1) + # S2 may be Platform or ModuleType + if len(ItemList) > 2: + S2 = ItemList[2].upper() + else: + S2 = 'COMMON' + if [S1, S2, self.DataType[self._SectionName]] not in self._Scope: + self._Scope.append([S1, S2, self.DataType[self._SectionName]]) + + # 'COMMON' must not be used with specific ARCHs at the same section + if 'COMMON' in ArchList and len(ArchList) > 1: + EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs", + File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine) + + ## [guids], [ppis] and [protocols] section parser + @ParseMacro + def _GuidParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + if len(TokenList) < 2: + EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name or value specified", + ExtraData=self._CurrentLine + " ( = )", + File=self.MetaFile, Line=self._LineIndex+1) + if TokenList[0] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name specified", + ExtraData=self._CurrentLine + " ( = )", + File=self.MetaFile, Line=self._LineIndex+1) + if TokenList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No GUID value specified", + ExtraData=self._CurrentLine + " ( = )", + File=self.MetaFile, Line=self._LineIndex+1) + if TokenList[1][0] != '{' or TokenList[1][-1] != '}' or GuidStructureStringToGuidString(TokenList[1]) == '': + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid GUID value format", + ExtraData=self._CurrentLine + \ + " ( = )", + File=self.MetaFile, Line=self._LineIndex+1) + self._ValueList[0] = TokenList[0] + #Parse the Guid value format + GuidValueList = TokenList[1].strip(' {}').split(',') + Index = 0 + HexList = [] + if len(GuidValueList) == 11: + for GuidValue in GuidValueList: + GuidValue = GuidValue.strip() + if GuidValue.startswith('0x') or GuidValue.startswith('0X'): + HexList.append('0x' + str(GuidValue[2:])) + Index += 1 + continue + else: + if GuidValue.startswith('{'): + HexList.append('0x' + str(GuidValue[3:])) + Index += 1 + self._ValueList[1] = "{ %s, %s, %s, { %s, %s, %s, %s, %s, %s, %s, %s }}" % (HexList[0], HexList[1], HexList[2],HexList[3],HexList[4],HexList[5],HexList[6],HexList[7],HexList[8],HexList[9],HexList[10]) + else: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid GUID value format", + ExtraData=self._CurrentLine + \ + " ( = )", + File=self.MetaFile, Line=self._LineIndex+1) + self._ValueList[0] = '' + + ## PCD sections parser + # + # [PcdsFixedAtBuild] + # [PcdsPatchableInModule] + # [PcdsFeatureFlag] + # [PcdsDynamicEx + # [PcdsDynamic] + # + @ParseMacro + def _PcdParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) + self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT) + # check PCD information + if self._ValueList[0] == '' or self._ValueList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex+1) + # check PCD datum information + if len(TokenList) < 2 or TokenList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum information given", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex+1) + + + ValueRe = re.compile(r'^\s*L?\".*\|.*\"') + PtrValue = ValueRe.findall(TokenList[1]) + + # Has VOID* type string, may contain "|" character in the string. + if len(PtrValue) != 0: + ptrValueList = re.sub(ValueRe, '', TokenList[1]) + ValueList = GetSplitValueList(ptrValueList) + ValueList[0] = PtrValue[0] + else: + ValueList = GetSplitValueList(TokenList[1]) + + + # check if there's enough datum information given + if len(ValueList) != 3: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information given", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex+1) + # check default value + if ValueList[0] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum information", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex+1) + # check datum type + if ValueList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum information", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex+1) + # check token of the PCD + if ValueList[2] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum information", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex+1) + # check format of default value against the datum type + IsValid, Cause = CheckPcdDatum(ValueList[1], ValueList[0]) + if not IsValid: + EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine, + File=self.MetaFile, Line=self._LineIndex+1) + + if ValueList[0] in ['True', 'true', 'TRUE']: + ValueList[0] = '1' + elif ValueList[0] in ['False', 'false', 'FALSE']: + ValueList[0] = '0' + + self._ValueList[2] = ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip() + + _SectionParser = { + MODEL_META_DATA_HEADER : MetaFileParser._DefineParser, + MODEL_EFI_INCLUDE : MetaFileParser._PathParser, + MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser, + MODEL_EFI_GUID : _GuidParser, + MODEL_EFI_PPI : _GuidParser, + MODEL_EFI_PROTOCOL : _GuidParser, + MODEL_PCD_FIXED_AT_BUILD : _PcdParser, + MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, + MODEL_PCD_FEATURE_FLAG : _PcdParser, + MODEL_PCD_DYNAMIC : _PcdParser, + MODEL_PCD_DYNAMIC_EX : _PcdParser, + MODEL_UNKNOWN : MetaFileParser._Skip, + MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, + } + + +## FdfObject +# +# This class defined basic Fdf object which is used by inheriting +# +# @param object: Inherited from object class +# +class FdfObject(object): + def __init__(self): + object.__init__() + +## Fdf +# +# This class defined the structure used in Fdf object +# +# @param FdfObject: Inherited from FdfObject class +# @param Filename: Input value for Ffilename of Fdf file, default is None +# @param WorkspaceDir: Input value for current workspace directory, default is None +# +class Fdf(FdfObject): + def __init__(self, Filename = None, IsToDatabase = False, WorkspaceDir = None, Database = None): + self.WorkspaceDir = WorkspaceDir + self.IsToDatabase = IsToDatabase + + self.Cur = Database.Cur + self.TblFile = Database.TblFile + self.TblFdf = Database.TblFdf + self.FileID = -1 + self.FileList = {} + + # + # Load Fdf file if filename is not None + # + if Filename != None: + self.LoadFdfFile(Filename) + + # + # Insert a FDF file record into database + # + def InsertFile(self, Filename): + FileID = -1 + Filename = NormPath(Filename) + if Filename not in self.FileList: + FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_FDF) + self.FileList[Filename] = FileID + + return self.FileList[Filename] + + + ## Load Fdf file + # + # Load the file if it exists + # + # @param Filename: Input value for filename of Fdf file + # + def LoadFdfFile(self, Filename): + FileList = [] + # + # Parse Fdf file + # + Filename = NormPath(Filename) + Fdf = FdfParser(Filename) + Fdf.ParseFile() + + # + # Insert inf file and pcd information + # + if self.IsToDatabase: + (Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled) = \ + (0, '', '', '', 'COMMON', 'COMMON', -1, -1, -1, -1, -1, -1, 0) + for Index in range(0, len(Fdf.Profile.PcdDict)): + pass + for Key in Fdf.Profile.PcdDict.keys(): + Model = MODEL_PCD + Value1 = Key[1] + Value2 = Key[0] + FileName = Fdf.Profile.PcdFileLineDict[Key][0] + StartLine = Fdf.Profile.PcdFileLineDict[Key][1] + BelongsToFile = self.InsertFile(FileName) + self.TblFdf.Insert(Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled) + for Index in range(0, len(Fdf.Profile.InfList)): + Model = MODEL_META_DATA_COMPONENT + Value1 = Fdf.Profile.InfList[Index] + Value2 = '' + FileName = Fdf.Profile.InfFileLineList[Index][0] + StartLine = Fdf.Profile.InfFileLineList[Index][1] + BelongsToFile = self.InsertFile(FileName) + self.TblFdf.Insert(Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled) + +## +# +# This acts like the main() function for the script, unless it is 'import'ed into another +# script. +# +if __name__ == '__main__': + pass + diff --git a/BaseTools/Source/Python/Ecc/Xml/__init__.py b/BaseTools/Source/Python/Ecc/Xml/__init__.py index 5d268d990b..f09eece5fb 100644 --- a/BaseTools/Source/Python/Ecc/Xml/__init__.py +++ b/BaseTools/Source/Python/Ecc/Xml/__init__.py @@ -1,20 +1,20 @@ -## @file -# Python 'Library' package initialization file. -# -# This file is required to make Python interpreter treat the directory -# as containing package. -# -# Copyright (c) 2011, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -''' -Xml +## @file +# Python 'Library' package initialization file. +# +# This file is required to make Python interpreter treat the directory +# as containing package. +# +# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +''' +Xml ''' \ No newline at end of file diff --git a/BaseTools/Source/Python/Eot/CLexer.py b/BaseTools/Source/Python/Eot/CLexer.py index a72d4ee3c2..a496f43440 100644 --- a/BaseTools/Source/Python/Eot/CLexer.py +++ b/BaseTools/Source/Python/Eot/CLexer.py @@ -1,7 +1,7 @@ -# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53 - -from antlr3 import * -from antlr3.compat import set, frozenset +# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53 + +from antlr3 import * +from antlr3.compat import set, frozenset ## @file # The file defines the Lexer for C source files. @@ -21,4927 +21,4927 @@ from antlr3.compat import set, frozenset # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # ## - - - -# for convenience in actions -HIDDEN = BaseRecognizer.HIDDEN - -# token types -T114=114 -T115=115 -T116=116 -T117=117 -FloatTypeSuffix=16 -LETTER=11 -T29=29 -T28=28 -T27=27 -T26=26 -T25=25 -EOF=-1 -STRING_LITERAL=9 -FLOATING_POINT_LITERAL=10 -T38=38 -T37=37 -T39=39 -T34=34 -COMMENT=22 -T33=33 -T36=36 -T35=35 -T30=30 -T32=32 -T31=31 -LINE_COMMENT=23 -IntegerTypeSuffix=14 -CHARACTER_LITERAL=8 -T49=49 -T48=48 -T100=100 -T43=43 -T42=42 -T102=102 -T41=41 -T101=101 -T40=40 -T47=47 -T46=46 -T45=45 -T44=44 -T109=109 -T107=107 -T108=108 -T105=105 -WS=19 -T106=106 -T103=103 -T104=104 -T50=50 -LINE_COMMAND=24 -T59=59 -T113=113 -T52=52 -T112=112 -T51=51 -T111=111 -T54=54 -T110=110 -EscapeSequence=12 -DECIMAL_LITERAL=7 -T53=53 -T56=56 -T55=55 -T58=58 -T57=57 -T75=75 -T76=76 -T73=73 -T74=74 -T79=79 -T77=77 -T78=78 -Exponent=15 -HexDigit=13 -T72=72 -T71=71 -T70=70 -T62=62 -T63=63 -T64=64 -T65=65 -T66=66 -T67=67 -T68=68 -T69=69 -IDENTIFIER=4 -UnicodeVocabulary=21 -HEX_LITERAL=5 -T61=61 -T60=60 -T99=99 -T97=97 -BS=20 -T98=98 -T95=95 -T96=96 -OCTAL_LITERAL=6 -T94=94 -Tokens=118 -T93=93 -T92=92 -T91=91 -T90=90 -T88=88 -T89=89 -T84=84 -T85=85 -T86=86 -T87=87 -UnicodeEscape=18 -T81=81 -T80=80 -T83=83 -OctalEscape=17 -T82=82 - -class CLexer(Lexer): - - grammarFileName = "C.g" - - def __init__(self, input=None): - Lexer.__init__(self, input) - self.dfa25 = self.DFA25( - self, 25, - eot = self.DFA25_eot, - eof = self.DFA25_eof, - min = self.DFA25_min, - max = self.DFA25_max, - accept = self.DFA25_accept, - special = self.DFA25_special, - transition = self.DFA25_transition - ) - self.dfa35 = self.DFA35( - self, 35, - eot = self.DFA35_eot, - eof = self.DFA35_eof, - min = self.DFA35_min, - max = self.DFA35_max, - accept = self.DFA35_accept, - special = self.DFA35_special, - transition = self.DFA35_transition - ) - - - - - - - # $ANTLR start T25 - def mT25(self, ): - - try: - self.type = T25 - - # C.g:27:5: ( ';' ) - # C.g:27:7: ';' - self.match(u';') - - - - - - finally: - - pass - - # $ANTLR end T25 - - - - # $ANTLR start T26 - def mT26(self, ): - - try: - self.type = T26 - - # C.g:28:5: ( 'typedef' ) - # C.g:28:7: 'typedef' - self.match("typedef") - - - - - - - finally: - - pass - - # $ANTLR end T26 - - - - # $ANTLR start T27 - def mT27(self, ): - - try: - self.type = T27 - - # C.g:29:5: ( ',' ) - # C.g:29:7: ',' - self.match(u',') - - - - - - finally: - - pass - - # $ANTLR end T27 - - - - # $ANTLR start T28 - def mT28(self, ): - - try: - self.type = T28 - - # C.g:30:5: ( '=' ) - # C.g:30:7: '=' - self.match(u'=') - - - - - - finally: - - pass - - # $ANTLR end T28 - - - - # $ANTLR start T29 - def mT29(self, ): - - try: - self.type = T29 - - # C.g:31:5: ( 'extern' ) - # C.g:31:7: 'extern' - self.match("extern") - - - - - - - finally: - - pass - - # $ANTLR end T29 - - - - # $ANTLR start T30 - def mT30(self, ): - - try: - self.type = T30 - - # C.g:32:5: ( 'static' ) - # C.g:32:7: 'static' - self.match("static") - - - - - - - finally: - - pass - - # $ANTLR end T30 - - - - # $ANTLR start T31 - def mT31(self, ): - - try: - self.type = T31 - - # C.g:33:5: ( 'auto' ) - # C.g:33:7: 'auto' - self.match("auto") - - - - - - - finally: - - pass - - # $ANTLR end T31 - - - - # $ANTLR start T32 - def mT32(self, ): - - try: - self.type = T32 - - # C.g:34:5: ( 'register' ) - # C.g:34:7: 'register' - self.match("register") - - - - - - - finally: - - pass - - # $ANTLR end T32 - - - - # $ANTLR start T33 - def mT33(self, ): - - try: - self.type = T33 - - # C.g:35:5: ( 'STATIC' ) - # C.g:35:7: 'STATIC' - self.match("STATIC") - - - - - - - finally: - - pass - - # $ANTLR end T33 - - - - # $ANTLR start T34 - def mT34(self, ): - - try: - self.type = T34 - - # C.g:36:5: ( 'void' ) - # C.g:36:7: 'void' - self.match("void") - - - - - - - finally: - - pass - - # $ANTLR end T34 - - - - # $ANTLR start T35 - def mT35(self, ): - - try: - self.type = T35 - - # C.g:37:5: ( 'char' ) - # C.g:37:7: 'char' - self.match("char") - - - - - - - finally: - - pass - - # $ANTLR end T35 - - - - # $ANTLR start T36 - def mT36(self, ): - - try: - self.type = T36 - - # C.g:38:5: ( 'short' ) - # C.g:38:7: 'short' - self.match("short") - - - - - - - finally: - - pass - - # $ANTLR end T36 - - - - # $ANTLR start T37 - def mT37(self, ): - - try: - self.type = T37 - - # C.g:39:5: ( 'int' ) - # C.g:39:7: 'int' - self.match("int") - - - - - - - finally: - - pass - - # $ANTLR end T37 - - - - # $ANTLR start T38 - def mT38(self, ): - - try: - self.type = T38 - - # C.g:40:5: ( 'long' ) - # C.g:40:7: 'long' - self.match("long") - - - - - - - finally: - - pass - - # $ANTLR end T38 - - - - # $ANTLR start T39 - def mT39(self, ): - - try: - self.type = T39 - - # C.g:41:5: ( 'float' ) - # C.g:41:7: 'float' - self.match("float") - - - - - - - finally: - - pass - - # $ANTLR end T39 - - - - # $ANTLR start T40 - def mT40(self, ): - - try: - self.type = T40 - - # C.g:42:5: ( 'double' ) - # C.g:42:7: 'double' - self.match("double") - - - - - - - finally: - - pass - - # $ANTLR end T40 - - - - # $ANTLR start T41 - def mT41(self, ): - - try: - self.type = T41 - - # C.g:43:5: ( 'signed' ) - # C.g:43:7: 'signed' - self.match("signed") - - - - - - - finally: - - pass - - # $ANTLR end T41 - - - - # $ANTLR start T42 - def mT42(self, ): - - try: - self.type = T42 - - # C.g:44:5: ( 'unsigned' ) - # C.g:44:7: 'unsigned' - self.match("unsigned") - - - - - - - finally: - - pass - - # $ANTLR end T42 - - - - # $ANTLR start T43 - def mT43(self, ): - - try: - self.type = T43 - - # C.g:45:5: ( '{' ) - # C.g:45:7: '{' - self.match(u'{') - - - - - - finally: - - pass - - # $ANTLR end T43 - - - - # $ANTLR start T44 - def mT44(self, ): - - try: - self.type = T44 - - # C.g:46:5: ( '}' ) - # C.g:46:7: '}' - self.match(u'}') - - - - - - finally: - - pass - - # $ANTLR end T44 - - - - # $ANTLR start T45 - def mT45(self, ): - - try: - self.type = T45 - - # C.g:47:5: ( 'struct' ) - # C.g:47:7: 'struct' - self.match("struct") - - - - - - - finally: - - pass - - # $ANTLR end T45 - - - - # $ANTLR start T46 - def mT46(self, ): - - try: - self.type = T46 - - # C.g:48:5: ( 'union' ) - # C.g:48:7: 'union' - self.match("union") - - - - - - - finally: - - pass - - # $ANTLR end T46 - - - - # $ANTLR start T47 - def mT47(self, ): - - try: - self.type = T47 - - # C.g:49:5: ( ':' ) - # C.g:49:7: ':' - self.match(u':') - - - - - - finally: - - pass - - # $ANTLR end T47 - - - - # $ANTLR start T48 - def mT48(self, ): - - try: - self.type = T48 - - # C.g:50:5: ( 'enum' ) - # C.g:50:7: 'enum' - self.match("enum") - - - - - - - finally: - - pass - - # $ANTLR end T48 - - - - # $ANTLR start T49 - def mT49(self, ): - - try: - self.type = T49 - - # C.g:51:5: ( 'const' ) - # C.g:51:7: 'const' - self.match("const") - - - - - - - finally: - - pass - - # $ANTLR end T49 - - - - # $ANTLR start T50 - def mT50(self, ): - - try: - self.type = T50 - - # C.g:52:5: ( 'volatile' ) - # C.g:52:7: 'volatile' - self.match("volatile") - - - - - - - finally: - - pass - - # $ANTLR end T50 - - - - # $ANTLR start T51 - def mT51(self, ): - - try: - self.type = T51 - - # C.g:53:5: ( 'IN' ) - # C.g:53:7: 'IN' - self.match("IN") - - - - - - - finally: - - pass - - # $ANTLR end T51 - - - - # $ANTLR start T52 - def mT52(self, ): - - try: - self.type = T52 - - # C.g:54:5: ( 'OUT' ) - # C.g:54:7: 'OUT' - self.match("OUT") - - - - - - - finally: - - pass - - # $ANTLR end T52 - - - - # $ANTLR start T53 - def mT53(self, ): - - try: - self.type = T53 - - # C.g:55:5: ( 'OPTIONAL' ) - # C.g:55:7: 'OPTIONAL' - self.match("OPTIONAL") - - - - - - - finally: - - pass - - # $ANTLR end T53 - - - - # $ANTLR start T54 - def mT54(self, ): - - try: - self.type = T54 - - # C.g:56:5: ( 'CONST' ) - # C.g:56:7: 'CONST' - self.match("CONST") - - - - - - - finally: - - pass - - # $ANTLR end T54 - - - - # $ANTLR start T55 - def mT55(self, ): - - try: - self.type = T55 - - # C.g:57:5: ( 'UNALIGNED' ) - # C.g:57:7: 'UNALIGNED' - self.match("UNALIGNED") - - - - - - - finally: - - pass - - # $ANTLR end T55 - - - - # $ANTLR start T56 - def mT56(self, ): - - try: - self.type = T56 - - # C.g:58:5: ( 'VOLATILE' ) - # C.g:58:7: 'VOLATILE' - self.match("VOLATILE") - - - - - - - finally: - - pass - - # $ANTLR end T56 - - - - # $ANTLR start T57 - def mT57(self, ): - - try: - self.type = T57 - - # C.g:59:5: ( 'GLOBAL_REMOVE_IF_UNREFERENCED' ) - # C.g:59:7: 'GLOBAL_REMOVE_IF_UNREFERENCED' - self.match("GLOBAL_REMOVE_IF_UNREFERENCED") - - - - - - - finally: - - pass - - # $ANTLR end T57 - - - - # $ANTLR start T58 - def mT58(self, ): - - try: - self.type = T58 - - # C.g:60:5: ( 'EFIAPI' ) - # C.g:60:7: 'EFIAPI' - self.match("EFIAPI") - - - - - - - finally: - - pass - - # $ANTLR end T58 - - - - # $ANTLR start T59 - def mT59(self, ): - - try: - self.type = T59 - - # C.g:61:5: ( 'EFI_BOOTSERVICE' ) - # C.g:61:7: 'EFI_BOOTSERVICE' - self.match("EFI_BOOTSERVICE") - - - - - - - finally: - - pass - - # $ANTLR end T59 - - - - # $ANTLR start T60 - def mT60(self, ): - - try: - self.type = T60 - - # C.g:62:5: ( 'EFI_RUNTIMESERVICE' ) - # C.g:62:7: 'EFI_RUNTIMESERVICE' - self.match("EFI_RUNTIMESERVICE") - - - - - - - finally: - - pass - - # $ANTLR end T60 - - - - # $ANTLR start T61 - def mT61(self, ): - - try: - self.type = T61 - - # C.g:63:5: ( 'PACKED' ) - # C.g:63:7: 'PACKED' - self.match("PACKED") - - - - - - - finally: - - pass - - # $ANTLR end T61 - - - - # $ANTLR start T62 - def mT62(self, ): - - try: - self.type = T62 - - # C.g:64:5: ( '(' ) - # C.g:64:7: '(' - self.match(u'(') - - - - - - finally: - - pass - - # $ANTLR end T62 - - - - # $ANTLR start T63 - def mT63(self, ): - - try: - self.type = T63 - - # C.g:65:5: ( ')' ) - # C.g:65:7: ')' - self.match(u')') - - - - - - finally: - - pass - - # $ANTLR end T63 - - - - # $ANTLR start T64 - def mT64(self, ): - - try: - self.type = T64 - - # C.g:66:5: ( '[' ) - # C.g:66:7: '[' - self.match(u'[') - - - - - - finally: - - pass - - # $ANTLR end T64 - - - - # $ANTLR start T65 - def mT65(self, ): - - try: - self.type = T65 - - # C.g:67:5: ( ']' ) - # C.g:67:7: ']' - self.match(u']') - - - - - - finally: - - pass - - # $ANTLR end T65 - - - - # $ANTLR start T66 - def mT66(self, ): - - try: - self.type = T66 - - # C.g:68:5: ( '*' ) - # C.g:68:7: '*' - self.match(u'*') - - - - - - finally: - - pass - - # $ANTLR end T66 - - - - # $ANTLR start T67 - def mT67(self, ): - - try: - self.type = T67 - - # C.g:69:5: ( '...' ) - # C.g:69:7: '...' - self.match("...") - - - - - - - finally: - - pass - - # $ANTLR end T67 - - - - # $ANTLR start T68 - def mT68(self, ): - - try: - self.type = T68 - - # C.g:70:5: ( '+' ) - # C.g:70:7: '+' - self.match(u'+') - - - - - - finally: - - pass - - # $ANTLR end T68 - - - - # $ANTLR start T69 - def mT69(self, ): - - try: - self.type = T69 - - # C.g:71:5: ( '-' ) - # C.g:71:7: '-' - self.match(u'-') - - - - - - finally: - - pass - - # $ANTLR end T69 - - - - # $ANTLR start T70 - def mT70(self, ): - - try: - self.type = T70 - - # C.g:72:5: ( '/' ) - # C.g:72:7: '/' - self.match(u'/') - - - - - - finally: - - pass - - # $ANTLR end T70 - - - - # $ANTLR start T71 - def mT71(self, ): - - try: - self.type = T71 - - # C.g:73:5: ( '%' ) - # C.g:73:7: '%' - self.match(u'%') - - - - - - finally: - - pass - - # $ANTLR end T71 - - - - # $ANTLR start T72 - def mT72(self, ): - - try: - self.type = T72 - - # C.g:74:5: ( '++' ) - # C.g:74:7: '++' - self.match("++") - - - - - - - finally: - - pass - - # $ANTLR end T72 - - - - # $ANTLR start T73 - def mT73(self, ): - - try: - self.type = T73 - - # C.g:75:5: ( '--' ) - # C.g:75:7: '--' - self.match("--") - - - - - - - finally: - - pass - - # $ANTLR end T73 - - - - # $ANTLR start T74 - def mT74(self, ): - - try: - self.type = T74 - - # C.g:76:5: ( 'sizeof' ) - # C.g:76:7: 'sizeof' - self.match("sizeof") - - - - - - - finally: - - pass - - # $ANTLR end T74 - - - - # $ANTLR start T75 - def mT75(self, ): - - try: - self.type = T75 - - # C.g:77:5: ( '.' ) - # C.g:77:7: '.' - self.match(u'.') - - - - - - finally: - - pass - - # $ANTLR end T75 - - - - # $ANTLR start T76 - def mT76(self, ): - - try: - self.type = T76 - - # C.g:78:5: ( '->' ) - # C.g:78:7: '->' - self.match("->") - - - - - - - finally: - - pass - - # $ANTLR end T76 - - - - # $ANTLR start T77 - def mT77(self, ): - - try: - self.type = T77 - - # C.g:79:5: ( '&' ) - # C.g:79:7: '&' - self.match(u'&') - - - - - - finally: - - pass - - # $ANTLR end T77 - - - - # $ANTLR start T78 - def mT78(self, ): - - try: - self.type = T78 - - # C.g:80:5: ( '~' ) - # C.g:80:7: '~' - self.match(u'~') - - - - - - finally: - - pass - - # $ANTLR end T78 - - - - # $ANTLR start T79 - def mT79(self, ): - - try: - self.type = T79 - - # C.g:81:5: ( '!' ) - # C.g:81:7: '!' - self.match(u'!') - - - - - - finally: - - pass - - # $ANTLR end T79 - - - - # $ANTLR start T80 - def mT80(self, ): - - try: - self.type = T80 - - # C.g:82:5: ( '*=' ) - # C.g:82:7: '*=' - self.match("*=") - - - - - - - finally: - - pass - - # $ANTLR end T80 - - - - # $ANTLR start T81 - def mT81(self, ): - - try: - self.type = T81 - - # C.g:83:5: ( '/=' ) - # C.g:83:7: '/=' - self.match("/=") - - - - - - - finally: - - pass - - # $ANTLR end T81 - - - - # $ANTLR start T82 - def mT82(self, ): - - try: - self.type = T82 - - # C.g:84:5: ( '%=' ) - # C.g:84:7: '%=' - self.match("%=") - - - - - - - finally: - - pass - - # $ANTLR end T82 - - - - # $ANTLR start T83 - def mT83(self, ): - - try: - self.type = T83 - - # C.g:85:5: ( '+=' ) - # C.g:85:7: '+=' - self.match("+=") - - - - - - - finally: - - pass - - # $ANTLR end T83 - - - - # $ANTLR start T84 - def mT84(self, ): - - try: - self.type = T84 - - # C.g:86:5: ( '-=' ) - # C.g:86:7: '-=' - self.match("-=") - - - - - - - finally: - - pass - - # $ANTLR end T84 - - - - # $ANTLR start T85 - def mT85(self, ): - - try: - self.type = T85 - - # C.g:87:5: ( '<<=' ) - # C.g:87:7: '<<=' - self.match("<<=") - - - - - - - finally: - - pass - - # $ANTLR end T85 - - - - # $ANTLR start T86 - def mT86(self, ): - - try: - self.type = T86 - - # C.g:88:5: ( '>>=' ) - # C.g:88:7: '>>=' - self.match(">>=") - - - - - - - finally: - - pass - - # $ANTLR end T86 - - - - # $ANTLR start T87 - def mT87(self, ): - - try: - self.type = T87 - - # C.g:89:5: ( '&=' ) - # C.g:89:7: '&=' - self.match("&=") - - - - - - - finally: - - pass - - # $ANTLR end T87 - - - - # $ANTLR start T88 - def mT88(self, ): - - try: - self.type = T88 - - # C.g:90:5: ( '^=' ) - # C.g:90:7: '^=' - self.match("^=") - - - - - - - finally: - - pass - - # $ANTLR end T88 - - - - # $ANTLR start T89 - def mT89(self, ): - - try: - self.type = T89 - - # C.g:91:5: ( '|=' ) - # C.g:91:7: '|=' - self.match("|=") - - - - - - - finally: - - pass - - # $ANTLR end T89 - - - - # $ANTLR start T90 - def mT90(self, ): - - try: - self.type = T90 - - # C.g:92:5: ( '?' ) - # C.g:92:7: '?' - self.match(u'?') - - - - - - finally: - - pass - - # $ANTLR end T90 - - - - # $ANTLR start T91 - def mT91(self, ): - - try: - self.type = T91 - - # C.g:93:5: ( '||' ) - # C.g:93:7: '||' - self.match("||") - - - - - - - finally: - - pass - - # $ANTLR end T91 - - - - # $ANTLR start T92 - def mT92(self, ): - - try: - self.type = T92 - - # C.g:94:5: ( '&&' ) - # C.g:94:7: '&&' - self.match("&&") - - - - - - - finally: - - pass - - # $ANTLR end T92 - - - - # $ANTLR start T93 - def mT93(self, ): - - try: - self.type = T93 - - # C.g:95:5: ( '|' ) - # C.g:95:7: '|' - self.match(u'|') - - - - - - finally: - - pass - - # $ANTLR end T93 - - - - # $ANTLR start T94 - def mT94(self, ): - - try: - self.type = T94 - - # C.g:96:5: ( '^' ) - # C.g:96:7: '^' - self.match(u'^') - - - - - - finally: - - pass - - # $ANTLR end T94 - - - - # $ANTLR start T95 - def mT95(self, ): - - try: - self.type = T95 - - # C.g:97:5: ( '==' ) - # C.g:97:7: '==' - self.match("==") - - - - - - - finally: - - pass - - # $ANTLR end T95 - - - - # $ANTLR start T96 - def mT96(self, ): - - try: - self.type = T96 - - # C.g:98:5: ( '!=' ) - # C.g:98:7: '!=' - self.match("!=") - - - - - - - finally: - - pass - - # $ANTLR end T96 - - - - # $ANTLR start T97 - def mT97(self, ): - - try: - self.type = T97 - - # C.g:99:5: ( '<' ) - # C.g:99:7: '<' - self.match(u'<') - - - - - - finally: - - pass - - # $ANTLR end T97 - - - - # $ANTLR start T98 - def mT98(self, ): - - try: - self.type = T98 - - # C.g:100:5: ( '>' ) - # C.g:100:7: '>' - self.match(u'>') - - - - - - finally: - - pass - - # $ANTLR end T98 - - - - # $ANTLR start T99 - def mT99(self, ): - - try: - self.type = T99 - - # C.g:101:5: ( '<=' ) - # C.g:101:7: '<=' - self.match("<=") - - - - - - - finally: - - pass - - # $ANTLR end T99 - - - - # $ANTLR start T100 - def mT100(self, ): - - try: - self.type = T100 - - # C.g:102:6: ( '>=' ) - # C.g:102:8: '>=' - self.match(">=") - - - - - - - finally: - - pass - - # $ANTLR end T100 - - - - # $ANTLR start T101 - def mT101(self, ): - - try: - self.type = T101 - - # C.g:103:6: ( '<<' ) - # C.g:103:8: '<<' - self.match("<<") - - - - - - - finally: - - pass - - # $ANTLR end T101 - - - - # $ANTLR start T102 - def mT102(self, ): - - try: - self.type = T102 - - # C.g:104:6: ( '>>' ) - # C.g:104:8: '>>' - self.match(">>") - - - - - - - finally: - - pass - - # $ANTLR end T102 - - - - # $ANTLR start T103 - def mT103(self, ): - - try: - self.type = T103 - - # C.g:105:6: ( '__asm__' ) - # C.g:105:8: '__asm__' - self.match("__asm__") - - - - - - - finally: - - pass - - # $ANTLR end T103 - - - - # $ANTLR start T104 - def mT104(self, ): - - try: - self.type = T104 - - # C.g:106:6: ( '_asm' ) - # C.g:106:8: '_asm' - self.match("_asm") - - - - - - - finally: - - pass - - # $ANTLR end T104 - - - - # $ANTLR start T105 - def mT105(self, ): - - try: - self.type = T105 - - # C.g:107:6: ( '__asm' ) - # C.g:107:8: '__asm' - self.match("__asm") - - - - - - - finally: - - pass - - # $ANTLR end T105 - - - - # $ANTLR start T106 - def mT106(self, ): - - try: - self.type = T106 - - # C.g:108:6: ( 'case' ) - # C.g:108:8: 'case' - self.match("case") - - - - - - - finally: - - pass - - # $ANTLR end T106 - - - - # $ANTLR start T107 - def mT107(self, ): - - try: - self.type = T107 - - # C.g:109:6: ( 'default' ) - # C.g:109:8: 'default' - self.match("default") - - - - - - - finally: - - pass - - # $ANTLR end T107 - - - - # $ANTLR start T108 - def mT108(self, ): - - try: - self.type = T108 - - # C.g:110:6: ( 'if' ) - # C.g:110:8: 'if' - self.match("if") - - - - - - - finally: - - pass - - # $ANTLR end T108 - - - - # $ANTLR start T109 - def mT109(self, ): - - try: - self.type = T109 - - # C.g:111:6: ( 'else' ) - # C.g:111:8: 'else' - self.match("else") - - - - - - - finally: - - pass - - # $ANTLR end T109 - - - - # $ANTLR start T110 - def mT110(self, ): - - try: - self.type = T110 - - # C.g:112:6: ( 'switch' ) - # C.g:112:8: 'switch' - self.match("switch") - - - - - - - finally: - - pass - - # $ANTLR end T110 - - - - # $ANTLR start T111 - def mT111(self, ): - - try: - self.type = T111 - - # C.g:113:6: ( 'while' ) - # C.g:113:8: 'while' - self.match("while") - - - - - - - finally: - - pass - - # $ANTLR end T111 - - - - # $ANTLR start T112 - def mT112(self, ): - - try: - self.type = T112 - - # C.g:114:6: ( 'do' ) - # C.g:114:8: 'do' - self.match("do") - - - - - - - finally: - - pass - - # $ANTLR end T112 - - - - # $ANTLR start T113 - def mT113(self, ): - - try: - self.type = T113 - - # C.g:115:6: ( 'for' ) - # C.g:115:8: 'for' - self.match("for") - - - - - - - finally: - - pass - - # $ANTLR end T113 - - - - # $ANTLR start T114 - def mT114(self, ): - - try: - self.type = T114 - - # C.g:116:6: ( 'goto' ) - # C.g:116:8: 'goto' - self.match("goto") - - - - - - - finally: - - pass - - # $ANTLR end T114 - - - - # $ANTLR start T115 - def mT115(self, ): - - try: - self.type = T115 - - # C.g:117:6: ( 'continue' ) - # C.g:117:8: 'continue' - self.match("continue") - - - - - - - finally: - - pass - - # $ANTLR end T115 - - - - # $ANTLR start T116 - def mT116(self, ): - - try: - self.type = T116 - - # C.g:118:6: ( 'break' ) - # C.g:118:8: 'break' - self.match("break") - - - - - - - finally: - - pass - - # $ANTLR end T116 - - - - # $ANTLR start T117 - def mT117(self, ): - - try: - self.type = T117 - - # C.g:119:6: ( 'return' ) - # C.g:119:8: 'return' - self.match("return") - - - - - - - finally: - - pass - - # $ANTLR end T117 - - - - # $ANTLR start IDENTIFIER - def mIDENTIFIER(self, ): - - try: - self.type = IDENTIFIER - - # C.g:586:2: ( LETTER ( LETTER | '0' .. '9' )* ) - # C.g:586:4: LETTER ( LETTER | '0' .. '9' )* - self.mLETTER() - - # C.g:586:11: ( LETTER | '0' .. '9' )* - while True: #loop1 - alt1 = 2 - LA1_0 = self.input.LA(1) - - if (LA1_0 == u'$' or (u'0' <= LA1_0 <= u'9') or (u'A' <= LA1_0 <= u'Z') or LA1_0 == u'_' or (u'a' <= LA1_0 <= u'z')) : - alt1 = 1 - - - if alt1 == 1: - # C.g: - if self.input.LA(1) == u'$' or (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - else: - break #loop1 - - - - - - - finally: - - pass - - # $ANTLR end IDENTIFIER - - - - # $ANTLR start LETTER - def mLETTER(self, ): - - try: - # C.g:591:2: ( '$' | 'A' .. 'Z' | 'a' .. 'z' | '_' ) - # C.g: - if self.input.LA(1) == u'$' or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - - finally: - - pass - - # $ANTLR end LETTER - - - - # $ANTLR start CHARACTER_LITERAL - def mCHARACTER_LITERAL(self, ): - - try: - self.type = CHARACTER_LITERAL - - # C.g:598:5: ( ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' ) - # C.g:598:9: ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' - # C.g:598:9: ( 'L' )? - alt2 = 2 - LA2_0 = self.input.LA(1) - - if (LA2_0 == u'L') : - alt2 = 1 - if alt2 == 1: - # C.g:598:10: 'L' - self.match(u'L') - - - - - self.match(u'\'') - - # C.g:598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) - alt3 = 2 - LA3_0 = self.input.LA(1) - - if (LA3_0 == u'\\') : - alt3 = 1 - elif ((u'\u0000' <= LA3_0 <= u'&') or (u'(' <= LA3_0 <= u'[') or (u']' <= LA3_0 <= u'\uFFFE')) : - alt3 = 2 - else: - nvae = NoViableAltException("598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) )", 3, 0, self.input) - - raise nvae - - if alt3 == 1: - # C.g:598:23: EscapeSequence - self.mEscapeSequence() - - - - elif alt3 == 2: - # C.g:598:40: ~ ( '\\'' | '\\\\' ) - if (u'\u0000' <= self.input.LA(1) <= u'&') or (u'(' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - self.match(u'\'') - - - - - - finally: - - pass - - # $ANTLR end CHARACTER_LITERAL - - - - # $ANTLR start STRING_LITERAL - def mSTRING_LITERAL(self, ): - - try: - self.type = STRING_LITERAL - - # C.g:602:5: ( ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) - # C.g:602:8: ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' - # C.g:602:8: ( 'L' )? - alt4 = 2 - LA4_0 = self.input.LA(1) - - if (LA4_0 == u'L') : - alt4 = 1 - if alt4 == 1: - # C.g:602:9: 'L' - self.match(u'L') - - - - - self.match(u'"') - - # C.g:602:19: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* - while True: #loop5 - alt5 = 3 - LA5_0 = self.input.LA(1) - - if (LA5_0 == u'\\') : - alt5 = 1 - elif ((u'\u0000' <= LA5_0 <= u'!') or (u'#' <= LA5_0 <= u'[') or (u']' <= LA5_0 <= u'\uFFFE')) : - alt5 = 2 - - - if alt5 == 1: - # C.g:602:21: EscapeSequence - self.mEscapeSequence() - - - - elif alt5 == 2: - # C.g:602:38: ~ ( '\\\\' | '\"' ) - if (u'\u0000' <= self.input.LA(1) <= u'!') or (u'#' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - else: - break #loop5 - - - self.match(u'"') - - - - - - finally: - - pass - - # $ANTLR end STRING_LITERAL - - - - # $ANTLR start HEX_LITERAL - def mHEX_LITERAL(self, ): - - try: - self.type = HEX_LITERAL - - # C.g:605:13: ( '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? ) - # C.g:605:15: '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? - self.match(u'0') - - if self.input.LA(1) == u'X' or self.input.LA(1) == u'x': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - # C.g:605:29: ( HexDigit )+ - cnt6 = 0 - while True: #loop6 - alt6 = 2 - LA6_0 = self.input.LA(1) - - if ((u'0' <= LA6_0 <= u'9') or (u'A' <= LA6_0 <= u'F') or (u'a' <= LA6_0 <= u'f')) : - alt6 = 1 - - - if alt6 == 1: - # C.g:605:29: HexDigit - self.mHexDigit() - - - - else: - if cnt6 >= 1: - break #loop6 - - eee = EarlyExitException(6, self.input) - raise eee - - cnt6 += 1 - - - # C.g:605:39: ( IntegerTypeSuffix )? - alt7 = 2 - LA7_0 = self.input.LA(1) - - if (LA7_0 == u'L' or LA7_0 == u'U' or LA7_0 == u'l' or LA7_0 == u'u') : - alt7 = 1 - if alt7 == 1: - # C.g:605:39: IntegerTypeSuffix - self.mIntegerTypeSuffix() - - - - - - - - - finally: - - pass - - # $ANTLR end HEX_LITERAL - - - - # $ANTLR start DECIMAL_LITERAL - def mDECIMAL_LITERAL(self, ): - - try: - self.type = DECIMAL_LITERAL - - # C.g:607:17: ( ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? ) - # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? - # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* ) - alt9 = 2 - LA9_0 = self.input.LA(1) - - if (LA9_0 == u'0') : - alt9 = 1 - elif ((u'1' <= LA9_0 <= u'9')) : - alt9 = 2 - else: - nvae = NoViableAltException("607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* )", 9, 0, self.input) - - raise nvae - - if alt9 == 1: - # C.g:607:20: '0' - self.match(u'0') - - - - elif alt9 == 2: - # C.g:607:26: '1' .. '9' ( '0' .. '9' )* - self.matchRange(u'1', u'9') - - # C.g:607:35: ( '0' .. '9' )* - while True: #loop8 - alt8 = 2 - LA8_0 = self.input.LA(1) - - if ((u'0' <= LA8_0 <= u'9')) : - alt8 = 1 - - - if alt8 == 1: - # C.g:607:35: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - break #loop8 - - - - - - # C.g:607:46: ( IntegerTypeSuffix )? - alt10 = 2 - LA10_0 = self.input.LA(1) - - if (LA10_0 == u'L' or LA10_0 == u'U' or LA10_0 == u'l' or LA10_0 == u'u') : - alt10 = 1 - if alt10 == 1: - # C.g:607:46: IntegerTypeSuffix - self.mIntegerTypeSuffix() - - - - - - - - - finally: - - pass - - # $ANTLR end DECIMAL_LITERAL - - - - # $ANTLR start OCTAL_LITERAL - def mOCTAL_LITERAL(self, ): - - try: - self.type = OCTAL_LITERAL - - # C.g:609:15: ( '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? ) - # C.g:609:17: '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? - self.match(u'0') - - # C.g:609:21: ( '0' .. '7' )+ - cnt11 = 0 - while True: #loop11 - alt11 = 2 - LA11_0 = self.input.LA(1) - - if ((u'0' <= LA11_0 <= u'7')) : - alt11 = 1 - - - if alt11 == 1: - # C.g:609:22: '0' .. '7' - self.matchRange(u'0', u'7') - - - - else: - if cnt11 >= 1: - break #loop11 - - eee = EarlyExitException(11, self.input) - raise eee - - cnt11 += 1 - - - # C.g:609:33: ( IntegerTypeSuffix )? - alt12 = 2 - LA12_0 = self.input.LA(1) - - if (LA12_0 == u'L' or LA12_0 == u'U' or LA12_0 == u'l' or LA12_0 == u'u') : - alt12 = 1 - if alt12 == 1: - # C.g:609:33: IntegerTypeSuffix - self.mIntegerTypeSuffix() - - - - - - - - - finally: - - pass - - # $ANTLR end OCTAL_LITERAL - - - - # $ANTLR start HexDigit - def mHexDigit(self, ): - - try: - # C.g:612:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) ) - # C.g:612:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) - if (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'F') or (u'a' <= self.input.LA(1) <= u'f'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - - finally: - - pass - - # $ANTLR end HexDigit - - - - # $ANTLR start IntegerTypeSuffix - def mIntegerTypeSuffix(self, ): - - try: - # C.g:616:2: ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) ) - alt13 = 4 - LA13_0 = self.input.LA(1) - - if (LA13_0 == u'U' or LA13_0 == u'u') : - LA13_1 = self.input.LA(2) - - if (LA13_1 == u'L' or LA13_1 == u'l') : - LA13_3 = self.input.LA(3) - - if (LA13_3 == u'L' or LA13_3 == u'l') : - alt13 = 4 - else: - alt13 = 3 - else: - alt13 = 1 - elif (LA13_0 == u'L' or LA13_0 == u'l') : - alt13 = 2 - else: - nvae = NoViableAltException("614:1: fragment IntegerTypeSuffix : ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) );", 13, 0, self.input) - - raise nvae - - if alt13 == 1: - # C.g:616:4: ( 'u' | 'U' ) - if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - elif alt13 == 2: - # C.g:617:4: ( 'l' | 'L' ) - if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - elif alt13 == 3: - # C.g:618:4: ( 'u' | 'U' ) ( 'l' | 'L' ) - if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - elif alt13 == 4: - # C.g:619:4: ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) - if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - finally: - - pass - - # $ANTLR end IntegerTypeSuffix - - - - # $ANTLR start FLOATING_POINT_LITERAL - def mFLOATING_POINT_LITERAL(self, ): - - try: - self.type = FLOATING_POINT_LITERAL - - # C.g:623:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? | '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix ) - alt25 = 4 - alt25 = self.dfa25.predict(self.input) - if alt25 == 1: - # C.g:623:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? - # C.g:623:9: ( '0' .. '9' )+ - cnt14 = 0 - while True: #loop14 - alt14 = 2 - LA14_0 = self.input.LA(1) - - if ((u'0' <= LA14_0 <= u'9')) : - alt14 = 1 - - - if alt14 == 1: - # C.g:623:10: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - if cnt14 >= 1: - break #loop14 - - eee = EarlyExitException(14, self.input) - raise eee - - cnt14 += 1 - - - self.match(u'.') - - # C.g:623:25: ( '0' .. '9' )* - while True: #loop15 - alt15 = 2 - LA15_0 = self.input.LA(1) - - if ((u'0' <= LA15_0 <= u'9')) : - alt15 = 1 - - - if alt15 == 1: - # C.g:623:26: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - break #loop15 - - - # C.g:623:37: ( Exponent )? - alt16 = 2 - LA16_0 = self.input.LA(1) - - if (LA16_0 == u'E' or LA16_0 == u'e') : - alt16 = 1 - if alt16 == 1: - # C.g:623:37: Exponent - self.mExponent() - - - - - # C.g:623:47: ( FloatTypeSuffix )? - alt17 = 2 - LA17_0 = self.input.LA(1) - - if (LA17_0 == u'D' or LA17_0 == u'F' or LA17_0 == u'd' or LA17_0 == u'f') : - alt17 = 1 - if alt17 == 1: - # C.g:623:47: FloatTypeSuffix - self.mFloatTypeSuffix() - - - - - - - elif alt25 == 2: - # C.g:624:9: '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? - self.match(u'.') - - # C.g:624:13: ( '0' .. '9' )+ - cnt18 = 0 - while True: #loop18 - alt18 = 2 - LA18_0 = self.input.LA(1) - - if ((u'0' <= LA18_0 <= u'9')) : - alt18 = 1 - - - if alt18 == 1: - # C.g:624:14: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - if cnt18 >= 1: - break #loop18 - - eee = EarlyExitException(18, self.input) - raise eee - - cnt18 += 1 - - - # C.g:624:25: ( Exponent )? - alt19 = 2 - LA19_0 = self.input.LA(1) - - if (LA19_0 == u'E' or LA19_0 == u'e') : - alt19 = 1 - if alt19 == 1: - # C.g:624:25: Exponent - self.mExponent() - - - - - # C.g:624:35: ( FloatTypeSuffix )? - alt20 = 2 - LA20_0 = self.input.LA(1) - - if (LA20_0 == u'D' or LA20_0 == u'F' or LA20_0 == u'd' or LA20_0 == u'f') : - alt20 = 1 - if alt20 == 1: - # C.g:624:35: FloatTypeSuffix - self.mFloatTypeSuffix() - - - - - - - elif alt25 == 3: - # C.g:625:9: ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? - # C.g:625:9: ( '0' .. '9' )+ - cnt21 = 0 - while True: #loop21 - alt21 = 2 - LA21_0 = self.input.LA(1) - - if ((u'0' <= LA21_0 <= u'9')) : - alt21 = 1 - - - if alt21 == 1: - # C.g:625:10: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - if cnt21 >= 1: - break #loop21 - - eee = EarlyExitException(21, self.input) - raise eee - - cnt21 += 1 - - - self.mExponent() - - # C.g:625:30: ( FloatTypeSuffix )? - alt22 = 2 - LA22_0 = self.input.LA(1) - - if (LA22_0 == u'D' or LA22_0 == u'F' or LA22_0 == u'd' or LA22_0 == u'f') : - alt22 = 1 - if alt22 == 1: - # C.g:625:30: FloatTypeSuffix - self.mFloatTypeSuffix() - - - - - - - elif alt25 == 4: - # C.g:626:9: ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix - # C.g:626:9: ( '0' .. '9' )+ - cnt23 = 0 - while True: #loop23 - alt23 = 2 - LA23_0 = self.input.LA(1) - - if ((u'0' <= LA23_0 <= u'9')) : - alt23 = 1 - - - if alt23 == 1: - # C.g:626:10: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - if cnt23 >= 1: - break #loop23 - - eee = EarlyExitException(23, self.input) - raise eee - - cnt23 += 1 - - - # C.g:626:21: ( Exponent )? - alt24 = 2 - LA24_0 = self.input.LA(1) - - if (LA24_0 == u'E' or LA24_0 == u'e') : - alt24 = 1 - if alt24 == 1: - # C.g:626:21: Exponent - self.mExponent() - - - - - self.mFloatTypeSuffix() - - - - - finally: - - pass - - # $ANTLR end FLOATING_POINT_LITERAL - - - - # $ANTLR start Exponent - def mExponent(self, ): - - try: - # C.g:630:10: ( ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ ) - # C.g:630:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ - if self.input.LA(1) == u'E' or self.input.LA(1) == u'e': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - # C.g:630:22: ( '+' | '-' )? - alt26 = 2 - LA26_0 = self.input.LA(1) - - if (LA26_0 == u'+' or LA26_0 == u'-') : - alt26 = 1 - if alt26 == 1: - # C.g: - if self.input.LA(1) == u'+' or self.input.LA(1) == u'-': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - # C.g:630:33: ( '0' .. '9' )+ - cnt27 = 0 - while True: #loop27 - alt27 = 2 - LA27_0 = self.input.LA(1) - - if ((u'0' <= LA27_0 <= u'9')) : - alt27 = 1 - - - if alt27 == 1: - # C.g:630:34: '0' .. '9' - self.matchRange(u'0', u'9') - - - - else: - if cnt27 >= 1: - break #loop27 - - eee = EarlyExitException(27, self.input) - raise eee - - cnt27 += 1 - - - - - - - finally: - - pass - - # $ANTLR end Exponent - - - - # $ANTLR start FloatTypeSuffix - def mFloatTypeSuffix(self, ): - - try: - # C.g:633:17: ( ( 'f' | 'F' | 'd' | 'D' ) ) - # C.g:633:19: ( 'f' | 'F' | 'd' | 'D' ) - if self.input.LA(1) == u'D' or self.input.LA(1) == u'F' or self.input.LA(1) == u'd' or self.input.LA(1) == u'f': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - - - finally: - - pass - - # $ANTLR end FloatTypeSuffix - - - - # $ANTLR start EscapeSequence - def mEscapeSequence(self, ): - - try: - # C.g:637:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape ) - alt28 = 2 - LA28_0 = self.input.LA(1) - - if (LA28_0 == u'\\') : - LA28_1 = self.input.LA(2) - - if (LA28_1 == u'"' or LA28_1 == u'\'' or LA28_1 == u'\\' or LA28_1 == u'b' or LA28_1 == u'f' or LA28_1 == u'n' or LA28_1 == u'r' or LA28_1 == u't') : - alt28 = 1 - elif ((u'0' <= LA28_1 <= u'7')) : - alt28 = 2 - else: - nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 1, self.input) - - raise nvae - - else: - nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 0, self.input) - - raise nvae - - if alt28 == 1: - # C.g:637:8: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) - self.match(u'\\') - - if self.input.LA(1) == u'"' or self.input.LA(1) == u'\'' or self.input.LA(1) == u'\\' or self.input.LA(1) == u'b' or self.input.LA(1) == u'f' or self.input.LA(1) == u'n' or self.input.LA(1) == u'r' or self.input.LA(1) == u't': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - elif alt28 == 2: - # C.g:638:9: OctalEscape - self.mOctalEscape() - - - - - finally: - - pass - - # $ANTLR end EscapeSequence - - - - # $ANTLR start OctalEscape - def mOctalEscape(self, ): - - try: - # C.g:643:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ) - alt29 = 3 - LA29_0 = self.input.LA(1) - - if (LA29_0 == u'\\') : - LA29_1 = self.input.LA(2) - - if ((u'0' <= LA29_1 <= u'3')) : - LA29_2 = self.input.LA(3) - - if ((u'0' <= LA29_2 <= u'7')) : - LA29_4 = self.input.LA(4) - - if ((u'0' <= LA29_4 <= u'7')) : - alt29 = 1 - else: - alt29 = 2 - else: - alt29 = 3 - elif ((u'4' <= LA29_1 <= u'7')) : - LA29_3 = self.input.LA(3) - - if ((u'0' <= LA29_3 <= u'7')) : - alt29 = 2 - else: - alt29 = 3 - else: - nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 1, self.input) - - raise nvae - - else: - nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 0, self.input) - - raise nvae - - if alt29 == 1: - # C.g:643:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) - self.match(u'\\') - - # C.g:643:14: ( '0' .. '3' ) - # C.g:643:15: '0' .. '3' - self.matchRange(u'0', u'3') - - - - - # C.g:643:25: ( '0' .. '7' ) - # C.g:643:26: '0' .. '7' - self.matchRange(u'0', u'7') - - - - - # C.g:643:36: ( '0' .. '7' ) - # C.g:643:37: '0' .. '7' - self.matchRange(u'0', u'7') - - - - - - - elif alt29 == 2: - # C.g:644:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) - self.match(u'\\') - - # C.g:644:14: ( '0' .. '7' ) - # C.g:644:15: '0' .. '7' - self.matchRange(u'0', u'7') - - - - - # C.g:644:25: ( '0' .. '7' ) - # C.g:644:26: '0' .. '7' - self.matchRange(u'0', u'7') - - - - - - - elif alt29 == 3: - # C.g:645:9: '\\\\' ( '0' .. '7' ) - self.match(u'\\') - - # C.g:645:14: ( '0' .. '7' ) - # C.g:645:15: '0' .. '7' - self.matchRange(u'0', u'7') - - - - - - - - finally: - - pass - - # $ANTLR end OctalEscape - - - - # $ANTLR start UnicodeEscape - def mUnicodeEscape(self, ): - - try: - # C.g:650:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit ) - # C.g:650:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit - self.match(u'\\') - - self.match(u'u') - - self.mHexDigit() - - self.mHexDigit() - - self.mHexDigit() - - self.mHexDigit() - - - - - - finally: - - pass - - # $ANTLR end UnicodeEscape - - - - # $ANTLR start WS - def mWS(self, ): - - try: - self.type = WS - - # C.g:653:5: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) ) - # C.g:653:8: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) - if (u'\t' <= self.input.LA(1) <= u'\n') or (u'\f' <= self.input.LA(1) <= u'\r') or self.input.LA(1) == u' ': - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - #action start - self.channel=HIDDEN; - #action end - - - - - finally: - - pass - - # $ANTLR end WS - - - - # $ANTLR start BS - def mBS(self, ): - - try: - self.type = BS - - # C.g:657:5: ( ( '\\\\' ) ) - # C.g:657:7: ( '\\\\' ) - # C.g:657:7: ( '\\\\' ) - # C.g:657:8: '\\\\' - self.match(u'\\') - - - - - #action start - self.channel=HIDDEN; - #action end - - - - - finally: - - pass - - # $ANTLR end BS - - - - # $ANTLR start UnicodeVocabulary - def mUnicodeVocabulary(self, ): - - try: - self.type = UnicodeVocabulary - - # C.g:665:5: ( '\\u0003' .. '\\uFFFE' ) - # C.g:665:7: '\\u0003' .. '\\uFFFE' - self.matchRange(u'\u0003', u'\uFFFE') - - - - - - finally: - - pass - - # $ANTLR end UnicodeVocabulary - - - - # $ANTLR start COMMENT - def mCOMMENT(self, ): - - try: - self.type = COMMENT - - # C.g:668:5: ( '/*' ( options {greedy=false; } : . )* '*/' ) - # C.g:668:9: '/*' ( options {greedy=false; } : . )* '*/' - self.match("/*") - - - # C.g:668:14: ( options {greedy=false; } : . )* - while True: #loop30 - alt30 = 2 - LA30_0 = self.input.LA(1) - - if (LA30_0 == u'*') : - LA30_1 = self.input.LA(2) - - if (LA30_1 == u'/') : - alt30 = 2 - elif ((u'\u0000' <= LA30_1 <= u'.') or (u'0' <= LA30_1 <= u'\uFFFE')) : - alt30 = 1 - - - elif ((u'\u0000' <= LA30_0 <= u')') or (u'+' <= LA30_0 <= u'\uFFFE')) : - alt30 = 1 - - - if alt30 == 1: - # C.g:668:42: . - self.matchAny() - - - - else: - break #loop30 - - - self.match("*/") - - - #action start - self.channel=HIDDEN; - #action end - - - - - finally: - - pass - - # $ANTLR end COMMENT - - - - # $ANTLR start LINE_COMMENT - def mLINE_COMMENT(self, ): - - try: - self.type = LINE_COMMENT - - # C.g:673:5: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) - # C.g:673:7: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' - self.match("//") - - - # C.g:673:12: (~ ( '\\n' | '\\r' ) )* - while True: #loop31 - alt31 = 2 - LA31_0 = self.input.LA(1) - - if ((u'\u0000' <= LA31_0 <= u'\t') or (u'\u000B' <= LA31_0 <= u'\f') or (u'\u000E' <= LA31_0 <= u'\uFFFE')) : - alt31 = 1 - - - if alt31 == 1: - # C.g:673:12: ~ ( '\\n' | '\\r' ) - if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - else: - break #loop31 - - - # C.g:673:26: ( '\\r' )? - alt32 = 2 - LA32_0 = self.input.LA(1) - - if (LA32_0 == u'\r') : - alt32 = 1 - if alt32 == 1: - # C.g:673:26: '\\r' - self.match(u'\r') - - - - - self.match(u'\n') - - #action start - self.channel=HIDDEN; - #action end - - - - - finally: - - pass - - # $ANTLR end LINE_COMMENT - - - - # $ANTLR start LINE_COMMAND - def mLINE_COMMAND(self, ): - - try: - self.type = LINE_COMMAND - - # C.g:678:5: ( '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) - # C.g:678:7: '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' - self.match(u'#') - - # C.g:678:11: (~ ( '\\n' | '\\r' ) )* - while True: #loop33 - alt33 = 2 - LA33_0 = self.input.LA(1) - - if ((u'\u0000' <= LA33_0 <= u'\t') or (u'\u000B' <= LA33_0 <= u'\f') or (u'\u000E' <= LA33_0 <= u'\uFFFE')) : - alt33 = 1 - - - if alt33 == 1: - # C.g:678:11: ~ ( '\\n' | '\\r' ) - if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'): - self.input.consume(); - - else: - mse = MismatchedSetException(None, self.input) - self.recover(mse) - raise mse - - - - - else: - break #loop33 - - - # C.g:678:25: ( '\\r' )? - alt34 = 2 - LA34_0 = self.input.LA(1) - - if (LA34_0 == u'\r') : - alt34 = 1 - if alt34 == 1: - # C.g:678:25: '\\r' - self.match(u'\r') - - - - - self.match(u'\n') - - #action start - self.channel=HIDDEN; - #action end - - - - - finally: - - pass - - # $ANTLR end LINE_COMMAND - - - - def mTokens(self): - # C.g:1:8: ( T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | T41 | T42 | T43 | T44 | T45 | T46 | T47 | T48 | T49 | T50 | T51 | T52 | T53 | T54 | T55 | T56 | T57 | T58 | T59 | T60 | T61 | T62 | T63 | T64 | T65 | T66 | T67 | T68 | T69 | T70 | T71 | T72 | T73 | T74 | T75 | T76 | T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | T87 | T88 | T89 | T90 | T91 | T92 | T93 | T94 | T95 | T96 | T97 | T98 | T99 | T100 | T101 | T102 | T103 | T104 | T105 | T106 | T107 | T108 | T109 | T110 | T111 | T112 | T113 | T114 | T115 | T116 | T117 | IDENTIFIER | CHARACTER_LITERAL | STRING_LITERAL | HEX_LITERAL | DECIMAL_LITERAL | OCTAL_LITERAL | FLOATING_POINT_LITERAL | WS | BS | UnicodeVocabulary | COMMENT | LINE_COMMENT | LINE_COMMAND ) - alt35 = 106 - alt35 = self.dfa35.predict(self.input) - if alt35 == 1: - # C.g:1:10: T25 - self.mT25() - - - - elif alt35 == 2: - # C.g:1:14: T26 - self.mT26() - - - - elif alt35 == 3: - # C.g:1:18: T27 - self.mT27() - - - - elif alt35 == 4: - # C.g:1:22: T28 - self.mT28() - - - - elif alt35 == 5: - # C.g:1:26: T29 - self.mT29() - - - - elif alt35 == 6: - # C.g:1:30: T30 - self.mT30() - - - - elif alt35 == 7: - # C.g:1:34: T31 - self.mT31() - - - - elif alt35 == 8: - # C.g:1:38: T32 - self.mT32() - - - - elif alt35 == 9: - # C.g:1:42: T33 - self.mT33() - - - - elif alt35 == 10: - # C.g:1:46: T34 - self.mT34() - - - - elif alt35 == 11: - # C.g:1:50: T35 - self.mT35() - - - - elif alt35 == 12: - # C.g:1:54: T36 - self.mT36() - - - - elif alt35 == 13: - # C.g:1:58: T37 - self.mT37() - - - - elif alt35 == 14: - # C.g:1:62: T38 - self.mT38() - - - - elif alt35 == 15: - # C.g:1:66: T39 - self.mT39() - - - - elif alt35 == 16: - # C.g:1:70: T40 - self.mT40() - - - - elif alt35 == 17: - # C.g:1:74: T41 - self.mT41() - - - - elif alt35 == 18: - # C.g:1:78: T42 - self.mT42() - - - - elif alt35 == 19: - # C.g:1:82: T43 - self.mT43() - - - - elif alt35 == 20: - # C.g:1:86: T44 - self.mT44() - - - - elif alt35 == 21: - # C.g:1:90: T45 - self.mT45() - - - - elif alt35 == 22: - # C.g:1:94: T46 - self.mT46() - - - - elif alt35 == 23: - # C.g:1:98: T47 - self.mT47() - - - - elif alt35 == 24: - # C.g:1:102: T48 - self.mT48() - - - - elif alt35 == 25: - # C.g:1:106: T49 - self.mT49() - - - - elif alt35 == 26: - # C.g:1:110: T50 - self.mT50() - - - - elif alt35 == 27: - # C.g:1:114: T51 - self.mT51() - - - - elif alt35 == 28: - # C.g:1:118: T52 - self.mT52() - - - - elif alt35 == 29: - # C.g:1:122: T53 - self.mT53() - - - - elif alt35 == 30: - # C.g:1:126: T54 - self.mT54() - - - - elif alt35 == 31: - # C.g:1:130: T55 - self.mT55() - - - - elif alt35 == 32: - # C.g:1:134: T56 - self.mT56() - - - - elif alt35 == 33: - # C.g:1:138: T57 - self.mT57() - - - - elif alt35 == 34: - # C.g:1:142: T58 - self.mT58() - - - - elif alt35 == 35: - # C.g:1:146: T59 - self.mT59() - - - - elif alt35 == 36: - # C.g:1:150: T60 - self.mT60() - - - - elif alt35 == 37: - # C.g:1:154: T61 - self.mT61() - - - - elif alt35 == 38: - # C.g:1:158: T62 - self.mT62() - - - - elif alt35 == 39: - # C.g:1:162: T63 - self.mT63() - - - - elif alt35 == 40: - # C.g:1:166: T64 - self.mT64() - - - - elif alt35 == 41: - # C.g:1:170: T65 - self.mT65() - - - - elif alt35 == 42: - # C.g:1:174: T66 - self.mT66() - - - - elif alt35 == 43: - # C.g:1:178: T67 - self.mT67() - - - - elif alt35 == 44: - # C.g:1:182: T68 - self.mT68() - - - - elif alt35 == 45: - # C.g:1:186: T69 - self.mT69() - - - - elif alt35 == 46: - # C.g:1:190: T70 - self.mT70() - - - - elif alt35 == 47: - # C.g:1:194: T71 - self.mT71() - - - - elif alt35 == 48: - # C.g:1:198: T72 - self.mT72() - - - - elif alt35 == 49: - # C.g:1:202: T73 - self.mT73() - - - - elif alt35 == 50: - # C.g:1:206: T74 - self.mT74() - - - - elif alt35 == 51: - # C.g:1:210: T75 - self.mT75() - - - - elif alt35 == 52: - # C.g:1:214: T76 - self.mT76() - - - - elif alt35 == 53: - # C.g:1:218: T77 - self.mT77() - - - - elif alt35 == 54: - # C.g:1:222: T78 - self.mT78() - - - - elif alt35 == 55: - # C.g:1:226: T79 - self.mT79() - - - - elif alt35 == 56: - # C.g:1:230: T80 - self.mT80() - - - - elif alt35 == 57: - # C.g:1:234: T81 - self.mT81() - - - - elif alt35 == 58: - # C.g:1:238: T82 - self.mT82() - - - - elif alt35 == 59: - # C.g:1:242: T83 - self.mT83() - - - - elif alt35 == 60: - # C.g:1:246: T84 - self.mT84() - - - - elif alt35 == 61: - # C.g:1:250: T85 - self.mT85() - - - - elif alt35 == 62: - # C.g:1:254: T86 - self.mT86() - - - - elif alt35 == 63: - # C.g:1:258: T87 - self.mT87() - - - - elif alt35 == 64: - # C.g:1:262: T88 - self.mT88() - - - - elif alt35 == 65: - # C.g:1:266: T89 - self.mT89() - - - - elif alt35 == 66: - # C.g:1:270: T90 - self.mT90() - - - - elif alt35 == 67: - # C.g:1:274: T91 - self.mT91() - - - - elif alt35 == 68: - # C.g:1:278: T92 - self.mT92() - - - - elif alt35 == 69: - # C.g:1:282: T93 - self.mT93() - - - - elif alt35 == 70: - # C.g:1:286: T94 - self.mT94() - - - - elif alt35 == 71: - # C.g:1:290: T95 - self.mT95() - - - - elif alt35 == 72: - # C.g:1:294: T96 - self.mT96() - - - - elif alt35 == 73: - # C.g:1:298: T97 - self.mT97() - - - - elif alt35 == 74: - # C.g:1:302: T98 - self.mT98() - - - - elif alt35 == 75: - # C.g:1:306: T99 - self.mT99() - - - - elif alt35 == 76: - # C.g:1:310: T100 - self.mT100() - - - - elif alt35 == 77: - # C.g:1:315: T101 - self.mT101() - - - - elif alt35 == 78: - # C.g:1:320: T102 - self.mT102() - - - - elif alt35 == 79: - # C.g:1:325: T103 - self.mT103() - - - - elif alt35 == 80: - # C.g:1:330: T104 - self.mT104() - - - - elif alt35 == 81: - # C.g:1:335: T105 - self.mT105() - - - - elif alt35 == 82: - # C.g:1:340: T106 - self.mT106() - - - - elif alt35 == 83: - # C.g:1:345: T107 - self.mT107() - - - - elif alt35 == 84: - # C.g:1:350: T108 - self.mT108() - - - - elif alt35 == 85: - # C.g:1:355: T109 - self.mT109() - - - - elif alt35 == 86: - # C.g:1:360: T110 - self.mT110() - - - - elif alt35 == 87: - # C.g:1:365: T111 - self.mT111() - - - - elif alt35 == 88: - # C.g:1:370: T112 - self.mT112() - - - - elif alt35 == 89: - # C.g:1:375: T113 - self.mT113() - - - - elif alt35 == 90: - # C.g:1:380: T114 - self.mT114() - - - - elif alt35 == 91: - # C.g:1:385: T115 - self.mT115() - - - - elif alt35 == 92: - # C.g:1:390: T116 - self.mT116() - - - - elif alt35 == 93: - # C.g:1:395: T117 - self.mT117() - - - - elif alt35 == 94: - # C.g:1:400: IDENTIFIER - self.mIDENTIFIER() - - - - elif alt35 == 95: - # C.g:1:411: CHARACTER_LITERAL - self.mCHARACTER_LITERAL() - - - - elif alt35 == 96: - # C.g:1:429: STRING_LITERAL - self.mSTRING_LITERAL() - - - - elif alt35 == 97: - # C.g:1:444: HEX_LITERAL - self.mHEX_LITERAL() - - - - elif alt35 == 98: - # C.g:1:456: DECIMAL_LITERAL - self.mDECIMAL_LITERAL() - - - - elif alt35 == 99: - # C.g:1:472: OCTAL_LITERAL - self.mOCTAL_LITERAL() - - - - elif alt35 == 100: - # C.g:1:486: FLOATING_POINT_LITERAL - self.mFLOATING_POINT_LITERAL() - - - - elif alt35 == 101: - # C.g:1:509: WS - self.mWS() - - - - elif alt35 == 102: - # C.g:1:512: BS - self.mBS() - - - - elif alt35 == 103: - # C.g:1:515: UnicodeVocabulary - self.mUnicodeVocabulary() - - - - elif alt35 == 104: - # C.g:1:533: COMMENT - self.mCOMMENT() - - - - elif alt35 == 105: - # C.g:1:541: LINE_COMMENT - self.mLINE_COMMENT() - - - - elif alt35 == 106: - # C.g:1:554: LINE_COMMAND - self.mLINE_COMMAND() - - - - - - - - - # lookup tables for DFA #25 - - DFA25_eot = DFA.unpack( - u"\7\uffff\1\10\2\uffff" - ) - - DFA25_eof = DFA.unpack( - u"\12\uffff" - ) - - DFA25_min = DFA.unpack( - u"\2\56\2\uffff\1\53\1\uffff\2\60\2\uffff" - ) - - DFA25_max = DFA.unpack( - u"\1\71\1\146\2\uffff\1\71\1\uffff\1\71\1\146\2\uffff" - ) - - DFA25_accept = DFA.unpack( - u"\2\uffff\1\2\1\1\1\uffff\1\4\2\uffff\2\3" - ) - - DFA25_special = DFA.unpack( - u"\12\uffff" - ) - - - DFA25_transition = [ - DFA.unpack(u"\1\2\1\uffff\12\1"), - DFA.unpack(u"\1\3\1\uffff\12\1\12\uffff\1\5\1\4\1\5\35\uffff\1\5" - u"\1\4\1\5"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\6\1\uffff\1\6\2\uffff\12\7"), - DFA.unpack(u""), - DFA.unpack(u"\12\7"), - DFA.unpack(u"\12\7\12\uffff\1\11\1\uffff\1\11\35\uffff\1\11\1\uffff" - u"\1\11"), - DFA.unpack(u""), - DFA.unpack(u"") - ] - - # class definition for DFA #25 - - DFA25 = DFA - # lookup tables for DFA #35 - - DFA35_eot = DFA.unpack( - u"\2\uffff\1\76\1\uffff\1\101\14\76\3\uffff\10\76\4\uffff\1\151\1" - u"\153\1\157\1\163\1\167\1\171\1\174\1\uffff\1\177\1\u0082\1\u0085" - u"\1\u0087\1\u008a\1\uffff\5\76\1\uffff\2\73\2\u0095\2\uffff\1\73" - u"\2\uffff\1\76\4\uffff\16\76\1\u00ad\5\76\1\u00b4\1\76\3\uffff\1" - u"\u00b7\10\76\34\uffff\1\u00c1\2\uffff\1\u00c3\10\uffff\5\76\3\uffff" - u"\1\u00c9\1\uffff\1\u0095\3\uffff\23\76\1\uffff\1\u00de\1\76\1\u00e0" - u"\3\76\1\uffff\2\76\1\uffff\1\76\1\u00e7\6\76\4\uffff\5\76\1\uffff" - u"\1\76\1\u00f5\1\76\1\u00f7\6\76\1\u00fe\4\76\1\u0103\1\u0104\2" - u"\76\1\u0107\1\uffff\1\u0108\1\uffff\6\76\1\uffff\10\76\1\u0118" - u"\1\76\1\u011a\2\76\1\uffff\1\76\1\uffff\5\76\1\u0123\1\uffff\4" - u"\76\2\uffff\1\76\1\u0129\2\uffff\1\u012a\3\76\1\u012e\1\76\1\u0130" - u"\7\76\1\u0139\1\uffff\1\u013a\1\uffff\1\u013b\1\76\1\u013d\1\u013e" - u"\1\u013f\1\u0140\1\u0141\1\u0142\1\uffff\1\76\1\u0144\1\u0145\2" - u"\76\2\uffff\1\76\1\u0149\1\76\1\uffff\1\76\1\uffff\5\76\1\u0151" - u"\1\u0152\1\76\3\uffff\1\u0154\6\uffff\1\76\2\uffff\2\76\1\u0158" - u"\1\uffff\7\76\2\uffff\1\u0160\1\uffff\1\u0161\1\u0162\1\u0163\1" - u"\uffff\1\u0164\1\u0165\1\76\1\u0167\3\76\6\uffff\1\u016b\1\uffff" - u"\3\76\1\uffff\21\76\1\u0180\2\76\1\uffff\3\76\1\u0186\1\76\1\uffff" - u"\11\76\1\u0191\1\uffff" - ) - - DFA35_eof = DFA.unpack( - u"\u0192\uffff" - ) - - DFA35_min = DFA.unpack( - u"\1\3\1\uffff\1\171\1\uffff\1\75\1\154\1\150\1\165\1\145\1\124\1" - u"\157\1\141\1\146\1\157\1\154\1\145\1\156\3\uffff\1\116\1\120\1" - u"\117\1\116\1\117\1\114\1\106\1\101\4\uffff\1\75\1\56\1\53\1\55" - u"\1\52\1\75\1\46\1\uffff\1\75\1\74\3\75\1\uffff\1\137\1\150\1\157" - u"\1\162\1\42\1\uffff\2\0\2\56\2\uffff\1\0\2\uffff\1\160\4\uffff" - u"\1\163\1\164\1\165\1\151\1\141\1\147\1\157\1\164\1\147\1\101\1" - u"\151\1\163\1\156\1\141\1\44\1\164\1\156\1\162\1\157\1\146\1\44" - u"\1\151\3\uffff\1\44\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34" - u"\uffff\1\75\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145" - u"\3\uffff\1\56\1\uffff\1\56\3\uffff\3\145\1\155\2\164\1\165\1\145" - u"\1\156\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\163\1" - u"\162\1\uffff\1\44\1\147\1\44\2\141\1\142\1\uffff\1\151\1\157\1" - u"\uffff\1\111\1\44\1\123\1\114\1\101\1\102\1\101\1\113\4\uffff\1" - u"\163\1\155\1\154\1\157\1\141\1\uffff\1\144\1\44\1\162\1\44\1\143" - u"\1\151\1\143\1\157\1\145\1\164\1\44\1\163\1\162\1\111\1\164\2\44" - u"\1\151\1\164\1\44\1\uffff\1\44\1\uffff\1\164\1\165\1\154\1\147" - u"\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\102\1\120\1\105" - u"\1\155\1\44\1\145\1\44\1\153\1\145\1\uffff\1\156\1\uffff\1\150" - u"\1\143\1\164\1\146\1\144\1\44\1\uffff\1\164\1\156\1\103\1\151\2" - u"\uffff\1\156\1\44\2\uffff\1\44\1\154\1\145\1\156\1\44\1\116\1\44" - u"\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\44\1\uffff\1\44\1" - u"\uffff\1\44\1\146\6\44\1\uffff\1\145\2\44\1\154\1\165\2\uffff\1" - u"\164\1\44\1\145\1\uffff\1\101\1\uffff\1\116\1\114\1\137\1\116\1" - u"\117\2\44\1\137\3\uffff\1\44\6\uffff\1\162\2\uffff\2\145\1\44\1" - u"\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff\1\44\1\uffff\3\44" - u"\1\uffff\2\44\1\104\1\44\1\105\1\111\1\123\6\uffff\1\44\1\uffff" - u"\2\115\1\105\1\uffff\1\117\1\105\1\122\1\126\1\123\1\126\2\105" - u"\1\111\1\137\1\122\1\103\1\111\1\126\1\105\1\106\1\111\1\44\1\137" - u"\1\103\1\uffff\1\125\1\105\1\116\1\44\1\122\1\uffff\1\105\1\106" - u"\1\105\1\122\1\105\1\116\1\103\1\105\1\104\1\44\1\uffff" - ) - - DFA35_max = DFA.unpack( - u"\1\ufffe\1\uffff\1\171\1\uffff\1\75\1\170\1\167\1\165\1\145\1\124" - u"\2\157\1\156\3\157\1\156\3\uffff\1\116\1\125\1\117\1\116\1\117" - u"\1\114\1\106\1\101\4\uffff\1\75\1\71\1\75\1\76\3\75\1\uffff\2\75" - u"\1\76\1\75\1\174\1\uffff\1\141\1\150\1\157\1\162\1\47\1\uffff\2" - u"\ufffe\1\170\1\146\2\uffff\1\ufffe\2\uffff\1\160\4\uffff\1\163" - u"\1\164\1\165\1\151\1\162\1\172\1\157\2\164\1\101\1\154\1\163\1" - u"\156\1\141\1\172\1\164\1\156\1\162\1\157\1\146\1\172\1\163\3\uffff" - u"\1\172\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34\uffff\1\75" - u"\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145\3\uffff\1" - u"\146\1\uffff\1\146\3\uffff\3\145\1\155\2\164\1\165\1\145\1\156" - u"\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\164\1\162\1" - u"\uffff\1\172\1\147\1\172\2\141\1\142\1\uffff\1\151\1\157\1\uffff" - u"\1\111\1\172\1\123\1\114\1\101\1\102\1\137\1\113\4\uffff\1\163" - u"\1\155\1\154\1\157\1\141\1\uffff\1\144\1\172\1\162\1\172\1\143" - u"\1\151\1\143\1\157\1\145\1\164\1\172\1\163\1\162\1\111\1\164\2" - u"\172\1\151\1\164\1\172\1\uffff\1\172\1\uffff\1\164\1\165\1\154" - u"\1\147\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\122\1\120" - u"\1\105\1\155\1\172\1\145\1\172\1\153\1\145\1\uffff\1\156\1\uffff" - u"\1\150\1\143\1\164\1\146\1\144\1\172\1\uffff\1\164\1\156\1\103" - u"\1\151\2\uffff\1\156\1\172\2\uffff\1\172\1\154\1\145\1\156\1\172" - u"\1\116\1\172\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\172\1" - u"\uffff\1\172\1\uffff\1\172\1\146\6\172\1\uffff\1\145\2\172\1\154" - u"\1\165\2\uffff\1\164\1\172\1\145\1\uffff\1\101\1\uffff\1\116\1" - u"\114\1\137\1\116\1\117\2\172\1\137\3\uffff\1\172\6\uffff\1\162" - u"\2\uffff\2\145\1\172\1\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff" - u"\1\172\1\uffff\3\172\1\uffff\2\172\1\104\1\172\1\105\1\111\1\123" - u"\6\uffff\1\172\1\uffff\2\115\1\105\1\uffff\1\117\1\105\1\122\1" - u"\126\1\123\1\126\2\105\1\111\1\137\1\122\1\103\1\111\1\126\1\105" - u"\1\106\1\111\1\172\1\137\1\103\1\uffff\1\125\1\105\1\116\1\172" - u"\1\122\1\uffff\1\105\1\106\1\105\1\122\1\105\1\116\1\103\1\105" - u"\1\104\1\172\1\uffff" - ) - - DFA35_accept = DFA.unpack( - u"\1\uffff\1\1\1\uffff\1\3\15\uffff\1\23\1\24\1\27\10\uffff\1\46" - u"\1\47\1\50\1\51\7\uffff\1\66\5\uffff\1\102\5\uffff\1\136\4\uffff" - u"\1\145\1\146\1\uffff\1\147\1\1\1\uffff\1\136\1\3\1\107\1\4\26\uffff" - u"\1\23\1\24\1\27\11\uffff\1\46\1\47\1\50\1\51\1\70\1\52\1\53\1\63" - u"\1\144\1\73\1\60\1\54\1\74\1\64\1\61\1\55\1\150\1\151\1\71\1\56" - u"\1\72\1\57\1\77\1\104\1\65\1\66\1\110\1\67\1\uffff\1\113\1\111" - u"\1\uffff\1\114\1\112\1\100\1\106\1\103\1\101\1\105\1\102\5\uffff" - u"\1\140\1\137\1\141\1\uffff\1\142\1\uffff\1\145\1\146\1\152\23\uffff" - u"\1\124\6\uffff\1\130\2\uffff\1\33\10\uffff\1\75\1\115\1\76\1\116" - u"\5\uffff\1\143\24\uffff\1\15\1\uffff\1\131\6\uffff\1\34\15\uffff" - u"\1\125\1\uffff\1\30\6\uffff\1\7\4\uffff\1\12\1\122\2\uffff\1\13" - u"\1\16\17\uffff\1\120\1\uffff\1\132\10\uffff\1\14\5\uffff\1\31\1" - u"\17\3\uffff\1\26\1\uffff\1\36\10\uffff\1\121\1\127\1\134\1\uffff" - u"\1\5\1\126\1\6\1\25\1\62\1\21\1\uffff\1\135\1\11\3\uffff\1\20\7" - u"\uffff\1\42\1\45\1\uffff\1\2\3\uffff\1\123\7\uffff\1\117\1\10\1" - u"\32\1\133\1\22\1\35\1\uffff\1\40\3\uffff\1\37\24\uffff\1\43\5\uffff" - u"\1\44\12\uffff\1\41" - ) - - DFA35_special = DFA.unpack( - u"\u0192\uffff" - ) - - - DFA35_transition = [ - DFA.unpack(u"\6\73\2\70\1\73\2\70\22\73\1\70\1\50\1\65\1\72\1\63" - u"\1\45\1\46\1\64\1\34\1\35\1\40\1\42\1\3\1\43\1\41\1\44\1\66\11" - u"\67\1\23\1\1\1\51\1\4\1\52\1\55\1\73\2\63\1\26\1\63\1\32\1\63\1" - u"\31\1\63\1\24\2\63\1\62\2\63\1\25\1\33\2\63\1\11\1\63\1\27\1\30" - u"\4\63\1\36\1\71\1\37\1\53\1\56\1\73\1\7\1\61\1\13\1\17\1\5\1\16" - u"\1\60\1\63\1\14\2\63\1\15\5\63\1\10\1\6\1\2\1\20\1\12\1\57\3\63" - u"\1\21\1\54\1\22\1\47\uff80\73"), - DFA.unpack(u""), - DFA.unpack(u"\1\75"), - DFA.unpack(u""), - DFA.unpack(u"\1\100"), - DFA.unpack(u"\1\102\1\uffff\1\104\11\uffff\1\103"), - DFA.unpack(u"\1\110\1\107\12\uffff\1\106\2\uffff\1\105"), - DFA.unpack(u"\1\111"), - DFA.unpack(u"\1\112"), - DFA.unpack(u"\1\113"), - DFA.unpack(u"\1\114"), - DFA.unpack(u"\1\115\6\uffff\1\117\6\uffff\1\116"), - DFA.unpack(u"\1\120\7\uffff\1\121"), - DFA.unpack(u"\1\122"), - DFA.unpack(u"\1\124\2\uffff\1\123"), - DFA.unpack(u"\1\125\11\uffff\1\126"), - DFA.unpack(u"\1\127"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\133"), - DFA.unpack(u"\1\134\4\uffff\1\135"), - DFA.unpack(u"\1\136"), - DFA.unpack(u"\1\137"), - DFA.unpack(u"\1\140"), - DFA.unpack(u"\1\141"), - DFA.unpack(u"\1\142"), - DFA.unpack(u"\1\143"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\150"), - DFA.unpack(u"\1\152\1\uffff\12\154"), - DFA.unpack(u"\1\156\21\uffff\1\155"), - DFA.unpack(u"\1\162\17\uffff\1\160\1\161"), - DFA.unpack(u"\1\164\4\uffff\1\165\15\uffff\1\166"), - DFA.unpack(u"\1\170"), - DFA.unpack(u"\1\173\26\uffff\1\172"), - DFA.unpack(u""), - DFA.unpack(u"\1\176"), - DFA.unpack(u"\1\u0080\1\u0081"), - DFA.unpack(u"\1\u0084\1\u0083"), - DFA.unpack(u"\1\u0086"), - DFA.unpack(u"\1\u0089\76\uffff\1\u0088"), - DFA.unpack(u""), - DFA.unpack(u"\1\u008c\1\uffff\1\u008d"), - DFA.unpack(u"\1\u008e"), - DFA.unpack(u"\1\u008f"), - DFA.unpack(u"\1\u0090"), - DFA.unpack(u"\1\u0091\4\uffff\1\u0092"), - DFA.unpack(u""), - DFA.unpack(u"\47\u0092\1\uffff\uffd7\u0092"), - DFA.unpack(u"\uffff\u0091"), - DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\21\uffff" - u"\1\u0093\13\uffff\3\154\21\uffff\1\u0093"), - DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\uffff\u0099"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u009a"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u009b"), - DFA.unpack(u"\1\u009c"), - DFA.unpack(u"\1\u009d"), - DFA.unpack(u"\1\u009e"), - DFA.unpack(u"\1\u009f\20\uffff\1\u00a0"), - DFA.unpack(u"\1\u00a2\22\uffff\1\u00a1"), - DFA.unpack(u"\1\u00a3"), - DFA.unpack(u"\1\u00a4"), - DFA.unpack(u"\1\u00a5\14\uffff\1\u00a6"), - DFA.unpack(u"\1\u00a7"), - DFA.unpack(u"\1\u00a9\2\uffff\1\u00a8"), - DFA.unpack(u"\1\u00aa"), - DFA.unpack(u"\1\u00ab"), - DFA.unpack(u"\1\u00ac"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00ae"), - DFA.unpack(u"\1\u00af"), - DFA.unpack(u"\1\u00b0"), - DFA.unpack(u"\1\u00b1"), - DFA.unpack(u"\1\u00b2"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\24\76\1\u00b3\5\76"), - DFA.unpack(u"\1\u00b6\11\uffff\1\u00b5"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00b8"), - DFA.unpack(u"\1\u00b9"), - DFA.unpack(u"\1\u00ba"), - DFA.unpack(u"\1\u00bb"), - DFA.unpack(u"\1\u00bc"), - DFA.unpack(u"\1\u00bd"), - DFA.unpack(u"\1\u00be"), - DFA.unpack(u"\1\u00bf"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u00c0"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u00c2"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u00c4"), - DFA.unpack(u"\1\u00c5"), - DFA.unpack(u"\1\u00c6"), - DFA.unpack(u"\1\u00c7"), - DFA.unpack(u"\1\u00c8"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\35\uffff" - u"\3\154"), - DFA.unpack(u""), - DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u00ca"), - DFA.unpack(u"\1\u00cb"), - DFA.unpack(u"\1\u00cc"), - DFA.unpack(u"\1\u00cd"), - DFA.unpack(u"\1\u00ce"), - DFA.unpack(u"\1\u00cf"), - DFA.unpack(u"\1\u00d0"), - DFA.unpack(u"\1\u00d1"), - DFA.unpack(u"\1\u00d2"), - DFA.unpack(u"\1\u00d3"), - DFA.unpack(u"\1\u00d4"), - DFA.unpack(u"\1\u00d5"), - DFA.unpack(u"\1\u00d6"), - DFA.unpack(u"\1\u00d7"), - DFA.unpack(u"\1\u00d8"), - DFA.unpack(u"\1\u00d9"), - DFA.unpack(u"\1\u00da"), - DFA.unpack(u"\1\u00dc\1\u00db"), - DFA.unpack(u"\1\u00dd"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00df"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00e1"), - DFA.unpack(u"\1\u00e2"), - DFA.unpack(u"\1\u00e3"), - DFA.unpack(u""), - DFA.unpack(u"\1\u00e4"), - DFA.unpack(u"\1\u00e5"), - DFA.unpack(u""), - DFA.unpack(u"\1\u00e6"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00e8"), - DFA.unpack(u"\1\u00e9"), - DFA.unpack(u"\1\u00ea"), - DFA.unpack(u"\1\u00eb"), - DFA.unpack(u"\1\u00ed\35\uffff\1\u00ec"), - DFA.unpack(u"\1\u00ee"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u00ef"), - DFA.unpack(u"\1\u00f0"), - DFA.unpack(u"\1\u00f1"), - DFA.unpack(u"\1\u00f2"), - DFA.unpack(u"\1\u00f3"), - DFA.unpack(u""), - DFA.unpack(u"\1\u00f4"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00f6"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00f8"), - DFA.unpack(u"\1\u00f9"), - DFA.unpack(u"\1\u00fa"), - DFA.unpack(u"\1\u00fb"), - DFA.unpack(u"\1\u00fc"), - DFA.unpack(u"\1\u00fd"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u00ff"), - DFA.unpack(u"\1\u0100"), - DFA.unpack(u"\1\u0101"), - DFA.unpack(u"\1\u0102"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0105"), - DFA.unpack(u"\1\u0106"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0109"), - DFA.unpack(u"\1\u010a"), - DFA.unpack(u"\1\u010b"), - DFA.unpack(u"\1\u010c"), - DFA.unpack(u"\1\u010d"), - DFA.unpack(u"\1\u010e"), - DFA.unpack(u""), - DFA.unpack(u"\1\u010f"), - DFA.unpack(u"\1\u0110"), - DFA.unpack(u"\1\u0111"), - DFA.unpack(u"\1\u0112"), - DFA.unpack(u"\1\u0114\17\uffff\1\u0113"), - DFA.unpack(u"\1\u0115"), - DFA.unpack(u"\1\u0116"), - DFA.unpack(u"\1\u0117"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0119"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u011b"), - DFA.unpack(u"\1\u011c"), - DFA.unpack(u""), - DFA.unpack(u"\1\u011d"), - DFA.unpack(u""), - DFA.unpack(u"\1\u011e"), - DFA.unpack(u"\1\u011f"), - DFA.unpack(u"\1\u0120"), - DFA.unpack(u"\1\u0121"), - DFA.unpack(u"\1\u0122"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0124"), - DFA.unpack(u"\1\u0125"), - DFA.unpack(u"\1\u0126"), - DFA.unpack(u"\1\u0127"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u0128"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u012b"), - DFA.unpack(u"\1\u012c"), - DFA.unpack(u"\1\u012d"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u012f"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0131"), - DFA.unpack(u"\1\u0132"), - DFA.unpack(u"\1\u0133"), - DFA.unpack(u"\1\u0134"), - DFA.unpack(u"\1\u0135"), - DFA.unpack(u"\1\u0136"), - DFA.unpack(u"\1\u0137"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\u0138\1" - u"\uffff\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u013c"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0143"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0146"), - DFA.unpack(u"\1\u0147"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u0148"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u014a"), - DFA.unpack(u""), - DFA.unpack(u"\1\u014b"), - DFA.unpack(u""), - DFA.unpack(u"\1\u014c"), - DFA.unpack(u"\1\u014d"), - DFA.unpack(u"\1\u014e"), - DFA.unpack(u"\1\u014f"), - DFA.unpack(u"\1\u0150"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0153"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u0155"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\u0156"), - DFA.unpack(u"\1\u0157"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0159"), - DFA.unpack(u"\1\u015a"), - DFA.unpack(u"\1\u015b"), - DFA.unpack(u"\1\u015c"), - DFA.unpack(u"\1\u015d"), - DFA.unpack(u"\1\u015e"), - DFA.unpack(u"\1\u015f"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0166"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0168"), - DFA.unpack(u"\1\u0169"), - DFA.unpack(u"\1\u016a"), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u""), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u""), - DFA.unpack(u"\1\u016c"), - DFA.unpack(u"\1\u016d"), - DFA.unpack(u"\1\u016e"), - DFA.unpack(u""), - DFA.unpack(u"\1\u016f"), - DFA.unpack(u"\1\u0170"), - DFA.unpack(u"\1\u0171"), - DFA.unpack(u"\1\u0172"), - DFA.unpack(u"\1\u0173"), - DFA.unpack(u"\1\u0174"), - DFA.unpack(u"\1\u0175"), - DFA.unpack(u"\1\u0176"), - DFA.unpack(u"\1\u0177"), - DFA.unpack(u"\1\u0178"), - DFA.unpack(u"\1\u0179"), - DFA.unpack(u"\1\u017a"), - DFA.unpack(u"\1\u017b"), - DFA.unpack(u"\1\u017c"), - DFA.unpack(u"\1\u017d"), - DFA.unpack(u"\1\u017e"), - DFA.unpack(u"\1\u017f"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0181"), - DFA.unpack(u"\1\u0182"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0183"), - DFA.unpack(u"\1\u0184"), - DFA.unpack(u"\1\u0185"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"\1\u0187"), - DFA.unpack(u""), - DFA.unpack(u"\1\u0188"), - DFA.unpack(u"\1\u0189"), - DFA.unpack(u"\1\u018a"), - DFA.unpack(u"\1\u018b"), - DFA.unpack(u"\1\u018c"), - DFA.unpack(u"\1\u018d"), - DFA.unpack(u"\1\u018e"), - DFA.unpack(u"\1\u018f"), - DFA.unpack(u"\1\u0190"), - DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" - u"\32\76"), - DFA.unpack(u"") - ] - - # class definition for DFA #35 - - DFA35 = DFA - - + + + +# for convenience in actions +HIDDEN = BaseRecognizer.HIDDEN + +# token types +T114=114 +T115=115 +T116=116 +T117=117 +FloatTypeSuffix=16 +LETTER=11 +T29=29 +T28=28 +T27=27 +T26=26 +T25=25 +EOF=-1 +STRING_LITERAL=9 +FLOATING_POINT_LITERAL=10 +T38=38 +T37=37 +T39=39 +T34=34 +COMMENT=22 +T33=33 +T36=36 +T35=35 +T30=30 +T32=32 +T31=31 +LINE_COMMENT=23 +IntegerTypeSuffix=14 +CHARACTER_LITERAL=8 +T49=49 +T48=48 +T100=100 +T43=43 +T42=42 +T102=102 +T41=41 +T101=101 +T40=40 +T47=47 +T46=46 +T45=45 +T44=44 +T109=109 +T107=107 +T108=108 +T105=105 +WS=19 +T106=106 +T103=103 +T104=104 +T50=50 +LINE_COMMAND=24 +T59=59 +T113=113 +T52=52 +T112=112 +T51=51 +T111=111 +T54=54 +T110=110 +EscapeSequence=12 +DECIMAL_LITERAL=7 +T53=53 +T56=56 +T55=55 +T58=58 +T57=57 +T75=75 +T76=76 +T73=73 +T74=74 +T79=79 +T77=77 +T78=78 +Exponent=15 +HexDigit=13 +T72=72 +T71=71 +T70=70 +T62=62 +T63=63 +T64=64 +T65=65 +T66=66 +T67=67 +T68=68 +T69=69 +IDENTIFIER=4 +UnicodeVocabulary=21 +HEX_LITERAL=5 +T61=61 +T60=60 +T99=99 +T97=97 +BS=20 +T98=98 +T95=95 +T96=96 +OCTAL_LITERAL=6 +T94=94 +Tokens=118 +T93=93 +T92=92 +T91=91 +T90=90 +T88=88 +T89=89 +T84=84 +T85=85 +T86=86 +T87=87 +UnicodeEscape=18 +T81=81 +T80=80 +T83=83 +OctalEscape=17 +T82=82 + +class CLexer(Lexer): + + grammarFileName = "C.g" + + def __init__(self, input=None): + Lexer.__init__(self, input) + self.dfa25 = self.DFA25( + self, 25, + eot = self.DFA25_eot, + eof = self.DFA25_eof, + min = self.DFA25_min, + max = self.DFA25_max, + accept = self.DFA25_accept, + special = self.DFA25_special, + transition = self.DFA25_transition + ) + self.dfa35 = self.DFA35( + self, 35, + eot = self.DFA35_eot, + eof = self.DFA35_eof, + min = self.DFA35_min, + max = self.DFA35_max, + accept = self.DFA35_accept, + special = self.DFA35_special, + transition = self.DFA35_transition + ) + + + + + + + # $ANTLR start T25 + def mT25(self, ): + + try: + self.type = T25 + + # C.g:27:5: ( ';' ) + # C.g:27:7: ';' + self.match(u';') + + + + + + finally: + + pass + + # $ANTLR end T25 + + + + # $ANTLR start T26 + def mT26(self, ): + + try: + self.type = T26 + + # C.g:28:5: ( 'typedef' ) + # C.g:28:7: 'typedef' + self.match("typedef") + + + + + + + finally: + + pass + + # $ANTLR end T26 + + + + # $ANTLR start T27 + def mT27(self, ): + + try: + self.type = T27 + + # C.g:29:5: ( ',' ) + # C.g:29:7: ',' + self.match(u',') + + + + + + finally: + + pass + + # $ANTLR end T27 + + + + # $ANTLR start T28 + def mT28(self, ): + + try: + self.type = T28 + + # C.g:30:5: ( '=' ) + # C.g:30:7: '=' + self.match(u'=') + + + + + + finally: + + pass + + # $ANTLR end T28 + + + + # $ANTLR start T29 + def mT29(self, ): + + try: + self.type = T29 + + # C.g:31:5: ( 'extern' ) + # C.g:31:7: 'extern' + self.match("extern") + + + + + + + finally: + + pass + + # $ANTLR end T29 + + + + # $ANTLR start T30 + def mT30(self, ): + + try: + self.type = T30 + + # C.g:32:5: ( 'static' ) + # C.g:32:7: 'static' + self.match("static") + + + + + + + finally: + + pass + + # $ANTLR end T30 + + + + # $ANTLR start T31 + def mT31(self, ): + + try: + self.type = T31 + + # C.g:33:5: ( 'auto' ) + # C.g:33:7: 'auto' + self.match("auto") + + + + + + + finally: + + pass + + # $ANTLR end T31 + + + + # $ANTLR start T32 + def mT32(self, ): + + try: + self.type = T32 + + # C.g:34:5: ( 'register' ) + # C.g:34:7: 'register' + self.match("register") + + + + + + + finally: + + pass + + # $ANTLR end T32 + + + + # $ANTLR start T33 + def mT33(self, ): + + try: + self.type = T33 + + # C.g:35:5: ( 'STATIC' ) + # C.g:35:7: 'STATIC' + self.match("STATIC") + + + + + + + finally: + + pass + + # $ANTLR end T33 + + + + # $ANTLR start T34 + def mT34(self, ): + + try: + self.type = T34 + + # C.g:36:5: ( 'void' ) + # C.g:36:7: 'void' + self.match("void") + + + + + + + finally: + + pass + + # $ANTLR end T34 + + + + # $ANTLR start T35 + def mT35(self, ): + + try: + self.type = T35 + + # C.g:37:5: ( 'char' ) + # C.g:37:7: 'char' + self.match("char") + + + + + + + finally: + + pass + + # $ANTLR end T35 + + + + # $ANTLR start T36 + def mT36(self, ): + + try: + self.type = T36 + + # C.g:38:5: ( 'short' ) + # C.g:38:7: 'short' + self.match("short") + + + + + + + finally: + + pass + + # $ANTLR end T36 + + + + # $ANTLR start T37 + def mT37(self, ): + + try: + self.type = T37 + + # C.g:39:5: ( 'int' ) + # C.g:39:7: 'int' + self.match("int") + + + + + + + finally: + + pass + + # $ANTLR end T37 + + + + # $ANTLR start T38 + def mT38(self, ): + + try: + self.type = T38 + + # C.g:40:5: ( 'long' ) + # C.g:40:7: 'long' + self.match("long") + + + + + + + finally: + + pass + + # $ANTLR end T38 + + + + # $ANTLR start T39 + def mT39(self, ): + + try: + self.type = T39 + + # C.g:41:5: ( 'float' ) + # C.g:41:7: 'float' + self.match("float") + + + + + + + finally: + + pass + + # $ANTLR end T39 + + + + # $ANTLR start T40 + def mT40(self, ): + + try: + self.type = T40 + + # C.g:42:5: ( 'double' ) + # C.g:42:7: 'double' + self.match("double") + + + + + + + finally: + + pass + + # $ANTLR end T40 + + + + # $ANTLR start T41 + def mT41(self, ): + + try: + self.type = T41 + + # C.g:43:5: ( 'signed' ) + # C.g:43:7: 'signed' + self.match("signed") + + + + + + + finally: + + pass + + # $ANTLR end T41 + + + + # $ANTLR start T42 + def mT42(self, ): + + try: + self.type = T42 + + # C.g:44:5: ( 'unsigned' ) + # C.g:44:7: 'unsigned' + self.match("unsigned") + + + + + + + finally: + + pass + + # $ANTLR end T42 + + + + # $ANTLR start T43 + def mT43(self, ): + + try: + self.type = T43 + + # C.g:45:5: ( '{' ) + # C.g:45:7: '{' + self.match(u'{') + + + + + + finally: + + pass + + # $ANTLR end T43 + + + + # $ANTLR start T44 + def mT44(self, ): + + try: + self.type = T44 + + # C.g:46:5: ( '}' ) + # C.g:46:7: '}' + self.match(u'}') + + + + + + finally: + + pass + + # $ANTLR end T44 + + + + # $ANTLR start T45 + def mT45(self, ): + + try: + self.type = T45 + + # C.g:47:5: ( 'struct' ) + # C.g:47:7: 'struct' + self.match("struct") + + + + + + + finally: + + pass + + # $ANTLR end T45 + + + + # $ANTLR start T46 + def mT46(self, ): + + try: + self.type = T46 + + # C.g:48:5: ( 'union' ) + # C.g:48:7: 'union' + self.match("union") + + + + + + + finally: + + pass + + # $ANTLR end T46 + + + + # $ANTLR start T47 + def mT47(self, ): + + try: + self.type = T47 + + # C.g:49:5: ( ':' ) + # C.g:49:7: ':' + self.match(u':') + + + + + + finally: + + pass + + # $ANTLR end T47 + + + + # $ANTLR start T48 + def mT48(self, ): + + try: + self.type = T48 + + # C.g:50:5: ( 'enum' ) + # C.g:50:7: 'enum' + self.match("enum") + + + + + + + finally: + + pass + + # $ANTLR end T48 + + + + # $ANTLR start T49 + def mT49(self, ): + + try: + self.type = T49 + + # C.g:51:5: ( 'const' ) + # C.g:51:7: 'const' + self.match("const") + + + + + + + finally: + + pass + + # $ANTLR end T49 + + + + # $ANTLR start T50 + def mT50(self, ): + + try: + self.type = T50 + + # C.g:52:5: ( 'volatile' ) + # C.g:52:7: 'volatile' + self.match("volatile") + + + + + + + finally: + + pass + + # $ANTLR end T50 + + + + # $ANTLR start T51 + def mT51(self, ): + + try: + self.type = T51 + + # C.g:53:5: ( 'IN' ) + # C.g:53:7: 'IN' + self.match("IN") + + + + + + + finally: + + pass + + # $ANTLR end T51 + + + + # $ANTLR start T52 + def mT52(self, ): + + try: + self.type = T52 + + # C.g:54:5: ( 'OUT' ) + # C.g:54:7: 'OUT' + self.match("OUT") + + + + + + + finally: + + pass + + # $ANTLR end T52 + + + + # $ANTLR start T53 + def mT53(self, ): + + try: + self.type = T53 + + # C.g:55:5: ( 'OPTIONAL' ) + # C.g:55:7: 'OPTIONAL' + self.match("OPTIONAL") + + + + + + + finally: + + pass + + # $ANTLR end T53 + + + + # $ANTLR start T54 + def mT54(self, ): + + try: + self.type = T54 + + # C.g:56:5: ( 'CONST' ) + # C.g:56:7: 'CONST' + self.match("CONST") + + + + + + + finally: + + pass + + # $ANTLR end T54 + + + + # $ANTLR start T55 + def mT55(self, ): + + try: + self.type = T55 + + # C.g:57:5: ( 'UNALIGNED' ) + # C.g:57:7: 'UNALIGNED' + self.match("UNALIGNED") + + + + + + + finally: + + pass + + # $ANTLR end T55 + + + + # $ANTLR start T56 + def mT56(self, ): + + try: + self.type = T56 + + # C.g:58:5: ( 'VOLATILE' ) + # C.g:58:7: 'VOLATILE' + self.match("VOLATILE") + + + + + + + finally: + + pass + + # $ANTLR end T56 + + + + # $ANTLR start T57 + def mT57(self, ): + + try: + self.type = T57 + + # C.g:59:5: ( 'GLOBAL_REMOVE_IF_UNREFERENCED' ) + # C.g:59:7: 'GLOBAL_REMOVE_IF_UNREFERENCED' + self.match("GLOBAL_REMOVE_IF_UNREFERENCED") + + + + + + + finally: + + pass + + # $ANTLR end T57 + + + + # $ANTLR start T58 + def mT58(self, ): + + try: + self.type = T58 + + # C.g:60:5: ( 'EFIAPI' ) + # C.g:60:7: 'EFIAPI' + self.match("EFIAPI") + + + + + + + finally: + + pass + + # $ANTLR end T58 + + + + # $ANTLR start T59 + def mT59(self, ): + + try: + self.type = T59 + + # C.g:61:5: ( 'EFI_BOOTSERVICE' ) + # C.g:61:7: 'EFI_BOOTSERVICE' + self.match("EFI_BOOTSERVICE") + + + + + + + finally: + + pass + + # $ANTLR end T59 + + + + # $ANTLR start T60 + def mT60(self, ): + + try: + self.type = T60 + + # C.g:62:5: ( 'EFI_RUNTIMESERVICE' ) + # C.g:62:7: 'EFI_RUNTIMESERVICE' + self.match("EFI_RUNTIMESERVICE") + + + + + + + finally: + + pass + + # $ANTLR end T60 + + + + # $ANTLR start T61 + def mT61(self, ): + + try: + self.type = T61 + + # C.g:63:5: ( 'PACKED' ) + # C.g:63:7: 'PACKED' + self.match("PACKED") + + + + + + + finally: + + pass + + # $ANTLR end T61 + + + + # $ANTLR start T62 + def mT62(self, ): + + try: + self.type = T62 + + # C.g:64:5: ( '(' ) + # C.g:64:7: '(' + self.match(u'(') + + + + + + finally: + + pass + + # $ANTLR end T62 + + + + # $ANTLR start T63 + def mT63(self, ): + + try: + self.type = T63 + + # C.g:65:5: ( ')' ) + # C.g:65:7: ')' + self.match(u')') + + + + + + finally: + + pass + + # $ANTLR end T63 + + + + # $ANTLR start T64 + def mT64(self, ): + + try: + self.type = T64 + + # C.g:66:5: ( '[' ) + # C.g:66:7: '[' + self.match(u'[') + + + + + + finally: + + pass + + # $ANTLR end T64 + + + + # $ANTLR start T65 + def mT65(self, ): + + try: + self.type = T65 + + # C.g:67:5: ( ']' ) + # C.g:67:7: ']' + self.match(u']') + + + + + + finally: + + pass + + # $ANTLR end T65 + + + + # $ANTLR start T66 + def mT66(self, ): + + try: + self.type = T66 + + # C.g:68:5: ( '*' ) + # C.g:68:7: '*' + self.match(u'*') + + + + + + finally: + + pass + + # $ANTLR end T66 + + + + # $ANTLR start T67 + def mT67(self, ): + + try: + self.type = T67 + + # C.g:69:5: ( '...' ) + # C.g:69:7: '...' + self.match("...") + + + + + + + finally: + + pass + + # $ANTLR end T67 + + + + # $ANTLR start T68 + def mT68(self, ): + + try: + self.type = T68 + + # C.g:70:5: ( '+' ) + # C.g:70:7: '+' + self.match(u'+') + + + + + + finally: + + pass + + # $ANTLR end T68 + + + + # $ANTLR start T69 + def mT69(self, ): + + try: + self.type = T69 + + # C.g:71:5: ( '-' ) + # C.g:71:7: '-' + self.match(u'-') + + + + + + finally: + + pass + + # $ANTLR end T69 + + + + # $ANTLR start T70 + def mT70(self, ): + + try: + self.type = T70 + + # C.g:72:5: ( '/' ) + # C.g:72:7: '/' + self.match(u'/') + + + + + + finally: + + pass + + # $ANTLR end T70 + + + + # $ANTLR start T71 + def mT71(self, ): + + try: + self.type = T71 + + # C.g:73:5: ( '%' ) + # C.g:73:7: '%' + self.match(u'%') + + + + + + finally: + + pass + + # $ANTLR end T71 + + + + # $ANTLR start T72 + def mT72(self, ): + + try: + self.type = T72 + + # C.g:74:5: ( '++' ) + # C.g:74:7: '++' + self.match("++") + + + + + + + finally: + + pass + + # $ANTLR end T72 + + + + # $ANTLR start T73 + def mT73(self, ): + + try: + self.type = T73 + + # C.g:75:5: ( '--' ) + # C.g:75:7: '--' + self.match("--") + + + + + + + finally: + + pass + + # $ANTLR end T73 + + + + # $ANTLR start T74 + def mT74(self, ): + + try: + self.type = T74 + + # C.g:76:5: ( 'sizeof' ) + # C.g:76:7: 'sizeof' + self.match("sizeof") + + + + + + + finally: + + pass + + # $ANTLR end T74 + + + + # $ANTLR start T75 + def mT75(self, ): + + try: + self.type = T75 + + # C.g:77:5: ( '.' ) + # C.g:77:7: '.' + self.match(u'.') + + + + + + finally: + + pass + + # $ANTLR end T75 + + + + # $ANTLR start T76 + def mT76(self, ): + + try: + self.type = T76 + + # C.g:78:5: ( '->' ) + # C.g:78:7: '->' + self.match("->") + + + + + + + finally: + + pass + + # $ANTLR end T76 + + + + # $ANTLR start T77 + def mT77(self, ): + + try: + self.type = T77 + + # C.g:79:5: ( '&' ) + # C.g:79:7: '&' + self.match(u'&') + + + + + + finally: + + pass + + # $ANTLR end T77 + + + + # $ANTLR start T78 + def mT78(self, ): + + try: + self.type = T78 + + # C.g:80:5: ( '~' ) + # C.g:80:7: '~' + self.match(u'~') + + + + + + finally: + + pass + + # $ANTLR end T78 + + + + # $ANTLR start T79 + def mT79(self, ): + + try: + self.type = T79 + + # C.g:81:5: ( '!' ) + # C.g:81:7: '!' + self.match(u'!') + + + + + + finally: + + pass + + # $ANTLR end T79 + + + + # $ANTLR start T80 + def mT80(self, ): + + try: + self.type = T80 + + # C.g:82:5: ( '*=' ) + # C.g:82:7: '*=' + self.match("*=") + + + + + + + finally: + + pass + + # $ANTLR end T80 + + + + # $ANTLR start T81 + def mT81(self, ): + + try: + self.type = T81 + + # C.g:83:5: ( '/=' ) + # C.g:83:7: '/=' + self.match("/=") + + + + + + + finally: + + pass + + # $ANTLR end T81 + + + + # $ANTLR start T82 + def mT82(self, ): + + try: + self.type = T82 + + # C.g:84:5: ( '%=' ) + # C.g:84:7: '%=' + self.match("%=") + + + + + + + finally: + + pass + + # $ANTLR end T82 + + + + # $ANTLR start T83 + def mT83(self, ): + + try: + self.type = T83 + + # C.g:85:5: ( '+=' ) + # C.g:85:7: '+=' + self.match("+=") + + + + + + + finally: + + pass + + # $ANTLR end T83 + + + + # $ANTLR start T84 + def mT84(self, ): + + try: + self.type = T84 + + # C.g:86:5: ( '-=' ) + # C.g:86:7: '-=' + self.match("-=") + + + + + + + finally: + + pass + + # $ANTLR end T84 + + + + # $ANTLR start T85 + def mT85(self, ): + + try: + self.type = T85 + + # C.g:87:5: ( '<<=' ) + # C.g:87:7: '<<=' + self.match("<<=") + + + + + + + finally: + + pass + + # $ANTLR end T85 + + + + # $ANTLR start T86 + def mT86(self, ): + + try: + self.type = T86 + + # C.g:88:5: ( '>>=' ) + # C.g:88:7: '>>=' + self.match(">>=") + + + + + + + finally: + + pass + + # $ANTLR end T86 + + + + # $ANTLR start T87 + def mT87(self, ): + + try: + self.type = T87 + + # C.g:89:5: ( '&=' ) + # C.g:89:7: '&=' + self.match("&=") + + + + + + + finally: + + pass + + # $ANTLR end T87 + + + + # $ANTLR start T88 + def mT88(self, ): + + try: + self.type = T88 + + # C.g:90:5: ( '^=' ) + # C.g:90:7: '^=' + self.match("^=") + + + + + + + finally: + + pass + + # $ANTLR end T88 + + + + # $ANTLR start T89 + def mT89(self, ): + + try: + self.type = T89 + + # C.g:91:5: ( '|=' ) + # C.g:91:7: '|=' + self.match("|=") + + + + + + + finally: + + pass + + # $ANTLR end T89 + + + + # $ANTLR start T90 + def mT90(self, ): + + try: + self.type = T90 + + # C.g:92:5: ( '?' ) + # C.g:92:7: '?' + self.match(u'?') + + + + + + finally: + + pass + + # $ANTLR end T90 + + + + # $ANTLR start T91 + def mT91(self, ): + + try: + self.type = T91 + + # C.g:93:5: ( '||' ) + # C.g:93:7: '||' + self.match("||") + + + + + + + finally: + + pass + + # $ANTLR end T91 + + + + # $ANTLR start T92 + def mT92(self, ): + + try: + self.type = T92 + + # C.g:94:5: ( '&&' ) + # C.g:94:7: '&&' + self.match("&&") + + + + + + + finally: + + pass + + # $ANTLR end T92 + + + + # $ANTLR start T93 + def mT93(self, ): + + try: + self.type = T93 + + # C.g:95:5: ( '|' ) + # C.g:95:7: '|' + self.match(u'|') + + + + + + finally: + + pass + + # $ANTLR end T93 + + + + # $ANTLR start T94 + def mT94(self, ): + + try: + self.type = T94 + + # C.g:96:5: ( '^' ) + # C.g:96:7: '^' + self.match(u'^') + + + + + + finally: + + pass + + # $ANTLR end T94 + + + + # $ANTLR start T95 + def mT95(self, ): + + try: + self.type = T95 + + # C.g:97:5: ( '==' ) + # C.g:97:7: '==' + self.match("==") + + + + + + + finally: + + pass + + # $ANTLR end T95 + + + + # $ANTLR start T96 + def mT96(self, ): + + try: + self.type = T96 + + # C.g:98:5: ( '!=' ) + # C.g:98:7: '!=' + self.match("!=") + + + + + + + finally: + + pass + + # $ANTLR end T96 + + + + # $ANTLR start T97 + def mT97(self, ): + + try: + self.type = T97 + + # C.g:99:5: ( '<' ) + # C.g:99:7: '<' + self.match(u'<') + + + + + + finally: + + pass + + # $ANTLR end T97 + + + + # $ANTLR start T98 + def mT98(self, ): + + try: + self.type = T98 + + # C.g:100:5: ( '>' ) + # C.g:100:7: '>' + self.match(u'>') + + + + + + finally: + + pass + + # $ANTLR end T98 + + + + # $ANTLR start T99 + def mT99(self, ): + + try: + self.type = T99 + + # C.g:101:5: ( '<=' ) + # C.g:101:7: '<=' + self.match("<=") + + + + + + + finally: + + pass + + # $ANTLR end T99 + + + + # $ANTLR start T100 + def mT100(self, ): + + try: + self.type = T100 + + # C.g:102:6: ( '>=' ) + # C.g:102:8: '>=' + self.match(">=") + + + + + + + finally: + + pass + + # $ANTLR end T100 + + + + # $ANTLR start T101 + def mT101(self, ): + + try: + self.type = T101 + + # C.g:103:6: ( '<<' ) + # C.g:103:8: '<<' + self.match("<<") + + + + + + + finally: + + pass + + # $ANTLR end T101 + + + + # $ANTLR start T102 + def mT102(self, ): + + try: + self.type = T102 + + # C.g:104:6: ( '>>' ) + # C.g:104:8: '>>' + self.match(">>") + + + + + + + finally: + + pass + + # $ANTLR end T102 + + + + # $ANTLR start T103 + def mT103(self, ): + + try: + self.type = T103 + + # C.g:105:6: ( '__asm__' ) + # C.g:105:8: '__asm__' + self.match("__asm__") + + + + + + + finally: + + pass + + # $ANTLR end T103 + + + + # $ANTLR start T104 + def mT104(self, ): + + try: + self.type = T104 + + # C.g:106:6: ( '_asm' ) + # C.g:106:8: '_asm' + self.match("_asm") + + + + + + + finally: + + pass + + # $ANTLR end T104 + + + + # $ANTLR start T105 + def mT105(self, ): + + try: + self.type = T105 + + # C.g:107:6: ( '__asm' ) + # C.g:107:8: '__asm' + self.match("__asm") + + + + + + + finally: + + pass + + # $ANTLR end T105 + + + + # $ANTLR start T106 + def mT106(self, ): + + try: + self.type = T106 + + # C.g:108:6: ( 'case' ) + # C.g:108:8: 'case' + self.match("case") + + + + + + + finally: + + pass + + # $ANTLR end T106 + + + + # $ANTLR start T107 + def mT107(self, ): + + try: + self.type = T107 + + # C.g:109:6: ( 'default' ) + # C.g:109:8: 'default' + self.match("default") + + + + + + + finally: + + pass + + # $ANTLR end T107 + + + + # $ANTLR start T108 + def mT108(self, ): + + try: + self.type = T108 + + # C.g:110:6: ( 'if' ) + # C.g:110:8: 'if' + self.match("if") + + + + + + + finally: + + pass + + # $ANTLR end T108 + + + + # $ANTLR start T109 + def mT109(self, ): + + try: + self.type = T109 + + # C.g:111:6: ( 'else' ) + # C.g:111:8: 'else' + self.match("else") + + + + + + + finally: + + pass + + # $ANTLR end T109 + + + + # $ANTLR start T110 + def mT110(self, ): + + try: + self.type = T110 + + # C.g:112:6: ( 'switch' ) + # C.g:112:8: 'switch' + self.match("switch") + + + + + + + finally: + + pass + + # $ANTLR end T110 + + + + # $ANTLR start T111 + def mT111(self, ): + + try: + self.type = T111 + + # C.g:113:6: ( 'while' ) + # C.g:113:8: 'while' + self.match("while") + + + + + + + finally: + + pass + + # $ANTLR end T111 + + + + # $ANTLR start T112 + def mT112(self, ): + + try: + self.type = T112 + + # C.g:114:6: ( 'do' ) + # C.g:114:8: 'do' + self.match("do") + + + + + + + finally: + + pass + + # $ANTLR end T112 + + + + # $ANTLR start T113 + def mT113(self, ): + + try: + self.type = T113 + + # C.g:115:6: ( 'for' ) + # C.g:115:8: 'for' + self.match("for") + + + + + + + finally: + + pass + + # $ANTLR end T113 + + + + # $ANTLR start T114 + def mT114(self, ): + + try: + self.type = T114 + + # C.g:116:6: ( 'goto' ) + # C.g:116:8: 'goto' + self.match("goto") + + + + + + + finally: + + pass + + # $ANTLR end T114 + + + + # $ANTLR start T115 + def mT115(self, ): + + try: + self.type = T115 + + # C.g:117:6: ( 'continue' ) + # C.g:117:8: 'continue' + self.match("continue") + + + + + + + finally: + + pass + + # $ANTLR end T115 + + + + # $ANTLR start T116 + def mT116(self, ): + + try: + self.type = T116 + + # C.g:118:6: ( 'break' ) + # C.g:118:8: 'break' + self.match("break") + + + + + + + finally: + + pass + + # $ANTLR end T116 + + + + # $ANTLR start T117 + def mT117(self, ): + + try: + self.type = T117 + + # C.g:119:6: ( 'return' ) + # C.g:119:8: 'return' + self.match("return") + + + + + + + finally: + + pass + + # $ANTLR end T117 + + + + # $ANTLR start IDENTIFIER + def mIDENTIFIER(self, ): + + try: + self.type = IDENTIFIER + + # C.g:586:2: ( LETTER ( LETTER | '0' .. '9' )* ) + # C.g:586:4: LETTER ( LETTER | '0' .. '9' )* + self.mLETTER() + + # C.g:586:11: ( LETTER | '0' .. '9' )* + while True: #loop1 + alt1 = 2 + LA1_0 = self.input.LA(1) + + if (LA1_0 == u'$' or (u'0' <= LA1_0 <= u'9') or (u'A' <= LA1_0 <= u'Z') or LA1_0 == u'_' or (u'a' <= LA1_0 <= u'z')) : + alt1 = 1 + + + if alt1 == 1: + # C.g: + if self.input.LA(1) == u'$' or (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + else: + break #loop1 + + + + + + + finally: + + pass + + # $ANTLR end IDENTIFIER + + + + # $ANTLR start LETTER + def mLETTER(self, ): + + try: + # C.g:591:2: ( '$' | 'A' .. 'Z' | 'a' .. 'z' | '_' ) + # C.g: + if self.input.LA(1) == u'$' or (u'A' <= self.input.LA(1) <= u'Z') or self.input.LA(1) == u'_' or (u'a' <= self.input.LA(1) <= u'z'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + + finally: + + pass + + # $ANTLR end LETTER + + + + # $ANTLR start CHARACTER_LITERAL + def mCHARACTER_LITERAL(self, ): + + try: + self.type = CHARACTER_LITERAL + + # C.g:598:5: ( ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' ) + # C.g:598:9: ( 'L' )? '\\'' ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) '\\'' + # C.g:598:9: ( 'L' )? + alt2 = 2 + LA2_0 = self.input.LA(1) + + if (LA2_0 == u'L') : + alt2 = 1 + if alt2 == 1: + # C.g:598:10: 'L' + self.match(u'L') + + + + + self.match(u'\'') + + # C.g:598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) ) + alt3 = 2 + LA3_0 = self.input.LA(1) + + if (LA3_0 == u'\\') : + alt3 = 1 + elif ((u'\u0000' <= LA3_0 <= u'&') or (u'(' <= LA3_0 <= u'[') or (u']' <= LA3_0 <= u'\uFFFE')) : + alt3 = 2 + else: + nvae = NoViableAltException("598:21: ( EscapeSequence | ~ ( '\\'' | '\\\\' ) )", 3, 0, self.input) + + raise nvae + + if alt3 == 1: + # C.g:598:23: EscapeSequence + self.mEscapeSequence() + + + + elif alt3 == 2: + # C.g:598:40: ~ ( '\\'' | '\\\\' ) + if (u'\u0000' <= self.input.LA(1) <= u'&') or (u'(' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + self.match(u'\'') + + + + + + finally: + + pass + + # $ANTLR end CHARACTER_LITERAL + + + + # $ANTLR start STRING_LITERAL + def mSTRING_LITERAL(self, ): + + try: + self.type = STRING_LITERAL + + # C.g:602:5: ( ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' ) + # C.g:602:8: ( 'L' )? '\"' ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* '\"' + # C.g:602:8: ( 'L' )? + alt4 = 2 + LA4_0 = self.input.LA(1) + + if (LA4_0 == u'L') : + alt4 = 1 + if alt4 == 1: + # C.g:602:9: 'L' + self.match(u'L') + + + + + self.match(u'"') + + # C.g:602:19: ( EscapeSequence | ~ ( '\\\\' | '\"' ) )* + while True: #loop5 + alt5 = 3 + LA5_0 = self.input.LA(1) + + if (LA5_0 == u'\\') : + alt5 = 1 + elif ((u'\u0000' <= LA5_0 <= u'!') or (u'#' <= LA5_0 <= u'[') or (u']' <= LA5_0 <= u'\uFFFE')) : + alt5 = 2 + + + if alt5 == 1: + # C.g:602:21: EscapeSequence + self.mEscapeSequence() + + + + elif alt5 == 2: + # C.g:602:38: ~ ( '\\\\' | '\"' ) + if (u'\u0000' <= self.input.LA(1) <= u'!') or (u'#' <= self.input.LA(1) <= u'[') or (u']' <= self.input.LA(1) <= u'\uFFFE'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + else: + break #loop5 + + + self.match(u'"') + + + + + + finally: + + pass + + # $ANTLR end STRING_LITERAL + + + + # $ANTLR start HEX_LITERAL + def mHEX_LITERAL(self, ): + + try: + self.type = HEX_LITERAL + + # C.g:605:13: ( '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? ) + # C.g:605:15: '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? + self.match(u'0') + + if self.input.LA(1) == u'X' or self.input.LA(1) == u'x': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + # C.g:605:29: ( HexDigit )+ + cnt6 = 0 + while True: #loop6 + alt6 = 2 + LA6_0 = self.input.LA(1) + + if ((u'0' <= LA6_0 <= u'9') or (u'A' <= LA6_0 <= u'F') or (u'a' <= LA6_0 <= u'f')) : + alt6 = 1 + + + if alt6 == 1: + # C.g:605:29: HexDigit + self.mHexDigit() + + + + else: + if cnt6 >= 1: + break #loop6 + + eee = EarlyExitException(6, self.input) + raise eee + + cnt6 += 1 + + + # C.g:605:39: ( IntegerTypeSuffix )? + alt7 = 2 + LA7_0 = self.input.LA(1) + + if (LA7_0 == u'L' or LA7_0 == u'U' or LA7_0 == u'l' or LA7_0 == u'u') : + alt7 = 1 + if alt7 == 1: + # C.g:605:39: IntegerTypeSuffix + self.mIntegerTypeSuffix() + + + + + + + + + finally: + + pass + + # $ANTLR end HEX_LITERAL + + + + # $ANTLR start DECIMAL_LITERAL + def mDECIMAL_LITERAL(self, ): + + try: + self.type = DECIMAL_LITERAL + + # C.g:607:17: ( ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? ) + # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* ) ( IntegerTypeSuffix )? + # C.g:607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* ) + alt9 = 2 + LA9_0 = self.input.LA(1) + + if (LA9_0 == u'0') : + alt9 = 1 + elif ((u'1' <= LA9_0 <= u'9')) : + alt9 = 2 + else: + nvae = NoViableAltException("607:19: ( '0' | '1' .. '9' ( '0' .. '9' )* )", 9, 0, self.input) + + raise nvae + + if alt9 == 1: + # C.g:607:20: '0' + self.match(u'0') + + + + elif alt9 == 2: + # C.g:607:26: '1' .. '9' ( '0' .. '9' )* + self.matchRange(u'1', u'9') + + # C.g:607:35: ( '0' .. '9' )* + while True: #loop8 + alt8 = 2 + LA8_0 = self.input.LA(1) + + if ((u'0' <= LA8_0 <= u'9')) : + alt8 = 1 + + + if alt8 == 1: + # C.g:607:35: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + break #loop8 + + + + + + # C.g:607:46: ( IntegerTypeSuffix )? + alt10 = 2 + LA10_0 = self.input.LA(1) + + if (LA10_0 == u'L' or LA10_0 == u'U' or LA10_0 == u'l' or LA10_0 == u'u') : + alt10 = 1 + if alt10 == 1: + # C.g:607:46: IntegerTypeSuffix + self.mIntegerTypeSuffix() + + + + + + + + + finally: + + pass + + # $ANTLR end DECIMAL_LITERAL + + + + # $ANTLR start OCTAL_LITERAL + def mOCTAL_LITERAL(self, ): + + try: + self.type = OCTAL_LITERAL + + # C.g:609:15: ( '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? ) + # C.g:609:17: '0' ( '0' .. '7' )+ ( IntegerTypeSuffix )? + self.match(u'0') + + # C.g:609:21: ( '0' .. '7' )+ + cnt11 = 0 + while True: #loop11 + alt11 = 2 + LA11_0 = self.input.LA(1) + + if ((u'0' <= LA11_0 <= u'7')) : + alt11 = 1 + + + if alt11 == 1: + # C.g:609:22: '0' .. '7' + self.matchRange(u'0', u'7') + + + + else: + if cnt11 >= 1: + break #loop11 + + eee = EarlyExitException(11, self.input) + raise eee + + cnt11 += 1 + + + # C.g:609:33: ( IntegerTypeSuffix )? + alt12 = 2 + LA12_0 = self.input.LA(1) + + if (LA12_0 == u'L' or LA12_0 == u'U' or LA12_0 == u'l' or LA12_0 == u'u') : + alt12 = 1 + if alt12 == 1: + # C.g:609:33: IntegerTypeSuffix + self.mIntegerTypeSuffix() + + + + + + + + + finally: + + pass + + # $ANTLR end OCTAL_LITERAL + + + + # $ANTLR start HexDigit + def mHexDigit(self, ): + + try: + # C.g:612:10: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) ) + # C.g:612:12: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) + if (u'0' <= self.input.LA(1) <= u'9') or (u'A' <= self.input.LA(1) <= u'F') or (u'a' <= self.input.LA(1) <= u'f'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + + finally: + + pass + + # $ANTLR end HexDigit + + + + # $ANTLR start IntegerTypeSuffix + def mIntegerTypeSuffix(self, ): + + try: + # C.g:616:2: ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) ) + alt13 = 4 + LA13_0 = self.input.LA(1) + + if (LA13_0 == u'U' or LA13_0 == u'u') : + LA13_1 = self.input.LA(2) + + if (LA13_1 == u'L' or LA13_1 == u'l') : + LA13_3 = self.input.LA(3) + + if (LA13_3 == u'L' or LA13_3 == u'l') : + alt13 = 4 + else: + alt13 = 3 + else: + alt13 = 1 + elif (LA13_0 == u'L' or LA13_0 == u'l') : + alt13 = 2 + else: + nvae = NoViableAltException("614:1: fragment IntegerTypeSuffix : ( ( 'u' | 'U' ) | ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) | ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) );", 13, 0, self.input) + + raise nvae + + if alt13 == 1: + # C.g:616:4: ( 'u' | 'U' ) + if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + elif alt13 == 2: + # C.g:617:4: ( 'l' | 'L' ) + if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + elif alt13 == 3: + # C.g:618:4: ( 'u' | 'U' ) ( 'l' | 'L' ) + if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + elif alt13 == 4: + # C.g:619:4: ( 'u' | 'U' ) ( 'l' | 'L' ) ( 'l' | 'L' ) + if self.input.LA(1) == u'U' or self.input.LA(1) == u'u': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + if self.input.LA(1) == u'L' or self.input.LA(1) == u'l': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + finally: + + pass + + # $ANTLR end IntegerTypeSuffix + + + + # $ANTLR start FLOATING_POINT_LITERAL + def mFLOATING_POINT_LITERAL(self, ): + + try: + self.type = FLOATING_POINT_LITERAL + + # C.g:623:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? | '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? | ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? | ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix ) + alt25 = 4 + alt25 = self.dfa25.predict(self.input) + if alt25 == 1: + # C.g:623:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( Exponent )? ( FloatTypeSuffix )? + # C.g:623:9: ( '0' .. '9' )+ + cnt14 = 0 + while True: #loop14 + alt14 = 2 + LA14_0 = self.input.LA(1) + + if ((u'0' <= LA14_0 <= u'9')) : + alt14 = 1 + + + if alt14 == 1: + # C.g:623:10: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + if cnt14 >= 1: + break #loop14 + + eee = EarlyExitException(14, self.input) + raise eee + + cnt14 += 1 + + + self.match(u'.') + + # C.g:623:25: ( '0' .. '9' )* + while True: #loop15 + alt15 = 2 + LA15_0 = self.input.LA(1) + + if ((u'0' <= LA15_0 <= u'9')) : + alt15 = 1 + + + if alt15 == 1: + # C.g:623:26: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + break #loop15 + + + # C.g:623:37: ( Exponent )? + alt16 = 2 + LA16_0 = self.input.LA(1) + + if (LA16_0 == u'E' or LA16_0 == u'e') : + alt16 = 1 + if alt16 == 1: + # C.g:623:37: Exponent + self.mExponent() + + + + + # C.g:623:47: ( FloatTypeSuffix )? + alt17 = 2 + LA17_0 = self.input.LA(1) + + if (LA17_0 == u'D' or LA17_0 == u'F' or LA17_0 == u'd' or LA17_0 == u'f') : + alt17 = 1 + if alt17 == 1: + # C.g:623:47: FloatTypeSuffix + self.mFloatTypeSuffix() + + + + + + + elif alt25 == 2: + # C.g:624:9: '.' ( '0' .. '9' )+ ( Exponent )? ( FloatTypeSuffix )? + self.match(u'.') + + # C.g:624:13: ( '0' .. '9' )+ + cnt18 = 0 + while True: #loop18 + alt18 = 2 + LA18_0 = self.input.LA(1) + + if ((u'0' <= LA18_0 <= u'9')) : + alt18 = 1 + + + if alt18 == 1: + # C.g:624:14: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + if cnt18 >= 1: + break #loop18 + + eee = EarlyExitException(18, self.input) + raise eee + + cnt18 += 1 + + + # C.g:624:25: ( Exponent )? + alt19 = 2 + LA19_0 = self.input.LA(1) + + if (LA19_0 == u'E' or LA19_0 == u'e') : + alt19 = 1 + if alt19 == 1: + # C.g:624:25: Exponent + self.mExponent() + + + + + # C.g:624:35: ( FloatTypeSuffix )? + alt20 = 2 + LA20_0 = self.input.LA(1) + + if (LA20_0 == u'D' or LA20_0 == u'F' or LA20_0 == u'd' or LA20_0 == u'f') : + alt20 = 1 + if alt20 == 1: + # C.g:624:35: FloatTypeSuffix + self.mFloatTypeSuffix() + + + + + + + elif alt25 == 3: + # C.g:625:9: ( '0' .. '9' )+ Exponent ( FloatTypeSuffix )? + # C.g:625:9: ( '0' .. '9' )+ + cnt21 = 0 + while True: #loop21 + alt21 = 2 + LA21_0 = self.input.LA(1) + + if ((u'0' <= LA21_0 <= u'9')) : + alt21 = 1 + + + if alt21 == 1: + # C.g:625:10: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + if cnt21 >= 1: + break #loop21 + + eee = EarlyExitException(21, self.input) + raise eee + + cnt21 += 1 + + + self.mExponent() + + # C.g:625:30: ( FloatTypeSuffix )? + alt22 = 2 + LA22_0 = self.input.LA(1) + + if (LA22_0 == u'D' or LA22_0 == u'F' or LA22_0 == u'd' or LA22_0 == u'f') : + alt22 = 1 + if alt22 == 1: + # C.g:625:30: FloatTypeSuffix + self.mFloatTypeSuffix() + + + + + + + elif alt25 == 4: + # C.g:626:9: ( '0' .. '9' )+ ( Exponent )? FloatTypeSuffix + # C.g:626:9: ( '0' .. '9' )+ + cnt23 = 0 + while True: #loop23 + alt23 = 2 + LA23_0 = self.input.LA(1) + + if ((u'0' <= LA23_0 <= u'9')) : + alt23 = 1 + + + if alt23 == 1: + # C.g:626:10: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + if cnt23 >= 1: + break #loop23 + + eee = EarlyExitException(23, self.input) + raise eee + + cnt23 += 1 + + + # C.g:626:21: ( Exponent )? + alt24 = 2 + LA24_0 = self.input.LA(1) + + if (LA24_0 == u'E' or LA24_0 == u'e') : + alt24 = 1 + if alt24 == 1: + # C.g:626:21: Exponent + self.mExponent() + + + + + self.mFloatTypeSuffix() + + + + + finally: + + pass + + # $ANTLR end FLOATING_POINT_LITERAL + + + + # $ANTLR start Exponent + def mExponent(self, ): + + try: + # C.g:630:10: ( ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ ) + # C.g:630:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ + if self.input.LA(1) == u'E' or self.input.LA(1) == u'e': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + # C.g:630:22: ( '+' | '-' )? + alt26 = 2 + LA26_0 = self.input.LA(1) + + if (LA26_0 == u'+' or LA26_0 == u'-') : + alt26 = 1 + if alt26 == 1: + # C.g: + if self.input.LA(1) == u'+' or self.input.LA(1) == u'-': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + # C.g:630:33: ( '0' .. '9' )+ + cnt27 = 0 + while True: #loop27 + alt27 = 2 + LA27_0 = self.input.LA(1) + + if ((u'0' <= LA27_0 <= u'9')) : + alt27 = 1 + + + if alt27 == 1: + # C.g:630:34: '0' .. '9' + self.matchRange(u'0', u'9') + + + + else: + if cnt27 >= 1: + break #loop27 + + eee = EarlyExitException(27, self.input) + raise eee + + cnt27 += 1 + + + + + + + finally: + + pass + + # $ANTLR end Exponent + + + + # $ANTLR start FloatTypeSuffix + def mFloatTypeSuffix(self, ): + + try: + # C.g:633:17: ( ( 'f' | 'F' | 'd' | 'D' ) ) + # C.g:633:19: ( 'f' | 'F' | 'd' | 'D' ) + if self.input.LA(1) == u'D' or self.input.LA(1) == u'F' or self.input.LA(1) == u'd' or self.input.LA(1) == u'f': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + + + finally: + + pass + + # $ANTLR end FloatTypeSuffix + + + + # $ANTLR start EscapeSequence + def mEscapeSequence(self, ): + + try: + # C.g:637:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape ) + alt28 = 2 + LA28_0 = self.input.LA(1) + + if (LA28_0 == u'\\') : + LA28_1 = self.input.LA(2) + + if (LA28_1 == u'"' or LA28_1 == u'\'' or LA28_1 == u'\\' or LA28_1 == u'b' or LA28_1 == u'f' or LA28_1 == u'n' or LA28_1 == u'r' or LA28_1 == u't') : + alt28 = 1 + elif ((u'0' <= LA28_1 <= u'7')) : + alt28 = 2 + else: + nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 1, self.input) + + raise nvae + + else: + nvae = NoViableAltException("635:1: fragment EscapeSequence : ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | OctalEscape );", 28, 0, self.input) + + raise nvae + + if alt28 == 1: + # C.g:637:8: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) + self.match(u'\\') + + if self.input.LA(1) == u'"' or self.input.LA(1) == u'\'' or self.input.LA(1) == u'\\' or self.input.LA(1) == u'b' or self.input.LA(1) == u'f' or self.input.LA(1) == u'n' or self.input.LA(1) == u'r' or self.input.LA(1) == u't': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + elif alt28 == 2: + # C.g:638:9: OctalEscape + self.mOctalEscape() + + + + + finally: + + pass + + # $ANTLR end EscapeSequence + + + + # $ANTLR start OctalEscape + def mOctalEscape(self, ): + + try: + # C.g:643:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ) + alt29 = 3 + LA29_0 = self.input.LA(1) + + if (LA29_0 == u'\\') : + LA29_1 = self.input.LA(2) + + if ((u'0' <= LA29_1 <= u'3')) : + LA29_2 = self.input.LA(3) + + if ((u'0' <= LA29_2 <= u'7')) : + LA29_4 = self.input.LA(4) + + if ((u'0' <= LA29_4 <= u'7')) : + alt29 = 1 + else: + alt29 = 2 + else: + alt29 = 3 + elif ((u'4' <= LA29_1 <= u'7')) : + LA29_3 = self.input.LA(3) + + if ((u'0' <= LA29_3 <= u'7')) : + alt29 = 2 + else: + alt29 = 3 + else: + nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 1, self.input) + + raise nvae + + else: + nvae = NoViableAltException("641:1: fragment OctalEscape : ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) );", 29, 0, self.input) + + raise nvae + + if alt29 == 1: + # C.g:643:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) + self.match(u'\\') + + # C.g:643:14: ( '0' .. '3' ) + # C.g:643:15: '0' .. '3' + self.matchRange(u'0', u'3') + + + + + # C.g:643:25: ( '0' .. '7' ) + # C.g:643:26: '0' .. '7' + self.matchRange(u'0', u'7') + + + + + # C.g:643:36: ( '0' .. '7' ) + # C.g:643:37: '0' .. '7' + self.matchRange(u'0', u'7') + + + + + + + elif alt29 == 2: + # C.g:644:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) + self.match(u'\\') + + # C.g:644:14: ( '0' .. '7' ) + # C.g:644:15: '0' .. '7' + self.matchRange(u'0', u'7') + + + + + # C.g:644:25: ( '0' .. '7' ) + # C.g:644:26: '0' .. '7' + self.matchRange(u'0', u'7') + + + + + + + elif alt29 == 3: + # C.g:645:9: '\\\\' ( '0' .. '7' ) + self.match(u'\\') + + # C.g:645:14: ( '0' .. '7' ) + # C.g:645:15: '0' .. '7' + self.matchRange(u'0', u'7') + + + + + + + + finally: + + pass + + # $ANTLR end OctalEscape + + + + # $ANTLR start UnicodeEscape + def mUnicodeEscape(self, ): + + try: + # C.g:650:5: ( '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit ) + # C.g:650:9: '\\\\' 'u' HexDigit HexDigit HexDigit HexDigit + self.match(u'\\') + + self.match(u'u') + + self.mHexDigit() + + self.mHexDigit() + + self.mHexDigit() + + self.mHexDigit() + + + + + + finally: + + pass + + # $ANTLR end UnicodeEscape + + + + # $ANTLR start WS + def mWS(self, ): + + try: + self.type = WS + + # C.g:653:5: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) ) + # C.g:653:8: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) + if (u'\t' <= self.input.LA(1) <= u'\n') or (u'\f' <= self.input.LA(1) <= u'\r') or self.input.LA(1) == u' ': + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + #action start + self.channel=HIDDEN; + #action end + + + + + finally: + + pass + + # $ANTLR end WS + + + + # $ANTLR start BS + def mBS(self, ): + + try: + self.type = BS + + # C.g:657:5: ( ( '\\\\' ) ) + # C.g:657:7: ( '\\\\' ) + # C.g:657:7: ( '\\\\' ) + # C.g:657:8: '\\\\' + self.match(u'\\') + + + + + #action start + self.channel=HIDDEN; + #action end + + + + + finally: + + pass + + # $ANTLR end BS + + + + # $ANTLR start UnicodeVocabulary + def mUnicodeVocabulary(self, ): + + try: + self.type = UnicodeVocabulary + + # C.g:665:5: ( '\\u0003' .. '\\uFFFE' ) + # C.g:665:7: '\\u0003' .. '\\uFFFE' + self.matchRange(u'\u0003', u'\uFFFE') + + + + + + finally: + + pass + + # $ANTLR end UnicodeVocabulary + + + + # $ANTLR start COMMENT + def mCOMMENT(self, ): + + try: + self.type = COMMENT + + # C.g:668:5: ( '/*' ( options {greedy=false; } : . )* '*/' ) + # C.g:668:9: '/*' ( options {greedy=false; } : . )* '*/' + self.match("/*") + + + # C.g:668:14: ( options {greedy=false; } : . )* + while True: #loop30 + alt30 = 2 + LA30_0 = self.input.LA(1) + + if (LA30_0 == u'*') : + LA30_1 = self.input.LA(2) + + if (LA30_1 == u'/') : + alt30 = 2 + elif ((u'\u0000' <= LA30_1 <= u'.') or (u'0' <= LA30_1 <= u'\uFFFE')) : + alt30 = 1 + + + elif ((u'\u0000' <= LA30_0 <= u')') or (u'+' <= LA30_0 <= u'\uFFFE')) : + alt30 = 1 + + + if alt30 == 1: + # C.g:668:42: . + self.matchAny() + + + + else: + break #loop30 + + + self.match("*/") + + + #action start + self.channel=HIDDEN; + #action end + + + + + finally: + + pass + + # $ANTLR end COMMENT + + + + # $ANTLR start LINE_COMMENT + def mLINE_COMMENT(self, ): + + try: + self.type = LINE_COMMENT + + # C.g:673:5: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) + # C.g:673:7: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' + self.match("//") + + + # C.g:673:12: (~ ( '\\n' | '\\r' ) )* + while True: #loop31 + alt31 = 2 + LA31_0 = self.input.LA(1) + + if ((u'\u0000' <= LA31_0 <= u'\t') or (u'\u000B' <= LA31_0 <= u'\f') or (u'\u000E' <= LA31_0 <= u'\uFFFE')) : + alt31 = 1 + + + if alt31 == 1: + # C.g:673:12: ~ ( '\\n' | '\\r' ) + if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + else: + break #loop31 + + + # C.g:673:26: ( '\\r' )? + alt32 = 2 + LA32_0 = self.input.LA(1) + + if (LA32_0 == u'\r') : + alt32 = 1 + if alt32 == 1: + # C.g:673:26: '\\r' + self.match(u'\r') + + + + + self.match(u'\n') + + #action start + self.channel=HIDDEN; + #action end + + + + + finally: + + pass + + # $ANTLR end LINE_COMMENT + + + + # $ANTLR start LINE_COMMAND + def mLINE_COMMAND(self, ): + + try: + self.type = LINE_COMMAND + + # C.g:678:5: ( '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) + # C.g:678:7: '#' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' + self.match(u'#') + + # C.g:678:11: (~ ( '\\n' | '\\r' ) )* + while True: #loop33 + alt33 = 2 + LA33_0 = self.input.LA(1) + + if ((u'\u0000' <= LA33_0 <= u'\t') or (u'\u000B' <= LA33_0 <= u'\f') or (u'\u000E' <= LA33_0 <= u'\uFFFE')) : + alt33 = 1 + + + if alt33 == 1: + # C.g:678:11: ~ ( '\\n' | '\\r' ) + if (u'\u0000' <= self.input.LA(1) <= u'\t') or (u'\u000B' <= self.input.LA(1) <= u'\f') or (u'\u000E' <= self.input.LA(1) <= u'\uFFFE'): + self.input.consume(); + + else: + mse = MismatchedSetException(None, self.input) + self.recover(mse) + raise mse + + + + + else: + break #loop33 + + + # C.g:678:25: ( '\\r' )? + alt34 = 2 + LA34_0 = self.input.LA(1) + + if (LA34_0 == u'\r') : + alt34 = 1 + if alt34 == 1: + # C.g:678:25: '\\r' + self.match(u'\r') + + + + + self.match(u'\n') + + #action start + self.channel=HIDDEN; + #action end + + + + + finally: + + pass + + # $ANTLR end LINE_COMMAND + + + + def mTokens(self): + # C.g:1:8: ( T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | T41 | T42 | T43 | T44 | T45 | T46 | T47 | T48 | T49 | T50 | T51 | T52 | T53 | T54 | T55 | T56 | T57 | T58 | T59 | T60 | T61 | T62 | T63 | T64 | T65 | T66 | T67 | T68 | T69 | T70 | T71 | T72 | T73 | T74 | T75 | T76 | T77 | T78 | T79 | T80 | T81 | T82 | T83 | T84 | T85 | T86 | T87 | T88 | T89 | T90 | T91 | T92 | T93 | T94 | T95 | T96 | T97 | T98 | T99 | T100 | T101 | T102 | T103 | T104 | T105 | T106 | T107 | T108 | T109 | T110 | T111 | T112 | T113 | T114 | T115 | T116 | T117 | IDENTIFIER | CHARACTER_LITERAL | STRING_LITERAL | HEX_LITERAL | DECIMAL_LITERAL | OCTAL_LITERAL | FLOATING_POINT_LITERAL | WS | BS | UnicodeVocabulary | COMMENT | LINE_COMMENT | LINE_COMMAND ) + alt35 = 106 + alt35 = self.dfa35.predict(self.input) + if alt35 == 1: + # C.g:1:10: T25 + self.mT25() + + + + elif alt35 == 2: + # C.g:1:14: T26 + self.mT26() + + + + elif alt35 == 3: + # C.g:1:18: T27 + self.mT27() + + + + elif alt35 == 4: + # C.g:1:22: T28 + self.mT28() + + + + elif alt35 == 5: + # C.g:1:26: T29 + self.mT29() + + + + elif alt35 == 6: + # C.g:1:30: T30 + self.mT30() + + + + elif alt35 == 7: + # C.g:1:34: T31 + self.mT31() + + + + elif alt35 == 8: + # C.g:1:38: T32 + self.mT32() + + + + elif alt35 == 9: + # C.g:1:42: T33 + self.mT33() + + + + elif alt35 == 10: + # C.g:1:46: T34 + self.mT34() + + + + elif alt35 == 11: + # C.g:1:50: T35 + self.mT35() + + + + elif alt35 == 12: + # C.g:1:54: T36 + self.mT36() + + + + elif alt35 == 13: + # C.g:1:58: T37 + self.mT37() + + + + elif alt35 == 14: + # C.g:1:62: T38 + self.mT38() + + + + elif alt35 == 15: + # C.g:1:66: T39 + self.mT39() + + + + elif alt35 == 16: + # C.g:1:70: T40 + self.mT40() + + + + elif alt35 == 17: + # C.g:1:74: T41 + self.mT41() + + + + elif alt35 == 18: + # C.g:1:78: T42 + self.mT42() + + + + elif alt35 == 19: + # C.g:1:82: T43 + self.mT43() + + + + elif alt35 == 20: + # C.g:1:86: T44 + self.mT44() + + + + elif alt35 == 21: + # C.g:1:90: T45 + self.mT45() + + + + elif alt35 == 22: + # C.g:1:94: T46 + self.mT46() + + + + elif alt35 == 23: + # C.g:1:98: T47 + self.mT47() + + + + elif alt35 == 24: + # C.g:1:102: T48 + self.mT48() + + + + elif alt35 == 25: + # C.g:1:106: T49 + self.mT49() + + + + elif alt35 == 26: + # C.g:1:110: T50 + self.mT50() + + + + elif alt35 == 27: + # C.g:1:114: T51 + self.mT51() + + + + elif alt35 == 28: + # C.g:1:118: T52 + self.mT52() + + + + elif alt35 == 29: + # C.g:1:122: T53 + self.mT53() + + + + elif alt35 == 30: + # C.g:1:126: T54 + self.mT54() + + + + elif alt35 == 31: + # C.g:1:130: T55 + self.mT55() + + + + elif alt35 == 32: + # C.g:1:134: T56 + self.mT56() + + + + elif alt35 == 33: + # C.g:1:138: T57 + self.mT57() + + + + elif alt35 == 34: + # C.g:1:142: T58 + self.mT58() + + + + elif alt35 == 35: + # C.g:1:146: T59 + self.mT59() + + + + elif alt35 == 36: + # C.g:1:150: T60 + self.mT60() + + + + elif alt35 == 37: + # C.g:1:154: T61 + self.mT61() + + + + elif alt35 == 38: + # C.g:1:158: T62 + self.mT62() + + + + elif alt35 == 39: + # C.g:1:162: T63 + self.mT63() + + + + elif alt35 == 40: + # C.g:1:166: T64 + self.mT64() + + + + elif alt35 == 41: + # C.g:1:170: T65 + self.mT65() + + + + elif alt35 == 42: + # C.g:1:174: T66 + self.mT66() + + + + elif alt35 == 43: + # C.g:1:178: T67 + self.mT67() + + + + elif alt35 == 44: + # C.g:1:182: T68 + self.mT68() + + + + elif alt35 == 45: + # C.g:1:186: T69 + self.mT69() + + + + elif alt35 == 46: + # C.g:1:190: T70 + self.mT70() + + + + elif alt35 == 47: + # C.g:1:194: T71 + self.mT71() + + + + elif alt35 == 48: + # C.g:1:198: T72 + self.mT72() + + + + elif alt35 == 49: + # C.g:1:202: T73 + self.mT73() + + + + elif alt35 == 50: + # C.g:1:206: T74 + self.mT74() + + + + elif alt35 == 51: + # C.g:1:210: T75 + self.mT75() + + + + elif alt35 == 52: + # C.g:1:214: T76 + self.mT76() + + + + elif alt35 == 53: + # C.g:1:218: T77 + self.mT77() + + + + elif alt35 == 54: + # C.g:1:222: T78 + self.mT78() + + + + elif alt35 == 55: + # C.g:1:226: T79 + self.mT79() + + + + elif alt35 == 56: + # C.g:1:230: T80 + self.mT80() + + + + elif alt35 == 57: + # C.g:1:234: T81 + self.mT81() + + + + elif alt35 == 58: + # C.g:1:238: T82 + self.mT82() + + + + elif alt35 == 59: + # C.g:1:242: T83 + self.mT83() + + + + elif alt35 == 60: + # C.g:1:246: T84 + self.mT84() + + + + elif alt35 == 61: + # C.g:1:250: T85 + self.mT85() + + + + elif alt35 == 62: + # C.g:1:254: T86 + self.mT86() + + + + elif alt35 == 63: + # C.g:1:258: T87 + self.mT87() + + + + elif alt35 == 64: + # C.g:1:262: T88 + self.mT88() + + + + elif alt35 == 65: + # C.g:1:266: T89 + self.mT89() + + + + elif alt35 == 66: + # C.g:1:270: T90 + self.mT90() + + + + elif alt35 == 67: + # C.g:1:274: T91 + self.mT91() + + + + elif alt35 == 68: + # C.g:1:278: T92 + self.mT92() + + + + elif alt35 == 69: + # C.g:1:282: T93 + self.mT93() + + + + elif alt35 == 70: + # C.g:1:286: T94 + self.mT94() + + + + elif alt35 == 71: + # C.g:1:290: T95 + self.mT95() + + + + elif alt35 == 72: + # C.g:1:294: T96 + self.mT96() + + + + elif alt35 == 73: + # C.g:1:298: T97 + self.mT97() + + + + elif alt35 == 74: + # C.g:1:302: T98 + self.mT98() + + + + elif alt35 == 75: + # C.g:1:306: T99 + self.mT99() + + + + elif alt35 == 76: + # C.g:1:310: T100 + self.mT100() + + + + elif alt35 == 77: + # C.g:1:315: T101 + self.mT101() + + + + elif alt35 == 78: + # C.g:1:320: T102 + self.mT102() + + + + elif alt35 == 79: + # C.g:1:325: T103 + self.mT103() + + + + elif alt35 == 80: + # C.g:1:330: T104 + self.mT104() + + + + elif alt35 == 81: + # C.g:1:335: T105 + self.mT105() + + + + elif alt35 == 82: + # C.g:1:340: T106 + self.mT106() + + + + elif alt35 == 83: + # C.g:1:345: T107 + self.mT107() + + + + elif alt35 == 84: + # C.g:1:350: T108 + self.mT108() + + + + elif alt35 == 85: + # C.g:1:355: T109 + self.mT109() + + + + elif alt35 == 86: + # C.g:1:360: T110 + self.mT110() + + + + elif alt35 == 87: + # C.g:1:365: T111 + self.mT111() + + + + elif alt35 == 88: + # C.g:1:370: T112 + self.mT112() + + + + elif alt35 == 89: + # C.g:1:375: T113 + self.mT113() + + + + elif alt35 == 90: + # C.g:1:380: T114 + self.mT114() + + + + elif alt35 == 91: + # C.g:1:385: T115 + self.mT115() + + + + elif alt35 == 92: + # C.g:1:390: T116 + self.mT116() + + + + elif alt35 == 93: + # C.g:1:395: T117 + self.mT117() + + + + elif alt35 == 94: + # C.g:1:400: IDENTIFIER + self.mIDENTIFIER() + + + + elif alt35 == 95: + # C.g:1:411: CHARACTER_LITERAL + self.mCHARACTER_LITERAL() + + + + elif alt35 == 96: + # C.g:1:429: STRING_LITERAL + self.mSTRING_LITERAL() + + + + elif alt35 == 97: + # C.g:1:444: HEX_LITERAL + self.mHEX_LITERAL() + + + + elif alt35 == 98: + # C.g:1:456: DECIMAL_LITERAL + self.mDECIMAL_LITERAL() + + + + elif alt35 == 99: + # C.g:1:472: OCTAL_LITERAL + self.mOCTAL_LITERAL() + + + + elif alt35 == 100: + # C.g:1:486: FLOATING_POINT_LITERAL + self.mFLOATING_POINT_LITERAL() + + + + elif alt35 == 101: + # C.g:1:509: WS + self.mWS() + + + + elif alt35 == 102: + # C.g:1:512: BS + self.mBS() + + + + elif alt35 == 103: + # C.g:1:515: UnicodeVocabulary + self.mUnicodeVocabulary() + + + + elif alt35 == 104: + # C.g:1:533: COMMENT + self.mCOMMENT() + + + + elif alt35 == 105: + # C.g:1:541: LINE_COMMENT + self.mLINE_COMMENT() + + + + elif alt35 == 106: + # C.g:1:554: LINE_COMMAND + self.mLINE_COMMAND() + + + + + + + + + # lookup tables for DFA #25 + + DFA25_eot = DFA.unpack( + u"\7\uffff\1\10\2\uffff" + ) + + DFA25_eof = DFA.unpack( + u"\12\uffff" + ) + + DFA25_min = DFA.unpack( + u"\2\56\2\uffff\1\53\1\uffff\2\60\2\uffff" + ) + + DFA25_max = DFA.unpack( + u"\1\71\1\146\2\uffff\1\71\1\uffff\1\71\1\146\2\uffff" + ) + + DFA25_accept = DFA.unpack( + u"\2\uffff\1\2\1\1\1\uffff\1\4\2\uffff\2\3" + ) + + DFA25_special = DFA.unpack( + u"\12\uffff" + ) + + + DFA25_transition = [ + DFA.unpack(u"\1\2\1\uffff\12\1"), + DFA.unpack(u"\1\3\1\uffff\12\1\12\uffff\1\5\1\4\1\5\35\uffff\1\5" + u"\1\4\1\5"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\6\1\uffff\1\6\2\uffff\12\7"), + DFA.unpack(u""), + DFA.unpack(u"\12\7"), + DFA.unpack(u"\12\7\12\uffff\1\11\1\uffff\1\11\35\uffff\1\11\1\uffff" + u"\1\11"), + DFA.unpack(u""), + DFA.unpack(u"") + ] + + # class definition for DFA #25 + + DFA25 = DFA + # lookup tables for DFA #35 + + DFA35_eot = DFA.unpack( + u"\2\uffff\1\76\1\uffff\1\101\14\76\3\uffff\10\76\4\uffff\1\151\1" + u"\153\1\157\1\163\1\167\1\171\1\174\1\uffff\1\177\1\u0082\1\u0085" + u"\1\u0087\1\u008a\1\uffff\5\76\1\uffff\2\73\2\u0095\2\uffff\1\73" + u"\2\uffff\1\76\4\uffff\16\76\1\u00ad\5\76\1\u00b4\1\76\3\uffff\1" + u"\u00b7\10\76\34\uffff\1\u00c1\2\uffff\1\u00c3\10\uffff\5\76\3\uffff" + u"\1\u00c9\1\uffff\1\u0095\3\uffff\23\76\1\uffff\1\u00de\1\76\1\u00e0" + u"\3\76\1\uffff\2\76\1\uffff\1\76\1\u00e7\6\76\4\uffff\5\76\1\uffff" + u"\1\76\1\u00f5\1\76\1\u00f7\6\76\1\u00fe\4\76\1\u0103\1\u0104\2" + u"\76\1\u0107\1\uffff\1\u0108\1\uffff\6\76\1\uffff\10\76\1\u0118" + u"\1\76\1\u011a\2\76\1\uffff\1\76\1\uffff\5\76\1\u0123\1\uffff\4" + u"\76\2\uffff\1\76\1\u0129\2\uffff\1\u012a\3\76\1\u012e\1\76\1\u0130" + u"\7\76\1\u0139\1\uffff\1\u013a\1\uffff\1\u013b\1\76\1\u013d\1\u013e" + u"\1\u013f\1\u0140\1\u0141\1\u0142\1\uffff\1\76\1\u0144\1\u0145\2" + u"\76\2\uffff\1\76\1\u0149\1\76\1\uffff\1\76\1\uffff\5\76\1\u0151" + u"\1\u0152\1\76\3\uffff\1\u0154\6\uffff\1\76\2\uffff\2\76\1\u0158" + u"\1\uffff\7\76\2\uffff\1\u0160\1\uffff\1\u0161\1\u0162\1\u0163\1" + u"\uffff\1\u0164\1\u0165\1\76\1\u0167\3\76\6\uffff\1\u016b\1\uffff" + u"\3\76\1\uffff\21\76\1\u0180\2\76\1\uffff\3\76\1\u0186\1\76\1\uffff" + u"\11\76\1\u0191\1\uffff" + ) + + DFA35_eof = DFA.unpack( + u"\u0192\uffff" + ) + + DFA35_min = DFA.unpack( + u"\1\3\1\uffff\1\171\1\uffff\1\75\1\154\1\150\1\165\1\145\1\124\1" + u"\157\1\141\1\146\1\157\1\154\1\145\1\156\3\uffff\1\116\1\120\1" + u"\117\1\116\1\117\1\114\1\106\1\101\4\uffff\1\75\1\56\1\53\1\55" + u"\1\52\1\75\1\46\1\uffff\1\75\1\74\3\75\1\uffff\1\137\1\150\1\157" + u"\1\162\1\42\1\uffff\2\0\2\56\2\uffff\1\0\2\uffff\1\160\4\uffff" + u"\1\163\1\164\1\165\1\151\1\141\1\147\1\157\1\164\1\147\1\101\1" + u"\151\1\163\1\156\1\141\1\44\1\164\1\156\1\162\1\157\1\146\1\44" + u"\1\151\3\uffff\1\44\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34" + u"\uffff\1\75\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145" + u"\3\uffff\1\56\1\uffff\1\56\3\uffff\3\145\1\155\2\164\1\165\1\145" + u"\1\156\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\163\1" + u"\162\1\uffff\1\44\1\147\1\44\2\141\1\142\1\uffff\1\151\1\157\1" + u"\uffff\1\111\1\44\1\123\1\114\1\101\1\102\1\101\1\113\4\uffff\1" + u"\163\1\155\1\154\1\157\1\141\1\uffff\1\144\1\44\1\162\1\44\1\143" + u"\1\151\1\143\1\157\1\145\1\164\1\44\1\163\1\162\1\111\1\164\2\44" + u"\1\151\1\164\1\44\1\uffff\1\44\1\uffff\1\164\1\165\1\154\1\147" + u"\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\102\1\120\1\105" + u"\1\155\1\44\1\145\1\44\1\153\1\145\1\uffff\1\156\1\uffff\1\150" + u"\1\143\1\164\1\146\1\144\1\44\1\uffff\1\164\1\156\1\103\1\151\2" + u"\uffff\1\156\1\44\2\uffff\1\44\1\154\1\145\1\156\1\44\1\116\1\44" + u"\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\44\1\uffff\1\44\1" + u"\uffff\1\44\1\146\6\44\1\uffff\1\145\2\44\1\154\1\165\2\uffff\1" + u"\164\1\44\1\145\1\uffff\1\101\1\uffff\1\116\1\114\1\137\1\116\1" + u"\117\2\44\1\137\3\uffff\1\44\6\uffff\1\162\2\uffff\2\145\1\44\1" + u"\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff\1\44\1\uffff\3\44" + u"\1\uffff\2\44\1\104\1\44\1\105\1\111\1\123\6\uffff\1\44\1\uffff" + u"\2\115\1\105\1\uffff\1\117\1\105\1\122\1\126\1\123\1\126\2\105" + u"\1\111\1\137\1\122\1\103\1\111\1\126\1\105\1\106\1\111\1\44\1\137" + u"\1\103\1\uffff\1\125\1\105\1\116\1\44\1\122\1\uffff\1\105\1\106" + u"\1\105\1\122\1\105\1\116\1\103\1\105\1\104\1\44\1\uffff" + ) + + DFA35_max = DFA.unpack( + u"\1\ufffe\1\uffff\1\171\1\uffff\1\75\1\170\1\167\1\165\1\145\1\124" + u"\2\157\1\156\3\157\1\156\3\uffff\1\116\1\125\1\117\1\116\1\117" + u"\1\114\1\106\1\101\4\uffff\1\75\1\71\1\75\1\76\3\75\1\uffff\2\75" + u"\1\76\1\75\1\174\1\uffff\1\141\1\150\1\157\1\162\1\47\1\uffff\2" + u"\ufffe\1\170\1\146\2\uffff\1\ufffe\2\uffff\1\160\4\uffff\1\163" + u"\1\164\1\165\1\151\1\162\1\172\1\157\2\164\1\101\1\154\1\163\1" + u"\156\1\141\1\172\1\164\1\156\1\162\1\157\1\146\1\172\1\163\3\uffff" + u"\1\172\2\124\1\116\1\101\1\114\1\117\1\111\1\103\34\uffff\1\75" + u"\2\uffff\1\75\10\uffff\1\141\1\163\1\151\1\164\1\145\3\uffff\1" + u"\146\1\uffff\1\146\3\uffff\3\145\1\155\2\164\1\165\1\145\1\156" + u"\1\162\1\157\1\151\1\165\1\124\1\141\1\144\1\145\1\164\1\162\1" + u"\uffff\1\172\1\147\1\172\2\141\1\142\1\uffff\1\151\1\157\1\uffff" + u"\1\111\1\172\1\123\1\114\1\101\1\102\1\137\1\113\4\uffff\1\163" + u"\1\155\1\154\1\157\1\141\1\uffff\1\144\1\172\1\162\1\172\1\143" + u"\1\151\1\143\1\157\1\145\1\164\1\172\1\163\1\162\1\111\1\164\2" + u"\172\1\151\1\164\1\172\1\uffff\1\172\1\uffff\1\164\1\165\1\154" + u"\1\147\1\156\1\117\1\uffff\1\124\1\111\1\124\1\101\1\122\1\120" + u"\1\105\1\155\1\172\1\145\1\172\1\153\1\145\1\uffff\1\156\1\uffff" + u"\1\150\1\143\1\164\1\146\1\144\1\172\1\uffff\1\164\1\156\1\103" + u"\1\151\2\uffff\1\156\1\172\2\uffff\1\172\1\154\1\145\1\156\1\172" + u"\1\116\1\172\1\107\1\111\1\114\1\125\1\117\1\111\1\104\1\172\1" + u"\uffff\1\172\1\uffff\1\172\1\146\6\172\1\uffff\1\145\2\172\1\154" + u"\1\165\2\uffff\1\164\1\172\1\145\1\uffff\1\101\1\uffff\1\116\1" + u"\114\1\137\1\116\1\117\2\172\1\137\3\uffff\1\172\6\uffff\1\162" + u"\2\uffff\2\145\1\172\1\uffff\1\144\1\114\2\105\1\122\2\124\2\uffff" + u"\1\172\1\uffff\3\172\1\uffff\2\172\1\104\1\172\1\105\1\111\1\123" + u"\6\uffff\1\172\1\uffff\2\115\1\105\1\uffff\1\117\1\105\1\122\1" + u"\126\1\123\1\126\2\105\1\111\1\137\1\122\1\103\1\111\1\126\1\105" + u"\1\106\1\111\1\172\1\137\1\103\1\uffff\1\125\1\105\1\116\1\172" + u"\1\122\1\uffff\1\105\1\106\1\105\1\122\1\105\1\116\1\103\1\105" + u"\1\104\1\172\1\uffff" + ) + + DFA35_accept = DFA.unpack( + u"\1\uffff\1\1\1\uffff\1\3\15\uffff\1\23\1\24\1\27\10\uffff\1\46" + u"\1\47\1\50\1\51\7\uffff\1\66\5\uffff\1\102\5\uffff\1\136\4\uffff" + u"\1\145\1\146\1\uffff\1\147\1\1\1\uffff\1\136\1\3\1\107\1\4\26\uffff" + u"\1\23\1\24\1\27\11\uffff\1\46\1\47\1\50\1\51\1\70\1\52\1\53\1\63" + u"\1\144\1\73\1\60\1\54\1\74\1\64\1\61\1\55\1\150\1\151\1\71\1\56" + u"\1\72\1\57\1\77\1\104\1\65\1\66\1\110\1\67\1\uffff\1\113\1\111" + u"\1\uffff\1\114\1\112\1\100\1\106\1\103\1\101\1\105\1\102\5\uffff" + u"\1\140\1\137\1\141\1\uffff\1\142\1\uffff\1\145\1\146\1\152\23\uffff" + u"\1\124\6\uffff\1\130\2\uffff\1\33\10\uffff\1\75\1\115\1\76\1\116" + u"\5\uffff\1\143\24\uffff\1\15\1\uffff\1\131\6\uffff\1\34\15\uffff" + u"\1\125\1\uffff\1\30\6\uffff\1\7\4\uffff\1\12\1\122\2\uffff\1\13" + u"\1\16\17\uffff\1\120\1\uffff\1\132\10\uffff\1\14\5\uffff\1\31\1" + u"\17\3\uffff\1\26\1\uffff\1\36\10\uffff\1\121\1\127\1\134\1\uffff" + u"\1\5\1\126\1\6\1\25\1\62\1\21\1\uffff\1\135\1\11\3\uffff\1\20\7" + u"\uffff\1\42\1\45\1\uffff\1\2\3\uffff\1\123\7\uffff\1\117\1\10\1" + u"\32\1\133\1\22\1\35\1\uffff\1\40\3\uffff\1\37\24\uffff\1\43\5\uffff" + u"\1\44\12\uffff\1\41" + ) + + DFA35_special = DFA.unpack( + u"\u0192\uffff" + ) + + + DFA35_transition = [ + DFA.unpack(u"\6\73\2\70\1\73\2\70\22\73\1\70\1\50\1\65\1\72\1\63" + u"\1\45\1\46\1\64\1\34\1\35\1\40\1\42\1\3\1\43\1\41\1\44\1\66\11" + u"\67\1\23\1\1\1\51\1\4\1\52\1\55\1\73\2\63\1\26\1\63\1\32\1\63\1" + u"\31\1\63\1\24\2\63\1\62\2\63\1\25\1\33\2\63\1\11\1\63\1\27\1\30" + u"\4\63\1\36\1\71\1\37\1\53\1\56\1\73\1\7\1\61\1\13\1\17\1\5\1\16" + u"\1\60\1\63\1\14\2\63\1\15\5\63\1\10\1\6\1\2\1\20\1\12\1\57\3\63" + u"\1\21\1\54\1\22\1\47\uff80\73"), + DFA.unpack(u""), + DFA.unpack(u"\1\75"), + DFA.unpack(u""), + DFA.unpack(u"\1\100"), + DFA.unpack(u"\1\102\1\uffff\1\104\11\uffff\1\103"), + DFA.unpack(u"\1\110\1\107\12\uffff\1\106\2\uffff\1\105"), + DFA.unpack(u"\1\111"), + DFA.unpack(u"\1\112"), + DFA.unpack(u"\1\113"), + DFA.unpack(u"\1\114"), + DFA.unpack(u"\1\115\6\uffff\1\117\6\uffff\1\116"), + DFA.unpack(u"\1\120\7\uffff\1\121"), + DFA.unpack(u"\1\122"), + DFA.unpack(u"\1\124\2\uffff\1\123"), + DFA.unpack(u"\1\125\11\uffff\1\126"), + DFA.unpack(u"\1\127"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\133"), + DFA.unpack(u"\1\134\4\uffff\1\135"), + DFA.unpack(u"\1\136"), + DFA.unpack(u"\1\137"), + DFA.unpack(u"\1\140"), + DFA.unpack(u"\1\141"), + DFA.unpack(u"\1\142"), + DFA.unpack(u"\1\143"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\150"), + DFA.unpack(u"\1\152\1\uffff\12\154"), + DFA.unpack(u"\1\156\21\uffff\1\155"), + DFA.unpack(u"\1\162\17\uffff\1\160\1\161"), + DFA.unpack(u"\1\164\4\uffff\1\165\15\uffff\1\166"), + DFA.unpack(u"\1\170"), + DFA.unpack(u"\1\173\26\uffff\1\172"), + DFA.unpack(u""), + DFA.unpack(u"\1\176"), + DFA.unpack(u"\1\u0080\1\u0081"), + DFA.unpack(u"\1\u0084\1\u0083"), + DFA.unpack(u"\1\u0086"), + DFA.unpack(u"\1\u0089\76\uffff\1\u0088"), + DFA.unpack(u""), + DFA.unpack(u"\1\u008c\1\uffff\1\u008d"), + DFA.unpack(u"\1\u008e"), + DFA.unpack(u"\1\u008f"), + DFA.unpack(u"\1\u0090"), + DFA.unpack(u"\1\u0091\4\uffff\1\u0092"), + DFA.unpack(u""), + DFA.unpack(u"\47\u0092\1\uffff\uffd7\u0092"), + DFA.unpack(u"\uffff\u0091"), + DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\21\uffff" + u"\1\u0093\13\uffff\3\154\21\uffff\1\u0093"), + DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\uffff\u0099"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u009a"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u009b"), + DFA.unpack(u"\1\u009c"), + DFA.unpack(u"\1\u009d"), + DFA.unpack(u"\1\u009e"), + DFA.unpack(u"\1\u009f\20\uffff\1\u00a0"), + DFA.unpack(u"\1\u00a2\22\uffff\1\u00a1"), + DFA.unpack(u"\1\u00a3"), + DFA.unpack(u"\1\u00a4"), + DFA.unpack(u"\1\u00a5\14\uffff\1\u00a6"), + DFA.unpack(u"\1\u00a7"), + DFA.unpack(u"\1\u00a9\2\uffff\1\u00a8"), + DFA.unpack(u"\1\u00aa"), + DFA.unpack(u"\1\u00ab"), + DFA.unpack(u"\1\u00ac"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00ae"), + DFA.unpack(u"\1\u00af"), + DFA.unpack(u"\1\u00b0"), + DFA.unpack(u"\1\u00b1"), + DFA.unpack(u"\1\u00b2"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\24\76\1\u00b3\5\76"), + DFA.unpack(u"\1\u00b6\11\uffff\1\u00b5"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00b8"), + DFA.unpack(u"\1\u00b9"), + DFA.unpack(u"\1\u00ba"), + DFA.unpack(u"\1\u00bb"), + DFA.unpack(u"\1\u00bc"), + DFA.unpack(u"\1\u00bd"), + DFA.unpack(u"\1\u00be"), + DFA.unpack(u"\1\u00bf"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u00c0"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u00c2"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u00c4"), + DFA.unpack(u"\1\u00c5"), + DFA.unpack(u"\1\u00c6"), + DFA.unpack(u"\1\u00c7"), + DFA.unpack(u"\1\u00c8"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\154\1\uffff\10\u0094\2\154\12\uffff\3\154\35\uffff" + u"\3\154"), + DFA.unpack(u""), + DFA.unpack(u"\1\154\1\uffff\12\u0096\12\uffff\3\154\35\uffff\3\154"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u00ca"), + DFA.unpack(u"\1\u00cb"), + DFA.unpack(u"\1\u00cc"), + DFA.unpack(u"\1\u00cd"), + DFA.unpack(u"\1\u00ce"), + DFA.unpack(u"\1\u00cf"), + DFA.unpack(u"\1\u00d0"), + DFA.unpack(u"\1\u00d1"), + DFA.unpack(u"\1\u00d2"), + DFA.unpack(u"\1\u00d3"), + DFA.unpack(u"\1\u00d4"), + DFA.unpack(u"\1\u00d5"), + DFA.unpack(u"\1\u00d6"), + DFA.unpack(u"\1\u00d7"), + DFA.unpack(u"\1\u00d8"), + DFA.unpack(u"\1\u00d9"), + DFA.unpack(u"\1\u00da"), + DFA.unpack(u"\1\u00dc\1\u00db"), + DFA.unpack(u"\1\u00dd"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00df"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00e1"), + DFA.unpack(u"\1\u00e2"), + DFA.unpack(u"\1\u00e3"), + DFA.unpack(u""), + DFA.unpack(u"\1\u00e4"), + DFA.unpack(u"\1\u00e5"), + DFA.unpack(u""), + DFA.unpack(u"\1\u00e6"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00e8"), + DFA.unpack(u"\1\u00e9"), + DFA.unpack(u"\1\u00ea"), + DFA.unpack(u"\1\u00eb"), + DFA.unpack(u"\1\u00ed\35\uffff\1\u00ec"), + DFA.unpack(u"\1\u00ee"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u00ef"), + DFA.unpack(u"\1\u00f0"), + DFA.unpack(u"\1\u00f1"), + DFA.unpack(u"\1\u00f2"), + DFA.unpack(u"\1\u00f3"), + DFA.unpack(u""), + DFA.unpack(u"\1\u00f4"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00f6"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00f8"), + DFA.unpack(u"\1\u00f9"), + DFA.unpack(u"\1\u00fa"), + DFA.unpack(u"\1\u00fb"), + DFA.unpack(u"\1\u00fc"), + DFA.unpack(u"\1\u00fd"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u00ff"), + DFA.unpack(u"\1\u0100"), + DFA.unpack(u"\1\u0101"), + DFA.unpack(u"\1\u0102"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0105"), + DFA.unpack(u"\1\u0106"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0109"), + DFA.unpack(u"\1\u010a"), + DFA.unpack(u"\1\u010b"), + DFA.unpack(u"\1\u010c"), + DFA.unpack(u"\1\u010d"), + DFA.unpack(u"\1\u010e"), + DFA.unpack(u""), + DFA.unpack(u"\1\u010f"), + DFA.unpack(u"\1\u0110"), + DFA.unpack(u"\1\u0111"), + DFA.unpack(u"\1\u0112"), + DFA.unpack(u"\1\u0114\17\uffff\1\u0113"), + DFA.unpack(u"\1\u0115"), + DFA.unpack(u"\1\u0116"), + DFA.unpack(u"\1\u0117"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0119"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u011b"), + DFA.unpack(u"\1\u011c"), + DFA.unpack(u""), + DFA.unpack(u"\1\u011d"), + DFA.unpack(u""), + DFA.unpack(u"\1\u011e"), + DFA.unpack(u"\1\u011f"), + DFA.unpack(u"\1\u0120"), + DFA.unpack(u"\1\u0121"), + DFA.unpack(u"\1\u0122"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0124"), + DFA.unpack(u"\1\u0125"), + DFA.unpack(u"\1\u0126"), + DFA.unpack(u"\1\u0127"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u0128"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u012b"), + DFA.unpack(u"\1\u012c"), + DFA.unpack(u"\1\u012d"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u012f"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0131"), + DFA.unpack(u"\1\u0132"), + DFA.unpack(u"\1\u0133"), + DFA.unpack(u"\1\u0134"), + DFA.unpack(u"\1\u0135"), + DFA.unpack(u"\1\u0136"), + DFA.unpack(u"\1\u0137"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\u0138\1" + u"\uffff\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u013c"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0143"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0146"), + DFA.unpack(u"\1\u0147"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u0148"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u014a"), + DFA.unpack(u""), + DFA.unpack(u"\1\u014b"), + DFA.unpack(u""), + DFA.unpack(u"\1\u014c"), + DFA.unpack(u"\1\u014d"), + DFA.unpack(u"\1\u014e"), + DFA.unpack(u"\1\u014f"), + DFA.unpack(u"\1\u0150"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0153"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u0155"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\u0156"), + DFA.unpack(u"\1\u0157"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0159"), + DFA.unpack(u"\1\u015a"), + DFA.unpack(u"\1\u015b"), + DFA.unpack(u"\1\u015c"), + DFA.unpack(u"\1\u015d"), + DFA.unpack(u"\1\u015e"), + DFA.unpack(u"\1\u015f"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0166"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0168"), + DFA.unpack(u"\1\u0169"), + DFA.unpack(u"\1\u016a"), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u""), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u""), + DFA.unpack(u"\1\u016c"), + DFA.unpack(u"\1\u016d"), + DFA.unpack(u"\1\u016e"), + DFA.unpack(u""), + DFA.unpack(u"\1\u016f"), + DFA.unpack(u"\1\u0170"), + DFA.unpack(u"\1\u0171"), + DFA.unpack(u"\1\u0172"), + DFA.unpack(u"\1\u0173"), + DFA.unpack(u"\1\u0174"), + DFA.unpack(u"\1\u0175"), + DFA.unpack(u"\1\u0176"), + DFA.unpack(u"\1\u0177"), + DFA.unpack(u"\1\u0178"), + DFA.unpack(u"\1\u0179"), + DFA.unpack(u"\1\u017a"), + DFA.unpack(u"\1\u017b"), + DFA.unpack(u"\1\u017c"), + DFA.unpack(u"\1\u017d"), + DFA.unpack(u"\1\u017e"), + DFA.unpack(u"\1\u017f"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0181"), + DFA.unpack(u"\1\u0182"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0183"), + DFA.unpack(u"\1\u0184"), + DFA.unpack(u"\1\u0185"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"\1\u0187"), + DFA.unpack(u""), + DFA.unpack(u"\1\u0188"), + DFA.unpack(u"\1\u0189"), + DFA.unpack(u"\1\u018a"), + DFA.unpack(u"\1\u018b"), + DFA.unpack(u"\1\u018c"), + DFA.unpack(u"\1\u018d"), + DFA.unpack(u"\1\u018e"), + DFA.unpack(u"\1\u018f"), + DFA.unpack(u"\1\u0190"), + DFA.unpack(u"\1\76\13\uffff\12\76\7\uffff\32\76\4\uffff\1\76\1\uffff" + u"\32\76"), + DFA.unpack(u"") + ] + + # class definition for DFA #35 + + DFA35 = DFA + + diff --git a/BaseTools/Source/Python/Eot/CParser.py b/BaseTools/Source/Python/Eot/CParser.py index 511d429f26..baa521f43c 100644 --- a/BaseTools/Source/Python/Eot/CParser.py +++ b/BaseTools/Source/Python/Eot/CParser.py @@ -1,7 +1,7 @@ -# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53 - -from antlr3 import * -from antlr3.compat import set, frozenset +# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53 + +from antlr3 import * +from antlr3.compat import set, frozenset ## @file # The file defines the parser for C source files. @@ -24,88 +24,88 @@ from antlr3.compat import set, frozenset import CodeFragment import FileProfile - - - -# for convenience in actions -HIDDEN = BaseRecognizer.HIDDEN - -# token types -BS=20 -LINE_COMMENT=23 -FloatTypeSuffix=16 -IntegerTypeSuffix=14 -LETTER=11 -OCTAL_LITERAL=6 -CHARACTER_LITERAL=8 -Exponent=15 -EOF=-1 -HexDigit=13 -STRING_LITERAL=9 -WS=19 -FLOATING_POINT_LITERAL=10 -IDENTIFIER=4 -UnicodeEscape=18 -LINE_COMMAND=24 -UnicodeVocabulary=21 -HEX_LITERAL=5 -COMMENT=22 -DECIMAL_LITERAL=7 -EscapeSequence=12 -OctalEscape=17 - -# token names -tokenNames = [ - "", "", "", "", - "IDENTIFIER", "HEX_LITERAL", "OCTAL_LITERAL", "DECIMAL_LITERAL", "CHARACTER_LITERAL", - "STRING_LITERAL", "FLOATING_POINT_LITERAL", "LETTER", "EscapeSequence", - "HexDigit", "IntegerTypeSuffix", "Exponent", "FloatTypeSuffix", "OctalEscape", - "UnicodeEscape", "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT", - "LINE_COMMAND", "';'", "'typedef'", "','", "'='", "'extern'", "'static'", - "'auto'", "'register'", "'STATIC'", "'void'", "'char'", "'short'", "'int'", - "'long'", "'float'", "'double'", "'signed'", "'unsigned'", "'{'", "'}'", - "'struct'", "'union'", "':'", "'enum'", "'const'", "'volatile'", "'IN'", - "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'", "'VOLATILE'", "'GLOBAL_REMOVE_IF_UNREFERENCED'", - "'EFIAPI'", "'EFI_BOOTSERVICE'", "'EFI_RUNTIMESERVICE'", "'PACKED'", - "'('", "')'", "'['", "']'", "'*'", "'...'", "'+'", "'-'", "'/'", "'%'", - "'++'", "'--'", "'sizeof'", "'.'", "'->'", "'&'", "'~'", "'!'", "'*='", - "'/='", "'%='", "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='", - "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='", "'<'", "'>'", "'<='", - "'>='", "'<<'", "'>>'", "'__asm__'", "'_asm'", "'__asm'", "'case'", - "'default'", "'if'", "'else'", "'switch'", "'while'", "'do'", "'for'", - "'goto'", "'continue'", "'break'", "'return'" -] - - -class function_definition_scope(object): - def __init__(self): - self.ModifierText = None - self.DeclText = None - self.LBLine = None - self.LBOffset = None - self.DeclLine = None - self.DeclOffset = None -class postfix_expression_scope(object): - def __init__(self): - self.FuncCallText = None - - -class CParser(Parser): - grammarFileName = "C.g" - tokenNames = tokenNames - - def __init__(self, input): - Parser.__init__(self, input) - self.ruleMemo = {} - - self.function_definition_stack = [] - self.postfix_expression_stack = [] - - - - - - + + + +# for convenience in actions +HIDDEN = BaseRecognizer.HIDDEN + +# token types +BS=20 +LINE_COMMENT=23 +FloatTypeSuffix=16 +IntegerTypeSuffix=14 +LETTER=11 +OCTAL_LITERAL=6 +CHARACTER_LITERAL=8 +Exponent=15 +EOF=-1 +HexDigit=13 +STRING_LITERAL=9 +WS=19 +FLOATING_POINT_LITERAL=10 +IDENTIFIER=4 +UnicodeEscape=18 +LINE_COMMAND=24 +UnicodeVocabulary=21 +HEX_LITERAL=5 +COMMENT=22 +DECIMAL_LITERAL=7 +EscapeSequence=12 +OctalEscape=17 + +# token names +tokenNames = [ + "", "", "", "", + "IDENTIFIER", "HEX_LITERAL", "OCTAL_LITERAL", "DECIMAL_LITERAL", "CHARACTER_LITERAL", + "STRING_LITERAL", "FLOATING_POINT_LITERAL", "LETTER", "EscapeSequence", + "HexDigit", "IntegerTypeSuffix", "Exponent", "FloatTypeSuffix", "OctalEscape", + "UnicodeEscape", "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT", + "LINE_COMMAND", "';'", "'typedef'", "','", "'='", "'extern'", "'static'", + "'auto'", "'register'", "'STATIC'", "'void'", "'char'", "'short'", "'int'", + "'long'", "'float'", "'double'", "'signed'", "'unsigned'", "'{'", "'}'", + "'struct'", "'union'", "':'", "'enum'", "'const'", "'volatile'", "'IN'", + "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'", "'VOLATILE'", "'GLOBAL_REMOVE_IF_UNREFERENCED'", + "'EFIAPI'", "'EFI_BOOTSERVICE'", "'EFI_RUNTIMESERVICE'", "'PACKED'", + "'('", "')'", "'['", "']'", "'*'", "'...'", "'+'", "'-'", "'/'", "'%'", + "'++'", "'--'", "'sizeof'", "'.'", "'->'", "'&'", "'~'", "'!'", "'*='", + "'/='", "'%='", "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='", + "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='", "'<'", "'>'", "'<='", + "'>='", "'<<'", "'>>'", "'__asm__'", "'_asm'", "'__asm'", "'case'", + "'default'", "'if'", "'else'", "'switch'", "'while'", "'do'", "'for'", + "'goto'", "'continue'", "'break'", "'return'" +] + + +class function_definition_scope(object): + def __init__(self): + self.ModifierText = None + self.DeclText = None + self.LBLine = None + self.LBOffset = None + self.DeclLine = None + self.DeclOffset = None +class postfix_expression_scope(object): + def __init__(self): + self.FuncCallText = None + + +class CParser(Parser): + grammarFileName = "C.g" + tokenNames = tokenNames + + def __init__(self, input): + Parser.__init__(self, input) + self.ruleMemo = {} + + self.function_definition_stack = [] + self.postfix_expression_stack = [] + + + + + + def printTokenInfo(self, line, offset, tokenText): @@ -139,442 +139,442 @@ class CParser(Parser): FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset)) FileProfile.FunctionCallingList.append(FuncCall) - - - - # $ANTLR start translation_unit - # C.g:102:1: translation_unit : ( external_declaration )* ; - def translation_unit(self, ): - - translation_unit_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 1): - return - - # C.g:103:2: ( ( external_declaration )* ) - # C.g:103:4: ( external_declaration )* - # C.g:103:4: ( external_declaration )* - while True: #loop1 - alt1 = 2 - LA1_0 = self.input.LA(1) - - if (LA1_0 == IDENTIFIER or LA1_0 == 26 or (29 <= LA1_0 <= 42) or (45 <= LA1_0 <= 46) or (48 <= LA1_0 <= 62) or LA1_0 == 66) : - alt1 = 1 - - - if alt1 == 1: - # C.g:0:0: external_declaration - self.following.append(self.FOLLOW_external_declaration_in_translation_unit74) - self.external_declaration() - self.following.pop() - if self.failed: - return - - - else: - break #loop1 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 1, translation_unit_StartIndex) - - pass - - return - - # $ANTLR end translation_unit - - - # $ANTLR start external_declaration - # C.g:114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? ); - def external_declaration(self, ): - - external_declaration_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 2): - return - - # C.g:119:2: ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? ) - alt3 = 3 - LA3_0 = self.input.LA(1) - - if ((29 <= LA3_0 <= 33)) : - LA3_1 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 1, self.input) - - raise nvae - - elif (LA3_0 == 34) : - LA3_2 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 2, self.input) - - raise nvae - - elif (LA3_0 == 35) : - LA3_3 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 3, self.input) - - raise nvae - - elif (LA3_0 == 36) : - LA3_4 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 4, self.input) - - raise nvae - - elif (LA3_0 == 37) : - LA3_5 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 5, self.input) - - raise nvae - - elif (LA3_0 == 38) : - LA3_6 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 6, self.input) - - raise nvae - - elif (LA3_0 == 39) : - LA3_7 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 7, self.input) - - raise nvae - - elif (LA3_0 == 40) : - LA3_8 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 8, self.input) - - raise nvae - - elif (LA3_0 == 41) : - LA3_9 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 9, self.input) - - raise nvae - - elif (LA3_0 == 42) : - LA3_10 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 10, self.input) - - raise nvae - - elif ((45 <= LA3_0 <= 46)) : - LA3_11 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 11, self.input) - - raise nvae - - elif (LA3_0 == 48) : - LA3_12 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 12, self.input) - - raise nvae - - elif (LA3_0 == IDENTIFIER) : - LA3_13 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - elif (True) : - alt3 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 13, self.input) - - raise nvae - - elif (LA3_0 == 58) : - LA3_14 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 14, self.input) - - raise nvae - - elif (LA3_0 == 66) and (self.synpred4()): - alt3 = 1 - elif (LA3_0 == 59) : - LA3_16 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 16, self.input) - - raise nvae - - elif (LA3_0 == 60) : - LA3_17 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 17, self.input) - - raise nvae - - elif ((49 <= LA3_0 <= 57) or LA3_0 == 61) : - LA3_18 = self.input.LA(2) - - if (self.synpred4()) : - alt3 = 1 - elif (self.synpred5()) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 18, self.input) - - raise nvae - - elif (LA3_0 == 62) and (self.synpred4()): - alt3 = 1 - elif (LA3_0 == 26) : - alt3 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 0, self.input) - - raise nvae - - if alt3 == 1: - # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition - self.following.append(self.FOLLOW_function_definition_in_external_declaration113) - self.function_definition() - self.following.pop() - if self.failed: - return - - - elif alt3 == 2: - # C.g:120:4: declaration - self.following.append(self.FOLLOW_declaration_in_external_declaration118) - self.declaration() - self.following.pop() - if self.failed: - return - - - elif alt3 == 3: - # C.g:121:4: macro_statement ( ';' )? - self.following.append(self.FOLLOW_macro_statement_in_external_declaration123) - self.macro_statement() - self.following.pop() - if self.failed: - return - # C.g:121:20: ( ';' )? - alt2 = 2 - LA2_0 = self.input.LA(1) - - if (LA2_0 == 25) : - alt2 = 1 - if alt2 == 1: - # C.g:121:21: ';' - self.match(self.input, 25, self.FOLLOW_25_in_external_declaration126) - if self.failed: - return - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 2, external_declaration_StartIndex) - - pass - - return - - # $ANTLR end external_declaration - - class function_definition_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start function_definition - # C.g:126:1: function_definition : (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ; - def function_definition(self, ): - self.function_definition_stack.append(function_definition_scope()) - retval = self.function_definition_return() - retval.start = self.input.LT(1) - function_definition_StartIndex = self.input.index() - d = None - - a = None - - b = None - - declarator1 = None - - + + + + # $ANTLR start translation_unit + # C.g:102:1: translation_unit : ( external_declaration )* ; + def translation_unit(self, ): + + translation_unit_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 1): + return + + # C.g:103:2: ( ( external_declaration )* ) + # C.g:103:4: ( external_declaration )* + # C.g:103:4: ( external_declaration )* + while True: #loop1 + alt1 = 2 + LA1_0 = self.input.LA(1) + + if (LA1_0 == IDENTIFIER or LA1_0 == 26 or (29 <= LA1_0 <= 42) or (45 <= LA1_0 <= 46) or (48 <= LA1_0 <= 62) or LA1_0 == 66) : + alt1 = 1 + + + if alt1 == 1: + # C.g:0:0: external_declaration + self.following.append(self.FOLLOW_external_declaration_in_translation_unit74) + self.external_declaration() + self.following.pop() + if self.failed: + return + + + else: + break #loop1 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 1, translation_unit_StartIndex) + + pass + + return + + # $ANTLR end translation_unit + + + # $ANTLR start external_declaration + # C.g:114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? ); + def external_declaration(self, ): + + external_declaration_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 2): + return + + # C.g:119:2: ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? ) + alt3 = 3 + LA3_0 = self.input.LA(1) + + if ((29 <= LA3_0 <= 33)) : + LA3_1 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 1, self.input) + + raise nvae + + elif (LA3_0 == 34) : + LA3_2 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 2, self.input) + + raise nvae + + elif (LA3_0 == 35) : + LA3_3 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 3, self.input) + + raise nvae + + elif (LA3_0 == 36) : + LA3_4 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 4, self.input) + + raise nvae + + elif (LA3_0 == 37) : + LA3_5 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 5, self.input) + + raise nvae + + elif (LA3_0 == 38) : + LA3_6 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 6, self.input) + + raise nvae + + elif (LA3_0 == 39) : + LA3_7 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 7, self.input) + + raise nvae + + elif (LA3_0 == 40) : + LA3_8 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 8, self.input) + + raise nvae + + elif (LA3_0 == 41) : + LA3_9 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 9, self.input) + + raise nvae + + elif (LA3_0 == 42) : + LA3_10 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 10, self.input) + + raise nvae + + elif ((45 <= LA3_0 <= 46)) : + LA3_11 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 11, self.input) + + raise nvae + + elif (LA3_0 == 48) : + LA3_12 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 12, self.input) + + raise nvae + + elif (LA3_0 == IDENTIFIER) : + LA3_13 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + elif (True) : + alt3 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 13, self.input) + + raise nvae + + elif (LA3_0 == 58) : + LA3_14 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 14, self.input) + + raise nvae + + elif (LA3_0 == 66) and (self.synpred4()): + alt3 = 1 + elif (LA3_0 == 59) : + LA3_16 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 16, self.input) + + raise nvae + + elif (LA3_0 == 60) : + LA3_17 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 17, self.input) + + raise nvae + + elif ((49 <= LA3_0 <= 57) or LA3_0 == 61) : + LA3_18 = self.input.LA(2) + + if (self.synpred4()) : + alt3 = 1 + elif (self.synpred5()) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 18, self.input) + + raise nvae + + elif (LA3_0 == 62) and (self.synpred4()): + alt3 = 1 + elif (LA3_0 == 26) : + alt3 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 0, self.input) + + raise nvae + + if alt3 == 1: + # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition + self.following.append(self.FOLLOW_function_definition_in_external_declaration113) + self.function_definition() + self.following.pop() + if self.failed: + return + + + elif alt3 == 2: + # C.g:120:4: declaration + self.following.append(self.FOLLOW_declaration_in_external_declaration118) + self.declaration() + self.following.pop() + if self.failed: + return + + + elif alt3 == 3: + # C.g:121:4: macro_statement ( ';' )? + self.following.append(self.FOLLOW_macro_statement_in_external_declaration123) + self.macro_statement() + self.following.pop() + if self.failed: + return + # C.g:121:20: ( ';' )? + alt2 = 2 + LA2_0 = self.input.LA(1) + + if (LA2_0 == 25) : + alt2 = 1 + if alt2 == 1: + # C.g:121:21: ';' + self.match(self.input, 25, self.FOLLOW_25_in_external_declaration126) + if self.failed: + return + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 2, external_declaration_StartIndex) + + pass + + return + + # $ANTLR end external_declaration + + class function_definition_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start function_definition + # C.g:126:1: function_definition : (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ; + def function_definition(self, ): + self.function_definition_stack.append(function_definition_scope()) + retval = self.function_definition_return() + retval.start = self.input.LT(1) + function_definition_StartIndex = self.input.index() + d = None + + a = None + + b = None + + declarator1 = None + + self.function_definition_stack[-1].ModifierText = '' self.function_definition_stack[-1].DeclText = '' @@ -582,213 +582,213 @@ class CParser(Parser): self.function_definition_stack[-1].LBOffset = 0 self.function_definition_stack[-1].DeclLine = 0 self.function_definition_stack[-1].DeclOffset = 0 - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 3): - return retval - - # C.g:146:2: ( (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ) - # C.g:146:4: (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) - # C.g:146:5: (d= declaration_specifiers )? - alt4 = 2 - LA4 = self.input.LA(1) - if LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33 or LA4 == 34 or LA4 == 35 or LA4 == 36 or LA4 == 37 or LA4 == 38 or LA4 == 39 or LA4 == 40 or LA4 == 41 or LA4 == 42 or LA4 == 45 or LA4 == 46 or LA4 == 48 or LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61: - alt4 = 1 - elif LA4 == IDENTIFIER: - LA4 = self.input.LA(2) - if LA4 == 66: - alt4 = 1 - elif LA4 == 58: - LA4_21 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 59: - LA4_22 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 60: - LA4_23 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == IDENTIFIER: - LA4_24 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 62: - LA4_25 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33: - LA4_26 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 34: - LA4_27 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 35: - LA4_28 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 36: - LA4_29 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 37: - LA4_30 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 38: - LA4_31 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 39: - LA4_32 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 40: - LA4_33 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 41: - LA4_34 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 42: - LA4_35 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 45 or LA4 == 46: - LA4_36 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 48: - LA4_37 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61: - LA4_38 = self.input.LA(3) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 58: - LA4_14 = self.input.LA(2) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 59: - LA4_16 = self.input.LA(2) - - if (self.synpred7()) : - alt4 = 1 - elif LA4 == 60: - LA4_17 = self.input.LA(2) - - if (self.synpred7()) : - alt4 = 1 - if alt4 == 1: - # C.g:0:0: d= declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_function_definition157) - d = self.declaration_specifiers() - self.following.pop() - if self.failed: - return retval - - - - self.following.append(self.FOLLOW_declarator_in_function_definition160) - declarator1 = self.declarator() - self.following.pop() - if self.failed: - return retval - # C.g:147:3: ( ( declaration )+ a= compound_statement | b= compound_statement ) - alt6 = 2 - LA6_0 = self.input.LA(1) - - if (LA6_0 == IDENTIFIER or LA6_0 == 26 or (29 <= LA6_0 <= 42) or (45 <= LA6_0 <= 46) or (48 <= LA6_0 <= 61)) : - alt6 = 1 - elif (LA6_0 == 43) : - alt6 = 2 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("147:3: ( ( declaration )+ a= compound_statement | b= compound_statement )", 6, 0, self.input) - - raise nvae - - if alt6 == 1: - # C.g:147:5: ( declaration )+ a= compound_statement - # C.g:147:5: ( declaration )+ - cnt5 = 0 - while True: #loop5 - alt5 = 2 - LA5_0 = self.input.LA(1) - - if (LA5_0 == IDENTIFIER or LA5_0 == 26 or (29 <= LA5_0 <= 42) or (45 <= LA5_0 <= 46) or (48 <= LA5_0 <= 61)) : - alt5 = 1 - - - if alt5 == 1: - # C.g:0:0: declaration - self.following.append(self.FOLLOW_declaration_in_function_definition166) - self.declaration() - self.following.pop() - if self.failed: - return retval - - - else: - if cnt5 >= 1: - break #loop5 - - if self.backtracking > 0: - self.failed = True - return retval - - eee = EarlyExitException(5, self.input) - raise eee - - cnt5 += 1 - - - self.following.append(self.FOLLOW_compound_statement_in_function_definition171) - a = self.compound_statement() - self.following.pop() - if self.failed: - return retval - - - elif alt6 == 2: - # C.g:148:5: b= compound_statement - self.following.append(self.FOLLOW_compound_statement_in_function_definition180) - b = self.compound_statement() - self.following.pop() - if self.failed: - return retval - - - - if self.backtracking == 0: + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 3): + return retval + + # C.g:146:2: ( (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ) + # C.g:146:4: (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) + # C.g:146:5: (d= declaration_specifiers )? + alt4 = 2 + LA4 = self.input.LA(1) + if LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33 or LA4 == 34 or LA4 == 35 or LA4 == 36 or LA4 == 37 or LA4 == 38 or LA4 == 39 or LA4 == 40 or LA4 == 41 or LA4 == 42 or LA4 == 45 or LA4 == 46 or LA4 == 48 or LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61: + alt4 = 1 + elif LA4 == IDENTIFIER: + LA4 = self.input.LA(2) + if LA4 == 66: + alt4 = 1 + elif LA4 == 58: + LA4_21 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 59: + LA4_22 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 60: + LA4_23 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == IDENTIFIER: + LA4_24 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 62: + LA4_25 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33: + LA4_26 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 34: + LA4_27 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 35: + LA4_28 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 36: + LA4_29 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 37: + LA4_30 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 38: + LA4_31 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 39: + LA4_32 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 40: + LA4_33 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 41: + LA4_34 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 42: + LA4_35 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 45 or LA4 == 46: + LA4_36 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 48: + LA4_37 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61: + LA4_38 = self.input.LA(3) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 58: + LA4_14 = self.input.LA(2) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 59: + LA4_16 = self.input.LA(2) + + if (self.synpred7()) : + alt4 = 1 + elif LA4 == 60: + LA4_17 = self.input.LA(2) + + if (self.synpred7()) : + alt4 = 1 + if alt4 == 1: + # C.g:0:0: d= declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_function_definition157) + d = self.declaration_specifiers() + self.following.pop() + if self.failed: + return retval + + + + self.following.append(self.FOLLOW_declarator_in_function_definition160) + declarator1 = self.declarator() + self.following.pop() + if self.failed: + return retval + # C.g:147:3: ( ( declaration )+ a= compound_statement | b= compound_statement ) + alt6 = 2 + LA6_0 = self.input.LA(1) + + if (LA6_0 == IDENTIFIER or LA6_0 == 26 or (29 <= LA6_0 <= 42) or (45 <= LA6_0 <= 46) or (48 <= LA6_0 <= 61)) : + alt6 = 1 + elif (LA6_0 == 43) : + alt6 = 2 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("147:3: ( ( declaration )+ a= compound_statement | b= compound_statement )", 6, 0, self.input) + + raise nvae + + if alt6 == 1: + # C.g:147:5: ( declaration )+ a= compound_statement + # C.g:147:5: ( declaration )+ + cnt5 = 0 + while True: #loop5 + alt5 = 2 + LA5_0 = self.input.LA(1) + + if (LA5_0 == IDENTIFIER or LA5_0 == 26 or (29 <= LA5_0 <= 42) or (45 <= LA5_0 <= 46) or (48 <= LA5_0 <= 61)) : + alt5 = 1 + + + if alt5 == 1: + # C.g:0:0: declaration + self.following.append(self.FOLLOW_declaration_in_function_definition166) + self.declaration() + self.following.pop() + if self.failed: + return retval + + + else: + if cnt5 >= 1: + break #loop5 + + if self.backtracking > 0: + self.failed = True + return retval + + eee = EarlyExitException(5, self.input) + raise eee + + cnt5 += 1 + + + self.following.append(self.FOLLOW_compound_statement_in_function_definition171) + a = self.compound_statement() + self.following.pop() + if self.failed: + return retval + + + elif alt6 == 2: + # C.g:148:5: b= compound_statement + self.following.append(self.FOLLOW_compound_statement_in_function_definition180) + b = self.compound_statement() + self.following.pop() + if self.failed: + return retval + + + + if self.backtracking == 0: if d != None: self.function_definition_stack[-1].ModifierText = self.input.toString(d.start,d.stop) @@ -803,18042 +803,18042 @@ class CParser(Parser): else: self.function_definition_stack[-1].LBLine = b.start.line self.function_definition_stack[-1].LBOffset = b.start.charPositionInLine - - - - - - retval.stop = self.input.LT(-1) - - if self.backtracking == 0: + + + + + + retval.stop = self.input.LT(-1) + + if self.backtracking == 0: self.StoreFunctionDefinition(retval.start.line, retval.start.charPositionInLine, retval.stop.line, retval.stop.charPositionInLine, self.function_definition_stack[-1].ModifierText, self.function_definition_stack[-1].DeclText, self.function_definition_stack[-1].LBLine, self.function_definition_stack[-1].LBOffset, self.function_definition_stack[-1].DeclLine, self.function_definition_stack[-1].DeclOffset) - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 3, function_definition_StartIndex) - - self.function_definition_stack.pop() - pass - - return retval - - # $ANTLR end function_definition - - - # $ANTLR start declaration - # C.g:166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' ); - def declaration(self, ): - - declaration_StartIndex = self.input.index() - a = None - d = None - e = None - b = None - - c = None - - s = None - - t = None - - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 4): - return - - # C.g:167:2: (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' ) - alt9 = 2 - LA9_0 = self.input.LA(1) - - if (LA9_0 == 26) : - alt9 = 1 - elif (LA9_0 == IDENTIFIER or (29 <= LA9_0 <= 42) or (45 <= LA9_0 <= 46) or (48 <= LA9_0 <= 61)) : - alt9 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' );", 9, 0, self.input) - - raise nvae - - if alt9 == 1: - # C.g:167:4: a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' - a = self.input.LT(1) - self.match(self.input, 26, self.FOLLOW_26_in_declaration203) - if self.failed: - return - # C.g:167:17: (b= declaration_specifiers )? - alt7 = 2 - LA7 = self.input.LA(1) - if LA7 == 29 or LA7 == 30 or LA7 == 31 or LA7 == 32 or LA7 == 33 or LA7 == 34 or LA7 == 35 or LA7 == 36 or LA7 == 37 or LA7 == 38 or LA7 == 39 or LA7 == 40 or LA7 == 41 or LA7 == 42 or LA7 == 45 or LA7 == 46 or LA7 == 48 or LA7 == 49 or LA7 == 50 or LA7 == 51 or LA7 == 52 or LA7 == 53 or LA7 == 54 or LA7 == 55 or LA7 == 56 or LA7 == 57 or LA7 == 61: - alt7 = 1 - elif LA7 == IDENTIFIER: - LA7_13 = self.input.LA(2) - - if (LA7_13 == 62) : - LA7_21 = self.input.LA(3) - - if (self.synpred10()) : - alt7 = 1 - elif (LA7_13 == IDENTIFIER or (29 <= LA7_13 <= 42) or (45 <= LA7_13 <= 46) or (48 <= LA7_13 <= 61) or LA7_13 == 66) : - alt7 = 1 - elif LA7 == 58: - LA7_14 = self.input.LA(2) - - if (self.synpred10()) : - alt7 = 1 - elif LA7 == 59: - LA7_16 = self.input.LA(2) - - if (self.synpred10()) : - alt7 = 1 - elif LA7 == 60: - LA7_17 = self.input.LA(2) - - if (self.synpred10()) : - alt7 = 1 - if alt7 == 1: - # C.g:0:0: b= declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_declaration207) - b = self.declaration_specifiers() - self.following.pop() - if self.failed: - return - - - - self.following.append(self.FOLLOW_init_declarator_list_in_declaration216) - c = self.init_declarator_list() - self.following.pop() - if self.failed: - return - d = self.input.LT(1) - self.match(self.input, 25, self.FOLLOW_25_in_declaration220) - if self.failed: - return - if self.backtracking == 0: + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 3, function_definition_StartIndex) + + self.function_definition_stack.pop() + pass + + return retval + + # $ANTLR end function_definition + + + # $ANTLR start declaration + # C.g:166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' ); + def declaration(self, ): + + declaration_StartIndex = self.input.index() + a = None + d = None + e = None + b = None + + c = None + + s = None + + t = None + + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 4): + return + + # C.g:167:2: (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' ) + alt9 = 2 + LA9_0 = self.input.LA(1) + + if (LA9_0 == 26) : + alt9 = 1 + elif (LA9_0 == IDENTIFIER or (29 <= LA9_0 <= 42) or (45 <= LA9_0 <= 46) or (48 <= LA9_0 <= 61)) : + alt9 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' );", 9, 0, self.input) + + raise nvae + + if alt9 == 1: + # C.g:167:4: a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' + a = self.input.LT(1) + self.match(self.input, 26, self.FOLLOW_26_in_declaration203) + if self.failed: + return + # C.g:167:17: (b= declaration_specifiers )? + alt7 = 2 + LA7 = self.input.LA(1) + if LA7 == 29 or LA7 == 30 or LA7 == 31 or LA7 == 32 or LA7 == 33 or LA7 == 34 or LA7 == 35 or LA7 == 36 or LA7 == 37 or LA7 == 38 or LA7 == 39 or LA7 == 40 or LA7 == 41 or LA7 == 42 or LA7 == 45 or LA7 == 46 or LA7 == 48 or LA7 == 49 or LA7 == 50 or LA7 == 51 or LA7 == 52 or LA7 == 53 or LA7 == 54 or LA7 == 55 or LA7 == 56 or LA7 == 57 or LA7 == 61: + alt7 = 1 + elif LA7 == IDENTIFIER: + LA7_13 = self.input.LA(2) + + if (LA7_13 == 62) : + LA7_21 = self.input.LA(3) + + if (self.synpred10()) : + alt7 = 1 + elif (LA7_13 == IDENTIFIER or (29 <= LA7_13 <= 42) or (45 <= LA7_13 <= 46) or (48 <= LA7_13 <= 61) or LA7_13 == 66) : + alt7 = 1 + elif LA7 == 58: + LA7_14 = self.input.LA(2) + + if (self.synpred10()) : + alt7 = 1 + elif LA7 == 59: + LA7_16 = self.input.LA(2) + + if (self.synpred10()) : + alt7 = 1 + elif LA7 == 60: + LA7_17 = self.input.LA(2) + + if (self.synpred10()) : + alt7 = 1 + if alt7 == 1: + # C.g:0:0: b= declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_declaration207) + b = self.declaration_specifiers() + self.following.pop() + if self.failed: + return + + + + self.following.append(self.FOLLOW_init_declarator_list_in_declaration216) + c = self.init_declarator_list() + self.following.pop() + if self.failed: + return + d = self.input.LT(1) + self.match(self.input, 25, self.FOLLOW_25_in_declaration220) + if self.failed: + return + if self.backtracking == 0: if b != None: self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, self.input.toString(b.start,b.stop), self.input.toString(c.start,c.stop)) else: self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, '', self.input.toString(c.start,c.stop)) - - - - - elif alt9 == 2: - # C.g:175:4: s= declaration_specifiers (t= init_declarator_list )? e= ';' - self.following.append(self.FOLLOW_declaration_specifiers_in_declaration234) - s = self.declaration_specifiers() - self.following.pop() - if self.failed: - return - # C.g:175:30: (t= init_declarator_list )? - alt8 = 2 - LA8_0 = self.input.LA(1) - - if (LA8_0 == IDENTIFIER or (58 <= LA8_0 <= 60) or LA8_0 == 62 or LA8_0 == 66) : - alt8 = 1 - if alt8 == 1: - # C.g:0:0: t= init_declarator_list - self.following.append(self.FOLLOW_init_declarator_list_in_declaration238) - t = self.init_declarator_list() - self.following.pop() - if self.failed: - return - - - - e = self.input.LT(1) - self.match(self.input, 25, self.FOLLOW_25_in_declaration243) - if self.failed: - return - if self.backtracking == 0: + + + + + elif alt9 == 2: + # C.g:175:4: s= declaration_specifiers (t= init_declarator_list )? e= ';' + self.following.append(self.FOLLOW_declaration_specifiers_in_declaration234) + s = self.declaration_specifiers() + self.following.pop() + if self.failed: + return + # C.g:175:30: (t= init_declarator_list )? + alt8 = 2 + LA8_0 = self.input.LA(1) + + if (LA8_0 == IDENTIFIER or (58 <= LA8_0 <= 60) or LA8_0 == 62 or LA8_0 == 66) : + alt8 = 1 + if alt8 == 1: + # C.g:0:0: t= init_declarator_list + self.following.append(self.FOLLOW_init_declarator_list_in_declaration238) + t = self.init_declarator_list() + self.following.pop() + if self.failed: + return + + + + e = self.input.LT(1) + self.match(self.input, 25, self.FOLLOW_25_in_declaration243) + if self.failed: + return + if self.backtracking == 0: if t != None: self.StoreVariableDeclaration(s.start.line, s.start.charPositionInLine, t.start.line, t.start.charPositionInLine, self.input.toString(s.start,s.stop), self.input.toString(t.start,t.stop)) - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 4, declaration_StartIndex) - - pass - - return - - # $ANTLR end declaration - - class declaration_specifiers_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start declaration_specifiers - # C.g:182:1: declaration_specifiers : ( storage_class_specifier | type_specifier | type_qualifier )+ ; - def declaration_specifiers(self, ): - - retval = self.declaration_specifiers_return() - retval.start = self.input.LT(1) - declaration_specifiers_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 5): - return retval - - # C.g:183:2: ( ( storage_class_specifier | type_specifier | type_qualifier )+ ) - # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+ - # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+ - cnt10 = 0 - while True: #loop10 - alt10 = 4 - LA10 = self.input.LA(1) - if LA10 == 58: - LA10_2 = self.input.LA(2) - - if (self.synpred15()) : - alt10 = 3 - - - elif LA10 == 59: - LA10_3 = self.input.LA(2) - - if (self.synpred15()) : - alt10 = 3 - - - elif LA10 == 60: - LA10_4 = self.input.LA(2) - - if (self.synpred15()) : - alt10 = 3 - - - elif LA10 == IDENTIFIER: - LA10_5 = self.input.LA(2) - - if (self.synpred14()) : - alt10 = 2 - - - elif LA10 == 53: - LA10_9 = self.input.LA(2) - - if (self.synpred15()) : - alt10 = 3 - - - elif LA10 == 29 or LA10 == 30 or LA10 == 31 or LA10 == 32 or LA10 == 33: - alt10 = 1 - elif LA10 == 34 or LA10 == 35 or LA10 == 36 or LA10 == 37 or LA10 == 38 or LA10 == 39 or LA10 == 40 or LA10 == 41 or LA10 == 42 or LA10 == 45 or LA10 == 46 or LA10 == 48: - alt10 = 2 - elif LA10 == 49 or LA10 == 50 or LA10 == 51 or LA10 == 52 or LA10 == 54 or LA10 == 55 or LA10 == 56 or LA10 == 57 or LA10 == 61: - alt10 = 3 - - if alt10 == 1: - # C.g:183:10: storage_class_specifier - self.following.append(self.FOLLOW_storage_class_specifier_in_declaration_specifiers264) - self.storage_class_specifier() - self.following.pop() - if self.failed: - return retval - - - elif alt10 == 2: - # C.g:184:7: type_specifier - self.following.append(self.FOLLOW_type_specifier_in_declaration_specifiers272) - self.type_specifier() - self.following.pop() - if self.failed: - return retval - - - elif alt10 == 3: - # C.g:185:13: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_declaration_specifiers286) - self.type_qualifier() - self.following.pop() - if self.failed: - return retval - - - else: - if cnt10 >= 1: - break #loop10 - - if self.backtracking > 0: - self.failed = True - return retval - - eee = EarlyExitException(10, self.input) - raise eee - - cnt10 += 1 - - - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 5, declaration_specifiers_StartIndex) - - pass - - return retval - - # $ANTLR end declaration_specifiers - - class init_declarator_list_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start init_declarator_list - # C.g:189:1: init_declarator_list : init_declarator ( ',' init_declarator )* ; - def init_declarator_list(self, ): - - retval = self.init_declarator_list_return() - retval.start = self.input.LT(1) - init_declarator_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 6): - return retval - - # C.g:190:2: ( init_declarator ( ',' init_declarator )* ) - # C.g:190:4: init_declarator ( ',' init_declarator )* - self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list308) - self.init_declarator() - self.following.pop() - if self.failed: - return retval - # C.g:190:20: ( ',' init_declarator )* - while True: #loop11 - alt11 = 2 - LA11_0 = self.input.LA(1) - - if (LA11_0 == 27) : - alt11 = 1 - - - if alt11 == 1: - # C.g:190:21: ',' init_declarator - self.match(self.input, 27, self.FOLLOW_27_in_init_declarator_list311) - if self.failed: - return retval - self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list313) - self.init_declarator() - self.following.pop() - if self.failed: - return retval - - - else: - break #loop11 - - - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 6, init_declarator_list_StartIndex) - - pass - - return retval - - # $ANTLR end init_declarator_list - - - # $ANTLR start init_declarator - # C.g:193:1: init_declarator : declarator ( '=' initializer )? ; - def init_declarator(self, ): - - init_declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 7): - return - - # C.g:194:2: ( declarator ( '=' initializer )? ) - # C.g:194:4: declarator ( '=' initializer )? - self.following.append(self.FOLLOW_declarator_in_init_declarator326) - self.declarator() - self.following.pop() - if self.failed: - return - # C.g:194:15: ( '=' initializer )? - alt12 = 2 - LA12_0 = self.input.LA(1) - - if (LA12_0 == 28) : - alt12 = 1 - if alt12 == 1: - # C.g:194:16: '=' initializer - self.match(self.input, 28, self.FOLLOW_28_in_init_declarator329) - if self.failed: - return - self.following.append(self.FOLLOW_initializer_in_init_declarator331) - self.initializer() - self.following.pop() - if self.failed: - return - - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 7, init_declarator_StartIndex) - - pass - - return - - # $ANTLR end init_declarator - - - # $ANTLR start storage_class_specifier - # C.g:197:1: storage_class_specifier : ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' ); - def storage_class_specifier(self, ): - - storage_class_specifier_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 8): - return - - # C.g:198:2: ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' ) - # C.g: - if (29 <= self.input.LA(1) <= 33): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_storage_class_specifier0 - ) - raise mse - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 8, storage_class_specifier_StartIndex) - - pass - - return - - # $ANTLR end storage_class_specifier - - - # $ANTLR start type_specifier - # C.g:205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id ); - def type_specifier(self, ): - - type_specifier_StartIndex = self.input.index() - s = None - - e = None - - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 9): - return - - # C.g:206:2: ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id ) - alt13 = 12 - LA13_0 = self.input.LA(1) - - if (LA13_0 == 34) : - alt13 = 1 - elif (LA13_0 == 35) : - alt13 = 2 - elif (LA13_0 == 36) : - alt13 = 3 - elif (LA13_0 == 37) : - alt13 = 4 - elif (LA13_0 == 38) : - alt13 = 5 - elif (LA13_0 == 39) : - alt13 = 6 - elif (LA13_0 == 40) : - alt13 = 7 - elif (LA13_0 == 41) : - alt13 = 8 - elif (LA13_0 == 42) : - alt13 = 9 - elif ((45 <= LA13_0 <= 46)) : - alt13 = 10 - elif (LA13_0 == 48) : - alt13 = 11 - elif (LA13_0 == IDENTIFIER) and (self.synpred34()): - alt13 = 12 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id );", 13, 0, self.input) - - raise nvae - - if alt13 == 1: - # C.g:206:4: 'void' - self.match(self.input, 34, self.FOLLOW_34_in_type_specifier376) - if self.failed: - return - - - elif alt13 == 2: - # C.g:207:4: 'char' - self.match(self.input, 35, self.FOLLOW_35_in_type_specifier381) - if self.failed: - return - - - elif alt13 == 3: - # C.g:208:4: 'short' - self.match(self.input, 36, self.FOLLOW_36_in_type_specifier386) - if self.failed: - return - - - elif alt13 == 4: - # C.g:209:4: 'int' - self.match(self.input, 37, self.FOLLOW_37_in_type_specifier391) - if self.failed: - return - - - elif alt13 == 5: - # C.g:210:4: 'long' - self.match(self.input, 38, self.FOLLOW_38_in_type_specifier396) - if self.failed: - return - - - elif alt13 == 6: - # C.g:211:4: 'float' - self.match(self.input, 39, self.FOLLOW_39_in_type_specifier401) - if self.failed: - return - - - elif alt13 == 7: - # C.g:212:4: 'double' - self.match(self.input, 40, self.FOLLOW_40_in_type_specifier406) - if self.failed: - return - - - elif alt13 == 8: - # C.g:213:4: 'signed' - self.match(self.input, 41, self.FOLLOW_41_in_type_specifier411) - if self.failed: - return - - - elif alt13 == 9: - # C.g:214:4: 'unsigned' - self.match(self.input, 42, self.FOLLOW_42_in_type_specifier416) - if self.failed: - return - - - elif alt13 == 10: - # C.g:215:4: s= struct_or_union_specifier - self.following.append(self.FOLLOW_struct_or_union_specifier_in_type_specifier423) - s = self.struct_or_union_specifier() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - - if s.stop != None: - self.StoreStructUnionDefinition(s.start.line, s.start.charPositionInLine, s.stop.line, s.stop.charPositionInLine, self.input.toString(s.start,s.stop)) - - - - - elif alt13 == 11: - # C.g:220:4: e= enum_specifier - self.following.append(self.FOLLOW_enum_specifier_in_type_specifier433) - e = self.enum_specifier() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - - if e.stop != None: - self.StoreEnumerationDefinition(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - - - - elif alt13 == 12: - # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator )=> type_id - self.following.append(self.FOLLOW_type_id_in_type_specifier451) - self.type_id() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 9, type_specifier_StartIndex) - - pass - - return - - # $ANTLR end type_specifier - - - # $ANTLR start type_id - # C.g:228:1: type_id : IDENTIFIER ; - def type_id(self, ): - - type_id_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 10): - return - - # C.g:229:5: ( IDENTIFIER ) - # C.g:229:9: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_type_id467) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 10, type_id_StartIndex) - - pass - - return - - # $ANTLR end type_id - - class struct_or_union_specifier_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start struct_or_union_specifier - # C.g:233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER ); - def struct_or_union_specifier(self, ): - - retval = self.struct_or_union_specifier_return() - retval.start = self.input.LT(1) - struct_or_union_specifier_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 11): - return retval - - # C.g:235:2: ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER ) - alt15 = 2 - LA15_0 = self.input.LA(1) - - if ((45 <= LA15_0 <= 46)) : - LA15_1 = self.input.LA(2) - - if (LA15_1 == IDENTIFIER) : - LA15_2 = self.input.LA(3) - - if (LA15_2 == 43) : - alt15 = 1 - elif (LA15_2 == EOF or LA15_2 == IDENTIFIER or LA15_2 == 25 or LA15_2 == 27 or (29 <= LA15_2 <= 42) or (45 <= LA15_2 <= 64) or LA15_2 == 66) : - alt15 = 2 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 2, self.input) - - raise nvae - - elif (LA15_1 == 43) : - alt15 = 1 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 1, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 0, self.input) - - raise nvae - - if alt15 == 1: - # C.g:235:4: struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' - self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier494) - self.struct_or_union() - self.following.pop() - if self.failed: - return retval - # C.g:235:20: ( IDENTIFIER )? - alt14 = 2 - LA14_0 = self.input.LA(1) - - if (LA14_0 == IDENTIFIER) : - alt14 = 1 - if alt14 == 1: - # C.g:0:0: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier496) - if self.failed: - return retval - - - - self.match(self.input, 43, self.FOLLOW_43_in_struct_or_union_specifier499) - if self.failed: - return retval - self.following.append(self.FOLLOW_struct_declaration_list_in_struct_or_union_specifier501) - self.struct_declaration_list() - self.following.pop() - if self.failed: - return retval - self.match(self.input, 44, self.FOLLOW_44_in_struct_or_union_specifier503) - if self.failed: - return retval - - - elif alt15 == 2: - # C.g:236:4: struct_or_union IDENTIFIER - self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier508) - self.struct_or_union() - self.following.pop() - if self.failed: - return retval - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier510) - if self.failed: - return retval - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 11, struct_or_union_specifier_StartIndex) - - pass - - return retval - - # $ANTLR end struct_or_union_specifier - - - # $ANTLR start struct_or_union - # C.g:239:1: struct_or_union : ( 'struct' | 'union' ); - def struct_or_union(self, ): - - struct_or_union_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 12): - return - - # C.g:240:2: ( 'struct' | 'union' ) - # C.g: - if (45 <= self.input.LA(1) <= 46): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_struct_or_union0 - ) - raise mse - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 12, struct_or_union_StartIndex) - - pass - - return - - # $ANTLR end struct_or_union - - - # $ANTLR start struct_declaration_list - # C.g:244:1: struct_declaration_list : ( struct_declaration )+ ; - def struct_declaration_list(self, ): - - struct_declaration_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 13): - return - - # C.g:245:2: ( ( struct_declaration )+ ) - # C.g:245:4: ( struct_declaration )+ - # C.g:245:4: ( struct_declaration )+ - cnt16 = 0 - while True: #loop16 - alt16 = 2 - LA16_0 = self.input.LA(1) - - if (LA16_0 == IDENTIFIER or (34 <= LA16_0 <= 42) or (45 <= LA16_0 <= 46) or (48 <= LA16_0 <= 61)) : - alt16 = 1 - - - if alt16 == 1: - # C.g:0:0: struct_declaration - self.following.append(self.FOLLOW_struct_declaration_in_struct_declaration_list537) - self.struct_declaration() - self.following.pop() - if self.failed: - return - - - else: - if cnt16 >= 1: - break #loop16 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(16, self.input) - raise eee - - cnt16 += 1 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 13, struct_declaration_list_StartIndex) - - pass - - return - - # $ANTLR end struct_declaration_list - - - # $ANTLR start struct_declaration - # C.g:248:1: struct_declaration : specifier_qualifier_list struct_declarator_list ';' ; - def struct_declaration(self, ): - - struct_declaration_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 14): - return - - # C.g:249:2: ( specifier_qualifier_list struct_declarator_list ';' ) - # C.g:249:4: specifier_qualifier_list struct_declarator_list ';' - self.following.append(self.FOLLOW_specifier_qualifier_list_in_struct_declaration549) - self.specifier_qualifier_list() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_struct_declarator_list_in_struct_declaration551) - self.struct_declarator_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_struct_declaration553) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 14, struct_declaration_StartIndex) - - pass - - return - - # $ANTLR end struct_declaration - - - # $ANTLR start specifier_qualifier_list - # C.g:252:1: specifier_qualifier_list : ( type_qualifier | type_specifier )+ ; - def specifier_qualifier_list(self, ): - - specifier_qualifier_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 15): - return - - # C.g:253:2: ( ( type_qualifier | type_specifier )+ ) - # C.g:253:4: ( type_qualifier | type_specifier )+ - # C.g:253:4: ( type_qualifier | type_specifier )+ - cnt17 = 0 - while True: #loop17 - alt17 = 3 - LA17 = self.input.LA(1) - if LA17 == 58: - LA17_2 = self.input.LA(2) - - if (self.synpred39()) : - alt17 = 1 - - - elif LA17 == 59: - LA17_3 = self.input.LA(2) - - if (self.synpred39()) : - alt17 = 1 - - - elif LA17 == 60: - LA17_4 = self.input.LA(2) - - if (self.synpred39()) : - alt17 = 1 - - - elif LA17 == IDENTIFIER: - LA17 = self.input.LA(2) - if LA17 == EOF or LA17 == IDENTIFIER or LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48 or LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 58 or LA17 == 59 or LA17 == 60 or LA17 == 61 or LA17 == 63 or LA17 == 66: - alt17 = 2 - elif LA17 == 62: - LA17_94 = self.input.LA(3) - - if (self.synpred40()) : - alt17 = 2 - - - elif LA17 == 47: - LA17_95 = self.input.LA(3) - - if (self.synpred40()) : - alt17 = 2 - - - elif LA17 == 64: - LA17_96 = self.input.LA(3) - - if (self.synpred40()) : - alt17 = 2 - - - - elif LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 61: - alt17 = 1 - elif LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48: - alt17 = 2 - - if alt17 == 1: - # C.g:253:6: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_specifier_qualifier_list566) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - elif alt17 == 2: - # C.g:253:23: type_specifier - self.following.append(self.FOLLOW_type_specifier_in_specifier_qualifier_list570) - self.type_specifier() - self.following.pop() - if self.failed: - return - - - else: - if cnt17 >= 1: - break #loop17 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(17, self.input) - raise eee - - cnt17 += 1 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 15, specifier_qualifier_list_StartIndex) - - pass - - return - - # $ANTLR end specifier_qualifier_list - - - # $ANTLR start struct_declarator_list - # C.g:256:1: struct_declarator_list : struct_declarator ( ',' struct_declarator )* ; - def struct_declarator_list(self, ): - - struct_declarator_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 16): - return - - # C.g:257:2: ( struct_declarator ( ',' struct_declarator )* ) - # C.g:257:4: struct_declarator ( ',' struct_declarator )* - self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list584) - self.struct_declarator() - self.following.pop() - if self.failed: - return - # C.g:257:22: ( ',' struct_declarator )* - while True: #loop18 - alt18 = 2 - LA18_0 = self.input.LA(1) - - if (LA18_0 == 27) : - alt18 = 1 - - - if alt18 == 1: - # C.g:257:23: ',' struct_declarator - self.match(self.input, 27, self.FOLLOW_27_in_struct_declarator_list587) - if self.failed: - return - self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list589) - self.struct_declarator() - self.following.pop() - if self.failed: - return - - - else: - break #loop18 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 16, struct_declarator_list_StartIndex) - - pass - - return - - # $ANTLR end struct_declarator_list - - - # $ANTLR start struct_declarator - # C.g:260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression ); - def struct_declarator(self, ): - - struct_declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 17): - return - - # C.g:261:2: ( declarator ( ':' constant_expression )? | ':' constant_expression ) - alt20 = 2 - LA20_0 = self.input.LA(1) - - if (LA20_0 == IDENTIFIER or (58 <= LA20_0 <= 60) or LA20_0 == 62 or LA20_0 == 66) : - alt20 = 1 - elif (LA20_0 == 47) : - alt20 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression );", 20, 0, self.input) - - raise nvae - - if alt20 == 1: - # C.g:261:4: declarator ( ':' constant_expression )? - self.following.append(self.FOLLOW_declarator_in_struct_declarator602) - self.declarator() - self.following.pop() - if self.failed: - return - # C.g:261:15: ( ':' constant_expression )? - alt19 = 2 - LA19_0 = self.input.LA(1) - - if (LA19_0 == 47) : - alt19 = 1 - if alt19 == 1: - # C.g:261:16: ':' constant_expression - self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator605) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_struct_declarator607) - self.constant_expression() - self.following.pop() - if self.failed: - return - - - - - - elif alt20 == 2: - # C.g:262:4: ':' constant_expression - self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator614) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_struct_declarator616) - self.constant_expression() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 17, struct_declarator_StartIndex) - - pass - - return - - # $ANTLR end struct_declarator - - class enum_specifier_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start enum_specifier - # C.g:265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER ); - def enum_specifier(self, ): - - retval = self.enum_specifier_return() - retval.start = self.input.LT(1) - enum_specifier_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 18): - return retval - - # C.g:267:2: ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER ) - alt23 = 3 - LA23_0 = self.input.LA(1) - - if (LA23_0 == 48) : - LA23_1 = self.input.LA(2) - - if (LA23_1 == IDENTIFIER) : - LA23_2 = self.input.LA(3) - - if (LA23_2 == 43) : - alt23 = 2 - elif (LA23_2 == EOF or LA23_2 == IDENTIFIER or LA23_2 == 25 or LA23_2 == 27 or (29 <= LA23_2 <= 42) or (45 <= LA23_2 <= 64) or LA23_2 == 66) : - alt23 = 3 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 2, self.input) - - raise nvae - - elif (LA23_1 == 43) : - alt23 = 1 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 1, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 0, self.input) - - raise nvae - - if alt23 == 1: - # C.g:267:4: 'enum' '{' enumerator_list ( ',' )? '}' - self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier634) - if self.failed: - return retval - self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier636) - if self.failed: - return retval - self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier638) - self.enumerator_list() - self.following.pop() - if self.failed: - return retval - # C.g:267:31: ( ',' )? - alt21 = 2 - LA21_0 = self.input.LA(1) - - if (LA21_0 == 27) : - alt21 = 1 - if alt21 == 1: - # C.g:0:0: ',' - self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier640) - if self.failed: - return retval - - - - self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier643) - if self.failed: - return retval - - - elif alt23 == 2: - # C.g:268:4: 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' - self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier648) - if self.failed: - return retval - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier650) - if self.failed: - return retval - self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier652) - if self.failed: - return retval - self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier654) - self.enumerator_list() - self.following.pop() - if self.failed: - return retval - # C.g:268:42: ( ',' )? - alt22 = 2 - LA22_0 = self.input.LA(1) - - if (LA22_0 == 27) : - alt22 = 1 - if alt22 == 1: - # C.g:0:0: ',' - self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier656) - if self.failed: - return retval - - - - self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier659) - if self.failed: - return retval - - - elif alt23 == 3: - # C.g:269:4: 'enum' IDENTIFIER - self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier664) - if self.failed: - return retval - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier666) - if self.failed: - return retval - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 18, enum_specifier_StartIndex) - - pass - - return retval - - # $ANTLR end enum_specifier - - - # $ANTLR start enumerator_list - # C.g:272:1: enumerator_list : enumerator ( ',' enumerator )* ; - def enumerator_list(self, ): - - enumerator_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 19): - return - - # C.g:273:2: ( enumerator ( ',' enumerator )* ) - # C.g:273:4: enumerator ( ',' enumerator )* - self.following.append(self.FOLLOW_enumerator_in_enumerator_list677) - self.enumerator() - self.following.pop() - if self.failed: - return - # C.g:273:15: ( ',' enumerator )* - while True: #loop24 - alt24 = 2 - LA24_0 = self.input.LA(1) - - if (LA24_0 == 27) : - LA24_1 = self.input.LA(2) - - if (LA24_1 == IDENTIFIER) : - alt24 = 1 - - - - - if alt24 == 1: - # C.g:273:16: ',' enumerator - self.match(self.input, 27, self.FOLLOW_27_in_enumerator_list680) - if self.failed: - return - self.following.append(self.FOLLOW_enumerator_in_enumerator_list682) - self.enumerator() - self.following.pop() - if self.failed: - return - - - else: - break #loop24 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 19, enumerator_list_StartIndex) - - pass - - return - - # $ANTLR end enumerator_list - - - # $ANTLR start enumerator - # C.g:276:1: enumerator : IDENTIFIER ( '=' constant_expression )? ; - def enumerator(self, ): - - enumerator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 20): - return - - # C.g:277:2: ( IDENTIFIER ( '=' constant_expression )? ) - # C.g:277:4: IDENTIFIER ( '=' constant_expression )? - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enumerator695) - if self.failed: - return - # C.g:277:15: ( '=' constant_expression )? - alt25 = 2 - LA25_0 = self.input.LA(1) - - if (LA25_0 == 28) : - alt25 = 1 - if alt25 == 1: - # C.g:277:16: '=' constant_expression - self.match(self.input, 28, self.FOLLOW_28_in_enumerator698) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_enumerator700) - self.constant_expression() - self.following.pop() - if self.failed: - return - - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 20, enumerator_StartIndex) - - pass - - return - - # $ANTLR end enumerator - - - # $ANTLR start type_qualifier - # C.g:280:1: type_qualifier : ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' ); - def type_qualifier(self, ): - - type_qualifier_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 21): - return - - # C.g:281:2: ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' ) - # C.g: - if (49 <= self.input.LA(1) <= 61): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_type_qualifier0 - ) - raise mse - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 21, type_qualifier_StartIndex) - - pass - - return - - # $ANTLR end type_qualifier - - class declarator_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start declarator - # C.g:296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer ); - def declarator(self, ): - - retval = self.declarator_return() - retval.start = self.input.LT(1) - declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 22): - return retval - - # C.g:297:2: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer ) - alt30 = 2 - LA30_0 = self.input.LA(1) - - if (LA30_0 == 66) : - LA30_1 = self.input.LA(2) - - if (self.synpred66()) : - alt30 = 1 - elif (True) : - alt30 = 2 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 1, self.input) - - raise nvae - - elif (LA30_0 == IDENTIFIER or (58 <= LA30_0 <= 60) or LA30_0 == 62) : - alt30 = 1 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 0, self.input) - - raise nvae - - if alt30 == 1: - # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator - # C.g:297:4: ( pointer )? - alt26 = 2 - LA26_0 = self.input.LA(1) - - if (LA26_0 == 66) : - alt26 = 1 - if alt26 == 1: - # C.g:0:0: pointer - self.following.append(self.FOLLOW_pointer_in_declarator784) - self.pointer() - self.following.pop() - if self.failed: - return retval - - - - # C.g:297:13: ( 'EFIAPI' )? - alt27 = 2 - LA27_0 = self.input.LA(1) - - if (LA27_0 == 58) : - alt27 = 1 - if alt27 == 1: - # C.g:297:14: 'EFIAPI' - self.match(self.input, 58, self.FOLLOW_58_in_declarator788) - if self.failed: - return retval - - - - # C.g:297:25: ( 'EFI_BOOTSERVICE' )? - alt28 = 2 - LA28_0 = self.input.LA(1) - - if (LA28_0 == 59) : - alt28 = 1 - if alt28 == 1: - # C.g:297:26: 'EFI_BOOTSERVICE' - self.match(self.input, 59, self.FOLLOW_59_in_declarator793) - if self.failed: - return retval - - - - # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )? - alt29 = 2 - LA29_0 = self.input.LA(1) - - if (LA29_0 == 60) : - alt29 = 1 - if alt29 == 1: - # C.g:297:47: 'EFI_RUNTIMESERVICE' - self.match(self.input, 60, self.FOLLOW_60_in_declarator798) - if self.failed: - return retval - - - - self.following.append(self.FOLLOW_direct_declarator_in_declarator802) - self.direct_declarator() - self.following.pop() - if self.failed: - return retval - - - elif alt30 == 2: - # C.g:299:4: pointer - self.following.append(self.FOLLOW_pointer_in_declarator808) - self.pointer() - self.following.pop() - if self.failed: - return retval - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 22, declarator_StartIndex) - - pass - - return retval - - # $ANTLR end declarator - - - # $ANTLR start direct_declarator - # C.g:302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ ); - def direct_declarator(self, ): - - direct_declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 23): - return - - # C.g:303:2: ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ ) - alt34 = 2 - LA34_0 = self.input.LA(1) - - if (LA34_0 == IDENTIFIER) : - alt34 = 1 - elif (LA34_0 == 62) : - alt34 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ );", 34, 0, self.input) - - raise nvae - - if alt34 == 1: - # C.g:303:4: IDENTIFIER ( declarator_suffix )* - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_direct_declarator819) - if self.failed: - return - # C.g:303:15: ( declarator_suffix )* - while True: #loop31 - alt31 = 2 - LA31_0 = self.input.LA(1) - - if (LA31_0 == 62) : - LA31 = self.input.LA(2) - if LA31 == 63: - LA31_30 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 58: - LA31_31 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 66: - LA31_32 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 59: - LA31_33 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 60: - LA31_34 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == IDENTIFIER: - LA31_35 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 29 or LA31 == 30 or LA31 == 31 or LA31 == 32 or LA31 == 33: - LA31_37 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 34: - LA31_38 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 35: - LA31_39 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 36: - LA31_40 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 37: - LA31_41 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 38: - LA31_42 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 39: - LA31_43 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 40: - LA31_44 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 41: - LA31_45 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 42: - LA31_46 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 45 or LA31 == 46: - LA31_47 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 48: - LA31_48 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 49 or LA31 == 50 or LA31 == 51 or LA31 == 52 or LA31 == 53 or LA31 == 54 or LA31 == 55 or LA31 == 56 or LA31 == 57 or LA31 == 61: - LA31_49 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - - elif (LA31_0 == 64) : - LA31 = self.input.LA(2) - if LA31 == 65: - LA31_51 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 62: - LA31_52 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == IDENTIFIER: - LA31_53 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == HEX_LITERAL: - LA31_54 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == OCTAL_LITERAL: - LA31_55 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == DECIMAL_LITERAL: - LA31_56 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == CHARACTER_LITERAL: - LA31_57 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == STRING_LITERAL: - LA31_58 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == FLOATING_POINT_LITERAL: - LA31_59 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 72: - LA31_60 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 73: - LA31_61 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 66 or LA31 == 68 or LA31 == 69 or LA31 == 77 or LA31 == 78 or LA31 == 79: - LA31_62 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - elif LA31 == 74: - LA31_63 = self.input.LA(3) - - if (self.synpred67()) : - alt31 = 1 - - - - - - if alt31 == 1: - # C.g:0:0: declarator_suffix - self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator821) - self.declarator_suffix() - self.following.pop() - if self.failed: - return - - - else: - break #loop31 - - - - - elif alt34 == 2: - # C.g:304:4: '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ - self.match(self.input, 62, self.FOLLOW_62_in_direct_declarator827) - if self.failed: - return - # C.g:304:8: ( 'EFIAPI' )? - alt32 = 2 - LA32_0 = self.input.LA(1) - - if (LA32_0 == 58) : - LA32_1 = self.input.LA(2) - - if (self.synpred69()) : - alt32 = 1 - if alt32 == 1: - # C.g:304:9: 'EFIAPI' - self.match(self.input, 58, self.FOLLOW_58_in_direct_declarator830) - if self.failed: - return - - - - self.following.append(self.FOLLOW_declarator_in_direct_declarator834) - self.declarator() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_direct_declarator836) - if self.failed: - return - # C.g:304:35: ( declarator_suffix )+ - cnt33 = 0 - while True: #loop33 - alt33 = 2 - LA33_0 = self.input.LA(1) - - if (LA33_0 == 62) : - LA33 = self.input.LA(2) - if LA33 == 63: - LA33_30 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 58: - LA33_31 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 66: - LA33_32 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 59: - LA33_33 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 60: - LA33_34 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == IDENTIFIER: - LA33_35 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 29 or LA33 == 30 or LA33 == 31 or LA33 == 32 or LA33 == 33: - LA33_37 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 34: - LA33_38 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 35: - LA33_39 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 36: - LA33_40 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 37: - LA33_41 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 38: - LA33_42 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 39: - LA33_43 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 40: - LA33_44 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 41: - LA33_45 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 42: - LA33_46 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 45 or LA33 == 46: - LA33_47 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 48: - LA33_48 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 49 or LA33 == 50 or LA33 == 51 or LA33 == 52 or LA33 == 53 or LA33 == 54 or LA33 == 55 or LA33 == 56 or LA33 == 57 or LA33 == 61: - LA33_49 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - - elif (LA33_0 == 64) : - LA33 = self.input.LA(2) - if LA33 == 65: - LA33_51 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 62: - LA33_52 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == IDENTIFIER: - LA33_53 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == HEX_LITERAL: - LA33_54 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == OCTAL_LITERAL: - LA33_55 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == DECIMAL_LITERAL: - LA33_56 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == CHARACTER_LITERAL: - LA33_57 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == STRING_LITERAL: - LA33_58 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == FLOATING_POINT_LITERAL: - LA33_59 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 72: - LA33_60 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 73: - LA33_61 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 66 or LA33 == 68 or LA33 == 69 or LA33 == 77 or LA33 == 78 or LA33 == 79: - LA33_62 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - elif LA33 == 74: - LA33_63 = self.input.LA(3) - - if (self.synpred70()) : - alt33 = 1 - - - - - - if alt33 == 1: - # C.g:0:0: declarator_suffix - self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator838) - self.declarator_suffix() - self.following.pop() - if self.failed: - return - - - else: - if cnt33 >= 1: - break #loop33 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(33, self.input) - raise eee - - cnt33 += 1 - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 23, direct_declarator_StartIndex) - - pass - - return - - # $ANTLR end direct_declarator - - - # $ANTLR start declarator_suffix - # C.g:307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' ); - def declarator_suffix(self, ): - - declarator_suffix_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 24): - return - - # C.g:308:2: ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' ) - alt35 = 5 - LA35_0 = self.input.LA(1) - - if (LA35_0 == 64) : - LA35_1 = self.input.LA(2) - - if (LA35_1 == 65) : - alt35 = 2 - elif ((IDENTIFIER <= LA35_1 <= FLOATING_POINT_LITERAL) or LA35_1 == 62 or LA35_1 == 66 or (68 <= LA35_1 <= 69) or (72 <= LA35_1 <= 74) or (77 <= LA35_1 <= 79)) : - alt35 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 1, self.input) - - raise nvae - - elif (LA35_0 == 62) : - LA35 = self.input.LA(2) - if LA35 == 63: - alt35 = 5 - elif LA35 == 29 or LA35 == 30 or LA35 == 31 or LA35 == 32 or LA35 == 33 or LA35 == 34 or LA35 == 35 or LA35 == 36 or LA35 == 37 or LA35 == 38 or LA35 == 39 or LA35 == 40 or LA35 == 41 or LA35 == 42 or LA35 == 45 or LA35 == 46 or LA35 == 48 or LA35 == 49 or LA35 == 50 or LA35 == 51 or LA35 == 52 or LA35 == 53 or LA35 == 54 or LA35 == 55 or LA35 == 56 or LA35 == 57 or LA35 == 58 or LA35 == 59 or LA35 == 60 or LA35 == 61 or LA35 == 66: - alt35 = 3 - elif LA35 == IDENTIFIER: - LA35_29 = self.input.LA(3) - - if (self.synpred73()) : - alt35 = 3 - elif (self.synpred74()) : - alt35 = 4 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 29, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 2, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 0, self.input) - - raise nvae - - if alt35 == 1: - # C.g:308:6: '[' constant_expression ']' - self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix852) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_declarator_suffix854) - self.constant_expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix856) - if self.failed: - return - - - elif alt35 == 2: - # C.g:309:9: '[' ']' - self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix866) - if self.failed: - return - self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix868) - if self.failed: - return - - - elif alt35 == 3: - # C.g:310:9: '(' parameter_type_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix878) - if self.failed: - return - self.following.append(self.FOLLOW_parameter_type_list_in_declarator_suffix880) - self.parameter_type_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix882) - if self.failed: - return - - - elif alt35 == 4: - # C.g:311:9: '(' identifier_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix892) - if self.failed: - return - self.following.append(self.FOLLOW_identifier_list_in_declarator_suffix894) - self.identifier_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix896) - if self.failed: - return - - - elif alt35 == 5: - # C.g:312:9: '(' ')' - self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix906) - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix908) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 24, declarator_suffix_StartIndex) - - pass - - return - - # $ANTLR end declarator_suffix - - - # $ANTLR start pointer - # C.g:315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' ); - def pointer(self, ): - - pointer_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 25): - return - - # C.g:316:2: ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' ) - alt38 = 3 - LA38_0 = self.input.LA(1) - - if (LA38_0 == 66) : - LA38 = self.input.LA(2) - if LA38 == 66: - LA38_2 = self.input.LA(3) - - if (self.synpred78()) : - alt38 = 2 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 2, self.input) - - raise nvae - - elif LA38 == 58: - LA38_3 = self.input.LA(3) - - if (self.synpred77()) : - alt38 = 1 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 3, self.input) - - raise nvae - - elif LA38 == 59: - LA38_4 = self.input.LA(3) - - if (self.synpred77()) : - alt38 = 1 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 4, self.input) - - raise nvae - - elif LA38 == 60: - LA38_5 = self.input.LA(3) - - if (self.synpred77()) : - alt38 = 1 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 5, self.input) - - raise nvae - - elif LA38 == EOF or LA38 == IDENTIFIER or LA38 == 25 or LA38 == 26 or LA38 == 27 or LA38 == 28 or LA38 == 29 or LA38 == 30 or LA38 == 31 or LA38 == 32 or LA38 == 33 or LA38 == 34 or LA38 == 35 or LA38 == 36 or LA38 == 37 or LA38 == 38 or LA38 == 39 or LA38 == 40 or LA38 == 41 or LA38 == 42 or LA38 == 43 or LA38 == 45 or LA38 == 46 or LA38 == 47 or LA38 == 48 or LA38 == 62 or LA38 == 63 or LA38 == 64: - alt38 = 3 - elif LA38 == 53: - LA38_21 = self.input.LA(3) - - if (self.synpred77()) : - alt38 = 1 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 21, self.input) - - raise nvae - - elif LA38 == 49 or LA38 == 50 or LA38 == 51 or LA38 == 52 or LA38 == 54 or LA38 == 55 or LA38 == 56 or LA38 == 57 or LA38 == 61: - LA38_29 = self.input.LA(3) - - if (self.synpred77()) : - alt38 = 1 - elif (True) : - alt38 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 29, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 1, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 0, self.input) - - raise nvae - - if alt38 == 1: - # C.g:316:4: '*' ( type_qualifier )+ ( pointer )? - self.match(self.input, 66, self.FOLLOW_66_in_pointer919) - if self.failed: - return - # C.g:316:8: ( type_qualifier )+ - cnt36 = 0 - while True: #loop36 - alt36 = 2 - LA36 = self.input.LA(1) - if LA36 == 58: - LA36_2 = self.input.LA(2) - - if (self.synpred75()) : - alt36 = 1 - - - elif LA36 == 59: - LA36_3 = self.input.LA(2) - - if (self.synpred75()) : - alt36 = 1 - - - elif LA36 == 60: - LA36_4 = self.input.LA(2) - - if (self.synpred75()) : - alt36 = 1 - - - elif LA36 == 53: - LA36_20 = self.input.LA(2) - - if (self.synpred75()) : - alt36 = 1 - - - elif LA36 == 49 or LA36 == 50 or LA36 == 51 or LA36 == 52 or LA36 == 54 or LA36 == 55 or LA36 == 56 or LA36 == 57 or LA36 == 61: - LA36_28 = self.input.LA(2) - - if (self.synpred75()) : - alt36 = 1 - - - - if alt36 == 1: - # C.g:0:0: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_pointer921) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - else: - if cnt36 >= 1: - break #loop36 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(36, self.input) - raise eee - - cnt36 += 1 - - - # C.g:316:24: ( pointer )? - alt37 = 2 - LA37_0 = self.input.LA(1) - - if (LA37_0 == 66) : - LA37_1 = self.input.LA(2) - - if (self.synpred76()) : - alt37 = 1 - if alt37 == 1: - # C.g:0:0: pointer - self.following.append(self.FOLLOW_pointer_in_pointer924) - self.pointer() - self.following.pop() - if self.failed: - return - - - - - - elif alt38 == 2: - # C.g:317:4: '*' pointer - self.match(self.input, 66, self.FOLLOW_66_in_pointer930) - if self.failed: - return - self.following.append(self.FOLLOW_pointer_in_pointer932) - self.pointer() - self.following.pop() - if self.failed: - return - - - elif alt38 == 3: - # C.g:318:4: '*' - self.match(self.input, 66, self.FOLLOW_66_in_pointer937) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 25, pointer_StartIndex) - - pass - - return - - # $ANTLR end pointer - - - # $ANTLR start parameter_type_list - # C.g:321:1: parameter_type_list : parameter_list ( ',' ( 'OPTIONAL' )? '...' )? ; - def parameter_type_list(self, ): - - parameter_type_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 26): - return - - # C.g:322:2: ( parameter_list ( ',' ( 'OPTIONAL' )? '...' )? ) - # C.g:322:4: parameter_list ( ',' ( 'OPTIONAL' )? '...' )? - self.following.append(self.FOLLOW_parameter_list_in_parameter_type_list948) - self.parameter_list() - self.following.pop() - if self.failed: - return - # C.g:322:19: ( ',' ( 'OPTIONAL' )? '...' )? - alt40 = 2 - LA40_0 = self.input.LA(1) - - if (LA40_0 == 27) : - alt40 = 1 - if alt40 == 1: - # C.g:322:20: ',' ( 'OPTIONAL' )? '...' - self.match(self.input, 27, self.FOLLOW_27_in_parameter_type_list951) - if self.failed: - return - # C.g:322:24: ( 'OPTIONAL' )? - alt39 = 2 - LA39_0 = self.input.LA(1) - - if (LA39_0 == 53) : - alt39 = 1 - if alt39 == 1: - # C.g:322:25: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_parameter_type_list954) - if self.failed: - return - - - - self.match(self.input, 67, self.FOLLOW_67_in_parameter_type_list958) - if self.failed: - return - - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 26, parameter_type_list_StartIndex) - - pass - - return - - # $ANTLR end parameter_type_list - - - # $ANTLR start parameter_list - # C.g:325:1: parameter_list : parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* ; - def parameter_list(self, ): - - parameter_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 27): - return - - # C.g:326:2: ( parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* ) - # C.g:326:4: parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* - self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list971) - self.parameter_declaration() - self.following.pop() - if self.failed: - return - # C.g:326:26: ( ',' ( 'OPTIONAL' )? parameter_declaration )* - while True: #loop42 - alt42 = 2 - LA42_0 = self.input.LA(1) - - if (LA42_0 == 27) : - LA42_1 = self.input.LA(2) - - if (LA42_1 == 53) : - LA42_3 = self.input.LA(3) - - if (self.synpred82()) : - alt42 = 1 - - - elif (LA42_1 == IDENTIFIER or (29 <= LA42_1 <= 42) or (45 <= LA42_1 <= 46) or (48 <= LA42_1 <= 52) or (54 <= LA42_1 <= 61) or LA42_1 == 66) : - alt42 = 1 - - - - - if alt42 == 1: - # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration - self.match(self.input, 27, self.FOLLOW_27_in_parameter_list974) - if self.failed: - return - # C.g:326:31: ( 'OPTIONAL' )? - alt41 = 2 - LA41_0 = self.input.LA(1) - - if (LA41_0 == 53) : - LA41_1 = self.input.LA(2) - - if (self.synpred81()) : - alt41 = 1 - if alt41 == 1: - # C.g:326:32: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_parameter_list977) - if self.failed: - return - - - - self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list981) - self.parameter_declaration() - self.following.pop() - if self.failed: - return - - - else: - break #loop42 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 27, parameter_list_StartIndex) - - pass - - return - - # $ANTLR end parameter_list - - - # $ANTLR start parameter_declaration - # C.g:329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER ); - def parameter_declaration(self, ): - - parameter_declaration_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 28): - return - - # C.g:330:2: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER ) - alt46 = 2 - LA46 = self.input.LA(1) - if LA46 == 29 or LA46 == 30 or LA46 == 31 or LA46 == 32 or LA46 == 33 or LA46 == 34 or LA46 == 35 or LA46 == 36 or LA46 == 37 or LA46 == 38 or LA46 == 39 or LA46 == 40 or LA46 == 41 or LA46 == 42 or LA46 == 45 or LA46 == 46 or LA46 == 48 or LA46 == 49 or LA46 == 50 or LA46 == 51 or LA46 == 52 or LA46 == 53 or LA46 == 54 or LA46 == 55 or LA46 == 56 or LA46 == 57 or LA46 == 58 or LA46 == 59 or LA46 == 60 or LA46 == 61: - alt46 = 1 - elif LA46 == IDENTIFIER: - LA46_13 = self.input.LA(2) - - if (self.synpred86()) : - alt46 = 1 - elif (True) : - alt46 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 13, self.input) - - raise nvae - - elif LA46 == 66: - alt46 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 0, self.input) - - raise nvae - - if alt46 == 1: - # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? - self.following.append(self.FOLLOW_declaration_specifiers_in_parameter_declaration994) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - # C.g:330:27: ( declarator | abstract_declarator )* - while True: #loop43 - alt43 = 3 - LA43 = self.input.LA(1) - if LA43 == 66: - LA43_5 = self.input.LA(2) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == IDENTIFIER or LA43 == 58 or LA43 == 59 or LA43 == 60: - alt43 = 1 - elif LA43 == 62: - LA43 = self.input.LA(2) - if LA43 == 29 or LA43 == 30 or LA43 == 31 or LA43 == 32 or LA43 == 33 or LA43 == 34 or LA43 == 35 or LA43 == 36 or LA43 == 37 or LA43 == 38 or LA43 == 39 or LA43 == 40 or LA43 == 41 or LA43 == 42 or LA43 == 45 or LA43 == 46 or LA43 == 48 or LA43 == 49 or LA43 == 50 or LA43 == 51 or LA43 == 52 or LA43 == 53 or LA43 == 54 or LA43 == 55 or LA43 == 56 or LA43 == 57 or LA43 == 61 or LA43 == 63 or LA43 == 64: - alt43 = 2 - elif LA43 == IDENTIFIER: - LA43_37 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == 58: - LA43_38 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == 66: - LA43_39 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == 59: - LA43_40 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == 60: - LA43_41 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - elif LA43 == 62: - LA43_43 = self.input.LA(3) - - if (self.synpred83()) : - alt43 = 1 - elif (self.synpred84()) : - alt43 = 2 - - - - elif LA43 == 64: - alt43 = 2 - - if alt43 == 1: - # C.g:330:28: declarator - self.following.append(self.FOLLOW_declarator_in_parameter_declaration997) - self.declarator() - self.following.pop() - if self.failed: - return - - - elif alt43 == 2: - # C.g:330:39: abstract_declarator - self.following.append(self.FOLLOW_abstract_declarator_in_parameter_declaration999) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - - - else: - break #loop43 - - - # C.g:330:61: ( 'OPTIONAL' )? - alt44 = 2 - LA44_0 = self.input.LA(1) - - if (LA44_0 == 53) : - alt44 = 1 - if alt44 == 1: - # C.g:330:62: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_parameter_declaration1004) - if self.failed: - return - - - - - - elif alt46 == 2: - # C.g:332:4: ( pointer )* IDENTIFIER - # C.g:332:4: ( pointer )* - while True: #loop45 - alt45 = 2 - LA45_0 = self.input.LA(1) - - if (LA45_0 == 66) : - alt45 = 1 - - - if alt45 == 1: - # C.g:0:0: pointer - self.following.append(self.FOLLOW_pointer_in_parameter_declaration1013) - self.pointer() - self.following.pop() - if self.failed: - return - - - else: - break #loop45 - - - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_parameter_declaration1016) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 28, parameter_declaration_StartIndex) - - pass - - return - - # $ANTLR end parameter_declaration - - - # $ANTLR start identifier_list - # C.g:335:1: identifier_list : IDENTIFIER ( ',' IDENTIFIER )* ; - def identifier_list(self, ): - - identifier_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 29): - return - - # C.g:336:2: ( IDENTIFIER ( ',' IDENTIFIER )* ) - # C.g:336:4: IDENTIFIER ( ',' IDENTIFIER )* - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1027) - if self.failed: - return - # C.g:337:2: ( ',' IDENTIFIER )* - while True: #loop47 - alt47 = 2 - LA47_0 = self.input.LA(1) - - if (LA47_0 == 27) : - alt47 = 1 - - - if alt47 == 1: - # C.g:337:3: ',' IDENTIFIER - self.match(self.input, 27, self.FOLLOW_27_in_identifier_list1031) - if self.failed: - return - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1033) - if self.failed: - return - - - else: - break #loop47 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 29, identifier_list_StartIndex) - - pass - - return - - # $ANTLR end identifier_list - - - # $ANTLR start type_name - # C.g:340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id ); - def type_name(self, ): - - type_name_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 30): - return - - # C.g:341:2: ( specifier_qualifier_list ( abstract_declarator )? | type_id ) - alt49 = 2 - LA49_0 = self.input.LA(1) - - if ((34 <= LA49_0 <= 42) or (45 <= LA49_0 <= 46) or (48 <= LA49_0 <= 61)) : - alt49 = 1 - elif (LA49_0 == IDENTIFIER) : - LA49_13 = self.input.LA(2) - - if (self.synpred90()) : - alt49 = 1 - elif (True) : - alt49 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 13, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 0, self.input) - - raise nvae - - if alt49 == 1: - # C.g:341:4: specifier_qualifier_list ( abstract_declarator )? - self.following.append(self.FOLLOW_specifier_qualifier_list_in_type_name1046) - self.specifier_qualifier_list() - self.following.pop() - if self.failed: - return - # C.g:341:29: ( abstract_declarator )? - alt48 = 2 - LA48_0 = self.input.LA(1) - - if (LA48_0 == 62 or LA48_0 == 64 or LA48_0 == 66) : - alt48 = 1 - if alt48 == 1: - # C.g:0:0: abstract_declarator - self.following.append(self.FOLLOW_abstract_declarator_in_type_name1048) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - - - - - - elif alt49 == 2: - # C.g:342:4: type_id - self.following.append(self.FOLLOW_type_id_in_type_name1054) - self.type_id() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 30, type_name_StartIndex) - - pass - - return - - # $ANTLR end type_name - - - # $ANTLR start abstract_declarator - # C.g:345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator ); - def abstract_declarator(self, ): - - abstract_declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 31): - return - - # C.g:346:2: ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator ) - alt51 = 2 - LA51_0 = self.input.LA(1) - - if (LA51_0 == 66) : - alt51 = 1 - elif (LA51_0 == 62 or LA51_0 == 64) : - alt51 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator );", 51, 0, self.input) - - raise nvae - - if alt51 == 1: - # C.g:346:4: pointer ( direct_abstract_declarator )? - self.following.append(self.FOLLOW_pointer_in_abstract_declarator1065) - self.pointer() - self.following.pop() - if self.failed: - return - # C.g:346:12: ( direct_abstract_declarator )? - alt50 = 2 - LA50_0 = self.input.LA(1) - - if (LA50_0 == 62) : - LA50 = self.input.LA(2) - if LA50 == 63: - LA50_12 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 58: - LA50_13 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 66: - LA50_14 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 59: - LA50_15 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 60: - LA50_16 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == IDENTIFIER: - LA50_17 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 62: - LA50_18 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 64: - LA50_19 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 29 or LA50 == 30 or LA50 == 31 or LA50 == 32 or LA50 == 33: - LA50_20 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 34: - LA50_21 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 35: - LA50_22 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 36: - LA50_23 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 37: - LA50_24 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 38: - LA50_25 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 39: - LA50_26 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 40: - LA50_27 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 41: - LA50_28 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 42: - LA50_29 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 45 or LA50 == 46: - LA50_30 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 48: - LA50_31 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 49 or LA50 == 50 or LA50 == 51 or LA50 == 52 or LA50 == 53 or LA50 == 54 or LA50 == 55 or LA50 == 56 or LA50 == 57 or LA50 == 61: - LA50_32 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif (LA50_0 == 64) : - LA50 = self.input.LA(2) - if LA50 == 65: - LA50_33 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 62: - LA50_34 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == IDENTIFIER: - LA50_35 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == HEX_LITERAL: - LA50_36 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == OCTAL_LITERAL: - LA50_37 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == DECIMAL_LITERAL: - LA50_38 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == CHARACTER_LITERAL: - LA50_39 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == STRING_LITERAL: - LA50_40 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == FLOATING_POINT_LITERAL: - LA50_41 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 72: - LA50_42 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 73: - LA50_43 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 66 or LA50 == 68 or LA50 == 69 or LA50 == 77 or LA50 == 78 or LA50 == 79: - LA50_44 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - elif LA50 == 74: - LA50_45 = self.input.LA(3) - - if (self.synpred91()) : - alt50 = 1 - if alt50 == 1: - # C.g:0:0: direct_abstract_declarator - self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1067) - self.direct_abstract_declarator() - self.following.pop() - if self.failed: - return - - - - - - elif alt51 == 2: - # C.g:347:4: direct_abstract_declarator - self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1073) - self.direct_abstract_declarator() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 31, abstract_declarator_StartIndex) - - pass - - return - - # $ANTLR end abstract_declarator - - - # $ANTLR start direct_abstract_declarator - # C.g:350:1: direct_abstract_declarator : ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* ; - def direct_abstract_declarator(self, ): - - direct_abstract_declarator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 32): - return - - # C.g:351:2: ( ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* ) - # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* - # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix ) - alt52 = 2 - LA52_0 = self.input.LA(1) - - if (LA52_0 == 62) : - LA52 = self.input.LA(2) - if LA52 == IDENTIFIER or LA52 == 29 or LA52 == 30 or LA52 == 31 or LA52 == 32 or LA52 == 33 or LA52 == 34 or LA52 == 35 or LA52 == 36 or LA52 == 37 or LA52 == 38 or LA52 == 39 or LA52 == 40 or LA52 == 41 or LA52 == 42 or LA52 == 45 or LA52 == 46 or LA52 == 48 or LA52 == 49 or LA52 == 50 or LA52 == 51 or LA52 == 52 or LA52 == 53 or LA52 == 54 or LA52 == 55 or LA52 == 56 or LA52 == 57 or LA52 == 58 or LA52 == 59 or LA52 == 60 or LA52 == 61 or LA52 == 63: - alt52 = 2 - elif LA52 == 66: - LA52_18 = self.input.LA(3) - - if (self.synpred93()) : - alt52 = 1 - elif (True) : - alt52 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 18, self.input) - - raise nvae - - elif LA52 == 62 or LA52 == 64: - alt52 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 1, self.input) - - raise nvae - - elif (LA52_0 == 64) : - alt52 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 0, self.input) - - raise nvae - - if alt52 == 1: - # C.g:351:6: '(' abstract_declarator ')' - self.match(self.input, 62, self.FOLLOW_62_in_direct_abstract_declarator1086) - if self.failed: - return - self.following.append(self.FOLLOW_abstract_declarator_in_direct_abstract_declarator1088) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_direct_abstract_declarator1090) - if self.failed: - return - - - elif alt52 == 2: - # C.g:351:36: abstract_declarator_suffix - self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094) - self.abstract_declarator_suffix() - self.following.pop() - if self.failed: - return - - - - # C.g:351:65: ( abstract_declarator_suffix )* - while True: #loop53 - alt53 = 2 - LA53_0 = self.input.LA(1) - - if (LA53_0 == 62) : - LA53 = self.input.LA(2) - if LA53 == 63: - LA53_12 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 58: - LA53_13 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 66: - LA53_14 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 59: - LA53_15 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 60: - LA53_16 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == IDENTIFIER: - LA53_17 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 29 or LA53 == 30 or LA53 == 31 or LA53 == 32 or LA53 == 33: - LA53_19 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 34: - LA53_20 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 35: - LA53_21 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 36: - LA53_22 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 37: - LA53_23 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 38: - LA53_24 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 39: - LA53_25 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 40: - LA53_26 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 41: - LA53_27 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 42: - LA53_28 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 45 or LA53 == 46: - LA53_29 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 48: - LA53_30 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 49 or LA53 == 50 or LA53 == 51 or LA53 == 52 or LA53 == 53 or LA53 == 54 or LA53 == 55 or LA53 == 56 or LA53 == 57 or LA53 == 61: - LA53_31 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - - elif (LA53_0 == 64) : - LA53 = self.input.LA(2) - if LA53 == 65: - LA53_33 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 62: - LA53_34 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == IDENTIFIER: - LA53_35 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == HEX_LITERAL: - LA53_36 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == OCTAL_LITERAL: - LA53_37 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == DECIMAL_LITERAL: - LA53_38 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == CHARACTER_LITERAL: - LA53_39 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == STRING_LITERAL: - LA53_40 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == FLOATING_POINT_LITERAL: - LA53_41 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 72: - LA53_42 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 73: - LA53_43 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 66 or LA53 == 68 or LA53 == 69 or LA53 == 77 or LA53 == 78 or LA53 == 79: - LA53_44 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - elif LA53 == 74: - LA53_45 = self.input.LA(3) - - if (self.synpred94()) : - alt53 = 1 - - - - - - if alt53 == 1: - # C.g:0:0: abstract_declarator_suffix - self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098) - self.abstract_declarator_suffix() - self.following.pop() - if self.failed: - return - - - else: - break #loop53 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 32, direct_abstract_declarator_StartIndex) - - pass - - return - - # $ANTLR end direct_abstract_declarator - - - # $ANTLR start abstract_declarator_suffix - # C.g:354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' ); - def abstract_declarator_suffix(self, ): - - abstract_declarator_suffix_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 33): - return - - # C.g:355:2: ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' ) - alt54 = 4 - LA54_0 = self.input.LA(1) - - if (LA54_0 == 64) : - LA54_1 = self.input.LA(2) - - if (LA54_1 == 65) : - alt54 = 1 - elif ((IDENTIFIER <= LA54_1 <= FLOATING_POINT_LITERAL) or LA54_1 == 62 or LA54_1 == 66 or (68 <= LA54_1 <= 69) or (72 <= LA54_1 <= 74) or (77 <= LA54_1 <= 79)) : - alt54 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 1, self.input) - - raise nvae - - elif (LA54_0 == 62) : - LA54_2 = self.input.LA(2) - - if (LA54_2 == 63) : - alt54 = 3 - elif (LA54_2 == IDENTIFIER or (29 <= LA54_2 <= 42) or (45 <= LA54_2 <= 46) or (48 <= LA54_2 <= 61) or LA54_2 == 66) : - alt54 = 4 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 2, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 0, self.input) - - raise nvae - - if alt54 == 1: - # C.g:355:4: '[' ']' - self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1110) - if self.failed: - return - self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1112) - if self.failed: - return - - - elif alt54 == 2: - # C.g:356:4: '[' constant_expression ']' - self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1117) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_abstract_declarator_suffix1119) - self.constant_expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1121) - if self.failed: - return - - - elif alt54 == 3: - # C.g:357:4: '(' ')' - self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1126) - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1128) - if self.failed: - return - - - elif alt54 == 4: - # C.g:358:4: '(' parameter_type_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1133) - if self.failed: - return - self.following.append(self.FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135) - self.parameter_type_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1137) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 33, abstract_declarator_suffix_StartIndex) - - pass - - return - - # $ANTLR end abstract_declarator_suffix - - - # $ANTLR start initializer - # C.g:361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' ); - def initializer(self, ): - - initializer_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 34): - return - - # C.g:363:2: ( assignment_expression | '{' initializer_list ( ',' )? '}' ) - alt56 = 2 - LA56_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA56_0 <= FLOATING_POINT_LITERAL) or LA56_0 == 62 or LA56_0 == 66 or (68 <= LA56_0 <= 69) or (72 <= LA56_0 <= 74) or (77 <= LA56_0 <= 79)) : - alt56 = 1 - elif (LA56_0 == 43) : - alt56 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' );", 56, 0, self.input) - - raise nvae - - if alt56 == 1: - # C.g:363:4: assignment_expression - self.following.append(self.FOLLOW_assignment_expression_in_initializer1150) - self.assignment_expression() - self.following.pop() - if self.failed: - return - - - elif alt56 == 2: - # C.g:364:4: '{' initializer_list ( ',' )? '}' - self.match(self.input, 43, self.FOLLOW_43_in_initializer1155) - if self.failed: - return - self.following.append(self.FOLLOW_initializer_list_in_initializer1157) - self.initializer_list() - self.following.pop() - if self.failed: - return - # C.g:364:25: ( ',' )? - alt55 = 2 - LA55_0 = self.input.LA(1) - - if (LA55_0 == 27) : - alt55 = 1 - if alt55 == 1: - # C.g:0:0: ',' - self.match(self.input, 27, self.FOLLOW_27_in_initializer1159) - if self.failed: - return - - - - self.match(self.input, 44, self.FOLLOW_44_in_initializer1162) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 34, initializer_StartIndex) - - pass - - return - - # $ANTLR end initializer - - - # $ANTLR start initializer_list - # C.g:367:1: initializer_list : initializer ( ',' initializer )* ; - def initializer_list(self, ): - - initializer_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 35): - return - - # C.g:368:2: ( initializer ( ',' initializer )* ) - # C.g:368:4: initializer ( ',' initializer )* - self.following.append(self.FOLLOW_initializer_in_initializer_list1173) - self.initializer() - self.following.pop() - if self.failed: - return - # C.g:368:16: ( ',' initializer )* - while True: #loop57 - alt57 = 2 - LA57_0 = self.input.LA(1) - - if (LA57_0 == 27) : - LA57_1 = self.input.LA(2) - - if ((IDENTIFIER <= LA57_1 <= FLOATING_POINT_LITERAL) or LA57_1 == 43 or LA57_1 == 62 or LA57_1 == 66 or (68 <= LA57_1 <= 69) or (72 <= LA57_1 <= 74) or (77 <= LA57_1 <= 79)) : - alt57 = 1 - - - - - if alt57 == 1: - # C.g:368:17: ',' initializer - self.match(self.input, 27, self.FOLLOW_27_in_initializer_list1176) - if self.failed: - return - self.following.append(self.FOLLOW_initializer_in_initializer_list1178) - self.initializer() - self.following.pop() - if self.failed: - return - - - else: - break #loop57 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 35, initializer_list_StartIndex) - - pass - - return - - # $ANTLR end initializer_list - - class argument_expression_list_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start argument_expression_list - # C.g:373:1: argument_expression_list : assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* ; - def argument_expression_list(self, ): - - retval = self.argument_expression_list_return() - retval.start = self.input.LT(1) - argument_expression_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 36): - return retval - - # C.g:374:2: ( assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* ) - # C.g:374:6: assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* - self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1196) - self.assignment_expression() - self.following.pop() - if self.failed: - return retval - # C.g:374:28: ( 'OPTIONAL' )? - alt58 = 2 - LA58_0 = self.input.LA(1) - - if (LA58_0 == 53) : - alt58 = 1 - if alt58 == 1: - # C.g:374:29: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1199) - if self.failed: - return retval - - - - # C.g:374:42: ( ',' assignment_expression ( 'OPTIONAL' )? )* - while True: #loop60 - alt60 = 2 - LA60_0 = self.input.LA(1) - - if (LA60_0 == 27) : - alt60 = 1 - - - if alt60 == 1: - # C.g:374:43: ',' assignment_expression ( 'OPTIONAL' )? - self.match(self.input, 27, self.FOLLOW_27_in_argument_expression_list1204) - if self.failed: - return retval - self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1206) - self.assignment_expression() - self.following.pop() - if self.failed: - return retval - # C.g:374:69: ( 'OPTIONAL' )? - alt59 = 2 - LA59_0 = self.input.LA(1) - - if (LA59_0 == 53) : - alt59 = 1 - if alt59 == 1: - # C.g:374:70: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1209) - if self.failed: - return retval - - - - - - else: - break #loop60 - - - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 36, argument_expression_list_StartIndex) - - pass - - return retval - - # $ANTLR end argument_expression_list - - - # $ANTLR start additive_expression - # C.g:377:1: additive_expression : ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* ; - def additive_expression(self, ): - - additive_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 37): - return - - # C.g:378:2: ( ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* ) - # C.g:378:4: ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* - # C.g:378:4: ( multiplicative_expression ) - # C.g:378:5: multiplicative_expression - self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1225) - self.multiplicative_expression() - self.following.pop() - if self.failed: - return - - - - # C.g:378:32: ( '+' multiplicative_expression | '-' multiplicative_expression )* - while True: #loop61 - alt61 = 3 - LA61_0 = self.input.LA(1) - - if (LA61_0 == 68) : - alt61 = 1 - elif (LA61_0 == 69) : - alt61 = 2 - - - if alt61 == 1: - # C.g:378:33: '+' multiplicative_expression - self.match(self.input, 68, self.FOLLOW_68_in_additive_expression1229) - if self.failed: - return - self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1231) - self.multiplicative_expression() - self.following.pop() - if self.failed: - return - - - elif alt61 == 2: - # C.g:378:65: '-' multiplicative_expression - self.match(self.input, 69, self.FOLLOW_69_in_additive_expression1235) - if self.failed: - return - self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1237) - self.multiplicative_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop61 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 37, additive_expression_StartIndex) - - pass - - return - - # $ANTLR end additive_expression - - - # $ANTLR start multiplicative_expression - # C.g:381:1: multiplicative_expression : ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* ; - def multiplicative_expression(self, ): - - multiplicative_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 38): - return - - # C.g:382:2: ( ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* ) - # C.g:382:4: ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* - # C.g:382:4: ( cast_expression ) - # C.g:382:5: cast_expression - self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1251) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - - # C.g:382:22: ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* - while True: #loop62 - alt62 = 4 - LA62 = self.input.LA(1) - if LA62 == 66: - alt62 = 1 - elif LA62 == 70: - alt62 = 2 - elif LA62 == 71: - alt62 = 3 - - if alt62 == 1: - # C.g:382:23: '*' cast_expression - self.match(self.input, 66, self.FOLLOW_66_in_multiplicative_expression1255) - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1257) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - elif alt62 == 2: - # C.g:382:45: '/' cast_expression - self.match(self.input, 70, self.FOLLOW_70_in_multiplicative_expression1261) - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1263) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - elif alt62 == 3: - # C.g:382:67: '%' cast_expression - self.match(self.input, 71, self.FOLLOW_71_in_multiplicative_expression1267) - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1269) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop62 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 38, multiplicative_expression_StartIndex) - - pass - - return - - # $ANTLR end multiplicative_expression - - - # $ANTLR start cast_expression - # C.g:385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression ); - def cast_expression(self, ): - - cast_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 39): - return - - # C.g:386:2: ( '(' type_name ')' cast_expression | unary_expression ) - alt63 = 2 - LA63_0 = self.input.LA(1) - - if (LA63_0 == 62) : - LA63 = self.input.LA(2) - if LA63 == 34 or LA63 == 35 or LA63 == 36 or LA63 == 37 or LA63 == 38 or LA63 == 39 or LA63 == 40 or LA63 == 41 or LA63 == 42 or LA63 == 45 or LA63 == 46 or LA63 == 48 or LA63 == 49 or LA63 == 50 or LA63 == 51 or LA63 == 52 or LA63 == 53 or LA63 == 54 or LA63 == 55 or LA63 == 56 or LA63 == 57 or LA63 == 58 or LA63 == 59 or LA63 == 60 or LA63 == 61: - alt63 = 1 - elif LA63 == IDENTIFIER: - LA63_25 = self.input.LA(3) - - if (self.synpred109()) : - alt63 = 1 - elif (True) : - alt63 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 25, self.input) - - raise nvae - - elif LA63 == HEX_LITERAL or LA63 == OCTAL_LITERAL or LA63 == DECIMAL_LITERAL or LA63 == CHARACTER_LITERAL or LA63 == STRING_LITERAL or LA63 == FLOATING_POINT_LITERAL or LA63 == 62 or LA63 == 66 or LA63 == 68 or LA63 == 69 or LA63 == 72 or LA63 == 73 or LA63 == 74 or LA63 == 77 or LA63 == 78 or LA63 == 79: - alt63 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 1, self.input) - - raise nvae - - elif ((IDENTIFIER <= LA63_0 <= FLOATING_POINT_LITERAL) or LA63_0 == 66 or (68 <= LA63_0 <= 69) or (72 <= LA63_0 <= 74) or (77 <= LA63_0 <= 79)) : - alt63 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 0, self.input) - - raise nvae - - if alt63 == 1: - # C.g:386:4: '(' type_name ')' cast_expression - self.match(self.input, 62, self.FOLLOW_62_in_cast_expression1282) - if self.failed: - return - self.following.append(self.FOLLOW_type_name_in_cast_expression1284) - self.type_name() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_cast_expression1286) - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_cast_expression1288) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - elif alt63 == 2: - # C.g:387:4: unary_expression - self.following.append(self.FOLLOW_unary_expression_in_cast_expression1293) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 39, cast_expression_StartIndex) - - pass - - return - - # $ANTLR end cast_expression - - - # $ANTLR start unary_expression - # C.g:390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' ); - def unary_expression(self, ): - - unary_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 40): - return - - # C.g:391:2: ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' ) - alt64 = 6 - LA64 = self.input.LA(1) - if LA64 == IDENTIFIER or LA64 == HEX_LITERAL or LA64 == OCTAL_LITERAL or LA64 == DECIMAL_LITERAL or LA64 == CHARACTER_LITERAL or LA64 == STRING_LITERAL or LA64 == FLOATING_POINT_LITERAL or LA64 == 62: - alt64 = 1 - elif LA64 == 72: - alt64 = 2 - elif LA64 == 73: - alt64 = 3 - elif LA64 == 66 or LA64 == 68 or LA64 == 69 or LA64 == 77 or LA64 == 78 or LA64 == 79: - alt64 = 4 - elif LA64 == 74: - LA64_12 = self.input.LA(2) - - if (LA64_12 == 62) : - LA64_13 = self.input.LA(3) - - if (self.synpred114()) : - alt64 = 5 - elif (True) : - alt64 = 6 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 13, self.input) - - raise nvae - - elif ((IDENTIFIER <= LA64_12 <= FLOATING_POINT_LITERAL) or LA64_12 == 66 or (68 <= LA64_12 <= 69) or (72 <= LA64_12 <= 74) or (77 <= LA64_12 <= 79)) : - alt64 = 5 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 12, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 0, self.input) - - raise nvae - - if alt64 == 1: - # C.g:391:4: postfix_expression - self.following.append(self.FOLLOW_postfix_expression_in_unary_expression1304) - self.postfix_expression() - self.following.pop() - if self.failed: - return - - - elif alt64 == 2: - # C.g:392:4: '++' unary_expression - self.match(self.input, 72, self.FOLLOW_72_in_unary_expression1309) - if self.failed: - return - self.following.append(self.FOLLOW_unary_expression_in_unary_expression1311) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - elif alt64 == 3: - # C.g:393:4: '--' unary_expression - self.match(self.input, 73, self.FOLLOW_73_in_unary_expression1316) - if self.failed: - return - self.following.append(self.FOLLOW_unary_expression_in_unary_expression1318) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - elif alt64 == 4: - # C.g:394:4: unary_operator cast_expression - self.following.append(self.FOLLOW_unary_operator_in_unary_expression1323) - self.unary_operator() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_unary_expression1325) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - elif alt64 == 5: - # C.g:395:4: 'sizeof' unary_expression - self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1330) - if self.failed: - return - self.following.append(self.FOLLOW_unary_expression_in_unary_expression1332) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - elif alt64 == 6: - # C.g:396:4: 'sizeof' '(' type_name ')' - self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1337) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_unary_expression1339) - if self.failed: - return - self.following.append(self.FOLLOW_type_name_in_unary_expression1341) - self.type_name() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_unary_expression1343) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 40, unary_expression_StartIndex) - - pass - - return - - # $ANTLR end unary_expression - - - # $ANTLR start postfix_expression - # C.g:399:1: postfix_expression : p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* ; - def postfix_expression(self, ): - self.postfix_expression_stack.append(postfix_expression_scope()) - postfix_expression_StartIndex = self.input.index() - a = None - b = None - x = None - y = None - z = None - p = None - - c = None - - - - self.postfix_expression_stack[-1].FuncCallText = '' - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 41): - return - - # C.g:406:2: (p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* ) - # C.g:406:6: p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* - self.following.append(self.FOLLOW_primary_expression_in_postfix_expression1367) - p = self.primary_expression() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - self.postfix_expression_stack[-1].FuncCallText += self.input.toString(p.start,p.stop) - - # C.g:407:9: ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* - while True: #loop65 - alt65 = 10 - LA65 = self.input.LA(1) - if LA65 == 66: - LA65_1 = self.input.LA(2) - - if (LA65_1 == IDENTIFIER) : - LA65_30 = self.input.LA(3) - - if (self.synpred120()) : - alt65 = 6 - - - - - elif LA65 == 64: - alt65 = 1 - elif LA65 == 62: - LA65 = self.input.LA(2) - if LA65 == 63: - alt65 = 2 - elif LA65 == 29 or LA65 == 30 or LA65 == 31 or LA65 == 32 or LA65 == 33 or LA65 == 34 or LA65 == 35 or LA65 == 36 or LA65 == 37 or LA65 == 38 or LA65 == 39 or LA65 == 40 or LA65 == 41 or LA65 == 42 or LA65 == 45 or LA65 == 46 or LA65 == 48 or LA65 == 49 or LA65 == 50 or LA65 == 51 or LA65 == 52 or LA65 == 53 or LA65 == 54 or LA65 == 55 or LA65 == 56 or LA65 == 57 or LA65 == 58 or LA65 == 59 or LA65 == 60 or LA65 == 61: - alt65 = 4 - elif LA65 == IDENTIFIER: - LA65_55 = self.input.LA(3) - - if (self.synpred117()) : - alt65 = 3 - elif (self.synpred118()) : - alt65 = 4 - - - elif LA65 == 66: - LA65_57 = self.input.LA(3) - - if (self.synpred117()) : - alt65 = 3 - elif (self.synpred118()) : - alt65 = 4 - - - elif LA65 == HEX_LITERAL or LA65 == OCTAL_LITERAL or LA65 == DECIMAL_LITERAL or LA65 == CHARACTER_LITERAL or LA65 == STRING_LITERAL or LA65 == FLOATING_POINT_LITERAL or LA65 == 62 or LA65 == 68 or LA65 == 69 or LA65 == 72 or LA65 == 73 or LA65 == 74 or LA65 == 77 or LA65 == 78 or LA65 == 79: - alt65 = 3 - - elif LA65 == 75: - alt65 = 5 - elif LA65 == 76: - alt65 = 7 - elif LA65 == 72: - alt65 = 8 - elif LA65 == 73: - alt65 = 9 - - if alt65 == 1: - # C.g:407:13: '[' expression ']' - self.match(self.input, 64, self.FOLLOW_64_in_postfix_expression1383) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_postfix_expression1385) - self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 65, self.FOLLOW_65_in_postfix_expression1387) - if self.failed: - return - - - elif alt65 == 2: - # C.g:408:13: '(' a= ')' - self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1401) - if self.failed: - return - a = self.input.LT(1) - self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1405) - if self.failed: - return - if self.backtracking == 0: - self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, a.line, a.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, '') - - - - elif alt65 == 3: - # C.g:409:13: '(' c= argument_expression_list b= ')' - self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1420) - if self.failed: - return - self.following.append(self.FOLLOW_argument_expression_list_in_postfix_expression1424) - c = self.argument_expression_list() - self.following.pop() - if self.failed: - return - b = self.input.LT(1) - self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1428) - if self.failed: - return - if self.backtracking == 0: - self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, b.line, b.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, self.input.toString(c.start,c.stop)) - - - - elif alt65 == 4: - # C.g:410:13: '(' macro_parameter_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1444) - if self.failed: - return - self.following.append(self.FOLLOW_macro_parameter_list_in_postfix_expression1446) - self.macro_parameter_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1448) - if self.failed: - return - - - elif alt65 == 5: - # C.g:411:13: '.' x= IDENTIFIER - self.match(self.input, 75, self.FOLLOW_75_in_postfix_expression1462) - if self.failed: - return - x = self.input.LT(1) - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1466) - if self.failed: - return - if self.backtracking == 0: - self.postfix_expression_stack[-1].FuncCallText += '.' + x.text - - - - elif alt65 == 6: - # C.g:412:13: '*' y= IDENTIFIER - self.match(self.input, 66, self.FOLLOW_66_in_postfix_expression1482) - if self.failed: - return - y = self.input.LT(1) - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1486) - if self.failed: - return - if self.backtracking == 0: - self.postfix_expression_stack[-1].FuncCallText = y.text - - - - elif alt65 == 7: - # C.g:413:13: '->' z= IDENTIFIER - self.match(self.input, 76, self.FOLLOW_76_in_postfix_expression1502) - if self.failed: - return - z = self.input.LT(1) - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1506) - if self.failed: - return - if self.backtracking == 0: - self.postfix_expression_stack[-1].FuncCallText += '->' + z.text - - - - elif alt65 == 8: - # C.g:414:13: '++' - self.match(self.input, 72, self.FOLLOW_72_in_postfix_expression1522) - if self.failed: - return - - - elif alt65 == 9: - # C.g:415:13: '--' - self.match(self.input, 73, self.FOLLOW_73_in_postfix_expression1536) - if self.failed: - return - - - else: - break #loop65 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 41, postfix_expression_StartIndex) - - self.postfix_expression_stack.pop() - pass - - return - - # $ANTLR end postfix_expression - - - # $ANTLR start macro_parameter_list - # C.g:419:1: macro_parameter_list : parameter_declaration ( ',' parameter_declaration )* ; - def macro_parameter_list(self, ): - - macro_parameter_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 42): - return - - # C.g:420:2: ( parameter_declaration ( ',' parameter_declaration )* ) - # C.g:420:4: parameter_declaration ( ',' parameter_declaration )* - self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1559) - self.parameter_declaration() - self.following.pop() - if self.failed: - return - # C.g:420:26: ( ',' parameter_declaration )* - while True: #loop66 - alt66 = 2 - LA66_0 = self.input.LA(1) - - if (LA66_0 == 27) : - alt66 = 1 - - - if alt66 == 1: - # C.g:420:27: ',' parameter_declaration - self.match(self.input, 27, self.FOLLOW_27_in_macro_parameter_list1562) - if self.failed: - return - self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1564) - self.parameter_declaration() - self.following.pop() - if self.failed: - return - - - else: - break #loop66 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 42, macro_parameter_list_StartIndex) - - pass - - return - - # $ANTLR end macro_parameter_list - - - # $ANTLR start unary_operator - # C.g:423:1: unary_operator : ( '&' | '*' | '+' | '-' | '~' | '!' ); - def unary_operator(self, ): - - unary_operator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 43): - return - - # C.g:424:2: ( '&' | '*' | '+' | '-' | '~' | '!' ) - # C.g: - if self.input.LA(1) == 66 or (68 <= self.input.LA(1) <= 69) or (77 <= self.input.LA(1) <= 79): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_unary_operator0 - ) - raise mse - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 43, unary_operator_StartIndex) - - pass - - return - - # $ANTLR end unary_operator - - class primary_expression_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start primary_expression - # C.g:432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' ); - def primary_expression(self, ): - - retval = self.primary_expression_return() - retval.start = self.input.LT(1) - primary_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 44): - return retval - - # C.g:433:2: ( IDENTIFIER | constant | '(' expression ')' ) - alt67 = 3 - LA67 = self.input.LA(1) - if LA67 == IDENTIFIER: - LA67_1 = self.input.LA(2) - - if (LA67_1 == EOF or LA67_1 == 25 or (27 <= LA67_1 <= 28) or LA67_1 == 44 or LA67_1 == 47 or LA67_1 == 53 or (62 <= LA67_1 <= 66) or (68 <= LA67_1 <= 73) or (75 <= LA67_1 <= 77) or (80 <= LA67_1 <= 102)) : - alt67 = 1 - elif (LA67_1 == IDENTIFIER or LA67_1 == STRING_LITERAL) : - alt67 = 2 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 1, self.input) - - raise nvae - - elif LA67 == HEX_LITERAL or LA67 == OCTAL_LITERAL or LA67 == DECIMAL_LITERAL or LA67 == CHARACTER_LITERAL or LA67 == STRING_LITERAL or LA67 == FLOATING_POINT_LITERAL: - alt67 = 2 - elif LA67 == 62: - alt67 = 3 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 0, self.input) - - raise nvae - - if alt67 == 1: - # C.g:433:4: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_primary_expression1613) - if self.failed: - return retval - - - elif alt67 == 2: - # C.g:434:4: constant - self.following.append(self.FOLLOW_constant_in_primary_expression1618) - self.constant() - self.following.pop() - if self.failed: - return retval - - - elif alt67 == 3: - # C.g:435:4: '(' expression ')' - self.match(self.input, 62, self.FOLLOW_62_in_primary_expression1623) - if self.failed: - return retval - self.following.append(self.FOLLOW_expression_in_primary_expression1625) - self.expression() - self.following.pop() - if self.failed: - return retval - self.match(self.input, 63, self.FOLLOW_63_in_primary_expression1627) - if self.failed: - return retval - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 44, primary_expression_StartIndex) - - pass - - return retval - - # $ANTLR end primary_expression - - - # $ANTLR start constant - # C.g:438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL ); - def constant(self, ): - - constant_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 45): - return - - # C.g:439:5: ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL ) - alt72 = 6 - LA72 = self.input.LA(1) - if LA72 == HEX_LITERAL: - alt72 = 1 - elif LA72 == OCTAL_LITERAL: - alt72 = 2 - elif LA72 == DECIMAL_LITERAL: - alt72 = 3 - elif LA72 == CHARACTER_LITERAL: - alt72 = 4 - elif LA72 == IDENTIFIER or LA72 == STRING_LITERAL: - alt72 = 5 - elif LA72 == FLOATING_POINT_LITERAL: - alt72 = 6 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL );", 72, 0, self.input) - - raise nvae - - if alt72 == 1: - # C.g:439:9: HEX_LITERAL - self.match(self.input, HEX_LITERAL, self.FOLLOW_HEX_LITERAL_in_constant1643) - if self.failed: - return - - - elif alt72 == 2: - # C.g:440:9: OCTAL_LITERAL - self.match(self.input, OCTAL_LITERAL, self.FOLLOW_OCTAL_LITERAL_in_constant1653) - if self.failed: - return - - - elif alt72 == 3: - # C.g:441:9: DECIMAL_LITERAL - self.match(self.input, DECIMAL_LITERAL, self.FOLLOW_DECIMAL_LITERAL_in_constant1663) - if self.failed: - return - - - elif alt72 == 4: - # C.g:442:7: CHARACTER_LITERAL - self.match(self.input, CHARACTER_LITERAL, self.FOLLOW_CHARACTER_LITERAL_in_constant1671) - if self.failed: - return - - - elif alt72 == 5: - # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* - # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ - cnt70 = 0 - while True: #loop70 - alt70 = 2 - LA70_0 = self.input.LA(1) - - if (LA70_0 == IDENTIFIER) : - LA70_1 = self.input.LA(2) - - if (LA70_1 == STRING_LITERAL) : - alt70 = 1 - elif (LA70_1 == IDENTIFIER) : - LA70_33 = self.input.LA(3) - - if (self.synpred138()) : - alt70 = 1 - - - - - elif (LA70_0 == STRING_LITERAL) : - alt70 = 1 - - - if alt70 == 1: - # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+ - # C.g:443:8: ( IDENTIFIER )* - while True: #loop68 - alt68 = 2 - LA68_0 = self.input.LA(1) - - if (LA68_0 == IDENTIFIER) : - alt68 = 1 - - - if alt68 == 1: - # C.g:0:0: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1680) - if self.failed: - return - - - else: - break #loop68 - - - # C.g:443:20: ( STRING_LITERAL )+ - cnt69 = 0 - while True: #loop69 - alt69 = 2 - LA69_0 = self.input.LA(1) - - if (LA69_0 == STRING_LITERAL) : - LA69_31 = self.input.LA(2) - - if (self.synpred137()) : - alt69 = 1 - - - - - if alt69 == 1: - # C.g:0:0: STRING_LITERAL - self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_constant1683) - if self.failed: - return - - - else: - if cnt69 >= 1: - break #loop69 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(69, self.input) - raise eee - - cnt69 += 1 - - - - - else: - if cnt70 >= 1: - break #loop70 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(70, self.input) - raise eee - - cnt70 += 1 - - - # C.g:443:38: ( IDENTIFIER )* - while True: #loop71 - alt71 = 2 - LA71_0 = self.input.LA(1) - - if (LA71_0 == IDENTIFIER) : - alt71 = 1 - - - if alt71 == 1: - # C.g:0:0: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1688) - if self.failed: - return - - - else: - break #loop71 - - - - - elif alt72 == 6: - # C.g:444:9: FLOATING_POINT_LITERAL - self.match(self.input, FLOATING_POINT_LITERAL, self.FOLLOW_FLOATING_POINT_LITERAL_in_constant1699) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 45, constant_StartIndex) - - pass - - return - - # $ANTLR end constant - - class expression_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start expression - # C.g:449:1: expression : assignment_expression ( ',' assignment_expression )* ; - def expression(self, ): - - retval = self.expression_return() - retval.start = self.input.LT(1) - expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 46): - return retval - - # C.g:450:2: ( assignment_expression ( ',' assignment_expression )* ) - # C.g:450:4: assignment_expression ( ',' assignment_expression )* - self.following.append(self.FOLLOW_assignment_expression_in_expression1715) - self.assignment_expression() - self.following.pop() - if self.failed: - return retval - # C.g:450:26: ( ',' assignment_expression )* - while True: #loop73 - alt73 = 2 - LA73_0 = self.input.LA(1) - - if (LA73_0 == 27) : - alt73 = 1 - - - if alt73 == 1: - # C.g:450:27: ',' assignment_expression - self.match(self.input, 27, self.FOLLOW_27_in_expression1718) - if self.failed: - return retval - self.following.append(self.FOLLOW_assignment_expression_in_expression1720) - self.assignment_expression() - self.following.pop() - if self.failed: - return retval - - - else: - break #loop73 - - - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 46, expression_StartIndex) - - pass - - return retval - - # $ANTLR end expression - - - # $ANTLR start constant_expression - # C.g:453:1: constant_expression : conditional_expression ; - def constant_expression(self, ): - - constant_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 47): - return - - # C.g:454:2: ( conditional_expression ) - # C.g:454:4: conditional_expression - self.following.append(self.FOLLOW_conditional_expression_in_constant_expression1733) - self.conditional_expression() - self.following.pop() - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 47, constant_expression_StartIndex) - - pass - - return - - # $ANTLR end constant_expression - - - # $ANTLR start assignment_expression - # C.g:457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression ); - def assignment_expression(self, ): - - assignment_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 48): - return - - # C.g:458:2: ( lvalue assignment_operator assignment_expression | conditional_expression ) - alt74 = 2 - LA74 = self.input.LA(1) - if LA74 == IDENTIFIER: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_13 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 13, self.input) - - raise nvae - - elif LA74 == 62: - LA74_14 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 14, self.input) - - raise nvae - - elif LA74 == 75: - LA74_15 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 15, self.input) - - raise nvae - - elif LA74 == 66: - LA74_16 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 16, self.input) - - raise nvae - - elif LA74 == 76: - LA74_17 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 17, self.input) - - raise nvae - - elif LA74 == 72: - LA74_18 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 18, self.input) - - raise nvae - - elif LA74 == 73: - LA74_19 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 19, self.input) - - raise nvae - - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - elif LA74 == STRING_LITERAL: - LA74_21 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 21, self.input) - - raise nvae - - elif LA74 == IDENTIFIER: - LA74_22 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 22, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 1, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_44 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 44, self.input) - - raise nvae - - elif LA74 == 62: - LA74_45 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 45, self.input) - - raise nvae - - elif LA74 == 75: - LA74_46 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 46, self.input) - - raise nvae - - elif LA74 == 66: - LA74_47 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 47, self.input) - - raise nvae - - elif LA74 == 76: - LA74_48 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 48, self.input) - - raise nvae - - elif LA74 == 72: - LA74_49 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 49, self.input) - - raise nvae - - elif LA74 == 73: - LA74_50 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 50, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 2, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_73 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 73, self.input) - - raise nvae - - elif LA74 == 62: - LA74_74 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 74, self.input) - - raise nvae - - elif LA74 == 75: - LA74_75 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 75, self.input) - - raise nvae - - elif LA74 == 66: - LA74_76 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 76, self.input) - - raise nvae - - elif LA74 == 76: - LA74_77 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 77, self.input) - - raise nvae - - elif LA74 == 72: - LA74_78 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 78, self.input) - - raise nvae - - elif LA74 == 73: - LA74_79 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 79, self.input) - - raise nvae - - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 3, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_102 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 102, self.input) - - raise nvae - - elif LA74 == 62: - LA74_103 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 103, self.input) - - raise nvae - - elif LA74 == 75: - LA74_104 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 104, self.input) - - raise nvae - - elif LA74 == 66: - LA74_105 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 105, self.input) - - raise nvae - - elif LA74 == 76: - LA74_106 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 106, self.input) - - raise nvae - - elif LA74 == 72: - LA74_107 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 107, self.input) - - raise nvae - - elif LA74 == 73: - LA74_108 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 108, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 4, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_131 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 131, self.input) - - raise nvae - - elif LA74 == 62: - LA74_132 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 132, self.input) - - raise nvae - - elif LA74 == 75: - LA74_133 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 133, self.input) - - raise nvae - - elif LA74 == 66: - LA74_134 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 134, self.input) - - raise nvae - - elif LA74 == 76: - LA74_135 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 135, self.input) - - raise nvae - - elif LA74 == 72: - LA74_136 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 136, self.input) - - raise nvae - - elif LA74 == 73: - LA74_137 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 137, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 5, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74 = self.input.LA(2) - if LA74 == IDENTIFIER: - LA74_160 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 160, self.input) - - raise nvae - - elif LA74 == 64: - LA74_161 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 161, self.input) - - raise nvae - - elif LA74 == 62: - LA74_162 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 162, self.input) - - raise nvae - - elif LA74 == 75: - LA74_163 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 163, self.input) - - raise nvae - - elif LA74 == 66: - LA74_164 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 164, self.input) - - raise nvae - - elif LA74 == 76: - LA74_165 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 165, self.input) - - raise nvae - - elif LA74 == 72: - LA74_166 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 166, self.input) - - raise nvae - - elif LA74 == 73: - LA74_167 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 167, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - elif LA74 == STRING_LITERAL: - LA74_189 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 189, self.input) - - raise nvae - - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 6, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74 = self.input.LA(2) - if LA74 == 64: - LA74_191 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 191, self.input) - - raise nvae - - elif LA74 == 62: - LA74_192 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 192, self.input) - - raise nvae - - elif LA74 == 75: - LA74_193 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 193, self.input) - - raise nvae - - elif LA74 == 66: - LA74_194 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 194, self.input) - - raise nvae - - elif LA74 == 76: - LA74_195 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 195, self.input) - - raise nvae - - elif LA74 == 72: - LA74_196 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 196, self.input) - - raise nvae - - elif LA74 == 73: - LA74_197 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 197, self.input) - - raise nvae - - elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: - alt74 = 2 - elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: - alt74 = 1 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 7, self.input) - - raise nvae - - elif LA74 == 62: - LA74 = self.input.LA(2) - if LA74 == IDENTIFIER: - LA74_220 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 220, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74_221 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 221, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74_222 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 222, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74_223 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 223, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74_224 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 224, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74_225 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 225, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74_226 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 226, self.input) - - raise nvae - - elif LA74 == 62: - LA74_227 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 227, self.input) - - raise nvae - - elif LA74 == 72: - LA74_228 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 228, self.input) - - raise nvae - - elif LA74 == 73: - LA74_229 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 229, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74_230 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 230, self.input) - - raise nvae - - elif LA74 == 74: - LA74_231 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 231, self.input) - - raise nvae - - elif LA74 == 34 or LA74 == 35 or LA74 == 36 or LA74 == 37 or LA74 == 38 or LA74 == 39 or LA74 == 40 or LA74 == 41 or LA74 == 42 or LA74 == 45 or LA74 == 46 or LA74 == 48 or LA74 == 49 or LA74 == 50 or LA74 == 51 or LA74 == 52 or LA74 == 53 or LA74 == 54 or LA74 == 55 or LA74 == 56 or LA74 == 57 or LA74 == 58 or LA74 == 59 or LA74 == 60 or LA74 == 61: - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 8, self.input) - - raise nvae - - elif LA74 == 72: - LA74 = self.input.LA(2) - if LA74 == IDENTIFIER: - LA74_244 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 244, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74_245 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 245, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74_246 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 246, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74_247 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 247, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74_248 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 248, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74_249 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 249, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74_250 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 250, self.input) - - raise nvae - - elif LA74 == 62: - LA74_251 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 251, self.input) - - raise nvae - - elif LA74 == 72: - LA74_252 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 252, self.input) - - raise nvae - - elif LA74 == 73: - LA74_253 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 253, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74_254 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 254, self.input) - - raise nvae - - elif LA74 == 74: - LA74_255 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 255, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 9, self.input) - - raise nvae - - elif LA74 == 73: - LA74 = self.input.LA(2) - if LA74 == IDENTIFIER: - LA74_256 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 256, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74_257 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 257, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74_258 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 258, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74_259 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 259, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74_260 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 260, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74_261 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 261, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74_262 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 262, self.input) - - raise nvae - - elif LA74 == 62: - LA74_263 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 263, self.input) - - raise nvae - - elif LA74 == 72: - LA74_264 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 264, self.input) - - raise nvae - - elif LA74 == 73: - LA74_265 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 265, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74_266 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 266, self.input) - - raise nvae - - elif LA74 == 74: - LA74_267 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 267, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 10, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74 = self.input.LA(2) - if LA74 == 62: - LA74_268 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 268, self.input) - - raise nvae - - elif LA74 == IDENTIFIER: - LA74_269 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 269, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74_270 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 270, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74_271 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 271, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74_272 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 272, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74_273 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 273, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74_274 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 274, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74_275 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 275, self.input) - - raise nvae - - elif LA74 == 72: - LA74_276 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 276, self.input) - - raise nvae - - elif LA74 == 73: - LA74_277 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 277, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74_278 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 278, self.input) - - raise nvae - - elif LA74 == 74: - LA74_279 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 279, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 11, self.input) - - raise nvae - - elif LA74 == 74: - LA74 = self.input.LA(2) - if LA74 == 62: - LA74_280 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 280, self.input) - - raise nvae - - elif LA74 == IDENTIFIER: - LA74_281 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 281, self.input) - - raise nvae - - elif LA74 == HEX_LITERAL: - LA74_282 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 282, self.input) - - raise nvae - - elif LA74 == OCTAL_LITERAL: - LA74_283 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 283, self.input) - - raise nvae - - elif LA74 == DECIMAL_LITERAL: - LA74_284 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 284, self.input) - - raise nvae - - elif LA74 == CHARACTER_LITERAL: - LA74_285 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 285, self.input) - - raise nvae - - elif LA74 == STRING_LITERAL: - LA74_286 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 286, self.input) - - raise nvae - - elif LA74 == FLOATING_POINT_LITERAL: - LA74_287 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 287, self.input) - - raise nvae - - elif LA74 == 72: - LA74_288 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 288, self.input) - - raise nvae - - elif LA74 == 73: - LA74_289 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 289, self.input) - - raise nvae - - elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: - LA74_290 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 290, self.input) - - raise nvae - - elif LA74 == 74: - LA74_291 = self.input.LA(3) - - if (self.synpred142()) : - alt74 = 1 - elif (True) : - alt74 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 291, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 12, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 0, self.input) - - raise nvae - - if alt74 == 1: - # C.g:458:4: lvalue assignment_operator assignment_expression - self.following.append(self.FOLLOW_lvalue_in_assignment_expression1744) - self.lvalue() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_assignment_operator_in_assignment_expression1746) - self.assignment_operator() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_assignment_expression_in_assignment_expression1748) - self.assignment_expression() - self.following.pop() - if self.failed: - return - - - elif alt74 == 2: - # C.g:459:4: conditional_expression - self.following.append(self.FOLLOW_conditional_expression_in_assignment_expression1753) - self.conditional_expression() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 48, assignment_expression_StartIndex) - - pass - - return - - # $ANTLR end assignment_expression - - - # $ANTLR start lvalue - # C.g:462:1: lvalue : unary_expression ; - def lvalue(self, ): - - lvalue_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 49): - return - - # C.g:463:2: ( unary_expression ) - # C.g:463:4: unary_expression - self.following.append(self.FOLLOW_unary_expression_in_lvalue1765) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 49, lvalue_StartIndex) - - pass - - return - - # $ANTLR end lvalue - - - # $ANTLR start assignment_operator - # C.g:466:1: assignment_operator : ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' ); - def assignment_operator(self, ): - - assignment_operator_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 50): - return - - # C.g:467:2: ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' ) - # C.g: - if self.input.LA(1) == 28 or (80 <= self.input.LA(1) <= 89): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_assignment_operator0 - ) - raise mse - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 50, assignment_operator_StartIndex) - - pass - - return - - # $ANTLR end assignment_operator - - - # $ANTLR start conditional_expression - # C.g:480:1: conditional_expression : e= logical_or_expression ( '?' expression ':' conditional_expression )? ; - def conditional_expression(self, ): - - conditional_expression_StartIndex = self.input.index() - e = None - - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 51): - return - - # C.g:481:2: (e= logical_or_expression ( '?' expression ':' conditional_expression )? ) - # C.g:481:4: e= logical_or_expression ( '?' expression ':' conditional_expression )? - self.following.append(self.FOLLOW_logical_or_expression_in_conditional_expression1839) - e = self.logical_or_expression() - self.following.pop() - if self.failed: - return - # C.g:481:28: ( '?' expression ':' conditional_expression )? - alt75 = 2 - LA75_0 = self.input.LA(1) - - if (LA75_0 == 90) : - alt75 = 1 - if alt75 == 1: - # C.g:481:29: '?' expression ':' conditional_expression - self.match(self.input, 90, self.FOLLOW_90_in_conditional_expression1842) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_conditional_expression1844) - self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 47, self.FOLLOW_47_in_conditional_expression1846) - if self.failed: - return - self.following.append(self.FOLLOW_conditional_expression_in_conditional_expression1848) - self.conditional_expression() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 51, conditional_expression_StartIndex) - - pass - - return - - # $ANTLR end conditional_expression - - class logical_or_expression_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start logical_or_expression - # C.g:484:1: logical_or_expression : logical_and_expression ( '||' logical_and_expression )* ; - def logical_or_expression(self, ): - - retval = self.logical_or_expression_return() - retval.start = self.input.LT(1) - logical_or_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 52): - return retval - - # C.g:485:2: ( logical_and_expression ( '||' logical_and_expression )* ) - # C.g:485:4: logical_and_expression ( '||' logical_and_expression )* - self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1863) - self.logical_and_expression() - self.following.pop() - if self.failed: - return retval - # C.g:485:27: ( '||' logical_and_expression )* - while True: #loop76 - alt76 = 2 - LA76_0 = self.input.LA(1) - - if (LA76_0 == 91) : - alt76 = 1 - - - if alt76 == 1: - # C.g:485:28: '||' logical_and_expression - self.match(self.input, 91, self.FOLLOW_91_in_logical_or_expression1866) - if self.failed: - return retval - self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1868) - self.logical_and_expression() - self.following.pop() - if self.failed: - return retval - - - else: - break #loop76 - - - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 52, logical_or_expression_StartIndex) - - pass - - return retval - - # $ANTLR end logical_or_expression - - - # $ANTLR start logical_and_expression - # C.g:488:1: logical_and_expression : inclusive_or_expression ( '&&' inclusive_or_expression )* ; - def logical_and_expression(self, ): - - logical_and_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 53): - return - - # C.g:489:2: ( inclusive_or_expression ( '&&' inclusive_or_expression )* ) - # C.g:489:4: inclusive_or_expression ( '&&' inclusive_or_expression )* - self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1881) - self.inclusive_or_expression() - self.following.pop() - if self.failed: - return - # C.g:489:28: ( '&&' inclusive_or_expression )* - while True: #loop77 - alt77 = 2 - LA77_0 = self.input.LA(1) - - if (LA77_0 == 92) : - alt77 = 1 - - - if alt77 == 1: - # C.g:489:29: '&&' inclusive_or_expression - self.match(self.input, 92, self.FOLLOW_92_in_logical_and_expression1884) - if self.failed: - return - self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1886) - self.inclusive_or_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop77 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 53, logical_and_expression_StartIndex) - - pass - - return - - # $ANTLR end logical_and_expression - - - # $ANTLR start inclusive_or_expression - # C.g:492:1: inclusive_or_expression : exclusive_or_expression ( '|' exclusive_or_expression )* ; - def inclusive_or_expression(self, ): - - inclusive_or_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 54): - return - - # C.g:493:2: ( exclusive_or_expression ( '|' exclusive_or_expression )* ) - # C.g:493:4: exclusive_or_expression ( '|' exclusive_or_expression )* - self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899) - self.exclusive_or_expression() - self.following.pop() - if self.failed: - return - # C.g:493:28: ( '|' exclusive_or_expression )* - while True: #loop78 - alt78 = 2 - LA78_0 = self.input.LA(1) - - if (LA78_0 == 93) : - alt78 = 1 - - - if alt78 == 1: - # C.g:493:29: '|' exclusive_or_expression - self.match(self.input, 93, self.FOLLOW_93_in_inclusive_or_expression1902) - if self.failed: - return - self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904) - self.exclusive_or_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop78 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 54, inclusive_or_expression_StartIndex) - - pass - - return - - # $ANTLR end inclusive_or_expression - - - # $ANTLR start exclusive_or_expression - # C.g:496:1: exclusive_or_expression : and_expression ( '^' and_expression )* ; - def exclusive_or_expression(self, ): - - exclusive_or_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 55): - return - - # C.g:497:2: ( and_expression ( '^' and_expression )* ) - # C.g:497:4: and_expression ( '^' and_expression )* - self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1917) - self.and_expression() - self.following.pop() - if self.failed: - return - # C.g:497:19: ( '^' and_expression )* - while True: #loop79 - alt79 = 2 - LA79_0 = self.input.LA(1) - - if (LA79_0 == 94) : - alt79 = 1 - - - if alt79 == 1: - # C.g:497:20: '^' and_expression - self.match(self.input, 94, self.FOLLOW_94_in_exclusive_or_expression1920) - if self.failed: - return - self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1922) - self.and_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop79 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 55, exclusive_or_expression_StartIndex) - - pass - - return - - # $ANTLR end exclusive_or_expression - - - # $ANTLR start and_expression - # C.g:500:1: and_expression : equality_expression ( '&' equality_expression )* ; - def and_expression(self, ): - - and_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 56): - return - - # C.g:501:2: ( equality_expression ( '&' equality_expression )* ) - # C.g:501:4: equality_expression ( '&' equality_expression )* - self.following.append(self.FOLLOW_equality_expression_in_and_expression1935) - self.equality_expression() - self.following.pop() - if self.failed: - return - # C.g:501:24: ( '&' equality_expression )* - while True: #loop80 - alt80 = 2 - LA80_0 = self.input.LA(1) - - if (LA80_0 == 77) : - alt80 = 1 - - - if alt80 == 1: - # C.g:501:25: '&' equality_expression - self.match(self.input, 77, self.FOLLOW_77_in_and_expression1938) - if self.failed: - return - self.following.append(self.FOLLOW_equality_expression_in_and_expression1940) - self.equality_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop80 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 56, and_expression_StartIndex) - - pass - - return - - # $ANTLR end and_expression - - - # $ANTLR start equality_expression - # C.g:503:1: equality_expression : relational_expression ( ( '==' | '!=' ) relational_expression )* ; - def equality_expression(self, ): - - equality_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 57): - return - - # C.g:504:2: ( relational_expression ( ( '==' | '!=' ) relational_expression )* ) - # C.g:504:4: relational_expression ( ( '==' | '!=' ) relational_expression )* - self.following.append(self.FOLLOW_relational_expression_in_equality_expression1952) - self.relational_expression() - self.following.pop() - if self.failed: - return - # C.g:504:26: ( ( '==' | '!=' ) relational_expression )* - while True: #loop81 - alt81 = 2 - LA81_0 = self.input.LA(1) - - if ((95 <= LA81_0 <= 96)) : - alt81 = 1 - - - if alt81 == 1: - # C.g:504:27: ( '==' | '!=' ) relational_expression - if (95 <= self.input.LA(1) <= 96): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_equality_expression1955 - ) - raise mse - - - self.following.append(self.FOLLOW_relational_expression_in_equality_expression1961) - self.relational_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop81 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 57, equality_expression_StartIndex) - - pass - - return - - # $ANTLR end equality_expression - - - # $ANTLR start relational_expression - # C.g:507:1: relational_expression : shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* ; - def relational_expression(self, ): - - relational_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 58): - return - - # C.g:508:2: ( shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* ) - # C.g:508:4: shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* - self.following.append(self.FOLLOW_shift_expression_in_relational_expression1975) - self.shift_expression() - self.following.pop() - if self.failed: - return - # C.g:508:21: ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* - while True: #loop82 - alt82 = 2 - LA82_0 = self.input.LA(1) - - if ((97 <= LA82_0 <= 100)) : - alt82 = 1 - - - if alt82 == 1: - # C.g:508:22: ( '<' | '>' | '<=' | '>=' ) shift_expression - if (97 <= self.input.LA(1) <= 100): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_relational_expression1978 - ) - raise mse - - - self.following.append(self.FOLLOW_shift_expression_in_relational_expression1988) - self.shift_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop82 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 58, relational_expression_StartIndex) - - pass - - return - - # $ANTLR end relational_expression - - - # $ANTLR start shift_expression - # C.g:511:1: shift_expression : additive_expression ( ( '<<' | '>>' ) additive_expression )* ; - def shift_expression(self, ): - - shift_expression_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 59): - return - - # C.g:512:2: ( additive_expression ( ( '<<' | '>>' ) additive_expression )* ) - # C.g:512:4: additive_expression ( ( '<<' | '>>' ) additive_expression )* - self.following.append(self.FOLLOW_additive_expression_in_shift_expression2001) - self.additive_expression() - self.following.pop() - if self.failed: - return - # C.g:512:24: ( ( '<<' | '>>' ) additive_expression )* - while True: #loop83 - alt83 = 2 - LA83_0 = self.input.LA(1) - - if ((101 <= LA83_0 <= 102)) : - alt83 = 1 - - - if alt83 == 1: - # C.g:512:25: ( '<<' | '>>' ) additive_expression - if (101 <= self.input.LA(1) <= 102): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_shift_expression2004 - ) - raise mse - - - self.following.append(self.FOLLOW_additive_expression_in_shift_expression2010) - self.additive_expression() - self.following.pop() - if self.failed: - return - - - else: - break #loop83 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 59, shift_expression_StartIndex) - - pass - - return - - # $ANTLR end shift_expression - - - # $ANTLR start statement - # C.g:517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration ); - def statement(self, ): - - statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 60): - return - - # C.g:518:2: ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration ) - alt84 = 11 - LA84 = self.input.LA(1) - if LA84 == IDENTIFIER: - LA84 = self.input.LA(2) - if LA84 == 62: - LA84_43 = self.input.LA(3) - - if (self.synpred169()) : - alt84 = 3 - elif (self.synpred173()) : - alt84 = 7 - elif (self.synpred174()) : - alt84 = 8 - elif (True) : - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 43, self.input) - - raise nvae - - elif LA84 == 47: - alt84 = 1 - elif LA84 == STRING_LITERAL or LA84 == 27 or LA84 == 28 or LA84 == 64 or LA84 == 68 or LA84 == 69 or LA84 == 70 or LA84 == 71 or LA84 == 72 or LA84 == 73 or LA84 == 75 or LA84 == 76 or LA84 == 77 or LA84 == 80 or LA84 == 81 or LA84 == 82 or LA84 == 83 or LA84 == 84 or LA84 == 85 or LA84 == 86 or LA84 == 87 or LA84 == 88 or LA84 == 89 or LA84 == 90 or LA84 == 91 or LA84 == 92 or LA84 == 93 or LA84 == 94 or LA84 == 95 or LA84 == 96 or LA84 == 97 or LA84 == 98 or LA84 == 99 or LA84 == 100 or LA84 == 101 or LA84 == 102: - alt84 = 3 - elif LA84 == 66: - LA84_47 = self.input.LA(3) - - if (self.synpred169()) : - alt84 = 3 - elif (True) : - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 47, self.input) - - raise nvae - - elif LA84 == IDENTIFIER: - LA84_53 = self.input.LA(3) - - if (self.synpred169()) : - alt84 = 3 - elif (True) : - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 53, self.input) - - raise nvae - - elif LA84 == 25: - LA84_68 = self.input.LA(3) - - if (self.synpred169()) : - alt84 = 3 - elif (True) : - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 68, self.input) - - raise nvae - - elif LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61: - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 1, self.input) - - raise nvae - - elif LA84 == 106 or LA84 == 107: - alt84 = 1 - elif LA84 == 43: - alt84 = 2 - elif LA84 == HEX_LITERAL or LA84 == OCTAL_LITERAL or LA84 == DECIMAL_LITERAL or LA84 == CHARACTER_LITERAL or LA84 == STRING_LITERAL or LA84 == FLOATING_POINT_LITERAL or LA84 == 25 or LA84 == 62 or LA84 == 66 or LA84 == 68 or LA84 == 69 or LA84 == 72 or LA84 == 73 or LA84 == 74 or LA84 == 77 or LA84 == 78 or LA84 == 79: - alt84 = 3 - elif LA84 == 108 or LA84 == 110: - alt84 = 4 - elif LA84 == 111 or LA84 == 112 or LA84 == 113: - alt84 = 5 - elif LA84 == 114 or LA84 == 115 or LA84 == 116 or LA84 == 117: - alt84 = 6 - elif LA84 == 103: - alt84 = 8 - elif LA84 == 104: - alt84 = 9 - elif LA84 == 105: - alt84 = 10 - elif LA84 == 26 or LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61: - alt84 = 11 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 0, self.input) - - raise nvae - - if alt84 == 1: - # C.g:518:4: labeled_statement - self.following.append(self.FOLLOW_labeled_statement_in_statement2025) - self.labeled_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 2: - # C.g:519:4: compound_statement - self.following.append(self.FOLLOW_compound_statement_in_statement2030) - self.compound_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 3: - # C.g:520:4: expression_statement - self.following.append(self.FOLLOW_expression_statement_in_statement2035) - self.expression_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 4: - # C.g:521:4: selection_statement - self.following.append(self.FOLLOW_selection_statement_in_statement2040) - self.selection_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 5: - # C.g:522:4: iteration_statement - self.following.append(self.FOLLOW_iteration_statement_in_statement2045) - self.iteration_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 6: - # C.g:523:4: jump_statement - self.following.append(self.FOLLOW_jump_statement_in_statement2050) - self.jump_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 7: - # C.g:524:4: macro_statement - self.following.append(self.FOLLOW_macro_statement_in_statement2055) - self.macro_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 8: - # C.g:525:4: asm2_statement - self.following.append(self.FOLLOW_asm2_statement_in_statement2060) - self.asm2_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 9: - # C.g:526:4: asm1_statement - self.following.append(self.FOLLOW_asm1_statement_in_statement2065) - self.asm1_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 10: - # C.g:527:4: asm_statement - self.following.append(self.FOLLOW_asm_statement_in_statement2070) - self.asm_statement() - self.following.pop() - if self.failed: - return - - - elif alt84 == 11: - # C.g:528:4: declaration - self.following.append(self.FOLLOW_declaration_in_statement2075) - self.declaration() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 60, statement_StartIndex) - - pass - - return - - # $ANTLR end statement - - - # $ANTLR start asm2_statement - # C.g:531:1: asm2_statement : ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' ; - def asm2_statement(self, ): - - asm2_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 61): - return - - # C.g:532:2: ( ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' ) - # C.g:532:4: ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' - # C.g:532:4: ( '__asm__' )? - alt85 = 2 - LA85_0 = self.input.LA(1) - - if (LA85_0 == 103) : - alt85 = 1 - if alt85 == 1: - # C.g:0:0: '__asm__' - self.match(self.input, 103, self.FOLLOW_103_in_asm2_statement2086) - if self.failed: - return - - - - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_asm2_statement2089) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_asm2_statement2091) - if self.failed: - return - # C.g:532:30: (~ ( ';' ) )* - while True: #loop86 - alt86 = 2 - LA86_0 = self.input.LA(1) - - if (LA86_0 == 63) : - LA86_1 = self.input.LA(2) - - if ((IDENTIFIER <= LA86_1 <= LINE_COMMAND) or (26 <= LA86_1 <= 117)) : - alt86 = 1 - - - elif ((IDENTIFIER <= LA86_0 <= LINE_COMMAND) or (26 <= LA86_0 <= 62) or (64 <= LA86_0 <= 117)) : - alt86 = 1 - - - if alt86 == 1: - # C.g:532:31: ~ ( ';' ) - if (IDENTIFIER <= self.input.LA(1) <= LINE_COMMAND) or (26 <= self.input.LA(1) <= 117): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_asm2_statement2094 - ) - raise mse - - - - - else: - break #loop86 - - - self.match(self.input, 63, self.FOLLOW_63_in_asm2_statement2101) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_asm2_statement2103) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 61, asm2_statement_StartIndex) - - pass - - return - - # $ANTLR end asm2_statement - - - # $ANTLR start asm1_statement - # C.g:535:1: asm1_statement : '_asm' '{' (~ ( '}' ) )* '}' ; - def asm1_statement(self, ): - - asm1_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 62): - return - - # C.g:536:2: ( '_asm' '{' (~ ( '}' ) )* '}' ) - # C.g:536:4: '_asm' '{' (~ ( '}' ) )* '}' - self.match(self.input, 104, self.FOLLOW_104_in_asm1_statement2115) - if self.failed: - return - self.match(self.input, 43, self.FOLLOW_43_in_asm1_statement2117) - if self.failed: - return - # C.g:536:15: (~ ( '}' ) )* - while True: #loop87 - alt87 = 2 - LA87_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA87_0 <= 43) or (45 <= LA87_0 <= 117)) : - alt87 = 1 - - - if alt87 == 1: - # C.g:536:16: ~ ( '}' ) - if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_asm1_statement2120 - ) - raise mse - - - - - else: - break #loop87 - - - self.match(self.input, 44, self.FOLLOW_44_in_asm1_statement2127) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 62, asm1_statement_StartIndex) - - pass - - return - - # $ANTLR end asm1_statement - - - # $ANTLR start asm_statement - # C.g:539:1: asm_statement : '__asm' '{' (~ ( '}' ) )* '}' ; - def asm_statement(self, ): - - asm_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 63): - return - - # C.g:540:2: ( '__asm' '{' (~ ( '}' ) )* '}' ) - # C.g:540:4: '__asm' '{' (~ ( '}' ) )* '}' - self.match(self.input, 105, self.FOLLOW_105_in_asm_statement2138) - if self.failed: - return - self.match(self.input, 43, self.FOLLOW_43_in_asm_statement2140) - if self.failed: - return - # C.g:540:16: (~ ( '}' ) )* - while True: #loop88 - alt88 = 2 - LA88_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA88_0 <= 43) or (45 <= LA88_0 <= 117)) : - alt88 = 1 - - - if alt88 == 1: - # C.g:540:17: ~ ( '}' ) - if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117): - self.input.consume(); - self.errorRecovery = False - self.failed = False - - else: - if self.backtracking > 0: - self.failed = True - return - - mse = MismatchedSetException(None, self.input) - self.recoverFromMismatchedSet( - self.input, mse, self.FOLLOW_set_in_asm_statement2143 - ) - raise mse - - - - - else: - break #loop88 - - - self.match(self.input, 44, self.FOLLOW_44_in_asm_statement2150) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 63, asm_statement_StartIndex) - - pass - - return - - # $ANTLR end asm_statement - - - # $ANTLR start macro_statement - # C.g:543:1: macro_statement : IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' ; - def macro_statement(self, ): - - macro_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 64): - return - - # C.g:544:2: ( IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' ) - # C.g:544:4: IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_macro_statement2162) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_macro_statement2164) - if self.failed: - return - # C.g:544:19: ( declaration )* - while True: #loop89 - alt89 = 2 - LA89 = self.input.LA(1) - if LA89 == IDENTIFIER: - LA89 = self.input.LA(2) - if LA89 == 62: - LA89_45 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_47 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 66: - LA89_50 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_68 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_71 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_72 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_73 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_74 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_75 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_76 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_77 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_78 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_79 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_80 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_81 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_82 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_83 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_84 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_85 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_86 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 26: - LA89 = self.input.LA(2) - if LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_87 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_88 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_89 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_90 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_91 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_92 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_93 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_94 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_95 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_96 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_97 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_98 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_99 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_100 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 66: - LA89_101 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_102 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_103 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_104 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_105 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_106 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_107 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_108 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_109 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_110 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_111 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_112 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_113 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_114 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_115 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_116 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_117 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_118 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_119 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_120 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_121 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_122 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_123 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_124 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_125 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 34: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_126 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_127 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_128 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_129 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_130 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_131 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_132 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_133 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_134 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_135 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_136 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_137 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_138 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_139 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_140 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_141 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_142 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_143 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_144 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_145 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 35: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_146 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_147 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_148 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_149 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_150 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_151 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_152 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_153 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_154 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_155 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_156 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_157 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_158 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_159 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_160 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_161 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_162 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_163 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_164 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_165 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 36: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_166 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_167 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_168 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_169 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_170 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_171 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_172 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_173 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_174 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_175 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_176 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_177 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_178 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_179 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_180 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_181 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_182 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_183 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_184 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_185 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 37: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_186 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_187 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_188 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_189 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_190 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_191 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_192 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_193 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_194 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_195 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_196 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_197 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_198 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_199 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_200 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_201 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_202 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_203 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_204 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_205 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 38: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_206 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_207 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_208 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_209 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_210 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_211 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_212 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_213 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_214 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_215 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_216 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_217 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_218 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_219 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_220 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_221 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_222 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_223 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_224 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_225 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 39: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_226 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_227 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_228 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_229 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_230 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_231 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_232 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_233 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_234 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_235 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_236 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_237 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_238 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_239 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_240 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_241 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_242 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_243 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_244 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_245 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 40: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_246 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_247 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_248 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_249 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_250 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_251 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_252 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_253 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_254 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_255 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_256 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_257 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_258 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_259 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_260 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_261 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_262 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_263 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_264 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_265 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 41: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_266 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_267 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_268 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_269 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_270 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_271 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_272 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_273 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_274 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_275 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_276 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_277 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_278 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_279 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_280 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_281 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_282 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_283 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_284 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_285 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 42: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_286 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_287 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_288 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_289 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_290 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_291 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_292 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_293 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_294 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_295 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_296 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_297 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_298 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_299 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_300 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_301 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_302 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_303 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_304 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_305 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - elif LA89 == 45 or LA89 == 46: - LA89_40 = self.input.LA(2) - - if (LA89_40 == IDENTIFIER) : - LA89_306 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif (LA89_40 == 43) : - LA89_307 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - - elif LA89 == 48: - LA89_41 = self.input.LA(2) - - if (LA89_41 == 43) : - LA89_308 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif (LA89_41 == IDENTIFIER) : - LA89_309 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 58 or LA89 == 59 or LA89 == 60 or LA89 == 61: - LA89 = self.input.LA(2) - if LA89 == 66: - LA89_310 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 58: - LA89_311 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 59: - LA89_312 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 60: - LA89_313 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == IDENTIFIER: - LA89_314 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 62: - LA89_315 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 25: - LA89_316 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: - LA89_317 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 34: - LA89_318 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 35: - LA89_319 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 36: - LA89_320 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 37: - LA89_321 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 38: - LA89_322 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 39: - LA89_323 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 40: - LA89_324 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 41: - LA89_325 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 42: - LA89_326 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 45 or LA89 == 46: - LA89_327 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 48: - LA89_328 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: - LA89_329 = self.input.LA(3) - - if (self.synpred181()) : - alt89 = 1 - - - - - if alt89 == 1: - # C.g:0:0: declaration - self.following.append(self.FOLLOW_declaration_in_macro_statement2166) - self.declaration() - self.following.pop() - if self.failed: - return - - - else: - break #loop89 - - - # C.g:544:33: ( statement_list )? - alt90 = 2 - LA90 = self.input.LA(1) - if LA90 == IDENTIFIER: - LA90 = self.input.LA(2) - if LA90 == 25 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 45 or LA90 == 46 or LA90 == 47 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61: - alt90 = 1 - elif LA90 == 62: - LA90_45 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_46 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == IDENTIFIER: - LA90_47 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 64: - LA90_48 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_49 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_50 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_51 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_52 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_53 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_54 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_55 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_56 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_57 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_58 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_59 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_60 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_61 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_62 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_63 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_64 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_65 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_66 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_67 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_70 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25 or LA90 == 26 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 43 or LA90 == 45 or LA90 == 46 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61 or LA90 == 103 or LA90 == 104 or LA90 == 105 or LA90 == 106 or LA90 == 107 or LA90 == 108 or LA90 == 110 or LA90 == 111 or LA90 == 112 or LA90 == 113 or LA90 == 114 or LA90 == 115 or LA90 == 116 or LA90 == 117: - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90 = self.input.LA(2) - if LA90 == 64: - LA90_87 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_88 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_89 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_90 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_91 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_92 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_93 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_94 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_95 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_96 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_97 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_98 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_99 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_100 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_101 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_102 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_103 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_104 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_105 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_106 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_107 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_108 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90 = self.input.LA(2) - if LA90 == 64: - LA90_111 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_112 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_113 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_114 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_115 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_116 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_117 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_118 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_119 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_120 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_121 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_122 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_123 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_124 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_125 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_126 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_127 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_128 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_129 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_130 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_131 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_134 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90 = self.input.LA(2) - if LA90 == 64: - LA90_135 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_136 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_137 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_138 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_139 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_140 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_141 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_142 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_143 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_144 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_145 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_146 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_147 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_148 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_149 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_150 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_151 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_152 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_153 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_154 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_155 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_156 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90 = self.input.LA(2) - if LA90 == 64: - LA90_159 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_160 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_161 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_162 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_163 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_164 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_165 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_166 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_167 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_168 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_169 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_170 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_171 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_172 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_173 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_174 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_175 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_176 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_177 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_178 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_179 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_181 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90 = self.input.LA(2) - if LA90 == IDENTIFIER: - LA90_183 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 64: - LA90_184 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_185 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_186 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_187 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_188 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_189 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_190 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_191 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_192 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_193 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_194 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_195 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_196 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_197 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_198 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_199 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_200 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_201 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_202 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_203 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_204 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_205 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_206 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90 = self.input.LA(2) - if LA90 == 64: - LA90_209 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_210 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 75: - LA90_211 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66: - LA90_212 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 76: - LA90_213 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_214 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_215 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: - LA90_216 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 70: - LA90_217 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 71: - LA90_218 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 68: - LA90_219 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 69: - LA90_220 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 101 or LA90 == 102: - LA90_221 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: - LA90_222 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 95 or LA90 == 96: - LA90_223 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 77: - LA90_224 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 94: - LA90_225 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 93: - LA90_226 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 92: - LA90_227 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 91: - LA90_228 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 90: - LA90_229 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 27: - LA90_230 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 25: - alt90 = 1 - elif LA90 == 62: - LA90 = self.input.LA(2) - if LA90 == IDENTIFIER: - LA90_233 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90_234 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90_235 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90_236 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90_237 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_238 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90_239 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_240 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_241 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_242 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90_243 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90_244 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61: - LA90_245 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 34: - LA90_246 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 35: - LA90_247 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 36: - LA90_248 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 37: - LA90_249 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 38: - LA90_250 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 39: - LA90_251 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 40: - LA90_252 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 41: - LA90_253 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 42: - LA90_254 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 45 or LA90 == 46: - LA90_255 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 48: - LA90_256 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90 = self.input.LA(2) - if LA90 == IDENTIFIER: - LA90_257 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90_258 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90_259 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90_260 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90_261 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_262 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90_263 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_264 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_265 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_266 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90_267 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90_268 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90 = self.input.LA(2) - if LA90 == IDENTIFIER: - LA90_269 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90_270 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90_271 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90_272 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90_273 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_274 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90_275 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 62: - LA90_276 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_277 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_278 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90_279 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90_280 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90 = self.input.LA(2) - if LA90 == 62: - LA90_281 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == IDENTIFIER: - LA90_282 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90_283 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90_284 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90_285 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90_286 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_287 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90_288 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_289 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_290 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90_291 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90_292 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90 = self.input.LA(2) - if LA90 == 62: - LA90_293 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == IDENTIFIER: - LA90_294 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == HEX_LITERAL: - LA90_295 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == OCTAL_LITERAL: - LA90_296 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == DECIMAL_LITERAL: - LA90_297 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == CHARACTER_LITERAL: - LA90_298 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == STRING_LITERAL: - LA90_299 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == FLOATING_POINT_LITERAL: - LA90_300 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 72: - LA90_301 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 73: - LA90_302 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: - LA90_303 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - elif LA90 == 74: - LA90_304 = self.input.LA(3) - - if (self.synpred182()) : - alt90 = 1 - if alt90 == 1: - # C.g:0:0: statement_list - self.following.append(self.FOLLOW_statement_list_in_macro_statement2170) - self.statement_list() - self.following.pop() - if self.failed: - return - - - - # C.g:544:49: ( expression )? - alt91 = 2 - LA91_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA91_0 <= FLOATING_POINT_LITERAL) or LA91_0 == 62 or LA91_0 == 66 or (68 <= LA91_0 <= 69) or (72 <= LA91_0 <= 74) or (77 <= LA91_0 <= 79)) : - alt91 = 1 - if alt91 == 1: - # C.g:0:0: expression - self.following.append(self.FOLLOW_expression_in_macro_statement2173) - self.expression() - self.following.pop() - if self.failed: - return - - - - self.match(self.input, 63, self.FOLLOW_63_in_macro_statement2176) - if self.failed: - return - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 64, macro_statement_StartIndex) - - pass - - return - - # $ANTLR end macro_statement - - - # $ANTLR start labeled_statement - # C.g:547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement ); - def labeled_statement(self, ): - - labeled_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 65): - return - - # C.g:548:2: ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement ) - alt92 = 3 - LA92 = self.input.LA(1) - if LA92 == IDENTIFIER: - alt92 = 1 - elif LA92 == 106: - alt92 = 2 - elif LA92 == 107: - alt92 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement );", 92, 0, self.input) - - raise nvae - - if alt92 == 1: - # C.g:548:4: IDENTIFIER ':' statement - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_labeled_statement2188) - if self.failed: - return - self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2190) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_labeled_statement2192) - self.statement() - self.following.pop() - if self.failed: - return - - - elif alt92 == 2: - # C.g:549:4: 'case' constant_expression ':' statement - self.match(self.input, 106, self.FOLLOW_106_in_labeled_statement2197) - if self.failed: - return - self.following.append(self.FOLLOW_constant_expression_in_labeled_statement2199) - self.constant_expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2201) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_labeled_statement2203) - self.statement() - self.following.pop() - if self.failed: - return - - - elif alt92 == 3: - # C.g:550:4: 'default' ':' statement - self.match(self.input, 107, self.FOLLOW_107_in_labeled_statement2208) - if self.failed: - return - self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2210) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_labeled_statement2212) - self.statement() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 65, labeled_statement_StartIndex) - - pass - - return - - # $ANTLR end labeled_statement - - class compound_statement_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start compound_statement - # C.g:553:1: compound_statement : '{' ( declaration )* ( statement_list )? '}' ; - def compound_statement(self, ): - - retval = self.compound_statement_return() - retval.start = self.input.LT(1) - compound_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 66): - return retval - - # C.g:554:2: ( '{' ( declaration )* ( statement_list )? '}' ) - # C.g:554:4: '{' ( declaration )* ( statement_list )? '}' - self.match(self.input, 43, self.FOLLOW_43_in_compound_statement2223) - if self.failed: - return retval - # C.g:554:8: ( declaration )* - while True: #loop93 - alt93 = 2 - LA93 = self.input.LA(1) - if LA93 == IDENTIFIER: - LA93 = self.input.LA(2) - if LA93 == 62: - LA93_44 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_47 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 66: - LA93_48 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_49 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_50 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_51 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_52 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_53 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_54 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_55 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_56 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_57 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_58 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_59 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_60 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_61 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_62 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_63 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_64 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_65 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 26: - LA93 = self.input.LA(2) - if LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_86 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_87 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_88 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_89 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_90 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_91 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_92 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_93 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_94 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_95 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_96 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_97 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_98 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_99 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 66: - LA93_100 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_101 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_102 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_103 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_104 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_105 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_106 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_107 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_108 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_109 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_110 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_111 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_112 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_113 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_114 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_115 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_116 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_117 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_118 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_119 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_120 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_121 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_122 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_123 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_124 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 34: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_125 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_126 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_127 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_128 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_129 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_130 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_131 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_132 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_133 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_134 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_135 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_136 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_137 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_138 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_139 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_140 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_141 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_142 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_143 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_144 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 35: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_145 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_146 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_147 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_148 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_149 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_150 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_151 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_152 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_153 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_154 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_155 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_156 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_157 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_158 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_159 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_160 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_161 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_162 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_163 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_164 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 36: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_165 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_166 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_167 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_168 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_169 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_170 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_171 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_172 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_173 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_174 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_175 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_176 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_177 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_178 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_179 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_180 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_181 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_182 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_183 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_184 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 37: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_185 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_186 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_187 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_188 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_189 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_190 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_191 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_192 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_193 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_194 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_195 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_196 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_197 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_198 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_199 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_200 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_201 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_202 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_203 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_204 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 38: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_205 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_206 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_207 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_208 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_209 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_210 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_211 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_212 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_213 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_214 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_215 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_216 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_217 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_218 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_219 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_220 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_221 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_222 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_223 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_224 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 39: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_225 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_226 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_227 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_228 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_229 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_230 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_231 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_232 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_233 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_234 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_235 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_236 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_237 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_238 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_239 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_240 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_241 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_242 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_243 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_244 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 40: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_245 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_246 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_247 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_248 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_249 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_250 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_251 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_252 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_253 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_254 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_255 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_256 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_257 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_258 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_259 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_260 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_261 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_262 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_263 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_264 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 41: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_265 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_266 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_267 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_268 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_269 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_270 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_271 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_272 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_273 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_274 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_275 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_276 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_277 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_278 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_279 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_280 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_281 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_282 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_283 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_284 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 42: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_285 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_286 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_287 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_288 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_289 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_290 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_291 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_292 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_293 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_294 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_295 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_296 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_297 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_298 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_299 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_300 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_301 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_302 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_303 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_304 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - elif LA93 == 45 or LA93 == 46: - LA93_40 = self.input.LA(2) - - if (LA93_40 == IDENTIFIER) : - LA93_305 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif (LA93_40 == 43) : - LA93_306 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - - elif LA93 == 48: - LA93_41 = self.input.LA(2) - - if (LA93_41 == 43) : - LA93_307 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif (LA93_41 == IDENTIFIER) : - LA93_308 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 58 or LA93 == 59 or LA93 == 60 or LA93 == 61: - LA93 = self.input.LA(2) - if LA93 == 66: - LA93_309 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 58: - LA93_310 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 59: - LA93_311 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 60: - LA93_312 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == IDENTIFIER: - LA93_313 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 62: - LA93_314 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 25: - LA93_315 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: - LA93_316 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 34: - LA93_317 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 35: - LA93_318 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 36: - LA93_319 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 37: - LA93_320 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 38: - LA93_321 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 39: - LA93_322 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 40: - LA93_323 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 41: - LA93_324 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 42: - LA93_325 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 45 or LA93 == 46: - LA93_326 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 48: - LA93_327 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: - LA93_328 = self.input.LA(3) - - if (self.synpred186()) : - alt93 = 1 - - - - - if alt93 == 1: - # C.g:0:0: declaration - self.following.append(self.FOLLOW_declaration_in_compound_statement2225) - self.declaration() - self.following.pop() - if self.failed: - return retval - - - else: - break #loop93 - - - # C.g:554:21: ( statement_list )? - alt94 = 2 - LA94_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA94_0 <= FLOATING_POINT_LITERAL) or (25 <= LA94_0 <= 26) or (29 <= LA94_0 <= 43) or (45 <= LA94_0 <= 46) or (48 <= LA94_0 <= 62) or LA94_0 == 66 or (68 <= LA94_0 <= 69) or (72 <= LA94_0 <= 74) or (77 <= LA94_0 <= 79) or (103 <= LA94_0 <= 108) or (110 <= LA94_0 <= 117)) : - alt94 = 1 - if alt94 == 1: - # C.g:0:0: statement_list - self.following.append(self.FOLLOW_statement_list_in_compound_statement2228) - self.statement_list() - self.following.pop() - if self.failed: - return retval - - - - self.match(self.input, 44, self.FOLLOW_44_in_compound_statement2231) - if self.failed: - return retval - - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 66, compound_statement_StartIndex) - - pass - - return retval - - # $ANTLR end compound_statement - - - # $ANTLR start statement_list - # C.g:557:1: statement_list : ( statement )+ ; - def statement_list(self, ): - - statement_list_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 67): - return - - # C.g:558:2: ( ( statement )+ ) - # C.g:558:4: ( statement )+ - # C.g:558:4: ( statement )+ - cnt95 = 0 - while True: #loop95 - alt95 = 2 - LA95 = self.input.LA(1) - if LA95 == IDENTIFIER: - LA95 = self.input.LA(2) - if LA95 == 62: - LA95_46 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 45 or LA95 == 46 or LA95 == 47 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61: - alt95 = 1 - elif LA95 == STRING_LITERAL: - LA95_48 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == IDENTIFIER: - LA95_49 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 64: - LA95_50 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_51 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_52 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_53 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_54 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_55 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_56 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_57 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_58 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_59 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_60 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_61 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_62 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_63 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_64 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_65 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_66 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_67 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_68 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_69 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_88 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == HEX_LITERAL: - LA95 = self.input.LA(2) - if LA95 == 64: - LA95_89 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_90 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_91 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_92 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_93 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_94 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_95 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_96 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_97 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_98 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_99 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_100 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_101 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_102 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_103 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_104 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_105 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_106 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_107 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_108 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_109 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_110 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - - elif LA95 == OCTAL_LITERAL: - LA95 = self.input.LA(2) - if LA95 == 64: - LA95_113 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_114 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_115 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_116 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_117 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_118 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_119 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_120 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_121 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_122 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_123 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_124 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_125 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_126 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_127 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_128 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_129 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_130 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_131 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_132 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_133 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_135 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - - elif LA95 == DECIMAL_LITERAL: - LA95 = self.input.LA(2) - if LA95 == 64: - LA95_137 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_138 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_139 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_140 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_141 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_142 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_143 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_144 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_145 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_146 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_147 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_148 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_149 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_150 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_151 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_152 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_153 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_154 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_155 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_156 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_157 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_158 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - - elif LA95 == CHARACTER_LITERAL: - LA95 = self.input.LA(2) - if LA95 == 64: - LA95_161 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_162 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_163 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_164 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_165 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_166 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_167 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_168 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_169 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_170 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_171 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_172 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_173 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_174 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_175 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_176 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_177 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_178 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_179 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_180 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_181 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_182 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - - elif LA95 == STRING_LITERAL: - LA95 = self.input.LA(2) - if LA95 == IDENTIFIER: - LA95_185 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 64: - LA95_186 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_187 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_188 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_189 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_190 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_191 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_192 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_193 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_194 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_195 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_196 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_197 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_198 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_199 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_200 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_201 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_202 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_203 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_204 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_205 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_206 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - elif LA95 == STRING_LITERAL: - LA95_208 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_209 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95 = self.input.LA(2) - if LA95 == 64: - LA95_211 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_212 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 75: - LA95_213 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66: - LA95_214 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 76: - LA95_215 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_216 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_217 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 70: - LA95_218 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 71: - LA95_219 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 68: - LA95_220 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 69: - LA95_221 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 101 or LA95 == 102: - LA95_222 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: - LA95_223 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 95 or LA95 == 96: - LA95_224 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 77: - LA95_225 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 94: - LA95_226 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 93: - LA95_227 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 92: - LA95_228 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 91: - LA95_229 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 90: - LA95_230 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 27: - LA95_231 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 25: - alt95 = 1 - elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: - LA95_234 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 62: - LA95 = self.input.LA(2) - if LA95 == IDENTIFIER: - LA95_235 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == HEX_LITERAL: - LA95_236 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == OCTAL_LITERAL: - LA95_237 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == DECIMAL_LITERAL: - LA95_238 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == CHARACTER_LITERAL: - LA95_239 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == STRING_LITERAL: - LA95_240 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95_241 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_242 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_243 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_244 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95_245 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 74: - LA95_246 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61: - LA95_247 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 34: - LA95_248 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 35: - LA95_249 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 36: - LA95_250 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 37: - LA95_251 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 38: - LA95_252 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 39: - LA95_253 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 40: - LA95_254 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 41: - LA95_255 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 42: - LA95_256 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 45 or LA95 == 46: - LA95_257 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 48: - LA95_258 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 72: - LA95 = self.input.LA(2) - if LA95 == IDENTIFIER: - LA95_259 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == HEX_LITERAL: - LA95_260 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == OCTAL_LITERAL: - LA95_261 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == DECIMAL_LITERAL: - LA95_262 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == CHARACTER_LITERAL: - LA95_263 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == STRING_LITERAL: - LA95_264 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95_265 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_266 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_267 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_268 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95_269 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 74: - LA95_270 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 73: - LA95 = self.input.LA(2) - if LA95 == IDENTIFIER: - LA95_271 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == HEX_LITERAL: - LA95_272 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == OCTAL_LITERAL: - LA95_273 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == DECIMAL_LITERAL: - LA95_274 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == CHARACTER_LITERAL: - LA95_275 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == STRING_LITERAL: - LA95_276 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95_277 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 62: - LA95_278 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_279 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_280 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95_281 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 74: - LA95_282 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95 = self.input.LA(2) - if LA95 == 62: - LA95_283 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == IDENTIFIER: - LA95_284 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == HEX_LITERAL: - LA95_285 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == OCTAL_LITERAL: - LA95_286 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == DECIMAL_LITERAL: - LA95_287 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == CHARACTER_LITERAL: - LA95_288 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == STRING_LITERAL: - LA95_289 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95_290 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_291 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_292 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95_293 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 74: - LA95_294 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 74: - LA95 = self.input.LA(2) - if LA95 == 62: - LA95_295 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == IDENTIFIER: - LA95_296 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == HEX_LITERAL: - LA95_297 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == OCTAL_LITERAL: - LA95_298 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == DECIMAL_LITERAL: - LA95_299 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == CHARACTER_LITERAL: - LA95_300 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == STRING_LITERAL: - LA95_301 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == FLOATING_POINT_LITERAL: - LA95_302 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 72: - LA95_303 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 73: - LA95_304 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: - LA95_305 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - elif LA95 == 74: - LA95_306 = self.input.LA(3) - - if (self.synpred188()) : - alt95 = 1 - - - - elif LA95 == 25 or LA95 == 26 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 43 or LA95 == 45 or LA95 == 46 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61 or LA95 == 103 or LA95 == 104 or LA95 == 105 or LA95 == 106 or LA95 == 107 or LA95 == 108 or LA95 == 110 or LA95 == 111 or LA95 == 112 or LA95 == 113 or LA95 == 114 or LA95 == 115 or LA95 == 116 or LA95 == 117: - alt95 = 1 - - if alt95 == 1: - # C.g:0:0: statement - self.following.append(self.FOLLOW_statement_in_statement_list2242) - self.statement() - self.following.pop() - if self.failed: - return - - - else: - if cnt95 >= 1: - break #loop95 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(95, self.input) - raise eee - - cnt95 += 1 - - - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 67, statement_list_StartIndex) - - pass - - return - - # $ANTLR end statement_list - - class expression_statement_return(object): - def __init__(self): - self.start = None - self.stop = None - - - - # $ANTLR start expression_statement - # C.g:561:1: expression_statement : ( ';' | expression ';' ); - def expression_statement(self, ): - - retval = self.expression_statement_return() - retval.start = self.input.LT(1) - expression_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 68): - return retval - - # C.g:562:2: ( ';' | expression ';' ) - alt96 = 2 - LA96_0 = self.input.LA(1) - - if (LA96_0 == 25) : - alt96 = 1 - elif ((IDENTIFIER <= LA96_0 <= FLOATING_POINT_LITERAL) or LA96_0 == 62 or LA96_0 == 66 or (68 <= LA96_0 <= 69) or (72 <= LA96_0 <= 74) or (77 <= LA96_0 <= 79)) : - alt96 = 2 - else: - if self.backtracking > 0: - self.failed = True - return retval - - nvae = NoViableAltException("561:1: expression_statement : ( ';' | expression ';' );", 96, 0, self.input) - - raise nvae - - if alt96 == 1: - # C.g:562:4: ';' - self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2254) - if self.failed: - return retval - - - elif alt96 == 2: - # C.g:563:4: expression ';' - self.following.append(self.FOLLOW_expression_in_expression_statement2259) - self.expression() - self.following.pop() - if self.failed: - return retval - self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2261) - if self.failed: - return retval - - - retval.stop = self.input.LT(-1) - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 68, expression_statement_StartIndex) - - pass - - return retval - - # $ANTLR end expression_statement - - - # $ANTLR start selection_statement - # C.g:566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement ); - def selection_statement(self, ): - - selection_statement_StartIndex = self.input.index() - e = None - - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 69): - return - - # C.g:567:2: ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement ) - alt98 = 2 - LA98_0 = self.input.LA(1) - - if (LA98_0 == 108) : - alt98 = 1 - elif (LA98_0 == 110) : - alt98 = 2 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement );", 98, 0, self.input) - - raise nvae - - if alt98 == 1: - # C.g:567:4: 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? - self.match(self.input, 108, self.FOLLOW_108_in_selection_statement2272) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2274) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_selection_statement2278) - e = self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2280) - if self.failed: - return - if self.backtracking == 0: - self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - self.following.append(self.FOLLOW_statement_in_selection_statement2284) - self.statement() - self.following.pop() - if self.failed: - return - # C.g:567:167: ( options {k=1; backtrack=false; } : 'else' statement )? - alt97 = 2 - LA97_0 = self.input.LA(1) - - if (LA97_0 == 109) : - alt97 = 1 - if alt97 == 1: - # C.g:567:200: 'else' statement - self.match(self.input, 109, self.FOLLOW_109_in_selection_statement2299) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_selection_statement2301) - self.statement() - self.following.pop() - if self.failed: - return - - - - - - elif alt98 == 2: - # C.g:568:4: 'switch' '(' expression ')' statement - self.match(self.input, 110, self.FOLLOW_110_in_selection_statement2308) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2310) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_selection_statement2312) - self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2314) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_selection_statement2316) - self.statement() - self.following.pop() - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 69, selection_statement_StartIndex) - - pass - - return - - # $ANTLR end selection_statement - - - # $ANTLR start iteration_statement - # C.g:571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement ); - def iteration_statement(self, ): - - iteration_statement_StartIndex = self.input.index() - e = None - - - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 70): - return - - # C.g:572:2: ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement ) - alt100 = 3 - LA100 = self.input.LA(1) - if LA100 == 111: - alt100 = 1 - elif LA100 == 112: - alt100 = 2 - elif LA100 == 113: - alt100 = 3 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement );", 100, 0, self.input) - - raise nvae - - if alt100 == 1: - # C.g:572:4: 'while' '(' e= expression ')' statement - self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2327) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2329) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_iteration_statement2333) - e = self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2335) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_iteration_statement2337) - self.statement() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - - - elif alt100 == 2: - # C.g:573:4: 'do' statement 'while' '(' e= expression ')' ';' - self.match(self.input, 112, self.FOLLOW_112_in_iteration_statement2344) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_iteration_statement2346) - self.statement() - self.following.pop() - if self.failed: - return - self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2348) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2350) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_iteration_statement2354) - e = self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2356) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_iteration_statement2358) - if self.failed: - return - if self.backtracking == 0: - self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - - - elif alt100 == 3: - # C.g:574:4: 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement - self.match(self.input, 113, self.FOLLOW_113_in_iteration_statement2365) - if self.failed: - return - self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2367) - if self.failed: - return - self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2369) - self.expression_statement() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2373) - e = self.expression_statement() - self.following.pop() - if self.failed: - return - # C.g:574:58: ( expression )? - alt99 = 2 - LA99_0 = self.input.LA(1) - - if ((IDENTIFIER <= LA99_0 <= FLOATING_POINT_LITERAL) or LA99_0 == 62 or LA99_0 == 66 or (68 <= LA99_0 <= 69) or (72 <= LA99_0 <= 74) or (77 <= LA99_0 <= 79)) : - alt99 = 1 - if alt99 == 1: - # C.g:0:0: expression - self.following.append(self.FOLLOW_expression_in_iteration_statement2375) - self.expression() - self.following.pop() - if self.failed: - return - - - - self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2378) - if self.failed: - return - self.following.append(self.FOLLOW_statement_in_iteration_statement2380) - self.statement() - self.following.pop() - if self.failed: - return - if self.backtracking == 0: - self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) - - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 70, iteration_statement_StartIndex) - - pass - - return - - # $ANTLR end iteration_statement - - - # $ANTLR start jump_statement - # C.g:577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' ); - def jump_statement(self, ): - - jump_statement_StartIndex = self.input.index() - try: - try: - if self.backtracking > 0 and self.alreadyParsedRule(self.input, 71): - return - - # C.g:578:2: ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' ) - alt101 = 5 - LA101 = self.input.LA(1) - if LA101 == 114: - alt101 = 1 - elif LA101 == 115: - alt101 = 2 - elif LA101 == 116: - alt101 = 3 - elif LA101 == 117: - LA101_4 = self.input.LA(2) - - if (LA101_4 == 25) : - alt101 = 4 - elif ((IDENTIFIER <= LA101_4 <= FLOATING_POINT_LITERAL) or LA101_4 == 62 or LA101_4 == 66 or (68 <= LA101_4 <= 69) or (72 <= LA101_4 <= 74) or (77 <= LA101_4 <= 79)) : - alt101 = 5 - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 4, self.input) - - raise nvae - - else: - if self.backtracking > 0: - self.failed = True - return - - nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 0, self.input) - - raise nvae - - if alt101 == 1: - # C.g:578:4: 'goto' IDENTIFIER ';' - self.match(self.input, 114, self.FOLLOW_114_in_jump_statement2393) - if self.failed: - return - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_jump_statement2395) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2397) - if self.failed: - return - - - elif alt101 == 2: - # C.g:579:4: 'continue' ';' - self.match(self.input, 115, self.FOLLOW_115_in_jump_statement2402) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2404) - if self.failed: - return - - - elif alt101 == 3: - # C.g:580:4: 'break' ';' - self.match(self.input, 116, self.FOLLOW_116_in_jump_statement2409) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2411) - if self.failed: - return - - - elif alt101 == 4: - # C.g:581:4: 'return' ';' - self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2416) - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2418) - if self.failed: - return - - - elif alt101 == 5: - # C.g:582:4: 'return' expression ';' - self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2423) - if self.failed: - return - self.following.append(self.FOLLOW_expression_in_jump_statement2425) - self.expression() - self.following.pop() - if self.failed: - return - self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2427) - if self.failed: - return - - - - except RecognitionException, re: - self.reportError(re) - self.recover(self.input, re) - finally: - if self.backtracking > 0: - self.memoize(self.input, 71, jump_statement_StartIndex) - - pass - - return - - # $ANTLR end jump_statement - - # $ANTLR start synpred2 - def synpred2_fragment(self, ): - # C.g:119:6: ( declaration_specifiers ) - # C.g:119:6: declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_synpred2100) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred2 - - - - # $ANTLR start synpred4 - def synpred4_fragment(self, ): - # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' ) - # C.g:119:6: ( declaration_specifiers )? declarator ( declaration )* '{' - # C.g:119:6: ( declaration_specifiers )? - alt102 = 2 - LA102 = self.input.LA(1) - if LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33 or LA102 == 34 or LA102 == 35 or LA102 == 36 or LA102 == 37 or LA102 == 38 or LA102 == 39 or LA102 == 40 or LA102 == 41 or LA102 == 42 or LA102 == 45 or LA102 == 46 or LA102 == 48 or LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61: - alt102 = 1 - elif LA102 == IDENTIFIER: - LA102 = self.input.LA(2) - if LA102 == 62: - LA102_21 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33: - LA102_23 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 34: - LA102_24 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 35: - LA102_25 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 36: - LA102_26 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 37: - LA102_27 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 38: - LA102_28 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 39: - LA102_29 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 40: - LA102_30 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 41: - LA102_31 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 42: - LA102_32 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 45 or LA102 == 46: - LA102_33 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 48: - LA102_34 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == IDENTIFIER: - LA102_35 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 58: - LA102_36 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 66: - alt102 = 1 - elif LA102 == 59: - LA102_39 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 60: - LA102_40 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61: - LA102_41 = self.input.LA(3) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 58: - LA102_14 = self.input.LA(2) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 59: - LA102_16 = self.input.LA(2) - - if (self.synpred2()) : - alt102 = 1 - elif LA102 == 60: - LA102_17 = self.input.LA(2) - - if (self.synpred2()) : - alt102 = 1 - if alt102 == 1: - # C.g:0:0: declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_synpred4100) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - - - - self.following.append(self.FOLLOW_declarator_in_synpred4103) - self.declarator() - self.following.pop() - if self.failed: - return - # C.g:119:41: ( declaration )* - while True: #loop103 - alt103 = 2 - LA103_0 = self.input.LA(1) - - if (LA103_0 == IDENTIFIER or LA103_0 == 26 or (29 <= LA103_0 <= 42) or (45 <= LA103_0 <= 46) or (48 <= LA103_0 <= 61)) : - alt103 = 1 - - - if alt103 == 1: - # C.g:0:0: declaration - self.following.append(self.FOLLOW_declaration_in_synpred4105) - self.declaration() - self.following.pop() - if self.failed: - return - - - else: - break #loop103 - - - self.match(self.input, 43, self.FOLLOW_43_in_synpred4108) - if self.failed: - return - - - # $ANTLR end synpred4 - - - - # $ANTLR start synpred5 - def synpred5_fragment(self, ): - # C.g:120:4: ( declaration ) - # C.g:120:4: declaration - self.following.append(self.FOLLOW_declaration_in_synpred5118) - self.declaration() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred5 - - - - # $ANTLR start synpred7 - def synpred7_fragment(self, ): - # C.g:146:6: ( declaration_specifiers ) - # C.g:146:6: declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_synpred7157) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred7 - - - - # $ANTLR start synpred10 - def synpred10_fragment(self, ): - # C.g:167:18: ( declaration_specifiers ) - # C.g:167:18: declaration_specifiers - self.following.append(self.FOLLOW_declaration_specifiers_in_synpred10207) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred10 - - - - # $ANTLR start synpred14 - def synpred14_fragment(self, ): - # C.g:184:7: ( type_specifier ) - # C.g:184:7: type_specifier - self.following.append(self.FOLLOW_type_specifier_in_synpred14272) - self.type_specifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred14 - - - - # $ANTLR start synpred15 - def synpred15_fragment(self, ): - # C.g:185:13: ( type_qualifier ) - # C.g:185:13: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred15286) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred15 - - - - # $ANTLR start synpred33 - def synpred33_fragment(self, ): - # C.g:225:16: ( type_qualifier ) - # C.g:225:16: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred33444) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred33 - - - - # $ANTLR start synpred34 - def synpred34_fragment(self, ): - # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator ) - # C.g:225:5: IDENTIFIER ( type_qualifier )* declarator - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred34442) - if self.failed: - return - # C.g:225:16: ( type_qualifier )* - while True: #loop106 - alt106 = 2 - LA106 = self.input.LA(1) - if LA106 == 58: - LA106_2 = self.input.LA(2) - - if (self.synpred33()) : - alt106 = 1 - - - elif LA106 == 59: - LA106_3 = self.input.LA(2) - - if (self.synpred33()) : - alt106 = 1 - - - elif LA106 == 60: - LA106_4 = self.input.LA(2) - - if (self.synpred33()) : - alt106 = 1 - - - elif LA106 == 49 or LA106 == 50 or LA106 == 51 or LA106 == 52 or LA106 == 53 or LA106 == 54 or LA106 == 55 or LA106 == 56 or LA106 == 57 or LA106 == 61: - alt106 = 1 - - if alt106 == 1: - # C.g:0:0: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred34444) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - else: - break #loop106 - - - self.following.append(self.FOLLOW_declarator_in_synpred34447) - self.declarator() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred34 - - - - # $ANTLR start synpred39 - def synpred39_fragment(self, ): - # C.g:253:6: ( type_qualifier ) - # C.g:253:6: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred39566) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred39 - - - - # $ANTLR start synpred40 - def synpred40_fragment(self, ): - # C.g:253:23: ( type_specifier ) - # C.g:253:23: type_specifier - self.following.append(self.FOLLOW_type_specifier_in_synpred40570) - self.type_specifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred40 - - - - # $ANTLR start synpred66 - def synpred66_fragment(self, ): - # C.g:297:4: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator ) - # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator - # C.g:297:4: ( pointer )? - alt111 = 2 - LA111_0 = self.input.LA(1) - - if (LA111_0 == 66) : - alt111 = 1 - if alt111 == 1: - # C.g:0:0: pointer - self.following.append(self.FOLLOW_pointer_in_synpred66784) - self.pointer() - self.following.pop() - if self.failed: - return - - - - # C.g:297:13: ( 'EFIAPI' )? - alt112 = 2 - LA112_0 = self.input.LA(1) - - if (LA112_0 == 58) : - alt112 = 1 - if alt112 == 1: - # C.g:297:14: 'EFIAPI' - self.match(self.input, 58, self.FOLLOW_58_in_synpred66788) - if self.failed: - return - - - - # C.g:297:25: ( 'EFI_BOOTSERVICE' )? - alt113 = 2 - LA113_0 = self.input.LA(1) - - if (LA113_0 == 59) : - alt113 = 1 - if alt113 == 1: - # C.g:297:26: 'EFI_BOOTSERVICE' - self.match(self.input, 59, self.FOLLOW_59_in_synpred66793) - if self.failed: - return - - - - # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )? - alt114 = 2 - LA114_0 = self.input.LA(1) - - if (LA114_0 == 60) : - alt114 = 1 - if alt114 == 1: - # C.g:297:47: 'EFI_RUNTIMESERVICE' - self.match(self.input, 60, self.FOLLOW_60_in_synpred66798) - if self.failed: - return - - - - self.following.append(self.FOLLOW_direct_declarator_in_synpred66802) - self.direct_declarator() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred66 - - - - # $ANTLR start synpred67 - def synpred67_fragment(self, ): - # C.g:303:15: ( declarator_suffix ) - # C.g:303:15: declarator_suffix - self.following.append(self.FOLLOW_declarator_suffix_in_synpred67821) - self.declarator_suffix() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred67 - - - - # $ANTLR start synpred69 - def synpred69_fragment(self, ): - # C.g:304:9: ( 'EFIAPI' ) - # C.g:304:9: 'EFIAPI' - self.match(self.input, 58, self.FOLLOW_58_in_synpred69830) - if self.failed: - return - - - # $ANTLR end synpred69 - - - - # $ANTLR start synpred70 - def synpred70_fragment(self, ): - # C.g:304:35: ( declarator_suffix ) - # C.g:304:35: declarator_suffix - self.following.append(self.FOLLOW_declarator_suffix_in_synpred70838) - self.declarator_suffix() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred70 - - - - # $ANTLR start synpred73 - def synpred73_fragment(self, ): - # C.g:310:9: ( '(' parameter_type_list ')' ) - # C.g:310:9: '(' parameter_type_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_synpred73878) - if self.failed: - return - self.following.append(self.FOLLOW_parameter_type_list_in_synpred73880) - self.parameter_type_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred73882) - if self.failed: - return - - - # $ANTLR end synpred73 - - - - # $ANTLR start synpred74 - def synpred74_fragment(self, ): - # C.g:311:9: ( '(' identifier_list ')' ) - # C.g:311:9: '(' identifier_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_synpred74892) - if self.failed: - return - self.following.append(self.FOLLOW_identifier_list_in_synpred74894) - self.identifier_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred74896) - if self.failed: - return - - - # $ANTLR end synpred74 - - - - # $ANTLR start synpred75 - def synpred75_fragment(self, ): - # C.g:316:8: ( type_qualifier ) - # C.g:316:8: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred75921) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred75 - - - - # $ANTLR start synpred76 - def synpred76_fragment(self, ): - # C.g:316:24: ( pointer ) - # C.g:316:24: pointer - self.following.append(self.FOLLOW_pointer_in_synpred76924) - self.pointer() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred76 - - - - # $ANTLR start synpred77 - def synpred77_fragment(self, ): - # C.g:316:4: ( '*' ( type_qualifier )+ ( pointer )? ) - # C.g:316:4: '*' ( type_qualifier )+ ( pointer )? - self.match(self.input, 66, self.FOLLOW_66_in_synpred77919) - if self.failed: - return - # C.g:316:8: ( type_qualifier )+ - cnt116 = 0 - while True: #loop116 - alt116 = 2 - LA116_0 = self.input.LA(1) - - if ((49 <= LA116_0 <= 61)) : - alt116 = 1 - - - if alt116 == 1: - # C.g:0:0: type_qualifier - self.following.append(self.FOLLOW_type_qualifier_in_synpred77921) - self.type_qualifier() - self.following.pop() - if self.failed: - return - - - else: - if cnt116 >= 1: - break #loop116 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(116, self.input) - raise eee - - cnt116 += 1 - - - # C.g:316:24: ( pointer )? - alt117 = 2 - LA117_0 = self.input.LA(1) - - if (LA117_0 == 66) : - alt117 = 1 - if alt117 == 1: - # C.g:0:0: pointer - self.following.append(self.FOLLOW_pointer_in_synpred77924) - self.pointer() - self.following.pop() - if self.failed: - return - - - - - - # $ANTLR end synpred77 - - - - # $ANTLR start synpred78 - def synpred78_fragment(self, ): - # C.g:317:4: ( '*' pointer ) - # C.g:317:4: '*' pointer - self.match(self.input, 66, self.FOLLOW_66_in_synpred78930) - if self.failed: - return - self.following.append(self.FOLLOW_pointer_in_synpred78932) - self.pointer() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred78 - - - - # $ANTLR start synpred81 - def synpred81_fragment(self, ): - # C.g:326:32: ( 'OPTIONAL' ) - # C.g:326:32: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_synpred81977) - if self.failed: - return - - - # $ANTLR end synpred81 - - - - # $ANTLR start synpred82 - def synpred82_fragment(self, ): - # C.g:326:27: ( ',' ( 'OPTIONAL' )? parameter_declaration ) - # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration - self.match(self.input, 27, self.FOLLOW_27_in_synpred82974) - if self.failed: - return - # C.g:326:31: ( 'OPTIONAL' )? - alt119 = 2 - LA119_0 = self.input.LA(1) - - if (LA119_0 == 53) : - LA119_1 = self.input.LA(2) - - if (self.synpred81()) : - alt119 = 1 - if alt119 == 1: - # C.g:326:32: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_synpred82977) - if self.failed: - return - - - - self.following.append(self.FOLLOW_parameter_declaration_in_synpred82981) - self.parameter_declaration() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred82 - - - - # $ANTLR start synpred83 - def synpred83_fragment(self, ): - # C.g:330:28: ( declarator ) - # C.g:330:28: declarator - self.following.append(self.FOLLOW_declarator_in_synpred83997) - self.declarator() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred83 - - - - # $ANTLR start synpred84 - def synpred84_fragment(self, ): - # C.g:330:39: ( abstract_declarator ) - # C.g:330:39: abstract_declarator - self.following.append(self.FOLLOW_abstract_declarator_in_synpred84999) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred84 - - - - # $ANTLR start synpred86 - def synpred86_fragment(self, ): - # C.g:330:4: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? ) - # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? - self.following.append(self.FOLLOW_declaration_specifiers_in_synpred86994) - self.declaration_specifiers() - self.following.pop() - if self.failed: - return - # C.g:330:27: ( declarator | abstract_declarator )* - while True: #loop120 - alt120 = 3 - LA120 = self.input.LA(1) - if LA120 == 66: - LA120_3 = self.input.LA(2) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == IDENTIFIER or LA120 == 58 or LA120 == 59 or LA120 == 60: - alt120 = 1 - elif LA120 == 62: - LA120 = self.input.LA(2) - if LA120 == 29 or LA120 == 30 or LA120 == 31 or LA120 == 32 or LA120 == 33 or LA120 == 34 or LA120 == 35 or LA120 == 36 or LA120 == 37 or LA120 == 38 or LA120 == 39 or LA120 == 40 or LA120 == 41 or LA120 == 42 or LA120 == 45 or LA120 == 46 or LA120 == 48 or LA120 == 49 or LA120 == 50 or LA120 == 51 or LA120 == 52 or LA120 == 53 or LA120 == 54 or LA120 == 55 or LA120 == 56 or LA120 == 57 or LA120 == 61 or LA120 == 63 or LA120 == 64: - alt120 = 2 - elif LA120 == 58: - LA120_21 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == 66: - LA120_22 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == 59: - LA120_23 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == 60: - LA120_24 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == IDENTIFIER: - LA120_25 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - elif LA120 == 62: - LA120_26 = self.input.LA(3) - - if (self.synpred83()) : - alt120 = 1 - elif (self.synpred84()) : - alt120 = 2 - - - - elif LA120 == 64: - alt120 = 2 - - if alt120 == 1: - # C.g:330:28: declarator - self.following.append(self.FOLLOW_declarator_in_synpred86997) - self.declarator() - self.following.pop() - if self.failed: - return - - - elif alt120 == 2: - # C.g:330:39: abstract_declarator - self.following.append(self.FOLLOW_abstract_declarator_in_synpred86999) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - - - else: - break #loop120 - - - # C.g:330:61: ( 'OPTIONAL' )? - alt121 = 2 - LA121_0 = self.input.LA(1) - - if (LA121_0 == 53) : - alt121 = 1 - if alt121 == 1: - # C.g:330:62: 'OPTIONAL' - self.match(self.input, 53, self.FOLLOW_53_in_synpred861004) - if self.failed: - return - - - - - - # $ANTLR end synpred86 - - - - # $ANTLR start synpred90 - def synpred90_fragment(self, ): - # C.g:341:4: ( specifier_qualifier_list ( abstract_declarator )? ) - # C.g:341:4: specifier_qualifier_list ( abstract_declarator )? - self.following.append(self.FOLLOW_specifier_qualifier_list_in_synpred901046) - self.specifier_qualifier_list() - self.following.pop() - if self.failed: - return - # C.g:341:29: ( abstract_declarator )? - alt122 = 2 - LA122_0 = self.input.LA(1) - - if (LA122_0 == 62 or LA122_0 == 64 or LA122_0 == 66) : - alt122 = 1 - if alt122 == 1: - # C.g:0:0: abstract_declarator - self.following.append(self.FOLLOW_abstract_declarator_in_synpred901048) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - - - - - - # $ANTLR end synpred90 - - - - # $ANTLR start synpred91 - def synpred91_fragment(self, ): - # C.g:346:12: ( direct_abstract_declarator ) - # C.g:346:12: direct_abstract_declarator - self.following.append(self.FOLLOW_direct_abstract_declarator_in_synpred911067) - self.direct_abstract_declarator() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred91 - - - - # $ANTLR start synpred93 - def synpred93_fragment(self, ): - # C.g:351:6: ( '(' abstract_declarator ')' ) - # C.g:351:6: '(' abstract_declarator ')' - self.match(self.input, 62, self.FOLLOW_62_in_synpred931086) - if self.failed: - return - self.following.append(self.FOLLOW_abstract_declarator_in_synpred931088) - self.abstract_declarator() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred931090) - if self.failed: - return - - - # $ANTLR end synpred93 - - - - # $ANTLR start synpred94 - def synpred94_fragment(self, ): - # C.g:351:65: ( abstract_declarator_suffix ) - # C.g:351:65: abstract_declarator_suffix - self.following.append(self.FOLLOW_abstract_declarator_suffix_in_synpred941098) - self.abstract_declarator_suffix() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred94 - - - - # $ANTLR start synpred109 - def synpred109_fragment(self, ): - # C.g:386:4: ( '(' type_name ')' cast_expression ) - # C.g:386:4: '(' type_name ')' cast_expression - self.match(self.input, 62, self.FOLLOW_62_in_synpred1091282) - if self.failed: - return - self.following.append(self.FOLLOW_type_name_in_synpred1091284) - self.type_name() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred1091286) - if self.failed: - return - self.following.append(self.FOLLOW_cast_expression_in_synpred1091288) - self.cast_expression() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred109 - - - - # $ANTLR start synpred114 - def synpred114_fragment(self, ): - # C.g:395:4: ( 'sizeof' unary_expression ) - # C.g:395:4: 'sizeof' unary_expression - self.match(self.input, 74, self.FOLLOW_74_in_synpred1141330) - if self.failed: - return - self.following.append(self.FOLLOW_unary_expression_in_synpred1141332) - self.unary_expression() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred114 - - - - # $ANTLR start synpred117 - def synpred117_fragment(self, ): - # C.g:409:13: ( '(' argument_expression_list ')' ) - # C.g:409:13: '(' argument_expression_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_synpred1171420) - if self.failed: - return - self.following.append(self.FOLLOW_argument_expression_list_in_synpred1171424) - self.argument_expression_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred1171428) - if self.failed: - return - - - # $ANTLR end synpred117 - - - - # $ANTLR start synpred118 - def synpred118_fragment(self, ): - # C.g:410:13: ( '(' macro_parameter_list ')' ) - # C.g:410:13: '(' macro_parameter_list ')' - self.match(self.input, 62, self.FOLLOW_62_in_synpred1181444) - if self.failed: - return - self.following.append(self.FOLLOW_macro_parameter_list_in_synpred1181446) - self.macro_parameter_list() - self.following.pop() - if self.failed: - return - self.match(self.input, 63, self.FOLLOW_63_in_synpred1181448) - if self.failed: - return - - - # $ANTLR end synpred118 - - - - # $ANTLR start synpred120 - def synpred120_fragment(self, ): - # C.g:412:13: ( '*' IDENTIFIER ) - # C.g:412:13: '*' IDENTIFIER - self.match(self.input, 66, self.FOLLOW_66_in_synpred1201482) - if self.failed: - return - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1201486) - if self.failed: - return - - - # $ANTLR end synpred120 - - - - # $ANTLR start synpred137 - def synpred137_fragment(self, ): - # C.g:443:20: ( STRING_LITERAL ) - # C.g:443:20: STRING_LITERAL - self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1371683) - if self.failed: - return - - - # $ANTLR end synpred137 - - - - # $ANTLR start synpred138 - def synpred138_fragment(self, ): - # C.g:443:8: ( ( IDENTIFIER )* ( STRING_LITERAL )+ ) - # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+ - # C.g:443:8: ( IDENTIFIER )* - while True: #loop125 - alt125 = 2 - LA125_0 = self.input.LA(1) - - if (LA125_0 == IDENTIFIER) : - alt125 = 1 - - - if alt125 == 1: - # C.g:0:0: IDENTIFIER - self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1381680) - if self.failed: - return - - - else: - break #loop125 - - - # C.g:443:20: ( STRING_LITERAL )+ - cnt126 = 0 - while True: #loop126 - alt126 = 2 - LA126_0 = self.input.LA(1) - - if (LA126_0 == STRING_LITERAL) : - alt126 = 1 - - - if alt126 == 1: - # C.g:0:0: STRING_LITERAL - self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1381683) - if self.failed: - return - - - else: - if cnt126 >= 1: - break #loop126 - - if self.backtracking > 0: - self.failed = True - return - - eee = EarlyExitException(126, self.input) - raise eee - - cnt126 += 1 - - - - - # $ANTLR end synpred138 - - - - # $ANTLR start synpred142 - def synpred142_fragment(self, ): - # C.g:458:4: ( lvalue assignment_operator assignment_expression ) - # C.g:458:4: lvalue assignment_operator assignment_expression - self.following.append(self.FOLLOW_lvalue_in_synpred1421744) - self.lvalue() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_assignment_operator_in_synpred1421746) - self.assignment_operator() - self.following.pop() - if self.failed: - return - self.following.append(self.FOLLOW_assignment_expression_in_synpred1421748) - self.assignment_expression() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred142 - - - - # $ANTLR start synpred169 - def synpred169_fragment(self, ): - # C.g:520:4: ( expression_statement ) - # C.g:520:4: expression_statement - self.following.append(self.FOLLOW_expression_statement_in_synpred1692035) - self.expression_statement() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred169 - - - - # $ANTLR start synpred173 - def synpred173_fragment(self, ): - # C.g:524:4: ( macro_statement ) - # C.g:524:4: macro_statement - self.following.append(self.FOLLOW_macro_statement_in_synpred1732055) - self.macro_statement() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred173 - - - - # $ANTLR start synpred174 - def synpred174_fragment(self, ): - # C.g:525:4: ( asm2_statement ) - # C.g:525:4: asm2_statement - self.following.append(self.FOLLOW_asm2_statement_in_synpred1742060) - self.asm2_statement() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred174 - - - - # $ANTLR start synpred181 - def synpred181_fragment(self, ): - # C.g:544:19: ( declaration ) - # C.g:544:19: declaration - self.following.append(self.FOLLOW_declaration_in_synpred1812166) - self.declaration() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred181 - - - - # $ANTLR start synpred182 - def synpred182_fragment(self, ): - # C.g:544:33: ( statement_list ) - # C.g:544:33: statement_list - self.following.append(self.FOLLOW_statement_list_in_synpred1822170) - self.statement_list() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred182 - - - - # $ANTLR start synpred186 - def synpred186_fragment(self, ): - # C.g:554:8: ( declaration ) - # C.g:554:8: declaration - self.following.append(self.FOLLOW_declaration_in_synpred1862225) - self.declaration() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred186 - - - - # $ANTLR start synpred188 - def synpred188_fragment(self, ): - # C.g:558:4: ( statement ) - # C.g:558:4: statement - self.following.append(self.FOLLOW_statement_in_synpred1882242) - self.statement() - self.following.pop() - if self.failed: - return - - - # $ANTLR end synpred188 - - - - def synpred69(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred69_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred81(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred81_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred82(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred82_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred66(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred66_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred83(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred83_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred84(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred84_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred67(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred67_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred86(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred86_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred120(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred120_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred40(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred40_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred142(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred142_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred182(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred182_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred109(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred109_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred181(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred181_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred186(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred186_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred188(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred188_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred169(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred169_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred117(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred117_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred70(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred70_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred118(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred118_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred34(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred34_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred33(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred33_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred94(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred94_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred39(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred39_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred74(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred74_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred114(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred114_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred93(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred93_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred75(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred75_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred137(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred137_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred90(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred90_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred138(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred138_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred91(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred91_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred73(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred73_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred5(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred5_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred78(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred78_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred7(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred7_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred76(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred76_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred77(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred77_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred2(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred2_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred4(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred4_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred174(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred174_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred173(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred173_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred14(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred14_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred15(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred15_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - def synpred10(self): - self.backtracking += 1 - start = self.input.mark() - self.synpred10_fragment() - success = not self.failed - self.input.rewind(start) - self.backtracking -= 1 - self.failed = False - return success - - - - - - FOLLOW_external_declaration_in_translation_unit74 = frozenset([1, 4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) - FOLLOW_function_definition_in_external_declaration113 = frozenset([1]) - FOLLOW_declaration_in_external_declaration118 = frozenset([1]) - FOLLOW_macro_statement_in_external_declaration123 = frozenset([1, 25]) - FOLLOW_25_in_external_declaration126 = frozenset([1]) - FOLLOW_declaration_specifiers_in_function_definition157 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_declarator_in_function_definition160 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_declaration_in_function_definition166 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_compound_statement_in_function_definition171 = frozenset([1]) - FOLLOW_compound_statement_in_function_definition180 = frozenset([1]) - FOLLOW_26_in_declaration203 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) - FOLLOW_declaration_specifiers_in_declaration207 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_init_declarator_list_in_declaration216 = frozenset([25]) - FOLLOW_25_in_declaration220 = frozenset([1]) - FOLLOW_declaration_specifiers_in_declaration234 = frozenset([4, 25, 58, 59, 60, 62, 66]) - FOLLOW_init_declarator_list_in_declaration238 = frozenset([25]) - FOLLOW_25_in_declaration243 = frozenset([1]) - FOLLOW_storage_class_specifier_in_declaration_specifiers264 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_specifier_in_declaration_specifiers272 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_qualifier_in_declaration_specifiers286 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_init_declarator_in_init_declarator_list308 = frozenset([1, 27]) - FOLLOW_27_in_init_declarator_list311 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_init_declarator_in_init_declarator_list313 = frozenset([1, 27]) - FOLLOW_declarator_in_init_declarator326 = frozenset([1, 28]) - FOLLOW_28_in_init_declarator329 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_initializer_in_init_declarator331 = frozenset([1]) - FOLLOW_set_in_storage_class_specifier0 = frozenset([1]) - FOLLOW_34_in_type_specifier376 = frozenset([1]) - FOLLOW_35_in_type_specifier381 = frozenset([1]) - FOLLOW_36_in_type_specifier386 = frozenset([1]) - FOLLOW_37_in_type_specifier391 = frozenset([1]) - FOLLOW_38_in_type_specifier396 = frozenset([1]) - FOLLOW_39_in_type_specifier401 = frozenset([1]) - FOLLOW_40_in_type_specifier406 = frozenset([1]) - FOLLOW_41_in_type_specifier411 = frozenset([1]) - FOLLOW_42_in_type_specifier416 = frozenset([1]) - FOLLOW_struct_or_union_specifier_in_type_specifier423 = frozenset([1]) - FOLLOW_enum_specifier_in_type_specifier433 = frozenset([1]) - FOLLOW_type_id_in_type_specifier451 = frozenset([1]) - FOLLOW_IDENTIFIER_in_type_id467 = frozenset([1]) - FOLLOW_struct_or_union_in_struct_or_union_specifier494 = frozenset([4, 43]) - FOLLOW_IDENTIFIER_in_struct_or_union_specifier496 = frozenset([43]) - FOLLOW_43_in_struct_or_union_specifier499 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_struct_declaration_list_in_struct_or_union_specifier501 = frozenset([44]) - FOLLOW_44_in_struct_or_union_specifier503 = frozenset([1]) - FOLLOW_struct_or_union_in_struct_or_union_specifier508 = frozenset([4]) - FOLLOW_IDENTIFIER_in_struct_or_union_specifier510 = frozenset([1]) - FOLLOW_set_in_struct_or_union0 = frozenset([1]) - FOLLOW_struct_declaration_in_struct_declaration_list537 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_specifier_qualifier_list_in_struct_declaration549 = frozenset([4, 47, 58, 59, 60, 62, 66]) - FOLLOW_struct_declarator_list_in_struct_declaration551 = frozenset([25]) - FOLLOW_25_in_struct_declaration553 = frozenset([1]) - FOLLOW_type_qualifier_in_specifier_qualifier_list566 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_specifier_in_specifier_qualifier_list570 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_struct_declarator_in_struct_declarator_list584 = frozenset([1, 27]) - FOLLOW_27_in_struct_declarator_list587 = frozenset([4, 47, 58, 59, 60, 62, 66]) - FOLLOW_struct_declarator_in_struct_declarator_list589 = frozenset([1, 27]) - FOLLOW_declarator_in_struct_declarator602 = frozenset([1, 47]) - FOLLOW_47_in_struct_declarator605 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_struct_declarator607 = frozenset([1]) - FOLLOW_47_in_struct_declarator614 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_struct_declarator616 = frozenset([1]) - FOLLOW_48_in_enum_specifier634 = frozenset([43]) - FOLLOW_43_in_enum_specifier636 = frozenset([4]) - FOLLOW_enumerator_list_in_enum_specifier638 = frozenset([27, 44]) - FOLLOW_27_in_enum_specifier640 = frozenset([44]) - FOLLOW_44_in_enum_specifier643 = frozenset([1]) - FOLLOW_48_in_enum_specifier648 = frozenset([4]) - FOLLOW_IDENTIFIER_in_enum_specifier650 = frozenset([43]) - FOLLOW_43_in_enum_specifier652 = frozenset([4]) - FOLLOW_enumerator_list_in_enum_specifier654 = frozenset([27, 44]) - FOLLOW_27_in_enum_specifier656 = frozenset([44]) - FOLLOW_44_in_enum_specifier659 = frozenset([1]) - FOLLOW_48_in_enum_specifier664 = frozenset([4]) - FOLLOW_IDENTIFIER_in_enum_specifier666 = frozenset([1]) - FOLLOW_enumerator_in_enumerator_list677 = frozenset([1, 27]) - FOLLOW_27_in_enumerator_list680 = frozenset([4]) - FOLLOW_enumerator_in_enumerator_list682 = frozenset([1, 27]) - FOLLOW_IDENTIFIER_in_enumerator695 = frozenset([1, 28]) - FOLLOW_28_in_enumerator698 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_enumerator700 = frozenset([1]) - FOLLOW_set_in_type_qualifier0 = frozenset([1]) - FOLLOW_pointer_in_declarator784 = frozenset([4, 58, 59, 60, 62]) - FOLLOW_58_in_declarator788 = frozenset([4, 59, 60, 62]) - FOLLOW_59_in_declarator793 = frozenset([4, 60, 62]) - FOLLOW_60_in_declarator798 = frozenset([4, 62]) - FOLLOW_direct_declarator_in_declarator802 = frozenset([1]) - FOLLOW_pointer_in_declarator808 = frozenset([1]) - FOLLOW_IDENTIFIER_in_direct_declarator819 = frozenset([1, 62, 64]) - FOLLOW_declarator_suffix_in_direct_declarator821 = frozenset([1, 62, 64]) - FOLLOW_62_in_direct_declarator827 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_58_in_direct_declarator830 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_declarator_in_direct_declarator834 = frozenset([63]) - FOLLOW_63_in_direct_declarator836 = frozenset([62, 64]) - FOLLOW_declarator_suffix_in_direct_declarator838 = frozenset([1, 62, 64]) - FOLLOW_64_in_declarator_suffix852 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_declarator_suffix854 = frozenset([65]) - FOLLOW_65_in_declarator_suffix856 = frozenset([1]) - FOLLOW_64_in_declarator_suffix866 = frozenset([65]) - FOLLOW_65_in_declarator_suffix868 = frozenset([1]) - FOLLOW_62_in_declarator_suffix878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_type_list_in_declarator_suffix880 = frozenset([63]) - FOLLOW_63_in_declarator_suffix882 = frozenset([1]) - FOLLOW_62_in_declarator_suffix892 = frozenset([4]) - FOLLOW_identifier_list_in_declarator_suffix894 = frozenset([63]) - FOLLOW_63_in_declarator_suffix896 = frozenset([1]) - FOLLOW_62_in_declarator_suffix906 = frozenset([63]) - FOLLOW_63_in_declarator_suffix908 = frozenset([1]) - FOLLOW_66_in_pointer919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_qualifier_in_pointer921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_pointer_in_pointer924 = frozenset([1]) - FOLLOW_66_in_pointer930 = frozenset([66]) - FOLLOW_pointer_in_pointer932 = frozenset([1]) - FOLLOW_66_in_pointer937 = frozenset([1]) - FOLLOW_parameter_list_in_parameter_type_list948 = frozenset([1, 27]) - FOLLOW_27_in_parameter_type_list951 = frozenset([53, 67]) - FOLLOW_53_in_parameter_type_list954 = frozenset([67]) - FOLLOW_67_in_parameter_type_list958 = frozenset([1]) - FOLLOW_parameter_declaration_in_parameter_list971 = frozenset([1, 27]) - FOLLOW_27_in_parameter_list974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_53_in_parameter_list977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_declaration_in_parameter_list981 = frozenset([1, 27]) - FOLLOW_declaration_specifiers_in_parameter_declaration994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_declarator_in_parameter_declaration997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_abstract_declarator_in_parameter_declaration999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_53_in_parameter_declaration1004 = frozenset([1]) - FOLLOW_pointer_in_parameter_declaration1013 = frozenset([4, 66]) - FOLLOW_IDENTIFIER_in_parameter_declaration1016 = frozenset([1]) - FOLLOW_IDENTIFIER_in_identifier_list1027 = frozenset([1, 27]) - FOLLOW_27_in_identifier_list1031 = frozenset([4]) - FOLLOW_IDENTIFIER_in_identifier_list1033 = frozenset([1, 27]) - FOLLOW_specifier_qualifier_list_in_type_name1046 = frozenset([1, 62, 64, 66]) - FOLLOW_abstract_declarator_in_type_name1048 = frozenset([1]) - FOLLOW_type_id_in_type_name1054 = frozenset([1]) - FOLLOW_pointer_in_abstract_declarator1065 = frozenset([1, 62, 64]) - FOLLOW_direct_abstract_declarator_in_abstract_declarator1067 = frozenset([1]) - FOLLOW_direct_abstract_declarator_in_abstract_declarator1073 = frozenset([1]) - FOLLOW_62_in_direct_abstract_declarator1086 = frozenset([62, 64, 66]) - FOLLOW_abstract_declarator_in_direct_abstract_declarator1088 = frozenset([63]) - FOLLOW_63_in_direct_abstract_declarator1090 = frozenset([1, 62, 64]) - FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094 = frozenset([1, 62, 64]) - FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098 = frozenset([1, 62, 64]) - FOLLOW_64_in_abstract_declarator_suffix1110 = frozenset([65]) - FOLLOW_65_in_abstract_declarator_suffix1112 = frozenset([1]) - FOLLOW_64_in_abstract_declarator_suffix1117 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_abstract_declarator_suffix1119 = frozenset([65]) - FOLLOW_65_in_abstract_declarator_suffix1121 = frozenset([1]) - FOLLOW_62_in_abstract_declarator_suffix1126 = frozenset([63]) - FOLLOW_63_in_abstract_declarator_suffix1128 = frozenset([1]) - FOLLOW_62_in_abstract_declarator_suffix1133 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135 = frozenset([63]) - FOLLOW_63_in_abstract_declarator_suffix1137 = frozenset([1]) - FOLLOW_assignment_expression_in_initializer1150 = frozenset([1]) - FOLLOW_43_in_initializer1155 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_initializer_list_in_initializer1157 = frozenset([27, 44]) - FOLLOW_27_in_initializer1159 = frozenset([44]) - FOLLOW_44_in_initializer1162 = frozenset([1]) - FOLLOW_initializer_in_initializer_list1173 = frozenset([1, 27]) - FOLLOW_27_in_initializer_list1176 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_initializer_in_initializer_list1178 = frozenset([1, 27]) - FOLLOW_assignment_expression_in_argument_expression_list1196 = frozenset([1, 27, 53]) - FOLLOW_53_in_argument_expression_list1199 = frozenset([1, 27]) - FOLLOW_27_in_argument_expression_list1204 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_assignment_expression_in_argument_expression_list1206 = frozenset([1, 27, 53]) - FOLLOW_53_in_argument_expression_list1209 = frozenset([1, 27]) - FOLLOW_multiplicative_expression_in_additive_expression1225 = frozenset([1, 68, 69]) - FOLLOW_68_in_additive_expression1229 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_multiplicative_expression_in_additive_expression1231 = frozenset([1, 68, 69]) - FOLLOW_69_in_additive_expression1235 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_multiplicative_expression_in_additive_expression1237 = frozenset([1, 68, 69]) - FOLLOW_cast_expression_in_multiplicative_expression1251 = frozenset([1, 66, 70, 71]) - FOLLOW_66_in_multiplicative_expression1255 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_multiplicative_expression1257 = frozenset([1, 66, 70, 71]) - FOLLOW_70_in_multiplicative_expression1261 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_multiplicative_expression1263 = frozenset([1, 66, 70, 71]) - FOLLOW_71_in_multiplicative_expression1267 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_multiplicative_expression1269 = frozenset([1, 66, 70, 71]) - FOLLOW_62_in_cast_expression1282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_name_in_cast_expression1284 = frozenset([63]) - FOLLOW_63_in_cast_expression1286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_cast_expression1288 = frozenset([1]) - FOLLOW_unary_expression_in_cast_expression1293 = frozenset([1]) - FOLLOW_postfix_expression_in_unary_expression1304 = frozenset([1]) - FOLLOW_72_in_unary_expression1309 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_unary_expression_in_unary_expression1311 = frozenset([1]) - FOLLOW_73_in_unary_expression1316 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_unary_expression_in_unary_expression1318 = frozenset([1]) - FOLLOW_unary_operator_in_unary_expression1323 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_unary_expression1325 = frozenset([1]) - FOLLOW_74_in_unary_expression1330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_unary_expression_in_unary_expression1332 = frozenset([1]) - FOLLOW_74_in_unary_expression1337 = frozenset([62]) - FOLLOW_62_in_unary_expression1339 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_name_in_unary_expression1341 = frozenset([63]) - FOLLOW_63_in_unary_expression1343 = frozenset([1]) - FOLLOW_primary_expression_in_postfix_expression1367 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_64_in_postfix_expression1383 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_postfix_expression1385 = frozenset([65]) - FOLLOW_65_in_postfix_expression1387 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_62_in_postfix_expression1401 = frozenset([63]) - FOLLOW_63_in_postfix_expression1405 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_62_in_postfix_expression1420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_argument_expression_list_in_postfix_expression1424 = frozenset([63]) - FOLLOW_63_in_postfix_expression1428 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_62_in_postfix_expression1444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_macro_parameter_list_in_postfix_expression1446 = frozenset([63]) - FOLLOW_63_in_postfix_expression1448 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_75_in_postfix_expression1462 = frozenset([4]) - FOLLOW_IDENTIFIER_in_postfix_expression1466 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_66_in_postfix_expression1482 = frozenset([4]) - FOLLOW_IDENTIFIER_in_postfix_expression1486 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_76_in_postfix_expression1502 = frozenset([4]) - FOLLOW_IDENTIFIER_in_postfix_expression1506 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_72_in_postfix_expression1522 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_73_in_postfix_expression1536 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) - FOLLOW_parameter_declaration_in_macro_parameter_list1559 = frozenset([1, 27]) - FOLLOW_27_in_macro_parameter_list1562 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_declaration_in_macro_parameter_list1564 = frozenset([1, 27]) - FOLLOW_set_in_unary_operator0 = frozenset([1]) - FOLLOW_IDENTIFIER_in_primary_expression1613 = frozenset([1]) - FOLLOW_constant_in_primary_expression1618 = frozenset([1]) - FOLLOW_62_in_primary_expression1623 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_primary_expression1625 = frozenset([63]) - FOLLOW_63_in_primary_expression1627 = frozenset([1]) - FOLLOW_HEX_LITERAL_in_constant1643 = frozenset([1]) - FOLLOW_OCTAL_LITERAL_in_constant1653 = frozenset([1]) - FOLLOW_DECIMAL_LITERAL_in_constant1663 = frozenset([1]) - FOLLOW_CHARACTER_LITERAL_in_constant1671 = frozenset([1]) - FOLLOW_IDENTIFIER_in_constant1680 = frozenset([4, 9]) - FOLLOW_STRING_LITERAL_in_constant1683 = frozenset([1, 4, 9]) - FOLLOW_IDENTIFIER_in_constant1688 = frozenset([1, 4]) - FOLLOW_FLOATING_POINT_LITERAL_in_constant1699 = frozenset([1]) - FOLLOW_assignment_expression_in_expression1715 = frozenset([1, 27]) - FOLLOW_27_in_expression1718 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_assignment_expression_in_expression1720 = frozenset([1, 27]) - FOLLOW_conditional_expression_in_constant_expression1733 = frozenset([1]) - FOLLOW_lvalue_in_assignment_expression1744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]) - FOLLOW_assignment_operator_in_assignment_expression1746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_assignment_expression_in_assignment_expression1748 = frozenset([1]) - FOLLOW_conditional_expression_in_assignment_expression1753 = frozenset([1]) - FOLLOW_unary_expression_in_lvalue1765 = frozenset([1]) - FOLLOW_set_in_assignment_operator0 = frozenset([1]) - FOLLOW_logical_or_expression_in_conditional_expression1839 = frozenset([1, 90]) - FOLLOW_90_in_conditional_expression1842 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_conditional_expression1844 = frozenset([47]) - FOLLOW_47_in_conditional_expression1846 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_conditional_expression_in_conditional_expression1848 = frozenset([1]) - FOLLOW_logical_and_expression_in_logical_or_expression1863 = frozenset([1, 91]) - FOLLOW_91_in_logical_or_expression1866 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_logical_and_expression_in_logical_or_expression1868 = frozenset([1, 91]) - FOLLOW_inclusive_or_expression_in_logical_and_expression1881 = frozenset([1, 92]) - FOLLOW_92_in_logical_and_expression1884 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_inclusive_or_expression_in_logical_and_expression1886 = frozenset([1, 92]) - FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899 = frozenset([1, 93]) - FOLLOW_93_in_inclusive_or_expression1902 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904 = frozenset([1, 93]) - FOLLOW_and_expression_in_exclusive_or_expression1917 = frozenset([1, 94]) - FOLLOW_94_in_exclusive_or_expression1920 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_and_expression_in_exclusive_or_expression1922 = frozenset([1, 94]) - FOLLOW_equality_expression_in_and_expression1935 = frozenset([1, 77]) - FOLLOW_77_in_and_expression1938 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_equality_expression_in_and_expression1940 = frozenset([1, 77]) - FOLLOW_relational_expression_in_equality_expression1952 = frozenset([1, 95, 96]) - FOLLOW_set_in_equality_expression1955 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_relational_expression_in_equality_expression1961 = frozenset([1, 95, 96]) - FOLLOW_shift_expression_in_relational_expression1975 = frozenset([1, 97, 98, 99, 100]) - FOLLOW_set_in_relational_expression1978 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_shift_expression_in_relational_expression1988 = frozenset([1, 97, 98, 99, 100]) - FOLLOW_additive_expression_in_shift_expression2001 = frozenset([1, 101, 102]) - FOLLOW_set_in_shift_expression2004 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_additive_expression_in_shift_expression2010 = frozenset([1, 101, 102]) - FOLLOW_labeled_statement_in_statement2025 = frozenset([1]) - FOLLOW_compound_statement_in_statement2030 = frozenset([1]) - FOLLOW_expression_statement_in_statement2035 = frozenset([1]) - FOLLOW_selection_statement_in_statement2040 = frozenset([1]) - FOLLOW_iteration_statement_in_statement2045 = frozenset([1]) - FOLLOW_jump_statement_in_statement2050 = frozenset([1]) - FOLLOW_macro_statement_in_statement2055 = frozenset([1]) - FOLLOW_asm2_statement_in_statement2060 = frozenset([1]) - FOLLOW_asm1_statement_in_statement2065 = frozenset([1]) - FOLLOW_asm_statement_in_statement2070 = frozenset([1]) - FOLLOW_declaration_in_statement2075 = frozenset([1]) - FOLLOW_103_in_asm2_statement2086 = frozenset([4]) - FOLLOW_IDENTIFIER_in_asm2_statement2089 = frozenset([62]) - FOLLOW_62_in_asm2_statement2091 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_set_in_asm2_statement2094 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_63_in_asm2_statement2101 = frozenset([25]) - FOLLOW_25_in_asm2_statement2103 = frozenset([1]) - FOLLOW_104_in_asm1_statement2115 = frozenset([43]) - FOLLOW_43_in_asm1_statement2117 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_set_in_asm1_statement2120 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_44_in_asm1_statement2127 = frozenset([1]) - FOLLOW_105_in_asm_statement2138 = frozenset([43]) - FOLLOW_43_in_asm_statement2140 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_set_in_asm_statement2143 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_44_in_asm_statement2150 = frozenset([1]) - FOLLOW_IDENTIFIER_in_macro_statement2162 = frozenset([62]) - FOLLOW_62_in_macro_statement2164 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_declaration_in_macro_statement2166 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_list_in_macro_statement2170 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_macro_statement2173 = frozenset([63]) - FOLLOW_63_in_macro_statement2176 = frozenset([1]) - FOLLOW_IDENTIFIER_in_labeled_statement2188 = frozenset([47]) - FOLLOW_47_in_labeled_statement2190 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_labeled_statement2192 = frozenset([1]) - FOLLOW_106_in_labeled_statement2197 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_constant_expression_in_labeled_statement2199 = frozenset([47]) - FOLLOW_47_in_labeled_statement2201 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_labeled_statement2203 = frozenset([1]) - FOLLOW_107_in_labeled_statement2208 = frozenset([47]) - FOLLOW_47_in_labeled_statement2210 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_labeled_statement2212 = frozenset([1]) - FOLLOW_43_in_compound_statement2223 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_declaration_in_compound_statement2225 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_list_in_compound_statement2228 = frozenset([44]) - FOLLOW_44_in_compound_statement2231 = frozenset([1]) - FOLLOW_statement_in_statement_list2242 = frozenset([1, 4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_25_in_expression_statement2254 = frozenset([1]) - FOLLOW_expression_in_expression_statement2259 = frozenset([25]) - FOLLOW_25_in_expression_statement2261 = frozenset([1]) - FOLLOW_108_in_selection_statement2272 = frozenset([62]) - FOLLOW_62_in_selection_statement2274 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_selection_statement2278 = frozenset([63]) - FOLLOW_63_in_selection_statement2280 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_selection_statement2284 = frozenset([1, 109]) - FOLLOW_109_in_selection_statement2299 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_selection_statement2301 = frozenset([1]) - FOLLOW_110_in_selection_statement2308 = frozenset([62]) - FOLLOW_62_in_selection_statement2310 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_selection_statement2312 = frozenset([63]) - FOLLOW_63_in_selection_statement2314 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_selection_statement2316 = frozenset([1]) - FOLLOW_111_in_iteration_statement2327 = frozenset([62]) - FOLLOW_62_in_iteration_statement2329 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_iteration_statement2333 = frozenset([63]) - FOLLOW_63_in_iteration_statement2335 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_iteration_statement2337 = frozenset([1]) - FOLLOW_112_in_iteration_statement2344 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_iteration_statement2346 = frozenset([111]) - FOLLOW_111_in_iteration_statement2348 = frozenset([62]) - FOLLOW_62_in_iteration_statement2350 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_iteration_statement2354 = frozenset([63]) - FOLLOW_63_in_iteration_statement2356 = frozenset([25]) - FOLLOW_25_in_iteration_statement2358 = frozenset([1]) - FOLLOW_113_in_iteration_statement2365 = frozenset([62]) - FOLLOW_62_in_iteration_statement2367 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_statement_in_iteration_statement2369 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_statement_in_iteration_statement2373 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_iteration_statement2375 = frozenset([63]) - FOLLOW_63_in_iteration_statement2378 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) - FOLLOW_statement_in_iteration_statement2380 = frozenset([1]) - FOLLOW_114_in_jump_statement2393 = frozenset([4]) - FOLLOW_IDENTIFIER_in_jump_statement2395 = frozenset([25]) - FOLLOW_25_in_jump_statement2397 = frozenset([1]) - FOLLOW_115_in_jump_statement2402 = frozenset([25]) - FOLLOW_25_in_jump_statement2404 = frozenset([1]) - FOLLOW_116_in_jump_statement2409 = frozenset([25]) - FOLLOW_25_in_jump_statement2411 = frozenset([1]) - FOLLOW_117_in_jump_statement2416 = frozenset([25]) - FOLLOW_25_in_jump_statement2418 = frozenset([1]) - FOLLOW_117_in_jump_statement2423 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_expression_in_jump_statement2425 = frozenset([25]) - FOLLOW_25_in_jump_statement2427 = frozenset([1]) - FOLLOW_declaration_specifiers_in_synpred2100 = frozenset([1]) - FOLLOW_declaration_specifiers_in_synpred4100 = frozenset([4, 58, 59, 60, 62, 66]) - FOLLOW_declarator_in_synpred4103 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_declaration_in_synpred4105 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_43_in_synpred4108 = frozenset([1]) - FOLLOW_declaration_in_synpred5118 = frozenset([1]) - FOLLOW_declaration_specifiers_in_synpred7157 = frozenset([1]) - FOLLOW_declaration_specifiers_in_synpred10207 = frozenset([1]) - FOLLOW_type_specifier_in_synpred14272 = frozenset([1]) - FOLLOW_type_qualifier_in_synpred15286 = frozenset([1]) - FOLLOW_type_qualifier_in_synpred33444 = frozenset([1]) - FOLLOW_IDENTIFIER_in_synpred34442 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) - FOLLOW_type_qualifier_in_synpred34444 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) - FOLLOW_declarator_in_synpred34447 = frozenset([1]) - FOLLOW_type_qualifier_in_synpred39566 = frozenset([1]) - FOLLOW_type_specifier_in_synpred40570 = frozenset([1]) - FOLLOW_pointer_in_synpred66784 = frozenset([4, 58, 59, 60, 62]) - FOLLOW_58_in_synpred66788 = frozenset([4, 59, 60, 62]) - FOLLOW_59_in_synpred66793 = frozenset([4, 60, 62]) - FOLLOW_60_in_synpred66798 = frozenset([4, 62]) - FOLLOW_direct_declarator_in_synpred66802 = frozenset([1]) - FOLLOW_declarator_suffix_in_synpred67821 = frozenset([1]) - FOLLOW_58_in_synpred69830 = frozenset([1]) - FOLLOW_declarator_suffix_in_synpred70838 = frozenset([1]) - FOLLOW_62_in_synpred73878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_type_list_in_synpred73880 = frozenset([63]) - FOLLOW_63_in_synpred73882 = frozenset([1]) - FOLLOW_62_in_synpred74892 = frozenset([4]) - FOLLOW_identifier_list_in_synpred74894 = frozenset([63]) - FOLLOW_63_in_synpred74896 = frozenset([1]) - FOLLOW_type_qualifier_in_synpred75921 = frozenset([1]) - FOLLOW_pointer_in_synpred76924 = frozenset([1]) - FOLLOW_66_in_synpred77919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_qualifier_in_synpred77921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_pointer_in_synpred77924 = frozenset([1]) - FOLLOW_66_in_synpred78930 = frozenset([66]) - FOLLOW_pointer_in_synpred78932 = frozenset([1]) - FOLLOW_53_in_synpred81977 = frozenset([1]) - FOLLOW_27_in_synpred82974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_53_in_synpred82977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_parameter_declaration_in_synpred82981 = frozenset([1]) - FOLLOW_declarator_in_synpred83997 = frozenset([1]) - FOLLOW_abstract_declarator_in_synpred84999 = frozenset([1]) - FOLLOW_declaration_specifiers_in_synpred86994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_declarator_in_synpred86997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_abstract_declarator_in_synpred86999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) - FOLLOW_53_in_synpred861004 = frozenset([1]) - FOLLOW_specifier_qualifier_list_in_synpred901046 = frozenset([1, 62, 64, 66]) - FOLLOW_abstract_declarator_in_synpred901048 = frozenset([1]) - FOLLOW_direct_abstract_declarator_in_synpred911067 = frozenset([1]) - FOLLOW_62_in_synpred931086 = frozenset([62, 64, 66]) - FOLLOW_abstract_declarator_in_synpred931088 = frozenset([63]) - FOLLOW_63_in_synpred931090 = frozenset([1]) - FOLLOW_abstract_declarator_suffix_in_synpred941098 = frozenset([1]) - FOLLOW_62_in_synpred1091282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) - FOLLOW_type_name_in_synpred1091284 = frozenset([63]) - FOLLOW_63_in_synpred1091286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_cast_expression_in_synpred1091288 = frozenset([1]) - FOLLOW_74_in_synpred1141330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_unary_expression_in_synpred1141332 = frozenset([1]) - FOLLOW_62_in_synpred1171420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_argument_expression_list_in_synpred1171424 = frozenset([63]) - FOLLOW_63_in_synpred1171428 = frozenset([1]) - FOLLOW_62_in_synpred1181444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) - FOLLOW_macro_parameter_list_in_synpred1181446 = frozenset([63]) - FOLLOW_63_in_synpred1181448 = frozenset([1]) - FOLLOW_66_in_synpred1201482 = frozenset([4]) - FOLLOW_IDENTIFIER_in_synpred1201486 = frozenset([1]) - FOLLOW_STRING_LITERAL_in_synpred1371683 = frozenset([1]) - FOLLOW_IDENTIFIER_in_synpred1381680 = frozenset([4, 9]) - FOLLOW_STRING_LITERAL_in_synpred1381683 = frozenset([1, 9]) - FOLLOW_lvalue_in_synpred1421744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]) - FOLLOW_assignment_operator_in_synpred1421746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) - FOLLOW_assignment_expression_in_synpred1421748 = frozenset([1]) - FOLLOW_expression_statement_in_synpred1692035 = frozenset([1]) - FOLLOW_macro_statement_in_synpred1732055 = frozenset([1]) - FOLLOW_asm2_statement_in_synpred1742060 = frozenset([1]) - FOLLOW_declaration_in_synpred1812166 = frozenset([1]) - FOLLOW_statement_list_in_synpred1822170 = frozenset([1]) - FOLLOW_declaration_in_synpred1862225 = frozenset([1]) - FOLLOW_statement_in_synpred1882242 = frozenset([1]) - + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 4, declaration_StartIndex) + + pass + + return + + # $ANTLR end declaration + + class declaration_specifiers_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start declaration_specifiers + # C.g:182:1: declaration_specifiers : ( storage_class_specifier | type_specifier | type_qualifier )+ ; + def declaration_specifiers(self, ): + + retval = self.declaration_specifiers_return() + retval.start = self.input.LT(1) + declaration_specifiers_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 5): + return retval + + # C.g:183:2: ( ( storage_class_specifier | type_specifier | type_qualifier )+ ) + # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+ + # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+ + cnt10 = 0 + while True: #loop10 + alt10 = 4 + LA10 = self.input.LA(1) + if LA10 == 58: + LA10_2 = self.input.LA(2) + + if (self.synpred15()) : + alt10 = 3 + + + elif LA10 == 59: + LA10_3 = self.input.LA(2) + + if (self.synpred15()) : + alt10 = 3 + + + elif LA10 == 60: + LA10_4 = self.input.LA(2) + + if (self.synpred15()) : + alt10 = 3 + + + elif LA10 == IDENTIFIER: + LA10_5 = self.input.LA(2) + + if (self.synpred14()) : + alt10 = 2 + + + elif LA10 == 53: + LA10_9 = self.input.LA(2) + + if (self.synpred15()) : + alt10 = 3 + + + elif LA10 == 29 or LA10 == 30 or LA10 == 31 or LA10 == 32 or LA10 == 33: + alt10 = 1 + elif LA10 == 34 or LA10 == 35 or LA10 == 36 or LA10 == 37 or LA10 == 38 or LA10 == 39 or LA10 == 40 or LA10 == 41 or LA10 == 42 or LA10 == 45 or LA10 == 46 or LA10 == 48: + alt10 = 2 + elif LA10 == 49 or LA10 == 50 or LA10 == 51 or LA10 == 52 or LA10 == 54 or LA10 == 55 or LA10 == 56 or LA10 == 57 or LA10 == 61: + alt10 = 3 + + if alt10 == 1: + # C.g:183:10: storage_class_specifier + self.following.append(self.FOLLOW_storage_class_specifier_in_declaration_specifiers264) + self.storage_class_specifier() + self.following.pop() + if self.failed: + return retval + + + elif alt10 == 2: + # C.g:184:7: type_specifier + self.following.append(self.FOLLOW_type_specifier_in_declaration_specifiers272) + self.type_specifier() + self.following.pop() + if self.failed: + return retval + + + elif alt10 == 3: + # C.g:185:13: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_declaration_specifiers286) + self.type_qualifier() + self.following.pop() + if self.failed: + return retval + + + else: + if cnt10 >= 1: + break #loop10 + + if self.backtracking > 0: + self.failed = True + return retval + + eee = EarlyExitException(10, self.input) + raise eee + + cnt10 += 1 + + + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 5, declaration_specifiers_StartIndex) + + pass + + return retval + + # $ANTLR end declaration_specifiers + + class init_declarator_list_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start init_declarator_list + # C.g:189:1: init_declarator_list : init_declarator ( ',' init_declarator )* ; + def init_declarator_list(self, ): + + retval = self.init_declarator_list_return() + retval.start = self.input.LT(1) + init_declarator_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 6): + return retval + + # C.g:190:2: ( init_declarator ( ',' init_declarator )* ) + # C.g:190:4: init_declarator ( ',' init_declarator )* + self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list308) + self.init_declarator() + self.following.pop() + if self.failed: + return retval + # C.g:190:20: ( ',' init_declarator )* + while True: #loop11 + alt11 = 2 + LA11_0 = self.input.LA(1) + + if (LA11_0 == 27) : + alt11 = 1 + + + if alt11 == 1: + # C.g:190:21: ',' init_declarator + self.match(self.input, 27, self.FOLLOW_27_in_init_declarator_list311) + if self.failed: + return retval + self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list313) + self.init_declarator() + self.following.pop() + if self.failed: + return retval + + + else: + break #loop11 + + + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 6, init_declarator_list_StartIndex) + + pass + + return retval + + # $ANTLR end init_declarator_list + + + # $ANTLR start init_declarator + # C.g:193:1: init_declarator : declarator ( '=' initializer )? ; + def init_declarator(self, ): + + init_declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 7): + return + + # C.g:194:2: ( declarator ( '=' initializer )? ) + # C.g:194:4: declarator ( '=' initializer )? + self.following.append(self.FOLLOW_declarator_in_init_declarator326) + self.declarator() + self.following.pop() + if self.failed: + return + # C.g:194:15: ( '=' initializer )? + alt12 = 2 + LA12_0 = self.input.LA(1) + + if (LA12_0 == 28) : + alt12 = 1 + if alt12 == 1: + # C.g:194:16: '=' initializer + self.match(self.input, 28, self.FOLLOW_28_in_init_declarator329) + if self.failed: + return + self.following.append(self.FOLLOW_initializer_in_init_declarator331) + self.initializer() + self.following.pop() + if self.failed: + return + + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 7, init_declarator_StartIndex) + + pass + + return + + # $ANTLR end init_declarator + + + # $ANTLR start storage_class_specifier + # C.g:197:1: storage_class_specifier : ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' ); + def storage_class_specifier(self, ): + + storage_class_specifier_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 8): + return + + # C.g:198:2: ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' ) + # C.g: + if (29 <= self.input.LA(1) <= 33): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_storage_class_specifier0 + ) + raise mse + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 8, storage_class_specifier_StartIndex) + + pass + + return + + # $ANTLR end storage_class_specifier + + + # $ANTLR start type_specifier + # C.g:205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id ); + def type_specifier(self, ): + + type_specifier_StartIndex = self.input.index() + s = None + + e = None + + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 9): + return + + # C.g:206:2: ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id ) + alt13 = 12 + LA13_0 = self.input.LA(1) + + if (LA13_0 == 34) : + alt13 = 1 + elif (LA13_0 == 35) : + alt13 = 2 + elif (LA13_0 == 36) : + alt13 = 3 + elif (LA13_0 == 37) : + alt13 = 4 + elif (LA13_0 == 38) : + alt13 = 5 + elif (LA13_0 == 39) : + alt13 = 6 + elif (LA13_0 == 40) : + alt13 = 7 + elif (LA13_0 == 41) : + alt13 = 8 + elif (LA13_0 == 42) : + alt13 = 9 + elif ((45 <= LA13_0 <= 46)) : + alt13 = 10 + elif (LA13_0 == 48) : + alt13 = 11 + elif (LA13_0 == IDENTIFIER) and (self.synpred34()): + alt13 = 12 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id );", 13, 0, self.input) + + raise nvae + + if alt13 == 1: + # C.g:206:4: 'void' + self.match(self.input, 34, self.FOLLOW_34_in_type_specifier376) + if self.failed: + return + + + elif alt13 == 2: + # C.g:207:4: 'char' + self.match(self.input, 35, self.FOLLOW_35_in_type_specifier381) + if self.failed: + return + + + elif alt13 == 3: + # C.g:208:4: 'short' + self.match(self.input, 36, self.FOLLOW_36_in_type_specifier386) + if self.failed: + return + + + elif alt13 == 4: + # C.g:209:4: 'int' + self.match(self.input, 37, self.FOLLOW_37_in_type_specifier391) + if self.failed: + return + + + elif alt13 == 5: + # C.g:210:4: 'long' + self.match(self.input, 38, self.FOLLOW_38_in_type_specifier396) + if self.failed: + return + + + elif alt13 == 6: + # C.g:211:4: 'float' + self.match(self.input, 39, self.FOLLOW_39_in_type_specifier401) + if self.failed: + return + + + elif alt13 == 7: + # C.g:212:4: 'double' + self.match(self.input, 40, self.FOLLOW_40_in_type_specifier406) + if self.failed: + return + + + elif alt13 == 8: + # C.g:213:4: 'signed' + self.match(self.input, 41, self.FOLLOW_41_in_type_specifier411) + if self.failed: + return + + + elif alt13 == 9: + # C.g:214:4: 'unsigned' + self.match(self.input, 42, self.FOLLOW_42_in_type_specifier416) + if self.failed: + return + + + elif alt13 == 10: + # C.g:215:4: s= struct_or_union_specifier + self.following.append(self.FOLLOW_struct_or_union_specifier_in_type_specifier423) + s = self.struct_or_union_specifier() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + + if s.stop != None: + self.StoreStructUnionDefinition(s.start.line, s.start.charPositionInLine, s.stop.line, s.stop.charPositionInLine, self.input.toString(s.start,s.stop)) + + + + + elif alt13 == 11: + # C.g:220:4: e= enum_specifier + self.following.append(self.FOLLOW_enum_specifier_in_type_specifier433) + e = self.enum_specifier() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + + if e.stop != None: + self.StoreEnumerationDefinition(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + + + + elif alt13 == 12: + # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator )=> type_id + self.following.append(self.FOLLOW_type_id_in_type_specifier451) + self.type_id() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 9, type_specifier_StartIndex) + + pass + + return + + # $ANTLR end type_specifier + + + # $ANTLR start type_id + # C.g:228:1: type_id : IDENTIFIER ; + def type_id(self, ): + + type_id_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 10): + return + + # C.g:229:5: ( IDENTIFIER ) + # C.g:229:9: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_type_id467) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 10, type_id_StartIndex) + + pass + + return + + # $ANTLR end type_id + + class struct_or_union_specifier_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start struct_or_union_specifier + # C.g:233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER ); + def struct_or_union_specifier(self, ): + + retval = self.struct_or_union_specifier_return() + retval.start = self.input.LT(1) + struct_or_union_specifier_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 11): + return retval + + # C.g:235:2: ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER ) + alt15 = 2 + LA15_0 = self.input.LA(1) + + if ((45 <= LA15_0 <= 46)) : + LA15_1 = self.input.LA(2) + + if (LA15_1 == IDENTIFIER) : + LA15_2 = self.input.LA(3) + + if (LA15_2 == 43) : + alt15 = 1 + elif (LA15_2 == EOF or LA15_2 == IDENTIFIER or LA15_2 == 25 or LA15_2 == 27 or (29 <= LA15_2 <= 42) or (45 <= LA15_2 <= 64) or LA15_2 == 66) : + alt15 = 2 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 2, self.input) + + raise nvae + + elif (LA15_1 == 43) : + alt15 = 1 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 1, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 0, self.input) + + raise nvae + + if alt15 == 1: + # C.g:235:4: struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' + self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier494) + self.struct_or_union() + self.following.pop() + if self.failed: + return retval + # C.g:235:20: ( IDENTIFIER )? + alt14 = 2 + LA14_0 = self.input.LA(1) + + if (LA14_0 == IDENTIFIER) : + alt14 = 1 + if alt14 == 1: + # C.g:0:0: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier496) + if self.failed: + return retval + + + + self.match(self.input, 43, self.FOLLOW_43_in_struct_or_union_specifier499) + if self.failed: + return retval + self.following.append(self.FOLLOW_struct_declaration_list_in_struct_or_union_specifier501) + self.struct_declaration_list() + self.following.pop() + if self.failed: + return retval + self.match(self.input, 44, self.FOLLOW_44_in_struct_or_union_specifier503) + if self.failed: + return retval + + + elif alt15 == 2: + # C.g:236:4: struct_or_union IDENTIFIER + self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier508) + self.struct_or_union() + self.following.pop() + if self.failed: + return retval + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier510) + if self.failed: + return retval + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 11, struct_or_union_specifier_StartIndex) + + pass + + return retval + + # $ANTLR end struct_or_union_specifier + + + # $ANTLR start struct_or_union + # C.g:239:1: struct_or_union : ( 'struct' | 'union' ); + def struct_or_union(self, ): + + struct_or_union_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 12): + return + + # C.g:240:2: ( 'struct' | 'union' ) + # C.g: + if (45 <= self.input.LA(1) <= 46): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_struct_or_union0 + ) + raise mse + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 12, struct_or_union_StartIndex) + + pass + + return + + # $ANTLR end struct_or_union + + + # $ANTLR start struct_declaration_list + # C.g:244:1: struct_declaration_list : ( struct_declaration )+ ; + def struct_declaration_list(self, ): + + struct_declaration_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 13): + return + + # C.g:245:2: ( ( struct_declaration )+ ) + # C.g:245:4: ( struct_declaration )+ + # C.g:245:4: ( struct_declaration )+ + cnt16 = 0 + while True: #loop16 + alt16 = 2 + LA16_0 = self.input.LA(1) + + if (LA16_0 == IDENTIFIER or (34 <= LA16_0 <= 42) or (45 <= LA16_0 <= 46) or (48 <= LA16_0 <= 61)) : + alt16 = 1 + + + if alt16 == 1: + # C.g:0:0: struct_declaration + self.following.append(self.FOLLOW_struct_declaration_in_struct_declaration_list537) + self.struct_declaration() + self.following.pop() + if self.failed: + return + + + else: + if cnt16 >= 1: + break #loop16 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(16, self.input) + raise eee + + cnt16 += 1 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 13, struct_declaration_list_StartIndex) + + pass + + return + + # $ANTLR end struct_declaration_list + + + # $ANTLR start struct_declaration + # C.g:248:1: struct_declaration : specifier_qualifier_list struct_declarator_list ';' ; + def struct_declaration(self, ): + + struct_declaration_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 14): + return + + # C.g:249:2: ( specifier_qualifier_list struct_declarator_list ';' ) + # C.g:249:4: specifier_qualifier_list struct_declarator_list ';' + self.following.append(self.FOLLOW_specifier_qualifier_list_in_struct_declaration549) + self.specifier_qualifier_list() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_struct_declarator_list_in_struct_declaration551) + self.struct_declarator_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_struct_declaration553) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 14, struct_declaration_StartIndex) + + pass + + return + + # $ANTLR end struct_declaration + + + # $ANTLR start specifier_qualifier_list + # C.g:252:1: specifier_qualifier_list : ( type_qualifier | type_specifier )+ ; + def specifier_qualifier_list(self, ): + + specifier_qualifier_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 15): + return + + # C.g:253:2: ( ( type_qualifier | type_specifier )+ ) + # C.g:253:4: ( type_qualifier | type_specifier )+ + # C.g:253:4: ( type_qualifier | type_specifier )+ + cnt17 = 0 + while True: #loop17 + alt17 = 3 + LA17 = self.input.LA(1) + if LA17 == 58: + LA17_2 = self.input.LA(2) + + if (self.synpred39()) : + alt17 = 1 + + + elif LA17 == 59: + LA17_3 = self.input.LA(2) + + if (self.synpred39()) : + alt17 = 1 + + + elif LA17 == 60: + LA17_4 = self.input.LA(2) + + if (self.synpred39()) : + alt17 = 1 + + + elif LA17 == IDENTIFIER: + LA17 = self.input.LA(2) + if LA17 == EOF or LA17 == IDENTIFIER or LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48 or LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 58 or LA17 == 59 or LA17 == 60 or LA17 == 61 or LA17 == 63 or LA17 == 66: + alt17 = 2 + elif LA17 == 62: + LA17_94 = self.input.LA(3) + + if (self.synpred40()) : + alt17 = 2 + + + elif LA17 == 47: + LA17_95 = self.input.LA(3) + + if (self.synpred40()) : + alt17 = 2 + + + elif LA17 == 64: + LA17_96 = self.input.LA(3) + + if (self.synpred40()) : + alt17 = 2 + + + + elif LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 61: + alt17 = 1 + elif LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48: + alt17 = 2 + + if alt17 == 1: + # C.g:253:6: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_specifier_qualifier_list566) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + elif alt17 == 2: + # C.g:253:23: type_specifier + self.following.append(self.FOLLOW_type_specifier_in_specifier_qualifier_list570) + self.type_specifier() + self.following.pop() + if self.failed: + return + + + else: + if cnt17 >= 1: + break #loop17 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(17, self.input) + raise eee + + cnt17 += 1 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 15, specifier_qualifier_list_StartIndex) + + pass + + return + + # $ANTLR end specifier_qualifier_list + + + # $ANTLR start struct_declarator_list + # C.g:256:1: struct_declarator_list : struct_declarator ( ',' struct_declarator )* ; + def struct_declarator_list(self, ): + + struct_declarator_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 16): + return + + # C.g:257:2: ( struct_declarator ( ',' struct_declarator )* ) + # C.g:257:4: struct_declarator ( ',' struct_declarator )* + self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list584) + self.struct_declarator() + self.following.pop() + if self.failed: + return + # C.g:257:22: ( ',' struct_declarator )* + while True: #loop18 + alt18 = 2 + LA18_0 = self.input.LA(1) + + if (LA18_0 == 27) : + alt18 = 1 + + + if alt18 == 1: + # C.g:257:23: ',' struct_declarator + self.match(self.input, 27, self.FOLLOW_27_in_struct_declarator_list587) + if self.failed: + return + self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list589) + self.struct_declarator() + self.following.pop() + if self.failed: + return + + + else: + break #loop18 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 16, struct_declarator_list_StartIndex) + + pass + + return + + # $ANTLR end struct_declarator_list + + + # $ANTLR start struct_declarator + # C.g:260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression ); + def struct_declarator(self, ): + + struct_declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 17): + return + + # C.g:261:2: ( declarator ( ':' constant_expression )? | ':' constant_expression ) + alt20 = 2 + LA20_0 = self.input.LA(1) + + if (LA20_0 == IDENTIFIER or (58 <= LA20_0 <= 60) or LA20_0 == 62 or LA20_0 == 66) : + alt20 = 1 + elif (LA20_0 == 47) : + alt20 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression );", 20, 0, self.input) + + raise nvae + + if alt20 == 1: + # C.g:261:4: declarator ( ':' constant_expression )? + self.following.append(self.FOLLOW_declarator_in_struct_declarator602) + self.declarator() + self.following.pop() + if self.failed: + return + # C.g:261:15: ( ':' constant_expression )? + alt19 = 2 + LA19_0 = self.input.LA(1) + + if (LA19_0 == 47) : + alt19 = 1 + if alt19 == 1: + # C.g:261:16: ':' constant_expression + self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator605) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_struct_declarator607) + self.constant_expression() + self.following.pop() + if self.failed: + return + + + + + + elif alt20 == 2: + # C.g:262:4: ':' constant_expression + self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator614) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_struct_declarator616) + self.constant_expression() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 17, struct_declarator_StartIndex) + + pass + + return + + # $ANTLR end struct_declarator + + class enum_specifier_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start enum_specifier + # C.g:265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER ); + def enum_specifier(self, ): + + retval = self.enum_specifier_return() + retval.start = self.input.LT(1) + enum_specifier_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 18): + return retval + + # C.g:267:2: ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER ) + alt23 = 3 + LA23_0 = self.input.LA(1) + + if (LA23_0 == 48) : + LA23_1 = self.input.LA(2) + + if (LA23_1 == IDENTIFIER) : + LA23_2 = self.input.LA(3) + + if (LA23_2 == 43) : + alt23 = 2 + elif (LA23_2 == EOF or LA23_2 == IDENTIFIER or LA23_2 == 25 or LA23_2 == 27 or (29 <= LA23_2 <= 42) or (45 <= LA23_2 <= 64) or LA23_2 == 66) : + alt23 = 3 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 2, self.input) + + raise nvae + + elif (LA23_1 == 43) : + alt23 = 1 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 1, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 0, self.input) + + raise nvae + + if alt23 == 1: + # C.g:267:4: 'enum' '{' enumerator_list ( ',' )? '}' + self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier634) + if self.failed: + return retval + self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier636) + if self.failed: + return retval + self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier638) + self.enumerator_list() + self.following.pop() + if self.failed: + return retval + # C.g:267:31: ( ',' )? + alt21 = 2 + LA21_0 = self.input.LA(1) + + if (LA21_0 == 27) : + alt21 = 1 + if alt21 == 1: + # C.g:0:0: ',' + self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier640) + if self.failed: + return retval + + + + self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier643) + if self.failed: + return retval + + + elif alt23 == 2: + # C.g:268:4: 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' + self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier648) + if self.failed: + return retval + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier650) + if self.failed: + return retval + self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier652) + if self.failed: + return retval + self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier654) + self.enumerator_list() + self.following.pop() + if self.failed: + return retval + # C.g:268:42: ( ',' )? + alt22 = 2 + LA22_0 = self.input.LA(1) + + if (LA22_0 == 27) : + alt22 = 1 + if alt22 == 1: + # C.g:0:0: ',' + self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier656) + if self.failed: + return retval + + + + self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier659) + if self.failed: + return retval + + + elif alt23 == 3: + # C.g:269:4: 'enum' IDENTIFIER + self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier664) + if self.failed: + return retval + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier666) + if self.failed: + return retval + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 18, enum_specifier_StartIndex) + + pass + + return retval + + # $ANTLR end enum_specifier + + + # $ANTLR start enumerator_list + # C.g:272:1: enumerator_list : enumerator ( ',' enumerator )* ; + def enumerator_list(self, ): + + enumerator_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 19): + return + + # C.g:273:2: ( enumerator ( ',' enumerator )* ) + # C.g:273:4: enumerator ( ',' enumerator )* + self.following.append(self.FOLLOW_enumerator_in_enumerator_list677) + self.enumerator() + self.following.pop() + if self.failed: + return + # C.g:273:15: ( ',' enumerator )* + while True: #loop24 + alt24 = 2 + LA24_0 = self.input.LA(1) + + if (LA24_0 == 27) : + LA24_1 = self.input.LA(2) + + if (LA24_1 == IDENTIFIER) : + alt24 = 1 + + + + + if alt24 == 1: + # C.g:273:16: ',' enumerator + self.match(self.input, 27, self.FOLLOW_27_in_enumerator_list680) + if self.failed: + return + self.following.append(self.FOLLOW_enumerator_in_enumerator_list682) + self.enumerator() + self.following.pop() + if self.failed: + return + + + else: + break #loop24 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 19, enumerator_list_StartIndex) + + pass + + return + + # $ANTLR end enumerator_list + + + # $ANTLR start enumerator + # C.g:276:1: enumerator : IDENTIFIER ( '=' constant_expression )? ; + def enumerator(self, ): + + enumerator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 20): + return + + # C.g:277:2: ( IDENTIFIER ( '=' constant_expression )? ) + # C.g:277:4: IDENTIFIER ( '=' constant_expression )? + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enumerator695) + if self.failed: + return + # C.g:277:15: ( '=' constant_expression )? + alt25 = 2 + LA25_0 = self.input.LA(1) + + if (LA25_0 == 28) : + alt25 = 1 + if alt25 == 1: + # C.g:277:16: '=' constant_expression + self.match(self.input, 28, self.FOLLOW_28_in_enumerator698) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_enumerator700) + self.constant_expression() + self.following.pop() + if self.failed: + return + + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 20, enumerator_StartIndex) + + pass + + return + + # $ANTLR end enumerator + + + # $ANTLR start type_qualifier + # C.g:280:1: type_qualifier : ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' ); + def type_qualifier(self, ): + + type_qualifier_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 21): + return + + # C.g:281:2: ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' ) + # C.g: + if (49 <= self.input.LA(1) <= 61): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_type_qualifier0 + ) + raise mse + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 21, type_qualifier_StartIndex) + + pass + + return + + # $ANTLR end type_qualifier + + class declarator_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start declarator + # C.g:296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer ); + def declarator(self, ): + + retval = self.declarator_return() + retval.start = self.input.LT(1) + declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 22): + return retval + + # C.g:297:2: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer ) + alt30 = 2 + LA30_0 = self.input.LA(1) + + if (LA30_0 == 66) : + LA30_1 = self.input.LA(2) + + if (self.synpred66()) : + alt30 = 1 + elif (True) : + alt30 = 2 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 1, self.input) + + raise nvae + + elif (LA30_0 == IDENTIFIER or (58 <= LA30_0 <= 60) or LA30_0 == 62) : + alt30 = 1 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 0, self.input) + + raise nvae + + if alt30 == 1: + # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator + # C.g:297:4: ( pointer )? + alt26 = 2 + LA26_0 = self.input.LA(1) + + if (LA26_0 == 66) : + alt26 = 1 + if alt26 == 1: + # C.g:0:0: pointer + self.following.append(self.FOLLOW_pointer_in_declarator784) + self.pointer() + self.following.pop() + if self.failed: + return retval + + + + # C.g:297:13: ( 'EFIAPI' )? + alt27 = 2 + LA27_0 = self.input.LA(1) + + if (LA27_0 == 58) : + alt27 = 1 + if alt27 == 1: + # C.g:297:14: 'EFIAPI' + self.match(self.input, 58, self.FOLLOW_58_in_declarator788) + if self.failed: + return retval + + + + # C.g:297:25: ( 'EFI_BOOTSERVICE' )? + alt28 = 2 + LA28_0 = self.input.LA(1) + + if (LA28_0 == 59) : + alt28 = 1 + if alt28 == 1: + # C.g:297:26: 'EFI_BOOTSERVICE' + self.match(self.input, 59, self.FOLLOW_59_in_declarator793) + if self.failed: + return retval + + + + # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )? + alt29 = 2 + LA29_0 = self.input.LA(1) + + if (LA29_0 == 60) : + alt29 = 1 + if alt29 == 1: + # C.g:297:47: 'EFI_RUNTIMESERVICE' + self.match(self.input, 60, self.FOLLOW_60_in_declarator798) + if self.failed: + return retval + + + + self.following.append(self.FOLLOW_direct_declarator_in_declarator802) + self.direct_declarator() + self.following.pop() + if self.failed: + return retval + + + elif alt30 == 2: + # C.g:299:4: pointer + self.following.append(self.FOLLOW_pointer_in_declarator808) + self.pointer() + self.following.pop() + if self.failed: + return retval + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 22, declarator_StartIndex) + + pass + + return retval + + # $ANTLR end declarator + + + # $ANTLR start direct_declarator + # C.g:302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ ); + def direct_declarator(self, ): + + direct_declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 23): + return + + # C.g:303:2: ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ ) + alt34 = 2 + LA34_0 = self.input.LA(1) + + if (LA34_0 == IDENTIFIER) : + alt34 = 1 + elif (LA34_0 == 62) : + alt34 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ );", 34, 0, self.input) + + raise nvae + + if alt34 == 1: + # C.g:303:4: IDENTIFIER ( declarator_suffix )* + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_direct_declarator819) + if self.failed: + return + # C.g:303:15: ( declarator_suffix )* + while True: #loop31 + alt31 = 2 + LA31_0 = self.input.LA(1) + + if (LA31_0 == 62) : + LA31 = self.input.LA(2) + if LA31 == 63: + LA31_30 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 58: + LA31_31 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 66: + LA31_32 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 59: + LA31_33 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 60: + LA31_34 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == IDENTIFIER: + LA31_35 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 29 or LA31 == 30 or LA31 == 31 or LA31 == 32 or LA31 == 33: + LA31_37 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 34: + LA31_38 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 35: + LA31_39 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 36: + LA31_40 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 37: + LA31_41 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 38: + LA31_42 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 39: + LA31_43 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 40: + LA31_44 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 41: + LA31_45 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 42: + LA31_46 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 45 or LA31 == 46: + LA31_47 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 48: + LA31_48 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 49 or LA31 == 50 or LA31 == 51 or LA31 == 52 or LA31 == 53 or LA31 == 54 or LA31 == 55 or LA31 == 56 or LA31 == 57 or LA31 == 61: + LA31_49 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + + elif (LA31_0 == 64) : + LA31 = self.input.LA(2) + if LA31 == 65: + LA31_51 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 62: + LA31_52 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == IDENTIFIER: + LA31_53 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == HEX_LITERAL: + LA31_54 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == OCTAL_LITERAL: + LA31_55 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == DECIMAL_LITERAL: + LA31_56 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == CHARACTER_LITERAL: + LA31_57 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == STRING_LITERAL: + LA31_58 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == FLOATING_POINT_LITERAL: + LA31_59 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 72: + LA31_60 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 73: + LA31_61 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 66 or LA31 == 68 or LA31 == 69 or LA31 == 77 or LA31 == 78 or LA31 == 79: + LA31_62 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + elif LA31 == 74: + LA31_63 = self.input.LA(3) + + if (self.synpred67()) : + alt31 = 1 + + + + + + if alt31 == 1: + # C.g:0:0: declarator_suffix + self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator821) + self.declarator_suffix() + self.following.pop() + if self.failed: + return + + + else: + break #loop31 + + + + + elif alt34 == 2: + # C.g:304:4: '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ + self.match(self.input, 62, self.FOLLOW_62_in_direct_declarator827) + if self.failed: + return + # C.g:304:8: ( 'EFIAPI' )? + alt32 = 2 + LA32_0 = self.input.LA(1) + + if (LA32_0 == 58) : + LA32_1 = self.input.LA(2) + + if (self.synpred69()) : + alt32 = 1 + if alt32 == 1: + # C.g:304:9: 'EFIAPI' + self.match(self.input, 58, self.FOLLOW_58_in_direct_declarator830) + if self.failed: + return + + + + self.following.append(self.FOLLOW_declarator_in_direct_declarator834) + self.declarator() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_direct_declarator836) + if self.failed: + return + # C.g:304:35: ( declarator_suffix )+ + cnt33 = 0 + while True: #loop33 + alt33 = 2 + LA33_0 = self.input.LA(1) + + if (LA33_0 == 62) : + LA33 = self.input.LA(2) + if LA33 == 63: + LA33_30 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 58: + LA33_31 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 66: + LA33_32 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 59: + LA33_33 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 60: + LA33_34 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == IDENTIFIER: + LA33_35 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 29 or LA33 == 30 or LA33 == 31 or LA33 == 32 or LA33 == 33: + LA33_37 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 34: + LA33_38 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 35: + LA33_39 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 36: + LA33_40 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 37: + LA33_41 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 38: + LA33_42 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 39: + LA33_43 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 40: + LA33_44 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 41: + LA33_45 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 42: + LA33_46 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 45 or LA33 == 46: + LA33_47 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 48: + LA33_48 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 49 or LA33 == 50 or LA33 == 51 or LA33 == 52 or LA33 == 53 or LA33 == 54 or LA33 == 55 or LA33 == 56 or LA33 == 57 or LA33 == 61: + LA33_49 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + + elif (LA33_0 == 64) : + LA33 = self.input.LA(2) + if LA33 == 65: + LA33_51 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 62: + LA33_52 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == IDENTIFIER: + LA33_53 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == HEX_LITERAL: + LA33_54 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == OCTAL_LITERAL: + LA33_55 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == DECIMAL_LITERAL: + LA33_56 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == CHARACTER_LITERAL: + LA33_57 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == STRING_LITERAL: + LA33_58 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == FLOATING_POINT_LITERAL: + LA33_59 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 72: + LA33_60 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 73: + LA33_61 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 66 or LA33 == 68 or LA33 == 69 or LA33 == 77 or LA33 == 78 or LA33 == 79: + LA33_62 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + elif LA33 == 74: + LA33_63 = self.input.LA(3) + + if (self.synpred70()) : + alt33 = 1 + + + + + + if alt33 == 1: + # C.g:0:0: declarator_suffix + self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator838) + self.declarator_suffix() + self.following.pop() + if self.failed: + return + + + else: + if cnt33 >= 1: + break #loop33 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(33, self.input) + raise eee + + cnt33 += 1 + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 23, direct_declarator_StartIndex) + + pass + + return + + # $ANTLR end direct_declarator + + + # $ANTLR start declarator_suffix + # C.g:307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' ); + def declarator_suffix(self, ): + + declarator_suffix_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 24): + return + + # C.g:308:2: ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' ) + alt35 = 5 + LA35_0 = self.input.LA(1) + + if (LA35_0 == 64) : + LA35_1 = self.input.LA(2) + + if (LA35_1 == 65) : + alt35 = 2 + elif ((IDENTIFIER <= LA35_1 <= FLOATING_POINT_LITERAL) or LA35_1 == 62 or LA35_1 == 66 or (68 <= LA35_1 <= 69) or (72 <= LA35_1 <= 74) or (77 <= LA35_1 <= 79)) : + alt35 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 1, self.input) + + raise nvae + + elif (LA35_0 == 62) : + LA35 = self.input.LA(2) + if LA35 == 63: + alt35 = 5 + elif LA35 == 29 or LA35 == 30 or LA35 == 31 or LA35 == 32 or LA35 == 33 or LA35 == 34 or LA35 == 35 or LA35 == 36 or LA35 == 37 or LA35 == 38 or LA35 == 39 or LA35 == 40 or LA35 == 41 or LA35 == 42 or LA35 == 45 or LA35 == 46 or LA35 == 48 or LA35 == 49 or LA35 == 50 or LA35 == 51 or LA35 == 52 or LA35 == 53 or LA35 == 54 or LA35 == 55 or LA35 == 56 or LA35 == 57 or LA35 == 58 or LA35 == 59 or LA35 == 60 or LA35 == 61 or LA35 == 66: + alt35 = 3 + elif LA35 == IDENTIFIER: + LA35_29 = self.input.LA(3) + + if (self.synpred73()) : + alt35 = 3 + elif (self.synpred74()) : + alt35 = 4 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 29, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 2, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 0, self.input) + + raise nvae + + if alt35 == 1: + # C.g:308:6: '[' constant_expression ']' + self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix852) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_declarator_suffix854) + self.constant_expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix856) + if self.failed: + return + + + elif alt35 == 2: + # C.g:309:9: '[' ']' + self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix866) + if self.failed: + return + self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix868) + if self.failed: + return + + + elif alt35 == 3: + # C.g:310:9: '(' parameter_type_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix878) + if self.failed: + return + self.following.append(self.FOLLOW_parameter_type_list_in_declarator_suffix880) + self.parameter_type_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix882) + if self.failed: + return + + + elif alt35 == 4: + # C.g:311:9: '(' identifier_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix892) + if self.failed: + return + self.following.append(self.FOLLOW_identifier_list_in_declarator_suffix894) + self.identifier_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix896) + if self.failed: + return + + + elif alt35 == 5: + # C.g:312:9: '(' ')' + self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix906) + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix908) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 24, declarator_suffix_StartIndex) + + pass + + return + + # $ANTLR end declarator_suffix + + + # $ANTLR start pointer + # C.g:315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' ); + def pointer(self, ): + + pointer_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 25): + return + + # C.g:316:2: ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' ) + alt38 = 3 + LA38_0 = self.input.LA(1) + + if (LA38_0 == 66) : + LA38 = self.input.LA(2) + if LA38 == 66: + LA38_2 = self.input.LA(3) + + if (self.synpred78()) : + alt38 = 2 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 2, self.input) + + raise nvae + + elif LA38 == 58: + LA38_3 = self.input.LA(3) + + if (self.synpred77()) : + alt38 = 1 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 3, self.input) + + raise nvae + + elif LA38 == 59: + LA38_4 = self.input.LA(3) + + if (self.synpred77()) : + alt38 = 1 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 4, self.input) + + raise nvae + + elif LA38 == 60: + LA38_5 = self.input.LA(3) + + if (self.synpred77()) : + alt38 = 1 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 5, self.input) + + raise nvae + + elif LA38 == EOF or LA38 == IDENTIFIER or LA38 == 25 or LA38 == 26 or LA38 == 27 or LA38 == 28 or LA38 == 29 or LA38 == 30 or LA38 == 31 or LA38 == 32 or LA38 == 33 or LA38 == 34 or LA38 == 35 or LA38 == 36 or LA38 == 37 or LA38 == 38 or LA38 == 39 or LA38 == 40 or LA38 == 41 or LA38 == 42 or LA38 == 43 or LA38 == 45 or LA38 == 46 or LA38 == 47 or LA38 == 48 or LA38 == 62 or LA38 == 63 or LA38 == 64: + alt38 = 3 + elif LA38 == 53: + LA38_21 = self.input.LA(3) + + if (self.synpred77()) : + alt38 = 1 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 21, self.input) + + raise nvae + + elif LA38 == 49 or LA38 == 50 or LA38 == 51 or LA38 == 52 or LA38 == 54 or LA38 == 55 or LA38 == 56 or LA38 == 57 or LA38 == 61: + LA38_29 = self.input.LA(3) + + if (self.synpred77()) : + alt38 = 1 + elif (True) : + alt38 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 29, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 1, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("315:1: pointer : ( '*' ( type_qualifier )+ ( pointer )? | '*' pointer | '*' );", 38, 0, self.input) + + raise nvae + + if alt38 == 1: + # C.g:316:4: '*' ( type_qualifier )+ ( pointer )? + self.match(self.input, 66, self.FOLLOW_66_in_pointer919) + if self.failed: + return + # C.g:316:8: ( type_qualifier )+ + cnt36 = 0 + while True: #loop36 + alt36 = 2 + LA36 = self.input.LA(1) + if LA36 == 58: + LA36_2 = self.input.LA(2) + + if (self.synpred75()) : + alt36 = 1 + + + elif LA36 == 59: + LA36_3 = self.input.LA(2) + + if (self.synpred75()) : + alt36 = 1 + + + elif LA36 == 60: + LA36_4 = self.input.LA(2) + + if (self.synpred75()) : + alt36 = 1 + + + elif LA36 == 53: + LA36_20 = self.input.LA(2) + + if (self.synpred75()) : + alt36 = 1 + + + elif LA36 == 49 or LA36 == 50 or LA36 == 51 or LA36 == 52 or LA36 == 54 or LA36 == 55 or LA36 == 56 or LA36 == 57 or LA36 == 61: + LA36_28 = self.input.LA(2) + + if (self.synpred75()) : + alt36 = 1 + + + + if alt36 == 1: + # C.g:0:0: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_pointer921) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + else: + if cnt36 >= 1: + break #loop36 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(36, self.input) + raise eee + + cnt36 += 1 + + + # C.g:316:24: ( pointer )? + alt37 = 2 + LA37_0 = self.input.LA(1) + + if (LA37_0 == 66) : + LA37_1 = self.input.LA(2) + + if (self.synpred76()) : + alt37 = 1 + if alt37 == 1: + # C.g:0:0: pointer + self.following.append(self.FOLLOW_pointer_in_pointer924) + self.pointer() + self.following.pop() + if self.failed: + return + + + + + + elif alt38 == 2: + # C.g:317:4: '*' pointer + self.match(self.input, 66, self.FOLLOW_66_in_pointer930) + if self.failed: + return + self.following.append(self.FOLLOW_pointer_in_pointer932) + self.pointer() + self.following.pop() + if self.failed: + return + + + elif alt38 == 3: + # C.g:318:4: '*' + self.match(self.input, 66, self.FOLLOW_66_in_pointer937) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 25, pointer_StartIndex) + + pass + + return + + # $ANTLR end pointer + + + # $ANTLR start parameter_type_list + # C.g:321:1: parameter_type_list : parameter_list ( ',' ( 'OPTIONAL' )? '...' )? ; + def parameter_type_list(self, ): + + parameter_type_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 26): + return + + # C.g:322:2: ( parameter_list ( ',' ( 'OPTIONAL' )? '...' )? ) + # C.g:322:4: parameter_list ( ',' ( 'OPTIONAL' )? '...' )? + self.following.append(self.FOLLOW_parameter_list_in_parameter_type_list948) + self.parameter_list() + self.following.pop() + if self.failed: + return + # C.g:322:19: ( ',' ( 'OPTIONAL' )? '...' )? + alt40 = 2 + LA40_0 = self.input.LA(1) + + if (LA40_0 == 27) : + alt40 = 1 + if alt40 == 1: + # C.g:322:20: ',' ( 'OPTIONAL' )? '...' + self.match(self.input, 27, self.FOLLOW_27_in_parameter_type_list951) + if self.failed: + return + # C.g:322:24: ( 'OPTIONAL' )? + alt39 = 2 + LA39_0 = self.input.LA(1) + + if (LA39_0 == 53) : + alt39 = 1 + if alt39 == 1: + # C.g:322:25: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_parameter_type_list954) + if self.failed: + return + + + + self.match(self.input, 67, self.FOLLOW_67_in_parameter_type_list958) + if self.failed: + return + + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 26, parameter_type_list_StartIndex) + + pass + + return + + # $ANTLR end parameter_type_list + + + # $ANTLR start parameter_list + # C.g:325:1: parameter_list : parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* ; + def parameter_list(self, ): + + parameter_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 27): + return + + # C.g:326:2: ( parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* ) + # C.g:326:4: parameter_declaration ( ',' ( 'OPTIONAL' )? parameter_declaration )* + self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list971) + self.parameter_declaration() + self.following.pop() + if self.failed: + return + # C.g:326:26: ( ',' ( 'OPTIONAL' )? parameter_declaration )* + while True: #loop42 + alt42 = 2 + LA42_0 = self.input.LA(1) + + if (LA42_0 == 27) : + LA42_1 = self.input.LA(2) + + if (LA42_1 == 53) : + LA42_3 = self.input.LA(3) + + if (self.synpred82()) : + alt42 = 1 + + + elif (LA42_1 == IDENTIFIER or (29 <= LA42_1 <= 42) or (45 <= LA42_1 <= 46) or (48 <= LA42_1 <= 52) or (54 <= LA42_1 <= 61) or LA42_1 == 66) : + alt42 = 1 + + + + + if alt42 == 1: + # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration + self.match(self.input, 27, self.FOLLOW_27_in_parameter_list974) + if self.failed: + return + # C.g:326:31: ( 'OPTIONAL' )? + alt41 = 2 + LA41_0 = self.input.LA(1) + + if (LA41_0 == 53) : + LA41_1 = self.input.LA(2) + + if (self.synpred81()) : + alt41 = 1 + if alt41 == 1: + # C.g:326:32: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_parameter_list977) + if self.failed: + return + + + + self.following.append(self.FOLLOW_parameter_declaration_in_parameter_list981) + self.parameter_declaration() + self.following.pop() + if self.failed: + return + + + else: + break #loop42 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 27, parameter_list_StartIndex) + + pass + + return + + # $ANTLR end parameter_list + + + # $ANTLR start parameter_declaration + # C.g:329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER ); + def parameter_declaration(self, ): + + parameter_declaration_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 28): + return + + # C.g:330:2: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER ) + alt46 = 2 + LA46 = self.input.LA(1) + if LA46 == 29 or LA46 == 30 or LA46 == 31 or LA46 == 32 or LA46 == 33 or LA46 == 34 or LA46 == 35 or LA46 == 36 or LA46 == 37 or LA46 == 38 or LA46 == 39 or LA46 == 40 or LA46 == 41 or LA46 == 42 or LA46 == 45 or LA46 == 46 or LA46 == 48 or LA46 == 49 or LA46 == 50 or LA46 == 51 or LA46 == 52 or LA46 == 53 or LA46 == 54 or LA46 == 55 or LA46 == 56 or LA46 == 57 or LA46 == 58 or LA46 == 59 or LA46 == 60 or LA46 == 61: + alt46 = 1 + elif LA46 == IDENTIFIER: + LA46_13 = self.input.LA(2) + + if (self.synpred86()) : + alt46 = 1 + elif (True) : + alt46 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 13, self.input) + + raise nvae + + elif LA46 == 66: + alt46 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("329:1: parameter_declaration : ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? | ( pointer )* IDENTIFIER );", 46, 0, self.input) + + raise nvae + + if alt46 == 1: + # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? + self.following.append(self.FOLLOW_declaration_specifiers_in_parameter_declaration994) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + # C.g:330:27: ( declarator | abstract_declarator )* + while True: #loop43 + alt43 = 3 + LA43 = self.input.LA(1) + if LA43 == 66: + LA43_5 = self.input.LA(2) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == IDENTIFIER or LA43 == 58 or LA43 == 59 or LA43 == 60: + alt43 = 1 + elif LA43 == 62: + LA43 = self.input.LA(2) + if LA43 == 29 or LA43 == 30 or LA43 == 31 or LA43 == 32 or LA43 == 33 or LA43 == 34 or LA43 == 35 or LA43 == 36 or LA43 == 37 or LA43 == 38 or LA43 == 39 or LA43 == 40 or LA43 == 41 or LA43 == 42 or LA43 == 45 or LA43 == 46 or LA43 == 48 or LA43 == 49 or LA43 == 50 or LA43 == 51 or LA43 == 52 or LA43 == 53 or LA43 == 54 or LA43 == 55 or LA43 == 56 or LA43 == 57 or LA43 == 61 or LA43 == 63 or LA43 == 64: + alt43 = 2 + elif LA43 == IDENTIFIER: + LA43_37 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == 58: + LA43_38 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == 66: + LA43_39 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == 59: + LA43_40 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == 60: + LA43_41 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + elif LA43 == 62: + LA43_43 = self.input.LA(3) + + if (self.synpred83()) : + alt43 = 1 + elif (self.synpred84()) : + alt43 = 2 + + + + elif LA43 == 64: + alt43 = 2 + + if alt43 == 1: + # C.g:330:28: declarator + self.following.append(self.FOLLOW_declarator_in_parameter_declaration997) + self.declarator() + self.following.pop() + if self.failed: + return + + + elif alt43 == 2: + # C.g:330:39: abstract_declarator + self.following.append(self.FOLLOW_abstract_declarator_in_parameter_declaration999) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + + + else: + break #loop43 + + + # C.g:330:61: ( 'OPTIONAL' )? + alt44 = 2 + LA44_0 = self.input.LA(1) + + if (LA44_0 == 53) : + alt44 = 1 + if alt44 == 1: + # C.g:330:62: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_parameter_declaration1004) + if self.failed: + return + + + + + + elif alt46 == 2: + # C.g:332:4: ( pointer )* IDENTIFIER + # C.g:332:4: ( pointer )* + while True: #loop45 + alt45 = 2 + LA45_0 = self.input.LA(1) + + if (LA45_0 == 66) : + alt45 = 1 + + + if alt45 == 1: + # C.g:0:0: pointer + self.following.append(self.FOLLOW_pointer_in_parameter_declaration1013) + self.pointer() + self.following.pop() + if self.failed: + return + + + else: + break #loop45 + + + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_parameter_declaration1016) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 28, parameter_declaration_StartIndex) + + pass + + return + + # $ANTLR end parameter_declaration + + + # $ANTLR start identifier_list + # C.g:335:1: identifier_list : IDENTIFIER ( ',' IDENTIFIER )* ; + def identifier_list(self, ): + + identifier_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 29): + return + + # C.g:336:2: ( IDENTIFIER ( ',' IDENTIFIER )* ) + # C.g:336:4: IDENTIFIER ( ',' IDENTIFIER )* + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1027) + if self.failed: + return + # C.g:337:2: ( ',' IDENTIFIER )* + while True: #loop47 + alt47 = 2 + LA47_0 = self.input.LA(1) + + if (LA47_0 == 27) : + alt47 = 1 + + + if alt47 == 1: + # C.g:337:3: ',' IDENTIFIER + self.match(self.input, 27, self.FOLLOW_27_in_identifier_list1031) + if self.failed: + return + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_identifier_list1033) + if self.failed: + return + + + else: + break #loop47 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 29, identifier_list_StartIndex) + + pass + + return + + # $ANTLR end identifier_list + + + # $ANTLR start type_name + # C.g:340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id ); + def type_name(self, ): + + type_name_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 30): + return + + # C.g:341:2: ( specifier_qualifier_list ( abstract_declarator )? | type_id ) + alt49 = 2 + LA49_0 = self.input.LA(1) + + if ((34 <= LA49_0 <= 42) or (45 <= LA49_0 <= 46) or (48 <= LA49_0 <= 61)) : + alt49 = 1 + elif (LA49_0 == IDENTIFIER) : + LA49_13 = self.input.LA(2) + + if (self.synpred90()) : + alt49 = 1 + elif (True) : + alt49 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 13, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("340:1: type_name : ( specifier_qualifier_list ( abstract_declarator )? | type_id );", 49, 0, self.input) + + raise nvae + + if alt49 == 1: + # C.g:341:4: specifier_qualifier_list ( abstract_declarator )? + self.following.append(self.FOLLOW_specifier_qualifier_list_in_type_name1046) + self.specifier_qualifier_list() + self.following.pop() + if self.failed: + return + # C.g:341:29: ( abstract_declarator )? + alt48 = 2 + LA48_0 = self.input.LA(1) + + if (LA48_0 == 62 or LA48_0 == 64 or LA48_0 == 66) : + alt48 = 1 + if alt48 == 1: + # C.g:0:0: abstract_declarator + self.following.append(self.FOLLOW_abstract_declarator_in_type_name1048) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + + + + + + elif alt49 == 2: + # C.g:342:4: type_id + self.following.append(self.FOLLOW_type_id_in_type_name1054) + self.type_id() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 30, type_name_StartIndex) + + pass + + return + + # $ANTLR end type_name + + + # $ANTLR start abstract_declarator + # C.g:345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator ); + def abstract_declarator(self, ): + + abstract_declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 31): + return + + # C.g:346:2: ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator ) + alt51 = 2 + LA51_0 = self.input.LA(1) + + if (LA51_0 == 66) : + alt51 = 1 + elif (LA51_0 == 62 or LA51_0 == 64) : + alt51 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("345:1: abstract_declarator : ( pointer ( direct_abstract_declarator )? | direct_abstract_declarator );", 51, 0, self.input) + + raise nvae + + if alt51 == 1: + # C.g:346:4: pointer ( direct_abstract_declarator )? + self.following.append(self.FOLLOW_pointer_in_abstract_declarator1065) + self.pointer() + self.following.pop() + if self.failed: + return + # C.g:346:12: ( direct_abstract_declarator )? + alt50 = 2 + LA50_0 = self.input.LA(1) + + if (LA50_0 == 62) : + LA50 = self.input.LA(2) + if LA50 == 63: + LA50_12 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 58: + LA50_13 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 66: + LA50_14 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 59: + LA50_15 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 60: + LA50_16 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == IDENTIFIER: + LA50_17 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 62: + LA50_18 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 64: + LA50_19 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 29 or LA50 == 30 or LA50 == 31 or LA50 == 32 or LA50 == 33: + LA50_20 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 34: + LA50_21 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 35: + LA50_22 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 36: + LA50_23 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 37: + LA50_24 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 38: + LA50_25 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 39: + LA50_26 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 40: + LA50_27 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 41: + LA50_28 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 42: + LA50_29 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 45 or LA50 == 46: + LA50_30 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 48: + LA50_31 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 49 or LA50 == 50 or LA50 == 51 or LA50 == 52 or LA50 == 53 or LA50 == 54 or LA50 == 55 or LA50 == 56 or LA50 == 57 or LA50 == 61: + LA50_32 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif (LA50_0 == 64) : + LA50 = self.input.LA(2) + if LA50 == 65: + LA50_33 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 62: + LA50_34 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == IDENTIFIER: + LA50_35 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == HEX_LITERAL: + LA50_36 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == OCTAL_LITERAL: + LA50_37 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == DECIMAL_LITERAL: + LA50_38 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == CHARACTER_LITERAL: + LA50_39 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == STRING_LITERAL: + LA50_40 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == FLOATING_POINT_LITERAL: + LA50_41 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 72: + LA50_42 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 73: + LA50_43 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 66 or LA50 == 68 or LA50 == 69 or LA50 == 77 or LA50 == 78 or LA50 == 79: + LA50_44 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + elif LA50 == 74: + LA50_45 = self.input.LA(3) + + if (self.synpred91()) : + alt50 = 1 + if alt50 == 1: + # C.g:0:0: direct_abstract_declarator + self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1067) + self.direct_abstract_declarator() + self.following.pop() + if self.failed: + return + + + + + + elif alt51 == 2: + # C.g:347:4: direct_abstract_declarator + self.following.append(self.FOLLOW_direct_abstract_declarator_in_abstract_declarator1073) + self.direct_abstract_declarator() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 31, abstract_declarator_StartIndex) + + pass + + return + + # $ANTLR end abstract_declarator + + + # $ANTLR start direct_abstract_declarator + # C.g:350:1: direct_abstract_declarator : ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* ; + def direct_abstract_declarator(self, ): + + direct_abstract_declarator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 32): + return + + # C.g:351:2: ( ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* ) + # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix ) ( abstract_declarator_suffix )* + # C.g:351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix ) + alt52 = 2 + LA52_0 = self.input.LA(1) + + if (LA52_0 == 62) : + LA52 = self.input.LA(2) + if LA52 == IDENTIFIER or LA52 == 29 or LA52 == 30 or LA52 == 31 or LA52 == 32 or LA52 == 33 or LA52 == 34 or LA52 == 35 or LA52 == 36 or LA52 == 37 or LA52 == 38 or LA52 == 39 or LA52 == 40 or LA52 == 41 or LA52 == 42 or LA52 == 45 or LA52 == 46 or LA52 == 48 or LA52 == 49 or LA52 == 50 or LA52 == 51 or LA52 == 52 or LA52 == 53 or LA52 == 54 or LA52 == 55 or LA52 == 56 or LA52 == 57 or LA52 == 58 or LA52 == 59 or LA52 == 60 or LA52 == 61 or LA52 == 63: + alt52 = 2 + elif LA52 == 66: + LA52_18 = self.input.LA(3) + + if (self.synpred93()) : + alt52 = 1 + elif (True) : + alt52 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 18, self.input) + + raise nvae + + elif LA52 == 62 or LA52 == 64: + alt52 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 1, self.input) + + raise nvae + + elif (LA52_0 == 64) : + alt52 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("351:4: ( '(' abstract_declarator ')' | abstract_declarator_suffix )", 52, 0, self.input) + + raise nvae + + if alt52 == 1: + # C.g:351:6: '(' abstract_declarator ')' + self.match(self.input, 62, self.FOLLOW_62_in_direct_abstract_declarator1086) + if self.failed: + return + self.following.append(self.FOLLOW_abstract_declarator_in_direct_abstract_declarator1088) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_direct_abstract_declarator1090) + if self.failed: + return + + + elif alt52 == 2: + # C.g:351:36: abstract_declarator_suffix + self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094) + self.abstract_declarator_suffix() + self.following.pop() + if self.failed: + return + + + + # C.g:351:65: ( abstract_declarator_suffix )* + while True: #loop53 + alt53 = 2 + LA53_0 = self.input.LA(1) + + if (LA53_0 == 62) : + LA53 = self.input.LA(2) + if LA53 == 63: + LA53_12 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 58: + LA53_13 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 66: + LA53_14 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 59: + LA53_15 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 60: + LA53_16 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == IDENTIFIER: + LA53_17 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 29 or LA53 == 30 or LA53 == 31 or LA53 == 32 or LA53 == 33: + LA53_19 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 34: + LA53_20 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 35: + LA53_21 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 36: + LA53_22 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 37: + LA53_23 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 38: + LA53_24 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 39: + LA53_25 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 40: + LA53_26 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 41: + LA53_27 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 42: + LA53_28 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 45 or LA53 == 46: + LA53_29 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 48: + LA53_30 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 49 or LA53 == 50 or LA53 == 51 or LA53 == 52 or LA53 == 53 or LA53 == 54 or LA53 == 55 or LA53 == 56 or LA53 == 57 or LA53 == 61: + LA53_31 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + + elif (LA53_0 == 64) : + LA53 = self.input.LA(2) + if LA53 == 65: + LA53_33 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 62: + LA53_34 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == IDENTIFIER: + LA53_35 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == HEX_LITERAL: + LA53_36 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == OCTAL_LITERAL: + LA53_37 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == DECIMAL_LITERAL: + LA53_38 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == CHARACTER_LITERAL: + LA53_39 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == STRING_LITERAL: + LA53_40 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == FLOATING_POINT_LITERAL: + LA53_41 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 72: + LA53_42 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 73: + LA53_43 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 66 or LA53 == 68 or LA53 == 69 or LA53 == 77 or LA53 == 78 or LA53 == 79: + LA53_44 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + elif LA53 == 74: + LA53_45 = self.input.LA(3) + + if (self.synpred94()) : + alt53 = 1 + + + + + + if alt53 == 1: + # C.g:0:0: abstract_declarator_suffix + self.following.append(self.FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098) + self.abstract_declarator_suffix() + self.following.pop() + if self.failed: + return + + + else: + break #loop53 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 32, direct_abstract_declarator_StartIndex) + + pass + + return + + # $ANTLR end direct_abstract_declarator + + + # $ANTLR start abstract_declarator_suffix + # C.g:354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' ); + def abstract_declarator_suffix(self, ): + + abstract_declarator_suffix_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 33): + return + + # C.g:355:2: ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' ) + alt54 = 4 + LA54_0 = self.input.LA(1) + + if (LA54_0 == 64) : + LA54_1 = self.input.LA(2) + + if (LA54_1 == 65) : + alt54 = 1 + elif ((IDENTIFIER <= LA54_1 <= FLOATING_POINT_LITERAL) or LA54_1 == 62 or LA54_1 == 66 or (68 <= LA54_1 <= 69) or (72 <= LA54_1 <= 74) or (77 <= LA54_1 <= 79)) : + alt54 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 1, self.input) + + raise nvae + + elif (LA54_0 == 62) : + LA54_2 = self.input.LA(2) + + if (LA54_2 == 63) : + alt54 = 3 + elif (LA54_2 == IDENTIFIER or (29 <= LA54_2 <= 42) or (45 <= LA54_2 <= 46) or (48 <= LA54_2 <= 61) or LA54_2 == 66) : + alt54 = 4 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 2, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("354:1: abstract_declarator_suffix : ( '[' ']' | '[' constant_expression ']' | '(' ')' | '(' parameter_type_list ')' );", 54, 0, self.input) + + raise nvae + + if alt54 == 1: + # C.g:355:4: '[' ']' + self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1110) + if self.failed: + return + self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1112) + if self.failed: + return + + + elif alt54 == 2: + # C.g:356:4: '[' constant_expression ']' + self.match(self.input, 64, self.FOLLOW_64_in_abstract_declarator_suffix1117) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_abstract_declarator_suffix1119) + self.constant_expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 65, self.FOLLOW_65_in_abstract_declarator_suffix1121) + if self.failed: + return + + + elif alt54 == 3: + # C.g:357:4: '(' ')' + self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1126) + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1128) + if self.failed: + return + + + elif alt54 == 4: + # C.g:358:4: '(' parameter_type_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_abstract_declarator_suffix1133) + if self.failed: + return + self.following.append(self.FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135) + self.parameter_type_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_abstract_declarator_suffix1137) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 33, abstract_declarator_suffix_StartIndex) + + pass + + return + + # $ANTLR end abstract_declarator_suffix + + + # $ANTLR start initializer + # C.g:361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' ); + def initializer(self, ): + + initializer_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 34): + return + + # C.g:363:2: ( assignment_expression | '{' initializer_list ( ',' )? '}' ) + alt56 = 2 + LA56_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA56_0 <= FLOATING_POINT_LITERAL) or LA56_0 == 62 or LA56_0 == 66 or (68 <= LA56_0 <= 69) or (72 <= LA56_0 <= 74) or (77 <= LA56_0 <= 79)) : + alt56 = 1 + elif (LA56_0 == 43) : + alt56 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("361:1: initializer : ( assignment_expression | '{' initializer_list ( ',' )? '}' );", 56, 0, self.input) + + raise nvae + + if alt56 == 1: + # C.g:363:4: assignment_expression + self.following.append(self.FOLLOW_assignment_expression_in_initializer1150) + self.assignment_expression() + self.following.pop() + if self.failed: + return + + + elif alt56 == 2: + # C.g:364:4: '{' initializer_list ( ',' )? '}' + self.match(self.input, 43, self.FOLLOW_43_in_initializer1155) + if self.failed: + return + self.following.append(self.FOLLOW_initializer_list_in_initializer1157) + self.initializer_list() + self.following.pop() + if self.failed: + return + # C.g:364:25: ( ',' )? + alt55 = 2 + LA55_0 = self.input.LA(1) + + if (LA55_0 == 27) : + alt55 = 1 + if alt55 == 1: + # C.g:0:0: ',' + self.match(self.input, 27, self.FOLLOW_27_in_initializer1159) + if self.failed: + return + + + + self.match(self.input, 44, self.FOLLOW_44_in_initializer1162) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 34, initializer_StartIndex) + + pass + + return + + # $ANTLR end initializer + + + # $ANTLR start initializer_list + # C.g:367:1: initializer_list : initializer ( ',' initializer )* ; + def initializer_list(self, ): + + initializer_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 35): + return + + # C.g:368:2: ( initializer ( ',' initializer )* ) + # C.g:368:4: initializer ( ',' initializer )* + self.following.append(self.FOLLOW_initializer_in_initializer_list1173) + self.initializer() + self.following.pop() + if self.failed: + return + # C.g:368:16: ( ',' initializer )* + while True: #loop57 + alt57 = 2 + LA57_0 = self.input.LA(1) + + if (LA57_0 == 27) : + LA57_1 = self.input.LA(2) + + if ((IDENTIFIER <= LA57_1 <= FLOATING_POINT_LITERAL) or LA57_1 == 43 or LA57_1 == 62 or LA57_1 == 66 or (68 <= LA57_1 <= 69) or (72 <= LA57_1 <= 74) or (77 <= LA57_1 <= 79)) : + alt57 = 1 + + + + + if alt57 == 1: + # C.g:368:17: ',' initializer + self.match(self.input, 27, self.FOLLOW_27_in_initializer_list1176) + if self.failed: + return + self.following.append(self.FOLLOW_initializer_in_initializer_list1178) + self.initializer() + self.following.pop() + if self.failed: + return + + + else: + break #loop57 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 35, initializer_list_StartIndex) + + pass + + return + + # $ANTLR end initializer_list + + class argument_expression_list_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start argument_expression_list + # C.g:373:1: argument_expression_list : assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* ; + def argument_expression_list(self, ): + + retval = self.argument_expression_list_return() + retval.start = self.input.LT(1) + argument_expression_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 36): + return retval + + # C.g:374:2: ( assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* ) + # C.g:374:6: assignment_expression ( 'OPTIONAL' )? ( ',' assignment_expression ( 'OPTIONAL' )? )* + self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1196) + self.assignment_expression() + self.following.pop() + if self.failed: + return retval + # C.g:374:28: ( 'OPTIONAL' )? + alt58 = 2 + LA58_0 = self.input.LA(1) + + if (LA58_0 == 53) : + alt58 = 1 + if alt58 == 1: + # C.g:374:29: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1199) + if self.failed: + return retval + + + + # C.g:374:42: ( ',' assignment_expression ( 'OPTIONAL' )? )* + while True: #loop60 + alt60 = 2 + LA60_0 = self.input.LA(1) + + if (LA60_0 == 27) : + alt60 = 1 + + + if alt60 == 1: + # C.g:374:43: ',' assignment_expression ( 'OPTIONAL' )? + self.match(self.input, 27, self.FOLLOW_27_in_argument_expression_list1204) + if self.failed: + return retval + self.following.append(self.FOLLOW_assignment_expression_in_argument_expression_list1206) + self.assignment_expression() + self.following.pop() + if self.failed: + return retval + # C.g:374:69: ( 'OPTIONAL' )? + alt59 = 2 + LA59_0 = self.input.LA(1) + + if (LA59_0 == 53) : + alt59 = 1 + if alt59 == 1: + # C.g:374:70: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_argument_expression_list1209) + if self.failed: + return retval + + + + + + else: + break #loop60 + + + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 36, argument_expression_list_StartIndex) + + pass + + return retval + + # $ANTLR end argument_expression_list + + + # $ANTLR start additive_expression + # C.g:377:1: additive_expression : ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* ; + def additive_expression(self, ): + + additive_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 37): + return + + # C.g:378:2: ( ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* ) + # C.g:378:4: ( multiplicative_expression ) ( '+' multiplicative_expression | '-' multiplicative_expression )* + # C.g:378:4: ( multiplicative_expression ) + # C.g:378:5: multiplicative_expression + self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1225) + self.multiplicative_expression() + self.following.pop() + if self.failed: + return + + + + # C.g:378:32: ( '+' multiplicative_expression | '-' multiplicative_expression )* + while True: #loop61 + alt61 = 3 + LA61_0 = self.input.LA(1) + + if (LA61_0 == 68) : + alt61 = 1 + elif (LA61_0 == 69) : + alt61 = 2 + + + if alt61 == 1: + # C.g:378:33: '+' multiplicative_expression + self.match(self.input, 68, self.FOLLOW_68_in_additive_expression1229) + if self.failed: + return + self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1231) + self.multiplicative_expression() + self.following.pop() + if self.failed: + return + + + elif alt61 == 2: + # C.g:378:65: '-' multiplicative_expression + self.match(self.input, 69, self.FOLLOW_69_in_additive_expression1235) + if self.failed: + return + self.following.append(self.FOLLOW_multiplicative_expression_in_additive_expression1237) + self.multiplicative_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop61 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 37, additive_expression_StartIndex) + + pass + + return + + # $ANTLR end additive_expression + + + # $ANTLR start multiplicative_expression + # C.g:381:1: multiplicative_expression : ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* ; + def multiplicative_expression(self, ): + + multiplicative_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 38): + return + + # C.g:382:2: ( ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* ) + # C.g:382:4: ( cast_expression ) ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* + # C.g:382:4: ( cast_expression ) + # C.g:382:5: cast_expression + self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1251) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + + # C.g:382:22: ( '*' cast_expression | '/' cast_expression | '%' cast_expression )* + while True: #loop62 + alt62 = 4 + LA62 = self.input.LA(1) + if LA62 == 66: + alt62 = 1 + elif LA62 == 70: + alt62 = 2 + elif LA62 == 71: + alt62 = 3 + + if alt62 == 1: + # C.g:382:23: '*' cast_expression + self.match(self.input, 66, self.FOLLOW_66_in_multiplicative_expression1255) + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1257) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + elif alt62 == 2: + # C.g:382:45: '/' cast_expression + self.match(self.input, 70, self.FOLLOW_70_in_multiplicative_expression1261) + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1263) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + elif alt62 == 3: + # C.g:382:67: '%' cast_expression + self.match(self.input, 71, self.FOLLOW_71_in_multiplicative_expression1267) + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_multiplicative_expression1269) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop62 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 38, multiplicative_expression_StartIndex) + + pass + + return + + # $ANTLR end multiplicative_expression + + + # $ANTLR start cast_expression + # C.g:385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression ); + def cast_expression(self, ): + + cast_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 39): + return + + # C.g:386:2: ( '(' type_name ')' cast_expression | unary_expression ) + alt63 = 2 + LA63_0 = self.input.LA(1) + + if (LA63_0 == 62) : + LA63 = self.input.LA(2) + if LA63 == 34 or LA63 == 35 or LA63 == 36 or LA63 == 37 or LA63 == 38 or LA63 == 39 or LA63 == 40 or LA63 == 41 or LA63 == 42 or LA63 == 45 or LA63 == 46 or LA63 == 48 or LA63 == 49 or LA63 == 50 or LA63 == 51 or LA63 == 52 or LA63 == 53 or LA63 == 54 or LA63 == 55 or LA63 == 56 or LA63 == 57 or LA63 == 58 or LA63 == 59 or LA63 == 60 or LA63 == 61: + alt63 = 1 + elif LA63 == IDENTIFIER: + LA63_25 = self.input.LA(3) + + if (self.synpred109()) : + alt63 = 1 + elif (True) : + alt63 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 25, self.input) + + raise nvae + + elif LA63 == HEX_LITERAL or LA63 == OCTAL_LITERAL or LA63 == DECIMAL_LITERAL or LA63 == CHARACTER_LITERAL or LA63 == STRING_LITERAL or LA63 == FLOATING_POINT_LITERAL or LA63 == 62 or LA63 == 66 or LA63 == 68 or LA63 == 69 or LA63 == 72 or LA63 == 73 or LA63 == 74 or LA63 == 77 or LA63 == 78 or LA63 == 79: + alt63 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 1, self.input) + + raise nvae + + elif ((IDENTIFIER <= LA63_0 <= FLOATING_POINT_LITERAL) or LA63_0 == 66 or (68 <= LA63_0 <= 69) or (72 <= LA63_0 <= 74) or (77 <= LA63_0 <= 79)) : + alt63 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("385:1: cast_expression : ( '(' type_name ')' cast_expression | unary_expression );", 63, 0, self.input) + + raise nvae + + if alt63 == 1: + # C.g:386:4: '(' type_name ')' cast_expression + self.match(self.input, 62, self.FOLLOW_62_in_cast_expression1282) + if self.failed: + return + self.following.append(self.FOLLOW_type_name_in_cast_expression1284) + self.type_name() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_cast_expression1286) + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_cast_expression1288) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + elif alt63 == 2: + # C.g:387:4: unary_expression + self.following.append(self.FOLLOW_unary_expression_in_cast_expression1293) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 39, cast_expression_StartIndex) + + pass + + return + + # $ANTLR end cast_expression + + + # $ANTLR start unary_expression + # C.g:390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' ); + def unary_expression(self, ): + + unary_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 40): + return + + # C.g:391:2: ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' ) + alt64 = 6 + LA64 = self.input.LA(1) + if LA64 == IDENTIFIER or LA64 == HEX_LITERAL or LA64 == OCTAL_LITERAL or LA64 == DECIMAL_LITERAL or LA64 == CHARACTER_LITERAL or LA64 == STRING_LITERAL or LA64 == FLOATING_POINT_LITERAL or LA64 == 62: + alt64 = 1 + elif LA64 == 72: + alt64 = 2 + elif LA64 == 73: + alt64 = 3 + elif LA64 == 66 or LA64 == 68 or LA64 == 69 or LA64 == 77 or LA64 == 78 or LA64 == 79: + alt64 = 4 + elif LA64 == 74: + LA64_12 = self.input.LA(2) + + if (LA64_12 == 62) : + LA64_13 = self.input.LA(3) + + if (self.synpred114()) : + alt64 = 5 + elif (True) : + alt64 = 6 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 13, self.input) + + raise nvae + + elif ((IDENTIFIER <= LA64_12 <= FLOATING_POINT_LITERAL) or LA64_12 == 66 or (68 <= LA64_12 <= 69) or (72 <= LA64_12 <= 74) or (77 <= LA64_12 <= 79)) : + alt64 = 5 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 12, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("390:1: unary_expression : ( postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' );", 64, 0, self.input) + + raise nvae + + if alt64 == 1: + # C.g:391:4: postfix_expression + self.following.append(self.FOLLOW_postfix_expression_in_unary_expression1304) + self.postfix_expression() + self.following.pop() + if self.failed: + return + + + elif alt64 == 2: + # C.g:392:4: '++' unary_expression + self.match(self.input, 72, self.FOLLOW_72_in_unary_expression1309) + if self.failed: + return + self.following.append(self.FOLLOW_unary_expression_in_unary_expression1311) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + elif alt64 == 3: + # C.g:393:4: '--' unary_expression + self.match(self.input, 73, self.FOLLOW_73_in_unary_expression1316) + if self.failed: + return + self.following.append(self.FOLLOW_unary_expression_in_unary_expression1318) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + elif alt64 == 4: + # C.g:394:4: unary_operator cast_expression + self.following.append(self.FOLLOW_unary_operator_in_unary_expression1323) + self.unary_operator() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_unary_expression1325) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + elif alt64 == 5: + # C.g:395:4: 'sizeof' unary_expression + self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1330) + if self.failed: + return + self.following.append(self.FOLLOW_unary_expression_in_unary_expression1332) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + elif alt64 == 6: + # C.g:396:4: 'sizeof' '(' type_name ')' + self.match(self.input, 74, self.FOLLOW_74_in_unary_expression1337) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_unary_expression1339) + if self.failed: + return + self.following.append(self.FOLLOW_type_name_in_unary_expression1341) + self.type_name() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_unary_expression1343) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 40, unary_expression_StartIndex) + + pass + + return + + # $ANTLR end unary_expression + + + # $ANTLR start postfix_expression + # C.g:399:1: postfix_expression : p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* ; + def postfix_expression(self, ): + self.postfix_expression_stack.append(postfix_expression_scope()) + postfix_expression_StartIndex = self.input.index() + a = None + b = None + x = None + y = None + z = None + p = None + + c = None + + + + self.postfix_expression_stack[-1].FuncCallText = '' + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 41): + return + + # C.g:406:2: (p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* ) + # C.g:406:6: p= primary_expression ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* + self.following.append(self.FOLLOW_primary_expression_in_postfix_expression1367) + p = self.primary_expression() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + self.postfix_expression_stack[-1].FuncCallText += self.input.toString(p.start,p.stop) + + # C.g:407:9: ( '[' expression ']' | '(' a= ')' | '(' c= argument_expression_list b= ')' | '(' macro_parameter_list ')' | '.' x= IDENTIFIER | '*' y= IDENTIFIER | '->' z= IDENTIFIER | '++' | '--' )* + while True: #loop65 + alt65 = 10 + LA65 = self.input.LA(1) + if LA65 == 66: + LA65_1 = self.input.LA(2) + + if (LA65_1 == IDENTIFIER) : + LA65_30 = self.input.LA(3) + + if (self.synpred120()) : + alt65 = 6 + + + + + elif LA65 == 64: + alt65 = 1 + elif LA65 == 62: + LA65 = self.input.LA(2) + if LA65 == 63: + alt65 = 2 + elif LA65 == 29 or LA65 == 30 or LA65 == 31 or LA65 == 32 or LA65 == 33 or LA65 == 34 or LA65 == 35 or LA65 == 36 or LA65 == 37 or LA65 == 38 or LA65 == 39 or LA65 == 40 or LA65 == 41 or LA65 == 42 or LA65 == 45 or LA65 == 46 or LA65 == 48 or LA65 == 49 or LA65 == 50 or LA65 == 51 or LA65 == 52 or LA65 == 53 or LA65 == 54 or LA65 == 55 or LA65 == 56 or LA65 == 57 or LA65 == 58 or LA65 == 59 or LA65 == 60 or LA65 == 61: + alt65 = 4 + elif LA65 == IDENTIFIER: + LA65_55 = self.input.LA(3) + + if (self.synpred117()) : + alt65 = 3 + elif (self.synpred118()) : + alt65 = 4 + + + elif LA65 == 66: + LA65_57 = self.input.LA(3) + + if (self.synpred117()) : + alt65 = 3 + elif (self.synpred118()) : + alt65 = 4 + + + elif LA65 == HEX_LITERAL or LA65 == OCTAL_LITERAL or LA65 == DECIMAL_LITERAL or LA65 == CHARACTER_LITERAL or LA65 == STRING_LITERAL or LA65 == FLOATING_POINT_LITERAL or LA65 == 62 or LA65 == 68 or LA65 == 69 or LA65 == 72 or LA65 == 73 or LA65 == 74 or LA65 == 77 or LA65 == 78 or LA65 == 79: + alt65 = 3 + + elif LA65 == 75: + alt65 = 5 + elif LA65 == 76: + alt65 = 7 + elif LA65 == 72: + alt65 = 8 + elif LA65 == 73: + alt65 = 9 + + if alt65 == 1: + # C.g:407:13: '[' expression ']' + self.match(self.input, 64, self.FOLLOW_64_in_postfix_expression1383) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_postfix_expression1385) + self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 65, self.FOLLOW_65_in_postfix_expression1387) + if self.failed: + return + + + elif alt65 == 2: + # C.g:408:13: '(' a= ')' + self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1401) + if self.failed: + return + a = self.input.LT(1) + self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1405) + if self.failed: + return + if self.backtracking == 0: + self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, a.line, a.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, '') + + + + elif alt65 == 3: + # C.g:409:13: '(' c= argument_expression_list b= ')' + self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1420) + if self.failed: + return + self.following.append(self.FOLLOW_argument_expression_list_in_postfix_expression1424) + c = self.argument_expression_list() + self.following.pop() + if self.failed: + return + b = self.input.LT(1) + self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1428) + if self.failed: + return + if self.backtracking == 0: + self.StoreFunctionCalling(p.start.line, p.start.charPositionInLine, b.line, b.charPositionInLine, self.postfix_expression_stack[-1].FuncCallText, self.input.toString(c.start,c.stop)) + + + + elif alt65 == 4: + # C.g:410:13: '(' macro_parameter_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_postfix_expression1444) + if self.failed: + return + self.following.append(self.FOLLOW_macro_parameter_list_in_postfix_expression1446) + self.macro_parameter_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_postfix_expression1448) + if self.failed: + return + + + elif alt65 == 5: + # C.g:411:13: '.' x= IDENTIFIER + self.match(self.input, 75, self.FOLLOW_75_in_postfix_expression1462) + if self.failed: + return + x = self.input.LT(1) + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1466) + if self.failed: + return + if self.backtracking == 0: + self.postfix_expression_stack[-1].FuncCallText += '.' + x.text + + + + elif alt65 == 6: + # C.g:412:13: '*' y= IDENTIFIER + self.match(self.input, 66, self.FOLLOW_66_in_postfix_expression1482) + if self.failed: + return + y = self.input.LT(1) + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1486) + if self.failed: + return + if self.backtracking == 0: + self.postfix_expression_stack[-1].FuncCallText = y.text + + + + elif alt65 == 7: + # C.g:413:13: '->' z= IDENTIFIER + self.match(self.input, 76, self.FOLLOW_76_in_postfix_expression1502) + if self.failed: + return + z = self.input.LT(1) + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_postfix_expression1506) + if self.failed: + return + if self.backtracking == 0: + self.postfix_expression_stack[-1].FuncCallText += '->' + z.text + + + + elif alt65 == 8: + # C.g:414:13: '++' + self.match(self.input, 72, self.FOLLOW_72_in_postfix_expression1522) + if self.failed: + return + + + elif alt65 == 9: + # C.g:415:13: '--' + self.match(self.input, 73, self.FOLLOW_73_in_postfix_expression1536) + if self.failed: + return + + + else: + break #loop65 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 41, postfix_expression_StartIndex) + + self.postfix_expression_stack.pop() + pass + + return + + # $ANTLR end postfix_expression + + + # $ANTLR start macro_parameter_list + # C.g:419:1: macro_parameter_list : parameter_declaration ( ',' parameter_declaration )* ; + def macro_parameter_list(self, ): + + macro_parameter_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 42): + return + + # C.g:420:2: ( parameter_declaration ( ',' parameter_declaration )* ) + # C.g:420:4: parameter_declaration ( ',' parameter_declaration )* + self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1559) + self.parameter_declaration() + self.following.pop() + if self.failed: + return + # C.g:420:26: ( ',' parameter_declaration )* + while True: #loop66 + alt66 = 2 + LA66_0 = self.input.LA(1) + + if (LA66_0 == 27) : + alt66 = 1 + + + if alt66 == 1: + # C.g:420:27: ',' parameter_declaration + self.match(self.input, 27, self.FOLLOW_27_in_macro_parameter_list1562) + if self.failed: + return + self.following.append(self.FOLLOW_parameter_declaration_in_macro_parameter_list1564) + self.parameter_declaration() + self.following.pop() + if self.failed: + return + + + else: + break #loop66 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 42, macro_parameter_list_StartIndex) + + pass + + return + + # $ANTLR end macro_parameter_list + + + # $ANTLR start unary_operator + # C.g:423:1: unary_operator : ( '&' | '*' | '+' | '-' | '~' | '!' ); + def unary_operator(self, ): + + unary_operator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 43): + return + + # C.g:424:2: ( '&' | '*' | '+' | '-' | '~' | '!' ) + # C.g: + if self.input.LA(1) == 66 or (68 <= self.input.LA(1) <= 69) or (77 <= self.input.LA(1) <= 79): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_unary_operator0 + ) + raise mse + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 43, unary_operator_StartIndex) + + pass + + return + + # $ANTLR end unary_operator + + class primary_expression_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start primary_expression + # C.g:432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' ); + def primary_expression(self, ): + + retval = self.primary_expression_return() + retval.start = self.input.LT(1) + primary_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 44): + return retval + + # C.g:433:2: ( IDENTIFIER | constant | '(' expression ')' ) + alt67 = 3 + LA67 = self.input.LA(1) + if LA67 == IDENTIFIER: + LA67_1 = self.input.LA(2) + + if (LA67_1 == EOF or LA67_1 == 25 or (27 <= LA67_1 <= 28) or LA67_1 == 44 or LA67_1 == 47 or LA67_1 == 53 or (62 <= LA67_1 <= 66) or (68 <= LA67_1 <= 73) or (75 <= LA67_1 <= 77) or (80 <= LA67_1 <= 102)) : + alt67 = 1 + elif (LA67_1 == IDENTIFIER or LA67_1 == STRING_LITERAL) : + alt67 = 2 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 1, self.input) + + raise nvae + + elif LA67 == HEX_LITERAL or LA67 == OCTAL_LITERAL or LA67 == DECIMAL_LITERAL or LA67 == CHARACTER_LITERAL or LA67 == STRING_LITERAL or LA67 == FLOATING_POINT_LITERAL: + alt67 = 2 + elif LA67 == 62: + alt67 = 3 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("432:1: primary_expression : ( IDENTIFIER | constant | '(' expression ')' );", 67, 0, self.input) + + raise nvae + + if alt67 == 1: + # C.g:433:4: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_primary_expression1613) + if self.failed: + return retval + + + elif alt67 == 2: + # C.g:434:4: constant + self.following.append(self.FOLLOW_constant_in_primary_expression1618) + self.constant() + self.following.pop() + if self.failed: + return retval + + + elif alt67 == 3: + # C.g:435:4: '(' expression ')' + self.match(self.input, 62, self.FOLLOW_62_in_primary_expression1623) + if self.failed: + return retval + self.following.append(self.FOLLOW_expression_in_primary_expression1625) + self.expression() + self.following.pop() + if self.failed: + return retval + self.match(self.input, 63, self.FOLLOW_63_in_primary_expression1627) + if self.failed: + return retval + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 44, primary_expression_StartIndex) + + pass + + return retval + + # $ANTLR end primary_expression + + + # $ANTLR start constant + # C.g:438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL ); + def constant(self, ): + + constant_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 45): + return + + # C.g:439:5: ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL ) + alt72 = 6 + LA72 = self.input.LA(1) + if LA72 == HEX_LITERAL: + alt72 = 1 + elif LA72 == OCTAL_LITERAL: + alt72 = 2 + elif LA72 == DECIMAL_LITERAL: + alt72 = 3 + elif LA72 == CHARACTER_LITERAL: + alt72 = 4 + elif LA72 == IDENTIFIER or LA72 == STRING_LITERAL: + alt72 = 5 + elif LA72 == FLOATING_POINT_LITERAL: + alt72 = 6 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("438:1: constant : ( HEX_LITERAL | OCTAL_LITERAL | DECIMAL_LITERAL | CHARACTER_LITERAL | ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* | FLOATING_POINT_LITERAL );", 72, 0, self.input) + + raise nvae + + if alt72 == 1: + # C.g:439:9: HEX_LITERAL + self.match(self.input, HEX_LITERAL, self.FOLLOW_HEX_LITERAL_in_constant1643) + if self.failed: + return + + + elif alt72 == 2: + # C.g:440:9: OCTAL_LITERAL + self.match(self.input, OCTAL_LITERAL, self.FOLLOW_OCTAL_LITERAL_in_constant1653) + if self.failed: + return + + + elif alt72 == 3: + # C.g:441:9: DECIMAL_LITERAL + self.match(self.input, DECIMAL_LITERAL, self.FOLLOW_DECIMAL_LITERAL_in_constant1663) + if self.failed: + return + + + elif alt72 == 4: + # C.g:442:7: CHARACTER_LITERAL + self.match(self.input, CHARACTER_LITERAL, self.FOLLOW_CHARACTER_LITERAL_in_constant1671) + if self.failed: + return + + + elif alt72 == 5: + # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ ( IDENTIFIER )* + # C.g:443:7: ( ( IDENTIFIER )* ( STRING_LITERAL )+ )+ + cnt70 = 0 + while True: #loop70 + alt70 = 2 + LA70_0 = self.input.LA(1) + + if (LA70_0 == IDENTIFIER) : + LA70_1 = self.input.LA(2) + + if (LA70_1 == STRING_LITERAL) : + alt70 = 1 + elif (LA70_1 == IDENTIFIER) : + LA70_33 = self.input.LA(3) + + if (self.synpred138()) : + alt70 = 1 + + + + + elif (LA70_0 == STRING_LITERAL) : + alt70 = 1 + + + if alt70 == 1: + # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+ + # C.g:443:8: ( IDENTIFIER )* + while True: #loop68 + alt68 = 2 + LA68_0 = self.input.LA(1) + + if (LA68_0 == IDENTIFIER) : + alt68 = 1 + + + if alt68 == 1: + # C.g:0:0: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1680) + if self.failed: + return + + + else: + break #loop68 + + + # C.g:443:20: ( STRING_LITERAL )+ + cnt69 = 0 + while True: #loop69 + alt69 = 2 + LA69_0 = self.input.LA(1) + + if (LA69_0 == STRING_LITERAL) : + LA69_31 = self.input.LA(2) + + if (self.synpred137()) : + alt69 = 1 + + + + + if alt69 == 1: + # C.g:0:0: STRING_LITERAL + self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_constant1683) + if self.failed: + return + + + else: + if cnt69 >= 1: + break #loop69 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(69, self.input) + raise eee + + cnt69 += 1 + + + + + else: + if cnt70 >= 1: + break #loop70 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(70, self.input) + raise eee + + cnt70 += 1 + + + # C.g:443:38: ( IDENTIFIER )* + while True: #loop71 + alt71 = 2 + LA71_0 = self.input.LA(1) + + if (LA71_0 == IDENTIFIER) : + alt71 = 1 + + + if alt71 == 1: + # C.g:0:0: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_constant1688) + if self.failed: + return + + + else: + break #loop71 + + + + + elif alt72 == 6: + # C.g:444:9: FLOATING_POINT_LITERAL + self.match(self.input, FLOATING_POINT_LITERAL, self.FOLLOW_FLOATING_POINT_LITERAL_in_constant1699) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 45, constant_StartIndex) + + pass + + return + + # $ANTLR end constant + + class expression_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start expression + # C.g:449:1: expression : assignment_expression ( ',' assignment_expression )* ; + def expression(self, ): + + retval = self.expression_return() + retval.start = self.input.LT(1) + expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 46): + return retval + + # C.g:450:2: ( assignment_expression ( ',' assignment_expression )* ) + # C.g:450:4: assignment_expression ( ',' assignment_expression )* + self.following.append(self.FOLLOW_assignment_expression_in_expression1715) + self.assignment_expression() + self.following.pop() + if self.failed: + return retval + # C.g:450:26: ( ',' assignment_expression )* + while True: #loop73 + alt73 = 2 + LA73_0 = self.input.LA(1) + + if (LA73_0 == 27) : + alt73 = 1 + + + if alt73 == 1: + # C.g:450:27: ',' assignment_expression + self.match(self.input, 27, self.FOLLOW_27_in_expression1718) + if self.failed: + return retval + self.following.append(self.FOLLOW_assignment_expression_in_expression1720) + self.assignment_expression() + self.following.pop() + if self.failed: + return retval + + + else: + break #loop73 + + + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 46, expression_StartIndex) + + pass + + return retval + + # $ANTLR end expression + + + # $ANTLR start constant_expression + # C.g:453:1: constant_expression : conditional_expression ; + def constant_expression(self, ): + + constant_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 47): + return + + # C.g:454:2: ( conditional_expression ) + # C.g:454:4: conditional_expression + self.following.append(self.FOLLOW_conditional_expression_in_constant_expression1733) + self.conditional_expression() + self.following.pop() + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 47, constant_expression_StartIndex) + + pass + + return + + # $ANTLR end constant_expression + + + # $ANTLR start assignment_expression + # C.g:457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression ); + def assignment_expression(self, ): + + assignment_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 48): + return + + # C.g:458:2: ( lvalue assignment_operator assignment_expression | conditional_expression ) + alt74 = 2 + LA74 = self.input.LA(1) + if LA74 == IDENTIFIER: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_13 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 13, self.input) + + raise nvae + + elif LA74 == 62: + LA74_14 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 14, self.input) + + raise nvae + + elif LA74 == 75: + LA74_15 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 15, self.input) + + raise nvae + + elif LA74 == 66: + LA74_16 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 16, self.input) + + raise nvae + + elif LA74 == 76: + LA74_17 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 17, self.input) + + raise nvae + + elif LA74 == 72: + LA74_18 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 18, self.input) + + raise nvae + + elif LA74 == 73: + LA74_19 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 19, self.input) + + raise nvae + + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + elif LA74 == STRING_LITERAL: + LA74_21 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 21, self.input) + + raise nvae + + elif LA74 == IDENTIFIER: + LA74_22 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 22, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 1, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_44 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 44, self.input) + + raise nvae + + elif LA74 == 62: + LA74_45 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 45, self.input) + + raise nvae + + elif LA74 == 75: + LA74_46 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 46, self.input) + + raise nvae + + elif LA74 == 66: + LA74_47 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 47, self.input) + + raise nvae + + elif LA74 == 76: + LA74_48 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 48, self.input) + + raise nvae + + elif LA74 == 72: + LA74_49 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 49, self.input) + + raise nvae + + elif LA74 == 73: + LA74_50 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 50, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 2, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_73 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 73, self.input) + + raise nvae + + elif LA74 == 62: + LA74_74 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 74, self.input) + + raise nvae + + elif LA74 == 75: + LA74_75 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 75, self.input) + + raise nvae + + elif LA74 == 66: + LA74_76 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 76, self.input) + + raise nvae + + elif LA74 == 76: + LA74_77 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 77, self.input) + + raise nvae + + elif LA74 == 72: + LA74_78 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 78, self.input) + + raise nvae + + elif LA74 == 73: + LA74_79 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 79, self.input) + + raise nvae + + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 3, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_102 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 102, self.input) + + raise nvae + + elif LA74 == 62: + LA74_103 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 103, self.input) + + raise nvae + + elif LA74 == 75: + LA74_104 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 104, self.input) + + raise nvae + + elif LA74 == 66: + LA74_105 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 105, self.input) + + raise nvae + + elif LA74 == 76: + LA74_106 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 106, self.input) + + raise nvae + + elif LA74 == 72: + LA74_107 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 107, self.input) + + raise nvae + + elif LA74 == 73: + LA74_108 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 108, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 4, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_131 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 131, self.input) + + raise nvae + + elif LA74 == 62: + LA74_132 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 132, self.input) + + raise nvae + + elif LA74 == 75: + LA74_133 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 133, self.input) + + raise nvae + + elif LA74 == 66: + LA74_134 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 134, self.input) + + raise nvae + + elif LA74 == 76: + LA74_135 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 135, self.input) + + raise nvae + + elif LA74 == 72: + LA74_136 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 136, self.input) + + raise nvae + + elif LA74 == 73: + LA74_137 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 137, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 5, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74 = self.input.LA(2) + if LA74 == IDENTIFIER: + LA74_160 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 160, self.input) + + raise nvae + + elif LA74 == 64: + LA74_161 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 161, self.input) + + raise nvae + + elif LA74 == 62: + LA74_162 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 162, self.input) + + raise nvae + + elif LA74 == 75: + LA74_163 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 163, self.input) + + raise nvae + + elif LA74 == 66: + LA74_164 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 164, self.input) + + raise nvae + + elif LA74 == 76: + LA74_165 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 165, self.input) + + raise nvae + + elif LA74 == 72: + LA74_166 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 166, self.input) + + raise nvae + + elif LA74 == 73: + LA74_167 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 167, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + elif LA74 == STRING_LITERAL: + LA74_189 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 189, self.input) + + raise nvae + + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 6, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74 = self.input.LA(2) + if LA74 == 64: + LA74_191 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 191, self.input) + + raise nvae + + elif LA74 == 62: + LA74_192 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 192, self.input) + + raise nvae + + elif LA74 == 75: + LA74_193 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 193, self.input) + + raise nvae + + elif LA74 == 66: + LA74_194 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 194, self.input) + + raise nvae + + elif LA74 == 76: + LA74_195 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 195, self.input) + + raise nvae + + elif LA74 == 72: + LA74_196 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 196, self.input) + + raise nvae + + elif LA74 == 73: + LA74_197 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 197, self.input) + + raise nvae + + elif LA74 == EOF or LA74 == 25 or LA74 == 27 or LA74 == 44 or LA74 == 47 or LA74 == 53 or LA74 == 63 or LA74 == 65 or LA74 == 68 or LA74 == 69 or LA74 == 70 or LA74 == 71 or LA74 == 77 or LA74 == 90 or LA74 == 91 or LA74 == 92 or LA74 == 93 or LA74 == 94 or LA74 == 95 or LA74 == 96 or LA74 == 97 or LA74 == 98 or LA74 == 99 or LA74 == 100 or LA74 == 101 or LA74 == 102: + alt74 = 2 + elif LA74 == 28 or LA74 == 80 or LA74 == 81 or LA74 == 82 or LA74 == 83 or LA74 == 84 or LA74 == 85 or LA74 == 86 or LA74 == 87 or LA74 == 88 or LA74 == 89: + alt74 = 1 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 7, self.input) + + raise nvae + + elif LA74 == 62: + LA74 = self.input.LA(2) + if LA74 == IDENTIFIER: + LA74_220 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 220, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74_221 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 221, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74_222 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 222, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74_223 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 223, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74_224 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 224, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74_225 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 225, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74_226 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 226, self.input) + + raise nvae + + elif LA74 == 62: + LA74_227 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 227, self.input) + + raise nvae + + elif LA74 == 72: + LA74_228 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 228, self.input) + + raise nvae + + elif LA74 == 73: + LA74_229 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 229, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74_230 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 230, self.input) + + raise nvae + + elif LA74 == 74: + LA74_231 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 231, self.input) + + raise nvae + + elif LA74 == 34 or LA74 == 35 or LA74 == 36 or LA74 == 37 or LA74 == 38 or LA74 == 39 or LA74 == 40 or LA74 == 41 or LA74 == 42 or LA74 == 45 or LA74 == 46 or LA74 == 48 or LA74 == 49 or LA74 == 50 or LA74 == 51 or LA74 == 52 or LA74 == 53 or LA74 == 54 or LA74 == 55 or LA74 == 56 or LA74 == 57 or LA74 == 58 or LA74 == 59 or LA74 == 60 or LA74 == 61: + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 8, self.input) + + raise nvae + + elif LA74 == 72: + LA74 = self.input.LA(2) + if LA74 == IDENTIFIER: + LA74_244 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 244, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74_245 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 245, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74_246 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 246, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74_247 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 247, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74_248 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 248, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74_249 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 249, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74_250 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 250, self.input) + + raise nvae + + elif LA74 == 62: + LA74_251 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 251, self.input) + + raise nvae + + elif LA74 == 72: + LA74_252 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 252, self.input) + + raise nvae + + elif LA74 == 73: + LA74_253 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 253, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74_254 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 254, self.input) + + raise nvae + + elif LA74 == 74: + LA74_255 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 255, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 9, self.input) + + raise nvae + + elif LA74 == 73: + LA74 = self.input.LA(2) + if LA74 == IDENTIFIER: + LA74_256 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 256, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74_257 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 257, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74_258 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 258, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74_259 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 259, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74_260 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 260, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74_261 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 261, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74_262 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 262, self.input) + + raise nvae + + elif LA74 == 62: + LA74_263 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 263, self.input) + + raise nvae + + elif LA74 == 72: + LA74_264 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 264, self.input) + + raise nvae + + elif LA74 == 73: + LA74_265 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 265, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74_266 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 266, self.input) + + raise nvae + + elif LA74 == 74: + LA74_267 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 267, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 10, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74 = self.input.LA(2) + if LA74 == 62: + LA74_268 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 268, self.input) + + raise nvae + + elif LA74 == IDENTIFIER: + LA74_269 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 269, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74_270 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 270, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74_271 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 271, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74_272 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 272, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74_273 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 273, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74_274 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 274, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74_275 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 275, self.input) + + raise nvae + + elif LA74 == 72: + LA74_276 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 276, self.input) + + raise nvae + + elif LA74 == 73: + LA74_277 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 277, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74_278 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 278, self.input) + + raise nvae + + elif LA74 == 74: + LA74_279 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 279, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 11, self.input) + + raise nvae + + elif LA74 == 74: + LA74 = self.input.LA(2) + if LA74 == 62: + LA74_280 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 280, self.input) + + raise nvae + + elif LA74 == IDENTIFIER: + LA74_281 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 281, self.input) + + raise nvae + + elif LA74 == HEX_LITERAL: + LA74_282 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 282, self.input) + + raise nvae + + elif LA74 == OCTAL_LITERAL: + LA74_283 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 283, self.input) + + raise nvae + + elif LA74 == DECIMAL_LITERAL: + LA74_284 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 284, self.input) + + raise nvae + + elif LA74 == CHARACTER_LITERAL: + LA74_285 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 285, self.input) + + raise nvae + + elif LA74 == STRING_LITERAL: + LA74_286 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 286, self.input) + + raise nvae + + elif LA74 == FLOATING_POINT_LITERAL: + LA74_287 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 287, self.input) + + raise nvae + + elif LA74 == 72: + LA74_288 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 288, self.input) + + raise nvae + + elif LA74 == 73: + LA74_289 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 289, self.input) + + raise nvae + + elif LA74 == 66 or LA74 == 68 or LA74 == 69 or LA74 == 77 or LA74 == 78 or LA74 == 79: + LA74_290 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 290, self.input) + + raise nvae + + elif LA74 == 74: + LA74_291 = self.input.LA(3) + + if (self.synpred142()) : + alt74 = 1 + elif (True) : + alt74 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 291, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 12, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("457:1: assignment_expression : ( lvalue assignment_operator assignment_expression | conditional_expression );", 74, 0, self.input) + + raise nvae + + if alt74 == 1: + # C.g:458:4: lvalue assignment_operator assignment_expression + self.following.append(self.FOLLOW_lvalue_in_assignment_expression1744) + self.lvalue() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_assignment_operator_in_assignment_expression1746) + self.assignment_operator() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_assignment_expression_in_assignment_expression1748) + self.assignment_expression() + self.following.pop() + if self.failed: + return + + + elif alt74 == 2: + # C.g:459:4: conditional_expression + self.following.append(self.FOLLOW_conditional_expression_in_assignment_expression1753) + self.conditional_expression() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 48, assignment_expression_StartIndex) + + pass + + return + + # $ANTLR end assignment_expression + + + # $ANTLR start lvalue + # C.g:462:1: lvalue : unary_expression ; + def lvalue(self, ): + + lvalue_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 49): + return + + # C.g:463:2: ( unary_expression ) + # C.g:463:4: unary_expression + self.following.append(self.FOLLOW_unary_expression_in_lvalue1765) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 49, lvalue_StartIndex) + + pass + + return + + # $ANTLR end lvalue + + + # $ANTLR start assignment_operator + # C.g:466:1: assignment_operator : ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' ); + def assignment_operator(self, ): + + assignment_operator_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 50): + return + + # C.g:467:2: ( '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' ) + # C.g: + if self.input.LA(1) == 28 or (80 <= self.input.LA(1) <= 89): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_assignment_operator0 + ) + raise mse + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 50, assignment_operator_StartIndex) + + pass + + return + + # $ANTLR end assignment_operator + + + # $ANTLR start conditional_expression + # C.g:480:1: conditional_expression : e= logical_or_expression ( '?' expression ':' conditional_expression )? ; + def conditional_expression(self, ): + + conditional_expression_StartIndex = self.input.index() + e = None + + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 51): + return + + # C.g:481:2: (e= logical_or_expression ( '?' expression ':' conditional_expression )? ) + # C.g:481:4: e= logical_or_expression ( '?' expression ':' conditional_expression )? + self.following.append(self.FOLLOW_logical_or_expression_in_conditional_expression1839) + e = self.logical_or_expression() + self.following.pop() + if self.failed: + return + # C.g:481:28: ( '?' expression ':' conditional_expression )? + alt75 = 2 + LA75_0 = self.input.LA(1) + + if (LA75_0 == 90) : + alt75 = 1 + if alt75 == 1: + # C.g:481:29: '?' expression ':' conditional_expression + self.match(self.input, 90, self.FOLLOW_90_in_conditional_expression1842) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_conditional_expression1844) + self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 47, self.FOLLOW_47_in_conditional_expression1846) + if self.failed: + return + self.following.append(self.FOLLOW_conditional_expression_in_conditional_expression1848) + self.conditional_expression() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 51, conditional_expression_StartIndex) + + pass + + return + + # $ANTLR end conditional_expression + + class logical_or_expression_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start logical_or_expression + # C.g:484:1: logical_or_expression : logical_and_expression ( '||' logical_and_expression )* ; + def logical_or_expression(self, ): + + retval = self.logical_or_expression_return() + retval.start = self.input.LT(1) + logical_or_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 52): + return retval + + # C.g:485:2: ( logical_and_expression ( '||' logical_and_expression )* ) + # C.g:485:4: logical_and_expression ( '||' logical_and_expression )* + self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1863) + self.logical_and_expression() + self.following.pop() + if self.failed: + return retval + # C.g:485:27: ( '||' logical_and_expression )* + while True: #loop76 + alt76 = 2 + LA76_0 = self.input.LA(1) + + if (LA76_0 == 91) : + alt76 = 1 + + + if alt76 == 1: + # C.g:485:28: '||' logical_and_expression + self.match(self.input, 91, self.FOLLOW_91_in_logical_or_expression1866) + if self.failed: + return retval + self.following.append(self.FOLLOW_logical_and_expression_in_logical_or_expression1868) + self.logical_and_expression() + self.following.pop() + if self.failed: + return retval + + + else: + break #loop76 + + + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 52, logical_or_expression_StartIndex) + + pass + + return retval + + # $ANTLR end logical_or_expression + + + # $ANTLR start logical_and_expression + # C.g:488:1: logical_and_expression : inclusive_or_expression ( '&&' inclusive_or_expression )* ; + def logical_and_expression(self, ): + + logical_and_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 53): + return + + # C.g:489:2: ( inclusive_or_expression ( '&&' inclusive_or_expression )* ) + # C.g:489:4: inclusive_or_expression ( '&&' inclusive_or_expression )* + self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1881) + self.inclusive_or_expression() + self.following.pop() + if self.failed: + return + # C.g:489:28: ( '&&' inclusive_or_expression )* + while True: #loop77 + alt77 = 2 + LA77_0 = self.input.LA(1) + + if (LA77_0 == 92) : + alt77 = 1 + + + if alt77 == 1: + # C.g:489:29: '&&' inclusive_or_expression + self.match(self.input, 92, self.FOLLOW_92_in_logical_and_expression1884) + if self.failed: + return + self.following.append(self.FOLLOW_inclusive_or_expression_in_logical_and_expression1886) + self.inclusive_or_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop77 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 53, logical_and_expression_StartIndex) + + pass + + return + + # $ANTLR end logical_and_expression + + + # $ANTLR start inclusive_or_expression + # C.g:492:1: inclusive_or_expression : exclusive_or_expression ( '|' exclusive_or_expression )* ; + def inclusive_or_expression(self, ): + + inclusive_or_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 54): + return + + # C.g:493:2: ( exclusive_or_expression ( '|' exclusive_or_expression )* ) + # C.g:493:4: exclusive_or_expression ( '|' exclusive_or_expression )* + self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899) + self.exclusive_or_expression() + self.following.pop() + if self.failed: + return + # C.g:493:28: ( '|' exclusive_or_expression )* + while True: #loop78 + alt78 = 2 + LA78_0 = self.input.LA(1) + + if (LA78_0 == 93) : + alt78 = 1 + + + if alt78 == 1: + # C.g:493:29: '|' exclusive_or_expression + self.match(self.input, 93, self.FOLLOW_93_in_inclusive_or_expression1902) + if self.failed: + return + self.following.append(self.FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904) + self.exclusive_or_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop78 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 54, inclusive_or_expression_StartIndex) + + pass + + return + + # $ANTLR end inclusive_or_expression + + + # $ANTLR start exclusive_or_expression + # C.g:496:1: exclusive_or_expression : and_expression ( '^' and_expression )* ; + def exclusive_or_expression(self, ): + + exclusive_or_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 55): + return + + # C.g:497:2: ( and_expression ( '^' and_expression )* ) + # C.g:497:4: and_expression ( '^' and_expression )* + self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1917) + self.and_expression() + self.following.pop() + if self.failed: + return + # C.g:497:19: ( '^' and_expression )* + while True: #loop79 + alt79 = 2 + LA79_0 = self.input.LA(1) + + if (LA79_0 == 94) : + alt79 = 1 + + + if alt79 == 1: + # C.g:497:20: '^' and_expression + self.match(self.input, 94, self.FOLLOW_94_in_exclusive_or_expression1920) + if self.failed: + return + self.following.append(self.FOLLOW_and_expression_in_exclusive_or_expression1922) + self.and_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop79 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 55, exclusive_or_expression_StartIndex) + + pass + + return + + # $ANTLR end exclusive_or_expression + + + # $ANTLR start and_expression + # C.g:500:1: and_expression : equality_expression ( '&' equality_expression )* ; + def and_expression(self, ): + + and_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 56): + return + + # C.g:501:2: ( equality_expression ( '&' equality_expression )* ) + # C.g:501:4: equality_expression ( '&' equality_expression )* + self.following.append(self.FOLLOW_equality_expression_in_and_expression1935) + self.equality_expression() + self.following.pop() + if self.failed: + return + # C.g:501:24: ( '&' equality_expression )* + while True: #loop80 + alt80 = 2 + LA80_0 = self.input.LA(1) + + if (LA80_0 == 77) : + alt80 = 1 + + + if alt80 == 1: + # C.g:501:25: '&' equality_expression + self.match(self.input, 77, self.FOLLOW_77_in_and_expression1938) + if self.failed: + return + self.following.append(self.FOLLOW_equality_expression_in_and_expression1940) + self.equality_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop80 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 56, and_expression_StartIndex) + + pass + + return + + # $ANTLR end and_expression + + + # $ANTLR start equality_expression + # C.g:503:1: equality_expression : relational_expression ( ( '==' | '!=' ) relational_expression )* ; + def equality_expression(self, ): + + equality_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 57): + return + + # C.g:504:2: ( relational_expression ( ( '==' | '!=' ) relational_expression )* ) + # C.g:504:4: relational_expression ( ( '==' | '!=' ) relational_expression )* + self.following.append(self.FOLLOW_relational_expression_in_equality_expression1952) + self.relational_expression() + self.following.pop() + if self.failed: + return + # C.g:504:26: ( ( '==' | '!=' ) relational_expression )* + while True: #loop81 + alt81 = 2 + LA81_0 = self.input.LA(1) + + if ((95 <= LA81_0 <= 96)) : + alt81 = 1 + + + if alt81 == 1: + # C.g:504:27: ( '==' | '!=' ) relational_expression + if (95 <= self.input.LA(1) <= 96): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_equality_expression1955 + ) + raise mse + + + self.following.append(self.FOLLOW_relational_expression_in_equality_expression1961) + self.relational_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop81 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 57, equality_expression_StartIndex) + + pass + + return + + # $ANTLR end equality_expression + + + # $ANTLR start relational_expression + # C.g:507:1: relational_expression : shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* ; + def relational_expression(self, ): + + relational_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 58): + return + + # C.g:508:2: ( shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* ) + # C.g:508:4: shift_expression ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* + self.following.append(self.FOLLOW_shift_expression_in_relational_expression1975) + self.shift_expression() + self.following.pop() + if self.failed: + return + # C.g:508:21: ( ( '<' | '>' | '<=' | '>=' ) shift_expression )* + while True: #loop82 + alt82 = 2 + LA82_0 = self.input.LA(1) + + if ((97 <= LA82_0 <= 100)) : + alt82 = 1 + + + if alt82 == 1: + # C.g:508:22: ( '<' | '>' | '<=' | '>=' ) shift_expression + if (97 <= self.input.LA(1) <= 100): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_relational_expression1978 + ) + raise mse + + + self.following.append(self.FOLLOW_shift_expression_in_relational_expression1988) + self.shift_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop82 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 58, relational_expression_StartIndex) + + pass + + return + + # $ANTLR end relational_expression + + + # $ANTLR start shift_expression + # C.g:511:1: shift_expression : additive_expression ( ( '<<' | '>>' ) additive_expression )* ; + def shift_expression(self, ): + + shift_expression_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 59): + return + + # C.g:512:2: ( additive_expression ( ( '<<' | '>>' ) additive_expression )* ) + # C.g:512:4: additive_expression ( ( '<<' | '>>' ) additive_expression )* + self.following.append(self.FOLLOW_additive_expression_in_shift_expression2001) + self.additive_expression() + self.following.pop() + if self.failed: + return + # C.g:512:24: ( ( '<<' | '>>' ) additive_expression )* + while True: #loop83 + alt83 = 2 + LA83_0 = self.input.LA(1) + + if ((101 <= LA83_0 <= 102)) : + alt83 = 1 + + + if alt83 == 1: + # C.g:512:25: ( '<<' | '>>' ) additive_expression + if (101 <= self.input.LA(1) <= 102): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_shift_expression2004 + ) + raise mse + + + self.following.append(self.FOLLOW_additive_expression_in_shift_expression2010) + self.additive_expression() + self.following.pop() + if self.failed: + return + + + else: + break #loop83 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 59, shift_expression_StartIndex) + + pass + + return + + # $ANTLR end shift_expression + + + # $ANTLR start statement + # C.g:517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration ); + def statement(self, ): + + statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 60): + return + + # C.g:518:2: ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration ) + alt84 = 11 + LA84 = self.input.LA(1) + if LA84 == IDENTIFIER: + LA84 = self.input.LA(2) + if LA84 == 62: + LA84_43 = self.input.LA(3) + + if (self.synpred169()) : + alt84 = 3 + elif (self.synpred173()) : + alt84 = 7 + elif (self.synpred174()) : + alt84 = 8 + elif (True) : + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 43, self.input) + + raise nvae + + elif LA84 == 47: + alt84 = 1 + elif LA84 == STRING_LITERAL or LA84 == 27 or LA84 == 28 or LA84 == 64 or LA84 == 68 or LA84 == 69 or LA84 == 70 or LA84 == 71 or LA84 == 72 or LA84 == 73 or LA84 == 75 or LA84 == 76 or LA84 == 77 or LA84 == 80 or LA84 == 81 or LA84 == 82 or LA84 == 83 or LA84 == 84 or LA84 == 85 or LA84 == 86 or LA84 == 87 or LA84 == 88 or LA84 == 89 or LA84 == 90 or LA84 == 91 or LA84 == 92 or LA84 == 93 or LA84 == 94 or LA84 == 95 or LA84 == 96 or LA84 == 97 or LA84 == 98 or LA84 == 99 or LA84 == 100 or LA84 == 101 or LA84 == 102: + alt84 = 3 + elif LA84 == 66: + LA84_47 = self.input.LA(3) + + if (self.synpred169()) : + alt84 = 3 + elif (True) : + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 47, self.input) + + raise nvae + + elif LA84 == IDENTIFIER: + LA84_53 = self.input.LA(3) + + if (self.synpred169()) : + alt84 = 3 + elif (True) : + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 53, self.input) + + raise nvae + + elif LA84 == 25: + LA84_68 = self.input.LA(3) + + if (self.synpred169()) : + alt84 = 3 + elif (True) : + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 68, self.input) + + raise nvae + + elif LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61: + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 1, self.input) + + raise nvae + + elif LA84 == 106 or LA84 == 107: + alt84 = 1 + elif LA84 == 43: + alt84 = 2 + elif LA84 == HEX_LITERAL or LA84 == OCTAL_LITERAL or LA84 == DECIMAL_LITERAL or LA84 == CHARACTER_LITERAL or LA84 == STRING_LITERAL or LA84 == FLOATING_POINT_LITERAL or LA84 == 25 or LA84 == 62 or LA84 == 66 or LA84 == 68 or LA84 == 69 or LA84 == 72 or LA84 == 73 or LA84 == 74 or LA84 == 77 or LA84 == 78 or LA84 == 79: + alt84 = 3 + elif LA84 == 108 or LA84 == 110: + alt84 = 4 + elif LA84 == 111 or LA84 == 112 or LA84 == 113: + alt84 = 5 + elif LA84 == 114 or LA84 == 115 or LA84 == 116 or LA84 == 117: + alt84 = 6 + elif LA84 == 103: + alt84 = 8 + elif LA84 == 104: + alt84 = 9 + elif LA84 == 105: + alt84 = 10 + elif LA84 == 26 or LA84 == 29 or LA84 == 30 or LA84 == 31 or LA84 == 32 or LA84 == 33 or LA84 == 34 or LA84 == 35 or LA84 == 36 or LA84 == 37 or LA84 == 38 or LA84 == 39 or LA84 == 40 or LA84 == 41 or LA84 == 42 or LA84 == 45 or LA84 == 46 or LA84 == 48 or LA84 == 49 or LA84 == 50 or LA84 == 51 or LA84 == 52 or LA84 == 53 or LA84 == 54 or LA84 == 55 or LA84 == 56 or LA84 == 57 or LA84 == 58 or LA84 == 59 or LA84 == 60 or LA84 == 61: + alt84 = 11 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("517:1: statement : ( labeled_statement | compound_statement | expression_statement | selection_statement | iteration_statement | jump_statement | macro_statement | asm2_statement | asm1_statement | asm_statement | declaration );", 84, 0, self.input) + + raise nvae + + if alt84 == 1: + # C.g:518:4: labeled_statement + self.following.append(self.FOLLOW_labeled_statement_in_statement2025) + self.labeled_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 2: + # C.g:519:4: compound_statement + self.following.append(self.FOLLOW_compound_statement_in_statement2030) + self.compound_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 3: + # C.g:520:4: expression_statement + self.following.append(self.FOLLOW_expression_statement_in_statement2035) + self.expression_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 4: + # C.g:521:4: selection_statement + self.following.append(self.FOLLOW_selection_statement_in_statement2040) + self.selection_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 5: + # C.g:522:4: iteration_statement + self.following.append(self.FOLLOW_iteration_statement_in_statement2045) + self.iteration_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 6: + # C.g:523:4: jump_statement + self.following.append(self.FOLLOW_jump_statement_in_statement2050) + self.jump_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 7: + # C.g:524:4: macro_statement + self.following.append(self.FOLLOW_macro_statement_in_statement2055) + self.macro_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 8: + # C.g:525:4: asm2_statement + self.following.append(self.FOLLOW_asm2_statement_in_statement2060) + self.asm2_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 9: + # C.g:526:4: asm1_statement + self.following.append(self.FOLLOW_asm1_statement_in_statement2065) + self.asm1_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 10: + # C.g:527:4: asm_statement + self.following.append(self.FOLLOW_asm_statement_in_statement2070) + self.asm_statement() + self.following.pop() + if self.failed: + return + + + elif alt84 == 11: + # C.g:528:4: declaration + self.following.append(self.FOLLOW_declaration_in_statement2075) + self.declaration() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 60, statement_StartIndex) + + pass + + return + + # $ANTLR end statement + + + # $ANTLR start asm2_statement + # C.g:531:1: asm2_statement : ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' ; + def asm2_statement(self, ): + + asm2_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 61): + return + + # C.g:532:2: ( ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' ) + # C.g:532:4: ( '__asm__' )? IDENTIFIER '(' (~ ( ';' ) )* ')' ';' + # C.g:532:4: ( '__asm__' )? + alt85 = 2 + LA85_0 = self.input.LA(1) + + if (LA85_0 == 103) : + alt85 = 1 + if alt85 == 1: + # C.g:0:0: '__asm__' + self.match(self.input, 103, self.FOLLOW_103_in_asm2_statement2086) + if self.failed: + return + + + + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_asm2_statement2089) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_asm2_statement2091) + if self.failed: + return + # C.g:532:30: (~ ( ';' ) )* + while True: #loop86 + alt86 = 2 + LA86_0 = self.input.LA(1) + + if (LA86_0 == 63) : + LA86_1 = self.input.LA(2) + + if ((IDENTIFIER <= LA86_1 <= LINE_COMMAND) or (26 <= LA86_1 <= 117)) : + alt86 = 1 + + + elif ((IDENTIFIER <= LA86_0 <= LINE_COMMAND) or (26 <= LA86_0 <= 62) or (64 <= LA86_0 <= 117)) : + alt86 = 1 + + + if alt86 == 1: + # C.g:532:31: ~ ( ';' ) + if (IDENTIFIER <= self.input.LA(1) <= LINE_COMMAND) or (26 <= self.input.LA(1) <= 117): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_asm2_statement2094 + ) + raise mse + + + + + else: + break #loop86 + + + self.match(self.input, 63, self.FOLLOW_63_in_asm2_statement2101) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_asm2_statement2103) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 61, asm2_statement_StartIndex) + + pass + + return + + # $ANTLR end asm2_statement + + + # $ANTLR start asm1_statement + # C.g:535:1: asm1_statement : '_asm' '{' (~ ( '}' ) )* '}' ; + def asm1_statement(self, ): + + asm1_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 62): + return + + # C.g:536:2: ( '_asm' '{' (~ ( '}' ) )* '}' ) + # C.g:536:4: '_asm' '{' (~ ( '}' ) )* '}' + self.match(self.input, 104, self.FOLLOW_104_in_asm1_statement2115) + if self.failed: + return + self.match(self.input, 43, self.FOLLOW_43_in_asm1_statement2117) + if self.failed: + return + # C.g:536:15: (~ ( '}' ) )* + while True: #loop87 + alt87 = 2 + LA87_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA87_0 <= 43) or (45 <= LA87_0 <= 117)) : + alt87 = 1 + + + if alt87 == 1: + # C.g:536:16: ~ ( '}' ) + if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_asm1_statement2120 + ) + raise mse + + + + + else: + break #loop87 + + + self.match(self.input, 44, self.FOLLOW_44_in_asm1_statement2127) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 62, asm1_statement_StartIndex) + + pass + + return + + # $ANTLR end asm1_statement + + + # $ANTLR start asm_statement + # C.g:539:1: asm_statement : '__asm' '{' (~ ( '}' ) )* '}' ; + def asm_statement(self, ): + + asm_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 63): + return + + # C.g:540:2: ( '__asm' '{' (~ ( '}' ) )* '}' ) + # C.g:540:4: '__asm' '{' (~ ( '}' ) )* '}' + self.match(self.input, 105, self.FOLLOW_105_in_asm_statement2138) + if self.failed: + return + self.match(self.input, 43, self.FOLLOW_43_in_asm_statement2140) + if self.failed: + return + # C.g:540:16: (~ ( '}' ) )* + while True: #loop88 + alt88 = 2 + LA88_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA88_0 <= 43) or (45 <= LA88_0 <= 117)) : + alt88 = 1 + + + if alt88 == 1: + # C.g:540:17: ~ ( '}' ) + if (IDENTIFIER <= self.input.LA(1) <= 43) or (45 <= self.input.LA(1) <= 117): + self.input.consume(); + self.errorRecovery = False + self.failed = False + + else: + if self.backtracking > 0: + self.failed = True + return + + mse = MismatchedSetException(None, self.input) + self.recoverFromMismatchedSet( + self.input, mse, self.FOLLOW_set_in_asm_statement2143 + ) + raise mse + + + + + else: + break #loop88 + + + self.match(self.input, 44, self.FOLLOW_44_in_asm_statement2150) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 63, asm_statement_StartIndex) + + pass + + return + + # $ANTLR end asm_statement + + + # $ANTLR start macro_statement + # C.g:543:1: macro_statement : IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' ; + def macro_statement(self, ): + + macro_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 64): + return + + # C.g:544:2: ( IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' ) + # C.g:544:4: IDENTIFIER '(' ( declaration )* ( statement_list )? ( expression )? ')' + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_macro_statement2162) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_macro_statement2164) + if self.failed: + return + # C.g:544:19: ( declaration )* + while True: #loop89 + alt89 = 2 + LA89 = self.input.LA(1) + if LA89 == IDENTIFIER: + LA89 = self.input.LA(2) + if LA89 == 62: + LA89_45 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_47 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 66: + LA89_50 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_68 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_71 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_72 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_73 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_74 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_75 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_76 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_77 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_78 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_79 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_80 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_81 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_82 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_83 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_84 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_85 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_86 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 26: + LA89 = self.input.LA(2) + if LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_87 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_88 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_89 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_90 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_91 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_92 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_93 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_94 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_95 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_96 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_97 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_98 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_99 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_100 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 66: + LA89_101 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_102 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_103 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_104 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_105 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_106 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_107 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_108 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_109 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_110 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_111 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_112 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_113 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_114 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_115 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_116 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_117 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_118 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_119 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_120 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_121 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_122 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_123 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_124 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_125 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 34: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_126 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_127 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_128 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_129 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_130 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_131 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_132 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_133 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_134 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_135 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_136 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_137 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_138 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_139 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_140 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_141 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_142 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_143 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_144 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_145 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 35: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_146 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_147 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_148 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_149 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_150 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_151 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_152 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_153 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_154 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_155 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_156 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_157 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_158 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_159 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_160 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_161 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_162 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_163 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_164 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_165 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 36: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_166 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_167 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_168 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_169 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_170 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_171 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_172 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_173 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_174 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_175 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_176 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_177 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_178 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_179 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_180 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_181 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_182 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_183 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_184 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_185 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 37: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_186 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_187 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_188 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_189 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_190 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_191 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_192 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_193 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_194 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_195 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_196 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_197 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_198 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_199 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_200 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_201 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_202 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_203 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_204 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_205 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 38: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_206 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_207 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_208 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_209 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_210 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_211 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_212 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_213 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_214 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_215 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_216 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_217 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_218 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_219 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_220 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_221 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_222 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_223 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_224 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_225 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 39: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_226 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_227 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_228 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_229 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_230 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_231 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_232 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_233 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_234 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_235 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_236 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_237 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_238 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_239 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_240 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_241 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_242 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_243 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_244 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_245 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 40: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_246 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_247 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_248 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_249 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_250 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_251 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_252 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_253 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_254 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_255 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_256 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_257 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_258 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_259 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_260 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_261 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_262 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_263 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_264 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_265 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 41: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_266 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_267 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_268 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_269 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_270 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_271 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_272 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_273 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_274 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_275 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_276 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_277 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_278 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_279 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_280 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_281 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_282 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_283 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_284 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_285 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 42: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_286 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_287 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_288 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_289 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_290 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_291 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_292 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_293 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_294 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_295 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_296 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_297 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_298 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_299 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_300 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_301 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_302 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_303 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_304 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_305 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + elif LA89 == 45 or LA89 == 46: + LA89_40 = self.input.LA(2) + + if (LA89_40 == IDENTIFIER) : + LA89_306 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif (LA89_40 == 43) : + LA89_307 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + + elif LA89 == 48: + LA89_41 = self.input.LA(2) + + if (LA89_41 == 43) : + LA89_308 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif (LA89_41 == IDENTIFIER) : + LA89_309 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 58 or LA89 == 59 or LA89 == 60 or LA89 == 61: + LA89 = self.input.LA(2) + if LA89 == 66: + LA89_310 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 58: + LA89_311 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 59: + LA89_312 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 60: + LA89_313 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == IDENTIFIER: + LA89_314 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 62: + LA89_315 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 25: + LA89_316 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 29 or LA89 == 30 or LA89 == 31 or LA89 == 32 or LA89 == 33: + LA89_317 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 34: + LA89_318 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 35: + LA89_319 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 36: + LA89_320 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 37: + LA89_321 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 38: + LA89_322 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 39: + LA89_323 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 40: + LA89_324 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 41: + LA89_325 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 42: + LA89_326 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 45 or LA89 == 46: + LA89_327 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 48: + LA89_328 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + elif LA89 == 49 or LA89 == 50 or LA89 == 51 or LA89 == 52 or LA89 == 53 or LA89 == 54 or LA89 == 55 or LA89 == 56 or LA89 == 57 or LA89 == 61: + LA89_329 = self.input.LA(3) + + if (self.synpred181()) : + alt89 = 1 + + + + + if alt89 == 1: + # C.g:0:0: declaration + self.following.append(self.FOLLOW_declaration_in_macro_statement2166) + self.declaration() + self.following.pop() + if self.failed: + return + + + else: + break #loop89 + + + # C.g:544:33: ( statement_list )? + alt90 = 2 + LA90 = self.input.LA(1) + if LA90 == IDENTIFIER: + LA90 = self.input.LA(2) + if LA90 == 25 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 45 or LA90 == 46 or LA90 == 47 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61: + alt90 = 1 + elif LA90 == 62: + LA90_45 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_46 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == IDENTIFIER: + LA90_47 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 64: + LA90_48 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_49 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_50 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_51 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_52 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_53 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_54 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_55 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_56 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_57 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_58 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_59 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_60 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_61 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_62 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_63 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_64 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_65 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_66 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_67 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_70 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25 or LA90 == 26 or LA90 == 29 or LA90 == 30 or LA90 == 31 or LA90 == 32 or LA90 == 33 or LA90 == 34 or LA90 == 35 or LA90 == 36 or LA90 == 37 or LA90 == 38 or LA90 == 39 or LA90 == 40 or LA90 == 41 or LA90 == 42 or LA90 == 43 or LA90 == 45 or LA90 == 46 or LA90 == 48 or LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61 or LA90 == 103 or LA90 == 104 or LA90 == 105 or LA90 == 106 or LA90 == 107 or LA90 == 108 or LA90 == 110 or LA90 == 111 or LA90 == 112 or LA90 == 113 or LA90 == 114 or LA90 == 115 or LA90 == 116 or LA90 == 117: + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90 = self.input.LA(2) + if LA90 == 64: + LA90_87 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_88 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_89 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_90 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_91 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_92 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_93 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_94 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_95 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_96 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_97 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_98 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_99 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_100 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_101 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_102 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_103 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_104 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_105 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_106 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_107 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_108 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90 = self.input.LA(2) + if LA90 == 64: + LA90_111 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_112 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_113 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_114 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_115 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_116 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_117 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_118 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_119 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_120 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_121 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_122 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_123 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_124 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_125 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_126 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_127 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_128 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_129 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_130 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_131 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_134 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90 = self.input.LA(2) + if LA90 == 64: + LA90_135 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_136 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_137 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_138 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_139 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_140 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_141 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_142 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_143 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_144 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_145 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_146 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_147 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_148 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_149 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_150 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_151 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_152 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_153 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_154 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_155 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_156 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90 = self.input.LA(2) + if LA90 == 64: + LA90_159 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_160 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_161 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_162 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_163 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_164 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_165 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_166 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_167 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_168 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_169 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_170 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_171 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_172 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_173 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_174 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_175 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_176 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_177 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_178 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_179 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_181 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90 = self.input.LA(2) + if LA90 == IDENTIFIER: + LA90_183 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 64: + LA90_184 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_185 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_186 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_187 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_188 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_189 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_190 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_191 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_192 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_193 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_194 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_195 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_196 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_197 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_198 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_199 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_200 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_201 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_202 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_203 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_204 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_205 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_206 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90 = self.input.LA(2) + if LA90 == 64: + LA90_209 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_210 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 75: + LA90_211 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66: + LA90_212 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 76: + LA90_213 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_214 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_215 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 28 or LA90 == 80 or LA90 == 81 or LA90 == 82 or LA90 == 83 or LA90 == 84 or LA90 == 85 or LA90 == 86 or LA90 == 87 or LA90 == 88 or LA90 == 89: + LA90_216 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 70: + LA90_217 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 71: + LA90_218 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 68: + LA90_219 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 69: + LA90_220 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 101 or LA90 == 102: + LA90_221 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 97 or LA90 == 98 or LA90 == 99 or LA90 == 100: + LA90_222 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 95 or LA90 == 96: + LA90_223 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 77: + LA90_224 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 94: + LA90_225 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 93: + LA90_226 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 92: + LA90_227 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 91: + LA90_228 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 90: + LA90_229 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 27: + LA90_230 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 25: + alt90 = 1 + elif LA90 == 62: + LA90 = self.input.LA(2) + if LA90 == IDENTIFIER: + LA90_233 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90_234 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90_235 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90_236 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90_237 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_238 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90_239 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_240 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_241 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_242 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90_243 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90_244 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 49 or LA90 == 50 or LA90 == 51 or LA90 == 52 or LA90 == 53 or LA90 == 54 or LA90 == 55 or LA90 == 56 or LA90 == 57 or LA90 == 58 or LA90 == 59 or LA90 == 60 or LA90 == 61: + LA90_245 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 34: + LA90_246 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 35: + LA90_247 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 36: + LA90_248 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 37: + LA90_249 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 38: + LA90_250 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 39: + LA90_251 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 40: + LA90_252 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 41: + LA90_253 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 42: + LA90_254 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 45 or LA90 == 46: + LA90_255 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 48: + LA90_256 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90 = self.input.LA(2) + if LA90 == IDENTIFIER: + LA90_257 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90_258 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90_259 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90_260 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90_261 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_262 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90_263 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_264 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_265 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_266 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90_267 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90_268 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90 = self.input.LA(2) + if LA90 == IDENTIFIER: + LA90_269 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90_270 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90_271 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90_272 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90_273 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_274 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90_275 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 62: + LA90_276 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_277 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_278 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90_279 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90_280 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90 = self.input.LA(2) + if LA90 == 62: + LA90_281 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == IDENTIFIER: + LA90_282 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90_283 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90_284 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90_285 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90_286 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_287 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90_288 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_289 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_290 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90_291 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90_292 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90 = self.input.LA(2) + if LA90 == 62: + LA90_293 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == IDENTIFIER: + LA90_294 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == HEX_LITERAL: + LA90_295 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == OCTAL_LITERAL: + LA90_296 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == DECIMAL_LITERAL: + LA90_297 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == CHARACTER_LITERAL: + LA90_298 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == STRING_LITERAL: + LA90_299 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == FLOATING_POINT_LITERAL: + LA90_300 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 72: + LA90_301 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 73: + LA90_302 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 66 or LA90 == 68 or LA90 == 69 or LA90 == 77 or LA90 == 78 or LA90 == 79: + LA90_303 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + elif LA90 == 74: + LA90_304 = self.input.LA(3) + + if (self.synpred182()) : + alt90 = 1 + if alt90 == 1: + # C.g:0:0: statement_list + self.following.append(self.FOLLOW_statement_list_in_macro_statement2170) + self.statement_list() + self.following.pop() + if self.failed: + return + + + + # C.g:544:49: ( expression )? + alt91 = 2 + LA91_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA91_0 <= FLOATING_POINT_LITERAL) or LA91_0 == 62 or LA91_0 == 66 or (68 <= LA91_0 <= 69) or (72 <= LA91_0 <= 74) or (77 <= LA91_0 <= 79)) : + alt91 = 1 + if alt91 == 1: + # C.g:0:0: expression + self.following.append(self.FOLLOW_expression_in_macro_statement2173) + self.expression() + self.following.pop() + if self.failed: + return + + + + self.match(self.input, 63, self.FOLLOW_63_in_macro_statement2176) + if self.failed: + return + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 64, macro_statement_StartIndex) + + pass + + return + + # $ANTLR end macro_statement + + + # $ANTLR start labeled_statement + # C.g:547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement ); + def labeled_statement(self, ): + + labeled_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 65): + return + + # C.g:548:2: ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement ) + alt92 = 3 + LA92 = self.input.LA(1) + if LA92 == IDENTIFIER: + alt92 = 1 + elif LA92 == 106: + alt92 = 2 + elif LA92 == 107: + alt92 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("547:1: labeled_statement : ( IDENTIFIER ':' statement | 'case' constant_expression ':' statement | 'default' ':' statement );", 92, 0, self.input) + + raise nvae + + if alt92 == 1: + # C.g:548:4: IDENTIFIER ':' statement + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_labeled_statement2188) + if self.failed: + return + self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2190) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_labeled_statement2192) + self.statement() + self.following.pop() + if self.failed: + return + + + elif alt92 == 2: + # C.g:549:4: 'case' constant_expression ':' statement + self.match(self.input, 106, self.FOLLOW_106_in_labeled_statement2197) + if self.failed: + return + self.following.append(self.FOLLOW_constant_expression_in_labeled_statement2199) + self.constant_expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2201) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_labeled_statement2203) + self.statement() + self.following.pop() + if self.failed: + return + + + elif alt92 == 3: + # C.g:550:4: 'default' ':' statement + self.match(self.input, 107, self.FOLLOW_107_in_labeled_statement2208) + if self.failed: + return + self.match(self.input, 47, self.FOLLOW_47_in_labeled_statement2210) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_labeled_statement2212) + self.statement() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 65, labeled_statement_StartIndex) + + pass + + return + + # $ANTLR end labeled_statement + + class compound_statement_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start compound_statement + # C.g:553:1: compound_statement : '{' ( declaration )* ( statement_list )? '}' ; + def compound_statement(self, ): + + retval = self.compound_statement_return() + retval.start = self.input.LT(1) + compound_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 66): + return retval + + # C.g:554:2: ( '{' ( declaration )* ( statement_list )? '}' ) + # C.g:554:4: '{' ( declaration )* ( statement_list )? '}' + self.match(self.input, 43, self.FOLLOW_43_in_compound_statement2223) + if self.failed: + return retval + # C.g:554:8: ( declaration )* + while True: #loop93 + alt93 = 2 + LA93 = self.input.LA(1) + if LA93 == IDENTIFIER: + LA93 = self.input.LA(2) + if LA93 == 62: + LA93_44 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_47 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 66: + LA93_48 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_49 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_50 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_51 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_52 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_53 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_54 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_55 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_56 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_57 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_58 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_59 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_60 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_61 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_62 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_63 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_64 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_65 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 26: + LA93 = self.input.LA(2) + if LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_86 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_87 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_88 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_89 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_90 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_91 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_92 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_93 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_94 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_95 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_96 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_97 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_98 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_99 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 66: + LA93_100 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_101 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_102 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_103 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_104 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_105 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_106 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_107 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_108 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_109 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_110 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_111 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_112 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_113 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_114 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_115 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_116 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_117 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_118 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_119 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_120 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_121 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_122 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_123 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_124 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 34: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_125 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_126 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_127 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_128 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_129 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_130 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_131 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_132 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_133 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_134 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_135 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_136 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_137 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_138 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_139 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_140 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_141 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_142 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_143 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_144 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 35: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_145 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_146 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_147 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_148 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_149 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_150 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_151 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_152 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_153 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_154 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_155 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_156 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_157 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_158 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_159 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_160 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_161 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_162 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_163 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_164 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 36: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_165 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_166 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_167 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_168 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_169 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_170 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_171 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_172 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_173 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_174 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_175 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_176 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_177 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_178 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_179 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_180 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_181 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_182 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_183 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_184 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 37: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_185 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_186 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_187 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_188 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_189 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_190 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_191 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_192 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_193 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_194 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_195 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_196 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_197 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_198 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_199 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_200 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_201 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_202 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_203 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_204 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 38: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_205 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_206 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_207 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_208 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_209 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_210 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_211 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_212 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_213 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_214 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_215 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_216 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_217 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_218 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_219 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_220 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_221 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_222 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_223 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_224 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 39: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_225 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_226 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_227 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_228 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_229 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_230 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_231 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_232 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_233 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_234 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_235 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_236 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_237 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_238 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_239 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_240 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_241 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_242 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_243 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_244 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 40: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_245 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_246 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_247 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_248 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_249 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_250 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_251 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_252 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_253 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_254 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_255 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_256 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_257 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_258 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_259 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_260 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_261 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_262 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_263 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_264 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 41: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_265 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_266 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_267 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_268 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_269 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_270 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_271 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_272 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_273 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_274 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_275 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_276 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_277 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_278 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_279 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_280 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_281 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_282 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_283 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_284 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 42: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_285 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_286 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_287 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_288 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_289 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_290 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_291 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_292 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_293 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_294 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_295 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_296 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_297 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_298 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_299 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_300 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_301 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_302 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_303 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_304 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + elif LA93 == 45 or LA93 == 46: + LA93_40 = self.input.LA(2) + + if (LA93_40 == IDENTIFIER) : + LA93_305 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif (LA93_40 == 43) : + LA93_306 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + + elif LA93 == 48: + LA93_41 = self.input.LA(2) + + if (LA93_41 == 43) : + LA93_307 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif (LA93_41 == IDENTIFIER) : + LA93_308 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 58 or LA93 == 59 or LA93 == 60 or LA93 == 61: + LA93 = self.input.LA(2) + if LA93 == 66: + LA93_309 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 58: + LA93_310 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 59: + LA93_311 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 60: + LA93_312 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == IDENTIFIER: + LA93_313 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 62: + LA93_314 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 25: + LA93_315 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 29 or LA93 == 30 or LA93 == 31 or LA93 == 32 or LA93 == 33: + LA93_316 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 34: + LA93_317 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 35: + LA93_318 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 36: + LA93_319 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 37: + LA93_320 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 38: + LA93_321 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 39: + LA93_322 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 40: + LA93_323 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 41: + LA93_324 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 42: + LA93_325 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 45 or LA93 == 46: + LA93_326 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 48: + LA93_327 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + elif LA93 == 49 or LA93 == 50 or LA93 == 51 or LA93 == 52 or LA93 == 53 or LA93 == 54 or LA93 == 55 or LA93 == 56 or LA93 == 57 or LA93 == 61: + LA93_328 = self.input.LA(3) + + if (self.synpred186()) : + alt93 = 1 + + + + + if alt93 == 1: + # C.g:0:0: declaration + self.following.append(self.FOLLOW_declaration_in_compound_statement2225) + self.declaration() + self.following.pop() + if self.failed: + return retval + + + else: + break #loop93 + + + # C.g:554:21: ( statement_list )? + alt94 = 2 + LA94_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA94_0 <= FLOATING_POINT_LITERAL) or (25 <= LA94_0 <= 26) or (29 <= LA94_0 <= 43) or (45 <= LA94_0 <= 46) or (48 <= LA94_0 <= 62) or LA94_0 == 66 or (68 <= LA94_0 <= 69) or (72 <= LA94_0 <= 74) or (77 <= LA94_0 <= 79) or (103 <= LA94_0 <= 108) or (110 <= LA94_0 <= 117)) : + alt94 = 1 + if alt94 == 1: + # C.g:0:0: statement_list + self.following.append(self.FOLLOW_statement_list_in_compound_statement2228) + self.statement_list() + self.following.pop() + if self.failed: + return retval + + + + self.match(self.input, 44, self.FOLLOW_44_in_compound_statement2231) + if self.failed: + return retval + + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 66, compound_statement_StartIndex) + + pass + + return retval + + # $ANTLR end compound_statement + + + # $ANTLR start statement_list + # C.g:557:1: statement_list : ( statement )+ ; + def statement_list(self, ): + + statement_list_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 67): + return + + # C.g:558:2: ( ( statement )+ ) + # C.g:558:4: ( statement )+ + # C.g:558:4: ( statement )+ + cnt95 = 0 + while True: #loop95 + alt95 = 2 + LA95 = self.input.LA(1) + if LA95 == IDENTIFIER: + LA95 = self.input.LA(2) + if LA95 == 62: + LA95_46 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 45 or LA95 == 46 or LA95 == 47 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61: + alt95 = 1 + elif LA95 == STRING_LITERAL: + LA95_48 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == IDENTIFIER: + LA95_49 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 64: + LA95_50 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_51 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_52 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_53 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_54 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_55 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_56 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_57 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_58 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_59 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_60 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_61 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_62 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_63 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_64 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_65 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_66 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_67 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_68 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_69 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_88 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == HEX_LITERAL: + LA95 = self.input.LA(2) + if LA95 == 64: + LA95_89 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_90 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_91 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_92 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_93 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_94 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_95 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_96 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_97 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_98 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_99 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_100 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_101 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_102 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_103 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_104 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_105 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_106 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_107 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_108 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_109 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_110 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + + elif LA95 == OCTAL_LITERAL: + LA95 = self.input.LA(2) + if LA95 == 64: + LA95_113 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_114 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_115 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_116 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_117 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_118 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_119 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_120 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_121 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_122 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_123 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_124 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_125 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_126 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_127 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_128 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_129 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_130 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_131 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_132 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_133 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_135 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + + elif LA95 == DECIMAL_LITERAL: + LA95 = self.input.LA(2) + if LA95 == 64: + LA95_137 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_138 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_139 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_140 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_141 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_142 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_143 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_144 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_145 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_146 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_147 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_148 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_149 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_150 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_151 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_152 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_153 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_154 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_155 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_156 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_157 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_158 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + + elif LA95 == CHARACTER_LITERAL: + LA95 = self.input.LA(2) + if LA95 == 64: + LA95_161 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_162 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_163 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_164 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_165 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_166 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_167 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_168 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_169 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_170 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_171 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_172 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_173 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_174 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_175 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_176 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_177 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_178 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_179 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_180 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_181 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_182 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + + elif LA95 == STRING_LITERAL: + LA95 = self.input.LA(2) + if LA95 == IDENTIFIER: + LA95_185 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 64: + LA95_186 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_187 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_188 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_189 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_190 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_191 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_192 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_193 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_194 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_195 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_196 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_197 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_198 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_199 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_200 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_201 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_202 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_203 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_204 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_205 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_206 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + elif LA95 == STRING_LITERAL: + LA95_208 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_209 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95 = self.input.LA(2) + if LA95 == 64: + LA95_211 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_212 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 75: + LA95_213 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66: + LA95_214 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 76: + LA95_215 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_216 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_217 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 70: + LA95_218 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 71: + LA95_219 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 68: + LA95_220 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 69: + LA95_221 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 101 or LA95 == 102: + LA95_222 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 97 or LA95 == 98 or LA95 == 99 or LA95 == 100: + LA95_223 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 95 or LA95 == 96: + LA95_224 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 77: + LA95_225 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 94: + LA95_226 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 93: + LA95_227 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 92: + LA95_228 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 91: + LA95_229 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 90: + LA95_230 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 27: + LA95_231 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 25: + alt95 = 1 + elif LA95 == 28 or LA95 == 80 or LA95 == 81 or LA95 == 82 or LA95 == 83 or LA95 == 84 or LA95 == 85 or LA95 == 86 or LA95 == 87 or LA95 == 88 or LA95 == 89: + LA95_234 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 62: + LA95 = self.input.LA(2) + if LA95 == IDENTIFIER: + LA95_235 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == HEX_LITERAL: + LA95_236 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == OCTAL_LITERAL: + LA95_237 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == DECIMAL_LITERAL: + LA95_238 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == CHARACTER_LITERAL: + LA95_239 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == STRING_LITERAL: + LA95_240 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95_241 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_242 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_243 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_244 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95_245 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 74: + LA95_246 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61: + LA95_247 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 34: + LA95_248 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 35: + LA95_249 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 36: + LA95_250 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 37: + LA95_251 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 38: + LA95_252 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 39: + LA95_253 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 40: + LA95_254 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 41: + LA95_255 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 42: + LA95_256 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 45 or LA95 == 46: + LA95_257 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 48: + LA95_258 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 72: + LA95 = self.input.LA(2) + if LA95 == IDENTIFIER: + LA95_259 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == HEX_LITERAL: + LA95_260 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == OCTAL_LITERAL: + LA95_261 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == DECIMAL_LITERAL: + LA95_262 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == CHARACTER_LITERAL: + LA95_263 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == STRING_LITERAL: + LA95_264 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95_265 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_266 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_267 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_268 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95_269 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 74: + LA95_270 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 73: + LA95 = self.input.LA(2) + if LA95 == IDENTIFIER: + LA95_271 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == HEX_LITERAL: + LA95_272 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == OCTAL_LITERAL: + LA95_273 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == DECIMAL_LITERAL: + LA95_274 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == CHARACTER_LITERAL: + LA95_275 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == STRING_LITERAL: + LA95_276 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95_277 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 62: + LA95_278 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_279 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_280 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95_281 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 74: + LA95_282 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95 = self.input.LA(2) + if LA95 == 62: + LA95_283 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == IDENTIFIER: + LA95_284 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == HEX_LITERAL: + LA95_285 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == OCTAL_LITERAL: + LA95_286 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == DECIMAL_LITERAL: + LA95_287 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == CHARACTER_LITERAL: + LA95_288 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == STRING_LITERAL: + LA95_289 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95_290 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_291 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_292 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95_293 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 74: + LA95_294 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 74: + LA95 = self.input.LA(2) + if LA95 == 62: + LA95_295 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == IDENTIFIER: + LA95_296 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == HEX_LITERAL: + LA95_297 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == OCTAL_LITERAL: + LA95_298 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == DECIMAL_LITERAL: + LA95_299 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == CHARACTER_LITERAL: + LA95_300 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == STRING_LITERAL: + LA95_301 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == FLOATING_POINT_LITERAL: + LA95_302 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 72: + LA95_303 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 73: + LA95_304 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 66 or LA95 == 68 or LA95 == 69 or LA95 == 77 or LA95 == 78 or LA95 == 79: + LA95_305 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + elif LA95 == 74: + LA95_306 = self.input.LA(3) + + if (self.synpred188()) : + alt95 = 1 + + + + elif LA95 == 25 or LA95 == 26 or LA95 == 29 or LA95 == 30 or LA95 == 31 or LA95 == 32 or LA95 == 33 or LA95 == 34 or LA95 == 35 or LA95 == 36 or LA95 == 37 or LA95 == 38 or LA95 == 39 or LA95 == 40 or LA95 == 41 or LA95 == 42 or LA95 == 43 or LA95 == 45 or LA95 == 46 or LA95 == 48 or LA95 == 49 or LA95 == 50 or LA95 == 51 or LA95 == 52 or LA95 == 53 or LA95 == 54 or LA95 == 55 or LA95 == 56 or LA95 == 57 or LA95 == 58 or LA95 == 59 or LA95 == 60 or LA95 == 61 or LA95 == 103 or LA95 == 104 or LA95 == 105 or LA95 == 106 or LA95 == 107 or LA95 == 108 or LA95 == 110 or LA95 == 111 or LA95 == 112 or LA95 == 113 or LA95 == 114 or LA95 == 115 or LA95 == 116 or LA95 == 117: + alt95 = 1 + + if alt95 == 1: + # C.g:0:0: statement + self.following.append(self.FOLLOW_statement_in_statement_list2242) + self.statement() + self.following.pop() + if self.failed: + return + + + else: + if cnt95 >= 1: + break #loop95 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(95, self.input) + raise eee + + cnt95 += 1 + + + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 67, statement_list_StartIndex) + + pass + + return + + # $ANTLR end statement_list + + class expression_statement_return(object): + def __init__(self): + self.start = None + self.stop = None + + + + # $ANTLR start expression_statement + # C.g:561:1: expression_statement : ( ';' | expression ';' ); + def expression_statement(self, ): + + retval = self.expression_statement_return() + retval.start = self.input.LT(1) + expression_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 68): + return retval + + # C.g:562:2: ( ';' | expression ';' ) + alt96 = 2 + LA96_0 = self.input.LA(1) + + if (LA96_0 == 25) : + alt96 = 1 + elif ((IDENTIFIER <= LA96_0 <= FLOATING_POINT_LITERAL) or LA96_0 == 62 or LA96_0 == 66 or (68 <= LA96_0 <= 69) or (72 <= LA96_0 <= 74) or (77 <= LA96_0 <= 79)) : + alt96 = 2 + else: + if self.backtracking > 0: + self.failed = True + return retval + + nvae = NoViableAltException("561:1: expression_statement : ( ';' | expression ';' );", 96, 0, self.input) + + raise nvae + + if alt96 == 1: + # C.g:562:4: ';' + self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2254) + if self.failed: + return retval + + + elif alt96 == 2: + # C.g:563:4: expression ';' + self.following.append(self.FOLLOW_expression_in_expression_statement2259) + self.expression() + self.following.pop() + if self.failed: + return retval + self.match(self.input, 25, self.FOLLOW_25_in_expression_statement2261) + if self.failed: + return retval + + + retval.stop = self.input.LT(-1) + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 68, expression_statement_StartIndex) + + pass + + return retval + + # $ANTLR end expression_statement + + + # $ANTLR start selection_statement + # C.g:566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement ); + def selection_statement(self, ): + + selection_statement_StartIndex = self.input.index() + e = None + + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 69): + return + + # C.g:567:2: ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement ) + alt98 = 2 + LA98_0 = self.input.LA(1) + + if (LA98_0 == 108) : + alt98 = 1 + elif (LA98_0 == 110) : + alt98 = 2 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("566:1: selection_statement : ( 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? | 'switch' '(' expression ')' statement );", 98, 0, self.input) + + raise nvae + + if alt98 == 1: + # C.g:567:4: 'if' '(' e= expression ')' statement ( options {k=1; backtrack=false; } : 'else' statement )? + self.match(self.input, 108, self.FOLLOW_108_in_selection_statement2272) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2274) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_selection_statement2278) + e = self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2280) + if self.failed: + return + if self.backtracking == 0: + self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + self.following.append(self.FOLLOW_statement_in_selection_statement2284) + self.statement() + self.following.pop() + if self.failed: + return + # C.g:567:167: ( options {k=1; backtrack=false; } : 'else' statement )? + alt97 = 2 + LA97_0 = self.input.LA(1) + + if (LA97_0 == 109) : + alt97 = 1 + if alt97 == 1: + # C.g:567:200: 'else' statement + self.match(self.input, 109, self.FOLLOW_109_in_selection_statement2299) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_selection_statement2301) + self.statement() + self.following.pop() + if self.failed: + return + + + + + + elif alt98 == 2: + # C.g:568:4: 'switch' '(' expression ')' statement + self.match(self.input, 110, self.FOLLOW_110_in_selection_statement2308) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_selection_statement2310) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_selection_statement2312) + self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_selection_statement2314) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_selection_statement2316) + self.statement() + self.following.pop() + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 69, selection_statement_StartIndex) + + pass + + return + + # $ANTLR end selection_statement + + + # $ANTLR start iteration_statement + # C.g:571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement ); + def iteration_statement(self, ): + + iteration_statement_StartIndex = self.input.index() + e = None + + + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 70): + return + + # C.g:572:2: ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement ) + alt100 = 3 + LA100 = self.input.LA(1) + if LA100 == 111: + alt100 = 1 + elif LA100 == 112: + alt100 = 2 + elif LA100 == 113: + alt100 = 3 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("571:1: iteration_statement : ( 'while' '(' e= expression ')' statement | 'do' statement 'while' '(' e= expression ')' ';' | 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement );", 100, 0, self.input) + + raise nvae + + if alt100 == 1: + # C.g:572:4: 'while' '(' e= expression ')' statement + self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2327) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2329) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_iteration_statement2333) + e = self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2335) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_iteration_statement2337) + self.statement() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + + + elif alt100 == 2: + # C.g:573:4: 'do' statement 'while' '(' e= expression ')' ';' + self.match(self.input, 112, self.FOLLOW_112_in_iteration_statement2344) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_iteration_statement2346) + self.statement() + self.following.pop() + if self.failed: + return + self.match(self.input, 111, self.FOLLOW_111_in_iteration_statement2348) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2350) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_iteration_statement2354) + e = self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2356) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_iteration_statement2358) + if self.failed: + return + if self.backtracking == 0: + self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + + + elif alt100 == 3: + # C.g:574:4: 'for' '(' expression_statement e= expression_statement ( expression )? ')' statement + self.match(self.input, 113, self.FOLLOW_113_in_iteration_statement2365) + if self.failed: + return + self.match(self.input, 62, self.FOLLOW_62_in_iteration_statement2367) + if self.failed: + return + self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2369) + self.expression_statement() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_expression_statement_in_iteration_statement2373) + e = self.expression_statement() + self.following.pop() + if self.failed: + return + # C.g:574:58: ( expression )? + alt99 = 2 + LA99_0 = self.input.LA(1) + + if ((IDENTIFIER <= LA99_0 <= FLOATING_POINT_LITERAL) or LA99_0 == 62 or LA99_0 == 66 or (68 <= LA99_0 <= 69) or (72 <= LA99_0 <= 74) or (77 <= LA99_0 <= 79)) : + alt99 = 1 + if alt99 == 1: + # C.g:0:0: expression + self.following.append(self.FOLLOW_expression_in_iteration_statement2375) + self.expression() + self.following.pop() + if self.failed: + return + + + + self.match(self.input, 63, self.FOLLOW_63_in_iteration_statement2378) + if self.failed: + return + self.following.append(self.FOLLOW_statement_in_iteration_statement2380) + self.statement() + self.following.pop() + if self.failed: + return + if self.backtracking == 0: + self.StorePredicateExpression(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop)) + + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 70, iteration_statement_StartIndex) + + pass + + return + + # $ANTLR end iteration_statement + + + # $ANTLR start jump_statement + # C.g:577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' ); + def jump_statement(self, ): + + jump_statement_StartIndex = self.input.index() + try: + try: + if self.backtracking > 0 and self.alreadyParsedRule(self.input, 71): + return + + # C.g:578:2: ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' ) + alt101 = 5 + LA101 = self.input.LA(1) + if LA101 == 114: + alt101 = 1 + elif LA101 == 115: + alt101 = 2 + elif LA101 == 116: + alt101 = 3 + elif LA101 == 117: + LA101_4 = self.input.LA(2) + + if (LA101_4 == 25) : + alt101 = 4 + elif ((IDENTIFIER <= LA101_4 <= FLOATING_POINT_LITERAL) or LA101_4 == 62 or LA101_4 == 66 or (68 <= LA101_4 <= 69) or (72 <= LA101_4 <= 74) or (77 <= LA101_4 <= 79)) : + alt101 = 5 + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 4, self.input) + + raise nvae + + else: + if self.backtracking > 0: + self.failed = True + return + + nvae = NoViableAltException("577:1: jump_statement : ( 'goto' IDENTIFIER ';' | 'continue' ';' | 'break' ';' | 'return' ';' | 'return' expression ';' );", 101, 0, self.input) + + raise nvae + + if alt101 == 1: + # C.g:578:4: 'goto' IDENTIFIER ';' + self.match(self.input, 114, self.FOLLOW_114_in_jump_statement2393) + if self.failed: + return + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_jump_statement2395) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2397) + if self.failed: + return + + + elif alt101 == 2: + # C.g:579:4: 'continue' ';' + self.match(self.input, 115, self.FOLLOW_115_in_jump_statement2402) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2404) + if self.failed: + return + + + elif alt101 == 3: + # C.g:580:4: 'break' ';' + self.match(self.input, 116, self.FOLLOW_116_in_jump_statement2409) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2411) + if self.failed: + return + + + elif alt101 == 4: + # C.g:581:4: 'return' ';' + self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2416) + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2418) + if self.failed: + return + + + elif alt101 == 5: + # C.g:582:4: 'return' expression ';' + self.match(self.input, 117, self.FOLLOW_117_in_jump_statement2423) + if self.failed: + return + self.following.append(self.FOLLOW_expression_in_jump_statement2425) + self.expression() + self.following.pop() + if self.failed: + return + self.match(self.input, 25, self.FOLLOW_25_in_jump_statement2427) + if self.failed: + return + + + + except RecognitionException, re: + self.reportError(re) + self.recover(self.input, re) + finally: + if self.backtracking > 0: + self.memoize(self.input, 71, jump_statement_StartIndex) + + pass + + return + + # $ANTLR end jump_statement + + # $ANTLR start synpred2 + def synpred2_fragment(self, ): + # C.g:119:6: ( declaration_specifiers ) + # C.g:119:6: declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_synpred2100) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred2 + + + + # $ANTLR start synpred4 + def synpred4_fragment(self, ): + # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' ) + # C.g:119:6: ( declaration_specifiers )? declarator ( declaration )* '{' + # C.g:119:6: ( declaration_specifiers )? + alt102 = 2 + LA102 = self.input.LA(1) + if LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33 or LA102 == 34 or LA102 == 35 or LA102 == 36 or LA102 == 37 or LA102 == 38 or LA102 == 39 or LA102 == 40 or LA102 == 41 or LA102 == 42 or LA102 == 45 or LA102 == 46 or LA102 == 48 or LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61: + alt102 = 1 + elif LA102 == IDENTIFIER: + LA102 = self.input.LA(2) + if LA102 == 62: + LA102_21 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 29 or LA102 == 30 or LA102 == 31 or LA102 == 32 or LA102 == 33: + LA102_23 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 34: + LA102_24 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 35: + LA102_25 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 36: + LA102_26 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 37: + LA102_27 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 38: + LA102_28 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 39: + LA102_29 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 40: + LA102_30 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 41: + LA102_31 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 42: + LA102_32 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 45 or LA102 == 46: + LA102_33 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 48: + LA102_34 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == IDENTIFIER: + LA102_35 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 58: + LA102_36 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 66: + alt102 = 1 + elif LA102 == 59: + LA102_39 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 60: + LA102_40 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 49 or LA102 == 50 or LA102 == 51 or LA102 == 52 or LA102 == 53 or LA102 == 54 or LA102 == 55 or LA102 == 56 or LA102 == 57 or LA102 == 61: + LA102_41 = self.input.LA(3) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 58: + LA102_14 = self.input.LA(2) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 59: + LA102_16 = self.input.LA(2) + + if (self.synpred2()) : + alt102 = 1 + elif LA102 == 60: + LA102_17 = self.input.LA(2) + + if (self.synpred2()) : + alt102 = 1 + if alt102 == 1: + # C.g:0:0: declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_synpred4100) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + + + + self.following.append(self.FOLLOW_declarator_in_synpred4103) + self.declarator() + self.following.pop() + if self.failed: + return + # C.g:119:41: ( declaration )* + while True: #loop103 + alt103 = 2 + LA103_0 = self.input.LA(1) + + if (LA103_0 == IDENTIFIER or LA103_0 == 26 or (29 <= LA103_0 <= 42) or (45 <= LA103_0 <= 46) or (48 <= LA103_0 <= 61)) : + alt103 = 1 + + + if alt103 == 1: + # C.g:0:0: declaration + self.following.append(self.FOLLOW_declaration_in_synpred4105) + self.declaration() + self.following.pop() + if self.failed: + return + + + else: + break #loop103 + + + self.match(self.input, 43, self.FOLLOW_43_in_synpred4108) + if self.failed: + return + + + # $ANTLR end synpred4 + + + + # $ANTLR start synpred5 + def synpred5_fragment(self, ): + # C.g:120:4: ( declaration ) + # C.g:120:4: declaration + self.following.append(self.FOLLOW_declaration_in_synpred5118) + self.declaration() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred5 + + + + # $ANTLR start synpred7 + def synpred7_fragment(self, ): + # C.g:146:6: ( declaration_specifiers ) + # C.g:146:6: declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_synpred7157) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred7 + + + + # $ANTLR start synpred10 + def synpred10_fragment(self, ): + # C.g:167:18: ( declaration_specifiers ) + # C.g:167:18: declaration_specifiers + self.following.append(self.FOLLOW_declaration_specifiers_in_synpred10207) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred10 + + + + # $ANTLR start synpred14 + def synpred14_fragment(self, ): + # C.g:184:7: ( type_specifier ) + # C.g:184:7: type_specifier + self.following.append(self.FOLLOW_type_specifier_in_synpred14272) + self.type_specifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred14 + + + + # $ANTLR start synpred15 + def synpred15_fragment(self, ): + # C.g:185:13: ( type_qualifier ) + # C.g:185:13: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred15286) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred15 + + + + # $ANTLR start synpred33 + def synpred33_fragment(self, ): + # C.g:225:16: ( type_qualifier ) + # C.g:225:16: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred33444) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred33 + + + + # $ANTLR start synpred34 + def synpred34_fragment(self, ): + # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator ) + # C.g:225:5: IDENTIFIER ( type_qualifier )* declarator + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred34442) + if self.failed: + return + # C.g:225:16: ( type_qualifier )* + while True: #loop106 + alt106 = 2 + LA106 = self.input.LA(1) + if LA106 == 58: + LA106_2 = self.input.LA(2) + + if (self.synpred33()) : + alt106 = 1 + + + elif LA106 == 59: + LA106_3 = self.input.LA(2) + + if (self.synpred33()) : + alt106 = 1 + + + elif LA106 == 60: + LA106_4 = self.input.LA(2) + + if (self.synpred33()) : + alt106 = 1 + + + elif LA106 == 49 or LA106 == 50 or LA106 == 51 or LA106 == 52 or LA106 == 53 or LA106 == 54 or LA106 == 55 or LA106 == 56 or LA106 == 57 or LA106 == 61: + alt106 = 1 + + if alt106 == 1: + # C.g:0:0: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred34444) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + else: + break #loop106 + + + self.following.append(self.FOLLOW_declarator_in_synpred34447) + self.declarator() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred34 + + + + # $ANTLR start synpred39 + def synpred39_fragment(self, ): + # C.g:253:6: ( type_qualifier ) + # C.g:253:6: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred39566) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred39 + + + + # $ANTLR start synpred40 + def synpred40_fragment(self, ): + # C.g:253:23: ( type_specifier ) + # C.g:253:23: type_specifier + self.following.append(self.FOLLOW_type_specifier_in_synpred40570) + self.type_specifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred40 + + + + # $ANTLR start synpred66 + def synpred66_fragment(self, ): + # C.g:297:4: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator ) + # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator + # C.g:297:4: ( pointer )? + alt111 = 2 + LA111_0 = self.input.LA(1) + + if (LA111_0 == 66) : + alt111 = 1 + if alt111 == 1: + # C.g:0:0: pointer + self.following.append(self.FOLLOW_pointer_in_synpred66784) + self.pointer() + self.following.pop() + if self.failed: + return + + + + # C.g:297:13: ( 'EFIAPI' )? + alt112 = 2 + LA112_0 = self.input.LA(1) + + if (LA112_0 == 58) : + alt112 = 1 + if alt112 == 1: + # C.g:297:14: 'EFIAPI' + self.match(self.input, 58, self.FOLLOW_58_in_synpred66788) + if self.failed: + return + + + + # C.g:297:25: ( 'EFI_BOOTSERVICE' )? + alt113 = 2 + LA113_0 = self.input.LA(1) + + if (LA113_0 == 59) : + alt113 = 1 + if alt113 == 1: + # C.g:297:26: 'EFI_BOOTSERVICE' + self.match(self.input, 59, self.FOLLOW_59_in_synpred66793) + if self.failed: + return + + + + # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )? + alt114 = 2 + LA114_0 = self.input.LA(1) + + if (LA114_0 == 60) : + alt114 = 1 + if alt114 == 1: + # C.g:297:47: 'EFI_RUNTIMESERVICE' + self.match(self.input, 60, self.FOLLOW_60_in_synpred66798) + if self.failed: + return + + + + self.following.append(self.FOLLOW_direct_declarator_in_synpred66802) + self.direct_declarator() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred66 + + + + # $ANTLR start synpred67 + def synpred67_fragment(self, ): + # C.g:303:15: ( declarator_suffix ) + # C.g:303:15: declarator_suffix + self.following.append(self.FOLLOW_declarator_suffix_in_synpred67821) + self.declarator_suffix() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred67 + + + + # $ANTLR start synpred69 + def synpred69_fragment(self, ): + # C.g:304:9: ( 'EFIAPI' ) + # C.g:304:9: 'EFIAPI' + self.match(self.input, 58, self.FOLLOW_58_in_synpred69830) + if self.failed: + return + + + # $ANTLR end synpred69 + + + + # $ANTLR start synpred70 + def synpred70_fragment(self, ): + # C.g:304:35: ( declarator_suffix ) + # C.g:304:35: declarator_suffix + self.following.append(self.FOLLOW_declarator_suffix_in_synpred70838) + self.declarator_suffix() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred70 + + + + # $ANTLR start synpred73 + def synpred73_fragment(self, ): + # C.g:310:9: ( '(' parameter_type_list ')' ) + # C.g:310:9: '(' parameter_type_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_synpred73878) + if self.failed: + return + self.following.append(self.FOLLOW_parameter_type_list_in_synpred73880) + self.parameter_type_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred73882) + if self.failed: + return + + + # $ANTLR end synpred73 + + + + # $ANTLR start synpred74 + def synpred74_fragment(self, ): + # C.g:311:9: ( '(' identifier_list ')' ) + # C.g:311:9: '(' identifier_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_synpred74892) + if self.failed: + return + self.following.append(self.FOLLOW_identifier_list_in_synpred74894) + self.identifier_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred74896) + if self.failed: + return + + + # $ANTLR end synpred74 + + + + # $ANTLR start synpred75 + def synpred75_fragment(self, ): + # C.g:316:8: ( type_qualifier ) + # C.g:316:8: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred75921) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred75 + + + + # $ANTLR start synpred76 + def synpred76_fragment(self, ): + # C.g:316:24: ( pointer ) + # C.g:316:24: pointer + self.following.append(self.FOLLOW_pointer_in_synpred76924) + self.pointer() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred76 + + + + # $ANTLR start synpred77 + def synpred77_fragment(self, ): + # C.g:316:4: ( '*' ( type_qualifier )+ ( pointer )? ) + # C.g:316:4: '*' ( type_qualifier )+ ( pointer )? + self.match(self.input, 66, self.FOLLOW_66_in_synpred77919) + if self.failed: + return + # C.g:316:8: ( type_qualifier )+ + cnt116 = 0 + while True: #loop116 + alt116 = 2 + LA116_0 = self.input.LA(1) + + if ((49 <= LA116_0 <= 61)) : + alt116 = 1 + + + if alt116 == 1: + # C.g:0:0: type_qualifier + self.following.append(self.FOLLOW_type_qualifier_in_synpred77921) + self.type_qualifier() + self.following.pop() + if self.failed: + return + + + else: + if cnt116 >= 1: + break #loop116 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(116, self.input) + raise eee + + cnt116 += 1 + + + # C.g:316:24: ( pointer )? + alt117 = 2 + LA117_0 = self.input.LA(1) + + if (LA117_0 == 66) : + alt117 = 1 + if alt117 == 1: + # C.g:0:0: pointer + self.following.append(self.FOLLOW_pointer_in_synpred77924) + self.pointer() + self.following.pop() + if self.failed: + return + + + + + + # $ANTLR end synpred77 + + + + # $ANTLR start synpred78 + def synpred78_fragment(self, ): + # C.g:317:4: ( '*' pointer ) + # C.g:317:4: '*' pointer + self.match(self.input, 66, self.FOLLOW_66_in_synpred78930) + if self.failed: + return + self.following.append(self.FOLLOW_pointer_in_synpred78932) + self.pointer() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred78 + + + + # $ANTLR start synpred81 + def synpred81_fragment(self, ): + # C.g:326:32: ( 'OPTIONAL' ) + # C.g:326:32: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_synpred81977) + if self.failed: + return + + + # $ANTLR end synpred81 + + + + # $ANTLR start synpred82 + def synpred82_fragment(self, ): + # C.g:326:27: ( ',' ( 'OPTIONAL' )? parameter_declaration ) + # C.g:326:27: ',' ( 'OPTIONAL' )? parameter_declaration + self.match(self.input, 27, self.FOLLOW_27_in_synpred82974) + if self.failed: + return + # C.g:326:31: ( 'OPTIONAL' )? + alt119 = 2 + LA119_0 = self.input.LA(1) + + if (LA119_0 == 53) : + LA119_1 = self.input.LA(2) + + if (self.synpred81()) : + alt119 = 1 + if alt119 == 1: + # C.g:326:32: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_synpred82977) + if self.failed: + return + + + + self.following.append(self.FOLLOW_parameter_declaration_in_synpred82981) + self.parameter_declaration() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred82 + + + + # $ANTLR start synpred83 + def synpred83_fragment(self, ): + # C.g:330:28: ( declarator ) + # C.g:330:28: declarator + self.following.append(self.FOLLOW_declarator_in_synpred83997) + self.declarator() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred83 + + + + # $ANTLR start synpred84 + def synpred84_fragment(self, ): + # C.g:330:39: ( abstract_declarator ) + # C.g:330:39: abstract_declarator + self.following.append(self.FOLLOW_abstract_declarator_in_synpred84999) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred84 + + + + # $ANTLR start synpred86 + def synpred86_fragment(self, ): + # C.g:330:4: ( declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? ) + # C.g:330:4: declaration_specifiers ( declarator | abstract_declarator )* ( 'OPTIONAL' )? + self.following.append(self.FOLLOW_declaration_specifiers_in_synpred86994) + self.declaration_specifiers() + self.following.pop() + if self.failed: + return + # C.g:330:27: ( declarator | abstract_declarator )* + while True: #loop120 + alt120 = 3 + LA120 = self.input.LA(1) + if LA120 == 66: + LA120_3 = self.input.LA(2) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == IDENTIFIER or LA120 == 58 or LA120 == 59 or LA120 == 60: + alt120 = 1 + elif LA120 == 62: + LA120 = self.input.LA(2) + if LA120 == 29 or LA120 == 30 or LA120 == 31 or LA120 == 32 or LA120 == 33 or LA120 == 34 or LA120 == 35 or LA120 == 36 or LA120 == 37 or LA120 == 38 or LA120 == 39 or LA120 == 40 or LA120 == 41 or LA120 == 42 or LA120 == 45 or LA120 == 46 or LA120 == 48 or LA120 == 49 or LA120 == 50 or LA120 == 51 or LA120 == 52 or LA120 == 53 or LA120 == 54 or LA120 == 55 or LA120 == 56 or LA120 == 57 or LA120 == 61 or LA120 == 63 or LA120 == 64: + alt120 = 2 + elif LA120 == 58: + LA120_21 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == 66: + LA120_22 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == 59: + LA120_23 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == 60: + LA120_24 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == IDENTIFIER: + LA120_25 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + elif LA120 == 62: + LA120_26 = self.input.LA(3) + + if (self.synpred83()) : + alt120 = 1 + elif (self.synpred84()) : + alt120 = 2 + + + + elif LA120 == 64: + alt120 = 2 + + if alt120 == 1: + # C.g:330:28: declarator + self.following.append(self.FOLLOW_declarator_in_synpred86997) + self.declarator() + self.following.pop() + if self.failed: + return + + + elif alt120 == 2: + # C.g:330:39: abstract_declarator + self.following.append(self.FOLLOW_abstract_declarator_in_synpred86999) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + + + else: + break #loop120 + + + # C.g:330:61: ( 'OPTIONAL' )? + alt121 = 2 + LA121_0 = self.input.LA(1) + + if (LA121_0 == 53) : + alt121 = 1 + if alt121 == 1: + # C.g:330:62: 'OPTIONAL' + self.match(self.input, 53, self.FOLLOW_53_in_synpred861004) + if self.failed: + return + + + + + + # $ANTLR end synpred86 + + + + # $ANTLR start synpred90 + def synpred90_fragment(self, ): + # C.g:341:4: ( specifier_qualifier_list ( abstract_declarator )? ) + # C.g:341:4: specifier_qualifier_list ( abstract_declarator )? + self.following.append(self.FOLLOW_specifier_qualifier_list_in_synpred901046) + self.specifier_qualifier_list() + self.following.pop() + if self.failed: + return + # C.g:341:29: ( abstract_declarator )? + alt122 = 2 + LA122_0 = self.input.LA(1) + + if (LA122_0 == 62 or LA122_0 == 64 or LA122_0 == 66) : + alt122 = 1 + if alt122 == 1: + # C.g:0:0: abstract_declarator + self.following.append(self.FOLLOW_abstract_declarator_in_synpred901048) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + + + + + + # $ANTLR end synpred90 + + + + # $ANTLR start synpred91 + def synpred91_fragment(self, ): + # C.g:346:12: ( direct_abstract_declarator ) + # C.g:346:12: direct_abstract_declarator + self.following.append(self.FOLLOW_direct_abstract_declarator_in_synpred911067) + self.direct_abstract_declarator() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred91 + + + + # $ANTLR start synpred93 + def synpred93_fragment(self, ): + # C.g:351:6: ( '(' abstract_declarator ')' ) + # C.g:351:6: '(' abstract_declarator ')' + self.match(self.input, 62, self.FOLLOW_62_in_synpred931086) + if self.failed: + return + self.following.append(self.FOLLOW_abstract_declarator_in_synpred931088) + self.abstract_declarator() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred931090) + if self.failed: + return + + + # $ANTLR end synpred93 + + + + # $ANTLR start synpred94 + def synpred94_fragment(self, ): + # C.g:351:65: ( abstract_declarator_suffix ) + # C.g:351:65: abstract_declarator_suffix + self.following.append(self.FOLLOW_abstract_declarator_suffix_in_synpred941098) + self.abstract_declarator_suffix() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred94 + + + + # $ANTLR start synpred109 + def synpred109_fragment(self, ): + # C.g:386:4: ( '(' type_name ')' cast_expression ) + # C.g:386:4: '(' type_name ')' cast_expression + self.match(self.input, 62, self.FOLLOW_62_in_synpred1091282) + if self.failed: + return + self.following.append(self.FOLLOW_type_name_in_synpred1091284) + self.type_name() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred1091286) + if self.failed: + return + self.following.append(self.FOLLOW_cast_expression_in_synpred1091288) + self.cast_expression() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred109 + + + + # $ANTLR start synpred114 + def synpred114_fragment(self, ): + # C.g:395:4: ( 'sizeof' unary_expression ) + # C.g:395:4: 'sizeof' unary_expression + self.match(self.input, 74, self.FOLLOW_74_in_synpred1141330) + if self.failed: + return + self.following.append(self.FOLLOW_unary_expression_in_synpred1141332) + self.unary_expression() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred114 + + + + # $ANTLR start synpred117 + def synpred117_fragment(self, ): + # C.g:409:13: ( '(' argument_expression_list ')' ) + # C.g:409:13: '(' argument_expression_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_synpred1171420) + if self.failed: + return + self.following.append(self.FOLLOW_argument_expression_list_in_synpred1171424) + self.argument_expression_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred1171428) + if self.failed: + return + + + # $ANTLR end synpred117 + + + + # $ANTLR start synpred118 + def synpred118_fragment(self, ): + # C.g:410:13: ( '(' macro_parameter_list ')' ) + # C.g:410:13: '(' macro_parameter_list ')' + self.match(self.input, 62, self.FOLLOW_62_in_synpred1181444) + if self.failed: + return + self.following.append(self.FOLLOW_macro_parameter_list_in_synpred1181446) + self.macro_parameter_list() + self.following.pop() + if self.failed: + return + self.match(self.input, 63, self.FOLLOW_63_in_synpred1181448) + if self.failed: + return + + + # $ANTLR end synpred118 + + + + # $ANTLR start synpred120 + def synpred120_fragment(self, ): + # C.g:412:13: ( '*' IDENTIFIER ) + # C.g:412:13: '*' IDENTIFIER + self.match(self.input, 66, self.FOLLOW_66_in_synpred1201482) + if self.failed: + return + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1201486) + if self.failed: + return + + + # $ANTLR end synpred120 + + + + # $ANTLR start synpred137 + def synpred137_fragment(self, ): + # C.g:443:20: ( STRING_LITERAL ) + # C.g:443:20: STRING_LITERAL + self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1371683) + if self.failed: + return + + + # $ANTLR end synpred137 + + + + # $ANTLR start synpred138 + def synpred138_fragment(self, ): + # C.g:443:8: ( ( IDENTIFIER )* ( STRING_LITERAL )+ ) + # C.g:443:8: ( IDENTIFIER )* ( STRING_LITERAL )+ + # C.g:443:8: ( IDENTIFIER )* + while True: #loop125 + alt125 = 2 + LA125_0 = self.input.LA(1) + + if (LA125_0 == IDENTIFIER) : + alt125 = 1 + + + if alt125 == 1: + # C.g:0:0: IDENTIFIER + self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_synpred1381680) + if self.failed: + return + + + else: + break #loop125 + + + # C.g:443:20: ( STRING_LITERAL )+ + cnt126 = 0 + while True: #loop126 + alt126 = 2 + LA126_0 = self.input.LA(1) + + if (LA126_0 == STRING_LITERAL) : + alt126 = 1 + + + if alt126 == 1: + # C.g:0:0: STRING_LITERAL + self.match(self.input, STRING_LITERAL, self.FOLLOW_STRING_LITERAL_in_synpred1381683) + if self.failed: + return + + + else: + if cnt126 >= 1: + break #loop126 + + if self.backtracking > 0: + self.failed = True + return + + eee = EarlyExitException(126, self.input) + raise eee + + cnt126 += 1 + + + + + # $ANTLR end synpred138 + + + + # $ANTLR start synpred142 + def synpred142_fragment(self, ): + # C.g:458:4: ( lvalue assignment_operator assignment_expression ) + # C.g:458:4: lvalue assignment_operator assignment_expression + self.following.append(self.FOLLOW_lvalue_in_synpred1421744) + self.lvalue() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_assignment_operator_in_synpred1421746) + self.assignment_operator() + self.following.pop() + if self.failed: + return + self.following.append(self.FOLLOW_assignment_expression_in_synpred1421748) + self.assignment_expression() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred142 + + + + # $ANTLR start synpred169 + def synpred169_fragment(self, ): + # C.g:520:4: ( expression_statement ) + # C.g:520:4: expression_statement + self.following.append(self.FOLLOW_expression_statement_in_synpred1692035) + self.expression_statement() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred169 + + + + # $ANTLR start synpred173 + def synpred173_fragment(self, ): + # C.g:524:4: ( macro_statement ) + # C.g:524:4: macro_statement + self.following.append(self.FOLLOW_macro_statement_in_synpred1732055) + self.macro_statement() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred173 + + + + # $ANTLR start synpred174 + def synpred174_fragment(self, ): + # C.g:525:4: ( asm2_statement ) + # C.g:525:4: asm2_statement + self.following.append(self.FOLLOW_asm2_statement_in_synpred1742060) + self.asm2_statement() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred174 + + + + # $ANTLR start synpred181 + def synpred181_fragment(self, ): + # C.g:544:19: ( declaration ) + # C.g:544:19: declaration + self.following.append(self.FOLLOW_declaration_in_synpred1812166) + self.declaration() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred181 + + + + # $ANTLR start synpred182 + def synpred182_fragment(self, ): + # C.g:544:33: ( statement_list ) + # C.g:544:33: statement_list + self.following.append(self.FOLLOW_statement_list_in_synpred1822170) + self.statement_list() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred182 + + + + # $ANTLR start synpred186 + def synpred186_fragment(self, ): + # C.g:554:8: ( declaration ) + # C.g:554:8: declaration + self.following.append(self.FOLLOW_declaration_in_synpred1862225) + self.declaration() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred186 + + + + # $ANTLR start synpred188 + def synpred188_fragment(self, ): + # C.g:558:4: ( statement ) + # C.g:558:4: statement + self.following.append(self.FOLLOW_statement_in_synpred1882242) + self.statement() + self.following.pop() + if self.failed: + return + + + # $ANTLR end synpred188 + + + + def synpred69(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred69_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred81(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred81_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred82(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred82_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred66(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred66_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred83(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred83_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred84(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred84_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred67(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred67_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred86(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred86_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred120(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred120_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred40(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred40_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred142(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred142_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred182(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred182_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred109(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred109_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred181(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred181_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred186(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred186_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred188(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred188_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred169(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred169_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred117(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred117_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred70(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred70_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred118(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred118_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred34(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred34_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred33(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred33_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred94(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred94_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred39(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred39_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred74(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred74_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred114(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred114_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred93(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred93_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred75(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred75_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred137(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred137_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred90(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred90_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred138(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred138_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred91(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred91_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred73(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred73_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred5(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred5_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred78(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred78_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred7(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred7_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred76(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred76_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred77(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred77_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred2(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred2_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred4(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred4_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred174(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred174_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred173(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred173_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred14(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred14_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred15(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred15_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + def synpred10(self): + self.backtracking += 1 + start = self.input.mark() + self.synpred10_fragment() + success = not self.failed + self.input.rewind(start) + self.backtracking -= 1 + self.failed = False + return success + + + + + + FOLLOW_external_declaration_in_translation_unit74 = frozenset([1, 4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) + FOLLOW_function_definition_in_external_declaration113 = frozenset([1]) + FOLLOW_declaration_in_external_declaration118 = frozenset([1]) + FOLLOW_macro_statement_in_external_declaration123 = frozenset([1, 25]) + FOLLOW_25_in_external_declaration126 = frozenset([1]) + FOLLOW_declaration_specifiers_in_function_definition157 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_declarator_in_function_definition160 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_declaration_in_function_definition166 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_compound_statement_in_function_definition171 = frozenset([1]) + FOLLOW_compound_statement_in_function_definition180 = frozenset([1]) + FOLLOW_26_in_declaration203 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) + FOLLOW_declaration_specifiers_in_declaration207 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_init_declarator_list_in_declaration216 = frozenset([25]) + FOLLOW_25_in_declaration220 = frozenset([1]) + FOLLOW_declaration_specifiers_in_declaration234 = frozenset([4, 25, 58, 59, 60, 62, 66]) + FOLLOW_init_declarator_list_in_declaration238 = frozenset([25]) + FOLLOW_25_in_declaration243 = frozenset([1]) + FOLLOW_storage_class_specifier_in_declaration_specifiers264 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_specifier_in_declaration_specifiers272 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_qualifier_in_declaration_specifiers286 = frozenset([1, 4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_init_declarator_in_init_declarator_list308 = frozenset([1, 27]) + FOLLOW_27_in_init_declarator_list311 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_init_declarator_in_init_declarator_list313 = frozenset([1, 27]) + FOLLOW_declarator_in_init_declarator326 = frozenset([1, 28]) + FOLLOW_28_in_init_declarator329 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_initializer_in_init_declarator331 = frozenset([1]) + FOLLOW_set_in_storage_class_specifier0 = frozenset([1]) + FOLLOW_34_in_type_specifier376 = frozenset([1]) + FOLLOW_35_in_type_specifier381 = frozenset([1]) + FOLLOW_36_in_type_specifier386 = frozenset([1]) + FOLLOW_37_in_type_specifier391 = frozenset([1]) + FOLLOW_38_in_type_specifier396 = frozenset([1]) + FOLLOW_39_in_type_specifier401 = frozenset([1]) + FOLLOW_40_in_type_specifier406 = frozenset([1]) + FOLLOW_41_in_type_specifier411 = frozenset([1]) + FOLLOW_42_in_type_specifier416 = frozenset([1]) + FOLLOW_struct_or_union_specifier_in_type_specifier423 = frozenset([1]) + FOLLOW_enum_specifier_in_type_specifier433 = frozenset([1]) + FOLLOW_type_id_in_type_specifier451 = frozenset([1]) + FOLLOW_IDENTIFIER_in_type_id467 = frozenset([1]) + FOLLOW_struct_or_union_in_struct_or_union_specifier494 = frozenset([4, 43]) + FOLLOW_IDENTIFIER_in_struct_or_union_specifier496 = frozenset([43]) + FOLLOW_43_in_struct_or_union_specifier499 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_struct_declaration_list_in_struct_or_union_specifier501 = frozenset([44]) + FOLLOW_44_in_struct_or_union_specifier503 = frozenset([1]) + FOLLOW_struct_or_union_in_struct_or_union_specifier508 = frozenset([4]) + FOLLOW_IDENTIFIER_in_struct_or_union_specifier510 = frozenset([1]) + FOLLOW_set_in_struct_or_union0 = frozenset([1]) + FOLLOW_struct_declaration_in_struct_declaration_list537 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_specifier_qualifier_list_in_struct_declaration549 = frozenset([4, 47, 58, 59, 60, 62, 66]) + FOLLOW_struct_declarator_list_in_struct_declaration551 = frozenset([25]) + FOLLOW_25_in_struct_declaration553 = frozenset([1]) + FOLLOW_type_qualifier_in_specifier_qualifier_list566 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_specifier_in_specifier_qualifier_list570 = frozenset([1, 4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_struct_declarator_in_struct_declarator_list584 = frozenset([1, 27]) + FOLLOW_27_in_struct_declarator_list587 = frozenset([4, 47, 58, 59, 60, 62, 66]) + FOLLOW_struct_declarator_in_struct_declarator_list589 = frozenset([1, 27]) + FOLLOW_declarator_in_struct_declarator602 = frozenset([1, 47]) + FOLLOW_47_in_struct_declarator605 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_struct_declarator607 = frozenset([1]) + FOLLOW_47_in_struct_declarator614 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_struct_declarator616 = frozenset([1]) + FOLLOW_48_in_enum_specifier634 = frozenset([43]) + FOLLOW_43_in_enum_specifier636 = frozenset([4]) + FOLLOW_enumerator_list_in_enum_specifier638 = frozenset([27, 44]) + FOLLOW_27_in_enum_specifier640 = frozenset([44]) + FOLLOW_44_in_enum_specifier643 = frozenset([1]) + FOLLOW_48_in_enum_specifier648 = frozenset([4]) + FOLLOW_IDENTIFIER_in_enum_specifier650 = frozenset([43]) + FOLLOW_43_in_enum_specifier652 = frozenset([4]) + FOLLOW_enumerator_list_in_enum_specifier654 = frozenset([27, 44]) + FOLLOW_27_in_enum_specifier656 = frozenset([44]) + FOLLOW_44_in_enum_specifier659 = frozenset([1]) + FOLLOW_48_in_enum_specifier664 = frozenset([4]) + FOLLOW_IDENTIFIER_in_enum_specifier666 = frozenset([1]) + FOLLOW_enumerator_in_enumerator_list677 = frozenset([1, 27]) + FOLLOW_27_in_enumerator_list680 = frozenset([4]) + FOLLOW_enumerator_in_enumerator_list682 = frozenset([1, 27]) + FOLLOW_IDENTIFIER_in_enumerator695 = frozenset([1, 28]) + FOLLOW_28_in_enumerator698 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_enumerator700 = frozenset([1]) + FOLLOW_set_in_type_qualifier0 = frozenset([1]) + FOLLOW_pointer_in_declarator784 = frozenset([4, 58, 59, 60, 62]) + FOLLOW_58_in_declarator788 = frozenset([4, 59, 60, 62]) + FOLLOW_59_in_declarator793 = frozenset([4, 60, 62]) + FOLLOW_60_in_declarator798 = frozenset([4, 62]) + FOLLOW_direct_declarator_in_declarator802 = frozenset([1]) + FOLLOW_pointer_in_declarator808 = frozenset([1]) + FOLLOW_IDENTIFIER_in_direct_declarator819 = frozenset([1, 62, 64]) + FOLLOW_declarator_suffix_in_direct_declarator821 = frozenset([1, 62, 64]) + FOLLOW_62_in_direct_declarator827 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_58_in_direct_declarator830 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_declarator_in_direct_declarator834 = frozenset([63]) + FOLLOW_63_in_direct_declarator836 = frozenset([62, 64]) + FOLLOW_declarator_suffix_in_direct_declarator838 = frozenset([1, 62, 64]) + FOLLOW_64_in_declarator_suffix852 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_declarator_suffix854 = frozenset([65]) + FOLLOW_65_in_declarator_suffix856 = frozenset([1]) + FOLLOW_64_in_declarator_suffix866 = frozenset([65]) + FOLLOW_65_in_declarator_suffix868 = frozenset([1]) + FOLLOW_62_in_declarator_suffix878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_type_list_in_declarator_suffix880 = frozenset([63]) + FOLLOW_63_in_declarator_suffix882 = frozenset([1]) + FOLLOW_62_in_declarator_suffix892 = frozenset([4]) + FOLLOW_identifier_list_in_declarator_suffix894 = frozenset([63]) + FOLLOW_63_in_declarator_suffix896 = frozenset([1]) + FOLLOW_62_in_declarator_suffix906 = frozenset([63]) + FOLLOW_63_in_declarator_suffix908 = frozenset([1]) + FOLLOW_66_in_pointer919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_qualifier_in_pointer921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_pointer_in_pointer924 = frozenset([1]) + FOLLOW_66_in_pointer930 = frozenset([66]) + FOLLOW_pointer_in_pointer932 = frozenset([1]) + FOLLOW_66_in_pointer937 = frozenset([1]) + FOLLOW_parameter_list_in_parameter_type_list948 = frozenset([1, 27]) + FOLLOW_27_in_parameter_type_list951 = frozenset([53, 67]) + FOLLOW_53_in_parameter_type_list954 = frozenset([67]) + FOLLOW_67_in_parameter_type_list958 = frozenset([1]) + FOLLOW_parameter_declaration_in_parameter_list971 = frozenset([1, 27]) + FOLLOW_27_in_parameter_list974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_53_in_parameter_list977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_declaration_in_parameter_list981 = frozenset([1, 27]) + FOLLOW_declaration_specifiers_in_parameter_declaration994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_declarator_in_parameter_declaration997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_abstract_declarator_in_parameter_declaration999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_53_in_parameter_declaration1004 = frozenset([1]) + FOLLOW_pointer_in_parameter_declaration1013 = frozenset([4, 66]) + FOLLOW_IDENTIFIER_in_parameter_declaration1016 = frozenset([1]) + FOLLOW_IDENTIFIER_in_identifier_list1027 = frozenset([1, 27]) + FOLLOW_27_in_identifier_list1031 = frozenset([4]) + FOLLOW_IDENTIFIER_in_identifier_list1033 = frozenset([1, 27]) + FOLLOW_specifier_qualifier_list_in_type_name1046 = frozenset([1, 62, 64, 66]) + FOLLOW_abstract_declarator_in_type_name1048 = frozenset([1]) + FOLLOW_type_id_in_type_name1054 = frozenset([1]) + FOLLOW_pointer_in_abstract_declarator1065 = frozenset([1, 62, 64]) + FOLLOW_direct_abstract_declarator_in_abstract_declarator1067 = frozenset([1]) + FOLLOW_direct_abstract_declarator_in_abstract_declarator1073 = frozenset([1]) + FOLLOW_62_in_direct_abstract_declarator1086 = frozenset([62, 64, 66]) + FOLLOW_abstract_declarator_in_direct_abstract_declarator1088 = frozenset([63]) + FOLLOW_63_in_direct_abstract_declarator1090 = frozenset([1, 62, 64]) + FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1094 = frozenset([1, 62, 64]) + FOLLOW_abstract_declarator_suffix_in_direct_abstract_declarator1098 = frozenset([1, 62, 64]) + FOLLOW_64_in_abstract_declarator_suffix1110 = frozenset([65]) + FOLLOW_65_in_abstract_declarator_suffix1112 = frozenset([1]) + FOLLOW_64_in_abstract_declarator_suffix1117 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_abstract_declarator_suffix1119 = frozenset([65]) + FOLLOW_65_in_abstract_declarator_suffix1121 = frozenset([1]) + FOLLOW_62_in_abstract_declarator_suffix1126 = frozenset([63]) + FOLLOW_63_in_abstract_declarator_suffix1128 = frozenset([1]) + FOLLOW_62_in_abstract_declarator_suffix1133 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_type_list_in_abstract_declarator_suffix1135 = frozenset([63]) + FOLLOW_63_in_abstract_declarator_suffix1137 = frozenset([1]) + FOLLOW_assignment_expression_in_initializer1150 = frozenset([1]) + FOLLOW_43_in_initializer1155 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_initializer_list_in_initializer1157 = frozenset([27, 44]) + FOLLOW_27_in_initializer1159 = frozenset([44]) + FOLLOW_44_in_initializer1162 = frozenset([1]) + FOLLOW_initializer_in_initializer_list1173 = frozenset([1, 27]) + FOLLOW_27_in_initializer_list1176 = frozenset([4, 5, 6, 7, 8, 9, 10, 43, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_initializer_in_initializer_list1178 = frozenset([1, 27]) + FOLLOW_assignment_expression_in_argument_expression_list1196 = frozenset([1, 27, 53]) + FOLLOW_53_in_argument_expression_list1199 = frozenset([1, 27]) + FOLLOW_27_in_argument_expression_list1204 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_assignment_expression_in_argument_expression_list1206 = frozenset([1, 27, 53]) + FOLLOW_53_in_argument_expression_list1209 = frozenset([1, 27]) + FOLLOW_multiplicative_expression_in_additive_expression1225 = frozenset([1, 68, 69]) + FOLLOW_68_in_additive_expression1229 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_multiplicative_expression_in_additive_expression1231 = frozenset([1, 68, 69]) + FOLLOW_69_in_additive_expression1235 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_multiplicative_expression_in_additive_expression1237 = frozenset([1, 68, 69]) + FOLLOW_cast_expression_in_multiplicative_expression1251 = frozenset([1, 66, 70, 71]) + FOLLOW_66_in_multiplicative_expression1255 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_multiplicative_expression1257 = frozenset([1, 66, 70, 71]) + FOLLOW_70_in_multiplicative_expression1261 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_multiplicative_expression1263 = frozenset([1, 66, 70, 71]) + FOLLOW_71_in_multiplicative_expression1267 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_multiplicative_expression1269 = frozenset([1, 66, 70, 71]) + FOLLOW_62_in_cast_expression1282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_name_in_cast_expression1284 = frozenset([63]) + FOLLOW_63_in_cast_expression1286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_cast_expression1288 = frozenset([1]) + FOLLOW_unary_expression_in_cast_expression1293 = frozenset([1]) + FOLLOW_postfix_expression_in_unary_expression1304 = frozenset([1]) + FOLLOW_72_in_unary_expression1309 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_unary_expression_in_unary_expression1311 = frozenset([1]) + FOLLOW_73_in_unary_expression1316 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_unary_expression_in_unary_expression1318 = frozenset([1]) + FOLLOW_unary_operator_in_unary_expression1323 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_unary_expression1325 = frozenset([1]) + FOLLOW_74_in_unary_expression1330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_unary_expression_in_unary_expression1332 = frozenset([1]) + FOLLOW_74_in_unary_expression1337 = frozenset([62]) + FOLLOW_62_in_unary_expression1339 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_name_in_unary_expression1341 = frozenset([63]) + FOLLOW_63_in_unary_expression1343 = frozenset([1]) + FOLLOW_primary_expression_in_postfix_expression1367 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_64_in_postfix_expression1383 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_postfix_expression1385 = frozenset([65]) + FOLLOW_65_in_postfix_expression1387 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_62_in_postfix_expression1401 = frozenset([63]) + FOLLOW_63_in_postfix_expression1405 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_62_in_postfix_expression1420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_argument_expression_list_in_postfix_expression1424 = frozenset([63]) + FOLLOW_63_in_postfix_expression1428 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_62_in_postfix_expression1444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_macro_parameter_list_in_postfix_expression1446 = frozenset([63]) + FOLLOW_63_in_postfix_expression1448 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_75_in_postfix_expression1462 = frozenset([4]) + FOLLOW_IDENTIFIER_in_postfix_expression1466 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_66_in_postfix_expression1482 = frozenset([4]) + FOLLOW_IDENTIFIER_in_postfix_expression1486 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_76_in_postfix_expression1502 = frozenset([4]) + FOLLOW_IDENTIFIER_in_postfix_expression1506 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_72_in_postfix_expression1522 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_73_in_postfix_expression1536 = frozenset([1, 62, 64, 66, 72, 73, 75, 76]) + FOLLOW_parameter_declaration_in_macro_parameter_list1559 = frozenset([1, 27]) + FOLLOW_27_in_macro_parameter_list1562 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_declaration_in_macro_parameter_list1564 = frozenset([1, 27]) + FOLLOW_set_in_unary_operator0 = frozenset([1]) + FOLLOW_IDENTIFIER_in_primary_expression1613 = frozenset([1]) + FOLLOW_constant_in_primary_expression1618 = frozenset([1]) + FOLLOW_62_in_primary_expression1623 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_primary_expression1625 = frozenset([63]) + FOLLOW_63_in_primary_expression1627 = frozenset([1]) + FOLLOW_HEX_LITERAL_in_constant1643 = frozenset([1]) + FOLLOW_OCTAL_LITERAL_in_constant1653 = frozenset([1]) + FOLLOW_DECIMAL_LITERAL_in_constant1663 = frozenset([1]) + FOLLOW_CHARACTER_LITERAL_in_constant1671 = frozenset([1]) + FOLLOW_IDENTIFIER_in_constant1680 = frozenset([4, 9]) + FOLLOW_STRING_LITERAL_in_constant1683 = frozenset([1, 4, 9]) + FOLLOW_IDENTIFIER_in_constant1688 = frozenset([1, 4]) + FOLLOW_FLOATING_POINT_LITERAL_in_constant1699 = frozenset([1]) + FOLLOW_assignment_expression_in_expression1715 = frozenset([1, 27]) + FOLLOW_27_in_expression1718 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_assignment_expression_in_expression1720 = frozenset([1, 27]) + FOLLOW_conditional_expression_in_constant_expression1733 = frozenset([1]) + FOLLOW_lvalue_in_assignment_expression1744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]) + FOLLOW_assignment_operator_in_assignment_expression1746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_assignment_expression_in_assignment_expression1748 = frozenset([1]) + FOLLOW_conditional_expression_in_assignment_expression1753 = frozenset([1]) + FOLLOW_unary_expression_in_lvalue1765 = frozenset([1]) + FOLLOW_set_in_assignment_operator0 = frozenset([1]) + FOLLOW_logical_or_expression_in_conditional_expression1839 = frozenset([1, 90]) + FOLLOW_90_in_conditional_expression1842 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_conditional_expression1844 = frozenset([47]) + FOLLOW_47_in_conditional_expression1846 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_conditional_expression_in_conditional_expression1848 = frozenset([1]) + FOLLOW_logical_and_expression_in_logical_or_expression1863 = frozenset([1, 91]) + FOLLOW_91_in_logical_or_expression1866 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_logical_and_expression_in_logical_or_expression1868 = frozenset([1, 91]) + FOLLOW_inclusive_or_expression_in_logical_and_expression1881 = frozenset([1, 92]) + FOLLOW_92_in_logical_and_expression1884 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_inclusive_or_expression_in_logical_and_expression1886 = frozenset([1, 92]) + FOLLOW_exclusive_or_expression_in_inclusive_or_expression1899 = frozenset([1, 93]) + FOLLOW_93_in_inclusive_or_expression1902 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_exclusive_or_expression_in_inclusive_or_expression1904 = frozenset([1, 93]) + FOLLOW_and_expression_in_exclusive_or_expression1917 = frozenset([1, 94]) + FOLLOW_94_in_exclusive_or_expression1920 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_and_expression_in_exclusive_or_expression1922 = frozenset([1, 94]) + FOLLOW_equality_expression_in_and_expression1935 = frozenset([1, 77]) + FOLLOW_77_in_and_expression1938 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_equality_expression_in_and_expression1940 = frozenset([1, 77]) + FOLLOW_relational_expression_in_equality_expression1952 = frozenset([1, 95, 96]) + FOLLOW_set_in_equality_expression1955 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_relational_expression_in_equality_expression1961 = frozenset([1, 95, 96]) + FOLLOW_shift_expression_in_relational_expression1975 = frozenset([1, 97, 98, 99, 100]) + FOLLOW_set_in_relational_expression1978 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_shift_expression_in_relational_expression1988 = frozenset([1, 97, 98, 99, 100]) + FOLLOW_additive_expression_in_shift_expression2001 = frozenset([1, 101, 102]) + FOLLOW_set_in_shift_expression2004 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_additive_expression_in_shift_expression2010 = frozenset([1, 101, 102]) + FOLLOW_labeled_statement_in_statement2025 = frozenset([1]) + FOLLOW_compound_statement_in_statement2030 = frozenset([1]) + FOLLOW_expression_statement_in_statement2035 = frozenset([1]) + FOLLOW_selection_statement_in_statement2040 = frozenset([1]) + FOLLOW_iteration_statement_in_statement2045 = frozenset([1]) + FOLLOW_jump_statement_in_statement2050 = frozenset([1]) + FOLLOW_macro_statement_in_statement2055 = frozenset([1]) + FOLLOW_asm2_statement_in_statement2060 = frozenset([1]) + FOLLOW_asm1_statement_in_statement2065 = frozenset([1]) + FOLLOW_asm_statement_in_statement2070 = frozenset([1]) + FOLLOW_declaration_in_statement2075 = frozenset([1]) + FOLLOW_103_in_asm2_statement2086 = frozenset([4]) + FOLLOW_IDENTIFIER_in_asm2_statement2089 = frozenset([62]) + FOLLOW_62_in_asm2_statement2091 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_set_in_asm2_statement2094 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_63_in_asm2_statement2101 = frozenset([25]) + FOLLOW_25_in_asm2_statement2103 = frozenset([1]) + FOLLOW_104_in_asm1_statement2115 = frozenset([43]) + FOLLOW_43_in_asm1_statement2117 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_set_in_asm1_statement2120 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_44_in_asm1_statement2127 = frozenset([1]) + FOLLOW_105_in_asm_statement2138 = frozenset([43]) + FOLLOW_43_in_asm_statement2140 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_set_in_asm_statement2143 = frozenset([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_44_in_asm_statement2150 = frozenset([1]) + FOLLOW_IDENTIFIER_in_macro_statement2162 = frozenset([62]) + FOLLOW_62_in_macro_statement2164 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_declaration_in_macro_statement2166 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_list_in_macro_statement2170 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_macro_statement2173 = frozenset([63]) + FOLLOW_63_in_macro_statement2176 = frozenset([1]) + FOLLOW_IDENTIFIER_in_labeled_statement2188 = frozenset([47]) + FOLLOW_47_in_labeled_statement2190 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_labeled_statement2192 = frozenset([1]) + FOLLOW_106_in_labeled_statement2197 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_constant_expression_in_labeled_statement2199 = frozenset([47]) + FOLLOW_47_in_labeled_statement2201 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_labeled_statement2203 = frozenset([1]) + FOLLOW_107_in_labeled_statement2208 = frozenset([47]) + FOLLOW_47_in_labeled_statement2210 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_labeled_statement2212 = frozenset([1]) + FOLLOW_43_in_compound_statement2223 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_declaration_in_compound_statement2225 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_list_in_compound_statement2228 = frozenset([44]) + FOLLOW_44_in_compound_statement2231 = frozenset([1]) + FOLLOW_statement_in_statement_list2242 = frozenset([1, 4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_25_in_expression_statement2254 = frozenset([1]) + FOLLOW_expression_in_expression_statement2259 = frozenset([25]) + FOLLOW_25_in_expression_statement2261 = frozenset([1]) + FOLLOW_108_in_selection_statement2272 = frozenset([62]) + FOLLOW_62_in_selection_statement2274 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_selection_statement2278 = frozenset([63]) + FOLLOW_63_in_selection_statement2280 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_selection_statement2284 = frozenset([1, 109]) + FOLLOW_109_in_selection_statement2299 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_selection_statement2301 = frozenset([1]) + FOLLOW_110_in_selection_statement2308 = frozenset([62]) + FOLLOW_62_in_selection_statement2310 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_selection_statement2312 = frozenset([63]) + FOLLOW_63_in_selection_statement2314 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_selection_statement2316 = frozenset([1]) + FOLLOW_111_in_iteration_statement2327 = frozenset([62]) + FOLLOW_62_in_iteration_statement2329 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_iteration_statement2333 = frozenset([63]) + FOLLOW_63_in_iteration_statement2335 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_iteration_statement2337 = frozenset([1]) + FOLLOW_112_in_iteration_statement2344 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_iteration_statement2346 = frozenset([111]) + FOLLOW_111_in_iteration_statement2348 = frozenset([62]) + FOLLOW_62_in_iteration_statement2350 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_iteration_statement2354 = frozenset([63]) + FOLLOW_63_in_iteration_statement2356 = frozenset([25]) + FOLLOW_25_in_iteration_statement2358 = frozenset([1]) + FOLLOW_113_in_iteration_statement2365 = frozenset([62]) + FOLLOW_62_in_iteration_statement2367 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_statement_in_iteration_statement2369 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_statement_in_iteration_statement2373 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 63, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_iteration_statement2375 = frozenset([63]) + FOLLOW_63_in_iteration_statement2378 = frozenset([4, 5, 6, 7, 8, 9, 10, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79, 103, 104, 105, 106, 107, 108, 110, 111, 112, 113, 114, 115, 116, 117]) + FOLLOW_statement_in_iteration_statement2380 = frozenset([1]) + FOLLOW_114_in_jump_statement2393 = frozenset([4]) + FOLLOW_IDENTIFIER_in_jump_statement2395 = frozenset([25]) + FOLLOW_25_in_jump_statement2397 = frozenset([1]) + FOLLOW_115_in_jump_statement2402 = frozenset([25]) + FOLLOW_25_in_jump_statement2404 = frozenset([1]) + FOLLOW_116_in_jump_statement2409 = frozenset([25]) + FOLLOW_25_in_jump_statement2411 = frozenset([1]) + FOLLOW_117_in_jump_statement2416 = frozenset([25]) + FOLLOW_25_in_jump_statement2418 = frozenset([1]) + FOLLOW_117_in_jump_statement2423 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_expression_in_jump_statement2425 = frozenset([25]) + FOLLOW_25_in_jump_statement2427 = frozenset([1]) + FOLLOW_declaration_specifiers_in_synpred2100 = frozenset([1]) + FOLLOW_declaration_specifiers_in_synpred4100 = frozenset([4, 58, 59, 60, 62, 66]) + FOLLOW_declarator_in_synpred4103 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_declaration_in_synpred4105 = frozenset([4, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_43_in_synpred4108 = frozenset([1]) + FOLLOW_declaration_in_synpred5118 = frozenset([1]) + FOLLOW_declaration_specifiers_in_synpred7157 = frozenset([1]) + FOLLOW_declaration_specifiers_in_synpred10207 = frozenset([1]) + FOLLOW_type_specifier_in_synpred14272 = frozenset([1]) + FOLLOW_type_qualifier_in_synpred15286 = frozenset([1]) + FOLLOW_type_qualifier_in_synpred33444 = frozenset([1]) + FOLLOW_IDENTIFIER_in_synpred34442 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) + FOLLOW_type_qualifier_in_synpred34444 = frozenset([4, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 66]) + FOLLOW_declarator_in_synpred34447 = frozenset([1]) + FOLLOW_type_qualifier_in_synpred39566 = frozenset([1]) + FOLLOW_type_specifier_in_synpred40570 = frozenset([1]) + FOLLOW_pointer_in_synpred66784 = frozenset([4, 58, 59, 60, 62]) + FOLLOW_58_in_synpred66788 = frozenset([4, 59, 60, 62]) + FOLLOW_59_in_synpred66793 = frozenset([4, 60, 62]) + FOLLOW_60_in_synpred66798 = frozenset([4, 62]) + FOLLOW_direct_declarator_in_synpred66802 = frozenset([1]) + FOLLOW_declarator_suffix_in_synpred67821 = frozenset([1]) + FOLLOW_58_in_synpred69830 = frozenset([1]) + FOLLOW_declarator_suffix_in_synpred70838 = frozenset([1]) + FOLLOW_62_in_synpred73878 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_type_list_in_synpred73880 = frozenset([63]) + FOLLOW_63_in_synpred73882 = frozenset([1]) + FOLLOW_62_in_synpred74892 = frozenset([4]) + FOLLOW_identifier_list_in_synpred74894 = frozenset([63]) + FOLLOW_63_in_synpred74896 = frozenset([1]) + FOLLOW_type_qualifier_in_synpred75921 = frozenset([1]) + FOLLOW_pointer_in_synpred76924 = frozenset([1]) + FOLLOW_66_in_synpred77919 = frozenset([49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_qualifier_in_synpred77921 = frozenset([1, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_pointer_in_synpred77924 = frozenset([1]) + FOLLOW_66_in_synpred78930 = frozenset([66]) + FOLLOW_pointer_in_synpred78932 = frozenset([1]) + FOLLOW_53_in_synpred81977 = frozenset([1]) + FOLLOW_27_in_synpred82974 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_53_in_synpred82977 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_parameter_declaration_in_synpred82981 = frozenset([1]) + FOLLOW_declarator_in_synpred83997 = frozenset([1]) + FOLLOW_abstract_declarator_in_synpred84999 = frozenset([1]) + FOLLOW_declaration_specifiers_in_synpred86994 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_declarator_in_synpred86997 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_abstract_declarator_in_synpred86999 = frozenset([1, 4, 53, 58, 59, 60, 62, 64, 66]) + FOLLOW_53_in_synpred861004 = frozenset([1]) + FOLLOW_specifier_qualifier_list_in_synpred901046 = frozenset([1, 62, 64, 66]) + FOLLOW_abstract_declarator_in_synpred901048 = frozenset([1]) + FOLLOW_direct_abstract_declarator_in_synpred911067 = frozenset([1]) + FOLLOW_62_in_synpred931086 = frozenset([62, 64, 66]) + FOLLOW_abstract_declarator_in_synpred931088 = frozenset([63]) + FOLLOW_63_in_synpred931090 = frozenset([1]) + FOLLOW_abstract_declarator_suffix_in_synpred941098 = frozenset([1]) + FOLLOW_62_in_synpred1091282 = frozenset([4, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61]) + FOLLOW_type_name_in_synpred1091284 = frozenset([63]) + FOLLOW_63_in_synpred1091286 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_cast_expression_in_synpred1091288 = frozenset([1]) + FOLLOW_74_in_synpred1141330 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_unary_expression_in_synpred1141332 = frozenset([1]) + FOLLOW_62_in_synpred1171420 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_argument_expression_list_in_synpred1171424 = frozenset([63]) + FOLLOW_63_in_synpred1171428 = frozenset([1]) + FOLLOW_62_in_synpred1181444 = frozenset([4, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 66]) + FOLLOW_macro_parameter_list_in_synpred1181446 = frozenset([63]) + FOLLOW_63_in_synpred1181448 = frozenset([1]) + FOLLOW_66_in_synpred1201482 = frozenset([4]) + FOLLOW_IDENTIFIER_in_synpred1201486 = frozenset([1]) + FOLLOW_STRING_LITERAL_in_synpred1371683 = frozenset([1]) + FOLLOW_IDENTIFIER_in_synpred1381680 = frozenset([4, 9]) + FOLLOW_STRING_LITERAL_in_synpred1381683 = frozenset([1, 9]) + FOLLOW_lvalue_in_synpred1421744 = frozenset([28, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89]) + FOLLOW_assignment_operator_in_synpred1421746 = frozenset([4, 5, 6, 7, 8, 9, 10, 62, 66, 68, 69, 72, 73, 74, 77, 78, 79]) + FOLLOW_assignment_expression_in_synpred1421748 = frozenset([1]) + FOLLOW_expression_statement_in_synpred1692035 = frozenset([1]) + FOLLOW_macro_statement_in_synpred1732055 = frozenset([1]) + FOLLOW_asm2_statement_in_synpred1742060 = frozenset([1]) + FOLLOW_declaration_in_synpred1812166 = frozenset([1]) + FOLLOW_statement_list_in_synpred1822170 = frozenset([1]) + FOLLOW_declaration_in_synpred1862225 = frozenset([1]) + FOLLOW_statement_in_synpred1882242 = frozenset([1]) + diff --git a/BaseTools/Source/Python/Eot/FvImage.py b/BaseTools/Source/Python/Eot/FvImage.py index d54c2233d8..f668a17c09 100644 --- a/BaseTools/Source/Python/Eot/FvImage.py +++ b/BaseTools/Source/Python/Eot/FvImage.py @@ -1,1453 +1,1453 @@ -## @file -# Parse FV image -# -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## Import Modules -# -import os -import re -import sys -import uuid -import struct -import codecs -import copy - -from UserDict import IterableUserDict -from cStringIO import StringIO -from array import array - -from CommonDataClass import * -from Common.Misc import sdict, GuidStructureStringToGuidString - -import Common.EdkLogger as EdkLogger - -import EotGlobalData - -# Global definiton -gFfsPrintTitle = "%-36s %-21s %8s %8s %8s %-4s %-36s" % ("GUID", "TYPE", "OFFSET", "SIZE", "FREE", "ALIGN", "NAME") -gFfsPrintFormat = "%36s %-21s %8X %8X %8X %4s %-36s" -gGuidStringFormat = "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X" -gPeiAprioriFileNameGuid = '1b45cc0a-156a-428a-af62-49864da0e6e6' -gAprioriGuid = 'fc510ee7-ffdc-11d4-bd41-0080c73c8881' -gIndention = -4 - -## Image() class -# -# A class for Image -# -class Image(array): - _HEADER_ = struct.Struct("") - _HEADER_SIZE_ = _HEADER_.size - - def __new__(cls, *args, **kwargs): - return array.__new__(cls, 'B') - - def __init__(m, ID=None): - if ID == None: - m._ID_ = str(uuid.uuid1()).upper() - else: - m._ID_ = ID - m._BUF_ = None - m._LEN_ = None - m._OFF_ = None - - m._SubImages = sdict() # {offset: Image()} - - array.__init__(m, 'B') - - def __repr__(m): - return m._ID_ - - def __len__(m): - Len = array.__len__(m) - for Offset in m._SubImages: - Len += len(m._SubImages[Offset]) - return Len - - def _Unpack(m): - m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._LEN_]) - return len(m) - - def _Pack(m, PadByte=0xFF): - raise NotImplementedError - - def frombuffer(m, Buffer, Offset=0, Size=None): - m._BUF_ = Buffer - m._OFF_ = Offset - # we may need the Size information in advance if it's given - m._LEN_ = Size - m._LEN_ = m._Unpack() - - def empty(m): - del m[0:] - - def GetField(m, FieldStruct, Offset=0): - return FieldStruct.unpack_from(m, Offset) - - def SetField(m, FieldStruct, Offset, *args): - # check if there's enough space - Size = FieldStruct.size - if Size > len(m): - m.extend([0] * (Size - len(m))) - FieldStruct.pack_into(m, Offset, *args) - - def _SetData(m, Data): - if len(m) < m._HEADER_SIZE_: - m.extend([0] * (m._HEADER_SIZE_ - len(m))) - else: - del m[m._HEADER_SIZE_:] - m.extend(Data) - - def _GetData(m): - if len(m) > m._HEADER_SIZE_: - return m[m._HEADER_SIZE_:] - return None - - Data = property(_GetData, _SetData) - -## FirmwareVolume() class -# -# A class for Firmware Volume -# -class FirmwareVolume(Image): - # Read FvLength, Attributes, HeaderLength, Checksum - _HEADER_ = struct.Struct("16x 1I2H8B 1Q 4x 1I 1H 1H") - _HEADER_SIZE_ = _HEADER_.size - - _FfsGuid = "8C8CE578-8A3D-4F1C-9935-896185C32DD3" - - _GUID_ = struct.Struct("16x 1I2H8B") - _LENGTH_ = struct.Struct("16x 16x 1Q") - _SIG_ = struct.Struct("16x 16x 8x 1I") - _ATTR_ = struct.Struct("16x 16x 8x 4x 1I") - _HLEN_ = struct.Struct("16x 16x 8x 4x 4x 1H") - _CHECKSUM_ = struct.Struct("16x 16x 8x 4x 4x 2x 1H") - - def __init__(self, Name=''): - Image.__init__(self) - self.Name = Name - self.FfsDict = sdict() - self.OrderedFfsDict = sdict() - self.UnDispatchedFfsDict = sdict() - self.NoDepexFfsDict = sdict() - self.ProtocolList = sdict() - - def CheckArchProtocol(self): - for Item in EotGlobalData.gArchProtocolGuids: - if Item.lower() not in EotGlobalData.gProtocolList: - - return False - - return True - - def ParseDepex(self, Depex, Type): - List = None - if Type == 'Ppi': - List = EotGlobalData.gPpiList - if Type == 'Protocol': - List = EotGlobalData.gProtocolList - DepexStack = [] - DepexList = [] - DepexString = '' - FileDepex = None - CouldBeLoaded = True - for Index in range(0, len(Depex.Expression)): - Item = Depex.Expression[Index] - if Item == 0x00: - Index = Index + 1 - Guid = gGuidStringFormat % Depex.Expression[Index] - if Guid in self.OrderedFfsDict and Depex.Expression[Index + 1] == 0x08: - return (True, 'BEFORE %s' % Guid, [Guid, 'BEFORE']) - elif Item == 0x01: - Index = Index + 1 - Guid = gGuidStringFormat % Depex.Expression[Index] - if Guid in self.OrderedFfsDict and Depex.Expression[Index + 1] == 0x08: - return (True, 'AFTER %s' % Guid, [Guid, 'AFTER']) - elif Item == 0x02: - Index = Index + 1 - Guid = gGuidStringFormat % Depex.Expression[Index] - if Guid.lower() in List: - DepexStack.append(True) - DepexList.append(Guid) - else: - DepexStack.append(False) - DepexList.append(Guid) - continue - elif Item == 0x03 or Item == 0x04: - DepexStack.append(eval(str(DepexStack.pop()) + ' ' + Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexStack.pop()))) - DepexList.append(str(DepexList.pop()) + ' ' + Depex._OPCODE_STRING_[Item].upper() + ' ' + str(DepexList.pop())) - elif Item == 0x05: - DepexStack.append(eval(Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexStack.pop()))) - DepexList.append(Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexList.pop())) - elif Item == 0x06: - DepexStack.append(True) - DepexList.append('TRUE') - DepexString = DepexString + 'TRUE' + ' ' - elif Item == 0x07: - DepexStack.append(False) - DepexList.append('False') - DepexString = DepexString + 'FALSE' + ' ' - elif Item == 0x08: - if Index != len(Depex.Expression) - 1: - CouldBeLoaded = False - else: - CouldBeLoaded = DepexStack.pop() - else: - CouldBeLoaded = False - if DepexList != []: - DepexString = DepexList[0].strip() - return (CouldBeLoaded, DepexString, FileDepex) - - def Dispatch(self, Db = None): - if Db == None: - return False - self.UnDispatchedFfsDict = copy.copy(self.FfsDict) - # Find PeiCore, DexCore, PeiPriori, DxePriori first - FfsSecCoreGuid = None - FfsPeiCoreGuid = None - FfsDxeCoreGuid = None - FfsPeiPrioriGuid = None - FfsDxePrioriGuid = None - for FfsID in self.UnDispatchedFfsDict: - Ffs = self.UnDispatchedFfsDict[FfsID] - if Ffs.Type == 0x03: - FfsSecCoreGuid = FfsID - continue - if Ffs.Type == 0x04: - FfsPeiCoreGuid = FfsID - continue - if Ffs.Type == 0x05: - FfsDxeCoreGuid = FfsID - continue - if Ffs.Guid.lower() == gPeiAprioriFileNameGuid: - FfsPeiPrioriGuid = FfsID - continue - if Ffs.Guid.lower() == gAprioriGuid: - FfsDxePrioriGuid = FfsID - continue - - # Parse SEC_CORE first - if FfsSecCoreGuid != None: - self.OrderedFfsDict[FfsSecCoreGuid] = self.UnDispatchedFfsDict.pop(FfsSecCoreGuid) - self.LoadPpi(Db, FfsSecCoreGuid) - - # Parse PEI first - if FfsPeiCoreGuid != None: - self.OrderedFfsDict[FfsPeiCoreGuid] = self.UnDispatchedFfsDict.pop(FfsPeiCoreGuid) - self.LoadPpi(Db, FfsPeiCoreGuid) - if FfsPeiPrioriGuid != None: - # Load PEIM described in priori file - FfsPeiPriori = self.UnDispatchedFfsDict.pop(FfsPeiPrioriGuid) - if len(FfsPeiPriori.Sections) == 1: - Section = FfsPeiPriori.Sections.popitem()[1] - if Section.Type == 0x19: - GuidStruct = struct.Struct('1I2H8B') - Start = 4 - while len(Section) > Start: - Guid = GuidStruct.unpack_from(Section[Start : Start + 16]) - GuidString = gGuidStringFormat % Guid - Start = Start + 16 - if GuidString in self.UnDispatchedFfsDict: - self.OrderedFfsDict[GuidString] = self.UnDispatchedFfsDict.pop(GuidString) - self.LoadPpi(Db, GuidString) - - self.DisPatchPei(Db) - - # Parse DXE then - if FfsDxeCoreGuid != None: - self.OrderedFfsDict[FfsDxeCoreGuid] = self.UnDispatchedFfsDict.pop(FfsDxeCoreGuid) - self.LoadProtocol(Db, FfsDxeCoreGuid) - if FfsDxePrioriGuid != None: - # Load PEIM described in priori file - FfsDxePriori = self.UnDispatchedFfsDict.pop(FfsDxePrioriGuid) - if len(FfsDxePriori.Sections) == 1: - Section = FfsDxePriori.Sections.popitem()[1] - if Section.Type == 0x19: - GuidStruct = struct.Struct('1I2H8B') - Start = 4 - while len(Section) > Start: - Guid = GuidStruct.unpack_from(Section[Start : Start + 16]) - GuidString = gGuidStringFormat % Guid - Start = Start + 16 - if GuidString in self.UnDispatchedFfsDict: - self.OrderedFfsDict[GuidString] = self.UnDispatchedFfsDict.pop(GuidString) - self.LoadProtocol(Db, GuidString) - - self.DisPatchDxe(Db) - - def DisPatchNoDepexFfs(self, Db): - # Last Load Drivers without Depex - for FfsID in self.NoDepexFfsDict: - NewFfs = self.NoDepexFfsDict.pop(FfsID) - self.OrderedFfsDict[FfsID] = NewFfs - self.LoadProtocol(Db, FfsID) - - return True - - def LoadCallbackProtocol(self): - IsLoad = True - for Protocol in self.ProtocolList: - for Callback in self.ProtocolList[Protocol][1]: - if Callback[0] not in self.OrderedFfsDict.keys(): - IsLoad = False - continue - if IsLoad: - EotGlobalData.gProtocolList[Protocol.lower()] = self.ProtocolList[Protocol][0] - self.ProtocolList.pop(Protocol) - - def LoadProtocol(self, Db, ModuleGuid): - SqlCommand = """select GuidValue from Report - where SourceFileFullPath in - (select Value1 from Inf where BelongsToFile = - (select BelongsToFile from Inf - where Value1 = 'FILE_GUID' and Value2 like '%s' and Model = %s) - and Model = %s) - and ItemType = 'Protocol' and ItemMode = 'Produced'""" \ - % (ModuleGuid, 5001, 3007) - RecordSet = Db.TblReport.Exec(SqlCommand) - for Record in RecordSet: - SqlCommand = """select Value2 from Inf where BelongsToFile = - (select DISTINCT BelongsToFile from Inf - where Value1 = - (select SourceFileFullPath from Report - where GuidValue like '%s' and ItemMode = 'Callback')) - and Value1 = 'FILE_GUID'""" % Record[0] - CallBackSet = Db.TblReport.Exec(SqlCommand) - if CallBackSet != []: - EotGlobalData.gProtocolList[Record[0].lower()] = ModuleGuid - else: - EotGlobalData.gProtocolList[Record[0].lower()] = ModuleGuid - - def LoadPpi(self, Db, ModuleGuid): - SqlCommand = """select GuidValue from Report - where SourceFileFullPath in - (select Value1 from Inf where BelongsToFile = - (select BelongsToFile from Inf - where Value1 = 'FILE_GUID' and Value2 like '%s' and Model = %s) - and Model = %s) - and ItemType = 'Ppi' and ItemMode = 'Produced'""" \ - % (ModuleGuid, 5001, 3007) - RecordSet = Db.TblReport.Exec(SqlCommand) - for Record in RecordSet: - EotGlobalData.gPpiList[Record[0].lower()] = ModuleGuid - - def DisPatchDxe(self, Db): - IsInstalled = False - ScheduleList = sdict() - for FfsID in self.UnDispatchedFfsDict: - CouldBeLoaded = False - DepexString = '' - FileDepex = None - Ffs = self.UnDispatchedFfsDict[FfsID] - if Ffs.Type == 0x07: - # Get Depex - IsFoundDepex = False - for Section in Ffs.Sections.values(): - # Find Depex - if Section.Type == 0x13: - IsFoundDepex = True - CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(Section._SubImages[4], 'Protocol') - break - if Section.Type == 0x01: - CompressSections = Section._SubImages[4] - for CompressSection in CompressSections.Sections: - if CompressSection.Type == 0x13: - IsFoundDepex = True - CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(CompressSection._SubImages[4], 'Protocol') - break - if CompressSection.Type == 0x02: - NewSections = CompressSection._SubImages[4] - for NewSection in NewSections.Sections: - if NewSection.Type == 0x13: - IsFoundDepex = True - CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(NewSection._SubImages[4], 'Protocol') - break - - # Not find Depex - if not IsFoundDepex: - CouldBeLoaded = self.CheckArchProtocol() - DepexString = '' - FileDepex = None - - # Append New Ffs - if CouldBeLoaded: - IsInstalled = True - NewFfs = self.UnDispatchedFfsDict.pop(FfsID) - NewFfs.Depex = DepexString - if FileDepex != None: - ScheduleList.insert.insert(FileDepex[1], FfsID, NewFfs, FileDepex[0]) - else: - ScheduleList[FfsID] = NewFfs - else: - self.UnDispatchedFfsDict[FfsID].Depex = DepexString - - for FfsID in ScheduleList: - NewFfs = ScheduleList.pop(FfsID) - FfsName = 'UnKnown' - self.OrderedFfsDict[FfsID] = NewFfs - self.LoadProtocol(Db, FfsID) - - SqlCommand = """select Value2 from Inf - where BelongsToFile = (select BelongsToFile from Inf where Value1 = 'FILE_GUID' and lower(Value2) = lower('%s') and Model = %s) - and Model = %s and Value1='BASE_NAME'""" % (FfsID, 5001, 5001) - RecordSet = Db.TblReport.Exec(SqlCommand) - if RecordSet != []: - FfsName = RecordSet[0][0] - - if IsInstalled: - self.DisPatchDxe(Db) - - def DisPatchPei(self, Db): - IsInstalled = False - for FfsID in self.UnDispatchedFfsDict: - CouldBeLoaded = True - DepexString = '' - FileDepex = None - Ffs = self.UnDispatchedFfsDict[FfsID] - if Ffs.Type == 0x06 or Ffs.Type == 0x08: - # Get Depex - for Section in Ffs.Sections.values(): - if Section.Type == 0x1B: - CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(Section._SubImages[4], 'Ppi') - break - - if Section.Type == 0x01: - CompressSections = Section._SubImages[4] - for CompressSection in CompressSections.Sections: - if CompressSection.Type == 0x1B: - CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(CompressSection._SubImages[4], 'Ppi') - break - if CompressSection.Type == 0x02: - NewSections = CompressSection._SubImages[4] - for NewSection in NewSections.Sections: - if NewSection.Type == 0x1B: - CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(NewSection._SubImages[4], 'Ppi') - break - - # Append New Ffs - if CouldBeLoaded: - IsInstalled = True - NewFfs = self.UnDispatchedFfsDict.pop(FfsID) - NewFfs.Depex = DepexString - self.OrderedFfsDict[FfsID] = NewFfs - self.LoadPpi(Db, FfsID) - else: - self.UnDispatchedFfsDict[FfsID].Depex = DepexString - - if IsInstalled: - self.DisPatchPei(Db) - - - def __str__(self): - global gIndention - gIndention += 4 - FvInfo = '\n' + ' ' * gIndention - FvInfo += "[FV:%s] file_system=%s size=%x checksum=%s\n" % (self.Name, self.FileSystemGuid, self.Size, self.Checksum) - FfsInfo = "\n".join([str(self.FfsDict[FfsId]) for FfsId in self.FfsDict]) - gIndention -= 4 - return FvInfo + FfsInfo - - def _Unpack(self): - Size = self._LENGTH_.unpack_from(self._BUF_, self._OFF_)[0] - self.empty() - self.extend(self._BUF_[self._OFF_:self._OFF_+Size]) - - # traverse the FFS - EndOfFv = Size - FfsStartAddress = self.HeaderSize - LastFfsObj = None - while FfsStartAddress < EndOfFv: - FfsObj = Ffs() - FfsObj.frombuffer(self, FfsStartAddress) - FfsId = repr(FfsObj) - if ((self.Attributes & 0x00000800) != 0 and len(FfsObj) == 0xFFFFFF) \ - or ((self.Attributes & 0x00000800) == 0 and len(FfsObj) == 0): - if LastFfsObj != None: - LastFfsObj.FreeSpace = EndOfFv - LastFfsObj._OFF_ - len(LastFfsObj) - else: - if FfsId in self.FfsDict: - EdkLogger.error("FV", 0, "Duplicate GUID in FFS", - ExtraData="\t%s @ %s\n\t%s @ %s" \ - % (FfsObj.Guid, FfsObj.Offset, - self.FfsDict[FfsId].Guid, self.FfsDict[FfsId].Offset)) - self.FfsDict[FfsId] = FfsObj - if LastFfsObj != None: - LastFfsObj.FreeSpace = FfsStartAddress - LastFfsObj._OFF_ - len(LastFfsObj) - - FfsStartAddress += len(FfsObj) - # - # align to next 8-byte aligned address: A = (A + 8 - 1) & (~(8 - 1)) - # The next FFS must be at the latest next 8-byte aligned address - # - FfsStartAddress = (FfsStartAddress + 7) & (~7) - LastFfsObj = FfsObj - - def _GetAttributes(self): - return self.GetField(self._ATTR_, 0)[0] - - def _GetSize(self): - return self.GetField(self._LENGTH_, 0)[0] - - def _GetChecksum(self): - return self.GetField(self._CHECKSUM_, 0)[0] - - def _GetHeaderLength(self): - return self.GetField(self._HLEN_, 0)[0] - - def _GetFileSystemGuid(self): - return gGuidStringFormat % self.GetField(self._GUID_, 0) - - Attributes = property(_GetAttributes) - Size = property(_GetSize) - Checksum = property(_GetChecksum) - HeaderSize = property(_GetHeaderLength) - FileSystemGuid = property(_GetFileSystemGuid) - -## CompressedImage() class -# -# A class for Compressed Image -# -class CompressedImage(Image): - # UncompressedLength = 4-byte - # CompressionType = 1-byte - _HEADER_ = struct.Struct("1I 1B") - _HEADER_SIZE_ = _HEADER_.size - - _ORIG_SIZE_ = struct.Struct("1I") - _CMPRS_TYPE_ = struct.Struct("4x 1B") - - def __init__(m, CompressedData=None, CompressionType=None, UncompressedLength=None): - Image.__init__(m) - if UncompressedLength != None: - m.UncompressedLength = UncompressedLength - if CompressionType != None: - m.CompressionType = CompressionType - if CompressedData != None: - m.Data = CompressedData - - def __str__(m): - global gIndention - S = "algorithm=%s uncompressed=%x" % (m.CompressionType, m.UncompressedLength) - for Sec in m.Sections: - S += '\n' + str(Sec) - - return S - - def _SetOriginalSize(m, Size): - m.SetField(m._ORIG_SIZE_, 0, Size) - - def _GetOriginalSize(m): - return m.GetField(m._ORIG_SIZE_)[0] - - def _SetCompressionType(m, Type): - m.SetField(m._CMPRS_TYPE_, 0, Type) - - def _GetCompressionType(m): - return m.GetField(m._CMPRS_TYPE_)[0] - - def _GetSections(m): - try: - import EfiCompressor - TmpData = EfiCompressor.FrameworkDecompress( - m[m._HEADER_SIZE_:], - len(m) - m._HEADER_SIZE_ - ) - DecData = array('B') - DecData.fromstring(TmpData) - except: - import EfiCompressor - TmpData = EfiCompressor.UefiDecompress( - m[m._HEADER_SIZE_:], - len(m) - m._HEADER_SIZE_ - ) - DecData = array('B') - DecData.fromstring(TmpData) - - SectionList = [] - Offset = 0 - while Offset < len(DecData): - Sec = Section() - try: - Sec.frombuffer(DecData, Offset) - Offset += Sec.Size - # the section is aligned to 4-byte boundary - except: - break - SectionList.append(Sec) - return SectionList - - UncompressedLength = property(_GetOriginalSize, _SetOriginalSize) - CompressionType = property(_GetCompressionType, _SetCompressionType) - Sections = property(_GetSections) - -## GuidDefinedImage() class -# -# A class for GUID Defined Image -# -class GuidDefinedImage(Image): - _HEADER_ = struct.Struct("1I2H8B 1H 1H") - _HEADER_SIZE_ = _HEADER_.size - - _GUID_ = struct.Struct("1I2H8B") - _DATA_OFFSET_ = struct.Struct("16x 1H") - _ATTR_ = struct.Struct("18x 1H") - - CRC32_GUID = "FC1BCDB0-7D31-49AA-936A-A4600D9DD083" - TIANO_COMPRESS_GUID = 'A31280AD-481E-41B6-95E8-127F4C984779' - LZMA_COMPRESS_GUID = 'EE4E5898-3914-4259-9D6E-DC7BD79403CF' - - def __init__(m, SectionDefinitionGuid=None, DataOffset=None, Attributes=None, Data=None): - Image.__init__(m) - if SectionDefinitionGuid != None: - m.SectionDefinitionGuid = SectionDefinitionGuid - if DataOffset != None: - m.DataOffset = DataOffset - if Attributes != None: - m.Attributes = Attributes - if Data != None: - m.Data = Data - - def __str__(m): - S = "guid=%s" % (gGuidStringFormat % m.SectionDefinitionGuid) - for Sec in m.Sections: - S += "\n" + str(Sec) - return S - - def _Unpack(m): - # keep header in this Image object - m.empty() - m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._LEN_]) - return len(m) - - def _SetAttribute(m, Attribute): - m.SetField(m._ATTR_, 0, Attribute) - - def _GetAttribute(m): - return m.GetField(m._ATTR_)[0] - - def _SetGuid(m, Guid): - m.SetField(m._GUID_, 0, Guid) - - def _GetGuid(m): - return m.GetField(m._GUID_) - - def _SetDataOffset(m, Offset): - m.SetField(m._DATA_OFFSET_, 0, Offset) - - def _GetDataOffset(m): - return m.GetField(m._DATA_OFFSET_)[0] - - def _GetSections(m): - SectionList = [] - Guid = gGuidStringFormat % m.SectionDefinitionGuid - if Guid == m.CRC32_GUID: - # skip the CRC32 value, we don't do CRC32 verification here - Offset = m.DataOffset - 4 - while Offset < len(m): - Sec = Section() - try: - Sec.frombuffer(m, Offset) - Offset += Sec.Size - # the section is aligned to 4-byte boundary - Offset = (Offset + 3) & (~3) - except: - break - SectionList.append(Sec) - elif Guid == m.TIANO_COMPRESS_GUID: - try: - import EfiCompressor - # skip the header - Offset = m.DataOffset - 4 - TmpData = EfiCompressor.FrameworkDecompress(m[Offset:], len(m)-Offset) - DecData = array('B') - DecData.fromstring(TmpData) - Offset = 0 - while Offset < len(DecData): - Sec = Section() - try: - Sec.frombuffer(DecData, Offset) - Offset += Sec.Size - # the section is aligned to 4-byte boundary - Offset = (Offset + 3) & (~3) - except: - break - SectionList.append(Sec) - except: - pass - elif Guid == m.LZMA_COMPRESS_GUID: - try: - import LzmaCompressor - # skip the header - Offset = m.DataOffset - 4 - TmpData = LzmaCompressor.LzmaDecompress(m[Offset:], len(m)-Offset) - DecData = array('B') - DecData.fromstring(TmpData) - Offset = 0 - while Offset < len(DecData): - Sec = Section() - try: - Sec.frombuffer(DecData, Offset) - Offset += Sec.Size - # the section is aligned to 4-byte boundary - Offset = (Offset + 3) & (~3) - except: - break - SectionList.append(Sec) - except: - pass - - return SectionList - - Attributes = property(_GetAttribute, _SetAttribute) - SectionDefinitionGuid = property(_GetGuid, _SetGuid) - DataOffset = property(_GetDataOffset, _SetDataOffset) - Sections = property(_GetSections) - -## Depex() class -# -# A class for Depex -# -class Depex(Image): - _HEADER_ = struct.Struct("") - _HEADER_SIZE_ = 0 - - _GUID_ = struct.Struct("1I2H8B") - _OPCODE_ = struct.Struct("1B") - - _OPCODE_STRING_ = { - 0x00 : "BEFORE", - 0x01 : "AFTER", - 0x02 : "PUSH", - 0x03 : "AND", - 0x04 : "OR", - 0x05 : "NOT", - 0x06 : "TRUE", - 0x07 : "FALSE", - 0x08 : "END", - 0x09 : "SOR" - } - - _NEXT_ = { - -1 : _OPCODE_, # first one in depex must be an opcdoe - 0x00 : _GUID_, #"BEFORE", - 0x01 : _GUID_, #"AFTER", - 0x02 : _GUID_, #"PUSH", - 0x03 : _OPCODE_, #"AND", - 0x04 : _OPCODE_, #"OR", - 0x05 : _OPCODE_, #"NOT", - 0x06 : _OPCODE_, #"TRUE", - 0x07 : _OPCODE_, #"FALSE", - 0x08 : None, #"END", - 0x09 : _OPCODE_, #"SOR" - } - - def __init__(m): - Image.__init__(m) - m._ExprList = [] - - def __str__(m): - global gIndention - gIndention += 4 - Indention = ' ' * gIndention - S = '\n' - for T in m.Expression: - if T in m._OPCODE_STRING_: - S += Indention + m._OPCODE_STRING_[T] - if T not in [0x00, 0x01, 0x02]: - S += '\n' - else: - S += ' ' + gGuidStringFormat % T + '\n' - gIndention -= 4 - return S - - def _Unpack(m): - # keep header in this Image object - m.empty() - m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._LEN_]) - return len(m) - - def _GetExpression(m): - if m._ExprList == []: - Offset = 0 - CurrentData = m._OPCODE_ - while Offset < len(m): - Token = CurrentData.unpack_from(m, Offset) - Offset += CurrentData.size - if len(Token) == 1: - Token = Token[0] - if Token in m._NEXT_: - CurrentData = m._NEXT_[Token] - else: - CurrentData = m._GUID_ - else: - CurrentData = m._OPCODE_ - m._ExprList.append(Token) - if CurrentData == None: - break - return m._ExprList - - Expression = property(_GetExpression) - -## Ui() class -# -# A class for Ui -# -class Ui(Image): - _HEADER_ = struct.Struct("") - _HEADER_SIZE_ = 0 - - def __init__(m): - Image.__init__(m) - - def __str__(m): - return m.String - - def _Unpack(m): - # keep header in this Image object - m.empty() - m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._LEN_]) - return len(m) - - def _GetUiString(m): - return codecs.utf_16_decode(m[0:-2].tostring())[0] - - String = property(_GetUiString) - -## Section() class -# -# A class for Section -# -class Section(Image): - _TypeName = { - 0x00 : "", - 0x01 : "COMPRESSION", - 0x02 : "GUID_DEFINED", - 0x10 : "PE32", - 0x11 : "PIC", - 0x12 : "TE", - 0x13 : "DXE_DEPEX", - 0x14 : "VERSION", - 0x15 : "USER_INTERFACE", - 0x16 : "COMPATIBILITY16", - 0x17 : "FIRMWARE_VOLUME_IMAGE", - 0x18 : "FREEFORM_SUBTYPE_GUID", - 0x19 : "RAW", - 0x1B : "PEI_DEPEX" - } - - _SectionSubImages = { - 0x01 : CompressedImage, - 0x02 : GuidDefinedImage, - 0x17 : FirmwareVolume, - 0x13 : Depex, - 0x1B : Depex, - 0x15 : Ui - } - - # Size = 3-byte - # Type = 1-byte - _HEADER_ = struct.Struct("3B 1B") - _HEADER_SIZE_ = _HEADER_.size - - # SubTypeGuid - # _FREE_FORM_SUBTYPE_GUID_HEADER_ = struct.Struct("1I2H8B") - - _SIZE_ = struct.Struct("3B") - _TYPE_ = struct.Struct("3x 1B") - - def __init__(m, Type=None, Size=None): - Image.__init__(m) - m._Alignment = 1 - if Type != None: - m.Type = Type - if Size != None: - m.Size = Size - - def __str__(m): - global gIndention - gIndention += 4 - SectionInfo = ' ' * gIndention - if m.Type in m._TypeName: - SectionInfo += "[SECTION:%s] offset=%x size=%x" % (m._TypeName[m.Type], m._OFF_, m.Size) - else: - SectionInfo += "[SECTION:%x] offset=%x size=%x " % (m.Type, m._OFF_, m.Size) - for Offset in m._SubImages: - SectionInfo += ", " + str(m._SubImages[Offset]) - gIndention -= 4 - return SectionInfo - - def _Unpack(m): - m.empty() - Type, = m._TYPE_.unpack_from(m._BUF_, m._OFF_) - Size1, Size2, Size3 = m._SIZE_.unpack_from(m._BUF_, m._OFF_) - Size = Size1 + (Size2 << 8) + (Size3 << 16) - - if Type not in m._SectionSubImages: - # no need to extract sub-image, keep all in this Image object - m.extend(m._BUF_[m._OFF_ : m._OFF_ + Size]) - else: - # keep header in this Image object - m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._HEADER_SIZE_]) - # - # use new Image object to represent payload, which may be another kind - # of image such as PE32 - # - PayloadOffset = m._HEADER_SIZE_ - PayloadLen = m.Size - m._HEADER_SIZE_ - Payload = m._SectionSubImages[m.Type]() - Payload.frombuffer(m._BUF_, m._OFF_ + m._HEADER_SIZE_, PayloadLen) - m._SubImages[PayloadOffset] = Payload - - return Size - - def _SetSize(m, Size): - Size1 = Size & 0xFF - Size2 = (Size & 0xFF00) >> 8 - Size3 = (Size & 0xFF0000) >> 16 - m.SetField(m._SIZE_, 0, Size1, Size2, Size3) - - def _GetSize(m): - Size1, Size2, Size3 = m.GetField(m._SIZE_) - return Size1 + (Size2 << 8) + (Size3 << 16) - - def _SetType(m, Type): - m.SetField(m._TYPE_, 0, Type) - - def _GetType(m): - return m.GetField(m._TYPE_)[0] - - def _GetAlignment(m): - return m._Alignment - - def _SetAlignment(m, Alignment): - m._Alignment = Alignment - AlignmentMask = Alignment - 1 - # section alignment is actually for payload, so we need to add header size - PayloadOffset = m._OFF_ + m._HEADER_SIZE_ - if (PayloadOffset & (~AlignmentMask)) == 0: - return - NewOffset = (PayloadOffset + AlignmentMask) & (~AlignmentMask) - while (NewOffset - PayloadOffset) < m._HEADER_SIZE_: - NewOffset += m._Alignment - - def tofile(m, f): - m.Size = len(m) - Image.tofile(m, f) - for Offset in m._SubImages: - m._SubImages[Offset].tofile(f) - - Type = property(_GetType, _SetType) - Size = property(_GetSize, _SetSize) - Alignment = property(_GetAlignment, _SetAlignment) - # SubTypeGuid = property(_GetGuid, _SetGuid) - -## PadSection() class -# -# A class for Pad Section -# -class PadSection(Section): - def __init__(m, Size): - Section.__init__(m) - m.Type = 0x19 - m.Size = Size - m.Data = [0] * (Size - m._HEADER_SIZE_) - -## Ffs() class -# -# A class for Ffs Section -# -class Ffs(Image): - _FfsFormat = "24B%(payload_size)sB" - # skip IntegrityCheck - _HEADER_ = struct.Struct("1I2H8B 2x 1B 1B 3B 1B") - _HEADER_SIZE_ = _HEADER_.size - - _NAME_ = struct.Struct("1I2H8B") - _INT_CHECK_ = struct.Struct("16x 1H") - _TYPE_ = struct.Struct("18x 1B") - _ATTR_ = struct.Struct("19x 1B") - _SIZE_ = struct.Struct("20x 3B") - _STATE_ = struct.Struct("23x 1B") - - VTF_GUID = "1BA0062E-C779-4582-8566-336AE8F78F09" - - FFS_ATTRIB_FIXED = 0x04 - FFS_ATTRIB_DATA_ALIGNMENT = 0x38 - FFS_ATTRIB_CHECKSUM = 0x40 - - _TypeName = { - 0x00 : "", - 0x01 : "RAW", - 0x02 : "FREEFORM", - 0x03 : "SECURITY_CORE", - 0x04 : "PEI_CORE", - 0x05 : "DXE_CORE", - 0x06 : "PEIM", - 0x07 : "DRIVER", - 0x08 : "COMBINED_PEIM_DRIVER", - 0x09 : "APPLICATION", - 0x0A : "SMM", - 0x0B : "FIRMWARE_VOLUME_IMAGE", - 0x0C : "COMBINED_SMM_DXE", - 0x0D : "SMM_CORE", - 0xc0 : "OEM_MIN", - 0xdf : "OEM_MAX", - 0xe0 : "DEBUG_MIN", - 0xef : "DEBUG_MAX", - 0xf0 : "FFS_MIN", - 0xff : "FFS_MAX", - 0xf0 : "FFS_PAD", - } - - def __init__(self): - Image.__init__(self) - self.FreeSpace = 0 - - self.Sections = sdict() - self.Depex = '' - - self.__ID__ = None - - def __str__(self): - global gIndention - gIndention += 4 - Indention = ' ' * gIndention - FfsInfo = Indention - FfsInfo += "[FFS:%s] offset=%x size=%x guid=%s free_space=%x alignment=%s\n" % \ - (Ffs._TypeName[self.Type], self._OFF_, self.Size, self.Guid, self.FreeSpace, self.Alignment) - SectionInfo = '\n'.join([str(self.Sections[Offset]) for Offset in self.Sections]) - gIndention -= 4 - return FfsInfo + SectionInfo + "\n" - - def __len__(self): - return self.Size - - def __repr__(self): - return self.__ID__ - - def _Unpack(self): - Size1, Size2, Size3 = self._SIZE_.unpack_from(self._BUF_, self._OFF_) - Size = Size1 + (Size2 << 8) + (Size3 << 16) - self.empty() - self.extend(self._BUF_[self._OFF_ : self._OFF_ + Size]) - - # Pad FFS may use the same GUID. We need to avoid it. - if self.Type == 0xf0: - self.__ID__ = str(uuid.uuid1()).upper() - else: - self.__ID__ = self.Guid - - # Traverse the SECTION. RAW and PAD do not have sections - if self.Type not in [0xf0, 0x01] and Size > 0 and Size < 0xFFFFFF: - EndOfFfs = Size - SectionStartAddress = self._HEADER_SIZE_ - while SectionStartAddress < EndOfFfs: - SectionObj = Section() - SectionObj.frombuffer(self, SectionStartAddress) - #f = open(repr(SectionObj), 'wb') - #SectionObj.Size = 0 - #SectionObj.tofile(f) - #f.close() - self.Sections[SectionStartAddress] = SectionObj - SectionStartAddress += len(SectionObj) - SectionStartAddress = (SectionStartAddress + 3) & (~3) - - def Pack(self): - pass - - def SetFreeSpace(self, Size): - self.FreeSpace = Size - - def _GetGuid(self): - return gGuidStringFormat % self.Name - - def _SetName(self, Value): - # Guid1, Guid2, Guid3, Guid4, Guid5, Guid6, Guid7, Guid8, Guid9, Guid10, Guid11 - self.SetField(self._NAME_, 0, Value) - - def _GetName(self): - # Guid1, Guid2, Guid3, Guid4, Guid5, Guid6, Guid7, Guid8, Guid9, Guid10, Guid11 - return self.GetField(self._NAME_) - - def _SetSize(m, Size): - Size1 = Size & 0xFF - Size2 = (Size & 0xFF00) >> 8 - Size3 = (Size & 0xFF0000) >> 16 - m.SetField(m._SIZE_, 0, Size1, Size2, Size3) - - def _GetSize(m): - Size1, Size2, Size3 = m.GetField(m._SIZE_) - return Size1 + (Size2 << 8) + (Size3 << 16) - - def _SetType(m, Type): - m.SetField(m._TYPE_, 0, Type) - - def _GetType(m): - return m.GetField(m._TYPE_)[0] - - def _SetAttributes(self, Value): - self.SetField(m._ATTR_, 0, Value) - - def _GetAttributes(self): - return self.GetField(self._ATTR_)[0] - - def _GetFixed(self): - if (self.Attributes & self.FFS_ATTRIB_FIXED) != 0: - return True - return False - - def _GetCheckSum(self): - if (self.Attributes & self.FFS_ATTRIB_CHECKSUM) != 0: - return True - return False - - def _GetAlignment(self): - return (self.Attributes & self.FFS_ATTRIB_DATA_ALIGNMENT) >> 3 - - def _SetState(self, Value): - self.SetField(m._STATE_, 0, Value) - - def _GetState(self): - return self.GetField(m._STATE_)[0] - - Name = property(_GetName, _SetName) - Guid = property(_GetGuid) - Type = property(_GetType, _SetType) - Size = property(_GetSize, _SetSize) - Attributes = property(_GetAttributes, _SetAttributes) - Fixed = property(_GetFixed) - Checksum = property(_GetCheckSum) - Alignment = property(_GetAlignment) - State = property(_GetState, _SetState) - -## PeImage() class -# -# A class for PE Image -# -class PeImage: - # - # just extract e_lfanew - # - _DosHeaderFormat = "60x 1I" - # - # Machine - # NumberOfSections - # SizeOfOptionalHeader - # - _FileHeaderFormat = "4x 1H 1H 4x 4x 4x 1H 2x" - # - # Magic - # SizeOfImage - # SizeOfHeaders - # CheckSum - # NumberOfRvaAndSizes - # - _OptionalHeader32Format = "1H 54x 1I 1I 1I 24x 1I" - _OptionalHeader64Format = "" - def __init__(self, Buf, Offset, Size): - self.Offset = Offset - self.Size = Size - self.Machine = 0x014c # IA32 - self.NumberOfSections = 0 - self.SizeOfImage = 0 - self.SizeOfOptionalHeader = 0 - self.Checksum = 0 - self._PeImageBuf = Buf - self._SectionList = [] - - self._DosHeader = struct.Struct(PeImage._DosHeaderFormat) - self._FileHeader = struct.Struct(PeImage._FileHeaderFormat) - self._OptionalHeader32 = struct.Struct(PeImage._OptionalHeader32Format) - - self.Buffer = None - - self._Unpack() - - def __str__(self): - pass - - def __len__(self): - return self.Size - - def _Unpack(self): - # from DOS header, get the offset of PE header - FileHeaderOffset, = self._DosHeader.unpack_from(self._PeImageBuf, self.Offset) - if FileHeaderOffset < struct.calcsize(self._DosHeaderFormat): - EdkLogger.error("PE+", 0, "Invalid offset of IMAGE_FILE_HEADER: %s" % FileHeaderOffset) - - # from FILE header, get the optional header size - self.Machine, self.NumberOfSections, self.SizeOfOptionalHeader = \ - self._FileHeader.unpack_from(self._PeImageBuf, self.Offset + FileHeaderOffset) - - print "Machine=%x NumberOfSections=%x SizeOfOptionalHeader=%x" % (self.Machine, self.NumberOfSections, self.SizeOfOptionalHeader) - # optional header follows the FILE header - OptionalHeaderOffset = FileHeaderOffset + struct.calcsize(self._FileHeaderFormat) - Magic, self.SizeOfImage, SizeOfHeaders, self.Checksum, NumberOfRvaAndSizes = \ - self._OptionalHeader32.unpack_from(self._PeImageBuf, self.Offset + OptionalHeaderOffset) - print "Magic=%x SizeOfImage=%x SizeOfHeaders=%x, Checksum=%x, NumberOfRvaAndSizes=%x" % (Magic, self.SizeOfImage, SizeOfHeaders, self.Checksum, NumberOfRvaAndSizes) - - PeImageSectionTableOffset = OptionalHeaderOffset + self.SizeOfOptionalHeader - PeSections = PeSectionTable(self._PeImageBuf, self.Offset + PeImageSectionTableOffset, self.NumberOfSections) - - print "%x" % PeSections.GetFileAddress(0x3920) - -## PeSectionTable() class -# -# A class for PE Section Table -# -class PeSectionTable: - def __init__(self, Buf, Offset, NumberOfSections): - self._SectionList = [] - - SectionHeaderOffset = Offset - for TableIndex in range(0, NumberOfSections): - SectionHeader = PeSectionHeader(Buf, SectionHeaderOffset) - self._SectionList.append(SectionHeader) - SectionHeaderOffset += len(SectionHeader) - print SectionHeader - - def GetFileAddress(self, Rva): - for PeSection in self._SectionList: - if Rva in PeSection: - return PeSection[Rva] - -## PeSectionHeader() class -# -# A class for PE Section Header -# -class PeSectionHeader: - # - # VirtualAddress - # SizeOfRawData - # PointerToRawData - # - _HeaderFormat = "12x 1I 1I 1I 16x" - _HeaderLength = struct.calcsize(_HeaderFormat) - - def __init__(self, Buf, Offset): - self.VirtualAddressStart, self.SizeOfRawData, self.PointerToRawData = \ - struct.unpack_from(self._HeaderFormat, Buf, Offset) - self.VirtualAddressEnd = self.VirtualAddressStart + self.SizeOfRawData - 1 - - def __str__(self): - return "VirtualAddress=%x, SizeOfRawData=%x, PointerToRawData=%x" % (self.VirtualAddressStart, self.SizeOfRawData, self.PointerToRawData) - - def __len__(self): - return self._HeaderLength - - def __contains__(self, Rva): - return Rva >= self.VirtualAddressStart and Rva <= self.VirtualAddressEnd - - def __getitem__(self, Rva): - return Rva - self.VirtualAddressStart + self.PointerToRawData - -## LinkMap() class -# -# A class for Link Map -# -class LinkMap: - _StartFlag = { - "MSFT" : re.compile("Address +Publics by Value +Rva\+Base +Lib:Object"), - "GCC" : re.compile("^\.(text|bss|data|edata)"), - } - - _MappingFormat = { - "MSFT" : re.compile("([0-9a-f]+):([0-9a-f]+)\s+_+([0-9A-Za-z]+)\s+([0-9a-f]+)\s+"), - "GCC" : re.compile("^(\.\w)?\s+(0x[0-9a-f]+)\s+_+([0-9A-Za-z]+)"), - } - - def __init__(self, MapFile, MapType="MSFT"): - self.File = MapFile - self.MapType = MapType - self._Globals = {} # global:RVA - - self._Parse() - - def _Parse(self): - MapFile = open(self.File, 'r') - MappingTitle = self._StartFlag[self.MapType] - MappingFormat = self._MappingFormat[self.MapType] - MappingStart = False - try: - for Line in MapFile: - Line = Line.strip() - if not MappingStart: - if MappingTitle.match(Line) != None: - MappingStart = True - continue - ResultList = MappingFormat.findall(Line) - if len(ResultList) == 0 or len(ResultList[0]) != 4: - continue - self._Globals[ResultList[2]] = int(ResultList[3], 16) - EdkLogger.verbose(ResultList[0]) - finally: - MapFile.close() - - def __contains__(self, Var): - return Var in self._Globals - - def __getitem__(self, Var): - if Var not in self._Globals: - return None - return self._Globals[Var] - -## MultipleFv() class -# -# A class for Multiple FV -# -class MultipleFv(FirmwareVolume): - def __init__(self, FvList): - FirmwareVolume.__init__(self) - self.BasicInfo = [] - for FvPath in FvList: - FvName = os.path.splitext(os.path.split(FvPath)[1])[0] - Fd = open(FvPath, 'rb') - Buf = array('B') - try: - Buf.fromfile(Fd, os.path.getsize(FvPath)) - except EOFError: - pass - - Fv = FirmwareVolume(FvName) - Fv.frombuffer(Buf, 0, len(Buf)) - - self.BasicInfo.append([Fv.Name, Fv.FileSystemGuid, Fv.Size]) - self.FfsDict.append(Fv.FfsDict) - -# Version and Copyright -__version_number__ = "0.01" -__version__ = "%prog Version " + __version_number__ -__copyright__ = "Copyright (c) 2008, Intel Corporation. All rights reserved." - -## Parse command line options -# -# Using standard Python module optparse to parse command line option of this tool. -# -# @retval Options A optparse.Values object containing the parsed options -# @retval InputFile Path of file to be trimmed -# -def GetOptions(): - OptionList = [ - make_option("-a", "--arch", dest="Arch", - help="The input file is preprocessed source code, including C or assembly code"), - make_option("-p", "--platform", dest="ActivePlatform", - help="The input file is preprocessed VFR file"), - make_option("-m", "--module", dest="ActiveModule", - help="Convert standard hex format (0xabcd) to MASM format (abcdh)"), - make_option("-f", "--FDF-file", dest="FdfFile", - help="Convert standard hex format (0xabcd) to MASM format (abcdh)"), - make_option("-o", "--output", dest="OutputDirectory", - help="File to store the trimmed content"), - make_option("-t", "--toolchain-tag", dest="ToolChain", - help=""), - make_option("-k", "--msft", dest="MakefileType", action="store_const", const="nmake", - help=""), - make_option("-g", "--gcc", dest="MakefileType", action="store_const", const="gmake", - help=""), - make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE, - help="Run verbosely"), - make_option("-d", "--debug", dest="LogLevel", type="int", - help="Run with debug information"), - make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET, - help="Run quietly"), - make_option("-?", action="help", help="show this help message and exit"), - ] - - # use clearer usage to override default usage message - UsageString = "%prog [-a ARCH] [-p PLATFORM] [-m MODULE] [-t TOOLCHAIN_TAG] [-k] [-g] [-v|-d |-q] [-o ] [GenC|GenMake]" - - Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString) - Parser.set_defaults(Arch=[]) - Parser.set_defaults(ActivePlatform=None) - Parser.set_defaults(ActiveModule=None) - Parser.set_defaults(OutputDirectory="build") - Parser.set_defaults(FdfFile=None) - Parser.set_defaults(ToolChain="MYTOOLS") - if sys.platform == "win32": - Parser.set_defaults(MakefileType="nmake") - else: - Parser.set_defaults(MakefileType="gmake") - Parser.set_defaults(LogLevel=EdkLogger.INFO) - - Options, Args = Parser.parse_args() - - # error check - if len(Args) == 0: - Options.Target = "genmake" - sys.argv.append("genmake") - elif len(Args) == 1: - Options.Target = Args[0].lower() - if Options.Target not in ["genc", "genmake"]: - EdkLogger.error("AutoGen", OPTION_NOT_SUPPORTED, "Not supported target", - ExtraData="%s\n\n%s" % (Options.Target, Parser.get_usage())) - else: - EdkLogger.error("AutoGen", OPTION_NOT_SUPPORTED, "Too many targets", - ExtraData=Parser.get_usage()) - - return Options - -## Entrance method -# -# This method mainly dispatch specific methods per the command line options. -# If no error found, return zero value so the caller of this tool can know -# if it's executed successfully or not. -# -# @retval 0 Tool was successful -# @retval 1 Tool failed -# -def Main(): - from build import build - try: - Option = GetOptions() - build.main() - except Exception, e: - print e - return 1 - - return 0 - -# This acts like the main() function for the script, unless it is 'import'ed into another script. -if __name__ == '__main__': - EdkLogger.Initialize() - # sys.exit(Main()) - - if len(sys.argv) > 1: - FilePath = sys.argv[1] - if FilePath.lower().endswith(".fv"): - fd = open(FilePath, 'rb') - buf = array('B') - try: - buf.fromfile(fd, os.path.getsize(FilePath)) - except EOFError: - pass - - fv = FirmwareVolume("FVRECOVERY") - fv.frombuffer(buf, 0, len(buf)) - #fv.Dispatch(None) - print fv - elif FilePath.endswith(".efi"): - fd = open(FilePath, 'rb') - buf = array('B') - Size = os.path.getsize(FilePath) - - try: - buf.fromfile(fd, Size) - except EOFError: - pass - - PeSection = Section(Type=0x10) - PeSection.Data = buf - sf, ext = os.path.splitext(os.path.basename(FilePath)) - sf += ".sec" - PeSection.tofile(open(sf, 'wb')) - elif FilePath.endswith(".map"): - mf = LinkMap(FilePath) +## @file +# Parse FV image +# +# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## Import Modules +# +import os +import re +import sys +import uuid +import struct +import codecs +import copy + +from UserDict import IterableUserDict +from cStringIO import StringIO +from array import array + +from CommonDataClass import * +from Common.Misc import sdict, GuidStructureStringToGuidString + +import Common.EdkLogger as EdkLogger + +import EotGlobalData + +# Global definiton +gFfsPrintTitle = "%-36s %-21s %8s %8s %8s %-4s %-36s" % ("GUID", "TYPE", "OFFSET", "SIZE", "FREE", "ALIGN", "NAME") +gFfsPrintFormat = "%36s %-21s %8X %8X %8X %4s %-36s" +gGuidStringFormat = "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X" +gPeiAprioriFileNameGuid = '1b45cc0a-156a-428a-af62-49864da0e6e6' +gAprioriGuid = 'fc510ee7-ffdc-11d4-bd41-0080c73c8881' +gIndention = -4 + +## Image() class +# +# A class for Image +# +class Image(array): + _HEADER_ = struct.Struct("") + _HEADER_SIZE_ = _HEADER_.size + + def __new__(cls, *args, **kwargs): + return array.__new__(cls, 'B') + + def __init__(m, ID=None): + if ID == None: + m._ID_ = str(uuid.uuid1()).upper() + else: + m._ID_ = ID + m._BUF_ = None + m._LEN_ = None + m._OFF_ = None + + m._SubImages = sdict() # {offset: Image()} + + array.__init__(m, 'B') + + def __repr__(m): + return m._ID_ + + def __len__(m): + Len = array.__len__(m) + for Offset in m._SubImages: + Len += len(m._SubImages[Offset]) + return Len + + def _Unpack(m): + m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._LEN_]) + return len(m) + + def _Pack(m, PadByte=0xFF): + raise NotImplementedError + + def frombuffer(m, Buffer, Offset=0, Size=None): + m._BUF_ = Buffer + m._OFF_ = Offset + # we may need the Size information in advance if it's given + m._LEN_ = Size + m._LEN_ = m._Unpack() + + def empty(m): + del m[0:] + + def GetField(m, FieldStruct, Offset=0): + return FieldStruct.unpack_from(m, Offset) + + def SetField(m, FieldStruct, Offset, *args): + # check if there's enough space + Size = FieldStruct.size + if Size > len(m): + m.extend([0] * (Size - len(m))) + FieldStruct.pack_into(m, Offset, *args) + + def _SetData(m, Data): + if len(m) < m._HEADER_SIZE_: + m.extend([0] * (m._HEADER_SIZE_ - len(m))) + else: + del m[m._HEADER_SIZE_:] + m.extend(Data) + + def _GetData(m): + if len(m) > m._HEADER_SIZE_: + return m[m._HEADER_SIZE_:] + return None + + Data = property(_GetData, _SetData) + +## FirmwareVolume() class +# +# A class for Firmware Volume +# +class FirmwareVolume(Image): + # Read FvLength, Attributes, HeaderLength, Checksum + _HEADER_ = struct.Struct("16x 1I2H8B 1Q 4x 1I 1H 1H") + _HEADER_SIZE_ = _HEADER_.size + + _FfsGuid = "8C8CE578-8A3D-4F1C-9935-896185C32DD3" + + _GUID_ = struct.Struct("16x 1I2H8B") + _LENGTH_ = struct.Struct("16x 16x 1Q") + _SIG_ = struct.Struct("16x 16x 8x 1I") + _ATTR_ = struct.Struct("16x 16x 8x 4x 1I") + _HLEN_ = struct.Struct("16x 16x 8x 4x 4x 1H") + _CHECKSUM_ = struct.Struct("16x 16x 8x 4x 4x 2x 1H") + + def __init__(self, Name=''): + Image.__init__(self) + self.Name = Name + self.FfsDict = sdict() + self.OrderedFfsDict = sdict() + self.UnDispatchedFfsDict = sdict() + self.NoDepexFfsDict = sdict() + self.ProtocolList = sdict() + + def CheckArchProtocol(self): + for Item in EotGlobalData.gArchProtocolGuids: + if Item.lower() not in EotGlobalData.gProtocolList: + + return False + + return True + + def ParseDepex(self, Depex, Type): + List = None + if Type == 'Ppi': + List = EotGlobalData.gPpiList + if Type == 'Protocol': + List = EotGlobalData.gProtocolList + DepexStack = [] + DepexList = [] + DepexString = '' + FileDepex = None + CouldBeLoaded = True + for Index in range(0, len(Depex.Expression)): + Item = Depex.Expression[Index] + if Item == 0x00: + Index = Index + 1 + Guid = gGuidStringFormat % Depex.Expression[Index] + if Guid in self.OrderedFfsDict and Depex.Expression[Index + 1] == 0x08: + return (True, 'BEFORE %s' % Guid, [Guid, 'BEFORE']) + elif Item == 0x01: + Index = Index + 1 + Guid = gGuidStringFormat % Depex.Expression[Index] + if Guid in self.OrderedFfsDict and Depex.Expression[Index + 1] == 0x08: + return (True, 'AFTER %s' % Guid, [Guid, 'AFTER']) + elif Item == 0x02: + Index = Index + 1 + Guid = gGuidStringFormat % Depex.Expression[Index] + if Guid.lower() in List: + DepexStack.append(True) + DepexList.append(Guid) + else: + DepexStack.append(False) + DepexList.append(Guid) + continue + elif Item == 0x03 or Item == 0x04: + DepexStack.append(eval(str(DepexStack.pop()) + ' ' + Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexStack.pop()))) + DepexList.append(str(DepexList.pop()) + ' ' + Depex._OPCODE_STRING_[Item].upper() + ' ' + str(DepexList.pop())) + elif Item == 0x05: + DepexStack.append(eval(Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexStack.pop()))) + DepexList.append(Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexList.pop())) + elif Item == 0x06: + DepexStack.append(True) + DepexList.append('TRUE') + DepexString = DepexString + 'TRUE' + ' ' + elif Item == 0x07: + DepexStack.append(False) + DepexList.append('False') + DepexString = DepexString + 'FALSE' + ' ' + elif Item == 0x08: + if Index != len(Depex.Expression) - 1: + CouldBeLoaded = False + else: + CouldBeLoaded = DepexStack.pop() + else: + CouldBeLoaded = False + if DepexList != []: + DepexString = DepexList[0].strip() + return (CouldBeLoaded, DepexString, FileDepex) + + def Dispatch(self, Db = None): + if Db == None: + return False + self.UnDispatchedFfsDict = copy.copy(self.FfsDict) + # Find PeiCore, DexCore, PeiPriori, DxePriori first + FfsSecCoreGuid = None + FfsPeiCoreGuid = None + FfsDxeCoreGuid = None + FfsPeiPrioriGuid = None + FfsDxePrioriGuid = None + for FfsID in self.UnDispatchedFfsDict: + Ffs = self.UnDispatchedFfsDict[FfsID] + if Ffs.Type == 0x03: + FfsSecCoreGuid = FfsID + continue + if Ffs.Type == 0x04: + FfsPeiCoreGuid = FfsID + continue + if Ffs.Type == 0x05: + FfsDxeCoreGuid = FfsID + continue + if Ffs.Guid.lower() == gPeiAprioriFileNameGuid: + FfsPeiPrioriGuid = FfsID + continue + if Ffs.Guid.lower() == gAprioriGuid: + FfsDxePrioriGuid = FfsID + continue + + # Parse SEC_CORE first + if FfsSecCoreGuid != None: + self.OrderedFfsDict[FfsSecCoreGuid] = self.UnDispatchedFfsDict.pop(FfsSecCoreGuid) + self.LoadPpi(Db, FfsSecCoreGuid) + + # Parse PEI first + if FfsPeiCoreGuid != None: + self.OrderedFfsDict[FfsPeiCoreGuid] = self.UnDispatchedFfsDict.pop(FfsPeiCoreGuid) + self.LoadPpi(Db, FfsPeiCoreGuid) + if FfsPeiPrioriGuid != None: + # Load PEIM described in priori file + FfsPeiPriori = self.UnDispatchedFfsDict.pop(FfsPeiPrioriGuid) + if len(FfsPeiPriori.Sections) == 1: + Section = FfsPeiPriori.Sections.popitem()[1] + if Section.Type == 0x19: + GuidStruct = struct.Struct('1I2H8B') + Start = 4 + while len(Section) > Start: + Guid = GuidStruct.unpack_from(Section[Start : Start + 16]) + GuidString = gGuidStringFormat % Guid + Start = Start + 16 + if GuidString in self.UnDispatchedFfsDict: + self.OrderedFfsDict[GuidString] = self.UnDispatchedFfsDict.pop(GuidString) + self.LoadPpi(Db, GuidString) + + self.DisPatchPei(Db) + + # Parse DXE then + if FfsDxeCoreGuid != None: + self.OrderedFfsDict[FfsDxeCoreGuid] = self.UnDispatchedFfsDict.pop(FfsDxeCoreGuid) + self.LoadProtocol(Db, FfsDxeCoreGuid) + if FfsDxePrioriGuid != None: + # Load PEIM described in priori file + FfsDxePriori = self.UnDispatchedFfsDict.pop(FfsDxePrioriGuid) + if len(FfsDxePriori.Sections) == 1: + Section = FfsDxePriori.Sections.popitem()[1] + if Section.Type == 0x19: + GuidStruct = struct.Struct('1I2H8B') + Start = 4 + while len(Section) > Start: + Guid = GuidStruct.unpack_from(Section[Start : Start + 16]) + GuidString = gGuidStringFormat % Guid + Start = Start + 16 + if GuidString in self.UnDispatchedFfsDict: + self.OrderedFfsDict[GuidString] = self.UnDispatchedFfsDict.pop(GuidString) + self.LoadProtocol(Db, GuidString) + + self.DisPatchDxe(Db) + + def DisPatchNoDepexFfs(self, Db): + # Last Load Drivers without Depex + for FfsID in self.NoDepexFfsDict: + NewFfs = self.NoDepexFfsDict.pop(FfsID) + self.OrderedFfsDict[FfsID] = NewFfs + self.LoadProtocol(Db, FfsID) + + return True + + def LoadCallbackProtocol(self): + IsLoad = True + for Protocol in self.ProtocolList: + for Callback in self.ProtocolList[Protocol][1]: + if Callback[0] not in self.OrderedFfsDict.keys(): + IsLoad = False + continue + if IsLoad: + EotGlobalData.gProtocolList[Protocol.lower()] = self.ProtocolList[Protocol][0] + self.ProtocolList.pop(Protocol) + + def LoadProtocol(self, Db, ModuleGuid): + SqlCommand = """select GuidValue from Report + where SourceFileFullPath in + (select Value1 from Inf where BelongsToFile = + (select BelongsToFile from Inf + where Value1 = 'FILE_GUID' and Value2 like '%s' and Model = %s) + and Model = %s) + and ItemType = 'Protocol' and ItemMode = 'Produced'""" \ + % (ModuleGuid, 5001, 3007) + RecordSet = Db.TblReport.Exec(SqlCommand) + for Record in RecordSet: + SqlCommand = """select Value2 from Inf where BelongsToFile = + (select DISTINCT BelongsToFile from Inf + where Value1 = + (select SourceFileFullPath from Report + where GuidValue like '%s' and ItemMode = 'Callback')) + and Value1 = 'FILE_GUID'""" % Record[0] + CallBackSet = Db.TblReport.Exec(SqlCommand) + if CallBackSet != []: + EotGlobalData.gProtocolList[Record[0].lower()] = ModuleGuid + else: + EotGlobalData.gProtocolList[Record[0].lower()] = ModuleGuid + + def LoadPpi(self, Db, ModuleGuid): + SqlCommand = """select GuidValue from Report + where SourceFileFullPath in + (select Value1 from Inf where BelongsToFile = + (select BelongsToFile from Inf + where Value1 = 'FILE_GUID' and Value2 like '%s' and Model = %s) + and Model = %s) + and ItemType = 'Ppi' and ItemMode = 'Produced'""" \ + % (ModuleGuid, 5001, 3007) + RecordSet = Db.TblReport.Exec(SqlCommand) + for Record in RecordSet: + EotGlobalData.gPpiList[Record[0].lower()] = ModuleGuid + + def DisPatchDxe(self, Db): + IsInstalled = False + ScheduleList = sdict() + for FfsID in self.UnDispatchedFfsDict: + CouldBeLoaded = False + DepexString = '' + FileDepex = None + Ffs = self.UnDispatchedFfsDict[FfsID] + if Ffs.Type == 0x07: + # Get Depex + IsFoundDepex = False + for Section in Ffs.Sections.values(): + # Find Depex + if Section.Type == 0x13: + IsFoundDepex = True + CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(Section._SubImages[4], 'Protocol') + break + if Section.Type == 0x01: + CompressSections = Section._SubImages[4] + for CompressSection in CompressSections.Sections: + if CompressSection.Type == 0x13: + IsFoundDepex = True + CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(CompressSection._SubImages[4], 'Protocol') + break + if CompressSection.Type == 0x02: + NewSections = CompressSection._SubImages[4] + for NewSection in NewSections.Sections: + if NewSection.Type == 0x13: + IsFoundDepex = True + CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(NewSection._SubImages[4], 'Protocol') + break + + # Not find Depex + if not IsFoundDepex: + CouldBeLoaded = self.CheckArchProtocol() + DepexString = '' + FileDepex = None + + # Append New Ffs + if CouldBeLoaded: + IsInstalled = True + NewFfs = self.UnDispatchedFfsDict.pop(FfsID) + NewFfs.Depex = DepexString + if FileDepex != None: + ScheduleList.insert.insert(FileDepex[1], FfsID, NewFfs, FileDepex[0]) + else: + ScheduleList[FfsID] = NewFfs + else: + self.UnDispatchedFfsDict[FfsID].Depex = DepexString + + for FfsID in ScheduleList: + NewFfs = ScheduleList.pop(FfsID) + FfsName = 'UnKnown' + self.OrderedFfsDict[FfsID] = NewFfs + self.LoadProtocol(Db, FfsID) + + SqlCommand = """select Value2 from Inf + where BelongsToFile = (select BelongsToFile from Inf where Value1 = 'FILE_GUID' and lower(Value2) = lower('%s') and Model = %s) + and Model = %s and Value1='BASE_NAME'""" % (FfsID, 5001, 5001) + RecordSet = Db.TblReport.Exec(SqlCommand) + if RecordSet != []: + FfsName = RecordSet[0][0] + + if IsInstalled: + self.DisPatchDxe(Db) + + def DisPatchPei(self, Db): + IsInstalled = False + for FfsID in self.UnDispatchedFfsDict: + CouldBeLoaded = True + DepexString = '' + FileDepex = None + Ffs = self.UnDispatchedFfsDict[FfsID] + if Ffs.Type == 0x06 or Ffs.Type == 0x08: + # Get Depex + for Section in Ffs.Sections.values(): + if Section.Type == 0x1B: + CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(Section._SubImages[4], 'Ppi') + break + + if Section.Type == 0x01: + CompressSections = Section._SubImages[4] + for CompressSection in CompressSections.Sections: + if CompressSection.Type == 0x1B: + CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(CompressSection._SubImages[4], 'Ppi') + break + if CompressSection.Type == 0x02: + NewSections = CompressSection._SubImages[4] + for NewSection in NewSections.Sections: + if NewSection.Type == 0x1B: + CouldBeLoaded, DepexString, FileDepex = self.ParseDepex(NewSection._SubImages[4], 'Ppi') + break + + # Append New Ffs + if CouldBeLoaded: + IsInstalled = True + NewFfs = self.UnDispatchedFfsDict.pop(FfsID) + NewFfs.Depex = DepexString + self.OrderedFfsDict[FfsID] = NewFfs + self.LoadPpi(Db, FfsID) + else: + self.UnDispatchedFfsDict[FfsID].Depex = DepexString + + if IsInstalled: + self.DisPatchPei(Db) + + + def __str__(self): + global gIndention + gIndention += 4 + FvInfo = '\n' + ' ' * gIndention + FvInfo += "[FV:%s] file_system=%s size=%x checksum=%s\n" % (self.Name, self.FileSystemGuid, self.Size, self.Checksum) + FfsInfo = "\n".join([str(self.FfsDict[FfsId]) for FfsId in self.FfsDict]) + gIndention -= 4 + return FvInfo + FfsInfo + + def _Unpack(self): + Size = self._LENGTH_.unpack_from(self._BUF_, self._OFF_)[0] + self.empty() + self.extend(self._BUF_[self._OFF_:self._OFF_+Size]) + + # traverse the FFS + EndOfFv = Size + FfsStartAddress = self.HeaderSize + LastFfsObj = None + while FfsStartAddress < EndOfFv: + FfsObj = Ffs() + FfsObj.frombuffer(self, FfsStartAddress) + FfsId = repr(FfsObj) + if ((self.Attributes & 0x00000800) != 0 and len(FfsObj) == 0xFFFFFF) \ + or ((self.Attributes & 0x00000800) == 0 and len(FfsObj) == 0): + if LastFfsObj != None: + LastFfsObj.FreeSpace = EndOfFv - LastFfsObj._OFF_ - len(LastFfsObj) + else: + if FfsId in self.FfsDict: + EdkLogger.error("FV", 0, "Duplicate GUID in FFS", + ExtraData="\t%s @ %s\n\t%s @ %s" \ + % (FfsObj.Guid, FfsObj.Offset, + self.FfsDict[FfsId].Guid, self.FfsDict[FfsId].Offset)) + self.FfsDict[FfsId] = FfsObj + if LastFfsObj != None: + LastFfsObj.FreeSpace = FfsStartAddress - LastFfsObj._OFF_ - len(LastFfsObj) + + FfsStartAddress += len(FfsObj) + # + # align to next 8-byte aligned address: A = (A + 8 - 1) & (~(8 - 1)) + # The next FFS must be at the latest next 8-byte aligned address + # + FfsStartAddress = (FfsStartAddress + 7) & (~7) + LastFfsObj = FfsObj + + def _GetAttributes(self): + return self.GetField(self._ATTR_, 0)[0] + + def _GetSize(self): + return self.GetField(self._LENGTH_, 0)[0] + + def _GetChecksum(self): + return self.GetField(self._CHECKSUM_, 0)[0] + + def _GetHeaderLength(self): + return self.GetField(self._HLEN_, 0)[0] + + def _GetFileSystemGuid(self): + return gGuidStringFormat % self.GetField(self._GUID_, 0) + + Attributes = property(_GetAttributes) + Size = property(_GetSize) + Checksum = property(_GetChecksum) + HeaderSize = property(_GetHeaderLength) + FileSystemGuid = property(_GetFileSystemGuid) + +## CompressedImage() class +# +# A class for Compressed Image +# +class CompressedImage(Image): + # UncompressedLength = 4-byte + # CompressionType = 1-byte + _HEADER_ = struct.Struct("1I 1B") + _HEADER_SIZE_ = _HEADER_.size + + _ORIG_SIZE_ = struct.Struct("1I") + _CMPRS_TYPE_ = struct.Struct("4x 1B") + + def __init__(m, CompressedData=None, CompressionType=None, UncompressedLength=None): + Image.__init__(m) + if UncompressedLength != None: + m.UncompressedLength = UncompressedLength + if CompressionType != None: + m.CompressionType = CompressionType + if CompressedData != None: + m.Data = CompressedData + + def __str__(m): + global gIndention + S = "algorithm=%s uncompressed=%x" % (m.CompressionType, m.UncompressedLength) + for Sec in m.Sections: + S += '\n' + str(Sec) + + return S + + def _SetOriginalSize(m, Size): + m.SetField(m._ORIG_SIZE_, 0, Size) + + def _GetOriginalSize(m): + return m.GetField(m._ORIG_SIZE_)[0] + + def _SetCompressionType(m, Type): + m.SetField(m._CMPRS_TYPE_, 0, Type) + + def _GetCompressionType(m): + return m.GetField(m._CMPRS_TYPE_)[0] + + def _GetSections(m): + try: + import EfiCompressor + TmpData = EfiCompressor.FrameworkDecompress( + m[m._HEADER_SIZE_:], + len(m) - m._HEADER_SIZE_ + ) + DecData = array('B') + DecData.fromstring(TmpData) + except: + import EfiCompressor + TmpData = EfiCompressor.UefiDecompress( + m[m._HEADER_SIZE_:], + len(m) - m._HEADER_SIZE_ + ) + DecData = array('B') + DecData.fromstring(TmpData) + + SectionList = [] + Offset = 0 + while Offset < len(DecData): + Sec = Section() + try: + Sec.frombuffer(DecData, Offset) + Offset += Sec.Size + # the section is aligned to 4-byte boundary + except: + break + SectionList.append(Sec) + return SectionList + + UncompressedLength = property(_GetOriginalSize, _SetOriginalSize) + CompressionType = property(_GetCompressionType, _SetCompressionType) + Sections = property(_GetSections) + +## GuidDefinedImage() class +# +# A class for GUID Defined Image +# +class GuidDefinedImage(Image): + _HEADER_ = struct.Struct("1I2H8B 1H 1H") + _HEADER_SIZE_ = _HEADER_.size + + _GUID_ = struct.Struct("1I2H8B") + _DATA_OFFSET_ = struct.Struct("16x 1H") + _ATTR_ = struct.Struct("18x 1H") + + CRC32_GUID = "FC1BCDB0-7D31-49AA-936A-A4600D9DD083" + TIANO_COMPRESS_GUID = 'A31280AD-481E-41B6-95E8-127F4C984779' + LZMA_COMPRESS_GUID = 'EE4E5898-3914-4259-9D6E-DC7BD79403CF' + + def __init__(m, SectionDefinitionGuid=None, DataOffset=None, Attributes=None, Data=None): + Image.__init__(m) + if SectionDefinitionGuid != None: + m.SectionDefinitionGuid = SectionDefinitionGuid + if DataOffset != None: + m.DataOffset = DataOffset + if Attributes != None: + m.Attributes = Attributes + if Data != None: + m.Data = Data + + def __str__(m): + S = "guid=%s" % (gGuidStringFormat % m.SectionDefinitionGuid) + for Sec in m.Sections: + S += "\n" + str(Sec) + return S + + def _Unpack(m): + # keep header in this Image object + m.empty() + m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._LEN_]) + return len(m) + + def _SetAttribute(m, Attribute): + m.SetField(m._ATTR_, 0, Attribute) + + def _GetAttribute(m): + return m.GetField(m._ATTR_)[0] + + def _SetGuid(m, Guid): + m.SetField(m._GUID_, 0, Guid) + + def _GetGuid(m): + return m.GetField(m._GUID_) + + def _SetDataOffset(m, Offset): + m.SetField(m._DATA_OFFSET_, 0, Offset) + + def _GetDataOffset(m): + return m.GetField(m._DATA_OFFSET_)[0] + + def _GetSections(m): + SectionList = [] + Guid = gGuidStringFormat % m.SectionDefinitionGuid + if Guid == m.CRC32_GUID: + # skip the CRC32 value, we don't do CRC32 verification here + Offset = m.DataOffset - 4 + while Offset < len(m): + Sec = Section() + try: + Sec.frombuffer(m, Offset) + Offset += Sec.Size + # the section is aligned to 4-byte boundary + Offset = (Offset + 3) & (~3) + except: + break + SectionList.append(Sec) + elif Guid == m.TIANO_COMPRESS_GUID: + try: + import EfiCompressor + # skip the header + Offset = m.DataOffset - 4 + TmpData = EfiCompressor.FrameworkDecompress(m[Offset:], len(m)-Offset) + DecData = array('B') + DecData.fromstring(TmpData) + Offset = 0 + while Offset < len(DecData): + Sec = Section() + try: + Sec.frombuffer(DecData, Offset) + Offset += Sec.Size + # the section is aligned to 4-byte boundary + Offset = (Offset + 3) & (~3) + except: + break + SectionList.append(Sec) + except: + pass + elif Guid == m.LZMA_COMPRESS_GUID: + try: + import LzmaCompressor + # skip the header + Offset = m.DataOffset - 4 + TmpData = LzmaCompressor.LzmaDecompress(m[Offset:], len(m)-Offset) + DecData = array('B') + DecData.fromstring(TmpData) + Offset = 0 + while Offset < len(DecData): + Sec = Section() + try: + Sec.frombuffer(DecData, Offset) + Offset += Sec.Size + # the section is aligned to 4-byte boundary + Offset = (Offset + 3) & (~3) + except: + break + SectionList.append(Sec) + except: + pass + + return SectionList + + Attributes = property(_GetAttribute, _SetAttribute) + SectionDefinitionGuid = property(_GetGuid, _SetGuid) + DataOffset = property(_GetDataOffset, _SetDataOffset) + Sections = property(_GetSections) + +## Depex() class +# +# A class for Depex +# +class Depex(Image): + _HEADER_ = struct.Struct("") + _HEADER_SIZE_ = 0 + + _GUID_ = struct.Struct("1I2H8B") + _OPCODE_ = struct.Struct("1B") + + _OPCODE_STRING_ = { + 0x00 : "BEFORE", + 0x01 : "AFTER", + 0x02 : "PUSH", + 0x03 : "AND", + 0x04 : "OR", + 0x05 : "NOT", + 0x06 : "TRUE", + 0x07 : "FALSE", + 0x08 : "END", + 0x09 : "SOR" + } + + _NEXT_ = { + -1 : _OPCODE_, # first one in depex must be an opcdoe + 0x00 : _GUID_, #"BEFORE", + 0x01 : _GUID_, #"AFTER", + 0x02 : _GUID_, #"PUSH", + 0x03 : _OPCODE_, #"AND", + 0x04 : _OPCODE_, #"OR", + 0x05 : _OPCODE_, #"NOT", + 0x06 : _OPCODE_, #"TRUE", + 0x07 : _OPCODE_, #"FALSE", + 0x08 : None, #"END", + 0x09 : _OPCODE_, #"SOR" + } + + def __init__(m): + Image.__init__(m) + m._ExprList = [] + + def __str__(m): + global gIndention + gIndention += 4 + Indention = ' ' * gIndention + S = '\n' + for T in m.Expression: + if T in m._OPCODE_STRING_: + S += Indention + m._OPCODE_STRING_[T] + if T not in [0x00, 0x01, 0x02]: + S += '\n' + else: + S += ' ' + gGuidStringFormat % T + '\n' + gIndention -= 4 + return S + + def _Unpack(m): + # keep header in this Image object + m.empty() + m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._LEN_]) + return len(m) + + def _GetExpression(m): + if m._ExprList == []: + Offset = 0 + CurrentData = m._OPCODE_ + while Offset < len(m): + Token = CurrentData.unpack_from(m, Offset) + Offset += CurrentData.size + if len(Token) == 1: + Token = Token[0] + if Token in m._NEXT_: + CurrentData = m._NEXT_[Token] + else: + CurrentData = m._GUID_ + else: + CurrentData = m._OPCODE_ + m._ExprList.append(Token) + if CurrentData == None: + break + return m._ExprList + + Expression = property(_GetExpression) + +## Ui() class +# +# A class for Ui +# +class Ui(Image): + _HEADER_ = struct.Struct("") + _HEADER_SIZE_ = 0 + + def __init__(m): + Image.__init__(m) + + def __str__(m): + return m.String + + def _Unpack(m): + # keep header in this Image object + m.empty() + m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._LEN_]) + return len(m) + + def _GetUiString(m): + return codecs.utf_16_decode(m[0:-2].tostring())[0] + + String = property(_GetUiString) + +## Section() class +# +# A class for Section +# +class Section(Image): + _TypeName = { + 0x00 : "", + 0x01 : "COMPRESSION", + 0x02 : "GUID_DEFINED", + 0x10 : "PE32", + 0x11 : "PIC", + 0x12 : "TE", + 0x13 : "DXE_DEPEX", + 0x14 : "VERSION", + 0x15 : "USER_INTERFACE", + 0x16 : "COMPATIBILITY16", + 0x17 : "FIRMWARE_VOLUME_IMAGE", + 0x18 : "FREEFORM_SUBTYPE_GUID", + 0x19 : "RAW", + 0x1B : "PEI_DEPEX" + } + + _SectionSubImages = { + 0x01 : CompressedImage, + 0x02 : GuidDefinedImage, + 0x17 : FirmwareVolume, + 0x13 : Depex, + 0x1B : Depex, + 0x15 : Ui + } + + # Size = 3-byte + # Type = 1-byte + _HEADER_ = struct.Struct("3B 1B") + _HEADER_SIZE_ = _HEADER_.size + + # SubTypeGuid + # _FREE_FORM_SUBTYPE_GUID_HEADER_ = struct.Struct("1I2H8B") + + _SIZE_ = struct.Struct("3B") + _TYPE_ = struct.Struct("3x 1B") + + def __init__(m, Type=None, Size=None): + Image.__init__(m) + m._Alignment = 1 + if Type != None: + m.Type = Type + if Size != None: + m.Size = Size + + def __str__(m): + global gIndention + gIndention += 4 + SectionInfo = ' ' * gIndention + if m.Type in m._TypeName: + SectionInfo += "[SECTION:%s] offset=%x size=%x" % (m._TypeName[m.Type], m._OFF_, m.Size) + else: + SectionInfo += "[SECTION:%x] offset=%x size=%x " % (m.Type, m._OFF_, m.Size) + for Offset in m._SubImages: + SectionInfo += ", " + str(m._SubImages[Offset]) + gIndention -= 4 + return SectionInfo + + def _Unpack(m): + m.empty() + Type, = m._TYPE_.unpack_from(m._BUF_, m._OFF_) + Size1, Size2, Size3 = m._SIZE_.unpack_from(m._BUF_, m._OFF_) + Size = Size1 + (Size2 << 8) + (Size3 << 16) + + if Type not in m._SectionSubImages: + # no need to extract sub-image, keep all in this Image object + m.extend(m._BUF_[m._OFF_ : m._OFF_ + Size]) + else: + # keep header in this Image object + m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._HEADER_SIZE_]) + # + # use new Image object to represent payload, which may be another kind + # of image such as PE32 + # + PayloadOffset = m._HEADER_SIZE_ + PayloadLen = m.Size - m._HEADER_SIZE_ + Payload = m._SectionSubImages[m.Type]() + Payload.frombuffer(m._BUF_, m._OFF_ + m._HEADER_SIZE_, PayloadLen) + m._SubImages[PayloadOffset] = Payload + + return Size + + def _SetSize(m, Size): + Size1 = Size & 0xFF + Size2 = (Size & 0xFF00) >> 8 + Size3 = (Size & 0xFF0000) >> 16 + m.SetField(m._SIZE_, 0, Size1, Size2, Size3) + + def _GetSize(m): + Size1, Size2, Size3 = m.GetField(m._SIZE_) + return Size1 + (Size2 << 8) + (Size3 << 16) + + def _SetType(m, Type): + m.SetField(m._TYPE_, 0, Type) + + def _GetType(m): + return m.GetField(m._TYPE_)[0] + + def _GetAlignment(m): + return m._Alignment + + def _SetAlignment(m, Alignment): + m._Alignment = Alignment + AlignmentMask = Alignment - 1 + # section alignment is actually for payload, so we need to add header size + PayloadOffset = m._OFF_ + m._HEADER_SIZE_ + if (PayloadOffset & (~AlignmentMask)) == 0: + return + NewOffset = (PayloadOffset + AlignmentMask) & (~AlignmentMask) + while (NewOffset - PayloadOffset) < m._HEADER_SIZE_: + NewOffset += m._Alignment + + def tofile(m, f): + m.Size = len(m) + Image.tofile(m, f) + for Offset in m._SubImages: + m._SubImages[Offset].tofile(f) + + Type = property(_GetType, _SetType) + Size = property(_GetSize, _SetSize) + Alignment = property(_GetAlignment, _SetAlignment) + # SubTypeGuid = property(_GetGuid, _SetGuid) + +## PadSection() class +# +# A class for Pad Section +# +class PadSection(Section): + def __init__(m, Size): + Section.__init__(m) + m.Type = 0x19 + m.Size = Size + m.Data = [0] * (Size - m._HEADER_SIZE_) + +## Ffs() class +# +# A class for Ffs Section +# +class Ffs(Image): + _FfsFormat = "24B%(payload_size)sB" + # skip IntegrityCheck + _HEADER_ = struct.Struct("1I2H8B 2x 1B 1B 3B 1B") + _HEADER_SIZE_ = _HEADER_.size + + _NAME_ = struct.Struct("1I2H8B") + _INT_CHECK_ = struct.Struct("16x 1H") + _TYPE_ = struct.Struct("18x 1B") + _ATTR_ = struct.Struct("19x 1B") + _SIZE_ = struct.Struct("20x 3B") + _STATE_ = struct.Struct("23x 1B") + + VTF_GUID = "1BA0062E-C779-4582-8566-336AE8F78F09" + + FFS_ATTRIB_FIXED = 0x04 + FFS_ATTRIB_DATA_ALIGNMENT = 0x38 + FFS_ATTRIB_CHECKSUM = 0x40 + + _TypeName = { + 0x00 : "", + 0x01 : "RAW", + 0x02 : "FREEFORM", + 0x03 : "SECURITY_CORE", + 0x04 : "PEI_CORE", + 0x05 : "DXE_CORE", + 0x06 : "PEIM", + 0x07 : "DRIVER", + 0x08 : "COMBINED_PEIM_DRIVER", + 0x09 : "APPLICATION", + 0x0A : "SMM", + 0x0B : "FIRMWARE_VOLUME_IMAGE", + 0x0C : "COMBINED_SMM_DXE", + 0x0D : "SMM_CORE", + 0xc0 : "OEM_MIN", + 0xdf : "OEM_MAX", + 0xe0 : "DEBUG_MIN", + 0xef : "DEBUG_MAX", + 0xf0 : "FFS_MIN", + 0xff : "FFS_MAX", + 0xf0 : "FFS_PAD", + } + + def __init__(self): + Image.__init__(self) + self.FreeSpace = 0 + + self.Sections = sdict() + self.Depex = '' + + self.__ID__ = None + + def __str__(self): + global gIndention + gIndention += 4 + Indention = ' ' * gIndention + FfsInfo = Indention + FfsInfo += "[FFS:%s] offset=%x size=%x guid=%s free_space=%x alignment=%s\n" % \ + (Ffs._TypeName[self.Type], self._OFF_, self.Size, self.Guid, self.FreeSpace, self.Alignment) + SectionInfo = '\n'.join([str(self.Sections[Offset]) for Offset in self.Sections]) + gIndention -= 4 + return FfsInfo + SectionInfo + "\n" + + def __len__(self): + return self.Size + + def __repr__(self): + return self.__ID__ + + def _Unpack(self): + Size1, Size2, Size3 = self._SIZE_.unpack_from(self._BUF_, self._OFF_) + Size = Size1 + (Size2 << 8) + (Size3 << 16) + self.empty() + self.extend(self._BUF_[self._OFF_ : self._OFF_ + Size]) + + # Pad FFS may use the same GUID. We need to avoid it. + if self.Type == 0xf0: + self.__ID__ = str(uuid.uuid1()).upper() + else: + self.__ID__ = self.Guid + + # Traverse the SECTION. RAW and PAD do not have sections + if self.Type not in [0xf0, 0x01] and Size > 0 and Size < 0xFFFFFF: + EndOfFfs = Size + SectionStartAddress = self._HEADER_SIZE_ + while SectionStartAddress < EndOfFfs: + SectionObj = Section() + SectionObj.frombuffer(self, SectionStartAddress) + #f = open(repr(SectionObj), 'wb') + #SectionObj.Size = 0 + #SectionObj.tofile(f) + #f.close() + self.Sections[SectionStartAddress] = SectionObj + SectionStartAddress += len(SectionObj) + SectionStartAddress = (SectionStartAddress + 3) & (~3) + + def Pack(self): + pass + + def SetFreeSpace(self, Size): + self.FreeSpace = Size + + def _GetGuid(self): + return gGuidStringFormat % self.Name + + def _SetName(self, Value): + # Guid1, Guid2, Guid3, Guid4, Guid5, Guid6, Guid7, Guid8, Guid9, Guid10, Guid11 + self.SetField(self._NAME_, 0, Value) + + def _GetName(self): + # Guid1, Guid2, Guid3, Guid4, Guid5, Guid6, Guid7, Guid8, Guid9, Guid10, Guid11 + return self.GetField(self._NAME_) + + def _SetSize(m, Size): + Size1 = Size & 0xFF + Size2 = (Size & 0xFF00) >> 8 + Size3 = (Size & 0xFF0000) >> 16 + m.SetField(m._SIZE_, 0, Size1, Size2, Size3) + + def _GetSize(m): + Size1, Size2, Size3 = m.GetField(m._SIZE_) + return Size1 + (Size2 << 8) + (Size3 << 16) + + def _SetType(m, Type): + m.SetField(m._TYPE_, 0, Type) + + def _GetType(m): + return m.GetField(m._TYPE_)[0] + + def _SetAttributes(self, Value): + self.SetField(m._ATTR_, 0, Value) + + def _GetAttributes(self): + return self.GetField(self._ATTR_)[0] + + def _GetFixed(self): + if (self.Attributes & self.FFS_ATTRIB_FIXED) != 0: + return True + return False + + def _GetCheckSum(self): + if (self.Attributes & self.FFS_ATTRIB_CHECKSUM) != 0: + return True + return False + + def _GetAlignment(self): + return (self.Attributes & self.FFS_ATTRIB_DATA_ALIGNMENT) >> 3 + + def _SetState(self, Value): + self.SetField(m._STATE_, 0, Value) + + def _GetState(self): + return self.GetField(m._STATE_)[0] + + Name = property(_GetName, _SetName) + Guid = property(_GetGuid) + Type = property(_GetType, _SetType) + Size = property(_GetSize, _SetSize) + Attributes = property(_GetAttributes, _SetAttributes) + Fixed = property(_GetFixed) + Checksum = property(_GetCheckSum) + Alignment = property(_GetAlignment) + State = property(_GetState, _SetState) + +## PeImage() class +# +# A class for PE Image +# +class PeImage: + # + # just extract e_lfanew + # + _DosHeaderFormat = "60x 1I" + # + # Machine + # NumberOfSections + # SizeOfOptionalHeader + # + _FileHeaderFormat = "4x 1H 1H 4x 4x 4x 1H 2x" + # + # Magic + # SizeOfImage + # SizeOfHeaders + # CheckSum + # NumberOfRvaAndSizes + # + _OptionalHeader32Format = "1H 54x 1I 1I 1I 24x 1I" + _OptionalHeader64Format = "" + def __init__(self, Buf, Offset, Size): + self.Offset = Offset + self.Size = Size + self.Machine = 0x014c # IA32 + self.NumberOfSections = 0 + self.SizeOfImage = 0 + self.SizeOfOptionalHeader = 0 + self.Checksum = 0 + self._PeImageBuf = Buf + self._SectionList = [] + + self._DosHeader = struct.Struct(PeImage._DosHeaderFormat) + self._FileHeader = struct.Struct(PeImage._FileHeaderFormat) + self._OptionalHeader32 = struct.Struct(PeImage._OptionalHeader32Format) + + self.Buffer = None + + self._Unpack() + + def __str__(self): + pass + + def __len__(self): + return self.Size + + def _Unpack(self): + # from DOS header, get the offset of PE header + FileHeaderOffset, = self._DosHeader.unpack_from(self._PeImageBuf, self.Offset) + if FileHeaderOffset < struct.calcsize(self._DosHeaderFormat): + EdkLogger.error("PE+", 0, "Invalid offset of IMAGE_FILE_HEADER: %s" % FileHeaderOffset) + + # from FILE header, get the optional header size + self.Machine, self.NumberOfSections, self.SizeOfOptionalHeader = \ + self._FileHeader.unpack_from(self._PeImageBuf, self.Offset + FileHeaderOffset) + + print "Machine=%x NumberOfSections=%x SizeOfOptionalHeader=%x" % (self.Machine, self.NumberOfSections, self.SizeOfOptionalHeader) + # optional header follows the FILE header + OptionalHeaderOffset = FileHeaderOffset + struct.calcsize(self._FileHeaderFormat) + Magic, self.SizeOfImage, SizeOfHeaders, self.Checksum, NumberOfRvaAndSizes = \ + self._OptionalHeader32.unpack_from(self._PeImageBuf, self.Offset + OptionalHeaderOffset) + print "Magic=%x SizeOfImage=%x SizeOfHeaders=%x, Checksum=%x, NumberOfRvaAndSizes=%x" % (Magic, self.SizeOfImage, SizeOfHeaders, self.Checksum, NumberOfRvaAndSizes) + + PeImageSectionTableOffset = OptionalHeaderOffset + self.SizeOfOptionalHeader + PeSections = PeSectionTable(self._PeImageBuf, self.Offset + PeImageSectionTableOffset, self.NumberOfSections) + + print "%x" % PeSections.GetFileAddress(0x3920) + +## PeSectionTable() class +# +# A class for PE Section Table +# +class PeSectionTable: + def __init__(self, Buf, Offset, NumberOfSections): + self._SectionList = [] + + SectionHeaderOffset = Offset + for TableIndex in range(0, NumberOfSections): + SectionHeader = PeSectionHeader(Buf, SectionHeaderOffset) + self._SectionList.append(SectionHeader) + SectionHeaderOffset += len(SectionHeader) + print SectionHeader + + def GetFileAddress(self, Rva): + for PeSection in self._SectionList: + if Rva in PeSection: + return PeSection[Rva] + +## PeSectionHeader() class +# +# A class for PE Section Header +# +class PeSectionHeader: + # + # VirtualAddress + # SizeOfRawData + # PointerToRawData + # + _HeaderFormat = "12x 1I 1I 1I 16x" + _HeaderLength = struct.calcsize(_HeaderFormat) + + def __init__(self, Buf, Offset): + self.VirtualAddressStart, self.SizeOfRawData, self.PointerToRawData = \ + struct.unpack_from(self._HeaderFormat, Buf, Offset) + self.VirtualAddressEnd = self.VirtualAddressStart + self.SizeOfRawData - 1 + + def __str__(self): + return "VirtualAddress=%x, SizeOfRawData=%x, PointerToRawData=%x" % (self.VirtualAddressStart, self.SizeOfRawData, self.PointerToRawData) + + def __len__(self): + return self._HeaderLength + + def __contains__(self, Rva): + return Rva >= self.VirtualAddressStart and Rva <= self.VirtualAddressEnd + + def __getitem__(self, Rva): + return Rva - self.VirtualAddressStart + self.PointerToRawData + +## LinkMap() class +# +# A class for Link Map +# +class LinkMap: + _StartFlag = { + "MSFT" : re.compile("Address +Publics by Value +Rva\+Base +Lib:Object"), + "GCC" : re.compile("^\.(text|bss|data|edata)"), + } + + _MappingFormat = { + "MSFT" : re.compile("([0-9a-f]+):([0-9a-f]+)\s+_+([0-9A-Za-z]+)\s+([0-9a-f]+)\s+"), + "GCC" : re.compile("^(\.\w)?\s+(0x[0-9a-f]+)\s+_+([0-9A-Za-z]+)"), + } + + def __init__(self, MapFile, MapType="MSFT"): + self.File = MapFile + self.MapType = MapType + self._Globals = {} # global:RVA + + self._Parse() + + def _Parse(self): + MapFile = open(self.File, 'r') + MappingTitle = self._StartFlag[self.MapType] + MappingFormat = self._MappingFormat[self.MapType] + MappingStart = False + try: + for Line in MapFile: + Line = Line.strip() + if not MappingStart: + if MappingTitle.match(Line) != None: + MappingStart = True + continue + ResultList = MappingFormat.findall(Line) + if len(ResultList) == 0 or len(ResultList[0]) != 4: + continue + self._Globals[ResultList[2]] = int(ResultList[3], 16) + EdkLogger.verbose(ResultList[0]) + finally: + MapFile.close() + + def __contains__(self, Var): + return Var in self._Globals + + def __getitem__(self, Var): + if Var not in self._Globals: + return None + return self._Globals[Var] + +## MultipleFv() class +# +# A class for Multiple FV +# +class MultipleFv(FirmwareVolume): + def __init__(self, FvList): + FirmwareVolume.__init__(self) + self.BasicInfo = [] + for FvPath in FvList: + FvName = os.path.splitext(os.path.split(FvPath)[1])[0] + Fd = open(FvPath, 'rb') + Buf = array('B') + try: + Buf.fromfile(Fd, os.path.getsize(FvPath)) + except EOFError: + pass + + Fv = FirmwareVolume(FvName) + Fv.frombuffer(Buf, 0, len(Buf)) + + self.BasicInfo.append([Fv.Name, Fv.FileSystemGuid, Fv.Size]) + self.FfsDict.append(Fv.FfsDict) + +# Version and Copyright +__version_number__ = "0.01" +__version__ = "%prog Version " + __version_number__ +__copyright__ = "Copyright (c) 2008, Intel Corporation. All rights reserved." + +## Parse command line options +# +# Using standard Python module optparse to parse command line option of this tool. +# +# @retval Options A optparse.Values object containing the parsed options +# @retval InputFile Path of file to be trimmed +# +def GetOptions(): + OptionList = [ + make_option("-a", "--arch", dest="Arch", + help="The input file is preprocessed source code, including C or assembly code"), + make_option("-p", "--platform", dest="ActivePlatform", + help="The input file is preprocessed VFR file"), + make_option("-m", "--module", dest="ActiveModule", + help="Convert standard hex format (0xabcd) to MASM format (abcdh)"), + make_option("-f", "--FDF-file", dest="FdfFile", + help="Convert standard hex format (0xabcd) to MASM format (abcdh)"), + make_option("-o", "--output", dest="OutputDirectory", + help="File to store the trimmed content"), + make_option("-t", "--toolchain-tag", dest="ToolChain", + help=""), + make_option("-k", "--msft", dest="MakefileType", action="store_const", const="nmake", + help=""), + make_option("-g", "--gcc", dest="MakefileType", action="store_const", const="gmake", + help=""), + make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE, + help="Run verbosely"), + make_option("-d", "--debug", dest="LogLevel", type="int", + help="Run with debug information"), + make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET, + help="Run quietly"), + make_option("-?", action="help", help="show this help message and exit"), + ] + + # use clearer usage to override default usage message + UsageString = "%prog [-a ARCH] [-p PLATFORM] [-m MODULE] [-t TOOLCHAIN_TAG] [-k] [-g] [-v|-d |-q] [-o ] [GenC|GenMake]" + + Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString) + Parser.set_defaults(Arch=[]) + Parser.set_defaults(ActivePlatform=None) + Parser.set_defaults(ActiveModule=None) + Parser.set_defaults(OutputDirectory="build") + Parser.set_defaults(FdfFile=None) + Parser.set_defaults(ToolChain="MYTOOLS") + if sys.platform == "win32": + Parser.set_defaults(MakefileType="nmake") + else: + Parser.set_defaults(MakefileType="gmake") + Parser.set_defaults(LogLevel=EdkLogger.INFO) + + Options, Args = Parser.parse_args() + + # error check + if len(Args) == 0: + Options.Target = "genmake" + sys.argv.append("genmake") + elif len(Args) == 1: + Options.Target = Args[0].lower() + if Options.Target not in ["genc", "genmake"]: + EdkLogger.error("AutoGen", OPTION_NOT_SUPPORTED, "Not supported target", + ExtraData="%s\n\n%s" % (Options.Target, Parser.get_usage())) + else: + EdkLogger.error("AutoGen", OPTION_NOT_SUPPORTED, "Too many targets", + ExtraData=Parser.get_usage()) + + return Options + +## Entrance method +# +# This method mainly dispatch specific methods per the command line options. +# If no error found, return zero value so the caller of this tool can know +# if it's executed successfully or not. +# +# @retval 0 Tool was successful +# @retval 1 Tool failed +# +def Main(): + from build import build + try: + Option = GetOptions() + build.main() + except Exception, e: + print e + return 1 + + return 0 + +# This acts like the main() function for the script, unless it is 'import'ed into another script. +if __name__ == '__main__': + EdkLogger.Initialize() + # sys.exit(Main()) + + if len(sys.argv) > 1: + FilePath = sys.argv[1] + if FilePath.lower().endswith(".fv"): + fd = open(FilePath, 'rb') + buf = array('B') + try: + buf.fromfile(fd, os.path.getsize(FilePath)) + except EOFError: + pass + + fv = FirmwareVolume("FVRECOVERY") + fv.frombuffer(buf, 0, len(buf)) + #fv.Dispatch(None) + print fv + elif FilePath.endswith(".efi"): + fd = open(FilePath, 'rb') + buf = array('B') + Size = os.path.getsize(FilePath) + + try: + buf.fromfile(fd, Size) + except EOFError: + pass + + PeSection = Section(Type=0x10) + PeSection.Data = buf + sf, ext = os.path.splitext(os.path.basename(FilePath)) + sf += ".sec" + PeSection.tofile(open(sf, 'wb')) + elif FilePath.endswith(".map"): + mf = LinkMap(FilePath) diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py index 5419e11fce..3eb4e23842 100644 --- a/BaseTools/Source/Python/GenFds/EfiSection.py +++ b/BaseTools/Source/Python/GenFds/EfiSection.py @@ -80,11 +80,11 @@ class EfiSection (EfiSectionClassObject): FileList = [] if Filename != None: Filename = GenFdsGlobalVariable.MacroExtend(Filename, Dict) - # check if the path is absolute or relative - if os.path.isabs(Filename): - Filename = os.path.normpath(Filename) - else: - Filename = os.path.normpath(os.path.join(FfsInf.EfiOutputPath, Filename)) + # check if the path is absolute or relative + if os.path.isabs(Filename): + Filename = os.path.normpath(Filename) + else: + Filename = os.path.normpath(os.path.join(FfsInf.EfiOutputPath, Filename)) if not self.Optional: FileList.append(Filename) diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index d79bed2b28..781c1a045d 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -296,13 +296,13 @@ class FV (FvClassObject): Buffer = '' for Index in range (0, len(self.FvExtEntryType)): if self.FvExtEntryType[Index] == 'FILE': - # check if the path is absolute or relative - if os.path.isabs(self.FvExtEntryData[Index]): - FileFullPath = os.path.normpath(self.FvExtEntryData[Index]) - else: - FileFullPath = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.FvExtEntryData[Index])) - # check if the file path exists or not - if not os.path.isfile(FileFullPath): + # check if the path is absolute or relative + if os.path.isabs(self.FvExtEntryData[Index]): + FileFullPath = os.path.normpath(self.FvExtEntryData[Index]) + else: + FileFullPath = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.FvExtEntryData[Index])) + # check if the file path exists or not + if not os.path.isfile(FileFullPath): GenFdsGlobalVariable.ErrorLogger("Error opening FV Extension Header Entry file %s." % (self.FvExtEntryData[Index])) FvExtFile = open (FileFullPath,'rb') FvExtFile.seek(0,2) diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py index eca21642c8..058fa0c6a0 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -1,538 +1,538 @@ -## @file -# generate flash image -# -# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -from optparse import OptionParser -import sys -import os -import linecache -import FdfParser -import Common.BuildToolError as BuildToolError -from GenFdsGlobalVariable import GenFdsGlobalVariable -from Workspace.WorkspaceDatabase import WorkspaceDatabase -from Workspace.BuildClassObject import PcdClassObject -from Workspace.BuildClassObject import ModuleBuildClassObject -import RuleComplexFile -from EfiSection import EfiSection -import StringIO -import Common.TargetTxtClassObject as TargetTxtClassObject -import Common.ToolDefClassObject as ToolDefClassObject -import Common.DataType -import Common.GlobalData as GlobalData -from Common import EdkLogger -from Common.String import * -from Common.Misc import DirCache,PathClass -from Common.Misc import SaveFileOnChange -from Common.BuildVersion import gBUILD_VERSION - -## Version and Copyright -versionNumber = "1.0" + ' ' + gBUILD_VERSION -__version__ = "%prog Version " + versionNumber -__copyright__ = "Copyright (c) 2007 - 2013, Intel Corporation All rights reserved." - -## Tool entrance method -# -# This method mainly dispatch specific methods per the command line options. -# If no error found, return zero value so the caller of this tool can know -# if it's executed successfully or not. -# -# @retval 0 Tool was successful -# @retval 1 Tool failed -# -def main(): - global Options - Options = myOptionParser() - - global Workspace - Workspace = "" - ArchList = None - ReturnCode = 0 - - EdkLogger.Initialize() - try: - if Options.verbose != None: - EdkLogger.SetLevel(EdkLogger.VERBOSE) - GenFdsGlobalVariable.VerboseMode = True - - if Options.FixedAddress != None: - GenFdsGlobalVariable.FixedLoadAddress = True - - if Options.quiet != None: - EdkLogger.SetLevel(EdkLogger.QUIET) - if Options.debug != None: - EdkLogger.SetLevel(Options.debug + 1) - GenFdsGlobalVariable.DebugLevel = Options.debug - else: - EdkLogger.SetLevel(EdkLogger.INFO) - - if (Options.Workspace == None): - EdkLogger.error("GenFds", OPTION_MISSING, "WORKSPACE not defined", - ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.") - elif not os.path.exists(Options.Workspace): - EdkLogger.error("GenFds", PARAMETER_INVALID, "WORKSPACE is invalid", - ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.") - else: - Workspace = os.path.normcase(Options.Workspace) - GenFdsGlobalVariable.WorkSpaceDir = Workspace - if 'EDK_SOURCE' in os.environ.keys(): - GenFdsGlobalVariable.EdkSourceDir = os.path.normcase(os.environ['EDK_SOURCE']) - if (Options.debug): - GenFdsGlobalVariable.VerboseLogger( "Using Workspace:" + Workspace) - os.chdir(GenFdsGlobalVariable.WorkSpaceDir) - - if (Options.filename): - FdfFilename = Options.filename - FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename) - - if FdfFilename[0:2] == '..': - FdfFilename = os.path.realpath(FdfFilename) - if not os.path.isabs (FdfFilename): - FdfFilename = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename) - if not os.path.exists(FdfFilename): - EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=FdfFilename) - if os.path.normcase (FdfFilename).find(Workspace) != 0: - EdkLogger.error("GenFds", FILE_NOT_FOUND, "FdfFile doesn't exist in Workspace!") - - GenFdsGlobalVariable.FdfFile = FdfFilename - GenFdsGlobalVariable.FdfFileTimeStamp = os.path.getmtime(FdfFilename) - else: - EdkLogger.error("GenFds", OPTION_MISSING, "Missing FDF filename") - - if (Options.BuildTarget): - GenFdsGlobalVariable.TargetName = Options.BuildTarget - else: - EdkLogger.error("GenFds", OPTION_MISSING, "Missing build target") - - if (Options.ToolChain): - GenFdsGlobalVariable.ToolChainTag = Options.ToolChain - else: - EdkLogger.error("GenFds", OPTION_MISSING, "Missing tool chain tag") - - if (Options.activePlatform): - ActivePlatform = Options.activePlatform - ActivePlatform = GenFdsGlobalVariable.ReplaceWorkspaceMacro(ActivePlatform) - - if ActivePlatform[0:2] == '..': - ActivePlatform = os.path.realpath(ActivePlatform) - - if not os.path.isabs (ActivePlatform): - ActivePlatform = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform) - - if not os.path.exists(ActivePlatform) : - EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!") - - if os.path.normcase (ActivePlatform).find(Workspace) != 0: - EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist in Workspace!") - - ActivePlatform = ActivePlatform[len(Workspace):] - if len(ActivePlatform) > 0 : - if ActivePlatform[0] == '\\' or ActivePlatform[0] == '/': - ActivePlatform = ActivePlatform[1:] - else: - EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!") - else: - EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform") - - GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform), Workspace) - - BuildConfigurationFile = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, "Conf/target.txt")) - if os.path.isfile(BuildConfigurationFile) == True: - TargetTxtClassObject.TargetTxtClassObject(BuildConfigurationFile) - else: - EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=BuildConfigurationFile) - - if Options.Macros: - for Pair in Options.Macros: - Pair.strip('"') - List = Pair.split('=') - if len(List) == 2: - if List[0].strip() == "EFI_SOURCE": - GlobalData.gEfiSource = List[1].strip() - GlobalData.gGlobalDefines["EFI_SOURCE"] = GlobalData.gEfiSource - continue - elif List[0].strip() == "EDK_SOURCE": - GlobalData.gEdkSource = List[1].strip() - GlobalData.gGlobalDefines["EDK_SOURCE"] = GlobalData.gEdkSource - continue - elif List[0].strip() in ["WORKSPACE", "TARGET", "TOOLCHAIN"]: - GlobalData.gGlobalDefines[List[0].strip()] = List[1].strip() - else: - GlobalData.gCommandLineDefines[List[0].strip()] = List[1].strip() - else: - GlobalData.gCommandLineDefines[List[0].strip()] = "TRUE" - os.environ["WORKSPACE"] = Workspace - - """call Workspace build create database""" - BuildWorkSpace = WorkspaceDatabase(None) - BuildWorkSpace.InitDatabase() - - # - # Get files real name in workspace dir - # - GlobalData.gAllFiles = DirCache(Workspace) - GlobalData.gWorkspace = Workspace - - if (Options.archList) : - ArchList = Options.archList.split(',') - else: -# EdkLogger.error("GenFds", OPTION_MISSING, "Missing build ARCH") - ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON', Options.BuildTarget, Options.ToolChain].SupArchList - - TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON', Options.BuildTarget, Options.ToolChain].SupArchList) & set(ArchList) - if len(TargetArchList) == 0: - EdkLogger.error("GenFds", GENFDS_ERROR, "Target ARCH %s not in platform supported ARCH %s" % (str(ArchList), str(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList))) - - for Arch in ArchList: - GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = NormPath(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, Options.BuildTarget, Options.ToolChain].OutputDirectory) - GenFdsGlobalVariable.PlatformName = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, Options.BuildTarget, Options.ToolChain].PlatformName - - if (Options.outputDir): - OutputDirFromCommandLine = GenFdsGlobalVariable.ReplaceWorkspaceMacro(Options.outputDir) - if not os.path.isabs (OutputDirFromCommandLine): - OutputDirFromCommandLine = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, OutputDirFromCommandLine) - for Arch in ArchList: - GenFdsGlobalVariable.OutputDirDict[Arch] = OutputDirFromCommandLine - else: - for Arch in ArchList: - GenFdsGlobalVariable.OutputDirDict[Arch] = os.path.join(GenFdsGlobalVariable.OutputDirFromDscDict[Arch], GenFdsGlobalVariable.TargetName + '_' + GenFdsGlobalVariable.ToolChainTag) - - for Key in GenFdsGlobalVariable.OutputDirDict: - OutputDir = GenFdsGlobalVariable.OutputDirDict[Key] - if OutputDir[0:2] == '..': - OutputDir = os.path.realpath(OutputDir) - - if OutputDir[1] != ':': - OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir) - - if not os.path.exists(OutputDir): - EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=OutputDir) - GenFdsGlobalVariable.OutputDirDict[Key] = OutputDir - - """ Parse Fdf file, has to place after build Workspace as FDF may contain macros from DSC file """ - FdfParserObj = FdfParser.FdfParser(FdfFilename) - FdfParserObj.ParseFile() - - if FdfParserObj.CycleReferenceCheck(): - EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file") - - if (Options.uiFdName) : - if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict.keys(): - GenFds.OnlyGenerateThisFd = Options.uiFdName - else: - EdkLogger.error("GenFds", OPTION_VALUE_INVALID, - "No such an FD in FDF file: %s" % Options.uiFdName) - - if (Options.uiFvName) : - if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict.keys(): - GenFds.OnlyGenerateThisFv = Options.uiFvName - else: - EdkLogger.error("GenFds", OPTION_VALUE_INVALID, - "No such an FV in FDF file: %s" % Options.uiFvName) - - if (Options.uiCapName) : - if Options.uiCapName.upper() in FdfParserObj.Profile.CapsuleDict.keys(): - GenFds.OnlyGenerateThisCap = Options.uiCapName - else: - EdkLogger.error("GenFds", OPTION_VALUE_INVALID, - "No such a Capsule in FDF file: %s" % Options.uiCapName) - - """Modify images from build output if the feature of loading driver at fixed address is on.""" - if GenFdsGlobalVariable.FixedLoadAddress: - GenFds.PreprocessImage(BuildWorkSpace, GenFdsGlobalVariable.ActivePlatform) - """Call GenFds""" - GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList) - - """Generate GUID cross reference file""" - GenFds.GenerateGuidXRefFile(BuildWorkSpace, ArchList) - - """Display FV space info.""" - GenFds.DisplayFvSpaceInfo(FdfParserObj) - - except FdfParser.Warning, X: - EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False) - ReturnCode = FORMAT_INVALID - except FatalError, X: - if Options.debug != None: - import traceback - EdkLogger.quiet(traceback.format_exc()) - ReturnCode = X.args[0] - except: - import traceback - EdkLogger.error( - "\nPython", - CODE_ERROR, - "Tools code failure", - ExtraData="Please send email to edk2-buildtools-devel@lists.sourceforge.net for help, attaching following call stack trace!\n", - RaiseError=False - ) - EdkLogger.quiet(traceback.format_exc()) - ReturnCode = CODE_ERROR - return ReturnCode - -gParamCheck = [] -def SingleCheckCallback(option, opt_str, value, parser): - if option not in gParamCheck: - setattr(parser.values, option.dest, value) - gParamCheck.append(option) - else: - parser.error("Option %s only allows one instance in command line!" % option) - -## Parse command line options -# -# Using standard Python module optparse to parse command line option of this tool. -# -# @retval Opt A optparse.Values object containing the parsed options -# @retval Args Target of build command -# -def myOptionParser(): - usage = "%prog [options] -f input_file -a arch_list -b build_target -p active_platform -t tool_chain_tag -D \"MacroName [= MacroValue]\"" - Parser = OptionParser(usage=usage,description=__copyright__,version="%prog " + str(versionNumber)) - Parser.add_option("-f", "--file", dest="filename", type="string", help="Name of FDF file to convert", action="callback", callback=SingleCheckCallback) - Parser.add_option("-a", "--arch", dest="archList", help="comma separated list containing one or more of: IA32, X64, IPF, ARM, AARCH64 or EBC which should be built, overrides target.txt?s TARGET_ARCH") - Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.") - Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed.") - Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.") - Parser.add_option("-p", "--platform", type="string", dest="activePlatform", help="Set the ACTIVE_PLATFORM, overrides target.txt ACTIVE_PLATFORM setting.", - action="callback", callback=SingleCheckCallback) - Parser.add_option("-w", "--workspace", type="string", dest="Workspace", default=os.environ.get('WORKSPACE'), help="Set the WORKSPACE", - action="callback", callback=SingleCheckCallback) - Parser.add_option("-o", "--outputDir", type="string", dest="outputDir", help="Name of Build Output directory", - action="callback", callback=SingleCheckCallback) - Parser.add_option("-r", "--rom_image", dest="uiFdName", help="Build the image using the [FD] section named by FdUiName.") - Parser.add_option("-i", "--FvImage", dest="uiFvName", help="Build the FV image using the [FV] section named by UiFvName") - Parser.add_option("-C", "--CapsuleImage", dest="uiCapName", help="Build the Capsule image using the [Capsule] section named by UiCapName") - Parser.add_option("-b", "--buildtarget", type="string", dest="BuildTarget", help="Set the build TARGET, overrides target.txt TARGET setting.", - action="callback", callback=SingleCheckCallback) - Parser.add_option("-t", "--tagname", type="string", dest="ToolChain", help="Using the tools: TOOL_CHAIN_TAG name to build the platform.", - action="callback", callback=SingleCheckCallback) - Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".") - Parser.add_option("-s", "--specifyaddress", dest="FixedAddress", action="store_true", type=None, help="Specify driver load address.") - (Options, args) = Parser.parse_args() - return Options - -## The class implementing the EDK2 flash image generation process -# -# This process includes: -# 1. Collect workspace information, includes platform and module information -# 2. Call methods of Fd class to generate FD -# 3. Call methods of Fv class to generate FV that not belong to FD -# -class GenFds : - FdfParsef = None - # FvName, FdName, CapName in FDF, Image file name - ImageBinDict = {} - OnlyGenerateThisFd = None - OnlyGenerateThisFv = None - OnlyGenerateThisCap = None - - ## GenFd() - # - # @param OutputDir Output directory - # @param FdfParser FDF contents parser - # @param Workspace The directory of workspace - # @param ArchList The Arch list of platform - # - def GenFd (OutputDir, FdfParser, WorkSpace, ArchList): - GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList) - - GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images and their required FV and Capsule images!") - if GenFds.OnlyGenerateThisCap != None and GenFds.OnlyGenerateThisCap.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys(): - CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.get(GenFds.OnlyGenerateThisCap.upper()) - if CapsuleObj != None: - CapsuleObj.GenCapsule() - return - - if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): - FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(GenFds.OnlyGenerateThisFd.upper()) - if FdObj != None: - FdObj.GenFd() - return - elif GenFds.OnlyGenerateThisFd == None and GenFds.OnlyGenerateThisFv == None: - for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): - FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName] - FdObj.GenFd() - - GenFdsGlobalVariable.VerboseLogger("\n Generate other FV images! ") - if GenFds.OnlyGenerateThisFv != None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys(): - FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(GenFds.OnlyGenerateThisFv.upper()) - if FvObj != None: - Buffer = StringIO.StringIO() - FvObj.AddToBuffer(Buffer) - Buffer.close() - return - elif GenFds.OnlyGenerateThisFv == None: - for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys(): - Buffer = StringIO.StringIO('') - FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName] - FvObj.AddToBuffer(Buffer) - Buffer.close() - - if GenFds.OnlyGenerateThisFv == None and GenFds.OnlyGenerateThisFd == None and GenFds.OnlyGenerateThisCap == None: - if GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict != {}: - GenFdsGlobalVariable.VerboseLogger("\n Generate other Capsule images!") - for CapsuleName in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys(): - CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[CapsuleName] - CapsuleObj.GenCapsule() - - if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}: - GenFdsGlobalVariable.VerboseLogger("\n Generate all Option ROM!") - for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys(): - OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName] - OptRomObj.AddToBuffer(None) - - ## GetFvBlockSize() - # - # @param FvObj Whose block size to get - # @retval int Block size value - # - def GetFvBlockSize(FvObj): - DefaultBlockSize = 0x1 - FdObj = None - if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): - FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()] - if FdObj == None: - for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values(): - for ElementRegion in ElementFd.RegionList: - if ElementRegion.RegionType == 'FV': - for ElementRegionData in ElementRegion.RegionDataList: - if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName: - if FvObj.BlockSizeList != []: - return FvObj.BlockSizeList[0][0] - else: - return ElementRegion.BlockSizeOfRegion(ElementFd.BlockSizeList) - if FvObj.BlockSizeList != []: - return FvObj.BlockSizeList[0][0] - return DefaultBlockSize - else: - for ElementRegion in FdObj.RegionList: - if ElementRegion.RegionType == 'FV': - for ElementRegionData in ElementRegion.RegionDataList: - if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName: - if FvObj.BlockSizeList != []: - return FvObj.BlockSizeList[0][0] - else: - return ElementRegion.BlockSizeOfRegion(ElementFd.BlockSizeList) - return DefaultBlockSize - - ## DisplayFvSpaceInfo() - # - # @param FvObj Whose block size to get - # @retval None - # - def DisplayFvSpaceInfo(FdfParser): - - FvSpaceInfoList = [] - MaxFvNameLength = 0 - for FvName in FdfParser.Profile.FvDict: - if len(FvName) > MaxFvNameLength: - MaxFvNameLength = len(FvName) - FvSpaceInfoFileName = os.path.join(GenFdsGlobalVariable.FvDir, FvName.upper() + '.Fv.map') - if os.path.exists(FvSpaceInfoFileName): - FileLinesList = linecache.getlines(FvSpaceInfoFileName) - TotalFound = False - Total = '' - UsedFound = False - Used = '' - FreeFound = False - Free = '' - for Line in FileLinesList: - NameValue = Line.split('=') - if len(NameValue) == 2: - if NameValue[0].strip() == 'EFI_FV_TOTAL_SIZE': - TotalFound = True - Total = NameValue[1].strip() - if NameValue[0].strip() == 'EFI_FV_TAKEN_SIZE': - UsedFound = True - Used = NameValue[1].strip() - if NameValue[0].strip() == 'EFI_FV_SPACE_SIZE': - FreeFound = True - Free = NameValue[1].strip() - - if TotalFound and UsedFound and FreeFound: - FvSpaceInfoList.append((FvName, Total, Used, Free)) - - GenFdsGlobalVariable.InfLogger('\nFV Space Information') - for FvSpaceInfo in FvSpaceInfoList: - Name = FvSpaceInfo[0] - TotalSizeValue = long(FvSpaceInfo[1], 0) - UsedSizeValue = long(FvSpaceInfo[2], 0) - FreeSizeValue = long(FvSpaceInfo[3], 0) - if UsedSizeValue == TotalSizeValue: - Percentage = '100' - else: - Percentage = str((UsedSizeValue+0.0)/TotalSizeValue)[0:4].lstrip('0.') - - GenFdsGlobalVariable.InfLogger(Name + ' ' + '[' + Percentage + '%Full] ' + str(TotalSizeValue) + ' total, ' + str(UsedSizeValue) + ' used, ' + str(FreeSizeValue) + ' free') - - ## PreprocessImage() - # - # @param BuildDb Database from build meta data files - # @param DscFile modules from dsc file will be preprocessed - # @retval None - # - def PreprocessImage(BuildDb, DscFile): - PcdDict = BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Pcds - PcdValue = '' - for Key in PcdDict: - PcdObj = PcdDict[Key] - if PcdObj.TokenCName == 'PcdBsBaseAddress': - PcdValue = PcdObj.DefaultValue - break - - if PcdValue == '': - return - - Int64PcdValue = long(PcdValue, 0) - if Int64PcdValue == 0 or Int64PcdValue < -1: - return - - TopAddress = 0 - if Int64PcdValue > 0: - TopAddress = Int64PcdValue - - ModuleDict = BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Modules - for Key in ModuleDict: - ModuleObj = BuildDb.BuildObject[Key, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] - print ModuleObj.BaseName + ' ' + ModuleObj.ModuleType - - def GenerateGuidXRefFile(BuildDb, ArchList): - GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref") - GuidXRefFile = StringIO.StringIO('') - for Arch in ArchList: - PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] - for ModuleFile in PlatformDataBase.Modules: - Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] - GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName)) - if GuidXRefFile.getvalue(): - SaveFileOnChange(GuidXRefFileName, GuidXRefFile.getvalue(), False) - GenFdsGlobalVariable.InfLogger("\nGUID cross reference file can be found at %s" % GuidXRefFileName) - elif os.path.exists(GuidXRefFileName): - os.remove(GuidXRefFileName) - GuidXRefFile.close() - - ##Define GenFd as static function - GenFd = staticmethod(GenFd) - GetFvBlockSize = staticmethod(GetFvBlockSize) - DisplayFvSpaceInfo = staticmethod(DisplayFvSpaceInfo) - PreprocessImage = staticmethod(PreprocessImage) - GenerateGuidXRefFile = staticmethod(GenerateGuidXRefFile) - -if __name__ == '__main__': - r = main() - ## 0-127 is a safe return range, and 1 is a standard default error - if r < 0 or r > 127: r = 1 - sys.exit(r) - +## @file +# generate flash image +# +# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +from optparse import OptionParser +import sys +import os +import linecache +import FdfParser +import Common.BuildToolError as BuildToolError +from GenFdsGlobalVariable import GenFdsGlobalVariable +from Workspace.WorkspaceDatabase import WorkspaceDatabase +from Workspace.BuildClassObject import PcdClassObject +from Workspace.BuildClassObject import ModuleBuildClassObject +import RuleComplexFile +from EfiSection import EfiSection +import StringIO +import Common.TargetTxtClassObject as TargetTxtClassObject +import Common.ToolDefClassObject as ToolDefClassObject +import Common.DataType +import Common.GlobalData as GlobalData +from Common import EdkLogger +from Common.String import * +from Common.Misc import DirCache,PathClass +from Common.Misc import SaveFileOnChange +from Common.BuildVersion import gBUILD_VERSION + +## Version and Copyright +versionNumber = "1.0" + ' ' + gBUILD_VERSION +__version__ = "%prog Version " + versionNumber +__copyright__ = "Copyright (c) 2007 - 2013, Intel Corporation All rights reserved." + +## Tool entrance method +# +# This method mainly dispatch specific methods per the command line options. +# If no error found, return zero value so the caller of this tool can know +# if it's executed successfully or not. +# +# @retval 0 Tool was successful +# @retval 1 Tool failed +# +def main(): + global Options + Options = myOptionParser() + + global Workspace + Workspace = "" + ArchList = None + ReturnCode = 0 + + EdkLogger.Initialize() + try: + if Options.verbose != None: + EdkLogger.SetLevel(EdkLogger.VERBOSE) + GenFdsGlobalVariable.VerboseMode = True + + if Options.FixedAddress != None: + GenFdsGlobalVariable.FixedLoadAddress = True + + if Options.quiet != None: + EdkLogger.SetLevel(EdkLogger.QUIET) + if Options.debug != None: + EdkLogger.SetLevel(Options.debug + 1) + GenFdsGlobalVariable.DebugLevel = Options.debug + else: + EdkLogger.SetLevel(EdkLogger.INFO) + + if (Options.Workspace == None): + EdkLogger.error("GenFds", OPTION_MISSING, "WORKSPACE not defined", + ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.") + elif not os.path.exists(Options.Workspace): + EdkLogger.error("GenFds", PARAMETER_INVALID, "WORKSPACE is invalid", + ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.") + else: + Workspace = os.path.normcase(Options.Workspace) + GenFdsGlobalVariable.WorkSpaceDir = Workspace + if 'EDK_SOURCE' in os.environ.keys(): + GenFdsGlobalVariable.EdkSourceDir = os.path.normcase(os.environ['EDK_SOURCE']) + if (Options.debug): + GenFdsGlobalVariable.VerboseLogger( "Using Workspace:" + Workspace) + os.chdir(GenFdsGlobalVariable.WorkSpaceDir) + + if (Options.filename): + FdfFilename = Options.filename + FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename) + + if FdfFilename[0:2] == '..': + FdfFilename = os.path.realpath(FdfFilename) + if not os.path.isabs (FdfFilename): + FdfFilename = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename) + if not os.path.exists(FdfFilename): + EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=FdfFilename) + if os.path.normcase (FdfFilename).find(Workspace) != 0: + EdkLogger.error("GenFds", FILE_NOT_FOUND, "FdfFile doesn't exist in Workspace!") + + GenFdsGlobalVariable.FdfFile = FdfFilename + GenFdsGlobalVariable.FdfFileTimeStamp = os.path.getmtime(FdfFilename) + else: + EdkLogger.error("GenFds", OPTION_MISSING, "Missing FDF filename") + + if (Options.BuildTarget): + GenFdsGlobalVariable.TargetName = Options.BuildTarget + else: + EdkLogger.error("GenFds", OPTION_MISSING, "Missing build target") + + if (Options.ToolChain): + GenFdsGlobalVariable.ToolChainTag = Options.ToolChain + else: + EdkLogger.error("GenFds", OPTION_MISSING, "Missing tool chain tag") + + if (Options.activePlatform): + ActivePlatform = Options.activePlatform + ActivePlatform = GenFdsGlobalVariable.ReplaceWorkspaceMacro(ActivePlatform) + + if ActivePlatform[0:2] == '..': + ActivePlatform = os.path.realpath(ActivePlatform) + + if not os.path.isabs (ActivePlatform): + ActivePlatform = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform) + + if not os.path.exists(ActivePlatform) : + EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!") + + if os.path.normcase (ActivePlatform).find(Workspace) != 0: + EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist in Workspace!") + + ActivePlatform = ActivePlatform[len(Workspace):] + if len(ActivePlatform) > 0 : + if ActivePlatform[0] == '\\' or ActivePlatform[0] == '/': + ActivePlatform = ActivePlatform[1:] + else: + EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!") + else: + EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform") + + GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform), Workspace) + + BuildConfigurationFile = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, "Conf/target.txt")) + if os.path.isfile(BuildConfigurationFile) == True: + TargetTxtClassObject.TargetTxtClassObject(BuildConfigurationFile) + else: + EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=BuildConfigurationFile) + + if Options.Macros: + for Pair in Options.Macros: + Pair.strip('"') + List = Pair.split('=') + if len(List) == 2: + if List[0].strip() == "EFI_SOURCE": + GlobalData.gEfiSource = List[1].strip() + GlobalData.gGlobalDefines["EFI_SOURCE"] = GlobalData.gEfiSource + continue + elif List[0].strip() == "EDK_SOURCE": + GlobalData.gEdkSource = List[1].strip() + GlobalData.gGlobalDefines["EDK_SOURCE"] = GlobalData.gEdkSource + continue + elif List[0].strip() in ["WORKSPACE", "TARGET", "TOOLCHAIN"]: + GlobalData.gGlobalDefines[List[0].strip()] = List[1].strip() + else: + GlobalData.gCommandLineDefines[List[0].strip()] = List[1].strip() + else: + GlobalData.gCommandLineDefines[List[0].strip()] = "TRUE" + os.environ["WORKSPACE"] = Workspace + + """call Workspace build create database""" + BuildWorkSpace = WorkspaceDatabase(None) + BuildWorkSpace.InitDatabase() + + # + # Get files real name in workspace dir + # + GlobalData.gAllFiles = DirCache(Workspace) + GlobalData.gWorkspace = Workspace + + if (Options.archList) : + ArchList = Options.archList.split(',') + else: +# EdkLogger.error("GenFds", OPTION_MISSING, "Missing build ARCH") + ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON', Options.BuildTarget, Options.ToolChain].SupArchList + + TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON', Options.BuildTarget, Options.ToolChain].SupArchList) & set(ArchList) + if len(TargetArchList) == 0: + EdkLogger.error("GenFds", GENFDS_ERROR, "Target ARCH %s not in platform supported ARCH %s" % (str(ArchList), str(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList))) + + for Arch in ArchList: + GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = NormPath(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, Options.BuildTarget, Options.ToolChain].OutputDirectory) + GenFdsGlobalVariable.PlatformName = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, Options.BuildTarget, Options.ToolChain].PlatformName + + if (Options.outputDir): + OutputDirFromCommandLine = GenFdsGlobalVariable.ReplaceWorkspaceMacro(Options.outputDir) + if not os.path.isabs (OutputDirFromCommandLine): + OutputDirFromCommandLine = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, OutputDirFromCommandLine) + for Arch in ArchList: + GenFdsGlobalVariable.OutputDirDict[Arch] = OutputDirFromCommandLine + else: + for Arch in ArchList: + GenFdsGlobalVariable.OutputDirDict[Arch] = os.path.join(GenFdsGlobalVariable.OutputDirFromDscDict[Arch], GenFdsGlobalVariable.TargetName + '_' + GenFdsGlobalVariable.ToolChainTag) + + for Key in GenFdsGlobalVariable.OutputDirDict: + OutputDir = GenFdsGlobalVariable.OutputDirDict[Key] + if OutputDir[0:2] == '..': + OutputDir = os.path.realpath(OutputDir) + + if OutputDir[1] != ':': + OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir) + + if not os.path.exists(OutputDir): + EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=OutputDir) + GenFdsGlobalVariable.OutputDirDict[Key] = OutputDir + + """ Parse Fdf file, has to place after build Workspace as FDF may contain macros from DSC file """ + FdfParserObj = FdfParser.FdfParser(FdfFilename) + FdfParserObj.ParseFile() + + if FdfParserObj.CycleReferenceCheck(): + EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file") + + if (Options.uiFdName) : + if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict.keys(): + GenFds.OnlyGenerateThisFd = Options.uiFdName + else: + EdkLogger.error("GenFds", OPTION_VALUE_INVALID, + "No such an FD in FDF file: %s" % Options.uiFdName) + + if (Options.uiFvName) : + if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict.keys(): + GenFds.OnlyGenerateThisFv = Options.uiFvName + else: + EdkLogger.error("GenFds", OPTION_VALUE_INVALID, + "No such an FV in FDF file: %s" % Options.uiFvName) + + if (Options.uiCapName) : + if Options.uiCapName.upper() in FdfParserObj.Profile.CapsuleDict.keys(): + GenFds.OnlyGenerateThisCap = Options.uiCapName + else: + EdkLogger.error("GenFds", OPTION_VALUE_INVALID, + "No such a Capsule in FDF file: %s" % Options.uiCapName) + + """Modify images from build output if the feature of loading driver at fixed address is on.""" + if GenFdsGlobalVariable.FixedLoadAddress: + GenFds.PreprocessImage(BuildWorkSpace, GenFdsGlobalVariable.ActivePlatform) + """Call GenFds""" + GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList) + + """Generate GUID cross reference file""" + GenFds.GenerateGuidXRefFile(BuildWorkSpace, ArchList) + + """Display FV space info.""" + GenFds.DisplayFvSpaceInfo(FdfParserObj) + + except FdfParser.Warning, X: + EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False) + ReturnCode = FORMAT_INVALID + except FatalError, X: + if Options.debug != None: + import traceback + EdkLogger.quiet(traceback.format_exc()) + ReturnCode = X.args[0] + except: + import traceback + EdkLogger.error( + "\nPython", + CODE_ERROR, + "Tools code failure", + ExtraData="Please send email to edk2-buildtools-devel@lists.sourceforge.net for help, attaching following call stack trace!\n", + RaiseError=False + ) + EdkLogger.quiet(traceback.format_exc()) + ReturnCode = CODE_ERROR + return ReturnCode + +gParamCheck = [] +def SingleCheckCallback(option, opt_str, value, parser): + if option not in gParamCheck: + setattr(parser.values, option.dest, value) + gParamCheck.append(option) + else: + parser.error("Option %s only allows one instance in command line!" % option) + +## Parse command line options +# +# Using standard Python module optparse to parse command line option of this tool. +# +# @retval Opt A optparse.Values object containing the parsed options +# @retval Args Target of build command +# +def myOptionParser(): + usage = "%prog [options] -f input_file -a arch_list -b build_target -p active_platform -t tool_chain_tag -D \"MacroName [= MacroValue]\"" + Parser = OptionParser(usage=usage,description=__copyright__,version="%prog " + str(versionNumber)) + Parser.add_option("-f", "--file", dest="filename", type="string", help="Name of FDF file to convert", action="callback", callback=SingleCheckCallback) + Parser.add_option("-a", "--arch", dest="archList", help="comma separated list containing one or more of: IA32, X64, IPF, ARM, AARCH64 or EBC which should be built, overrides target.txt?s TARGET_ARCH") + Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.") + Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed.") + Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.") + Parser.add_option("-p", "--platform", type="string", dest="activePlatform", help="Set the ACTIVE_PLATFORM, overrides target.txt ACTIVE_PLATFORM setting.", + action="callback", callback=SingleCheckCallback) + Parser.add_option("-w", "--workspace", type="string", dest="Workspace", default=os.environ.get('WORKSPACE'), help="Set the WORKSPACE", + action="callback", callback=SingleCheckCallback) + Parser.add_option("-o", "--outputDir", type="string", dest="outputDir", help="Name of Build Output directory", + action="callback", callback=SingleCheckCallback) + Parser.add_option("-r", "--rom_image", dest="uiFdName", help="Build the image using the [FD] section named by FdUiName.") + Parser.add_option("-i", "--FvImage", dest="uiFvName", help="Build the FV image using the [FV] section named by UiFvName") + Parser.add_option("-C", "--CapsuleImage", dest="uiCapName", help="Build the Capsule image using the [Capsule] section named by UiCapName") + Parser.add_option("-b", "--buildtarget", type="string", dest="BuildTarget", help="Set the build TARGET, overrides target.txt TARGET setting.", + action="callback", callback=SingleCheckCallback) + Parser.add_option("-t", "--tagname", type="string", dest="ToolChain", help="Using the tools: TOOL_CHAIN_TAG name to build the platform.", + action="callback", callback=SingleCheckCallback) + Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".") + Parser.add_option("-s", "--specifyaddress", dest="FixedAddress", action="store_true", type=None, help="Specify driver load address.") + (Options, args) = Parser.parse_args() + return Options + +## The class implementing the EDK2 flash image generation process +# +# This process includes: +# 1. Collect workspace information, includes platform and module information +# 2. Call methods of Fd class to generate FD +# 3. Call methods of Fv class to generate FV that not belong to FD +# +class GenFds : + FdfParsef = None + # FvName, FdName, CapName in FDF, Image file name + ImageBinDict = {} + OnlyGenerateThisFd = None + OnlyGenerateThisFv = None + OnlyGenerateThisCap = None + + ## GenFd() + # + # @param OutputDir Output directory + # @param FdfParser FDF contents parser + # @param Workspace The directory of workspace + # @param ArchList The Arch list of platform + # + def GenFd (OutputDir, FdfParser, WorkSpace, ArchList): + GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList) + + GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images and their required FV and Capsule images!") + if GenFds.OnlyGenerateThisCap != None and GenFds.OnlyGenerateThisCap.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys(): + CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.get(GenFds.OnlyGenerateThisCap.upper()) + if CapsuleObj != None: + CapsuleObj.GenCapsule() + return + + if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): + FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(GenFds.OnlyGenerateThisFd.upper()) + if FdObj != None: + FdObj.GenFd() + return + elif GenFds.OnlyGenerateThisFd == None and GenFds.OnlyGenerateThisFv == None: + for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): + FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName] + FdObj.GenFd() + + GenFdsGlobalVariable.VerboseLogger("\n Generate other FV images! ") + if GenFds.OnlyGenerateThisFv != None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys(): + FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(GenFds.OnlyGenerateThisFv.upper()) + if FvObj != None: + Buffer = StringIO.StringIO() + FvObj.AddToBuffer(Buffer) + Buffer.close() + return + elif GenFds.OnlyGenerateThisFv == None: + for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys(): + Buffer = StringIO.StringIO('') + FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName] + FvObj.AddToBuffer(Buffer) + Buffer.close() + + if GenFds.OnlyGenerateThisFv == None and GenFds.OnlyGenerateThisFd == None and GenFds.OnlyGenerateThisCap == None: + if GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict != {}: + GenFdsGlobalVariable.VerboseLogger("\n Generate other Capsule images!") + for CapsuleName in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys(): + CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[CapsuleName] + CapsuleObj.GenCapsule() + + if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}: + GenFdsGlobalVariable.VerboseLogger("\n Generate all Option ROM!") + for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys(): + OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName] + OptRomObj.AddToBuffer(None) + + ## GetFvBlockSize() + # + # @param FvObj Whose block size to get + # @retval int Block size value + # + def GetFvBlockSize(FvObj): + DefaultBlockSize = 0x1 + FdObj = None + if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): + FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()] + if FdObj == None: + for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values(): + for ElementRegion in ElementFd.RegionList: + if ElementRegion.RegionType == 'FV': + for ElementRegionData in ElementRegion.RegionDataList: + if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName: + if FvObj.BlockSizeList != []: + return FvObj.BlockSizeList[0][0] + else: + return ElementRegion.BlockSizeOfRegion(ElementFd.BlockSizeList) + if FvObj.BlockSizeList != []: + return FvObj.BlockSizeList[0][0] + return DefaultBlockSize + else: + for ElementRegion in FdObj.RegionList: + if ElementRegion.RegionType == 'FV': + for ElementRegionData in ElementRegion.RegionDataList: + if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName: + if FvObj.BlockSizeList != []: + return FvObj.BlockSizeList[0][0] + else: + return ElementRegion.BlockSizeOfRegion(ElementFd.BlockSizeList) + return DefaultBlockSize + + ## DisplayFvSpaceInfo() + # + # @param FvObj Whose block size to get + # @retval None + # + def DisplayFvSpaceInfo(FdfParser): + + FvSpaceInfoList = [] + MaxFvNameLength = 0 + for FvName in FdfParser.Profile.FvDict: + if len(FvName) > MaxFvNameLength: + MaxFvNameLength = len(FvName) + FvSpaceInfoFileName = os.path.join(GenFdsGlobalVariable.FvDir, FvName.upper() + '.Fv.map') + if os.path.exists(FvSpaceInfoFileName): + FileLinesList = linecache.getlines(FvSpaceInfoFileName) + TotalFound = False + Total = '' + UsedFound = False + Used = '' + FreeFound = False + Free = '' + for Line in FileLinesList: + NameValue = Line.split('=') + if len(NameValue) == 2: + if NameValue[0].strip() == 'EFI_FV_TOTAL_SIZE': + TotalFound = True + Total = NameValue[1].strip() + if NameValue[0].strip() == 'EFI_FV_TAKEN_SIZE': + UsedFound = True + Used = NameValue[1].strip() + if NameValue[0].strip() == 'EFI_FV_SPACE_SIZE': + FreeFound = True + Free = NameValue[1].strip() + + if TotalFound and UsedFound and FreeFound: + FvSpaceInfoList.append((FvName, Total, Used, Free)) + + GenFdsGlobalVariable.InfLogger('\nFV Space Information') + for FvSpaceInfo in FvSpaceInfoList: + Name = FvSpaceInfo[0] + TotalSizeValue = long(FvSpaceInfo[1], 0) + UsedSizeValue = long(FvSpaceInfo[2], 0) + FreeSizeValue = long(FvSpaceInfo[3], 0) + if UsedSizeValue == TotalSizeValue: + Percentage = '100' + else: + Percentage = str((UsedSizeValue+0.0)/TotalSizeValue)[0:4].lstrip('0.') + + GenFdsGlobalVariable.InfLogger(Name + ' ' + '[' + Percentage + '%Full] ' + str(TotalSizeValue) + ' total, ' + str(UsedSizeValue) + ' used, ' + str(FreeSizeValue) + ' free') + + ## PreprocessImage() + # + # @param BuildDb Database from build meta data files + # @param DscFile modules from dsc file will be preprocessed + # @retval None + # + def PreprocessImage(BuildDb, DscFile): + PcdDict = BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Pcds + PcdValue = '' + for Key in PcdDict: + PcdObj = PcdDict[Key] + if PcdObj.TokenCName == 'PcdBsBaseAddress': + PcdValue = PcdObj.DefaultValue + break + + if PcdValue == '': + return + + Int64PcdValue = long(PcdValue, 0) + if Int64PcdValue == 0 or Int64PcdValue < -1: + return + + TopAddress = 0 + if Int64PcdValue > 0: + TopAddress = Int64PcdValue + + ModuleDict = BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Modules + for Key in ModuleDict: + ModuleObj = BuildDb.BuildObject[Key, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] + print ModuleObj.BaseName + ' ' + ModuleObj.ModuleType + + def GenerateGuidXRefFile(BuildDb, ArchList): + GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref") + GuidXRefFile = StringIO.StringIO('') + for Arch in ArchList: + PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] + for ModuleFile in PlatformDataBase.Modules: + Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] + GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName)) + if GuidXRefFile.getvalue(): + SaveFileOnChange(GuidXRefFileName, GuidXRefFile.getvalue(), False) + GenFdsGlobalVariable.InfLogger("\nGUID cross reference file can be found at %s" % GuidXRefFileName) + elif os.path.exists(GuidXRefFileName): + os.remove(GuidXRefFileName) + GuidXRefFile.close() + + ##Define GenFd as static function + GenFd = staticmethod(GenFd) + GetFvBlockSize = staticmethod(GetFvBlockSize) + DisplayFvSpaceInfo = staticmethod(DisplayFvSpaceInfo) + PreprocessImage = staticmethod(PreprocessImage) + GenerateGuidXRefFile = staticmethod(GenerateGuidXRefFile) + +if __name__ == '__main__': + r = main() + ## 0-127 is a safe return range, and 1 is a standard default error + if r < 0 or r > 127: r = 1 + sys.exit(r) + diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index 1cd31bccc3..cbf3d980a8 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -1,722 +1,722 @@ -## @file -# Global variables for GenFds -# -# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import sys -import subprocess -import struct -import array - -from Common.BuildToolError import * -from Common import EdkLogger -from Common.Misc import SaveFileOnChange - -from Common.TargetTxtClassObject import TargetTxtClassObject -from Common.ToolDefClassObject import ToolDefClassObject -from AutoGen.BuildEngine import BuildRule -import Common.DataType as DataType -from Common.Misc import PathClass - -## Global variables -# -# -class GenFdsGlobalVariable: - FvDir = '' - OutputDirDict = {} - BinDir = '' - # will be FvDir + os.sep + 'Ffs' - FfsDir = '' - FdfParser = None - LibDir = '' - WorkSpace = None - WorkSpaceDir = '' - EdkSourceDir = '' - OutputDirFromDscDict = {} - TargetName = '' - ToolChainTag = '' - RuleDict = {} - ArchList = None - VtfDict = {} - ActivePlatform = None - FvAddressFileName = '' - VerboseMode = False - DebugLevel = -1 - SharpCounter = 0 - SharpNumberPerLine = 40 - FdfFile = '' - FdfFileTimeStamp = 0 - FixedLoadAddress = False - PlatformName = '' - - BuildRuleFamily = "MSFT" - ToolChainFamily = "MSFT" - __BuildRuleDatabase = None - - # - # The list whose element are flags to indicate if large FFS or SECTION files exist in FV. - # At the beginning of each generation of FV, false flag is appended to the list, - # after the call to GenerateSection returns, check the size of the output file, - # if it is greater than 0xFFFFFF, the tail flag in list is set to true, - # and EFI_FIRMWARE_FILE_SYSTEM3_GUID is passed to C GenFv. - # At the end of generation of FV, pop the flag. - # List is used as a stack to handle nested FV generation. - # - LargeFileInFvFlags = [] - EFI_FIRMWARE_FILE_SYSTEM3_GUID = '5473C07A-3DCB-4dca-BD6F-1E9689E7349A' - LARGE_FILE_SIZE = 0x1000000 - - SectionHeader = struct.Struct("3B 1B") - - ## LoadBuildRule - # - @staticmethod - def __LoadBuildRule(): - if GenFdsGlobalVariable.__BuildRuleDatabase: - return GenFdsGlobalVariable.__BuildRuleDatabase - BuildConfigurationFile = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, "Conf/target.txt")) - TargetTxt = TargetTxtClassObject() - if os.path.isfile(BuildConfigurationFile) == True: - TargetTxt.LoadTargetTxtFile(BuildConfigurationFile) - if DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF in TargetTxt.TargetTxtDictionary: - BuildRuleFile = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF] - if BuildRuleFile in [None, '']: - BuildRuleFile = 'Conf/build_rule.txt' - GenFdsGlobalVariable.__BuildRuleDatabase = BuildRule(BuildRuleFile) - ToolDefinitionFile = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF] - if ToolDefinitionFile == '': - ToolDefinitionFile = "Conf/tools_def.txt" - if os.path.isfile(ToolDefinitionFile): - ToolDef = ToolDefClassObject() - ToolDef.LoadToolDefFile(ToolDefinitionFile) - ToolDefinition = ToolDef.ToolsDefTxtDatabase - if DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDefinition \ - and GenFdsGlobalVariable.ToolChainTag in ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY] \ - and ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlobalVariable.ToolChainTag]: - GenFdsGlobalVariable.BuildRuleFamily = ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlobalVariable.ToolChainTag] - - if DataType.TAB_TOD_DEFINES_FAMILY in ToolDefinition \ - and GenFdsGlobalVariable.ToolChainTag in ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY] \ - and ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable.ToolChainTag]: - GenFdsGlobalVariable.ToolChainFamily = ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable.ToolChainTag] - return GenFdsGlobalVariable.__BuildRuleDatabase - - ## GetBuildRules - # @param Inf: object of InfBuildData - # @param Arch: current arch - # - @staticmethod - def GetBuildRules(Inf, Arch): - if not Arch: - Arch = 'COMMON' - - if not Arch in GenFdsGlobalVariable.OutputDirDict: - return {} - - BuildRuleDatabase = GenFdsGlobalVariable.__LoadBuildRule() - if not BuildRuleDatabase: - return {} - - PathClassObj = PathClass(Inf.MetaFile.File, - GenFdsGlobalVariable.WorkSpaceDir) - Macro = {} - Macro["WORKSPACE" ] = GenFdsGlobalVariable.WorkSpaceDir - Macro["MODULE_NAME" ] = Inf.BaseName - Macro["MODULE_GUID" ] = Inf.Guid - Macro["MODULE_VERSION" ] = Inf.Version - Macro["MODULE_TYPE" ] = Inf.ModuleType - Macro["MODULE_FILE" ] = str(PathClassObj) - Macro["MODULE_FILE_BASE_NAME" ] = PathClassObj.BaseName - Macro["MODULE_RELATIVE_DIR" ] = PathClassObj.SubDir - Macro["MODULE_DIR" ] = PathClassObj.SubDir - - Macro["BASE_NAME" ] = Inf.BaseName - - Macro["ARCH" ] = Arch - Macro["TOOLCHAIN" ] = GenFdsGlobalVariable.ToolChainTag - Macro["TOOLCHAIN_TAG" ] = GenFdsGlobalVariable.ToolChainTag - Macro["TOOL_CHAIN_TAG" ] = GenFdsGlobalVariable.ToolChainTag - Macro["TARGET" ] = GenFdsGlobalVariable.TargetName - - Macro["BUILD_DIR" ] = GenFdsGlobalVariable.OutputDirDict[Arch] - Macro["BIN_DIR" ] = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch], Arch) - Macro["LIB_DIR" ] = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch], Arch) - BuildDir = os.path.join( - GenFdsGlobalVariable.OutputDirDict[Arch], - Arch, - PathClassObj.SubDir, - PathClassObj.BaseName - ) - Macro["MODULE_BUILD_DIR" ] = BuildDir - Macro["OUTPUT_DIR" ] = os.path.join(BuildDir, "OUTPUT") - Macro["DEBUG_DIR" ] = os.path.join(BuildDir, "DEBUG") - - BuildRules = {} - for Type in BuildRuleDatabase.FileTypeList: - #first try getting build rule by BuildRuleFamily - RuleObject = BuildRuleDatabase[Type, Inf.BuildType, Arch, GenFdsGlobalVariable.BuildRuleFamily] - if not RuleObject: - # build type is always module type, but ... - if Inf.ModuleType != Inf.BuildType: - RuleObject = BuildRuleDatabase[Type, Inf.ModuleType, Arch, GenFdsGlobalVariable.BuildRuleFamily] - #second try getting build rule by ToolChainFamily - if not RuleObject: - RuleObject = BuildRuleDatabase[Type, Inf.BuildType, Arch, GenFdsGlobalVariable.ToolChainFamily] - if not RuleObject: - # build type is always module type, but ... - if Inf.ModuleType != Inf.BuildType: - RuleObject = BuildRuleDatabase[Type, Inf.ModuleType, Arch, GenFdsGlobalVariable.ToolChainFamily] - if not RuleObject: - continue - RuleObject = RuleObject.Instantiate(Macro) - BuildRules[Type] = RuleObject - for Ext in RuleObject.SourceFileExtList: - BuildRules[Ext] = RuleObject - return BuildRules - - ## GetModuleCodaTargetList - # - # @param Inf: object of InfBuildData - # @param Arch: current arch - # - @staticmethod - def GetModuleCodaTargetList(Inf, Arch): - BuildRules = GenFdsGlobalVariable.GetBuildRules(Inf, Arch) - if not BuildRules: - return [] - - TargetList = set() - FileList = [] - for File in Inf.Sources: - if File.TagName in ("", "*", GenFdsGlobalVariable.ToolChainTag) and \ - File.ToolChainFamily in ("", "*", GenFdsGlobalVariable.ToolChainFamily): - FileList.append((File, DataType.TAB_UNKNOWN_FILE)) - - for File in Inf.Binaries: - if File.Target in ['COMMON', '*', GenFdsGlobalVariable.TargetName]: - FileList.append((File, File.Type)) - - for File, FileType in FileList: - LastTarget = None - RuleChain = [] - SourceList = [File] - Index = 0 - while Index < len(SourceList): - Source = SourceList[Index] - Index = Index + 1 - - if File.IsBinary and File == Source and Inf.Binaries != None and File in Inf.Binaries: - # Skip all files that are not binary libraries - if not Inf.LibraryClass: - continue - RuleObject = BuildRules[DataType.TAB_DEFAULT_BINARY_FILE] - elif FileType in BuildRules: - RuleObject = BuildRules[FileType] - elif Source.Ext in BuildRules: - RuleObject = BuildRules[Source.Ext] - else: - # stop at no more rules - if LastTarget: - TargetList.add(str(LastTarget)) - break - - FileType = RuleObject.SourceFileType - - # stop at STATIC_LIBRARY for library - if Inf.LibraryClass and FileType == DataType.TAB_STATIC_LIBRARY: - if LastTarget: - TargetList.add(str(LastTarget)) - break - - Target = RuleObject.Apply(Source) - if not Target: - if LastTarget: - TargetList.add(str(LastTarget)) - break - elif not Target.Outputs: - # Only do build for target with outputs - TargetList.add(str(Target)) - - # to avoid cyclic rule - if FileType in RuleChain: - break - - RuleChain.append(FileType) - SourceList.extend(Target.Outputs) - LastTarget = Target - FileType = DataType.TAB_UNKNOWN_FILE - - return list(TargetList) - - ## SetDir() - # - # @param OutputDir Output directory - # @param FdfParser FDF contents parser - # @param Workspace The directory of workspace - # @param ArchList The Arch list of platform - # - def SetDir (OutputDir, FdfParser, WorkSpace, ArchList): - GenFdsGlobalVariable.VerboseLogger( "GenFdsGlobalVariable.OutputDir :%s" %OutputDir) -# GenFdsGlobalVariable.OutputDirDict = OutputDir - GenFdsGlobalVariable.FdfParser = FdfParser - GenFdsGlobalVariable.WorkSpace = WorkSpace - GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], 'FV') - if not os.path.exists(GenFdsGlobalVariable.FvDir) : - os.makedirs(GenFdsGlobalVariable.FvDir) - GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs') - if not os.path.exists(GenFdsGlobalVariable.FfsDir) : - os.makedirs(GenFdsGlobalVariable.FfsDir) - if ArchList != None: - GenFdsGlobalVariable.ArchList = ArchList - - T_CHAR_LF = '\n' - # - # Create FV Address inf file - # - GenFdsGlobalVariable.FvAddressFileName = os.path.join(GenFdsGlobalVariable.FfsDir, 'FvAddress.inf') - FvAddressFile = open (GenFdsGlobalVariable.FvAddressFileName, 'w') - # - # Add [Options] - # - FvAddressFile.writelines("[options]" + T_CHAR_LF) - BsAddress = '0' - for Arch in ArchList: - if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].BsBaseAddress: - BsAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].BsBaseAddress - break - - FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS = " + \ - BsAddress + \ - T_CHAR_LF) - - RtAddress = '0' - for Arch in ArchList: - if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBaseAddress: - RtAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBaseAddress - - FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS = " + \ - RtAddress + \ - T_CHAR_LF) - - FvAddressFile.close() - - ## ReplaceWorkspaceMacro() - # - # @param String String that may contain macro - # - def ReplaceWorkspaceMacro(String): - Str = String.replace('$(WORKSPACE)', GenFdsGlobalVariable.WorkSpaceDir) - if os.path.exists(Str): - if not os.path.isabs(Str): - Str = os.path.abspath(Str) - else: - Str = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, String) - return os.path.normpath(Str) - - ## Check if the input files are newer than output files - # - # @param Output Path of output file - # @param Input Path list of input files - # - # @retval True if Output doesn't exist, or any Input is newer - # @retval False if all Input is older than Output - # - @staticmethod - def NeedsUpdate(Output, Input): - if not os.path.exists(Output): - return True - # always update "Output" if no "Input" given - if Input == None or len(Input) == 0: - return True - - # if fdf file is changed after the 'Output" is generated, update the 'Output' - OutputTime = os.path.getmtime(Output) - if GenFdsGlobalVariable.FdfFileTimeStamp > OutputTime: - return True - - for F in Input: - # always update "Output" if any "Input" doesn't exist - if not os.path.exists(F): - return True - # always update "Output" if any "Input" is newer than "Output" - if os.path.getmtime(F) > OutputTime: - return True - return False - - @staticmethod - def GenerateSection(Output, Input, Type=None, CompressionType=None, Guid=None, - GuidHdrLen=None, GuidAttr=[], Ui=None, Ver=None, InputAlign=None, BuildNumber=None): - Cmd = ["GenSec"] - if Type not in [None, '']: - Cmd += ["-s", Type] - if CompressionType not in [None, '']: - Cmd += ["-c", CompressionType] - if Guid != None: - Cmd += ["-g", Guid] - if GuidHdrLen not in [None, '']: - Cmd += ["-l", GuidHdrLen] - if len(GuidAttr) != 0: - #Add each guided attribute - for Attr in GuidAttr: - Cmd += ["-r", Attr] - if InputAlign != None: - #Section Align is only for dummy section without section type - for SecAlign in InputAlign: - Cmd += ["--sectionalign", SecAlign] - - CommandFile = Output + '.txt' - if Ui not in [None, '']: - #Cmd += ["-n", '"' + Ui + '"'] - SectionData = array.array('B', [0,0,0,0]) - SectionData.fromstring(Ui.encode("utf_16_le")) - SectionData.append(0) - SectionData.append(0) - Len = len(SectionData) - GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, 0, Len & 0xff, (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15) - SaveFileOnChange(Output, SectionData.tostring()) - elif Ver not in [None, '']: - Cmd += ["-n", Ver] - if BuildNumber: - Cmd += ["-j", BuildNumber] - Cmd += ["-o", Output] - - SaveFileOnChange(CommandFile, ' '.join(Cmd), False) - if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]): - return - - GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section") - else: - Cmd += ["-o", Output] - Cmd += Input - - SaveFileOnChange(CommandFile, ' '.join(Cmd), False) - if GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]): - GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) - GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section") - - if (os.path.getsize(Output) >= GenFdsGlobalVariable.LARGE_FILE_SIZE and - GenFdsGlobalVariable.LargeFileInFvFlags): - GenFdsGlobalVariable.LargeFileInFvFlags[-1] = True - - @staticmethod - def GetAlignment (AlignString): - if AlignString == None: - return 0 +## @file +# Global variables for GenFds +# +# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import sys +import subprocess +import struct +import array + +from Common.BuildToolError import * +from Common import EdkLogger +from Common.Misc import SaveFileOnChange + +from Common.TargetTxtClassObject import TargetTxtClassObject +from Common.ToolDefClassObject import ToolDefClassObject +from AutoGen.BuildEngine import BuildRule +import Common.DataType as DataType +from Common.Misc import PathClass + +## Global variables +# +# +class GenFdsGlobalVariable: + FvDir = '' + OutputDirDict = {} + BinDir = '' + # will be FvDir + os.sep + 'Ffs' + FfsDir = '' + FdfParser = None + LibDir = '' + WorkSpace = None + WorkSpaceDir = '' + EdkSourceDir = '' + OutputDirFromDscDict = {} + TargetName = '' + ToolChainTag = '' + RuleDict = {} + ArchList = None + VtfDict = {} + ActivePlatform = None + FvAddressFileName = '' + VerboseMode = False + DebugLevel = -1 + SharpCounter = 0 + SharpNumberPerLine = 40 + FdfFile = '' + FdfFileTimeStamp = 0 + FixedLoadAddress = False + PlatformName = '' + + BuildRuleFamily = "MSFT" + ToolChainFamily = "MSFT" + __BuildRuleDatabase = None + + # + # The list whose element are flags to indicate if large FFS or SECTION files exist in FV. + # At the beginning of each generation of FV, false flag is appended to the list, + # after the call to GenerateSection returns, check the size of the output file, + # if it is greater than 0xFFFFFF, the tail flag in list is set to true, + # and EFI_FIRMWARE_FILE_SYSTEM3_GUID is passed to C GenFv. + # At the end of generation of FV, pop the flag. + # List is used as a stack to handle nested FV generation. + # + LargeFileInFvFlags = [] + EFI_FIRMWARE_FILE_SYSTEM3_GUID = '5473C07A-3DCB-4dca-BD6F-1E9689E7349A' + LARGE_FILE_SIZE = 0x1000000 + + SectionHeader = struct.Struct("3B 1B") + + ## LoadBuildRule + # + @staticmethod + def __LoadBuildRule(): + if GenFdsGlobalVariable.__BuildRuleDatabase: + return GenFdsGlobalVariable.__BuildRuleDatabase + BuildConfigurationFile = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, "Conf/target.txt")) + TargetTxt = TargetTxtClassObject() + if os.path.isfile(BuildConfigurationFile) == True: + TargetTxt.LoadTargetTxtFile(BuildConfigurationFile) + if DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF in TargetTxt.TargetTxtDictionary: + BuildRuleFile = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF] + if BuildRuleFile in [None, '']: + BuildRuleFile = 'Conf/build_rule.txt' + GenFdsGlobalVariable.__BuildRuleDatabase = BuildRule(BuildRuleFile) + ToolDefinitionFile = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF] + if ToolDefinitionFile == '': + ToolDefinitionFile = "Conf/tools_def.txt" + if os.path.isfile(ToolDefinitionFile): + ToolDef = ToolDefClassObject() + ToolDef.LoadToolDefFile(ToolDefinitionFile) + ToolDefinition = ToolDef.ToolsDefTxtDatabase + if DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY in ToolDefinition \ + and GenFdsGlobalVariable.ToolChainTag in ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY] \ + and ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlobalVariable.ToolChainTag]: + GenFdsGlobalVariable.BuildRuleFamily = ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlobalVariable.ToolChainTag] + + if DataType.TAB_TOD_DEFINES_FAMILY in ToolDefinition \ + and GenFdsGlobalVariable.ToolChainTag in ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY] \ + and ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable.ToolChainTag]: + GenFdsGlobalVariable.ToolChainFamily = ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable.ToolChainTag] + return GenFdsGlobalVariable.__BuildRuleDatabase + + ## GetBuildRules + # @param Inf: object of InfBuildData + # @param Arch: current arch + # + @staticmethod + def GetBuildRules(Inf, Arch): + if not Arch: + Arch = 'COMMON' + + if not Arch in GenFdsGlobalVariable.OutputDirDict: + return {} + + BuildRuleDatabase = GenFdsGlobalVariable.__LoadBuildRule() + if not BuildRuleDatabase: + return {} + + PathClassObj = PathClass(Inf.MetaFile.File, + GenFdsGlobalVariable.WorkSpaceDir) + Macro = {} + Macro["WORKSPACE" ] = GenFdsGlobalVariable.WorkSpaceDir + Macro["MODULE_NAME" ] = Inf.BaseName + Macro["MODULE_GUID" ] = Inf.Guid + Macro["MODULE_VERSION" ] = Inf.Version + Macro["MODULE_TYPE" ] = Inf.ModuleType + Macro["MODULE_FILE" ] = str(PathClassObj) + Macro["MODULE_FILE_BASE_NAME" ] = PathClassObj.BaseName + Macro["MODULE_RELATIVE_DIR" ] = PathClassObj.SubDir + Macro["MODULE_DIR" ] = PathClassObj.SubDir + + Macro["BASE_NAME" ] = Inf.BaseName + + Macro["ARCH" ] = Arch + Macro["TOOLCHAIN" ] = GenFdsGlobalVariable.ToolChainTag + Macro["TOOLCHAIN_TAG" ] = GenFdsGlobalVariable.ToolChainTag + Macro["TOOL_CHAIN_TAG" ] = GenFdsGlobalVariable.ToolChainTag + Macro["TARGET" ] = GenFdsGlobalVariable.TargetName + + Macro["BUILD_DIR" ] = GenFdsGlobalVariable.OutputDirDict[Arch] + Macro["BIN_DIR" ] = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch], Arch) + Macro["LIB_DIR" ] = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch], Arch) + BuildDir = os.path.join( + GenFdsGlobalVariable.OutputDirDict[Arch], + Arch, + PathClassObj.SubDir, + PathClassObj.BaseName + ) + Macro["MODULE_BUILD_DIR" ] = BuildDir + Macro["OUTPUT_DIR" ] = os.path.join(BuildDir, "OUTPUT") + Macro["DEBUG_DIR" ] = os.path.join(BuildDir, "DEBUG") + + BuildRules = {} + for Type in BuildRuleDatabase.FileTypeList: + #first try getting build rule by BuildRuleFamily + RuleObject = BuildRuleDatabase[Type, Inf.BuildType, Arch, GenFdsGlobalVariable.BuildRuleFamily] + if not RuleObject: + # build type is always module type, but ... + if Inf.ModuleType != Inf.BuildType: + RuleObject = BuildRuleDatabase[Type, Inf.ModuleType, Arch, GenFdsGlobalVariable.BuildRuleFamily] + #second try getting build rule by ToolChainFamily + if not RuleObject: + RuleObject = BuildRuleDatabase[Type, Inf.BuildType, Arch, GenFdsGlobalVariable.ToolChainFamily] + if not RuleObject: + # build type is always module type, but ... + if Inf.ModuleType != Inf.BuildType: + RuleObject = BuildRuleDatabase[Type, Inf.ModuleType, Arch, GenFdsGlobalVariable.ToolChainFamily] + if not RuleObject: + continue + RuleObject = RuleObject.Instantiate(Macro) + BuildRules[Type] = RuleObject + for Ext in RuleObject.SourceFileExtList: + BuildRules[Ext] = RuleObject + return BuildRules + + ## GetModuleCodaTargetList + # + # @param Inf: object of InfBuildData + # @param Arch: current arch + # + @staticmethod + def GetModuleCodaTargetList(Inf, Arch): + BuildRules = GenFdsGlobalVariable.GetBuildRules(Inf, Arch) + if not BuildRules: + return [] + + TargetList = set() + FileList = [] + for File in Inf.Sources: + if File.TagName in ("", "*", GenFdsGlobalVariable.ToolChainTag) and \ + File.ToolChainFamily in ("", "*", GenFdsGlobalVariable.ToolChainFamily): + FileList.append((File, DataType.TAB_UNKNOWN_FILE)) + + for File in Inf.Binaries: + if File.Target in ['COMMON', '*', GenFdsGlobalVariable.TargetName]: + FileList.append((File, File.Type)) + + for File, FileType in FileList: + LastTarget = None + RuleChain = [] + SourceList = [File] + Index = 0 + while Index < len(SourceList): + Source = SourceList[Index] + Index = Index + 1 + + if File.IsBinary and File == Source and Inf.Binaries != None and File in Inf.Binaries: + # Skip all files that are not binary libraries + if not Inf.LibraryClass: + continue + RuleObject = BuildRules[DataType.TAB_DEFAULT_BINARY_FILE] + elif FileType in BuildRules: + RuleObject = BuildRules[FileType] + elif Source.Ext in BuildRules: + RuleObject = BuildRules[Source.Ext] + else: + # stop at no more rules + if LastTarget: + TargetList.add(str(LastTarget)) + break + + FileType = RuleObject.SourceFileType + + # stop at STATIC_LIBRARY for library + if Inf.LibraryClass and FileType == DataType.TAB_STATIC_LIBRARY: + if LastTarget: + TargetList.add(str(LastTarget)) + break + + Target = RuleObject.Apply(Source) + if not Target: + if LastTarget: + TargetList.add(str(LastTarget)) + break + elif not Target.Outputs: + # Only do build for target with outputs + TargetList.add(str(Target)) + + # to avoid cyclic rule + if FileType in RuleChain: + break + + RuleChain.append(FileType) + SourceList.extend(Target.Outputs) + LastTarget = Target + FileType = DataType.TAB_UNKNOWN_FILE + + return list(TargetList) + + ## SetDir() + # + # @param OutputDir Output directory + # @param FdfParser FDF contents parser + # @param Workspace The directory of workspace + # @param ArchList The Arch list of platform + # + def SetDir (OutputDir, FdfParser, WorkSpace, ArchList): + GenFdsGlobalVariable.VerboseLogger( "GenFdsGlobalVariable.OutputDir :%s" %OutputDir) +# GenFdsGlobalVariable.OutputDirDict = OutputDir + GenFdsGlobalVariable.FdfParser = FdfParser + GenFdsGlobalVariable.WorkSpace = WorkSpace + GenFdsGlobalVariable.FvDir = os.path.join(GenFdsGlobalVariable.OutputDirDict[ArchList[0]], 'FV') + if not os.path.exists(GenFdsGlobalVariable.FvDir) : + os.makedirs(GenFdsGlobalVariable.FvDir) + GenFdsGlobalVariable.FfsDir = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs') + if not os.path.exists(GenFdsGlobalVariable.FfsDir) : + os.makedirs(GenFdsGlobalVariable.FfsDir) + if ArchList != None: + GenFdsGlobalVariable.ArchList = ArchList + + T_CHAR_LF = '\n' + # + # Create FV Address inf file + # + GenFdsGlobalVariable.FvAddressFileName = os.path.join(GenFdsGlobalVariable.FfsDir, 'FvAddress.inf') + FvAddressFile = open (GenFdsGlobalVariable.FvAddressFileName, 'w') + # + # Add [Options] + # + FvAddressFile.writelines("[options]" + T_CHAR_LF) + BsAddress = '0' + for Arch in ArchList: + if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].BsBaseAddress: + BsAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].BsBaseAddress + break + + FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS = " + \ + BsAddress + \ + T_CHAR_LF) + + RtAddress = '0' + for Arch in ArchList: + if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBaseAddress: + RtAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBaseAddress + + FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS = " + \ + RtAddress + \ + T_CHAR_LF) + + FvAddressFile.close() + + ## ReplaceWorkspaceMacro() + # + # @param String String that may contain macro + # + def ReplaceWorkspaceMacro(String): + Str = String.replace('$(WORKSPACE)', GenFdsGlobalVariable.WorkSpaceDir) + if os.path.exists(Str): + if not os.path.isabs(Str): + Str = os.path.abspath(Str) + else: + Str = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, String) + return os.path.normpath(Str) + + ## Check if the input files are newer than output files + # + # @param Output Path of output file + # @param Input Path list of input files + # + # @retval True if Output doesn't exist, or any Input is newer + # @retval False if all Input is older than Output + # + @staticmethod + def NeedsUpdate(Output, Input): + if not os.path.exists(Output): + return True + # always update "Output" if no "Input" given + if Input == None or len(Input) == 0: + return True + + # if fdf file is changed after the 'Output" is generated, update the 'Output' + OutputTime = os.path.getmtime(Output) + if GenFdsGlobalVariable.FdfFileTimeStamp > OutputTime: + return True + + for F in Input: + # always update "Output" if any "Input" doesn't exist + if not os.path.exists(F): + return True + # always update "Output" if any "Input" is newer than "Output" + if os.path.getmtime(F) > OutputTime: + return True + return False + + @staticmethod + def GenerateSection(Output, Input, Type=None, CompressionType=None, Guid=None, + GuidHdrLen=None, GuidAttr=[], Ui=None, Ver=None, InputAlign=None, BuildNumber=None): + Cmd = ["GenSec"] + if Type not in [None, '']: + Cmd += ["-s", Type] + if CompressionType not in [None, '']: + Cmd += ["-c", CompressionType] + if Guid != None: + Cmd += ["-g", Guid] + if GuidHdrLen not in [None, '']: + Cmd += ["-l", GuidHdrLen] + if len(GuidAttr) != 0: + #Add each guided attribute + for Attr in GuidAttr: + Cmd += ["-r", Attr] + if InputAlign != None: + #Section Align is only for dummy section without section type + for SecAlign in InputAlign: + Cmd += ["--sectionalign", SecAlign] + + CommandFile = Output + '.txt' + if Ui not in [None, '']: + #Cmd += ["-n", '"' + Ui + '"'] + SectionData = array.array('B', [0,0,0,0]) + SectionData.fromstring(Ui.encode("utf_16_le")) + SectionData.append(0) + SectionData.append(0) + Len = len(SectionData) + GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, 0, Len & 0xff, (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15) + SaveFileOnChange(Output, SectionData.tostring()) + elif Ver not in [None, '']: + Cmd += ["-n", Ver] + if BuildNumber: + Cmd += ["-j", BuildNumber] + Cmd += ["-o", Output] + + SaveFileOnChange(CommandFile, ' '.join(Cmd), False) + if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]): + return + + GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section") + else: + Cmd += ["-o", Output] + Cmd += Input + + SaveFileOnChange(CommandFile, ' '.join(Cmd), False) + if GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]): + GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) + GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section") + + if (os.path.getsize(Output) >= GenFdsGlobalVariable.LARGE_FILE_SIZE and + GenFdsGlobalVariable.LargeFileInFvFlags): + GenFdsGlobalVariable.LargeFileInFvFlags[-1] = True + + @staticmethod + def GetAlignment (AlignString): + if AlignString == None: + return 0 if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K"): return int (AlignString.rstrip('K')) * 1024 else: return int (AlignString) - - @staticmethod - def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None, - SectionAlign=None): - Cmd = ["GenFfs", "-t", Type, "-g", Guid] - if Fixed == True: - Cmd += ["-x"] - if CheckSum: - Cmd += ["-s"] - if Align not in [None, '']: - Cmd += ["-a", Align] - - Cmd += ["-o", Output] - for I in range(0, len(Input)): - Cmd += ("-i", Input[I]) - if SectionAlign not in [None, '', []] and SectionAlign[I] not in [None, '']: - Cmd += ("-n", SectionAlign[I]) - - CommandFile = Output + '.txt' - SaveFileOnChange(CommandFile, ' '.join(Cmd), False) - if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]): - return - GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) - - GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS") - - @staticmethod - def GenerateFirmwareVolume(Output, Input, BaseAddress=None, ForceRebase=None, Capsule=False, Dump=False, - AddressFile=None, MapFile=None, FfsList=[], FileSystemGuid=None): - if not GenFdsGlobalVariable.NeedsUpdate(Output, Input+FfsList): - return - GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) - - Cmd = ["GenFv"] - if BaseAddress not in [None, '']: - Cmd += ["-r", BaseAddress] - - if ForceRebase == False: - Cmd +=["-F", "FALSE"] - elif ForceRebase == True: - Cmd +=["-F", "TRUE"] - - if Capsule: - Cmd += ["-c"] - if Dump: - Cmd += ["-p"] - if AddressFile not in [None, '']: - Cmd += ["-a", AddressFile] - if MapFile not in [None, '']: - Cmd += ["-m", MapFile] - if FileSystemGuid: - Cmd += ["-g", FileSystemGuid] - Cmd += ["-o", Output] - for I in Input: - Cmd += ["-i", I] - - GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FV") - - @staticmethod - def GenerateVtf(Output, Input, BaseAddress=None, FvSize=None): - if not GenFdsGlobalVariable.NeedsUpdate(Output, Input): - return - GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) - - Cmd = ["GenVtf"] - if BaseAddress not in [None, ''] and FvSize not in [None, ''] \ - and len(BaseAddress) == len(FvSize): - for I in range(0, len(BaseAddress)): - Cmd += ["-r", BaseAddress[I], "-s", FvSize[I]] - Cmd += ["-o", Output] - for F in Input: - Cmd += ["-f", F] - - GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate VTF") - - @staticmethod - def GenerateFirmwareImage(Output, Input, Type="efi", SubType=None, Zero=False, - Strip=False, Replace=False, TimeStamp=None, Join=False, - Align=None, Padding=None, Convert=False): - if not GenFdsGlobalVariable.NeedsUpdate(Output, Input): - return - GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) - - Cmd = ["GenFw"] - if Type.lower() == "te": - Cmd += ["-t"] - if SubType not in [None, '']: - Cmd += ["-e", SubType] - if TimeStamp not in [None, '']: - Cmd += ["-s", TimeStamp] - if Align not in [None, '']: - Cmd += ["-a", Align] - if Padding not in [None, '']: - Cmd += ["-p", Padding] - if Zero: - Cmd += ["-z"] - if Strip: - Cmd += ["-l"] - if Replace: - Cmd += ["-r"] - if Join: - Cmd += ["-j"] - if Convert: - Cmd += ["-m"] - Cmd += ["-o", Output] - Cmd += Input - - GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate firmware image") - - @staticmethod - def GenerateOptionRom(Output, EfiInput, BinaryInput, Compress=False, ClassCode=None, - Revision=None, DeviceId=None, VendorId=None): - InputList = [] - Cmd = ["EfiRom"] - if len(EfiInput) > 0: - - if Compress: - Cmd += ["-ec"] - else: - Cmd += ["-e"] - - for EfiFile in EfiInput: - Cmd += [EfiFile] - InputList.append (EfiFile) - - if len(BinaryInput) > 0: - Cmd += ["-b"] - for BinFile in BinaryInput: - Cmd += [BinFile] - InputList.append (BinFile) - - # Check List - if not GenFdsGlobalVariable.NeedsUpdate(Output, InputList): - return - GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList)) - - if ClassCode != None: - Cmd += ["-l", ClassCode] - if Revision != None: - Cmd += ["-r", Revision] - if DeviceId != None: - Cmd += ["-i", DeviceId] - if VendorId != None: - Cmd += ["-f", VendorId] - - Cmd += ["-o", Output] - GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate option rom") - - @staticmethod - def GuidTool(Output, Input, ToolPath, Options='', returnValue=[]): - if not GenFdsGlobalVariable.NeedsUpdate(Output, Input): - return - GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) - - Cmd = [ToolPath, ] - Cmd += Options.split(' ') - Cmd += ["-o", Output] - Cmd += Input - - GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to call " + ToolPath, returnValue) - - def CallExternalTool (cmd, errorMess, returnValue=[]): - - if type(cmd) not in (tuple, list): - GenFdsGlobalVariable.ErrorLogger("ToolError! Invalid parameter type in call to CallExternalTool") - - if GenFdsGlobalVariable.DebugLevel != -1: - cmd += ('--debug', str(GenFdsGlobalVariable.DebugLevel)) - GenFdsGlobalVariable.InfLogger (cmd) - - if GenFdsGlobalVariable.VerboseMode: - cmd += ('-v',) - GenFdsGlobalVariable.InfLogger (cmd) - else: - sys.stdout.write ('#') - sys.stdout.flush() - GenFdsGlobalVariable.SharpCounter = GenFdsGlobalVariable.SharpCounter + 1 - if GenFdsGlobalVariable.SharpCounter % GenFdsGlobalVariable.SharpNumberPerLine == 0: - sys.stdout.write('\n') - - try: - PopenObject = subprocess.Popen(' '.join(cmd), stdout=subprocess.PIPE, stderr= subprocess.PIPE, shell=True) - except Exception, X: - EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0])) - (out, error) = PopenObject.communicate() - - while PopenObject.returncode == None : - PopenObject.wait() - if returnValue != [] and returnValue[0] != 0: - #get command return value - returnValue[0] = PopenObject.returncode - return - if PopenObject.returncode != 0 or GenFdsGlobalVariable.VerboseMode or GenFdsGlobalVariable.DebugLevel != -1: - GenFdsGlobalVariable.InfLogger ("Return Value = %d" %PopenObject.returncode) - GenFdsGlobalVariable.InfLogger (out) - GenFdsGlobalVariable.InfLogger (error) - if PopenObject.returncode != 0: - print "###", cmd - EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess) - - def VerboseLogger (msg): - EdkLogger.verbose(msg) - - def InfLogger (msg): - EdkLogger.info(msg) - - def ErrorLogger (msg, File = None, Line = None, ExtraData = None): - EdkLogger.error('GenFds', GENFDS_ERROR, msg, File, Line, ExtraData) - - def DebugLogger (Level, msg): - EdkLogger.debug(Level, msg) - - ## ReplaceWorkspaceMacro() - # - # @param Str String that may contain macro - # @param MacroDict Dictionary that contains macro value pair - # - def MacroExtend (Str, MacroDict = {}, Arch = 'COMMON'): - if Str == None : - return None - - Dict = {'$(WORKSPACE)' : GenFdsGlobalVariable.WorkSpaceDir, - '$(EDK_SOURCE)' : GenFdsGlobalVariable.EdkSourceDir, -# '$(OUTPUT_DIRECTORY)': GenFdsGlobalVariable.OutputDirFromDsc, - '$(TARGET)' : GenFdsGlobalVariable.TargetName, - '$(TOOL_CHAIN_TAG)' : GenFdsGlobalVariable.ToolChainTag - } - OutputDir = GenFdsGlobalVariable.OutputDirFromDscDict[GenFdsGlobalVariable.ArchList[0]] - if Arch != 'COMMON' and Arch in GenFdsGlobalVariable.ArchList: - OutputDir = GenFdsGlobalVariable.OutputDirFromDscDict[Arch] - - Dict['$(OUTPUT_DIRECTORY)'] = OutputDir - - if MacroDict != None and len (MacroDict) != 0: - Dict.update(MacroDict) - - for key in Dict.keys(): - if Str.find(key) >= 0 : - Str = Str.replace (key, Dict[key]) - - if Str.find('$(ARCH)') >= 0: - if len(GenFdsGlobalVariable.ArchList) == 1: - Str = Str.replace('$(ARCH)', GenFdsGlobalVariable.ArchList[0]) - else: - EdkLogger.error("GenFds", GENFDS_ERROR, "No way to determine $(ARCH) for %s" % Str) - - return Str - - ## GetPcdValue() - # - # @param PcdPattern pattern that labels a PCD. - # - def GetPcdValue (PcdPattern): - if PcdPattern == None : - return None - PcdPair = PcdPattern.lstrip('PCD(').rstrip(')').strip().split('.') - TokenSpace = PcdPair[0] - TokenCName = PcdPair[1] - - PcdValue = '' - for Arch in GenFdsGlobalVariable.ArchList: - Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] - PcdDict = Platform.Pcds - for Key in PcdDict: - PcdObj = PcdDict[Key] - if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace): - if PcdObj.Type != 'FixedAtBuild': - EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern) - if PcdObj.DatumType != 'VOID*': - EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern) - - PcdValue = PcdObj.DefaultValue - return PcdValue - - for Package in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform, - Arch, - GenFdsGlobalVariable.TargetName, - GenFdsGlobalVariable.ToolChainTag): - PcdDict = Package.Pcds - for Key in PcdDict: - PcdObj = PcdDict[Key] - if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace): - if PcdObj.Type != 'FixedAtBuild': - EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern) - if PcdObj.DatumType != 'VOID*': - EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern) - - PcdValue = PcdObj.DefaultValue - return PcdValue - - return PcdValue - - SetDir = staticmethod(SetDir) - ReplaceWorkspaceMacro = staticmethod(ReplaceWorkspaceMacro) - CallExternalTool = staticmethod(CallExternalTool) - VerboseLogger = staticmethod(VerboseLogger) - InfLogger = staticmethod(InfLogger) - ErrorLogger = staticmethod(ErrorLogger) - DebugLogger = staticmethod(DebugLogger) - MacroExtend = staticmethod (MacroExtend) - GetPcdValue = staticmethod(GetPcdValue) + + @staticmethod + def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None, + SectionAlign=None): + Cmd = ["GenFfs", "-t", Type, "-g", Guid] + if Fixed == True: + Cmd += ["-x"] + if CheckSum: + Cmd += ["-s"] + if Align not in [None, '']: + Cmd += ["-a", Align] + + Cmd += ["-o", Output] + for I in range(0, len(Input)): + Cmd += ("-i", Input[I]) + if SectionAlign not in [None, '', []] and SectionAlign[I] not in [None, '']: + Cmd += ("-n", SectionAlign[I]) + + CommandFile = Output + '.txt' + SaveFileOnChange(CommandFile, ' '.join(Cmd), False) + if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]): + return + GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) + + GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS") + + @staticmethod + def GenerateFirmwareVolume(Output, Input, BaseAddress=None, ForceRebase=None, Capsule=False, Dump=False, + AddressFile=None, MapFile=None, FfsList=[], FileSystemGuid=None): + if not GenFdsGlobalVariable.NeedsUpdate(Output, Input+FfsList): + return + GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) + + Cmd = ["GenFv"] + if BaseAddress not in [None, '']: + Cmd += ["-r", BaseAddress] + + if ForceRebase == False: + Cmd +=["-F", "FALSE"] + elif ForceRebase == True: + Cmd +=["-F", "TRUE"] + + if Capsule: + Cmd += ["-c"] + if Dump: + Cmd += ["-p"] + if AddressFile not in [None, '']: + Cmd += ["-a", AddressFile] + if MapFile not in [None, '']: + Cmd += ["-m", MapFile] + if FileSystemGuid: + Cmd += ["-g", FileSystemGuid] + Cmd += ["-o", Output] + for I in Input: + Cmd += ["-i", I] + + GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FV") + + @staticmethod + def GenerateVtf(Output, Input, BaseAddress=None, FvSize=None): + if not GenFdsGlobalVariable.NeedsUpdate(Output, Input): + return + GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) + + Cmd = ["GenVtf"] + if BaseAddress not in [None, ''] and FvSize not in [None, ''] \ + and len(BaseAddress) == len(FvSize): + for I in range(0, len(BaseAddress)): + Cmd += ["-r", BaseAddress[I], "-s", FvSize[I]] + Cmd += ["-o", Output] + for F in Input: + Cmd += ["-f", F] + + GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate VTF") + + @staticmethod + def GenerateFirmwareImage(Output, Input, Type="efi", SubType=None, Zero=False, + Strip=False, Replace=False, TimeStamp=None, Join=False, + Align=None, Padding=None, Convert=False): + if not GenFdsGlobalVariable.NeedsUpdate(Output, Input): + return + GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) + + Cmd = ["GenFw"] + if Type.lower() == "te": + Cmd += ["-t"] + if SubType not in [None, '']: + Cmd += ["-e", SubType] + if TimeStamp not in [None, '']: + Cmd += ["-s", TimeStamp] + if Align not in [None, '']: + Cmd += ["-a", Align] + if Padding not in [None, '']: + Cmd += ["-p", Padding] + if Zero: + Cmd += ["-z"] + if Strip: + Cmd += ["-l"] + if Replace: + Cmd += ["-r"] + if Join: + Cmd += ["-j"] + if Convert: + Cmd += ["-m"] + Cmd += ["-o", Output] + Cmd += Input + + GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate firmware image") + + @staticmethod + def GenerateOptionRom(Output, EfiInput, BinaryInput, Compress=False, ClassCode=None, + Revision=None, DeviceId=None, VendorId=None): + InputList = [] + Cmd = ["EfiRom"] + if len(EfiInput) > 0: + + if Compress: + Cmd += ["-ec"] + else: + Cmd += ["-e"] + + for EfiFile in EfiInput: + Cmd += [EfiFile] + InputList.append (EfiFile) + + if len(BinaryInput) > 0: + Cmd += ["-b"] + for BinFile in BinaryInput: + Cmd += [BinFile] + InputList.append (BinFile) + + # Check List + if not GenFdsGlobalVariable.NeedsUpdate(Output, InputList): + return + GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList)) + + if ClassCode != None: + Cmd += ["-l", ClassCode] + if Revision != None: + Cmd += ["-r", Revision] + if DeviceId != None: + Cmd += ["-i", DeviceId] + if VendorId != None: + Cmd += ["-f", VendorId] + + Cmd += ["-o", Output] + GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate option rom") + + @staticmethod + def GuidTool(Output, Input, ToolPath, Options='', returnValue=[]): + if not GenFdsGlobalVariable.NeedsUpdate(Output, Input): + return + GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) + + Cmd = [ToolPath, ] + Cmd += Options.split(' ') + Cmd += ["-o", Output] + Cmd += Input + + GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to call " + ToolPath, returnValue) + + def CallExternalTool (cmd, errorMess, returnValue=[]): + + if type(cmd) not in (tuple, list): + GenFdsGlobalVariable.ErrorLogger("ToolError! Invalid parameter type in call to CallExternalTool") + + if GenFdsGlobalVariable.DebugLevel != -1: + cmd += ('--debug', str(GenFdsGlobalVariable.DebugLevel)) + GenFdsGlobalVariable.InfLogger (cmd) + + if GenFdsGlobalVariable.VerboseMode: + cmd += ('-v',) + GenFdsGlobalVariable.InfLogger (cmd) + else: + sys.stdout.write ('#') + sys.stdout.flush() + GenFdsGlobalVariable.SharpCounter = GenFdsGlobalVariable.SharpCounter + 1 + if GenFdsGlobalVariable.SharpCounter % GenFdsGlobalVariable.SharpNumberPerLine == 0: + sys.stdout.write('\n') + + try: + PopenObject = subprocess.Popen(' '.join(cmd), stdout=subprocess.PIPE, stderr= subprocess.PIPE, shell=True) + except Exception, X: + EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0])) + (out, error) = PopenObject.communicate() + + while PopenObject.returncode == None : + PopenObject.wait() + if returnValue != [] and returnValue[0] != 0: + #get command return value + returnValue[0] = PopenObject.returncode + return + if PopenObject.returncode != 0 or GenFdsGlobalVariable.VerboseMode or GenFdsGlobalVariable.DebugLevel != -1: + GenFdsGlobalVariable.InfLogger ("Return Value = %d" %PopenObject.returncode) + GenFdsGlobalVariable.InfLogger (out) + GenFdsGlobalVariable.InfLogger (error) + if PopenObject.returncode != 0: + print "###", cmd + EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess) + + def VerboseLogger (msg): + EdkLogger.verbose(msg) + + def InfLogger (msg): + EdkLogger.info(msg) + + def ErrorLogger (msg, File = None, Line = None, ExtraData = None): + EdkLogger.error('GenFds', GENFDS_ERROR, msg, File, Line, ExtraData) + + def DebugLogger (Level, msg): + EdkLogger.debug(Level, msg) + + ## ReplaceWorkspaceMacro() + # + # @param Str String that may contain macro + # @param MacroDict Dictionary that contains macro value pair + # + def MacroExtend (Str, MacroDict = {}, Arch = 'COMMON'): + if Str == None : + return None + + Dict = {'$(WORKSPACE)' : GenFdsGlobalVariable.WorkSpaceDir, + '$(EDK_SOURCE)' : GenFdsGlobalVariable.EdkSourceDir, +# '$(OUTPUT_DIRECTORY)': GenFdsGlobalVariable.OutputDirFromDsc, + '$(TARGET)' : GenFdsGlobalVariable.TargetName, + '$(TOOL_CHAIN_TAG)' : GenFdsGlobalVariable.ToolChainTag + } + OutputDir = GenFdsGlobalVariable.OutputDirFromDscDict[GenFdsGlobalVariable.ArchList[0]] + if Arch != 'COMMON' and Arch in GenFdsGlobalVariable.ArchList: + OutputDir = GenFdsGlobalVariable.OutputDirFromDscDict[Arch] + + Dict['$(OUTPUT_DIRECTORY)'] = OutputDir + + if MacroDict != None and len (MacroDict) != 0: + Dict.update(MacroDict) + + for key in Dict.keys(): + if Str.find(key) >= 0 : + Str = Str.replace (key, Dict[key]) + + if Str.find('$(ARCH)') >= 0: + if len(GenFdsGlobalVariable.ArchList) == 1: + Str = Str.replace('$(ARCH)', GenFdsGlobalVariable.ArchList[0]) + else: + EdkLogger.error("GenFds", GENFDS_ERROR, "No way to determine $(ARCH) for %s" % Str) + + return Str + + ## GetPcdValue() + # + # @param PcdPattern pattern that labels a PCD. + # + def GetPcdValue (PcdPattern): + if PcdPattern == None : + return None + PcdPair = PcdPattern.lstrip('PCD(').rstrip(')').strip().split('.') + TokenSpace = PcdPair[0] + TokenCName = PcdPair[1] + + PcdValue = '' + for Arch in GenFdsGlobalVariable.ArchList: + Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] + PcdDict = Platform.Pcds + for Key in PcdDict: + PcdObj = PcdDict[Key] + if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace): + if PcdObj.Type != 'FixedAtBuild': + EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern) + if PcdObj.DatumType != 'VOID*': + EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern) + + PcdValue = PcdObj.DefaultValue + return PcdValue + + for Package in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform, + Arch, + GenFdsGlobalVariable.TargetName, + GenFdsGlobalVariable.ToolChainTag): + PcdDict = Package.Pcds + for Key in PcdDict: + PcdObj = PcdDict[Key] + if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace): + if PcdObj.Type != 'FixedAtBuild': + EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern) + if PcdObj.DatumType != 'VOID*': + EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern) + + PcdValue = PcdObj.DefaultValue + return PcdValue + + return PcdValue + + SetDir = staticmethod(SetDir) + ReplaceWorkspaceMacro = staticmethod(ReplaceWorkspaceMacro) + CallExternalTool = staticmethod(CallExternalTool) + VerboseLogger = staticmethod(VerboseLogger) + InfLogger = staticmethod(InfLogger) + ErrorLogger = staticmethod(ErrorLogger) + DebugLogger = staticmethod(DebugLogger) + MacroExtend = staticmethod (MacroExtend) + GetPcdValue = staticmethod(GetPcdValue) diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py index 6deb0f8471..b6227d24fb 100644 --- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py +++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py @@ -1,8 +1,8 @@ ## @file # Generate PCD table for 'Patchable In Module' type PCD with given .map file. -# The Patch PCD table like: -# -# PCD Name Offset in binary +# The Patch PCD table like: +# +# PCD Name Offset in binary # ======== ================ # # Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.
@@ -14,77 +14,77 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -# - -#====================================== External Libraries ======================================== -import optparse -import os -import re -import array - -from Common.BuildToolError import * -import Common.EdkLogger as EdkLogger +# + +#====================================== External Libraries ======================================== +import optparse +import os +import re +import array + +from Common.BuildToolError import * +import Common.EdkLogger as EdkLogger from Common.Misc import PeImageClass from Common.BuildVersion import gBUILD_VERSION - -# Version and Copyright -__version_number__ = ("0.10" + " " + gBUILD_VERSION) -__version__ = "%prog Version " + __version_number__ -__copyright__ = "Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved." - -#====================================== Internal Libraries ======================================== - -#============================================== Code =============================================== -secRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]? +([.\w\$]+) +(\w+)', re.UNICODE) -symRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.:\\\\\w\?@\$]+) +([\da-fA-F]+)', re.UNICODE) - -def parsePcdInfoFromMapFile(mapfilepath, efifilepath): - """ Parse map file to get binary patch pcd information - @param path Map file absolution path - - @return a list which element hold (PcdName, Offset, SectionName) - """ - lines = [] - try: - f = open(mapfilepath, 'r') - lines = f.readlines() - f.close() - except: - return None - - if len(lines) == 0: return None - if lines[0].strip().find("Archive member included because of file (symbol)") != -1: - return _parseForGCC(lines, efifilepath) - return _parseGeneral(lines, efifilepath) - -def _parseForGCC(lines, efifilepath): - """ Parse map file generated by GCC linker """ - status = 0 - imageBase = -1 - sections = [] - bpcds = [] - for line in lines: - line = line.strip() - # status machine transection - if status == 0 and line == "Memory Configuration": - status = 1 - continue - elif status == 1 and line == 'Linker script and memory map': - status = 2 - continue - elif status ==2 and line == 'START GROUP': - status = 3 - continue - + +# Version and Copyright +__version_number__ = ("0.10" + " " + gBUILD_VERSION) +__version__ = "%prog Version " + __version_number__ +__copyright__ = "Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved." + +#====================================== Internal Libraries ======================================== + +#============================================== Code =============================================== +secRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]? +([.\w\$]+) +(\w+)', re.UNICODE) +symRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.:\\\\\w\?@\$]+) +([\da-fA-F]+)', re.UNICODE) + +def parsePcdInfoFromMapFile(mapfilepath, efifilepath): + """ Parse map file to get binary patch pcd information + @param path Map file absolution path + + @return a list which element hold (PcdName, Offset, SectionName) + """ + lines = [] + try: + f = open(mapfilepath, 'r') + lines = f.readlines() + f.close() + except: + return None + + if len(lines) == 0: return None + if lines[0].strip().find("Archive member included because of file (symbol)") != -1: + return _parseForGCC(lines, efifilepath) + return _parseGeneral(lines, efifilepath) + +def _parseForGCC(lines, efifilepath): + """ Parse map file generated by GCC linker """ + status = 0 + imageBase = -1 + sections = [] + bpcds = [] + for line in lines: + line = line.strip() + # status machine transection + if status == 0 and line == "Memory Configuration": + status = 1 + continue + elif status == 1 and line == 'Linker script and memory map': + status = 2 + continue + elif status ==2 and line == 'START GROUP': + status = 3 + continue + # status handler - if status == 2: - m = re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$', line) - if m != None: - sections.append(m.groups(0)) - if status == 2: - m = re.match("^([\da-fA-Fx]+) +[_]+gPcd_BinaryPatch_([\w_\d]+)$", line) - if m != None: - bpcds.append((m.groups(0)[1], int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0])) + if status == 2: + m = re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$', line) + if m != None: + sections.append(m.groups(0)) + if status == 2: + m = re.match("^([\da-fA-Fx]+) +[_]+gPcd_BinaryPatch_([\w_\d]+)$", line) + if m != None: + bpcds.append((m.groups(0)[1], int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0])) # get section information from efi file efisecs = PeImageClass(efifilepath).SectionHeaderList @@ -102,104 +102,104 @@ def _parseForGCC(lines, efifilepath): if pcd[1] >= efisec[1] and pcd[1] < efisec[1]+efisec[3]: #assert efisec[0].strip() == pcd[3].strip() and efisec[1] + redirection == pcd[2], "There are some differences between map file and efi file" pcds.append([pcd[0], efisec[2] + pcd[1] - efisec[1] - redirection, efisec[0]]) - return pcds - -def _parseGeneral(lines, efifilepath): - """ For MSFT, ICC, EBC - @param lines line array for map file - - @return a list which element hold (PcdName, Offset, SectionName) - """ - status = 0 #0 - beginning of file; 1 - PE section definition; 2 - symbol table - secs = [] # key = section name - bPcds = [] - - - for line in lines: - line = line.strip() - if re.match("^Start[' ']+Length[' ']+Name[' ']+Class", line): - status = 1 - continue - if re.match("^Address[' ']+Publics by Value[' ']+Rva\+Base", line): - status = 2 - continue - if re.match("^entry point at", line): - status = 3 - continue - if status == 1 and len(line) != 0: - m = secRe.match(line) - assert m != None, "Fail to parse the section in map file , line is %s" % line - sec_no, sec_start, sec_length, sec_name, sec_class = m.groups(0) - secs.append([int(sec_no, 16), int(sec_start, 16), int(sec_length, 16), sec_name, sec_class]) - if status == 2 and len(line) != 0: - m = symRe.match(line) - assert m != None, "Fail to parse the symbol in map file, line is %s" % line - sec_no, sym_offset, sym_name, vir_addr = m.groups(0) - sec_no = int(sec_no, 16) - sym_offset = int(sym_offset, 16) - vir_addr = int(vir_addr, 16) - m2 = re.match('^[_]+gPcd_BinaryPatch_([\w]+)', sym_name) - if m2 != None: - # fond a binary pcd entry in map file - for sec in secs: - if sec[0] == sec_no and (sym_offset >= sec[1] and sym_offset < sec[1] + sec[2]): - bPcds.append([m2.groups(0)[0], sec[3], sym_offset, vir_addr, sec_no]) - - if len(bPcds) == 0: return None - - # get section information from efi file - efisecs = PeImageClass(efifilepath).SectionHeaderList - if efisecs == None or len(efisecs) == 0: - return None - - pcds = [] - for pcd in bPcds: - index = 0 - for efisec in efisecs: - index = index + 1 - if pcd[1].strip() == efisec[0].strip(): - pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]]) - elif pcd[4] == index: - pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]]) - return pcds - -def generatePcdTable(list, pcdpath): - try: - f = open(pcdpath, 'w') - except: - pass - - f.write('PCD Name Offset Section Name\r\n') - - for pcditem in list: - f.write('%-30s 0x%-08X %-6s\r\n' % (pcditem[0], pcditem[1], pcditem[2])) - f.close() - - #print 'Success to generate Binary Patch PCD table at %s!' % pcdpath - -if __name__ == '__main__': - UsageString = "%prog -m -e -o " - AdditionalNotes = "\nPCD table is generated in file name with .BinaryPcdTable.txt postfix" - parser = optparse.OptionParser(description=__copyright__, version=__version__, usage=UsageString) - parser.add_option('-m', '--mapfile', action='store', dest='mapfile', - help='Absolute path of module map file.') - parser.add_option('-e', '--efifile', action='store', dest='efifile', - help='Absolute path of EFI binary file.') - parser.add_option('-o', '--outputfile', action='store', dest='outfile', - help='Absolute path of output file to store the got patchable PCD table.') - - (options, args) = parser.parse_args() - - if options.mapfile == None or options.efifile == None: - print parser.get_usage() - elif os.path.exists(options.mapfile) and os.path.exists(options.efifile): - list = parsePcdInfoFromMapFile(options.mapfile, options.efifile) - if list != None: - if options.outfile != None: - generatePcdTable(list, options.outfile) - else: - generatePcdTable(list, options.mapfile.replace('.map', '.BinaryPcdTable.txt')) - else: - print 'Fail to generate Patch PCD Table based on map file and efi file' - else: - print 'Fail to generate Patch PCD Table for fail to find map file or efi file!' + return pcds + +def _parseGeneral(lines, efifilepath): + """ For MSFT, ICC, EBC + @param lines line array for map file + + @return a list which element hold (PcdName, Offset, SectionName) + """ + status = 0 #0 - beginning of file; 1 - PE section definition; 2 - symbol table + secs = [] # key = section name + bPcds = [] + + + for line in lines: + line = line.strip() + if re.match("^Start[' ']+Length[' ']+Name[' ']+Class", line): + status = 1 + continue + if re.match("^Address[' ']+Publics by Value[' ']+Rva\+Base", line): + status = 2 + continue + if re.match("^entry point at", line): + status = 3 + continue + if status == 1 and len(line) != 0: + m = secRe.match(line) + assert m != None, "Fail to parse the section in map file , line is %s" % line + sec_no, sec_start, sec_length, sec_name, sec_class = m.groups(0) + secs.append([int(sec_no, 16), int(sec_start, 16), int(sec_length, 16), sec_name, sec_class]) + if status == 2 and len(line) != 0: + m = symRe.match(line) + assert m != None, "Fail to parse the symbol in map file, line is %s" % line + sec_no, sym_offset, sym_name, vir_addr = m.groups(0) + sec_no = int(sec_no, 16) + sym_offset = int(sym_offset, 16) + vir_addr = int(vir_addr, 16) + m2 = re.match('^[_]+gPcd_BinaryPatch_([\w]+)', sym_name) + if m2 != None: + # fond a binary pcd entry in map file + for sec in secs: + if sec[0] == sec_no and (sym_offset >= sec[1] and sym_offset < sec[1] + sec[2]): + bPcds.append([m2.groups(0)[0], sec[3], sym_offset, vir_addr, sec_no]) + + if len(bPcds) == 0: return None + + # get section information from efi file + efisecs = PeImageClass(efifilepath).SectionHeaderList + if efisecs == None or len(efisecs) == 0: + return None + + pcds = [] + for pcd in bPcds: + index = 0 + for efisec in efisecs: + index = index + 1 + if pcd[1].strip() == efisec[0].strip(): + pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]]) + elif pcd[4] == index: + pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]]) + return pcds + +def generatePcdTable(list, pcdpath): + try: + f = open(pcdpath, 'w') + except: + pass + + f.write('PCD Name Offset Section Name\r\n') + + for pcditem in list: + f.write('%-30s 0x%-08X %-6s\r\n' % (pcditem[0], pcditem[1], pcditem[2])) + f.close() + + #print 'Success to generate Binary Patch PCD table at %s!' % pcdpath + +if __name__ == '__main__': + UsageString = "%prog -m -e -o " + AdditionalNotes = "\nPCD table is generated in file name with .BinaryPcdTable.txt postfix" + parser = optparse.OptionParser(description=__copyright__, version=__version__, usage=UsageString) + parser.add_option('-m', '--mapfile', action='store', dest='mapfile', + help='Absolute path of module map file.') + parser.add_option('-e', '--efifile', action='store', dest='efifile', + help='Absolute path of EFI binary file.') + parser.add_option('-o', '--outputfile', action='store', dest='outfile', + help='Absolute path of output file to store the got patchable PCD table.') + + (options, args) = parser.parse_args() + + if options.mapfile == None or options.efifile == None: + print parser.get_usage() + elif os.path.exists(options.mapfile) and os.path.exists(options.efifile): + list = parsePcdInfoFromMapFile(options.mapfile, options.efifile) + if list != None: + if options.outfile != None: + generatePcdTable(list, options.outfile) + else: + generatePcdTable(list, options.mapfile.replace('.map', '.BinaryPcdTable.txt')) + else: + print 'Fail to generate Patch PCD Table based on map file and efi file' + else: + print 'Fail to generate Patch PCD Table for fail to find map file or efi file!' diff --git a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py index 69c8244790..01b87012cd 100644 --- a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py +++ b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py @@ -1,290 +1,290 @@ -## @file -# Patch value into the binary file. -# -# Copyright (c) 2010, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import sys -import re - -from optparse import OptionParser -from optparse import make_option -from Common.BuildToolError import * -import Common.EdkLogger as EdkLogger -from Common.BuildVersion import gBUILD_VERSION -import array - -# Version and Copyright -__version_number__ = ("0.10" + " " + gBUILD_VERSION) -__version__ = "%prog Version " + __version_number__ -__copyright__ = "Copyright (c) 2010, Intel Corporation. All rights reserved." - -## PatchBinaryFile method -# -# This method mainly patches the data into binary file. -# -# @param FileName File path of the binary file -# @param ValueOffset Offset value -# @param TypeName DataType Name -# @param Value Value String -# @param MaxSize MaxSize value -# -# @retval 0 File is updated successfully. -# @retval not 0 File is updated failed. -# -def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0): - # - # Length of Binary File - # - FileHandle = open (FileName, 'rb') - FileHandle.seek (0, 2) - FileLength = FileHandle.tell() - FileHandle.close() - # - # Unify string to upper string - # - TypeName = TypeName.upper() - # - # Get PCD value data length - # - ValueLength = 0 - if TypeName == 'BOOLEAN': - ValueLength = 1 - elif TypeName == 'UINT8': - ValueLength = 1 - elif TypeName == 'UINT16': - ValueLength = 2 - elif TypeName == 'UINT32': - ValueLength = 4 - elif TypeName == 'UINT64': - ValueLength = 8 - elif TypeName == 'VOID*': - if MaxSize == 0: - return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD." - ValueLength = int(MaxSize) - else: - return PARAMETER_INVALID, "PCD type %s is not valid." %(CommandOptions.PcdTypeName) - # - # Check PcdValue is in the input binary file. - # - if ValueOffset + ValueLength > FileLength: - return PARAMETER_INVALID, "PcdOffset + PcdMaxSize(DataType) is larger than the input file size." - # - # Read binary file into array - # - FileHandle = open (FileName, 'rb') - ByteArray = array.array('B') - ByteArray.fromfile(FileHandle, FileLength) - FileHandle.close() - OrigByteList = ByteArray.tolist() - ByteList = ByteArray.tolist() - # - # Clear the data in file - # - for Index in range(ValueLength): - ByteList[ValueOffset + Index] = 0 - # - # Patch value into offset - # - SavedStr = ValueString - ValueString = ValueString.upper() - ValueNumber = 0 - if TypeName == 'BOOLEAN': - # - # Get PCD value for BOOLEAN data type - # - try: - if ValueString == 'TRUE': - ValueNumber = 1 - elif ValueString == 'FALSE': - ValueNumber = 0 - elif ValueString.startswith('0X'): - ValueNumber = int (ValueString, 16) - else: - ValueNumber = int (ValueString) - if ValueNumber != 0: - ValueNumber = 1 - except: - return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString) - # - # Set PCD value into binary data - # - ByteList[ValueOffset] = ValueNumber - elif TypeName in ['UINT8', 'UINT16', 'UINT32', 'UINT64']: - # - # Get PCD value for UINT* data type - # - try: - if ValueString.startswith('0X'): - ValueNumber = int (ValueString, 16) - else: - ValueNumber = int (ValueString) - except: - return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString) - # - # Set PCD value into binary data - # - for Index in range(ValueLength): - ByteList[ValueOffset + Index] = ValueNumber % 0x100 - ValueNumber = ValueNumber / 0x100 - elif TypeName == 'VOID*': - ValueString = SavedStr - if ValueString.startswith('L"'): - # - # Patch Unicode String - # - Index = 0 - for ByteString in ValueString[2:-1]: - # - # Reserve zero as unicode tail - # - if Index + 2 >= ValueLength: - break - # - # Set string value one by one - # - ByteList[ValueOffset + Index] = ord(ByteString) - Index = Index + 2 - elif ValueString.startswith("{") and ValueString.endswith("}"): - # - # Patch {0x1, 0x2, ...} byte by byte - # - ValueList = ValueString[1 : len(ValueString) - 1].split(', ') - Index = 0 - try: - for ByteString in ValueList: - if ByteString.upper().startswith('0X'): - ByteValue = int(ByteString, 16) - else: - ByteValue = int(ByteString) - ByteList[ValueOffset + Index] = ByteValue % 0x100 - Index = Index + 1 - if Index >= ValueLength: - break - except: - return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string array." %(ValueString) - else: - # - # Patch ascii string - # - Index = 0 - for ByteString in ValueString[1:-1]: - # - # Reserve zero as string tail - # - if Index + 1 >= ValueLength: - break - # - # Set string value one by one - # - ByteList[ValueOffset + Index] = ord(ByteString) - Index = Index + 1 - # - # Update new data into input file. - # - if ByteList != OrigByteList: - ByteArray = array.array('B') - ByteArray.fromlist(ByteList) - FileHandle = open (FileName, 'wb') - ByteArray.tofile(FileHandle) - FileHandle.close() - return 0, "Patch Value into File %s successfully." %(FileName) - -## Parse command line options -# -# Using standard Python module optparse to parse command line option of this tool. -# -# @retval Options A optparse.Values object containing the parsed options -# @retval InputFile Path of file to be trimmed -# -def Options(): - OptionList = [ - make_option("-f", "--offset", dest="PcdOffset", action="store", type="int", - help="Start offset to the image is used to store PCD value."), - make_option("-u", "--value", dest="PcdValue", action="store", - help="PCD value will be updated into the image."), - make_option("-t", "--type", dest="PcdTypeName", action="store", - help="The name of PCD data type may be one of VOID*,BOOLEAN, UINT8, UINT16, UINT32, UINT64."), - make_option("-s", "--maxsize", dest="PcdMaxSize", action="store", type="int", - help="Max size of data buffer is taken by PCD value.It must be set when PCD type is VOID*."), - make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE, - help="Run verbosely"), - make_option("-d", "--debug", dest="LogLevel", type="int", - help="Run with debug information"), - make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET, - help="Run quietly"), - make_option("-?", action="help", help="show this help message and exit"), - ] - - # use clearer usage to override default usage message - UsageString = "%prog -f Offset -u Value -t Type [-s MaxSize] " - - Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString) - Parser.set_defaults(LogLevel=EdkLogger.INFO) - - Options, Args = Parser.parse_args() - - # error check - if len(Args) == 0: - EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData=Parser.get_usage()) - - InputFile = Args[len(Args) - 1] - return Options, InputFile - -## Entrance method -# -# This method mainly dispatch specific methods per the command line options. -# If no error found, return zero value so the caller of this tool can know -# if it's executed successfully or not. -# -# @retval 0 Tool was successful -# @retval 1 Tool failed -# -def Main(): - try: - # - # Check input parameter - # - EdkLogger.Initialize() - CommandOptions, InputFile = Options() - if CommandOptions.LogLevel < EdkLogger.DEBUG_9: - EdkLogger.SetLevel(CommandOptions.LogLevel + 1) - else: - EdkLogger.SetLevel(CommandOptions.LogLevel) - if not os.path.exists (InputFile): - EdkLogger.error("PatchPcdValue", FILE_NOT_FOUND, ExtraData=InputFile) - return 1 - if CommandOptions.PcdOffset == None or CommandOptions.PcdValue == None or CommandOptions.PcdTypeName == None: - EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdOffset or PcdValue of PcdTypeName is not specified.") - return 1 - if CommandOptions.PcdTypeName.upper() not in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64", "VOID*"]: - EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." %(CommandOptions.PcdTypeName)) - return 1 - if CommandOptions.PcdTypeName.upper() == "VOID*" and CommandOptions.PcdMaxSize == None: - EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdMaxSize is not specified for VOID* type PCD.") - return 1 - # - # Patch value into binary image. - # - ReturnValue, ErrorInfo = PatchBinaryFile (InputFile, CommandOptions.PcdOffset, CommandOptions.PcdTypeName, CommandOptions.PcdValue, CommandOptions.PcdMaxSize) - if ReturnValue != 0: - EdkLogger.error("PatchPcdValue", ReturnValue, ExtraData=ErrorInfo) - return 1 - return 0 - except: - return 1 - -if __name__ == '__main__': - r = Main() - sys.exit(r) +## @file +# Patch value into the binary file. +# +# Copyright (c) 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import sys +import re + +from optparse import OptionParser +from optparse import make_option +from Common.BuildToolError import * +import Common.EdkLogger as EdkLogger +from Common.BuildVersion import gBUILD_VERSION +import array + +# Version and Copyright +__version_number__ = ("0.10" + " " + gBUILD_VERSION) +__version__ = "%prog Version " + __version_number__ +__copyright__ = "Copyright (c) 2010, Intel Corporation. All rights reserved." + +## PatchBinaryFile method +# +# This method mainly patches the data into binary file. +# +# @param FileName File path of the binary file +# @param ValueOffset Offset value +# @param TypeName DataType Name +# @param Value Value String +# @param MaxSize MaxSize value +# +# @retval 0 File is updated successfully. +# @retval not 0 File is updated failed. +# +def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0): + # + # Length of Binary File + # + FileHandle = open (FileName, 'rb') + FileHandle.seek (0, 2) + FileLength = FileHandle.tell() + FileHandle.close() + # + # Unify string to upper string + # + TypeName = TypeName.upper() + # + # Get PCD value data length + # + ValueLength = 0 + if TypeName == 'BOOLEAN': + ValueLength = 1 + elif TypeName == 'UINT8': + ValueLength = 1 + elif TypeName == 'UINT16': + ValueLength = 2 + elif TypeName == 'UINT32': + ValueLength = 4 + elif TypeName == 'UINT64': + ValueLength = 8 + elif TypeName == 'VOID*': + if MaxSize == 0: + return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD." + ValueLength = int(MaxSize) + else: + return PARAMETER_INVALID, "PCD type %s is not valid." %(CommandOptions.PcdTypeName) + # + # Check PcdValue is in the input binary file. + # + if ValueOffset + ValueLength > FileLength: + return PARAMETER_INVALID, "PcdOffset + PcdMaxSize(DataType) is larger than the input file size." + # + # Read binary file into array + # + FileHandle = open (FileName, 'rb') + ByteArray = array.array('B') + ByteArray.fromfile(FileHandle, FileLength) + FileHandle.close() + OrigByteList = ByteArray.tolist() + ByteList = ByteArray.tolist() + # + # Clear the data in file + # + for Index in range(ValueLength): + ByteList[ValueOffset + Index] = 0 + # + # Patch value into offset + # + SavedStr = ValueString + ValueString = ValueString.upper() + ValueNumber = 0 + if TypeName == 'BOOLEAN': + # + # Get PCD value for BOOLEAN data type + # + try: + if ValueString == 'TRUE': + ValueNumber = 1 + elif ValueString == 'FALSE': + ValueNumber = 0 + elif ValueString.startswith('0X'): + ValueNumber = int (ValueString, 16) + else: + ValueNumber = int (ValueString) + if ValueNumber != 0: + ValueNumber = 1 + except: + return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString) + # + # Set PCD value into binary data + # + ByteList[ValueOffset] = ValueNumber + elif TypeName in ['UINT8', 'UINT16', 'UINT32', 'UINT64']: + # + # Get PCD value for UINT* data type + # + try: + if ValueString.startswith('0X'): + ValueNumber = int (ValueString, 16) + else: + ValueNumber = int (ValueString) + except: + return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string." %(ValueString) + # + # Set PCD value into binary data + # + for Index in range(ValueLength): + ByteList[ValueOffset + Index] = ValueNumber % 0x100 + ValueNumber = ValueNumber / 0x100 + elif TypeName == 'VOID*': + ValueString = SavedStr + if ValueString.startswith('L"'): + # + # Patch Unicode String + # + Index = 0 + for ByteString in ValueString[2:-1]: + # + # Reserve zero as unicode tail + # + if Index + 2 >= ValueLength: + break + # + # Set string value one by one + # + ByteList[ValueOffset + Index] = ord(ByteString) + Index = Index + 2 + elif ValueString.startswith("{") and ValueString.endswith("}"): + # + # Patch {0x1, 0x2, ...} byte by byte + # + ValueList = ValueString[1 : len(ValueString) - 1].split(', ') + Index = 0 + try: + for ByteString in ValueList: + if ByteString.upper().startswith('0X'): + ByteValue = int(ByteString, 16) + else: + ByteValue = int(ByteString) + ByteList[ValueOffset + Index] = ByteValue % 0x100 + Index = Index + 1 + if Index >= ValueLength: + break + except: + return PARAMETER_INVALID, "PCD Value %s is not valid dec or hex string array." %(ValueString) + else: + # + # Patch ascii string + # + Index = 0 + for ByteString in ValueString[1:-1]: + # + # Reserve zero as string tail + # + if Index + 1 >= ValueLength: + break + # + # Set string value one by one + # + ByteList[ValueOffset + Index] = ord(ByteString) + Index = Index + 1 + # + # Update new data into input file. + # + if ByteList != OrigByteList: + ByteArray = array.array('B') + ByteArray.fromlist(ByteList) + FileHandle = open (FileName, 'wb') + ByteArray.tofile(FileHandle) + FileHandle.close() + return 0, "Patch Value into File %s successfully." %(FileName) + +## Parse command line options +# +# Using standard Python module optparse to parse command line option of this tool. +# +# @retval Options A optparse.Values object containing the parsed options +# @retval InputFile Path of file to be trimmed +# +def Options(): + OptionList = [ + make_option("-f", "--offset", dest="PcdOffset", action="store", type="int", + help="Start offset to the image is used to store PCD value."), + make_option("-u", "--value", dest="PcdValue", action="store", + help="PCD value will be updated into the image."), + make_option("-t", "--type", dest="PcdTypeName", action="store", + help="The name of PCD data type may be one of VOID*,BOOLEAN, UINT8, UINT16, UINT32, UINT64."), + make_option("-s", "--maxsize", dest="PcdMaxSize", action="store", type="int", + help="Max size of data buffer is taken by PCD value.It must be set when PCD type is VOID*."), + make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE, + help="Run verbosely"), + make_option("-d", "--debug", dest="LogLevel", type="int", + help="Run with debug information"), + make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET, + help="Run quietly"), + make_option("-?", action="help", help="show this help message and exit"), + ] + + # use clearer usage to override default usage message + UsageString = "%prog -f Offset -u Value -t Type [-s MaxSize] " + + Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString) + Parser.set_defaults(LogLevel=EdkLogger.INFO) + + Options, Args = Parser.parse_args() + + # error check + if len(Args) == 0: + EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData=Parser.get_usage()) + + InputFile = Args[len(Args) - 1] + return Options, InputFile + +## Entrance method +# +# This method mainly dispatch specific methods per the command line options. +# If no error found, return zero value so the caller of this tool can know +# if it's executed successfully or not. +# +# @retval 0 Tool was successful +# @retval 1 Tool failed +# +def Main(): + try: + # + # Check input parameter + # + EdkLogger.Initialize() + CommandOptions, InputFile = Options() + if CommandOptions.LogLevel < EdkLogger.DEBUG_9: + EdkLogger.SetLevel(CommandOptions.LogLevel + 1) + else: + EdkLogger.SetLevel(CommandOptions.LogLevel) + if not os.path.exists (InputFile): + EdkLogger.error("PatchPcdValue", FILE_NOT_FOUND, ExtraData=InputFile) + return 1 + if CommandOptions.PcdOffset == None or CommandOptions.PcdValue == None or CommandOptions.PcdTypeName == None: + EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdOffset or PcdValue of PcdTypeName is not specified.") + return 1 + if CommandOptions.PcdTypeName.upper() not in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64", "VOID*"]: + EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." %(CommandOptions.PcdTypeName)) + return 1 + if CommandOptions.PcdTypeName.upper() == "VOID*" and CommandOptions.PcdMaxSize == None: + EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdMaxSize is not specified for VOID* type PCD.") + return 1 + # + # Patch value into binary image. + # + ReturnValue, ErrorInfo = PatchBinaryFile (InputFile, CommandOptions.PcdOffset, CommandOptions.PcdTypeName, CommandOptions.PcdValue, CommandOptions.PcdMaxSize) + if ReturnValue != 0: + EdkLogger.error("PatchPcdValue", ReturnValue, ExtraData=ErrorInfo) + return 1 + return 0 + except: + return 1 + +if __name__ == '__main__': + r = Main() + sys.exit(r) diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py index 0416ecdcac..c0ede03359 100644 --- a/BaseTools/Source/Python/Trim/Trim.py +++ b/BaseTools/Source/Python/Trim/Trim.py @@ -1,609 +1,609 @@ -## @file -# Trim files preprocessed by compiler -# -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import sys -import re - -from optparse import OptionParser -from optparse import make_option -from Common.BuildToolError import * -from Common.Misc import * -from Common.BuildVersion import gBUILD_VERSION -import Common.EdkLogger as EdkLogger - -# Version and Copyright -__version_number__ = ("0.10" + " " + gBUILD_VERSION) -__version__ = "%prog Version " + __version_number__ -__copyright__ = "Copyright (c) 2007-2010, Intel Corporation. All rights reserved." - -## Regular expression for matching Line Control directive like "#line xxx" -gLineControlDirective = re.compile('^\s*#(?:line)?\s+([0-9]+)\s+"*([^"]*)"') -## Regular expression for matching "typedef struct" -gTypedefPattern = re.compile("^\s*typedef\s+struct(\s+\w+)?\s*[{]*$", re.MULTILINE) -## Regular expression for matching "#pragma pack" -gPragmaPattern = re.compile("^\s*#pragma\s+pack", re.MULTILINE) - -# -# The following number pattern match will only match if following criteria is met: -# There is leading non-(alphanumeric or _) character, and no following alphanumeric or _ -# as the pattern is greedily match, so it is ok for the gDecNumberPattern or gHexNumberPattern to grab the maximum match -# -## Regular expression for matching HEX number -gHexNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])(0[xX])([0-9a-fA-F]+)(U(?=$|[^a-zA-Z0-9_]))?") -## Regular expression for matching decimal number with 'U' postfix -gDecNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])([0-9]+)U(?=$|[^a-zA-Z0-9_])") -## Regular expression for matching constant with 'ULL' 'LL' postfix -gLongNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])(0[xX][0-9a-fA-F]+|[0-9]+)U?LL(?=$|[^a-zA-Z0-9_])") - -## Regular expression for matching "Include ()" in asl file -gAslIncludePattern = re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", re.MULTILINE) -## Regular expression for matching C style #include "XXX.asl" in asl file -gAslCIncludePattern = re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*([>"])', re.MULTILINE) -## Patterns used to convert EDK conventions to EDK2 ECP conventions -gImportCodePatterns = [ - [ - re.compile('^(\s*)\(\*\*PeiServices\)\.PciCfg\s*=\s*([^;\s]+);', re.MULTILINE), - '''\\1{ -\\1 STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = { -\\1 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), -\\1 &gEcpPeiPciCfgPpiGuid, -\\1 \\2 -\\1 }; -\\1 (**PeiServices).InstallPpi (PeiServices, &gEcpPeiPciCfgPpiList); -\\1}''' - ], - - [ - re.compile('^(\s*)\(\*PeiServices\)->PciCfg\s*=\s*([^;\s]+);', re.MULTILINE), - '''\\1{ -\\1 STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = { -\\1 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), -\\1 &gEcpPeiPciCfgPpiGuid, -\\1 \\2 -\\1 }; -\\1 (**PeiServices).InstallPpi (PeiServices, &gEcpPeiPciCfgPpiList); -\\1}''' - ], - - [ - re.compile("(\s*).+->Modify[\s\n]*\(", re.MULTILINE), - '\\1PeiLibPciCfgModify (' - ], - - [ - re.compile("(\W*)gRT->ReportStatusCode[\s\n]*\(", re.MULTILINE), - '\\1EfiLibReportStatusCode (' - ], - - [ - re.compile('#include\s+EFI_GUID_DEFINITION\s*\(FirmwareFileSystem\)', re.MULTILINE), - '#include EFI_GUID_DEFINITION (FirmwareFileSystem)\n#include EFI_GUID_DEFINITION (FirmwareFileSystem2)' - ], - - [ - re.compile('gEfiFirmwareFileSystemGuid', re.MULTILINE), - 'gEfiFirmwareFileSystem2Guid' - ], - - [ - re.compile('EFI_FVH_REVISION', re.MULTILINE), - 'EFI_FVH_PI_REVISION' - ], - - [ - re.compile("(\s*)\S*CreateEvent\s*\([\s\n]*EFI_EVENT_SIGNAL_READY_TO_BOOT[^,]*,((?:[^;]+\n)+)(\s*\));", re.MULTILINE), - '\\1EfiCreateEventReadyToBoot (\\2\\3;' - ], - - [ - re.compile("(\s*)\S*CreateEvent\s*\([\s\n]*EFI_EVENT_SIGNAL_LEGACY_BOOT[^,]*,((?:[^;]+\n)+)(\s*\));", re.MULTILINE), - '\\1EfiCreateEventLegacyBoot (\\2\\3;' - ], -# [ -# re.compile("(\W)(PEI_PCI_CFG_PPI)(\W)", re.MULTILINE), -# '\\1ECP_\\2\\3' -# ] -] - -## file cache to avoid circular include in ASL file -gIncludedAslFile = [] - -## Trim preprocessed source code -# -# Remove extra content made by preprocessor. The preprocessor must enable the -# line number generation option when preprocessing. -# -# @param Source File to be trimmed -# @param Target File to store the trimmed content -# @param Convert If True, convert standard HEX format to MASM format -# -def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong): - CreateDirectory(os.path.dirname(Target)) - try: - f = open (Source, 'r') - except: - EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) - - # read whole file - Lines = f.readlines() - f.close() - - PreprocessedFile = "" - InjectedFile = "" - LineIndexOfOriginalFile = None - NewLines = [] - LineControlDirectiveFound = False - for Index in range(len(Lines)): - Line = Lines[Index] - # - # Find out the name of files injected by preprocessor from the lines - # with Line Control directive - # - MatchList = gLineControlDirective.findall(Line) - if MatchList != []: - MatchList = MatchList[0] - if len(MatchList) == 2: - LineNumber = int(MatchList[0], 0) - InjectedFile = MatchList[1] - # The first injetcted file must be the preprocessed file itself - if PreprocessedFile == "": - PreprocessedFile = InjectedFile - LineControlDirectiveFound = True - continue - elif PreprocessedFile == "" or InjectedFile != PreprocessedFile: - continue - - if LineIndexOfOriginalFile == None: - # - # Any non-empty lines must be from original preprocessed file. - # And this must be the first one. - # - LineIndexOfOriginalFile = Index - EdkLogger.verbose("Found original file content starting from line %d" - % (LineIndexOfOriginalFile + 1)) - - # convert HEX number format if indicated - if ConvertHex: - Line = gHexNumberPattern.sub(r"0\2h", Line) - else: - Line = gHexNumberPattern.sub(r"\1\2", Line) - if TrimLong: - Line = gLongNumberPattern.sub(r"\1", Line) - - # convert Decimal number format - Line = gDecNumberPattern.sub(r"\1", Line) - - if LineNumber != None: - EdkLogger.verbose("Got line directive: line=%d" % LineNumber) - # in case preprocessor removed some lines, like blank or comment lines - if LineNumber <= len(NewLines): - # possible? - NewLines[LineNumber - 1] = Line - else: - if LineNumber > (len(NewLines) + 1): - for LineIndex in range(len(NewLines), LineNumber-1): - NewLines.append(os.linesep) - NewLines.append(Line) - LineNumber = None - EdkLogger.verbose("Now we have lines: %d" % len(NewLines)) - else: - NewLines.append(Line) - - # in case there's no line directive or linemarker found - if (not LineControlDirectiveFound) and NewLines == []: - NewLines = Lines - - # save to file - try: - f = open (Target, 'wb') - except: - EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) - f.writelines(NewLines) - f.close() - -## Trim preprocessed VFR file -# -# Remove extra content made by preprocessor. The preprocessor doesn't need to -# enable line number generation option when preprocessing. -# -# @param Source File to be trimmed -# @param Target File to store the trimmed content -# -def TrimPreprocessedVfr(Source, Target): - CreateDirectory(os.path.dirname(Target)) - - try: - f = open (Source,'r') - except: - EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) - # read whole file - Lines = f.readlines() - f.close() - - FoundTypedef = False - Brace = 0 - TypedefStart = 0 - TypedefEnd = 0 - for Index in range(len(Lines)): - Line = Lines[Index] - # don't trim the lines from "formset" definition to the end of file - if Line.strip() == 'formset': - break - - if FoundTypedef == False and (Line.find('#line') == 0 or Line.find('# ') == 0): - # empty the line number directive if it's not aomong "typedef struct" - Lines[Index] = "\n" - continue - - if FoundTypedef == False and gTypedefPattern.search(Line) == None: - # keep "#pragram pack" directive - if gPragmaPattern.search(Line) == None: - Lines[Index] = "\n" - continue - elif FoundTypedef == False: - # found "typedef struct", keept its position and set a flag - FoundTypedef = True - TypedefStart = Index - - # match { and } to find the end of typedef definition - if Line.find("{") >= 0: - Brace += 1 - elif Line.find("}") >= 0: - Brace -= 1 - - # "typedef struct" must end with a ";" - if Brace == 0 and Line.find(";") >= 0: - FoundTypedef = False - TypedefEnd = Index - # keep all "typedef struct" except to GUID, EFI_PLABEL and PAL_CALL_RETURN - if Line.strip("} ;\r\n") in ["GUID", "EFI_PLABEL", "PAL_CALL_RETURN"]: - for i in range(TypedefStart, TypedefEnd+1): - Lines[i] = "\n" - - # save all lines trimmed - try: - f = open (Target,'w') - except: - EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) - f.writelines(Lines) - f.close() - -## Read the content ASL file, including ASL included, recursively -# -# @param Source File to be read -# @param Indent Spaces before the Include() statement -# @param IncludePathList The list of external include file -# @param LocalSearchPath If LocalSearchPath is specified, this path will be searched -# first for the included file; otherwise, only the path specified -# in the IncludePathList will be searched. -# -def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None): - NewFileContent = [] - - try: - # - # Search LocalSearchPath first if it is specified. - # - if LocalSearchPath: - SearchPathList = [LocalSearchPath] + IncludePathList - else: - SearchPathList = IncludePathList - - for IncludePath in SearchPathList: - IncludeFile = os.path.join(IncludePath, Source) - if os.path.isfile(IncludeFile): - F = open(IncludeFile, "r") - break - else: - EdkLogger.error("Trim", "Failed to find include file %s" % Source) - except: - EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) - - - # avoid A "include" B and B "include" A - IncludeFile = os.path.abspath(os.path.normpath(IncludeFile)) - if IncludeFile in gIncludedAslFile: - EdkLogger.warn("Trim", "Circular include", - ExtraData= "%s -> %s" % (" -> ".join(gIncludedAslFile), IncludeFile)) - return [] - gIncludedAslFile.append(IncludeFile) - - for Line in F: - LocalSearchPath = None - Result = gAslIncludePattern.findall(Line) - if len(Result) == 0: - Result = gAslCIncludePattern.findall(Line) - if len(Result) == 0 or os.path.splitext(Result[0][1])[1].lower() not in [".asl", ".asi"]: - NewFileContent.append("%s%s" % (Indent, Line)) - continue - # - # We should first search the local directory if current file are using pattern #include "XXX" - # - if Result[0][2] == '"': - LocalSearchPath = os.path.dirname(IncludeFile) - CurrentIndent = Indent + Result[0][0] - IncludedFile = Result[0][1] - NewFileContent.extend(DoInclude(IncludedFile, CurrentIndent, IncludePathList, LocalSearchPath)) - NewFileContent.append("\n") - - gIncludedAslFile.pop() - F.close() - - return NewFileContent - - -## Trim ASL file -# -# Replace ASL include statement with the content the included file -# -# @param Source File to be trimmed -# @param Target File to store the trimmed content -# @param IncludePathFile The file to log the external include path -# -def TrimAslFile(Source, Target, IncludePathFile): - CreateDirectory(os.path.dirname(Target)) - - SourceDir = os.path.dirname(Source) - if SourceDir == '': - SourceDir = '.' - - # - # Add source directory as the first search directory - # - IncludePathList = [SourceDir] - - # - # If additional include path file is specified, append them all - # to the search directory list. - # - if IncludePathFile: - try: - LineNum = 0 - for Line in open(IncludePathFile,'r'): - LineNum += 1 - if Line.startswith("/I") or Line.startswith ("-I"): - IncludePathList.append(Line[2:].strip()) - else: - EdkLogger.warn("Trim", "Invalid include line in include list file.", IncludePathFile, LineNum) - except: - EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=IncludePathFile) - - Lines = DoInclude(Source, '', IncludePathList) - - # - # Undef MIN and MAX to avoid collision in ASL source code - # - Lines.insert(0, "#undef MIN\n#undef MAX\n") - - # save all lines trimmed - try: - f = open (Target,'w') - except: - EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) - - f.writelines(Lines) - f.close() - -## Trim EDK source code file(s) -# -# -# @param Source File or directory to be trimmed -# @param Target File or directory to store the trimmed content -# -def TrimEdkSources(Source, Target): - if os.path.isdir(Source): - for CurrentDir, Dirs, Files in os.walk(Source): - if '.svn' in Dirs: - Dirs.remove('.svn') - elif "CVS" in Dirs: - Dirs.remove("CVS") - - for FileName in Files: - Dummy, Ext = os.path.splitext(FileName) - if Ext.upper() not in ['.C', '.H']: continue - if Target == None or Target == '': - TrimEdkSourceCode( - os.path.join(CurrentDir, FileName), - os.path.join(CurrentDir, FileName) - ) - else: - TrimEdkSourceCode( - os.path.join(CurrentDir, FileName), - os.path.join(Target, CurrentDir[len(Source)+1:], FileName) - ) - else: - TrimEdkSourceCode(Source, Target) - -## Trim one EDK source code file -# -# Do following replacement: -# -# (**PeiServices\).PciCfg = <*>; -# => { -# STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = { -# (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), -# &gEcpPeiPciCfgPpiGuid, -# <*> -# }; -# (**PeiServices).InstallPpi (PeiServices, &gEcpPeiPciCfgPpiList); -# -# <*>Modify(<*>) -# => PeiLibPciCfgModify (<*>) -# -# gRT->ReportStatusCode (<*>) -# => EfiLibReportStatusCode (<*>) -# -# #include -# => #include -# -# CreateEvent (EFI_EVENT_SIGNAL_READY_TO_BOOT, <*>) -# => EfiCreateEventReadyToBoot (<*>) -# -# CreateEvent (EFI_EVENT_SIGNAL_LEGACY_BOOT, <*>) -# => EfiCreateEventLegacyBoot (<*>) -# -# @param Source File to be trimmed -# @param Target File to store the trimmed content -# -def TrimEdkSourceCode(Source, Target): - EdkLogger.verbose("\t%s -> %s" % (Source, Target)) - CreateDirectory(os.path.dirname(Target)) - - try: - f = open (Source,'rb') - except: - EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) - # read whole file - Lines = f.read() - f.close() - - NewLines = None - for Re,Repl in gImportCodePatterns: - if NewLines == None: - NewLines = Re.sub(Repl, Lines) - else: - NewLines = Re.sub(Repl, NewLines) - - # save all lines if trimmed - if Source == Target and NewLines == Lines: - return - - try: - f = open (Target,'wb') - except: - EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) - f.write(NewLines) - f.close() - - -## Parse command line options -# -# Using standard Python module optparse to parse command line option of this tool. -# -# @retval Options A optparse.Values object containing the parsed options -# @retval InputFile Path of file to be trimmed -# -def Options(): - OptionList = [ - make_option("-s", "--source-code", dest="FileType", const="SourceCode", action="store_const", - help="The input file is preprocessed source code, including C or assembly code"), - make_option("-r", "--vfr-file", dest="FileType", const="Vfr", action="store_const", - help="The input file is preprocessed VFR file"), - make_option("-a", "--asl-file", dest="FileType", const="Asl", action="store_const", - help="The input file is ASL file"), - make_option("-8", "--Edk-source-code", dest="FileType", const="EdkSourceCode", action="store_const", - help="The input file is source code for Edk to be trimmed for ECP"), - - make_option("-c", "--convert-hex", dest="ConvertHex", action="store_true", - help="Convert standard hex format (0xabcd) to MASM format (abcdh)"), - - make_option("-l", "--trim-long", dest="TrimLong", action="store_true", - help="Remove postfix of long number"), - make_option("-i", "--include-path-file", dest="IncludePathFile", - help="The input file is include path list to search for ASL include file"), - make_option("-o", "--output", dest="OutputFile", - help="File to store the trimmed content"), - make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE, - help="Run verbosely"), - make_option("-d", "--debug", dest="LogLevel", type="int", - help="Run with debug information"), - make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET, - help="Run quietly"), - make_option("-?", action="help", help="show this help message and exit"), - ] - - # use clearer usage to override default usage message - UsageString = "%prog [-s|-r|-a] [-c] [-v|-d |-q] [-i ] [-o ] " - - Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString) - Parser.set_defaults(FileType="Vfr") - Parser.set_defaults(ConvertHex=False) - Parser.set_defaults(LogLevel=EdkLogger.INFO) - - Options, Args = Parser.parse_args() - - # error check - if len(Args) == 0: - EdkLogger.error("Trim", OPTION_MISSING, ExtraData=Parser.get_usage()) - if len(Args) > 1: - EdkLogger.error("Trim", OPTION_NOT_SUPPORTED, ExtraData=Parser.get_usage()) - - InputFile = Args[0] - return Options, InputFile - -## Entrance method -# -# This method mainly dispatch specific methods per the command line options. -# If no error found, return zero value so the caller of this tool can know -# if it's executed successfully or not. -# -# @retval 0 Tool was successful -# @retval 1 Tool failed -# -def Main(): - try: - EdkLogger.Initialize() - CommandOptions, InputFile = Options() - if CommandOptions.LogLevel < EdkLogger.DEBUG_9: - EdkLogger.SetLevel(CommandOptions.LogLevel + 1) - else: - EdkLogger.SetLevel(CommandOptions.LogLevel) - except FatalError, X: - return 1 - - try: - if CommandOptions.FileType == "Vfr": - if CommandOptions.OutputFile == None: - CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii' - TrimPreprocessedVfr(InputFile, CommandOptions.OutputFile) - elif CommandOptions.FileType == "Asl": - if CommandOptions.OutputFile == None: - CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii' - TrimAslFile(InputFile, CommandOptions.OutputFile, CommandOptions.IncludePathFile) - elif CommandOptions.FileType == "EdkSourceCode": - TrimEdkSources(InputFile, CommandOptions.OutputFile) - else : - if CommandOptions.OutputFile == None: - CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii' - TrimPreprocessedFile(InputFile, CommandOptions.OutputFile, CommandOptions.ConvertHex, CommandOptions.TrimLong) - except FatalError, X: - import platform - import traceback - if CommandOptions != None and CommandOptions.LogLevel <= EdkLogger.DEBUG_9: - EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc()) - return 1 - except: - import traceback - import platform - EdkLogger.error( - "\nTrim", - CODE_ERROR, - "Unknown fatal error when trimming [%s]" % InputFile, - ExtraData="\n(Please send email to edk2-buildtools-devel@lists.sourceforge.net for help, attaching following call stack trace!)\n", - RaiseError=False - ) - EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc()) - return 1 - - return 0 - -if __name__ == '__main__': - r = Main() - ## 0-127 is a safe return range, and 1 is a standard default error - if r < 0 or r > 127: r = 1 - sys.exit(r) - +## @file +# Trim files preprocessed by compiler +# +# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import sys +import re + +from optparse import OptionParser +from optparse import make_option +from Common.BuildToolError import * +from Common.Misc import * +from Common.BuildVersion import gBUILD_VERSION +import Common.EdkLogger as EdkLogger + +# Version and Copyright +__version_number__ = ("0.10" + " " + gBUILD_VERSION) +__version__ = "%prog Version " + __version_number__ +__copyright__ = "Copyright (c) 2007-2010, Intel Corporation. All rights reserved." + +## Regular expression for matching Line Control directive like "#line xxx" +gLineControlDirective = re.compile('^\s*#(?:line)?\s+([0-9]+)\s+"*([^"]*)"') +## Regular expression for matching "typedef struct" +gTypedefPattern = re.compile("^\s*typedef\s+struct(\s+\w+)?\s*[{]*$", re.MULTILINE) +## Regular expression for matching "#pragma pack" +gPragmaPattern = re.compile("^\s*#pragma\s+pack", re.MULTILINE) + +# +# The following number pattern match will only match if following criteria is met: +# There is leading non-(alphanumeric or _) character, and no following alphanumeric or _ +# as the pattern is greedily match, so it is ok for the gDecNumberPattern or gHexNumberPattern to grab the maximum match +# +## Regular expression for matching HEX number +gHexNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])(0[xX])([0-9a-fA-F]+)(U(?=$|[^a-zA-Z0-9_]))?") +## Regular expression for matching decimal number with 'U' postfix +gDecNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])([0-9]+)U(?=$|[^a-zA-Z0-9_])") +## Regular expression for matching constant with 'ULL' 'LL' postfix +gLongNumberPattern = re.compile("(?<=[^a-zA-Z0-9_])(0[xX][0-9a-fA-F]+|[0-9]+)U?LL(?=$|[^a-zA-Z0-9_])") + +## Regular expression for matching "Include ()" in asl file +gAslIncludePattern = re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", re.MULTILINE) +## Regular expression for matching C style #include "XXX.asl" in asl file +gAslCIncludePattern = re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*([>"])', re.MULTILINE) +## Patterns used to convert EDK conventions to EDK2 ECP conventions +gImportCodePatterns = [ + [ + re.compile('^(\s*)\(\*\*PeiServices\)\.PciCfg\s*=\s*([^;\s]+);', re.MULTILINE), + '''\\1{ +\\1 STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = { +\\1 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), +\\1 &gEcpPeiPciCfgPpiGuid, +\\1 \\2 +\\1 }; +\\1 (**PeiServices).InstallPpi (PeiServices, &gEcpPeiPciCfgPpiList); +\\1}''' + ], + + [ + re.compile('^(\s*)\(\*PeiServices\)->PciCfg\s*=\s*([^;\s]+);', re.MULTILINE), + '''\\1{ +\\1 STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = { +\\1 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), +\\1 &gEcpPeiPciCfgPpiGuid, +\\1 \\2 +\\1 }; +\\1 (**PeiServices).InstallPpi (PeiServices, &gEcpPeiPciCfgPpiList); +\\1}''' + ], + + [ + re.compile("(\s*).+->Modify[\s\n]*\(", re.MULTILINE), + '\\1PeiLibPciCfgModify (' + ], + + [ + re.compile("(\W*)gRT->ReportStatusCode[\s\n]*\(", re.MULTILINE), + '\\1EfiLibReportStatusCode (' + ], + + [ + re.compile('#include\s+EFI_GUID_DEFINITION\s*\(FirmwareFileSystem\)', re.MULTILINE), + '#include EFI_GUID_DEFINITION (FirmwareFileSystem)\n#include EFI_GUID_DEFINITION (FirmwareFileSystem2)' + ], + + [ + re.compile('gEfiFirmwareFileSystemGuid', re.MULTILINE), + 'gEfiFirmwareFileSystem2Guid' + ], + + [ + re.compile('EFI_FVH_REVISION', re.MULTILINE), + 'EFI_FVH_PI_REVISION' + ], + + [ + re.compile("(\s*)\S*CreateEvent\s*\([\s\n]*EFI_EVENT_SIGNAL_READY_TO_BOOT[^,]*,((?:[^;]+\n)+)(\s*\));", re.MULTILINE), + '\\1EfiCreateEventReadyToBoot (\\2\\3;' + ], + + [ + re.compile("(\s*)\S*CreateEvent\s*\([\s\n]*EFI_EVENT_SIGNAL_LEGACY_BOOT[^,]*,((?:[^;]+\n)+)(\s*\));", re.MULTILINE), + '\\1EfiCreateEventLegacyBoot (\\2\\3;' + ], +# [ +# re.compile("(\W)(PEI_PCI_CFG_PPI)(\W)", re.MULTILINE), +# '\\1ECP_\\2\\3' +# ] +] + +## file cache to avoid circular include in ASL file +gIncludedAslFile = [] + +## Trim preprocessed source code +# +# Remove extra content made by preprocessor. The preprocessor must enable the +# line number generation option when preprocessing. +# +# @param Source File to be trimmed +# @param Target File to store the trimmed content +# @param Convert If True, convert standard HEX format to MASM format +# +def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong): + CreateDirectory(os.path.dirname(Target)) + try: + f = open (Source, 'r') + except: + EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) + + # read whole file + Lines = f.readlines() + f.close() + + PreprocessedFile = "" + InjectedFile = "" + LineIndexOfOriginalFile = None + NewLines = [] + LineControlDirectiveFound = False + for Index in range(len(Lines)): + Line = Lines[Index] + # + # Find out the name of files injected by preprocessor from the lines + # with Line Control directive + # + MatchList = gLineControlDirective.findall(Line) + if MatchList != []: + MatchList = MatchList[0] + if len(MatchList) == 2: + LineNumber = int(MatchList[0], 0) + InjectedFile = MatchList[1] + # The first injetcted file must be the preprocessed file itself + if PreprocessedFile == "": + PreprocessedFile = InjectedFile + LineControlDirectiveFound = True + continue + elif PreprocessedFile == "" or InjectedFile != PreprocessedFile: + continue + + if LineIndexOfOriginalFile == None: + # + # Any non-empty lines must be from original preprocessed file. + # And this must be the first one. + # + LineIndexOfOriginalFile = Index + EdkLogger.verbose("Found original file content starting from line %d" + % (LineIndexOfOriginalFile + 1)) + + # convert HEX number format if indicated + if ConvertHex: + Line = gHexNumberPattern.sub(r"0\2h", Line) + else: + Line = gHexNumberPattern.sub(r"\1\2", Line) + if TrimLong: + Line = gLongNumberPattern.sub(r"\1", Line) + + # convert Decimal number format + Line = gDecNumberPattern.sub(r"\1", Line) + + if LineNumber != None: + EdkLogger.verbose("Got line directive: line=%d" % LineNumber) + # in case preprocessor removed some lines, like blank or comment lines + if LineNumber <= len(NewLines): + # possible? + NewLines[LineNumber - 1] = Line + else: + if LineNumber > (len(NewLines) + 1): + for LineIndex in range(len(NewLines), LineNumber-1): + NewLines.append(os.linesep) + NewLines.append(Line) + LineNumber = None + EdkLogger.verbose("Now we have lines: %d" % len(NewLines)) + else: + NewLines.append(Line) + + # in case there's no line directive or linemarker found + if (not LineControlDirectiveFound) and NewLines == []: + NewLines = Lines + + # save to file + try: + f = open (Target, 'wb') + except: + EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) + f.writelines(NewLines) + f.close() + +## Trim preprocessed VFR file +# +# Remove extra content made by preprocessor. The preprocessor doesn't need to +# enable line number generation option when preprocessing. +# +# @param Source File to be trimmed +# @param Target File to store the trimmed content +# +def TrimPreprocessedVfr(Source, Target): + CreateDirectory(os.path.dirname(Target)) + + try: + f = open (Source,'r') + except: + EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) + # read whole file + Lines = f.readlines() + f.close() + + FoundTypedef = False + Brace = 0 + TypedefStart = 0 + TypedefEnd = 0 + for Index in range(len(Lines)): + Line = Lines[Index] + # don't trim the lines from "formset" definition to the end of file + if Line.strip() == 'formset': + break + + if FoundTypedef == False and (Line.find('#line') == 0 or Line.find('# ') == 0): + # empty the line number directive if it's not aomong "typedef struct" + Lines[Index] = "\n" + continue + + if FoundTypedef == False and gTypedefPattern.search(Line) == None: + # keep "#pragram pack" directive + if gPragmaPattern.search(Line) == None: + Lines[Index] = "\n" + continue + elif FoundTypedef == False: + # found "typedef struct", keept its position and set a flag + FoundTypedef = True + TypedefStart = Index + + # match { and } to find the end of typedef definition + if Line.find("{") >= 0: + Brace += 1 + elif Line.find("}") >= 0: + Brace -= 1 + + # "typedef struct" must end with a ";" + if Brace == 0 and Line.find(";") >= 0: + FoundTypedef = False + TypedefEnd = Index + # keep all "typedef struct" except to GUID, EFI_PLABEL and PAL_CALL_RETURN + if Line.strip("} ;\r\n") in ["GUID", "EFI_PLABEL", "PAL_CALL_RETURN"]: + for i in range(TypedefStart, TypedefEnd+1): + Lines[i] = "\n" + + # save all lines trimmed + try: + f = open (Target,'w') + except: + EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) + f.writelines(Lines) + f.close() + +## Read the content ASL file, including ASL included, recursively +# +# @param Source File to be read +# @param Indent Spaces before the Include() statement +# @param IncludePathList The list of external include file +# @param LocalSearchPath If LocalSearchPath is specified, this path will be searched +# first for the included file; otherwise, only the path specified +# in the IncludePathList will be searched. +# +def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None): + NewFileContent = [] + + try: + # + # Search LocalSearchPath first if it is specified. + # + if LocalSearchPath: + SearchPathList = [LocalSearchPath] + IncludePathList + else: + SearchPathList = IncludePathList + + for IncludePath in SearchPathList: + IncludeFile = os.path.join(IncludePath, Source) + if os.path.isfile(IncludeFile): + F = open(IncludeFile, "r") + break + else: + EdkLogger.error("Trim", "Failed to find include file %s" % Source) + except: + EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) + + + # avoid A "include" B and B "include" A + IncludeFile = os.path.abspath(os.path.normpath(IncludeFile)) + if IncludeFile in gIncludedAslFile: + EdkLogger.warn("Trim", "Circular include", + ExtraData= "%s -> %s" % (" -> ".join(gIncludedAslFile), IncludeFile)) + return [] + gIncludedAslFile.append(IncludeFile) + + for Line in F: + LocalSearchPath = None + Result = gAslIncludePattern.findall(Line) + if len(Result) == 0: + Result = gAslCIncludePattern.findall(Line) + if len(Result) == 0 or os.path.splitext(Result[0][1])[1].lower() not in [".asl", ".asi"]: + NewFileContent.append("%s%s" % (Indent, Line)) + continue + # + # We should first search the local directory if current file are using pattern #include "XXX" + # + if Result[0][2] == '"': + LocalSearchPath = os.path.dirname(IncludeFile) + CurrentIndent = Indent + Result[0][0] + IncludedFile = Result[0][1] + NewFileContent.extend(DoInclude(IncludedFile, CurrentIndent, IncludePathList, LocalSearchPath)) + NewFileContent.append("\n") + + gIncludedAslFile.pop() + F.close() + + return NewFileContent + + +## Trim ASL file +# +# Replace ASL include statement with the content the included file +# +# @param Source File to be trimmed +# @param Target File to store the trimmed content +# @param IncludePathFile The file to log the external include path +# +def TrimAslFile(Source, Target, IncludePathFile): + CreateDirectory(os.path.dirname(Target)) + + SourceDir = os.path.dirname(Source) + if SourceDir == '': + SourceDir = '.' + + # + # Add source directory as the first search directory + # + IncludePathList = [SourceDir] + + # + # If additional include path file is specified, append them all + # to the search directory list. + # + if IncludePathFile: + try: + LineNum = 0 + for Line in open(IncludePathFile,'r'): + LineNum += 1 + if Line.startswith("/I") or Line.startswith ("-I"): + IncludePathList.append(Line[2:].strip()) + else: + EdkLogger.warn("Trim", "Invalid include line in include list file.", IncludePathFile, LineNum) + except: + EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=IncludePathFile) + + Lines = DoInclude(Source, '', IncludePathList) + + # + # Undef MIN and MAX to avoid collision in ASL source code + # + Lines.insert(0, "#undef MIN\n#undef MAX\n") + + # save all lines trimmed + try: + f = open (Target,'w') + except: + EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) + + f.writelines(Lines) + f.close() + +## Trim EDK source code file(s) +# +# +# @param Source File or directory to be trimmed +# @param Target File or directory to store the trimmed content +# +def TrimEdkSources(Source, Target): + if os.path.isdir(Source): + for CurrentDir, Dirs, Files in os.walk(Source): + if '.svn' in Dirs: + Dirs.remove('.svn') + elif "CVS" in Dirs: + Dirs.remove("CVS") + + for FileName in Files: + Dummy, Ext = os.path.splitext(FileName) + if Ext.upper() not in ['.C', '.H']: continue + if Target == None or Target == '': + TrimEdkSourceCode( + os.path.join(CurrentDir, FileName), + os.path.join(CurrentDir, FileName) + ) + else: + TrimEdkSourceCode( + os.path.join(CurrentDir, FileName), + os.path.join(Target, CurrentDir[len(Source)+1:], FileName) + ) + else: + TrimEdkSourceCode(Source, Target) + +## Trim one EDK source code file +# +# Do following replacement: +# +# (**PeiServices\).PciCfg = <*>; +# => { +# STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = { +# (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), +# &gEcpPeiPciCfgPpiGuid, +# <*> +# }; +# (**PeiServices).InstallPpi (PeiServices, &gEcpPeiPciCfgPpiList); +# +# <*>Modify(<*>) +# => PeiLibPciCfgModify (<*>) +# +# gRT->ReportStatusCode (<*>) +# => EfiLibReportStatusCode (<*>) +# +# #include +# => #include +# +# CreateEvent (EFI_EVENT_SIGNAL_READY_TO_BOOT, <*>) +# => EfiCreateEventReadyToBoot (<*>) +# +# CreateEvent (EFI_EVENT_SIGNAL_LEGACY_BOOT, <*>) +# => EfiCreateEventLegacyBoot (<*>) +# +# @param Source File to be trimmed +# @param Target File to store the trimmed content +# +def TrimEdkSourceCode(Source, Target): + EdkLogger.verbose("\t%s -> %s" % (Source, Target)) + CreateDirectory(os.path.dirname(Target)) + + try: + f = open (Source,'rb') + except: + EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source) + # read whole file + Lines = f.read() + f.close() + + NewLines = None + for Re,Repl in gImportCodePatterns: + if NewLines == None: + NewLines = Re.sub(Repl, Lines) + else: + NewLines = Re.sub(Repl, NewLines) + + # save all lines if trimmed + if Source == Target and NewLines == Lines: + return + + try: + f = open (Target,'wb') + except: + EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target) + f.write(NewLines) + f.close() + + +## Parse command line options +# +# Using standard Python module optparse to parse command line option of this tool. +# +# @retval Options A optparse.Values object containing the parsed options +# @retval InputFile Path of file to be trimmed +# +def Options(): + OptionList = [ + make_option("-s", "--source-code", dest="FileType", const="SourceCode", action="store_const", + help="The input file is preprocessed source code, including C or assembly code"), + make_option("-r", "--vfr-file", dest="FileType", const="Vfr", action="store_const", + help="The input file is preprocessed VFR file"), + make_option("-a", "--asl-file", dest="FileType", const="Asl", action="store_const", + help="The input file is ASL file"), + make_option("-8", "--Edk-source-code", dest="FileType", const="EdkSourceCode", action="store_const", + help="The input file is source code for Edk to be trimmed for ECP"), + + make_option("-c", "--convert-hex", dest="ConvertHex", action="store_true", + help="Convert standard hex format (0xabcd) to MASM format (abcdh)"), + + make_option("-l", "--trim-long", dest="TrimLong", action="store_true", + help="Remove postfix of long number"), + make_option("-i", "--include-path-file", dest="IncludePathFile", + help="The input file is include path list to search for ASL include file"), + make_option("-o", "--output", dest="OutputFile", + help="File to store the trimmed content"), + make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE, + help="Run verbosely"), + make_option("-d", "--debug", dest="LogLevel", type="int", + help="Run with debug information"), + make_option("-q", "--quiet", dest="LogLevel", action="store_const", const=EdkLogger.QUIET, + help="Run quietly"), + make_option("-?", action="help", help="show this help message and exit"), + ] + + # use clearer usage to override default usage message + UsageString = "%prog [-s|-r|-a] [-c] [-v|-d |-q] [-i ] [-o ] " + + Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString) + Parser.set_defaults(FileType="Vfr") + Parser.set_defaults(ConvertHex=False) + Parser.set_defaults(LogLevel=EdkLogger.INFO) + + Options, Args = Parser.parse_args() + + # error check + if len(Args) == 0: + EdkLogger.error("Trim", OPTION_MISSING, ExtraData=Parser.get_usage()) + if len(Args) > 1: + EdkLogger.error("Trim", OPTION_NOT_SUPPORTED, ExtraData=Parser.get_usage()) + + InputFile = Args[0] + return Options, InputFile + +## Entrance method +# +# This method mainly dispatch specific methods per the command line options. +# If no error found, return zero value so the caller of this tool can know +# if it's executed successfully or not. +# +# @retval 0 Tool was successful +# @retval 1 Tool failed +# +def Main(): + try: + EdkLogger.Initialize() + CommandOptions, InputFile = Options() + if CommandOptions.LogLevel < EdkLogger.DEBUG_9: + EdkLogger.SetLevel(CommandOptions.LogLevel + 1) + else: + EdkLogger.SetLevel(CommandOptions.LogLevel) + except FatalError, X: + return 1 + + try: + if CommandOptions.FileType == "Vfr": + if CommandOptions.OutputFile == None: + CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii' + TrimPreprocessedVfr(InputFile, CommandOptions.OutputFile) + elif CommandOptions.FileType == "Asl": + if CommandOptions.OutputFile == None: + CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii' + TrimAslFile(InputFile, CommandOptions.OutputFile, CommandOptions.IncludePathFile) + elif CommandOptions.FileType == "EdkSourceCode": + TrimEdkSources(InputFile, CommandOptions.OutputFile) + else : + if CommandOptions.OutputFile == None: + CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii' + TrimPreprocessedFile(InputFile, CommandOptions.OutputFile, CommandOptions.ConvertHex, CommandOptions.TrimLong) + except FatalError, X: + import platform + import traceback + if CommandOptions != None and CommandOptions.LogLevel <= EdkLogger.DEBUG_9: + EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc()) + return 1 + except: + import traceback + import platform + EdkLogger.error( + "\nTrim", + CODE_ERROR, + "Unknown fatal error when trimming [%s]" % InputFile, + ExtraData="\n(Please send email to edk2-buildtools-devel@lists.sourceforge.net for help, attaching following call stack trace!)\n", + RaiseError=False + ) + EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc()) + return 1 + + return 0 + +if __name__ == '__main__': + r = Main() + ## 0-127 is a safe return range, and 1 is a standard default error + if r < 0 or r > 127: r = 1 + sys.exit(r) + diff --git a/BaseTools/Source/Python/UPT/BuildVersion.py b/BaseTools/Source/Python/UPT/BuildVersion.py index 1ce93dbe8b..8b86b37e30 100644 --- a/BaseTools/Source/Python/UPT/BuildVersion.py +++ b/BaseTools/Source/Python/UPT/BuildVersion.py @@ -17,4 +17,4 @@ Build version information ''' -gBUILD_VERSION = "Build 2640" +gBUILD_VERSION = "Build 2649" diff --git a/BaseTools/Source/Python/UPT/Core/__init__.py b/BaseTools/Source/Python/UPT/Core/__init__.py index 39c78e8ecf..efe9cd09b7 100644 --- a/BaseTools/Source/Python/UPT/Core/__init__.py +++ b/BaseTools/Source/Python/UPT/Core/__init__.py @@ -1,20 +1,20 @@ -## @file -# Python 'Library' package initialization file. -# -# This file is required to make Python interpreter treat the directory -# as containing package. -# -# Copyright (c) 2011, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -''' -Core init file +## @file +# Python 'Library' package initialization file. +# +# This file is required to make Python interpreter treat the directory +# as containing package. +# +# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +''' +Core init file ''' \ No newline at end of file diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/__init__.py b/BaseTools/Source/Python/UPT/GenMetaFile/__init__.py index 0f6ce81579..269ba0bc48 100644 --- a/BaseTools/Source/Python/UPT/GenMetaFile/__init__.py +++ b/BaseTools/Source/Python/UPT/GenMetaFile/__init__.py @@ -1,20 +1,20 @@ -## @file -# Python 'Library' package initialization file. -# -# This file is required to make Python interpreter treat the directory -# as containing package. -# -# Copyright (c) 2011, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -''' -GenMetaFile +## @file +# Python 'Library' package initialization file. +# +# This file is required to make Python interpreter treat the directory +# as containing package. +# +# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +''' +GenMetaFile ''' \ No newline at end of file diff --git a/BaseTools/Source/Python/UPT/Library/ExpressionValidate.py b/BaseTools/Source/Python/UPT/Library/ExpressionValidate.py index 91041c7a64..3b476b4c48 100644 --- a/BaseTools/Source/Python/UPT/Library/ExpressionValidate.py +++ b/BaseTools/Source/Python/UPT/Library/ExpressionValidate.py @@ -93,7 +93,7 @@ class _ExprBase: ## IsCurrentOp # - # @param OpList: option list + # @param OpList: option list # def IsCurrentOp(self, OpList): self.SkipWhitespace() diff --git a/BaseTools/Source/Python/UPT/Library/GlobalData.py b/BaseTools/Source/Python/UPT/Library/GlobalData.py index 3f72f22738..e47e24a714 100644 --- a/BaseTools/Source/Python/UPT/Library/GlobalData.py +++ b/BaseTools/Source/Python/UPT/Library/GlobalData.py @@ -1,99 +1,99 @@ -## @file -# This file is used to define common static strings and global data used by UPT -# -# Copyright (c) 2011, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -''' -GlobalData -''' - -# -# The workspace directory -# -gWORKSPACE = '.' - -# -# INF module directory -# -gINF_MODULE_DIR = "." -gINF_MODULE_NAME = '' - -# -# the directory to holds upt related files -# -gUPT_DIR = r"Conf/upt/" - -# -# Log file for invalid meta-data files during force removing -# -gINVALID_MODULE_FILE = gUPT_DIR + r"Invalid_Modules.log" - -# -# File name for content zip file in the distribution -# -gCONTENT_FILE = "dist.content" - -# -# File name for XML file in the distibution -# -gDESC_FILE = 'dist.pkg' - -# -# Case Insensitive flag -# -gCASE_INSENSITIVE = '' - -# -# All Files dictionary -# -gALL_FILES = {} - -# -# Database instance -# -gDB = None - -# -# list for files that are found in module level but not in INF files, -# items are (File, ModulePath), all these should be relative to $(WORKSPACE) -# -gMISS_FILE_IN_MODLIST = [] - -# -# Global Current Line -# -gINF_CURRENT_LINE = None - -# -# Global pkg list -# -gWSPKG_LIST = [] - -# -# Flag used to take WARN as ERROR. -# By default, only ERROR message will break the tools execution. -# -gWARNING_AS_ERROR = False - -# -# Used to specify the temp directory to hold the unpacked distribution files -# -gUNPACK_DIR = None - -# -# Flag used to mark whether the INF file is Binary INF or not. -# -gIS_BINARY_INF = False -# -# Used by Library instance parser -# {FilePath: FileObj} -# +## @file +# This file is used to define common static strings and global data used by UPT +# +# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +''' +GlobalData +''' + +# +# The workspace directory +# +gWORKSPACE = '.' + +# +# INF module directory +# +gINF_MODULE_DIR = "." +gINF_MODULE_NAME = '' + +# +# the directory to holds upt related files +# +gUPT_DIR = r"Conf/upt/" + +# +# Log file for invalid meta-data files during force removing +# +gINVALID_MODULE_FILE = gUPT_DIR + r"Invalid_Modules.log" + +# +# File name for content zip file in the distribution +# +gCONTENT_FILE = "dist.content" + +# +# File name for XML file in the distibution +# +gDESC_FILE = 'dist.pkg' + +# +# Case Insensitive flag +# +gCASE_INSENSITIVE = '' + +# +# All Files dictionary +# +gALL_FILES = {} + +# +# Database instance +# +gDB = None + +# +# list for files that are found in module level but not in INF files, +# items are (File, ModulePath), all these should be relative to $(WORKSPACE) +# +gMISS_FILE_IN_MODLIST = [] + +# +# Global Current Line +# +gINF_CURRENT_LINE = None + +# +# Global pkg list +# +gWSPKG_LIST = [] + +# +# Flag used to take WARN as ERROR. +# By default, only ERROR message will break the tools execution. +# +gWARNING_AS_ERROR = False + +# +# Used to specify the temp directory to hold the unpacked distribution files +# +gUNPACK_DIR = None + +# +# Flag used to mark whether the INF file is Binary INF or not. +# +gIS_BINARY_INF = False +# +# Used by Library instance parser +# {FilePath: FileObj} +# gLIBINSTANCEDICT = {} \ No newline at end of file diff --git a/BaseTools/Source/Python/UPT/Library/Misc.py b/BaseTools/Source/Python/UPT/Library/Misc.py index 889b777d19..750805e328 100644 --- a/BaseTools/Source/Python/UPT/Library/Misc.py +++ b/BaseTools/Source/Python/UPT/Library/Misc.py @@ -1,974 +1,974 @@ -## @file -# Common routines used by all tools -# -# Copyright (c) 2011, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -''' -Misc -''' - -## -# Import Modules -# -import os.path -from os import access -from os import F_OK -from os import makedirs -from os import getcwd -from os import chdir -from os import listdir -from os import remove -from os import rmdir -from os import linesep -from os import walk -from os import environ -import re -from UserDict import IterableUserDict - -import Logger.Log as Logger -from Logger import StringTable as ST -from Logger import ToolError -from Library import GlobalData -from Library.DataType import SUP_MODULE_LIST -from Library.DataType import END_OF_LINE -from Library.DataType import TAB_SPLIT -from Library.DataType import LANGUAGE_EN_US -from Library.String import GetSplitValueList -from Library.ParserValidate import IsValidHexVersion -from Library.ParserValidate import IsValidPath -from Object.POM.CommonObject import TextObject - -## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C -# structure style -# -# @param Guid: The GUID string -# -def GuidStringToGuidStructureString(Guid): - GuidList = Guid.split('-') - Result = '{' - for Index in range(0, 3, 1): - Result = Result + '0x' + GuidList[Index] + ', ' - Result = Result + '{0x' + GuidList[3][0:2] + ', 0x' + GuidList[3][2:4] - for Index in range(0, 12, 2): - Result = Result + ', 0x' + GuidList[4][Index:Index + 2] - Result += '}}' - return Result - -## Check whether GUID string is of format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -# -# @param GuidValue: The GUID value -# -def CheckGuidRegFormat(GuidValue): - ## Regular expression used to find out register format of GUID - # - RegFormatGuidPattern = re.compile("^\s*([0-9a-fA-F]){8}-" - "([0-9a-fA-F]){4}-" - "([0-9a-fA-F]){4}-" - "([0-9a-fA-F]){4}-" - "([0-9a-fA-F]){12}\s*$") - - if RegFormatGuidPattern.match(GuidValue): - return True - else: - return False - - -## Convert GUID string in C structure style to -# xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -# -# @param GuidValue: The GUID value in C structure format -# -def GuidStructureStringToGuidString(GuidValue): - GuidValueString = GuidValue.lower().replace("{", "").replace("}", "").\ - replace(" ", "").replace(";", "") - GuidValueList = GuidValueString.split(",") - if len(GuidValueList) != 11: - return '' - try: - return "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % ( - int(GuidValueList[0], 16), - int(GuidValueList[1], 16), - int(GuidValueList[2], 16), - int(GuidValueList[3], 16), - int(GuidValueList[4], 16), - int(GuidValueList[5], 16), - int(GuidValueList[6], 16), - int(GuidValueList[7], 16), - int(GuidValueList[8], 16), - int(GuidValueList[9], 16), - int(GuidValueList[10], 16) - ) - except BaseException: - return '' - -## Create directories -# -# @param Directory: The directory name -# -def CreateDirectory(Directory): - if Directory == None or Directory.strip() == "": - return True - try: - if not access(Directory, F_OK): - makedirs(Directory) - except BaseException: - return False - return True - -## Remove directories, including files and sub-directories in it -# -# @param Directory: The directory name -# -def RemoveDirectory(Directory, Recursively=False): - if Directory == None or Directory.strip() == "" or not \ - os.path.exists(Directory): - return - if Recursively: - CurrentDirectory = getcwd() - chdir(Directory) - for File in listdir("."): - if os.path.isdir(File): - RemoveDirectory(File, Recursively) - else: - remove(File) - chdir(CurrentDirectory) - rmdir(Directory) - -## Store content in file -# -# This method is used to save file only when its content is changed. This is -# quite useful for "make" system to decide what will be re-built and what -# won't. -# -# @param File: The path of file -# @param Content: The new content of the file -# @param IsBinaryFile: The flag indicating if the file is binary file -# or not -# -def SaveFileOnChange(File, Content, IsBinaryFile=True): - if not IsBinaryFile: - Content = Content.replace("\n", linesep) - - if os.path.exists(File): - try: - if Content == open(File, "rb").read(): - return False - except BaseException: - Logger.Error(None, ToolError.FILE_OPEN_FAILURE, ExtraData=File) - - CreateDirectory(os.path.dirname(File)) - try: - FileFd = open(File, "wb") - FileFd.write(Content) - FileFd.close() - except BaseException: - Logger.Error(None, ToolError.FILE_CREATE_FAILURE, ExtraData=File) - - return True - -## Get all files of a directory -# -# @param Root: Root dir -# @param SkipList : The files need be skipped -# -def GetFiles(Root, SkipList=None, FullPath=True): - OriPath = os.path.normpath(Root) - FileList = [] - for Root, Dirs, Files in walk(Root): - if SkipList: - for Item in SkipList: - if Item in Dirs: - Dirs.remove(Item) - for Dir in Dirs: - if Dir.startswith('.'): - Dirs.remove(Dir) - - for File in Files: - if File.startswith('.'): - continue - File = os.path.normpath(os.path.join(Root, File)) - if not FullPath: - File = File[len(OriPath) + 1:] - FileList.append(File) - - return FileList - -## Get all non-metadata files of a directory -# -# @param Root: Root Dir -# @param SkipList : List of path need be skipped -# @param FullPath: True if the returned file should be full path -# @param PrefixPath: the path that need to be added to the files found -# @return: the list of files found -# -def GetNonMetaDataFiles(Root, SkipList, FullPath, PrefixPath): - FileList = GetFiles(Root, SkipList, FullPath) - NewFileList = [] - for File in FileList: - ExtName = os.path.splitext(File)[1] - # - # skip '.dec', '.inf', '.dsc', '.fdf' files - # - if ExtName.lower() not in ['.dec', '.inf', '.dsc', '.fdf']: - NewFileList.append(os.path.normpath(os.path.join(PrefixPath, File))) - - return NewFileList - -## Check if given file exists or not -# -# @param File: File name or path to be checked -# @param Dir: The directory the file is relative to -# -def ValidFile(File, Ext=None): - File = File.replace('\\', '/') - if Ext != None: - FileExt = os.path.splitext(File)[1] - if FileExt.lower() != Ext.lower(): - return False - if not os.path.exists(File): - return False - return True - -## RealPath -# -# @param File: File name or path to be checked -# @param Dir: The directory the file is relative to -# @param OverrideDir: The override directory -# -def RealPath(File, Dir='', OverrideDir=''): - NewFile = os.path.normpath(os.path.join(Dir, File)) - NewFile = GlobalData.gALL_FILES[NewFile] - if not NewFile and OverrideDir: - NewFile = os.path.normpath(os.path.join(OverrideDir, File)) - NewFile = GlobalData.gALL_FILES[NewFile] - return NewFile - -## RealPath2 -# -# @param File: File name or path to be checked -# @param Dir: The directory the file is relative to -# @param OverrideDir: The override directory -# -def RealPath2(File, Dir='', OverrideDir=''): - if OverrideDir: - NewFile = GlobalData.gALL_FILES[os.path.normpath(os.path.join\ - (OverrideDir, File))] - if NewFile: - if OverrideDir[-1] == os.path.sep: - return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)] - else: - return NewFile[len(OverrideDir) + 1:], \ - NewFile[0:len(OverrideDir)] - - NewFile = GlobalData.gALL_FILES[os.path.normpath(os.path.join(Dir, File))] - if NewFile: - if Dir: - if Dir[-1] == os.path.sep: - return NewFile[len(Dir):], NewFile[0:len(Dir)] - else: - return NewFile[len(Dir) + 1:], NewFile[0:len(Dir)] - else: - return NewFile, '' - - return None, None - -## A dict which can access its keys and/or values orderly -# -# The class implements a new kind of dict which its keys or values can be -# accessed in the order they are added into the dict. It guarantees the order -# by making use of an internal list to keep a copy of keys. -# -class Sdict(IterableUserDict): - ## Constructor - # - def __init__(self): - IterableUserDict.__init__(self) - self._key_list = [] - - ## [] operator - # - def __setitem__(self, Key, Value): - if Key not in self._key_list: - self._key_list.append(Key) - IterableUserDict.__setitem__(self, Key, Value) - - ## del operator - # - def __delitem__(self, Key): - self._key_list.remove(Key) - IterableUserDict.__delitem__(self, Key) - - ## used in "for k in dict" loop to ensure the correct order - # - def __iter__(self): - return self.iterkeys() - - ## len() support - # - def __len__(self): - return len(self._key_list) - - ## "in" test support - # - def __contains__(self, Key): - return Key in self._key_list - - ## indexof support - # - def index(self, Key): - return self._key_list.index(Key) - - ## insert support - # - def insert(self, Key, Newkey, Newvalue, Order): - Index = self._key_list.index(Key) - if Order == 'BEFORE': - self._key_list.insert(Index, Newkey) - IterableUserDict.__setitem__(self, Newkey, Newvalue) - elif Order == 'AFTER': - self._key_list.insert(Index + 1, Newkey) - IterableUserDict.__setitem__(self, Newkey, Newvalue) - - ## append support - # - def append(self, Sdict2): - for Key in Sdict2: - if Key not in self._key_list: - self._key_list.append(Key) - IterableUserDict.__setitem__(self, Key, Sdict2[Key]) - ## hash key - # - def has_key(self, Key): - return Key in self._key_list - - ## Empty the dict - # - def clear(self): - self._key_list = [] - IterableUserDict.clear(self) - - ## Return a copy of keys - # - def keys(self): - Keys = [] - for Key in self._key_list: - Keys.append(Key) - return Keys - - ## Return a copy of values - # - def values(self): - Values = [] - for Key in self._key_list: - Values.append(self[Key]) - return Values - - ## Return a copy of (key, value) list - # - def items(self): - Items = [] - for Key in self._key_list: - Items.append((Key, self[Key])) - return Items - - ## Iteration support - # - def iteritems(self): - return iter(self.items()) - - ## Keys interation support - # - def iterkeys(self): - return iter(self.keys()) - - ## Values interation support - # - def itervalues(self): - return iter(self.values()) - - ## Return value related to a key, and remove the (key, value) from the dict - # - def pop(self, Key, *Dv): - Value = None - if Key in self._key_list: - Value = self[Key] - self.__delitem__(Key) - elif len(Dv) != 0 : - Value = Dv[0] - return Value - - ## Return (key, value) pair, and remove the (key, value) from the dict - # - def popitem(self): - Key = self._key_list[-1] - Value = self[Key] - self.__delitem__(Key) - return Key, Value - ## update method - # - def update(self, Dict=None, **Kwargs): - if Dict != None: - for Key1, Val1 in Dict.items(): - self[Key1] = Val1 - if len(Kwargs): - for Key1, Val1 in Kwargs.items(): - self[Key1] = Val1 - -## CommonPath -# -# @param PathList: PathList -# -def CommonPath(PathList): - Path1 = min(PathList).split(os.path.sep) - Path2 = max(PathList).split(os.path.sep) - for Index in xrange(min(len(Path1), len(Path2))): - if Path1[Index] != Path2[Index]: - return os.path.sep.join(Path1[:Index]) - return os.path.sep.join(Path1) - -## PathClass -# -class PathClass(object): - def __init__(self, File='', Root='', AlterRoot='', Type='', IsBinary=False, - Arch='COMMON', ToolChainFamily='', Target='', TagName='', \ - ToolCode=''): - self.Arch = Arch - self.File = str(File) - if os.path.isabs(self.File): - self.Root = '' - self.AlterRoot = '' - else: - self.Root = str(Root) - self.AlterRoot = str(AlterRoot) - - # - # Remove any '.' and '..' in path - # - if self.Root: - self.Path = os.path.normpath(os.path.join(self.Root, self.File)) - self.Root = os.path.normpath(CommonPath([self.Root, self.Path])) - # - # eliminate the side-effect of 'C:' - # - if self.Root[-1] == ':': - self.Root += os.path.sep - # - # file path should not start with path separator - # - if self.Root[-1] == os.path.sep: - self.File = self.Path[len(self.Root):] - else: - self.File = self.Path[len(self.Root) + 1:] - else: - self.Path = os.path.normpath(self.File) - - self.SubDir, self.Name = os.path.split(self.File) - self.BaseName, self.Ext = os.path.splitext(self.Name) - - if self.Root: - if self.SubDir: - self.Dir = os.path.join(self.Root, self.SubDir) - else: - self.Dir = self.Root - else: - self.Dir = self.SubDir - - if IsBinary: - self.Type = Type - else: - self.Type = self.Ext.lower() - - self.IsBinary = IsBinary - self.Target = Target - self.TagName = TagName - self.ToolCode = ToolCode - self.ToolChainFamily = ToolChainFamily - - self._Key = None - - ## Convert the object of this class to a string - # - # Convert member Path of the class to a string - # - def __str__(self): - return self.Path - - ## Override __eq__ function - # - # Check whether PathClass are the same - # - def __eq__(self, Other): - if type(Other) == type(self): - return self.Path == Other.Path - else: - return self.Path == str(Other) - - ## Override __hash__ function - # - # Use Path as key in hash table - # - def __hash__(self): - return hash(self.Path) - - ## _GetFileKey - # - def _GetFileKey(self): - if self._Key == None: - self._Key = self.Path.upper() - return self._Key - ## Validate - # - def Validate(self, Type='', CaseSensitive=True): - if GlobalData.gCASE_INSENSITIVE: - CaseSensitive = False - if Type and Type.lower() != self.Type: - return ToolError.FILE_TYPE_MISMATCH, '%s (expect %s but got %s)' % \ - (self.File, Type, self.Type) - - RealFile, RealRoot = RealPath2(self.File, self.Root, self.AlterRoot) - if not RealRoot and not RealFile: - RealFile = self.File - if self.AlterRoot: - RealFile = os.path.join(self.AlterRoot, self.File) - elif self.Root: - RealFile = os.path.join(self.Root, self.File) - return ToolError.FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile) - - ErrorCode = 0 - ErrorInfo = '' - if RealRoot != self.Root or RealFile != self.File: - if CaseSensitive and (RealFile != self.File or \ - (RealRoot != self.Root and RealRoot != \ - self.AlterRoot)): - ErrorCode = ToolError.FILE_CASE_MISMATCH - ErrorInfo = self.File + '\n\t' + RealFile + \ - " [in file system]" - - self.SubDir, self.Name = os.path.split(RealFile) - self.BaseName, self.Ext = os.path.splitext(self.Name) - if self.SubDir: - self.Dir = os.path.join(RealRoot, self.SubDir) - else: - self.Dir = RealRoot - self.File = RealFile - self.Root = RealRoot - self.Path = os.path.join(RealRoot, RealFile) - return ErrorCode, ErrorInfo - - Key = property(_GetFileKey) - -## Check environment variables -# -# Check environment variables that must be set for build. Currently they are -# -# WORKSPACE The directory all packages/platforms start from -# EDK_TOOLS_PATH The directory contains all tools needed by the build -# PATH $(EDK_TOOLS_PATH)/Bin/ must be set in PATH -# -# If any of above environment variable is not set or has error, the build -# will be broken. -# -def CheckEnvVariable(): - # - # check WORKSPACE - # - if "WORKSPACE" not in environ: - Logger.Error("UPT", - ToolError.UPT_ENVIRON_MISSING_ERROR, - ST.ERR_NOT_FOUND_ENVIRONMENT, - ExtraData="WORKSPACE") - - WorkspaceDir = os.path.normpath(environ["WORKSPACE"]) - if not os.path.exists(WorkspaceDir): - Logger.Error("UPT", - ToolError.UPT_ENVIRON_MISSING_ERROR, - ST.ERR_WORKSPACE_NOTEXIST, - ExtraData="%s" % WorkspaceDir) - elif ' ' in WorkspaceDir: - Logger.Error("UPT", - ToolError.FORMAT_NOT_SUPPORTED, - ST.ERR_SPACE_NOTALLOWED, - ExtraData=WorkspaceDir) - -## Check whether all module types are in list -# -# check whether all module types (SUP_MODULE_LIST) are in list -# -# @param ModuleList: a list of ModuleType -# -def IsAllModuleList(ModuleList): - NewModuleList = [Module.upper() for Module in ModuleList] - for Module in SUP_MODULE_LIST: - if Module not in NewModuleList: - return False - else: - return True - -## Dictionary that use comment(GenericComment, TailComment) as value, -# if a new comment which key already in the dic is inserted, then the -# comment will be merged. -# Key is (Statement, SupArch), when TailComment is added, it will ident -# according to Statement -# -class MergeCommentDict(dict): - ## []= operator - # - def __setitem__(self, Key, CommentVal): - GenericComment, TailComment = CommentVal - if Key in self: - OrigVal1, OrigVal2 = dict.__getitem__(self, Key) - Statement = Key[0] - dict.__setitem__(self, Key, (OrigVal1 + GenericComment, OrigVal2 \ - + len(Statement) * ' ' + TailComment)) - else: - dict.__setitem__(self, Key, (GenericComment, TailComment)) - - ## =[] operator - # - def __getitem__(self, Key): - return dict.__getitem__(self, Key) - - -## GenDummyHelpTextObj -# -# @retval HelpTxt: Generated dummy help text object -# -def GenDummyHelpTextObj(): - HelpTxt = TextObject() - HelpTxt.SetLang(LANGUAGE_EN_US) - HelpTxt.SetString(' ') - return HelpTxt - -## ConvertVersionToDecimal, the minor version should be within 0 - 99 -# ::= "0x" -# ::= (a-fA-F0-9){4} -# ::= (a-fA-F0-9){4} -# ::= (0-65535) ["." (0-99)] -# -# @param StringIn: The string contains version defined in INF file. -# It can be Decimal or Hex -# -def ConvertVersionToDecimal(StringIn): - if IsValidHexVersion(StringIn): - Value = int(StringIn, 16) - Major = Value >> 16 - Minor = Value & 0xFFFF - MinorStr = str(Minor) - if len(MinorStr) == 1: - MinorStr = '0' + MinorStr - return str(Major) + '.' + MinorStr - else: - if StringIn.find(TAB_SPLIT) != -1: - return StringIn - elif StringIn: - return StringIn + '.0' - else: - # - # when StringIn is '', return it directly - # - return StringIn - -## GetHelpStringByRemoveHashKey -# -# Remove hash key at the header of string and return the remain. -# -# @param String: The string need to be processed. -# -def GetHelpStringByRemoveHashKey(String): - ReturnString = '' - PattenRemoveHashKey = re.compile(r"^[#+\s]+", re.DOTALL) - String = String.strip() - if String == '': - return String - - LineList = GetSplitValueList(String, END_OF_LINE) - for Line in LineList: - ValueList = PattenRemoveHashKey.split(Line) - if len(ValueList) == 1: - ReturnString += ValueList[0] + END_OF_LINE - else: - ReturnString += ValueList[1] + END_OF_LINE - - if ReturnString.endswith('\n') and not ReturnString.endswith('\n\n') and ReturnString != '\n': - ReturnString = ReturnString[:-1] - - return ReturnString - -## ConvPathFromAbsToRel -# -# Get relative file path from absolute path. -# -# @param Path: The string contain file absolute path. -# @param Root: The string contain the parent path of Path in. -# -# -def ConvPathFromAbsToRel(Path, Root): - Path = os.path.normpath(Path) - Root = os.path.normpath(Root) - FullPath = os.path.normpath(os.path.join(Root, Path)) - - # - # If Path is absolute path. - # It should be in Root. - # - if os.path.isabs(Path): - return FullPath[FullPath.find(Root) + len(Root) + 1:] - - else: - return Path - -## ConvertPath -# -# Convert special characters to '_', '\' to '/' -# return converted path: Test!1.inf -> Test_1.inf -# -# @param Path: Path to be converted -# -def ConvertPath(Path): - RetPath = '' - for Char in Path.strip(): - if Char.isalnum() or Char in '.-_/': - RetPath = RetPath + Char - elif Char == '\\': - RetPath = RetPath + '/' - else: - RetPath = RetPath + '_' - return RetPath - -## ConvertSpec -# -# during install, convert the Spec string extract from UPD into INF allowable definition, -# the difference is period is allowed in the former (not the first letter) but not in the latter. -# return converted Spec string -# -# @param SpecStr: SpecStr to be converted -# -def ConvertSpec(SpecStr): - RetStr = '' - for Char in SpecStr: - if Char.isalnum() or Char == '_': - RetStr = RetStr + Char - else: - RetStr = RetStr + '_' - - return RetStr - - -## IsEqualList -# -# Judge two lists are identical(contain same item). -# The rule is elements in List A are in List B and elements in List B are in List A. -# -# @param ListA, ListB Lists need to be judged. -# -# @return True ListA and ListB are identical -# @return False ListA and ListB are different with each other -# -def IsEqualList(ListA, ListB): - if ListA == ListB: - return True - - for ItemA in ListA: - if not ItemA in ListB: - return False - - for ItemB in ListB: - if not ItemB in ListA: - return False - - return True - -## ConvertArchList -# -# Convert item in ArchList if the start character is lower case. -# In UDP spec, Arch is only allowed as: [A-Z]([a-zA-Z0-9])* -# -# @param ArchList The ArchList need to be converted. -# -# @return NewList The ArchList been converted. -# -def ConvertArchList(ArchList): - NewArchList = [] - if not ArchList: - return NewArchList - - if type(ArchList) == list: - for Arch in ArchList: - Arch = Arch.upper() - NewArchList.append(Arch) - elif type(ArchList) == str: - ArchList = ArchList.upper() - NewArchList.append(ArchList) - - return NewArchList - -## ProcessLineExtender -# -# Process the LineExtender of Line in LineList. -# If one line ends with a line extender, then it will be combined together with next line. -# -# @param LineList The LineList need to be processed. -# -# @return NewList The ArchList been processed. -# -def ProcessLineExtender(LineList): - NewList = [] - Count = 0 - while Count < len(LineList): - if LineList[Count].strip().endswith("\\") and Count + 1 < len(LineList): - NewList.append(LineList[Count].strip()[:-2] + LineList[Count + 1]) - Count = Count + 1 - else: - NewList.append(LineList[Count]) - - Count = Count + 1 - - return NewList - -## ProcessEdkComment -# -# Process EDK style comment in LineList: c style /* */ comment or cpp style // comment -# -# -# @param LineList The LineList need to be processed. -# -# @return LineList The LineList been processed. -# @return FirstPos Where Edk comment is first found, -1 if not found -# -def ProcessEdkComment(LineList): - FindEdkBlockComment = False - Count = 0 - StartPos = -1 - EndPos = -1 - FirstPos = -1 - - while(Count < len(LineList)): - Line = LineList[Count].strip() - if Line.startswith("/*"): - # - # handling c style comment - # - StartPos = Count - while Count < len(LineList): - Line = LineList[Count].strip() - if Line.endswith("*/"): - if (Count == StartPos) and Line.strip() == '/*/': - Count = Count + 1 - continue - EndPos = Count - FindEdkBlockComment = True - break - Count = Count + 1 - - if FindEdkBlockComment: - if FirstPos == -1: - FirstPos = StartPos - for Index in xrange(StartPos, EndPos+1): - LineList[Index] = '' - FindEdkBlockComment = False - elif Line.find("//") != -1 and not Line.startswith("#"): - # - # handling cpp style comment - # - LineList[Count] = Line.replace("//", '#') - if FirstPos == -1: - FirstPos = Count - - Count = Count + 1 - - return LineList, FirstPos - -## GetLibInstanceInfo -# -# Get the information from Library Instance INF file. -# -# @param string. A string start with # and followed by INF file path -# @param WorkSpace. The WorkSpace directory used to combined with INF file path. -# -# @return GUID, Version -def GetLibInstanceInfo(String, WorkSpace, LineNo): - - FileGuidString = "" - VerString = "" - - OrignalString = String - String = String.strip() - if not String: - return None, None - # - # Remove "#" characters at the beginning - # - String = GetHelpStringByRemoveHashKey(String) - String = String.strip() - - # - # Validate file name exist. - # - FullFileName = os.path.normpath(os.path.realpath(os.path.join(WorkSpace, String))) - if not (ValidFile(FullFileName)): - Logger.Error("InfParser", - ToolError.FORMAT_INVALID, - ST.ERR_FILELIST_EXIST % (String), - File=GlobalData.gINF_MODULE_NAME, - Line=LineNo, - ExtraData=OrignalString) - - # - # Validate file exist/format. - # - if IsValidPath(String, WorkSpace): - IsValidFileFlag = True - else: - Logger.Error("InfParser", - ToolError.FORMAT_INVALID, - ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID % (String), - File=GlobalData.gINF_MODULE_NAME, - Line=LineNo, - ExtraData=OrignalString) - return False - if IsValidFileFlag: - FileLinesList = [] - - try: - FInputfile = open(FullFileName, "rb", 0) - try: - FileLinesList = FInputfile.readlines() - except BaseException: - Logger.Error("InfParser", - ToolError.FILE_READ_FAILURE, - ST.ERR_FILE_OPEN_FAILURE, - File=FullFileName) - finally: - FInputfile.close() - except BaseException: - Logger.Error("InfParser", - ToolError.FILE_READ_FAILURE, - ST.ERR_FILE_OPEN_FAILURE, - File=FullFileName) - - ReFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$") - ReVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$") - - FileLinesList = ProcessLineExtender(FileLinesList) - - for Line in FileLinesList: - if ReFileGuidPattern.match(Line): - FileGuidString = Line - if ReVerStringPattern.match(Line): - VerString = Line - - if FileGuidString: - FileGuidString = GetSplitValueList(FileGuidString, '=', 1)[1] - if VerString: - VerString = GetSplitValueList(VerString, '=', 1)[1] - - return FileGuidString, VerString +## @file +# Common routines used by all tools +# +# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +''' +Misc +''' + +## +# Import Modules +# +import os.path +from os import access +from os import F_OK +from os import makedirs +from os import getcwd +from os import chdir +from os import listdir +from os import remove +from os import rmdir +from os import linesep +from os import walk +from os import environ +import re +from UserDict import IterableUserDict + +import Logger.Log as Logger +from Logger import StringTable as ST +from Logger import ToolError +from Library import GlobalData +from Library.DataType import SUP_MODULE_LIST +from Library.DataType import END_OF_LINE +from Library.DataType import TAB_SPLIT +from Library.DataType import LANGUAGE_EN_US +from Library.String import GetSplitValueList +from Library.ParserValidate import IsValidHexVersion +from Library.ParserValidate import IsValidPath +from Object.POM.CommonObject import TextObject + +## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C +# structure style +# +# @param Guid: The GUID string +# +def GuidStringToGuidStructureString(Guid): + GuidList = Guid.split('-') + Result = '{' + for Index in range(0, 3, 1): + Result = Result + '0x' + GuidList[Index] + ', ' + Result = Result + '{0x' + GuidList[3][0:2] + ', 0x' + GuidList[3][2:4] + for Index in range(0, 12, 2): + Result = Result + ', 0x' + GuidList[4][Index:Index + 2] + Result += '}}' + return Result + +## Check whether GUID string is of format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +# +# @param GuidValue: The GUID value +# +def CheckGuidRegFormat(GuidValue): + ## Regular expression used to find out register format of GUID + # + RegFormatGuidPattern = re.compile("^\s*([0-9a-fA-F]){8}-" + "([0-9a-fA-F]){4}-" + "([0-9a-fA-F]){4}-" + "([0-9a-fA-F]){4}-" + "([0-9a-fA-F]){12}\s*$") + + if RegFormatGuidPattern.match(GuidValue): + return True + else: + return False + + +## Convert GUID string in C structure style to +# xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +# +# @param GuidValue: The GUID value in C structure format +# +def GuidStructureStringToGuidString(GuidValue): + GuidValueString = GuidValue.lower().replace("{", "").replace("}", "").\ + replace(" ", "").replace(";", "") + GuidValueList = GuidValueString.split(",") + if len(GuidValueList) != 11: + return '' + try: + return "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % ( + int(GuidValueList[0], 16), + int(GuidValueList[1], 16), + int(GuidValueList[2], 16), + int(GuidValueList[3], 16), + int(GuidValueList[4], 16), + int(GuidValueList[5], 16), + int(GuidValueList[6], 16), + int(GuidValueList[7], 16), + int(GuidValueList[8], 16), + int(GuidValueList[9], 16), + int(GuidValueList[10], 16) + ) + except BaseException: + return '' + +## Create directories +# +# @param Directory: The directory name +# +def CreateDirectory(Directory): + if Directory == None or Directory.strip() == "": + return True + try: + if not access(Directory, F_OK): + makedirs(Directory) + except BaseException: + return False + return True + +## Remove directories, including files and sub-directories in it +# +# @param Directory: The directory name +# +def RemoveDirectory(Directory, Recursively=False): + if Directory == None or Directory.strip() == "" or not \ + os.path.exists(Directory): + return + if Recursively: + CurrentDirectory = getcwd() + chdir(Directory) + for File in listdir("."): + if os.path.isdir(File): + RemoveDirectory(File, Recursively) + else: + remove(File) + chdir(CurrentDirectory) + rmdir(Directory) + +## Store content in file +# +# This method is used to save file only when its content is changed. This is +# quite useful for "make" system to decide what will be re-built and what +# won't. +# +# @param File: The path of file +# @param Content: The new content of the file +# @param IsBinaryFile: The flag indicating if the file is binary file +# or not +# +def SaveFileOnChange(File, Content, IsBinaryFile=True): + if not IsBinaryFile: + Content = Content.replace("\n", linesep) + + if os.path.exists(File): + try: + if Content == open(File, "rb").read(): + return False + except BaseException: + Logger.Error(None, ToolError.FILE_OPEN_FAILURE, ExtraData=File) + + CreateDirectory(os.path.dirname(File)) + try: + FileFd = open(File, "wb") + FileFd.write(Content) + FileFd.close() + except BaseException: + Logger.Error(None, ToolError.FILE_CREATE_FAILURE, ExtraData=File) + + return True + +## Get all files of a directory +# +# @param Root: Root dir +# @param SkipList : The files need be skipped +# +def GetFiles(Root, SkipList=None, FullPath=True): + OriPath = os.path.normpath(Root) + FileList = [] + for Root, Dirs, Files in walk(Root): + if SkipList: + for Item in SkipList: + if Item in Dirs: + Dirs.remove(Item) + for Dir in Dirs: + if Dir.startswith('.'): + Dirs.remove(Dir) + + for File in Files: + if File.startswith('.'): + continue + File = os.path.normpath(os.path.join(Root, File)) + if not FullPath: + File = File[len(OriPath) + 1:] + FileList.append(File) + + return FileList + +## Get all non-metadata files of a directory +# +# @param Root: Root Dir +# @param SkipList : List of path need be skipped +# @param FullPath: True if the returned file should be full path +# @param PrefixPath: the path that need to be added to the files found +# @return: the list of files found +# +def GetNonMetaDataFiles(Root, SkipList, FullPath, PrefixPath): + FileList = GetFiles(Root, SkipList, FullPath) + NewFileList = [] + for File in FileList: + ExtName = os.path.splitext(File)[1] + # + # skip '.dec', '.inf', '.dsc', '.fdf' files + # + if ExtName.lower() not in ['.dec', '.inf', '.dsc', '.fdf']: + NewFileList.append(os.path.normpath(os.path.join(PrefixPath, File))) + + return NewFileList + +## Check if given file exists or not +# +# @param File: File name or path to be checked +# @param Dir: The directory the file is relative to +# +def ValidFile(File, Ext=None): + File = File.replace('\\', '/') + if Ext != None: + FileExt = os.path.splitext(File)[1] + if FileExt.lower() != Ext.lower(): + return False + if not os.path.exists(File): + return False + return True + +## RealPath +# +# @param File: File name or path to be checked +# @param Dir: The directory the file is relative to +# @param OverrideDir: The override directory +# +def RealPath(File, Dir='', OverrideDir=''): + NewFile = os.path.normpath(os.path.join(Dir, File)) + NewFile = GlobalData.gALL_FILES[NewFile] + if not NewFile and OverrideDir: + NewFile = os.path.normpath(os.path.join(OverrideDir, File)) + NewFile = GlobalData.gALL_FILES[NewFile] + return NewFile + +## RealPath2 +# +# @param File: File name or path to be checked +# @param Dir: The directory the file is relative to +# @param OverrideDir: The override directory +# +def RealPath2(File, Dir='', OverrideDir=''): + if OverrideDir: + NewFile = GlobalData.gALL_FILES[os.path.normpath(os.path.join\ + (OverrideDir, File))] + if NewFile: + if OverrideDir[-1] == os.path.sep: + return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)] + else: + return NewFile[len(OverrideDir) + 1:], \ + NewFile[0:len(OverrideDir)] + + NewFile = GlobalData.gALL_FILES[os.path.normpath(os.path.join(Dir, File))] + if NewFile: + if Dir: + if Dir[-1] == os.path.sep: + return NewFile[len(Dir):], NewFile[0:len(Dir)] + else: + return NewFile[len(Dir) + 1:], NewFile[0:len(Dir)] + else: + return NewFile, '' + + return None, None + +## A dict which can access its keys and/or values orderly +# +# The class implements a new kind of dict which its keys or values can be +# accessed in the order they are added into the dict. It guarantees the order +# by making use of an internal list to keep a copy of keys. +# +class Sdict(IterableUserDict): + ## Constructor + # + def __init__(self): + IterableUserDict.__init__(self) + self._key_list = [] + + ## [] operator + # + def __setitem__(self, Key, Value): + if Key not in self._key_list: + self._key_list.append(Key) + IterableUserDict.__setitem__(self, Key, Value) + + ## del operator + # + def __delitem__(self, Key): + self._key_list.remove(Key) + IterableUserDict.__delitem__(self, Key) + + ## used in "for k in dict" loop to ensure the correct order + # + def __iter__(self): + return self.iterkeys() + + ## len() support + # + def __len__(self): + return len(self._key_list) + + ## "in" test support + # + def __contains__(self, Key): + return Key in self._key_list + + ## indexof support + # + def index(self, Key): + return self._key_list.index(Key) + + ## insert support + # + def insert(self, Key, Newkey, Newvalue, Order): + Index = self._key_list.index(Key) + if Order == 'BEFORE': + self._key_list.insert(Index, Newkey) + IterableUserDict.__setitem__(self, Newkey, Newvalue) + elif Order == 'AFTER': + self._key_list.insert(Index + 1, Newkey) + IterableUserDict.__setitem__(self, Newkey, Newvalue) + + ## append support + # + def append(self, Sdict2): + for Key in Sdict2: + if Key not in self._key_list: + self._key_list.append(Key) + IterableUserDict.__setitem__(self, Key, Sdict2[Key]) + ## hash key + # + def has_key(self, Key): + return Key in self._key_list + + ## Empty the dict + # + def clear(self): + self._key_list = [] + IterableUserDict.clear(self) + + ## Return a copy of keys + # + def keys(self): + Keys = [] + for Key in self._key_list: + Keys.append(Key) + return Keys + + ## Return a copy of values + # + def values(self): + Values = [] + for Key in self._key_list: + Values.append(self[Key]) + return Values + + ## Return a copy of (key, value) list + # + def items(self): + Items = [] + for Key in self._key_list: + Items.append((Key, self[Key])) + return Items + + ## Iteration support + # + def iteritems(self): + return iter(self.items()) + + ## Keys interation support + # + def iterkeys(self): + return iter(self.keys()) + + ## Values interation support + # + def itervalues(self): + return iter(self.values()) + + ## Return value related to a key, and remove the (key, value) from the dict + # + def pop(self, Key, *Dv): + Value = None + if Key in self._key_list: + Value = self[Key] + self.__delitem__(Key) + elif len(Dv) != 0 : + Value = Dv[0] + return Value + + ## Return (key, value) pair, and remove the (key, value) from the dict + # + def popitem(self): + Key = self._key_list[-1] + Value = self[Key] + self.__delitem__(Key) + return Key, Value + ## update method + # + def update(self, Dict=None, **Kwargs): + if Dict != None: + for Key1, Val1 in Dict.items(): + self[Key1] = Val1 + if len(Kwargs): + for Key1, Val1 in Kwargs.items(): + self[Key1] = Val1 + +## CommonPath +# +# @param PathList: PathList +# +def CommonPath(PathList): + Path1 = min(PathList).split(os.path.sep) + Path2 = max(PathList).split(os.path.sep) + for Index in xrange(min(len(Path1), len(Path2))): + if Path1[Index] != Path2[Index]: + return os.path.sep.join(Path1[:Index]) + return os.path.sep.join(Path1) + +## PathClass +# +class PathClass(object): + def __init__(self, File='', Root='', AlterRoot='', Type='', IsBinary=False, + Arch='COMMON', ToolChainFamily='', Target='', TagName='', \ + ToolCode=''): + self.Arch = Arch + self.File = str(File) + if os.path.isabs(self.File): + self.Root = '' + self.AlterRoot = '' + else: + self.Root = str(Root) + self.AlterRoot = str(AlterRoot) + + # + # Remove any '.' and '..' in path + # + if self.Root: + self.Path = os.path.normpath(os.path.join(self.Root, self.File)) + self.Root = os.path.normpath(CommonPath([self.Root, self.Path])) + # + # eliminate the side-effect of 'C:' + # + if self.Root[-1] == ':': + self.Root += os.path.sep + # + # file path should not start with path separator + # + if self.Root[-1] == os.path.sep: + self.File = self.Path[len(self.Root):] + else: + self.File = self.Path[len(self.Root) + 1:] + else: + self.Path = os.path.normpath(self.File) + + self.SubDir, self.Name = os.path.split(self.File) + self.BaseName, self.Ext = os.path.splitext(self.Name) + + if self.Root: + if self.SubDir: + self.Dir = os.path.join(self.Root, self.SubDir) + else: + self.Dir = self.Root + else: + self.Dir = self.SubDir + + if IsBinary: + self.Type = Type + else: + self.Type = self.Ext.lower() + + self.IsBinary = IsBinary + self.Target = Target + self.TagName = TagName + self.ToolCode = ToolCode + self.ToolChainFamily = ToolChainFamily + + self._Key = None + + ## Convert the object of this class to a string + # + # Convert member Path of the class to a string + # + def __str__(self): + return self.Path + + ## Override __eq__ function + # + # Check whether PathClass are the same + # + def __eq__(self, Other): + if type(Other) == type(self): + return self.Path == Other.Path + else: + return self.Path == str(Other) + + ## Override __hash__ function + # + # Use Path as key in hash table + # + def __hash__(self): + return hash(self.Path) + + ## _GetFileKey + # + def _GetFileKey(self): + if self._Key == None: + self._Key = self.Path.upper() + return self._Key + ## Validate + # + def Validate(self, Type='', CaseSensitive=True): + if GlobalData.gCASE_INSENSITIVE: + CaseSensitive = False + if Type and Type.lower() != self.Type: + return ToolError.FILE_TYPE_MISMATCH, '%s (expect %s but got %s)' % \ + (self.File, Type, self.Type) + + RealFile, RealRoot = RealPath2(self.File, self.Root, self.AlterRoot) + if not RealRoot and not RealFile: + RealFile = self.File + if self.AlterRoot: + RealFile = os.path.join(self.AlterRoot, self.File) + elif self.Root: + RealFile = os.path.join(self.Root, self.File) + return ToolError.FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile) + + ErrorCode = 0 + ErrorInfo = '' + if RealRoot != self.Root or RealFile != self.File: + if CaseSensitive and (RealFile != self.File or \ + (RealRoot != self.Root and RealRoot != \ + self.AlterRoot)): + ErrorCode = ToolError.FILE_CASE_MISMATCH + ErrorInfo = self.File + '\n\t' + RealFile + \ + " [in file system]" + + self.SubDir, self.Name = os.path.split(RealFile) + self.BaseName, self.Ext = os.path.splitext(self.Name) + if self.SubDir: + self.Dir = os.path.join(RealRoot, self.SubDir) + else: + self.Dir = RealRoot + self.File = RealFile + self.Root = RealRoot + self.Path = os.path.join(RealRoot, RealFile) + return ErrorCode, ErrorInfo + + Key = property(_GetFileKey) + +## Check environment variables +# +# Check environment variables that must be set for build. Currently they are +# +# WORKSPACE The directory all packages/platforms start from +# EDK_TOOLS_PATH The directory contains all tools needed by the build +# PATH $(EDK_TOOLS_PATH)/Bin/ must be set in PATH +# +# If any of above environment variable is not set or has error, the build +# will be broken. +# +def CheckEnvVariable(): + # + # check WORKSPACE + # + if "WORKSPACE" not in environ: + Logger.Error("UPT", + ToolError.UPT_ENVIRON_MISSING_ERROR, + ST.ERR_NOT_FOUND_ENVIRONMENT, + ExtraData="WORKSPACE") + + WorkspaceDir = os.path.normpath(environ["WORKSPACE"]) + if not os.path.exists(WorkspaceDir): + Logger.Error("UPT", + ToolError.UPT_ENVIRON_MISSING_ERROR, + ST.ERR_WORKSPACE_NOTEXIST, + ExtraData="%s" % WorkspaceDir) + elif ' ' in WorkspaceDir: + Logger.Error("UPT", + ToolError.FORMAT_NOT_SUPPORTED, + ST.ERR_SPACE_NOTALLOWED, + ExtraData=WorkspaceDir) + +## Check whether all module types are in list +# +# check whether all module types (SUP_MODULE_LIST) are in list +# +# @param ModuleList: a list of ModuleType +# +def IsAllModuleList(ModuleList): + NewModuleList = [Module.upper() for Module in ModuleList] + for Module in SUP_MODULE_LIST: + if Module not in NewModuleList: + return False + else: + return True + +## Dictionary that use comment(GenericComment, TailComment) as value, +# if a new comment which key already in the dic is inserted, then the +# comment will be merged. +# Key is (Statement, SupArch), when TailComment is added, it will ident +# according to Statement +# +class MergeCommentDict(dict): + ## []= operator + # + def __setitem__(self, Key, CommentVal): + GenericComment, TailComment = CommentVal + if Key in self: + OrigVal1, OrigVal2 = dict.__getitem__(self, Key) + Statement = Key[0] + dict.__setitem__(self, Key, (OrigVal1 + GenericComment, OrigVal2 \ + + len(Statement) * ' ' + TailComment)) + else: + dict.__setitem__(self, Key, (GenericComment, TailComment)) + + ## =[] operator + # + def __getitem__(self, Key): + return dict.__getitem__(self, Key) + + +## GenDummyHelpTextObj +# +# @retval HelpTxt: Generated dummy help text object +# +def GenDummyHelpTextObj(): + HelpTxt = TextObject() + HelpTxt.SetLang(LANGUAGE_EN_US) + HelpTxt.SetString(' ') + return HelpTxt + +## ConvertVersionToDecimal, the minor version should be within 0 - 99 +# ::= "0x" +# ::= (a-fA-F0-9){4} +# ::= (a-fA-F0-9){4} +# ::= (0-65535) ["." (0-99)] +# +# @param StringIn: The string contains version defined in INF file. +# It can be Decimal or Hex +# +def ConvertVersionToDecimal(StringIn): + if IsValidHexVersion(StringIn): + Value = int(StringIn, 16) + Major = Value >> 16 + Minor = Value & 0xFFFF + MinorStr = str(Minor) + if len(MinorStr) == 1: + MinorStr = '0' + MinorStr + return str(Major) + '.' + MinorStr + else: + if StringIn.find(TAB_SPLIT) != -1: + return StringIn + elif StringIn: + return StringIn + '.0' + else: + # + # when StringIn is '', return it directly + # + return StringIn + +## GetHelpStringByRemoveHashKey +# +# Remove hash key at the header of string and return the remain. +# +# @param String: The string need to be processed. +# +def GetHelpStringByRemoveHashKey(String): + ReturnString = '' + PattenRemoveHashKey = re.compile(r"^[#+\s]+", re.DOTALL) + String = String.strip() + if String == '': + return String + + LineList = GetSplitValueList(String, END_OF_LINE) + for Line in LineList: + ValueList = PattenRemoveHashKey.split(Line) + if len(ValueList) == 1: + ReturnString += ValueList[0] + END_OF_LINE + else: + ReturnString += ValueList[1] + END_OF_LINE + + if ReturnString.endswith('\n') and not ReturnString.endswith('\n\n') and ReturnString != '\n': + ReturnString = ReturnString[:-1] + + return ReturnString + +## ConvPathFromAbsToRel +# +# Get relative file path from absolute path. +# +# @param Path: The string contain file absolute path. +# @param Root: The string contain the parent path of Path in. +# +# +def ConvPathFromAbsToRel(Path, Root): + Path = os.path.normpath(Path) + Root = os.path.normpath(Root) + FullPath = os.path.normpath(os.path.join(Root, Path)) + + # + # If Path is absolute path. + # It should be in Root. + # + if os.path.isabs(Path): + return FullPath[FullPath.find(Root) + len(Root) + 1:] + + else: + return Path + +## ConvertPath +# +# Convert special characters to '_', '\' to '/' +# return converted path: Test!1.inf -> Test_1.inf +# +# @param Path: Path to be converted +# +def ConvertPath(Path): + RetPath = '' + for Char in Path.strip(): + if Char.isalnum() or Char in '.-_/': + RetPath = RetPath + Char + elif Char == '\\': + RetPath = RetPath + '/' + else: + RetPath = RetPath + '_' + return RetPath + +## ConvertSpec +# +# during install, convert the Spec string extract from UPD into INF allowable definition, +# the difference is period is allowed in the former (not the first letter) but not in the latter. +# return converted Spec string +# +# @param SpecStr: SpecStr to be converted +# +def ConvertSpec(SpecStr): + RetStr = '' + for Char in SpecStr: + if Char.isalnum() or Char == '_': + RetStr = RetStr + Char + else: + RetStr = RetStr + '_' + + return RetStr + + +## IsEqualList +# +# Judge two lists are identical(contain same item). +# The rule is elements in List A are in List B and elements in List B are in List A. +# +# @param ListA, ListB Lists need to be judged. +# +# @return True ListA and ListB are identical +# @return False ListA and ListB are different with each other +# +def IsEqualList(ListA, ListB): + if ListA == ListB: + return True + + for ItemA in ListA: + if not ItemA in ListB: + return False + + for ItemB in ListB: + if not ItemB in ListA: + return False + + return True + +## ConvertArchList +# +# Convert item in ArchList if the start character is lower case. +# In UDP spec, Arch is only allowed as: [A-Z]([a-zA-Z0-9])* +# +# @param ArchList The ArchList need to be converted. +# +# @return NewList The ArchList been converted. +# +def ConvertArchList(ArchList): + NewArchList = [] + if not ArchList: + return NewArchList + + if type(ArchList) == list: + for Arch in ArchList: + Arch = Arch.upper() + NewArchList.append(Arch) + elif type(ArchList) == str: + ArchList = ArchList.upper() + NewArchList.append(ArchList) + + return NewArchList + +## ProcessLineExtender +# +# Process the LineExtender of Line in LineList. +# If one line ends with a line extender, then it will be combined together with next line. +# +# @param LineList The LineList need to be processed. +# +# @return NewList The ArchList been processed. +# +def ProcessLineExtender(LineList): + NewList = [] + Count = 0 + while Count < len(LineList): + if LineList[Count].strip().endswith("\\") and Count + 1 < len(LineList): + NewList.append(LineList[Count].strip()[:-2] + LineList[Count + 1]) + Count = Count + 1 + else: + NewList.append(LineList[Count]) + + Count = Count + 1 + + return NewList + +## ProcessEdkComment +# +# Process EDK style comment in LineList: c style /* */ comment or cpp style // comment +# +# +# @param LineList The LineList need to be processed. +# +# @return LineList The LineList been processed. +# @return FirstPos Where Edk comment is first found, -1 if not found +# +def ProcessEdkComment(LineList): + FindEdkBlockComment = False + Count = 0 + StartPos = -1 + EndPos = -1 + FirstPos = -1 + + while(Count < len(LineList)): + Line = LineList[Count].strip() + if Line.startswith("/*"): + # + # handling c style comment + # + StartPos = Count + while Count < len(LineList): + Line = LineList[Count].strip() + if Line.endswith("*/"): + if (Count == StartPos) and Line.strip() == '/*/': + Count = Count + 1 + continue + EndPos = Count + FindEdkBlockComment = True + break + Count = Count + 1 + + if FindEdkBlockComment: + if FirstPos == -1: + FirstPos = StartPos + for Index in xrange(StartPos, EndPos+1): + LineList[Index] = '' + FindEdkBlockComment = False + elif Line.find("//") != -1 and not Line.startswith("#"): + # + # handling cpp style comment + # + LineList[Count] = Line.replace("//", '#') + if FirstPos == -1: + FirstPos = Count + + Count = Count + 1 + + return LineList, FirstPos + +## GetLibInstanceInfo +# +# Get the information from Library Instance INF file. +# +# @param string. A string start with # and followed by INF file path +# @param WorkSpace. The WorkSpace directory used to combined with INF file path. +# +# @return GUID, Version +def GetLibInstanceInfo(String, WorkSpace, LineNo): + + FileGuidString = "" + VerString = "" + + OrignalString = String + String = String.strip() + if not String: + return None, None + # + # Remove "#" characters at the beginning + # + String = GetHelpStringByRemoveHashKey(String) + String = String.strip() + + # + # Validate file name exist. + # + FullFileName = os.path.normpath(os.path.realpath(os.path.join(WorkSpace, String))) + if not (ValidFile(FullFileName)): + Logger.Error("InfParser", + ToolError.FORMAT_INVALID, + ST.ERR_FILELIST_EXIST % (String), + File=GlobalData.gINF_MODULE_NAME, + Line=LineNo, + ExtraData=OrignalString) + + # + # Validate file exist/format. + # + if IsValidPath(String, WorkSpace): + IsValidFileFlag = True + else: + Logger.Error("InfParser", + ToolError.FORMAT_INVALID, + ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID % (String), + File=GlobalData.gINF_MODULE_NAME, + Line=LineNo, + ExtraData=OrignalString) + return False + if IsValidFileFlag: + FileLinesList = [] + + try: + FInputfile = open(FullFileName, "rb", 0) + try: + FileLinesList = FInputfile.readlines() + except BaseException: + Logger.Error("InfParser", + ToolError.FILE_READ_FAILURE, + ST.ERR_FILE_OPEN_FAILURE, + File=FullFileName) + finally: + FInputfile.close() + except BaseException: + Logger.Error("InfParser", + ToolError.FILE_READ_FAILURE, + ST.ERR_FILE_OPEN_FAILURE, + File=FullFileName) + + ReFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$") + ReVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$") + + FileLinesList = ProcessLineExtender(FileLinesList) + + for Line in FileLinesList: + if ReFileGuidPattern.match(Line): + FileGuidString = Line + if ReVerStringPattern.match(Line): + VerString = Line + + if FileGuidString: + FileGuidString = GetSplitValueList(FileGuidString, '=', 1)[1] + if VerString: + VerString = GetSplitValueList(VerString, '=', 1)[1] + + return FileGuidString, VerString diff --git a/BaseTools/Source/Python/UPT/Library/Xml/__init__.py b/BaseTools/Source/Python/UPT/Library/Xml/__init__.py index 5d268d990b..f09eece5fb 100644 --- a/BaseTools/Source/Python/UPT/Library/Xml/__init__.py +++ b/BaseTools/Source/Python/UPT/Library/Xml/__init__.py @@ -1,20 +1,20 @@ -## @file -# Python 'Library' package initialization file. -# -# This file is required to make Python interpreter treat the directory -# as containing package. -# -# Copyright (c) 2011, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -''' -Xml +## @file +# Python 'Library' package initialization file. +# +# This file is required to make Python interpreter treat the directory +# as containing package. +# +# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +''' +Xml ''' \ No newline at end of file diff --git a/BaseTools/Source/Python/UPT/Library/__init__.py b/BaseTools/Source/Python/UPT/Library/__init__.py index b265bc873c..6a98cd80a3 100644 --- a/BaseTools/Source/Python/UPT/Library/__init__.py +++ b/BaseTools/Source/Python/UPT/Library/__init__.py @@ -1,20 +1,20 @@ -## @file -# Python 'Library' package initialization file. -# -# This file is required to make Python interpreter treat the directory -# as containing package. -# -# Copyright (c) 2011, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -''' -Library +## @file +# Python 'Library' package initialization file. +# +# This file is required to make Python interpreter treat the directory +# as containing package. +# +# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +''' +Library ''' \ No newline at end of file diff --git a/BaseTools/Source/Python/UPT/Logger/Log.py b/BaseTools/Source/Python/UPT/Logger/Log.py index 0915bb7263..407a1b32b6 100644 --- a/BaseTools/Source/Python/UPT/Logger/Log.py +++ b/BaseTools/Source/Python/UPT/Logger/Log.py @@ -1,325 +1,325 @@ -## @file -# This file implements the log mechanism for Python tools. -# -# Copyright (c) 2011, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -''' -Logger -''' - -## Import modules -from sys import argv -from sys import stdout -from sys import stderr -import os.path -from os import remove -from logging import getLogger -from logging import Formatter -from logging import StreamHandler -from logging import FileHandler -from traceback import extract_stack - -from Logger.ToolError import FatalError -from Logger.ToolError import WARNING_AS_ERROR -from Logger.ToolError import gERROR_MESSAGE -from Logger.ToolError import UNKNOWN_ERROR -from Library import GlobalData - -# -# Log level constants -# -DEBUG_0 = 1 -DEBUG_1 = 2 -DEBUG_2 = 3 -DEBUG_3 = 4 -DEBUG_4 = 5 -DEBUG_5 = 6 -DEBUG_6 = 7 -DEBUG_7 = 8 -DEBUG_8 = 9 -DEBUG_9 = 10 -VERBOSE = 15 -INFO = 20 -WARN = 30 -QUIET = 40 -QUIET_1 = 41 -ERROR = 50 -SILENT = 60 - -IS_RAISE_ERROR = True -SUPRESS_ERROR = False - -# -# Tool name -# -_TOOL_NAME = os.path.basename(argv[0]) -# -# For validation purpose -# -_LOG_LEVELS = [DEBUG_0, DEBUG_1, DEBUG_2, DEBUG_3, DEBUG_4, DEBUG_5, DEBUG_6, \ - DEBUG_7, DEBUG_8, DEBUG_9, VERBOSE, WARN, INFO, ERROR, QUIET, \ - QUIET_1, SILENT] -# -# For DEBUG level (All DEBUG_0~9 are applicable) -# -_DEBUG_LOGGER = getLogger("tool_debug") -_DEBUG_FORMATTER = Formatter("[%(asctime)s.%(msecs)d]: %(message)s", \ - datefmt="%H:%M:%S") -# -# For VERBOSE, INFO, WARN level -# -_INFO_LOGGER = getLogger("tool_info") -_INFO_FORMATTER = Formatter("%(message)s") -# -# For ERROR level -# -_ERROR_LOGGER = getLogger("tool_error") -_ERROR_FORMATTER = Formatter("%(message)s") - -# -# String templates for ERROR/WARN/DEBUG log message -# -_ERROR_MESSAGE_TEMPLATE = \ -('\n\n%(tool)s...\n%(file)s(%(line)s): error %(errorcode)04X: %(msg)s\n\t%(extra)s') - -__ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE = \ -'\n\n%(tool)s...\n : error %(errorcode)04X: %(msg)s\n\t%(extra)s' - -_WARNING_MESSAGE_TEMPLATE = '%(tool)s...\n%(file)s(%(line)s): warning: %(msg)s' -_WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE = '%(tool)s: : warning: %(msg)s' -_DEBUG_MESSAGE_TEMPLATE = '%(file)s(%(line)s): debug: \n %(msg)s' - - -# -# Log INFO message -# -#Info = _INFO_LOGGER.info - -def Info(msg, *args, **kwargs): - _INFO_LOGGER.info(msg, *args, **kwargs) - -# -# Log information which should be always put out -# -def Quiet(msg, *args, **kwargs): - _ERROR_LOGGER.error(msg, *args, **kwargs) - -## Log debug message -# -# @param Level DEBUG level (DEBUG0~9) -# @param Message Debug information -# @param ExtraData More information associated with "Message" -# -def Debug(Level, Message, ExtraData=None): - if _DEBUG_LOGGER.level > Level: - return - if Level > DEBUG_9: - return - # - # Find out the caller method information - # - CallerStack = extract_stack()[-2] - TemplateDict = { - "file" : CallerStack[0], - "line" : CallerStack[1], - "msg" : Message, - } - - if ExtraData != None: - LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict + "\n %s" % ExtraData - else: - LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict - - _DEBUG_LOGGER.log(Level, LogText) - -## Log verbose message -# -# @param Message Verbose information -# -def Verbose(Message): - return _INFO_LOGGER.log(VERBOSE, Message) - -## Log warning message -# -# Warning messages are those which might be wrong but won't fail the tool. -# -# @param ToolName The name of the tool. If not given, the name of caller -# method will be used. -# @param Message Warning information -# @param File The name of file which caused the warning. -# @param Line The line number in the "File" which caused the warning. -# @param ExtraData More information associated with "Message" -# -def Warn(ToolName, Message, File=None, Line=None, ExtraData=None): - if _INFO_LOGGER.level > WARN: - return - # - # if no tool name given, use caller's source file name as tool name - # - if ToolName == None or ToolName == "": - ToolName = os.path.basename(extract_stack()[-2][0]) - - if Line == None: - Line = "..." - else: - Line = "%d" % Line - - TemplateDict = { - "tool" : ToolName, - "file" : File, - "line" : Line, - "msg" : Message, - } - - if File != None: - LogText = _WARNING_MESSAGE_TEMPLATE % TemplateDict - else: - LogText = _WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict - - if ExtraData != None: - LogText += "\n %s" % ExtraData - - _INFO_LOGGER.log(WARN, LogText) - # - # Raise an execption if indicated - # - if GlobalData.gWARNING_AS_ERROR == True: - raise FatalError(WARNING_AS_ERROR) - -## Log ERROR message -# -# Once an error messages is logged, the tool's execution will be broken by -# raising an execption. If you don't want to break the execution later, you -# can give "RaiseError" with "False" value. -# -# @param ToolName The name of the tool. If not given, the name of caller -# method will be used. -# @param ErrorCode The error code -# @param Message Warning information -# @param File The name of file which caused the error. -# @param Line The line number in the "File" which caused the warning. -# @param ExtraData More information associated with "Message" -# @param RaiseError Raise an exception to break the tool's executuion if -# it's True. This is the default behavior. -# -def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \ - ExtraData=None, RaiseError=IS_RAISE_ERROR): - if ToolName: - pass - if Line == None: - Line = "..." - else: - Line = "%d" % Line - - if Message == None: - if ErrorCode in gERROR_MESSAGE: - Message = gERROR_MESSAGE[ErrorCode] - else: - Message = gERROR_MESSAGE[UNKNOWN_ERROR] - - if ExtraData == None: - ExtraData = "" - - TemplateDict = { - "tool" : _TOOL_NAME, - "file" : File, - "line" : Line, - "errorcode" : ErrorCode, - "msg" : Message, - "extra" : ExtraData - } - - if File != None: - LogText = _ERROR_MESSAGE_TEMPLATE % TemplateDict - else: - LogText = __ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict - - if not SUPRESS_ERROR: - _ERROR_LOGGER.log(ERROR, LogText) - if RaiseError: - raise FatalError(ErrorCode) - - -## Initialize log system -# -def Initialize(): - # - # Since we use different format to log different levels of message into - # different place (stdout or stderr), we have to use different "Logger" - # objects to do this. - # - # For DEBUG level (All DEBUG_0~9 are applicable) - _DEBUG_LOGGER.setLevel(INFO) - _DebugChannel = StreamHandler(stdout) - _DebugChannel.setFormatter(_DEBUG_FORMATTER) - _DEBUG_LOGGER.addHandler(_DebugChannel) - # - # For VERBOSE, INFO, WARN level - # - _INFO_LOGGER.setLevel(INFO) - _InfoChannel = StreamHandler(stdout) - _InfoChannel.setFormatter(_INFO_FORMATTER) - _INFO_LOGGER.addHandler(_InfoChannel) - # - # For ERROR level - # - _ERROR_LOGGER.setLevel(INFO) - _ErrorCh = StreamHandler(stderr) - _ErrorCh.setFormatter(_ERROR_FORMATTER) - _ERROR_LOGGER.addHandler(_ErrorCh) - - -## Set log level -# -# @param Level One of log level in _LogLevel -# -def SetLevel(Level): - if Level not in _LOG_LEVELS: - Info("Not supported log level (%d). Use default level instead." % \ - Level) - Level = INFO - _DEBUG_LOGGER.setLevel(Level) - _INFO_LOGGER.setLevel(Level) - _ERROR_LOGGER.setLevel(Level) - -## Get current log level -# -def GetLevel(): - return _INFO_LOGGER.getEffectiveLevel() - -## Raise up warning as error -# -def SetWarningAsError(): - GlobalData.gWARNING_AS_ERROR = True - -## Specify a file to store the log message as well as put on console -# -# @param LogFile The file path used to store the log message -# -def SetLogFile(LogFile): - if os.path.exists(LogFile): - remove(LogFile) - - _Ch = FileHandler(LogFile) - _Ch.setFormatter(_DEBUG_FORMATTER) - _DEBUG_LOGGER.addHandler(_Ch) - - _Ch = FileHandler(LogFile) - _Ch.setFormatter(_INFO_FORMATTER) - _INFO_LOGGER.addHandler(_Ch) - - _Ch = FileHandler(LogFile) - _Ch.setFormatter(_ERROR_FORMATTER) - _ERROR_LOGGER.addHandler(_Ch) - - - +## @file +# This file implements the log mechanism for Python tools. +# +# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +''' +Logger +''' + +## Import modules +from sys import argv +from sys import stdout +from sys import stderr +import os.path +from os import remove +from logging import getLogger +from logging import Formatter +from logging import StreamHandler +from logging import FileHandler +from traceback import extract_stack + +from Logger.ToolError import FatalError +from Logger.ToolError import WARNING_AS_ERROR +from Logger.ToolError import gERROR_MESSAGE +from Logger.ToolError import UNKNOWN_ERROR +from Library import GlobalData + +# +# Log level constants +# +DEBUG_0 = 1 +DEBUG_1 = 2 +DEBUG_2 = 3 +DEBUG_3 = 4 +DEBUG_4 = 5 +DEBUG_5 = 6 +DEBUG_6 = 7 +DEBUG_7 = 8 +DEBUG_8 = 9 +DEBUG_9 = 10 +VERBOSE = 15 +INFO = 20 +WARN = 30 +QUIET = 40 +QUIET_1 = 41 +ERROR = 50 +SILENT = 60 + +IS_RAISE_ERROR = True +SUPRESS_ERROR = False + +# +# Tool name +# +_TOOL_NAME = os.path.basename(argv[0]) +# +# For validation purpose +# +_LOG_LEVELS = [DEBUG_0, DEBUG_1, DEBUG_2, DEBUG_3, DEBUG_4, DEBUG_5, DEBUG_6, \ + DEBUG_7, DEBUG_8, DEBUG_9, VERBOSE, WARN, INFO, ERROR, QUIET, \ + QUIET_1, SILENT] +# +# For DEBUG level (All DEBUG_0~9 are applicable) +# +_DEBUG_LOGGER = getLogger("tool_debug") +_DEBUG_FORMATTER = Formatter("[%(asctime)s.%(msecs)d]: %(message)s", \ + datefmt="%H:%M:%S") +# +# For VERBOSE, INFO, WARN level +# +_INFO_LOGGER = getLogger("tool_info") +_INFO_FORMATTER = Formatter("%(message)s") +# +# For ERROR level +# +_ERROR_LOGGER = getLogger("tool_error") +_ERROR_FORMATTER = Formatter("%(message)s") + +# +# String templates for ERROR/WARN/DEBUG log message +# +_ERROR_MESSAGE_TEMPLATE = \ +('\n\n%(tool)s...\n%(file)s(%(line)s): error %(errorcode)04X: %(msg)s\n\t%(extra)s') + +__ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE = \ +'\n\n%(tool)s...\n : error %(errorcode)04X: %(msg)s\n\t%(extra)s' + +_WARNING_MESSAGE_TEMPLATE = '%(tool)s...\n%(file)s(%(line)s): warning: %(msg)s' +_WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE = '%(tool)s: : warning: %(msg)s' +_DEBUG_MESSAGE_TEMPLATE = '%(file)s(%(line)s): debug: \n %(msg)s' + + +# +# Log INFO message +# +#Info = _INFO_LOGGER.info + +def Info(msg, *args, **kwargs): + _INFO_LOGGER.info(msg, *args, **kwargs) + +# +# Log information which should be always put out +# +def Quiet(msg, *args, **kwargs): + _ERROR_LOGGER.error(msg, *args, **kwargs) + +## Log debug message +# +# @param Level DEBUG level (DEBUG0~9) +# @param Message Debug information +# @param ExtraData More information associated with "Message" +# +def Debug(Level, Message, ExtraData=None): + if _DEBUG_LOGGER.level > Level: + return + if Level > DEBUG_9: + return + # + # Find out the caller method information + # + CallerStack = extract_stack()[-2] + TemplateDict = { + "file" : CallerStack[0], + "line" : CallerStack[1], + "msg" : Message, + } + + if ExtraData != None: + LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict + "\n %s" % ExtraData + else: + LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict + + _DEBUG_LOGGER.log(Level, LogText) + +## Log verbose message +# +# @param Message Verbose information +# +def Verbose(Message): + return _INFO_LOGGER.log(VERBOSE, Message) + +## Log warning message +# +# Warning messages are those which might be wrong but won't fail the tool. +# +# @param ToolName The name of the tool. If not given, the name of caller +# method will be used. +# @param Message Warning information +# @param File The name of file which caused the warning. +# @param Line The line number in the "File" which caused the warning. +# @param ExtraData More information associated with "Message" +# +def Warn(ToolName, Message, File=None, Line=None, ExtraData=None): + if _INFO_LOGGER.level > WARN: + return + # + # if no tool name given, use caller's source file name as tool name + # + if ToolName == None or ToolName == "": + ToolName = os.path.basename(extract_stack()[-2][0]) + + if Line == None: + Line = "..." + else: + Line = "%d" % Line + + TemplateDict = { + "tool" : ToolName, + "file" : File, + "line" : Line, + "msg" : Message, + } + + if File != None: + LogText = _WARNING_MESSAGE_TEMPLATE % TemplateDict + else: + LogText = _WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict + + if ExtraData != None: + LogText += "\n %s" % ExtraData + + _INFO_LOGGER.log(WARN, LogText) + # + # Raise an execption if indicated + # + if GlobalData.gWARNING_AS_ERROR == True: + raise FatalError(WARNING_AS_ERROR) + +## Log ERROR message +# +# Once an error messages is logged, the tool's execution will be broken by +# raising an execption. If you don't want to break the execution later, you +# can give "RaiseError" with "False" value. +# +# @param ToolName The name of the tool. If not given, the name of caller +# method will be used. +# @param ErrorCode The error code +# @param Message Warning information +# @param File The name of file which caused the error. +# @param Line The line number in the "File" which caused the warning. +# @param ExtraData More information associated with "Message" +# @param RaiseError Raise an exception to break the tool's executuion if +# it's True. This is the default behavior. +# +def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \ + ExtraData=None, RaiseError=IS_RAISE_ERROR): + if ToolName: + pass + if Line == None: + Line = "..." + else: + Line = "%d" % Line + + if Message == None: + if ErrorCode in gERROR_MESSAGE: + Message = gERROR_MESSAGE[ErrorCode] + else: + Message = gERROR_MESSAGE[UNKNOWN_ERROR] + + if ExtraData == None: + ExtraData = "" + + TemplateDict = { + "tool" : _TOOL_NAME, + "file" : File, + "line" : Line, + "errorcode" : ErrorCode, + "msg" : Message, + "extra" : ExtraData + } + + if File != None: + LogText = _ERROR_MESSAGE_TEMPLATE % TemplateDict + else: + LogText = __ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict + + if not SUPRESS_ERROR: + _ERROR_LOGGER.log(ERROR, LogText) + if RaiseError: + raise FatalError(ErrorCode) + + +## Initialize log system +# +def Initialize(): + # + # Since we use different format to log different levels of message into + # different place (stdout or stderr), we have to use different "Logger" + # objects to do this. + # + # For DEBUG level (All DEBUG_0~9 are applicable) + _DEBUG_LOGGER.setLevel(INFO) + _DebugChannel = StreamHandler(stdout) + _DebugChannel.setFormatter(_DEBUG_FORMATTER) + _DEBUG_LOGGER.addHandler(_DebugChannel) + # + # For VERBOSE, INFO, WARN level + # + _INFO_LOGGER.setLevel(INFO) + _InfoChannel = StreamHandler(stdout) + _InfoChannel.setFormatter(_INFO_FORMATTER) + _INFO_LOGGER.addHandler(_InfoChannel) + # + # For ERROR level + # + _ERROR_LOGGER.setLevel(INFO) + _ErrorCh = StreamHandler(stderr) + _ErrorCh.setFormatter(_ERROR_FORMATTER) + _ERROR_LOGGER.addHandler(_ErrorCh) + + +## Set log level +# +# @param Level One of log level in _LogLevel +# +def SetLevel(Level): + if Level not in _LOG_LEVELS: + Info("Not supported log level (%d). Use default level instead." % \ + Level) + Level = INFO + _DEBUG_LOGGER.setLevel(Level) + _INFO_LOGGER.setLevel(Level) + _ERROR_LOGGER.setLevel(Level) + +## Get current log level +# +def GetLevel(): + return _INFO_LOGGER.getEffectiveLevel() + +## Raise up warning as error +# +def SetWarningAsError(): + GlobalData.gWARNING_AS_ERROR = True + +## Specify a file to store the log message as well as put on console +# +# @param LogFile The file path used to store the log message +# +def SetLogFile(LogFile): + if os.path.exists(LogFile): + remove(LogFile) + + _Ch = FileHandler(LogFile) + _Ch.setFormatter(_DEBUG_FORMATTER) + _DEBUG_LOGGER.addHandler(_Ch) + + _Ch = FileHandler(LogFile) + _Ch.setFormatter(_INFO_FORMATTER) + _INFO_LOGGER.addHandler(_Ch) + + _Ch = FileHandler(LogFile) + _Ch.setFormatter(_ERROR_FORMATTER) + _ERROR_LOGGER.addHandler(_Ch) + + + diff --git a/BaseTools/Source/Python/UPT/Logger/ToolError.py b/BaseTools/Source/Python/UPT/Logger/ToolError.py index 906d03337c..5065b370a3 100644 --- a/BaseTools/Source/Python/UPT/Logger/ToolError.py +++ b/BaseTools/Source/Python/UPT/Logger/ToolError.py @@ -1,177 +1,177 @@ -## @file -# Standardized Error Hanlding infrastructures. -# -# Copyright (c) 2011, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -''' -ToolError -''' - -import Logger.StringTable as ST - -FILE_OPEN_FAILURE = 1 -FILE_WRITE_FAILURE = 2 -FILE_PARSE_FAILURE = 3 -FILE_READ_FAILURE = 4 -FILE_CREATE_FAILURE = 5 -FILE_CHECKSUM_FAILURE = 6 -FILE_COMPRESS_FAILURE = 7 -FILE_DECOMPRESS_FAILURE = 8 -FILE_MOVE_FAILURE = 9 -FILE_DELETE_FAILURE = 10 -FILE_COPY_FAILURE = 11 -FILE_POSITIONING_FAILURE = 12 -FILE_ALREADY_EXIST = 13 -FILE_NOT_FOUND = 14 -FILE_TYPE_MISMATCH = 15 -FILE_CASE_MISMATCH = 16 -FILE_DUPLICATED = 17 -FILE_UNKNOWN_ERROR = 0x0FFF - -OPTION_UNKNOWN = 0x1000 -OPTION_MISSING = 0x1001 -OPTION_CONFLICT = 0x1002 -OPTION_VALUE_INVALID = 0x1003 -OPTION_DEPRECATED = 0x1004 -OPTION_NOT_SUPPORTED = 0x1005 -OPTION_UNKNOWN_ERROR = 0x1FFF - -PARAMETER_INVALID = 0x2000 -PARAMETER_MISSING = 0x2001 -PARAMETER_UNKNOWN_ERROR = 0x2FFF - -FORMAT_INVALID = 0x3000 -FORMAT_NOT_SUPPORTED = 0x3001 -FORMAT_UNKNOWN = 0x3002 -FORMAT_UNKNOWN_ERROR = 0x3FFF - -RESOURCE_NOT_AVAILABLE = 0x4000 -RESOURCE_ALLOCATE_FAILURE = 0x4001 -RESOURCE_FULL = 0x4002 -RESOURCE_OVERFLOW = 0x4003 -RESOURCE_UNDERRUN = 0x4004 -RESOURCE_UNKNOWN_ERROR = 0x4FFF - -ATTRIBUTE_NOT_AVAILABLE = 0x5000 -ATTRIBUTE_GET_FAILURE = 0x5001 -ATTRIBUTE_SET_FAILURE = 0x5002 -ATTRIBUTE_UPDATE_FAILURE = 0x5003 -ATTRIBUTE_ACCESS_DENIED = 0x5004 -ATTRIBUTE_RETRIEVE_FAILURE = 0x5005 -ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF -ATTRIBUTE_RETRIEVE_FAILURE = 0x5F00 - -IO_NOT_READY = 0x6000 -IO_BUSY = 0x6001 -IO_TIMEOUT = 0x6002 -IO_UNKNOWN_ERROR = 0x6FFF - -COMMAND_FAILURE = 0x7000 - -CODE_ERROR = 0xC0DE - -AUTOGEN_ERROR = 0xF000 -PARSER_ERROR = 0xF001 -BUILD_ERROR = 0xF002 -GENFDS_ERROR = 0xF003 -ECC_ERROR = 0xF004 -EOT_ERROR = 0xF005 -DDC_ERROR = 0xF009 -WARNING_AS_ERROR = 0xF006 -MIGRATION_ERROR = 0xF010 -EDK1_INF_ERROR = 0xF011 -ABORT_ERROR = 0xFFFE -UNKNOWN_ERROR = 0xFFFF - -UPT_ALREADY_INSTALLED_ERROR = 0xD000 -UPT_ENVIRON_MISSING_ERROR = 0xD001 -UPT_REPKG_ERROR = 0xD002 -UPT_ALREADY_RUNNING_ERROR = 0xD003 -UPT_MUL_DEC_ERROR = 0xD004 -UPT_DB_UPDATE_ERROR = 0xD005 -UPT_INI_PARSE_ERROR = 0xE000 - -## Error message of each error code -# -gERROR_MESSAGE = { - FILE_NOT_FOUND : ST.ERR_FILE_NOT_FOUND, - FILE_OPEN_FAILURE : ST.ERR_FILE_OPEN_FAILURE, - FILE_WRITE_FAILURE : ST.ERR_FILE_WRITE_FAILURE, - FILE_PARSE_FAILURE : ST.ERR_FILE_PARSE_FAILURE, - FILE_READ_FAILURE : ST.ERR_FILE_READ_FAILURE, - FILE_CREATE_FAILURE : ST.ERR_FILE_CREATE_FAILURE, - FILE_CHECKSUM_FAILURE : ST.ERR_FILE_CHECKSUM_FAILURE, - FILE_COMPRESS_FAILURE : ST.ERR_FILE_COMPRESS_FAILURE, - FILE_DECOMPRESS_FAILURE : ST.ERR_FILE_DECOMPRESS_FAILURE, - FILE_MOVE_FAILURE : ST.ERR_FILE_MOVE_FAILURE, - FILE_DELETE_FAILURE : ST.ERR_FILE_DELETE_FAILURE, - FILE_COPY_FAILURE : ST.ERR_FILE_COPY_FAILURE, - FILE_POSITIONING_FAILURE: ST.ERR_FILE_POSITIONING_FAILURE, - FILE_ALREADY_EXIST : ST.ERR_FILE_ALREADY_EXIST, - FILE_TYPE_MISMATCH : ST.ERR_FILE_TYPE_MISMATCH , - FILE_CASE_MISMATCH : ST.ERR_FILE_CASE_MISMATCH, - FILE_DUPLICATED : ST.ERR_FILE_DUPLICATED, - FILE_UNKNOWN_ERROR : ST.ERR_FILE_UNKNOWN_ERROR, - - OPTION_UNKNOWN : ST.ERR_OPTION_UNKNOWN, - OPTION_MISSING : ST.ERR_OPTION_MISSING, - OPTION_CONFLICT : ST.ERR_OPTION_CONFLICT, - OPTION_VALUE_INVALID : ST.ERR_OPTION_VALUE_INVALID, - OPTION_DEPRECATED : ST.ERR_OPTION_DEPRECATED, - OPTION_NOT_SUPPORTED : ST.ERR_OPTION_NOT_SUPPORTED, - OPTION_UNKNOWN_ERROR : ST.ERR_OPTION_UNKNOWN_ERROR, - - PARAMETER_INVALID : ST.ERR_PARAMETER_INVALID, - PARAMETER_MISSING : ST.ERR_PARAMETER_MISSING, - PARAMETER_UNKNOWN_ERROR : ST.ERR_PARAMETER_UNKNOWN_ERROR, - - FORMAT_INVALID : ST.ERR_FORMAT_INVALID, - FORMAT_NOT_SUPPORTED : ST.ERR_FORMAT_NOT_SUPPORTED, - FORMAT_UNKNOWN : ST.ERR_FORMAT_UNKNOWN, - FORMAT_UNKNOWN_ERROR : ST.ERR_FORMAT_UNKNOWN_ERROR, - - RESOURCE_NOT_AVAILABLE : ST.ERR_RESOURCE_NOT_AVAILABLE, - RESOURCE_ALLOCATE_FAILURE : ST.ERR_RESOURCE_ALLOCATE_FAILURE, - RESOURCE_FULL : ST.ERR_RESOURCE_FULL, - RESOURCE_OVERFLOW : ST.ERR_RESOURCE_OVERFLOW, - RESOURCE_UNDERRUN : ST.ERR_RESOURCE_UNDERRUN, - RESOURCE_UNKNOWN_ERROR : ST.ERR_RESOURCE_UNKNOWN_ERROR, - - ATTRIBUTE_NOT_AVAILABLE : ST.ERR_ATTRIBUTE_NOT_AVAILABLE, - ATTRIBUTE_RETRIEVE_FAILURE : ST.ERR_ATTRIBUTE_RETRIEVE_FAILURE, - ATTRIBUTE_SET_FAILURE : ST.ERR_ATTRIBUTE_SET_FAILURE, - ATTRIBUTE_UPDATE_FAILURE: ST.ERR_ATTRIBUTE_UPDATE_FAILURE, - ATTRIBUTE_ACCESS_DENIED : ST.ERR_ATTRIBUTE_ACCESS_DENIED, - ATTRIBUTE_UNKNOWN_ERROR : ST.ERR_ATTRIBUTE_UNKNOWN_ERROR, - - COMMAND_FAILURE : ST.ERR_COMMAND_FAILURE, - - IO_NOT_READY : ST.ERR_IO_NOT_READY, - IO_BUSY : ST.ERR_IO_BUSY, - IO_TIMEOUT : ST.ERR_IO_TIMEOUT, - IO_UNKNOWN_ERROR : ST.ERR_IO_UNKNOWN_ERROR, - - UNKNOWN_ERROR : ST.ERR_UNKNOWN_ERROR, - - UPT_ALREADY_INSTALLED_ERROR : ST.ERR_UPT_ALREADY_INSTALLED_ERROR, - UPT_ENVIRON_MISSING_ERROR : ST.ERR_UPT_ENVIRON_MISSING_ERROR, - UPT_REPKG_ERROR : ST.ERR_UPT_REPKG_ERROR, - UPT_ALREADY_RUNNING_ERROR : ST.ERR_UPT_ALREADY_RUNNING_ERROR, - UPT_MUL_DEC_ERROR : ST.ERR_MUL_DEC_ERROR, - UPT_INI_PARSE_ERROR : ST.ERR_UPT_INI_PARSE_ERROR, -} - -## Exception indicating a fatal error -# -class FatalError(Exception): - pass - +## @file +# Standardized Error Hanlding infrastructures. +# +# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +''' +ToolError +''' + +import Logger.StringTable as ST + +FILE_OPEN_FAILURE = 1 +FILE_WRITE_FAILURE = 2 +FILE_PARSE_FAILURE = 3 +FILE_READ_FAILURE = 4 +FILE_CREATE_FAILURE = 5 +FILE_CHECKSUM_FAILURE = 6 +FILE_COMPRESS_FAILURE = 7 +FILE_DECOMPRESS_FAILURE = 8 +FILE_MOVE_FAILURE = 9 +FILE_DELETE_FAILURE = 10 +FILE_COPY_FAILURE = 11 +FILE_POSITIONING_FAILURE = 12 +FILE_ALREADY_EXIST = 13 +FILE_NOT_FOUND = 14 +FILE_TYPE_MISMATCH = 15 +FILE_CASE_MISMATCH = 16 +FILE_DUPLICATED = 17 +FILE_UNKNOWN_ERROR = 0x0FFF + +OPTION_UNKNOWN = 0x1000 +OPTION_MISSING = 0x1001 +OPTION_CONFLICT = 0x1002 +OPTION_VALUE_INVALID = 0x1003 +OPTION_DEPRECATED = 0x1004 +OPTION_NOT_SUPPORTED = 0x1005 +OPTION_UNKNOWN_ERROR = 0x1FFF + +PARAMETER_INVALID = 0x2000 +PARAMETER_MISSING = 0x2001 +PARAMETER_UNKNOWN_ERROR = 0x2FFF + +FORMAT_INVALID = 0x3000 +FORMAT_NOT_SUPPORTED = 0x3001 +FORMAT_UNKNOWN = 0x3002 +FORMAT_UNKNOWN_ERROR = 0x3FFF + +RESOURCE_NOT_AVAILABLE = 0x4000 +RESOURCE_ALLOCATE_FAILURE = 0x4001 +RESOURCE_FULL = 0x4002 +RESOURCE_OVERFLOW = 0x4003 +RESOURCE_UNDERRUN = 0x4004 +RESOURCE_UNKNOWN_ERROR = 0x4FFF + +ATTRIBUTE_NOT_AVAILABLE = 0x5000 +ATTRIBUTE_GET_FAILURE = 0x5001 +ATTRIBUTE_SET_FAILURE = 0x5002 +ATTRIBUTE_UPDATE_FAILURE = 0x5003 +ATTRIBUTE_ACCESS_DENIED = 0x5004 +ATTRIBUTE_RETRIEVE_FAILURE = 0x5005 +ATTRIBUTE_UNKNOWN_ERROR = 0x5FFF +ATTRIBUTE_RETRIEVE_FAILURE = 0x5F00 + +IO_NOT_READY = 0x6000 +IO_BUSY = 0x6001 +IO_TIMEOUT = 0x6002 +IO_UNKNOWN_ERROR = 0x6FFF + +COMMAND_FAILURE = 0x7000 + +CODE_ERROR = 0xC0DE + +AUTOGEN_ERROR = 0xF000 +PARSER_ERROR = 0xF001 +BUILD_ERROR = 0xF002 +GENFDS_ERROR = 0xF003 +ECC_ERROR = 0xF004 +EOT_ERROR = 0xF005 +DDC_ERROR = 0xF009 +WARNING_AS_ERROR = 0xF006 +MIGRATION_ERROR = 0xF010 +EDK1_INF_ERROR = 0xF011 +ABORT_ERROR = 0xFFFE +UNKNOWN_ERROR = 0xFFFF + +UPT_ALREADY_INSTALLED_ERROR = 0xD000 +UPT_ENVIRON_MISSING_ERROR = 0xD001 +UPT_REPKG_ERROR = 0xD002 +UPT_ALREADY_RUNNING_ERROR = 0xD003 +UPT_MUL_DEC_ERROR = 0xD004 +UPT_DB_UPDATE_ERROR = 0xD005 +UPT_INI_PARSE_ERROR = 0xE000 + +## Error message of each error code +# +gERROR_MESSAGE = { + FILE_NOT_FOUND : ST.ERR_FILE_NOT_FOUND, + FILE_OPEN_FAILURE : ST.ERR_FILE_OPEN_FAILURE, + FILE_WRITE_FAILURE : ST.ERR_FILE_WRITE_FAILURE, + FILE_PARSE_FAILURE : ST.ERR_FILE_PARSE_FAILURE, + FILE_READ_FAILURE : ST.ERR_FILE_READ_FAILURE, + FILE_CREATE_FAILURE : ST.ERR_FILE_CREATE_FAILURE, + FILE_CHECKSUM_FAILURE : ST.ERR_FILE_CHECKSUM_FAILURE, + FILE_COMPRESS_FAILURE : ST.ERR_FILE_COMPRESS_FAILURE, + FILE_DECOMPRESS_FAILURE : ST.ERR_FILE_DECOMPRESS_FAILURE, + FILE_MOVE_FAILURE : ST.ERR_FILE_MOVE_FAILURE, + FILE_DELETE_FAILURE : ST.ERR_FILE_DELETE_FAILURE, + FILE_COPY_FAILURE : ST.ERR_FILE_COPY_FAILURE, + FILE_POSITIONING_FAILURE: ST.ERR_FILE_POSITIONING_FAILURE, + FILE_ALREADY_EXIST : ST.ERR_FILE_ALREADY_EXIST, + FILE_TYPE_MISMATCH : ST.ERR_FILE_TYPE_MISMATCH , + FILE_CASE_MISMATCH : ST.ERR_FILE_CASE_MISMATCH, + FILE_DUPLICATED : ST.ERR_FILE_DUPLICATED, + FILE_UNKNOWN_ERROR : ST.ERR_FILE_UNKNOWN_ERROR, + + OPTION_UNKNOWN : ST.ERR_OPTION_UNKNOWN, + OPTION_MISSING : ST.ERR_OPTION_MISSING, + OPTION_CONFLICT : ST.ERR_OPTION_CONFLICT, + OPTION_VALUE_INVALID : ST.ERR_OPTION_VALUE_INVALID, + OPTION_DEPRECATED : ST.ERR_OPTION_DEPRECATED, + OPTION_NOT_SUPPORTED : ST.ERR_OPTION_NOT_SUPPORTED, + OPTION_UNKNOWN_ERROR : ST.ERR_OPTION_UNKNOWN_ERROR, + + PARAMETER_INVALID : ST.ERR_PARAMETER_INVALID, + PARAMETER_MISSING : ST.ERR_PARAMETER_MISSING, + PARAMETER_UNKNOWN_ERROR : ST.ERR_PARAMETER_UNKNOWN_ERROR, + + FORMAT_INVALID : ST.ERR_FORMAT_INVALID, + FORMAT_NOT_SUPPORTED : ST.ERR_FORMAT_NOT_SUPPORTED, + FORMAT_UNKNOWN : ST.ERR_FORMAT_UNKNOWN, + FORMAT_UNKNOWN_ERROR : ST.ERR_FORMAT_UNKNOWN_ERROR, + + RESOURCE_NOT_AVAILABLE : ST.ERR_RESOURCE_NOT_AVAILABLE, + RESOURCE_ALLOCATE_FAILURE : ST.ERR_RESOURCE_ALLOCATE_FAILURE, + RESOURCE_FULL : ST.ERR_RESOURCE_FULL, + RESOURCE_OVERFLOW : ST.ERR_RESOURCE_OVERFLOW, + RESOURCE_UNDERRUN : ST.ERR_RESOURCE_UNDERRUN, + RESOURCE_UNKNOWN_ERROR : ST.ERR_RESOURCE_UNKNOWN_ERROR, + + ATTRIBUTE_NOT_AVAILABLE : ST.ERR_ATTRIBUTE_NOT_AVAILABLE, + ATTRIBUTE_RETRIEVE_FAILURE : ST.ERR_ATTRIBUTE_RETRIEVE_FAILURE, + ATTRIBUTE_SET_FAILURE : ST.ERR_ATTRIBUTE_SET_FAILURE, + ATTRIBUTE_UPDATE_FAILURE: ST.ERR_ATTRIBUTE_UPDATE_FAILURE, + ATTRIBUTE_ACCESS_DENIED : ST.ERR_ATTRIBUTE_ACCESS_DENIED, + ATTRIBUTE_UNKNOWN_ERROR : ST.ERR_ATTRIBUTE_UNKNOWN_ERROR, + + COMMAND_FAILURE : ST.ERR_COMMAND_FAILURE, + + IO_NOT_READY : ST.ERR_IO_NOT_READY, + IO_BUSY : ST.ERR_IO_BUSY, + IO_TIMEOUT : ST.ERR_IO_TIMEOUT, + IO_UNKNOWN_ERROR : ST.ERR_IO_UNKNOWN_ERROR, + + UNKNOWN_ERROR : ST.ERR_UNKNOWN_ERROR, + + UPT_ALREADY_INSTALLED_ERROR : ST.ERR_UPT_ALREADY_INSTALLED_ERROR, + UPT_ENVIRON_MISSING_ERROR : ST.ERR_UPT_ENVIRON_MISSING_ERROR, + UPT_REPKG_ERROR : ST.ERR_UPT_REPKG_ERROR, + UPT_ALREADY_RUNNING_ERROR : ST.ERR_UPT_ALREADY_RUNNING_ERROR, + UPT_MUL_DEC_ERROR : ST.ERR_MUL_DEC_ERROR, + UPT_INI_PARSE_ERROR : ST.ERR_UPT_INI_PARSE_ERROR, +} + +## Exception indicating a fatal error +# +class FatalError(Exception): + pass + diff --git a/BaseTools/Source/Python/UPT/Xml/__init__.py b/BaseTools/Source/Python/UPT/Xml/__init__.py index 5d268d990b..f09eece5fb 100644 --- a/BaseTools/Source/Python/UPT/Xml/__init__.py +++ b/BaseTools/Source/Python/UPT/Xml/__init__.py @@ -1,20 +1,20 @@ -## @file -# Python 'Library' package initialization file. -# -# This file is required to make Python interpreter treat the directory -# as containing package. -# -# Copyright (c) 2011, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials are licensed and made available -# under the terms and conditions of the BSD License which accompanies this -# distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -''' -Xml +## @file +# Python 'Library' package initialization file. +# +# This file is required to make Python interpreter treat the directory +# as containing package. +# +# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +''' +Xml ''' \ No newline at end of file diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 7a6b1be46e..bc45a66e49 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1,1872 +1,1872 @@ -## @file -# This file is used to parse meta files -# -# Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import re -import time -import copy - -import Common.EdkLogger as EdkLogger -import Common.GlobalData as GlobalData - -from CommonDataClass.DataClass import * -from Common.DataType import * -from Common.String import * -from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData, AnalyzeDscPcd -from Common.Expression import * -from CommonDataClass.Exceptions import * - -from MetaFileTable import MetaFileStorage - -## A decorator used to parse macro definition -def ParseMacro(Parser): - def MacroParser(self): - Match = gMacroDefPattern.match(self._CurrentLine) - if not Match: - # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method - Parser(self) - return - - TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):], TAB_EQUAL_SPLIT, 1) - # Syntax check - if not TokenList[0]: - EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - if len(TokenList) < 2: - TokenList.append('') - - Type = Match.group(1) - Name, Value = TokenList - # Global macros can be only defined via environment variable - if Name in GlobalData.gGlobalDefines: - EdkLogger.error('Parser', FORMAT_INVALID, "%s can only be defined via environment variable" % Name, - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - # Only upper case letters, digit and '_' are allowed - if not gMacroNamePattern.match(Name): - EdkLogger.error('Parser', FORMAT_INVALID, "The macro name must be in the pattern [A-Z][A-Z0-9_]*", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - - Value = ReplaceMacro(Value, self._Macros) - if Type in self.DataType: - self._ItemType = self.DataType[Type] - else: - self._ItemType = MODEL_META_DATA_DEFINE - # DEFINE defined macros - if Type == TAB_DSC_DEFINES_DEFINE: - # - # First judge whether this DEFINE is in conditional directive statements or not. - # - if type(self) == DscParser and self._InDirective > -1: - pass - else: - if type(self) == DecParser: - if MODEL_META_DATA_HEADER in self._SectionType: - self._FileLocalMacros[Name] = Value - else: - self._ConstructSectionMacroDict(Name, Value) - elif self._SectionType == MODEL_META_DATA_HEADER: - self._FileLocalMacros[Name] = Value - else: - self._ConstructSectionMacroDict(Name, Value) - - # EDK_GLOBAL defined macros - elif type(self) != DscParser: - EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - elif self._SectionType != MODEL_META_DATA_HEADER: - EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used under [Defines] section", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] != Value): - EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a macro with the same name and different value as one defined by 'DEFINE'", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - - self._ValueList = [Type, Name, Value] - - return MacroParser - -## Base class of parser -# -# This class is used for derivation purpose. The specific parser for one kind -# type file must derive this class and implement some public interfaces. -# -# @param FilePath The path of platform description file -# @param FileType The raw data of DSC file -# @param Table Database used to retrieve module/package information -# @param Macros Macros used for replacement in file -# @param Owner Owner ID (for sub-section parsing) -# @param From ID from which the data comes (for !INCLUDE directive) -# -class MetaFileParser(object): - # data type (file content) for specific file type - DataType = {} - - # Parser objects used to implement singleton - MetaFiles = {} - - ## Factory method - # - # One file, one parser object. This factory method makes sure that there's - # only one object constructed for one meta file. - # - # @param Class class object of real AutoGen class - # (InfParser, DecParser or DscParser) - # @param FilePath The path of meta file - # @param *args The specific class related parameters - # @param **kwargs The specific class related dict parameters - # - def __new__(Class, FilePath, *args, **kwargs): - if FilePath in Class.MetaFiles: - return Class.MetaFiles[FilePath] - else: - ParserObject = super(MetaFileParser, Class).__new__(Class) - Class.MetaFiles[FilePath] = ParserObject - return ParserObject - - ## Constructor of MetaFileParser - # - # Initialize object of MetaFileParser - # - # @param FilePath The path of platform description file - # @param FileType The raw data of DSC file - # @param Table Database used to retrieve module/package information - # @param Macros Macros used for replacement in file - # @param Owner Owner ID (for sub-section parsing) - # @param From ID from which the data comes (for !INCLUDE directive) - # - def __init__(self, FilePath, FileType, Table, Owner= -1, From= -1): - self._Table = Table - self._RawTable = Table - self._FileType = FileType - self.MetaFile = FilePath - self._FileDir = self.MetaFile.Dir - self._Defines = {} - self._FileLocalMacros = {} - self._SectionsMacroDict = {} - - # for recursive parsing - self._Owner = [Owner] - self._From = From - - # parsr status for parsing - self._ValueList = ['', '', '', '', ''] - self._Scope = [] - self._LineIndex = 0 - self._CurrentLine = '' - self._SectionType = MODEL_UNKNOWN - self._SectionName = '' - self._InSubsection = False - self._SubsectionType = MODEL_UNKNOWN - self._SubsectionName = '' - self._ItemType = MODEL_UNKNOWN - self._LastItem = -1 - self._Enabled = 0 - self._Finished = False - self._PostProcessed = False - # Different version of meta-file has different way to parse. - self._Version = 0 - - ## Store the parsed data in table - def _Store(self, *Args): - return self._Table.Insert(*Args) - - ## Virtual method for starting parse - def Start(self): - raise NotImplementedError - - ## Notify a post-process is needed - def DoPostProcess(self): - self._PostProcessed = False - - ## Set parsing complete flag in both class and table - def _Done(self): - self._Finished = True - ## Do not set end flag when processing included files - if self._From == -1: - self._Table.SetEndFlag() - - def _PostProcess(self): - self._PostProcessed = True - - ## Get the parse complete flag - def _GetFinished(self): - return self._Finished - - ## Set the complete flag - def _SetFinished(self, Value): - self._Finished = Value - - ## Use [] style to query data in table, just for readability - # - # DataInfo = [data_type, scope1(arch), scope2(platform/moduletype)] - # - def __getitem__(self, DataInfo): - if type(DataInfo) != type(()): - DataInfo = (DataInfo,) - - # Parse the file first, if necessary - if not self._Finished: - if self._RawTable.IsIntegrity(): - self._Finished = True - else: - self._Table = self._RawTable - self._PostProcessed = False - self.Start() - - # No specific ARCH or Platform given, use raw data - if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] == None): - return self._RawTable.Query(*DataInfo) - - # Do post-process if necessary - if not self._PostProcessed: - self._PostProcess() - - return self._Table.Query(*DataInfo) - - ## Data parser for the common format in different type of file - # - # The common format in the meatfile is like - # - # xxx1 | xxx2 | xxx3 - # - @ParseMacro - def _CommonParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - self._ValueList[0:len(TokenList)] = TokenList - - ## Data parser for the format in which there's path - # - # Only path can have macro used. So we need to replace them before use. - # - @ParseMacro - def _PathParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - self._ValueList[0:len(TokenList)] = TokenList - # Don't do macro replacement for dsc file at this point - if type(self) != DscParser: - Macros = self._Macros - self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList] - - ## Skip unsupported data - def _Skip(self): - EdkLogger.warn("Parser", "Unrecognized content", File=self.MetaFile, - Line=self._LineIndex + 1, ExtraData=self._CurrentLine); - self._ValueList[0:1] = [self._CurrentLine] - - ## Section header parser - # - # The section header is always in following format: - # - # [section_name.arch<.platform|module_type>] - # - def _SectionHeaderParser(self): - self._Scope = [] - self._SectionName = '' - ArchList = set() - for Item in GetSplitValueList(self._CurrentLine[1:-1], TAB_COMMA_SPLIT): - if Item == '': - continue - ItemList = GetSplitValueList(Item, TAB_SPLIT,2) - # different section should not mix in one section - if self._SectionName != '' and self._SectionName != ItemList[0].upper(): - EdkLogger.error('Parser', FORMAT_INVALID, "Different section names in the same section", - File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine) - self._SectionName = ItemList[0].upper() - if self._SectionName in self.DataType: - self._SectionType = self.DataType[self._SectionName] - # Check if the section name is valid - if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH and len(ItemList) > 3: - EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item, - self.MetaFile, self._LineIndex + 1, self._CurrentLine) - elif self._Version >= 0x00010005: - EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item, - self.MetaFile, self._LineIndex + 1, self._CurrentLine) - else: - self._SectionType = MODEL_UNKNOWN - - # S1 is always Arch - if len(ItemList) > 1: - S1 = ItemList[1].upper() - else: - S1 = 'COMMON' - ArchList.add(S1) - - # S2 may be Platform or ModuleType - if len(ItemList) > 2: - if self._SectionName.upper() in SECTIONS_HAVE_ITEM_PCD: - S2 = ItemList[2] - else: - S2 = ItemList[2].upper() - else: - S2 = 'COMMON' - self._Scope.append([S1, S2]) - - # 'COMMON' must not be used with specific ARCHs at the same section - if 'COMMON' in ArchList and len(ArchList) > 1: - EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs", - File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine) - # If the section information is needed later, it should be stored in database - self._ValueList[0] = self._SectionName - - ## [defines] section parser - @ParseMacro - def _DefineParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - self._ValueList[1:len(TokenList)] = TokenList - if not self._ValueList[1]: - EdkLogger.error('Parser', FORMAT_INVALID, "No name specified", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - if not self._ValueList[2]: - EdkLogger.error('Parser', FORMAT_INVALID, "No value specified", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - - self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList] - Name, Value = self._ValueList[1], self._ValueList[2] - # Sometimes, we need to make differences between EDK and EDK2 modules - if Name == 'INF_VERSION': - try: - self._Version = int(Value, 0) - except: - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - - if type(self) == InfParser and self._Version < 0x00010005: - # EDK module allows using defines as macros - self._FileLocalMacros[Name] = Value - self._Defines[Name] = Value - - ## [BuildOptions] section parser - @ParseMacro - def _BuildOptionParser(self): - self._CurrentLine = CleanString(self._CurrentLine, BuildOption=True) - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - TokenList2 = GetSplitValueList(TokenList[0], ':', 1) - if len(TokenList2) == 2: - self._ValueList[0] = TokenList2[0] # toolchain family - self._ValueList[1] = TokenList2[1] # keys - else: - self._ValueList[1] = TokenList[0] - if len(TokenList) == 2 and type(self) != DscParser: # value - self._ValueList[2] = ReplaceMacro(TokenList[1], self._Macros) - - if self._ValueList[1].count('_') != 4: - EdkLogger.error( - 'Parser', - FORMAT_INVALID, - "'%s' must be in format of ____FLAGS" % self._ValueList[1], - ExtraData=self._CurrentLine, - File=self.MetaFile, - Line=self._LineIndex + 1 - ) - - def _GetMacros(self): - Macros = {} - Macros.update(self._FileLocalMacros) - Macros.update(self._GetApplicableSectionMacro()) - return Macros - - ## Construct section Macro dict - def _ConstructSectionMacroDict(self, Name, Value): - ScopeKey = [(Scope[0], Scope[1]) for Scope in self._Scope] - ScopeKey = tuple(ScopeKey) - SectionDictKey = self._SectionType, ScopeKey - # - # DecParser SectionType is a list, will contain more than one item only in Pcd Section - # As Pcd section macro usage is not alllowed, so here it is safe - # - if type(self) == DecParser: - SectionDictKey = self._SectionType[0], ScopeKey - if SectionDictKey not in self._SectionsMacroDict: - self._SectionsMacroDict[SectionDictKey] = {} - SectionLocalMacros = self._SectionsMacroDict[SectionDictKey] - SectionLocalMacros[Name] = Value - - ## Get section Macros that are applicable to current line, which may come from other sections - ## that share the same name while scope is wider - def _GetApplicableSectionMacro(self): - Macros = {} - - ComComMacroDict = {} - ComSpeMacroDict = {} - SpeSpeMacroDict = {} - - ActiveSectionType = self._SectionType - if type(self) == DecParser: - ActiveSectionType = self._SectionType[0] - - for (SectionType, Scope) in self._SectionsMacroDict: - if SectionType != ActiveSectionType: - continue - - for ActiveScope in self._Scope: - Scope0, Scope1 = ActiveScope[0], ActiveScope[1] - if(Scope0, Scope1) not in Scope: - break - else: - SpeSpeMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)]) - - for ActiveScope in self._Scope: - Scope0, Scope1 = ActiveScope[0], ActiveScope[1] - if(Scope0, Scope1) not in Scope and (Scope0, "COMMON") not in Scope and ("COMMON", Scope1) not in Scope: - break - else: - ComSpeMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)]) - - if ("COMMON", "COMMON") in Scope: - ComComMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)]) - - Macros.update(ComComMacroDict) - Macros.update(ComSpeMacroDict) - Macros.update(SpeSpeMacroDict) - - return Macros - - _SectionParser = {} - Finished = property(_GetFinished, _SetFinished) - _Macros = property(_GetMacros) - - -## INF file parser class -# -# @param FilePath The path of platform description file -# @param FileType The raw data of DSC file -# @param Table Database used to retrieve module/package information -# @param Macros Macros used for replacement in file -# -class InfParser(MetaFileParser): - # INF file supported data types (one type per section) - DataType = { - TAB_UNKNOWN.upper() : MODEL_UNKNOWN, - TAB_INF_DEFINES.upper() : MODEL_META_DATA_HEADER, - TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, - TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION, - TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE, - TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE, - TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, - TAB_PACKAGES.upper() : MODEL_META_DATA_PACKAGE, - TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE, - TAB_INF_FIXED_PCD.upper() : MODEL_PCD_FIXED_AT_BUILD, - TAB_INF_PATCH_PCD.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, - TAB_INF_FEATURE_PCD.upper() : MODEL_PCD_FEATURE_FLAG, - TAB_INF_PCD_EX.upper() : MODEL_PCD_DYNAMIC_EX, - TAB_INF_PCD.upper() : MODEL_PCD_DYNAMIC, - TAB_SOURCES.upper() : MODEL_EFI_SOURCE_FILE, - TAB_GUIDS.upper() : MODEL_EFI_GUID, - TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL, - TAB_PPIS.upper() : MODEL_EFI_PPI, - TAB_DEPEX.upper() : MODEL_EFI_DEPEX, - TAB_BINARIES.upper() : MODEL_EFI_BINARY_FILE, - TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION - } - - ## Constructor of InfParser - # - # Initialize object of InfParser - # - # @param FilePath The path of module description file - # @param FileType The raw data of DSC file - # @param Table Database used to retrieve module/package information - # @param Macros Macros used for replacement in file - # - def __init__(self, FilePath, FileType, Table): - # prevent re-initialization - if hasattr(self, "_Table"): - return - MetaFileParser.__init__(self, FilePath, FileType, Table) - self.PcdsDict = {} - - ## Parser starter - def Start(self): - NmakeLine = '' - Content = '' - try: - Content = open(str(self.MetaFile), 'r').readlines() - except: - EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) - - # parse the file line by line - IsFindBlockComment = False - GetHeaderComment = False - TailComments = [] - SectionComments = [] - Comments = [] - - for Index in range(0, len(Content)): - # skip empty, commented, block commented lines - Line, Comment = CleanString2(Content[Index], AllowCppStyleComment=True) - NextLine = '' - if Index + 1 < len(Content): - NextLine, NextComment = CleanString2(Content[Index + 1]) - if Line == '': - if Comment: - Comments.append((Comment, Index + 1)) - elif GetHeaderComment: - SectionComments.extend(Comments) - Comments = [] - continue - if Line.find(DataType.TAB_COMMENT_EDK_START) > -1: - IsFindBlockComment = True - continue - if Line.find(DataType.TAB_COMMENT_EDK_END) > -1: - IsFindBlockComment = False - continue - if IsFindBlockComment: - continue - - self._LineIndex = Index - self._CurrentLine = Line - - # section header - if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: - if not GetHeaderComment: - for Cmt, LNo in Comments: - self._Store(MODEL_META_DATA_HEADER_COMMENT, Cmt, '', '', 'COMMON', - 'COMMON', self._Owner[-1], LNo, -1, LNo, -1, 0) - GetHeaderComment = True - else: - TailComments.extend(SectionComments + Comments) - Comments = [] - self._SectionHeaderParser() - # Check invalid sections - if self._Version < 0x00010005: - if self._SectionType in [MODEL_META_DATA_BUILD_OPTION, - MODEL_EFI_LIBRARY_CLASS, - MODEL_META_DATA_PACKAGE, - MODEL_PCD_FIXED_AT_BUILD, - MODEL_PCD_PATCHABLE_IN_MODULE, - MODEL_PCD_FEATURE_FLAG, - MODEL_PCD_DYNAMIC_EX, - MODEL_PCD_DYNAMIC, - MODEL_EFI_GUID, - MODEL_EFI_PROTOCOL, - MODEL_EFI_PPI, - MODEL_META_DATA_USER_EXTENSION]: - EdkLogger.error('Parser', FORMAT_INVALID, - "Section [%s] is not allowed in inf file without version" % (self._SectionName), - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - elif self._SectionType in [MODEL_EFI_INCLUDE, - MODEL_EFI_LIBRARY_INSTANCE, - MODEL_META_DATA_NMAKE]: - EdkLogger.error('Parser', FORMAT_INVALID, - "Section [%s] is not allowed in inf file with version 0x%08x" % (self._SectionName, self._Version), - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - continue - # merge two lines specified by '\' in section NMAKE - elif self._SectionType == MODEL_META_DATA_NMAKE: - if Line[-1] == '\\': - if NextLine == '': - self._CurrentLine = NmakeLine + Line[0:-1] - NmakeLine = '' - else: - if NextLine[0] == TAB_SECTION_START and NextLine[-1] == TAB_SECTION_END: - self._CurrentLine = NmakeLine + Line[0:-1] - NmakeLine = '' - else: - NmakeLine = NmakeLine + ' ' + Line[0:-1] - continue - else: - self._CurrentLine = NmakeLine + Line - NmakeLine = '' - - # section content - self._ValueList = ['', '', ''] - # parse current line, result will be put in self._ValueList - self._SectionParser[self._SectionType](self) - if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE: - self._ItemType = -1 - Comments = [] - continue - if Comment: - Comments.append((Comment, Index + 1)) - # - # Model, Value1, Value2, Value3, Arch, Platform, BelongsToItem=-1, - # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 - # - for Arch, Platform in self._Scope: - LastItem = self._Store(self._SectionType, - self._ValueList[0], - self._ValueList[1], - self._ValueList[2], - Arch, - Platform, - self._Owner[-1], - self._LineIndex + 1, - - 1, - self._LineIndex + 1, - - 1, - 0 - ) - for Comment, LineNo in Comments: - self._Store(MODEL_META_DATA_COMMENT, Comment, '', '', Arch, Platform, - LastItem, LineNo, -1, LineNo, -1, 0) - Comments = [] - SectionComments = [] - TailComments.extend(SectionComments + Comments) - if IsFindBlockComment: - EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */", - File=self.MetaFile) - - # If there are tail comments in INF file, save to database whatever the comments are - for Comment in TailComments: - self._Store(MODEL_META_DATA_TAIL_COMMENT, Comment[0], '', '', 'COMMON', - 'COMMON', self._Owner[-1], -1, -1, -1, -1, 0) - self._Done() - - ## Data parser for the format in which there's path - # - # Only path can have macro used. So we need to replace them before use. - # - def _IncludeParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - self._ValueList[0:len(TokenList)] = TokenList - Macros = self._Macros - if Macros: - for Index in range(0, len(self._ValueList)): - Value = self._ValueList[Index] - if not Value: - continue - - if Value.upper().find('$(EFI_SOURCE)\Edk'.upper()) > -1 or Value.upper().find('$(EFI_SOURCE)/Edk'.upper()) > -1: - Value = '$(EDK_SOURCE)' + Value[17:] - if Value.find('$(EFI_SOURCE)') > -1 or Value.find('$(EDK_SOURCE)') > -1: - pass - elif Value.startswith('.'): - pass - elif Value.startswith('$('): - pass - else: - Value = '$(EFI_SOURCE)/' + Value - - self._ValueList[Index] = ReplaceMacro(Value, Macros) - - ## Parse [Sources] section - # - # Only path can have macro used. So we need to replace them before use. - # - @ParseMacro - def _SourceFileParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - self._ValueList[0:len(TokenList)] = TokenList - Macros = self._Macros - # For Acpi tables, remove macro like ' TABLE_NAME=Sata1' - if 'COMPONENT_TYPE' in Macros: - if self._Defines['COMPONENT_TYPE'].upper() == 'ACPITABLE': - self._ValueList[0] = GetSplitValueList(self._ValueList[0], ' ', 1)[0] - if self._Defines['BASE_NAME'] == 'Microcode': - pass - self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList] - - ## Parse [Binaries] section - # - # Only path can have macro used. So we need to replace them before use. - # - @ParseMacro - def _BinaryFileParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 2) - if len(TokenList) < 2: - EdkLogger.error('Parser', FORMAT_INVALID, "No file type or path specified", - ExtraData=self._CurrentLine + " ( | [| ])", - File=self.MetaFile, Line=self._LineIndex + 1) - if not TokenList[0]: - EdkLogger.error('Parser', FORMAT_INVALID, "No file type specified", - ExtraData=self._CurrentLine + " ( | [| ])", - File=self.MetaFile, Line=self._LineIndex + 1) - if not TokenList[1]: - EdkLogger.error('Parser', FORMAT_INVALID, "No file path specified", - ExtraData=self._CurrentLine + " ( | [| ])", - File=self.MetaFile, Line=self._LineIndex + 1) - self._ValueList[0:len(TokenList)] = TokenList - self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros) - - ## [nmake] section parser (Edk.x style only) - def _NmakeParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - self._ValueList[0:len(TokenList)] = TokenList - # remove macros - self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros) - # remove self-reference in macro setting - #self._ValueList[1] = ReplaceMacro(self._ValueList[1], {self._ValueList[0]:''}) - - ## [FixedPcd], [FeaturePcd], [PatchPcd], [Pcd] and [PcdEx] sections parser - @ParseMacro - def _PcdParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) - ValueList = GetSplitValueList(TokenList[0], TAB_SPLIT) - if len(ValueList) != 2: - EdkLogger.error('Parser', FORMAT_INVALID, "Illegal token space GUID and PCD name format", - ExtraData=self._CurrentLine + " (.)", - File=self.MetaFile, Line=self._LineIndex + 1) - self._ValueList[0:1] = ValueList - if len(TokenList) > 1: - self._ValueList[2] = TokenList[1] - if self._ValueList[0] == '' or self._ValueList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", - ExtraData=self._CurrentLine + " (.)", - File=self.MetaFile, Line=self._LineIndex + 1) - - # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0. - if self._ValueList[2] != '': - InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1) - if InfPcdValueList[0] in ['True', 'true', 'TRUE']: - self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1); - elif InfPcdValueList[0] in ['False', 'false', 'FALSE']: - self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1); - if (self._ValueList[0], self._ValueList[1]) not in self.PcdsDict: - self.PcdsDict[self._ValueList[0], self._ValueList[1]] = self._SectionType - elif self.PcdsDict[self._ValueList[0], self._ValueList[1]] != self._SectionType: - EdkLogger.error('Parser', FORMAT_INVALID, "It is not permissible to list a specified PCD in different PCD type sections.", - ExtraData=self._CurrentLine + " (.)", - File=self.MetaFile, Line=self._LineIndex + 1) - - ## [depex] section parser - @ParseMacro - def _DepexParser(self): - self._ValueList[0:1] = [self._CurrentLine] - - _SectionParser = { - MODEL_UNKNOWN : MetaFileParser._Skip, - MODEL_META_DATA_HEADER : MetaFileParser._DefineParser, - MODEL_META_DATA_BUILD_OPTION : MetaFileParser._BuildOptionParser, - MODEL_EFI_INCLUDE : _IncludeParser, # for Edk.x modules - MODEL_EFI_LIBRARY_INSTANCE : MetaFileParser._CommonParser, # for Edk.x modules - MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser, - MODEL_META_DATA_PACKAGE : MetaFileParser._PathParser, - MODEL_META_DATA_NMAKE : _NmakeParser, # for Edk.x modules - MODEL_PCD_FIXED_AT_BUILD : _PcdParser, - MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, - MODEL_PCD_FEATURE_FLAG : _PcdParser, - MODEL_PCD_DYNAMIC_EX : _PcdParser, - MODEL_PCD_DYNAMIC : _PcdParser, - MODEL_EFI_SOURCE_FILE : _SourceFileParser, - MODEL_EFI_GUID : MetaFileParser._CommonParser, - MODEL_EFI_PROTOCOL : MetaFileParser._CommonParser, - MODEL_EFI_PPI : MetaFileParser._CommonParser, - MODEL_EFI_DEPEX : _DepexParser, - MODEL_EFI_BINARY_FILE : _BinaryFileParser, - MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, - } - -## DSC file parser class -# -# @param FilePath The path of platform description file -# @param FileType The raw data of DSC file -# @param Table Database used to retrieve module/package information -# @param Macros Macros used for replacement in file -# @param Owner Owner ID (for sub-section parsing) -# @param From ID from which the data comes (for !INCLUDE directive) -# -class DscParser(MetaFileParser): - # DSC file supported data types (one type per section) - DataType = { - TAB_SKUIDS.upper() : MODEL_EFI_SKU_ID, - TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE, - TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, - TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION, - TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD, - TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, - TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG, - TAB_PCDS_DYNAMIC_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_DEFAULT, - TAB_PCDS_DYNAMIC_HII_NULL.upper() : MODEL_PCD_DYNAMIC_HII, - TAB_PCDS_DYNAMIC_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_VPD, - TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_EX_DEFAULT, - TAB_PCDS_DYNAMIC_EX_HII_NULL.upper() : MODEL_PCD_DYNAMIC_EX_HII, - TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_EX_VPD, - TAB_COMPONENTS.upper() : MODEL_META_DATA_COMPONENT, - TAB_COMPONENTS_SOURCE_OVERRIDE_PATH.upper() : MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH, - TAB_DSC_DEFINES.upper() : MODEL_META_DATA_HEADER, - TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, - TAB_DSC_DEFINES_EDKGLOBAL : MODEL_META_DATA_GLOBAL_DEFINE, - TAB_INCLUDE.upper() : MODEL_META_DATA_INCLUDE, - TAB_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, - TAB_IF_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, - TAB_IF_N_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF, - TAB_ELSE_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF, - TAB_ELSE.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE, - TAB_END_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF, - } - - # Valid names in define section - DefineKeywords = [ - "DSC_SPECIFICATION", - "PLATFORM_NAME", - "PLATFORM_GUID", - "PLATFORM_VERSION", - "SKUID_IDENTIFIER", - "PCD_INFO_GENERATION", - "SUPPORTED_ARCHITECTURES", - "BUILD_TARGETS", - "OUTPUT_DIRECTORY", - "FLASH_DEFINITION", - "BUILD_NUMBER", - "RFC_LANGUAGES", - "ISO_LANGUAGES", - "TIME_STAMP_FILE", - "VPD_TOOL_GUID", - "FIX_LOAD_TOP_MEMORY_ADDRESS" - ] - - SymbolPattern = ValueExpression.SymbolPattern - - ## Constructor of DscParser - # - # Initialize object of DscParser - # - # @param FilePath The path of platform description file - # @param FileType The raw data of DSC file - # @param Table Database used to retrieve module/package information - # @param Macros Macros used for replacement in file - # @param Owner Owner ID (for sub-section parsing) - # @param From ID from which the data comes (for !INCLUDE directive) - # - def __init__(self, FilePath, FileType, Table, Owner= -1, From= -1): - # prevent re-initialization - if hasattr(self, "_Table"): - return - MetaFileParser.__init__(self, FilePath, FileType, Table, Owner, From) - self._Version = 0x00010005 # Only EDK2 dsc file is supported - # to store conditional directive evaluation result - self._DirectiveStack = [] - self._DirectiveEvalStack = [] - self._Enabled = 1 - - # - # Specify whether current line is in uncertain condition - # - self._InDirective = -1 - - # Final valid replacable symbols - self._Symbols = {} - # - # Map the ID between the original table and new table to track - # the owner item - # - self._IdMapping = {-1:-1} - - ## Parser starter - def Start(self): - Content = '' - try: - Content = open(str(self.MetaFile), 'r').readlines() - except: - EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) - - OwnerId = {} - for Index in range(0, len(Content)): - Line = CleanString(Content[Index]) - # skip empty line - if Line == '': - continue - - self._CurrentLine = Line - self._LineIndex = Index - if self._InSubsection and self._Owner[-1] == -1: - self._Owner.append(self._LastItem) - - # section header - if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: - self._SectionType = MODEL_META_DATA_SECTION_HEADER - # subsection ending - elif Line[0] == '}' and self._InSubsection: - self._InSubsection = False - self._SubsectionType = MODEL_UNKNOWN - self._SubsectionName = '' - self._Owner[-1] = -1 - OwnerId = {} - continue - # subsection header - elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END: - self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER - # directive line - elif Line[0] == '!': - self._DirectiveParser() - continue - - if self._InSubsection: - SectionType = self._SubsectionType - else: - SectionType = self._SectionType - self._ItemType = SectionType - - self._ValueList = ['', '', ''] - self._SectionParser[SectionType](self) - if self._ValueList == None: - continue - # - # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1, - # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 - # - for Arch, ModuleType in self._Scope: - Owner = self._Owner[-1] - if self._SubsectionType != MODEL_UNKNOWN: - Owner = OwnerId[Arch] - self._LastItem = self._Store( - self._ItemType, - self._ValueList[0], - self._ValueList[1], - self._ValueList[2], - Arch, - ModuleType, - Owner, - self._From, - self._LineIndex + 1, - - 1, - self._LineIndex + 1, - - 1, - self._Enabled - ) - if self._SubsectionType == MODEL_UNKNOWN and self._InSubsection: - OwnerId[Arch] = self._LastItem - - if self._DirectiveStack: - Type, Line, Text = self._DirectiveStack[-1] - EdkLogger.error('Parser', FORMAT_INVALID, "No matching '!endif' found", - ExtraData=Text, File=self.MetaFile, Line=Line) - self._Done() - - ## parser - def _SubsectionHeaderParser(self): - self._SubsectionName = self._CurrentLine[1:-1].upper() - if self._SubsectionName in self.DataType: - self._SubsectionType = self.DataType[self._SubsectionName] - else: - self._SubsectionType = MODEL_UNKNOWN - EdkLogger.warn("Parser", "Unrecognized sub-section", File=self.MetaFile, - Line=self._LineIndex + 1, ExtraData=self._CurrentLine) - self._ValueList[0] = self._SubsectionName - - ## Directive statement parser - def _DirectiveParser(self): - self._ValueList = ['', '', ''] - TokenList = GetSplitValueList(self._CurrentLine, ' ', 1) - self._ValueList[0:len(TokenList)] = TokenList - - # Syntax check - DirectiveName = self._ValueList[0].upper() - if DirectiveName not in self.DataType: - EdkLogger.error("Parser", FORMAT_INVALID, "Unknown directive [%s]" % DirectiveName, - File=self.MetaFile, Line=self._LineIndex + 1) - - if DirectiveName in ['!IF', '!IFDEF', '!IFNDEF']: - self._InDirective += 1 - - if DirectiveName in ['!ENDIF']: - self._InDirective -= 1 - - if DirectiveName in ['!IF', '!IFDEF', '!INCLUDE', '!IFNDEF', '!ELSEIF'] and self._ValueList[1] == '': - EdkLogger.error("Parser", FORMAT_INVALID, "Missing expression", - File=self.MetaFile, Line=self._LineIndex + 1, - ExtraData=self._CurrentLine) - - ItemType = self.DataType[DirectiveName] - Scope = [['COMMON', 'COMMON']] - if ItemType == MODEL_META_DATA_INCLUDE: - Scope = self._Scope - if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF: - # Remove all directives between !if and !endif, including themselves - while self._DirectiveStack: - # Remove any !else or !elseif - DirectiveInfo = self._DirectiveStack.pop() - if DirectiveInfo[0] in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: - break - else: - EdkLogger.error("Parser", FORMAT_INVALID, "Redundant '!endif'", - File=self.MetaFile, Line=self._LineIndex + 1, - ExtraData=self._CurrentLine) - elif ItemType != MODEL_META_DATA_INCLUDE: - # Break if there's a !else is followed by a !elseif - if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF and \ - self._DirectiveStack and \ - self._DirectiveStack[-1][0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE: - EdkLogger.error("Parser", FORMAT_INVALID, "'!elseif' after '!else'", - File=self.MetaFile, Line=self._LineIndex + 1, - ExtraData=self._CurrentLine) - self._DirectiveStack.append((ItemType, self._LineIndex + 1, self._CurrentLine)) - elif self._From > 0: - EdkLogger.error('Parser', FORMAT_INVALID, - "No '!include' allowed in included file", - ExtraData=self._CurrentLine, File=self.MetaFile, - Line=self._LineIndex + 1) - - # - # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1, - # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 - # - for Arch, ModuleType in Scope: - self._LastItem = self._Store( - ItemType, - self._ValueList[0], - self._ValueList[1], - self._ValueList[2], - Arch, - ModuleType, - self._Owner[-1], - self._From, - self._LineIndex + 1, - - 1, - self._LineIndex + 1, - - 1, - 0 - ) - - ## [defines] section parser - @ParseMacro - def _DefineParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - self._ValueList[1:len(TokenList)] = TokenList - - # Syntax check - if not self._ValueList[1]: - EdkLogger.error('Parser', FORMAT_INVALID, "No name specified", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - if not self._ValueList[2]: - EdkLogger.error('Parser', FORMAT_INVALID, "No value specified", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - if not self._ValueList[1] in self.DefineKeywords: - EdkLogger.error('Parser', FORMAT_INVALID, - "Unknown keyword found: %s. " - "If this is a macro you must " - "add it as a DEFINE in the DSC" % self._ValueList[1], - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - self._Defines[self._ValueList[1]] = self._ValueList[2] - self._ItemType = self.DataType[TAB_DSC_DEFINES.upper()] - - @ParseMacro - def _SkuIdParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - if len(TokenList) != 2: - EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '|'", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - self._ValueList[0:len(TokenList)] = TokenList - - ## Parse Edk style of library modules - @ParseMacro - def _LibraryInstanceParser(self): - self._ValueList[0] = self._CurrentLine - - ## PCD sections parser - # - # [PcdsFixedAtBuild] - # [PcdsPatchableInModule] - # [PcdsFeatureFlag] - # [PcdsDynamicEx - # [PcdsDynamicExDefault] - # [PcdsDynamicExVpd] - # [PcdsDynamicExHii] - # [PcdsDynamic] - # [PcdsDynamicDefault] - # [PcdsDynamicVpd] - # [PcdsDynamicHii] - # - @ParseMacro - def _PcdParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) - self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT) - if len(TokenList) == 2: - self._ValueList[2] = TokenList[1] - if self._ValueList[0] == '' or self._ValueList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", - ExtraData=self._CurrentLine + " (.|)", - File=self.MetaFile, Line=self._LineIndex + 1) - if self._ValueList[2] == '': - # - # The PCD values are optional for FIXEDATBUILD and PATCHABLEINMODULE - # - if self._SectionType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE): - return - EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given", - ExtraData=self._CurrentLine + " (.|)", - File=self.MetaFile, Line=self._LineIndex + 1) - - # Validate the datum type of Dynamic Defaul PCD and DynamicEx Default PCD - ValueList = GetSplitValueList(self._ValueList[2]) - if len(ValueList) > 1 and ValueList[1] != TAB_VOID \ - and self._ItemType in [MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT]: - EdkLogger.error('Parser', FORMAT_INVALID, "The datum type '%s' of PCD is wrong" % ValueList[1], - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - - # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0. - DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1) - if DscPcdValueList[0] in ['True', 'true', 'TRUE']: - self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '1', 1); - elif DscPcdValueList[0] in ['False', 'false', 'FALSE']: - self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '0', 1); - - - ## [components] section parser - @ParseMacro - def _ComponentParser(self): - if self._CurrentLine[-1] == '{': - self._ValueList[0] = self._CurrentLine[0:-1].strip() - self._InSubsection = True - else: - self._ValueList[0] = self._CurrentLine - - ## [LibraryClasses] section - @ParseMacro - def _LibraryClassParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - if len(TokenList) < 2: - EdkLogger.error('Parser', FORMAT_INVALID, "No library class or instance specified", - ExtraData=self._CurrentLine + " (|)", - File=self.MetaFile, Line=self._LineIndex + 1) - if TokenList[0] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No library class specified", - ExtraData=self._CurrentLine + " (|)", - File=self.MetaFile, Line=self._LineIndex + 1) - if TokenList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No library instance specified", - ExtraData=self._CurrentLine + " (|)", - File=self.MetaFile, Line=self._LineIndex + 1) - - self._ValueList[0:len(TokenList)] = TokenList - - def _CompponentSourceOverridePathParser(self): - self._ValueList[0] = self._CurrentLine - - ## [BuildOptions] section parser - @ParseMacro - def _BuildOptionParser(self): - self._CurrentLine = CleanString(self._CurrentLine, BuildOption=True) - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - TokenList2 = GetSplitValueList(TokenList[0], ':', 1) - if len(TokenList2) == 2: - self._ValueList[0] = TokenList2[0] # toolchain family - self._ValueList[1] = TokenList2[1] # keys - else: - self._ValueList[1] = TokenList[0] - if len(TokenList) == 2: # value - self._ValueList[2] = TokenList[1] - - if self._ValueList[1].count('_') != 4: - EdkLogger.error( - 'Parser', - FORMAT_INVALID, - "'%s' must be in format of ____FLAGS" % self._ValueList[1], - ExtraData=self._CurrentLine, - File=self.MetaFile, - Line=self._LineIndex + 1 - ) - - ## Override parent's method since we'll do all macro replacements in parser - def _GetMacros(self): - Macros = {} - Macros.update(self._FileLocalMacros) - Macros.update(self._GetApplicableSectionMacro()) - Macros.update(GlobalData.gEdkGlobal) - Macros.update(GlobalData.gPlatformDefines) - Macros.update(GlobalData.gCommandLineDefines) - # PCD cannot be referenced in macro definition - if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_GLOBAL_DEFINE]: - Macros.update(self._Symbols) - return Macros - - def _PostProcess(self): - Processer = { - MODEL_META_DATA_SECTION_HEADER : self.__ProcessSectionHeader, - MODEL_META_DATA_SUBSECTION_HEADER : self.__ProcessSubsectionHeader, - MODEL_META_DATA_HEADER : self.__ProcessDefine, - MODEL_META_DATA_DEFINE : self.__ProcessDefine, - MODEL_META_DATA_GLOBAL_DEFINE : self.__ProcessDefine, - MODEL_META_DATA_INCLUDE : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IF : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF : self.__ProcessDirective, - MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF : self.__ProcessDirective, - MODEL_EFI_SKU_ID : self.__ProcessSkuId, - MODEL_EFI_LIBRARY_INSTANCE : self.__ProcessLibraryInstance, - MODEL_EFI_LIBRARY_CLASS : self.__ProcessLibraryClass, - MODEL_PCD_FIXED_AT_BUILD : self.__ProcessPcd, - MODEL_PCD_PATCHABLE_IN_MODULE : self.__ProcessPcd, - MODEL_PCD_FEATURE_FLAG : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_DEFAULT : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_HII : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_VPD : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_EX_DEFAULT : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_EX_HII : self.__ProcessPcd, - MODEL_PCD_DYNAMIC_EX_VPD : self.__ProcessPcd, - MODEL_META_DATA_COMPONENT : self.__ProcessComponent, - MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH : self.__ProcessSourceOverridePath, - MODEL_META_DATA_BUILD_OPTION : self.__ProcessBuildOption, - MODEL_UNKNOWN : self._Skip, - MODEL_META_DATA_USER_EXTENSION : self._Skip, - } - - self._Table = MetaFileStorage(self._RawTable.Cur, self.MetaFile, MODEL_FILE_DSC, True) - self._Table.Create() - self._DirectiveStack = [] - self._DirectiveEvalStack = [] - self._FileWithError = self.MetaFile - self._FileLocalMacros = {} - self._SectionsMacroDict = {} - GlobalData.gPlatformDefines = {} - - # Get all macro and PCD which has straitforward value - self.__RetrievePcdValue() - self._Content = self._RawTable.GetAll() - self._ContentIndex = 0 - while self._ContentIndex < len(self._Content) : - Id, self._ItemType, V1, V2, V3, S1, S2, Owner, self._From, \ - LineStart, ColStart, LineEnd, ColEnd, Enabled = self._Content[self._ContentIndex] - - if self._From < 0: - self._FileWithError = self.MetaFile - - self._ContentIndex += 1 - - self._Scope = [[S1, S2]] - # - # For !include directive, handle it specially, - # merge arch and module type in case of duplicate items - # - while self._ItemType == MODEL_META_DATA_INCLUDE: - if self._ContentIndex >= len(self._Content): - break - Record = self._Content[self._ContentIndex] - if LineStart == Record[9] and LineEnd == Record[11]: - if [Record[5], Record[6]] not in self._Scope: - self._Scope.append([Record[5], Record[6]]) - self._ContentIndex += 1 - else: - break - - self._LineIndex = LineStart - 1 - self._ValueList = [V1, V2, V3] - - try: - Processer[self._ItemType]() - except EvaluationException, Excpt: - # - # Only catch expression evaluation error here. We need to report - # the precise number of line on which the error occurred - # - if hasattr(Excpt, 'Pcd'): - if Excpt.Pcd in GlobalData.gPlatformOtherPcds: - Info = GlobalData.gPlatformOtherPcds[Excpt.Pcd] - EdkLogger.error('Parser', FORMAT_INVALID, "Cannot use this PCD (%s) in an expression as" - " it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section" - " of the DSC file, and it is currently defined in this section:" - " %s, line #: %d." % (Excpt.Pcd, Info[0], Info[1]), - File=self._FileWithError, ExtraData=' '.join(self._ValueList), - Line=self._LineIndex + 1) - else: - EdkLogger.error('Parser', FORMAT_INVALID, "PCD (%s) is not defined in DSC file" % Excpt.Pcd, - File=self._FileWithError, ExtraData=' '.join(self._ValueList), - Line=self._LineIndex + 1) - else: - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt), - File=self._FileWithError, ExtraData=' '.join(self._ValueList), - Line=self._LineIndex + 1) - except MacroException, Excpt: - EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt), - File=self._FileWithError, ExtraData=' '.join(self._ValueList), - Line=self._LineIndex + 1) - - if self._ValueList == None: - continue - - NewOwner = self._IdMapping.get(Owner, -1) - self._Enabled = int((not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack)) - self._LastItem = self._Store( - self._ItemType, - self._ValueList[0], - self._ValueList[1], - self._ValueList[2], - S1, - S2, - NewOwner, - self._From, - self._LineIndex + 1, - - 1, - self._LineIndex + 1, - - 1, - self._Enabled - ) - self._IdMapping[Id] = self._LastItem - - GlobalData.gPlatformDefines.update(self._FileLocalMacros) - self._PostProcessed = True - self._Content = None - - def __ProcessSectionHeader(self): - self._SectionName = self._ValueList[0] - if self._SectionName in self.DataType: - self._SectionType = self.DataType[self._SectionName] - else: - self._SectionType = MODEL_UNKNOWN - - def __ProcessSubsectionHeader(self): - self._SubsectionName = self._ValueList[0] - if self._SubsectionName in self.DataType: - self._SubsectionType = self.DataType[self._SubsectionName] - else: - self._SubsectionType = MODEL_UNKNOWN - - def __RetrievePcdValue(self): - Records = self._RawTable.Query(MODEL_PCD_FEATURE_FLAG, BelongsToItem= -1.0) - for TokenSpaceGuid, PcdName, Value, Dummy2, Dummy3, ID, Line in Records: - Name = TokenSpaceGuid + '.' + PcdName - ValList, Valid, Index = AnalyzeDscPcd(Value, MODEL_PCD_FEATURE_FLAG) - self._Symbols[Name] = ValList[Index] - - Records = self._RawTable.Query(MODEL_PCD_FIXED_AT_BUILD, BelongsToItem= -1.0) - for TokenSpaceGuid, PcdName, Value, Dummy2, Dummy3, ID, Line in Records: - Name = TokenSpaceGuid + '.' + PcdName - ValList, Valid, Index = AnalyzeDscPcd(Value, MODEL_PCD_FIXED_AT_BUILD) - self._Symbols[Name] = ValList[Index] - - Content = open(str(self.MetaFile), 'r').readlines() - GlobalData.gPlatformOtherPcds['DSCFILE'] = str(self.MetaFile) - for PcdType in (MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_HII, - MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_DYNAMIC_EX_HII, - MODEL_PCD_DYNAMIC_EX_VPD): - Records = self._RawTable.Query(PcdType, BelongsToItem= -1.0) - for TokenSpaceGuid, PcdName, Value, Dummy2, Dummy3, ID, Line in Records: - Name = TokenSpaceGuid + '.' + PcdName - if Name not in GlobalData.gPlatformOtherPcds: - PcdLine = Line - while not Content[Line - 1].lstrip().startswith(TAB_SECTION_START): - Line -= 1 - GlobalData.gPlatformOtherPcds[Name] = (CleanString(Content[Line - 1]), PcdLine, PcdType) - - def __ProcessDefine(self): - if not self._Enabled: - return - - Type, Name, Value = self._ValueList - Value = ReplaceMacro(Value, self._Macros, False) - if self._ItemType == MODEL_META_DATA_DEFINE: - if self._SectionType == MODEL_META_DATA_HEADER: - self._FileLocalMacros[Name] = Value - else: - self._ConstructSectionMacroDict(Name, Value) - elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE: - GlobalData.gEdkGlobal[Name] = Value - - # - # Keyword in [Defines] section can be used as Macros - # - if (self._ItemType == MODEL_META_DATA_HEADER) and (self._SectionType == MODEL_META_DATA_HEADER): - self._FileLocalMacros[Name] = Value - - self._ValueList = [Type, Name, Value] - - def __ProcessDirective(self): - Result = None - if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF]: - Macros = self._Macros - Macros.update(GlobalData.gGlobalDefines) - try: - Result = ValueExpression(self._ValueList[1], Macros)() - except SymbolNotFound, Exc: - EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1]) - Result = False - except WrnExpression, Excpt: - # - # Catch expression evaluation warning here. We need to report - # the precise number of line and return the evaluation result - # - EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt), - File=self._FileWithError, ExtraData=' '.join(self._ValueList), - Line=self._LineIndex + 1) - Result = Excpt.result - - if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: - self._DirectiveStack.append(self._ItemType) - if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF: - Result = bool(Result) - else: - Macro = self._ValueList[1] - Macro = Macro[2:-1] if (Macro.startswith("$(") and Macro.endswith(")")) else Macro - Result = Macro in self._Macros - if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF: - Result = not Result - self._DirectiveEvalStack.append(Result) - elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF: - self._DirectiveStack.append(self._ItemType) - self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1] - self._DirectiveEvalStack.append(bool(Result)) - elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE: - self._DirectiveStack.append(self._ItemType) - self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1] - self._DirectiveEvalStack.append(True) - elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF: - # Back to the nearest !if/!ifdef/!ifndef - while self._DirectiveStack: - self._DirectiveEvalStack.pop() - Directive = self._DirectiveStack.pop() - if Directive in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, - MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: - break - elif self._ItemType == MODEL_META_DATA_INCLUDE: - # The included file must be relative to workspace or same directory as DSC file - __IncludeMacros = {} - # - # Allow using system environment variables in path after !include - # - __IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE'] - if "ECP_SOURCE" in GlobalData.gGlobalDefines.keys(): - __IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE'] - # - # During GenFds phase call DSC parser, will go into this branch. - # - elif "ECP_SOURCE" in GlobalData.gCommandLineDefines.keys(): - __IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE'] - - __IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE'] - __IncludeMacros['EDK_SOURCE'] = GlobalData.gGlobalDefines['EDK_SOURCE'] - # - # Allow using MACROs comes from [Defines] section to keep compatible. - # - __IncludeMacros.update(self._Macros) - - IncludedFile = NormPath(ReplaceMacro(self._ValueList[1], __IncludeMacros, RaiseError=True)) - # - # First search the include file under the same directory as DSC file - # - IncludedFile1 = PathClass(IncludedFile, self.MetaFile.Dir) - ErrorCode, ErrorInfo1 = IncludedFile1.Validate() - if ErrorCode != 0: - # - # Also search file under the WORKSPACE directory - # - IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace) - ErrorCode, ErrorInfo2 = IncludedFile1.Validate() - if ErrorCode != 0: - EdkLogger.error('parser', ErrorCode, File=self._FileWithError, - Line=self._LineIndex + 1, ExtraData=ErrorInfo1 + "\n" + ErrorInfo2) - - self._FileWithError = IncludedFile1 - - IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile1, MODEL_FILE_DSC, False) - Owner = self._Content[self._ContentIndex - 1][0] - Parser = DscParser(IncludedFile1, self._FileType, IncludedFileTable, - Owner=Owner, From=Owner) - - # set the parser status with current status - Parser._SectionName = self._SectionName - Parser._SectionType = self._SectionType - Parser._Scope = self._Scope - Parser._Enabled = self._Enabled - # Parse the included file - Parser.Start() - - # update current status with sub-parser's status - self._SectionName = Parser._SectionName - self._SectionType = Parser._SectionType - self._Scope = Parser._Scope - self._Enabled = Parser._Enabled - - # Insert all records in the table for the included file into dsc file table - Records = IncludedFileTable.GetAll() - if Records: - self._Content[self._ContentIndex:self._ContentIndex] = Records - self._Content.pop(self._ContentIndex - 1) - self._ValueList = None - self._ContentIndex -= 1 - - def __ProcessSkuId(self): - self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=True) - for Value in self._ValueList] - - def __ProcessLibraryInstance(self): - self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList] - - def __ProcessLibraryClass(self): - self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True) - - def __ProcessPcd(self): - if self._ItemType not in [MODEL_PCD_FEATURE_FLAG, MODEL_PCD_FIXED_AT_BUILD]: - self._ValueList[2] = ReplaceMacro(self._ValueList[2], self._Macros, RaiseError=True) - return - - ValList, Valid, Index = AnalyzeDscPcd(self._ValueList[2], self._ItemType) - if not Valid: - EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.", File=self._FileWithError, Line=self._LineIndex+1, - ExtraData="%s.%s|%s" % (self._ValueList[0], self._ValueList[1], self._ValueList[2])) - PcdValue = ValList[Index] - if PcdValue: - try: - ValList[Index] = ValueExpression(PcdValue, self._Macros)(True) - except WrnExpression, Value: - ValList[Index] = Value.result - - if ValList[Index] == 'True': - ValList[Index] = '1' - if ValList[Index] == 'False': - ValList[Index] = '0' - - GlobalData.gPlatformPcds[TAB_SPLIT.join(self._ValueList[0:2])] = PcdValue - self._ValueList[2] = '|'.join(ValList) - - def __ProcessComponent(self): - self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros) - - def __ProcessSourceOverridePath(self): - self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros) - - def __ProcessBuildOption(self): - self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=False) - for Value in self._ValueList] - - _SectionParser = { - MODEL_META_DATA_HEADER : _DefineParser, - MODEL_EFI_SKU_ID : _SkuIdParser, - MODEL_EFI_LIBRARY_INSTANCE : _LibraryInstanceParser, - MODEL_EFI_LIBRARY_CLASS : _LibraryClassParser, - MODEL_PCD_FIXED_AT_BUILD : _PcdParser, - MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, - MODEL_PCD_FEATURE_FLAG : _PcdParser, - MODEL_PCD_DYNAMIC_DEFAULT : _PcdParser, - MODEL_PCD_DYNAMIC_HII : _PcdParser, - MODEL_PCD_DYNAMIC_VPD : _PcdParser, - MODEL_PCD_DYNAMIC_EX_DEFAULT : _PcdParser, - MODEL_PCD_DYNAMIC_EX_HII : _PcdParser, - MODEL_PCD_DYNAMIC_EX_VPD : _PcdParser, - MODEL_META_DATA_COMPONENT : _ComponentParser, - MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH : _CompponentSourceOverridePathParser, - MODEL_META_DATA_BUILD_OPTION : _BuildOptionParser, - MODEL_UNKNOWN : MetaFileParser._Skip, - MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, - MODEL_META_DATA_SECTION_HEADER : MetaFileParser._SectionHeaderParser, - MODEL_META_DATA_SUBSECTION_HEADER : _SubsectionHeaderParser, - } - - _Macros = property(_GetMacros) - -## DEC file parser class -# -# @param FilePath The path of platform description file -# @param FileType The raw data of DSC file -# @param Table Database used to retrieve module/package information -# @param Macros Macros used for replacement in file -# -class DecParser(MetaFileParser): - # DEC file supported data types (one type per section) - DataType = { - TAB_DEC_DEFINES.upper() : MODEL_META_DATA_HEADER, - TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, - TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE, - TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, - TAB_GUIDS.upper() : MODEL_EFI_GUID, - TAB_PPIS.upper() : MODEL_EFI_PPI, - TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL, - TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD, - TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, - TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG, - TAB_PCDS_DYNAMIC_NULL.upper() : MODEL_PCD_DYNAMIC, - TAB_PCDS_DYNAMIC_EX_NULL.upper() : MODEL_PCD_DYNAMIC_EX, - } - - ## Constructor of DecParser - # - # Initialize object of DecParser - # - # @param FilePath The path of platform description file - # @param FileType The raw data of DSC file - # @param Table Database used to retrieve module/package information - # @param Macros Macros used for replacement in file - # - def __init__(self, FilePath, FileType, Table): - # prevent re-initialization - if hasattr(self, "_Table"): - return - MetaFileParser.__init__(self, FilePath, FileType, Table, -1) - self._Comments = [] - self._Version = 0x00010005 # Only EDK2 dec file is supported - self._AllPCDs = [] # Only for check duplicate PCD - - ## Parser starter - def Start(self): - Content = '' - try: - Content = open(str(self.MetaFile), 'r').readlines() - except: - EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) - - for Index in range(0, len(Content)): - Line, Comment = CleanString2(Content[Index]) - self._CurrentLine = Line - self._LineIndex = Index - - # save comment for later use - if Comment: - self._Comments.append((Comment, self._LineIndex + 1)) - # skip empty line - if Line == '': - continue - - # section header - if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: - self._SectionHeaderParser() - self._Comments = [] - continue - elif len(self._SectionType) == 0: - self._Comments = [] - continue - - # section content - self._ValueList = ['', '', ''] - self._SectionParser[self._SectionType[0]](self) - if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE: - self._ItemType = -1 - self._Comments = [] - continue - - # - # Model, Value1, Value2, Value3, Arch, BelongsToItem=-1, LineBegin=-1, - # ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, FeatureFlag='', Enabled=-1 - # - for Arch, ModuleType, Type in self._Scope: - self._LastItem = self._Store( - Type, - self._ValueList[0], - self._ValueList[1], - self._ValueList[2], - Arch, - ModuleType, - self._Owner[-1], - self._LineIndex + 1, - - 1, - self._LineIndex + 1, - - 1, - 0 - ) - for Comment, LineNo in self._Comments: - self._Store( - MODEL_META_DATA_COMMENT, - Comment, - self._ValueList[0], - self._ValueList[1], - Arch, - ModuleType, - self._LastItem, - LineNo, - - 1, - LineNo, - - 1, - 0 - ) - self._Comments = [] - self._Done() - - - ## Section header parser - # - # The section header is always in following format: - # - # [section_name.arch<.platform|module_type>] - # - def _SectionHeaderParser(self): - self._Scope = [] - self._SectionName = '' - self._SectionType = [] - ArchList = set() - Line = self._CurrentLine.replace("%s%s" % (TAB_COMMA_SPLIT, TAB_SPACE_SPLIT), TAB_COMMA_SPLIT) - for Item in Line[1:-1].split(TAB_COMMA_SPLIT): - if Item == '': - EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, - "section name can NOT be empty or incorrectly use separator comma", - self.MetaFile, self._LineIndex + 1, self._CurrentLine) - ItemList = Item.split(TAB_SPLIT) - - # different types of PCD are permissible in one section - self._SectionName = ItemList[0].upper() - if self._SectionName in self.DataType: - if self.DataType[self._SectionName] not in self._SectionType: - self._SectionType.append(self.DataType[self._SectionName]) - else: - EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item, - self.MetaFile, self._LineIndex + 1, self._CurrentLine) - - if MODEL_PCD_FEATURE_FLAG in self._SectionType and len(self._SectionType) > 1: - EdkLogger.error( - 'Parser', - FORMAT_INVALID, - "%s must not be in the same section of other types of PCD" % TAB_PCDS_FEATURE_FLAG_NULL, - File=self.MetaFile, - Line=self._LineIndex + 1, - ExtraData=self._CurrentLine - ) - # S1 is always Arch - if len(ItemList) > 1: - S1 = ItemList[1].upper() - else: - S1 = 'COMMON' - ArchList.add(S1) - # S2 may be Platform or ModuleType - if len(ItemList) > 2: - S2 = ItemList[2].upper() - else: - S2 = 'COMMON' - if [S1, S2, self.DataType[self._SectionName]] not in self._Scope: - self._Scope.append([S1, S2, self.DataType[self._SectionName]]) - - # 'COMMON' must not be used with specific ARCHs at the same section - if 'COMMON' in ArchList and len(ArchList) > 1: - EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs", - File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine) - - ## [guids], [ppis] and [protocols] section parser - @ParseMacro - def _GuidParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) - if len(TokenList) < 2: - EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name or value specified", - ExtraData=self._CurrentLine + " ( = )", - File=self.MetaFile, Line=self._LineIndex + 1) - if TokenList[0] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name specified", - ExtraData=self._CurrentLine + " ( = )", - File=self.MetaFile, Line=self._LineIndex + 1) - if TokenList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No GUID value specified", - ExtraData=self._CurrentLine + " ( = )", - File=self.MetaFile, Line=self._LineIndex + 1) - if TokenList[1][0] != '{' or TokenList[1][-1] != '}' or GuidStructureStringToGuidString(TokenList[1]) == '': - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid GUID value format", - ExtraData=self._CurrentLine + \ - " ( = )", - File=self.MetaFile, Line=self._LineIndex + 1) - self._ValueList[0] = TokenList[0] - self._ValueList[1] = TokenList[1] - - ## PCD sections parser - # - # [PcdsFixedAtBuild] - # [PcdsPatchableInModule] - # [PcdsFeatureFlag] - # [PcdsDynamicEx - # [PcdsDynamic] - # - @ParseMacro - def _PcdParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) - self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT) - ValueRe = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*') - # check PCD information - if self._ValueList[0] == '' or self._ValueList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex + 1) - # check format of token space GUID CName - if not ValueRe.match(self._ValueList[0]): - EdkLogger.error('Parser', FORMAT_INVALID, "The format of the token space GUID CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex + 1) - # check format of PCD CName - if not ValueRe.match(self._ValueList[1]): - EdkLogger.error('Parser', FORMAT_INVALID, "The format of the PCD CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex + 1) - # check PCD datum information - if len(TokenList) < 2 or TokenList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum information given", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex + 1) - - - ValueRe = re.compile(r'^\s*L?\".*\|.*\"') - PtrValue = ValueRe.findall(TokenList[1]) - - # Has VOID* type string, may contain "|" character in the string. - if len(PtrValue) != 0: - ptrValueList = re.sub(ValueRe, '', TokenList[1]) - ValueList = GetSplitValueList(ptrValueList) - ValueList[0] = PtrValue[0] - else: - ValueList = GetSplitValueList(TokenList[1]) - - - # check if there's enough datum information given - if len(ValueList) != 3: - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information given", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex + 1) - # check default value - if ValueList[0] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum information", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex + 1) - # check datum type - if ValueList[1] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum information", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex + 1) - # check token of the PCD - if ValueList[2] == '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum information", - ExtraData=self._CurrentLine + \ - " (.|||)", - File=self.MetaFile, Line=self._LineIndex + 1) - # check format of default value against the datum type - IsValid, Cause = CheckPcdDatum(ValueList[1], ValueList[0]) - if not IsValid: - EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine, - File=self.MetaFile, Line=self._LineIndex + 1) - - if ValueList[0] in ['True', 'true', 'TRUE']: - ValueList[0] = '1' - elif ValueList[0] in ['False', 'false', 'FALSE']: - ValueList[0] = '0' - - # check for duplicate PCD definition - if (self._Scope[0], self._ValueList[0], self._ValueList[1]) in self._AllPCDs: - EdkLogger.error('Parser', FORMAT_INVALID, - "The same PCD name and GUID have been already defined", - ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) - else: - self._AllPCDs.append((self._Scope[0], self._ValueList[0], self._ValueList[1])) - - self._ValueList[2] = ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip() - - _SectionParser = { - MODEL_META_DATA_HEADER : MetaFileParser._DefineParser, - MODEL_EFI_INCLUDE : MetaFileParser._PathParser, - MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser, - MODEL_EFI_GUID : _GuidParser, - MODEL_EFI_PPI : _GuidParser, - MODEL_EFI_PROTOCOL : _GuidParser, - MODEL_PCD_FIXED_AT_BUILD : _PcdParser, - MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, - MODEL_PCD_FEATURE_FLAG : _PcdParser, - MODEL_PCD_DYNAMIC : _PcdParser, - MODEL_PCD_DYNAMIC_EX : _PcdParser, - MODEL_UNKNOWN : MetaFileParser._Skip, - MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, - } - -## -# -# This acts like the main() function for the script, unless it is 'import'ed into another -# script. -# -if __name__ == '__main__': - pass - +## @file +# This file is used to parse meta files +# +# Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import re +import time +import copy + +import Common.EdkLogger as EdkLogger +import Common.GlobalData as GlobalData + +from CommonDataClass.DataClass import * +from Common.DataType import * +from Common.String import * +from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData, AnalyzeDscPcd +from Common.Expression import * +from CommonDataClass.Exceptions import * + +from MetaFileTable import MetaFileStorage + +## A decorator used to parse macro definition +def ParseMacro(Parser): + def MacroParser(self): + Match = gMacroDefPattern.match(self._CurrentLine) + if not Match: + # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method + Parser(self) + return + + TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):], TAB_EQUAL_SPLIT, 1) + # Syntax check + if not TokenList[0]: + EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + if len(TokenList) < 2: + TokenList.append('') + + Type = Match.group(1) + Name, Value = TokenList + # Global macros can be only defined via environment variable + if Name in GlobalData.gGlobalDefines: + EdkLogger.error('Parser', FORMAT_INVALID, "%s can only be defined via environment variable" % Name, + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + # Only upper case letters, digit and '_' are allowed + if not gMacroNamePattern.match(Name): + EdkLogger.error('Parser', FORMAT_INVALID, "The macro name must be in the pattern [A-Z][A-Z0-9_]*", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + + Value = ReplaceMacro(Value, self._Macros) + if Type in self.DataType: + self._ItemType = self.DataType[Type] + else: + self._ItemType = MODEL_META_DATA_DEFINE + # DEFINE defined macros + if Type == TAB_DSC_DEFINES_DEFINE: + # + # First judge whether this DEFINE is in conditional directive statements or not. + # + if type(self) == DscParser and self._InDirective > -1: + pass + else: + if type(self) == DecParser: + if MODEL_META_DATA_HEADER in self._SectionType: + self._FileLocalMacros[Name] = Value + else: + self._ConstructSectionMacroDict(Name, Value) + elif self._SectionType == MODEL_META_DATA_HEADER: + self._FileLocalMacros[Name] = Value + else: + self._ConstructSectionMacroDict(Name, Value) + + # EDK_GLOBAL defined macros + elif type(self) != DscParser: + EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + elif self._SectionType != MODEL_META_DATA_HEADER: + EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used under [Defines] section", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] != Value): + EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a macro with the same name and different value as one defined by 'DEFINE'", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + + self._ValueList = [Type, Name, Value] + + return MacroParser + +## Base class of parser +# +# This class is used for derivation purpose. The specific parser for one kind +# type file must derive this class and implement some public interfaces. +# +# @param FilePath The path of platform description file +# @param FileType The raw data of DSC file +# @param Table Database used to retrieve module/package information +# @param Macros Macros used for replacement in file +# @param Owner Owner ID (for sub-section parsing) +# @param From ID from which the data comes (for !INCLUDE directive) +# +class MetaFileParser(object): + # data type (file content) for specific file type + DataType = {} + + # Parser objects used to implement singleton + MetaFiles = {} + + ## Factory method + # + # One file, one parser object. This factory method makes sure that there's + # only one object constructed for one meta file. + # + # @param Class class object of real AutoGen class + # (InfParser, DecParser or DscParser) + # @param FilePath The path of meta file + # @param *args The specific class related parameters + # @param **kwargs The specific class related dict parameters + # + def __new__(Class, FilePath, *args, **kwargs): + if FilePath in Class.MetaFiles: + return Class.MetaFiles[FilePath] + else: + ParserObject = super(MetaFileParser, Class).__new__(Class) + Class.MetaFiles[FilePath] = ParserObject + return ParserObject + + ## Constructor of MetaFileParser + # + # Initialize object of MetaFileParser + # + # @param FilePath The path of platform description file + # @param FileType The raw data of DSC file + # @param Table Database used to retrieve module/package information + # @param Macros Macros used for replacement in file + # @param Owner Owner ID (for sub-section parsing) + # @param From ID from which the data comes (for !INCLUDE directive) + # + def __init__(self, FilePath, FileType, Table, Owner= -1, From= -1): + self._Table = Table + self._RawTable = Table + self._FileType = FileType + self.MetaFile = FilePath + self._FileDir = self.MetaFile.Dir + self._Defines = {} + self._FileLocalMacros = {} + self._SectionsMacroDict = {} + + # for recursive parsing + self._Owner = [Owner] + self._From = From + + # parsr status for parsing + self._ValueList = ['', '', '', '', ''] + self._Scope = [] + self._LineIndex = 0 + self._CurrentLine = '' + self._SectionType = MODEL_UNKNOWN + self._SectionName = '' + self._InSubsection = False + self._SubsectionType = MODEL_UNKNOWN + self._SubsectionName = '' + self._ItemType = MODEL_UNKNOWN + self._LastItem = -1 + self._Enabled = 0 + self._Finished = False + self._PostProcessed = False + # Different version of meta-file has different way to parse. + self._Version = 0 + + ## Store the parsed data in table + def _Store(self, *Args): + return self._Table.Insert(*Args) + + ## Virtual method for starting parse + def Start(self): + raise NotImplementedError + + ## Notify a post-process is needed + def DoPostProcess(self): + self._PostProcessed = False + + ## Set parsing complete flag in both class and table + def _Done(self): + self._Finished = True + ## Do not set end flag when processing included files + if self._From == -1: + self._Table.SetEndFlag() + + def _PostProcess(self): + self._PostProcessed = True + + ## Get the parse complete flag + def _GetFinished(self): + return self._Finished + + ## Set the complete flag + def _SetFinished(self, Value): + self._Finished = Value + + ## Use [] style to query data in table, just for readability + # + # DataInfo = [data_type, scope1(arch), scope2(platform/moduletype)] + # + def __getitem__(self, DataInfo): + if type(DataInfo) != type(()): + DataInfo = (DataInfo,) + + # Parse the file first, if necessary + if not self._Finished: + if self._RawTable.IsIntegrity(): + self._Finished = True + else: + self._Table = self._RawTable + self._PostProcessed = False + self.Start() + + # No specific ARCH or Platform given, use raw data + if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] == None): + return self._RawTable.Query(*DataInfo) + + # Do post-process if necessary + if not self._PostProcessed: + self._PostProcess() + + return self._Table.Query(*DataInfo) + + ## Data parser for the common format in different type of file + # + # The common format in the meatfile is like + # + # xxx1 | xxx2 | xxx3 + # + @ParseMacro + def _CommonParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + self._ValueList[0:len(TokenList)] = TokenList + + ## Data parser for the format in which there's path + # + # Only path can have macro used. So we need to replace them before use. + # + @ParseMacro + def _PathParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + self._ValueList[0:len(TokenList)] = TokenList + # Don't do macro replacement for dsc file at this point + if type(self) != DscParser: + Macros = self._Macros + self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList] + + ## Skip unsupported data + def _Skip(self): + EdkLogger.warn("Parser", "Unrecognized content", File=self.MetaFile, + Line=self._LineIndex + 1, ExtraData=self._CurrentLine); + self._ValueList[0:1] = [self._CurrentLine] + + ## Section header parser + # + # The section header is always in following format: + # + # [section_name.arch<.platform|module_type>] + # + def _SectionHeaderParser(self): + self._Scope = [] + self._SectionName = '' + ArchList = set() + for Item in GetSplitValueList(self._CurrentLine[1:-1], TAB_COMMA_SPLIT): + if Item == '': + continue + ItemList = GetSplitValueList(Item, TAB_SPLIT,2) + # different section should not mix in one section + if self._SectionName != '' and self._SectionName != ItemList[0].upper(): + EdkLogger.error('Parser', FORMAT_INVALID, "Different section names in the same section", + File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine) + self._SectionName = ItemList[0].upper() + if self._SectionName in self.DataType: + self._SectionType = self.DataType[self._SectionName] + # Check if the section name is valid + if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH and len(ItemList) > 3: + EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item, + self.MetaFile, self._LineIndex + 1, self._CurrentLine) + elif self._Version >= 0x00010005: + EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item, + self.MetaFile, self._LineIndex + 1, self._CurrentLine) + else: + self._SectionType = MODEL_UNKNOWN + + # S1 is always Arch + if len(ItemList) > 1: + S1 = ItemList[1].upper() + else: + S1 = 'COMMON' + ArchList.add(S1) + + # S2 may be Platform or ModuleType + if len(ItemList) > 2: + if self._SectionName.upper() in SECTIONS_HAVE_ITEM_PCD: + S2 = ItemList[2] + else: + S2 = ItemList[2].upper() + else: + S2 = 'COMMON' + self._Scope.append([S1, S2]) + + # 'COMMON' must not be used with specific ARCHs at the same section + if 'COMMON' in ArchList and len(ArchList) > 1: + EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs", + File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine) + # If the section information is needed later, it should be stored in database + self._ValueList[0] = self._SectionName + + ## [defines] section parser + @ParseMacro + def _DefineParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + self._ValueList[1:len(TokenList)] = TokenList + if not self._ValueList[1]: + EdkLogger.error('Parser', FORMAT_INVALID, "No name specified", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + if not self._ValueList[2]: + EdkLogger.error('Parser', FORMAT_INVALID, "No value specified", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + + self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList] + Name, Value = self._ValueList[1], self._ValueList[2] + # Sometimes, we need to make differences between EDK and EDK2 modules + if Name == 'INF_VERSION': + try: + self._Version = int(Value, 0) + except: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + + if type(self) == InfParser and self._Version < 0x00010005: + # EDK module allows using defines as macros + self._FileLocalMacros[Name] = Value + self._Defines[Name] = Value + + ## [BuildOptions] section parser + @ParseMacro + def _BuildOptionParser(self): + self._CurrentLine = CleanString(self._CurrentLine, BuildOption=True) + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + TokenList2 = GetSplitValueList(TokenList[0], ':', 1) + if len(TokenList2) == 2: + self._ValueList[0] = TokenList2[0] # toolchain family + self._ValueList[1] = TokenList2[1] # keys + else: + self._ValueList[1] = TokenList[0] + if len(TokenList) == 2 and type(self) != DscParser: # value + self._ValueList[2] = ReplaceMacro(TokenList[1], self._Macros) + + if self._ValueList[1].count('_') != 4: + EdkLogger.error( + 'Parser', + FORMAT_INVALID, + "'%s' must be in format of ____FLAGS" % self._ValueList[1], + ExtraData=self._CurrentLine, + File=self.MetaFile, + Line=self._LineIndex + 1 + ) + + def _GetMacros(self): + Macros = {} + Macros.update(self._FileLocalMacros) + Macros.update(self._GetApplicableSectionMacro()) + return Macros + + ## Construct section Macro dict + def _ConstructSectionMacroDict(self, Name, Value): + ScopeKey = [(Scope[0], Scope[1]) for Scope in self._Scope] + ScopeKey = tuple(ScopeKey) + SectionDictKey = self._SectionType, ScopeKey + # + # DecParser SectionType is a list, will contain more than one item only in Pcd Section + # As Pcd section macro usage is not alllowed, so here it is safe + # + if type(self) == DecParser: + SectionDictKey = self._SectionType[0], ScopeKey + if SectionDictKey not in self._SectionsMacroDict: + self._SectionsMacroDict[SectionDictKey] = {} + SectionLocalMacros = self._SectionsMacroDict[SectionDictKey] + SectionLocalMacros[Name] = Value + + ## Get section Macros that are applicable to current line, which may come from other sections + ## that share the same name while scope is wider + def _GetApplicableSectionMacro(self): + Macros = {} + + ComComMacroDict = {} + ComSpeMacroDict = {} + SpeSpeMacroDict = {} + + ActiveSectionType = self._SectionType + if type(self) == DecParser: + ActiveSectionType = self._SectionType[0] + + for (SectionType, Scope) in self._SectionsMacroDict: + if SectionType != ActiveSectionType: + continue + + for ActiveScope in self._Scope: + Scope0, Scope1 = ActiveScope[0], ActiveScope[1] + if(Scope0, Scope1) not in Scope: + break + else: + SpeSpeMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)]) + + for ActiveScope in self._Scope: + Scope0, Scope1 = ActiveScope[0], ActiveScope[1] + if(Scope0, Scope1) not in Scope and (Scope0, "COMMON") not in Scope and ("COMMON", Scope1) not in Scope: + break + else: + ComSpeMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)]) + + if ("COMMON", "COMMON") in Scope: + ComComMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)]) + + Macros.update(ComComMacroDict) + Macros.update(ComSpeMacroDict) + Macros.update(SpeSpeMacroDict) + + return Macros + + _SectionParser = {} + Finished = property(_GetFinished, _SetFinished) + _Macros = property(_GetMacros) + + +## INF file parser class +# +# @param FilePath The path of platform description file +# @param FileType The raw data of DSC file +# @param Table Database used to retrieve module/package information +# @param Macros Macros used for replacement in file +# +class InfParser(MetaFileParser): + # INF file supported data types (one type per section) + DataType = { + TAB_UNKNOWN.upper() : MODEL_UNKNOWN, + TAB_INF_DEFINES.upper() : MODEL_META_DATA_HEADER, + TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, + TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION, + TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE, + TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE, + TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, + TAB_PACKAGES.upper() : MODEL_META_DATA_PACKAGE, + TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE, + TAB_INF_FIXED_PCD.upper() : MODEL_PCD_FIXED_AT_BUILD, + TAB_INF_PATCH_PCD.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, + TAB_INF_FEATURE_PCD.upper() : MODEL_PCD_FEATURE_FLAG, + TAB_INF_PCD_EX.upper() : MODEL_PCD_DYNAMIC_EX, + TAB_INF_PCD.upper() : MODEL_PCD_DYNAMIC, + TAB_SOURCES.upper() : MODEL_EFI_SOURCE_FILE, + TAB_GUIDS.upper() : MODEL_EFI_GUID, + TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL, + TAB_PPIS.upper() : MODEL_EFI_PPI, + TAB_DEPEX.upper() : MODEL_EFI_DEPEX, + TAB_BINARIES.upper() : MODEL_EFI_BINARY_FILE, + TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION + } + + ## Constructor of InfParser + # + # Initialize object of InfParser + # + # @param FilePath The path of module description file + # @param FileType The raw data of DSC file + # @param Table Database used to retrieve module/package information + # @param Macros Macros used for replacement in file + # + def __init__(self, FilePath, FileType, Table): + # prevent re-initialization + if hasattr(self, "_Table"): + return + MetaFileParser.__init__(self, FilePath, FileType, Table) + self.PcdsDict = {} + + ## Parser starter + def Start(self): + NmakeLine = '' + Content = '' + try: + Content = open(str(self.MetaFile), 'r').readlines() + except: + EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) + + # parse the file line by line + IsFindBlockComment = False + GetHeaderComment = False + TailComments = [] + SectionComments = [] + Comments = [] + + for Index in range(0, len(Content)): + # skip empty, commented, block commented lines + Line, Comment = CleanString2(Content[Index], AllowCppStyleComment=True) + NextLine = '' + if Index + 1 < len(Content): + NextLine, NextComment = CleanString2(Content[Index + 1]) + if Line == '': + if Comment: + Comments.append((Comment, Index + 1)) + elif GetHeaderComment: + SectionComments.extend(Comments) + Comments = [] + continue + if Line.find(DataType.TAB_COMMENT_EDK_START) > -1: + IsFindBlockComment = True + continue + if Line.find(DataType.TAB_COMMENT_EDK_END) > -1: + IsFindBlockComment = False + continue + if IsFindBlockComment: + continue + + self._LineIndex = Index + self._CurrentLine = Line + + # section header + if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: + if not GetHeaderComment: + for Cmt, LNo in Comments: + self._Store(MODEL_META_DATA_HEADER_COMMENT, Cmt, '', '', 'COMMON', + 'COMMON', self._Owner[-1], LNo, -1, LNo, -1, 0) + GetHeaderComment = True + else: + TailComments.extend(SectionComments + Comments) + Comments = [] + self._SectionHeaderParser() + # Check invalid sections + if self._Version < 0x00010005: + if self._SectionType in [MODEL_META_DATA_BUILD_OPTION, + MODEL_EFI_LIBRARY_CLASS, + MODEL_META_DATA_PACKAGE, + MODEL_PCD_FIXED_AT_BUILD, + MODEL_PCD_PATCHABLE_IN_MODULE, + MODEL_PCD_FEATURE_FLAG, + MODEL_PCD_DYNAMIC_EX, + MODEL_PCD_DYNAMIC, + MODEL_EFI_GUID, + MODEL_EFI_PROTOCOL, + MODEL_EFI_PPI, + MODEL_META_DATA_USER_EXTENSION]: + EdkLogger.error('Parser', FORMAT_INVALID, + "Section [%s] is not allowed in inf file without version" % (self._SectionName), + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + elif self._SectionType in [MODEL_EFI_INCLUDE, + MODEL_EFI_LIBRARY_INSTANCE, + MODEL_META_DATA_NMAKE]: + EdkLogger.error('Parser', FORMAT_INVALID, + "Section [%s] is not allowed in inf file with version 0x%08x" % (self._SectionName, self._Version), + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + continue + # merge two lines specified by '\' in section NMAKE + elif self._SectionType == MODEL_META_DATA_NMAKE: + if Line[-1] == '\\': + if NextLine == '': + self._CurrentLine = NmakeLine + Line[0:-1] + NmakeLine = '' + else: + if NextLine[0] == TAB_SECTION_START and NextLine[-1] == TAB_SECTION_END: + self._CurrentLine = NmakeLine + Line[0:-1] + NmakeLine = '' + else: + NmakeLine = NmakeLine + ' ' + Line[0:-1] + continue + else: + self._CurrentLine = NmakeLine + Line + NmakeLine = '' + + # section content + self._ValueList = ['', '', ''] + # parse current line, result will be put in self._ValueList + self._SectionParser[self._SectionType](self) + if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE: + self._ItemType = -1 + Comments = [] + continue + if Comment: + Comments.append((Comment, Index + 1)) + # + # Model, Value1, Value2, Value3, Arch, Platform, BelongsToItem=-1, + # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 + # + for Arch, Platform in self._Scope: + LastItem = self._Store(self._SectionType, + self._ValueList[0], + self._ValueList[1], + self._ValueList[2], + Arch, + Platform, + self._Owner[-1], + self._LineIndex + 1, + - 1, + self._LineIndex + 1, + - 1, + 0 + ) + for Comment, LineNo in Comments: + self._Store(MODEL_META_DATA_COMMENT, Comment, '', '', Arch, Platform, + LastItem, LineNo, -1, LineNo, -1, 0) + Comments = [] + SectionComments = [] + TailComments.extend(SectionComments + Comments) + if IsFindBlockComment: + EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */", + File=self.MetaFile) + + # If there are tail comments in INF file, save to database whatever the comments are + for Comment in TailComments: + self._Store(MODEL_META_DATA_TAIL_COMMENT, Comment[0], '', '', 'COMMON', + 'COMMON', self._Owner[-1], -1, -1, -1, -1, 0) + self._Done() + + ## Data parser for the format in which there's path + # + # Only path can have macro used. So we need to replace them before use. + # + def _IncludeParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + self._ValueList[0:len(TokenList)] = TokenList + Macros = self._Macros + if Macros: + for Index in range(0, len(self._ValueList)): + Value = self._ValueList[Index] + if not Value: + continue + + if Value.upper().find('$(EFI_SOURCE)\Edk'.upper()) > -1 or Value.upper().find('$(EFI_SOURCE)/Edk'.upper()) > -1: + Value = '$(EDK_SOURCE)' + Value[17:] + if Value.find('$(EFI_SOURCE)') > -1 or Value.find('$(EDK_SOURCE)') > -1: + pass + elif Value.startswith('.'): + pass + elif Value.startswith('$('): + pass + else: + Value = '$(EFI_SOURCE)/' + Value + + self._ValueList[Index] = ReplaceMacro(Value, Macros) + + ## Parse [Sources] section + # + # Only path can have macro used. So we need to replace them before use. + # + @ParseMacro + def _SourceFileParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + self._ValueList[0:len(TokenList)] = TokenList + Macros = self._Macros + # For Acpi tables, remove macro like ' TABLE_NAME=Sata1' + if 'COMPONENT_TYPE' in Macros: + if self._Defines['COMPONENT_TYPE'].upper() == 'ACPITABLE': + self._ValueList[0] = GetSplitValueList(self._ValueList[0], ' ', 1)[0] + if self._Defines['BASE_NAME'] == 'Microcode': + pass + self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList] + + ## Parse [Binaries] section + # + # Only path can have macro used. So we need to replace them before use. + # + @ParseMacro + def _BinaryFileParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 2) + if len(TokenList) < 2: + EdkLogger.error('Parser', FORMAT_INVALID, "No file type or path specified", + ExtraData=self._CurrentLine + " ( | [| ])", + File=self.MetaFile, Line=self._LineIndex + 1) + if not TokenList[0]: + EdkLogger.error('Parser', FORMAT_INVALID, "No file type specified", + ExtraData=self._CurrentLine + " ( | [| ])", + File=self.MetaFile, Line=self._LineIndex + 1) + if not TokenList[1]: + EdkLogger.error('Parser', FORMAT_INVALID, "No file path specified", + ExtraData=self._CurrentLine + " ( | [| ])", + File=self.MetaFile, Line=self._LineIndex + 1) + self._ValueList[0:len(TokenList)] = TokenList + self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros) + + ## [nmake] section parser (Edk.x style only) + def _NmakeParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + self._ValueList[0:len(TokenList)] = TokenList + # remove macros + self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros) + # remove self-reference in macro setting + #self._ValueList[1] = ReplaceMacro(self._ValueList[1], {self._ValueList[0]:''}) + + ## [FixedPcd], [FeaturePcd], [PatchPcd], [Pcd] and [PcdEx] sections parser + @ParseMacro + def _PcdParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) + ValueList = GetSplitValueList(TokenList[0], TAB_SPLIT) + if len(ValueList) != 2: + EdkLogger.error('Parser', FORMAT_INVALID, "Illegal token space GUID and PCD name format", + ExtraData=self._CurrentLine + " (.)", + File=self.MetaFile, Line=self._LineIndex + 1) + self._ValueList[0:1] = ValueList + if len(TokenList) > 1: + self._ValueList[2] = TokenList[1] + if self._ValueList[0] == '' or self._ValueList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", + ExtraData=self._CurrentLine + " (.)", + File=self.MetaFile, Line=self._LineIndex + 1) + + # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0. + if self._ValueList[2] != '': + InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1) + if InfPcdValueList[0] in ['True', 'true', 'TRUE']: + self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1); + elif InfPcdValueList[0] in ['False', 'false', 'FALSE']: + self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1); + if (self._ValueList[0], self._ValueList[1]) not in self.PcdsDict: + self.PcdsDict[self._ValueList[0], self._ValueList[1]] = self._SectionType + elif self.PcdsDict[self._ValueList[0], self._ValueList[1]] != self._SectionType: + EdkLogger.error('Parser', FORMAT_INVALID, "It is not permissible to list a specified PCD in different PCD type sections.", + ExtraData=self._CurrentLine + " (.)", + File=self.MetaFile, Line=self._LineIndex + 1) + + ## [depex] section parser + @ParseMacro + def _DepexParser(self): + self._ValueList[0:1] = [self._CurrentLine] + + _SectionParser = { + MODEL_UNKNOWN : MetaFileParser._Skip, + MODEL_META_DATA_HEADER : MetaFileParser._DefineParser, + MODEL_META_DATA_BUILD_OPTION : MetaFileParser._BuildOptionParser, + MODEL_EFI_INCLUDE : _IncludeParser, # for Edk.x modules + MODEL_EFI_LIBRARY_INSTANCE : MetaFileParser._CommonParser, # for Edk.x modules + MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser, + MODEL_META_DATA_PACKAGE : MetaFileParser._PathParser, + MODEL_META_DATA_NMAKE : _NmakeParser, # for Edk.x modules + MODEL_PCD_FIXED_AT_BUILD : _PcdParser, + MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, + MODEL_PCD_FEATURE_FLAG : _PcdParser, + MODEL_PCD_DYNAMIC_EX : _PcdParser, + MODEL_PCD_DYNAMIC : _PcdParser, + MODEL_EFI_SOURCE_FILE : _SourceFileParser, + MODEL_EFI_GUID : MetaFileParser._CommonParser, + MODEL_EFI_PROTOCOL : MetaFileParser._CommonParser, + MODEL_EFI_PPI : MetaFileParser._CommonParser, + MODEL_EFI_DEPEX : _DepexParser, + MODEL_EFI_BINARY_FILE : _BinaryFileParser, + MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, + } + +## DSC file parser class +# +# @param FilePath The path of platform description file +# @param FileType The raw data of DSC file +# @param Table Database used to retrieve module/package information +# @param Macros Macros used for replacement in file +# @param Owner Owner ID (for sub-section parsing) +# @param From ID from which the data comes (for !INCLUDE directive) +# +class DscParser(MetaFileParser): + # DSC file supported data types (one type per section) + DataType = { + TAB_SKUIDS.upper() : MODEL_EFI_SKU_ID, + TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE, + TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, + TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION, + TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD, + TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, + TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG, + TAB_PCDS_DYNAMIC_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_DEFAULT, + TAB_PCDS_DYNAMIC_HII_NULL.upper() : MODEL_PCD_DYNAMIC_HII, + TAB_PCDS_DYNAMIC_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_VPD, + TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL.upper() : MODEL_PCD_DYNAMIC_EX_DEFAULT, + TAB_PCDS_DYNAMIC_EX_HII_NULL.upper() : MODEL_PCD_DYNAMIC_EX_HII, + TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper() : MODEL_PCD_DYNAMIC_EX_VPD, + TAB_COMPONENTS.upper() : MODEL_META_DATA_COMPONENT, + TAB_COMPONENTS_SOURCE_OVERRIDE_PATH.upper() : MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH, + TAB_DSC_DEFINES.upper() : MODEL_META_DATA_HEADER, + TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, + TAB_DSC_DEFINES_EDKGLOBAL : MODEL_META_DATA_GLOBAL_DEFINE, + TAB_INCLUDE.upper() : MODEL_META_DATA_INCLUDE, + TAB_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, + TAB_IF_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, + TAB_IF_N_DEF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF, + TAB_ELSE_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF, + TAB_ELSE.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE, + TAB_END_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF, + } + + # Valid names in define section + DefineKeywords = [ + "DSC_SPECIFICATION", + "PLATFORM_NAME", + "PLATFORM_GUID", + "PLATFORM_VERSION", + "SKUID_IDENTIFIER", + "PCD_INFO_GENERATION", + "SUPPORTED_ARCHITECTURES", + "BUILD_TARGETS", + "OUTPUT_DIRECTORY", + "FLASH_DEFINITION", + "BUILD_NUMBER", + "RFC_LANGUAGES", + "ISO_LANGUAGES", + "TIME_STAMP_FILE", + "VPD_TOOL_GUID", + "FIX_LOAD_TOP_MEMORY_ADDRESS" + ] + + SymbolPattern = ValueExpression.SymbolPattern + + ## Constructor of DscParser + # + # Initialize object of DscParser + # + # @param FilePath The path of platform description file + # @param FileType The raw data of DSC file + # @param Table Database used to retrieve module/package information + # @param Macros Macros used for replacement in file + # @param Owner Owner ID (for sub-section parsing) + # @param From ID from which the data comes (for !INCLUDE directive) + # + def __init__(self, FilePath, FileType, Table, Owner= -1, From= -1): + # prevent re-initialization + if hasattr(self, "_Table"): + return + MetaFileParser.__init__(self, FilePath, FileType, Table, Owner, From) + self._Version = 0x00010005 # Only EDK2 dsc file is supported + # to store conditional directive evaluation result + self._DirectiveStack = [] + self._DirectiveEvalStack = [] + self._Enabled = 1 + + # + # Specify whether current line is in uncertain condition + # + self._InDirective = -1 + + # Final valid replacable symbols + self._Symbols = {} + # + # Map the ID between the original table and new table to track + # the owner item + # + self._IdMapping = {-1:-1} + + ## Parser starter + def Start(self): + Content = '' + try: + Content = open(str(self.MetaFile), 'r').readlines() + except: + EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) + + OwnerId = {} + for Index in range(0, len(Content)): + Line = CleanString(Content[Index]) + # skip empty line + if Line == '': + continue + + self._CurrentLine = Line + self._LineIndex = Index + if self._InSubsection and self._Owner[-1] == -1: + self._Owner.append(self._LastItem) + + # section header + if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: + self._SectionType = MODEL_META_DATA_SECTION_HEADER + # subsection ending + elif Line[0] == '}' and self._InSubsection: + self._InSubsection = False + self._SubsectionType = MODEL_UNKNOWN + self._SubsectionName = '' + self._Owner[-1] = -1 + OwnerId = {} + continue + # subsection header + elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END: + self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER + # directive line + elif Line[0] == '!': + self._DirectiveParser() + continue + + if self._InSubsection: + SectionType = self._SubsectionType + else: + SectionType = self._SectionType + self._ItemType = SectionType + + self._ValueList = ['', '', ''] + self._SectionParser[SectionType](self) + if self._ValueList == None: + continue + # + # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1, + # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 + # + for Arch, ModuleType in self._Scope: + Owner = self._Owner[-1] + if self._SubsectionType != MODEL_UNKNOWN: + Owner = OwnerId[Arch] + self._LastItem = self._Store( + self._ItemType, + self._ValueList[0], + self._ValueList[1], + self._ValueList[2], + Arch, + ModuleType, + Owner, + self._From, + self._LineIndex + 1, + - 1, + self._LineIndex + 1, + - 1, + self._Enabled + ) + if self._SubsectionType == MODEL_UNKNOWN and self._InSubsection: + OwnerId[Arch] = self._LastItem + + if self._DirectiveStack: + Type, Line, Text = self._DirectiveStack[-1] + EdkLogger.error('Parser', FORMAT_INVALID, "No matching '!endif' found", + ExtraData=Text, File=self.MetaFile, Line=Line) + self._Done() + + ## parser + def _SubsectionHeaderParser(self): + self._SubsectionName = self._CurrentLine[1:-1].upper() + if self._SubsectionName in self.DataType: + self._SubsectionType = self.DataType[self._SubsectionName] + else: + self._SubsectionType = MODEL_UNKNOWN + EdkLogger.warn("Parser", "Unrecognized sub-section", File=self.MetaFile, + Line=self._LineIndex + 1, ExtraData=self._CurrentLine) + self._ValueList[0] = self._SubsectionName + + ## Directive statement parser + def _DirectiveParser(self): + self._ValueList = ['', '', ''] + TokenList = GetSplitValueList(self._CurrentLine, ' ', 1) + self._ValueList[0:len(TokenList)] = TokenList + + # Syntax check + DirectiveName = self._ValueList[0].upper() + if DirectiveName not in self.DataType: + EdkLogger.error("Parser", FORMAT_INVALID, "Unknown directive [%s]" % DirectiveName, + File=self.MetaFile, Line=self._LineIndex + 1) + + if DirectiveName in ['!IF', '!IFDEF', '!IFNDEF']: + self._InDirective += 1 + + if DirectiveName in ['!ENDIF']: + self._InDirective -= 1 + + if DirectiveName in ['!IF', '!IFDEF', '!INCLUDE', '!IFNDEF', '!ELSEIF'] and self._ValueList[1] == '': + EdkLogger.error("Parser", FORMAT_INVALID, "Missing expression", + File=self.MetaFile, Line=self._LineIndex + 1, + ExtraData=self._CurrentLine) + + ItemType = self.DataType[DirectiveName] + Scope = [['COMMON', 'COMMON']] + if ItemType == MODEL_META_DATA_INCLUDE: + Scope = self._Scope + if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF: + # Remove all directives between !if and !endif, including themselves + while self._DirectiveStack: + # Remove any !else or !elseif + DirectiveInfo = self._DirectiveStack.pop() + if DirectiveInfo[0] in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: + break + else: + EdkLogger.error("Parser", FORMAT_INVALID, "Redundant '!endif'", + File=self.MetaFile, Line=self._LineIndex + 1, + ExtraData=self._CurrentLine) + elif ItemType != MODEL_META_DATA_INCLUDE: + # Break if there's a !else is followed by a !elseif + if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF and \ + self._DirectiveStack and \ + self._DirectiveStack[-1][0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE: + EdkLogger.error("Parser", FORMAT_INVALID, "'!elseif' after '!else'", + File=self.MetaFile, Line=self._LineIndex + 1, + ExtraData=self._CurrentLine) + self._DirectiveStack.append((ItemType, self._LineIndex + 1, self._CurrentLine)) + elif self._From > 0: + EdkLogger.error('Parser', FORMAT_INVALID, + "No '!include' allowed in included file", + ExtraData=self._CurrentLine, File=self.MetaFile, + Line=self._LineIndex + 1) + + # + # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1, + # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 + # + for Arch, ModuleType in Scope: + self._LastItem = self._Store( + ItemType, + self._ValueList[0], + self._ValueList[1], + self._ValueList[2], + Arch, + ModuleType, + self._Owner[-1], + self._From, + self._LineIndex + 1, + - 1, + self._LineIndex + 1, + - 1, + 0 + ) + + ## [defines] section parser + @ParseMacro + def _DefineParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + self._ValueList[1:len(TokenList)] = TokenList + + # Syntax check + if not self._ValueList[1]: + EdkLogger.error('Parser', FORMAT_INVALID, "No name specified", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + if not self._ValueList[2]: + EdkLogger.error('Parser', FORMAT_INVALID, "No value specified", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + if not self._ValueList[1] in self.DefineKeywords: + EdkLogger.error('Parser', FORMAT_INVALID, + "Unknown keyword found: %s. " + "If this is a macro you must " + "add it as a DEFINE in the DSC" % self._ValueList[1], + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + self._Defines[self._ValueList[1]] = self._ValueList[2] + self._ItemType = self.DataType[TAB_DSC_DEFINES.upper()] + + @ParseMacro + def _SkuIdParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + if len(TokenList) != 2: + EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '|'", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + self._ValueList[0:len(TokenList)] = TokenList + + ## Parse Edk style of library modules + @ParseMacro + def _LibraryInstanceParser(self): + self._ValueList[0] = self._CurrentLine + + ## PCD sections parser + # + # [PcdsFixedAtBuild] + # [PcdsPatchableInModule] + # [PcdsFeatureFlag] + # [PcdsDynamicEx + # [PcdsDynamicExDefault] + # [PcdsDynamicExVpd] + # [PcdsDynamicExHii] + # [PcdsDynamic] + # [PcdsDynamicDefault] + # [PcdsDynamicVpd] + # [PcdsDynamicHii] + # + @ParseMacro + def _PcdParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) + self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT) + if len(TokenList) == 2: + self._ValueList[2] = TokenList[1] + if self._ValueList[0] == '' or self._ValueList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", + ExtraData=self._CurrentLine + " (.|)", + File=self.MetaFile, Line=self._LineIndex + 1) + if self._ValueList[2] == '': + # + # The PCD values are optional for FIXEDATBUILD and PATCHABLEINMODULE + # + if self._SectionType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE): + return + EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given", + ExtraData=self._CurrentLine + " (.|)", + File=self.MetaFile, Line=self._LineIndex + 1) + + # Validate the datum type of Dynamic Defaul PCD and DynamicEx Default PCD + ValueList = GetSplitValueList(self._ValueList[2]) + if len(ValueList) > 1 and ValueList[1] != TAB_VOID \ + and self._ItemType in [MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT]: + EdkLogger.error('Parser', FORMAT_INVALID, "The datum type '%s' of PCD is wrong" % ValueList[1], + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + + # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0. + DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1) + if DscPcdValueList[0] in ['True', 'true', 'TRUE']: + self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '1', 1); + elif DscPcdValueList[0] in ['False', 'false', 'FALSE']: + self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '0', 1); + + + ## [components] section parser + @ParseMacro + def _ComponentParser(self): + if self._CurrentLine[-1] == '{': + self._ValueList[0] = self._CurrentLine[0:-1].strip() + self._InSubsection = True + else: + self._ValueList[0] = self._CurrentLine + + ## [LibraryClasses] section + @ParseMacro + def _LibraryClassParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + if len(TokenList) < 2: + EdkLogger.error('Parser', FORMAT_INVALID, "No library class or instance specified", + ExtraData=self._CurrentLine + " (|)", + File=self.MetaFile, Line=self._LineIndex + 1) + if TokenList[0] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No library class specified", + ExtraData=self._CurrentLine + " (|)", + File=self.MetaFile, Line=self._LineIndex + 1) + if TokenList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No library instance specified", + ExtraData=self._CurrentLine + " (|)", + File=self.MetaFile, Line=self._LineIndex + 1) + + self._ValueList[0:len(TokenList)] = TokenList + + def _CompponentSourceOverridePathParser(self): + self._ValueList[0] = self._CurrentLine + + ## [BuildOptions] section parser + @ParseMacro + def _BuildOptionParser(self): + self._CurrentLine = CleanString(self._CurrentLine, BuildOption=True) + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + TokenList2 = GetSplitValueList(TokenList[0], ':', 1) + if len(TokenList2) == 2: + self._ValueList[0] = TokenList2[0] # toolchain family + self._ValueList[1] = TokenList2[1] # keys + else: + self._ValueList[1] = TokenList[0] + if len(TokenList) == 2: # value + self._ValueList[2] = TokenList[1] + + if self._ValueList[1].count('_') != 4: + EdkLogger.error( + 'Parser', + FORMAT_INVALID, + "'%s' must be in format of ____FLAGS" % self._ValueList[1], + ExtraData=self._CurrentLine, + File=self.MetaFile, + Line=self._LineIndex + 1 + ) + + ## Override parent's method since we'll do all macro replacements in parser + def _GetMacros(self): + Macros = {} + Macros.update(self._FileLocalMacros) + Macros.update(self._GetApplicableSectionMacro()) + Macros.update(GlobalData.gEdkGlobal) + Macros.update(GlobalData.gPlatformDefines) + Macros.update(GlobalData.gCommandLineDefines) + # PCD cannot be referenced in macro definition + if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_GLOBAL_DEFINE]: + Macros.update(self._Symbols) + return Macros + + def _PostProcess(self): + Processer = { + MODEL_META_DATA_SECTION_HEADER : self.__ProcessSectionHeader, + MODEL_META_DATA_SUBSECTION_HEADER : self.__ProcessSubsectionHeader, + MODEL_META_DATA_HEADER : self.__ProcessDefine, + MODEL_META_DATA_DEFINE : self.__ProcessDefine, + MODEL_META_DATA_GLOBAL_DEFINE : self.__ProcessDefine, + MODEL_META_DATA_INCLUDE : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IF : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF : self.__ProcessDirective, + MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF : self.__ProcessDirective, + MODEL_EFI_SKU_ID : self.__ProcessSkuId, + MODEL_EFI_LIBRARY_INSTANCE : self.__ProcessLibraryInstance, + MODEL_EFI_LIBRARY_CLASS : self.__ProcessLibraryClass, + MODEL_PCD_FIXED_AT_BUILD : self.__ProcessPcd, + MODEL_PCD_PATCHABLE_IN_MODULE : self.__ProcessPcd, + MODEL_PCD_FEATURE_FLAG : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_DEFAULT : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_HII : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_VPD : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_EX_DEFAULT : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_EX_HII : self.__ProcessPcd, + MODEL_PCD_DYNAMIC_EX_VPD : self.__ProcessPcd, + MODEL_META_DATA_COMPONENT : self.__ProcessComponent, + MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH : self.__ProcessSourceOverridePath, + MODEL_META_DATA_BUILD_OPTION : self.__ProcessBuildOption, + MODEL_UNKNOWN : self._Skip, + MODEL_META_DATA_USER_EXTENSION : self._Skip, + } + + self._Table = MetaFileStorage(self._RawTable.Cur, self.MetaFile, MODEL_FILE_DSC, True) + self._Table.Create() + self._DirectiveStack = [] + self._DirectiveEvalStack = [] + self._FileWithError = self.MetaFile + self._FileLocalMacros = {} + self._SectionsMacroDict = {} + GlobalData.gPlatformDefines = {} + + # Get all macro and PCD which has straitforward value + self.__RetrievePcdValue() + self._Content = self._RawTable.GetAll() + self._ContentIndex = 0 + while self._ContentIndex < len(self._Content) : + Id, self._ItemType, V1, V2, V3, S1, S2, Owner, self._From, \ + LineStart, ColStart, LineEnd, ColEnd, Enabled = self._Content[self._ContentIndex] + + if self._From < 0: + self._FileWithError = self.MetaFile + + self._ContentIndex += 1 + + self._Scope = [[S1, S2]] + # + # For !include directive, handle it specially, + # merge arch and module type in case of duplicate items + # + while self._ItemType == MODEL_META_DATA_INCLUDE: + if self._ContentIndex >= len(self._Content): + break + Record = self._Content[self._ContentIndex] + if LineStart == Record[9] and LineEnd == Record[11]: + if [Record[5], Record[6]] not in self._Scope: + self._Scope.append([Record[5], Record[6]]) + self._ContentIndex += 1 + else: + break + + self._LineIndex = LineStart - 1 + self._ValueList = [V1, V2, V3] + + try: + Processer[self._ItemType]() + except EvaluationException, Excpt: + # + # Only catch expression evaluation error here. We need to report + # the precise number of line on which the error occurred + # + if hasattr(Excpt, 'Pcd'): + if Excpt.Pcd in GlobalData.gPlatformOtherPcds: + Info = GlobalData.gPlatformOtherPcds[Excpt.Pcd] + EdkLogger.error('Parser', FORMAT_INVALID, "Cannot use this PCD (%s) in an expression as" + " it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section" + " of the DSC file, and it is currently defined in this section:" + " %s, line #: %d." % (Excpt.Pcd, Info[0], Info[1]), + File=self._FileWithError, ExtraData=' '.join(self._ValueList), + Line=self._LineIndex + 1) + else: + EdkLogger.error('Parser', FORMAT_INVALID, "PCD (%s) is not defined in DSC file" % Excpt.Pcd, + File=self._FileWithError, ExtraData=' '.join(self._ValueList), + Line=self._LineIndex + 1) + else: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt), + File=self._FileWithError, ExtraData=' '.join(self._ValueList), + Line=self._LineIndex + 1) + except MacroException, Excpt: + EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt), + File=self._FileWithError, ExtraData=' '.join(self._ValueList), + Line=self._LineIndex + 1) + + if self._ValueList == None: + continue + + NewOwner = self._IdMapping.get(Owner, -1) + self._Enabled = int((not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack)) + self._LastItem = self._Store( + self._ItemType, + self._ValueList[0], + self._ValueList[1], + self._ValueList[2], + S1, + S2, + NewOwner, + self._From, + self._LineIndex + 1, + - 1, + self._LineIndex + 1, + - 1, + self._Enabled + ) + self._IdMapping[Id] = self._LastItem + + GlobalData.gPlatformDefines.update(self._FileLocalMacros) + self._PostProcessed = True + self._Content = None + + def __ProcessSectionHeader(self): + self._SectionName = self._ValueList[0] + if self._SectionName in self.DataType: + self._SectionType = self.DataType[self._SectionName] + else: + self._SectionType = MODEL_UNKNOWN + + def __ProcessSubsectionHeader(self): + self._SubsectionName = self._ValueList[0] + if self._SubsectionName in self.DataType: + self._SubsectionType = self.DataType[self._SubsectionName] + else: + self._SubsectionType = MODEL_UNKNOWN + + def __RetrievePcdValue(self): + Records = self._RawTable.Query(MODEL_PCD_FEATURE_FLAG, BelongsToItem= -1.0) + for TokenSpaceGuid, PcdName, Value, Dummy2, Dummy3, ID, Line in Records: + Name = TokenSpaceGuid + '.' + PcdName + ValList, Valid, Index = AnalyzeDscPcd(Value, MODEL_PCD_FEATURE_FLAG) + self._Symbols[Name] = ValList[Index] + + Records = self._RawTable.Query(MODEL_PCD_FIXED_AT_BUILD, BelongsToItem= -1.0) + for TokenSpaceGuid, PcdName, Value, Dummy2, Dummy3, ID, Line in Records: + Name = TokenSpaceGuid + '.' + PcdName + ValList, Valid, Index = AnalyzeDscPcd(Value, MODEL_PCD_FIXED_AT_BUILD) + self._Symbols[Name] = ValList[Index] + + Content = open(str(self.MetaFile), 'r').readlines() + GlobalData.gPlatformOtherPcds['DSCFILE'] = str(self.MetaFile) + for PcdType in (MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_HII, + MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_DYNAMIC_EX_HII, + MODEL_PCD_DYNAMIC_EX_VPD): + Records = self._RawTable.Query(PcdType, BelongsToItem= -1.0) + for TokenSpaceGuid, PcdName, Value, Dummy2, Dummy3, ID, Line in Records: + Name = TokenSpaceGuid + '.' + PcdName + if Name not in GlobalData.gPlatformOtherPcds: + PcdLine = Line + while not Content[Line - 1].lstrip().startswith(TAB_SECTION_START): + Line -= 1 + GlobalData.gPlatformOtherPcds[Name] = (CleanString(Content[Line - 1]), PcdLine, PcdType) + + def __ProcessDefine(self): + if not self._Enabled: + return + + Type, Name, Value = self._ValueList + Value = ReplaceMacro(Value, self._Macros, False) + if self._ItemType == MODEL_META_DATA_DEFINE: + if self._SectionType == MODEL_META_DATA_HEADER: + self._FileLocalMacros[Name] = Value + else: + self._ConstructSectionMacroDict(Name, Value) + elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE: + GlobalData.gEdkGlobal[Name] = Value + + # + # Keyword in [Defines] section can be used as Macros + # + if (self._ItemType == MODEL_META_DATA_HEADER) and (self._SectionType == MODEL_META_DATA_HEADER): + self._FileLocalMacros[Name] = Value + + self._ValueList = [Type, Name, Value] + + def __ProcessDirective(self): + Result = None + if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF]: + Macros = self._Macros + Macros.update(GlobalData.gGlobalDefines) + try: + Result = ValueExpression(self._ValueList[1], Macros)() + except SymbolNotFound, Exc: + EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1]) + Result = False + except WrnExpression, Excpt: + # + # Catch expression evaluation warning here. We need to report + # the precise number of line and return the evaluation result + # + EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt), + File=self._FileWithError, ExtraData=' '.join(self._ValueList), + Line=self._LineIndex + 1) + Result = Excpt.result + + if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: + self._DirectiveStack.append(self._ItemType) + if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF: + Result = bool(Result) + else: + Macro = self._ValueList[1] + Macro = Macro[2:-1] if (Macro.startswith("$(") and Macro.endswith(")")) else Macro + Result = Macro in self._Macros + if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF: + Result = not Result + self._DirectiveEvalStack.append(Result) + elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF: + self._DirectiveStack.append(self._ItemType) + self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1] + self._DirectiveEvalStack.append(bool(Result)) + elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE: + self._DirectiveStack.append(self._ItemType) + self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1] + self._DirectiveEvalStack.append(True) + elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF: + # Back to the nearest !if/!ifdef/!ifndef + while self._DirectiveStack: + self._DirectiveEvalStack.pop() + Directive = self._DirectiveStack.pop() + if Directive in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF, + MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]: + break + elif self._ItemType == MODEL_META_DATA_INCLUDE: + # The included file must be relative to workspace or same directory as DSC file + __IncludeMacros = {} + # + # Allow using system environment variables in path after !include + # + __IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE'] + if "ECP_SOURCE" in GlobalData.gGlobalDefines.keys(): + __IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE'] + # + # During GenFds phase call DSC parser, will go into this branch. + # + elif "ECP_SOURCE" in GlobalData.gCommandLineDefines.keys(): + __IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE'] + + __IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE'] + __IncludeMacros['EDK_SOURCE'] = GlobalData.gGlobalDefines['EDK_SOURCE'] + # + # Allow using MACROs comes from [Defines] section to keep compatible. + # + __IncludeMacros.update(self._Macros) + + IncludedFile = NormPath(ReplaceMacro(self._ValueList[1], __IncludeMacros, RaiseError=True)) + # + # First search the include file under the same directory as DSC file + # + IncludedFile1 = PathClass(IncludedFile, self.MetaFile.Dir) + ErrorCode, ErrorInfo1 = IncludedFile1.Validate() + if ErrorCode != 0: + # + # Also search file under the WORKSPACE directory + # + IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace) + ErrorCode, ErrorInfo2 = IncludedFile1.Validate() + if ErrorCode != 0: + EdkLogger.error('parser', ErrorCode, File=self._FileWithError, + Line=self._LineIndex + 1, ExtraData=ErrorInfo1 + "\n" + ErrorInfo2) + + self._FileWithError = IncludedFile1 + + IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile1, MODEL_FILE_DSC, False) + Owner = self._Content[self._ContentIndex - 1][0] + Parser = DscParser(IncludedFile1, self._FileType, IncludedFileTable, + Owner=Owner, From=Owner) + + # set the parser status with current status + Parser._SectionName = self._SectionName + Parser._SectionType = self._SectionType + Parser._Scope = self._Scope + Parser._Enabled = self._Enabled + # Parse the included file + Parser.Start() + + # update current status with sub-parser's status + self._SectionName = Parser._SectionName + self._SectionType = Parser._SectionType + self._Scope = Parser._Scope + self._Enabled = Parser._Enabled + + # Insert all records in the table for the included file into dsc file table + Records = IncludedFileTable.GetAll() + if Records: + self._Content[self._ContentIndex:self._ContentIndex] = Records + self._Content.pop(self._ContentIndex - 1) + self._ValueList = None + self._ContentIndex -= 1 + + def __ProcessSkuId(self): + self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=True) + for Value in self._ValueList] + + def __ProcessLibraryInstance(self): + self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList] + + def __ProcessLibraryClass(self): + self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True) + + def __ProcessPcd(self): + if self._ItemType not in [MODEL_PCD_FEATURE_FLAG, MODEL_PCD_FIXED_AT_BUILD]: + self._ValueList[2] = ReplaceMacro(self._ValueList[2], self._Macros, RaiseError=True) + return + + ValList, Valid, Index = AnalyzeDscPcd(self._ValueList[2], self._ItemType) + if not Valid: + EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.", File=self._FileWithError, Line=self._LineIndex+1, + ExtraData="%s.%s|%s" % (self._ValueList[0], self._ValueList[1], self._ValueList[2])) + PcdValue = ValList[Index] + if PcdValue: + try: + ValList[Index] = ValueExpression(PcdValue, self._Macros)(True) + except WrnExpression, Value: + ValList[Index] = Value.result + + if ValList[Index] == 'True': + ValList[Index] = '1' + if ValList[Index] == 'False': + ValList[Index] = '0' + + GlobalData.gPlatformPcds[TAB_SPLIT.join(self._ValueList[0:2])] = PcdValue + self._ValueList[2] = '|'.join(ValList) + + def __ProcessComponent(self): + self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros) + + def __ProcessSourceOverridePath(self): + self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros) + + def __ProcessBuildOption(self): + self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=False) + for Value in self._ValueList] + + _SectionParser = { + MODEL_META_DATA_HEADER : _DefineParser, + MODEL_EFI_SKU_ID : _SkuIdParser, + MODEL_EFI_LIBRARY_INSTANCE : _LibraryInstanceParser, + MODEL_EFI_LIBRARY_CLASS : _LibraryClassParser, + MODEL_PCD_FIXED_AT_BUILD : _PcdParser, + MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, + MODEL_PCD_FEATURE_FLAG : _PcdParser, + MODEL_PCD_DYNAMIC_DEFAULT : _PcdParser, + MODEL_PCD_DYNAMIC_HII : _PcdParser, + MODEL_PCD_DYNAMIC_VPD : _PcdParser, + MODEL_PCD_DYNAMIC_EX_DEFAULT : _PcdParser, + MODEL_PCD_DYNAMIC_EX_HII : _PcdParser, + MODEL_PCD_DYNAMIC_EX_VPD : _PcdParser, + MODEL_META_DATA_COMPONENT : _ComponentParser, + MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH : _CompponentSourceOverridePathParser, + MODEL_META_DATA_BUILD_OPTION : _BuildOptionParser, + MODEL_UNKNOWN : MetaFileParser._Skip, + MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, + MODEL_META_DATA_SECTION_HEADER : MetaFileParser._SectionHeaderParser, + MODEL_META_DATA_SUBSECTION_HEADER : _SubsectionHeaderParser, + } + + _Macros = property(_GetMacros) + +## DEC file parser class +# +# @param FilePath The path of platform description file +# @param FileType The raw data of DSC file +# @param Table Database used to retrieve module/package information +# @param Macros Macros used for replacement in file +# +class DecParser(MetaFileParser): + # DEC file supported data types (one type per section) + DataType = { + TAB_DEC_DEFINES.upper() : MODEL_META_DATA_HEADER, + TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE, + TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE, + TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS, + TAB_GUIDS.upper() : MODEL_EFI_GUID, + TAB_PPIS.upper() : MODEL_EFI_PPI, + TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL, + TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD, + TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE, + TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG, + TAB_PCDS_DYNAMIC_NULL.upper() : MODEL_PCD_DYNAMIC, + TAB_PCDS_DYNAMIC_EX_NULL.upper() : MODEL_PCD_DYNAMIC_EX, + } + + ## Constructor of DecParser + # + # Initialize object of DecParser + # + # @param FilePath The path of platform description file + # @param FileType The raw data of DSC file + # @param Table Database used to retrieve module/package information + # @param Macros Macros used for replacement in file + # + def __init__(self, FilePath, FileType, Table): + # prevent re-initialization + if hasattr(self, "_Table"): + return + MetaFileParser.__init__(self, FilePath, FileType, Table, -1) + self._Comments = [] + self._Version = 0x00010005 # Only EDK2 dec file is supported + self._AllPCDs = [] # Only for check duplicate PCD + + ## Parser starter + def Start(self): + Content = '' + try: + Content = open(str(self.MetaFile), 'r').readlines() + except: + EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile) + + for Index in range(0, len(Content)): + Line, Comment = CleanString2(Content[Index]) + self._CurrentLine = Line + self._LineIndex = Index + + # save comment for later use + if Comment: + self._Comments.append((Comment, self._LineIndex + 1)) + # skip empty line + if Line == '': + continue + + # section header + if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END: + self._SectionHeaderParser() + self._Comments = [] + continue + elif len(self._SectionType) == 0: + self._Comments = [] + continue + + # section content + self._ValueList = ['', '', ''] + self._SectionParser[self._SectionType[0]](self) + if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE: + self._ItemType = -1 + self._Comments = [] + continue + + # + # Model, Value1, Value2, Value3, Arch, BelongsToItem=-1, LineBegin=-1, + # ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, FeatureFlag='', Enabled=-1 + # + for Arch, ModuleType, Type in self._Scope: + self._LastItem = self._Store( + Type, + self._ValueList[0], + self._ValueList[1], + self._ValueList[2], + Arch, + ModuleType, + self._Owner[-1], + self._LineIndex + 1, + - 1, + self._LineIndex + 1, + - 1, + 0 + ) + for Comment, LineNo in self._Comments: + self._Store( + MODEL_META_DATA_COMMENT, + Comment, + self._ValueList[0], + self._ValueList[1], + Arch, + ModuleType, + self._LastItem, + LineNo, + - 1, + LineNo, + - 1, + 0 + ) + self._Comments = [] + self._Done() + + + ## Section header parser + # + # The section header is always in following format: + # + # [section_name.arch<.platform|module_type>] + # + def _SectionHeaderParser(self): + self._Scope = [] + self._SectionName = '' + self._SectionType = [] + ArchList = set() + Line = self._CurrentLine.replace("%s%s" % (TAB_COMMA_SPLIT, TAB_SPACE_SPLIT), TAB_COMMA_SPLIT) + for Item in Line[1:-1].split(TAB_COMMA_SPLIT): + if Item == '': + EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, + "section name can NOT be empty or incorrectly use separator comma", + self.MetaFile, self._LineIndex + 1, self._CurrentLine) + ItemList = Item.split(TAB_SPLIT) + + # different types of PCD are permissible in one section + self._SectionName = ItemList[0].upper() + if self._SectionName in self.DataType: + if self.DataType[self._SectionName] not in self._SectionType: + self._SectionType.append(self.DataType[self._SectionName]) + else: + EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item, + self.MetaFile, self._LineIndex + 1, self._CurrentLine) + + if MODEL_PCD_FEATURE_FLAG in self._SectionType and len(self._SectionType) > 1: + EdkLogger.error( + 'Parser', + FORMAT_INVALID, + "%s must not be in the same section of other types of PCD" % TAB_PCDS_FEATURE_FLAG_NULL, + File=self.MetaFile, + Line=self._LineIndex + 1, + ExtraData=self._CurrentLine + ) + # S1 is always Arch + if len(ItemList) > 1: + S1 = ItemList[1].upper() + else: + S1 = 'COMMON' + ArchList.add(S1) + # S2 may be Platform or ModuleType + if len(ItemList) > 2: + S2 = ItemList[2].upper() + else: + S2 = 'COMMON' + if [S1, S2, self.DataType[self._SectionName]] not in self._Scope: + self._Scope.append([S1, S2, self.DataType[self._SectionName]]) + + # 'COMMON' must not be used with specific ARCHs at the same section + if 'COMMON' in ArchList and len(ArchList) > 1: + EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs", + File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine) + + ## [guids], [ppis] and [protocols] section parser + @ParseMacro + def _GuidParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1) + if len(TokenList) < 2: + EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name or value specified", + ExtraData=self._CurrentLine + " ( = )", + File=self.MetaFile, Line=self._LineIndex + 1) + if TokenList[0] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name specified", + ExtraData=self._CurrentLine + " ( = )", + File=self.MetaFile, Line=self._LineIndex + 1) + if TokenList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No GUID value specified", + ExtraData=self._CurrentLine + " ( = )", + File=self.MetaFile, Line=self._LineIndex + 1) + if TokenList[1][0] != '{' or TokenList[1][-1] != '}' or GuidStructureStringToGuidString(TokenList[1]) == '': + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid GUID value format", + ExtraData=self._CurrentLine + \ + " ( = )", + File=self.MetaFile, Line=self._LineIndex + 1) + self._ValueList[0] = TokenList[0] + self._ValueList[1] = TokenList[1] + + ## PCD sections parser + # + # [PcdsFixedAtBuild] + # [PcdsPatchableInModule] + # [PcdsFeatureFlag] + # [PcdsDynamicEx + # [PcdsDynamic] + # + @ParseMacro + def _PcdParser(self): + TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1) + self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT) + ValueRe = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*') + # check PCD information + if self._ValueList[0] == '' or self._ValueList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex + 1) + # check format of token space GUID CName + if not ValueRe.match(self._ValueList[0]): + EdkLogger.error('Parser', FORMAT_INVALID, "The format of the token space GUID CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex + 1) + # check format of PCD CName + if not ValueRe.match(self._ValueList[1]): + EdkLogger.error('Parser', FORMAT_INVALID, "The format of the PCD CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex + 1) + # check PCD datum information + if len(TokenList) < 2 or TokenList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum information given", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex + 1) + + + ValueRe = re.compile(r'^\s*L?\".*\|.*\"') + PtrValue = ValueRe.findall(TokenList[1]) + + # Has VOID* type string, may contain "|" character in the string. + if len(PtrValue) != 0: + ptrValueList = re.sub(ValueRe, '', TokenList[1]) + ValueList = GetSplitValueList(ptrValueList) + ValueList[0] = PtrValue[0] + else: + ValueList = GetSplitValueList(TokenList[1]) + + + # check if there's enough datum information given + if len(ValueList) != 3: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information given", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex + 1) + # check default value + if ValueList[0] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum information", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex + 1) + # check datum type + if ValueList[1] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum information", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex + 1) + # check token of the PCD + if ValueList[2] == '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum information", + ExtraData=self._CurrentLine + \ + " (.|||)", + File=self.MetaFile, Line=self._LineIndex + 1) + # check format of default value against the datum type + IsValid, Cause = CheckPcdDatum(ValueList[1], ValueList[0]) + if not IsValid: + EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine, + File=self.MetaFile, Line=self._LineIndex + 1) + + if ValueList[0] in ['True', 'true', 'TRUE']: + ValueList[0] = '1' + elif ValueList[0] in ['False', 'false', 'FALSE']: + ValueList[0] = '0' + + # check for duplicate PCD definition + if (self._Scope[0], self._ValueList[0], self._ValueList[1]) in self._AllPCDs: + EdkLogger.error('Parser', FORMAT_INVALID, + "The same PCD name and GUID have been already defined", + ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) + else: + self._AllPCDs.append((self._Scope[0], self._ValueList[0], self._ValueList[1])) + + self._ValueList[2] = ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip() + + _SectionParser = { + MODEL_META_DATA_HEADER : MetaFileParser._DefineParser, + MODEL_EFI_INCLUDE : MetaFileParser._PathParser, + MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser, + MODEL_EFI_GUID : _GuidParser, + MODEL_EFI_PPI : _GuidParser, + MODEL_EFI_PROTOCOL : _GuidParser, + MODEL_PCD_FIXED_AT_BUILD : _PcdParser, + MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser, + MODEL_PCD_FEATURE_FLAG : _PcdParser, + MODEL_PCD_DYNAMIC : _PcdParser, + MODEL_PCD_DYNAMIC_EX : _PcdParser, + MODEL_UNKNOWN : MetaFileParser._Skip, + MODEL_META_DATA_USER_EXTENSION : MetaFileParser._Skip, + } + +## +# +# This acts like the main() function for the script, unless it is 'import'ed into another +# script. +# +if __name__ == '__main__': + pass + diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py index 262ec65e64..3444e4f053 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -1811,7 +1811,7 @@ class InfBuildData(ModuleBuildClassObject): else: Tool = ToolList[0] ToolChain = "*_*_*_%s_FLAGS" % Tool - ToolChainFamily = '' + ToolChainFamily = 'MSFT' # Edk.x only support MSFT tool chain #ignore not replaced macros in value ValueList = GetSplitList(' ' + Value, '/D') Dummy = ValueList[0] diff --git a/BaseTools/Source/Python/sitecustomize.py b/BaseTools/Source/Python/sitecustomize.py index 22501f8bae..ec463ea5fa 100644 --- a/BaseTools/Source/Python/sitecustomize.py +++ b/BaseTools/Source/Python/sitecustomize.py @@ -1,19 +1,19 @@ -# -# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -import sys -import locale - -if sys.platform == "darwin": - DefaultLocal = locale.getdefaultlocale()[1] - if DefaultLocal is None: - DefaultLocal = 'UTF8' - sys.setdefaultencoding(DefaultLocal) - +# +# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +import sys +import locale + +if sys.platform == "darwin": + DefaultLocal = locale.getdefaultlocale()[1] + if DefaultLocal is None: + DefaultLocal = 'UTF8' + sys.setdefaultencoding(DefaultLocal) + diff --git a/BaseTools/Tests/CToolsTests.py b/BaseTools/Tests/CToolsTests.py index 67681ea77f..ab75d9a7dc 100644 --- a/BaseTools/Tests/CToolsTests.py +++ b/BaseTools/Tests/CToolsTests.py @@ -1,35 +1,35 @@ -## @file -# Unit tests for C based BaseTools -# -# Copyright (c) 2008, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import sys -import unittest - -import TianoCompress -modules = ( - TianoCompress, - ) - - -def TheTestSuite(): - suites = map(lambda module: module.TheTestSuite(), modules) - return unittest.TestSuite(suites) - -if __name__ == '__main__': - allTests = TheTestSuite() - unittest.TextTestRunner().run(allTests) - +## @file +# Unit tests for C based BaseTools +# +# Copyright (c) 2008, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import sys +import unittest + +import TianoCompress +modules = ( + TianoCompress, + ) + + +def TheTestSuite(): + suites = map(lambda module: module.TheTestSuite(), modules) + return unittest.TestSuite(suites) + +if __name__ == '__main__': + allTests = TheTestSuite() + unittest.TextTestRunner().run(allTests) + diff --git a/BaseTools/Tests/CheckPythonSyntax.py b/BaseTools/Tests/CheckPythonSyntax.py index e27c341c0c..61a048ad5d 100644 --- a/BaseTools/Tests/CheckPythonSyntax.py +++ b/BaseTools/Tests/CheckPythonSyntax.py @@ -1,74 +1,74 @@ -## @file -# Unit tests for checking syntax of Python source code -# -# Copyright (c) 2009, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import unittest -import py_compile - -import TestTools - -class Tests(TestTools.BaseToolsTest): - - def setUp(self): - TestTools.BaseToolsTest.setUp(self) - - def SingleFileTest(self, filename): - try: - py_compile.compile(filename, doraise=True) - except Exception, e: - self.fail('syntax error: %s, Error is %s' % (filename, str(e))) - -def MakePythonSyntaxCheckTests(): - def GetAllPythonSourceFiles(): - pythonSourceFiles = [] - for (root, dirs, files) in os.walk(TestTools.PythonSourceDir): - for filename in files: - if filename.lower().endswith('.py'): - pythonSourceFiles.append( - os.path.join(root, filename) - ) - return pythonSourceFiles - - def MakeTestName(filename): - assert filename.lower().endswith('.py') - name = filename[:-3] - name = name.replace(TestTools.PythonSourceDir, '') - name = name.replace(os.path.sep, '_') - return 'test' + name - - def MakeNewTest(filename): - test = MakeTestName(filename) - newmethod = lambda self: self.SingleFileTest(filename) - setattr( - Tests, - test, - newmethod - ) - - for filename in GetAllPythonSourceFiles(): - MakeNewTest(filename) - -MakePythonSyntaxCheckTests() -del MakePythonSyntaxCheckTests - -TheTestSuite = TestTools.MakeTheTestSuite(locals()) - -if __name__ == '__main__': - allTests = TheTestSuite() - unittest.TextTestRunner().run(allTests) - - +## @file +# Unit tests for checking syntax of Python source code +# +# Copyright (c) 2009, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import unittest +import py_compile + +import TestTools + +class Tests(TestTools.BaseToolsTest): + + def setUp(self): + TestTools.BaseToolsTest.setUp(self) + + def SingleFileTest(self, filename): + try: + py_compile.compile(filename, doraise=True) + except Exception, e: + self.fail('syntax error: %s, Error is %s' % (filename, str(e))) + +def MakePythonSyntaxCheckTests(): + def GetAllPythonSourceFiles(): + pythonSourceFiles = [] + for (root, dirs, files) in os.walk(TestTools.PythonSourceDir): + for filename in files: + if filename.lower().endswith('.py'): + pythonSourceFiles.append( + os.path.join(root, filename) + ) + return pythonSourceFiles + + def MakeTestName(filename): + assert filename.lower().endswith('.py') + name = filename[:-3] + name = name.replace(TestTools.PythonSourceDir, '') + name = name.replace(os.path.sep, '_') + return 'test' + name + + def MakeNewTest(filename): + test = MakeTestName(filename) + newmethod = lambda self: self.SingleFileTest(filename) + setattr( + Tests, + test, + newmethod + ) + + for filename in GetAllPythonSourceFiles(): + MakeNewTest(filename) + +MakePythonSyntaxCheckTests() +del MakePythonSyntaxCheckTests + +TheTestSuite = TestTools.MakeTheTestSuite(locals()) + +if __name__ == '__main__': + allTests = TheTestSuite() + unittest.TextTestRunner().run(allTests) + + diff --git a/BaseTools/Tests/PythonToolsTests.py b/BaseTools/Tests/PythonToolsTests.py index 7db5855e0b..6096e212a9 100644 --- a/BaseTools/Tests/PythonToolsTests.py +++ b/BaseTools/Tests/PythonToolsTests.py @@ -1,32 +1,32 @@ -## @file -# Unit tests for Python based BaseTools -# -# Copyright (c) 2008, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import sys -import unittest - - -def TheTestSuite(): - suites = [] - import CheckPythonSyntax - suites.append(CheckPythonSyntax.TheTestSuite()) - return unittest.TestSuite(suites) - -if __name__ == '__main__': - allTests = TheTestSuite() - unittest.TextTestRunner().run(allTests) - +## @file +# Unit tests for Python based BaseTools +# +# Copyright (c) 2008, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import sys +import unittest + + +def TheTestSuite(): + suites = [] + import CheckPythonSyntax + suites.append(CheckPythonSyntax.TheTestSuite()) + return unittest.TestSuite(suites) + +if __name__ == '__main__': + allTests = TheTestSuite() + unittest.TextTestRunner().run(allTests) + diff --git a/BaseTools/Tests/RunTests.py b/BaseTools/Tests/RunTests.py index 193bc60625..e8ca2d055e 100644 --- a/BaseTools/Tests/RunTests.py +++ b/BaseTools/Tests/RunTests.py @@ -1,40 +1,40 @@ -## @file -# Unit tests for BaseTools utilities -# -# Copyright (c) 2008, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import sys -import unittest - -import TestTools - -sys.path.append(TestTools.PythonSourceDir) - -def GetCTestSuite(): - import CToolsTests - return CToolsTests.TheTestSuite() - -def GetPythonTestSuite(): - import PythonToolsTests - return PythonToolsTests.TheTestSuite() - -def GetAllTestsSuite(): - return unittest.TestSuite([GetCTestSuite(), GetPythonTestSuite()]) - -if __name__ == '__main__': - allTests = GetAllTestsSuite() - unittest.TextTestRunner(verbosity=2).run(allTests) - +## @file +# Unit tests for BaseTools utilities +# +# Copyright (c) 2008, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import sys +import unittest + +import TestTools + +sys.path.append(TestTools.PythonSourceDir) + +def GetCTestSuite(): + import CToolsTests + return CToolsTests.TheTestSuite() + +def GetPythonTestSuite(): + import PythonToolsTests + return PythonToolsTests.TheTestSuite() + +def GetAllTestsSuite(): + return unittest.TestSuite([GetCTestSuite(), GetPythonTestSuite()]) + +if __name__ == '__main__': + allTests = GetAllTestsSuite() + unittest.TextTestRunner(verbosity=2).run(allTests) + diff --git a/BaseTools/Tests/TestTools.py b/BaseTools/Tests/TestTools.py index e838ae4294..ac009db1fa 100644 --- a/BaseTools/Tests/TestTools.py +++ b/BaseTools/Tests/TestTools.py @@ -1,179 +1,179 @@ -## @file -# Utility functions and classes for BaseTools unit tests -# -# Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import base64 -import os -import os.path -import random -import shutil -import subprocess -import sys -import types -import unittest - -TestsDir = os.path.realpath(os.path.split(sys.argv[0])[0]) -BaseToolsDir = os.path.realpath(os.path.join(TestsDir, '..')) -CSourceDir = os.path.join(BaseToolsDir, 'Source', 'C') -PythonSourceDir = os.path.join(BaseToolsDir, 'Source', 'Python') -TestTempDir = os.path.join(TestsDir, 'TestTempDir') - -def MakeTheTestSuite(localItems): - tests = [] - for name, item in localItems.iteritems(): - if isinstance(item, types.TypeType): - if issubclass(item, unittest.TestCase): - tests.append(unittest.TestLoader().loadTestsFromTestCase(item)) - elif issubclass(item, unittest.TestSuite): - tests.append(item()) - return lambda: unittest.TestSuite(tests) - -def GetBaseToolsPaths(): - if sys.platform in ('win32', 'win64'): - return [ os.path.join(BaseToolsDir, 'Bin', sys.platform.title()) ] - else: - uname = os.popen('uname -sm').read().strip() - for char in (' ', '/'): - uname = uname.replace(char, '-') - return [ - os.path.join(BaseToolsDir, 'Bin', uname), - os.path.join(BaseToolsDir, 'BinWrappers', uname), - os.path.join(BaseToolsDir, 'BinWrappers', 'PosixLike') - ] - -BaseToolsBinPaths = GetBaseToolsPaths() - -class BaseToolsTest(unittest.TestCase): - - def cleanOutDir(self, dir): - for dirItem in os.listdir(dir): - if dirItem in ('.', '..'): continue - dirItem = os.path.join(dir, dirItem) - self.RemoveFileOrDir(dirItem) - - def CleanUpTmpDir(self): - if os.path.exists(self.testDir): - self.cleanOutDir(self.testDir) - - def HandleTreeDeleteError(self, function, path, excinfo): - os.chmod(path, stat.S_IWRITE) - function(path) - - def RemoveDir(self, dir): - shutil.rmtree(dir, False, self.HandleTreeDeleteError) - - def RemoveFileOrDir(self, path): - if not os.path.exists(path): - return - elif os.path.isdir(path): - self.RemoveDir(path) - else: - os.remove(path) - - def DisplayBinaryData(self, description, data): - print description, '(base64 encoded):' - b64data = base64.b64encode(data) - print b64data - - def DisplayFile(self, fileName): - sys.stdout.write(self.ReadTmpFile(fileName)) - sys.stdout.flush() - - def FindToolBin(self, toolName): - for binPath in BaseToolsBinPaths: - bin = os.path.join(binPath, toolName) - if os.path.exists(bin): - break - assert os.path.exists(bin) - return bin - - def RunTool(self, *args, **kwd): - if 'toolName' in kwd: toolName = kwd['toolName'] - else: toolName = None - if 'logFile' in kwd: logFile = kwd['logFile'] - else: logFile = None - - if toolName is None: toolName = self.toolName - bin = self.FindToolBin(toolName) - if logFile is not None: - logFile = open(os.path.join(self.testDir, logFile), 'w') - popenOut = logFile - else: - popenOut = subprocess.PIPE - - args = [toolName] + list(args) - - Proc = subprocess.Popen( - args, executable=bin, - stdout=popenOut, stderr=subprocess.STDOUT - ) - - if logFile is None: - Proc.stdout.read() - - return Proc.wait() - - def GetTmpFilePath(self, fileName): - return os.path.join(self.testDir, fileName) - - def OpenTmpFile(self, fileName, mode = 'r'): - return open(os.path.join(self.testDir, fileName), mode) - - def ReadTmpFile(self, fileName): - f = open(self.GetTmpFilePath(fileName), 'r') - data = f.read() - f.close() - return data - - def WriteTmpFile(self, fileName, data): - f = open(self.GetTmpFilePath(fileName), 'w') - f.write(data) - f.close() - - def GenRandomFileData(self, fileName, minlen = None, maxlen = None): - if maxlen is None: maxlen = minlen - f = self.OpenTmpFile(fileName, 'w') - f.write(self.GetRandomString(minlen, maxlen)) - f.close() - - def GetRandomString(self, minlen = None, maxlen = None): - if minlen is None: minlen = 1024 - if maxlen is None: maxlen = minlen - return ''.join( - [chr(random.randint(0,255)) - for x in xrange(random.randint(minlen, maxlen)) - ]) - - def setUp(self): - self.savedEnvPath = os.environ['PATH'] - self.savedSysPath = sys.path[:] - - for binPath in BaseToolsBinPaths: - os.environ['PATH'] = \ - os.path.pathsep.join((os.environ['PATH'], binPath)) - - self.testDir = TestTempDir - if not os.path.exists(self.testDir): - os.mkdir(self.testDir) - else: - self.cleanOutDir(self.testDir) - - def tearDown(self): - self.RemoveFileOrDir(self.testDir) - - os.environ['PATH'] = self.savedEnvPath - sys.path = self.savedSysPath - +## @file +# Utility functions and classes for BaseTools unit tests +# +# Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import base64 +import os +import os.path +import random +import shutil +import subprocess +import sys +import types +import unittest + +TestsDir = os.path.realpath(os.path.split(sys.argv[0])[0]) +BaseToolsDir = os.path.realpath(os.path.join(TestsDir, '..')) +CSourceDir = os.path.join(BaseToolsDir, 'Source', 'C') +PythonSourceDir = os.path.join(BaseToolsDir, 'Source', 'Python') +TestTempDir = os.path.join(TestsDir, 'TestTempDir') + +def MakeTheTestSuite(localItems): + tests = [] + for name, item in localItems.iteritems(): + if isinstance(item, types.TypeType): + if issubclass(item, unittest.TestCase): + tests.append(unittest.TestLoader().loadTestsFromTestCase(item)) + elif issubclass(item, unittest.TestSuite): + tests.append(item()) + return lambda: unittest.TestSuite(tests) + +def GetBaseToolsPaths(): + if sys.platform in ('win32', 'win64'): + return [ os.path.join(BaseToolsDir, 'Bin', sys.platform.title()) ] + else: + uname = os.popen('uname -sm').read().strip() + for char in (' ', '/'): + uname = uname.replace(char, '-') + return [ + os.path.join(BaseToolsDir, 'Bin', uname), + os.path.join(BaseToolsDir, 'BinWrappers', uname), + os.path.join(BaseToolsDir, 'BinWrappers', 'PosixLike') + ] + +BaseToolsBinPaths = GetBaseToolsPaths() + +class BaseToolsTest(unittest.TestCase): + + def cleanOutDir(self, dir): + for dirItem in os.listdir(dir): + if dirItem in ('.', '..'): continue + dirItem = os.path.join(dir, dirItem) + self.RemoveFileOrDir(dirItem) + + def CleanUpTmpDir(self): + if os.path.exists(self.testDir): + self.cleanOutDir(self.testDir) + + def HandleTreeDeleteError(self, function, path, excinfo): + os.chmod(path, stat.S_IWRITE) + function(path) + + def RemoveDir(self, dir): + shutil.rmtree(dir, False, self.HandleTreeDeleteError) + + def RemoveFileOrDir(self, path): + if not os.path.exists(path): + return + elif os.path.isdir(path): + self.RemoveDir(path) + else: + os.remove(path) + + def DisplayBinaryData(self, description, data): + print description, '(base64 encoded):' + b64data = base64.b64encode(data) + print b64data + + def DisplayFile(self, fileName): + sys.stdout.write(self.ReadTmpFile(fileName)) + sys.stdout.flush() + + def FindToolBin(self, toolName): + for binPath in BaseToolsBinPaths: + bin = os.path.join(binPath, toolName) + if os.path.exists(bin): + break + assert os.path.exists(bin) + return bin + + def RunTool(self, *args, **kwd): + if 'toolName' in kwd: toolName = kwd['toolName'] + else: toolName = None + if 'logFile' in kwd: logFile = kwd['logFile'] + else: logFile = None + + if toolName is None: toolName = self.toolName + bin = self.FindToolBin(toolName) + if logFile is not None: + logFile = open(os.path.join(self.testDir, logFile), 'w') + popenOut = logFile + else: + popenOut = subprocess.PIPE + + args = [toolName] + list(args) + + Proc = subprocess.Popen( + args, executable=bin, + stdout=popenOut, stderr=subprocess.STDOUT + ) + + if logFile is None: + Proc.stdout.read() + + return Proc.wait() + + def GetTmpFilePath(self, fileName): + return os.path.join(self.testDir, fileName) + + def OpenTmpFile(self, fileName, mode = 'r'): + return open(os.path.join(self.testDir, fileName), mode) + + def ReadTmpFile(self, fileName): + f = open(self.GetTmpFilePath(fileName), 'r') + data = f.read() + f.close() + return data + + def WriteTmpFile(self, fileName, data): + f = open(self.GetTmpFilePath(fileName), 'w') + f.write(data) + f.close() + + def GenRandomFileData(self, fileName, minlen = None, maxlen = None): + if maxlen is None: maxlen = minlen + f = self.OpenTmpFile(fileName, 'w') + f.write(self.GetRandomString(minlen, maxlen)) + f.close() + + def GetRandomString(self, minlen = None, maxlen = None): + if minlen is None: minlen = 1024 + if maxlen is None: maxlen = minlen + return ''.join( + [chr(random.randint(0,255)) + for x in xrange(random.randint(minlen, maxlen)) + ]) + + def setUp(self): + self.savedEnvPath = os.environ['PATH'] + self.savedSysPath = sys.path[:] + + for binPath in BaseToolsBinPaths: + os.environ['PATH'] = \ + os.path.pathsep.join((os.environ['PATH'], binPath)) + + self.testDir = TestTempDir + if not os.path.exists(self.testDir): + os.mkdir(self.testDir) + else: + self.cleanOutDir(self.testDir) + + def tearDown(self): + self.RemoveFileOrDir(self.testDir) + + os.environ['PATH'] = self.savedEnvPath + sys.path = self.savedSysPath + diff --git a/BaseTools/Tests/TianoCompress.py b/BaseTools/Tests/TianoCompress.py index 01cd975048..e141364162 100644 --- a/BaseTools/Tests/TianoCompress.py +++ b/BaseTools/Tests/TianoCompress.py @@ -1,74 +1,74 @@ -## @file -# Unit tests for TianoCompress utility -# -# Copyright (c) 2008, Intel Corporation. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -## -# Import Modules -# -import os -import random -import sys -import unittest - -import TestTools - -class Tests(TestTools.BaseToolsTest): - - def setUp(self): - TestTools.BaseToolsTest.setUp(self) - self.toolName = 'TianoCompress' - - def testHelp(self): - result = self.RunTool('--help', logFile='help') - #self.DisplayFile('help') - self.assertTrue(result == 0) - - def compressionTestCycle(self, data): - path = self.GetTmpFilePath('input') - self.WriteTmpFile('input', data) - result = self.RunTool( - '-e', - '-o', self.GetTmpFilePath('output1'), - self.GetTmpFilePath('input') - ) - self.assertTrue(result == 0) - result = self.RunTool( - '-d', - '-o', self.GetTmpFilePath('output2'), - self.GetTmpFilePath('output1') - ) - self.assertTrue(result == 0) - start = self.ReadTmpFile('input') - finish = self.ReadTmpFile('output2') - startEqualsFinish = start == finish - if not startEqualsFinish: - print - print 'Original data did not match decompress(compress(data))' - self.DisplayBinaryData('original data', start) - self.DisplayBinaryData('after compression', self.ReadTmpFile('output1')) - self.DisplayBinaryData('after decomression', finish) - self.assertTrue(startEqualsFinish) - - def testRandomDataCycles(self): - for i in range(8): - data = self.GetRandomString(1024, 2048) - self.compressionTestCycle(data) - self.CleanUpTmpDir() - -TheTestSuite = TestTools.MakeTheTestSuite(locals()) - -if __name__ == '__main__': - allTests = TheTestSuite() - unittest.TextTestRunner().run(allTests) - - +## @file +# Unit tests for TianoCompress utility +# +# Copyright (c) 2008, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# + +## +# Import Modules +# +import os +import random +import sys +import unittest + +import TestTools + +class Tests(TestTools.BaseToolsTest): + + def setUp(self): + TestTools.BaseToolsTest.setUp(self) + self.toolName = 'TianoCompress' + + def testHelp(self): + result = self.RunTool('--help', logFile='help') + #self.DisplayFile('help') + self.assertTrue(result == 0) + + def compressionTestCycle(self, data): + path = self.GetTmpFilePath('input') + self.WriteTmpFile('input', data) + result = self.RunTool( + '-e', + '-o', self.GetTmpFilePath('output1'), + self.GetTmpFilePath('input') + ) + self.assertTrue(result == 0) + result = self.RunTool( + '-d', + '-o', self.GetTmpFilePath('output2'), + self.GetTmpFilePath('output1') + ) + self.assertTrue(result == 0) + start = self.ReadTmpFile('input') + finish = self.ReadTmpFile('output2') + startEqualsFinish = start == finish + if not startEqualsFinish: + print + print 'Original data did not match decompress(compress(data))' + self.DisplayBinaryData('original data', start) + self.DisplayBinaryData('after compression', self.ReadTmpFile('output1')) + self.DisplayBinaryData('after decomression', finish) + self.assertTrue(startEqualsFinish) + + def testRandomDataCycles(self): + for i in range(8): + data = self.GetRandomString(1024, 2048) + self.compressionTestCycle(data) + self.CleanUpTmpDir() + +TheTestSuite = TestTools.MakeTheTestSuite(locals()) + +if __name__ == '__main__': + allTests = TheTestSuite() + unittest.TextTestRunner().run(allTests) + + diff --git a/BaseTools/building-gcc.txt b/BaseTools/building-gcc.txt index ed9cecee28..2b2cff6058 100644 --- a/BaseTools/building-gcc.txt +++ b/BaseTools/building-gcc.txt @@ -1,15 +1,15 @@ -To use GCC with the BaseTools project for edk2 based development purposes, -you will need to build a GCC based cross-compiler (in addition to binutils). - -Instructions for building GCC for this purpose can be found under the -BaseTools source tree. (In addition to the instructions, you will also -find scripts to help automate the build process.) - -If you do not have a tianocore.org account, you can make use of the 'guest' -account with an empty password. - -In a web browser, you can 'browse' the relavent source at this location: - http://sourceforge.net/p/edk2-buildtools/code/HEAD/tree/trunk/BaseTools/gcc - -Or, with subversion, you can download the relavent source with this command: - svn co https://svn.code.sf.net/p/edk2-buildtools/code/trunk/BaseTools/gcc +To use GCC with the BaseTools project for edk2 based development purposes, +you will need to build a GCC based cross-compiler (in addition to binutils). + +Instructions for building GCC for this purpose can be found under the +BaseTools source tree. (In addition to the instructions, you will also +find scripts to help automate the build process.) + +If you do not have a tianocore.org account, you can make use of the 'guest' +account with an empty password. + +In a web browser, you can 'browse' the relavent source at this location: + http://sourceforge.net/p/edk2-buildtools/code/HEAD/tree/trunk/BaseTools/gcc + +Or, with subversion, you can download the relavent source with this command: + svn co https://svn.code.sf.net/p/edk2-buildtools/code/trunk/BaseTools/gcc