gnu.ecmascript
Class Lexer

java.lang.Object
  extended by java.io.Reader
      extended by gnu.text.Lexer
          extended by gnu.ecmascript.Lexer
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class Lexer
extends Lexer

Reads EcmaScript token from a InPort.


Field Summary
static Char colonToken
           
static Char commaToken
           
static Char condToken
           
static Char dotToken
           
static Reserved elseToken
           
static java.lang.Object eofToken
           
static java.lang.Object eolToken
           
static Char equalToken
           
static Char lbraceToken
           
static Char lbracketToken
           
static Char lparenToken
           
static Reserved newToken
           
static Char notToken
           
static Char rbraceToken
           
static Char rbracketToken
           
static Char rparenToken
           
static Char semicolonToken
           
static Char tildeToken
           
 
Fields inherited from class gnu.text.Lexer
interactive, nesting, port, tokenBuffer, tokenBufferLength
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
Lexer(InPort port)
           
 
Method Summary
static java.lang.Object checkReserved(java.lang.String name)
           
 java.lang.String getIdentifier(int ch)
           
 java.lang.Double getNumericLiteral(int c)
           
 java.lang.String getStringLiteral(char quote)
           
 java.lang.Object getToken()
          Returns the next token.
static java.lang.Object getToken(InPort inp)
           
static void main(java.lang.String[] args)
           
 java.lang.Object maybeAssignment(java.lang.Object token)
           
 
Methods inherited from class gnu.text.Lexer
checkErrors, checkNext, clearErrors, close, eofError, eofError, error, error, error, fatal, getColumnNumber, getErrors, getLineNumber, getMessages, getName, getPort, isInteractive, mark, peek, popNesting, pushNesting, read, read, readDigitsInBuffer, readOptionalExponent, reset, seenErrors, setInteractive, setMessages, skip_quick, skip, tokenBufferAppend, unread_quick, unread, unread
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, ready, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lparenToken

public static final Char lparenToken

rparenToken

public static final Char rparenToken

lbraceToken

public static final Char lbraceToken

rbraceToken

public static final Char rbraceToken

lbracketToken

public static final Char lbracketToken

rbracketToken

public static final Char rbracketToken

dotToken

public static final Char dotToken

condToken

public static final Char condToken

commaToken

public static final Char commaToken

colonToken

public static final Char colonToken

equalToken

public static final Char equalToken

tildeToken

public static final Char tildeToken

notToken

public static final Char notToken

semicolonToken

public static final Char semicolonToken

eolToken

public static final java.lang.Object eolToken

eofToken

public static final java.lang.Object eofToken

elseToken

public static final Reserved elseToken

newToken

public static final Reserved newToken
Constructor Detail

Lexer

public Lexer(InPort port)
Method Detail

checkReserved

public static java.lang.Object checkReserved(java.lang.String name)

getNumericLiteral

public java.lang.Double getNumericLiteral(int c)
                                   throws java.io.IOException
Throws:
java.io.IOException

getStringLiteral

public java.lang.String getStringLiteral(char quote)
                                  throws java.io.IOException,
                                         SyntaxException
Throws:
java.io.IOException
SyntaxException

getIdentifier

public java.lang.String getIdentifier(int ch)
                               throws java.io.IOException
Throws:
java.io.IOException

maybeAssignment

public java.lang.Object maybeAssignment(java.lang.Object token)
                                 throws java.io.IOException,
                                        SyntaxException
Throws:
java.io.IOException
SyntaxException

getToken

public java.lang.Object getToken()
                          throws java.io.IOException,
                                 SyntaxException
Returns the next token. Returns:
end-of-file
Sequence.eofValue
end-of-line>dd>eolToken
reserved word
???
identifier>
a java.lang.String
punctuator
???
Literals are returned a QuoteExp objects, Specifically:
numeric literal
a QuoteExp of a java.lang.Double value
boolean literal
a QuoteExp of java.lang.Boolean.TRUE or FALSE
null literal
a QuoteExp whose value is null
string literal
a QuoteExp whose value is a String

Throws:
java.io.IOException
SyntaxException

getToken

public static java.lang.Object getToken(InPort inp)
                                 throws java.io.IOException,
                                        SyntaxException
Throws:
java.io.IOException
SyntaxException

main

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