[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 47/255: parsing of sgf files with alternative paths working
From: |
Eric Schulte |
Subject: |
[elpa] 47/255: parsing of sgf files with alternative paths working |
Date: |
Sun, 16 Mar 2014 01:02:16 +0000 |
eschulte pushed a commit to branch go
in repository elpa.
commit b5ab8b9a12fea1b54b2e188be23eb9440fc76a9b
Author: Eric Schulte <address@hidden>
Date: Sat May 19 19:28:59 2012 -0400
parsing of sgf files with alternative paths working
---
sgf.el | 28 ++++++++++------------------
1 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/sgf.el b/sgf.el
index af4148b..72612af 100644
--- a/sgf.el
+++ b/sgf.el
@@ -98,20 +98,8 @@
(defun other-color (color)
(if (equal color :b) :w :b))
-(defun rcons (x l) (append l (list x)))
-
-(defmacro rpush (x place)
- "Insert X at the tail of the list stored in PLACE.
-Analogous to (setf PLACE (rcons X PLACE)), though more careful about
-evaluating each argument only once and in the right order. PLACE may
-be a symbol, or any generalized variable allowed by `setf'."
- (if (symbolp place)
- (list 'setq place (list 'rcons x place))
- (list 'callf2 'rcons x place)))
-
;;; Parsing
-;; TODO: try using load-read-function and try loading these files w/read
(defmacro parse-many (regexp string &rest body)
(declare (indent 2))
`(let (res (start 0))
@@ -171,17 +159,21 @@ be a symbol, or any generalized variable allowed by
`setf'."
((and (= char ?\]) (not (= last ?\\))) (decf square-open))
((and (= char ?\() (zerop square-open)) (incf paren-open))
((and (= char ?\)) (zerop square-open)) (decf paren-open))))
- when (zerop paren-open) return n))))
+ when (zerop paren-open) return (1+ n)))))
(defun parse-trees (str)
(let (cont-p)
(parse-many parse-tree-part-re str
- (message "match: %d:%S" (1- (match-end 0)) (substring str (1- (match-end
0)) (match-end 0)))
- (let* ((start (1- (match-end 0)))
- (end (closing-paren str start)))
+ (let ((m-end (match-end 0)))
+ (setq cont-p (string= "(" (substring str (1- m-end) m-end)))
(collect (parse-nodes (match-string 1 str)))
- (collect (parse-trees (substring str start end)))
- (setq start end)))))
+ (setq start
+ (if cont-p
+ (let* ((start (1- m-end))
+ (end (closing-paren str start)))
+ (collect (parse-trees (substring str start end)))
+ (1+ end))
+ m-end))))))
(defun read-from-buffer (buffer)
(process (parse-trees (with-current-buffer buffer (buffer-string)))))
- [elpa] 38/255: more capture tests, failing multistone captures, (continued)
- [elpa] 38/255: more capture tests, failing multistone captures, Eric Schulte, 2014/03/15
- [elpa] 36/255: passing all tests (at least it did this once), Eric Schulte, 2014/03/15
- [elpa] 26/255: improvements, considering labels and moves, Eric Schulte, 2014/03/15
- [elpa] 40/255: parsing empty properties, Eric Schulte, 2014/03/15
- [elpa] 42/255: more work with tree parsing, Eric Schulte, 2014/03/15
- [elpa] 46/255: TODO: try using load-read-function and try loading these files w/read, Eric Schulte, 2014/03/15
- [elpa] 45/255: looking at a new method of parsing trees, Eric Schulte, 2014/03/15
- [elpa] 44/255: indentation, Eric Schulte, 2014/03/15
- [elpa] 43/255: paren matching, Eric Schulte, 2014/03/15
- [elpa] 49/255: removed debug stuffs, Eric Schulte, 2014/03/15
- [elpa] 47/255: parsing of sgf files with alternative paths working,
Eric Schulte <=
- [elpa] 48/255: all tests are passing, Eric Schulte, 2014/03/15
- [elpa] 52/255: more condensed collecting of games w/alternatives, Eric Schulte, 2014/03/15
- [elpa] 51/255: parsing large complex files, Eric Schulte, 2014/03/15
- [elpa] 39/255: passing all tests, Eric Schulte, 2014/03/15
- [elpa] 50/255: whitespace, Eric Schulte, 2014/03/15
- [elpa] 41/255: simplified parse-tree, but not done, Eric Schulte, 2014/03/15
- [elpa] 53/255: passing all tests, Eric Schulte, 2014/03/15
- [elpa] 54/255: more parsing/syntax tweaks, Eric Schulte, 2014/03/15
- [elpa] 56/255: some utility functions, Eric Schulte, 2014/03/15
- [elpa] 55/255: new approach to parsing sgf files into elisp, Eric Schulte, 2014/03/15