scala.util.parsing.combinator.lexical

class StdLexical

[source: scala/util/parsing/combinator/lexical/StdLexical.scala]

class StdLexical
extends Lexical with StdTokens

This 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}.

Author
Martin Odersky, Iulian Dragos, Adriaan Moors
Direct Known Subclasses:
Lexer

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
Values and Variables inherited from Parsers
lastNoSuccess
Method Summary
protected def comment : Parser[Any]
protected def delim : Parser[Token]
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
Parser, OnceParser, commit, elem, elem, accept, accept, accept, acceptIf, acceptMatch, acceptSeq, failure, err, success, log, rep, repsep, rep1, rep1, repN, rep1sep, chainl1, chainl1, chainr1, opt, not, positioned, phrase, mkList
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]
The set of reserved identifiers: these will be returned as `Keyword's

val delimiters : HashSet[java.lang.String]
The set of delimiters (ordering does not matter)

Method Details
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

protected def comment : Parser[Any]

protected def processIdent(name : java.lang.String) : Product with Token

protected def delim : Parser[Token]