net.sf.sasl.language.placeholder.syntax
Class PlaceholderScriptParser

java.lang.Object
  extended by net.sf.sasl.language.placeholder.syntax.PlaceholderScriptParser

public class PlaceholderScriptParser
extends Object

Small adapter to a cup generated LALR(1) placeholder parser.

Since:
0.0.1 (sasl-common-aspect-library)
Author:
Philipp Förmer

Constructor Summary
  PlaceholderScriptParser(InputStream inputStream)
          Creates a parser that reads the input from the given input stream.
protected PlaceholderScriptParser(PlaceholderScriptScanner scanner)
          Creates a parser that uses the given scanner to read the input.
  PlaceholderScriptParser(String input)
          Creates a parser that reads the input from the given input string.
 
Method Summary
 ScriptNode getParsedAST()
          Returns the parsed abstract syntax tree.
 Set<String> getPlaceholderSymbols()
          Returns a set of all placeholder names of the parsed abstract placeholder syntax tree.
 ScriptNode parse()
          Tries to parse the input if not already parsed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlaceholderScriptParser

public PlaceholderScriptParser(String input)
                        throws IllegalArgumentException
Creates a parser that reads the input from the given input string.

Parameters:
input - non null.
Throws:
IllegalArgumentException - if input is null.
Since:
0.0.1 (sasl-common-aspect-library)

PlaceholderScriptParser

public PlaceholderScriptParser(InputStream inputStream)
                        throws IllegalArgumentException
Creates a parser that reads the input from the given input stream.

Parameters:
inputStream - non null.
Throws:
IllegalArgumentException
Since:
0.0.1 (sasl-common-aspect-library)

PlaceholderScriptParser

protected PlaceholderScriptParser(PlaceholderScriptScanner scanner)
                           throws IllegalArgumentException
Creates a parser that uses the given scanner to read the input.

Parameters:
scanner - non null
Throws:
IllegalArgumentException - if scanner is null.
Since:
0.0.1 (sasl-common-aspect-library)
Method Detail

parse

public ScriptNode parse()
                 throws ParseException
Tries to parse the input if not already parsed. If parsing is successfully or parsed successfully in the past, than a non null script node will be returned which is the root of the abstract syntax tree. If the parse failed in the past, than null will be returned.

Returns:
null or non null.
Throws:
ParseException - if a scanner exception or syntax error occurs during parsing the input.
Since:
0.0.1 (sasl-common-aspect-library)

getParsedAST

public ScriptNode getParsedAST()
Returns the parsed abstract syntax tree. Returns null, if the parsing failed or parse() was not called in the past.

Returns:
null or non null.
Since:
0.0.1 (sasl-common-aspect-library)

getPlaceholderSymbols

public Set<String> getPlaceholderSymbols()
Returns a set of all placeholder names of the parsed abstract placeholder syntax tree. Null if no placeholder script was parsed or successfully parsed.

Returns:
null or non null
Since:
0.0.1 (sasl-common-aspect-library)


Copyright © 2010. All Rights Reserved.