Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Possible bug due to keywords with "special" chars
icon5.gif  Possible bug due to keywords with "special" chars [message #852165] Sat, 21 April 2012 18:50 Go to next message
Massimo Rabbi is currently offline Massimo RabbiFriend
Messages: 29
Registered: November 2010
Location: Padova
Junior Member
Hi all,
during tests with my grammar I've found a strange behavior and what I think it could be a bug.
Let's take also the sample Xtext grammar for "Hello World!".
It is enough to create a new xtext project and then modify the grammar a little bit:

	'$Hello' name=ID '!';

As you can see I've modified the keyword 'Hello' into '$Hello' but you can use for example another "special" char like for example & (ampersand).

Now after grammar generation, launch the runtime to test-it.
If you create a new file and start typing the keyword after digiting $, when you press enter H character an exception is thrown in the original workspace console. However, you can see it also opening the problems view in the runtime workspace.

This is a part of the exception.
Caused by: java.lang.IllegalArgumentException: Index out of bounds
	at org.eclipse.swt.SWT.error(
	at org.eclipse.swt.SWT.error(
	at org.eclipse.swt.SWT.error(
	at org.eclipse.swt.custom.StyledText.setStyleRanges(
	at org.eclipse.swt.custom.StyledText.replaceStyleRanges(
	at org.eclipse.jface.text.TextViewer.addPresentation(
	at org.eclipse.jface.text.TextViewer.changeTextPresentation(
	at org.eclipse.jface.text.presentation.PresentationReconciler.applyTextRegionCollection(
	at org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(
	at org.eclipse.jface.text.presentation.PresentationReconciler.access$3(
	at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.textChanged(
	at org.eclipse.xtext.ui.editor.XtextSourceViewer.updateTextListeners(
	at org.eclipse.jface.text.TextViewer.invalidateTextPresentation(
	at org.eclipse.jface.text.source.AnnotationPainter.invalidateTextPresentation(
	at org.eclipse.jface.text.source.AnnotationPainter.updatePainting(
	at org.eclipse.jface.text.source.AnnotationPainter.access$1(
	at org.eclipse.jface.text.source.AnnotationPainter$
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(
	... 23 more

Looking in Bugzilla I found the bug 339779 (hxxps:// that was marked as CLOSED WORKFORME.
The scenario is not the same, however the error is pretty similar.

Additional details
- it occurs on both MacOSX 10.7.3 and Windows 7 64bit. The actual version of Xtext installed is 2.2.1.
- a "dirty" trick to solve this problem is to split the keyword so '$Hello' becomes '$' 'Hello', the exception in this case is not raised.

Someone else has ever verified a similar problem?
Re: Possible bug due to keywords with "special" chars [message #852187 is a reply to message #852165] Sat, 21 April 2012 19:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13488
Registered: July 2009
Senior Member

i can reproduce this problem in 2.2.1
i cannot reproduce it in 2.3.0M6
could you try 2.3.0M6 too?
(milestone update site or
if you can reproduce it with 2.3.0M6 please file a ticket.


Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Re: Possible bug due to keywords with "special" chars [message #852895 is a reply to message #852187] Sun, 22 April 2012 12:51 Go to previous message
Massimo Rabbi is currently offline Massimo RabbiFriend
Messages: 29
Registered: November 2010
Location: Padova
Junior Member
Hi Christian,
thanks for the reply.
Just tested on my Win7 notebook with both Eclipse Indigo 3.7.2 (Xtext 2.3M6) and EclipseCon package.
As you said I was not able to reproduce it.

I suppose the problem has been fixed in the meanwhile.
Previous Topic:cross referencing resource contents of another language
Next Topic:Providing context values for the Xbase interpreter
Goto Forum:

Current Time: Mon Jul 06 21:42:17 GMT 2020

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

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

Back to the top