Package gnu.ecmascript
Class Lexer
- java.lang.Object
-
- java.io.Reader
-
- gnu.text.Lexer
-
- gnu.ecmascript.Lexer
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
public class Lexer extends Lexer
Reads EcmaScript token from a InPort.
-
-
Field Summary
Fields Modifier and Type Field Description static Char
colonToken
static Char
commaToken
static Char
condToken
static Char
dotToken
static Reserved
elseToken
static Object
eofToken
static 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
nesting, port, tentative, tokenBuffer, tokenBufferLength
-
-
Constructor Summary
Constructors Constructor Description Lexer(gnu.kawa.io.InPort port)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Object
checkReserved(String name)
String
getIdentifier(int ch)
Double
getNumericLiteral(int c)
String
getStringLiteral(char quote)
Object
getToken()
Returns the next token.static Object
getToken(gnu.kawa.io.InPort inp)
static void
main(String[] args)
Object
maybeAssignment(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, isTentative, mark, peek, popNesting, pushNesting, read, read, readCodePoint, readDelimited, readDigits, readDigitsInBuffer, readIntDigits, readOptionalExponent, readUnicodeChar, reset, seenErrors, setInteractive, setMessages, setTentative, skip, skip_quick, tokenBufferAppend, tokenBufferString, unread, unread, unread_quick
-
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, ready, skip, transferTo
-
-
-
-
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 Object eolToken
-
eofToken
public static final Object eofToken
-
elseToken
public static final Reserved elseToken
-
newToken
public static final Reserved newToken
-
-
Method Detail
-
getNumericLiteral
public Double getNumericLiteral(int c) throws IOException
- Throws:
IOException
-
getStringLiteral
public String getStringLiteral(char quote) throws IOException, SyntaxException
- Throws:
IOException
SyntaxException
-
getIdentifier
public String getIdentifier(int ch) throws IOException
- Throws:
IOException
-
maybeAssignment
public Object maybeAssignment(Object token) throws IOException, SyntaxException
- Throws:
IOException
SyntaxException
-
getToken
public Object getToken() throws IOException, SyntaxException
Returns the next token. Returns:- end-of-file
- Sequence.eofValue
- end-of-line
- eolToken
- reserved word
- ???
- identifier
- a java.lang.String
- punctuator
- ???
- 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:
IOException
SyntaxException
-
getToken
public static Object getToken(gnu.kawa.io.InPort inp) throws IOException, SyntaxException
- Throws:
IOException
SyntaxException
-
main
public static void main(String[] args)
-
-