aboutsummaryrefslogtreecommitdiff
path: root/compiler/standardClient.ey
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-08-06 23:09:08 +0200
committerDrahflow <drahflow@gmx.de>2013-08-06 23:09:08 +0200
commita0f5e44d1cd8f3d4b12463bf9d0401f0d5623057 (patch)
tree6d09c6a94ed406b8335c2d0678857bca11fba6c3 /compiler/standardClient.ey
parent92d3a212d4f9afe21914080de81f23d1878f6685 (diff)
Towards more efficient "include"
Diffstat (limited to 'compiler/standardClient.ey')
-rw-r--r--compiler/standardClient.ey22
1 files changed, 17 insertions, 5 deletions
diff --git a/compiler/standardClient.ey b/compiler/standardClient.ey
index 15c1878..4c03c8e 100644
--- a/compiler/standardClient.ey
+++ b/compiler/standardClient.ey
@@ -431,7 +431,7 @@
{ 0 dumpIndented }
> -- /dump deff
-# # regex support
+## regex support
# ideas taken from http://swtch.com/~rsc/regexp/regexp3.html
{
0 ==MATCH 1 ==TERM 2 ==JUMP 3 ==SPLIT 4 ==SAVE 5 ==FIRST 6 ==LAST
@@ -666,9 +666,14 @@
{ ==thread ==newpc <
newpc ==pc
- [ thread .captures 20 dearray ] ==captures
+ thread .captures ==captures
> } /cloneThread deff
+ { ==thread ==newpc <
+ newpc ==pc
+ [ thread .captures 20 dearray ] ==captures
+ > } /fullCloneThread deff
+
{ ==prog ==string
0 ==position
string len ==maxPosition
@@ -700,8 +705,9 @@
pc 1 code add thread cloneThread clist .add
pc 2 code add thread cloneThread clist .add
} { # SAVE
- position 1 code thread .captures =[]
- pc 1 add thread cloneThread clist .add
+ pc 1 add thread fullCloneThread ==newThread
+ position 1 code newThread .captures =[]
+ newThread clist .add
} { # FIRST
position 0 eq { pc 1 add thread cloneThread clist .add } rep
} { # LAST
@@ -738,7 +744,13 @@
{ prog execute }
} /enregex deff
-{ enregex * } /regex deff
+{
+ quoted {
+ _ sys .typed .type 1 eq {
+ enregex
+ } { |enregex "*" | } ? *
+ } { enregex * } ? *
+} /regex defq
{ ==filename # ==f (left on the stack and executed from sys .asm .programStart)
sys .asm .patchProgramStart ==frozenAllocationCount