Class ParserConfiguration

java.lang.Object
org.jruby.parser.ParserConfiguration

public class ParserConfiguration extends Object
  • Field Details

    • existingScope

      private DynamicScope existingScope
    • asBlock

      private boolean asBlock
    • lineNumber

      private int lineNumber
    • inlineSource

      private boolean inlineSource
    • isEvalParse

      private boolean isEvalParse
    • isDebug

      private boolean isDebug
    • saveData

      private boolean saveData
    • frozenStringLiteral

      private boolean frozenStringLiteral
    • defaultEncoding

      private org.jcodings.Encoding defaultEncoding
    • runtime

      private final Ruby runtime
    • coverage

      private int[] coverage
    • EMPTY_COVERAGE

      private static final int[] EMPTY_COVERAGE
  • Constructor Details

    • ParserConfiguration

      public ParserConfiguration(Ruby runtime, int lineNumber, boolean inlineSource, boolean isFileParse, boolean saveData)
    • ParserConfiguration

      public ParserConfiguration(Ruby runtime, int lineNumber, boolean inlineSource, boolean isFileParse, RubyInstanceConfig config)
    • ParserConfiguration

      public ParserConfiguration(Ruby runtime, int lineNumber, boolean inlineSource, boolean isFileParse, boolean saveData, RubyInstanceConfig config)
  • Method Details

    • setFrozenStringLiteral

      public void setFrozenStringLiteral(boolean frozenStringLiteral)
    • isFrozenStringLiteral

      public boolean isFrozenStringLiteral()
    • setDefaultEncoding

      public void setDefaultEncoding(org.jcodings.Encoding encoding)
    • getDefaultEncoding

      public org.jcodings.Encoding getDefaultEncoding()
    • getEncodingService

      public EncodingService getEncodingService()
    • isDebug

      public boolean isDebug()
    • isEvalParse

      public boolean isEvalParse()
      Is the requested parse for an eval()?
      Returns:
      true if for eval
    • getKCode

      public KCode getKCode()
    • getLineNumber

      public int getLineNumber()
    • parseAsBlock

      public void parseAsBlock(DynamicScope existingScope)
      If we are performing an eval we should pass existing scope in. Calling this lets the parser know we need to do this.
      Parameters:
      existingScope - is the scope that captures new vars, etc...
    • getRuntime

      public Ruby getRuntime()
    • getScope

      public DynamicScope getScope(String file)
      This method returns the appropriate first scope for the parser.
      Returns:
      correct top scope for source to be parsed
    • isCoverageEnabled

      public boolean isCoverageEnabled()
    • isSaveData

      public boolean isSaveData()
      Get whether we are saving the DATA contents of the file.
    • isInlineSource

      public boolean isInlineSource()
      Are we parsing source provided as part of the '-e' option to Ruby.
      Returns:
      true if source is from -e option
    • coverLine

      public void coverLine(int i)
      Zero out coverable lines as they're encountered
    • growCoverageLines

      public void growCoverageLines(int i)
      Called by coverLine to grow it large enough to add new covered line. Also called at end up parse to pick up any extra non-code lines which should be marked -1 for not valid code lines.
    • finishCoverage

      public CoverageData finishCoverage(String file, int lines)
      At end of a parse if coverage is enabled we will do final processing of the primitive coverage array and make sure runtimes coverage data has been updated with this new data.
    • getCoverage

      @Deprecated public int[] getCoverage()
      Deprecated.
      Get the coverage array, indicating all coverable lines