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

single quote is a valid rune for symbols and keywords #12

Closed
tolitius opened this issue Nov 7, 2017 · 1 comment
Closed

single quote is a valid rune for symbols and keywords #12

tolitius opened this issue Nov 7, 2017 · 1 comment

Comments

@tolitius
Copy link
Contributor

tolitius commented Nov 7, 2017

Currently symbols and keywords that have single quotes (i.e. :info-didn't-change) will fail to parse since "'" is not a valid rune.

Since okSymbol function in lexer.go is used for more than just symbols, I am not sure where you think is best to add it.

For now I added it here: https://github.com/tolitius/go-edn/blob/v1/lexer.go#L251

That is of course if you agree that "'" is a valid rune

@hypirion
Copy link
Member

hypirion commented Nov 8, 2017

Yeah, this is somewhat related to edn-format/edn#67: I decided to not support it initially, but I don't mind supporting single quotes in symbols and keywords.

okSymbol is used in keywords and symbols only, so it should be fine to add single quote there: That means adding '\'' to the list of allowed characters here:

edn/lexer.go

Lines 103 to 109 in d191449

func okSymbol(r rune) bool {
switch r {
case '.', '*', '+', '!', '-', '_', '?', '$', '%', '&', '=', '<', '>', ':', '#':
return true
}
return false
}

Happy to take a patch for this, otherwise I'll likely just fix it later today.

tolitius added a commit to tolitius/go-edn that referenced this issue Nov 8, 2017
hypirion added a commit that referenced this issue Nov 8, 2017
#12 adding a single quote as a valid symbol rune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants