Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Regarding ignoreCase for Keywords.
Regarding ignoreCase for Keywords. [message #1725837] Tue, 08 March 2016 04:39 Go to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
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: Tue, 08 March 2016 04:40]

Report message to a moderator

Re: Regarding ignoreCase [message #1725839 is a reply to message #1725837] Tue, 08 March 2016 04:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
You can use

parserGenerator = {
options = {
ignoreCase=true
}
}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1725840 is a reply to message #1725839] Tue, 08 March 2016 05:08 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
This is my mwe2 file. Should the snippet you suggest be added using the Fragment2 or any specific place below.

module org.xtext.example.mydsl.GenerateEinDsl

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*

var rootPath = ".."

Workflow {
	
	component = XtextGenerator {
		configuration = {
			project = StandardProjectConfig {
				baseName = "ein-suggestions-dsl-core"
				rootPath = rootPath
				runtimeTest = {
					enabled = true
				}
				ideaPlugin = {
					enabled = false
				}
				web = {
					enabled = false

				}
				genericIde = {
                                enabled = true
                                name = "ein-suggestions-dsl-core-ide"
                                }
             mavenLayout = true
			}
			code = {
				encoding = "UTF-8"
				fileHeader = "/*\n * generated by Xtext \${version}\n */"
			}
		}
		language = StandardLanguage {
			name = "org.xtext.example.mydsl.EinDsl"
			fileExtensions = "eindsl"

			serializer = {
				generateStub = false
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
		}

		}
}

Re: Regarding ignoreCase [message #1725841 is a reply to message #1725840] Tue, 08 March 2016 05:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
Inside language (in eclipse you have content assist and validation for
mwe2)


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1725842 is a reply to message #1725840] Tue, 08 March 2016 05:16 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I got it
Re: Regarding ignoreCase [message #1725844 is a reply to message #1725842] Tue, 08 March 2016 06:06 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
When I add the above in mwe2 .There is a build error in the application .
This import cannot be resolved to a type.

import org.xtext.example.mydsl.ide.contentassist.antlr.internal.InternalEinDslLexer;


When I remove the ignoreCase addition from mwe2 file it builds fine. I am thinking what could be the reason
Re: Regarding ignoreCase [message #1725846 is a reply to message #1725844] Tue, 08 March 2016 06:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
du you have any exceptions in the mwe log?
maybe you have some upper lower case ambiguities in your grammar


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1725848 is a reply to message #1725846] Tue, 08 March 2016 06:21 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Hi ,
I do not get any exceptions in the mwe2 log. I do get some warnings related to uppercase / lowercase ambiguity.Something like

"Decision can match input such as "By Month" using multiple alternatives: 1, 2"

my keywords are "by" and "month"

Could that be an issue? How can I resolve it?
Re: Regarding ignoreCase [message #1725849 is a reply to message #1725848] Tue, 08 March 2016 06:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
no that should not be an issue. can you share the grammar that causes the problem?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1725850 is a reply to message #1725849] Tue, 08 March 2016 06:28 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
http://pastebin.com/RtwFg8p6
Re: Regarding ignoreCase [message #1725851 is a reply to message #1725850] Tue, 08 March 2016 06:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
i cannot reproduce this using xtext 2.9.2.

are you sure there is nothing generated in /org.xtext.example.mydsl.ide/src/main/xtext-gen/org/xtext/example/mydsl/ide/contentassist/antlr/lexer


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1725854 is a reply to message #1725851] Tue, 08 March 2016 06:49 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
No ,I dont see it generated after.
before
index.php/fa/25215/0/

after
index.php/fa/25216/0/

[Updated on: Tue, 08 March 2016 06:49]

Report message to a moderator

Re: Regarding ignoreCase [message #1725855 is a reply to message #1725854] Tue, 08 March 2016 06:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
how do you run the generation?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1725856 is a reply to message #1725855] Tue, 08 March 2016 06:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
and did you test that with xtext 2.9.2

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1725857 is a reply to message #1725855] Tue, 08 March 2016 06:53 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I just clean install the project.
Re: Regarding ignoreCase [message #1725858 is a reply to message #1725856] Tue, 08 March 2016 06:57 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I just checked with 2.9.2 . Its the same. Sad
Re: Regarding ignoreCase [message #1725860 is a reply to message #1725858] Tue, 08 March 2016 06:59 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
My mwe2 file.
module org.xtext.example.mydsl.GenerateEinDsl

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*

var rootPath = ".."

Workflow {
	
	component = XtextGenerator {
		configuration = {
			project = StandardProjectConfig {
				baseName = "ein-suggestions-dsl-core"
				rootPath = rootPath
				runtimeTest = {
					enabled = true
				}
				ideaPlugin = {
					enabled = false
				}
				web = {
					enabled = false

				}
				genericIde = {
                                enabled = true
                                name = "ein-suggestions-dsl-core-ide"
                                }
             mavenLayout = true
			}
			code = {
				encoding = "UTF-8"
				fileHeader = "/*\n * generated by Xtext \${version}\n */"
			}
		}
		language = StandardLanguage {
			name = "org.xtext.example.mydsl.EinDsl"
			fileExtensions = "eindsl"

			serializer = {
				generateStub = false
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
			parserGenerator = {
                        options = {
                        ignoreCase=true
                        }
            }            
}
	}
}



Re: Regarding ignoreCase [message #1725861 is a reply to message #1725860] Tue, 08 March 2016 07:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
can you share a complete project

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1725867 is a reply to message #1725861] Tue, 08 March 2016 07:24 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
update the version
Re: Regarding ignoreCase [message #1725871 is a reply to message #1725867] Tue, 08 March 2016 07:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
the project you shared is completely mess up. please try a new one and zip the parent only

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1725872 is a reply to message #1725871] Tue, 08 March 2016 07:48 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
You can remove the parent definition and add the xtext version . is there any other error.
Re: Regarding ignoreCase [message #1725873 is a reply to message #1725872] Tue, 08 March 2016 08:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
please share something i can simply run

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726010 is a reply to message #1725873] Wed, 09 March 2016 03:56 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I have resolved the issues. Please have a look at the attached project
Re: Regarding ignoreCase [message #1726012 is a reply to message #1726010] Wed, 09 March 2016 04:15 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I have another observation from this. I see that the content assist does not does not suggest full keywords on partial text except "plot"

When I type p i get "plot". while for other keywords I dont get the content assist. Example.:
"plot abc fo" doesn't suggest "plot comm for". Same thing for all keywords except plot(which is the first word).

Moreover, I get content assist for average as well.

"prefix" :"plot a"

gives me "plot average"

but

"prefix" "plot average f" does not show "plot average for"
Am I missing something?


[Updated on: Wed, 09 March 2016 04:26]

Report message to a moderator

Re: Regarding ignoreCase [message #1726014 is a reply to message #1726012] Wed, 09 March 2016 04:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
plot average for is not valid in your grammar since (measure=MeasureList) requires at least one measurelist

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726015 is a reply to message #1726014] Wed, 09 March 2016 05:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
p.s:

besides this: use the debugger !!!!

this would have shown you that the contexts get lost and how you can workaround it

	override def Iterable<ContentAssistContext> getFilteredContexts(Collection<ContentAssistContext> contexts) {
		return contexts
	}


please file a bug


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726016 is a reply to message #1726014] Wed, 09 March 2016 05:30 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I am sorry i missed a measure list

so "plot average profit f" does not show me "for"
Re: Regarding ignoreCase [message #1726017 is a reply to message #1726016] Wed, 09 March 2016 05:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
As I said this is a bug imho please file a ticket and use my workaround

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726019 is a reply to message #1726017] Wed, 09 March 2016 05:57 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Ok Thank. with your workaround , please let me know how
"plot profit fo" suggests me "and" after fo instead of "for" .

I also observe that in all the four contexts for this case ,measure name is considered as "profit fo" . while there is a possibility of "for" coming from "fo" .

How can I filter the contexts appropriately in this case?
SO the bug is with the other issue i.e lowerCase setting ?
Re: Regarding ignoreCase [message #1726024 is a reply to message #1726019] Wed, 09 March 2016 06:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
no it is a separater issue.

i cannot help you with the workaround sry


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726027 is a reply to message #1726024] Wed, 09 March 2016 06:56 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
So, how can i resolve the lowercase setting issue .what is the bug I am confused
Re: Regarding ignoreCase [message #1726028 is a reply to message #1726027] Wed, 09 March 2016 07:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
hi the two Things have NOTHING todo with each other

bug is: i dot get proposals for the f

i already told you how to get ignorecase keywords


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 09 March 2016 07:02]

Report message to a moderator

Re: Regarding ignoreCase [message #1726036 is a reply to message #1726028] Wed, 09 March 2016 08:01 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Yeah you mentioned to solve the ignore case using this
parserGenerator = {
options = {
ignoreCase=true
}
} 



This seems to give an error as the lexer is not created.

I shared my project that you can directly build and run.

Attachment name is : ein-suggestions-dsl 2.zip

Re: Regarding ignoreCase [message #1726039 is a reply to message #1726036] Wed, 09 March 2016 08:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
but mvn clean install works fine for me

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726057 is a reply to message #1726039] Wed, 09 March 2016 10:17 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Do you have some text before "but"?. Are you able to replicate the issue I am having.
Re: Regarding ignoreCase [message #1726058 is a reply to message #1726057] Wed, 09 March 2016 10:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
no i am not. that is the problem.

mvn clean install on the parent works fine


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726059 is a reply to message #1726057] Wed, 09 March 2016 10:26 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
raised the bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=489272
Re: Regarding ignoreCase [message #1726060 is a reply to message #1726059] Wed, 09 March 2016 10:28 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I have not added this in the mwe2 file

parserGenerator = {
options = {
ignoreCase=true
}
}

please add this to replicate the issue

[Updated on: Wed, 09 March 2016 10:28]

Report message to a moderator

Re: Regarding ignoreCase [message #1726061 is a reply to message #1726060] Wed, 09 March 2016 10:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
no it is added the the version2 zip

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726149 is a reply to message #1726061] Thu, 10 March 2016 07:48 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Thanks Christian for your help on this. I found out that the file was created in the lexer folder (which is at the same level as internal ) .Previously the lexer was in internal folder. Thats why my imports were breaking.
Thanks much Smile
Re: Regarding ignoreCase [message #1726457 is a reply to message #1726149] Mon, 14 March 2016 06:35 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I have another issue regarding Keywords.

I have this statement for the grammar understand . "plot active days" . I see that there are no contexts generated.Hence I do not get any content assist proposal . I have "day" in grammar. But, in my statement I expect "active days" to be identified as measure as its a multiword as defined by my grammar.
Re: Regarding ignoreCase [message #1726459 is a reply to message #1726457] Mon, 14 March 2016 06:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
?!? please open a new ticket and provide all needed. as i said before the current Content assist impl Kind a sucks. you should use the DEBUGGER to find out what happens.
and a unit test to find out how your stuff is actually parsed.

if days is a keyword it may not be parsed as an ID and thus not as a measure.

you may introduce a datatype rule like

MYID : ID | 'days' | 'otherkeyword' | ....;

but thgis may turn your already ambigous grammar into an ambiguity nightmare


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726462 is a reply to message #1726459] Mon, 14 March 2016 06:56 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Hi ,
I have debugged and added the unit test which fails . I see that "plot active days" has "active" as the "measure" name . Is the the expected behaviour .As I understand ,it should include "days" as well. What is the ideal way to resolve this issue. Thanks
Re: Regarding ignoreCase [message #1726463 is a reply to message #1726462] Mon, 14 March 2016 06:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
hi i answered both of your questions.
please share the grammar and the unit test


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726465 is a reply to message #1726463] Mon, 14 March 2016 07:22 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Test
	@Test
	def void testPlotMeasureWithDays() {

		val query ="plot active days"
		val result = parseHelper.parse(query)

		var expected =Arrays.asList("active days")

		Assert.assertEquals(result.getQkeyWord,"plot")
		Assert.assertEquals(expected,result.getMeasureList)

	}


Grammar
http://pastebin.com/5irzNHKX
Re: Regarding ignoreCase [message #1726467 is a reply to message #1726465] Mon, 14 March 2016 07:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
val query ="plot active days"
val result = parseHelper.parse(query)
Assert.assertEquals("Found erros: " + result.eResource.errors.map[message].join(", "),0, result.eResource.errors.size)


a possible solutioin is to introduce a datatype rule

MyID: ID | 'days'| ... and use that in Measure. (might be ambigous)

or simply escape the keyword using ^days


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726476 is a reply to message #1726467] Mon, 14 March 2016 09:11 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Thanks ."or simply escape the keyword using ^days " Please elaborate on this.
Re: Regarding ignoreCase [message #1726515 is a reply to message #1726476] Mon, 14 March 2016 11:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
if you use proper value converters in xtext you can Workaround the keyword is not an ID Problem like this

Hello noKeyword!
Hello ^Hello!


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726523 is a reply to message #1726515] Mon, 14 March 2016 12:19 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I am sorry your sentence doesnt seem to be complete " you can Workaround the keyword is not an ID Problem like this" Should ^ appear in grammar or statement (plot..)

[Updated on: Mon, 14 March 2016 12:20]

Report message to a moderator

Re: Regarding ignoreCase [message #1726524 is a reply to message #1726523] Mon, 14 March 2016 12:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
No
by Default it is the grammar (ID) and IDValueCOnverter strips it off and adds it when serializing.

so you can either do the same for your stuff.
your you have to Switch from ID to MyID


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726525 is a reply to message #1726524] Mon, 14 March 2016 12:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
both

Hello noKeyword!
Hello ^Hello!

are actual models


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1726604 is a reply to message #1726523] Tue, 15 March 2016 02:58 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
you meant,Switch from MyID to ID right?
Re: Regarding ignoreCase [message #1726605 is a reply to message #1726604] Tue, 15 March 2016 04:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
pranay roy <forums-noreply@xxxxxxxx> wrote:
> you meant,Switch from MyID to ID right?
>

No the other way round.
Greeting : 'Hello' name=MyID '!';
MyID: ID|'Hello';

Hello Hello!



Or use the escaping

Greeting : 'Hello' name=ID '!';

Hello ^Hello!


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 15 March 2016 04:29]

Report message to a moderator

Re: Regarding ignoreCase [message #1727449 is a reply to message #1726605] Wed, 23 March 2016 08:40 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Thanks for the reply.

How can I add multi words? . Instead of Hello i have a list of words that should be included.Can I add another Category called "KEYWORDS" and have it included here as (Hello). Does it add additional performance overhead.?

Could you give an example please.

MyID: ID|'Hello';

[Updated on: Wed, 23 March 2016 08:41]

Report message to a moderator

Re: Regarding ignoreCase [message #1727451 is a reply to message #1727449] Wed, 23 March 2016 08:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
guess what:

MyID : ID | "keyword1" | .... | "keywordn";


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1727452 is a reply to message #1727449] Wed, 23 March 2016 08:48 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
I have just added

KEYWORDS:
('total'|'days')
;

and
^KEYWORDS to my definition of ID
Re: Regarding ignoreCase [message #1727455 is a reply to message #1727452] Wed, 23 March 2016 08:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
?!?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1727462 is a reply to message #1727455] Wed, 23 March 2016 09:21 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member

MyString:ID |SPECIAL|^KEYWORDS;

SPECIAL:
	('/' | ';' | ',' | '!' | 'ยง' | '%' | '&' | '(' | ')' | '?' | '*' | '+' | '.' | '-' | '|' | '[' | ']' | '#' | '@' |'{'|'}' |'$' |'^' |'~' |INT |':');

KEYWORDS:
	('total'|'days'|'weeks')
;





I start getting multiple warning messages when I build.

: Decision can match input such as "Total Asterisk" using multiple alternatives: 1, 2

I know its an ambiguity issue. Is there a better solution than this. My keywords could be more.
Re: Regarding ignoreCase [message #1727464 is a reply to message #1727462] Wed, 23 March 2016 09:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
but why ^KEYWORDS. KEYWORDS should be fine.



Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 23 March 2016 09:37]

Report message to a moderator

Re: Regarding ignoreCase [message #1727467 is a reply to message #1727464] Wed, 23 March 2016 09:39 Go to previous messageGo to next message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
Yeah , I am sorry . it should be without ^. I am trying to find a better way to solve this issue.
Re: Regarding ignoreCase [message #1727469 is a reply to message #1727467] Wed, 23 March 2016 09:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13193
Registered: July 2009
Senior Member
what i still dont get. how do you want to deal with the ambiguity

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding ignoreCase [message #1729912 is a reply to message #1727469] Wed, 20 April 2016 08:57 Go to previous message
pranay roy is currently offline pranay royFriend
Messages: 196
Registered: January 2016
Senior Member
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.
Previous Topic:Invoke a Rule Explicitly
Next Topic:definition terminal STRING
Goto Forum:
  


Current Time: Fri Nov 15 16:17:26 GMT 2019

Powered by FUDForum. Page generated in 0.04768 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top