Interface IGosuParser

All Superinterfaces:
IParserPart
All Known Implementing Classes:
GosuParser

public interface IGosuParser extends IParserPart
  • Field Details

    • NaN

      static final Double NaN
    • ZERO

      static final Double ZERO
    • ONE

      static final Double ONE
    • DOUBLE_DIGITS

      static final Double[] DOUBLE_DIGITS
    • BIGD_ZERO

      static final BigDecimal BIGD_ZERO
  • Method Details

    • 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.
    • parseProgram

      IProgram parseProgram(IScriptPartId partId) throws ParseResultsException
      Throws:
      ParseResultsException
    • parseProgram

      IProgram parseProgram(IScriptPartId partId, IType expectedExpressionType) throws ParseResultsException
      Throws:
      ParseResultsException
    • parseProgram

      IProgram parseProgram(IScriptPartId partId, IType expectedExpressionType, IFileContext ctx, boolean assignRuntime) throws ParseResultsException
      Throws:
      ParseResultsException
    • parseProgram

      IProgram parseProgram(IScriptPartId partId, IType expectedExpressionType, IFileContext ctx, boolean assignRuntime, boolean bDoNotThrowParseResultsException) throws ParseResultsException
      Throws:
      ParseResultsException
    • parseProgram

      IProgram parseProgram(IScriptPartId partId, boolean isolatedScope, boolean reallyIsolatedScope, IType expectedExpressionType, IFileContext ctx, boolean assignRuntime) throws ParseResultsException
      Throws:
      ParseResultsException
    • parseProgram

      IProgram parseProgram(IScriptPartId partId, boolean isolatedScope, boolean reallyIsolatedScope, IType expectedExpressionType, IFileContext ctx, boolean assignRuntime, boolean bDoNotThrowParseResultsException) throws ParseResultsException
      Throws:
      ParseResultsException
    • parseProgram

      IProgram parseProgram(IScriptPartId partId, boolean isolatedScope, boolean reallyIsolatedScope, IType expectedExpressionType, IFileContext ctx, boolean assignRuntime, boolean bDoNotThrowParseResultsException, IType superType) throws ParseResultsException
      Throws:
      ParseResultsException
    • parseClass

      IGosuClass parseClass(String strQualifiedClassName, ISourceFileHandle sourceFile, boolean bThrowOnWarnings, boolean bFullyCompile) throws ParseResultsException
      For use by code editors etc.
      Throws:
      ParseResultsException
    • parseExp

      Parses a Gosu expression. To evaluate the Expression simply call Expression.evaluate().
      Returns:
      The parsed Expression.
      Throws:
      ParseResultsException - if the expression does not parse according to the Gosu grammar.
    • parseExp

      IExpression parseExp(IScriptPartId partId, IType expectedExpressionType) throws ParseResultsException
      Parses a Gosu expression. To evaluate the Expression simply call Expression.evaluate().
      Returns:
      The parsed Expression.
      Throws:
      ParseResultsException - if the expression does not parse according to the Gosu grammar.
    • parseExp

      IExpression parseExp(IScriptPartId partId, IType expectedExpressionType, IFileContext context, boolean assignRuntime) throws ParseResultsException
      Parses a Gosu expression. To evaluate the Expression simply call Expression.evaluate().
      Returns:
      The parsed Expression.
      Throws:
      ParseResultsException - if the expression does 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

      Parses a type literal expression. The source must obviously satisfy the type literal syntax.
      Throws:
      ParseResultsException
    • 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.
    • setTokenizerInstructor

      void setTokenizerInstructor(ITokenizerInstructor instructor)
    • getTypeVariables

      Map<String,ITypeVariableDefinition> getTypeVariables()
    • 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)
    • getTokenizer

      ISourceCodeTokenizer getTokenizer()
    • parseParameterDeclarationList

      ArrayList<ISymbol> parseParameterDeclarationList(IParsedElement pe, boolean bStatic, List<IType> inferredArgumentTypes)
    • putDfsDeclInSetByName

      void putDfsDeclInSetByName(IDynamicFunctionSymbol specialFunction)
    • resolveTypeLiteral

      ITypeLiteralExpression resolveTypeLiteral(String strName)
    • getDfsDecls

      Map<String,List<IFunctionSymbol>> getDfsDecls()
    • getState

      IParserState getState()
    • isCaptureSymbolsForEval

      boolean isCaptureSymbolsForEval()
    • setCaptureSymbolsForEval

      void setCaptureSymbolsForEval(boolean bCaputreSymbolsForEval)
    • setDfsDeclInSetByName

      void setDfsDeclInSetByName(Map<String,List<IFunctionSymbol>> dfsDecl)
    • isParsingFunction

      boolean isParsingFunction()
    • isParsingBlock

      boolean isParsingBlock()
    • parseProgram

      IProgram parseProgram(IScriptPartId partId, boolean isolatedScope, IType expectedExpressionType) throws ParseResultsException
      Throws:
      ParseResultsException
    • setGenerateRootExpressionAccessForProgram

      void setGenerateRootExpressionAccessForProgram(boolean bGenRootExprAccess)
    • setSnapshotSymbols

      void setSnapshotSymbols()
    • parseUsesStatementList

      IUsesStatementList parseUsesStatementList(boolean resolveTypes)
    • popExpression

      IExpression popExpression()
    • setTokenizer

      void setTokenizer(ISourceCodeTokenizer tokenizer)
    • setIgnoreWarnings

      void setIgnoreWarnings(Set<ResourceKey> ignoreWarnings)