public class RubyLexer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RubyLexer.Keyword |
static class |
RubyLexer.LexState |
Modifier and Type | Field and Description |
---|---|
static org.jcodings.Encoding |
ASCII8BIT_ENCODING |
boolean |
commandStart |
ISourcePosition |
tokline |
static org.jcodings.Encoding |
USASCII_ENCODING |
static org.jcodings.Encoding |
UTF8_ENCODING |
Constructor and Description |
---|
RubyLexer() |
Modifier and Type | Method and Description |
---|---|
StrNode |
createStrNode(ISourcePosition position,
org.jruby.util.ByteList buffer,
int flags) |
int |
getBraceNest() |
StackState |
getCmdArgumentState() |
StackState |
getConditionState() |
String |
getCurrentLine() |
org.jcodings.Encoding |
getEncoding() |
static RubyLexer.Keyword |
getKeyword(String str) |
int |
getLeftParenBegin() |
ISourcePosition |
getPosition() |
ISourcePosition |
getPosition(ISourcePosition startPosition)
Get position information for Token/Node that follows node represented by startPosition
and current lexer location.
|
RubyLexer.LexState |
getState() |
StrTerm |
getStrTerm() |
StringBuilder |
getTokenBuffer() |
protected void |
handleFileEncodingComment(org.jruby.util.ByteList encodingLine) |
int |
incrementParenNest() |
boolean |
isASCII(int c) |
boolean |
isGlobalCharPunct(int c) |
boolean |
isIdentifierChar(int c)
This is a valid character for an identifier?
|
protected boolean |
isMultiByteChar(int c)
Is this a multibyte character from a multibyte encoding?
|
void |
newtok() |
int |
nextToken() |
protected boolean |
parseMagicComment(org.jruby.util.ByteList magicLine) |
protected int |
readComment()
Read a comment up to end of line.
|
int |
readEscape() |
int |
readUTFEscape(org.jruby.util.ByteList buffer,
boolean stringLiteral,
boolean symbolLiteral) |
void |
readUTFEscapeRegexpLiteral(org.jruby.util.ByteList buffer) |
void |
reset() |
void |
resetStacks() |
void |
setBraceNest(int nest) |
void |
setEncoding(org.jcodings.Encoding encoding) |
void |
setLeftParenBegin(int value) |
void |
setParserSupport(ParserSupport parserSupport)
Parse must pass its support object for some check at bottom of
yylex().
|
void |
setSource(LexerSource source)
Allow the parser to set the source for its lexer.
|
void |
setState(RubyLexer.LexState state) |
void |
setStrTerm(StrTerm strterm) |
void |
setValue(Object yaccValue) |
void |
setWarnings(IRubyWarnings warnings) |
void |
startOfToken() |
int |
token()
Last token read from the lexer at the end of a call to yylex()
|
int |
tokenAddMBC(int codepoint,
org.jruby.util.ByteList buffer) |
void |
tokenAddMBCFromSrc(int c,
org.jruby.util.ByteList buffer) |
Object |
value()
Value of last token (if it is a token which has a value).
|
public static final org.jcodings.Encoding UTF8_ENCODING
public static final org.jcodings.Encoding USASCII_ENCODING
public static final org.jcodings.Encoding ASCII8BIT_ENCODING
public ISourcePosition tokline
public boolean commandStart
public org.jcodings.Encoding getEncoding()
public static RubyLexer.Keyword getKeyword(String str)
public void startOfToken()
public void newtok()
public int incrementParenNest()
public int getBraceNest()
public void setBraceNest(int nest)
public int getLeftParenBegin()
public void setLeftParenBegin(int value)
public final void reset()
public int nextToken() throws IOException
IOException
public int token()
public StringBuilder getTokenBuffer()
public Object value()
public ISourcePosition getPosition(ISourcePosition startPosition)
startPosition
- previous node/tokenpublic ISourcePosition getPosition()
public String getCurrentLine()
public void setParserSupport(ParserSupport parserSupport)
parserSupport
- public void setEncoding(org.jcodings.Encoding encoding)
public void setSource(LexerSource source)
source
- where the lexer gets raw datapublic StrTerm getStrTerm()
public void setStrTerm(StrTerm strterm)
public void resetStacks()
public void setWarnings(IRubyWarnings warnings)
public RubyLexer.LexState getState()
public void setState(RubyLexer.LexState state)
public StackState getCmdArgumentState()
public StackState getConditionState()
public void setValue(Object yaccValue)
public boolean isIdentifierChar(int c)
c
- is character to be comparedpublic boolean isASCII(int c)
protected boolean isMultiByteChar(int c)
c
- public StrNode createStrNode(ISourcePosition position, org.jruby.util.ByteList buffer, int flags)
protected boolean parseMagicComment(org.jruby.util.ByteList magicLine) throws IOException
IOException
protected void handleFileEncodingComment(org.jruby.util.ByteList encodingLine) throws IOException
IOException
protected int readComment() throws IOException
IOException
public boolean isGlobalCharPunct(int c)
public void readUTFEscapeRegexpLiteral(org.jruby.util.ByteList buffer) throws IOException
IOException
public int tokenAddMBC(int codepoint, org.jruby.util.ByteList buffer)
public void tokenAddMBCFromSrc(int c, org.jruby.util.ByteList buffer) throws IOException
IOException
public int readUTFEscape(org.jruby.util.ByteList buffer, boolean stringLiteral, boolean symbolLiteral) throws IOException
IOException
public int readEscape() throws IOException
IOException
Copyright © 2001-2015 JRuby. All Rights Reserved.