org.jruby.lexer.yacc
Class ByteListLexerSource

java.lang.Object
  extended by org.jruby.lexer.yacc.LexerSource
      extended by org.jruby.lexer.yacc.ByteListLexerSource
Direct Known Subclasses:
CapturingByteListLexerSource

public class ByteListLexerSource
extends LexerSource


Field Summary
 
Fields inherited from class org.jruby.lexer.yacc.LexerSource
line, offset
 
Constructor Summary
ByteListLexerSource(java.lang.String sourceName, org.jruby.util.ByteList bytelist, java.util.List<java.lang.String> list, int line, boolean extraPositionInformation)
           
 
Method Summary
 int getOffset()
          The location of the last byte we read from the source.
static LexerSource getSource(java.lang.String file, org.jruby.util.ByteList content, java.util.List<java.lang.String> list, ParserConfiguration configuration)
           
 boolean lastWasBeginOfLine()
           
 boolean matchMarker(org.jruby.util.ByteList marker, 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 c)
           
 int read()
           
 org.jruby.util.ByteList readLineBytes()
           
 org.jruby.util.ByteList readUntil(char marker)
           
 int skipUntil(int c)
           
 java.lang.String toString()
           
 void unread(int c)
           
 void unreadMany(java.lang.CharSequence line)
           
 boolean wasBeginOfLine()
           
 
Methods inherited from class org.jruby.lexer.yacc.LexerSource
captureFeature, getFilename, getLine, getPosition, getPosition, getPositionFactory, getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteListLexerSource

public ByteListLexerSource(java.lang.String sourceName,
                           org.jruby.util.ByteList bytelist,
                           java.util.List<java.lang.String> list,
                           int line,
                           boolean extraPositionInformation)
Method Detail

matchMarker

public boolean matchMarker(org.jruby.util.ByteList marker,
                           boolean indent,
                           boolean checkNewline)
                    throws java.io.IOException
Description copied from class: LexerSource
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.

Specified by:
matchMarker in class LexerSource
Parameters:
marker - to match against
indent - eat any leading whitespace
checkNewline - includes a check that marker is followed by newline or EOF
Returns:
true if marker matches...false otherwise
Throws:
java.io.IOException - if an error occurred reading from underlying IO source

peek

public boolean peek(int c)
             throws java.io.IOException
Specified by:
peek in class LexerSource
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Specified by:
read in class LexerSource
Throws:
java.io.IOException

readLineBytes

public org.jruby.util.ByteList readLineBytes()
                                      throws java.io.IOException
Specified by:
readLineBytes in class LexerSource
Throws:
java.io.IOException

skipUntil

public int skipUntil(int c)
              throws java.io.IOException
Specified by:
skipUntil in class LexerSource
Throws:
java.io.IOException

unread

public void unread(int c)
Specified by:
unread in class LexerSource

unreadMany

public void unreadMany(java.lang.CharSequence line)
Specified by:
unreadMany in class LexerSource

wasBeginOfLine

public boolean wasBeginOfLine()
Specified by:
wasBeginOfLine in class LexerSource

lastWasBeginOfLine

public boolean lastWasBeginOfLine()
Specified by:
lastWasBeginOfLine in class LexerSource

getSource

public static LexerSource getSource(java.lang.String file,
                                    org.jruby.util.ByteList content,
                                    java.util.List<java.lang.String> list,
                                    ParserConfiguration configuration)

getOffset

public int getOffset()
Description copied from class: LexerSource
The location of the last byte we read from the source.

Overrides:
getOffset in class LexerSource
Returns:
current location of source

readUntil

public org.jruby.util.ByteList readUntil(char marker)
                                  throws java.io.IOException
Specified by:
readUntil in class LexerSource
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2007 JRuby Team. All Rights Reserved.