Scala 2.6.0-final

API Specification

This document is the API specification for Scala Library Documentation

Class Summary
abstract class Lexical extends Scanners with Tokens

This component complements the Scanners component with common operations for lexical parsers.

{@see StdLexical} for a concrete implementation for a simple, Scala-like language.

trait Scanners extends Parsers

This component provides core functionality for lexical parsers.

See its subclasses {@see Lexical} and -- most interestingly {@see StdLexical}, for more functionality.

@requires token a parser that produces a token (from a stream of characters) @requires whitespace a unit-parser for white-space @provides Scanner essentially a parser that parses a stream of characters to produce `Token's, which are typically passed to a syntactical parser (which operates on `Token's, not on individual characters).
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}.