Bug 449178 - WordRule cannot handle a mix of case sensitive and insensitive words
Summary: WordRule cannot handle a mix of case sensitive and insensitive words
Status: CLOSED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.3.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2014-10-29 08:22 EDT by Eyal Allweil CLA
Modified: 2014-10-31 17:06 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Allweil CLA 2014-10-29 08:22:49 EDT
WordRule is an easy to use class for identifying keywords and returning appropriate tokens for different words.

However, it offers an all-or-nothing approach to case sensitivity; you define whether the rule is case sensitive or not; you can't mix. Nor can you use two instances of WordRule, one case sensitive and one not.

Some languages (like Apache Pig) require this; in Pig, keywords and datatypes are case insensitive, but functions are case sensitive. I've made a backward-compatible change to WordRule for a Pig Eclipse plug in, and would be happy to put this patch back in the Eclipse text framework.

You can see the version of WordRule I'm using here:

https://code.google.com/p/pig-eclipse/source/browse/trunk/org.apache.pig.contrib.eclipse/src/org/apache/pig/contrib/eclipse/WordRule.java
Comment 1 Dani Megert CLA 2014-10-31 09:55:55 EDT
A scanner can take many rules. Why can't you just add two rules, one with the case-sensitive words and another one?

If you want to contribute please follow
https://wiki.eclipse.org/JDT_UI/How_to_Contribute#Contributing_Code
Comment 2 Eyal Allweil CLA 2014-10-31 17:06:08 EDT
Dani-

You're right; this is my mistake. I tried using two WordRules, one for case sensitive words and one for case insensitive words. This didn't work because my first rule was returning my default token, and the 2nd rule wasn't being used for anything, and that's why I modified WordRule. I didn't understand from the API what I was doing wrong, but after your comment I looked at it again and realized what was going on.

I'll close this bug, then.

Thanks!