mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-29 22:40:34 +02:00
Replaced generated elisp parser with hand-written one to fix source properties.
* module/language/elisp/parser.scm: Hand-written parser. * test-suite/tests/elisp-reader.test: Test for source properties.
This commit is contained in:
parent
15eeabfd53
commit
9e90010f07
2 changed files with 112 additions and 48 deletions
|
@ -26,9 +26,6 @@
|
|||
; ==============================================================================
|
||||
; Test the lexer.
|
||||
|
||||
; This is of course somewhat redundant with the full parser checks, but probably
|
||||
; can't hurt and is useful in developing the lexer itself.
|
||||
|
||||
(define (get-string-lexer str)
|
||||
(call-with-input-string str get-lexer))
|
||||
|
||||
|
@ -139,6 +136,17 @@ test\"ab\"\\ abcd
|
|||
(pass-if "only next expression"
|
||||
(equal? (parse-str "1 2 3") 1))
|
||||
|
||||
(pass-if "source properties"
|
||||
(let* ((list1 (parse-str "\n\n (\n(7) (42))"))
|
||||
(list2 (car list1))
|
||||
(list3 (cadr list1)))
|
||||
(and (= (source-property list1 'line) 3)
|
||||
(= (source-property list1 'column) 4)
|
||||
(= (source-property list2 'line) 4)
|
||||
(= (source-property list2 'column) 1)
|
||||
(= (source-property list3 'line) 4)
|
||||
(= (source-property list3 'column) 6))))
|
||||
|
||||
(pass-if "constants"
|
||||
(and (equal? (parse-str "-12") -12)
|
||||
(equal? (parse-str ".123") 0.123)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue