Regarding ignoreCase for Keywords. [message #1725837] |
Mon, 07 March 2016 23:39  |
Eclipse User |
|
|
|
Hi,
I wish to add a property to ignore case for keywords in my grammar.
I tried the example mentioned in
http://stackoverflow.com/questions/30889847/match-string-in-xtext-regardless-of-upper-lower-case
I updated the mwe2 configuration and I found out that
org.eclipse.xtext.generator.parser.antlr.ex.rt.AntlrGeneratorFragment could not be found.
I am using XText 2.9.0 . I checked the configuration property and found similar classes with suffix 2.
fragment = parser.antlr.XtextAntlrGeneratorFragment2 {}
fragment = ui.contentAssist.ContentAssistFragment2 {}
I tried to used ignoreCase =true property with the above but "ignoreCase"property could not be identified.
Please suggest .
[Updated on: Mon, 07 March 2016 23:40] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Regarding ignoreCase [message #1729912 is a reply to message #1727469] |
Wed, 20 April 2016 04:57  |
Eclipse User |
|
|
|
This is an example of using KEYWORDS
This is my grammar
http://pastebin.com/G0VTGyMj
This test fails.
@Test
def void testPlotMeasureByTime() {
val query ="plot profit by month"
val result = parseHelper.parse(query)
var expected =Arrays.asList("profit")
Assert.assertEquals(result.getQkeyWord,"plot")
Assert.assertEquals(expected,result.getMeasureList)
var groupBy=result.getGroupBy
var timeDimension=getTimeDimension(groupBy)
Assert.assertEquals(timeDimension,"month")
}
While this passes.
@Test
def void testPlotMeasureByDimensionByTime() {
val query ="plot profit by country by month"
val result = parseHelper.parse(query)
var expected =Arrays.asList("profit")
Assert.assertEquals(result.getQkeyWord,"plot")
Assert.assertEquals(expected,result.getMeasureList)
var groupBy=result.getGroupBy
var dimension =getDimension(groupBy)
var timeDimension=getTimeDimension(groupBy)
Assert.assertEquals(timeDimension,"month")
Assert.assertEquals(dimension,"country")
}
Util Methods.
def String getTimeDimension(EList<Group> groups){
return groups.get(0).getTimeGroup.get(0).getTimeGroup
}
def String getQkeyWord(Model result){
return result.greetings.key.getQKeyword
}
def List<String> getMeasureList(Model result){
return result.greetings.measure.names.toList
}
I have some ambiguities in my grammar as well. I would like to understand why month is taken as timeDimension in one test while the other test fails and considers it as dimGroup
Any suggestion will be highly appreciated.
|
|
|