Scala Library
|
|
class
StdLexical
extends
Lexical with
StdTokensThis component provides a standard lexical parser for a simple, Scala-like language. It parses keywords and identifiers, numeric literals (integers), strings, and delimiters.
To distinguish between identifiers and keywords, it uses a set of reserved identifiers: every string contained in `reserved' is returned as a keyword token. (Note that "=>" is hard-coded as a keyword.) Additionally, the kinds of delimiters can be specified by the `delimiters' set.
Usually this component is used to break character-based input into bigger tokens, which are then passed to a token-parser {@see TokenParsers}.
Value Summary | |
val
|
delimiters
: HashSet[java.lang.String]
The set of delimiters (ordering does not matter)
|
val
|
reserved
: HashSet[java.lang.String]
The set of reserved identifiers: these will be returned as `Keyword's
|
Method Summary | |
protected def
|
comment : Parser[Any] |
protected def
|
delim : Parser[Token] |
def
|
identBegin : Parser[Char] |
def
|
identCont : Parser[Char] |
protected def
|
processIdent
(name : java.lang.String) : Product with Token
|
def
|
token
: Parser[Token]
a parser that produces a token (from a stream of characters)
|
def
|
whitespace
: Parser[Any]
a parser for white-space -- its result will be discarded
|
Methods inherited from Lexical | |
letter, digit, chrExcept, whitespaceChar |
Methods inherited from Tokens | |
errorToken |
Methods inherited from Parsers | |
commit, commit, not, elem, elem, accept, accept, accept, failure, fail, success, success, discard, log, log, rep, rep, repsep, rep1, rep1, repN, rep1, repN, rep1sep, rep1sep, chainl1, chainl1, chainr1, opt, opt, positioned, positioned |
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Value Details |
val
reserved : HashSet[java.lang.String]
val
delimiters : HashSet[java.lang.String]
Method Details |
protected
def
processIdent(name : java.lang.String) : Product with
Token
Scala Library
|
|