[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/parser-generator ea898ce 317/434: Fixed code-styling
From: |
ELPA Syncer |
Subject: |
[elpa] externals/parser-generator ea898ce 317/434: Fixed code-styling |
Date: |
Mon, 29 Nov 2021 16:00:06 -0500 (EST) |
branch: externals/parser-generator
commit ea898ce9ae0e4555bfa187a2a5781d12b585de26
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Fixed code-styling
---
parser-generator-lr.el | 59 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 43 insertions(+), 16 deletions(-)
diff --git a/parser-generator-lr.el b/parser-generator-lr.el
index 725f328..262d66e 100644
--- a/parser-generator-lr.el
+++ b/parser-generator-lr.el
@@ -146,7 +146,10 @@
(let ((eff-index 0)
(eff-item)
(eff-length (length eff)))
- (while (< eff-index eff-length)
+ (while
+ (<
+ eff-index
+ eff-length)
(setq
eff-item
(parser-generator--first-to-lookahead
@@ -161,7 +164,11 @@
eff-item)
(let
((hash-key
- (format "%s-%s-%S" goto-index
state eff-item)))
+ (format
+ "%s-%s-%S"
+ goto-index
+ state
+ eff-item)))
(parser-generator--debug
(message
"Valid look-ahead: %s"
@@ -195,7 +202,9 @@
;; An extra column for '$'
(end of input) is added to the action table that contains acc for every item
set that contains an item of the form S → w • eof.
(progn
(push
- (list eff-item 'accept)
+ (list
+ eff-item
+ 'accept)
action-table)
(setq
found-accept
@@ -203,8 +212,7 @@
(push
(list
eff-item
- 'shift
- )
+ 'shift)
action-table)))
(setq
found-action
@@ -228,7 +236,10 @@
(B (nth 1 lr-item))
(u (nth 3 lr-item)))
(unless B
- (setq B (list parser-generator--e-identifier)))
+ (setq
+ B
+ (list
+ parser-generator--e-identifier)))
(if
(=
parser-generator--look-ahead-number
@@ -251,9 +262,10 @@
(message "production: %s (%s)" production
production-number)
(message "u: %s" u))
- (push (list nil 'reduce production-number)
action-table)
- (setq found-action t)
- (setq continue-loop nil))))
+ (push
+ (list nil 'reduce production-number)
+ action-table)
+ (setq found-action t))))
(when (parser-generator--valid-look-ahead-p u)
(let ((hash-key
@@ -293,13 +305,19 @@
(progn
;; Reduction by first production
;; of empty look-ahead means grammar
has been accepted
- (push (list u 'accept) action-table)
+ (push
+ (list u 'accept)
+ action-table)
(setq found-accept t)
(setq found-action t))
;; save reduction action in action table
- (push (list u 'reduce production-number)
action-table)
- (setq found-action t)))))))))))
+ (push
+ (list u 'reduce production-number)
+ action-table)
+ (setq
+ found-action
+ t)))))))))))
((eq state 'error)
(unless found-action
@@ -307,8 +325,17 @@
"Failed to find any action in set %d: %s"
goto-index
lr-items))
- (setq continue-loop nil)))
- (setq lr-item-index (1+ lr-item-index)))))))
+ (setq
+ continue-loop
+ nil)))
+ (setq
+ lr-item-index
+ (1+ lr-item-index)))
+
+ ;; TODO Handle case here were we have a conflict
+ ;; TODO shift/reduce or reduce/reduce
+
+ ))))
(parser-generator--debug
(message "%s actions %s" goto-index action-table))
(when action-table
@@ -939,7 +966,7 @@
(parser-generator--debug
(message "x: %s" x))
- ;; TODO Use caches to optimize this loop
+ ;; TODO Use caches to optimize this loop?
(dolist (lr-item previous-lr-item)
(let ((lr-item-lhs (nth 0 lr-item))
(lr-item-prefix (nth 1 lr-item))
@@ -1005,7 +1032,7 @@
(while added-new
(setq added-new nil)
- ;; TODO Use caches to optimize this loop
+ ;; TODO Use caches to optimize this loop?
(dolist (lr-item lr-new-item)
(let ((lr-item-suffix (nth 2 lr-item)))
(let ((lr-item-suffix-first
- [elpa] externals/parser-generator 0702765 293/434: Added incremental unit test for exported parser/translator, (continued)
- [elpa] externals/parser-generator 0702765 293/434: Added incremental unit test for exported parser/translator, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 552c0c5 304/434: Using better hash-key for goto-tables generation, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator d0d3201 299/434: FIRST calculation now handles cyclic productions, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 5145cda 306/434: Improved hash-key integrity for LRk Parser, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 2227cae 313/434: Moved validation of valid lr-item set to generation of goto-tables, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator a86c658 305/434: Improved output, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator dcbbdee 315/434: Started on support for symbol attributes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 0c1b8b6 316/434: Passing tests for symbol attributes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator c886537 311/434: Using references for distinct goto-tables to optimize memory usage, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 06bff4b 321/434: Improved validation of conflict-resolution using attributes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator ea898ce 317/434: Fixed code-styling,
ELPA Syncer <=
- [elpa] externals/parser-generator ae51103 323/434: Passing test for resolving conflict using precedence attributes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 35d6be3 327/434: Added TODO-items, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 4d60ed4 328/434: Added validation to context-sensitive attributes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator ce9ae69 329/434: Improved comment, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator b8a81c5 330/434: Added failing test, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 06d23f5 340/434: More debugging, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator f213255 348/434: Passed all old unit tests again after translation refactor, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 886af5c 349/434: Uncommented export tests until refactor is ok, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 99aa5b6 350/434: Added more unit tests for calculator, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator d8fb2da 354/434: Just white-space fixes, ELPA Syncer, 2021/11/29