xtc.parser
Class HtmlPrinter

java.lang.Object
  extended by xtc.tree.Visitor
      extended by xtc.parser.PrettyPrinter
          extended by xtc.parser.HtmlPrinter

public class HtmlPrinter
extends PrettyPrinter

A grammar pretty printer producing HTML.

Version:
$Revision: 1.28 $
Author:
Robert Grimm

Field Summary
protected  Analyzer analyzer
          The analyzer utility.
protected  boolean isGrammar
          The flag for whether we are processing a grammar or single module.
protected  int pNumber
          The number of the current production.
protected  Runtime runtime
          The runtime.
 
Fields inherited from class xtc.parser.PrettyPrinter
ast, isTopLevel, newline, parenChoice, parenSequence, printer, verbose
 
Constructor Summary
HtmlPrinter(Runtime runtime, Analyzer analyzer, AST ast, boolean verbose)
          Create a new HTML printer.
 
Method Summary
protected  void enter(Production p)
          Enter the specified production.
protected  void exit(Production p)
          Exit the specified production.
protected  void open(java.lang.String name)
          Create a printer for the specified file.
protected  void print(Module m)
          Actually print the specified module.
protected  void print(ModuleDependency dep, java.lang.String name)
          Print the specified module dependency.
protected  void print(ModuleName name, boolean resolved)
          Print a linked version of the specified module name.
protected  void print(java.lang.String s)
          Print the specified action string.
protected  void printDocumentation(Module m)
          Print the specified module documentation comment.
protected  void printOption(Module m)
          Print the specified module's options.
protected  int regexEscapes()
          Get the flags for escaping regex strings.
protected  int stringEscapes()
          Get the flags for escaping regular strings.
 void visit(Grammar g)
          Print the specified grammar.
 void visit(Module m)
          Print the specified module.
 void visit(NonTerminal nt)
          Print the specified nonterminal.
 void visit(SequenceName n)
          Print the specified sequence name.
 void visit(StringValue v)
          Print the specified string value.
 void visit(TokenValue v)
          Print the specified token value.
 
Methods inherited from class xtc.parser.PrettyPrinter
flush, format, isPrefix, print, print, printActions, printModule, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class xtc.tree.Visitor
dispatch, equals, hashCode, iterate, map, mapInPlace, unableToVisit, visit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

runtime

protected final Runtime runtime
The runtime.


analyzer

protected final Analyzer analyzer
The analyzer utility.


isGrammar

protected boolean isGrammar
The flag for whether we are processing a grammar or single module.


pNumber

protected int pNumber
The number of the current production.

Constructor Detail

HtmlPrinter

public HtmlPrinter(Runtime runtime,
                   Analyzer analyzer,
                   AST ast,
                   boolean verbose)
Create a new HTML printer.

Parameters:
runtime - The runtime.
analyzer - The analyzer.
ast - The type operations.
verbose - The verbose flag.
Method Detail

stringEscapes

protected int stringEscapes()
Description copied from class: PrettyPrinter
Get the flags for escaping regular strings.

Overrides:
stringEscapes in class PrettyPrinter
Returns:
The flags for escaping strings.

regexEscapes

protected int regexEscapes()
Description copied from class: PrettyPrinter
Get the flags for escaping regex strings.

Overrides:
regexEscapes in class PrettyPrinter
Returns:
The flags for escaping regex strings.

open

protected void open(java.lang.String name)
             throws java.io.IOException
Create a printer for the specified file. This method initializes this class' printer to a printer writing to the file with the specified name in the runtime's output directory.

Parameters:
name - The file name.
Throws:
java.io.IOException

printDocumentation

protected void printDocumentation(Module m)
Description copied from class: PrettyPrinter
Print the specified module documentation comment.

Overrides:
printDocumentation in class PrettyPrinter
Parameters:
m - The module.

printOption

protected void printOption(Module m)
Description copied from class: PrettyPrinter
Print the specified module's options.

Overrides:
printOption in class PrettyPrinter
Parameters:
m - The module.

print

protected void print(Module m)
Actually print the specified module.

Parameters:
m - The module to print.

visit

public void visit(Grammar g)
Description copied from class: PrettyPrinter
Print the specified grammar.

Overrides:
visit in class PrettyPrinter

visit

public void visit(Module m)
Description copied from class: PrettyPrinter
Print the specified module.

Overrides:
visit in class PrettyPrinter

print

protected void print(ModuleName name,
                     boolean resolved)
Print a linked version of the specified module name.

Parameters:
name - The module name.
resolved - The flag for whether the name can be resolved.

print

protected void print(ModuleDependency dep,
                     java.lang.String name)
Description copied from class: PrettyPrinter
Print the specified module dependency.

Overrides:
print in class PrettyPrinter
Parameters:
dep - The dependency.
name - The corresponding name.

enter

protected void enter(Production p)
Description copied from class: PrettyPrinter
Enter the specified production. This method prints a comment for productions folded from duplicates. It then prints the specified production's attributes, type, and name. Finally, it sets PrettyPrinter.parenChoice and PrettyPrinter.parenSequence to false.

Overrides:
enter in class PrettyPrinter
Parameters:
p - The production.

exit

protected void exit(Production p)
Description copied from class: PrettyPrinter
Exit the specified production. The default implementation prints a new line.

Overrides:
exit in class PrettyPrinter
Parameters:
p - The production.

visit

public void visit(SequenceName n)
Description copied from class: PrettyPrinter
Print the specified sequence name.

Overrides:
visit in class PrettyPrinter

visit

public void visit(NonTerminal nt)
Description copied from class: PrettyPrinter
Print the specified nonterminal.

Overrides:
visit in class PrettyPrinter

print

protected void print(java.lang.String s)
Description copied from class: PrettyPrinter
Print the specified action string.

Overrides:
print in class PrettyPrinter
Parameters:
s - The string.

visit

public void visit(StringValue v)
Description copied from class: PrettyPrinter
Print the specified string value.

Overrides:
visit in class PrettyPrinter

visit

public void visit(TokenValue v)
Description copied from class: PrettyPrinter
Print the specified token value.

Overrides:
visit in class PrettyPrinter


Copyright © 2012. All Rights Reserved.