Module Sedlex_ppx.Ppx_sedlexSource

PPX rewriter for sedlex.

Transforms match%sedlex lexbuf with ... into DFA-based lexer code. Registration with ppxlib is done via side effects at module initialization.

Internals exposed for the test PPX

The values below are not part of the public API. They are exposed so that ppx_sedlex_test can invoke the code generator in isolation and inspect the generated AST and DFA.

Sourceval reset_state : unit -> unit

Clear all internal tables (partitions, lookup tables). Must be called between independent compilations in tests.

Sourceval handle_sedlex_match : Ppxlib.Parsetree.expression -> Ppxlib.Parsetree.expression * Sedlex_compiler.Sedlex.dfa

handle_sedlex_match match_expr compiles a match%sedlex lexbuf with ... expression into generated DFA code using the built-in regexp environment. Returns the generated expression and the DFA automaton.

Sourceval map_expression : Ppxlib.Parsetree.expression -> Ppxlib.Parsetree.expression

map_expression expr applies the sedlex mapper to expr, processing any [%sedlex] or [%sedlex.regexp?] extensions it contains.