Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » case insensitive in xtext grammar(case insensitive in xtext grammar)
case insensitive in xtext grammar [message #1733450] Fri, 27 May 2016 15:43 Go to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
module com.prolifics.jpl.GenerateJPLEditor

import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*

var grammarURI = "classpath:/com/prolifics/jpl/JPLEditor.xtext"
var fileExtensions = "jpl"
var projectName = "com.prolifics.jpl.JPLEditor"
var runtimeProject = "../${projectName}"
var generateXtendStub = true
var encoding = "UTF-8"

Workflow {
bean = StandaloneSetup {
scanClassPath = true
platformUri = "${runtimeProject}/.."
// The following two lines can be removed, if Xbase is not used.
registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
}

component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}

component = DirectoryCleaner {
directory = "${runtimeProject}/model"
}

component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
}

component = DirectoryCleaner {
directory = "${runtimeProject}.tests/src-gen"
}

component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
pathTestProject = "${runtimeProject}.tests"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
encoding = encoding
language = auto-inject {
uri = grammarURI

// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment auto-inject {}

// generates Java API for the generated EPackages
fragment = ecore.EMFGeneratorFragment auto-inject {}

// the old serialization component
// fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {}

// serializer 2.0
fragment = serializer.SerializerFragment auto-inject {
generateStub = false
}

// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment auto-inject {}

// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
// options = {
// backtrack = true
// }
}

// Xtend-based API for validation
fragment = validation.ValidatorFragment auto-inject {
// composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}

// old scoping and exporting API
// fragment = scoping.ImportURIScopingFragment auto-inject {}
// fragment = exporting.SimpleNamesFragment auto-inject {}

// scoping and exporting API
fragment = scoping.ImportNamespacesScopingFragment auto-inject {}
fragment = exporting.QualifiedNamesFragment auto-inject {}
fragment = builder.BuilderIntegrationFragment auto-inject {}

// generator API
fragment = generator.GeneratorFragment auto-inject {}

// formatter API
fragment = formatting.FormatterFragment auto-inject {}

// labeling API
fragment = labeling.LabelProviderFragment auto-inject {}

// outline API
fragment = outline.OutlineTreeProviderFragment auto-inject {}
fragment = outline.QuickOutlineFragment auto-inject {}

// quickfix API
fragment = quickfix.QuickfixProviderFragment auto-inject {}

// content assist API
fragment = contentAssist.ContentAssistFragment auto-inject {}

// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {}

// generates junit test support classes into Generator#pathTestProject
fragment = junit.Junit4Fragment auto-inject {}

// project wizard (optional)
// fragment = projectWizard.SimpleProjectWizardFragment auto-inject {
// generatorProjectName = "${projectName}"
// }

// rename refactoring
fragment = refactoring.RefactorElementNameFragment auto-inject {}

// provides the necessary bindings for java types integration
fragment = types.TypesGeneratorFragment auto-inject {}

// generates the required bindings only if the grammar inherits from Xbase
fragment = xbase.XbaseGeneratorFragment auto-inject {}

// provides a preference page for template proposals
fragment = templates.CodetemplatesGeneratorFragment auto-inject {}

// provides a compare view
fragment = compare.CompareFragment auto-inject {}
}
}
}

Where to add ignoreCase=true in this file to achieve case insensitive?

Re: case insensitive in xtext grammar [message #1733455 is a reply to message #1733450] Fri, 27 May 2016 16:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12033
Registered: July 2009
Senior Member
the looks like an xtext <=2.8.4 style workflow

you can add it to

fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
    		  options = {
    		     ignoreCase = true
    		  }
    		}


and

fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {
    			options = {
    				ignoreCase = true
    			}
    		}


and

fragment = scoping.ImportNamespacesScopingFragment auto-inject {
    			ignoreCase = true
    		}


