se.chalmers.cs.gf.parse
Class ParseAll

java.lang.Object
  extended by se.chalmers.cs.gf.parse.ParseAll
All Implemented Interfaces:
Parser

public class ParseAll
extends java.lang.Object
implements Parser

Try parsing with a collection of parsers.


Constructor Summary
ParseAll(Parsers parsers)
           
 
Method Summary
 java.lang.String getName()
          Get the name of this parser.
 java.util.Collection<Tree> parse(java.lang.String str)
          Parse a string to zero or more abstract syntax trees the parsers default category.
 java.util.Collection<Tree> parse(java.lang.String str, java.lang.String cat)
          Ignores the category argument.
static java.util.Collection<Pair<java.lang.String,Tree>> parseWithAll(Parsers parsers, java.lang.String str)
          Try parsing the input with all the available parsers.
 boolean tryThisOne()
          Whether this parser should be used when trying to parse a string with different parsers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParseAll

public ParseAll(Parsers parsers)
Parameters:
parsers - The parsers that should be used to parse with.
Method Detail

parse

public java.util.Collection<Tree> parse(java.lang.String str)
Description copied from interface: Parser
Parse a string to zero or more abstract syntax trees the parsers default category.

Specified by:
parse in interface Parser

parse

public java.util.Collection<Tree> parse(java.lang.String str,
                                        java.lang.String cat)
Ignores the category argument.

Specified by:
parse in interface Parser
cat - The category to parse in. Note that the category name given here might not be identical to the one in the GF grammar, as the conversion to a context-free grammar can change the category name. Typically, for non-dependent categories, the GF source category "C" is translated to "C{}.s".

getName

public java.lang.String getName()
Description copied from interface: Parser
Get the name of this parser.

Specified by:
getName in interface Parser

tryThisOne

public boolean tryThisOne()
Description copied from interface: Parser
Whether this parser should be used when trying to parse a string with different parsers. This can be used to exclude special parsers from such attempts.

Specified by:
tryThisOne in interface Parser

parseWithAll

public static java.util.Collection<Pair<java.lang.String,Tree>> parseWithAll(Parsers parsers,
                                                                             java.lang.String str)
Try parsing the input with all the available parsers.

Returns:
A list of pairs (language, parse tree)