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

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

[elpa] externals/phps-mode b0ad204 44/96: Improved YACC grammar parser f


From: Christian Johansson
Subject: [elpa] externals/phps-mode b0ad204 44/96: Improved YACC grammar parser for productions
Date: Fri, 29 Oct 2021 11:14:43 -0400 (EDT)

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

    Improved YACC grammar parser for productions
---
 admin/phps-mode-grammar-parser-generator.el | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/admin/phps-mode-grammar-parser-generator.el 
b/admin/phps-mode-grammar-parser-generator.el
index 8c94476..0ae4a1c 100644
--- a/admin/phps-mode-grammar-parser-generator.el
+++ b/admin/phps-mode-grammar-parser-generator.el
@@ -48,7 +48,7 @@
    nil)
   (parser-generator-set-grammar
    '(
-     (Start Productions-Block Productions-Delimiter Productions Productions 
Production Production-End LHS RHSS RHS RHS-Symbol Comment Logic Symbol)
+     (Start Productions-Block Productions-Delimiter Productions Productions 
Production Production-End LHS RHSS RHS RHS-Symbol RHS-Symbols Comment Logic 
Symbol)
      (productions-delimiter ":" "|" ";" comment logic symbol literal)
      (
       (Start
@@ -89,9 +89,25 @@
       (RHS
        (RHS-Symbol
         (lambda(args) (format "%s" args)))
+       (RHS-Symbols
+        (lambda(args)
+          (if (string-match-p " " args)
+              (format "(%s)" args)
+            (format "%s" args))))
+       )
+      (RHS-Symbols
+       (RHS-Symbol
+        RHS-Symbols
+        (lambda (args)
+          (if (string= (nth 1 args) "")
+              (format "%s" (nth 0 args))
+            (format "%s %s" (nth 0 args) (nth 1 args)))))
        (RHS-Symbol
-        RHS
-        (lambda (args) (format "%s %s" (nth 0 args) (nth 1 args))))
+        RHS-Symbol
+        (lambda (args)
+          (if (string= (nth 1 args) "")
+              (format "%s" (nth 0 args))
+            (format "%s %s" (nth 0 args) (nth 1 args)))))
        )
       (RHS-Symbol
        Comment



reply via email to

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