From fba9568d44051660ff93d249ae6066b4132ffcc1 Mon Sep 17 00:00:00 2001 From: sc13-bioinf Date: Wed, 5 Sep 2018 18:28:32 +0200 Subject: [PATCH] Allow plus symbol "+" in symbol names. (#821) r=nalexander --- edn/src/edn.rustpeg | 2 +- edn/tests/tests.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/edn/src/edn.rustpeg b/edn/src/edn.rustpeg index 2a642bea..5f97ea6d 100644 --- a/edn/src/edn.rustpeg +++ b/edn/src/edn.rustpeg @@ -146,7 +146,7 @@ namespace_separator = "/" // Keywords follow the rules of symbols, except they can (and must) begin with : // e.g. :fred or :my/fred. See https://github.com/edn-format/edn#keywords symbol_char_initial = [a-zA-Z0-9*!_?$%&=<>] -symbol_char_subsequent = [a-zA-Z0-9*!_?$%&=<>-] +symbol_char_subsequent = [+a-zA-Z0-9*!_?$%&=<>-] symbol_namespace = symbol_char_initial symbol_char_subsequent* (namespace_divider symbol_char_subsequent+)* symbol_name = ( symbol_char_initial+ symbol_char_subsequent* ) diff --git a/edn/tests/tests.rs b/edn/tests/tests.rs index d9dc9380..54cf87b0 100644 --- a/edn/tests/tests.rs +++ b/edn/tests/tests.rs @@ -413,6 +413,9 @@ fn test_keyword() { assert!(keyword(":").is_err()); assert!(keyword(":foo/").is_err()); + + assert_eq!(keyword(":foo*!_?$%&=<>-+").unwrap(), k_plain("foo*!_?$%&=<>-+")); + assert_eq!(keyword(":foo/bar*!_?$%&=<>-+").unwrap(), k_ns("foo", "bar*!_?$%&=<>-+")); } #[test]