Skip to content

Case insensitivity doc#2146

Merged
parrt merged 18 commits intoantlr:masterfrom
parrt:case-insensitivity-doc
Dec 6, 2017
Merged

Case insensitivity doc#2146
parrt merged 18 commits intoantlr:masterfrom
parrt:case-insensitivity-doc

Conversation

@parrt
Copy link
Member

@parrt parrt commented Dec 5, 2017

In response to the lively discussion on case insensitive lexing,I have created documentation that makes it very easy to deal with case insensitivity either completely in the grammar or by using all uppercase in the grammar and in conjunction with a special character stream.

@bramp
Copy link
Contributor

bramp commented Dec 6, 2017

Thanks for writing this up. Is the intention to exclude the CaseInsensitiveStreams from the core library? and require users to make a local copy?

@parrt
Copy link
Member Author

parrt commented Dec 6, 2017 via email

Copy link
Contributor

@davesisson davesisson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@KvanTTT
Copy link
Member

KvanTTT commented Dec 6, 2017

Why not include these streams to runtimes itself? It's more convenient and less error-prone. Moreover the size of this code too small, thus nothing worry about. I suggest moving these files to runtimes.

@ericvergnaud
Copy link
Contributor

Duplicating my comment on another thread:
Wouldn’t it be more accurate and still simple to introduce a ‘caseless’ section in the Lexer grammar ?
Something like:
caseless {
SELECT: ‘select’;
WHERE: ‘where’;
}
The tool would generate the required intervals for each token letter.
I appreciate this requires changing the ANTLR grammar itself but it would remove any ambiguity on what is or isn’t caseless and would immediately work for all targets.
Only ascii would be supported.
What do you think?

@parrt
Copy link
Member Author

parrt commented Dec 6, 2017

@KvanTTT Every bit of code that goes into the main repository requires maintenance, documentation, synchronicity between language targets, testing and so on. It is always a trade-off between how many of the users need something and the maintenance effort on me. Remember that I've been doing this for 30 years now and everything we add I'm stuck supporting ;)

@parrt
Copy link
Member Author

parrt commented Dec 6, 2017

hi @ericvergnaud! An argument against that would be that changing the ANTLR metalanguage would break any existing tools. In the end, I think this is a minor issue for a small subset of the grammars. As @mike-lischke points out, you cut-and-paste once, if you are unlucky enough to work on an ancient language with case insensitive keywords, and never think about it again. :)

@parrt
Copy link
Member Author

parrt commented Dec 6, 2017

I introduced a syntax error are in the JavaScript so I'm waiting to get the tests to pass then will integrate... I will do a quick check for PRs but then will move towards a 4.7.1 release :)

@parrt parrt added the comp:doc label Dec 6, 2017
@parrt parrt merged commit a4a1421 into antlr:master Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants