package batteries
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=00f34b9aed4e47f314425b2ca9ceac206f112095a17ea9a7ffa6dac8cfccc492
md5=066051f9a210277710c54ad57c3b9568
doc/batteries.unthreaded/BatGenlex/Languages/Make/index.html
Module Languages.Make
Create a lexer from a language definition
Parameters
module M : DefinitionSignature
High-level API
val feed :
(char, BatCharParser.position) BatParserCo.Source.t ->
(token, BatCharParser.position) BatParserCo.Source.tDrop 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, BatCharParser.position) BatParserCo.tMedium-level API
Remove any leading whitespaces
val ident : (char, string, BatCharParser.position) BatParserCo.tAccepts any non-reserved identifier/operator. If the language is not case_sensitive, the identifier is returned in lower-case.
val kwd : (char, string, BatCharParser.position) BatParserCo.tAccepts any identifier. If the language is not case_sensitive, the identifier is returned in lower-case.
val identifier : string -> (char, unit, BatCharParser.position) BatParserCo.tval keyword : string -> (char, unit, BatCharParser.position) BatParserCo.tval char_literal : (char, char, BatCharParser.position) BatParserCo.tAccepts a character literal, i.e. one character (or an escape) between two quotes.
val string_literal : (char, string, BatCharParser.position) BatParserCo.tAccepts a string, i.e. one sequence of characters or escapes between two double quotes, on one line.
val integer : (char, int, BatCharParser.position) BatParserCo.tParse an integer.
val float : (char, float, BatCharParser.position) BatParserCo.tParse a floating-point number.
val number :
(char, [ `Float of float | `Integer of int ], BatCharParser.position)
BatParserCo.tParse either an integer or a floating-point number.
val char : char -> (char, char, BatCharParser.position) BatParserCo.tLow-level API
As CharParser.char, but case-insensitive if specified by case_sensitive.
val string : string -> (char, string, BatCharParser.position) BatParserCo.tAs CharParser.string, but case-insensitive if specified by case_sensitive.
val line_comment : (char, unit, BatCharParser.position) BatParserCo.tval multiline_comment : (char, unit, BatCharParser.position) BatParserCo.tval comment : (char, unit, BatCharParser.position) BatParserCo.tval whitespaces : (char, unit, BatCharParser.position) BatParserCo.tApply this filter to your own parsers if you want them to ignore following comments.