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 java.lang.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
ASM, ASM_SEMI, ASMBLOCK, ASMBLOCKB, ASMBLOCKP, ATTRIBUTE, AUTO, 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, OBJC, OBJC_DIGIT, OBJC_IDENTIFIER, OBJC_IGNORE, OBJC_LETTER, OBJC_SEMI, OBJC2, OBJC2_END, OBJC2_IGNORE, OCTAL_LITERAL, PATH_LITERAL, PCLOSE, PCOLON, PCOMMA, PDECIMAL_LITERAL, PDIGIT, PHASH, PHEX_LITERAL, PIDENTIFIER, PINTEGER_LITERAL, PLETTER, POCTAL_LITERAL, POPEN, PRAGMA, PRAGMALINE, PROTOCOL, PSTRING_LITERAL, PTR32, PTR64, QUOTE_C, READABLETO, REGISTER, RESTRICT, RETURN, SHORT, SIGNED, SIZEOF, STATIC, STDCALL, STRING_LITERAL, STRUCT, SWITCH, tokenImage, TYPEDEF, UNION, UNSIGNED, VOID, VOLATILE, W64, WCHAR, 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(java.io.InputStream stream)
Constructor with InputStream.CParser(java.io.InputStream stream, java.lang.String encoding)
Constructor with InputStream and supplied encodingCParser(java.io.Reader stream)
Constructor.
-
Method Summary
-
-
-
Field Detail
-
token_source
public CParserTokenManager token_source
Generated Token Manager.
-
token
public Token token
Current token.
-
jj_nt
public Token jj_nt
Next token.
-
-
Constructor Detail
-
CParser
public CParser()
-
CParser
public CParser(DataTypeManager dtmgr)
-
CParser
public CParser(DataTypeManager dtmgr, boolean storeDataType, DataTypeManager[] subDTMgrs)
-
CParser
public CParser(java.io.InputStream stream)
Constructor with InputStream.
-
CParser
public CParser(java.io.InputStream stream, java.lang.String encoding)
Constructor with InputStream and supplied encoding
-
CParser
public CParser(java.io.Reader stream)
Constructor.
-
CParser
public CParser(CParserTokenManager tm)
Constructor with generated Token Manager.
-
-
Method Detail
-
getDataTypeManager
public DataTypeManager getDataTypeManager()
Get the data type manager- Returns:
-
getLastDataType
public DataType getLastDataType()
- Returns:
- the last data type parsed
-
getDeclarations
public java.util.Map<java.lang.String,DataType> getDeclarations()
Get Global variable declarations- Returns:
-
getEnums
public java.util.Map<java.lang.String,DataType> getEnums()
Get Defined Enumerations- Returns:
- Defined enumeration names
-
getFunctions
public java.util.Map<java.lang.String,DataType> getFunctions()
Get Function signatures- Returns:
- Function signatures
-
getStructs
public java.util.Map<java.lang.String,DataType> getStructs()
Get structure definitions- Returns:
- Structure definitions
-
getTypes
public java.util.Map<java.lang.String,DataType> getTypes()
Get Type definitions- Returns:
- Type definitions
-
parse
public DataType parse(java.lang.String str) throws ParseException
- Throws:
ParseException
-
parse
public void parse(java.io.InputStream fis) throws ParseException
- Throws:
ParseException
-
main
public static void main(java.lang.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() throws ParseException
- Throws:
ParseException
-
AttributeSpecList
public final void AttributeSpecList() throws ParseException
- Throws:
ParseException
-
SubIdent
public final void SubIdent() throws ParseException
- Throws:
ParseException
-
DeclSpec
public final void DeclSpec() throws ParseException
- Throws:
ParseException
-
DeclSpecifier
public final void DeclSpecifier() throws ParseException
- Throws:
ParseException
-
DeclConstant
public final void DeclConstant() 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
-
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 java.util.ArrayList<ghidra.app.util.cparser.C.CParser.EnumMember> EnumeratorList() throws ParseException
- Throws:
ParseException
-
Enumerator
public final int Enumerator(java.util.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 java.util.ArrayList<Declaration> ParameterList() throws ParseException
- Throws:
ParseException
-
ParameterDeclaration
public final void ParameterDeclaration(java.util.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 DataType 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 java.lang.Object Expression() throws ParseException
- Throws:
ParseException
-
AssignmentExpression
public final java.lang.Object AssignmentExpression() throws ParseException
- Throws:
ParseException
-
AssignmentOperator
public final void AssignmentOperator() throws ParseException
- Throws:
ParseException
-
ConditionalExpression
public final java.lang.Object ConditionalExpression() throws ParseException
- Throws:
ParseException
-
ConstantExpression
public final java.lang.Object ConstantExpression() throws ParseException
- Throws:
ParseException
-
LogicalORExpression
public final java.lang.Object LogicalORExpression() throws ParseException
- Throws:
ParseException
-
LogicalANDExpression
public final java.lang.Object LogicalANDExpression() throws ParseException
- Throws:
ParseException
-
InclusiveORExpression
public final java.lang.Object InclusiveORExpression() throws ParseException
- Throws:
ParseException
-
ExclusiveORExpression
public final java.lang.Object ExclusiveORExpression() throws ParseException
- Throws:
ParseException
-
ANDExpression
public final java.lang.Object ANDExpression() throws ParseException
- Throws:
ParseException
-
EqualityExpression
public final java.lang.Object EqualityExpression() throws ParseException
- Throws:
ParseException
-
RelationalExpression
public final java.lang.Object RelationalExpression() throws ParseException
- Throws:
ParseException
-
ShiftExpression
public final java.lang.Object ShiftExpression() throws ParseException
- Throws:
ParseException
-
AdditiveExpression
public final java.lang.Object AdditiveExpression() throws ParseException
- Throws:
ParseException
-
MultiplicativeExpression
public final java.lang.Object MultiplicativeExpression() throws ParseException
- Throws:
ParseException
-
CastExpression
public final java.lang.Object CastExpression() throws ParseException
- Throws:
ParseException
-
UnaryExpression
public final java.lang.Object UnaryExpression() throws ParseException
- Throws:
ParseException
-
UnaryOperator
public final void UnaryOperator() throws ParseException
- Throws:
ParseException
-
PostfixExpression
public final java.lang.Object PostfixExpression() throws ParseException
- Throws:
ParseException
-
PrimaryExpression
public final java.lang.Object PrimaryExpression() throws ParseException
- Throws:
ParseException
-
ArgumentExpressionList
public final void ArgumentExpressionList() throws ParseException
- Throws:
ParseException
-
Constant
public final java.lang.Object Constant() throws ParseException
- Throws:
ParseException
-
ReInit
public void ReInit(java.io.InputStream stream)
Reinitialise.
-
ReInit
public void ReInit(java.io.InputStream stream, java.lang.String encoding)
Reinitialise.
-
ReInit
public void ReInit(java.io.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.
-
-