Exemplo n.º 1
0
 /**
  * In dot mode a graphical representation of the internal parse forest <code>root</code> is
  * created and the path to the created file is returned. Otherwise a {@link String} representation
  * is returned.<br>
  * In verbose mode all used rules are printed. Otherwise only the rules defined in the grammar are
  * printed.<br>
  * In each case ambiguity nodes are highlighted.
  *
  * @param root {@link AbstractParseNode} which is the root of the internal parse forest
  * @return {@link String} message as a result of the printing process
  */
 private String printParseForest(AbstractParseNode root) {
   ParseForest2Output printer =
       graphBuilder.isDotMode()
           ? new ParseForest2Dot(this, graphBuilder.getDotOutputFormat())
           : new ParseForest2String(this);
   return printer.convertParseForest(root, graphBuilder.isVerboseMode());
 }
Exemplo n.º 2
0
 /**
  * In dot mode a graphical representation of the internal parse forest <code>root</code> is
  * created and the path to the created file is returned. Otherwise a {@link String} representation
  * is returned.<br>
  * In verbose mode all used rules are printed. Otherwise only the rules defined in the grammar are
  * printed.<br>
  * In each case ambiguity nodes and <code>nodeWithException</code> are highlighted.
  *
  * @param root {@link AbstractParseNode} which is the root of the internal parse forest
  * @param nodeWithException {@link AbstractParseNode} which caused an exception an will be
  *     highlighted in the output
  * @return {@link String} message as a result of the printing process
  */
 private String printParseForest(AbstractParseNode root, AbstractParseNode nodeWithException) {
   ParseForest2Output printer =
       graphBuilder.isDotMode()
           ? new ParseForest2Dot(this, graphBuilder.getDotOutputFormat())
           : new ParseForest2String(this);
   return printer.convertParseForest(
       root,
       graphBuilder.isVerboseMode(),
       graphBuilder.isVerboseMode()
           ? nodeWithException
           : stack.getCurrentElement().getParentApplicationOfDefinedRule().getRepresentedNode());
 }