Skip to content

Commit

Permalink
1.0.0-rc47: fix #284
Browse files Browse the repository at this point in the history
  • Loading branch information
daveyarwood committed Nov 9, 2016
1 parent 9cf0160 commit 0a4fc77
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.0.0-rc47 (11/9/16)

* Fixed [#284](https://github.com/alda-lang/alda/issues/284), bugs related to comment spacing. Thanks [elyisgreat] for reporting!

## 1.0.0-rc46 (11/2/16)

This release includes improvements to the system that assigns instrument parts and groups in an Alda score ([#249](https://github.com/alda-lang/alda/issues/249)). Thanks, [elyisgreat] and [jimcheetham], for helping to talk me through all the different scenarios!
Expand Down
2 changes: 1 addition & 1 deletion resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0-rc46
1.0.0-rc47
2 changes: 1 addition & 1 deletion server/grammar/comments.bnf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
score = (non-comment | <comment> | clj-expr)*
score = (non-comment | comment | clj-expr)*
comment = <"#"> #".*" <#"(\n|\r|$)+">
<non-comment> = #"[^\#\(\)]+"

17 changes: 9 additions & 8 deletions server/src/alda/parser.clj
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,15 @@
check-for-failure
(insta/transform
(merge clj-expr-transforms
{:score
#(reduce (fn [acc x]
(if (string? x)
(str acc x)
(str acc (store-in-cache!
cache "clj-expr" x))))
""
%&)})))]
{:comment (constantly "\n")
:score #(reduce
(fn [acc x]
(if (string? x)
(str acc x)
(str acc (store-in-cache!
cache "clj-expr" x))))
""
%&)})))]
[code cache]))

(defn separate-parts
Expand Down
13 changes: 9 additions & 4 deletions server/test/alda/parser/comments_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
[alda.parser :refer (parse-input)]))

(def expected
'(alda.lisp/score
(alda.lisp/part {:names ["piano"]}
(alda.lisp/note (alda.lisp/pitch :c))
'(alda.lisp/score
(alda.lisp/part {:names ["piano"]}
(alda.lisp/note (alda.lisp/pitch :c))
(alda.lisp/note (alda.lisp/pitch :e)))))

(deftest short-comment-tests
(testing "a short comment"
(is (= expected (parse-input "piano: c
# d
e")))))
e")))
(testing "at the end of a line"
(is (= expected (parse-input "piano: c # d
e")))
(testing "without a leading space"
(is (= expected (parse-input "piano: c#d\ne")))))))

0 comments on commit 0a4fc77

Please sign in to comment.