de.hpi.fgis.dude.util.bibtex.parser
Class PseudoLexer

java.lang.Object
  extended by de.hpi.fgis.dude.util.bibtex.parser.PseudoLexer

final class PseudoLexer
extends Object

This is not a real lexer, since BibTex is such an insane format...

Author:
henkel

Nested Class Summary
(package private) static class PseudoLexer.Token
          The token class that is used within this lexer.
 
Constructor Summary
PseudoLexer(Reader input)
          Initializes the PseudoLexer.
 
Method Summary
 char currentInputChar()
          make sure to query enforceNoEof first!
 void enforceNoEof(String expected, boolean skipWhiteSpace)
          make sure you call
 void scan(char expected)
           
 int scanAlternatives(char[] alternatives, boolean lookAhead)
          The return value is an index into alternatives.
 void scanBracketedString(StringBuilder targetBuffer, boolean includeOuterBraces)
           
 String scanEntryTypeName()
           
 String scanLiteral(char[] terminationSet, boolean excludeWhitespace, boolean enforceNonzero)
           
 int scanLiteral(char[] terminationSet, boolean excludeWhitespace, boolean enforceNonzero, StringBuilder resultTargetBuffer)
          The return value is an index into the termination set the result is appended in the resultTargetBuffer
 String scanQuotedString()
           
 PseudoLexer.Token scanTopLevelCommentOrAtOrEOF()
          If it's a top-level comment, result.choice will be 0, for @ 1, for EOF 2.
 void skipWhitespace()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PseudoLexer

PseudoLexer(Reader input)
      throws IOException
Initializes the PseudoLexer.

Parameters:
input - The reader that is used internally.
Throws:
IOException - If an error occurs while reading the data.
Method Detail

scanTopLevelCommentOrAtOrEOF

public PseudoLexer.Token scanTopLevelCommentOrAtOrEOF()
                                               throws IOException
If it's a top-level comment, result.choice will be 0, for @ 1, for EOF 2.

Returns:
The next token.
Throws:
IOException - If an error occurs while reading the data.

scanAlternatives

public final int scanAlternatives(char[] alternatives,
                                  boolean lookAhead)
                           throws IOException,
                                  ParseException
The return value is an index into alternatives. If lookAhead is true we will not move forward ...

Parameters:
alternatives - ?
lookAhead - ?
Returns:
int ?
Throws:
IOException - If an error occurs during the reading process.
ParseException - If a parsing error occurs.

scanLiteral

public String scanLiteral(char[] terminationSet,
                          boolean excludeWhitespace,
                          boolean enforceNonzero)
                   throws ParseException,
                          IOException
Parameters:
terminationSet -
excludeWhitespace -
enforceNonzero -
Returns:
String
Throws:
ParseException
IOException

scanLiteral

public int scanLiteral(char[] terminationSet,
                       boolean excludeWhitespace,
                       boolean enforceNonzero,
                       StringBuilder resultTargetBuffer)
                throws ParseException,
                       IOException
The return value is an index into the termination set the result is appended in the resultTargetBuffer

Parameters:
terminationSet -
excludeWhitespace -
enforceNonzero -
resultTargetBuffer -
Returns:
Token
Throws:
ParseException
IOException

scanQuotedString

public String scanQuotedString()
                        throws IOException,
                               ParseException
Returns:
String
Throws:
IOException
ParseException

scanBracketedString

public void scanBracketedString(StringBuilder targetBuffer,
                                boolean includeOuterBraces)
                         throws ParseException,
                                IOException
Parameters:
targetBuffer -
includeOuterBraces -
Throws:
ParseException
IOException

scanEntryTypeName

public String scanEntryTypeName()
                         throws ParseException,
                                IOException
Returns:
String
Throws:
ParseException
IOException

scan

public void scan(char expected)
          throws ParseException,
                 IOException
Parameters:
expected -
Throws:
ParseException
IOException

skipWhitespace

public void skipWhitespace()
                    throws IOException
Throws:
IOException

enforceNoEof

public void enforceNoEof(String expected,
                         boolean skipWhiteSpace)
                  throws ParseException,
                         IOException
make sure you call

Parameters:
expected -
skipWhiteSpace -
Throws:
ParseException
IOException

currentInputChar

public char currentInputChar()
make sure to query enforceNoEof first!

Returns:
char


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.