module Future.Genlex.Languages.Make: functor (
M
:
Extlib.ExtGenlex.Genlex.Languages.Definition
) ->
sig
.. end
Parameters: |
M |
: |
Extlib.ExtGenlex.Genlex.Languages.Definition
|
|
Create a lexer from a language definition
High-level API
val feed : (char, Future.Char_parser.position) Future.Parser_co.Source.t ->
(Future.Genlex.token, Future.Char_parser.position)
Future.Parser_co.Source.t
Drop comments, present reserved operators and reserved
names as
Kwd
, operators and identifiers as
Ident
,
integer numbers as
Int
, floating-point numbers as
Float
and characters as
Char
.
If the language is not case_sensitive
, identifiers and
keywords are returned in lower-case.
val start : (char, unit, Future.Char_parser.position) Future.Parser_co.t
Medium-level API
Remove any leading whitespaces
val ident : (char, string, Future.Char_parser.position) Future.Parser_co.t
Accepts any non-reserved identifier/operator.
If the language is not case_sensitive
, the identifier
is returned in lower-case.
val kwd : (char, string, Future.Char_parser.position) Future.Parser_co.t
Accepts any identifier.
If the language is not case_sensitive
, the identifier
is returned in lower-case.
val identifier : string -> (char, unit, Future.Char_parser.position) Future.Parser_co.t
val keyword : string -> (char, unit, Future.Char_parser.position) Future.Parser_co.t
val char_literal : (char, char, Future.Char_parser.position) Future.Parser_co.t
Accepts a character literal, i.e. one character
(or an escape) between two quotes.
val string_literal : (char, string, Future.Char_parser.position) Future.Parser_co.t
Accepts a string, i.e. one sequence of
characters or escapes between two double
quotes, on one line.
val integer : (char, int, Future.Char_parser.position) Future.Parser_co.t
Parse an integer.
val float : (char, float, Future.Char_parser.position) Future.Parser_co.t
Parse a floating-point number.
val number : (char, [ `Float of float | `Integer of int ], Future.Char_parser.position)
Future.Parser_co.t
Parse either an integer or a floating-point number.
val char : char -> (char, char, Future.Char_parser.position) Future.Parser_co.t
Low-level API
As CharParser.char
, but case-insensitive if specified
by case_sensitive
.
val string : string -> (char, string, Future.Char_parser.position) Future.Parser_co.t
As CharParser.string
, but case-insensitive if specified
by case_sensitive
.
val line_comment : (char, unit, Future.Char_parser.position) Future.Parser_co.t
val multiline_comment : (char, unit, Future.Char_parser.position) Future.Parser_co.t
val comment : (char, unit, Future.Char_parser.position) Future.Parser_co.t
val whitespaces : (char, unit, Future.Char_parser.position) Future.Parser_co.t
Apply this filter to your own parsers if you want them
to ignore following comments.