[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 08/255: parsing simple trees
From: |
Eric Schulte |
Subject: |
[elpa] 08/255: parsing simple trees |
Date: |
Sun, 16 Mar 2014 01:02:09 +0000 |
eschulte pushed a commit to branch go
in repository elpa.
commit aa6169a6b0e3c37470130f10503f5a6c6d8a3344
Author: Eric Schulte <address@hidden>
Date: Tue May 15 07:51:36 2012 -0400
parsing simple trees
---
sgf.el | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/sgf.el b/sgf.el
index 2d72eb3..1e0f1f0 100644
--- a/sgf.el
+++ b/sgf.el
@@ -102,9 +102,9 @@
(setq start (match-beginning 2))
(let ((cont-p (string= (match-string 2 str) "("))
(tree-part (parse-nodes (match-string 1 str))))
- (if cont-p
- (list tree-part res)
- (cons tree-part res)))))
+ (setq res (if cont-p
+ (list tree-part res)
+ (cons tree-part res))))))
;;; Tests
@@ -127,11 +127,23 @@
(ert-deftest sgf-parse-one-large-node-test ()
(let* ((str ";GM[1]FF[4]
- SZ[19]
- GN[GNU Go 3.7.11 load and print]
- DT[2008-12-14]
- KM[0.0]HA[0]RU[Japanese]AP[GNU Go:3.7.11]AW[ja][oa]
- [pa][db][eb]")
+ SZ[19]
+ GN[GNU Go 3.7.11 load and print]
+ DT[2008-12-14]
+ KM[0.0]HA[0]RU[Japanese]AP[GNU Go:3.7.11]AW[ja][oa]
+ [pa][db][eb]")
(node (car (parse-nodes str))))
(should (= (length node) 10))
(should (= (length (cdar (last node))) 5))))
+
+(ert-deftest sgf-parse-simple-tree ()
+ (let* ((str "(;GM[1]FF[4]
+ SZ[19]
+ GN[GNU Go 3.7.11 load and print]
+ DT[2008-12-14]
+ KM[0.0]HA[0]RU[Japanese]AP[GNU Go:3.7.11]AW[ja][oa]
+ [pa][db][eb])")
+ (tree (parse-trees str)))
+ (should (= 1 (length tree)))
+ (should (= 1 (length (car tree))))
+ (should (= 10 (length (caar tree))))))
- [elpa] branch go created (now a5154e6), Eric Schulte, 2014/03/15
- [elpa] 01/255: parsing properties in SGF files, Eric Schulte, 2014/03/15
- [elpa] 02/255: parse nodes, Eric Schulte, 2014/03/15
- [elpa] 04/255: parse-many macro, Eric Schulte, 2014/03/15
- [elpa] 05/255: parse-nodes, Eric Schulte, 2014/03/15
- [elpa] 03/255: parse-prop -> parse-props, Eric Schulte, 2014/03/15
- [elpa] 08/255: parsing simple trees,
Eric Schulte <=
- [elpa] 06/255: passing all tests, Eric Schulte, 2014/03/15
- [elpa] 07/255: some fixes, Eric Schulte, 2014/03/15
- [elpa] 11/255: ignore data directory, Eric Schulte, 2014/03/15
- [elpa] 14/255: processing simple/core properties, Eric Schulte, 2014/03/15
- [elpa] 13/255: splitting into sections & stubbing out parsing, Eric Schulte, 2014/03/15
- [elpa] 12/255: headers, Eric Schulte, 2014/03/15
- [elpa] 15/255: board display, Eric Schulte, 2014/03/15
- [elpa] 22/255: example sgf file generated using gcoban, Eric Schulte, 2014/03/15
- [elpa] 17/255: not using "I" as an index, Eric Schulte, 2014/03/15
- [elpa] 20/255: alright "i" *is* a valid position identifier, Eric Schulte, 2014/03/15