Class ParserBase

java.lang.Object
gw.internal.gosu.parser.ParserBase
All Implemented Interfaces:
IParserPart
Direct Known Subclasses:
GosuClassParser, GosuParser

public abstract class ParserBase extends Object implements IParserPart
  • Field Details

    • _offsetShift

      protected int _offsetShift
    • _bDontOptimizeStatementLists

      protected boolean _bDontOptimizeStatementLists
  • Constructor Details

    • ParserBase

      public ParserBase()
    • ParserBase

      public ParserBase(GosuParser owner)
  • Method Details

    • getOwner

      public GosuParser getOwner()
      Specified by:
      getOwner in interface IParserPart
    • setOwner

      protected void setOwner(GosuParser owner)
    • setIgnoreWarnings

      public void setIgnoreWarnings(Set<ResourceKey> msgKeys)
    • pushExpression

      protected void pushExpression(Expression e)
    • verifyParsedElement

      protected void verifyParsedElement(IParsedElement element) throws ParseResultsException
      Throws:
      ParseResultsException
    • verifyParsedElement

      protected void verifyParsedElement(IParsedElement element, boolean bThrowOnWarnings) throws ParseResultsException
      Throws:
      ParseResultsException
    • getScript

      protected abstract String getScript()
    • popExpression

      protected Expression popExpression()
    • peekExpression

      protected Expression peekExpression()
    • pushStatement

      protected void pushStatement(Statement stmt)
    • popStatement

      protected Statement popStatement()
    • peekStatement

      protected Statement peekStatement()
    • eatBlock

      public final Token eatBlock(char cBegin, char cEnd, boolean bOperator)
    • eatBlock

      public final Token eatBlock(char cBegin, char cEnd, boolean bOperator, boolean bStopAtDeclarationKeyword)
    • eatTypeLiteral

      public void eatTypeLiteral()
    • parseDotPathWord

      public String parseDotPathWord(String t)
      Parse a dot separated path as a single logical token
    • match

      protected final boolean match(Token T, String token)
      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 found
      token - the string object to match
      Returns:
      true if a match occurred, and false otherwise
    • match

      protected final boolean match(Token T, int iType)
      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 found
      iType - the token "type" to match (e.g. ISourceCodeTokenizer.TT_WORD)
      Returns:
      true if a match occurred, and false otherwise
    • match

      public final boolean match(Token T, String token, int iType)
      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 found
      token - the string object to match
      iType - the token "type" to match (e.g. ISourceCodeTokenizer.TT_WORD)
      Returns:
      true if a match occurred, and false otherwise
    • match

      public final boolean match(Token T, String token, int iType, boolean bPeek)
      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 found
      token - the string object to match
      iType - 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

      protected final boolean match(Token T, Keyword token)
    • resolveTypeForArithmeticExpression

      protected IType resolveTypeForArithmeticExpression(ParsedElement parsedElement, IType lhsType, String op, IType rhsType)
    • resolveType

      protected IType resolveType(ParsedElement parsedElement, IType lhsType, int op, IType rhsType)
    • resolveRuntimeType

      public static IType resolveRuntimeType(ArithmeticExpression expr, IType lhsType, int op, IType rhsType)
    • resolveType

      public static IType resolveType(IType lhsType, int op, IType rhsType)
    • findMathOpMethod

      public static IMethodInfo findMathOpMethod(IType lhsType, int op, IType rhsType)
    • resolveSymbol

      protected ISymbol resolveSymbol(ParsedElement e, String strName, boolean ignoreFunctionSymbols)
    • resolveNamespaceSymbol

      protected ISymbol resolveNamespaceSymbol(ParsedElement e, String strName)
    • resolveNamespace

      protected INamespaceType resolveNamespace(String strName)
    • captureAllSymbols

      protected void captureAllSymbols(ICompilableTypeInternal anonClass, ICompilableTypeInternal enclosingClass, List<ICapturedSymbol> capturedSymbols)
    • captureSymbol

      protected ISymbol captureSymbol(ICompilableTypeInternal anonClass, String strName, ParsedElement e)
    • getUncapturedSymbol

      protected ISymbol getUncapturedSymbol(ICompilableType gsClass, String strName)
    • isEvalClass

      protected boolean isEvalClass()
    • verifyComparable

      protected void verifyComparable(IType lhsType, Expression rhs)
    • 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

      public void verifyNonVoidExpression(Expression eas)
    • eatOptionalSemiColon

      protected void eatOptionalSemiColon(boolean bEat)
    • parseAnnotation

      protected void parseAnnotation(List<IGosuAnnotation> annotations)
    • verifyModifiersForFeature

      protected void verifyModifiersForFeature(IParsedElement pe, ModifierInfo modInfo)
    • setDontOptimizeStatementLists

      public void setDontOptimizeStatementLists(boolean dontOptimizeStatementLists)
      Specified by:
      setDontOptimizeStatementLists in interface IParserPart
    • isDontOptimizeStatementLists

      public boolean isDontOptimizeStatementLists()
      Specified by:
      isDontOptimizeStatementLists in interface IParserPart
    • setSubTree

      public void setSubTree(List<IParseTree> subTree)
    • setBlocks

      public void setBlocks(Stack<BlockExpression> blocks)
    • pushCurrentBlock

      public void pushCurrentBlock(BlockExpression block)
    • addBlockToBlockStack

      public void addBlockToBlockStack(BlockExpression block)
    • getCurrentEnclosingGosuClass

      protected ICompilableTypeInternal getCurrentEnclosingGosuClass()
    • isParsingBlock

      public boolean isParsingBlock()
    • copyBlockStackTo

      protected void copyBlockStackTo(ParserBase otherParser)
    • getParsingAnonymousClass

      protected IGosuClassInternal getParsingAnonymousClass()
    • possiblyWrapWithImplicitCoercion

      protected Expression possiblyWrapWithImplicitCoercion(Expression expressionToCoerce, IType typeToCoerceTo)
    • possiblyWrapWithCoercion

      protected Expression possiblyWrapWithCoercion(Expression expressionToCoerce, IType typeToCoerceTo, boolean bImplicit)
    • setLocationForImplicitTypeAs

      protected void setLocationForImplicitTypeAs(Expression expressionToCoerce, TypeAsExpression tas)
    • findAndWrapLocation

      public ParseTree findAndWrapLocation(Expression oldExpr, ParsedElement newExpr)
    • setValidator

      public void setValidator(IGosuValidator validator)
      Specified by:
      setValidator in interface IParserPart
    • getValidator

      public IGosuValidator getValidator()
    • setOffsetShift

      protected void setOffsetShift(int offsetShift)
    • setLineNumShift

      public void setLineNumShift(int lineNumShift)
      Specified by:
      setLineNumShift in interface IParserPart
    • getLineNumShift

      public int getLineNumShift()
      Specified by:
      getLineNumShift in interface IParserPart
    • getOffsetShift

      public int getOffsetShift()
      Specified by:
      getOffsetShift in interface IParserPart
    • pushInferringFunctionTypeVars

      protected void pushInferringFunctionTypeVars(List<IType> typeVariableTypes)
    • popInferringFunctionTypeVariableTypes

      protected List<IType> popInferringFunctionTypeVariableTypes()
    • peekInferringFunctionTypeVariableTypes

      protected List<IType> peekInferringFunctionTypeVariableTypes()
    • getCurrentlyInferringFunctionTypeVars

      public List<IType> getCurrentlyInferringFunctionTypeVars()
    • matchDeclarationKeyword

      public static boolean matchDeclarationKeyword(String[] ret, boolean bPeek, SourceCodeTokenizer tokenizer)
    • shouldSnapshotSymbols

      public boolean shouldSnapshotSymbols()
    • setSnapshotSymbols

      public void setSnapshotSymbols()