Package gw.internal.gosu.parser
Class ParserBase
java.lang.Object
gw.internal.gosu.parser.ParserBase
- All Implemented Interfaces:
IParserPart
- Direct Known Subclasses:
GosuClassParser,GosuParser
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidcaptureAllSymbols(ICompilableTypeInternal anonClass, ICompilableTypeInternal enclosingClass, List<ICapturedSymbol> capturedSymbols) protected ISymbolcaptureSymbol(ICompilableTypeInternal anonClass, String strName, ParsedElement e) protected voidcopyBlockStackTo(ParserBase otherParser) final TokeneatBlock(char cBegin, char cEnd, boolean bOperator) final TokeneatBlock(char cBegin, char cEnd, boolean bOperator, boolean bStopAtDeclarationKeyword) protected voideatOptionalSemiColon(boolean bEat) voidfindAndWrapLocation(Expression oldExpr, ParsedElement newExpr) static IMethodInfofindMathOpMethod(IType lhsType, int op, IType rhsType) protected ICompilableTypeInternalintintgetOwner()protected IGosuClassInternalprotected abstract Stringprotected ISymbolgetUncapturedSymbol(ICompilableType gsClass, String strName) booleanprotected booleanbooleanprotected final booleanPossibly matches the specified token type.protected final booleanprotected final booleanPossibly matches the specified string token value.final booleanPossibly matches the specified token or name (in token).final booleanPossibly matches the specified token or name (in token).static booleanmatchDeclarationKeyword(String[] ret, boolean bPeek, SourceCodeTokenizer tokenizer) protected voidparseAnnotation(List<IGosuAnnotation> annotations) Parse a dot separated path as a single logical tokenprotected Expressionprotected Statementprotected Expressionprotected Statementprotected ExpressionpossiblyWrapWithCoercion(Expression expressionToCoerce, IType typeToCoerceTo, boolean bImplicit) protected ExpressionpossiblyWrapWithImplicitCoercion(Expression expressionToCoerce, IType typeToCoerceTo) voidpushCurrentBlock(BlockExpression block) protected voidprotected voidpushInferringFunctionTypeVars(List<IType> typeVariableTypes) protected voidpushStatement(Statement stmt) protected INamespaceTyperesolveNamespace(String strName) protected ISymbolresolveNamespaceSymbol(ParsedElement e, String strName) static ITyperesolveRuntimeType(ArithmeticExpression expr, IType lhsType, int op, IType rhsType) protected ISymbolresolveSymbol(ParsedElement e, String strName, boolean ignoreFunctionSymbols) protected ITyperesolveType(ParsedElement parsedElement, IType lhsType, int op, IType rhsType) static ITyperesolveType(IType lhsType, int op, IType rhsType) protected ITyperesolveTypeForArithmeticExpression(ParsedElement parsedElement, IType lhsType, String op, IType rhsType) voidsetBlocks(Stack<BlockExpression> blocks) voidsetDontOptimizeStatementLists(boolean dontOptimizeStatementLists) voidsetIgnoreWarnings(Set<ResourceKey> msgKeys) voidsetLineNumShift(int lineNumShift) protected voidsetLocationForImplicitTypeAs(Expression expressionToCoerce, TypeAsExpression tas) protected voidsetOffsetShift(int offsetShift) protected voidsetOwner(GosuParser owner) voidvoidsetSubTree(List<IParseTree> subTree) voidsetValidator(IGosuValidator validator) booleanprotected voidverifyComparable(IType lhsType, Expression rhs) protected voidverifyComparable(IType lhsType, Expression rhs, boolean bBiDirectional, boolean bErrorIfCoercion) protected voidverifyComparable(IType lhsType, Expression rhs, boolean bBiDirectional, boolean bErrorIfCoercion, IParserState state) protected voidverifyModifiersForFeature(IParsedElement pe, ModifierInfo modInfo) voidprotected voidverifyParsedElement(IParsedElement element) protected voidverifyParsedElement(IParsedElement element, boolean bThrowOnWarnings) protected ITypeverifyTypesComparable(ParsedElement element, IType lhsType, IType rhsType, boolean bBiDirectional, boolean bErrorIfCoercion) protected ITypeverifyTypesComparable(ParsedElement element, IType lhsType, IType rhsType, boolean bBiDirectional, boolean bErrorIfCoercion, IParserState state)
-
Field Details
-
_offsetShift
protected int _offsetShift -
_bDontOptimizeStatementLists
protected boolean _bDontOptimizeStatementLists
-
-
Constructor Details
-
ParserBase
public ParserBase() -
ParserBase
-
-
Method Details
-
getOwner
- Specified by:
getOwnerin interfaceIParserPart
-
setOwner
-
setIgnoreWarnings
-
pushExpression
-
verifyParsedElement
- Throws:
ParseResultsException
-
verifyParsedElement
protected void verifyParsedElement(IParsedElement element, boolean bThrowOnWarnings) throws ParseResultsException - Throws:
ParseResultsException
-
getScript
-
popExpression
-
peekExpression
-
pushStatement
-
popStatement
-
peekStatement
-
eatBlock
-
eatBlock
public final Token eatBlock(char cBegin, char cEnd, boolean bOperator, boolean bStopAtDeclarationKeyword) -
eatTypeLiteral
public void eatTypeLiteral() -
parseDotPathWord
Parse a dot separated path as a single logical token -
match
Possibly matches the specified string token value. If a match occurs the token will be eaten and its information put into T (if T is not null).- Parameters:
T- the Token object to populate iff a match is foundtoken- the string object to match- Returns:
- true if a match occurred, and false otherwise
-
match
Possibly matches the specified token type. If a match occurs then the token will be eaten and its information put into T (if T is not null).- Parameters:
T- the Token object to populate iff a match is foundiType- the token "type" to match (e.g.ISourceCodeTokenizer.TT_WORD)- Returns:
- true if a match occurred, and false otherwise
-
match
Possibly matches the specified token or name (in token). If a match occurs then the token will be eaten and its information put into T (if T is not null).- Parameters:
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)- Returns:
- true if a match occurred, and false otherwise
-
match
Possibly matches the specified token or name (in token). If a match occurs and bPeek is false then the token will be eaten and its information put into T (if T is not null).- Parameters:
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.- Returns:
- true if a match occurred, and false otherwise
-
match
-
resolveTypeForArithmeticExpression
protected IType resolveTypeForArithmeticExpression(ParsedElement parsedElement, IType lhsType, String op, IType rhsType) -
resolveType
-
resolveRuntimeType
public static IType resolveRuntimeType(ArithmeticExpression expr, IType lhsType, int op, IType rhsType) -
resolveType
-
findMathOpMethod
-
resolveSymbol
-
resolveNamespaceSymbol
-
resolveNamespace
-
captureAllSymbols
protected void captureAllSymbols(ICompilableTypeInternal anonClass, ICompilableTypeInternal enclosingClass, List<ICapturedSymbol> capturedSymbols) -
captureSymbol
-
getUncapturedSymbol
-
isEvalClass
protected boolean isEvalClass() -
verifyComparable
-
verifyComparable
protected void verifyComparable(IType lhsType, Expression rhs, boolean bBiDirectional, boolean bErrorIfCoercion) -
verifyComparable
protected void verifyComparable(IType lhsType, Expression rhs, boolean bBiDirectional, boolean bErrorIfCoercion, IParserState state) -
verifyTypesComparable
protected IType verifyTypesComparable(ParsedElement element, IType lhsType, IType rhsType, boolean bBiDirectional, boolean bErrorIfCoercion) -
verifyTypesComparable
protected IType verifyTypesComparable(ParsedElement element, IType lhsType, IType rhsType, boolean bBiDirectional, boolean bErrorIfCoercion, IParserState state) -
verifyNonVoidExpression
-
eatOptionalSemiColon
protected void eatOptionalSemiColon(boolean bEat) -
parseAnnotation
-
verifyModifiersForFeature
-
setDontOptimizeStatementLists
public void setDontOptimizeStatementLists(boolean dontOptimizeStatementLists) - Specified by:
setDontOptimizeStatementListsin interfaceIParserPart
-
isDontOptimizeStatementLists
public boolean isDontOptimizeStatementLists()- Specified by:
isDontOptimizeStatementListsin interfaceIParserPart
-
setSubTree
-
setBlocks
-
pushCurrentBlock
-
addBlockToBlockStack
-
getCurrentEnclosingGosuClass
-
isParsingBlock
public boolean isParsingBlock() -
copyBlockStackTo
-
getParsingAnonymousClass
-
possiblyWrapWithImplicitCoercion
protected Expression possiblyWrapWithImplicitCoercion(Expression expressionToCoerce, IType typeToCoerceTo) -
possiblyWrapWithCoercion
protected Expression possiblyWrapWithCoercion(Expression expressionToCoerce, IType typeToCoerceTo, boolean bImplicit) -
setLocationForImplicitTypeAs
-
findAndWrapLocation
-
setValidator
- Specified by:
setValidatorin interfaceIParserPart
-
getValidator
-
setOffsetShift
protected void setOffsetShift(int offsetShift) -
setLineNumShift
public void setLineNumShift(int lineNumShift) - Specified by:
setLineNumShiftin interfaceIParserPart
-
getLineNumShift
public int getLineNumShift()- Specified by:
getLineNumShiftin interfaceIParserPart
-
getOffsetShift
public int getOffsetShift()- Specified by:
getOffsetShiftin interfaceIParserPart
-
pushInferringFunctionTypeVars
-
popInferringFunctionTypeVariableTypes
-
peekInferringFunctionTypeVariableTypes
-
getCurrentlyInferringFunctionTypeVars
-
matchDeclarationKeyword
public static boolean matchDeclarationKeyword(String[] ret, boolean bPeek, SourceCodeTokenizer tokenizer) -
shouldSnapshotSymbols
public boolean shouldSnapshotSymbols() -
setSnapshotSymbols
public void setSnapshotSymbols()
-