org.parancoe.yaml.parser
Class YamlParser

java.lang.Object
  extended by org.parancoe.yaml.parser.YamlParser

public final class YamlParser
extends java.lang.Object

An experimental Yaml org.parancoe.yaml.parser.


Field Summary
static int DOCUMENT_HEADER
           
protected  int line
           
static int LIST_CLOSE
           
static int LIST_ENTRY
           
static int LIST_NO_OPEN
           
static int LIST_OPEN
           
static int MAP_CLOSE
           
static int MAP_NO_OPEN
           
static int MAP_OPEN
           
static int MAP_SEPARATOR
           
protected  ParserReader r
           
 
Constructor Summary
YamlParser(java.io.Reader r, ParserEvent event)
           
 
Method Summary
 boolean alias()
          alias ::= '*' word
 boolean anchor()
          anchor ::= '&' word
 boolean array(int type)
          string of characters of type 'type'
 boolean block_line(int n, java.lang.StringBuffer sb, char ch)
           
 boolean block(int n)
          block(n) ::= '|' space?
 boolean comment(int n, boolean explicit)
          throwable comment productions.
 boolean directive()
          directive ::= '#' word ':' line
 boolean document_first()
          document_first ::= nlist(-1) | nmap(-1)
 boolean document_next()
          document_next ::= header node_non_alias(-1)
 boolean end()
           
 ParserEvent getEvent()
           
 boolean header()
          header ::= '---' (space directive)*
 int indent()
          how many spaces from index till first non space
 boolean indent(int n)
          indent(n) ::= n*SP
 boolean key(int n)
          key ::= ( '?'
 boolean line()
          line = char_line+ Spaces not included !
 boolean linesp()
          linesp = char_linesp+ Spaces included !
 boolean list_entry()
          list_entry ::= space?
 boolean list()
          list ::= '[' (list_entry ',')* list_entry?
 boolean loose_string_simple()
           
 boolean loose_string()
          string ::= single_quoted | double_quoted | simple All strings are trimmed
 boolean loose_value_inline()
           
 boolean loose_value(int n)
           
 boolean map_entry()
          map_entry ::= space?
 boolean map()
          map ::= '{' (map_entry ',')* map_entry?
 boolean newline()
          newline ::= ( CR LF) | CR | LF / NEL / PS / LS (| EOF)
 boolean nlist_entry(int n)
          nlist_entry(n) ::= '-' ( value(>n) | nmap_inlist(>n) )
 boolean nlist(int n)
          nlist(n) ::= ( indent(n) nlist_entry(n) )+
 boolean nmap_entry(int n)
          nmap_entry(n) ::= key(n) ':' value(>n)
 boolean nmap_inlist(int n)
          nmap_inlist(n) ::= space string space?
 boolean nmap(int n)
          nmap(n) ::= (indent(n) nmap_entry(n))+
 boolean number()
          number = char_digit+
 void parse()
          parse ::= icomment(-1)* document_first?
 boolean properties()
          properties ::= ( transfer ( space anchor )?
protected  java.lang.String readerString()
           
 void setEvent(ParserEvent event)
           
 boolean space()
          space = char_space+
 boolean string_simple()
          simple string This function reads also trailing spaces.
 boolean string()
           
 boolean transfer()
          transfer ::= '!'
 boolean value_block(int n)
           
 boolean value_inline_na()
           
 boolean value_inline()
           
 boolean value_na(int n)
           
 boolean value_nested(int n)
           
 boolean value(int n)
           
 boolean word()
          word = char_word+
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIST_OPEN

public static final int LIST_OPEN
See Also:
Constant Field Values

LIST_CLOSE

public static final int LIST_CLOSE
See Also:
Constant Field Values

MAP_OPEN

public static final int MAP_OPEN
See Also:
Constant Field Values

MAP_CLOSE

public static final int MAP_CLOSE
See Also:
Constant Field Values

LIST_NO_OPEN

public static final int LIST_NO_OPEN
See Also:
Constant Field Values

MAP_NO_OPEN

public static final int MAP_NO_OPEN
See Also:
Constant Field Values

DOCUMENT_HEADER

public static final int DOCUMENT_HEADER
See Also:
Constant Field Values

MAP_SEPARATOR

public static final int MAP_SEPARATOR
See Also:
Constant Field Values

LIST_ENTRY

public static final int LIST_ENTRY
See Also:
Constant Field Values

r

protected ParserReader r

line

protected int line
Constructor Detail

YamlParser

public YamlParser(java.io.Reader r,
                  ParserEvent event)
           throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

readerString

protected java.lang.String readerString()

indent

public int indent()
           throws java.io.IOException
how many spaces from index till first non space

Throws:
java.io.IOException

array

public boolean array(int type)
              throws java.io.IOException
string of characters of type 'type'

Throws:
java.io.IOException

space

public boolean space()
              throws java.io.IOException
space = char_space+

Throws:
java.io.IOException

line

public boolean line()
             throws java.io.IOException
line = char_line+

Spaces not included !

Throws:
java.io.IOException

linesp

public boolean linesp()
               throws java.io.IOException
linesp = char_linesp+

Spaces included !

Throws:
java.io.IOException

word

public boolean word()
             throws java.io.IOException
word = char_word+

Throws:
java.io.IOException

number

public boolean number()
               throws java.io.IOException
number = char_digit+

Throws:
java.io.IOException

indent

public boolean indent(int n)
               throws java.io.IOException
indent(n) ::= n*SP

Throws:
java.io.IOException

newline

public boolean newline()
                throws java.io.IOException
newline ::= ( CR LF) | CR | LF / NEL / PS / LS (| EOF)

Throws:
java.io.IOException

end

public boolean end()
            throws java.io.IOException
Throws:
java.io.IOException

string_simple

public boolean string_simple()
                      throws java.lang.Exception
simple string

This function reads also trailing spaces. Trim later

Throws:
java.lang.Exception

loose_string_simple

public boolean loose_string_simple()
                            throws java.lang.Exception
Throws:
java.lang.Exception

loose_string

public boolean loose_string()
                     throws java.lang.Exception
string ::= single_quoted | double_quoted | simple

All strings are trimmed

Throws:
java.lang.Exception

string

public boolean string()
               throws java.lang.Exception
Throws:
java.lang.Exception

alias

public boolean alias()
              throws java.io.IOException
alias ::= '*' word

Throws:
java.io.IOException

anchor

public boolean anchor()
               throws java.io.IOException
anchor ::= '&' word

Throws:
java.io.IOException

comment

public boolean comment(int n,
                       boolean explicit)
                throws java.io.IOException
throwable comment productions. icomment(n) ::= indent(<n) ('#' linesp )? newline
xcomment(n) ::= indent(<n) '#' linesp newline

icomment(n) ::= comment(n,false)
xcomment(n) ::= comment(n,true)

Throws:
java.io.IOException

header

public boolean header()
               throws java.lang.Exception
header ::= '---' (space directive)*

Throws:
java.lang.Exception

directive

public boolean directive()
                  throws java.io.IOException
directive ::= '#' word ':' line

Throws:
java.io.IOException

transfer

public boolean transfer()
                 throws java.io.IOException
transfer ::= '!' line

Throws:
java.io.IOException

properties

public boolean properties()
                   throws java.lang.Exception
properties ::= ( transfer ( space anchor )? ) | ( anchor ( space transfer )?

Throws:
java.lang.Exception

key

public boolean key(int n)
            throws java.lang.Exception
key ::= ( '?' value_nested(>n) indent(n) ) | ( value_inline space? )

Throws:
java.lang.Exception

value

public boolean value(int n)
              throws java.lang.Exception
Throws:
java.lang.Exception

loose_value

public boolean loose_value(int n)
                    throws java.lang.Exception
Throws:
java.lang.Exception

value_na

public boolean value_na(int n)
                 throws java.lang.Exception
Throws:
java.lang.Exception

value_inline

public boolean value_inline()
                     throws java.lang.Exception
Throws:
java.lang.Exception

loose_value_inline

public boolean loose_value_inline()
                           throws java.lang.Exception
Throws:
java.lang.Exception

value_inline_na

public boolean value_inline_na()
                        throws java.lang.Exception
Throws:
java.lang.Exception

value_nested

public boolean value_nested(int n)
                     throws java.lang.Exception
Throws:
java.lang.Exception

value_block

public boolean value_block(int n)
                    throws java.lang.Exception
Throws:
java.lang.Exception

nmap

public boolean nmap(int n)
             throws java.lang.Exception
nmap(n) ::= (indent(n) nmap_entry(n))+

Throws:
java.lang.Exception

nmap_entry

public boolean nmap_entry(int n)
                   throws java.lang.Exception
nmap_entry(n) ::= key(n) ':' value(>n)

Throws:
java.lang.Exception

nlist

public boolean nlist(int n)
              throws java.lang.Exception
nlist(n) ::= ( indent(n) nlist_entry(n) )+

Throws:
java.lang.Exception

nlist_entry

public boolean nlist_entry(int n)
                    throws java.lang.Exception
nlist_entry(n) ::= '-' ( value(>n) | nmap_inlist(>n) )

Throws:
java.lang.Exception

nmap_inlist

public boolean nmap_inlist(int n)
                    throws java.lang.Exception
nmap_inlist(n) ::= space string space? ':' space value(>n) nmap(>n)? XXX

Throws:
java.lang.Exception

block

public boolean block(int n)
              throws java.lang.Exception
block(n) ::= '|' space? number? space? newline block_line(n)*

Throws:
java.lang.Exception

block_line

public boolean block_line(int n,
                          java.lang.StringBuffer sb,
                          char ch)
                   throws java.lang.Exception
Throws:
java.lang.Exception

list

public boolean list()
             throws java.lang.Exception
list ::= '[' (list_entry ',')* list_entry? ']'

Throws:
java.lang.Exception

list_entry

public boolean list_entry()
                   throws java.lang.Exception
list_entry ::= space? value_inline space?

Throws:
java.lang.Exception

map

public boolean map()
            throws java.lang.Exception
map ::= '{' (map_entry ',')* map_entry? '}'

Throws:
java.lang.Exception

map_entry

public boolean map_entry()
                  throws java.lang.Exception
map_entry ::= space? value_inline space? ':' space value_inline space?

Throws:
java.lang.Exception

document_first

public boolean document_first()
                       throws java.lang.Exception
document_first ::= nlist(-1) | nmap(-1)

Throws:
java.lang.Exception

document_next

public boolean document_next()
                      throws java.lang.Exception
document_next ::= header node_non_alias(-1)

Throws:
java.lang.Exception

parse

public void parse()
           throws java.lang.Exception
parse ::= icomment(-1)* document_first? document_next*

Throws:
java.lang.Exception

getEvent

public ParserEvent getEvent()
Returns:
Returns the event.

setEvent

public void setEvent(ParserEvent event)
Parameters:
event - The event to set.


Copyright © 2007 JUG Padova Parancoe Team. All Rights Reserved.