com.ricebridge.csvman
Class CsvParser

java.lang.Object
  extended bycom.ricebridge.csvman.imp.antlr.Parser
      extended bycom.ricebridge.csvman.imp.antlr.LLkParser
          extended bycom.ricebridge.csvman.CsvParser
All Implemented Interfaces:
CsvParserTokenTypes

public class CsvParser
extends com.ricebridge.csvman.imp.antlr.LLkParser
implements CsvParserTokenTypes

Internal Class; handles parsing of CSV text using the ANTLR parser generator.

ANTLR is used by Ricebridge CSV Manager under the terms of the ANTLR license, which allows for commercial redistribution.


Nested Class Summary
static class CsvParser.HandleLineException
          Internal Class; parser exceptions.
 
Field Summary
static String[] _tokenNames
           
static com.ricebridge.csvman.imp.antlr.collections.impl.BitSet _tokenSet_0
           
static com.ricebridge.csvman.imp.antlr.collections.impl.BitSet _tokenSet_1
           
 int iBadLineState
           
static int JUSTBAD
           
static int LASTBAD
           
static int NOTBAD
           
static int REALLYBAD
           
 
Fields inherited from class com.ricebridge.csvman.imp.antlr.Parser
inputState, tokenNames, traceDepth
 
Fields inherited from interface com.ricebridge.csvman.CsvParserTokenTypes
COMMENT, DQ, EC, ENDOFLINE, EOF, FIELD, MERGE_SEP, NULL_TREE_LOOKAHEAD, QUOTED_FIELD, ROOT, SEP, SINGLE_SEP, UNQUOTED_FIELD
 
Constructor Summary
  CsvParser(com.ricebridge.csvman.imp.antlr.ParserSharedInputState state)
           
  CsvParser(com.ricebridge.csvman.imp.antlr.TokenBuffer tokenBuf)
           
protected CsvParser(com.ricebridge.csvman.imp.antlr.TokenBuffer tokenBuf, int k)
           
  CsvParser(com.ricebridge.csvman.imp.antlr.TokenStream lexer)
           
protected CsvParser(com.ricebridge.csvman.imp.antlr.TokenStream lexer, int k)
           
 
Method Summary
 void addField(String pValue)
           
 void badLine(Exception e)
          keeps parsing as if at line end, so badline must be built from multiple line matches
 boolean checkLineWithinBounds()
           
 void closeBadLine(boolean pCallBadLine, boolean pOnward, String entry)
           
 boolean emptyLine()
           
 void endline()
           
 void field()
           
 long getBadLineCount()
           
 List getBadLines()
           
 long getLineCount()
           
 boolean handleLine()
           
 boolean line()
           
 boolean lineWithinBounds()
           
 void reportError(com.ricebridge.csvman.imp.antlr.RecognitionException pRE)
           
 void reportError(String pText)
           
 void reportWarning(String pText)
           
 void sep_first()
           
 void sep()
           
 void setCollectBadLines(boolean pCollectBadLines)
           
 void setCsvBuffer(CsvBuffer pCsvBuffer)
           
 void setEndLine(long pEndLine)
           
 void setEndOfLine(String pEndOfLine)
           
 void setFieldListener(FieldListener pFieldListener)
           
 void setIgnoreBadLines(boolean pIgnoreBadLines)
           
 void setIgnoreEmptyLines(boolean pIgnoreEmptyLines)
           
 void setLineListener(LineListener pLineListener)
           
 void setNumFields(int pSize)
           
 void setStartLine(long pStartLine)
           
 void table()
           
 
Methods inherited from class com.ricebridge.csvman.imp.antlr.LLkParser
consume, LA, LT, traceIn, traceOut
 
Methods inherited from class com.ricebridge.csvman.imp.antlr.Parser
consumeUntil, consumeUntil, defaultDebuggingSetup, getFilename, getInputState, getTokenName, getTokenNames, isDebugMode, mark, match, match, matchNot, rewind, setDebugMode, setFilename, setIgnoreInvalidDebugCalls, setInputState, setTokenBuffer, traceIndent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTBAD

public static int NOTBAD

JUSTBAD

public static int JUSTBAD

LASTBAD

public static int LASTBAD

REALLYBAD

public static int REALLYBAD

iBadLineState

public int iBadLineState

_tokenNames

public static final String[] _tokenNames

_tokenSet_0

