|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunsw.cse.framescript.Atomiser
public class Atomiser
This class takes a reader and tokenises its stream of characters into terms. Term produced are generally of types: atom, integer, double, string.
Constructor Summary | |
---|---|
Atomiser()
Creates an atomiser that reads from System.in. |
|
Atomiser(java.io.InputStream is)
Creates an atomiser that reads from a specified input stream. |
|
Atomiser(java.io.Reader r)
Creates an atomiser that reads from a specified reader. |
|
Atomiser(java.lang.String s)
Creates an atomiser that tokenises a given string. |
Method Summary | |
---|---|
static void |
addCompoundTerm(Atom a)
Tells all atomisers that a specific configuration of characters is special. |
static void |
addCompoundTerm(java.lang.String str)
Tells all atomisers that a specific configuration of characters is special. |
void |
allowSlashSlashComments(boolean flag)
Switches on/off C style line comments. |
void |
allowSlashStarComments(boolean flag)
Switches on/off C style block comments. |
java.lang.String |
comment(Term t)
Gets a comment associated with a term. |
void |
commentChar(int c)
Designates a character as a line comment indicator. |
static void |
debug(int i,
java.lang.String msg)
Method for displaying debugging information. |
void |
eolIsImportant(boolean flag)
Designates whether the end of a line is to be treated a a special character. |
int |
lineno()
Gets the current line number. |
static void |
loadAtoms()
Tells all atomisers to load all atoms from symbol table to get special atoms. |
static void |
main(java.lang.String[] args)
For use in testing of Atomiser. |
Term |
nextToken()
Gets the next term from the input stream. |
boolean |
nextToken(Term expect)
Checks if the next term matches another, if so it is consumed. |
void |
ordinaryChar(int c)
Designates a character ordiary. |
void |
ordinaryChars(int low,
int high)
Designates a range of characters ordinary. |
void |
parseNumbers(boolean flag)
Switches on/off number parsing. |
void |
pushBack(Term t)
Returns a term to the input stream. |
void |
quoteChar(int c)
Designates a character to be a quotation character. |
void |
skip(Term expect)
Skips to the designated term. |
void |
whitespaceChars(int low,
int high)
Designates which characters are considered whitespace. |
void |
wordChars(int low,
int high)
Disignates a range of characters to be word characters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Atomiser()
public Atomiser(java.io.Reader r)
r
- a readerpublic Atomiser(java.io.InputStream is)
is
- an input streampublic Atomiser(java.lang.String s)
s
- a string to be tokenisedMethod Detail |
---|
public java.lang.String comment(Term t)
t
- the term to get the comment for
public void ordinaryChar(int c)
c
- a characterpublic void ordinaryChars(int low, int high)
low
- lowest character to be made ordinaryhigh
- highest character to be made ordinarypublic void wordChars(int low, int high)
low
- lowest characte to be a word characterhigh
- highest character to be a word characterpublic void whitespaceChars(int low, int high)
low
- lowest character being made whitespacehigh
- highest character being made whitespacepublic void quoteChar(int c)
c
- a characterpublic void commentChar(int c)
c
- a characterpublic void parseNumbers(boolean flag)
flag
- whether or not to parse numberspublic void allowSlashSlashComments(boolean flag)
flag
- whether or not C style line comments are to be ignored.public void allowSlashStarComments(boolean flag)
flag
- whether or not C style line comments are to be ignored.public static void addCompoundTerm(Atom a)
a
- atom that represents a special configuration of characterspublic static void addCompoundTerm(java.lang.String str)
str
- a string which shows a special configuration of characterspublic void eolIsImportant(boolean flag)
flag
- whether or not ends of line are importantpublic int lineno()
public static void loadAtoms()
public Term nextToken() throws SyntaxError, java.io.IOException
java.io.IOException
- if the is a problem reading from the input stream
SyntaxError
- if a string literal is incorrectly finishedpublic void pushBack(Term t)
t
- term being returned to the streampublic boolean nextToken(Term expect) throws SyntaxError, java.io.IOException
expect
- a term that is exxpected at this point in the stream
SyntaxError
- if there is a problem reading from the input stream
java.io.IOException
- if there is a problem reading from the input streampublic void skip(Term expect) throws java.io.IOException
expect
- the term to skip to
java.io.IOException
- if there is a problem reading from the input streampublic static void debug(int i, java.lang.String msg)
i
- level of the debugging informationmsg
- string with debugging informationpublic static void main(java.lang.String[] args)
args
- arguments
FSException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |