Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 25cb10d

Browse files
committed
more test progress
1 parent d6abd4e commit 25cb10d

File tree

2 files changed

+176
-133
lines changed

2 files changed

+176
-133
lines changed

lib/snippet-body.pegjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ tabStopWithTransform = '{' n:integer t:transformation '}' { return { index: n, t
7979
// Builds a capture regex and substitution tree. If the capture is not a valid regex, then the match fails
8080
transformation = '/' find:regexString '/' replace:replace '/' flags:flags & {
8181
// Predicate: only succeed if the `find` + `flags` values make a valid regex
82-
// If so, then store the regex into `find` to be used in the following
83-
// match transformation action
82+
// TODO: find a way to not build the same RegExp twice. May need to wait until
83+
// hand written parser.
8484
try {
8585
find = new RegExp(find, flags);
8686
return true;
8787
} catch(e) {
8888
return false;
8989
}
9090
} {
91-
return { find, replace };
91+
return { find: new RegExp(find, flags), replace };
9292
}
9393

9494
// Pulls out the portion that would be for the find regex. Validation is done

0 commit comments

Comments
 (0)