From f79407366e4a063a7a61516edc46100473a08b68 Mon Sep 17 00:00:00 2001 From: fogus Date: Mon, 29 Aug 2011 15:04:12 -0400 Subject: [PATCH] Fixed parse error for prefixed keywords --- project.clj | 6 ++++-- src/marginalia/parser.clj | 2 +- src/problem_cases/general.clj | 1 + test/parse_test.clj | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/project.clj b/project.clj index 99e7711..f06ba15 100644 --- a/project.clj +++ b/project.clj @@ -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/)" :main marginalia.core :dependencies @@ -11,7 +11,9 @@ [jline "0.9.94"] ;; lein vimclojure& #starts the nailgun server [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 ;;and install MathJax in you doc directory. :marginalia {:javascript ["mathjax/MathJax.js"]}) diff --git a/src/marginalia/parser.clj b/src/marginalia/parser.clj index 7deba0e..b8bac3a 100644 --- a/src/marginalia/parser.clj +++ b/src/marginalia/parser.clj @@ -176,7 +176,7 @@ [form raw nspace-sym] ;; Strings which are inlined into clojure files outside of forms are parsed ;; 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) (re-find #"^def" (-> form first name)) (extract-common-docstring form raw nspace-sym) diff --git a/src/problem_cases/general.clj b/src/problem_cases/general.clj index 5d7f803..d4d1390 100644 --- a/src/problem_cases/general.clj +++ b/src/problem_cases/general.clj @@ -2,6 +2,7 @@ "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. ;; See [https://github.com/fogus/marginalia/issues/#issue/4](https://github.com/fogus/marginalia/issues/#issue/4) diff --git a/test/parse_test.clj b/test/parse_test.clj index fb20d83..65f5377 100644 --- a/test/parse_test.clj +++ b/test/parse_test.clj @@ -19,5 +19,6 @@ (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\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\"some string\"")) 1)))