Package ghidra.app.util.cparser.C

# Class CParser

java.lang.Object
ghidra.app.util.cparser.C.CParser

All Implemented Interfaces:
  `CParserConstants`

public class CParser extends Object implements CParserConstants

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `Token`
  `jj_nt`
  Next token.
  `Token`
  `token`
  Current token.
  `CParserTokenManager`
  `token_source`
  Generated Token Manager.

  ### Fields inherited from interface ghidra.app.util.cparser.C.CParserConstants

  `ALIGNAS, ALIGNOF, ASM, ASM_SEMI, ASMBLOCK, ASMBLOCKB, ASMBLOCKP, ATTRIBUTE, AUTO, BOOL, BREAK, CASE, CDECL, CHAR, CHARACTER_LITERAL, CONST, CONTINUE, DECIMAL_LITERAL, DECLSPEC, DEFAULT, DFLT, DIGIT, DO, DOUBLE, ELSE, ENUM, EOF, EXPONENT, EXTENSION, EXTERN, FAR, FASTCALL, FLOAT, FLOATING_POINT_LITERAL, FOR, GOTO, HEX_LITERAL, IDENTIFIER, IF, INLINE, INT, INT16, INT32, INT64, INT8, INTEGER_LITERAL, INTERFACE, LETTER, LINE, LINEALT, LINEBLOCK, LINENUMBER_LITERAL, LONG, NEAR, NORETURN, OBJC, OBJC_DIGIT, OBJC_IDENTIFIER, OBJC_IGNORE, OBJC_LETTER, OBJC_SEMI, OBJC2, OBJC2_END, OBJC2_IGNORE, OCTAL_LITERAL, PACKED, PASCALCALL, PATH_LITERAL, PCLOSE, PCOLON, PCOMMA, PDECIMAL_LITERAL, PDIGIT, PHEX_LITERAL, PIDENTIFIER, PINTEGER_LITERAL, PLETTER, PMINUS, POCTAL_LITERAL, POPEN, PPLUS, PRAGMA, PRAGMA_FUNC, PRAGMALINE, PROTOCOL, PSTAR, PSTRING_LITERAL, PTR32, PTR64, QUOTE_C, READABLETO, REGISTER, RESTRICT, RETURN, RUSTCALL, SHORT, SIGNED, SIZEOF, STATIC, STATICASSERT, STDCALL, STRING_LITERAL, STRUCT, SWITCH, THREADLOCAL, tokenImage, TYPEDEF, UNALIGNED, UNION, UNSIGNED, VECTORCALL, VOID, VOLATILE, W64, WHILE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CParser()`
  `CParser(CParserTokenManager tm)`
  Constructor with generated Token Manager.
  `CParser(DataTypeManager dtmgr)`
  `CParser(DataTypeManager dtmgr, boolean storeDataType, DataTypeManager[] subDTMgrs)`
  `CParser(InputStream stream)`
  Constructor with InputStream.
  `CParser(InputStream stream, String encoding)`
  Constructor with InputStream and supplied encoding
  `CParser(Reader stream)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final Declaration`
  `AbstractDeclarator(Declaration dt)`
  `final Object`
  `AdditiveExpression()`
  `final void`
  `AlignmentSpecifier()`
  `final Object`
  `ANDExpression()`
  `final void`
  `ArgumentExpressionList()`
  `final void`
  `AsmLine()`
  `final void`
  `AsmStatement()`
  `final Object`
  `AssignmentExpression()`
  `final void`
  `AssignmentOperator()`
  `final void`
  `AttributeList(Declaration dec)`
  `final void`
  `AttributeSpec(Declaration dec)`
  `final void`
  `AttributeSpecList(Declaration dec)`
  `final void`
  `AttributeToken(Declaration dec)`
  `final Declaration`
  `BuiltInDeclarationSpecifier(Declaration dec)`
  `final Declaration`
  `BuiltInTypeSpecifier(Declaration dec)`
  `final Object`
  `CastExpression()`
  `final void`
  `CompoundStatement()`
  `final Object`
  `ConditionalExpression()`
  `final Object`
  `Constant()`
  `final Object`
  `ConstantExpression()`
  `final Declaration`
  `Declaration()`
  `final void`
  `DeclarationList()`
  `final Declaration`
  `DeclarationSpecifiers(Declaration specDT)`
  `final Declaration`
  `Declarator(Declaration dt, DataType container)`
  `final void`
  `DeclConstant()`
  `final void`
  `DeclSpec(Declaration dec)`
  `final void`
  `DeclSpecifier(Declaration dec)`
  `final void`
  `Designation()`
  `final void`
  `Designator()`
  `final void`
  `DesignatorList()`
  `boolean`
  `didParseSucceed()`
  `final Declaration`
  `DirectAbstractDeclarator(Declaration dt)`
  `final Declaration`
  `DirectDeclarator(Declaration dt, DataType container)`
  `final void`
  `disable_tracing()`
  Disable tracing.
  `final void`
  `enable_tracing()`
  Enable tracing.
  `final int`
  `Enumerator(ArrayList<ghidra.app.util.cparser.C.CParser.EnumMember> list, int value)`
  `final ArrayList<ghidra.app.util.cparser.C.CParser.EnumMember>`
  `EnumeratorList()`
  `final DataType`
  `EnumSpecifier()`
  `final Object`
  `EqualityExpression()`
  `final Object`
  `ExclusiveORExpression()`
  `final Object`
  `Expression()`
  `final void`
  `ExpressionStatement()`
  `final void`
  `ExternalDeclaration()`
  `final void`
  `FunctionDefinition()`
  `ParseException`
  `generateParseException()`
  Generate ParseException.
  `Map<String,DataType>`
  `getComposites()`
  Get composite definitions
  `DataTypeManager`
  `getDataTypeManager()`
  Get the data type manager
  `Map<String,DataType>`
  `getDeclarations()`
  Get Global variable declarations
  `Map<String,DataType>`
  `getEnums()`
  Get Defined Enumerations
  `Map<String,DataType>`
  `getFunctions()`
  Get Function signatures
  `DataType`
  `getLastDataType()`
  `final Token`
  `getNextToken()`
  Get the next Token.
  `String`
  `getParseMessages()`
  `final Token`
  `getToken(int index)`
  Get the specific Token.
  `Map<String,DataType>`
  `getTypes()`
  Get Type definitions
  `final void`
  `IdentifierList(FunctionDefinitionDataType funcDT, DataType retDT)`
  `final Object`
  `InclusiveORExpression()`
  `final void`
  `InitDeclarator(Declaration dt)`
  `final void`
  `InitDeclaratorList(Declaration dt)`
  `final void`
  `Initializer()`
  `final void`
  `InitializerList()`
  `final void`
  `IterationStatement()`
  `final void`
  `JumpStatement()`
  `final void`
  `LabeledStatement()`
  `final void`
  `LineDef()`
  `final Object`
  `LogicalANDExpression()`
  `final Object`
  `LogicalORExpression()`
  `static void`
  `main(String[] args)`
  `final Token`
  `MultiLineString()`
  `final Object`
  `MultiplicativeExpression()`
  `final DataType`
  `ObjcDef()`
  `final void`
  `ParameterDeclaration(ArrayList<Declaration> list)`
  `final ArrayList<Declaration>`
  `ParameterList()`
  `final Declaration`
  `ParameterTypeList(FunctionDefinitionDataType funcDT, DataType retDT)`
  `void`
  `parse(InputStream fis)`
  `DataType`
  `parse(String str)`
  `final Declaration`
  `Pointer(Declaration dec)`
  `final Object`
  `PostfixExpression()`
  `final Token`
  `PragmaConstant()`
  `final void`
  `PragmaSpec()`
  `final void`
  `PragmaSpecifier()`
  `final Object`
  `PrimaryExpression()`
  `void`
  `ReInit(CParserTokenManager tm)`
  Reinitialise.
  `void`
  `ReInit(InputStream stream)`
  Reinitialise.
  `void`
  `ReInit(InputStream stream, String encoding)`
  Reinitialise.
  `void`
  `ReInit(Reader stream)`
  Reinitialise.
  `final Object`
  `RelationalExpression()`
  `final void`
  `SelectionStatement()`
  `void`
  `setMonitor(TaskMonitor monitor)`
  `void`
  `setParseFileName(String fName)`
  `final Object`
  `ShiftExpression()`
  `final Declaration`
  `SpecifierQualifierList()`
  `final void`
  `Statement()`
  `final void`
  `StatementList()`
  `final void`
  `StaticAssert()`
  `final Declaration`
  `StorageClassSpecifier(Declaration specDT)`
  `final void`
  `StructDeclaration(Composite comp, CompositeHandler compositeHandler)`
  `final void`
  `StructDeclarationList(Composite comp)`
  `final void`
  `StructDeclarator(Declaration dt, Composite comp, CompositeHandler compositeHandler)`
  `final void`
  `StructDeclaratorList(Declaration dt, Composite comp, CompositeHandler compositeHandler)`
  `final Composite`
  `StructOrUnion()`
  `final DataType`
  `StructOrUnionSpecifier()`
  `final void`
  `SubIdent(Declaration dec)`
  `final void`
  `TranslationUnit()`
  `final DataType`
  `TypedefName()`
  `final Declaration`
  `TypeName()`
  `final Declaration`
  `TypeQualifier(Declaration dec)`
  `final Declaration`
  `TypeQualifierList(Declaration dec)`
  `final Declaration`
  `TypeSpecifier(Declaration dec)`
  `final Object`
  `UnaryExpression()`
  `final void`
  `UnaryOperator()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### token_source

    public CParserTokenManager token_source
    Generated Token Manager.

  - ### token

    public Token token
    Current token.

  - ### jj_nt

    public Token jj_nt
    Next token.

- ## Constructor Details

  - ### CParser

    public CParser()

  - ### CParser

    public CParser(DataTypeManager dtmgr)

  - ### CParser

    public CParser(DataTypeManager dtmgr, boolean storeDataType, DataTypeManager[] subDTMgrs)

  - ### CParser

    public CParser(InputStream stream)
    Constructor with InputStream.

  - ### CParser

    public CParser(InputStream stream, String encoding)
    Constructor with InputStream and supplied encoding

  - ### CParser

    public CParser(Reader stream)
    Constructor.

  - ### CParser

    public CParser(CParserTokenManager tm)
    Constructor with generated Token Manager.

- ## Method Details

  - ### setParseFileName

    public void setParseFileName(String fName)

  - ### getParseMessages

    public String getParseMessages()

  - ### didParseSucceed

    public boolean didParseSucceed()

  - ### setMonitor

    public void setMonitor(TaskMonitor monitor)

  - ### getDataTypeManager

    public DataTypeManager getDataTypeManager()
    Get the data type manager
    Returns:

  - ### getLastDataType

    public DataType getLastDataType()
    Returns:
      the last data type parsed

  - ### getDeclarations

    public Map<String,DataType> getDeclarations()
    Get Global variable declarations
    Returns:

  - ### getEnums

    public Map<String,DataType> getEnums()
    Get Defined Enumerations
    Returns:
      Defined enumeration names

  - ### getFunctions

    public Map<String,DataType> getFunctions()
    Get Function signatures
    Returns:
      Function signatures

  - ### getComposites

    public Map<String,DataType> getComposites()
    Get composite definitions
    Returns:
      Composite (structure/union) definitions

  - ### getTypes

    public Map<String,DataType> getTypes()
    Get Type definitions
    Returns:
      Type definitions

  - ### parse

    public DataType parse(String str) throws ParseException
    Throws:
      `ParseException`

  - ### parse

    public void parse(InputStream fis) throws ParseException
    Throws:
      `ParseException`

  - ### main

    public static void main(String[] args)

  - ### TranslationUnit

    public final void TranslationUnit() throws ParseException
    Throws:
      `ParseException`

  - ### ExternalDeclaration

    public final void ExternalDeclaration() throws ParseException
    Throws:
      `ParseException`

  - ### LineDef

    public final void LineDef() throws ParseException
    Throws:
      `ParseException`

  - ### ObjcDef

    public final DataType ObjcDef() throws ParseException
    Throws:
      `ParseException`

  - ### FunctionDefinition

    public final void FunctionDefinition() throws ParseException
    Throws:
      `ParseException`

  - ### Declaration

    public final Declaration Declaration() throws ParseException
    Throws:
      `ParseException`

  - ### DeclarationList

    public final void DeclarationList() throws ParseException
    Throws:
      `ParseException`

  - ### DeclarationSpecifiers

    public final Declaration DeclarationSpecifiers(Declaration specDT) throws ParseException
    Throws:
      `ParseException`

  - ### StorageClassSpecifier

    public final Declaration StorageClassSpecifier(Declaration specDT) throws ParseException
    Throws:
      `ParseException`

  - ### BuiltInTypeSpecifier

    public final Declaration BuiltInTypeSpecifier(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### BuiltInDeclarationSpecifier

    public final Declaration BuiltInDeclarationSpecifier(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### TypeSpecifier

    public final Declaration TypeSpecifier(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### TypeQualifier

    public final Declaration TypeQualifier(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### AttributeSpec

    public final void AttributeSpec(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### AlignmentSpecifier

    public final void AlignmentSpecifier() throws ParseException
    Throws:
      `ParseException`

  - ### AttributeList

    public final void AttributeList(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### AttributeToken

    public final void AttributeToken(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### AttributeSpecList

    public final void AttributeSpecList(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### SubIdent

    public final void SubIdent(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### DeclSpec

    public final void DeclSpec(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### DeclSpecifier

    public final void DeclSpecifier(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### DeclConstant

    public final void DeclConstant() throws ParseException
    Throws:
      `ParseException`

  - ### MultiLineString

    public final Token MultiLineString() throws ParseException
    Throws:
      `ParseException`

  - ### PragmaSpec

    public final void PragmaSpec() throws ParseException
    Throws:
      `ParseException`

  - ### PragmaSpecifier

    public final void PragmaSpecifier() throws ParseException
    Throws:
      `ParseException`

  - ### PragmaConstant

    public final Token PragmaConstant() throws ParseException
    Throws:
      `ParseException`

  - ### StaticAssert

    public final void StaticAssert() throws ParseException
    Throws:
      `ParseException`

  - ### StructOrUnionSpecifier

    public final DataType StructOrUnionSpecifier() throws ParseException
    Throws:
      `ParseException`

  - ### StructOrUnion

    public final Composite StructOrUnion() throws ParseException
    Throws:
      `ParseException`

  - ### StructDeclarationList

    public final void StructDeclarationList(Composite comp) throws ParseException
    Throws:
      `ParseException`

  - ### InitDeclaratorList

    public final void InitDeclaratorList(Declaration dt) throws ParseException
    Throws:
      `ParseException`

  - ### InitDeclarator

    public final void InitDeclarator(Declaration dt) throws ParseException
    Throws:
      `ParseException`

  - ### StructDeclaration

    public final void StructDeclaration(Composite comp, CompositeHandler compositeHandler) throws ParseException
    Throws:
      `ParseException`

  - ### SpecifierQualifierList

    public final Declaration SpecifierQualifierList() throws ParseException
    Throws:
      `ParseException`

  - ### StructDeclaratorList

    public final void StructDeclaratorList(Declaration dt, Composite comp, CompositeHandler compositeHandler) throws ParseException
    Throws:
      `ParseException`

  - ### StructDeclarator

    public final void StructDeclarator(Declaration dt, Composite comp, CompositeHandler compositeHandler) throws ParseException
    Throws:
      `ParseException`

  - ### EnumSpecifier

    public final DataType EnumSpecifier() throws ParseException
    Throws:
      `ParseException`

  - ### EnumeratorList

    public final ArrayList<ghidra.app.util.cparser.C.CParser.EnumMember> EnumeratorList() throws ParseException
    Throws:
      `ParseException`

  - ### Enumerator

    public final int Enumerator(ArrayList<ghidra.app.util.cparser.C.CParser.EnumMember> list, int value) throws ParseException
    Throws:
      `ParseException`

  - ### Declarator

    public final Declaration Declarator(Declaration dt, DataType container) throws ParseException
    Throws:
      `ParseException`

  - ### DirectDeclarator

    public final Declaration DirectDeclarator(Declaration dt, DataType container) throws ParseException
    Throws:
      `ParseException`

  - ### Pointer

    public final Declaration Pointer(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### TypeQualifierList

    public final Declaration TypeQualifierList(Declaration dec) throws ParseException
    Throws:
      `ParseException`

  - ### ParameterTypeList

    public final Declaration ParameterTypeList(FunctionDefinitionDataType funcDT, DataType retDT) throws ParseException
    Throws:
      `ParseException`

  - ### ParameterList

    public final ArrayList<Declaration> ParameterList() throws ParseException
    Throws:
      `ParseException`

  - ### ParameterDeclaration

    public final void ParameterDeclaration(ArrayList<Declaration> list) throws ParseException
    Throws:
      `ParseException`

  - ### IdentifierList

    public final void IdentifierList(FunctionDefinitionDataType funcDT, DataType retDT) throws ParseException
    Throws:
      `ParseException`

  - ### Initializer

    public final void Initializer() throws ParseException
    Throws:
      `ParseException`

  - ### InitializerList

    public final void InitializerList() throws ParseException
    Throws:
      `ParseException`

  - ### Designation

    public final void Designation() throws ParseException
    Throws:
      `ParseException`

  - ### DesignatorList

    public final void DesignatorList() throws ParseException
    Throws:
      `ParseException`

  - ### Designator

    public final void Designator() throws ParseException
    Throws:
      `ParseException`

  - ### TypeName

    public final Declaration TypeName() throws ParseException
    Throws:
      `ParseException`

  - ### AbstractDeclarator

    public final Declaration AbstractDeclarator(Declaration dt) throws ParseException
    Throws:
      `ParseException`

  - ### DirectAbstractDeclarator

    public final Declaration DirectAbstractDeclarator(Declaration dt) throws ParseException
    Throws:
      `ParseException`

  - ### TypedefName

    public final DataType TypedefName() throws ParseException
    Throws:
      `ParseException`

  - ### Statement

    public final void Statement() throws ParseException
    Throws:
      `ParseException`

  - ### LabeledStatement

    public final void LabeledStatement() throws ParseException
    Throws:
      `ParseException`

  - ### ExpressionStatement

    public final void ExpressionStatement() throws ParseException
    Throws:
      `ParseException`

  - ### CompoundStatement

    public final void CompoundStatement() throws ParseException
    Throws:
      `ParseException`

  - ### StatementList

    public final void StatementList() throws ParseException
    Throws:
      `ParseException`

  - ### AsmStatement

    public final void AsmStatement() throws ParseException
    Throws:
      `ParseException`

  - ### AsmLine

    public final void AsmLine() throws ParseException
    Throws:
      `ParseException`

  - ### SelectionStatement

    public final void SelectionStatement() throws ParseException
    Throws:
      `ParseException`

  - ### IterationStatement

    public final void IterationStatement() throws ParseException
    Throws:
      `ParseException`

  - ### JumpStatement

    public final void JumpStatement() throws ParseException
    Throws:
      `ParseException`

  - ### Expression

    public final Object Expression() throws ParseException
    Throws:
      `ParseException`

  - ### AssignmentExpression

    public final Object AssignmentExpression() throws ParseException
    Throws:
      `ParseException`

  - ### AssignmentOperator

    public final void AssignmentOperator() throws ParseException
    Throws:
      `ParseException`

  - ### ConditionalExpression

    public final Object ConditionalExpression() throws ParseException
    Throws:
      `ParseException`

  - ### ConstantExpression

    public final Object ConstantExpression() throws ParseException
    Throws:
      `ParseException`

  - ### LogicalORExpression

    public final Object LogicalORExpression() throws ParseException
    Throws:
      `ParseException`

  - ### LogicalANDExpression

    public final Object LogicalANDExpression() throws ParseException
    Throws:
      `ParseException`

  - ### InclusiveORExpression

    public final Object InclusiveORExpression() throws ParseException
    Throws:
      `ParseException`

  - ### ExclusiveORExpression

    public final Object ExclusiveORExpression() throws ParseException
    Throws:
      `ParseException`

  - ### ANDExpression

    public final Object ANDExpression() throws ParseException
    Throws:
      `ParseException`

  - ### EqualityExpression

    public final Object EqualityExpression() throws ParseException
    Throws:
      `ParseException`

  - ### RelationalExpression

    public final Object RelationalExpression() throws ParseException
    Throws:
      `ParseException`

  - ### ShiftExpression

    public final Object ShiftExpression() throws ParseException
    Throws:
      `ParseException`

  - ### AdditiveExpression

    public final Object AdditiveExpression() throws ParseException
    Throws:
      `ParseException`

  - ### MultiplicativeExpression

    public final Object MultiplicativeExpression() throws ParseException
    Throws:
      `ParseException`

  - ### CastExpression

    public final Object CastExpression() throws ParseException
    Throws:
      `ParseException`

  - ### UnaryExpression

    public final Object UnaryExpression() throws ParseException
    Throws:
      `ParseException`

  - ### UnaryOperator

    public final void UnaryOperator() throws ParseException
    Throws:
      `ParseException`

  - ### PostfixExpression

    public final Object PostfixExpression() throws ParseException
    Throws:
      `ParseException`

  - ### PrimaryExpression

    public final Object PrimaryExpression() throws ParseException
    Throws:
      `ParseException`

  - ### ArgumentExpressionList

    public final void ArgumentExpressionList() throws ParseException
    Throws:
      `ParseException`

  - ### Constant

    public final Object Constant() throws ParseException
    Throws:
      `ParseException`

  - ### ReInit

    public void ReInit(InputStream stream)
    Reinitialise.

  - ### ReInit

    public void ReInit(InputStream stream, String encoding)
    Reinitialise.

  - ### ReInit

    public void ReInit(Reader stream)
    Reinitialise.

  - ### ReInit

    public void ReInit(CParserTokenManager tm)
    Reinitialise.

  - ### getNextToken

    public final Token getNextToken()
    Get the next Token.

  - ### getToken

    public final Token getToken(int index)
    Get the specific Token.

  - ### generateParseException

    public ParseException generateParseException()
    Generate ParseException.

  - ### enable_tracing

    public final void enable_tracing()
    Enable tracing.

  - ### disable_tracing

    public final void disable_tracing()
    Disable tracing.