Report a syntax error on "(?<".
Instead of failing due to NIL not being a character in a call to ALPHA-CHAR-P.
This commit is contained in:
12
lexer.lisp
12
lexer.lisp
@ -672,18 +672,20 @@ closing #\> will also be consumed."
|
|||||||
;; might be a look-behind assertion or a named group, so
|
;; might be a look-behind assertion or a named group, so
|
||||||
;; check next character
|
;; check next character
|
||||||
(let ((next-char (next-char-non-extended lexer)))
|
(let ((next-char (next-char-non-extended lexer)))
|
||||||
(if (alpha-char-p next-char)
|
(cond ((and next-char
|
||||||
(progn
|
(alpha-char-p next-char))
|
||||||
;; we have encountered a named group
|
;; we have encountered a named group
|
||||||
;; are we supporting register naming?
|
;; are we supporting register naming?
|
||||||
(unless *allow-named-registers*
|
(unless *allow-named-registers*
|
||||||
(signal-syntax-error* (1- (lexer-pos lexer))
|
(signal-syntax-error* (1- (lexer-pos lexer))
|
||||||
"Character '~A' may not follow '(?<'."
|
"Character '~A' may not follow '(?<' (because ~a = NIL)"
|
||||||
next-char))
|
next-char
|
||||||
|
'*allow-named-registers*))
|
||||||
;; put the letter back
|
;; put the letter back
|
||||||
(decf (lexer-pos lexer))
|
(decf (lexer-pos lexer))
|
||||||
;; named group
|
;; named group
|
||||||
:open-paren-less-letter)
|
:open-paren-less-letter)
|
||||||
|
(t
|
||||||
(case next-char
|
(case next-char
|
||||||
((#\=)
|
((#\=)
|
||||||
;; positive look-behind
|
;; positive look-behind
|
||||||
@ -702,7 +704,7 @@ closing #\> will also be consumed."
|
|||||||
;; also syntax error
|
;; also syntax error
|
||||||
(signal-syntax-error* (1- (lexer-pos lexer))
|
(signal-syntax-error* (1- (lexer-pos lexer))
|
||||||
"Character '~A' may not follow '(?<'."
|
"Character '~A' may not follow '(?<'."
|
||||||
next-char ))))))
|
next-char )))))))
|
||||||
(otherwise
|
(otherwise
|
||||||
(signal-syntax-error* (1- (lexer-pos lexer))
|
(signal-syntax-error* (1- (lexer-pos lexer))
|
||||||
"Character '~A' may not follow '(?'."
|
"Character '~A' may not follow '(?'."
|
||||||
|
|||||||
Reference in New Issue
Block a user