Module Liquidsoap_lang_parser.String_literal

Escape decoding for string and regexp literal bodies.

val __sedlex_table_1 : string
val __sedlex_table_3 : string
val __sedlex_table_4 : string
val __sedlex_table_2 : string
val __sedlex_table_5 : string
val __sedlex_partition_2 : int -> int
val __sedlex_partition_1 : int -> int
val __sedlex_partition_6 : int -> int
val __sedlex_partition_5 : int -> int
val __sedlex_partition_4 : int -> int
val __sedlex_partition_3 : int -> int

Decoding of string and regexp literal bodies.

Lexer stores literals raw, so that the formatter can reproduce them verbatim; escapes are resolved later, by render. This lives outside Lexer because Lexer depends on Parser for the token type, while Parser_helper — which the grammar's semantic actions use — needs to decode literals too.

val render : pos:Liquidsoap_lang_ast.Term.parsed_pos -> sep:char -> string -> string

render ~pos ~sep s resolves the escape sequences of a literal whose delimiter is sep. With sep = '/' (a regexp literal) the escapes the regexp engine handles itself are deliberately preserved.

See https://en.wikipedia.org/wiki/Escape_sequences_in_C