it.unimi.di.mg4j.query.parser
Interface QueryParser

All Superinterfaces:
FlyweightPrototype<QueryParser>
All Known Implementing Classes:
SimpleParser

public interface QueryParser
extends FlyweightPrototype<QueryParser>

A parser transforming query strings in composite Query objects.

Besides the obvious parse(String)/parse(MutableString) methods, a query parser must provide an escape(String)/escape(MutableString) method that can be used to turn arbitrary strings into text tokens.

Author:
Sebastiano Vigna

Method Summary
 MutableString escape(MutableString token)
          Escapes the provided mutable string, making it into a text token.
 String escape(String token)
          Escapes the provided string, making it into a text token.
 Query parse(MutableString query)
          Turns the given query mutable string into a composite Query object.
 Query parse(String query)
          Turns the given query string into a composite Query object.
 
Methods inherited from interface it.unimi.dsi.lang.FlyweightPrototype
copy
 

Method Detail

parse

Query parse(String query)
            throws QueryParserException
Turns the given query string into a composite Query object.

Parameters:
query - a string representing a query.
Returns:
the corresponding composite object.
Throws:
QueryParserException

parse

Query parse(MutableString query)
            throws QueryParserException
Turns the given query mutable string into a composite Query object.

Parameters:
query - a mutable string representing a query.
Returns:
the corresponding composite object.
Throws:
QueryParserException

escape

String escape(String token)
Escapes the provided string, making it into a text token.

Parameters:
token - a wannabe text token (maybe containing special characters, but no character below code 32).
Returns:
an escaped representation of token that will be interpreted as a text token by this parser.

escape

MutableString escape(MutableString token)
Escapes the provided mutable string, making it into a text token.

Parameters:
token - a wannabe text token (maybe containing special characters, but no character below code 32).
Returns:
token, escaped so that it will be interpreted as a text token by this parser.