gate.yam.parse
Class YamParser

java.lang.Object
  extended by gate.yam.parse.YamParser
All Implemented Interfaces:
YamParserConstants, YamParserTreeConstants

public class YamParser
extends Object
implements YamParserTreeConstants, YamParserConstants

A parser for YAM.

Author:
Hamish Cunningham

Field Summary
 Token jj_nt
           
protected  gate.yam.parse.JJTYamParserState jjtree
           
 boolean lookingAhead
           
 Token token
           
 YamParserTokenManager token_source
           
 
Fields inherited from interface gate.yam.parse.YamParserTreeConstants
JJTANCHOR, JJTBR, JJTCOLUMN, JJTCONTENTS, JJTCONTROL, JJTESCAPE, JJTHR, JJTLIST, JJTLISTITEM, JJTNBSP, jjtNodeName, JJTOLIST, JJTPARAGRAPH, JJTPLAIN, JJTPREDICATE, JJTROW, JJTSECTIONHEAD, JJTSECTIONTEXT, JJTSEP, JJTTABLE, JJTTABLESEP, JJTTARGETCONTROL, JJTTEXT, JJTTEXTORTABLE, JJTTITLE, JJTULIST, JJTUNIT, JJTURL, JJTVERBATIM, JJTWHSP, JJTWORD, JJTYAMDOCUMENT
 
Fields inherited from interface gate.yam.parse.YamParserConstants
amp, ANCHOR, anchorBody, anchorStart, anysp, bold, br, bslash, COMMENT, commentChars, contents, DEFAULT, dummy, EOF, escape, hr, it, levelNum, listItemStart, lt, multiLineCommentEnd, multiLineCommentStart, nbsp, nl, plain, PRED, predArg, predArgSep, predEnd, predStart, quote, sectionLevel, sep, singleLineComment, sp, tableEnd, tableRowStart, tableSep, tableStart, tokenImage, tt, under, urlBodyToRrbrOrComma, urlBodyToSpace, urlComma, URLPERCENT, urlPercentStart, URLPLAIN, urlPlainStart, urlRrbr, urlText, verbAny, VERBATIM, verbEnd, verbEscape, verbStart
 
Constructor Summary
YamParser(InputStream stream)
           
YamParser(InputStream stream, String encoding)
           
YamParser(Reader stream)
           
YamParser(YamParserTokenManager tm)
           
 
Method Summary
 void Anchor()
           
 void Br()
           
 void Contents()
           
 void Control()
           
 void disable_tracing()
           
 void enable_tracing()
           
 void Escape()
           
 ParseException generateParseException()
           
 Token getNextToken()
           
 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)
           
 void Hr()
           
 void List()
           
 void Nbsp()
           
 void OList()
           
 void Paragraph()
           
 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 Plain()
           
 void Predicate()
           
 void ReInit(InputStream stream)
           
 void ReInit(InputStream stream, String encoding)
           
 void ReInit(Reader stream)
           
 void ReInit(YamParserTokenManager tm)
           
 void Row(String[] rowSpacing)
           
 void SectionHead()
           
 void SectionText()
           
 int Sep()
           
 void setDoIncludes(boolean b)
          Should we process included files or not?
 void setIOHandler(IOHandler ioh)
          Set the parser's IOHandler.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jjtree

protected gate.yam.parse.JJTYamParserState jjtree

token_source

public YamParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

YamParser

public YamParser(InputStream stream)

YamParser

public YamParser(InputStream stream,
                 String encoding)

YamParser

public YamParser(Reader stream)

YamParser

public YamParser(YamParserTokenManager tm)
Method Detail

parse

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

Throws:
gate.util.GateException

parse

public YamParseTree parse(boolean titleIsHeading,
                          boolean ignoreTitle,
                          int headingIncrement,
                          boolean doIncludes)
                   throws gate.util.GateException
Perform parsing, and handle errors not dealt with in the grammar.

Parameters:
titleIsHeading - When we're including a file, the title is treated as a heading.
ignoreTitle - When we're recovering from an error don't look for a title.
headingIncrement - How much to increment heading levels (in an included file).
doIncludes - Should we process included files?
Throws:
gate.util.GateException

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.


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).


YamDocument

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

Throws:
ParseException

Sep

public final int Sep()
              throws ParseException
Throws:
ParseException

Title

public final void Title()
                 throws ParseException
Throws:
ParseException

Text

public final void Text()
                throws ParseException
Throws:
ParseException

Verbatim

public final void Verbatim()
                    throws ParseException
Throws:
ParseException

Word

public final void Word()
                throws ParseException
Throws:
ParseException

Escape

public final void Escape()
                  throws ParseException
Throws:
ParseException

Plain

public final void Plain()
                 throws ParseException
Throws:
ParseException

Control

public final void Control()
                   throws ParseException
Throws:
ParseException

TargetControl

public final void TargetControl()
                         throws ParseException
Throws:
ParseException

Hr

public final void Hr()
              throws ParseException
Throws:
ParseException

Url

public final void Url()
               throws ParseException
Throws:
ParseException

Anchor

public final void Anchor()
                  throws ParseException
Throws:
ParseException

Br

public final void Br()
              throws ParseException
Throws:
ParseException

Nbsp

public final void Nbsp()
                throws ParseException
Throws:
ParseException

Unit

public final void Unit()
                throws ParseException
Throws:
ParseException

SectionHead

public final void SectionHead()
                       throws ParseException
Throws:
ParseException

SectionText

public final void SectionText()
                       throws ParseException
Throws:
ParseException

Paragraph

public final void Paragraph()
                     throws ParseException
Throws:
ParseException

List

public final void List()
                throws ParseException
Throws:
ParseException

OList

public final void OList()
                 throws ParseException
Throws:
ParseException

UList

public final void UList()
                 throws ParseException
Throws:
ParseException

Table

public final void Table()
                 throws ParseException
Throws:
ParseException

Row

public final void Row(String[] rowSpacing)
               throws ParseException
Throws:
ParseException

TableSep

public final String[] TableSep()
                        throws ParseException
Throws:
ParseException

Whsp

public final void Whsp()
                throws ParseException
Throws:
ParseException

Contents

public final void Contents()
                    throws ParseException
Throws:
ParseException

Predicate

public final void Predicate()
                     throws ParseException
Throws:
ParseException

TextOrTable

public final void TextOrTable()
                       throws ParseException
Throws:
ParseException

ReInit

public void ReInit(InputStream stream)

ReInit

public void ReInit(InputStream stream,
                   String encoding)

ReInit

public void ReInit(Reader stream)

ReInit

public void ReInit(YamParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()