Groovy Documentation

java.gate.yam.parse
Class YamParser

java.lang.Object
  java.gate.yam.parse.YamParser
All Implemented Interfaces:
YamParserTreeConstants

class YamParser

A parser for YAM.

author:
Hamish Cunningham


Nested Class Summary
class YamParser.JJCalls

class YamParser.ListNodeHolder

The list stack needs to store OL/UL nodes and their indentation level.

class YamParser.LookaheadSuccess

 
Field Summary
int NONE

List item type.

int OL

List item type.

int UL

List item type.

boolean doIncludes

Should we process included files or not?

boolean doListMunging

Refactoring the list stuff...

Token firstToken

The first token of the first successfully constructed node.

int headingIncrement

Number of levels to add to headings.

boolean ignoreTitle

When we're recovering from an error don't look for a title.

int includeDepth

How deeply nested the current include is.

IOHandler ioHandler

The parser's IOHandler.

private JJCalls[] jj_2_rtns

private int jj_endpos

private def jj_expentries

private int[] jj_expentry

private int jj_gc

private int jj_gen

SimpleCharStream jj_input_stream

private int jj_kind

private int jj_la

private int[] jj_la1

private static int[] jj_la1_0

private static int[] jj_la1_1

private Token jj_lastpos

private int[] jj_lasttokens

private LookaheadSuccess jj_ls

Token jj_nt

private int jj_ntk

private boolean jj_rescan

private Token jj_scanpos

private boolean jj_semLA

protected JJTYamParserState jjtree

static Logger log

Logger

boolean lookingAhead

YamParseTree parseTree

The parse tree used to store the parse result, and returned by the top-level production.

boolean singleItemListWarning

Should we warn for single-item lists?

boolean titleIsHeading

In included files the title is treated as another heading.

Token token

YamParserTokenManager token_source

 
Constructor Summary
YamParser()

 
Method Summary
void Anchor()

void Br()

void Contents()

void Control()

void Escape()

void Hr()

void List()

void Nbsp()

void OList()

void Paragraph()

void Plain()

void Predicate()

void ReInit(def stream)

void ReInit(def stream, String encoding)

void ReInit(def stream)

void ReInit(YamParserTokenManager tm)

void Row(String[] rowSpacing)

void SectionHead()

void SectionText()

int Sep()

void Table()

String[] TableSep()

void TargetControl()

void Text()

void TextOrTable()

void Title()

void UList()

void Unit()

void Url()

void Verbatim()

void Whsp()

void Word()

void YamDocument()

Top-level parser goal.

def YamParser(def stream)

def YamParser(def stream, String encoding)

def YamParser(def stream)

def YamParser(YamParserTokenManager tm)

int calculateListIndentLevel(Token t)

Calculate the correct indentation level for a list from its start token.

void convertToSectionHead(SimpleNode titleNode)

Convert a title node to a section heading.

int countSpaces(String s)

Count spaces, taking account of tabs.

int countSpaces(int offset, String s)

Count spaces, taking account of tabs.

ListNodeHolder createNewList(int type, int indent, String itemSpacing, SimpleNode itemNode)

Create a new ListNodeHolder with appropriate type and indent.

void createNewListAndAttachToParent(int itemType, int itemIndent, String itemSpacing, SimpleNode itemNode, Node parentUnit, Stack activeListStack)

Create a new list and attach it to the parent Unit.

void disable_tracing()

void enable_tracing()

void fillVerbatimBody(SimpleNode n, Token vstart, Token vend)

Fill the body of a verbatim node with its token images, and its after string with any trailing space.

ParseException generateParseException()

String[] getColSpacing(Token t)

Get leading / trailing spaces for a column from the separator token.

int getListArity(SimpleNode n)

Caclulate the arity of a list.

String getListItemSpacing(Token t)

Get the initial spacing preceding a list item from its initial token.

int getListType(Token t)

Figure out a list's type from its listItemStart token.

Token getNextToken()

String[] getRowSpacing(Token t)

Get the leading spaces for a row node and the start of the first column from the row's start token.

int getSepSpacing(Token sep)

Returns the length of the trailing spaces on a sep token (the spaces at the start of the next line).

Token getToken(int index)

boolean indentedTokenComing()

Does the next token contain a space or tab?

private boolean jj_2_1(int xla)

