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[]
_tokenNames
static BitSet
_tokenSet_0
static BitSet
_tokenSet_1
static BitSet
_tokenSet_2
static BitSet
_tokenSet_3
static BitSet
_tokenSet_4
static String
ANONYMOUS_ENUM_NAME
Name 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 void
additiveExpr(AST _t)
void
argExprList(AST _t)
void
asm_expr(AST _t)
void
assignExpr(AST _t)
void
attributeDecl(AST _t)
void
bitAndExpr(AST _t)
void
castExpr(AST _t)
protected void
charConst(AST _t)
void
clearParsedFunctions()
Clears the list of functions this HeaderParser has parsed.void
commaExpr(AST _t)
void
compoundStatement(AST _t)
void
compoundStatementExpr(AST _t)
void
conditionalExpr(AST _t)
void
declaration(AST _t)
void
declarationList(AST _t)
String
declarator(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb)
com.jogamp.gluegen.cgram.HeaderParser.TypeBox
declSpecifiers(AST _t)
void
emptyExpr(AST _t)
ConstantDefinition
enumerator(AST _t, EnumType enumeration, ConstantDefinition defaultValue)
void
enumList(AST _t, EnumType enumeration)
Type
enumSpecifier(AST _t, int cvAttrs)
void
equalityExpr(AST _t)
void
exclusiveOrExpr(AST _t)
void
expr(AST _t)
void
externalDef(AST _t)
void
externalList(AST _t)
protected void
floatConst(AST _t)
void
functionDeclSpecifiers(AST _t)
void
functionDef(AST _t)
int
functionStorageClassSpecifier(AST _t)
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.boolean
getDebug()
List<EnumType>
getEnums()
Returns the EnumTypes this HeaderParser processed.List<FunctionSymbol>
getParsedFunctions()
Returns the list of FunctionSymbols this HeaderParser has parsed.TypeDictionary
getStructDictionary()
Returns the struct name dictionary this HeaderParser uses.TypeDictionary
getTypedefDictionary()
Returns the typedef dictionary this HeaderParser uses.void
gnuAsmExpr(AST _t)
void
idList(AST _t)
void
inclusiveOrExpr(AST _t)
void
initDecl(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb)
void
initDeclList(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb)
void
initializer(AST _t)
void
initializerElementLabel(AST _t)
void
initializerList(AST _t)
protected void
intConst(AST _t)
int
intConstExpr(AST _t)
void
lcurlyInitializer(AST _t)
void
localLabelDecl(AST _t)
void
logicalAndExpr(AST _t)
void
logicalOrExpr(AST _t)
void
multExpr(AST _t)
void
nonemptyAbstractDeclarator(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb)
com.jogamp.gluegen.cgram.HeaderParser.ParameterDeclaration
parameterDeclaration(AST _t)
List<com.jogamp.gluegen.cgram.HeaderParser.ParameterDeclaration>
parameterTypeList(AST _t)
void
pointerGroup(AST _t, com.jogamp.gluegen.cgram.HeaderParser.TypeBox tb)
void
postfixExpr(AST _t)
void
primaryExpr(AST _t)
void
rangeExpr(AST _t)
void
relationalExpr(AST _t)
void
setDebug(boolean debug)
void
setEnums(List<EnumType> enumTypes)
Pre-define the list of EnumTypes for this HeaderParser.void
setJavaConfiguration(JavaConfiguration cfg)
Set the configuration for this HeaderParser.void
setStructDictionary(TypeDictionary dict)
Set the dictionary mapping struct names (i.e., the "foo" in "struct foo { ...void
setTypedefDictionary(TypeDictionary dict)
Set the dictionary mapping typedef names to types for this HeaderParser.void
shiftExpr(AST _t)
Type
specifierQualifierList(AST _t)
void
statement(AST _t)
void
statementBody(AST _t)
void
statementList(AST _t)
int
storageClassSpecifier(AST _t)
protected void
stringConst(AST _t)
void
strOptExprPair(AST _t)
boolean
structDeclaration(AST _t, CompoundType containingType)
boolean
structDeclarationList(AST _t, CompoundType t)
boolean
structDeclarator(AST _t, CompoundType containingType, Type t)
boolean
structDeclaratorList(AST _t, CompoundType containingType, Type t)
CompoundType
structOrUnionBody(AST _t, CompoundTypeKind kind, int cvAttrs)
Type
structSpecifier(AST _t, int cvAttrs)
void
translationUnit(AST _t)
Type
typedefName(AST _t, int cvAttrs)
void
typelessDeclaration(AST _t)
void
typeName(AST _t)
int
typeQualifier(AST _t)
Type
typeSpecifier(AST _t, int attributes)
void
unaryExpr(AST _t)
void
unaryOperator(AST _t)
Type
unionSpecifier(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
-
-