Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Customizing error messages
Customizing error messages [message #893886] Thu, 05 July 2012 20:16 Go to next message
Prajeet Missing name is currently offline Prajeet Missing nameFriend
Messages: 14
Registered: November 2010
Location: B'Lore
Junior Member
Can anyone tell me how to show meaningful parser messages to the user? I want to know how it is done.

Thank you
Re: Customizing error messages [message #893896 is a reply to message #893886] Thu, 05 July 2012 21:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13469
Registered: July 2009
Senior Member
Hmmm,

i am not quite sure what kind of problem you are targeting, never the
less you may have a look at ISyntaxErrorMessageProvider

~Christian
--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@xxxxxxxx


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Customizing error messages [message #893913 is a reply to message #893896] Fri, 06 July 2012 02:38 Go to previous messageGo to next message
Prajeet Missing name is currently offline Prajeet Missing nameFriend
Messages: 14
Registered: November 2010
Location: B'Lore
Junior Member
By meaningful messages i mean that when the parser fails to parse a string of text according to the grammar rules, it shows a weird syntax error message like "no viable input after ..." or "Expecting Rule XYZ..." stuff like that.

I wanted to customize them so that i can provide meaningful messages to the users.


In order to gain something, something of equal value must be sacrificed.
Re: Customizing error messages [message #893921 is a reply to message #893913] Fri, 06 July 2012 05:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13469
Registered: July 2009
Senior Member
Hi,

this is what ISyntaxErrorMessageProvideris for - unfortunately you
will have to do a lot of reverse engineering to do the mapping of the
default messages to your messages.

~Christian
--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@xxxxxxxx


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Customizing error messages [message #894212 is a reply to message #893921] Sat, 07 July 2012 17:18 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
It is better to have a lenient and forgiving grammar and instead do
custom validation, this way you get full control over errors/warnings
and can even control what to flag as errors/warnings via user properties
if you want to.

You may even want to go as far as supporting illegal constructs in the
grammar where such constructs are common user mistakes just for the sake
of providing better feedback. As an example, if string are delimited
only by " " and user enters a string with ' ' - you can then easily
write a check for that, and provide a quickfix. If instead the first
single quote triggered a syntax error, you would have a very hard time
in the "error message provider" to translate the syntax-error to
something meaningful, and it would also be quite hard to provide a quick
fix (how do you know that what follows may be a string in an alternate
illegal form?)

Just my 2c

Regards
- henrik

On 2012-06-07 7:15, Christian Dietrich wrote:
> Hi,
>
> this is what ISyntaxErrorMessageProvideris for - unfortunately you will
> have to do a lot of reverse engineering to do the mapping of the default
> messages to your messages.
>
> ~Christian
Previous Topic:Excluding files from an MWE2 workflow
Next Topic:Possible Unicode Bug - Greek Polytonic
Goto Forum:
  


Current Time: Sat Jun 06 05:55:40 GMT 2020

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

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

Back to the top