private boolean jj_2_10(int xla)

private boolean jj_2_11(int xla)

private boolean jj_2_12(int xla)

private boolean jj_2_13(int xla)

private boolean jj_2_2(int xla)

private boolean jj_2_3(int xla)

private boolean jj_2_4(int xla)

private boolean jj_2_5(int xla)

private boolean jj_2_6(int xla)

private boolean jj_2_7(int xla)

private boolean jj_2_8(int xla)

private boolean jj_2_9(int xla)

private boolean jj_3R_24()

private boolean jj_3R_25()

private boolean jj_3R_26()

private boolean jj_3R_27()

private boolean jj_3R_28()

private boolean jj_3R_29()

private boolean jj_3R_30()

private boolean jj_3R_31()

private boolean jj_3R_32()

private boolean jj_3R_33()

private boolean jj_3R_34()

private boolean jj_3R_35()

private boolean jj_3R_36()

private boolean jj_3R_37()

private boolean jj_3R_38()

private boolean jj_3R_39()

private boolean jj_3R_40()

private boolean jj_3R_41()

private boolean jj_3R_42()

private boolean jj_3R_43()

private boolean jj_3R_44()

private boolean jj_3R_45()

private boolean jj_3R_46()

private boolean jj_3R_47()

private boolean jj_3R_48()

private boolean jj_3R_49()

private boolean jj_3R_50()

private boolean jj_3R_51()

private boolean jj_3R_52()

private boolean jj_3R_53()

private boolean jj_3R_54()

private boolean jj_3R_55()

private boolean jj_3R_56()

private boolean jj_3R_57()

private boolean jj_3R_58()

private boolean jj_3R_59()

private boolean jj_3R_60()

private boolean jj_3R_61()

private boolean jj_3R_62()

private boolean jj_3R_63()

private boolean jj_3R_64()

private boolean jj_3R_65()

private boolean jj_3R_66()

private boolean jj_3R_67()

private boolean jj_3R_68()

private boolean jj_3R_69()

private boolean jj_3R_70()

private boolean jj_3R_71()

private boolean jj_3R_72()

private boolean jj_3R_73()

private boolean jj_3R_74()

private boolean jj_3R_75()

private boolean jj_3R_76()

private boolean jj_3R_77()

private boolean jj_3R_78()

private boolean jj_3R_79()

private boolean jj_3R_80()

private boolean jj_3R_81()

private boolean jj_3R_82()

private boolean jj_3R_83()

private boolean jj_3R_84()

private boolean jj_3R_85()

private boolean jj_3R_86()

private boolean jj_3R_87()

private boolean jj_3R_88()

private boolean jj_3R_89()

private boolean jj_3R_90()

private boolean jj_3_1()

private boolean jj_3_10()

private boolean jj_3_11()

private boolean jj_3_12()

private boolean jj_3_13()

private boolean jj_3_2()

private boolean jj_3_3()

private boolean jj_3_4()

private boolean jj_3_5()

private boolean jj_3_6()

private boolean jj_3_7()

private boolean jj_3_8()

private boolean jj_3_9()

private void jj_add_error_token(int kind, int pos)

private Token jj_consume_token(int kind)

private static void jj_la1_0()

private static void jj_la1_1()

private int jj_ntk()

private void jj_rescan_token()

private void jj_save(int index, int xla)

private boolean jj_scan_token(int kind)

void jjtreeCloseNodeScope(Node n)

Override node scope method to store last Token dominated by a node.

void jjtreeOpenNodeScope(Node n)

Override node scope method to store first Token dominated by a node.

boolean nonZero(int i)

Helper for boolean lookahead in lists.

YamParseTree parse()

Perform parsing, and handle errors not dealt with in the grammar.

YamParseTree parse(boolean titleIsHeading, boolean ignoreTitle, int headingIncrement, boolean doIncludes)

Perform parsing, and handle errors not dealt with in the grammar.

void processInclude(SimpleNode includeNode)

Parse an include predicate and add in the resultant parse tree(s).

void pushBackListStart(StringBuffer image, SimpleCharStream input_stream, Token matchedToken)

Helper for tables to deal with inadvertant consumption of list starts.

void setColSp(Node n, String[] sa)

Set the start/end spacing on a column node.

void setDoIncludes(boolean b)

Should we process included files or not?

void setIOHandler(IOHandler ioh)

