Liquidsoap_lang_parser.String_literalEscape decoding for string and regexp literal bodies.
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 ->
stringrender ~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