Package gw.internal.gosu.parser
Class GosuParser
- java.lang.Object
-
- gw.internal.gosu.parser.ParserBase
-
- gw.internal.gosu.parser.GosuParser
-
- All Implemented Interfaces:
IGosuParser,IParserPart
public final class GosuParser extends ParserBase implements IGosuParser
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface gw.lang.parser.IGosuParser
IGosuParser.ParseType, IGosuParser.Settings
-
-
Field Summary
Fields Modifier and Type Field Description static ErrorTypenotfoundstatic ITypePENDING_BOUNDING_TYPE-
Fields inherited from class gw.internal.gosu.parser.ParserBase
_bDontOptimizeStatementLists, _offsetShift
-
Fields inherited from interface gw.lang.parser.IGosuParser
BIGD_ZERO, DOUBLE_DIGITS, NaN, ONE, ZERO
-
-
Method Summary
-
Methods inherited from class gw.internal.gosu.parser.ParserBase
addBlockToBlockStack, captureAllSymbols, captureSymbol, copyBlockStackTo, eatBlock, eatBlock, eatOptionalSemiColon, eatTypeLiteral, findAndWrapLocation, findMathOpMethod, getCurrentEnclosingGosuClass, getCurrentlyInferringFunctionTypeVars, getLineNumShift, getOffsetShift, getOwner, getParsingAnonymousClass, getUncapturedSymbol, getValidator, isDontOptimizeStatementLists, isEvalClass, isParsingBlock, match, match, match, match, match, matchDeclarationKeyword, parseAnnotation, parseDotPathWord, peekInferringFunctionTypeVariableTypes, popInferringFunctionTypeVariableTypes, possiblyWrapWithCoercion, possiblyWrapWithImplicitCoercion, pushCurrentBlock, pushInferringFunctionTypeVars, resolveNamespace, resolveNamespaceSymbol, resolveRuntimeType, resolveSymbol, resolveType, resolveType, resolveTypeForArithmeticExpression, setBlocks, setDontOptimizeStatementLists, setIgnoreWarnings, setLineNumShift, setLocationForImplicitTypeAs, setOffsetShift, setOwner, setSnapshotSymbols, setSubTree, shouldSnapshotSymbols, verifyComparable, verifyComparable, verifyComparable, verifyModifiersForFeature, verifyNonVoidExpression, verifyParsedElement, verifyParsedElement, verifyTypesComparable, verifyTypesComparable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gw.lang.parser.IGosuParser
isParsingBlock, setIgnoreWarnings, setSnapshotSymbols
-
Methods inherited from interface gw.lang.parser.IParserPart
getLineNumShift, getOffsetShift, getOwner, isDontOptimizeStatementLists, setDontOptimizeStatementLists, setLineNumShift
-
-
-
-
Method Detail
-
setValidator
public void setValidator(IGosuValidator validator)
- Specified by:
setValidatorin interfaceIParserPart- Overrides:
setValidatorin classParserBase
-
getScriptPart
public IScriptPartId getScriptPart()
- Specified by:
getScriptPartin interfaceIGosuParser
-
getScriptPartIdStack
public Stack<IScriptPartId> getScriptPartIdStack()
-
pushScriptPart
public void pushScriptPart(IScriptPartId partId)
-
getInferenceMap
public TypeVarToTypeMap getInferenceMap()
-
pushInferenceMap
public void pushInferenceMap(TypeVarToTypeMap inferenceMap)
-
setScript
public void setScript(CharSequence source)
- Specified by:
setScriptin interfaceIGosuParser
-
setScript
public void setScript(ISource src)
- Specified by:
setScriptin interfaceIGosuParser
-
setScript
public void setScript(SourceCodeReader reader)
- Specified by:
setScriptin interfaceIGosuParser
-
resetScript
public void resetScript()
-
getScript
protected String getScript()
- Specified by:
getScriptin classParserBase
-
getSymbolTable
public ISymbolTable getSymbolTable()
- Specified by:
getSymbolTablein interfaceIGosuParser
-
setSymbolTable
public void setSymbolTable(ISymbolTable symTable)
- Specified by:
setSymbolTablein interfaceIGosuParser
-
getTypeUsesMap
public ITypeUsesMap getTypeUsesMap()
- Specified by:
getTypeUsesMapin interfaceIGosuParser
-
setTypeUsesMap
public void setTypeUsesMap(ITypeUsesMap typeUsesMap)
- Specified by:
setTypeUsesMapin interfaceIGosuParser
-
getNamespace
public String getNamespace()
-
getVisibilityConstraint
public IScriptabilityModifier getVisibilityConstraint()
-
getTokenizerInstructor
public ITokenizerInstructor getTokenizerInstructor()
- Specified by:
getTokenizerInstructorin interfaceIGosuParser
-
setTokenizerInstructor
public void setTokenizerInstructor(ITokenizerInstructor tokenizerInstructor)
- Specified by:
setTokenizerInstructorin interfaceIGosuParser
-
peekParsingFunction
public FunctionType peekParsingFunction()
-
iterateParsingFunctions
public Iterator<FunctionType> iterateParsingFunctions()
-
isParsingFunction
public boolean isParsingFunction()
- Specified by:
isParsingFunctionin interfaceIGosuParser
-
peekParsingFieldInitializer
public VarStatement peekParsingFieldInitializer()
-
isParsingFieldInitializer
public boolean isParsingFieldInitializer()
-
parseStatements
public Statement parseStatements(IScriptPartId partId) throws ParseResultsException
- Specified by:
parseStatementsin interfaceIGosuParser- Throws:
ParseResultsException
-
parseProgram
public IProgram parseProgram(IScriptPartId partId) throws ParseResultsException
- Specified by:
parseProgramin interfaceIGosuParser- Throws:
ParseResultsException
-
parseProgram
public IProgram parseProgram(IScriptPartId partId, IType expectedExpressionType) throws ParseResultsException
- Specified by:
parseProgramin interfaceIGosuParser- Throws:
ParseResultsException
-
parseProgram
public IProgram parseProgram(IScriptPartId partId, IType expectedExpressionType, IFileContext ctx, boolean assignRuntime) throws ParseResultsException
- Specified by:
parseProgramin interfaceIGosuParser- Throws:
ParseResultsException
-
parseProgram
public IProgram parseProgram(IScriptPartId partId, IType expectedExpressionType, IFileContext ctx, boolean assignRuntime, boolean bDoNotThrowParseResultsException) throws ParseResultsException
- Specified by:
parseProgramin interfaceIGosuParser- Throws:
ParseResultsException
-
parseProgram
public IProgram parseProgram(IScriptPartId partId, boolean isolatedScope, IType expectedExpressionType) throws ParseResultsException
- Specified by:
parseProgramin interfaceIGosuParser- Throws:
ParseResultsException
-
parseProgram
public IProgram parseProgram(IScriptPartId partId, boolean isolatedScope, boolean reallyIsolatedScope, IType expectedExpressionType, IFileContext ctx, boolean assignRuntime) throws ParseResultsException
- Specified by:
parseProgramin interfaceIGosuParser- Throws:
ParseResultsException
-
parseProgram
public IProgram parseProgram(IScriptPartId partId, boolean isolatedScope, boolean reallyIsolatedScope, IType expectedExpressionType, IFileContext ctx, boolean assignRuntime, boolean bDoNotThrowParseResultsException) throws ParseResultsException
- Specified by:
parseProgramin interfaceIGosuParser- Throws:
ParseResultsException
-
parseProgram
public IProgram parseProgram(IScriptPartId partId, boolean isolatedScope, boolean reallyIsolatedScope, IType expectedExpressionType, IFileContext ctx, boolean assignRuntime, boolean bDoNotThrowParseResultsException, IType superType) throws ParseResultsException
- Specified by:
parseProgramin interfaceIGosuParser- Throws:
ParseResultsException
-
setGenerateRootExpressionAccessForProgram
public void setGenerateRootExpressionAccessForProgram(boolean bGenRootExprAccess)
- Specified by:
setGenerateRootExpressionAccessForProgramin interfaceIGosuParser
-
isGenerateRootExpressionAccessForProgram
public boolean isGenerateRootExpressionAccessForProgram()
-
parseExp
public Expression parseExp(IScriptPartId partId) throws ParseResultsException
- Specified by:
parseExpin interfaceIGosuParser- Throws:
ParseResultsException
-
parseExp
public Expression parseExp(IScriptPartId partId, IType expectedExpressionType) throws ParseResultsException
- Specified by:
parseExpin interfaceIGosuParser- Throws:
ParseResultsException
-
parseExp
public Expression parseExp(IScriptPartId partId, IType expectedExpressionType, IFileContext context, boolean assignRuntime) throws ParseResultsException
- Specified by:
parseExpin interfaceIGosuParser- Throws:
ParseResultsException
-
parseExpOrProgram
public IExpression parseExpOrProgram(IScriptPartId partId) throws ParseResultsException
- Specified by:
parseExpOrProgramin interfaceIGosuParser- Throws:
ParseResultsException
-
parseExpOrProgram
public IExpression parseExpOrProgram(IScriptPartId partId, boolean isolatedScope, boolean assignRuntime) throws ParseResultsException
- Specified by:
parseExpOrProgramin interfaceIGosuParser- Throws:
ParseResultsException
-
parseExpOrProgram
public IExpression parseExpOrProgram(IScriptPartId partId, IType typeExpected, boolean isolatedScope, boolean assignRuntime) throws ParseResultsException
- Throws:
ParseResultsException
-
parseTypeLiteral
public TypeLiteral parseTypeLiteral(IScriptPartId partId) throws ParseResultsException
- Specified by:
parseTypeLiteralin interfaceIGosuParser- Throws:
ParseResultsException
-
isParsed
public boolean isParsed()
- Specified by:
isParsedin interfaceIGosuParser
-
setParsed
protected void setParsed(boolean bParsed)
-
getTokenizer
public final SourceCodeTokenizer getTokenizer()
- Specified by:
getTokenizerin interfaceIGosuParser
-
getLocations
public List<IParseTree> getLocations()
- Specified by:
getLocationsin interfaceIGosuParser
-
peekLocation
public ParseTree peekLocation()
-
hasWarnings
public boolean hasWarnings()
- Specified by:
hasWarningsin interfaceIGosuParser
-
isThrowParseResultsExceptionForWarnings
public boolean isThrowParseResultsExceptionForWarnings()
- Specified by:
isThrowParseResultsExceptionForWarningsin interfaceIGosuParser
-
setThrowParseExceptionForWarnings
public void setThrowParseExceptionForWarnings(boolean bThrowParseExceptionForWarnings)
- Specified by:
setThrowParseExceptionForWarningsin interfaceIGosuParser
-
setContextInferenceManager
public void setContextInferenceManager(ContextInferenceManager ctxInferenceMgr)
-
pushInferredContextTypes
public void pushInferredContextTypes(ContextType ctxType)
-
popInferredContextTypes
public void popInferredContextTypes()
-
getContextType
public ContextType getContextType()
-
isCaptureSymbolsForEval
public boolean isCaptureSymbolsForEval()
- Specified by:
isCaptureSymbolsForEvalin interfaceIGosuParser
-
setCaptureSymbolsForEval
public void setCaptureSymbolsForEval(boolean bCaputreSymbolsForEval)
- Specified by:
setCaptureSymbolsForEvalin interfaceIGosuParser
-
isParsingStaticFeature
public boolean isParsingStaticFeature()
-
pushParsingStaticMember
public void pushParsingStaticMember(Boolean bParsingStaticFeature)
-
popParsingStaticMember
public void popParsingStaticMember()
-
isParsingAbstractConstructor
public boolean isParsingAbstractConstructor()
-
pushParsingAbstractConstructor
public void pushParsingAbstractConstructor(Boolean bParsingAbstractConstructor)
-
popParsingAbstractConstructor
public void popParsingAbstractConstructor()
-
parseTypeLiteral
public boolean parseTypeLiteral()
- Specified by:
parseTypeLiteralin interfaceIGosuParser
-
parseTypeLiteral
public boolean parseTypeLiteral(Token token)
-
parseUsesStatementList
public UsesStatementList parseUsesStatementList(boolean bResolveUsesTypes)
- Specified by:
parseUsesStatementListin interfaceIGosuParser
-
doParametersReifyToSameBytecodeType
public boolean doParametersReifyToSameBytecodeType(IDynamicFunctionSymbol dfs, IDynamicFunctionSymbol dfsExisting)
-
parseParameterDeclarationList
public ArrayList<ISymbol> parseParameterDeclarationList(IParsedElement element, boolean bStatic, List<IType> inferredArgumentTypes)
- Specified by:
parseParameterDeclarationListin interfaceIGosuParser
-
parseParameterDeclarationList
public ArrayList<ISymbol> parseParameterDeclarationList(IParsedElement element, boolean bStatic, List<IType> inferredArgumentTypes, boolean bProperty, boolean bGetter, boolean bEmpty, boolean bVarDynamicArg)
-
pushExpression
protected void pushExpression(Expression e)
- Overrides:
pushExpressionin classParserBase
-
popExpression
public Expression popExpression()
- Specified by:
popExpressionin interfaceIGosuParser- Overrides:
popExpressionin classParserBase
-
setTokenizer
public void setTokenizer(ISourceCodeTokenizer tokenizer)
- Specified by:
setTokenizerin interfaceIGosuParser
-
peekExpression
protected Expression peekExpression()
- Overrides:
peekExpressionin classParserBase
-
peekParsedElement
protected ParsedElement peekParsedElement()
-
pushStatement
protected void pushStatement(Statement stmt)
- Overrides:
pushStatementin classParserBase
-
popStatement
protected Statement popStatement()
- Overrides:
popStatementin classParserBase
-
peekStatement
protected Statement peekStatement()
- Overrides:
peekStatementin classParserBase
-
pushDynamicFunctionSymbol
protected void pushDynamicFunctionSymbol(DynamicFunctionSymbol stmt)
-
popDynamicFunctionSymbol
protected DynamicFunctionSymbol popDynamicFunctionSymbol()
-
peekDynamicFunctionSymbol
protected DynamicFunctionSymbol peekDynamicFunctionSymbol()
-
clearDfsStack
protected void clearDfsStack()
-
putDfsDeclsInTable
public void putDfsDeclsInTable(ISymbolTable table)
- Specified by:
putDfsDeclsInTablein interfaceIGosuParser
-
putDfsDeclInSetByName
public void putDfsDeclInSetByName(IDynamicFunctionSymbol dfs)
- Specified by:
putDfsDeclInSetByNamein interfaceIGosuParser
-
nextIndexOfErrantDuplicateDynamicSymbol
public int nextIndexOfErrantDuplicateDynamicSymbol(IDynamicSymbol ds, Collection<? extends ISymbol> symbols, boolean bCheckContains)
-
setDfsDeclInSetByName
public void setDfsDeclInSetByName(Map<String,List<IFunctionSymbol>> dfsDecl)
- Specified by:
setDfsDeclInSetByNamein interfaceIGosuParser
-
newDfsDeclInSetByName
protected void newDfsDeclInSetByName()
-
getDfsDecls
public Map<String,List<IFunctionSymbol>> getDfsDecls()
- Specified by:
getDfsDeclsin interfaceIGosuParser
-
getFunctionTypesForName
protected List<IFunctionType> getFunctionTypesForName(String strFunctionName)
-
resolveTypeLiteral
protected TypeLiteral resolveTypeLiteral(String[] T)
-
resolveTypeLiteral
protected TypeLiteral resolveTypeLiteral(String[] T, boolean bRelative, boolean bInterface)
-
getDfsDeclsForFunction
protected List<IFunctionSymbol> getDfsDeclsForFunction(String strFunctionName)
-
resolveTypeLiteral
public TypeLiteral resolveTypeLiteral(String strTypeName)
Resolves the type literal given by strTypeName. If parentType is non null then strTypeName is assumed relative to the given parent.- Specified by:
resolveTypeLiteralin interfaceIGosuParser- Parameters:
strTypeName-
-
resolveTypeLiteral
public TypeLiteral resolveTypeLiteral(String strTypeName, boolean bRelative, boolean bInterface)
-
getTypeVariables
public HashMap<String,ITypeVariableDefinition> getTypeVariables()
- Specified by:
getTypeVariablesin interfaceIGosuParser
-
setTypeVariables
protected void setTypeVariables(HashMap<String,ITypeVariableDefinition> map)
-
parseClass
public IGosuClassInternal parseClass(String strQualifiedClassName, ISourceFileHandle sourceFile, boolean bThrowOnWarnings, boolean bFullyCompile) throws ParseResultsException
- Specified by:
parseClassin interfaceIGosuParser- Throws:
ParseResultsException
-
getFunctionType
public IFunctionType getFunctionType(IType classBean, String functionName, Expression[] eArgs, List<IFunctionType> listAllMatchingMethods, GosuParser parser, boolean bMatchParamTypes) throws ParseException
- Throws:
ParseException
-
getConstructorType
public IConstructorType getConstructorType(IType classBean, Expression[] eArgs, List<IConstructorType> listAllMatchingMethods, ParserBase parserState) throws ParseException
Get the type of the method specified in the member path.- Parameters:
classBean- The declaring class of the constructor.parserState- The parserState that may be involved in the process of parsing a constructor. Can be null.- Returns:
- A Gosu type for the constructor.
- Throws:
ParseException
-
setWarnOnCaseIssue
public void setWarnOnCaseIssue(boolean warnOnCaseIssue)
- Specified by:
setWarnOnCaseIssuein interfaceIGosuParser
-
setEditorParser
public void setEditorParser(boolean bStudioEditorParser)
- Specified by:
setEditorParserin interfaceIGosuParser
-
isEditorParser
public boolean isEditorParser()
- Specified by:
isEditorParserin interfaceIGosuParser
-
getState
public IParserState getState()
- Specified by:
getStatein interfaceIGosuParser
-
isParsingAnnotation
public boolean isParsingAnnotation()
-
setParsingAnnotation
public void setParsingAnnotation(boolean parsingAnnotation)
-
isAllowingWildcards
public boolean isAllowingWildcards()
-
setAllowWildcards
public void setAllowWildcards(boolean allowWildcards)
-
isIgnoreTypeDeprecation
public boolean isIgnoreTypeDeprecation()
-
pushIgnoreTypeDeprecation
public void pushIgnoreTypeDeprecation()
-
popIgnoreTypeDeprecation
public void popIgnoreTypeDeprecation()
-
setLocationsFromProgramClassParser
public void setLocationsFromProgramClassParser(List<ParseTree> savedLocations)
-
pushTypeVariableTypesToInfer
protected void pushTypeVariableTypesToInfer(IInvocableType functionType)
-
-