Lombok.ast - v0.2

lombok.ast.printer
Class HtmlFormatter

java.lang.Object
  extended by lombok.ast.printer.HtmlFormatter
All Implemented Interfaces:
SourceFormatter

public class HtmlFormatter
extends Object
implements SourceFormatter


Field Summary
 
Fields inherited from interface lombok.ast.printer.SourceFormatter
FAIL
 
Constructor Summary
HtmlFormatter(String rawSource)
           
 
Method Summary
 void addError(int errorStart, int errorEnd, String errorMessage)
          Registers a parse error with the formatter.
 void append(String text)
          Add raw text to the output stream.
 void buildBlock(Node node)
          Opens a new AST level which is normally rendered as a block (example: statements, methods, type bodies).
 void buildInline(Node node)
          Opens a new AST level which is normally rendered inline (example: expressions, literals, modifiers, identifiers, etc).
 void closeBlock()
          Closes the previous SourceFormatter.buildBlock(Node) call.
 void closeInline()
          Closes the previous SourceFormatter.buildInline(Node) call.
 void endSuppressBlock()
          Closes the previous SourceFormatter.startSuppressBlock() call.
 void endSuppressIndent()
          Closes the previous SourceFormatter.startSuppressIndent() call.
 void fail(String fail)
          The AST is not valid; it applies to the current level.
 String finish()
          Generate the source representation and return it as a string.
 void keyword(String text)
           
 void nameNextElement(String name)
          The next SourceFormatter.buildInline(Node) or SourceFormatter.buildBlock(Node)'s relation to the current block is named by this call.
 void operator(String text)
           
 void property(String name, Object value)
           
 void setTimeTaken(long taken)
          Reports the total time taken in milliseconds by the parser.
 void space()
          Generate horizontal space.
 void startSuppressBlock()
          The next buildBlock(Node) call should NOT be rendered in its own vertical area, but should instead be treated as an inline element.
 void startSuppressIndent()
          The next buildBlock(Node) call should NOT indent.
 void verticalSpace()
          Generate an extra vertical spacer if the output format allows for it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlFormatter

public HtmlFormatter(String rawSource)
Method Detail

fail

public void fail(String fail)
Description copied from interface: SourceFormatter
The AST is not valid; it applies to the current level.

Specified by:
fail in interface SourceFormatter
Parameters:
fail - Human readable explanation of what's wrong with the AST at this level.

property

public void property(String name,
                     Object value)
Specified by:
property in interface SourceFormatter

keyword

public void keyword(String text)
Specified by:
keyword in interface SourceFormatter

operator

public void operator(String text)
Specified by:
operator in interface SourceFormatter

verticalSpace

public void verticalSpace()
Description copied from interface: SourceFormatter
Generate an extra vertical spacer if the output format allows for it. Only occurs between block elements. Example: Between a package statement and the import statements, verticalSpace will be called.

Specified by:
verticalSpace in interface SourceFormatter

space

public void space()
Description copied from interface: SourceFormatter
Generate horizontal space. Where relevant, the space should be 1 character wide.

Specified by:
space in interface SourceFormatter

append

public void append(String text)
Description copied from interface: SourceFormatter
Add raw text to the output stream. NB: Parentheses, braces and brackets that are structurally relevant as opening and/or closing a group are always appended separately; therefore, if you want to do special highlighting on parens that go together, you only have to check if the text appended is a single character long and contains a brace, bracket, or paren.

Specified by:
append in interface SourceFormatter
Parameters:
text - The raw text to print. If your output format requires it, it is the implementor's responsibility to escape this text.

buildInline

public void buildInline(Node node)
Description copied from interface: SourceFormatter
Opens a new AST level which is normally rendered inline (example: expressions, literals, modifiers, identifiers, etc).

Specified by:
buildInline in interface SourceFormatter
Parameters:
node - The AST node that this level represents. Can be null which signals that the current node has an inline substructure.

closeInline

public void closeInline()
Description copied from interface: SourceFormatter
Closes the previous SourceFormatter.buildInline(Node) call.

Specified by:
closeInline in interface SourceFormatter

startSuppressBlock

public void startSuppressBlock()
Description copied from interface: SourceFormatter
The next buildBlock(Node) call should NOT be rendered in its own vertical area, but should instead be treated as an inline element. Example: The execution statement is part of an if statement but has to be a statement, which is normally a block element. This call is generated before the execution statement so that the execution statement is printed inline with the if statement.

Specified by:
startSuppressBlock in interface SourceFormatter

endSuppressBlock

public void endSuppressBlock()
Description copied from interface: SourceFormatter
Closes the previous SourceFormatter.startSuppressBlock() call.

Specified by:
endSuppressBlock in interface SourceFormatter

startSuppressIndent

public void startSuppressIndent()
Description copied from interface: SourceFormatter
The next buildBlock(Node) call should NOT indent. Example: The case or default statement inside a switch block.

Specified by:
startSuppressIndent in interface SourceFormatter

endSuppressIndent

public void endSuppressIndent()
Description copied from interface: SourceFormatter
Closes the previous SourceFormatter.startSuppressIndent() call.

Specified by:
endSuppressIndent in interface SourceFormatter

buildBlock

public void buildBlock(Node node)
Description copied from interface: SourceFormatter
Opens a new AST level which is normally rendered as a block (example: statements, methods, type bodies).

Specified by:
buildBlock in interface SourceFormatter
Parameters:
node - The AST node that this level represents. Can be null which signals that the current node has a block substructure.

closeBlock

public void closeBlock()
Description copied from interface: SourceFormatter
Closes the previous SourceFormatter.buildBlock(Node) call.

Specified by:
closeBlock in interface SourceFormatter

addError

public void addError(int errorStart,
                     int errorEnd,
                     String errorMessage)
Description copied from interface: SourceFormatter
Registers a parse error with the formatter.

Specified by:
addError in interface SourceFormatter

finish

public String finish()
Description copied from interface: SourceFormatter
Generate the source representation and return it as a string.

Specified by:
finish in interface SourceFormatter

setTimeTaken

public void setTimeTaken(long taken)
Description copied from interface: SourceFormatter
Reports the total time taken in milliseconds by the parser.

Specified by:
setTimeTaken in interface SourceFormatter

nameNextElement

public void nameNextElement(String name)
Description copied from interface: SourceFormatter
The next SourceFormatter.buildInline(Node) or SourceFormatter.buildBlock(Node)'s relation to the current block is named by this call. Not all elements will get a name, and the name only applies to the next buildBlock/Inline call, not to any further calls.

Specified by:
nameNextElement in interface SourceFormatter

Lombok.ast - v0.2

Copyright © 2010-2011 The Project Lombok Authors, licensed under the MIT licence.