Package org.nineml.coffeefilter
Class InvisibleXmlDocument
java.lang.Object
org.nineml.coffeefilter.InvisibleXmlDocument
- Direct Known Subclasses:
InvisibleXmlFailureDocument
An InvisibleXmlDocument represents a document created with an
InvisibleXmlParser.
From this object, you can obtain the parsed representation(s) of the document. For ambiguous grammars, there may be more than one.
-
Method Summary
Modifier and TypeMethodDescriptionorg.nineml.coffeegrinder.trees.TreeBuildergetAdapter(ContentHandler handler) Returns an adapter for SAX ContentHandlers.intGet the column number of the last line processed.intGet the line number of the last line processed.longReturn the number of available parses of this document.intGet the offset of the last character processed.Get the parser options.org.nineml.coffeegrinder.parser.ParserTypeReturn the parser type.Get the parser version.org.nineml.coffeegrinder.parser.GearleyResultReturn the underlyingGearleyResultresult for this parse.getTree()Return an XML representation of the current parse.voidgetTree(PrintStream output) Write an XML representation of the current parse to the stream.voidgetTree(org.nineml.coffeegrinder.trees.TreeBuilder builder) Process the result with your ownTreeBuilder.voidgetTree(ContentHandler handler) Write an XML representation of the current parse to a SAX ContentHandler.voidgetTree(ContentHandler handler, ParserOptions options) Write an XML representation of the current parse to a SAX ContentHandler using a different set of options.booleanIs this document ambiguous?booleanIs this document infinitely ambiguous?longReturns the amount of time (roughly) spent parsing.booleanDid the parse succeed?
-
Method Details
-
getParserVersion
Get the parser version.- Returns:
- the parser version
-
getOptions
Get the parser options.- Returns:
- the parser options
-
getLineNumber
public int getLineNumber()Get the line number of the last line processed.If the parse failed, this will be the line on which the error occurred. Lines are counted by occurrence of '\n'.
- Returns:
- the line number
-
getColumnNumber
public int getColumnNumber()Get the column number of the last line processed.If the parse failed, this will be the position of the character in the last line where the error occurred.
- Returns:
- the column number
-
getOffset
public int getOffset()Get the offset of the last character processed.If the parse failed, this will be the position of the character in the input stream.
- Returns:
- the offset
-
getResult
public org.nineml.coffeegrinder.parser.GearleyResult getResult()Return the underlyingGearleyResultresult for this parse.- Returns:
- the result
-
getParserType
public org.nineml.coffeegrinder.parser.ParserType getParserType()Return the parser type.- Returns:
- the parser type
-
succeeded
public boolean succeeded()Did the parse succeed?- Returns:
- true if the parse was successful
-
getNumberOfParses
public long getNumberOfParses()Return the number of available parses of this document.Will return 0 if there are no successful parses.
- Returns:
- The number of parses.
-
isAmbiguous
public boolean isAmbiguous()Is this document ambiguous?The return value is arbitrary if the parse did not succeed.
- Returns:
- true, if the document is ambiguous
-
isInfinitelyAmbiguous
public boolean isInfinitelyAmbiguous()Is this document infinitely ambiguous?The return value is arbitrary if the parse did not succeed.
- Returns:
- true, if the document is ambiguous
-
parseTime
public long parseTime()Returns the amount of time (roughly) spent parsing.- Returns:
- The number of milliseconds spent parsing.
-
getAdapter
Returns an adapter for SAX ContentHandlers.- Parameters:
handler- the content handler- Returns:
- an adapting tree builder
-
getTree
Return an XML representation of the current parse.- Returns:
- the XML.
- Throws:
IxmlException- if the parse failed
-
getTree
Write an XML representation of the current parse to the stream.- Parameters:
output- the output stream.
-
getTree
Write an XML representation of the current parse to a SAX ContentHandler.- Parameters:
handler- the content handler.
-
getTree
Write an XML representation of the current parse to a SAX ContentHandler using a different set of options.- Parameters:
handler- the content handler.options- the options.
-
getTree
public void getTree(org.nineml.coffeegrinder.trees.TreeBuilder builder) Process the result with your ownTreeBuilder.This API needs work.
- Parameters:
builder- the tree builder.
-