Package com.jogamp.gluegen.cgram
Class HeaderParser
- java.lang.Object
-
- antlr.TreeParser
-
- com.jogamp.gluegen.cgram.HeaderParser
-
- All Implemented Interfaces:
HeaderParserTokenTypes
public class HeaderParser extends antlr.TreeParser implements HeaderParserTokenTypes
-
-
Field Summary
Fields Modifier and Type Field Description static String[]_tokenNamesstatic BitSet_tokenSet_0static BitSet_tokenSet_1static BitSet_tokenSet_2static BitSet_tokenSet_3static BitSet_tokenSet_4static StringANONYMOUS_ENUM_NAMEName assigned to a anonymous EnumType (e.g., "enum { ...-
Fields inherited from interface com.jogamp.gluegen.cgram.HeaderParserTokenTypes
ASSIGN, BadStringLiteral, BAND, BAND_ASSIGN, BNOT, BOR, BOR_ASSIGN, BXOR, BXOR_ASSIGN, CharLiteral, COLON, COMMA, Comment, CPPComment, DEC, DefineExpr, DefineExpr2, Digit, DIV, DIV_ASSIGN, DOT, DoubleDoubleConst, EOF, EQUAL, Escape, Exponent, FloatDoubleConst, FloatSuffix, GT, GTE, ID, INC, IntHexConst, IntIntConst, IntOctalConst, LAND, LBRACKET, LCURLY, LineDirective, LITERAL___alignof, LITERAL___attribute, LITERAL___complex, LITERAL___imag, LITERAL___label__, LITERAL___real, LITERAL_asm, LITERAL_auto, LITERAL_break, LITERAL_case, LITERAL_char, LITERAL_const, LITERAL_continue, LITERAL_default, LITERAL_do, LITERAL_double, LITERAL_else, LITERAL_enum, LITERAL_extern, LITERAL_float, LITERAL_for, LITERAL_goto, LITERAL_if, LITERAL_inline, LITERAL_int, LITERAL_intptr_t, LITERAL_long, LITERAL_ptrdiff_t, LITERAL_register, LITERAL_return, LITERAL_short, LITERAL_signed, LITERAL_size_t, LITERAL_sizeof, LITERAL_static, LITERAL_struct, LITERAL_switch, LITERAL_typedef, LITERAL_typeof, LITERAL_uintptr_t, LITERAL_union, LITERAL_unsigned, LITERAL_void, LITERAL_volatile, LITERAL_wchar_t, LITERAL_while, LNOT, LongDoubleConst, LongHexConst, LongIntConst, LongOctalConst, LongSuffix, LOR, LPAREN, LSHIFT, LSHIFT_ASSIGN, LT, LTE, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NAsmAttribute, NCast, NCommaExpr, NCompoundStatement, NDeclaration, NDeclarator, NEmptyExpression, NExpressionGroup, NFunctionCallArgs, NFunctionDef, NGnuAsmExpr, NInitDecl, NInitializer, NInitializerElementLabel, NLabel, NLcurlyInitializer, NNonemptyAbstractDeclarator, NonWhitespace, NOT_EQUAL, NParameterDeclaration, NParameterTypeList, NPointerGroup, NPostfixExpr, NRangeExpr, NStatementExpr, NStringSeq, NStructDeclarator, NTypedefName, NTypeMissing, NULL_TREE_LOOKAHEAD, Number, NUnaryExpr, PLUS, PLUS_ASSIGN, PREPROC_DIRECTIVE, PTR, QUESTION, RBRACKET, RCURLY, RPAREN, RSHIFT, RSHIFT_ASSIGN, SEMI, Space, STAR, STAR_ASSIGN, StringLiteral, UnsignedHexConst, UnsignedIntConst, UnsignedOctalConst, UnsignedSuffix, VARARGS, Vocabulary, Whitespace
-
-
Constructor Summary
Constructors Constructor Description HeaderParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadditiveExpr(AST _t)voidargExprList(AST _t)voidasm_expr(AST _t)voidassignExpr(AST _t)voidattributeDecl(AST _t)voidbitAndExpr(AST _t)voidcastExpr(AST _t)protected voidcharConst(AST _t)voidclearParsedFunctions()Clears the list of functions this HeaderParser has parsed.voidcommaExpr(AST _t)voidcompoundStatement(AST _t)voidcompoundStatementExpr(AST _t)voidconditionalExpr(AST _t)voiddeclaration(AST _t)voiddeclarationList(AST _t)Stringdeclarator(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb)com.jogamp.gluegen.cgram.HeaderParser.TypeBoxdeclSpecifiers(AST _t)voidemptyExpr(AST _t)ConstantDefinitionenumerator(AST _t, EnumType enumeration, ConstantDefinition defaultValue)voidenumList(AST _t, EnumType enumeration)TypeenumSpecifier(AST _t, int cvAttrs)voidequalityExpr(AST _t)voidexclusiveOrExpr(AST _t)voidexpr(AST _t)voidexternalDef(AST _t)voidexternalList(AST _t)protected voidfloatConst(AST _t)voidfunctionDeclSpecifiers(AST _t)voidfunctionDef(AST _t)intfunctionStorageClassSpecifier(AST _t)MapgetCanonMap()Get the canonicalization map, which is a regular HashMap mapping Type to Type and which is used for looking up the unique instances of e.g.booleangetDebug()List<EnumType>getEnums()Returns the EnumTypes this HeaderParser processed.List<FunctionSymbol>getParsedFunctions()Returns the list of FunctionSymbols this HeaderParser has parsed.TypeDictionarygetStructDictionary()Returns the struct name dictionary this HeaderParser uses.TypeDictionarygetTypedefDictionary()Returns the typedef dictionary this HeaderParser uses.voidgnuAsmExpr(AST _t)voididList(AST _t)voidinclusiveOrExpr(AST _t)voidinitDecl(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb)voidinitDeclList(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb)voidinitializer(AST _t)voidinitializerElementLabel(AST _t)voidinitializerList(AST _t)protected voidintConst(AST _t)intintConstExpr(AST _t)voidlcurlyInitializer(AST _t)voidlocalLabelDecl(AST _t)voidlogicalAndExpr(AST _t)voidlogicalOrExpr(AST _t)voidmultExpr(AST _t)voidnonemptyAbstractDeclarator(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb)com.jogamp.gluegen.cgram.HeaderParser.ParameterDeclarationparameterDeclaration(AST _t)List<com.jogamp.gluegen.cgram.HeaderParser.ParameterDeclaration>parameterTypeList(AST _t)voidpointerGroup(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb)voidpostfixExpr(AST _t)voidprimaryExpr(AST _t)voidrangeExpr(AST _t)voidrelationalExpr(AST _t)voidsetDebug(boolean debug)voidsetEnums(List<EnumType> enumTypes)Pre-define the list of EnumTypes for this HeaderParser.voidsetJavaConfiguration(JavaConfiguration cfg)Set the configuration for this HeaderParser.voidsetStructDictionary(TypeDictionary dict)Set the dictionary mapping struct names (i.e., the "foo" in "struct foo { ...voidsetTypedefDictionary(TypeDictionary dict)Set the dictionary mapping typedef names to types for this HeaderParser.voidshiftExpr(AST _t)TypespecifierQualifierList(AST _t)voidstatement(AST _t)voidstatementBody(AST _t)voidstatementList(AST _t)intstorageClassSpecifier(AST _t)protected voidstringConst(AST _t)voidstrOptExprPair(AST _t)booleanstructDeclaration(AST _t, CompoundType containingType)booleanstructDeclarationList(AST _t, CompoundType t)booleanstructDeclarator(AST _t, CompoundType containingType, Type t)booleanstructDeclaratorList(AST _t, CompoundType containingType, Type t)CompoundTypestructOrUnionBody(AST _t, CompoundTypeKind kind, int cvAttrs)TypestructSpecifier(AST _t, int cvAttrs)voidtranslationUnit(AST _t)TypetypedefName(AST _t, int cvAttrs)voidtypelessDeclaration(AST _t)voidtypeName(AST _t)inttypeQualifier(AST _t)TypetypeSpecifier(AST _t, int attributes)voidunaryExpr(AST _t)voidunaryOperator(AST _t)TypeunionSpecifier(AST _t, int cvAttrs)
-
-
-
Field Detail
-
ANONYMOUS_ENUM_NAME
public static final String ANONYMOUS_ENUM_NAME
Name assigned to a anonymous EnumType (e.g., "enum { ... }").- See Also:
- Constant Field Values
-
_tokenNames
public static final String[] _tokenNames
-
_tokenSet_0
public static final BitSet _tokenSet_0
-
_tokenSet_1
public static final BitSet _tokenSet_1
-
_tokenSet_2
public static final BitSet _tokenSet_2
-
_tokenSet_3
public static final BitSet _tokenSet_3
-
_tokenSet_4
public static final BitSet _tokenSet_4
-
-
Method Detail
-
getDebug
public boolean getDebug()
-
setDebug
public void setDebug(boolean debug)
-
setJavaConfiguration
public void setJavaConfiguration(JavaConfiguration cfg)
Set the configuration for this HeaderParser. Must be done before parsing.
-
setTypedefDictionary
public void setTypedefDictionary(TypeDictionary dict)
Set the dictionary mapping typedef names to types for this HeaderParser. Must be done before parsing.
-
getTypedefDictionary
public TypeDictionary getTypedefDictionary()
Returns the typedef dictionary this HeaderParser uses.
-
setStructDictionary
public void setStructDictionary(TypeDictionary dict)
Set the dictionary mapping struct names (i.e., the "foo" in "struct foo { ... };") to types for this HeaderParser. Must be done before parsing.
-
getStructDictionary
public TypeDictionary getStructDictionary()
Returns the struct name dictionary this HeaderParser uses.
-
getCanonMap
public Map getCanonMap()
Get the canonicalization map, which is a regular HashMap mapping Type to Type and which is used for looking up the unique instances of e.g. pointer-to-structure types that have been typedefed and therefore have names.
-
setEnums
public void setEnums(List<EnumType> enumTypes)
Pre-define the list of EnumTypes for this HeaderParser. Must be done before parsing.
-
clearParsedFunctions
public void clearParsedFunctions()
Clears the list of functions this HeaderParser has parsed. Useful when reusing the same HeaderParser for more than one header file.
-
getParsedFunctions
public List<FunctionSymbol> getParsedFunctions()
Returns the list of FunctionSymbols this HeaderParser has parsed.
-
declarator
public final String declarator(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb) throws RecognitionException
- Throws:
RecognitionException
-
pointerGroup
public final void pointerGroup(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb) throws RecognitionException- Throws:
RecognitionException
-
parameterTypeList
public final List<com.jogamp.gluegen.cgram.HeaderParser.ParameterDeclaration> parameterTypeList(AST _t) throws RecognitionException
- Throws:
RecognitionException
-
idList
public final void idList(AST _t) throws RecognitionException- Throws:
RecognitionException
-
expr
public final void expr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
typelessDeclaration
public final void typelessDeclaration(AST _t) throws RecognitionException- Throws:
RecognitionException
-
initDeclList
public final void initDeclList(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb) throws RecognitionException- Throws:
RecognitionException
-
declaration
public final void declaration(AST _t) throws RecognitionException- Throws:
RecognitionException
-
declSpecifiers
public final com.jogamp.gluegen.cgram.HeaderParser.TypeBox declSpecifiers(AST _t) throws RecognitionException- Throws:
RecognitionException
-
parameterDeclaration
public final com.jogamp.gluegen.cgram.HeaderParser.ParameterDeclaration parameterDeclaration(AST _t) throws RecognitionException- Throws:
RecognitionException
-
nonemptyAbstractDeclarator
public final void nonemptyAbstractDeclarator(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb) throws RecognitionException- Throws:
RecognitionException
-
functionDef
public final void functionDef(AST _t) throws RecognitionException- Throws:
RecognitionException
-
functionDeclSpecifiers
public final void functionDeclSpecifiers(AST _t) throws RecognitionException- Throws:
RecognitionException
-
compoundStatement
public final void compoundStatement(AST _t) throws RecognitionException- Throws:
RecognitionException
-
storageClassSpecifier
public final int storageClassSpecifier(AST _t) throws RecognitionException- Throws:
RecognitionException
-
typeQualifier
public final int typeQualifier(AST _t) throws RecognitionException- Throws:
RecognitionException
-
typeSpecifier
public final Type typeSpecifier(AST _t, int attributes) throws RecognitionException
- Throws:
RecognitionException
-
functionStorageClassSpecifier
public final int functionStorageClassSpecifier(AST _t) throws RecognitionException- Throws:
RecognitionException
-
structSpecifier
public final Type structSpecifier(AST _t, int cvAttrs) throws RecognitionException
- Throws:
RecognitionException
-
attributeDecl
public final void attributeDecl(AST _t) throws RecognitionException- Throws:
RecognitionException
-
unionSpecifier
public final Type unionSpecifier(AST _t, int cvAttrs) throws RecognitionException
- Throws:
RecognitionException
-
enumSpecifier
public final Type enumSpecifier(AST _t, int cvAttrs) throws RecognitionException
- Throws:
RecognitionException
-
typedefName
public final Type typedefName(AST _t, int cvAttrs) throws RecognitionException
- Throws:
RecognitionException
-
typeName
public final void typeName(AST _t) throws RecognitionException- Throws:
RecognitionException
-
structOrUnionBody
public final CompoundType structOrUnionBody(AST _t, CompoundTypeKind kind, int cvAttrs) throws RecognitionException
- Throws:
RecognitionException
-
structDeclarationList
public final boolean structDeclarationList(AST _t, CompoundType t) throws RecognitionException- Throws:
RecognitionException
-
structDeclaration
public final boolean structDeclaration(AST _t, CompoundType containingType) throws RecognitionException- Throws:
RecognitionException
-
specifierQualifierList
public final Type specifierQualifierList(AST _t) throws RecognitionException
- Throws:
RecognitionException
-
structDeclaratorList
public final boolean structDeclaratorList(AST _t, CompoundType containingType, Type t) throws RecognitionException- Throws:
RecognitionException
-
structDeclarator
public final boolean structDeclarator(AST _t, CompoundType containingType, Type t) throws RecognitionException- Throws:
RecognitionException
-
enumList
public final void enumList(AST _t, EnumType enumeration) throws RecognitionException- Throws:
RecognitionException
-
enumerator
public final ConstantDefinition enumerator(AST _t, EnumType enumeration, ConstantDefinition defaultValue) throws RecognitionException
- Throws:
RecognitionException
-
initDecl
public final void initDecl(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb) throws RecognitionException- Throws:
RecognitionException
-
initializer
public final void initializer(AST _t) throws RecognitionException- Throws:
RecognitionException
-
intConstExpr
public final int intConstExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
translationUnit
public final void translationUnit(AST _t) throws RecognitionException- Throws:
RecognitionException
-
externalList
public final void externalList(AST _t) throws RecognitionException- Throws:
RecognitionException
-
externalDef
public final void externalDef(AST _t) throws RecognitionException- Throws:
RecognitionException
-
asm_expr
public final void asm_expr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
initializerElementLabel
public final void initializerElementLabel(AST _t) throws RecognitionException- Throws:
RecognitionException
-
lcurlyInitializer
public final void lcurlyInitializer(AST _t) throws RecognitionException- Throws:
RecognitionException
-
initializerList
public final void initializerList(AST _t) throws RecognitionException- Throws:
RecognitionException
-
declarationList
public final void declarationList(AST _t) throws RecognitionException- Throws:
RecognitionException
-
localLabelDecl
public final void localLabelDecl(AST _t) throws RecognitionException- Throws:
RecognitionException
-
statementList
public final void statementList(AST _t) throws RecognitionException- Throws:
RecognitionException
-
statement
public final void statement(AST _t) throws RecognitionException- Throws:
RecognitionException
-
statementBody
public final void statementBody(AST _t) throws RecognitionException- Throws:
RecognitionException
-
assignExpr
public final void assignExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
conditionalExpr
public final void conditionalExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
logicalOrExpr
public final void logicalOrExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
logicalAndExpr
public final void logicalAndExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
inclusiveOrExpr
public final void inclusiveOrExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
exclusiveOrExpr
public final void exclusiveOrExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
bitAndExpr
public final void bitAndExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
equalityExpr
public final void equalityExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
relationalExpr
public final void relationalExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
shiftExpr
public final void shiftExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
additiveExpr
public final void additiveExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
multExpr
public final void multExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
castExpr
public final void castExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
unaryExpr
public final void unaryExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
postfixExpr
public final void postfixExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
primaryExpr
public final void primaryExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
commaExpr
public final void commaExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
emptyExpr
public final void emptyExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
compoundStatementExpr
public final void compoundStatementExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
rangeExpr
public final void rangeExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
gnuAsmExpr
public final void gnuAsmExpr(AST _t) throws RecognitionException- Throws:
RecognitionException
-
stringConst
protected final void stringConst(AST _t) throws RecognitionException- Throws:
RecognitionException
-
strOptExprPair
public final void strOptExprPair(AST _t) throws RecognitionException- Throws:
RecognitionException
-
unaryOperator
public final void unaryOperator(AST _t) throws RecognitionException- Throws:
RecognitionException
-
argExprList
public final void argExprList(AST _t) throws RecognitionException- Throws:
RecognitionException
-
charConst
protected final void charConst(AST _t) throws RecognitionException- Throws:
RecognitionException
-
intConst
protected final void intConst(AST _t) throws RecognitionException- Throws:
RecognitionException
-
floatConst
protected final void floatConst(AST _t) throws RecognitionException- Throws:
RecognitionException
-
-