diff options
author | Stefan Israelsson Tampe <stefan.itampe@gmail.com> | 2018-07-13 21:47:54 +0200 |
---|---|---|
committer | Stefan Israelsson Tampe <stefan.itampe@gmail.com> | 2018-07-13 21:47:54 +0200 |
commit | 41b35facd202cd41049ed8696d6762c9d5d69694 (patch) | |
tree | 42885065a80ad3e280c5c30d77f2875c6d14773a /modules/language/python/module/re/compile.scm | |
parent | d461fc2b3353176f58e71cde7a5b12e1ae164138 (diff) |
multiline works
Diffstat (limited to 'modules/language/python/module/re/compile.scm')
-rw-r--r-- | modules/language/python/module/re/compile.scm | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/modules/language/python/module/re/compile.scm b/modules/language/python/module/re/compile.scm index 9c4dfd3..ca7663d 100644 --- a/modules/language/python/module/re/compile.scm +++ b/modules/language/python/module/re/compile.scm @@ -3,10 +3,10 @@ #:use-module (language python module re flags) #:use-module (language python list) #:use-module (language python string) - #:use-module ((parser stis-parser) #:select + #:use-module ((parser stis-parser) #:select ((parse . stisparse) <p-lambda> <p-cc> .. f-nl! f-nl f-tag! f-tag f-seq f-or f-or! f-and f-true g* g+ gmn ng* ng+ - ngmn f-reg! f-and! + ngmn f-reg! f-and! f-test N M X XL g? ng? f-test! f-eof f-not! f-prev f-not f-out f-rev *whitespace* f-nm f-pos)) @@ -28,6 +28,11 @@ (.. c2 (f c)) (<p-cc> (wrap L c2)))) +(define startline + (<pp-lambda> (L c) + (when (= N 0) + (<p-cc> (wrap L c))))) + (define (gt f) (<pp-lambda> (L c) (let ((x #f)) @@ -268,8 +273,21 @@ ((#:?if-rev name yes no) (f-or (f-seq yes (incant-rev name)) no)) - (#:$ f-eof) - (#:^ (f-nm 0 1)) + (#:$ + (f-or! f-eof + (f-and (f-test (lambda (c) + (let ((x (fluid-ref *flags*))) + (not (= 0 (logior x MULTILINE)))))) + f-nl + f-true))) + (#:^ + (f-or! (f-nm 0 1) + (f-and (f-test (lambda (c) + (let ((x (fluid-ref *flags*))) + (not (= 0 (logior x MULTILINE)))))) + startline + f-true))) + ((#:op x #:* ) (g* (compile x) )) ((#:op x #:+ ) (g+ (compile x) )) ((#:op x (#:rep m n)) (gmn (compile x) m n)) |