Fixed parse error for prefixed keywords

This commit is contained in:
fogus 2011-08-29 15:04:12 -04:00
parent 6a0bd82549
commit f79407366e
4 changed files with 7 additions and 3 deletions

View file

@ -1,4 +1,4 @@
(defproject marginalia "0.6.0" (defproject marginalia "0.6.1"
:description "lightweight literate programming for clojure -- inspired by [docco](http://jashkenas.github.com/docco/)" :description "lightweight literate programming for clojure -- inspired by [docco](http://jashkenas.github.com/docco/)"
:main marginalia.core :main marginalia.core
:dependencies :dependencies
@ -11,7 +11,9 @@
[jline "0.9.94"] [jline "0.9.94"]
;; lein vimclojure& #starts the nailgun server ;; lein vimclojure& #starts the nailgun server
[org.clojars.autre/lein-vimclojure "1.0.0"] [org.clojars.autre/lein-vimclojure "1.0.0"]
[swank-clojure "1.2.1"]] [swank-clojure "1.2.1"]
[marginalia "0.6.1"]
[lein-marginalia "0.6.0"]]
;;Needed for testing Latex equation formatting. You must download ;;Needed for testing Latex equation formatting. You must download
;;and install MathJax in you doc directory. ;;and install MathJax in you doc directory.
:marginalia {:javascript ["mathjax/MathJax.js"]}) :marginalia {:javascript ["mathjax/MathJax.js"]})

View file

@ -176,7 +176,7 @@
[form raw nspace-sym] [form raw nspace-sym]
;; Strings which are inlined into clojure files outside of forms are parsed ;; Strings which are inlined into clojure files outside of forms are parsed
;; as `String` instances, while numbers - as `Number` subclasses. ;; as `String` instances, while numbers - as `Number` subclasses.
(cond (or (string? form) (number? form)) (cond (or (string? form) (number? form) (keyword? form))
(dispatch-literal form raw nspace-sym) (dispatch-literal form raw nspace-sym)
(re-find #"^def" (-> form first name)) (re-find #"^def" (-> form first name))
(extract-common-docstring form raw nspace-sym) (extract-common-docstring form raw nspace-sym)

View file

@ -2,6 +2,7 @@
"A place to examine poor parser behavior. These should go in tests when they get written." "A place to examine poor parser behavior. These should go in tests when they get written."
) )
::foo
;; Should have only this comment in the left margin. ;; Should have only this comment in the left margin.
;; See [https://github.com/fogus/marginalia/issues/#issue/4](https://github.com/fogus/marginalia/issues/#issue/4) ;; See [https://github.com/fogus/marginalia/issues/#issue/4](https://github.com/fogus/marginalia/issues/#issue/4)

View file

@ -19,5 +19,6 @@
(is (= (count (marginalia.parser/parse "(ns test)")) 1)) (is (= (count (marginalia.parser/parse "(ns test)")) 1))
;(is (= (count (marginalia.parser/parse "(ns test)\n123")) 1)) still failing ;(is (= (count (marginalia.parser/parse "(ns test)\n123")) 1)) still failing
(is (= (count (marginalia.parser/parse "(ns test)\n123\n")) 1)) (is (= (count (marginalia.parser/parse "(ns test)\n123\n")) 1))
(is (= (count (marginalia.parser/parse "(ns test)\n::foo\n")) 1))
(is (= (count (marginalia.parser/parse "(ns test)\n\"string\"")) 1)) (is (= (count (marginalia.parser/parse "(ns test)\n\"string\"")) 1))
(is (= (count (marginalia.parser/parse "(ns test)\n\"some string\"")) 1))) (is (= (count (marginalia.parser/parse "(ns test)\n\"some string\"")) 1)))