diff options
author | Stefan Israelsson Tampe <stefan.itampe@gmail.com> | 2014-05-29 09:59:23 +0200 |
---|---|---|
committer | Stefan Israelsson Tampe <stefan.itampe@gmail.com> | 2014-05-29 09:59:23 +0200 |
commit | 3335017bcd987fcf30a1d07d6634bafeff7a09db (patch) | |
tree | 65eb7d35095d0b685f3682cdb590aa71ddbc5301 /modules | |
parent | c20552c79bca1d31dd7e815ad7ae2533e159b9a3 (diff) |
adapted to changed interface of parser
Diffstat (limited to 'modules')
-rw-r--r-- | modules/language/python/parser-tool.scm | 6 | ||||
-rw-r--r-- | modules/language/python/parser.scm | 19 |
2 files changed, 11 insertions, 14 deletions
diff --git a/modules/language/python/parser-tool.scm b/modules/language/python/parser-tool.scm index ec7b504..754917f 100644 --- a/modules/language/python/parser-tool.scm +++ b/modules/language/python/parser-tool.scm @@ -42,7 +42,5 @@ ;; Sets up a standar parser functionals with INDENT field added (setup-parser <p-define> <p-lambda> <fail> <p-cc> <succeds> .. xx - X XL N M (0 0 0) - s-false s-true s-mk-seq s-mk-and s-mk-or - s-seq s-and s-and! s-and!! s-or - pp)) + X XL ((N 0) (M 0) (INDENT 0)) + s-false s-true s-mk-seq s-mk-and s-mk-or)) diff --git a/modules/language/python/parser.scm b/modules/language/python/parser.scm index 639955e..9ea1d4f 100644 --- a/modules/language/python/parser.scm +++ b/modules/language/python/parser.scm @@ -49,9 +49,8 @@ (<p-lambda> (c) (cond ((> i n) - (<let> ((Inew (cons i INDENT))) - (<syntax-parameterize> ((INDENT (lambda x #'Inew))) - (<p-cc> c)))) + (<with-bind> ((INDENT (cons i INDENT))) + (<p-cc> c))) ((< i n) (<or> (<and> @@ -70,10 +69,9 @@ (define indent= wn) (define indent+ wn+) (define indent- - (<p-lambda> (c) - (<let> ((i (cdr INDENT))) - (<syntax-parameterize> ((INDENT (lambda x #'i))) - (<p-cc> c))))) + (<p-lambda> (c) + (<with-bind> ((INDENT (cdr INDENT))) + (<p-cc> c)))) (define ih (f-reg! "a-zA-Z_")) @@ -329,6 +327,7 @@ (define decorators (ff+ decorator)) + (define decorated (f-list #:decorated decorators (f-or classdef funcdef))) @@ -480,9 +479,9 @@ (f-or! if_stmt while_stmt for_stmt try_stmt with_stmt funcdef classdef decorated)) -(define single_input (f-or (f-seq (f-pk 0) nl) - (f-seq (f-pk 1) indent= simple_stmt) - (f-seq (f-pk 2) indent= compound_stmt nl))) +(define single_input (f-or! (f-seq (f-pk 1) indent= simple_stmt) + (f-seq (f-pk 2) indent= compound_stmt nl) + (f-seq (f-pk 0) nl))) (set! stmt (f-or simple_stmt compound_stmt)) |