Groovy Documentation

java.gate.yam.translate
Class Cursor

java.lang.Object
  java.gate.yam.translate.Cursor

class Cursor

Helper class for pretty-printer. Represents a position in a tree traversal, and provides manipulation of spacing at that position.

author:
Hamish Cunningham


Field Summary
static boolean DEBUG

Debug mode.

SimpleNode hereNode

First node in current position.

NodeKind kind

Position type.

static Logger log

Logger

int nextChildNumber

The next node after the current one.

NodeKind nextKind

Position type.

SimpleNode nextNode

Next node from current position.

int numChildren

Number of children below the root node.

NodeKind previousKind

Previous position type.

SimpleNode rootNode

Root node of the parse tree.

 
Constructor Summary
Cursor(SimpleNode rootNode, int leadingMin, int leadingMax)

Construction from parse tree root node.

 
Method Summary
void advance()

Advance to the next Unit or Word sequence.

boolean atEnd()

Finished the document?

void blanksAfter(int min, int max)

Set the number of blank lines following this position.

void blanksAfter(int norm, int min, int max)

Set the number of blank lines following this position.

void blanksAfter(Token gapStart, Token gapEnd, int norm, int min, int max)

Set the number of blank lines in a token sequence.

NodeKind findNodeKind(SimpleNode n)

Type of the next node after the current Sep sequence.

String getBlanks(int i)

Get a newline string for a particular number of blanks.

SimpleNode getHereNode()

First node in current position.

NodeKind getKind()

Position type.

NodeKind getNextKind()

Next position type.

SimpleNode getNextNode()

Next node from current position.

NodeKind getPreviousKind()

Previous position type.

void init(SimpleNode rootNode, int leadingMin, int leadingMax)

Initialisation from parse tree root node.

String sedNls(String s)

Helper

String tokDetails(Token t)

Helper

 
Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 

Field Detail

DEBUG

static final boolean DEBUG
Debug mode.


hereNode

SimpleNode hereNode
First node in current position.


kind

NodeKind kind
Position type.


log

static Logger log
Logger


nextChildNumber

int nextChildNumber
The next node after the current one.


nextKind

NodeKind nextKind
Position type.


nextNode

SimpleNode nextNode
Next node from current position.


numChildren

int numChildren
Number of children below the root node.


previousKind

NodeKind previousKind
Previous position type.


rootNode

SimpleNode rootNode
Root node of the parse tree.


 
Constructor Detail

Cursor

public Cursor(SimpleNode rootNode, int leadingMin, int leadingMax)
Construction from parse tree root node.


 
Method Detail

advance

public void advance()
Advance to the next Unit or Word sequence. (Ignores top-level anchors.)


atEnd

public boolean atEnd()
Finished the document?


blanksAfter

public void blanksAfter(int min, int max)
Set the number of blank lines following this position.


blanksAfter

public void blanksAfter(int norm, int min, int max)
Set the number of blank lines following this position.


blanksAfter

public void blanksAfter(Token gapStart, Token gapEnd, int norm, int min, int max)
Set the number of blank lines in a token sequence. Tokens gapStart and gapEnd must not be null.


findNodeKind

public NodeKind findNodeKind(SimpleNode n)
Type of the next node after the current Sep sequence.


getBlanks

public String getBlanks(int i)
Get a newline string for a particular number of blanks. Note that 0 blanks is defined as equal to 1 newline; 1 blank is two newlines, and so on. (I.e. we assume that there's at least one newline at each point between units.)


getHereNode

public SimpleNode getHereNode()
First node in current position.


getKind

public NodeKind getKind()
Position type.


getNextKind

public NodeKind getNextKind()
Next position type.


getNextNode

public SimpleNode getNextNode()
Next node from current position.


getPreviousKind

public NodeKind getPreviousKind()
Previous position type.


init

public void init(SimpleNode rootNode, int leadingMin, int leadingMax)
Initialisation from parse tree root node. Deals with initial blank lines, and advances.


sedNls

public String sedNls(String s)
Helper


tokDetails

public String tokDetails(Token t)
Helper


 

Groovy Documentation