Commit 49f314ad authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2006-05-11 09:34:22 by afrisch] Utility for string literal in regexp

Original author: afrisch
Date: 2006-05-11 09:34:23+00:00
parent ad3329d5
......@@ -534,6 +534,15 @@ let deferr s = raise (Patterns.Error s)
let mk_weakstar n = WeakStar n
let mk_seqcapt x n = SeqCapture (x,n)
let mk_str s =
let j = Encodings.Utf8.end_index s in
let rec aux i =
if Encodings.Utf8.equal_index i j then Epsilon
else let (c,i) = s i in
let t = Types.char (Chars.atom (Chars.V.mk_int c)) in
Seq(Elem(mk_type t), aux i) in
aux (Encodings.Utf8.start_index s)
let rec prepare_regexp vars b rvars f = function
(* - vars: seq variables to be propagated top-down and added
to each captured element
......@@ -42,6 +42,7 @@ val mk_alt: re -> re -> re
val mk_star: re -> re
val mk_weakstar: re -> re
val mk_seqcapt: id -> re -> re
val mk_str: Encodings.Utf8.t -> re
val rexp: re -> node
val rexp_simplify: mix:bool -> re -> node
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment