package alba
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=062f33c55ef39706c4290dff67d5a00bf009051fd757f9352be527f629ae21fc
md5=eb4edc4d6b7e15b83d6397bd34994153
doc/alba.fmlib/Fmlib/Character_parser/Simple/index.html
Module Character_parser.Simple
Simple Parser.
Parameters
module Final : Module_types.ANYSignature
Modules and Types
module Error :
Generic_parser.ERROR
with type expect = string * Indent.t
and type semantic = stringtype final = Final.tCombinators
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 tval succeed : 'a -> 'a tPosition and State Combinators
val get_position : Position.t tval get_state : Common.Unit.t tval update : (Common.Unit.t -> Common.Unit.t) -> unit tIndentation Combinators
val get_bounds : (int * int option) tContext Combinator
val expect : (char -> bool) -> string -> char tCharacter Combinators
val expect_end : unit tval one_of_chars : string -> string -> char tval string : string -> unit tval char : char -> unit tval space : unit tval letter : char tval digit : char tval word : (char -> bool) -> (char -> bool) -> string -> string tword 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.tState type
val needs_more : parser -> boolDoes the parser need more tokens (i.e. either put_character or put_end)?
val has_ended : parser -> boolHas the parser terminated (opposite of needs_more p)?
val has_succeeded : parser -> boolHas the parser succeeded
val has_failed : parser -> boolHas the parser failed
val position : parser -> Position.tThe current position.
val line : parser -> intThe current line.
val column : parser -> intThe current column.
val error_tabs : parser -> int listput_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