Set the parser's IOHandler.

void setIncludeDepth(int i)

How deeply nested the current include is.

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

Field Detail

NONE

final int NONE
List item type.


OL

final int OL
List item type.


UL

final int UL
List item type.


doIncludes

boolean doIncludes
Should we process included files or not?


doListMunging

boolean doListMunging
Refactoring the list stuff...


firstToken

Token firstToken
The first token of the first successfully constructed node.


headingIncrement

int headingIncrement
Number of levels to add to headings. May be negative. This is used during parsing of included files.


ignoreTitle

boolean ignoreTitle
When we're recovering from an error don't look for a title.


includeDepth

int includeDepth
How deeply nested the current include is.


ioHandler

IOHandler ioHandler
The parser's IOHandler.


jj_2_rtns

private final JJCalls[] jj_2_rtns


jj_endpos

private int jj_endpos


jj_expentries

private def jj_expentries


jj_expentry

private int[] jj_expentry


jj_gc

private int jj_gc


jj_gen

private int jj_gen


jj_input_stream

SimpleCharStream jj_input_stream


jj_kind

private int jj_kind


jj_la

private int jj_la


jj_la1

private final int[] jj_la1


jj_la1_0

private static int[] jj_la1_0


jj_la1_1

private static int[] jj_la1_1


jj_lastpos

private Token jj_lastpos


jj_lasttokens

private int[] jj_lasttokens


jj_ls

private final LookaheadSuccess jj_ls


jj_nt

Token jj_nt


jj_ntk

private int jj_ntk


jj_rescan

private boolean jj_rescan


jj_scanpos

private Token jj_scanpos


jj_semLA

private boolean jj_semLA


jjtree

protected JJTYamParserState jjtree


log

static Logger log
Logger


lookingAhead

boolean lookingAhead


parseTree

YamParseTree parseTree
The parse tree used to store the parse result, and returned by the top-level production.


singleItemListWarning

boolean singleItemListWarning
Should we warn for single-item lists?


titleIsHeading

boolean titleIsHeading
In included files the title is treated as another heading.


token

Token token


token_source

YamParserTokenManager token_source


 
Constructor Detail

YamParser

YamParser()


 
Method Detail

Anchor

public final void Anchor()


Br

public final void Br()


Contents

public final void Contents()


Control

public final void Control()


Escape

public final void Escape()


Hr

public final void Hr()


List

public final void List()


Nbsp

public final void Nbsp()


OList

public final void OList()


Paragraph

public final void Paragraph()


Plain

public final void Plain()


Predicate

public final void Predicate()


ReInit

public void ReInit(def stream)


ReInit

public void ReInit(def stream, String encoding)


ReInit

public void ReInit(def stream)


ReInit

public void ReInit(YamParserTokenManager tm)


Row

public final void Row(String[] rowSpacing)


SectionHead

public final void SectionHead()


SectionText

public final void SectionText()


Sep

public final int Sep()


Table

public final void Table()


TableSep

public final String[] TableSep()


TargetControl

public final void TargetControl()


Text

public final void Text()


TextOrTable

public final void TextOrTable()


Title

public final void Title()


UList

public final void UList()


Unit

public final void Unit()


Url

public final void Url()


Verbatim

public final void Verbatim()


Whsp

public final void Whsp()


Word

public final void Word()


YamDocument

public final void YamDocument()
Top-level parser goal.


YamParser

public def YamParser(def stream)


YamParser

public def YamParser(def stream, String encoding)


YamParser

public def YamParser(def stream)


YamParser

public def YamParser(YamParserTokenManager tm)


calculateListIndentLevel

public int calculateListIndentLevel(Token t)
Calculate the correct indentation level for a list from its start token.


convertToSectionHead

public void convertToSectionHead(SimpleNode titleNode)
Convert a title node to a section heading.


countSpaces

public int countSpaces(String s)
Count spaces, taking account of tabs.


countSpaces

public int countSpaces(int offset, String s)
Count spaces, taking account of tabs. Counting starts offset chars in.


createNewList

public ListNodeHolder createNewList(int type, int indent, String itemSpacing, SimpleNode itemNode)
Create a new ListNodeHolder with appropriate type and indent.


createNewListAndAttachToParent

