|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jrubyparser.lexer.Lexer
public class Lexer
This is a port of the MRI lexer to Java it is compatible to Ruby 1.8.x and Ruby 1.9.x depending on compatibility flag.
| Nested Class Summary | |
|---|---|
static class |
Lexer.HeredocContext
|
static class |
Lexer.Keyword
|
static class |
Lexer.LexState
|
| Field Summary | |
|---|---|
boolean |
commandStart
|
Lexer.HeredocContext |
heredocContext
|
| Constructor Summary | |
|---|---|
Lexer()
|
|
Lexer(boolean isOneEight)
|
|
| Method Summary | |
|---|---|
boolean |
advance()
How the parser advances to the next token. |
boolean |
collectComments()
|
StackState |
getCmdArgumentState()
|
StackState |
getConditionState()
|
String |
getCurrentLine()
|
String |
getEncoding()
|
static Lexer.Keyword |
getKeyword(String str)
|
int |
getLeftParenBegin()
|
Lexer.LexState |
getLexState()
|
SourcePosition |
getPosition()
|
SourcePosition |
getPosition(SourcePosition startPosition,
boolean inclusive)
Get position information for Token/Node that follows node represented by startPosition and current lexer location. |
boolean |
getPreserveSpaces()
Return whether or not the lexer should be "space preserving". |
LexerSource |
getSource()
|
StrTerm |
getStrTerm()
|
CStringBuilder |
getTokenBuffer()
|
protected void |
handleFileEncodingComment(String encodingLine)
|
int |
incrementParenNest()
|
boolean |
isCommandStart()
|
boolean |
isIdentifierChar(int c)
This is a valid character for an identifier? |
boolean |
isOneEight()
|
boolean |
isSetSpaceSeen()
|
int |
nextToken()
|
protected boolean |
parseMagicComment(String magicLine)
|
protected int |
readComment(int c)
Read a comment up to end of line. |
int |
readEscape()
|
int |
readUTFEscape(CStringBuilder buffer,
boolean stringLiteral,
boolean symbolLiteral)
|
void |
readUTFEscapeRegexpLiteral(CStringBuilder buffer)
|
void |
reset()
|
void |
resetStacks()
|
void |
setCommandStart(boolean commandStart)
|
void |
setEncoding(String encoding)
|
void |
setLeftParenBegin(int value)
|
void |
setLexState(Lexer.LexState lex_state)
|
void |
setParserSupport(ParserSupport parserSupport)
Parse must pass its support object for some check at bottom of yylex(). |
void |
setPreserveSpaces(boolean preserveSpaces)
Set whether or not the lexer should be "space preserving" - in other words, whether the parser should consider whitespace sequences and code comments to be separate tokens to return to the client. |
void |
setSource(LexerSource source)
Allow the parser to set the source for its lexer. |
void |
setSpaceSeen(boolean setSpaceSeen)
|
void |
setState(Lexer.LexState state)
|
void |
setStrTerm(StrTerm strterm)
|
void |
setValue(Object yaccValue)
|
void |
setWarnings(IRubyWarnings warnings)
|
int |
token()
Last token read from the lexer at the end of a call to yylex() |
int |
tokenAddMBC(int codepoint,
CStringBuilder buffer)
|
void |
tokenAddMBCFromSrc(int c,
CStringBuilder buffer)
|
Object |
value()
Value of last token (if it is a token which has a value). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public Lexer.HeredocContext heredocContext
public boolean commandStart
| Constructor Detail |
|---|
public Lexer()
public Lexer(boolean isOneEight)
| Method Detail |
|---|
public static Lexer.Keyword getKeyword(String str)
public void setPreserveSpaces(boolean preserveSpaces)
preserveSpaces - If true, return space and comment sequences as tokens, if false, skip thesegetPreserveSpaces()public boolean getPreserveSpaces()
setPreserveSpaces(boolean).
setPreserveSpaces(boolean)public Lexer.LexState getLexState()
public void setLexState(Lexer.LexState lex_state)
public boolean isSetSpaceSeen()
public void setSpaceSeen(boolean setSpaceSeen)
public boolean isCommandStart()
public void setCommandStart(boolean commandStart)
public LexerSource getSource()
public int incrementParenNest()
public int getLeftParenBegin()
public void setLeftParenBegin(int value)
public void reset()
public boolean advance()
throws IOException
IOException
public int nextToken()
throws IOException
IOExceptionpublic int token()
public CStringBuilder getTokenBuffer()
public Object value()
public SourcePosition getPosition(SourcePosition startPosition,
boolean inclusive)
startPosition - previous node/tokeninclusive - include previous node into position information of current node
public SourcePosition getPosition()
public String getCurrentLine()
public void setEncoding(String encoding)
public String getEncoding()
public void setParserSupport(ParserSupport parserSupport)
parserSupport - 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 void setState(Lexer.LexState state)
public StackState getCmdArgumentState()
public boolean isOneEight()
public StackState getConditionState()
public void setValue(Object yaccValue)
public boolean isIdentifierChar(int c)
c - is character to be compared
protected boolean parseMagicComment(String magicLine)
throws IOException
IOException
protected void handleFileEncodingComment(String encodingLine)
throws IOException
IOExceptionpublic boolean collectComments()
protected int readComment(int c)
throws IOException
c - last character read from lexer source
IOException
public void readUTFEscapeRegexpLiteral(CStringBuilder buffer)
throws IOException
IOException
public int tokenAddMBC(int codepoint,
CStringBuilder buffer)
public void tokenAddMBCFromSrc(int c,
CStringBuilder buffer)
throws IOException
IOException
public int readUTFEscape(CStringBuilder buffer,
boolean stringLiteral,
boolean symbolLiteral)
throws IOException
IOException
public int readEscape()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||