Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [TCS] Eclipse Freeze
[TCS] Eclipse Freeze [message #12260] Thu, 17 April 2008 07:40 Go to next message
Eclipse UserFriend
Originally posted by: romain.perruchon.thalesgroup.com

Hi,

In some situation, my eclipse freeze when I launch my sample language
(with the TGE). I noticed that it appear when I have an error in my tcs
and it compiled nevertheless (no error mark with the TGE).

This time, my eclipse freeze again but I don't find error in my tcs, here
is my files :

------------------------------------------------
CSV_generic.km3

-- @name CSV_generic
-- @version 0.1
-- @authors ${romain perruchon}
-- @date ${13/03/2008}
-- @description ${description}

package CSV_generic {

class CSV_generic {
reference ligne [*] ordered container : Ligne;
}

class Ligne {
reference colonne[*] ordered container : Element;
}

abstract class Element {}

class NamedElement extends Element {
attribute name : String;
}

class EmptyElement extends Element {}
}

package PrimitiveTypes {
datatype String;
}

------------------------------------------------
CSV_generic.tcs

-- @name CSV_generic
-- @version 0.1
-- @authors ${romain perruchon}
-- @date ${13/03/2008}
-- @description ${description}


syntax CSV_generic {
primitiveTemplate string for String default using STRING:
value = "%token%";

template CSV_generic main
: ligne <newline>
;

template Ligne main
: colonne
;

template Element abstract;

template NamedElement
: name ";"
;

template EmptyElement
: ";"
;

token COMMENT : endOfLine(start = "--");

-- BEGIN Lexer
lexer = "
%options testLiterals = false;

NL
: ( '\\r' '\\n' | '\\n' '\\r' | '\\r' |
'\\n' ) {newline();}
;

WS
: ( ' ' | '\\t' )
;

STRING
:
(
~(';' |'\\\\'|'\\''|'\\n')
)*
;

";
}

and my language sample : Test1.csv

Environnement;Domaine;serveur;Nom node;Port
SS;AAA3B;111.22.3.444;XXXX-YYYy-ZZ3Z-AAAAA;7777
SS;AAA3B;111.22.3.444;XXXX-YYYy-ZZ3Z-AAAAA;8888
;;111.22.3.444;XXXX-YYYy-ZZ3Z-BB;9999

Thanks
Re: [TCS] Eclipse Freeze [message #12271 is a reply to message #12260] Thu, 17 April 2008 11:33 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hi,

In your metamodel, a Ligne may have no Colonne.

In your TCS model, the textual representation of an empty Ligne is
"epsilon" (i.e., an empty string).

Therefore, the generated grammar is ambiguous. You should see ANTLR
warnings on the grammar file, stating that some alternatives have been
disabled for some inputs. In this case, the "end of list" alternative
for input "EOF" (End Of File) is disabled, making the parser loop
infinitely.

The simplest solution is to change the multiplicity of reference colonne
from [*] to [1-*].


Regards,

Frédéric Jouault


romain Perruchon a écrit :
> Hi,
>
> In some situation, my eclipse freeze when I launch my sample language
> (with the TGE). I noticed that it appear when I have an error in my tcs
> and it compiled nevertheless (no error mark with the TGE).
>
> This time, my eclipse freeze again but I don't find error in my tcs,
> here is my files :
>
> ------------------------------------------------
> CSV_generic.km3
>
> -- @name CSV_generic
> -- @version 0.1
> -- @authors ${romain perruchon}
> -- @date ${13/03/2008}
> -- @description ${description}
>
> package CSV_generic {
>
> class CSV_generic {
> reference ligne [*] ordered container : Ligne;
> }
>
> class Ligne {
> reference colonne[*] ordered container : Element;
> }
>
> abstract class Element {}
>
> class NamedElement extends Element {
> attribute name : String;
> }
>
> class EmptyElement extends Element {}
> }
>
> package PrimitiveTypes {
> datatype String;
> }
>
> ------------------------------------------------
> CSV_generic.tcs
>
> -- @name CSV_generic
> -- @version 0.1
> -- @authors ${romain perruchon}
> -- @date ${13/03/2008}
> -- @description ${description}
>
>
> syntax CSV_generic {
> primitiveTemplate string for String default using STRING:
> value = "%token%";
>
> template CSV_generic main
> : ligne <newline>
> ;
>
> template Ligne main
> : colonne
> ;
>
> template Element abstract;
>
> template NamedElement
> : name ";"
> ;
>
> template EmptyElement
> : ";"
> ;
>
> token COMMENT : endOfLine(start = "--");
>
> -- BEGIN Lexer
> lexer = "
> %options testLiterals = false;
>
> NL
> : ( '\\r' '\\n' | '\\n' '\\r' | '\\r' |
> '\\n' ) {newline();}
> ;
>
> WS
> : ( ' ' | '\\t' )
> ;
>
> STRING
> :
> (
> ~(';' |'\\\\'|'\\''|'\\n')
> )*
> ;
>
> ";
> }
>
> and my language sample : Test1.csv
>
> Environnement;Domaine;serveur;Nom node;Port
> SS;AAA3B;111.22.3.444;XXXX-YYYy-ZZ3Z-AAAAA;7777
> SS;AAA3B;111.22.3.444;XXXX-YYYy-ZZ3Z-AAAAA;8888
> ;;111.22.3.444;XXXX-YYYy-ZZ3Z-BB;9999
>
> Thanks
>
Re: [TCS] Eclipse Freeze [message #12325 is a reply to message #12271] Fri, 18 April 2008 08:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: romain.perruchon.thalesgroup.com

Hi,

Thanks for answer, I already change [*] to [1-*] yersterday and I always
have a problem but this time I know why : in my sample language I have to
add ";" at the end of each line to have no freeze.

In fact, my grammar is define like this :

template NamedElement
: name ";"
;

template EmptyElement
: ";"
;

How to define my elements without ";" after name ?

My sample language :

Environnement;Domaine;serveur;Nom node;Port
SS;AAA3B;111.22.3.444;XXXX-YYYy-ZZ3Z-AAAAA;7777
SS;AAA3B;111.22.3.444;XXXX-YYYy-ZZ3Z-AAAAA;8888
;;111.22.3.444;XXXX-YYYy-ZZ3Z-BB;9999
;;111.22.3.444;;9999

I can't do ";" name because of the first element of each line and I can't
use {separator ";"} because of EmptyElement.

I also have a problem with my definition of lines :
template CSV_generic main
: ligne <newline>
;

don't work like I would and I don't know why, if I add a ";" at the end of
each lines of my sample language to work with my actual definition, The
outline recognize one line, like this :
CSV_generic
-> Ligne
-> NamedElement
[...]
-> NamedElement

Only one line instead of five.

Thanks for the help
Re: [TCS] Eclipse Freeze [message #12334 is a reply to message #12325] Fri, 18 April 2008 15:40 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hi,

Your problem is that you need to consider the newline as the separator
between lines.

This may be possible with the current version of TCS, although some
small changes are probably required to make it simpler.

I am going to work on an example, please stay tuned (and ask again in a
few days if nothing comes ;-)).


Regards,

Frédéric Jouault


romain Perruchon a écrit :
> Hi,
>
> Thanks for answer, I already change [*] to [1-*] yersterday and I always
> have a problem but this time I know why : in my sample language I have
> to add ";" at the end of each line to have no freeze.
>
> In fact, my grammar is define like this :
>
> template NamedElement
> : name ";"
> ;
>
> template EmptyElement
> : ";"
> ;
>
> How to define my elements without ";" after name ?
>
> My sample language :
>
> Environnement;Domaine;serveur;Nom node;Port
> SS;AAA3B;111.22.3.444;XXXX-YYYy-ZZ3Z-AAAAA;7777
> SS;AAA3B;111.22.3.444;XXXX-YYYy-ZZ3Z-AAAAA;8888
> ;;111.22.3.444;XXXX-YYYy-ZZ3Z-BB;9999
> ;;111.22.3.444;;9999
>
> I can't do ";" name because of the first element of each line and I
> can't use {separator ";"} because of EmptyElement.
>
> I also have a problem with my definition of lines :
> template CSV_generic main
> : ligne <newline>
> ;
>
> don't work like I would and I don't know why, if I add a ";" at the end
> of each lines of my sample language to work with my actual definition,
> The outline recognize one line, like this :
> CSV_generic
> -> Ligne
> -> NamedElement
> [...]
> -> NamedElement
>
> Only one line instead of five.
>
> Thanks for the help
>
Re: [TCS] Eclipse Freeze [message #14429 is a reply to message #12334] Mon, 05 May 2008 08:31 Go to previous message
Eclipse UserFriend
Originally posted by: romain.perruchon.thalesgroup.com

I ask again as expected

Thanks
Previous Topic:Re: [TCS] Problem with running TCS
Next Topic:[TCS] problem XML2
Goto Forum:
  


Current Time: Thu Jan 02 12:57:05 GMT 2025

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

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

Back to the top