Move inlined definitions before they are used.
Otherwise they do not get a chance to get inlined.
This commit is contained in:
24
lexer.lisp
24
lexer.lisp
@ -56,6 +56,7 @@ their associated character classes."
|
|||||||
((#\S)
|
((#\S)
|
||||||
:non-whitespace-char-class)))
|
:non-whitespace-char-class)))
|
||||||
|
|
||||||
|
(declaim (inline make-lexer-internal))
|
||||||
(defstruct (lexer (:constructor make-lexer-internal))
|
(defstruct (lexer (:constructor make-lexer-internal))
|
||||||
"LEXER structures are used to hold the regex string which is
|
"LEXER structures are used to hold the regex string which is
|
||||||
currently lexed and to keep track of the lexer's state."
|
currently lexed and to keep track of the lexer's state."
|
||||||
@ -66,8 +67,7 @@ currently lexed and to keep track of the lexer's state."
|
|||||||
(last-pos nil :type list))
|
(last-pos nil :type list))
|
||||||
|
|
||||||
(defun make-lexer (string)
|
(defun make-lexer (string)
|
||||||
(declare (inline make-lexer-internal)
|
(declare #-:genera (string string))
|
||||||
#-:genera (string string))
|
|
||||||
(make-lexer-internal :str (maybe-coerce-to-simple-string string)
|
(make-lexer-internal :str (maybe-coerce-to-simple-string string)
|
||||||
:len (length string)))
|
:len (length string)))
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ we're inside a range or not."
|
|||||||
(when (looking-at-p lexer #\-)
|
(when (looking-at-p lexer #\-)
|
||||||
(push #\- list)
|
(push #\- list)
|
||||||
(incf (lexer-pos lexer)))
|
(incf (lexer-pos lexer)))
|
||||||
(setq hyphen-seen nil))))
|
(setq hyphen-seen nil))))
|
||||||
((#\E)
|
((#\E)
|
||||||
;; if \Q quoting is on we ignore \E,
|
;; if \Q quoting is on we ignore \E,
|
||||||
;; otherwise it's just a plain #\E
|
;; otherwise it's just a plain #\E
|
||||||
@ -497,6 +497,15 @@ closing #\> will also be consumed."
|
|||||||
(setf (lexer-pos lexer) (1+ end-name))
|
(setf (lexer-pos lexer) (1+ end-name))
|
||||||
name)))
|
name)))
|
||||||
|
|
||||||
|
(declaim (inline unget-token))
|
||||||
|
(defun unget-token (lexer)
|
||||||
|
(declare #.*standard-optimize-settings*)
|
||||||
|
"Moves the lexer back to the last position stored in the LAST-POS stack."
|
||||||
|
(if (lexer-last-pos lexer)
|
||||||
|
(setf (lexer-pos lexer)
|
||||||
|
(pop (lexer-last-pos lexer)))
|
||||||
|
(error "No token to unget \(this should not happen)")))
|
||||||
|
|
||||||
(defun get-token (lexer)
|
(defun get-token (lexer)
|
||||||
(declare #.*standard-optimize-settings*)
|
(declare #.*standard-optimize-settings*)
|
||||||
"Returns and consumes the next token from the regex string \(or NIL)."
|
"Returns and consumes the next token from the regex string \(or NIL)."
|
||||||
@ -712,15 +721,6 @@ closing #\> will also be consumed."
|
|||||||
(pop (lexer-last-pos lexer))
|
(pop (lexer-last-pos lexer))
|
||||||
nil))))
|
nil))))
|
||||||
|
|
||||||
(declaim (inline unget-token))
|
|
||||||
(defun unget-token (lexer)
|
|
||||||
(declare #.*standard-optimize-settings*)
|
|
||||||
"Moves the lexer back to the last position stored in the LAST-POS stack."
|
|
||||||
(if (lexer-last-pos lexer)
|
|
||||||
(setf (lexer-pos lexer)
|
|
||||||
(pop (lexer-last-pos lexer)))
|
|
||||||
(error "No token to unget \(this should not happen)")))
|
|
||||||
|
|
||||||
(declaim (inline start-of-subexpr-p))
|
(declaim (inline start-of-subexpr-p))
|
||||||
(defun start-of-subexpr-p (lexer)
|
(defun start-of-subexpr-p (lexer)
|
||||||
(declare #.*standard-optimize-settings*)
|
(declare #.*standard-optimize-settings*)
|
||||||
|
|||||||
Reference in New Issue
Block a user