public abstract class ParserBase extends Object implements IParserPart
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_bDontOptimizeStatementLists |
protected int |
_offsetShift |
| Constructor and Description |
|---|
ParserBase() |
ParserBase(GosuParser owner) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBlockToBlockStack(BlockExpression block) |
protected void |
captureAllSymbols(ICompilableTypeInternal anonClass,
ICompilableTypeInternal enclosingClass,
List<ICapturedSymbol> capturedSymbols) |
protected ISymbol |
captureSymbol(ICompilableTypeInternal anonClass,
String strName,
ParsedElement e) |
protected void |
copyBlockStackTo(ParserBase otherParser) |
Token |
eatBlock(char cBegin,
char cEnd,
boolean bOperator) |
Token |
eatBlock(char cBegin,
char cEnd,
boolean bOperator,
boolean bStopAtDeclarationKeyword) |
protected void |
eatOptionalSemiColon(boolean bEat) |
void |
eatTypeLiteral() |
ParseTree |
findAndWrapLocation(Expression oldExpr,
ParsedElement newExpr) |
static IMethodInfo |
findMathOpMethod(IType lhsType,
int op,
IType rhsType) |
protected ICompilableTypeInternal |
getCurrentEnclosingGosuClass() |
List<IType> |
getCurrentlyInferringFunctionTypeVars() |
int |
getLineNumShift() |
int |
getOffsetShift() |
GosuParser |
getOwner() |
protected IGosuClassInternal |
getParsingAnonymousClass() |
protected abstract String |
getScript() |
protected ISymbol |
getUncapturedSymbol(ICompilableType gsClass,
String strName) |
IGosuValidator |
getValidator() |
boolean |
isDontOptimizeStatementLists() |
protected boolean |
isEvalClass() |
boolean |
isParsingBlock() |
protected boolean |
match(Token T,
int iType)
Possibly matches the specified token type.
|
protected boolean |
match(Token T,
Keyword token) |
protected boolean |
match(Token T,
String token)
Possibly matches the specified string token value.
|
boolean |
match(Token T,
String token,
int iType)
Possibly matches the specified token or name (in token).
|
boolean |
match(Token T,
String token,
int iType,
boolean bPeek)
Possibly matches the specified token or name (in token).
|
static boolean |
matchDeclarationKeyword(String[] ret,
boolean bPeek,
SourceCodeTokenizer tokenizer) |
protected void |
parseAnnotation(List<IGosuAnnotation> annotations) |
String |
parseDotPathWord(String t)
Parse a dot separated path as a single logical token
|
protected Expression |
peekExpression() |
protected List<IType> |
peekInferringFunctionTypeVariableTypes() |
protected Statement |
peekStatement() |
protected Expression |
popExpression() |
protected List<IType> |
popInferringFunctionTypeVariableTypes() |
protected Statement |
popStatement() |
protected Expression |
possiblyWrapWithCoercion(Expression expressionToCoerce,
IType typeToCoerceTo,
boolean bImplicit) |
protected Expression |
possiblyWrapWithImplicitCoercion(Expression expressionToCoerce,
IType typeToCoerceTo) |
void |
pushCurrentBlock(BlockExpression block) |
protected void |
pushExpression(Expression e) |
protected void |
pushInferringFunctionTypeVars(List<IType> typeVariableTypes) |
protected void |
pushStatement(Statement stmt) |
protected INamespaceType |
resolveNamespace(String strName) |
protected ISymbol |
resolveNamespaceSymbol(ParsedElement e,
String strName) |
static IType |
resolveRuntimeType(ArithmeticExpression expr,
IType lhsType,
int op,
IType rhsType) |
protected ISymbol |
resolveSymbol(ParsedElement e,
String strName,
boolean ignoreFunctionSymbols) |
static IType |
resolveType(IType lhsType,
int op,
IType rhsType) |
protected IType |
resolveType(ParsedElement parsedElement,
IType lhsType,
int op,
IType rhsType) |
protected IType |
resolveTypeForArithmeticExpression(ParsedElement parsedElement,
IType lhsType,
String op,
IType rhsType) |
void |
setBlocks(Stack<BlockExpression> blocks) |
void |
setDontOptimizeStatementLists(boolean dontOptimizeStatementLists) |
void |
setIgnoreWarnings(Set<ResourceKey> msgKeys) |
void |
setLineNumShift(int lineNumShift) |
protected void |
setLocationForImplicitTypeAs(Expression expressionToCoerce,
TypeAsExpression tas) |
protected void |
setOffsetShift(int offsetShift) |
protected void |
setOwner(GosuParser owner) |
void |
setSnapshotSymbols() |
void |
setSubTree(List<IParseTree> subTree) |
void |
setValidator(IGosuValidator validator) |
boolean |
shouldSnapshotSymbols() |
protected void |
verifyComparable(IType lhsType,
Expression rhs) |
protected void |
verifyComparable(IType lhsType,
Expression rhs,
boolean bBiDirectional,
boolean bErrorIfCoercion) |
protected void |
verifyComparable(IType lhsType,
Expression rhs,
boolean bBiDirectional,
boolean bErrorIfCoercion,
IParserState state) |
protected void |
verifyModifiersForFeature(IParsedElement pe,
ModifierInfo modInfo) |
void |
verifyNonVoidExpression(Expression eas) |
protected void |
verifyParsedElement(IParsedElement element) |
protected void |
verifyParsedElement(IParsedElement element,
boolean bThrowOnWarnings) |
protected IType |
verifyTypesComparable(ParsedElement element,
IType lhsType,
IType rhsType,
boolean bBiDirectional,
boolean bErrorIfCoercion) |
protected IType |
verifyTypesComparable(ParsedElement element,
IType lhsType,
IType rhsType,
boolean bBiDirectional,
boolean bErrorIfCoercion,
IParserState state) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waiteatBlock, eatBlock, match, matchDeclarationKeywordprotected int _offsetShift
protected boolean _bDontOptimizeStatementLists
public ParserBase()
public ParserBase(GosuParser owner)
public GosuParser getOwner()
getOwner in interface IParserPartprotected void setOwner(GosuParser owner)
public void setIgnoreWarnings(Set<ResourceKey> msgKeys)
protected void pushExpression(Expression e)
protected void verifyParsedElement(IParsedElement element) throws ParseResultsException
ParseResultsExceptionprotected void verifyParsedElement(IParsedElement element, boolean bThrowOnWarnings) throws ParseResultsException
ParseResultsExceptionprotected abstract String getScript()
protected Expression popExpression()
protected Expression peekExpression()
protected void pushStatement(Statement stmt)
protected Statement popStatement()
protected Statement peekStatement()
public final Token eatBlock(char cBegin, char cEnd, boolean bOperator)
public final Token eatBlock(char cBegin, char cEnd, boolean bOperator, boolean bStopAtDeclarationKeyword)
public void eatTypeLiteral()
public String parseDotPathWord(String t)
protected final boolean match(Token T, String token)
T - the Token object to populate iff a match is foundtoken - the string object to matchprotected final boolean match(Token T, int iType)
T - the Token object to populate iff a match is foundiType - the token "type" to match (e.g. ISourceCodeTokenizer.TT_WORD)public final boolean match(Token T, String token, int iType)
T - the Token object to populate iff a match is foundtoken - the string object to matchiType - the token "type" to match (e.g. ISourceCodeTokenizer.TT_WORD)public final boolean match(Token T, String token, int iType, boolean bPeek)
T - the Token object to populate iff a match is foundtoken - the string object to matchiType - the token "type" to match (e.g. ISourceCodeTokenizer.TT_WORD)bPeek - if true, a matching token will not be consumed (i.e. the stream will not advance to the next token.)
if false, a matching token will be removed from the front of the stream.protected IType resolveTypeForArithmeticExpression(ParsedElement parsedElement, IType lhsType, String op, IType rhsType)
protected IType resolveType(ParsedElement parsedElement, IType lhsType, int op, IType rhsType)
public static IType resolveRuntimeType(ArithmeticExpression expr, IType lhsType, int op, IType rhsType)
public static IMethodInfo findMathOpMethod(IType lhsType, int op, IType rhsType)
protected ISymbol resolveSymbol(ParsedElement e, String strName, boolean ignoreFunctionSymbols)
protected ISymbol resolveNamespaceSymbol(ParsedElement e, String strName)
protected INamespaceType resolveNamespace(String strName)
protected void captureAllSymbols(ICompilableTypeInternal anonClass, ICompilableTypeInternal enclosingClass, List<ICapturedSymbol> capturedSymbols)
protected ISymbol captureSymbol(ICompilableTypeInternal anonClass, String strName, ParsedElement e)
protected ISymbol getUncapturedSymbol(ICompilableType gsClass, String strName)
protected boolean isEvalClass()
protected void verifyComparable(IType lhsType, Expression rhs)
protected void verifyComparable(IType lhsType, Expression rhs, boolean bBiDirectional, boolean bErrorIfCoercion)
protected void verifyComparable(IType lhsType, Expression rhs, boolean bBiDirectional, boolean bErrorIfCoercion, IParserState state)
protected IType verifyTypesComparable(ParsedElement element, IType lhsType, IType rhsType, boolean bBiDirectional, boolean bErrorIfCoercion)
protected IType verifyTypesComparable(ParsedElement element, IType lhsType, IType rhsType, boolean bBiDirectional, boolean bErrorIfCoercion, IParserState state)
public void verifyNonVoidExpression(Expression eas)
protected void eatOptionalSemiColon(boolean bEat)
protected void parseAnnotation(List<IGosuAnnotation> annotations)
protected void verifyModifiersForFeature(IParsedElement pe, ModifierInfo modInfo)
public void setDontOptimizeStatementLists(boolean dontOptimizeStatementLists)
setDontOptimizeStatementLists in interface IParserPartpublic boolean isDontOptimizeStatementLists()
isDontOptimizeStatementLists in interface IParserPartpublic void setSubTree(List<IParseTree> subTree)
public void setBlocks(Stack<BlockExpression> blocks)
public void pushCurrentBlock(BlockExpression block)
public void addBlockToBlockStack(BlockExpression block)
protected ICompilableTypeInternal getCurrentEnclosingGosuClass()
public boolean isParsingBlock()
protected void copyBlockStackTo(ParserBase otherParser)
protected IGosuClassInternal getParsingAnonymousClass()
protected Expression possiblyWrapWithImplicitCoercion(Expression expressionToCoerce, IType typeToCoerceTo)
protected Expression possiblyWrapWithCoercion(Expression expressionToCoerce, IType typeToCoerceTo, boolean bImplicit)
protected void setLocationForImplicitTypeAs(Expression expressionToCoerce, TypeAsExpression tas)
public ParseTree findAndWrapLocation(Expression oldExpr, ParsedElement newExpr)
public void setValidator(IGosuValidator validator)
setValidator in interface IParserPartpublic IGosuValidator getValidator()
protected void setOffsetShift(int offsetShift)
public void setLineNumShift(int lineNumShift)
setLineNumShift in interface IParserPartpublic int getLineNumShift()
getLineNumShift in interface IParserPartpublic int getOffsetShift()
getOffsetShift in interface IParserPartprotected void pushInferringFunctionTypeVars(List<IType> typeVariableTypes)
protected List<IType> peekInferringFunctionTypeVariableTypes()
public static boolean matchDeclarationKeyword(String[] ret, boolean bPeek, SourceCodeTokenizer tokenizer)
public boolean shouldSnapshotSymbols()
public void setSnapshotSymbols()
Copyright © 2018. All rights reserved.