public void createNewListAndAttachToParent(int itemType, int itemIndent, String itemSpacing, SimpleNode itemNode, Node parentUnit, Stack activeListStack)
Create a new list and attach it to the parent Unit.


disable_tracing

public final void disable_tracing()


enable_tracing

public final void enable_tracing()


fillVerbatimBody

public void fillVerbatimBody(SimpleNode n, Token vstart, Token vend)
Fill the body of a verbatim node with its token images, and its after string with any trailing space.


generateParseException

public ParseException generateParseException()


getColSpacing

public String[] getColSpacing(Token t)
Get leading / trailing spaces for a column from the separator token. The first array element is the end of the previous column (from before the | separator); the second is the start of the new one (after the |).


getListArity

public int getListArity(SimpleNode n)
Caclulate the arity of a list.


getListItemSpacing

public String getListItemSpacing(Token t)
Get the initial spacing preceding a list item from its initial token.


getListType

public int getListType(Token t)
Figure out a list's type from its listItemStart token.


getNextToken

public final Token getNextToken()


getRowSpacing

public String[] getRowSpacing(Token t)
Get the leading spaces for a row node and the start of the first column from the row's start token.


getSepSpacing

public int getSepSpacing(Token sep)
Returns the length of the trailing spaces on a sep token (the spaces at the start of the next line).


getToken

public final Token getToken(int index)


indentedTokenComing

public boolean indentedTokenComing()
Does the next token contain a space or tab? Used for lists.


jj_2_1

private final boolean jj_2_1(int xla)


jj_2_10

private final boolean jj_2_10(int xla)


jj_2_11

private final boolean jj_2_11(int xla)


jj_2_12

private final boolean jj_2_12(int xla)


jj_2_13

private final boolean jj_2_13(int xla)


jj_2_2

private final boolean jj_2_2(int xla)


jj_2_3

private final boolean jj_2_3(int xla)


jj_2_4

private final boolean jj_2_4(int xla)


jj_2_5

private final boolean jj_2_5(int xla)


jj_2_6

private final boolean jj_2_6(int xla)


jj_2_7

private final boolean jj_2_7(int xla)


jj_2_8

private final boolean jj_2_8(int xla)


jj_2_9

private final boolean jj_2_9(int xla)


jj_3R_24

private final boolean jj_3R_24()


jj_3R_25

private final boolean jj_3R_25()


jj_3R_26

private final boolean jj_3R_26()


jj_3R_27

private final boolean jj_3R_27()


jj_3R_28

private final boolean jj_3R_28()


jj_3R_29

private final boolean jj_3R_29()


jj_3R_30

private final boolean jj_3R_30()


jj_3R_31

private final boolean jj_3R_31()


jj_3R_32

private final boolean jj_3R_32()


jj_3R_33

private final boolean jj_3R_33()


jj_3R_34

private final boolean jj_3R_34()


jj_3R_35

private final boolean jj_3R_35()


jj_3R_36

private final boolean jj_3R_36()


jj_3R_37

private final boolean jj_3R_37()


jj_3R_38

private final boolean jj_3R_38()


jj_3R_39

private final boolean jj_3R_39()


jj_3R_40

private final boolean jj_3R_40()


jj_3R_41

private final boolean jj_3R_41()


jj_3R_42

private final boolean jj_3R_42()


jj_3R_43

private final boolean jj_3R_43()


jj_3R_44

private final boolean jj_3R_44()


jj_3R_45

private final boolean jj_3R_45()


jj_3R_46

private final boolean jj_3R_46()


jj_3R_47

private final boolean jj_3R_47()


jj_3R_48

private final boolean jj_3R_48()


jj_3R_49

private final boolean jj_3R_49()


jj_3R_50

private final boolean jj_3R_50()


jj_3R_51

private final boolean jj_3R_51()


jj_3R_52

private final boolean jj_3R_52()


jj_3R_53

private final boolean jj_3R_53()


jj_3R_54

private final boolean jj_3R_54()


jj_3R_55

private final boolean jj_3R_55()


jj_3R_56

private final boolean jj_3R_56()


jj_3R_57

private final boolean jj_3R_57()


jj_3R_58

private final boolean jj_3R_58()


jj_3R_59

private final boolean jj_3R_59()


jj_3R_60

private final boolean jj_3R_60()


jj_3R_61

private final boolean jj_3R_61()


jj_3R_62

