| java.lang.Object org.jruby.lexer.yacc.LexerSource
LexerSource | public class LexerSource (Code) | | This class is what feeds the lexer. It is primarily a wrapper around a
Reader that can unread() data back onto the source. Originally, I thought
about using the PushBackReader to handle read/unread, but I realized that
some extremely pathological case could overflow the pushback buffer. Better
safe than sorry. I could have combined this implementation with a
PushbackBuffer, but the added complexity did not seem worth it.
author: enebo |
Constructor Summary | |
public | LexerSource(String sourceName, Reader reader, int line, boolean extraPositionInformation) |
LexerSource | public LexerSource(String sourceName, Reader reader, int line, boolean extraPositionInformation)(Code) | | Create our food-source for the lexer
Parameters: sourceName - is the file we are reading Parameters: reader - is what represents the contents of file sourceName Parameters: line - starting line number for source (used by eval) Parameters: extraPositionInformation - will gives us extra information that an IDE may want |
chompReadAhead | public int chompReadAhead()(Code) | | |
getCharAt | public char getCharAt(int anOffset) throws IOException(Code) | | Get character ahead of current position by offset positions.
Parameters: anOffset - is location past current position to get char at character index positions ahead of source location or EOF |
getFilename | public String getFilename()(Code) | | What file are we lexing?
the files name |
getLine | public int getLine()(Code) | | What line are we at?
the line number 0...line_size-1 |
getOffset | public int getOffset()(Code) | | The location of the last byte we read from the source.
current location of source |
getPosition | public ISourcePosition getPosition(ISourcePosition startPosition, boolean inclusive)(Code) | | Where is the reader within the source {filename,row}
the current position |
getPosition | public ISourcePosition getPosition()(Code) | | Where is the reader within the source {filename,row}
the current position |
getPositionFactory | public ISourcePositionFactory getPositionFactory()(Code) | | |
getSource | public static LexerSource getSource(String name, Reader content, int line, boolean extraPositionInformation)(Code) | | Create a source.
Parameters: name - the name of the source (e.g a filename: foo.rb) Parameters: content - the data of the source the new source |
isANewLine | public boolean isANewLine()(Code) | | |
read | public char read() throws IOException(Code) | | Read next character from this source
next character to viewed by the source |
setIsANewLine | public void setIsANewLine(boolean nextCharIsOnANewLine)(Code) | | |
setOffset | public void setOffset(int offset)(Code) | | |
unread | public void unread(char c)(Code) | | Pushes char back onto this source. Note, this also
allows us to push whatever is passes back into the source.
Parameters: c - to be put back onto the source |
wasBeginOfLine | public boolean wasBeginOfLine()(Code) | | |
|
|