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

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

[elpa] externals/phps-mode d56472c 50/62: Added precedence attributes to


From: Christian Johansson
Subject: [elpa] externals/phps-mode d56472c 50/62: Added precedence attributes to grammar
Date: Tue, 20 Apr 2021 10:56:22 -0400 (EDT)

branch: externals/phps-mode
commit d56472c810ba9070e35ec8a2f019fcafe29600e8
Author: Christian Johansson <christian@mediastrategi.se>
Commit: Christian Johansson <christian@mediastrategi.se>

    Added precedence attributes to grammar
---
 admin/phps-mode-automation-grammar.el | 27 ++++++++++++++++++++-------
 admin/phps-mode-automation.el         |  6 ++++++
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/admin/phps-mode-automation-grammar.el 
b/admin/phps-mode-automation-grammar.el
index fd6bc01..dc89990 100644
--- a/admin/phps-mode-automation-grammar.el
+++ b/admin/phps-mode-automation-grammar.el
@@ -798,7 +798,7 @@
      )
 
     (if_stmt
-     (if_stmt_without_else T_NOELSE)
+     (if_stmt_without_else (T_NOELSE (%prec 1)))
      (if_stmt_without_else T_ELSE statement)
      )
 
@@ -1060,8 +1060,8 @@
      (expr "%" expr)
      (expr T_SL expr)
      (expr T_SR expr)
-     ("+" expr "~")
-     ("-" expr "~")
+     ("+" expr ("~" (%prec 1)))
+     ("-" expr ("~" (%prec 1)))
      ("!" expr)
      ("~" expr)
      (expr T_IS_IDENTICAL expr)
@@ -1119,7 +1119,7 @@
      %empty)
 
     (backup_fn_flags
-     (PREC_ARROW_FUNCTION %empty))
+     ((PREC_ARROW_FUNCTION (%prec 1)) %empty))
 
     (backup_lex_pos
      %empty)
@@ -1373,12 +1373,25 @@
       (unless (= (point) index)
         (goto-char index))
       (phps-mode-lexer--re2c)
-      (car
-       (nreverse
-        phps-mode-lexer--generated-new-tokens))))
+      (when
+          (boundp
+           'phps-mode-lexer--generated-new-tokens)
+        (car
+         (nreverse
+          phps-mode-lexer--generated-new-tokens)))))
   "The custom lex-analyzer.")
 
 (defconst
+  phps-mode-automation-grammar-precendece-attribute
+  '%prec
+  "The precedence attribute of the grammar.")
+
+(defconst
+  phps-mode-automation-grammar-precedence-comparison-function
+  #'>
+  "The precedence comparison function of the grammar.")
+
+(defconst
   phps-mode-automation-grammar-lex-analyzer-get-function
   (lambda (token)
     (with-current-buffer "*phps-mode-lex-analyzer*"
diff --git a/admin/phps-mode-automation.el b/admin/phps-mode-automation.el
index 2171092..7ee0096 100644
--- a/admin/phps-mode-automation.el
+++ b/admin/phps-mode-automation.el
@@ -64,6 +64,12 @@
   (setq
    parser-generator-lex-analyzer--get-function
    phps-mode-automation-grammar-lex-analyzer-get-function)
+  (setq
+   parser-generator-lr--precedence-attribute
+   phps-mode-automation-grammar-precendece-attribute)
+  (setq
+   parser-generator-lr--precedence-comparison-function
+   phps-mode-automation-grammar-precedence-comparison-function)
   (parser-generator-process-grammar)
   (parser-generator-lr-generate-parser-tables)
 



reply via email to

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