emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/phps-mode 7a636ccd28 078/212: Removed obsolete file par


From: Christian Johansson
Subject: [elpa] externals/phps-mode 7a636ccd28 078/212: Removed obsolete file parser-grammar-macro.el
Date: Wed, 26 Jan 2022 01:50:57 -0500 (EST)

branch: externals/phps-mode
commit 7a636ccd28dc84cf84e32feafe441307a04ef0f1
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Removed obsolete file parser-grammar-macro.el
---
 phps-mode-lexer.el                |  31 ++++++++----
 phps-mode-parser-grammar-macro.el | 102 --------------------------------------
 phps-mode-parser-sdt.el           |  32 +++++++++++-
 3 files changed, 51 insertions(+), 114 deletions(-)

diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index c0f8ef873e..90c10ef07b 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -32,7 +32,6 @@
 
 
 (require 'phps-mode-macros)
-(require 'phps-mode-parser-grammar-macro)
 
 (require 'semantic)
 (require 'semantic/lex)
@@ -45,9 +44,19 @@
 ;; INITIALIZE SETTINGS
 
 
-(phps-mode-parser-grammar-macro-CG
+(defvar phps-mode-lexer--CG-data
+  (make-hash-table :test 'equal)
+  "A hash-table with all settings.")
+
+(defun phps-mode-lexer--CG (subject &optional value)
+  "Return and optionally set VALUE of SUBJECT."
+  (if value
+      (puthash subject value phps-mode-lexer--CG-data)
+    (gethash subject phps-mode-lexer--CG-data)))
+
+(phps-mode-lexer--CG
  'parser-mode t)
-(phps-mode-parser-grammar-macro-CG
+(phps-mode-lexer--CG
  'short-tags t)
 
 
@@ -377,8 +386,8 @@
 
 (defun phps-mode-lexer--reset-doc-comment ()
   "Reset doc comment."
-  (when (phps-mode-parser-grammar-macro-CG 'doc_comment)
-    (phps-mode-parser-grammar-macro-CG 'doc_comment nil)))
+  (when (phps-mode-lexer--CG 'doc_comment)
+    (phps-mode-lexer--CG 'doc_comment nil)))
 
 (defun phps-mode-lexer--return-token-with-indent (&optional token start end)
   "Return TOKEN with START and END."
@@ -1212,8 +1221,8 @@
        (and SHEBANG (looking-at (concat "#!.*" phps-mode-lexer--newline)))
        (let ((lineno
               (1+
-               (phps-mode-parser-grammar-macro-CG 'zend_lineno))))
-         (phps-mode-parser-grammar-macro-CG 'zend-lineno lineno))
+               (phps-mode-lexer--CG 'zend_lineno))))
+         (phps-mode-lexer--CG 'zend-lineno lineno))
        (phps-mode-lexer--begin 'ST_INITIAL)
        (phps-mode-lexer--restart))
 
@@ -1254,7 +1263,7 @@
            (phps-mode-lexer--begin 'ST_IN_SCRIPTING)
            (phps-mode-lexer--return-or-skip-token 'T_OPEN_TAG))
 
-          ((phps-mode-parser-grammar-macro-CG 'short-tags)
+          ((phps-mode-lexer--CG 'short-tags)
            (phps-mode-lexer--yyless 2)
            (setq end (- end 2))
            (phps-mode-lexer--begin 'ST_IN_SCRIPTING)
@@ -1268,7 +1277,7 @@
 
       (phps-mode-lexer--match-macro
        (and ST_INITIAL (looking-at "<\\?"))
-       (if (phps-mode-parser-grammar-macro-CG 'short-tags)
+       (if (phps-mode-lexer--CG 'short-tags)
            (progn
              (phps-mode-lexer--begin 'ST_IN_SCRIPTING)
              (phps-mode-lexer--return-or-skip-token 'T_OPEN_TAG))
@@ -1451,7 +1460,7 @@
                      (phps-mode-lexer--return-token
                       'T_DOC_COMMENT
                       start)
-                     (phps-mode-parser-grammar-macro-CG 'doc_comment t))
+                     (phps-mode-lexer--CG 'doc_comment t))
                  (phps-mode-lexer--return-token
                   'T_COMMENT start))
              (progn
@@ -1624,7 +1633,7 @@
           phps-mode-lexer--heredoc-label-stack)
          ;; (message "Found heredoc or nowdoc at %s with label %s" data 
phps-mode-lexer--heredoc-label)
 
-         (phps-mode-parser-grammar-macro-CG
+         (phps-mode-lexer--CG
           'doc_comment
           t)
          (phps-mode-lexer--return-token
diff --git a/phps-mode-parser-grammar-macro.el 
b/phps-mode-parser-grammar-macro.el
deleted file mode 100644
index 526c25303f..0000000000
--- a/phps-mode-parser-grammar-macro.el
+++ /dev/null
@@ -1,102 +0,0 @@
-;;; phps-mode-parser-grammar-macro.el --- Potential grammar macros for parser  
-*- lexical-binding:t -*-
-
-;; Copyright (C) 2018-2021  Free Software Foundation, Inc.
-
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2, or (at
-;; your option) any later version.
-
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;;; Code:
-
-
-(require 'semantic/wisent/grammar)
-
-(defvar phps-mode-parser-grammar-macro-CG-data
-  (make-hash-table :test 'equal)
-  "A hash-table with all settings.")
-
-(defun phps-mode-parser-grammar-macro-CG (subject &optional value)
-  "Return and optionally set VALUE of SUBJECT."
-  (if value
-      (puthash subject value phps-mode-parser-grammar-macro-CG-data)
-    (gethash subject phps-mode-parser-grammar-macro-CG-data)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_CREATE (symbol value &rest 
attributes)
-  "Create AST SYMBOL with VALUE."
-  `(wisent-raw-tag
-    (semantic-tag ,symbol ,value ,@attributes)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_CREATE_ASSIGN_OP (symbol 
subject object)
-  "Create AST assignment."
-  `(wisent-raw-tag
-    (semantic-tag ,symbol 'ZEND_AST_ASSIGN_OP :object ,object :subject 
,subject)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_CREATE_BINARY_OP (symbol 
subject object)
-  "Create AST assignment."
-  `(wisent-raw-tag
-    (semantic-tag ,symbol 'ZEND_AST_BINARY_OP :object ,object :subject 
,subject)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_CREATE_CAST (symbol subject)
-  "Create cast."
-  `(wisent-raw-tag
-    (semantic-tag ,symbol 'ZEND_AST_CAST :subject ,subject)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_CREATE_EX (symbol operator 
&optional subject subject2)
-  "Create stuff."
-  (let ((attributes `(:operator ,operator)))
-    (when subject
-      (plist-put attributes :subject subject))
-    (when subject2
-      (plist-put attributes :subject2 subject2))
-    `(wisent-raw-tag
-      (semantic-tag ,symbol 'ZEND_AST_EX ,@attributes))))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_LIST_RTRIM (subject)
-  `(wisent-raw-tag
-    (semantic-tag ,subject 'ZEND_AST_LIST_RTRIM)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_CREATE_LIST (size type &rest 
_elements)
-  `(wisent-raw-tag
-    (semantic-tag "" ,type :elements @elements :size ,size)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_LIST_ADD (array new-element)
-  `(wisent-raw-tag
-    (semantic-tag ,array 'ZEND_AST_LIST_ADD :new-element ,new-element)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_NEGATE_NUM_STRING (num-string)
-  `(* (string-to-number ,num-string) -1))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_CREATE_CLASS_CONST_OR_NAME 
(object member)
-  `(wisent-raw-tag
-    (semantic-tag ,object 'ZEND_AST_CLASS_CONST_OR_NAME :member ,member)))
-
-(defun phps-mode-parser-grammar-macro-ZVAL_INTERNED_STR (_callback string)
-  "Convert string to symbol."
-  `(let ((symbol ',string))
-     (funcall callback symbol)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_CREATE_ZVAL_EX (subject symbol)
-  `(wisent-raw-tag
-    (semantic-tag ,subject ,symbol)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_AST_CREATE_ZVAL (subject)
-  `(wisent-raw-tag
-    (semantic-tag ,subject 'ZEND_AST_ZVAL :attr 0)))
-
-(defun phps-mode-parser-grammar-macro-ZEND_LEX_TSTRING (callback)
-  (let ((token (semantic-lex (point) (point-max) nil 1)))
-    (funcall callback token)))
-
-(provide 'phps-mode-parser-grammar-macro)
-;;; phps-mode-parser-grammar-macro.el ends here
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 3485fdf0ac..f626b34e78 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -8,6 +8,33 @@
 
 ;;; Code:
 
+;; TODO Add SDT for
+;; argument_list
+;; array_pair_list
+;; catch_list
+;; catch_name_list
+;; class_statement_list
+;; echo_expr_list
+;; expr
+;; extends_from
+;; for_exprs
+;; for_statement
+;; foreach_statement
+;; global_var_list
+;; implements_list
+;; inner_statement_list
+;; inner_statement_list
+;; interface_extends_list
+;; isset_variables
+;; lexical_vars
+;; method_body
+;; method_modifiers
+;; optional_expr
+;; statement
+;; variable_modifiers
+
+;; TODO Remove function (phps-mode-parser-sdt--get-list-of-object)
+
 
 (require 'phps-mode-parser)
 
@@ -165,7 +192,10 @@
 (puthash
  149
  (lambda(args _terminals)
-   `(ast-type return-statement optional-expr 
,(phps-mode-parser-sdt--get-list-of-object (nth 1 args))))
+   `(ast-type
+     return-statement
+     optional-expr
+     ,(phps-mode-parser-sdt--get-list-of-object (nth 1 args))))
  phps-mode-parser--table-translations)
 
 ;; statement -> (T_GLOBAL global_var_list ";")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]