summaryrefslogtreecommitdiff
path: root/src/lib.urp
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2015-08-26 17:29:32 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2015-08-26 17:29:32 -0400
commitbc6b0bee8fe4120642029daaa8ce6c069ef667b8 (patch)
treefab27db4556318e4f6a4b7c60e6b47c7ab58e59a /src/lib.urp
parent75ff1a7a1979466a77dcc3acbbb88e897213027f (diff)
Rework replacement API to rely on transformation
Redesign library API around highly general regex-based transformations. Instead of specifying a string to substitute for each match, you now execute an entire function over the match (and over nonmatching regions as well). The resulting C++ code is much simpler, with more functionality pushed into Ur, and the engine now supports certain types of regex transformations needed to mimic Perl.
Diffstat (limited to 'src/lib.urp')
-rw-r--r--src/lib.urp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib.urp b/src/lib.urp
index 75bcd48..7fcdc82 100644
--- a/src/lib.urp
+++ b/src/lib.urp
@@ -1,12 +1,15 @@
ffi regex__FFI
include regex__FFI.h
link -lurweb_regex
-jsFunc Regex__FFI.succeeded=UrWeb.Regex.succeeded
-jsFunc Regex__FFI.n_subexpression_matches=UrWeb.Regex.nSubexpressionMatches
-jsFunc Regex__FFI.subexpression_match=UrWeb.Regex.subexpressionMatch
+jsFunc Regex__FFI.substring_start=UrWeb.Regex.Substring.start
+jsFunc Regex__FFI.substring_length=UrWeb.Regex.Substring.length
+jsFunc Regex__FFI.substring_list_length=UrWeb.Regex.Substring.List.length
+jsFunc Regex__FFI.substring_list_get=UrWeb.Regex.Substring.List.get
jsFunc Regex__FFI.do_match=UrWeb.Regex.doMatch
-jsFunc Regex__FFI.replace=UrWeb.Regex.replace
file /cgGvSqBi.js regex__FFI.js
script /cgGvSqBi.js
-regex \ No newline at end of file
+$/list
+$/option
+$/string
+regex