This commit is contained in:
waldemar%netscape.com 2000-08-22 04:29:01 +00:00
Родитель d502901d6a
Коммит b60ff5b98f
8 изменённых файлов: 24 добавлений и 14 удалений

Просмотреть файл

@ -3072,9 +3072,11 @@
(preprocess-grammar-or-lexer preprocessor-state :grammar kind2 name start-symbol))
(defun generate-no-line-break-constraint (terminal)
(defun generate-line-break-constraints (terminal)
(assert-type terminal user-terminal)
(list (list (make-lf-terminal terminal) :no-line-break)))
(list
(list terminal :line-break)
(list (make-lf-terminal terminal) :no-line-break)))
; (line-grammar <name> <kind> <start-symbol>)
@ -3087,8 +3089,8 @@
(defun preprocess-line-grammar (preprocessor-state command name kind2 start-symbol)
(declare (ignore command))
(preprocess-grammar-or-lexer preprocessor-state :grammar kind2 name start-symbol
:variant-constraint-names '(:no-line-break)
:variant-generator #'generate-no-line-break-constraint))
:variant-constraint-names '(:line-break :no-line-break)
:variant-generator #'generate-line-break-constraints))
; (lexer <name> <kind> <start-symbol> <charclasses-source> <lexer-actions-source>)

Просмотреть файл

@ -1225,7 +1225,7 @@
;
; A variant-generator is either nil or a function that takes a terminal and outputs a list of its variants.
; Each variant is specified as a cons of:
; A variant terminal
; A variant terminal (may be eql to the original terminal; this lets one add constraints that exclude the original terminal)
; A list of names of variant constraints which exclude this variant terminal
;
; The rhs can also contain lookahead constraints of the form
@ -1317,8 +1317,9 @@
(dolist (terminal (hash-table-keys terminals-hash))
(dolist (variant-and-constraints (funcall variant-generator terminal))
(let ((variant (first variant-and-constraints)))
(push variant (gethash terminal terminal-variants))
(setf (gethash variant terminals-hash) t)
(unless (grammar-symbol-= terminal variant)
(push variant (gethash terminal terminal-variants))
(setf (gethash variant terminals-hash) t))
(dolist (constraint (rest variant-and-constraints))
(push variant (cdr (assoc constraint variant-constraint-forbid-lists))))))))

Просмотреть файл

@ -487,6 +487,7 @@
((:but-not 6) (b "except"))
((:begin-negative-lookahead 13) "[lookahead" :not-member-10 "{")
((:end-negative-lookahead 2) "}]")
((:line-break 12) "[line" nbsp "break]")
((:no-line-break 15) "[no" nbsp "line" nbsp "break]")
(:subscript sub)
(:superscript sup)

Просмотреть файл

@ -323,6 +323,7 @@
((:but-not 6) (b "except"))
((:begin-negative-lookahead 13) "[lookahead" :not-member-10 "{")
((:end-negative-lookahead 2) "}]")
((:line-break 12) "[line" ~ "break]")
((:no-line-break 15) "[no" ~ "line" ~ "break]")
(:subscript sub)
(:superscript super)

Просмотреть файл

@ -3072,9 +3072,11 @@
(preprocess-grammar-or-lexer preprocessor-state :grammar kind2 name start-symbol))
(defun generate-no-line-break-constraint (terminal)
(defun generate-line-break-constraints (terminal)
(assert-type terminal user-terminal)
(list (list (make-lf-terminal terminal) :no-line-break)))
(list
(list terminal :line-break)
(list (make-lf-terminal terminal) :no-line-break)))
; (line-grammar <name> <kind> <start-symbol>)
@ -3087,8 +3089,8 @@
(defun preprocess-line-grammar (preprocessor-state command name kind2 start-symbol)
(declare (ignore command))
(preprocess-grammar-or-lexer preprocessor-state :grammar kind2 name start-symbol
:variant-constraint-names '(:no-line-break)
:variant-generator #'generate-no-line-break-constraint))
:variant-constraint-names '(:line-break :no-line-break)
:variant-generator #'generate-line-break-constraints))
; (lexer <name> <kind> <start-symbol> <charclasses-source> <lexer-actions-source>)

Просмотреть файл

@ -1225,7 +1225,7 @@
;
; A variant-generator is either nil or a function that takes a terminal and outputs a list of its variants.
; Each variant is specified as a cons of:
; A variant terminal
; A variant terminal (may be eql to the original terminal; this lets one add constraints that exclude the original terminal)
; A list of names of variant constraints which exclude this variant terminal
;
; The rhs can also contain lookahead constraints of the form
@ -1317,8 +1317,9 @@
(dolist (terminal (hash-table-keys terminals-hash))
(dolist (variant-and-constraints (funcall variant-generator terminal))
(let ((variant (first variant-and-constraints)))
(push variant (gethash terminal terminal-variants))
(setf (gethash variant terminals-hash) t)
(unless (grammar-symbol-= terminal variant)
(push variant (gethash terminal terminal-variants))
(setf (gethash variant terminals-hash) t))
(dolist (constraint (rest variant-and-constraints))
(push variant (cdr (assoc constraint variant-constraint-forbid-lists))))))))

Просмотреть файл

@ -487,6 +487,7 @@
((:but-not 6) (b "except"))
((:begin-negative-lookahead 13) "[lookahead" :not-member-10 "{")
((:end-negative-lookahead 2) "}]")
((:line-break 12) "[line" nbsp "break]")
((:no-line-break 15) "[no" nbsp "line" nbsp "break]")
(:subscript sub)
(:superscript sup)

Просмотреть файл

@ -323,6 +323,7 @@
((:but-not 6) (b "except"))
((:begin-negative-lookahead 13) "[lookahead" :not-member-10 "{")
((:end-negative-lookahead 2) "}]")
((:line-break 12) "[line" ~ "break]")
((:no-line-break 15) "[no" ~ "line" ~ "break]")
(:subscript sub)
(:superscript super)