Sexplib.PathSourcePath: Module for Substitutions within S-expressions
Type of substitution elements
parse str
Syntax:
"." -> separates path elements; must be present at start of string.
"[4]" -> specifies the 4th element in a tuple.
"some_tag[4]" -> tries to match some_tag, then denotes its 4th argument.
"name" -> denotes record field having name.
If an element contains the literal characters dots '.', brackets '', or backslashes '\', escape them with a backslash.
Example from test code:
".t.x.B1" -> choose record field with name t, then subfield x. Match this value against B, and denote its first argument.
".github\\.com" -> choose the record field with name github.com.
get ?path ?str sexp if path is provided, use it as path. Otherwise, if str is provided, parse it as a path. If neither is provided, assume an empty path.
replace ?path ?str sexp ~subst like get, but does not extract a sub-expression but substitutes it with subst.
replace_no_path ~str sexp ~subst like replace, but does not take optional arguments. str must be specified.
extract_pos n sexp
extract_match tag n sexp