diff options
author | Andrea Corallo <akrl@sdf.org> | 2021-03-09 10:03:47 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2021-03-09 10:03:47 +0100 |
commit | 43b0df62cd5922df5495b3f4aee5b7beca14384f (patch) | |
tree | 3c0bfa9526d08c9c85e646cd355467e3dfb439ac /lisp/cedet/semantic | |
parent | 380ba045c48bfbb160da288b1bd50f82d3f999f0 (diff) | |
parent | 9cbdf20316e1cec835a7dfe28877142e437976f4 (diff) | |
download | emacs-43b0df62cd5922df5495b3f4aee5b7beca14384f.tar.gz emacs-43b0df62cd5922df5495b3f4aee5b7beca14384f.tar.bz2 emacs-43b0df62cd5922df5495b3f4aee5b7beca14384f.zip |
Merge commit '9cbdf20316' into native-comp
Diffstat (limited to 'lisp/cedet/semantic')
-rw-r--r-- | lisp/cedet/semantic/analyze.el | 32 | ||||
-rw-r--r-- | lisp/cedet/semantic/analyze/complete.el | 16 | ||||
-rw-r--r-- | lisp/cedet/semantic/analyze/debug.el | 8 | ||||
-rw-r--r-- | lisp/cedet/semantic/analyze/fcn.el | 4 | ||||
-rw-r--r-- | lisp/cedet/semantic/analyze/refs.el | 4 | ||||
-rw-r--r-- | lisp/cedet/semantic/bovine.el | 5 | ||||
-rw-r--r-- | lisp/cedet/semantic/bovine/grammar.el | 8 | ||||
-rw-r--r-- | lisp/cedet/semantic/db-file.el | 29 | ||||
-rw-r--r-- | lisp/cedet/semantic/ede-grammar.el | 6 | ||||
-rw-r--r-- | lisp/cedet/semantic/edit.el | 3 | ||||
-rw-r--r-- | lisp/cedet/semantic/grammar-wy.el | 424 | ||||
-rw-r--r-- | lisp/cedet/semantic/idle.el | 58 | ||||
-rw-r--r-- | lisp/cedet/semantic/tag.el | 44 | ||||
-rw-r--r-- | lisp/cedet/semantic/wisent/grammar.el | 7 |
14 files changed, 309 insertions, 339 deletions
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el index c0a054dafc3..1a4be11c789 100644 --- a/lisp/cedet/semantic/analyze.el +++ b/lisp/cedet/semantic/analyze.el @@ -1,4 +1,4 @@ -;;; semantic/analyze.el --- Analyze semantic tags against local context +;;; semantic/analyze.el --- Analyze semantic tags against local context -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2005, 2007-2021 Free Software Foundation, Inc. @@ -167,7 +167,7 @@ of the parent function.") ;; Simple methods against the context classes. ;; (cl-defmethod semantic-analyze-type-constraint - ((context semantic-analyze-context) &optional desired-type) + ((_context semantic-analyze-context) &optional desired-type) "Return a type constraint for completing :prefix in CONTEXT. Optional argument DESIRED-TYPE may be a non-type tag to analyze." (when (semantic-tag-p desired-type) @@ -344,8 +344,8 @@ This function knows of flags: (setq tagtype (cons tmptype tagtype)) (when miniscope (let ((rawscope - (apply 'append - (mapcar 'semantic-tag-type-members tagtype)))) + (apply #'append + (mapcar #'semantic-tag-type-members tagtype)))) (oset miniscope fullscope rawscope))) ) (setq s (cdr s))) @@ -437,6 +437,8 @@ to provide a large number of non-cached analysis for filtering symbols." (:override))) ) +(defvar semantic--prefixtypes) + (defun semantic-analyze-current-symbol-default (analyzehookfcn position) "Call ANALYZEHOOKFCN on the analyzed symbol at POSITION." (let* ((semantic-analyze-error-stack nil) @@ -453,14 +455,14 @@ to provide a large number of non-cached analysis for filtering symbols." (catch 'unfindable ;; If debug on error is on, allow debugging in this fcn. (setq prefix (semantic-analyze-find-tag-sequence - prefix scope 'prefixtypes 'unfindable))) + prefix scope 'semantic--prefixtypes 'unfindable))) ;; Debug on error is off. Capture errors and move on (condition-case err ;; NOTE: This line is duplicated in ;; semantic-analyzer-debug-global-symbol ;; You will need to update both places. (setq prefix (semantic-analyze-find-tag-sequence - prefix scope 'prefixtypes)) + prefix scope 'semantic--prefixtypes)) (error (semantic-analyze-push-error err)))) ;;(message "Analysis took %.2f sec" (semantic-elapsed-time LLstart nil)) @@ -531,7 +533,7 @@ Returns an object based on symbol `semantic-analyze-context'." (bounds (nth 2 prefixandbounds)) ;; @todo - vv too early to really know this answer! vv (prefixclass (semantic-ctxt-current-class-list)) - (prefixtypes nil) + (semantic--prefixtypes nil) (scope (semantic-calculate-scope position)) (function nil) (fntag nil) @@ -611,13 +613,13 @@ Returns an object based on symbol `semantic-analyze-context'." (if debug-on-error (catch 'unfindable (setq prefix (semantic-analyze-find-tag-sequence - prefix scope 'prefixtypes 'unfindable)) + prefix scope 'semantic--prefixtypes 'unfindable)) ;; If there's an alias, dereference it and analyze ;; sequence again. (when (setq newseq (semantic-analyze-dereference-alias prefix)) (setq prefix (semantic-analyze-find-tag-sequence - newseq scope 'prefixtypes 'unfindable)))) + newseq scope 'semantic--prefixtypes 'unfindable)))) ;; Debug on error is off. Capture errors and move on (condition-case err ;; NOTE: This line is duplicated in @@ -625,11 +627,11 @@ Returns an object based on symbol `semantic-analyze-context'." ;; You will need to update both places. (progn (setq prefix (semantic-analyze-find-tag-sequence - prefix scope 'prefixtypes)) + prefix scope 'semantic--prefixtypes)) (when (setq newseq (semantic-analyze-dereference-alias prefix)) (setq prefix (semantic-analyze-find-tag-sequence - newseq scope 'prefixtypes)))) + newseq scope 'semantic--prefixtypes)))) (error (semantic-analyze-push-error err)))) ) @@ -650,7 +652,7 @@ Returns an object based on symbol `semantic-analyze-context'." :prefix prefix :prefixclass prefixclass :bounds bounds - :prefixtypes prefixtypes + :prefixtypes semantic--prefixtypes :errors semantic-analyze-error-stack))) ;; No function, try assignment @@ -670,7 +672,7 @@ Returns an object based on symbol `semantic-analyze-context'." :bounds bounds :prefix prefix :prefixclass prefixclass - :prefixtypes prefixtypes + :prefixtypes semantic--prefixtypes :errors semantic-analyze-error-stack))) ;; TODO: Identify return value condition. @@ -686,7 +688,7 @@ Returns an object based on symbol `semantic-analyze-context'." :bounds bounds :prefix prefix :prefixclass prefixclass - :prefixtypes prefixtypes + :prefixtypes semantic--prefixtypes :errors semantic-analyze-error-stack))) (t (setq context-return nil)) @@ -750,7 +752,7 @@ Some useful functions are found in `semantic-format-tag-functions'." :group 'semantic :type semantic-format-tag-custom-list) -(defun semantic-analyze-princ-sequence (sequence &optional prefix buff) +(defun semantic-analyze-princ-sequence (sequence &optional prefix _buff) "Send the tag SEQUENCE to standard out. Use PREFIX as a label. Use BUFF as a source of override methods." diff --git a/lisp/cedet/semantic/analyze/complete.el b/lisp/cedet/semantic/analyze/complete.el index e8139ab1aea..ccf405d62e2 100644 --- a/lisp/cedet/semantic/analyze/complete.el +++ b/lisp/cedet/semantic/analyze/complete.el @@ -1,4 +1,4 @@ -;;; semantic/analyze/complete.el --- Smart Completions +;;; semantic/analyze/complete.el --- Smart Completions -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -45,7 +45,7 @@ "For the tag TYPE, return any constant symbols of TYPE. Used as options when completing.") -(defun semantic-analyze-type-constants-default (type) +(defun semantic-analyze-type-constants-default (_type) "Do nothing with TYPE." nil) @@ -54,7 +54,7 @@ Used as options when completing.") (let ((origc tags)) ;; Accept only tags that are of the datatype specified by ;; the desired classes. - (setq tags (apply 'nconc ;; All input lists are permutable. + (setq tags (apply #'nconc ;; All input lists are permutable. (mapcar (lambda (class) (semantic-find-tags-by-class class origc)) classlist))) @@ -109,6 +109,8 @@ in a buffer." (when (called-interactively-p 'any) (error "Buffer was not parsed by Semantic.")))) +(defvar semantic--prefixtypes) + (defun semantic-analyze-possible-completions-default (context &optional flags) "Default method for producing smart completions. Argument CONTEXT is an object specifying the locally derived context. @@ -121,14 +123,14 @@ FLAGS can be any number of: (desired-type (semantic-analyze-type-constraint a)) (desired-class (oref a prefixclass)) (prefix (oref a prefix)) - (prefixtypes (oref a prefixtypes)) + (semantic--prefixtypes (oref a prefixtypes)) (completetext nil) (completetexttype nil) (scope (oref a scope)) (localvar (when scope (oref scope localvar))) (origc nil) (c nil) - (any nil) + ;; (any nil) (do-typeconstraint (not (memq 'no-tc flags))) (do-longprefix (not (memq 'no-longprefix flags))) (do-unique (not (memq 'no-unique flags))) @@ -138,7 +140,7 @@ FLAGS can be any number of: ;; If we are not doing the long prefix, shorten all the key ;; elements. (setq prefix (list (car (reverse prefix))) - prefixtypes nil)) + semantic--prefixtypes nil)) ;; Calculate what our prefix string is so that we can ;; find all our matching text. @@ -155,7 +157,7 @@ FLAGS can be any number of: ;; The prefixtypes should always be at least 1 less than ;; the prefix since the type is never looked up for the last ;; item when calculating a sequence. - (setq completetexttype (car (reverse prefixtypes))) + (setq completetexttype (car (reverse semantic--prefixtypes))) (when (or (not completetexttype) (not (and (semantic-tag-p completetexttype) (eq (semantic-tag-class completetexttype) 'type)))) diff --git a/lisp/cedet/semantic/analyze/debug.el b/lisp/cedet/semantic/analyze/debug.el index 4947368757e..58d6644f9a9 100644 --- a/lisp/cedet/semantic/analyze/debug.el +++ b/lisp/cedet/semantic/analyze/debug.el @@ -1,4 +1,4 @@ -;;; semantic/analyze/debug.el --- Debug the analyzer +;;; semantic/analyze/debug.el --- Debug the analyzer -*- lexical-binding: t; -*- ;;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -109,11 +109,11 @@ Argument COMP are possible completions here." (condition-case err (with-current-buffer origbuf (let* ((position (or (cdr-safe (oref ctxt bounds)) (point))) - (prefixtypes nil) ; Used as type return + ;; (semantic--prefixtypes nil) ; Used as type return (scope (semantic-calculate-scope position)) ) (semantic-analyze-find-tag-sequence - (list prefix "") scope 'prefixtypes) + (list prefix "") scope) ;; 'semantic--prefixtypes ) ) (error (setq finderr err))) @@ -149,7 +149,7 @@ path was setup incorrectly.\n") (semantic-analyzer-debug-add-buttons) )) -(defun semantic-analyzer-debug-missing-datatype (ctxt idx comp) +(defun semantic-analyzer-debug-missing-datatype (ctxt idx _comp) "Debug why we can't find a datatype entry for CTXT prefix at IDX. Argument COMP are possible completions here." (let* ((prefixitem (nth idx (oref ctxt prefix))) diff --git a/lisp/cedet/semantic/analyze/fcn.el b/lisp/cedet/semantic/analyze/fcn.el index 10d11c33ebb..d47e8976e58 100644 --- a/lisp/cedet/semantic/analyze/fcn.el +++ b/lisp/cedet/semantic/analyze/fcn.el @@ -1,4 +1,4 @@ -;;; semantic/analyze/fcn.el --- Analyzer support functions. +;;; semantic/analyze/fcn.el --- Analyzer support functions. -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -55,7 +55,7 @@ Return the string representing the compound name.") (defun semantic-analyze-unsplit-name-default (namelist) "Concatenate the names in NAMELIST with a . between." - (mapconcat 'identity namelist ".")) + (mapconcat #'identity namelist ".")) ;;; SELECTING ;; diff --git a/lisp/cedet/semantic/analyze/refs.el b/lisp/cedet/semantic/analyze/refs.el index a39ff6f6736..31cbb9e1173 100644 --- a/lisp/cedet/semantic/analyze/refs.el +++ b/lisp/cedet/semantic/analyze/refs.el @@ -1,4 +1,4 @@ -;;; semantic/analyze/refs.el --- Analysis of the references between tags. +;;; semantic/analyze/refs.el --- Analysis of the references between tags. -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -296,7 +296,7 @@ Only works for tags in the global namespace." (let* ((classmatch (semantic-tag-class tag)) (RES (semanticdb-find-tags-collector - (lambda (table tags) + (lambda (_table tags) (semantic-find-tags-by-class classmatch tags) ;; @todo - Add parent check also. ) diff --git a/lisp/cedet/semantic/bovine.el b/lisp/cedet/semantic/bovine.el index 3bc0e4dd618..b585e387fed 100644 --- a/lisp/cedet/semantic/bovine.el +++ b/lisp/cedet/semantic/bovine.el @@ -1,4 +1,4 @@ -;;; semantic/bovine.el --- LL Parser/Analyzer core. +;;; semantic/bovine.el --- LL Parser/Analyzer core -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2004, 2006-2007, 2009-2021 Free Software ;; Foundation, Inc. @@ -54,6 +54,7 @@ Use this to detect infinite recursion during a parse.") "Create a lambda expression to return a list including RETURN-VAL. The return list is a lambda expression to be used in a bovine table." `(lambda (vals start end) + (ignore vals) (append ,@return-val (list start end)))) ;;; Semantic Bovination @@ -283,7 +284,7 @@ list of semantic tokens found." ;; Make it the default parser ;;;###autoload -(defalias 'semantic-parse-stream-default 'semantic-bovinate-stream) +(defalias 'semantic-parse-stream-default #'semantic-bovinate-stream) (provide 'semantic/bovine) diff --git a/lisp/cedet/semantic/bovine/grammar.el b/lisp/cedet/semantic/bovine/grammar.el index 4914ec9b124..e3df7b12ab6 100644 --- a/lisp/cedet/semantic/bovine/grammar.el +++ b/lisp/cedet/semantic/bovine/grammar.el @@ -1,4 +1,4 @@ -;;; semantic/bovine/grammar.el --- Bovine's input grammar mode +;;; semantic/bovine/grammar.el --- Bovine's input grammar mode -*- lexical-binding: t; -*- ;; ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. ;; @@ -243,7 +243,8 @@ QUOTEMODE is the mode in which quoted symbols are slurred." (insert "\n") (cond ((eq (car sexp) 'EXPAND) - (insert ",(lambda (vals start end)") + (insert ",(lambda (vals start end)" + "\n(ignore vals start end)") ;; The EXPAND macro definition is mandatory (bovine-grammar-expand-form (apply (cdr (assq 'EXPAND bovine--grammar-macros)) (cdr sexp)) @@ -520,7 +521,8 @@ Menu items are appended to the common grammar menu.") (goto-char (point-min)) (delete-region (point-min) (line-end-position)) (insert ";;; " packagename - " --- Generated parser support file") + " --- Generated parser support file " + "-*- lexical-binding:t -*-") (delete-trailing-whitespace) (re-search-forward ";;; \\(.*\\) ends here") (replace-match packagename nil nil nil 1))))) diff --git a/lisp/cedet/semantic/db-file.el b/lisp/cedet/semantic/db-file.el index 59e9db9cc0a..d99b94f49eb 100644 --- a/lisp/cedet/semantic/db-file.el +++ b/lisp/cedet/semantic/db-file.el @@ -154,8 +154,6 @@ If DIRECTORY doesn't exist, create a new one." ;;; File IO -(declare-function inversion-test "inversion") - (defun semanticdb-load-database (filename) "Load the database FILENAME." (condition-case foo @@ -163,32 +161,19 @@ If DIRECTORY doesn't exist, create a new one." 'semanticdb-project-database-file)) (c (semanticdb-get-database-tables r)) (tv (oref r semantic-tag-version)) - (fv (oref r semanticdb-version)) - ) + (fv (oref r semanticdb-version))) ;; Restore the parent-db connection (while c (oset (car c) parent-db r) (setq c (cdr c))) (unless (and (equal semanticdb-file-version fv) (equal semantic-tag-version tv)) - ;; Try not to load inversion unless we need it: - (require 'inversion) - (if (not (inversion-test 'semanticdb-file fv)) - (when (inversion-test 'semantic-tag tv) - ;; Incompatible version. Flush tables. - (semanticdb-flush-database-tables r) - ;; Reset the version to new version. - (oset r semantic-tag-version semantic-tag-version) - ;; Warn user - (message "Semanticdb file is old. Starting over for %s" - filename)) - ;; Version is not ok. Flush whole system - (message "semanticdb file is old. Starting over for %s" - filename) - ;; This database is so old, we need to replace it. - ;; We also need to delete it from the instance tracker. - (delete-instance r) - (setq r nil))) + ;; Version is not ok. Flush whole system + (message "semanticdb file is old. Starting over for %s" filename) + ;; This database is so old, we need to replace it. + ;; We also need to delete it from the instance tracker. + (delete-instance r) + (setq r nil)) r) (error (message "Cache Error: [%s] %s, Restart" filename foo) diff --git a/lisp/cedet/semantic/ede-grammar.el b/lisp/cedet/semantic/ede-grammar.el index bd0795acbd6..64fc07fe1bb 100644 --- a/lisp/cedet/semantic/ede-grammar.el +++ b/lisp/cedet/semantic/ede-grammar.el @@ -162,10 +162,9 @@ Lays claim to all -by.el, and -wy.el files." "Insert variables needed by target THIS." (ede-proj-makefile-insert-loadpath-items (ede-proj-elisp-packages-to-loadpath - (list "eieio" "semantic" "inversion" "ede"))) + (list "eieio" "semantic" "ede"))) ;; eieio for object system needed in ede ;; semantic because it is - ;; Inversion for versioning system. ;; ede for project regeneration (ede-pmake-insert-variable-shared (concat (ede-pmake-varname this) "_SEMANTIC_GRAMMAR_EL") @@ -174,8 +173,7 @@ Lays claim to all -by.el, and -wy.el files." (with-current-buffer (find-file-noselect src) (concat (semantic-grammar-package) ".el"))) (oref this source) - " "))) - ) + " ")))) (cl-defmethod ede-proj-makefile-insert-rules :after ((this semantic-ede-proj-target-grammar)) "Insert rules needed by THIS target. diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el index f39cc093cc9..4594d7f6969 100644 --- a/lisp/cedet/semantic/edit.el +++ b/lisp/cedet/semantic/edit.el @@ -828,8 +828,7 @@ This function is for internal use by `semantic-edits-incremental-parser'." ;; Make it the default changes parser ;;;###autoload -(defalias 'semantic-parse-changes-default - 'semantic-edits-incremental-parser) +(defalias 'semantic-parse-changes-default #'semantic-edits-incremental-parser) ;;; Cache Splicing ;; diff --git a/lisp/cedet/semantic/grammar-wy.el b/lisp/cedet/semantic/grammar-wy.el index 12c9c047fc5..9a7f393072f 100644 --- a/lisp/cedet/semantic/grammar-wy.el +++ b/lisp/cedet/semantic/grammar-wy.el @@ -1,6 +1,6 @@ -;;; semantic/grammar-wy.el --- Generated parser support file +;;; semantic/grammar-wy.el --- Generated parser support file -*- lexical-binding:t -*- -;; Copyright (C) 2002-2004, 2009-2021 Free Software Foundation, Inc. +;; Copyright (C) 2002-2021 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -23,8 +23,9 @@ ;;; Code: -(require 'semantic) - +(require 'semantic/lex) +(eval-when-compile (require 'semantic/bovine)) + ;;; Prologue ;; (defvar semantic-grammar-lex-c-char-re) @@ -36,16 +37,20 @@ ;;; Declarations ;; +(eval-and-compile (defconst semantic-grammar-wy--expected-conflicts + nil + "The number of expected shift/reduce conflicts in this grammar.")) + (defconst semantic-grammar-wy--keyword-table (semantic-lex-make-keyword-table '(("%default-prec" . DEFAULT-PREC) ("%no-default-prec" . NO-DEFAULT-PREC) ("%keyword" . KEYWORD) - ("%expectedconflicts" . EXPECTEDCONFLICTS) ("%languagemode" . LANGUAGEMODE) ("%left" . LEFT) ("%nonassoc" . NONASSOC) ("%package" . PACKAGE) + ("%expectedconflicts" . EXPECTEDCONFLICTS) ("%provide" . PROVIDE) ("%prec" . PREC) ("%put" . PUT) @@ -111,239 +116,239 @@ (eval-when-compile (require 'semantic/wisent/comp)) (wisent-compile-grammar - '((DEFAULT-PREC NO-DEFAULT-PREC KEYWORD LANGUAGEMODE EXPECTEDCONFLICTS LEFT NONASSOC PACKAGE PROVIDE PREC PUT QUOTEMODE RIGHT SCOPESTART START TOKEN TYPE USE-MACROS STRING SYMBOL PERCENT_PERCENT CHARACTER PREFIXED_LIST SEXP PROLOGUE EPILOGUE PAREN_BLOCK BRACE_BLOCK LPAREN RPAREN LBRACE RBRACE COLON SEMI OR LT GT) + '((DEFAULT-PREC NO-DEFAULT-PREC KEYWORD LANGUAGEMODE LEFT NONASSOC PACKAGE EXPECTEDCONFLICTS PROVIDE PREC PUT QUOTEMODE RIGHT SCOPESTART START TOKEN TYPE USE-MACROS STRING SYMBOL PERCENT_PERCENT CHARACTER PREFIXED_LIST SEXP PROLOGUE EPILOGUE PAREN_BLOCK BRACE_BLOCK LPAREN RPAREN LBRACE RBRACE COLON SEMI OR LT GT) nil (grammar - ((prologue)) - ((epilogue)) - ((declaration)) - ((nonterminal)) - ((PERCENT_PERCENT))) + ((prologue)) + ((epilogue)) + ((declaration)) + ((nonterminal)) + ((PERCENT_PERCENT))) (prologue - ((PROLOGUE) - (wisent-raw-tag + ((PROLOGUE) + (wisent-raw-tag (semantic-tag-new-code "prologue" nil)))) (epilogue - ((EPILOGUE) - (wisent-raw-tag + ((EPILOGUE) + (wisent-raw-tag (semantic-tag-new-code "epilogue" nil)))) (declaration - ((decl) - (eval $1))) + ((decl) + (eval $1))) (decl - ((default_prec_decl)) - ((no_default_prec_decl)) - ((languagemode_decl)) - ((expectedconflicts_decl)) - ((package_decl)) - ((provide_decl)) - ((precedence_decl)) - ((put_decl)) - ((quotemode_decl)) - ((scopestart_decl)) - ((start_decl)) - ((keyword_decl)) - ((token_decl)) - ((type_decl)) - ((use_macros_decl))) + ((default_prec_decl)) + ((no_default_prec_decl)) + ((languagemode_decl)) + ((package_decl)) + ((expectedconflicts_decl)) + ((provide_decl)) + ((precedence_decl)) + ((put_decl)) + ((quotemode_decl)) + ((scopestart_decl)) + ((start_decl)) + ((keyword_decl)) + ((token_decl)) + ((type_decl)) + ((use_macros_decl))) (default_prec_decl - ((DEFAULT-PREC) + ((DEFAULT-PREC) `(wisent-raw-tag (semantic-tag "default-prec" 'assoc :value '("t"))))) (no_default_prec_decl - ((NO-DEFAULT-PREC) - `(wisent-raw-tag + ((NO-DEFAULT-PREC) + `(wisent-raw-tag (semantic-tag "default-prec" 'assoc :value - '("nil"))))) + '("nil"))))) (languagemode_decl - ((LANGUAGEMODE symbols) - `(wisent-raw-tag - (semantic-tag ',(car $2) - 'languagemode :rest ',(cdr $2))))) - (expectedconflicts_decl - ((EXPECTEDCONFLICTS symbols) - `(wisent-raw-tag + ((LANGUAGEMODE symbols) + `(wisent-raw-tag (semantic-tag ',(car $2) - 'expectedconflicts :rest ',(cdr $2))))) + 'languagemode :rest ',(cdr $2))))) (package_decl - ((PACKAGE SYMBOL) - `(wisent-raw-tag + ((PACKAGE SYMBOL) + `(wisent-raw-tag (semantic-tag-new-package ',$2 nil)))) + (expectedconflicts_decl + ((EXPECTEDCONFLICTS symbols) + `(wisent-raw-tag + (semantic-tag ',(car $2) + 'expectedconflicts :rest ',(cdr $2))))) (provide_decl - ((PROVIDE SYMBOL) - `(wisent-raw-tag + ((PROVIDE SYMBOL) + `(wisent-raw-tag (semantic-tag ',$2 'provide)))) (precedence_decl - ((associativity token_type_opt items) - `(wisent-raw-tag + ((associativity token_type_opt items) + `(wisent-raw-tag (semantic-tag ',$1 'assoc :type ',$2 :value ',$3)))) (associativity - ((LEFT) - (progn "left")) - ((RIGHT) - (progn "right")) - ((NONASSOC) - (progn "nonassoc"))) + ((LEFT) + (progn "left")) + ((RIGHT) + (progn "right")) + ((NONASSOC) + (progn "nonassoc"))) (put_decl - ((PUT put_name put_value) - `(wisent-raw-tag + ((PUT put_name put_value) + `(wisent-raw-tag (semantic-tag ',$2 'put :value ',(list $3)))) - ((PUT put_name put_value_list) - `(wisent-raw-tag + ((PUT put_name put_value_list) + `(wisent-raw-tag (semantic-tag ',$2 'put :value ',$3))) - ((PUT put_name_list put_value) - `(wisent-raw-tag + ((PUT put_name_list put_value) + `(wisent-raw-tag (semantic-tag ',(car $2) - 'put :rest ',(cdr $2) - :value ',(list $3)))) - ((PUT put_name_list put_value_list) - `(wisent-raw-tag + 'put :rest ',(cdr $2) + :value ',(list $3)))) + ((PUT put_name_list put_value_list) + `(wisent-raw-tag (semantic-tag ',(car $2) - 'put :rest ',(cdr $2) - :value ',$3)))) + 'put :rest ',(cdr $2) + :value ',$3)))) (put_name_list - ((BRACE_BLOCK) - (mapcar 'semantic-tag-name - (semantic-parse-region + ((BRACE_BLOCK) + (mapcar 'semantic-tag-name + (semantic-parse-region (car $region1) (cdr $region1) 'put_names 1)))) (put_names - ((LBRACE) - nil) - ((RBRACE) - nil) - ((put_name) - (wisent-raw-tag + ((LBRACE) + nil) + ((RBRACE) + nil) + ((put_name) + (wisent-raw-tag (semantic-tag $1 'put-name)))) (put_name - ((SYMBOL)) - ((token_type))) + ((SYMBOL)) + ((token_type))) (put_value_list - ((BRACE_BLOCK) - (mapcar 'semantic-tag-code-detail - (semantic-parse-region + ((BRACE_BLOCK) + (mapcar 'semantic-tag-code-detail + (semantic-parse-region (car $region1) (cdr $region1) 'put_values 1)))) (put_values - ((LBRACE) - nil) - ((RBRACE) - nil) - ((put_value) - (wisent-raw-tag + ((LBRACE) + nil) + ((RBRACE) + nil) + ((put_value) + (wisent-raw-tag (semantic-tag-new-code "put-value" $1)))) (put_value - ((SYMBOL any_value) - (cons $1 $2))) + ((SYMBOL any_value) + (cons $1 $2))) (scopestart_decl - ((SCOPESTART SYMBOL) - `(wisent-raw-tag + ((SCOPESTART SYMBOL) + `(wisent-raw-tag (semantic-tag ',$2 'scopestart)))) (quotemode_decl - ((QUOTEMODE SYMBOL) - `(wisent-raw-tag + ((QUOTEMODE SYMBOL) + `(wisent-raw-tag (semantic-tag ',$2 'quotemode)))) (start_decl - ((START symbols) - `(wisent-raw-tag + ((START symbols) + `(wisent-raw-tag (semantic-tag ',(car $2) - 'start :rest ',(cdr $2))))) + 'start :rest ',(cdr $2))))) (keyword_decl - ((KEYWORD SYMBOL string_value) - `(wisent-raw-tag + ((KEYWORD SYMBOL string_value) + `(wisent-raw-tag (semantic-tag ',$2 'keyword :value ',$3)))) (token_decl - ((TOKEN token_type_opt SYMBOL string_value) - `(wisent-raw-tag + ((TOKEN token_type_opt SYMBOL string_value) + `(wisent-raw-tag (semantic-tag ',$3 ',(if $2 'token 'keyword) - :type ',$2 :value ',$4))) - ((TOKEN token_type_opt symbols) - `(wisent-raw-tag + :type ',$2 :value ',$4))) + ((TOKEN token_type_opt symbols) + `(wisent-raw-tag (semantic-tag ',(car $3) - 'token :type ',$2 :rest ',(cdr $3))))) + 'token :type ',$2 :rest ',(cdr $3))))) (token_type_opt - (nil) - ((token_type))) + (nil) + ((token_type))) (token_type - ((LT SYMBOL GT) - (progn $2))) + ((LT SYMBOL GT) + (progn $2))) (type_decl - ((TYPE token_type plist_opt) - `(wisent-raw-tag + ((TYPE token_type plist_opt) + `(wisent-raw-tag (semantic-tag ',$2 'type :value ',$3)))) (plist_opt - (nil) - ((plist))) + (nil) + ((plist))) (plist - ((plist put_value) - (append + ((plist put_value) + (append (list $2) $1)) - ((put_value) - (list $1))) + ((put_value) + (list $1))) (use_name_list - ((BRACE_BLOCK) - (mapcar 'semantic-tag-name - (semantic-parse-region + ((BRACE_BLOCK) + (mapcar 'semantic-tag-name + (semantic-parse-region (car $region1) (cdr $region1) 'use_names 1)))) (use_names - ((LBRACE) - nil) - ((RBRACE) - nil) - ((SYMBOL) - (wisent-raw-tag + ((LBRACE) + nil) + ((RBRACE) + nil) + ((SYMBOL) + (wisent-raw-tag (semantic-tag $1 'use-name)))) (use_macros_decl - ((USE-MACROS SYMBOL use_name_list) - `(wisent-raw-tag + ((USE-MACROS SYMBOL use_name_list) + `(wisent-raw-tag (semantic-tag "macro" 'macro :type ',$2 :value ',$3)))) (string_value - ((STRING) - (read $1))) + ((STRING) + (read $1))) (any_value - ((SYMBOL)) - ((STRING)) - ((PAREN_BLOCK)) - ((PREFIXED_LIST)) - ((SEXP))) + ((SYMBOL)) + ((STRING)) + ((PAREN_BLOCK)) + ((PREFIXED_LIST)) + ((SEXP))) (symbols - ((lifo_symbols) - (nreverse $1))) + ((lifo_symbols) + (nreverse $1))) (lifo_symbols - ((lifo_symbols SYMBOL) - (cons $2 $1)) - ((SYMBOL) - (list $1))) + ((lifo_symbols SYMBOL) + (cons $2 $1)) + ((SYMBOL) + (list $1))) (nonterminal - ((SYMBOL + ((SYMBOL (setq semantic-grammar-wy--nterm $1 semantic-grammar-wy--rindx 0) COLON rules SEMI) - (wisent-raw-tag + (wisent-raw-tag (semantic-tag $1 'nonterminal :children $4)))) (rules - ((lifo_rules) - (apply 'nconc - (nreverse $1)))) + ((lifo_rules) + (apply 'nconc + (nreverse $1)))) (lifo_rules - ((lifo_rules OR rule) - (cons $3 $1)) - ((rule) - (list $1))) + ((lifo_rules OR rule) + (cons $3 $1)) + ((rule) + (list $1))) (rule - ((rhs) - (let* + ((rhs) + (let* ((nterm semantic-grammar-wy--nterm) (rindx semantic-grammar-wy--rindx) (rhs $1) comps prec action elt) (setq semantic-grammar-wy--rindx - (1+ semantic-grammar-wy--rindx)) + (1+ semantic-grammar-wy--rindx)) (while rhs (setq elt (car rhs) @@ -359,10 +364,10 @@ (if (or action comps) (setq comps - (cons elt comps) - semantic-grammar-wy--rindx - (1+ semantic-grammar-wy--rindx)) - (setq action + (cons elt comps) + semantic-grammar-wy--rindx + (1+ semantic-grammar-wy--rindx)) + (setq action (car elt)))) (t (setq comps @@ -375,46 +380,46 @@ (if comps "group" "empty") :value comps :prec prec :expr action)))))) (rhs - (nil) - ((rhs item) - (cons $2 $1)) - ((rhs action) - (cons + (nil) + ((rhs item) + (cons $2 $1)) + ((rhs action) + (cons (list $2) $1)) - ((rhs PREC item) - (cons + ((rhs PREC item) + (cons (vector $3) $1))) (action - ((PAREN_BLOCK)) - ((PREFIXED_LIST)) - ((BRACE_BLOCK) - (format "(progn\n%s)" - (let + ((PAREN_BLOCK)) + ((PREFIXED_LIST)) + ((BRACE_BLOCK) + (format "(progn\n%s)" + (let ((s $1)) (if - (string-match "^{[\r\n\t ]*" s) + (string-match "^{[
\n ]*" s) (setq s (substring s - (match-end 0)))) + (match-end 0)))) (if - (string-match "[\r\n\t ]*}$" s) + (string-match "[
\n ]*}$" s) (setq s (substring s 0 - (match-beginning 0)))) + (match-beginning 0)))) s)))) (items - ((lifo_items) - (nreverse $1))) + ((lifo_items) + (nreverse $1))) (lifo_items - ((lifo_items item) - (cons $2 $1)) - ((item) - (list $1))) + ((lifo_items item) + (cons $2 $1)) + ((item) + (list $1))) (item - ((SYMBOL)) - ((CHARACTER)))) + ((SYMBOL)) + ((CHARACTER)))) '(grammar prologue epilogue declaration nonterminal rule put_names put_values use_names))) "Parser table.") @@ -423,25 +428,26 @@ (semantic-install-function-overrides '((semantic-parse-stream . wisent-parse-stream))) (setq semantic-parser-name "LALR" - semantic--parse-table semantic-grammar-wy--parse-table - semantic-debug-parser-source "grammar.wy" - semantic-flex-keywords-obarray semantic-grammar-wy--keyword-table - semantic-lex-types-obarray semantic-grammar-wy--token-table) + semantic--parse-table semantic-grammar-wy--parse-table + semantic-debug-parser-source "grammar.wy" + semantic-flex-keywords-obarray semantic-grammar-wy--keyword-table + semantic-lex-types-obarray semantic-grammar-wy--token-table) ;; Collect unmatched syntax lexical tokens (add-hook 'wisent-discarding-token-functions - 'wisent-collect-unmatched-syntax nil t)) + 'wisent-collect-unmatched-syntax nil t)) ;;; Analyzers ;; -(define-lex-block-type-analyzer semantic-grammar-wy--<block>-block-analyzer - "block analyzer for <block> tokens." - "\\s(\\|\\s)" - '((("(" LPAREN PAREN_BLOCK) - ("{" LBRACE BRACE_BLOCK)) - (")" RPAREN) - ("}" RBRACE)) - ) +(define-lex-regex-type-analyzer semantic-grammar-wy--<symbol>-regexp-analyzer + "regexp analyzer for <symbol> tokens." + ":?\\(\\sw\\|\\s_\\)+" + '((PERCENT_PERCENT . "\\`%%\\'")) + 'SYMBOL) + +(define-lex-keyword-type-analyzer semantic-grammar-wy--<keyword>-keyword-analyzer + "keyword analyzer for <keyword> tokens." + "\\(\\sw\\|\\s_\\)+") (define-lex-regex-type-analyzer semantic-grammar-wy--<char>-regexp-analyzer "regexp analyzer for <char> tokens." @@ -449,21 +455,19 @@ nil 'CHARACTER) -(define-lex-regex-type-analyzer semantic-grammar-wy--<symbol>-regexp-analyzer - "regexp analyzer for <symbol> tokens." - ":?\\(\\sw\\|\\s_\\)+" - '((PERCENT_PERCENT . "\\`%%\\'")) - 'SYMBOL) - (define-lex-sexp-type-analyzer semantic-grammar-wy--<qlist>-sexp-analyzer "sexp analyzer for <qlist> tokens." "\\s'\\s-*(" 'PREFIXED_LIST) -(define-lex-sexp-type-analyzer semantic-grammar-wy--<string>-sexp-analyzer - "sexp analyzer for <string> tokens." - "\\s\"" - 'STRING) +(define-lex-block-type-analyzer semantic-grammar-wy--<block>-block-analyzer + "block analyzer for <block> tokens." + "\\s(\\|\\s)" + '((("(" LPAREN PAREN_BLOCK) + ("{" LBRACE BRACE_BLOCK)) + (")" RPAREN) + ("}" RBRACE)) + ) (define-lex-string-type-analyzer semantic-grammar-wy--<punctuation>-string-analyzer "string analyzer for <punctuation> tokens." @@ -475,9 +479,10 @@ (COLON . ":")) 'punctuation) -(define-lex-keyword-type-analyzer semantic-grammar-wy--<keyword>-keyword-analyzer - "keyword analyzer for <keyword> tokens." - "\\(\\sw\\|\\s_\\)+") +(define-lex-sexp-type-analyzer semantic-grammar-wy--<string>-sexp-analyzer + "sexp analyzer for <string> tokens." + "\\s\"" + 'STRING) (define-lex-sexp-type-analyzer semantic-grammar-wy--<sexp>-sexp-analyzer "sexp analyzer for <sexp> tokens." @@ -493,4 +498,9 @@ (provide 'semantic/grammar-wy) +;; Local Variables: +;; version-control: never +;; no-update-autoloads: t +;; End: + ;;; semantic/grammar-wy.el ends here diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el index 5af4607abb8..0f997474ded 100644 --- a/lisp/cedet/semantic/idle.el +++ b/lisp/cedet/semantic/idle.el @@ -47,8 +47,6 @@ ;; For the semantic-find-tags-by-name macro. (eval-when-compile (require 'semantic/find)) -(defvar eldoc-last-message) -(declare-function eldoc-message "eldoc") (declare-function semantic-analyze-unsplit-name "semantic/analyze/fcn") (declare-function semantic-complete-analyze-inline-idle "semantic/complete") (declare-function semanticdb-deep-find-tags-by-name "semantic/db-find") @@ -730,8 +728,8 @@ specific to a major mode. For example, in jde mode: :group 'semantic :type 'hook) -(defun semantic-idle-summary-idle-function () - "Display a tag summary of the lexical token under the cursor. +(defun semantic--eldoc-info (_callback &rest _) + "Return the eldoc info for the current symbol. Call `semantic-idle-summary-current-symbol-info' for getting the current tag to display information." (or (eq major-mode 'emacs-lisp-mode) @@ -741,21 +739,7 @@ current tag to display information." ((semantic-tag-p found) (funcall semantic-idle-summary-function found nil t))))) - ;; Show the message with eldoc functions - (unless (and str (boundp 'eldoc-echo-area-use-multiline-p) - eldoc-echo-area-use-multiline-p) - (let ((w (1- (window-width (minibuffer-window))))) - (if (> (length str) w) - (setq str (substring str 0 w))))) - ;; I borrowed some bits from eldoc to shorten the - ;; message. - (when semantic-idle-truncate-long-summaries - (let ((ea-width (1- (window-width (minibuffer-window)))) - (strlen (length str))) - (when (> strlen ea-width) - (setq str (substring str 0 ea-width))))) - ;; Display it - (eldoc-message str)))) + str))) (define-minor-mode semantic-idle-summary-mode "Toggle Semantic Idle Summary mode. @@ -764,30 +748,16 @@ When this minor mode is enabled, the echo area displays a summary of the lexical token at point whenever Emacs is idle." :group 'semantic :group 'semantic-modes - (if semantic-idle-summary-mode - ;; Enable the mode - (progn - (unless (and (featurep 'semantic) (semantic-active-p)) - ;; Disable minor mode if semantic stuff not available - (setq semantic-idle-summary-mode nil) - (error "Buffer %s was not set up for parsing" - (buffer-name))) - (require 'eldoc) - (semantic-idle-scheduler-add 'semantic-idle-summary-idle-function) - (add-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t)) - ;; Disable the mode - (semantic-idle-scheduler-remove 'semantic-idle-summary-idle-function) - (remove-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t))) - -(defun semantic-idle-summary-refresh-echo-area () - (and semantic-idle-summary-mode - eldoc-last-message - (if (and (not executing-kbd-macro) - (not (and (boundp 'edebug-active) edebug-active)) - (not cursor-in-echo-area) - (not (eq (selected-window) (minibuffer-window)))) - (eldoc-message eldoc-last-message) - (setq eldoc-last-message nil)))) + (remove-hook 'eldoc-documentation-functions #'semantic--eldoc-info t) + (when semantic-idle-summary-mode + ;; Enable the mode + (unless (and (featurep 'semantic) (semantic-active-p)) + ;; Disable minor mode if semantic stuff not available + (setq semantic-idle-summary-mode nil) + (error "Buffer %s was not set up for parsing" + (buffer-name))) + (add-hook 'eldoc-documentation-functions #'semantic--eldoc-info nil t) + (eldoc-mode 1))) (semantic-add-minor-mode 'semantic-idle-summary-mode "") @@ -1092,7 +1062,7 @@ be called." ;; mouse-3 pops up a context menu (define-key map [ header-line mouse-3 ] - 'semantic-idle-breadcrumbs--popup-menu) + #'semantic-idle-breadcrumbs--popup-menu) map) "Keymap for semantic idle breadcrumbs minor mode.") diff --git a/lisp/cedet/semantic/tag.el b/lisp/cedet/semantic/tag.el index 3d7bce8657a..a99e2ab279b 100644 --- a/lisp/cedet/semantic/tag.el +++ b/lisp/cedet/semantic/tag.el @@ -229,6 +229,28 @@ See also the function `semantic-ctxt-current-mode'." (require 'semantic/ctxt) (semantic-ctxt-current-mode))))) +;; Is this function still necessary? +(defun semantic-tag-make-plist (args) + "Create a property list with ARGS. +Args is a property list of the form (KEY1 VALUE1 ... KEYN VALUEN). +Where KEY is a symbol, and VALUE is the value for that symbol. +The return value will be a new property list, with these KEY/VALUE +pairs eliminated: + + - KEY associated to nil VALUE. + - KEY associated to an empty string VALUE. + - KEY associated to a zero VALUE." + (let (plist key val) + (while args + (setq key (car args) + val (nth 1 args) + args (nthcdr 2 args)) + (or (member val '("" nil)) + (and (numberp val) (zerop val)) + (setq plist (cons key (cons val plist))))) + ;; It is not useful to reverse the new plist. + plist)) + (defsubst semantic--tag-attributes-cdr (tag) "Return the cons cell whose car is the ATTRIBUTES part of TAG. That function is for internal use only." @@ -441,28 +463,6 @@ class to store those methods." ;;; Tag creation ;; -;; Is this function still necessary? -(defun semantic-tag-make-plist (args) - "Create a property list with ARGS. -Args is a property list of the form (KEY1 VALUE1 ... KEYN VALUEN). -Where KEY is a symbol, and VALUE is the value for that symbol. -The return value will be a new property list, with these KEY/VALUE -pairs eliminated: - - - KEY associated to nil VALUE. - - KEY associated to an empty string VALUE. - - KEY associated to a zero VALUE." - (let (plist key val) - (while args - (setq key (car args) - val (nth 1 args) - args (nthcdr 2 args)) - (or (member val '("" nil)) - (and (numberp val) (zerop val)) - (setq plist (cons key (cons val plist))))) - ;; It is not useful to reverse the new plist. - plist)) - (defsubst semantic-tag (name class &rest attributes) "Create a generic semantic tag. NAME is a string representing the name of this tag. diff --git a/lisp/cedet/semantic/wisent/grammar.el b/lisp/cedet/semantic/wisent/grammar.el index cfd4899186b..edc5c5c7029 100644 --- a/lisp/cedet/semantic/wisent/grammar.el +++ b/lisp/cedet/semantic/wisent/grammar.el @@ -1,4 +1,4 @@ -;;; semantic/wisent/grammar.el --- Wisent's input grammar mode +;;; semantic/wisent/grammar.el --- Wisent's input grammar mode -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. ;; @@ -228,7 +228,7 @@ Keep order of declaration in the WY file without duplicates." Return the expanded expression." (if (or (atom expr) (semantic-grammar-quote-p (car expr))) expr ;; Just return atom or quoted expression. - (let* ((expr (mapcar 'wisent-grammar-expand-macros expr)) + (let* ((expr (mapcar #'wisent-grammar-expand-macros expr)) (macro (assq (car expr) wisent--grammar-macros))) (if macro ;; Expand Semantic built-in. (apply (cdr macro) (cdr expr)) @@ -514,7 +514,8 @@ Menu items are appended to the common grammar menu.") (goto-char (point-min)) (delete-region (point-min) (line-end-position)) (insert ";;; " packagename - " --- Generated parser support file") + " --- Generated parser support file " + "-*- lexical-binding:t -*-") (re-search-forward ";;; \\(.*\\) ends here") (replace-match packagename nil nil nil 1) (delete-trailing-whitespace)))))) |