Package ghidra.app.util.cparser.CPP
Class PreProcessor
- java.lang.Object
-
- ghidra.app.util.cparser.CPP.PreProcessor
-
- All Implemented Interfaces:
PreProcessorConstants
public class PreProcessor extends java.lang.Object implements PreProcessorConstants
-
-
Field Summary
Fields Modifier and Type Field Description Tokenjj_ntNext token.TokentokenCurrent token.PreProcessorTokenManagertoken_sourceGenerated Token Manager.-
Fields inherited from interface ghidra.app.util.cparser.CPP.PreProcessorConstants
__LT, _AND, _BLANKLINE, _CMT, _CMT0, _CMT11, _CMT3, _CMT4, _CMT5, _COD, _COD1, _COD2, _COD3, _COD4, _CODC, _COLON, _COMMENT, _CTRL, _ECMT10, _ECMT3, _ECMT5, _ECMT7, _ECMT8, _ECMT9, _EECMT7, _EECMT9, _EEECMT9, _ENDREL, _EQ, _EQT, _EQT1, _EWSP, _GE, _GT, _HEX, _INCCOD, _INCCP, _INCOP, _INCSTANDARD, _INCWSP, _LCMT, _LCMT0, _LCMT11, _LCMT20, _LCMT21, _LCMT4, _LCMT7, _LE, _LEADIN1, _LEADIN2, _LINECOMMENT, _LOG_AND, _LOG_OR, _LSH, _LT, _MACWSP, _MINUS, _MWSP, _NEQ, _OR, _PLUS, _QMARK, _QTE, _QTE0, _QTE1, _RSH, _TOEOL, _WSP, _WSP_INFO, _WSP0, _WSP1, _WSP2, _WSP3, _WSP4, _WSP5, _WSP6, _WSP7, _WSP8, _XSYM, _XSYMENDL, AND, BEGITEM, CMT, COD, COLON, COMMA, COMMENT, CONLINE, CONSTANT, CONSTITUENT, CONTARG, CP, DECIMAL_LITERAL, DEFAULT, DEFD, DEFINE, DEFINED, DIR, DIRECTIVE, DIRECTIVECOMMENT, DIRLINE, ECMT, EIFLINE, ELIF, ELSE, ENDCMT, ENDIF, ENDITEM, ENDL, ENDREL, EOF, EQ, ERRLINE, ERROR, ERROR_EXPRN, ESTD, EXPATH, EXPONENT, FP_LITERAL, FP_NUMERIC, GE, GT, HASINCLUDE, HASINCLUDENEXT, HEX_DIGIT, HEX_LITERAL, IF, IFDEF, IFDEF_EXPRN, IFDEFED, IFDLINE, IFNDEF, IFNDEF_EXPRN, IFNDEFED, IFNDLINE, IGNORETOEOL, INCDEF, INCLINE, INCLUDE, INFO, INFO_EXPRN, INFOLINE, INTEGER_LITERAL, ITEM, LE, LEADIN3, LINE, LINECOMMENT, LINEINFO, LINLINE, LOG_AND, LOG_OR, LSH, LT, MACEXPPATH, MACROARGS, MACROMV, MACRORV, MACROVALS, MACROVALS_COMMENT, MANIFEST, MCVLINE, MINUS, MOREARG, MOREVAL, MQUOTED_VAL, MQUOTED_VALUE, NEQ, NEWLINE, NOPAR, NOT, NOTCHR, NOTCMT, NOTCMTCOD, NOTENDL, NOTENDLC, NOTENDLSTAR, NOTVALCMT, NOTWQC, NOTWS, NOTWSQ, NOTWSQLT, NOTWWSQLT, NUMERIC, OCTAL_LITERAL, OP, OPTD, OPTIONED, OR, OTHER_TEXT, OUTER_TEXT, PLUS, PRAGMA, PRAGMA_EXPRN, PRGLINE, QMARK, QUOTED_TEXT, QUOTED_VAL, QUOTED_VALUE, REL, RELATIVE, RELPATH, RSH, RVALUES, RVALUES_COMMENT, RVSLINE, STANDARD, STARTCMT, STD, STDPATH, TIMES, tokenImage, UNDEFINE, UNDIR, UNDIRALL, UNDLINE, VALUES, WARNING, WARNING_EXPRN, WARNLINE, WS, WSP, XSYM, XSYMLINK, XSYMLINKPATH, XSYMPATH
-
-
Constructor Summary
Constructors Constructor Description PreProcessor()PreProcessor(PreProcessorTokenManager tm)Constructor with generated Token Manager.PreProcessor(java.io.InputStream stream)Constructor with InputStream.PreProcessor(java.io.InputStream stream, java.lang.String encoding)Constructor with InputStream and supplied encodingPreProcessor(java.io.Reader stream)Constructor.PreProcessor(java.lang.String filename)PreProcessor(java.lang.String[] args)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddIncludePath(java.lang.String path)ghidra.app.util.cparser.CPP.PreProcessor.PPTokenAnd()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenAssertion()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenCompoundAndExpression()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenCompoundConditionalExpression()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenCompoundOrExpression()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenConditionalExpression()booleanControlLine()java.lang.StringcurFileStackTop()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenDefine()voiddisable_tracing()Disable tracing.ghidra.app.util.cparser.CPP.PreProcessor.PPTokenElIf()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenElse()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenElseIfCondition()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenElseMark()voidenable_tracing()Enable tracing.ghidra.app.util.cparser.CPP.PreProcessor.PPTokenEndIf()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenEqualityExpression()PPToken EqualityExpression() : {PPToken t,u,v;} { (t=RelationalExpression() ( LOOKAHEAD(2) u=EqualTo(){ if (verboseLevel()==7) print(u.image); } v=RelationalExpression(){ t.setTruth(t.compareTo(v)==0); if (verboseLevel()==7) print(": "); })* ){return t;} }ghidra.app.util.cparser.CPP.PreProcessor.PPTokenEqualTo()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenError()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenExpression()ParseExceptiongenerateParseException()Generate ParseException.ghidra.app.util.cparser.CPP.PreProcessor.PPTokengetDef(ghidra.app.util.cparser.CPP.PreProcessor.PPToken def)DefineTablegetDefinitions()java.lang.DoublegetDoubleValue(java.lang.String val)TokengetNextToken()Get the next Token.intgetNumericType(java.lang.String val)TokengetToken(int index)Get the specific Token.ghidra.app.util.cparser.CPP.PreProcessor.PPTokenGreaterThan()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenGreaterThanExpression()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenGreaterThanOrEqual()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenGreaterThanOrEqualExpression()booleanGroup()booleanGroupPart()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenIf()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenIfCondition()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenIfDef()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenIfDefExpr()booleanIFGroup()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenIfNDef()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenIfNDefExpr()booleanIFSection()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenInclude()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenInEqualityExpression()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenInfo()voidInput()booleanisArg(ghidra.app.util.cparser.CPP.PreProcessor.PPToken arg)booleanisDef(ghidra.app.util.cparser.CPP.PreProcessor.PPToken def)ghidra.app.util.cparser.CPP.PreProcessor.PPTokenLessExpression()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenLessThan()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenLessThanOrEqual()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenLessThanOrEqualExpression()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenLineInfo()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenLogicalAndExpression()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenLogicalOrExpression()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenLogNegation()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenMacroArgs()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenMacroVals()static voidmain(java.lang.String[] args)ghidra.app.util.cparser.CPP.PreProcessor.PPTokenNegation()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenNewLines()voidNoMas()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenNotEqualTo()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenOr()voidparse(java.lang.String filename)ghidra.app.util.cparser.CPP.PreProcessor.PPTokenPragma()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenQmark()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenQuotedText()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenQuotedValue()voidReInit(PreProcessorTokenManager tm)Reinitialise.voidReInit(java.io.InputStream stream)Reinitialise.voidReInit(java.io.InputStream stream, java.lang.String encoding)Reinitialise.voidReInit(java.io.Reader stream)Reinitialise.ghidra.app.util.cparser.CPP.PreProcessor.PPTokenRelationalExpression()voidsetArgs(java.lang.String[] args)voidsetOutputStream(java.io.OutputStream fos)ghidra.app.util.cparser.CPP.PreProcessor.PPTokenSubtractFrom()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenText()booleanTranslationUnit()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenUnDef()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenValueExpression()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenValues()intverboseLevel()ghidra.app.util.cparser.CPP.PreProcessor.PPTokenWarning()
-
-
-
Field Detail
-
token_source
public PreProcessorTokenManager token_source
Generated Token Manager.
-
token
public Token token
Current token.
-
jj_nt
public Token jj_nt
Next token.
-
-
Constructor Detail
-
PreProcessor
public PreProcessor(java.lang.String[] args) throws ParseException- Throws:
ParseException
-
PreProcessor
public PreProcessor(java.lang.String filename) throws ParseException- Throws:
ParseException
-
PreProcessor
public PreProcessor() throws ParseException- Throws:
ParseException
-
PreProcessor
public PreProcessor(java.io.InputStream stream)
Constructor with InputStream.
-
PreProcessor
public PreProcessor(java.io.InputStream stream, java.lang.String encoding)Constructor with InputStream and supplied encoding
-
PreProcessor
public PreProcessor(java.io.Reader stream)
Constructor.
-
PreProcessor
public PreProcessor(PreProcessorTokenManager tm)
Constructor with generated Token Manager.
-
-
Method Detail
-
verboseLevel
public int verboseLevel()
-
curFileStackTop
public java.lang.String curFileStackTop()
-
getDefinitions
public DefineTable getDefinitions()
-
getDef
public ghidra.app.util.cparser.CPP.PreProcessor.PPToken getDef(ghidra.app.util.cparser.CPP.PreProcessor.PPToken def)
-
isDef
public boolean isDef(ghidra.app.util.cparser.CPP.PreProcessor.PPToken def)
-
isArg
public boolean isArg(ghidra.app.util.cparser.CPP.PreProcessor.PPToken arg)
-
addIncludePath
public void addIncludePath(java.lang.String path)
-
getNumericType
public int getNumericType(java.lang.String val)
-
getDoubleValue
public java.lang.Double getDoubleValue(java.lang.String val)
-
setArgs
public void setArgs(java.lang.String[] args) throws ParseException- Throws:
ParseException
-
setOutputStream
public void setOutputStream(java.io.OutputStream fos)
-
parse
public void parse(java.lang.String filename)
-
main
public static void main(java.lang.String[] args)
-
Input
public final void Input() throws ParseException- Throws:
ParseException
-
TranslationUnit
public final boolean TranslationUnit() throws ParseException- Throws:
ParseException
-
NoMas
public final void NoMas() throws ParseException- Throws:
ParseException
-
Group
public final boolean Group() throws ParseException- Throws:
ParseException
-
GroupPart
public final boolean GroupPart() throws ParseException- Throws:
ParseException
-
ControlLine
public final boolean ControlLine() throws ParseException- Throws:
ParseException
-
IFSection
public final boolean IFSection() throws ParseException- Throws:
ParseException
-
IFGroup
public final boolean IFGroup() throws ParseException- Throws:
ParseException
-
IfCondition
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken IfCondition() throws ParseException- Throws:
ParseException
-
ElseIfCondition
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken ElseIfCondition() throws ParseException- Throws:
ParseException
-
Include
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Include() throws ParseException- Throws:
ParseException
-
LineInfo
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken LineInfo() throws ParseException- Throws:
ParseException
-
Define
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Define() throws ParseException- Throws:
ParseException
-
UnDef
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken UnDef() throws ParseException- Throws:
ParseException
-
MacroArgs
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken MacroArgs() throws ParseException- Throws:
ParseException
-
MacroVals
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken MacroVals() throws ParseException- Throws:
ParseException
-
Pragma
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Pragma() throws ParseException- Throws:
ParseException
-
IfDef
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken IfDef() throws ParseException- Throws:
ParseException
-
IfDefExpr
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken IfDefExpr() throws ParseException- Throws:
ParseException
-
IfNDef
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken IfNDef() throws ParseException- Throws:
ParseException
-
IfNDefExpr
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken IfNDefExpr() throws ParseException- Throws:
ParseException
-
Error
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Error() throws ParseException- Throws:
ParseException
-
Warning
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Warning() throws ParseException- Throws:
ParseException
-
Info
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Info() throws ParseException- Throws:
ParseException
-
EndIf
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken EndIf() throws ParseException- Throws:
ParseException
-
Else
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Else() throws ParseException- Throws:
ParseException
-
If
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken If() throws ParseException- Throws:
ParseException
-
ElIf
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken ElIf() throws ParseException- Throws:
ParseException
-
Values
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Values() throws ParseException- Throws:
ParseException
-
QuotedValue
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken QuotedValue() throws ParseException- Throws:
ParseException
-
Text
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Text() throws ParseException- Throws:
ParseException
-
NewLines
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken NewLines() throws ParseException- Throws:
ParseException
-
QuotedText
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken QuotedText() throws ParseException- Throws:
ParseException
-
CompoundConditionalExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken CompoundConditionalExpression() throws ParseException- Throws:
ParseException
-
CompoundAndExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken CompoundAndExpression() throws ParseException- Throws:
ParseException
-
CompoundOrExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken CompoundOrExpression() throws ParseException- Throws:
ParseException
-
ConditionalExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken ConditionalExpression() throws ParseException- Throws:
ParseException
-
LogicalOrExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken LogicalOrExpression() throws ParseException- Throws:
ParseException
-
LogicalAndExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken LogicalAndExpression() throws ParseException- Throws:
ParseException
-
EqualityExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken EqualityExpression() throws ParseExceptionPPToken EqualityExpression() : {PPToken t,u,v;} { (t=RelationalExpression() ( LOOKAHEAD(2) u=EqualTo(){ if (verboseLevel()==7) print(u.image); } v=RelationalExpression(){ t.setTruth(t.compareTo(v)==0); if (verboseLevel()==7) print(": "); })* ){return t;} }- Throws:
ParseException
-
InEqualityExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken InEqualityExpression() throws ParseException- Throws:
ParseException
-
RelationalExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken RelationalExpression() throws ParseException- Throws:
ParseException
-
GreaterThanExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken GreaterThanExpression() throws ParseException- Throws:
ParseException
-
GreaterThanOrEqualExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken GreaterThanOrEqualExpression() throws ParseException- Throws:
ParseException
-
LessThanOrEqualExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken LessThanOrEqualExpression() throws ParseException- Throws:
ParseException
-
LessExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken LessExpression() throws ParseException- Throws:
ParseException
-
Or
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Or() throws ParseException- Throws:
ParseException
-
And
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken And() throws ParseException- Throws:
ParseException
-
EqualTo
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken EqualTo() throws ParseException- Throws:
ParseException
-
NotEqualTo
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken NotEqualTo() throws ParseException- Throws:
ParseException
-
LessThan
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken LessThan() throws ParseException- Throws:
ParseException
-
LessThanOrEqual
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken LessThanOrEqual() throws ParseException- Throws:
ParseException
-
GreaterThan
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken GreaterThan() throws ParseException- Throws:
ParseException
-
GreaterThanOrEqual
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken GreaterThanOrEqual() throws ParseException- Throws:
ParseException
-
Qmark
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Qmark() throws ParseException- Throws:
ParseException
-
ElseMark
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken ElseMark() throws ParseException- Throws:
ParseException
-
LogNegation
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken LogNegation() throws ParseException- Throws:
ParseException
-
Negation
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Negation() throws ParseException- Throws:
ParseException
-
Assertion
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Assertion() throws ParseException- Throws:
ParseException
-
Expression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken Expression() throws ParseException- Throws:
ParseException
-
SubtractFrom
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken SubtractFrom() throws ParseException- Throws:
ParseException
-
ValueExpression
public final ghidra.app.util.cparser.CPP.PreProcessor.PPToken ValueExpression() 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(PreProcessorTokenManager 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.
-
-