Allow plus symbol "+" in symbol names. (#821) r=nalexander

This commit is contained in:
sc13-bioinf 2018-09-05 18:28:32 +02:00 committed by Nick Alexander
parent e3113783ae
commit fba9568d44
2 changed files with 4 additions and 1 deletions

View file

@ -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* )

View file

@ -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]