Package org.jruby.ext.ripper
Class RubyLexer
java.lang.Object
org.jruby.lexer.LexingCommon
org.jruby.ext.ripper.RubyLexer
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class org.jruby.lexer.LexingCommon
__end__seen, AMPERSAND, AMPERSAND_AMPERSAND, AMPERSAND_DOT, AND_KEYWORD, 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, 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, KWNOREST, 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, NIL, OR, OR_KEYWORD, OR_OR, parenNest, PERCENT, PLUS, PLUS_AT, Q, QQ, QUESTION, RBRACKET, RCURLY, RPAREN, ruby_sourceline, SEMICOLON, SLASH, src, STAR, STAR_STAR, start, str_dquote, str_dsym, str_dword, STR_FUNC_ESCAPE, STR_FUNC_EXPAND, 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
(RipperParserBase parser, LexerSource src) RubyLexer
(RipperParserBase parser, LexerSource src, IRubyWarnings _warnings) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDelayedToken
(int tok, int end) protected void
ambiguousOperator
(String op, String syn) void
compile_error
(String message) void
dispatchDelayedToken
(int token) void
void
dispatchIgnoredScanEvent
(int token) void
dispatchScanEvent
(int token) protected void
flush_string_content
(org.jcodings.Encoding encoding) getIdent()
static RubyLexer.Keyword
getKeyword
(String str) boolean
boolean
Has lexing started yet?void
heredoc_restore
(HeredocTerm here) id()
boolean
protected void
mismatchedRegexpEncodingError
(org.jcodings.Encoding optionEncoding, org.jcodings.Encoding encoding) int
nextc()
int
protected boolean
onMagicComment
(String name, ByteList value) void
parse_error
(String message) protected RegexpOptions
protected void
protected void
set_yylval_name
(ByteList name) protected void
protected void
set_yylval_val
(ByteList name) protected void
setCompileOptionFlag
(String name, ByteList value) protected void
setEncoding
(ByteList name) void
setParser
(RipperParserBase parserSupport) Parse must pass its support object for some check at bottom of yylex().void
setStrTerm
(StrTerm strterm) protected void
setTokenInfo
(String name, ByteList value) protected int
src_line()
int
tokenize_ident
(int result) void
void
void
Methods inherited from class org.jruby.lexer.LexingCommon
checkRegexpFragment, checkRegexpSyntax, column, comment_at_top, compile_error_pos, createAsEncodedString, createTokenByteList, createTokenByteList, createTokenString, createTokenString, dedent_string, flush, getBraceNest, getCmdArgumentState, getConditionState, getCurrentArg, getCurrentLine, getEncoding, getFile, getHeredocIndent, getHeredocLineIndent, getLeftParenBegin, getLexContext, getLineOffset, getParenNest, getRubySourceline, getState, getTokenCR, incrementParenNest, IS_AFTER_OPERATOR, IS_ARG, IS_BEG, IS_END, IS_LABEL_POSSIBLE, IS_LABEL_SUFFIX, IS_lex_state, IS_lex_state_all, IS_SPCARG, isASCII, isASCII, isEndSeen, isGlobalCharPunct, isHexChar, isIdentifierChar, isLambdaBeginning, isLookingAtEOL, isNext_identchar, isOctChar, isSpace, ISSPACE, lex_goto_eol, lineno, magicCommentEncoding, magicCommentMarker, newtok, numberLiteralSuffix, optionsEncodingChar, p, parser_magic_comment, parser_prepare, parseRegexpFlags, peek, peek, peekVariableName, precise_mbclen, printState, pushback, readEscape, readUTF8EscapeIntoBuffer, readUTFEscape, readUTFEscapeRegexpLiteral, reset, resetStacks, scanHex, scanHexLiteral, scanOct, set_file_encoding, setBraceNest, setCurrentArg, setCurrentEncoding, setEncoding, setHeredocIndent, setHeredocLineIndent, setLeftParenBegin, setLexContext, setRegexpEncoding, setRubySourceline, setSource, setState, setValue, strncmp, tokAdd, tokadd_ident, tokadd_mbchar, tokadd_mbchar, tokaddmbc, tokCopy, token, tokHex, update_heredoc_indent, updateStartPosition, updateTokenPosition, validateFormalIdentifier, validateFormalIdentifier, value, warn_balanced, was_bol, whole_match_p
-
Field Details
-
delayed
-
-
Constructor Details
-
RubyLexer
-
RubyLexer
-
-
Method Details
-
ambiguousOperator
- Specified by:
ambiguousOperator
in classLexingCommon
-
onMagicComment
- Overrides:
onMagicComment
in classLexingCommon
-
src_line
protected int src_line() -
isVerbose
public boolean isVerbose() -
warn
-
warning
-
warning
-
getKeyword
-
hasStarted
public boolean hasStarted()Has lexing started yet? -
flush_string_content
protected void flush_string_content(org.jcodings.Encoding encoding) -
addDelayedToken
public void addDelayedToken(int tok, int end) -
nextc
public int nextc()- Specified by:
nextc
in classLexingCommon
-
dispatchHeredocEnd
public void dispatchHeredocEnd() -
compile_error
- Specified by:
compile_error
in classLexingCommon
-
parse_error
- Specified by:
parse_error
in classLexingCommon
-
set_yylval_id
- Overrides:
set_yylval_id
in classLexingCommon
-
id
- Overrides:
id
in classLexingCommon
-
set_yylval_noname
protected void set_yylval_noname() -
set_yylval_name
- Overrides:
set_yylval_name
in classLexingCommon
-
set_yylval_val
-
tokenize_ident
public int tokenize_ident(int result) - Specified by:
tokenize_ident
in classLexingCommon
-
heredoc_restore
-
nextToken
- Throws:
IOException
-
getIdent
-
getRuntime
-
setParser
Parse must pass its support object for some check at bottom of yylex(). Ruby does it this way as well (i.e. a little parsing logic in the lexer).- Parameters:
parserSupport
-
-
setCompileOptionFlag
- Specified by:
setCompileOptionFlag
in classLexingCommon
-
parseRegexpFlags
- Specified by:
parseRegexpFlags
in classLexingCommon
- Throws:
IOException
-
mismatchedRegexpEncodingError
protected void mismatchedRegexpEncodingError(org.jcodings.Encoding optionEncoding, org.jcodings.Encoding encoding) - Specified by:
mismatchedRegexpEncodingError
in classLexingCommon
-
setTokenInfo
- Specified by:
setTokenInfo
in classLexingCommon
-
setEncoding
- Specified by:
setEncoding
in classLexingCommon
-
getStrTerm
-
setStrTerm
-
createStr
-
tokenByteList
-
hasScanEvent
public boolean hasScanEvent() -
dispatchDelayedToken
public void dispatchDelayedToken(int token) -
dispatchIgnoredScanEvent
public void dispatchIgnoredScanEvent(int token) -
dispatchScanEvent
public void dispatchScanEvent(int token)
-