public static final com.ricebridge.csvman.imp.antlr.collections.impl.BitSet _tokenSet_0

_tokenSet_1

public static final com.ricebridge.csvman.imp.antlr.collections.impl.BitSet _tokenSet_1
Constructor Detail

CsvParser

protected CsvParser(com.ricebridge.csvman.imp.antlr.TokenBuffer tokenBuf,
                    int k)

CsvParser

public CsvParser(com.ricebridge.csvman.imp.antlr.TokenBuffer tokenBuf)

CsvParser

protected CsvParser(com.ricebridge.csvman.imp.antlr.TokenStream lexer,
                    int k)

CsvParser

public CsvParser(com.ricebridge.csvman.imp.antlr.TokenStream lexer)

CsvParser

public CsvParser(com.ricebridge.csvman.imp.antlr.ParserSharedInputState state)
Method Detail

reportError

public void reportError(com.ricebridge.csvman.imp.antlr.RecognitionException pRE)

reportError

public void reportError(String pText)

reportWarning

public void reportWarning(String pText)

setNumFields

public void setNumFields(int pSize)

setLineListener

public void setLineListener(LineListener pLineListener)

setFieldListener

public void setFieldListener(FieldListener pFieldListener)

setEndOfLine

public void setEndOfLine(String pEndOfLine)

setCsvBuffer

public void setCsvBuffer(CsvBuffer pCsvBuffer)

setIgnoreBadLines

public void setIgnoreBadLines(boolean pIgnoreBadLines)

setCollectBadLines

public void setCollectBadLines(boolean pCollectBadLines)

setIgnoreEmptyLines

public void setIgnoreEmptyLines(boolean pIgnoreEmptyLines)

setStartLine

public void setStartLine(long pStartLine)

setEndLine

public void setEndLine(long pEndLine)

addField

public void addField(String pValue)

getLineCount

public long getLineCount()

getBadLineCount

public long getBadLineCount()

getBadLines

public List getBadLines()

emptyLine

public boolean emptyLine()

checkLineWithinBounds

public boolean checkLineWithinBounds()

lineWithinBounds

public boolean lineWithinBounds()

badLine

public void badLine(Exception e)
keeps parsing as if at line end, so badline must be built from multiple line matches


closeBadLine

public void closeBadLine(boolean pCallBadLine,
                         boolean pOnward,
                         String entry)

handleLine

public boolean handleLine()

table

public final void table()
                 throws com.ricebridge.csvman.imp.antlr.RecognitionException,
                        com.ricebridge.csvman.imp.antlr.TokenStreamException,
                        Exception
Throws:
com.ricebridge.csvman.imp.antlr.RecognitionException
com.ricebridge.csvman.imp.antlr.TokenStreamException
Exception

line

public final boolean line()
                   throws com.ricebridge.csvman.imp.antlr.RecognitionException,
                          com.ricebridge.csvman.imp.antlr.TokenStreamException,
                          Exception
Throws:
com.ricebridge.csvman.imp.antlr.RecognitionException
com.ricebridge.csvman.imp.antlr.TokenStreamException
Exception

sep_first

public final void sep_first()
                     throws com.ricebridge.csvman.imp.antlr.RecognitionException,
                            com.ricebridge.csvman.imp.antlr.TokenStreamException
Throws:
com.ricebridge.csvman.imp.antlr.RecognitionException
com.ricebridge.csvman.imp.antlr.TokenStreamException

field

public final void field()
                 throws com.ricebridge.csvman.imp.antlr.RecognitionException,
                        com.ricebridge.csvman.imp.antlr.TokenStreamException
Throws:
com.ricebridge.csvman.imp.antlr.RecognitionException
com.ricebridge.csvman.imp.antlr.TokenStreamException

sep

public final void sep()
               throws com.ricebridge.csvman.imp.antlr.RecognitionException,
                      com.ricebridge.csvman.imp.antlr.TokenStreamException
Throws:
com.ricebridge.csvman.imp.antlr.RecognitionException
com.ricebridge.csvman.imp.antlr.TokenStreamException

endline

public final void endline()
                   throws com.ricebridge.csvman.imp.antlr.RecognitionException,
                          com.ricebridge.csvman.imp.antlr.TokenStreamException
Throws:
com.ricebridge.csvman.imp.antlr.RecognitionException
com.ricebridge.csvman.imp.antlr.TokenStreamException


Copyright © 2003-2006 Ricebridge