Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Validating a Keyword(custom warnings)
Validating a Keyword [message #1740676] Wed, 17 August 2016 07:51 Go to next message
prateek garg is currently offline prateek gargFriend
Messages: 16
Registered: August 2016
Junior Member
Hi,
I have a task to validate the keyword.
Model:
greetings+=Greeting*;

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

I want to display a custom warning message if the input is "hello" saying as "hello should be Hello"
Re: Validating a Keyword [message #1740718 is a reply to message #1740676] Wed, 17 August 2016 18:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
is your grammar case insensitive or is it not.

if not, then allow it in your grammar

'Hello' | 'hello'

in both cases:

either assign the keyword to get the value in the validator

helloKeyword=(....)

or use NodeNodelUtils to retrieve the nodes for the Greeting eobject and then iterate the nodes and find the one whose grammar element is the hello keyword


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Validating a Keyword [message #1741111 is a reply to message #1740718] Tue, 23 August 2016 07:48 Go to previous message
prateek garg is currently offline prateek gargFriend
Messages: 16
Registered: August 2016
Junior Member
ThankYou Smile
Previous Topic:RuntimeException: Cannot root twice
Next Topic:How to add xtext sdk with eclipse plugin?
Goto Forum:
  


Current Time: Thu Apr 25 04:07:06 GMT 2024

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

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

Back to the top