Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » importURI strange problems(importURI, quotes)
icon9.gif  importURI strange problems [message #876435] Thu, 24 May 2012 15:35 Go to next message
Vil Lpz is currently offline Vil LpzFriend
Messages: 24
Registered: April 2012
Junior Member

I have long time with this and not understand the error ...

This works:

grammar pruebas.MyDsl 

ScxmlStateType  hidden(WS):

		( 'id=' name = ID
		& ('src=' importURI = LocalUrl)?
		& ('initial=' initial1 = [ScxmlStateType | ID])? ) //state
	scxmlStateMix = ScxmlStateMix	

	('/>') |
		( state += ScxmlStateType* 
		& transition += ScxmlTransitionType* )


		 ('target=' target = [ScxmlStateType | ID])? // state

	('../')? ID (('/' | '../') ID )* ('.' ID)?

 	QUOTE_V1 LocalUrl QUOTE_V1
 	//| QUOTE_V2 LocalUrl QUOTE_V2	

terminal QUOTE_V1:

terminal QUOTE_V2:

terminal ID: 
	('a'..'z'|'A'..'Z'|'_'|'-') ('a'..'z'|'A'..'Z'|'_'|'-'|'0'..'9')*

terminal WS: 
	(' '|'\t'|'\r'|'\n')+

I can reference states in another files which indicated by state src attribute...

<state id=x1 [b]src=y.test[/b]>  

	<state id=x2>
		<transition target=y2 />   

<state	id=y1>   
	<state id=y2>
		<transition target=y1 />

But if instead of
'src=' importURI = LocalUrl

'src=' importURI = LocalUrlDataType

That is, the same thing with quotes. It does not work. And I do not understand why.

Someone can help me?

Thank you.

A greeting.

[Updated on: Thu, 24 May 2012 15:36]

Report message to a moderator

Re: importURI strange problems [message #876490 is a reply to message #876435] Thu, 24 May 2012 17:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
Hi did you provide a value converter rule for the quoted URL as Xtext
does for strings?

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Re: importURI strange problems [message #876829 is a reply to message #876490] Fri, 25 May 2012 10:52 Go to previous message
Vil Lpz is currently offline Vil LpzFriend
Messages: 24
Registered: April 2012
Junior Member

I have a few time with XText and I donĀ“t known I had to do this ...

This is my solution, for if it could be useful to someone in the future. I was inspired by solution provided by pettergraff blog.

public class MyDslRuntimeModule extends pruebas.AbstractMyDslRuntimeModule {

    public Class<? extends IValueConverterService> bindIValueConverterService() {
        return LocalUrlDataTypeValueConverter.class;

public class LocalUrlDataTypeValueConverter extends DefaultTerminalConverters {
    @ValueConverter(rule = "LocalUrlDataType")
    public IValueConverter<String> LocalUrlDataType() {
        return new IValueConverter<String>() {
            public String toValue(String string, INode node) {
        		if (string == null)
        			return null;
        		try {
        			return Strings.convertFromJavaString(string.substring(1, string.length() - 1), true);
        		} catch (IllegalArgumentException e) {
        			throw new ValueConverterException(e.getMessage(), node, e);

            public String toString(String value) {
                return value;

Thank you very much.

a greeting
Previous Topic:Type Checking with JvmTypeParameter and JvmArgumentTypeReference
Next Topic:[Xtend 2.3 M6] Function1 cannot be used as parameter
Goto Forum:

Current Time: Thu Dec 03 08:44:22 GMT 2020

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

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

Back to the top