Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Validating a Keyword(custom warnings)
Validating a Keyword [message #1740676] Wed, 17 August 2016 03:51 Go to next message
Eclipse UserFriend
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 14:30 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Validating a Keyword [message #1741111 is a reply to message #1740718] Tue, 23 August 2016 03:48 Go to previous message
Eclipse UserFriend
ThankYou Smile
Previous Topic:RuntimeException: Cannot root twice
Next Topic:How to add xtext sdk with eclipse plugin?
Goto Forum:
  


Current Time: Mon Jul 14 01:59:01 EDT 2025

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

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

Back to the top