sleep.parser
Class Parser

java.lang.Object
  extended by sleep.parser.Parser

public class Parser
extends java.lang.Object


Field Summary
protected  java.lang.String code
           
protected  java.util.LinkedList comments
          an identifier for the script file.
 char EndOfTerm
           
protected  java.util.LinkedList errors
          a list of all of the comments from the script file
protected  Block executeMe
          a list of all of the statements
protected  ImportManager imports
           
protected  java.lang.String name
          the actual "code" for the script file.
protected  java.util.LinkedList statements
           
protected  TokenList tokens
          a list of all of the parser warnings
protected  java.util.LinkedList warnings
          a list of all of the parser errors
 
Constructor Summary
Parser(java.lang.String _code)
          initialize the parser with the code you want me to work with
Parser(java.lang.String _name, java.lang.String _code)
          initialize the parser with the code you want me to work with
Parser(java.lang.String _name, java.lang.String _code, ImportManager imps)
          initialize the parser with the code you want me to work with plus a shared import manager
 
Method Summary
 void addComment(java.lang.String text)
           
 void addStatement(Statement state)
           
 java.lang.Class findImportedClass(java.lang.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
 ImportManager getImportManager()
          obtain the import manager, used for managing imported packages.
 java.lang.String getName()
          returns the identifier representing the source of the script we're parsing
 Block getRunnableBlock()
           
 java.util.LinkedList getStatements()
           
 boolean hasErrors()
           
 boolean hasWarnings()
           
 void importPackage(java.lang.String packagez, java.lang.String from)
          Used by Sleep to import statement to save an imported package name.
static void main(java.lang.String[] args)
           
 void parse()
           
 void parse(StringIterator siter)
           
 void reportError(java.lang.String description, Token responsible)
           
 void reportError(SyntaxError error)
           
 void reportErrorWithMarker(java.lang.String description, Token responsible)
           
 void reportWarning(java.lang.String description, Token responsible)
           
 void setEndOfTerm(char c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code

protected java.lang.String code

name

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


comments

protected java.util.LinkedList comments
an identifier for the script file.


errors

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


warnings

protected java.util.LinkedList warnings
a list of all of the parser errors


tokens

protected TokenList tokens
a list of all of the parser warnings


statements

protected java.util.LinkedList statements

executeMe

protected Block executeMe
a list of all of the statements


EndOfTerm

public char EndOfTerm

imports

protected ImportManager imports
Constructor Detail

Parser

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


Parser

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


Parser

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

Method Detail

getImportManager

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


importPackage

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


findImportedClass

public java.lang.Class findImportedClass(java.lang.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


setEndOfTerm

public void setEndOfTerm(char c)

addStatement

public void addStatement(Statement state)

getStatements

public java.util.LinkedList getStatements()

getName

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


parse

public void parse()
           throws YourCodeSucksException
Throws:
YourCodeSucksException

parse

public void parse(StringIterator siter)
           throws YourCodeSucksException
Throws:
YourCodeSucksException

reportError

public void reportError(java.lang.String description,
                        Token responsible)

reportErrorWithMarker

public void reportErrorWithMarker(java.lang.String description,
                                  Token responsible)

reportError

public void reportError(SyntaxError error)

getRunnableBlock

public Block getRunnableBlock()

reportWarning

public void reportWarning(java.lang.String description,
                          Token responsible)

hasErrors

public boolean hasErrors()

hasWarnings

public boolean hasWarnings()

addComment

public void addComment(java.lang.String text)

main

public static void main(java.lang.String[] args)