Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Identifier Checking (for reserved characters) #16

Closed
djspiewak opened this Issue May 12, 2011 · 2 comments

Comments

Projects
None yet
2 participants
@djspiewak
Copy link
Owner

djspiewak commented May 12, 2011

Currently, it is possible to do something like this following:

Elem(None, "<", Attributes(), Group())

Clearly, this Elem name doesn't make any sense. We should run all identifiers through a regexp to ensure this case is rejected at runtime.

@jespersm

This comment has been minimized.

Copy link
Contributor

jespersm commented May 13, 2011

An exception should be thrown in Elem#apply, right?
Normally, I'd go for IlleglArgumentException or similar, is this bad Scala style?

@djspiewak

This comment has been minimized.

Copy link
Owner Author

djspiewak commented May 13, 2011

Actually, it should be thrown in the constructor for Elem. It's easier (and more efficient at runtime) if we stick with the compiler auto-generated apply method on the Elem companion object.

IllegalArgumentException is actually just right for the situation. I'm usually a bit lazy with my exceptions in Scala and I just use RuntimeException everywhere (which is definitely bad Scala style). :-) That reminds me: I really should go through and replace those instances in Anti-XML…

djspiewak added a commit that referenced this issue May 17, 2011

@djspiewak djspiewak closed this May 17, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.