(depending on your requirements)


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: case insensitive in xtext grammar [message #1733564 is a reply to message #1733455] Mon, 30 May 2016 07:59 Go to previous messageGo to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

I already tried this but I got an error like:

0 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering platform uri 'E:\JPLEditor1'
0 [main] WARN lipse.emf.mwe.utils.StandaloneSetup - Skipping conflicting project .antlr at 'archive:file:/E:/JPLEditor1/com.prolifics.jpl.JPLEditor/.antlr-generator-3.2.0-patch.jar!/' and using 'archive:file:/E:/JPLEditor1/com.prolifics.jpl.JPLEditor/.antlr-generator-3.2.0.jar!/' instead.
126 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Adding generated EPackage 'org.eclipse.xtext.xbase.XbasePackage'
344 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/Xtext/Xbase/XAnnotations' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
360 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xtype' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
376 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xbase' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
376 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/common/JavaVMTypes' from 'platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel'
1171 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Adding generated EPackage 'org.eclipse.xtext.common.types.TypesPackage'
1171 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems running workflow com.prolifics.jpl.GenerateJPLEditor:
[ERROR]: This fragment does not support the option 'ignorecase'. Use 'org.eclipse.xtext.generator.parser.antlr.ex.rt.AntlrGeneratorFragment' instead(Element: -UNKNOWN-; Reported by: -UNKNOWN-)
[ERROR]: This fragment does not support the option 'ignoreCase'. Use 'org.eclipse.xtext.generator.parser.antlr.ex.ca.ContentAssistParserGeneratorFragment' instead(Element: -UNKNOWN-; Reported by: -UNKNOWN-)
java.lang.RuntimeException: Problems running workflow com.prolifics.jpl.GenerateJPLEditor:
[ERROR]: This fragment does not support the option 'ignorecase'. Use 'org.eclipse.xtext.generator.parser.antlr.ex.rt.AntlrGeneratorFragment' instead(Element: -UNKNOWN-; Reported by: -UNKNOWN-)
[ERROR]: This fragment does not support the option 'ignoreCase'. Use 'org.eclipse.xtext.generator.parser.antlr.ex.ca.ContentAssistParserGeneratorFragment' instead(Element: -UNKNOWN-; Reported by: -UNKNOWN-)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:104)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.lang.RuntimeException:
[ERROR]: This fragment does not support the option 'ignorecase'. Use 'org.eclipse.xtext.generator.parser.antlr.ex.rt.AntlrGeneratorFragment' instead(Element: -UNKNOWN-; Reported by: -UNKNOWN-)
[ERROR]: This fragment does not support the option 'ignoreCase'. Use 'org.eclipse.xtext.generator.parser.antlr.ex.ca.ContentAssistParserGeneratorFragment' instead(Element: -UNKNOWN-; Reported by: -UNKNOWN-)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.handleIssues(Mwe2Bridge.java:56)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.preInvoke(Mwe2Bridge.java:66)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.preInvoke(AbstractWorkflowComponent.java:197)
at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.preInvoke(AbstractCompositeWorkflowComponent.java:29)
at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:18)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
... 4 more
Re: case insensitive in xtext grammar [message #1733567 is a reply to message #1733564] Mon, 30 May 2016 08:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12033
Registered: July 2009
Senior Member
the error message tells what to do

[ERROR]: This fragment does not support the option 'ignorecase'. Use 'org.eclipse.xtext.generator.parser.antlr.ex.rt.AntlrGeneratorFragment' instead(Element: -UNKNOWN-; Reported by: -UNKNOWN-)
[ERROR]: This fragment does not support the option 'ignoreCase'. Use 'org.eclipse.xtext.generator.parser.antlr.ex.ca.ContentAssistParserGeneratorFragment' instead(Element: -UNKNOWN-; Reported by: -UNKNOWN-)


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: case insensitive in xtext grammar [message #1777746 is a reply to message #1733455] Mon, 04 December 2017 07:32 Go to previous messageGo to next message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 14
Registered: December 2016
Junior Member
How does one specify the Case Insensitivity in the new WorkFlow.
Currently using xtext 2.13.

My WorkFlow snippet (ScreenShot1):
index.php/fa/31488/0/

My Issue (ScreenShot2):
index.php/fa/31489/0/

PS. Is there a guide I could read to understand the new WorkFlow, and allow me to translate the old workflow examples to the new?

Christian Dietrich wrote on Fri, 27 May 2016 16:41
the looks like an xtext <=2.8.4 style workflow

you can add it to

fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
    		  options = {
    		     ignoreCase = true
    		  }
    		}


and

fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {
    			options = {
    				ignoreCase = true
    			}
    		}


and

fragment = scoping.ImportNamespacesScopingFragment auto-inject {
    			ignoreCase = true
    		}


(depending on your requirements)

[Updated on: Mon, 04 December 2017 07:48]

Report message to a moderator

Re: case insensitive in xtext grammar [message #1777758 is a reply to message #1777746] Mon, 04 December 2017 10:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12033
Registered: July 2009
Senior Member
scoping != keywords

scopeProvider = {
ignoreCase = true
}


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: case insensitive in xtext grammar [message #1777769 is a reply to message #1777758] Mon, 04 December 2017 14:00 Go to previous message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 14
Registered: December 2016
Junior Member
Thanks. Worked. :)

index.php/fa/31491/0/

index.php/fa/31492/0/
Previous Topic:resolution of uriFragment '|29' failed.
Next Topic:Xbase: Fields in generated inner class not recognized, no problems as class in own file
Goto Forum:
  


Current Time: Wed Jun 20 17:23:04 GMT 2018

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

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

Back to the top