diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-05-22 12:21:23 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-05-22 12:21:23 -0400 |
commit | 3294ad44ebcd024b4ada68d00bedca33acc52de6 (patch) | |
tree | cbed468afa2ab2ed15f8a587b8f3b1f584dda2d8 /lisp/cedet/semantic/wisent.el | |
parent | a1a6e6c5c44e0930784de67fc6b25c3cc43e0ee4 (diff) | |
download | emacs-3294ad44ebcd024b4ada68d00bedca33acc52de6.tar.gz |
wisent.el: Prefer `define-mode-local-override`
* lisp/cedet/semantic/wisent.el (wisent--parse-stream): Rename from
`wisent-parse-stream` and mark the old name obsolete.
(semantic-parse-stream): Override with `define-mode-local-override`.
* lisp/cedet/semantic/wisent/grammar.el
(semantic-grammar-setupcode-builder): Don't override
`semantic-parse-stream` manually here via
`semantic-install-function-overrides`.
* lisp/cedet/semantic/grm-wy-boot.el: Refresh.
Diffstat (limited to 'lisp/cedet/semantic/wisent.el')
-rw-r--r-- | lisp/cedet/semantic/wisent.el | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lisp/cedet/semantic/wisent.el b/lisp/cedet/semantic/wisent.el index 55eeef453ea..d06028b48f7 100644 --- a/lisp/cedet/semantic/wisent.el +++ b/lisp/cedet/semantic/wisent.el @@ -154,17 +154,25 @@ and will be collected in `semantic-lex' form: (SYMBOL START . END)." ;; Maybe the latter is faster because it eliminates a lot of function ;; call. ;; -(defun wisent-parse-stream (stream goal) +;; Emacs<29 generated grammars which manually setup `wisent-parse-stream' +;; as a buffer-local overload for `semantic-parse-stream', but we don't +;; need that now that we define a mode-local overload instead. +(define-obsolete-function-alias 'wisent-parse-stream + #'wisent--parse-stream "29.1" + "Recompile your grammars so they don't call `wisent-parse-stream' any more.") +(define-mode-local-override semantic-parse-stream semantic-grammar-mode + (stream goal) + "Parse STREAM using the Wisent LALR parser. +See `wisent--parse-stream'." + (wisent--parse-stream stream goal)) +(defun wisent--parse-stream (stream goal) "Parse STREAM using the Wisent LALR parser. GOAL is a nonterminal symbol to start parsing at. Return the list (STREAM SEMANTIC-STREAM) where STREAM are those elements of STREAM that have not been used. SEMANTIC-STREAM is the list of semantic tags found. The LALR parser automaton must be available in buffer local variable -`semantic--parse-table'. - -Must be installed by `semantic-install-function-overrides' to override -the standard function `semantic-parse-stream'." +`semantic--parse-table'." (let (wisent-lex-istream wisent-lex-lookahead la-elt cache) ;; IMPLEMENTATION NOTES: @@ -267,10 +275,7 @@ Optional arguments GOAL is a nonterminal symbol to start parsing at, DEPTH is the lexical depth to scan, and RETURNONERROR is a flag to stop parsing on syntax error, when non-nil. The LALR parser automaton must be available in buffer local variable -`semantic--parse-table'. - -Must be installed by `semantic-install-function-overrides' to override -the standard function `semantic-parse-region'." +`semantic--parse-table'." (if (or (< start (point-min)) (> end (point-max)) (< end start)) (error "Invalid bounds [%s %s] passed to `wisent-parse-region'" start end)) |