private final boolean jj_3R_62()


jj_3R_63

private final boolean jj_3R_63()


jj_3R_64

private final boolean jj_3R_64()


jj_3R_65

private final boolean jj_3R_65()


jj_3R_66

private final boolean jj_3R_66()


jj_3R_67

private final boolean jj_3R_67()


jj_3R_68

private final boolean jj_3R_68()


jj_3R_69

private final boolean jj_3R_69()


jj_3R_70

private final boolean jj_3R_70()


jj_3R_71

private final boolean jj_3R_71()


jj_3R_72

private final boolean jj_3R_72()


jj_3R_73

private final boolean jj_3R_73()


jj_3R_74

private final boolean jj_3R_74()


jj_3R_75

private final boolean jj_3R_75()


jj_3R_76

private final boolean jj_3R_76()


jj_3R_77

private final boolean jj_3R_77()


jj_3R_78

private final boolean jj_3R_78()


jj_3R_79

private final boolean jj_3R_79()


jj_3R_80

private final boolean jj_3R_80()


jj_3R_81

private final boolean jj_3R_81()


jj_3R_82

private final boolean jj_3R_82()


jj_3R_83

private final boolean jj_3R_83()


jj_3R_84

private final boolean jj_3R_84()


jj_3R_85

private final boolean jj_3R_85()


jj_3R_86

private final boolean jj_3R_86()


jj_3R_87

private final boolean jj_3R_87()


jj_3R_88

private final boolean jj_3R_88()


jj_3R_89

private final boolean jj_3R_89()


jj_3R_90

private final boolean jj_3R_90()


jj_3_1

private final boolean jj_3_1()


jj_3_10

private final boolean jj_3_10()


jj_3_11

private final boolean jj_3_11()


jj_3_12

private final boolean jj_3_12()


jj_3_13

private final boolean jj_3_13()


jj_3_2

private final boolean jj_3_2()


jj_3_3

private final boolean jj_3_3()


jj_3_4

private final boolean jj_3_4()


jj_3_5

private final boolean jj_3_5()


jj_3_6

private final boolean jj_3_6()


jj_3_7

private final boolean jj_3_7()


jj_3_8

private final boolean jj_3_8()


jj_3_9

private final boolean jj_3_9()


jj_add_error_token

private void jj_add_error_token(int kind, int pos)


jj_consume_token

private final Token jj_consume_token(int kind)


jj_la1_0

private static void jj_la1_0()


jj_la1_1

private static void jj_la1_1()


jj_ntk

private final int jj_ntk()


jj_rescan_token

private final void jj_rescan_token()


jj_save

private final void jj_save(int index, int xla)


jj_scan_token

private final boolean jj_scan_token(int kind)


jjtreeCloseNodeScope

public void jjtreeCloseNodeScope(Node n)
Override node scope method to store last Token dominated by a node.


jjtreeOpenNodeScope

public void jjtreeOpenNodeScope(Node n)
Override node scope method to store first Token dominated by a node.


nonZero

public boolean nonZero(int i)
Helper for boolean lookahead in lists.


parse

public YamParseTree parse()
Perform parsing, and handle errors not dealt with in the grammar.


parse

public YamParseTree parse(boolean titleIsHeading, boolean ignoreTitle, int headingIncrement, boolean doIncludes)
Perform parsing, and handle errors not dealt with in the grammar.
param:
titleIsHeading When we're including a file, the title is treated as a heading.
param:
ignoreTitle When we're recovering from an error don't look for a title.
param:
headingIncrement How much to increment heading levels (in an included file).
param:
doIncludes Should we process included files?


processInclude

public void processInclude(SimpleNode includeNode)
Parse an include predicate and add in the resultant parse tree(s).


pushBackListStart

public void pushBackListStart(StringBuffer image, SimpleCharStream input_stream, Token matchedToken)
Helper for tables to deal with inadvertant consumption of list starts.


setColSp

public void setColSp(Node n, String[] sa)
Set the start/end spacing on a column node.


setDoIncludes

public void setDoIncludes(boolean b)
Should we process included files or not?


setIOHandler

public void setIOHandler(IOHandler ioh)
Set the parser's IOHandler. This object is used when the parser discovers an include directive.


setIncludeDepth

public void setIncludeDepth(int i)
How deeply nested the current include is.


 

Groovy Documentation