Class RubyLexer

java.lang.Object
org.jruby.lexer.LexingCommon
org.jruby.lexer.yacc.RubyLexer

public class RubyLexer extends LexingCommon
  • Field Details

  • Constructor Details

  • Method Details

    • newBignumNode

      private BignumNode newBignumNode(String value, int radix)
    • newFixnumNode

      private FixnumNode newFixnumNode(String value, int radix) throws NumberFormatException
      Throws:
      NumberFormatException
    • newRationalNode

      private RationalNode newRationalNode(String value, int radix) throws NumberFormatException
      Throws:
      NumberFormatException
    • newComplexNode

      private ComplexNode newComplexNode(NumericNode number)
    • ambiguousOperator

      protected void ambiguousOperator(String op, String syn)
      Specified by:
      ambiguousOperator in class LexingCommon
    • getKeyword

      public static RubyLexer.Keyword getKeyword(ByteList str)
    • getKeyword

      public static RubyLexer.Keyword getKeyword(String str)
    • tokenize_ident

      public int tokenize_ident(int result)
      Specified by:
      tokenize_ident in class LexingCommon
    • reset

      public void reset()
      Overrides:
      reset in class LexingCommon
    • nextc

      public int nextc()
      Specified by:
      nextc in class LexingCommon
    • heredoc_dedent

      public void heredoc_dedent(Node root)
    • compile_error

      public void compile_error(String message, long start, long end)
    • compile_error

      public void compile_error(String message)
      Specified by:
      compile_error in class LexingCommon
    • prepareMessage

      private String prepareMessage(String message, ByteList line, long start, long end)
    • compile_error_pos

      public void compile_error_pos(String message)
    • updateTokenPosition

      private void updateTokenPosition()
    • updateStartPosition

      private void updateStartPosition(int column)
    • heredoc_restore

      public void heredoc_restore(HeredocTerm here)
    • nextToken

      public int nextToken() throws IOException
      Throws:
      IOException
    • setCompileOptionFlag

      protected void setCompileOptionFlag(String name, ByteList value)
      Specified by:
      setCompileOptionFlag in class LexingCommon
    • parseRegexpFlags

      protected RegexpOptions parseRegexpFlags() throws IOException
      Specified by:
      parseRegexpFlags in class LexingCommon
      Throws:
      IOException
    • mismatchedRegexpEncodingError

      protected void mismatchedRegexpEncodingError(org.jcodings.Encoding optionEncoding, org.jcodings.Encoding encoding)
      Specified by:
      mismatchedRegexpEncodingError in class LexingCommon
    • asTruth

      protected int asTruth(String name, ByteList value)
    • setTokenInfo

      protected void setTokenInfo(String name, ByteList value)
      Specified by:
      setTokenInfo in class LexingCommon
    • setEncoding

      protected void setEncoding(ByteList name)
      Specified by:
      setEncoding in class LexingCommon
    • getStrTerm

      public StrTerm getStrTerm()
    • setStrTerm

      public void setStrTerm(StrTerm strterm)
    • setWarnings

      public void setWarnings(IRubyWarnings warnings)
    • considerComplex

      private int considerComplex(int token, int suffix)
    • getFloatToken

      private int getFloatToken(String number, int suffix)
    • getIntegerToken

      private int getIntegerToken(String value, int radix, int suffix)
    • createStr

      public StrNode createStr(ByteList buffer, int flags)
    • parseQuote

      private int parseQuote(int c)
      What type/kind of quote are we dealing with?
      Parameters:
      c - first character the the quote construct
      Returns:
      a token that specifies the quote type
    • hereDocumentIdentifier

      private int hereDocumentIdentifier()
    • arg_ambiguous

      private boolean arg_ambiguous()
    • printToken

      private void printToken(int token)
    • yylex2

      private int yylex2() throws IOException
      Throws:
      IOException
    • yylex

      private int yylex() throws IOException
      Returns the next token. Also sets yyVal is needed.
      Returns:
      Description of the Returned Value
      Throws:
      IOException
    • identifierToken

      private int identifierToken(int result, ByteList value)
    • ampersand

      private int ampersand(boolean spaceSeen)
    • at

      private int at()
    • backtick

      private int backtick(boolean commandState)
    • bang

      private int bang()
    • caret

      private int caret()
    • colon

      private int colon(boolean spaceSeen)
    • comma

      private int comma(int c)
    • doKeyword

      private int doKeyword(int state)
    • dollar

      private int dollar()
    • dot

      private int dot()
    • doubleQuote

      private int doubleQuote(boolean commandState)
    • greaterThan

      private int greaterThan()
    • identifier

      private int identifier(int c, boolean commandState)
    • leftBracket

      private int leftBracket(boolean spaceSeen)
    • leftCurly

      private int leftCurly()
    • leftParen

      private int leftParen(boolean spaceSeen)
    • lessThan

      private int lessThan(boolean spaceSeen)
    • minus

      private int minus(boolean spaceSeen)
    • percent

      private int percent(boolean spaceSeen)
    • pipe

      private int pipe()
    • plus

      private int plus(boolean spaceSeen)
    • questionMark

      private int questionMark() throws IOException
      Throws:
      IOException
    • rightBracket

      private int rightBracket()
    • rightCurly

      private int rightCurly()
    • rightParen

      private int rightParen()
    • singleQuote

      private int singleQuote(boolean commandState)
    • slash

      private int slash(boolean spaceSeen)
    • star

      private int star(boolean spaceSeen)
    • tilde

      private int tilde()
    • parseNumber

      private int parseNumber(int c)
      Parse a number from the input stream.
      Parameters:
      c - The first character of the number.
      Returns:
      An int constant which represents a token.
    • getNumberToken

      private int getNumberToken(String number, boolean seen_e, boolean seen_point, int nondigit)
    • readUTFEscapeRegexpLiteral

      public void readUTFEscapeRegexpLiteral(ByteList buffer)
    • readUTFEscape

      public int readUTFEscape(ByteList buffer, boolean stringLiteral, boolean[] encodingDetermined) throws IOException
      Throws:
      IOException
    • readUTF8EscapeIntoBuffer

      private void readUTF8EscapeIntoBuffer(int codepoint, ByteList buffer, boolean stringLiteral, boolean[] encodingDetermined) throws IOException
      Throws:
      IOException
    • readEscape

      public int readEscape() throws IOException
      Throws:
      IOException
    • scanHexLiteral

      private char scanHexLiteral(ByteList buffer, int count, boolean strict, String errorMessage)
      Read up to count hexadecimal digits and store those digits in a token numberBuffer. If strict is provided then count number of hex digits must be present. If no digits can be read a syntax exception will be thrown. This will also return the codepoint as a value so codepoint ranges can be checked.
    • tokHex

      private int tokHex(int count, String errorMessage)
    • scanHex

      private int scanHex(int count, boolean strict, String errorMessage)
      Read up to count hexadecimal digits. If strict is provided then count number of hex digits must be present. If no digits can be read a syntax exception will be thrown.