Package org.jruby.lexer.yacc
Class RubyLexer
java.lang.Object
org.jruby.lexer.LexingCommon
org.jruby.lexer.yacc.RubyLexer
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map<ByteList,RubyLexer.Keyword> longprivate final ByteListprivate StrTermprivate static final HashMap<String,RubyLexer.Keyword> private ByteListprivate ParserSupportlongprivate final ByteListprivate IRubyWarningsFields inherited from class org.jruby.lexer.LexingCommon
__end__seen, AMPERSAND, AMPERSAND_AMPERSAND, AMPERSAND_DOT, ASCII8BIT_ENCODING, BACKSLASH, BACKTICK, BANG, BANG_EQ, BANG_TILDE, BEGIN_DOC_MARKER, braceNest, CALL, CARET, cmdArgumentState, CODING, COLON, COLON_COLON, COMMA, commandStart, conditionState, DOLLAR_BANG, DOLLAR_DOT, DOLLAR_UNDERSCORE, DOT, DOT_DOT, DOT_DOT_DOT, END_DOC_MARKER, END_MARKER, EOF, eofp, EQ, EQ_EQ, EQ_EQ_EQ, EQ_GT, EQ_TILDE, EXPR_ARG, EXPR_ARG_ANY, EXPR_BEG, EXPR_BEG_ANY, EXPR_CLASS, EXPR_CMDARG, EXPR_DOT, EXPR_END, EXPR_END_ANY, EXPR_ENDARG, EXPR_ENDFN, EXPR_FITEM, EXPR_FNAME, EXPR_LABEL, EXPR_LABELED, EXPR_MID, EXPR_VALUE, GT, GT_EQ, GT_GT, has_shebang, heredoc_end, heredoc_indent, heredoc_line_indent, inKwarg, last_cr_line, last_state, LBRACKET, LBRACKET_RBRACKET, LBRACKET_RBRACKET_EQ, LCURLY, lex_lastline, lex_nextline, lex_p, lex_pbeg, lex_pend, lex_state, lexb, line_count, line_offset, LT, LT_EQ, LT_EQ_RT, LT_LT, MINUS, MINUS_AT, MINUS_GT, OR, OR_OR, parenNest, PERCENT, PLUS, PLUS_AT, Q, QQ, QUESTION, RBRACKET, RCURLY, RPAREN, ruby_sourceline, SEMICOLON, SLASH, src, STAR, STAR_STAR, str_dquote, str_dsym, str_dword, STR_FUNC_ESCAPE, STR_FUNC_EXPAND, STR_FUNC_INDENT, STR_FUNC_LABEL, STR_FUNC_LIST, STR_FUNC_QWORDS, STR_FUNC_REGEXP, STR_FUNC_SYMBOL, STR_FUNC_TERM, str_label, str_regexp, str_squote, str_ssym, str_sword, str_xquote, SUFFIX_ALL, SUFFIX_I, SUFFIX_R, TAB_WIDTH, TILDE, token, tokenSeen, tokline, tokp, USASCII_ENCODING, UTF8_ENCODING, yaccValue -
Constructor Summary
ConstructorsConstructorDescriptionRubyLexer(ParserSupport support, LexerSource source) Deprecated.RubyLexer(ParserSupport support, LexerSource source, IRubyWarnings warnings) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidambiguousOperator(String op, String syn) private intampersand(boolean spaceSeen) private booleanprotected intprivate intat()private intbacktick(boolean commandState) private intbang()private intcaret()private intcolon(boolean spaceSeen) private intcomma(int c) voidcompile_error(String message) voidcompile_error(String message, long start, long end) voidcompile_error_pos(String message) private intconsiderComplex(int token, int suffix) private intdoKeyword(int state) private intdollar()private intdot()private intdoubleQuote(boolean commandState) private intgetFloatToken(String number, int suffix) private intgetIntegerToken(String value, int radix, int suffix) static RubyLexer.KeywordgetKeyword(String str) static RubyLexer.KeywordgetKeyword(ByteList str) private intgetNumberToken(String number, boolean seen_e, boolean seen_point, int nondigit) private intvoidheredoc_dedent(Node root) voidheredoc_restore(HeredocTerm here) private intprivate intidentifier(int c, boolean commandState) private intidentifierToken(int result, ByteList value) private intleftBracket(boolean spaceSeen) private intprivate intleftParen(boolean spaceSeen) private intlessThan(boolean spaceSeen) private intminus(boolean spaceSeen) protected voidmismatchedRegexpEncodingError(org.jcodings.Encoding optionEncoding, org.jcodings.Encoding encoding) private BignumNodenewBignumNode(String value, int radix) private ComplexNodenewComplexNode(NumericNode number) private FixnumNodenewFixnumNode(String value, int radix) private RationalNodenewRationalNode(String value, int radix) intnextc()intprivate intparseNumber(int c) Parse a number from the input stream.private intparseQuote(int c) What type/kind of quote are we dealing with?protected RegexpOptionsprivate intpercent(boolean spaceSeen) private intpipe()private intplus(boolean spaceSeen) private StringprepareMessage(String message, ByteList line, long start, long end) private voidprintToken(int token) private intintprivate voidreadUTF8EscapeIntoBuffer(int codepoint, ByteList buffer, boolean stringLiteral, boolean[] encodingDetermined) intreadUTFEscape(ByteList buffer, boolean stringLiteral, boolean[] encodingDetermined) voidreadUTFEscapeRegexpLiteral(ByteList buffer) voidreset()private intprivate intprivate intprivate intRead up to count hexadecimal digits.private charscanHexLiteral(ByteList buffer, int count, boolean strict, String errorMessage) Read up to count hexadecimal digits and store those digits in a token numberBuffer.protected voidsetCompileOptionFlag(String name, ByteList value) protected voidsetEncoding(ByteList name) voidsetStrTerm(StrTerm strterm) protected voidsetTokenInfo(String name, ByteList value) voidsetWarnings(IRubyWarnings warnings) private intsingleQuote(boolean commandState) private intslash(boolean spaceSeen) private intstar(boolean spaceSeen) private inttilde()inttokenize_ident(int result) private intprivate voidupdateStartPosition(int column) private voidprivate intyylex()Returns the next token.private intyylex2()Methods inherited from class org.jruby.lexer.LexingCommon
checkRegexpFragment, checkRegexpSyntax, column, comment_at_top, createAsEncodedString, createTokenByteList, createTokenByteList, createTokenString, createTokenString, dedent_string, flush, getBraceNest, getCmdArgumentState, getConditionState, getCurrentArg, getCurrentLine, getEncoding, getFile, getHeredocIndent, getHeredocLineIndent, getLeftParenBegin, getLineOffset, getRubySourceline, getState, getTokenCR, incrementParenNest, isAfterOperator, isARG, isASCII, isASCII, isBEG, isEND, isEndSeen, isGlobalCharPunct, isHexChar, isIdentifierChar, isLabelPossible, isLabelSuffix, isLexState, isLexStateAll, isNext_identchar, isOctChar, isSpace, isSpaceArg, lex_goto_eol, lineno, magicCommentEncoding, magicCommentMarker, newtok, numberLiteralSuffix, onMagicComment, optionsEncodingChar, p, parser_magic_comment, parser_prepare, parseRegexpFlags, peek, peek, peekVariableName, precise_mbclen, printState, pushback, resetStacks, scanOct, set_file_encoding, setBraceNest, setCurrentArg, setCurrentEncoding, setEncoding, setHeredocIndent, setHeredocLineIndent, setLeftParenBegin, setRegexpEncoding, setRubySourceline, setSource, setState, setValue, strncmp, tokAdd, tokadd_ident, tokadd_mbchar, tokadd_mbchar, tokaddmbc, tokCopy, token, update_heredoc_indent, validateFormalIdentifier, validateFormalIdentifier, value, warn_balanced, was_bol, whole_match_p
-
Field Details
-
map
-
byteList2Keyword
-
parserSupport
-
warnings
-
lex_strterm
-
start
public long start -
end
public long end -
TRUE
-
FALSE
-
numberBuffer
-
-
Constructor Details
-
RubyLexer
-
RubyLexer
Deprecated.
-
-
Method Details
-
newBignumNode
-
newFixnumNode
- Throws:
NumberFormatException
-
newRationalNode
- Throws:
NumberFormatException
-
newComplexNode
-
ambiguousOperator
- Specified by:
ambiguousOperatorin classLexingCommon
-
getKeyword
-
getKeyword
-
tokenize_ident
public int tokenize_ident(int result) - Specified by:
tokenize_identin classLexingCommon
-
reset
public void reset()- Overrides:
resetin classLexingCommon
-
nextc
public int nextc()- Specified by:
nextcin classLexingCommon
-
heredoc_dedent
-
compile_error
-
compile_error
- Specified by:
compile_errorin classLexingCommon
-
prepareMessage
-
compile_error_pos
-
updateTokenPosition
private void updateTokenPosition() -
updateStartPosition
private void updateStartPosition(int column) -
heredoc_restore
-
nextToken
- Throws:
IOException
-
setCompileOptionFlag
- Specified by:
setCompileOptionFlagin classLexingCommon
-
parseRegexpFlags
- Specified by:
parseRegexpFlagsin classLexingCommon- Throws:
IOException
-
mismatchedRegexpEncodingError
protected void mismatchedRegexpEncodingError(org.jcodings.Encoding optionEncoding, org.jcodings.Encoding encoding) - Specified by:
mismatchedRegexpEncodingErrorin classLexingCommon
-
asTruth
-
setTokenInfo
- Specified by:
setTokenInfoin classLexingCommon
-
setEncoding
- Specified by:
setEncodingin classLexingCommon
-
getStrTerm
-
setStrTerm
-
setWarnings
-
considerComplex
private int considerComplex(int token, int suffix) -
getFloatToken
-
getIntegerToken
-
createStr
-
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
- Throws:
IOException
-
yylex
Returns the next token. Also sets yyVal is needed.- Returns:
- Description of the Returned Value
- Throws:
IOException
-
identifierToken
-
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
- 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
-
readUTFEscapeRegexpLiteral
-
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
- Throws:
IOException
-
scanHexLiteral
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
-
scanHex
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.
-