bpsm / edn-java

a reader for extensible data notation
Eclipse Public License 1.0
100 stars 24 forks source link

Symbol.checkName() should forbid names of the form "^[+][0-9].*" #36

Closed bpsm closed 7 years ago

bpsm commented 11 years ago

See https://github.com/edn-format/edn#symbols

Which states that symbols beginning with +, must continue with a non-digit.

Currently we catch this for namespace-less symbols and for prefixes of symbols but don't catch it if the symbol has a legal prefix, but the name itself violates this rule.

This test should pass (by having scan throw an exception):

@Test(expected=EdnException.class)
public void symbolNameStartsWithPlusDigit() {
    scan("foo/+4blah");
}

Currently this test fails.

bpsm commented 7 years ago

Closer reading of Clojure's own reader suggests that accepting foo/+4blah as a symbol is not an error, while accepting +4blah would be an error.