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:

Model:
	greetings+=Greeting*;
	
Greeting:
	'$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(SWT.java:4263)
	at org.eclipse.swt.SWT.error(SWT.java:4197)
	at org.eclipse.swt.SWT.error(SWT.java:4168)
	at org.eclipse.swt.custom.StyledText.setStyleRanges(StyledText.java:9661)
	at org.eclipse.swt.custom.StyledText.replaceStyleRanges(StyledText.java:7713)
	at org.eclipse.jface.text.TextViewer.addPresentation(TextViewer.java:4811)
	at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4890)
	at org.eclipse.jface.text.presentation.PresentationReconciler.applyTextRegionCollection(PresentationReconciler.java:579)
	at org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:568)
	at org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:564)
	at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.textChanged(PresentationReconciler.java:225)
	at org.eclipse.xtext.ui.editor.XtextSourceViewer.updateTextListeners(XtextSourceViewer.java:112)
	at org.eclipse.jface.text.TextViewer.invalidateTextPresentation(TextViewer.java:3467)
	at org.eclipse.jface.text.source.AnnotationPainter.invalidateTextPresentation(AnnotationPainter.java:962)
	at org.eclipse.jface.text.source.AnnotationPainter.updatePainting(AnnotationPainter.java:944)
	at org.eclipse.jface.text.source.AnnotationPainter.access$1(AnnotationPainter.java:938)
	at org.eclipse.jface.text.source.AnnotationPainter$1.run(AnnotationPainter.java:1077)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	... 23 more


Looking in Bugzilla I found the bug 339779 (hxxps://bugs.eclipse.org/bugs/show_bug.cgi?id=339779) 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: 14665
Registered: July 2009
Senior Member
Hi,

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 http://download.itemis.com/distros/eclipsecon2012)
if you can reproduce it with 2.3.0M6 please file a ticket.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
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.
Thanks.
Massimo.
Previous Topic:cross referencing resource contents of another language
Next Topic:Providing context values for the Xbase interpreter
Goto Forum:
  


Current Time: Fri Apr 26 12:07:42 GMT 2024

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

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

Back to the top