Interface IGosuParser

    • Method Detail

      • getScriptPart

        IScriptPartId getScriptPart()
        The context associated with the parser's script. E.g., a file name, a library, a rule, etc.
      • setScript

        void setScript​(CharSequence strRule)
        Set the script or expression to parse and execute.
        Parameters:
        strRule - The rule (Gosu) source to parse/execute.
      • setScript

        void setScript​(SourceCodeReader reader)
        Set the script or expression to parse and execute.
        Parameters:
        reader - A reader for the rule (Gosu) source to parse/execute.
      • setScript

        void setScript​(ISource reader)
        Set the script or expression to parse and execute.
        Parameters:
        reader - A reader for the rule (Gosu) source to parse/execute.
      • getSymbolTable

        ISymbolTable getSymbolTable()
        Returns the parser's symbol table.
      • setSymbolTable

        void setSymbolTable​(ISymbolTable symTable)
        Sets the parser's symbol table.
        Parameters:
        symTable - The symbol table the parser will use when parsing and executing rules.
      • getTypeUsesMap

        ITypeUsesMap getTypeUsesMap()
        Get the type uses map.
      • setTypeUsesMap

        void setTypeUsesMap​(ITypeUsesMap typeUsesMap)
        Set the type uses map.
      • parseStatements

        IStatement parseStatements​(IScriptPartId partId)
                            throws ParseResultsException
        Parses a set of Gosu statements. To execute all of the Statements at once call Statement.execute().
        Returns:
        The parsed Statement[s].
        Throws:
        ParseResultsException - if any of the statements do not parse according to the Gosu grammar.
      • parseExpOrProgram

        IExpression parseExpOrProgram​(IScriptPartId partId)
                               throws ParseResultsException
        Parses a Gosu expression. If that fails, attempts to parse a Gosu program (which is also an expression, but which has a different grammar.
        Parameters:
        partId - Script part id
        Returns:
        either a pure expression or Program, depending on the source
        Throws:
        ParseResultsException - if neither an expression nor a program parses according to the Gosu grammar. We try to make a best guess as to which IParseResultsException to throw, so that the errors are as close as possible to the true cause of the IParseResultsException
      • parseExpOrProgram

        IExpression parseExpOrProgram​(IScriptPartId partId,
                                      boolean isolatedScope,
                                      boolean assignRuntime)
                               throws ParseResultsException
        Parses a Gosu expression. If that fails, attempts to parse a Gosu program (which is also an expression, but which has a different grammar.
        Parameters:
        partId - Script part id
        isolatedScope - if false, the program will modify the symbol table at the current scope
        Returns:
        either a pure expression or Program, depending on the source
        Throws:
        ParseResultsException - if neither an expression nor a program parses according to the Gosu grammar. We try to make a best guess as to which IParseResultsException to throw, so that the errors are as close as possible to the true cause of the IParseResultsException
      • parseTypeLiteral

        boolean parseTypeLiteral()
        Consumes a type literal from the current tokenizer, if one exists.
        Returns:
        true if a type literal was found, false otherwise
      • isParsed

        boolean isParsed()
        Returns:
        Whether or not the referenced Gosu source has been parsed.
      • hasWarnings

        boolean hasWarnings()
        Returns:
        Did the most recent parse have warnings
      • getLocations

        List<IParseTree> getLocations()
        Returns:
        All the locations corresponding to parsed elements.
      • getTokenizerInstructor

        ITokenizerInstructor getTokenizerInstructor()
        The TokenizerInstructor to use for this parser. Optional.
      • isThrowParseResultsExceptionForWarnings

        boolean isThrowParseResultsExceptionForWarnings()
      • setThrowParseExceptionForWarnings

        void setThrowParseExceptionForWarnings​(boolean bThrowParseExceptionForWarnings)
      • setWarnOnCaseIssue

        void setWarnOnCaseIssue​(boolean warnOnCaseIssue)
      • setEditorParser

        void setEditorParser​(boolean bEditorParser)
      • isEditorParser

        boolean isEditorParser()
      • putDfsDeclsInTable

        void putDfsDeclsInTable​(ISymbolTable table)
      • isCaptureSymbolsForEval

        boolean isCaptureSymbolsForEval()
      • setCaptureSymbolsForEval

        void setCaptureSymbolsForEval​(boolean bCaputreSymbolsForEval)
      • isParsingFunction

        boolean isParsingFunction()
      • isParsingBlock

        boolean isParsingBlock()
      • setGenerateRootExpressionAccessForProgram

        void setGenerateRootExpressionAccessForProgram​(boolean bGenRootExprAccess)
      • setSnapshotSymbols

        void setSnapshotSymbols()
      • parseUsesStatementList

        IUsesStatementList parseUsesStatementList​(boolean resolveTypes)
      • setIgnoreWarnings

        void setIgnoreWarnings​(Set<ResourceKey> ignoreWarnings)