summaryrefslogtreecommitdiff
path: root/lisp/cedet/semantic/wisent.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/cedet/semantic/wisent.el')
-rw-r--r--lisp/cedet/semantic/wisent.el33
1 files changed, 15 insertions, 18 deletions
diff --git a/lisp/cedet/semantic/wisent.el b/lisp/cedet/semantic/wisent.el
index d5b73244a08..f5f381d4079 100644
--- a/lisp/cedet/semantic/wisent.el
+++ b/lisp/cedet/semantic/wisent.el
@@ -1,4 +1,4 @@
-;;; semantic/wisent.el --- Wisent - Semantic gateway
+;;; semantic/wisent.el --- Wisent - Semantic gateway -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2007, 2009-2021 Free Software Foundation, Inc.
@@ -22,13 +22,10 @@
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
-;;
+
;; Here are functions necessary to use the Wisent LALR parser from
;; Semantic environment.
-;;; History:
-;;
-
;;; Code:
(require 'semantic)
@@ -69,6 +66,7 @@ Returned tokens must have the form:
(TOKSYM VALUE START . END)
where VALUE is the buffer substring between START and END positions."
+ (declare (debug (&define name stringp def-body)))
`(defun
,name () ,doc
(cond
@@ -223,7 +221,7 @@ the standard function `semantic-parse-stream'."
(error-message-string error-to-filter))
(message "wisent-parse-max-stack-size \
might need to be increased"))
- (apply 'signal error-to-filter))))))
+ (apply #'signal error-to-filter))))))
;; Manage returned lookahead token
(if wisent-lookahead
(if (eq (caar la-elt) wisent-lookahead)
@@ -251,6 +249,17 @@ might need to be increased"))
(if (consp cache) cache '(nil))
)))
+(defmacro wisent-compiled-grammar (grammar &optional start-list)
+ "Return a compiled form of the LALR(1) Wisent GRAMMAR.
+See `wisent--compile-grammar' for a description of the arguments
+and return value."
+ ;; Ensure that the grammar compiler is available.
+ (require 'semantic/wisent/comp)
+ (declare-function wisent-automaton-lisp-form "semantic/wisent/comp" (x))
+ (declare-function wisent--compile-grammar "semantic/wisent/comp" (grm st))
+ (wisent-automaton-lisp-form
+ (wisent--compile-grammar grammar start-list)))
+
(defun wisent-parse-region (start end &optional goal depth returnonerror)
"Parse the area between START and END using the Wisent LALR parser.
Return the list of semantic tags found.
@@ -319,18 +328,6 @@ the standard function `semantic-parse-region'."
(point-max))))))
;; Return parse tree
(nreverse ptree)))
-
-;;; Interfacing with edebug
-;;
-(add-hook
- 'edebug-setup-hook
- #'(lambda ()
-
- (def-edebug-spec define-wisent-lexer
- (&define name stringp def-body)
- )
-
- ))
(provide 'semantic/wisent)