package camlp-streams

  1. Overview
  2. Docs
The Stream and Genlex libraries for use with Camlp4 and Camlp5

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v5.0.1.tar.gz
md5=afc874b25f7a1f13e8f5cfc1182b51a7
sha512=2efa8dd4a636217c8d49bac1e4e7e5558fc2f45cfea66514140a59fd99dd08d61fb9f1e17804997ff648b71b13820a5d4a1eb70fed9d848aa2abd6e41f853c86

doc/camlp-streams/Genlex/index.html

Module GenlexSource

include module type of struct include Genlex end
Sourcetype token = Genlex.token =
  1. | Kwd of string
  2. | Ident of string
  3. | Int of int
  4. | Float of float
  5. | String of string
  6. | Char of char

The type of tokens. The lexical classes are: Int and Float for integer and floating-point numbers; String for string literals, enclosed in double quotes; Char for character literals, enclosed in single quotes; Ident for identifiers (either sequences of letters, digits, underscores and quotes, or sequences of 'operator characters' such as +, *, etc); and Kwd for keywords (either identifiers or single 'special characters' such as (, }, etc).

Sourceval make_lexer : string list -> char Stream.t -> token Stream.t

Construct the lexer function. The first argument is the list of keywords. An identifier s is returned as Kwd s if s belongs to this list, and as Ident s otherwise. A special character s is returned as Kwd s if s belongs to this list, and cause a lexical error (exception Stream.Error with the offending lexeme as its parameter) otherwise. Blanks and newlines are skipped. Comments delimited by (* and *) are skipped as well, and can be nested. A Stream.Failure exception is raised if end of stream is unexpectedly reached.