Class ParserBase

    • Field Detail

      • EMPTY_ARRAY

        private static final java.lang.Object[] EMPTY_ARRAY
      • PLACEHOLDER_PARSER_STATE

        private static final IParserState PLACEHOLDER_PARSER_STATE
      • PROGRAM_NAMESPACE

        private static final INamespaceType PROGRAM_NAMESPACE
      • _snapshotSymbols

        private boolean _snapshotSymbols
      • _offsetShift

        protected int _offsetShift
      • _lineNumShift

        private int _lineNumShift
      • _bDontOptimizeStatementLists

        protected boolean _bDontOptimizeStatementLists
      • _subTree

        private java.util.List<IParseTree> _subTree
      • _inferringFunctionTypes

        private Stack<java.util.List<IType>> _inferringFunctionTypes
      • _ignoreWarnings

        private java.util.Set<ResourceKey> _ignoreWarnings
    • Constructor Detail

      • ParserBase

        public ParserBase()
      • ParserBase

        public ParserBase​(GosuParser owner)
    • Method Detail

      • setOwner

        protected void setOwner​(GosuParser owner)
      • setIgnoreWarnings

        public void setIgnoreWarnings​(java.util.Set<ResourceKey> msgKeys)
      • setLocation

        void setLocation​(int iOffset,
                         int iLineNum,
                         int iColumn)
      • setLocation

        void setLocation​(int iOffset,
                         int iLineNum,
                         int iColumn,
                         boolean bForceRedundancy)
      • setLocation

        void setLocation​(int iOffset,
                         int iLineNum,
                         int iColumn,
                         boolean bZeroLength,
                         boolean bForceRedundancy)
      • addLocation

        private ParseTree addLocation​(ParseTree location,
                                      boolean bForceRedundancy)
      • getLocationsList

        java.util.List<ParseTree> getLocationsList()
      • pushExpression

        protected void pushExpression​(Expression e)
      • getScript

        protected abstract java.lang.String getScript()
      • popExpression

        protected Expression popExpression()
      • peekExpression

        protected Expression peekExpression()
      • pushStatement

        protected void pushStatement​(Statement stmt)
      • popStatement

        protected Statement popStatement()
      • peekStatement

        protected Statement peekStatement()
      • eatPossibleStatementBlock

        boolean eatPossibleStatementBlock()
      • eatPossibleEnclosedVarInStmt

        boolean eatPossibleEnclosedVarInStmt()
      • eatPossibleParametarization

        void eatPossibleParametarization()
      • eatPossibleParametarization

        void eatPossibleParametarization​(boolean bMatchStart)
      • eatPossibleArrayBrackets

        void eatPossibleArrayBrackets()
      • eatPossibleArrayBrackets

        void eatPossibleArrayBrackets​(boolean bMatchStart)
      • 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 java.lang.String parseDotPathWord​(java.lang.String t)
        Parse a dot separated path as a single logical token
      • match

        protected final boolean match​(Token T,
                                      java.lang.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,
                                   java.lang.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,
                                   java.lang.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
      • isWordOrValueKeyword

        final boolean isWordOrValueKeyword​(Token T)
      • match

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

        final boolean match​(Token T,
                            Keyword keyword,
                            boolean bPeek)
      • verify

        final boolean verify​(ParsedElement parsedElement,
                             boolean bExpression,
                             ResourceKey errorMesg,
                             java.lang.String arg0)
      • verify

        final boolean verify​(ParsedElement parsedElement,
                             boolean bExpression,
                             ResourceKey errorMesg,
                             java.lang.String... args)
      • verify

        final boolean verify​(ParsedElement parsedElement,
                             boolean bExpression,
                             ResourceKey errorMesg,
                             java.lang.Object... args)
      • verify

        final boolean verify​(ParsedElement parsedElement,
                             boolean bExpression,
                             boolean bNextTokenIfException,
                             ResourceKey errorMesg,
                             java.lang.Object... args)
      • verify

        boolean verify​(ParsedElement parsedElement,
                       boolean bExpression,
                       boolean bNextTokenIfException,
                       IParserState parserState,
                       ResourceKey errorMesg,
                       java.lang.Object... args)
      • warn

        final boolean warn​(ParsedElement target,
                           boolean bExpression,
                           ResourceKey err,
                           java.lang.Object... args)
      • verifyOrWarn

        final boolean verifyOrWarn​(ParsedElement target,
                                   boolean bExpression,
                                   boolean bWarning,
                                   ResourceKey err,
                                   java.lang.Object... args)
      • verify

        private boolean verify​(ParsedElement parsedElement,
                               boolean bExpression,
                               boolean bNextTokenIfException,
                               boolean bWarning,
                               IParserState parserState,
                               ResourceKey errorMesg,
                               java.lang.Object... args)
      • advanceToNextTokenSilently

        final void advanceToNextTokenSilently()
      • makeFullParserState

        final IFullParserState makeFullParserState()
        Returns:
        a full parser state, which includes symbol table information, a clone of the tokenizer and everything else
      • makeFullParserStateWithSymbols

        final IFullParserState makeFullParserStateWithSymbols()
        Returns:
        a full parser state, which includes symbol table information, a clone of the tokenizer and everything else
      • makeLightweightParserState

        final LightweightParserState makeLightweightParserState()
        Returns:
        a lightweight parser state, which includes *only* the offset information of the parser, and no symbol information or a tokenizer state.
      • resolveTypeForArithmeticExpression

        protected IType resolveTypeForArithmeticExpression​(ParsedElement parsedElement,
                                                           IType lhsType,
                                                           java.lang.String op,
                                                           IType rhsType)
      • isNonFinalDimension

        private static boolean isNonFinalDimension​(IType type)
      • resolveType

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

        private static IType handleBoxedAndPrimitiveTypes​(IType lhsType,
                                                          IType rhsType)
      • makeBoxedTypeIfEitherOperandIsBoxed

        private static IType makeBoxedTypeIfEitherOperandIsBoxed​(IType lhsType,
                                                                 IType rhsType,
                                                                 IType retType)
      • assertBoxedOrBigNumber

        private static boolean assertBoxedOrBigNumber​(ParserBase parser,
                                                      ParsedElement parsedElement,
                                                      IType rhsType,
                                                      int op)
      • getAndAssignOperatorOverloader

        private static IType getAndAssignOperatorOverloader​(IType lhsType,
                                                            IType rhsType,
                                                            int op,
                                                            ParsedElement parsedElement)
      • findMathOpMethod

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

        protected ISymbol resolveSymbol​(ParsedElement e,
                                        java.lang.String strName,
                                        boolean ignoreFunctionSymbols)
      • isOrIsEnclosedByAnonymousClass

        boolean isOrIsEnclosedByAnonymousClass​(ICompilableType type)
      • resolveNamespaceSymbol

        protected ISymbol resolveNamespaceSymbol​(ParsedElement e,
                                                 java.lang.String strName)
      • maybeAddLocalsOfEnclosingType

        private void maybeAddLocalsOfEnclosingType()
      • resolveNamespace

        protected INamespaceType resolveNamespace​(java.lang.String strName)
      • resolveForNullEnclosingClass

        private ISymbol resolveForNullEnclosingClass​(java.lang.String strName)
      • getUncapturedSymbol

        protected ISymbol getUncapturedSymbol​(ICompilableType gsClass,
                                              java.lang.String strName)
      • findSymbol

        private ISymbol findSymbol​(java.lang.String strName,
                                   boolean ignoreFunctionSymbols)
      • findSymbol

        private ISymbol findSymbol​(java.lang.String strName,
                                   ISymbolTable symTable,
                                   boolean ignoreFunctionSymbols)
      • 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)
      • verifyNonVoidExpression

        public void verifyNonVoidExpression​(Expression eas)
      • parseModifiers

        ModifierInfo parseModifiers​(boolean bIgnoreErrors)
      • maybeAddJavadocDeprecatedModifier

        private int maybeAddJavadocDeprecatedModifier​(int iModifiers,
                                                      java.util.List<IGosuAnnotation> annotations)
      • pushModifierList

        void pushModifierList​(int iOffsetList,
                              int iLineNumList,
                              int iColumnList)
      • eatOptionalSemiColon

        protected void eatOptionalSemiColon​(boolean bEat)
      • parseAnnotation

        protected void parseAnnotation​(java.util.List<IGosuAnnotation> annotations)
      • maybeVerifyAnnotationArgs

        private void maybeVerifyAnnotationArgs​(Expression e)
      • verifyNoAbstractHideOverrideStaticModifierDefined

        void verifyNoAbstractHideOverrideStaticModifierDefined​(ParsedElement elem,
                                                               boolean bIgnoreErrors,
                                                               int modifier,
                                                               Keyword kw)
      • verifyNoAbstractHideOverrideStaticModifierDefined

        void verifyNoAbstractHideOverrideStaticModifierDefined​(ParsedElement elem,
                                                               boolean bIgnoreErrors,
                                                               int modifier,
                                                               Keyword kw,
                                                               boolean alreadyMatched)
      • verifyNoHideOverrideStaticModifierDefined

        void verifyNoHideOverrideStaticModifierDefined​(ParsedElement elem,
                                                       boolean bIgnoreErrors,
                                                       int modifier,
                                                       Keyword kw)
      • verifyNoAbstractHideStaticModifierDefined

        void verifyNoAbstractHideStaticModifierDefined​(ParsedElement elem,
                                                       boolean bIgnoreErrors,
                                                       int modifier,
                                                       Keyword kw,
                                                       boolean alreadyMatched)
      • verifyNoAccessibilityModifierDefined

        void verifyNoAccessibilityModifierDefined​(ParsedElement elem,
                                                  boolean bIgnoreErrors,
                                                  int modifier,
                                                  Keyword kw)
      • verifyNoAbstractHideOverrideModifierDefined

        void verifyNoAbstractHideOverrideModifierDefined​(ParsedElement elem,
                                                         boolean bIgnoreErrors,
                                                         int modifier,
                                                         Keyword kw)
      • verifyNoHideOverrideModifierDefined

        void verifyNoHideOverrideModifierDefined​(ParsedElement elem,
                                                 boolean bIgnoreErrors,
                                                 int modifier,
                                                 Keyword kw)
      • verifyNoCombinedPrivateAbstract

        void verifyNoCombinedPrivateAbstract​(ParsedElement elem,
                                             boolean bIgnoreErrors,
                                             int modifier)
      • verifyNoCombinedFinalPrivateModifierDefined

        void verifyNoCombinedFinalPrivateModifierDefined​(ParsedElement elem,
                                                         boolean bIgnoreErrors,
                                                         int modifier)
      • verifyNoCombinedFinalStaticModifierDefined

        void verifyNoCombinedFinalStaticModifierDefined​(ParsedElement elem,
                                                        boolean bIgnoreErrors,
                                                        int modifier)
      • setSubTree

        public void setSubTree​(java.util.List<IParseTree> subTree)
      • pushCurrentBlock

        public void pushCurrentBlock​(BlockExpression block)
      • addBlockToBlockStack

        public void addBlockToBlockStack​(BlockExpression block)
      • popCurrentBlock

        void popCurrentBlock()
      • isParsingBlock

        public boolean isParsingBlock()
      • copyBlockStackTo

        protected void copyBlockStackTo​(ParserBase otherParser)
      • possiblyWrapWithImplicitCoercion

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

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

        void verifyTypeVarAreReified​(Expression expr,
                                     IType rhsType)
      • setLocationForImplicitTypeAs

        protected void setLocationForImplicitTypeAs​(Expression expressionToCoerce,
                                                    TypeAsExpression tas)
      • setOffsetShift

        protected void setOffsetShift​(int offsetShift)
      • pushInferringFunctionTypeVars

        protected void pushInferringFunctionTypeVars​(java.util.List<IType> typeVariableTypes)
      • popInferringFunctionTypeVariableTypes

        protected java.util.List<IType> popInferringFunctionTypeVariableTypes()
      • peekInferringFunctionTypeVariableTypes

        protected java.util.List<IType> peekInferringFunctionTypeVariableTypes()
      • getCurrentlyInferringFunctionTypeVars

        public java.util.List<IType> getCurrentlyInferringFunctionTypeVars()
      • matchDeclarationKeyword

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

        public boolean shouldSnapshotSymbols()
      • setSnapshotSymbols

        public void setSnapshotSymbols()