de.unkrig.commons.text.json
Class JsonParser

java.lang.Object
  extended by de.unkrig.commons.text.parser.AbstractParser<JsonScanner.TokenType>
      extended by de.unkrig.commons.text.json.JsonParser

public class JsonParser
extends AbstractParser<JsonScanner.TokenType>

Parser for a 'parametrized value' of an HTTP header like:

 Content-Type: text/plain; charset=ASCII
 
'text/plain' is the so-called 'token', 'char=ASCII' is a so-called 'parameter'.


Field Summary
 
Fields inherited from class de.unkrig.commons.text.parser.AbstractParser
scanner
 
Constructor Summary
JsonParser(ProducerWhichThrows<AbstractScanner.Token<JsonScanner.TokenType>,ScanException> scanner)
           
JsonParser(java.io.Reader r)
           
 
Method Summary
 Json.Value parseArray()
           array := '[' [ value { ',' value } ] ']'
 Json.ObjecT parseObject()
           object := '{' [ member { ',' member } ] '}' member := string ':' value
 Json.Value parseValue()
           value := string | number | object | array | 'true' | 'false' | 'null'
 
Methods inherited from class de.unkrig.commons.text.parser.AbstractParser
eoi, peek, peek, peek, peek, peekRead, peekRead, peekRead, peekRead, peekReadEnum, read, read, read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonParser

public JsonParser(ProducerWhichThrows<AbstractScanner.Token<JsonScanner.TokenType>,ScanException> scanner)

JsonParser

public JsonParser(java.io.Reader r)
Method Detail

parseObject

public Json.ObjecT parseObject()
                        throws java.io.IOException,
                               ParseException
 object := '{' [ member { ',' member } ] '}'

 member := string ':' value
 

Throws:
java.io.IOException
ParseException

parseValue

public Json.Value parseValue()
                      throws java.io.IOException,
                             ParseException
 value :=
   string
   | number
   | object
   | array
   | 'true'
   | 'false'
   | 'null'
 

Throws:
java.io.IOException
ParseException

parseArray

public Json.Value parseArray()
                      throws java.io.IOException,
                             ParseException
 array := '[' [ value { ',' value } ] ']'
 

Throws:
java.io.IOException
ParseException