Skip to content

Commit

Permalink
allow reader conditional as metadata entry
Browse files Browse the repository at this point in the history
  • Loading branch information
carocad committed Aug 29, 2020
1 parent 3726d56 commit 1c51356
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Clojure.g4
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ metadata: ((metadata_entry | deprecated_metadata_entry) ignore*)+
| var_quote
);

metadata_entry: '^' ignore* ( map | symbol | string | keyword | macro_keyword );
metadata_entry: '^' ignore* ( map | symbol | string | keyword | macro_keyword | conditional);

/**
* According to https://github.com/clojure/clojure-site/blob/7493bdb10222719923519bfd6d2699a26677ee82/content/guides/weird_characters.adoc#-and----metadata
Expand All @@ -89,7 +89,7 @@ metadata_entry: '^' ignore* ( map | symbol | string | keyword | macro_keyword );
* In order to support roundtrip of parser rules it is required to exactly identify the
* character used which would not be possible with something like '#'? '^'
*/
deprecated_metadata_entry: '#^' ignore* ( map | symbol | string | keyword | macro_keyword );
deprecated_metadata_entry: '#^' ignore* ( map | symbol | string | keyword | macro_keyword | conditional);

backtick: '`' ignore* form;

Expand Down
3 changes: 3 additions & 0 deletions test/parcera/test_cases.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@
(valid? input)
(roundtrip input))
(let [input "(meta ^::hello @(atom {}))"]
(valid? input)
(roundtrip input))
(let [input "(meta ^#?(:clj ::hello :cljs ::world) {})"]
(valid? input)
(roundtrip input)))

Expand Down

0 comments on commit 1c51356

Please sign in to comment.