sleep.parser

Class Parser

public class Parser extends Object

Field Summary
protected Stringcode
protected LinkedListcomments
an identifier for the script file.
protected LinkedListerrors
a list of all of the comments from the script file
protected BlockexecuteMe
a list of all of the statements
charEndOfTerm
protected ImportManagerimports
protected Stringname
the actual "code" for the script file.
protected LinkedListstatements
protected TokenListtokens
a list of all of the parser warnings
protected LinkedListwarnings
a list of all of the parser errors
Constructor Summary
Parser(String _code)
initialize the parser with the code you want me to work with
Parser(String _name, String _code)
initialize the parser with the code you want me to work with
Parser(String _name, String _code, ImportManager imps)
initialize the parser with the code you want me to work with plus a shared import manager
Method Summary
voidaddComment(String text)
voidaddStatement(Statement state)
ClassfindImportedClass(String name)
Attempts to find a class, starts out with the passed in string itself, if that doesn't resolve then the string is appended to each imported package to see where the class might exist
ImportManagergetImportManager()
obtain the import manager, used for managing imported packages.
StringgetName()
returns the identifier representing the source of the script we're parsing
BlockgetRunnableBlock()
LinkedListgetStatements()
booleanhasErrors()
booleanhasWarnings()
voidimportPackage(String packagez, String from)
Used by Sleep to import statement to save an imported package name.
static voidmain(String[] args)
voidparse()
voidparse(StringIterator siter)
voidreportError(String description, Token responsible)
debug the tokenizer
voidreportError(SyntaxError error)
voidreportErrorWithMarker(String description, Token responsible)
voidreportWarning(String description, Token responsible)
voidsetEndOfTerm(char c)

Field Detail

code

protected String code

comments

protected LinkedList comments
an identifier for the script file.

errors

protected LinkedList errors
a list of all of the comments from the script file

executeMe

protected Block executeMe
a list of all of the statements

EndOfTerm

public char EndOfTerm

imports

protected ImportManager imports

name

protected String name
the actual "code" for the script file.

statements

protected LinkedList statements

tokens

protected TokenList tokens
a list of all of the parser warnings

warnings

protected LinkedList warnings
a list of all of the parser errors

Constructor Detail

Parser

public Parser(String _code)
initialize the parser with the code you want me to work with

Parser

public Parser(String _name, String _code)
initialize the parser with the code you want me to work with

Parser

public Parser(String _name, String _code, ImportManager imps)
initialize the parser with the code you want me to work with plus a shared import manager

Method Detail

addComment

public void addComment(String text)

addStatement

public void addStatement(Statement state)

findImportedClass

public Class findImportedClass(String name)
Attempts to find a class, starts out with the passed in string itself, if that doesn't resolve then the string is appended to each imported package to see where the class might exist

getImportManager

public ImportManager getImportManager()
obtain the import manager, used for managing imported packages.

getName

public String getName()
returns the identifier representing the source of the script we're parsing

getRunnableBlock

public Block getRunnableBlock()

getStatements

public LinkedList getStatements()

hasErrors

public boolean hasErrors()

hasWarnings

public boolean hasWarnings()

importPackage

public void importPackage(String packagez, String from)
Used by Sleep to import statement to save an imported package name.

main

public static void main(String[] args)

parse

public void parse()

parse

public void parse(StringIterator siter)

reportError

public void reportError(String description, Token responsible)
debug the tokenizer

reportError

public void reportError(SyntaxError error)

reportErrorWithMarker

public void reportErrorWithMarker(String description, Token responsible)

reportWarning

public void reportWarning(String description, Token responsible)

setEndOfTerm

public void setEndOfTerm(char c)