net.sf.parser4j.parser.service
Class ParsingToStringUtil

java.lang.Object
  extended by net.sf.parser4j.parser.service.ParsingToStringUtil
All Implemented Interfaces:
IParseNodeVisitor, ISyntaxNodeVisitor

public final class ParsingToStringUtil
extends java.lang.Object
implements IParseNodeVisitor, ISyntaxNodeVisitor

parse node, parse tree, to string utilities

Author:
luc peuvrier

Constructor Summary
ParsingToStringUtil(java.util.Map<java.lang.Integer,NonTerminal> nonTerminalByIdentifierMap)
           
 
Method Summary
 void beginAlternativeVisit(IParseNode node, int alternativeNumber)
           
 void beginAlternativeVisit(SyntaxNode syntaxNode, int alternativeNumber)
           
 boolean beginVisit(IParseNode parseNode)
          begin node visit
 boolean beginVisit(SyntaxNode syntaxNode)
           
 void endAlternativeVisit(IParseNode node, int alternativeNumber)
           
 void endAlternativeVisit(SyntaxNode syntaxNode, int alternativeNumber)
           
 void endVisit(IParseNode parseNode)
          end node visit, not invoke if IParseNodeVisitor.beginVisit(IParseNode) returned false
 void endVisit(SyntaxNode syntaxNode)
           
 java.lang.String grammarSymbolIdentifierToString(int grammarSymbolIdentifier)
          grammar symbol identifier to string
 java.lang.String parseNodesToString(IParseNode[] parseNodes, boolean addParseTree)
          parse nodes to string
 java.lang.String parseNodeToString(IParseNode parseNode)
          parse node to string
 java.lang.String parseStacksToString(ParseStack[] parseStacks, boolean[] tokenRecognition, boolean[] stringTokenRecognition, boolean addParseTree)
           
 java.lang.String parseStackToString(ParseStack parseStack, boolean[] tokenRecognition, boolean[] stringTokenRecognition, boolean addParseTree)
          parse stack to string
 java.lang.String parseStateToString(IParseState parseState, boolean[] tokenRecognition, boolean[] stringTokenRecognition, boolean addParseTree)
          parse state to string
 java.lang.String parseTreeToString(IParseNode rootParseNode, boolean visitAgainEnabled)
          parse tree to string
 java.lang.String syntaxTreeToString(SyntaxNode rootSyntaxNode, boolean visitAgainEnabled)
          syntax tree to string
 java.lang.String terminalIdentifierToString(int terminalIdentifier)
          terminal identifier to string : the character for ascii, or the utf code point \\uXXXX
 boolean visitFirstAlternativeOnly()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParsingToStringUtil

public ParsingToStringUtil(java.util.Map<java.lang.Integer,NonTerminal> nonTerminalByIdentifierMap)
Method Detail

parseStateToString

public java.lang.String parseStateToString(IParseState parseState,
                                           boolean[] tokenRecognition,
                                           boolean[] stringTokenRecognition,
                                           boolean addParseTree)
parse state to string

Parameters:
parseState -
tokenRecognition -
addParseTree - true if add parse tree for each node of parse nodes array
Returns:

parseStacksToString

public java.lang.String parseStacksToString(ParseStack[] parseStacks,
                                            boolean[] tokenRecognition,
                                            boolean[] stringTokenRecognition,
                                            boolean addParseTree)

parseStackToString

public java.lang.String parseStackToString(ParseStack parseStack,
                                           boolean[] tokenRecognition,
                                           boolean[] stringTokenRecognition,
                                           boolean addParseTree)
parse stack to string

Parameters:
parseStack -
tokenRecognition -
stringTokenRecognition -
addParseTree - true if add parse tree for each node of parse nodes array
Returns:

parseNodesToString

public java.lang.String parseNodesToString(IParseNode[] parseNodes,
                                           boolean addParseTree)
parse nodes to string

Parameters:
parseNodes -
addParseTree - true if add parse tree for each node of parse nodes array
Returns:

parseNodeToString

public java.lang.String parseNodeToString(IParseNode parseNode)
parse node to string

Parameters:
parseNode -
Returns:

parseTreeToString

public java.lang.String parseTreeToString(IParseNode rootParseNode,
                                          boolean visitAgainEnabled)
parse tree to string

Parameters:
rootParseNode -
Returns:

beginVisit

public boolean beginVisit(IParseNode parseNode)
Description copied from interface: IParseNodeVisitor
begin node visit

Specified by:
beginVisit in interface IParseNodeVisitor
Returns:
true if must do the son visit

visitFirstAlternativeOnly

public boolean visitFirstAlternativeOnly()
Specified by:
visitFirstAlternativeOnly in interface IParseNodeVisitor
Specified by:
visitFirstAlternativeOnly in interface ISyntaxNodeVisitor
Returns:
true if visit first alternative only

beginAlternativeVisit

public void beginAlternativeVisit(IParseNode node,
                                  int alternativeNumber)
Specified by:
beginAlternativeVisit in interface IParseNodeVisitor

endAlternativeVisit

public void endAlternativeVisit(IParseNode node,
                                int alternativeNumber)
Specified by:
endAlternativeVisit in interface IParseNodeVisitor

endVisit

public void endVisit(IParseNode parseNode)
Description copied from interface: IParseNodeVisitor
end node visit, not invoke if IParseNodeVisitor.beginVisit(IParseNode) returned false

Specified by:
endVisit in interface IParseNodeVisitor

grammarSymbolIdentifierToString

public java.lang.String grammarSymbolIdentifierToString(int grammarSymbolIdentifier)
grammar symbol identifier to string

Parameters:
grammarSymbolIdentifier -
Returns:

terminalIdentifierToString

public java.lang.String terminalIdentifierToString(int terminalIdentifier)
terminal identifier to string : the character for ascii, or the utf code point \\uXXXX

Parameters:
terminalIdentifier -
Returns:

syntaxTreeToString

public java.lang.String syntaxTreeToString(SyntaxNode rootSyntaxNode,
                                           boolean visitAgainEnabled)
syntax tree to string

Parameters:
rootParseNode -
Returns:

beginVisit

public boolean beginVisit(SyntaxNode syntaxNode)
Specified by:
beginVisit in interface ISyntaxNodeVisitor

beginAlternativeVisit

public void beginAlternativeVisit(SyntaxNode syntaxNode,
                                  int alternativeNumber)
Specified by:
beginAlternativeVisit in interface ISyntaxNodeVisitor

endAlternativeVisit

public void endAlternativeVisit(SyntaxNode syntaxNode,
                                int alternativeNumber)
Specified by:
endAlternativeVisit in interface ISyntaxNodeVisitor

endVisit

public void endVisit(SyntaxNode syntaxNode)
Specified by:
endVisit in interface ISyntaxNodeVisitor


Copyright © 2008-2009 Luc Peuvrier. All Rights Reserved.