Fix more iri issues

Julien LepillerThu Apr 02 04:26:31+0200 2020

c1e388b

Fix more iri issues

turtle/parser.scm

105105
(define-peg-pattern pn-prefix body
106106
  (and pn-chars-base (* (and (* ".") pn-chars))))
107107
;; [168s] 	PN_LOCAL 	::= 	(PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
108-
(define-peg-pattern pn-local body
108+
(define-peg-pattern pn-local all
109109
  (and (or pn-chars-u ":" (range #\0 #\9) plx)
110110
       (* (and (* ".") (or pn-chars ":" plx)))))
111111
;; [169s] 	PLX 	::= 	PERCENT | PN_LOCAL_ESC

turtle/tordf.scm

8484
    (() "")))
8585
8686
(define (parse-iri iri state)
87+
  (pk 'iri iri)
8788
  (match iri
88-
    (('iri ('prefixed-name ('pname-ln ('pname-ns ns) suffix)))
89+
    (('iri ('prefixed-name ('pname-ln ('pname-ns ns) ('pn-local suffix))))
8990
     `(("iri" . ,(string-append (assoc-ref (parser-state-namespaces state) ns)
90-
                               suffix))
91-
       ("state" . ,state)))
92-
    (('iri ('prefixed-name ('pname-ln ('pname-ns suffix))))
93-
     `(("iri" . ,(string-append (assoc-ref (parser-state-namespaces state) "")
9491
                                suffix))
9592
       ("state" . ,state)))
96-
    (('iri ('prefixed-name ('pname-ns suffix)))
93+
    (('iri ('prefixed-name ('pname-ln ('pname-ns ('pn-local suffix)))))
9794
     `(("iri" . ,(string-append (assoc-ref (parser-state-namespaces state) "")
9895
                                suffix))
9996
       ("state" . ,state)))
97+
    (('iri ('prefixed-name ('pname-ns ns)))
98+
     `(("iri" . ,(assoc-ref (parser-state-namespaces state) ns))
99+
       ("state" . ,state)))
100100
    (('iri ('prefixed-name 'pname-ns))
101101
     `(("iri" . ,(assoc-ref (parser-state-namespaces state) ""))
102102
       ("state" . ,state)))