sleep.parser
Class ParserConfig
public class ParserConfig
This class offers access to modify some settings within the sleep parser.
Install an Escape Constant
In sleep a character prefixed by a \ backslash within a "double quoted" string is said to be escaped. Typically an
escaped character is just skipped over during processing. It is possible in sleep to add meaning to different
characters by installing an escape. For example to add the escape \r to mean the new line character one would do the
following:
ParserConfig.installEscapeConstant('m', "MONKEY");
Once the above code is executed the value "blah\m" inside of sleep would be equivalent in java to "blahMONKEY".
Register a Keyword
The sleep parser requires that all environment "keywords" be registered before any scripts are parsed. Bridges
that should register their keywords are Environment, PredicateEnvironment, FilterEnvironment, Operator, and Predicate.
static void | addKeyword(String keyword) - registers "keyword" as a keyword with the parser.
|
static File | findJarFile(String name) - Search the sleep classpath for the specified file.
|
static String | getSleepClasspath() - Query the Sleep classpath.
|
static void | installEscapeConstant(char escape, String value) - Installs an escape constant into the sleep parser.
|
static void | setSleepClasspath(String path) - Set the Sleep classpath.
|
addKeyword
public static void addKeyword(String keyword)
registers "keyword" as a keyword with the parser. This is a necessity if you have environment bridges in sleep
findJarFile
public static File findJarFile(String name)
Search the sleep classpath for the specified file. Returns a File object reflecting where the
file was found. This method does not return null. If the file does not exist then a File object
constructed with just the passed in name is returned
getSleepClasspath
public static String getSleepClasspath()
Query the Sleep classpath. This is a semi-colon separated list of paths where sleep
should search for jar files that scripts attempt to import
installEscapeConstant
public static void installEscapeConstant(char escape,
String value)
Installs an escape constant into the sleep parser. Any time the escape constant escape is encountered inside of a
parsed literal with a \ backslash before it, sleep will substitute that string with the value specified here.
setSleepClasspath
public static void setSleepClasspath(String path)
Set the Sleep classpath. A semi-colon separated list of paths where sleep should search for
jar files that scripts attempt to import