dlang-community / SDLang-D

An SDLang (Simple Declarative Language) library for D
http://sdlang.org
Other
120 stars 21 forks source link

Incorrectly accepts ":tagname" (blank namespace, tagname prefixed with colon) #13

Closed Abscissa closed 8 years ago

Abscissa commented 10 years ago

This is dedicated ticket for "case 8" in Issue #9:

SDLang-D silently ignores all of these and does not throw an error. Currently this is invalid SDL, but it may become valid in SDLv2 as a way of escaping keywords as tag-names (and possibly attribute names).

:my-tag
:another-tag :still-doesnt-work
:yet-another;:and-another
:null :0

SDLang-D should follow the original Java lib's behavior of prohibiting this. SDLv2 can be dealt with as a separate matter once it's formalized and/or released.

lesderid commented 8 years ago

I don't think this is incorrect behaviour.

If the official SDL page can be considered normative, if a tag has no explicit namespace, the namespace defaults to an empty string. This implies that a zero-length namespace is valid.

Abscissa commented 8 years ago

Hmm, maybe SDLang-D used to silently accept ":tagname" but if so, it doesn't anymore.

However, the error message could be improved. Currently it says "Error: Expected end-of-file, not :", which is confusing.

Abscissa commented 8 years ago

Closing as "Works fine for me now". However, I did make a note here that we may want to allow this in a v2 of the spec.