Package dap4.core.dmr.parser.bison
Class Dap4ParserImpl
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- dap4.core.dmr.parser.bison.SaxEventHandler
-
- dap4.core.dmr.parser.bison.Dap4EventHandler
-
- dap4.core.dmr.parser.bison.Dap4Actions
-
- dap4.core.dmr.parser.bison.Dap4ParserImpl
-
- All Implemented Interfaces:
Dap4Parser,ContentHandler,DTDHandler,EntityResolver,ErrorHandler
public class Dap4ParserImpl extends Dap4Actions implements Dap4Parser
Implement the Dap4 Parse Actions
-
-
Field Summary
Fields Modifier and Type Field Description static StringbisonSkeletonName of the skeleton that generated this parser.static StringbisonVersionVersion number for the Bison executable that generated this parser.protected booleandebugprotected ErrorResponseerrorresponseprotected DMRFactoryfactoryprotected static intglobaldebuglevelprotected DapDatasetrootprotected Deque<DapNode>scopestackstatic intYYABORTReturned by a Bison action in order to stop the parsing process and return failure (false).static intYYACCEPTReturned by a Bison action in order to stop the parsing process and return success (true).static intYYERRORReturned by a Bison action in order to start error recovery without printing an error message.static intYYPUSH_MOREReturned by a Bison action in order to request a new token.-
Fields inherited from class dap4.core.dmr.parser.bison.Dap4EventHandler
SPECIALATTRPREFIX
-
-
Constructor Summary
Constructors Constructor Description Dap4ParserImpl(DMRFactory factory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Stringcleanup(String value)intgetDebugLevel()Answer the verbosity of the debugging output; 0 means that all kinds of output from the parser are suppressed.PrintStreamgetDebugStream()Return the PrintStream on which the debugging output is printed.DapDatasetgetDMR()ErrorResponsegetErrorResponse()booleangetErrorVerbose()Return whether verbose error messages are enabled.booleanparse(String input)intpush_parse(int yylextoken, Object yylexval)Push Parse input from external lexervoidpush_parse_initialize()(Re-)Initialize the state of the push parser.booleanrecovering()Return whether error recovery is being done.voidsetDebugLevel(int level)Set the verbosity of the debugging output; 0 means that all kinds of output from the parser are suppressed.voidsetDebugStream(PrintStream s)Set the PrintStream on which the debug output is printed.voidsetErrorVerbose(boolean verbose)Set the verbosity of error messages.static voidsetGlobalDebugLevel(int level)protected voidyycdebug(String s)voidyyerror(String msg)Print an error message via the lexer.-
Methods inherited from class dap4.core.dmr.parser.bison.Dap4EventHandler
yyevent
-
Methods inherited from class dap4.core.dmr.parser.bison.SaxEventHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, getLocator, ignorableWhitespace, locatedError, locatedEvent, notationDecl, processingInstruction, report, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, trace, unparsedEntityDecl, warning
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface dap4.core.dmr.parser.Dap4Parser
setDebugLevel
-
-
-
-
Field Detail
-
globaldebuglevel
protected static int globaldebuglevel
-
factory
protected DMRFactory factory
-
errorresponse
protected ErrorResponse errorresponse
-
root
protected DapDataset root
-
debug
protected boolean debug
-
bisonVersion
public static final String bisonVersion
Version number for the Bison executable that generated this parser.- See Also:
- Constant Field Values
-
bisonSkeleton
public static final String bisonSkeleton
Name of the skeleton that generated this parser.- See Also:
- Constant Field Values
-
YYACCEPT
public static final int YYACCEPT
Returned by a Bison action in order to stop the parsing process and return success (true).- See Also:
- Constant Field Values
-
YYABORT
public static final int YYABORT
Returned by a Bison action in order to stop the parsing process and return failure (false).- See Also:
- Constant Field Values
-
YYPUSH_MORE
public static final int YYPUSH_MORE
Returned by a Bison action in order to request a new token.- See Also:
- Constant Field Values
-
YYERROR
public static final int YYERROR
Returned by a Bison action in order to start error recovery without printing an error message.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Dap4ParserImpl
public Dap4ParserImpl(DMRFactory factory)
-
-
Method Detail
-
setGlobalDebugLevel
public static void setGlobalDebugLevel(int level)
-
getErrorResponse
public ErrorResponse getErrorResponse()
- Specified by:
getErrorResponsein interfaceDap4Parser
-
getDMR
public DapDataset getDMR()
- Specified by:
getDMRin interfaceDap4Parser
-
parse
public boolean parse(String input) throws SAXException
- Specified by:
parsein interfaceDap4Parser- Overrides:
parsein classSaxEventHandler- Throws:
SAXException
-
getErrorVerbose
public final boolean getErrorVerbose()
Return whether verbose error messages are enabled.
-
setErrorVerbose
public final void setErrorVerbose(boolean verbose)
Set the verbosity of error messages.- Parameters:
verbose- True to request verbose error messages.
-
getDebugStream
public final PrintStream getDebugStream()
Return the PrintStream on which the debugging output is printed.
-
setDebugStream
public final void setDebugStream(PrintStream s)
Set the PrintStream on which the debug output is printed.- Parameters:
s- The stream that is used for debugging output.
-
getDebugLevel
public final int getDebugLevel()
Answer the verbosity of the debugging output; 0 means that all kinds of output from the parser are suppressed.
-
setDebugLevel
public final void setDebugLevel(int level)
Set the verbosity of the debugging output; 0 means that all kinds of output from the parser are suppressed.- Parameters:
level- The verbosity level for debugging output.
-
yyerror
public final void yyerror(String msg)
Print an error message via the lexer.- Parameters:
msg- The error message.
-
yycdebug
protected final void yycdebug(String s)
-
recovering
public final boolean recovering()
Return whether error recovery is being done. In this state, the parser reads token until it reaches a known state, and then restarts normal operation.
-
push_parse
public int push_parse(int yylextoken, Object yylexval) throws DapException, DapExceptionPush Parse input from external lexer- Parameters:
yylextoken- current tokenyylexval- current lval- Returns:
- YYACCEPT, YYABORT, YYPUSH_MORE
- Throws:
DapException
-
push_parse_initialize
public void push_parse_initialize()
(Re-)Initialize the state of the push parser.
-
-