package alba
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=4817038301d3e45bac9edf7e6f2fc8bf0a6d78e76e02ad7ea33ef69bcc17df3b
md5=25234357587126685d64f16236167937
doc/alba.fmlib/Fmlib/Character_parser/Simple/index.html
Module Character_parser.Simple
Simple Parser.
Parameters
module Final : Module_types.ANY
Signature
Modules and Types
module Error :
Generic_parser.ERROR
with type expect = string * Indent.t
and type semantic = string
type final = Final.t
Combinators
include COMBINATORS
with type expect = string
and type semantic = string
and type state = Common.Unit.t
and type context = string
Basic Combinators
include Generic_parser.COMBINATORS with type semantic = string
val return : 'a -> 'a t
val succeed : 'a -> 'a t
Position and State Combinators
val get_position : Position.t t
val get_state : Common.Unit.t t
val put_state : Common.Unit.t -> unit t
val update : (Common.Unit.t -> Common.Unit.t) -> unit t
Indentation Combinators
val get_bounds : (int * int option) t
Context Combinator
val expect : (char -> bool) -> string -> char t
Character Combinators
val expect_end : unit t
val one_of_chars : string -> string -> char t
val string : string -> unit t
val char : char -> unit t
val space : unit t
val letter : char t
val digit : char t
val word : (char -> bool) -> (char -> bool) -> string -> string t
word start_char inner_char error_message
A word starts with a character satisfying start_char
followed by zero or more characters satisfying inner_char
.
In case that the first character does not satisfy start_char
an unsatisfied expectation with error_message
is entered.
Parser
During Parsing
include PARSER with type state = Common.Unit.t
type state = Common.Unit.t
State type
val needs_more : parser -> bool
Does the parser need more tokens (i.e. either put_character
or put_end
)?
val has_ended : parser -> bool
Has the parser terminated (opposite of needs_more p
)?
val has_succeeded : parser -> bool
Has the parser succeeded
val has_failed : parser -> bool
Has the parser failed
val position : parser -> Position.t
The current position.
val line : parser -> int
The current line.
val column : parser -> int
The current column.
val error_tabs : parser -> int list
put_character p c
feeds the parser p
with the character token c
. Only possible if needs_more p
is valid.
Terminated Parser
The result the parser has produced which is either a final value or a list of dead ends. Only valid if the parser has terminated.
The list of tokens (i.e. optional characters) which the parser has not processed at the point of termination.
val lookahead_string : parser -> string