|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jrubyparser.lexer.LexerSource
org.jrubyparser.lexer.ReaderLexerSource
public class ReaderLexerSource
| Field Summary |
|---|
| Fields inherited from class org.jrubyparser.lexer.LexerSource |
|---|
line, offset |
| Constructor Summary | |
|---|---|
ReaderLexerSource(String sourceName,
Reader in,
int line)
Create our food-source for the lexer |
|
| Method Summary | |
|---|---|
int |
chompReadAhead()
|
static LexerSource |
getSource(String name,
Reader content,
ParserConfiguration configuration)
Create a source. |
boolean |
isANewLine()
|
boolean |
lastWasBeginOfLine()
|
boolean |
matchMarker(String match,
boolean indent,
boolean checkNewline)
Match marker against input consumering lexer source as it goes...Unless it does not match then it reverts lexer source back to point when this method was invoked. |
boolean |
peek(int to)
Is the next character equal to 'to' |
int |
read()
Read next character from this source |
String |
readLineBytes()
|
String |
readUntil(char marker)
|
void |
setIsANewLine(boolean nextCharIsOnANewLine)
|
void |
setOffset(int offset)
|
int |
skipUntil(int c)
|
String |
toString()
|
void |
unread(int c)
Pushes char back onto this source. |
void |
unreadMany(CharSequence buffer)
|
boolean |
wasBeginOfLine()
Was the last character read from the stream the first character on a line |
| Methods inherited from class org.jrubyparser.lexer.LexerSource |
|---|
getFilename, getLine, getOffset, getPosition, getPosition |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ReaderLexerSource(String sourceName,
Reader in,
int line)
sourceName - is the file we are readingreader - is what represents the contents of file sourceNameline - starting line number for source (used by eval)extraPositionInformation - will gives us extra information that an IDE may want| Method Detail |
|---|
public int read()
throws IOException
read in class LexerSourceIOExceptionpublic void unread(int c)
unread in class LexerSourceto - be put back onto the source
public boolean peek(int to)
throws IOException
peek in class LexerSourceto - character to compare against
IOException
public static LexerSource getSource(String name,
Reader content,
ParserConfiguration configuration)
name - the name of the source (e.g a filename: foo.rb)content - the data of the source
public String readLineBytes()
throws IOException
readLineBytes in class LexerSourceIOException
public int skipUntil(int c)
throws IOException
skipUntil in class LexerSourceIOExceptionpublic void unreadMany(CharSequence buffer)
unreadMany in class LexerSource
public boolean matchMarker(String match,
boolean indent,
boolean checkNewline)
throws IOException
LexerSource
matchMarker in class LexerSourcematch - to match againstindent - eat any leading whitespacecheckNewline - includes a check that marker is followed by newline or EOF
IOException - if an error occurred reading from underlying IO sourcepublic boolean wasBeginOfLine()
wasBeginOfLine in class LexerSourcepublic boolean lastWasBeginOfLine()
lastWasBeginOfLine in class LexerSourcepublic String toString()
toString in class Object
public String readUntil(char marker)
throws IOException
readUntil in class LexerSourceIOExceptionpublic int chompReadAhead()
chompReadAhead in class LexerSourcepublic boolean isANewLine()
isANewLine in class LexerSourcepublic void setIsANewLine(boolean nextCharIsOnANewLine)
setIsANewLine in class LexerSourcepublic void setOffset(int offset)
setOffset in class LexerSource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||