public abstract class LexerSource
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
line |
protected int |
offset |
Modifier | Constructor and Description |
---|---|
protected |
LexerSource(java.lang.String sourceName,
java.util.List<java.lang.String> list,
int line,
boolean extraPositionInformation)
Create our food-source for the lexer
|
Modifier and Type | Method and Description |
---|---|
protected void |
captureFeature(int c) |
java.lang.String |
getCurrentLine() |
java.lang.String |
getFilename()
What file are we lexing?
|
int |
getLine()
What line are we at?
|
int |
getOffset()
The location of the last byte we read from the source.
|
ISourcePosition |
getPosition()
Where is the reader within the source {filename,row}
|
ISourcePosition |
getPosition(ISourcePosition startPosition)
Where is the reader within the source {filename,row}
|
abstract java.io.InputStream |
getRemainingAsStream() |
static LexerSource |
getSource(java.lang.String name,
byte[] content,
java.util.List<java.lang.String> list,
ParserConfiguration configuration) |
static LexerSource |
getSource(java.lang.String name,
java.io.InputStream content,
java.util.List<java.lang.String> list,
ParserConfiguration configuration)
Create a source.
|
abstract boolean |
lastWasBeginOfLine() |
protected java.lang.String |
makePointer(int length) |
abstract boolean |
matchMarker(org.jruby.util.ByteList marker,
boolean indent,
boolean withNewline)
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.
|
abstract boolean |
peek(int c) |
abstract int |
read() |
int |
readCodepoint(int first,
org.jcodings.Encoding encoding) |
abstract org.jruby.util.ByteList |
readLineBytes() |
abstract org.jruby.util.ByteList |
readUntil(char c) |
abstract int |
skipUntil(int c) |
protected void |
uncaptureFeature(int c) |
abstract void |
unread(int c) |
abstract void |
unreadMany(java.lang.CharSequence line) |
abstract boolean |
wasBeginOfLine() |
protected LexerSource(java.lang.String sourceName, java.util.List<java.lang.String> list, int line, boolean extraPositionInformation)
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 (deprecated)public java.lang.String getFilename()
public int getLine()
public int getOffset()
public ISourcePosition getPosition(ISourcePosition startPosition)
public ISourcePosition getPosition()
public static LexerSource getSource(java.lang.String name, java.io.InputStream content, java.util.List<java.lang.String> list, ParserConfiguration configuration)
name
- the name of the source (e.g a filename: foo.rb)content
- the data of the sourcepublic static LexerSource getSource(java.lang.String name, byte[] content, java.util.List<java.lang.String> list, ParserConfiguration configuration)
protected void captureFeature(int c)
protected void uncaptureFeature(int c)
public java.lang.String getCurrentLine()
protected java.lang.String makePointer(int length)
public int readCodepoint(int first, org.jcodings.Encoding encoding) throws java.io.IOException
java.io.IOException
public abstract boolean matchMarker(org.jruby.util.ByteList marker, boolean indent, boolean withNewline) throws java.io.IOException
marker
- to match againstindent
- eat any leading whitespacewithNewline
- includes a check that marker is followed by newline or EOFjava.io.IOException
- if an error occurred reading from underlying IO sourcepublic abstract int read() throws java.io.IOException
java.io.IOException
public abstract org.jruby.util.ByteList readUntil(char c) throws java.io.IOException
java.io.IOException
public abstract org.jruby.util.ByteList readLineBytes() throws java.io.IOException
java.io.IOException
public abstract int skipUntil(int c) throws java.io.IOException
java.io.IOException
public abstract void unread(int c)
public abstract void unreadMany(java.lang.CharSequence line)
public abstract boolean peek(int c) throws java.io.IOException
java.io.IOException
public abstract boolean lastWasBeginOfLine()
public abstract boolean wasBeginOfLine()
public abstract java.io.InputStream getRemainingAsStream() throws java.io.IOException
java.io.IOException
Copyright © 2002-2009 JRuby Team. All Rights Reserved.