Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] TCS Injection problem in standalone Java application
[ATL] TCS Injection problem in standalone Java application [message #26828] Sat, 31 March 2007 10:40 Go to next message
Eclipse UserFriend
Originally posted by: milanmilanovich.yahooo.com

Hi all,

did anyone managed to implement TCS injection into some standalone Java
application (outside of Eclipse environment) ?

I think that there is some problem with TCS, because when I try to inject
files with TCS in Eclipse it works, but when I implemented injection into
standalone Java application I got some error while parsing input code,
like:

"Error: 1:1: unexpected token: context."

This is the case when context is first word in code that is parsed.

-- Best regards, Milan Milanovic
Re: [ATL] TCS Injection problem in standalone Java application [message #26868 is a reply to message #26828] Sat, 31 March 2007 17:23 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 Milan,

I have been using TCS injection from standalone Java applications for
quite some time. TCS injection even started working in this context
before it was ported to Eclipse.

Could you please be more specific about your problem?


Regards,

Frédéric Jouault


Milan Milanovic wrote:
> Hi all,
>
> did anyone managed to implement TCS injection into some standalone Java
> application (outside of Eclipse environment) ?
> I think that there is some problem with TCS, because when I try to
> inject files with TCS in Eclipse it works, but when I implemented
> injection into standalone Java application I got some error while
> parsing input code, like:
>
> "Error: 1:1: unexpected token: context."
>
> This is the case when context is first word in code that is parsed.
>
> -- Best regards, Milan Milanovic
>
Re: [ATL] TCS Injection problem in standalone Java application [message #26948 is a reply to message #26868] Sun, 01 April 2007 10:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: milan.milanovic.org

Hi Frédéric,

well, as I wrote there is no problem when I inject files in
Eclipse environment by using the Ant tasks, but when I tried
to implement this injection in standalone Java application, I
got an error that I already wrote.

I implemented this Java class very similar to KM3Projector.

Could you send me some other code examples for EBNF injection
in standalone Java app or post it here ?

-- Best regards, Milan Milanovic

Frédéric Jouault wrote:

> Hi Milan,

> I have been using TCS injection from standalone Java applications for
> quite some time. TCS injection even started working in this context
> before it was ported to Eclipse.

> Could you please be more specific about your problem?


> Regards,

> Frédéric Jouault


> Milan Milanovic wrote:
>> Hi all,
>>
>> did anyone managed to implement TCS injection into some standalone Java
>> application (outside of Eclipse environment) ?
>> I think that there is some problem with TCS, because when I try to
>> inject files with TCS in Eclipse it works, but when I implemented
>> injection into standalone Java application I got some error while
>> parsing input code, like:
>>
>> "Error: 1:1: unexpected token: context."
>>
>> This is the case when context is first word in code that is parsed.
>>
>> -- Best regards, Milan Milanovic
>>
Re: [ATL] TCS Injection problem in standalone Java application - detailed! [message #27027 is a reply to message #26868] Sun, 01 April 2007 11:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: milan.milanovic.org

Hi Frédéric,

here is an example from my method (with error explanation) that I'm using
for injection:

//...An excerpt from getOCLFromFile() method {

URL oclmmurl = ATLTransformations.class.getResource("OCL/OCL.ecore");
ASMModel oclEMFmm = emfamh.loadModel("OCL", emfamh.getMof(),
oclmmurl.openStream());

ASMModel ret = emfamh.newModel("IN", oclEMFmm);

EBNFInjector2 ebnfi = new EBNFInjector2();
InputStream in = null;

try {
in = new FileInputStream(inputFile);

Class lexer = OCLLexer.class;
Class parser = OCLParser.class;

ebnfi.performImportation(oclEMFmm, ret, in, "OCL", lexer, parser);

// And in line above I got an error that is written in command line:
// "Error: 1:1: unexpected token: context."
//
// For input file (test.ocl):
//
// context CustomerCard::printedName : String
// derive: owner.title.concat(' ').concat(owner.name)

} catch(Exception e) {
e.printStackTrace();
}

return ret;

} // End of getOCLFromFile() method

Any hint will be great !

-- Thanks, Milan Milanovic


Frédéric Jouault wrote:

> Hi Milan,

> I have been using TCS injection from standalone Java applications for
> quite some time. TCS injection even started working in this context
> before it was ported to Eclipse.

> Could you please be more specific about your problem?


> Regards,

> Frédéric Jouault


> Milan Milanovic wrote:
>> Hi all,
>>
>> did anyone managed to implement TCS injection into some standalone Java
>> application (outside of Eclipse environment) ?
>> I think that there is some problem with TCS, because when I try to
>> inject files with TCS in Eclipse it works, but when I implemented
>> injection into standalone Java application I got some error while
>> parsing input code, like:
>>
>> "Error: 1:1: unexpected token: context."
>>
>> This is the case when context is first word in code that is parsed.
>>
>> -- Best regards, Milan Milanovic
>>
Re: [ATL] TCS Injection problem in standalone Java application [message #27067 is a reply to message #26948] Sun, 01 April 2007 15:21 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 Milan,

To use TCS injection from a command line, I generally use the
ModelLoader class:
http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt /ATL/org.atl.engine.vm/src/org/atl/engine/vm/ModelLoader.jav a?revision=1.4&view=markup


Regards,

Frédéric Jouault

Milan Milanovic wrote:
> Hi Frédéric,
>
> well, as I wrote there is no problem when I inject files in
> Eclipse environment by using the Ant tasks, but when I tried
> to implement this injection in standalone Java application, I got an
> error that I already wrote.
>
> I implemented this Java class very similar to KM3Projector.
>
> Could you send me some other code examples for EBNF injection in
> standalone Java app or post it here ?
>
> -- Best regards, Milan Milanovic
>
> Frédéric Jouault wrote:
>
>> Hi Milan,
>
>> I have been using TCS injection from standalone Java applications for
>> quite some time. TCS injection even started working in this context
>> before it was ported to Eclipse.
>
>> Could you please be more specific about your problem?
>
>
>> Regards,
>
>> Frédéric Jouault
>
>
>> Milan Milanovic wrote:
>>> Hi all,
>>>
>>> did anyone managed to implement TCS injection into some standalone
>>> Java application (outside of Eclipse environment) ?
>>> I think that there is some problem with TCS, because when I try to
>>> inject files with TCS in Eclipse it works, but when I implemented
>>> injection into standalone Java application I got some error while
>>> parsing input code, like:
>>>
>>> "Error: 1:1: unexpected token: context."
>>>
>>> This is the case when context is first word in code that is parsed.
>>>
>>> -- Best regards, Milan Milanovic
>>>
>
>
Re: [ATL] TCS Injection problem in standalone Java application - detailed! [message #27107 is a reply to message #27027] Sun, 01 April 2007 15:24 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 Milan,

The error message you get seems to mean that the file you are trying to
parse does not conform to the grammar that is used to parse. This could
be because of the way the parser is invoked.

Could you try to use the inject method on EBNFInjector2 instead of
performImportation?


Regards,

Frédéric Jouault

Milan Milanovic wrote:
> Hi Frédéric,
>
> here is an example from my method (with error explanation) that I'm
> using for injection:
>
> //...An excerpt from getOCLFromFile() method {
>
> URL oclmmurl = ATLTransformations.class.getResource("OCL/OCL.ecore");
> ASMModel oclEMFmm = emfamh.loadModel("OCL", emfamh.getMof(),
> oclmmurl.openStream());
>
> ASMModel ret = emfamh.newModel("IN", oclEMFmm);
>
> EBNFInjector2 ebnfi = new EBNFInjector2();
> InputStream in = null;
>
> try {
> in = new FileInputStream(inputFile);
>
> Class lexer = OCLLexer.class;
> Class parser = OCLParser.class;
>
> ebnfi.performImportation(oclEMFmm, ret, in, "OCL", lexer, parser);
>
> // And in line above I got an error that is written in command line:
> // "Error: 1:1: unexpected token: context."
> //
> // For input file (test.ocl): //
> // context CustomerCard::printedName : String
> // derive: owner.title.concat(' ').concat(owner.name)
>
> } catch(Exception e) {
> e.printStackTrace();
> }
>
> return ret;
>
> } // End of getOCLFromFile() method
>
> Any hint will be great !
>
> -- Thanks, Milan Milanovic
>
>
> Frédéric Jouault wrote:
>
>> Hi Milan,
>
>> I have been using TCS injection from standalone Java applications for
>> quite some time. TCS injection even started working in this context
>> before it was ported to Eclipse.
>
>> Could you please be more specific about your problem?
>
>
>> Regards,
>
>> Frédéric Jouault
>
>
>> Milan Milanovic wrote:
>>> Hi all,
>>>
>>> did anyone managed to implement TCS injection into some standalone
>>> Java application (outside of Eclipse environment) ?
>>> I think that there is some problem with TCS, because when I try to
>>> inject files with TCS in Eclipse it works, but when I implemented
>>> injection into standalone Java application I got some error while
>>> parsing input code, like:
>>>
>>> "Error: 1:1: unexpected token: context."
>>>
>>> This is the case when context is first word in code that is parsed.
>>>
>>> -- Best regards, Milan Milanovic
>>>
>
>
Re: [ATL] TCS Injection problem in standalone Java application - detailed! [message #27147 is a reply to message #27107] Mon, 02 April 2007 10:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: milan.milanovic.org

Hi Frédéric,

thank you on replying.

Yes, it could be because of way the parser is invoked.

Please, could you send to me (or post here) an example of using
inject method in EBNFInjector2 and of ModelLoader class from your
previous post ?

--
Thank you in advance, Milan Milanovic

Frédéric Jouault wrote:

> Hi Milan,

> The error message you get seems to mean that the file you are trying to
> parse does not conform to the grammar that is used to parse. This could
> be because of the way the parser is invoked.

> Could you try to use the inject method on EBNFInjector2 instead of
> performImportation?


> Regards,

> Frédéric Jouault

> Milan Milanovic wrote:
>> Hi Frédéric,
>>
>> here is an example from my method (with error explanation) that I'm
>> using for injection:
>>
>> //...An excerpt from getOCLFromFile() method {
>>
>> URL oclmmurl = ATLTransformations.class.getResource("OCL/OCL.ecore");
>> ASMModel oclEMFmm = emfamh.loadModel("OCL", emfamh.getMof(),
>> oclmmurl.openStream());
>>
>> ASMModel ret = emfamh.newModel("IN", oclEMFmm);
>>
>> EBNFInjector2 ebnfi = new EBNFInjector2();
>> InputStream in = null;
>>
>> try {
>> in = new FileInputStream(inputFile);
>>
>> Class lexer = OCLLexer.class;
>> Class parser = OCLParser.class;
>>
>> ebnfi.performImportation(oclEMFmm, ret, in, "OCL", lexer, parser);
>>
>> // And in line above I got an error that is written in command line:
>> // "Error: 1:1: unexpected token: context."
>> //
>> // For input file (test.ocl): //
>> // context CustomerCard::printedName : String
>> // derive: owner.title.concat(' ').concat(owner.name)
>>
>> } catch(Exception e) {
>> e.printStackTrace();
>> }
>>
>> return ret;
>>
>> } // End of getOCLFromFile() method
>>
>> Any hint will be great !
>>
>> -- Thanks, Milan Milanovic
>>
>>
>> Frédéric Jouault wrote:
>>
>>> Hi Milan,
>>
>>> I have been using TCS injection from standalone Java applications for
>>> quite some time. TCS injection even started working in this context
>>> before it was ported to Eclipse.
>>
>>> Could you please be more specific about your problem?
>>
>>
>>> Regards,
>>
>>> Frédéric Jouault
>>
>>
>>> Milan Milanovic wrote:
>>>> Hi all,
>>>>
>>>> did anyone managed to implement TCS injection into some standalone
>>>> Java application (outside of Eclipse environment) ?
>>>> I think that there is some problem with TCS, because when I try to
>>>> inject files with TCS in Eclipse it works, but when I implemented
>>>> injection into standalone Java application I got some error while
>>>> parsing input code, like:
>>>>
>>>> "Error: 1:1: unexpected token: context."
>>>>
>>>> This is the case when context is first word in code that is parsed.
>>>>
>>>> -- Best regards, Milan Milanovic
>>>>
>>
>>
Re: [ATL] TCS Injection problem in standalone Java application - detailed! [message #27783 is a reply to message #27147] Mon, 02 April 2007 15:18 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 Milan,

I prefer not to post any example of ModelLoader usage here (although
there are some in the CVS as well) because it is obsolete.

However, the ModelLoader class uses the inject method of interface
Injector, which is implemented by EBNFInjector2, and can be used as an
example of usage of this method:
http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt /ATL/org.atl.engine.vm/src/org/atl/engine/vm/ModelLoader.jav a?revision=1.4&view=markup


Best regards,

Frédéric Jouault


Milan Milanovic wrote:
> Hi Frédéric,
>
> thank you on replying.
>
> Yes, it could be because of way the parser is invoked.
>
> Please, could you send to me (or post here) an example of using
> inject method in EBNFInjector2 and of ModelLoader class from your
> previous post ?
>
> --
> Thank you in advance, Milan Milanovic
>
> Frédéric Jouault wrote:
>
>> Hi Milan,
>
>> The error message you get seems to mean that the file you are trying
>> to parse does not conform to the grammar that is used to parse. This
>> could be because of the way the parser is invoked.
>
>> Could you try to use the inject method on EBNFInjector2 instead of
>> performImportation?
>
>
>> Regards,
>
>> Frédéric Jouault
>
>> Milan Milanovic wrote:
>>> Hi Frédéric,
>>>
>>> here is an example from my method (with error explanation) that I'm
>>> using for injection:
>>>
>>> //...An excerpt from getOCLFromFile() method {
>>>
>>> URL oclmmurl = ATLTransformations.class.getResource("OCL/OCL.ecore");
>>> ASMModel oclEMFmm = emfamh.loadModel("OCL", emfamh.getMof(),
>>> oclmmurl.openStream());
>>>
>>> ASMModel ret = emfamh.newModel("IN", oclEMFmm);
>>>
>>> EBNFInjector2 ebnfi = new EBNFInjector2();
>>> InputStream in = null;
>>>
>>> try {
>>> in = new FileInputStream(inputFile);
>>>
>>> Class lexer = OCLLexer.class;
>>> Class parser = OCLParser.class;
>>>
>>> ebnfi.performImportation(oclEMFmm, ret, in, "OCL", lexer, parser);
>>>
>>> // And in line above I got an error that is written in command line:
>>> // "Error: 1:1: unexpected token: context."
>>> //
>>> // For input file (test.ocl): //
>>> // context CustomerCard::printedName : String
>>> // derive: owner.title.concat(' ').concat(owner.name)
>>>
>>> } catch(Exception e) {
>>> e.printStackTrace();
>>> }
>>>
>>> return ret;
>>>
>>> } // End of getOCLFromFile() method
>>>
>>> Any hint will be great !
>>>
>>> -- Thanks, Milan Milanovic
>>>
>>>
>>> Frédéric Jouault wrote:
>>>
>>>> Hi Milan,
>>>
>>>> I have been using TCS injection from standalone Java applications
>>>> for quite some time. TCS injection even started working in this
>>>> context before it was ported to Eclipse.
>>>
>>>> Could you please be more specific about your problem?
>>>
>>>
>>>> Regards,
>>>
>>>> Frédéric Jouault
>>>
>>>
>>>> Milan Milanovic wrote:
>>>>> Hi all,
>>>>>
>>>>> did anyone managed to implement TCS injection into some standalone
>>>>> Java application (outside of Eclipse environment) ?
>>>>> I think that there is some problem with TCS, because when I try to
>>>>> inject files with TCS in Eclipse it works, but when I implemented
>>>>> injection into standalone Java application I got some error while
>>>>> parsing input code, like:
>>>>>
>>>>> "Error: 1:1: unexpected token: context."
>>>>>
>>>>> This is the case when context is first word in code that is parsed.
>>>>>
>>>>> -- Best regards, Milan Milanovic
>>>>>
>>>
>>>
>
>
Re: [ATL] TCS Injection problem in standalone Java application - detailed! [message #27863 is a reply to message #27783] Mon, 02 April 2007 16:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: milanmilanovich.yahooo.com

Hi Frédéric,

thank you on this link.

Yes, I see how it is used:

root = inj.inject(ret, in, paramsMap);

There is return model, input stream and params Map, but I can't see
from this example how this paramsMap should be defined for EBNF injection ?

--
Best regards, Milan Milanovic

Frédéric Jouault wrote:

> Hi Milan,

> I prefer not to post any example of ModelLoader usage here (although
> there are some in the CVS as well) because it is obsolete.

> However, the ModelLoader class uses the inject method of interface
> Injector, which is implemented by EBNFInjector2, and can be used as an
> example of usage of this method:
>
http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt /ATL/org.atl.engine.vm/src/org/atl/engine/vm/ModelLoader.jav a?revision=1.4&view=markup


> Best regards,

> Frédéric Jouault


> Milan Milanovic wrote:
>> Hi Frédéric,
>>
>> thank you on replying.
>>
>> Yes, it could be because of way the parser is invoked.
>>
>> Please, could you send to me (or post here) an example of using
>> inject method in EBNFInjector2 and of ModelLoader class from your
>> previous post ?
>>
>> --
>> Thank you in advance, Milan Milanovic
>>
>> Frédéric Jouault wrote:
>>
>>> Hi Milan,
>>
>>> The error message you get seems to mean that the file you are trying
>>> to parse does not conform to the grammar that is used to parse. This
>>> could be because of the way the parser is invoked.
>>
>>> Could you try to use the inject method on EBNFInjector2 instead of
>>> performImportation?
>>
>>
>>> Regards,
>>
>>> Frédéric Jouault
>>
>>> Milan Milanovic wrote:
>>>> Hi Frédéric,
>>>>
>>>> here is an example from my method (with error explanation) that I'm
>>>> using for injection:
>>>>
>>>> //...An excerpt from getOCLFromFile() method {
>>>>
>>>> URL oclmmurl = ATLTransformations.class.getResource("OCL/OCL.ecore");
>>>> ASMModel oclEMFmm = emfamh.loadModel("OCL", emfamh.getMof(),
>>>> oclmmurl.openStream());
>>>>
>>>> ASMModel ret = emfamh.newModel("IN", oclEMFmm);
>>>>
>>>> EBNFInjector2 ebnfi = new EBNFInjector2();
>>>> InputStream in = null;
>>>>
>>>> try {
>>>> in = new FileInputStream(inputFile);
>>>>
>>>> Class lexer = OCLLexer.class;
>>>> Class parser = OCLParser.class;
>>>>
>>>> ebnfi.performImportation(oclEMFmm, ret, in, "OCL", lexer, parser);
>>>>
>>>> // And in line above I got an error that is written in command line:
>>>> // "Error: 1:1: unexpected token: context."
>>>> //
>>>> // For input file (test.ocl): //
>>>> // context CustomerCard::printedName : String
>>>> // derive: owner.title.concat(' ').concat(owner.name)
>>>>
>>>> } catch(Exception e) {
>>>> e.printStackTrace();
>>>> }
>>>>
>>>> return ret;
>>>>
>>>> } // End of getOCLFromFile() method
>>>>
>>>> Any hint will be great !
>>>>
>>>> -- Thanks, Milan Milanovic
>>>>
>>>>
>>>> Frédéric Jouault wrote:
>>>>
>>>>> Hi Milan,
>>>>
>>>>> I have been using TCS injection from standalone Java applications
>>>>> for quite some time. TCS injection even started working in this
>>>>> context before it was ported to Eclipse.
>>>>
>>>>> Could you please be more specific about your problem?
>>>>
>>>>
>>>>> Regards,
>>>>
>>>>> Frédéric Jouault
>>>>
>>>>
>>>>> Milan Milanovic wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> did anyone managed to implement TCS injection into some standalone
>>>>>> Java application (outside of Eclipse environment) ?
>>>>>> I think that there is some problem with TCS, because when I try to
>>>>>> inject files with TCS in Eclipse it works, but when I implemented
>>>>>> injection into standalone Java application I got some error while
>>>>>> parsing input code, like:
>>>>>>
>>>>>> "Error: 1:1: unexpected token: context."
>>>>>>
>>>>>> This is the case when context is first word in code that is parsed.
>>>>>>
>>>>>> -- Best regards, Milan Milanovic
>>>>>>
>>>>
>>>>
>>
>>
Re: [ATL] TCS Injection problem in standalone Java application - detailed (2)! [message #27903 is a reply to message #27783] Mon, 02 April 2007 16:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: milanmilanovich.yahooo.com

Hi Frédéric,

is this wierd, when I give some wrong OCL code in the input file,
like: cont Test

it generates an error in command line:

Warning: 1:1-1:10: could not set location of IN!<notnamedyet>, disabling
further location settings.

Error: <unknown location>: Constraint with name = cont was not found for
ownedConstraint of OCL!OclModule.
Error: <unknown location>: Constraint with name = Test was not found for
ownedConstraint of OCL!OclModule.

I'm not sure what this exactly means, that my OclModule have
ownedConstraint
reference ?

This is not true, because my OclModule is defined like:

template OclModule main
: ownedElements
;

Any hint will be useful !

--

Best regards, Milan Milanovic

Frédéric Jouault wrote:

> Hi Milan,

> I prefer not to post any example of ModelLoader usage here (although
> there are some in the CVS as well) because it is obsolete.

> However, the ModelLoader class uses the inject method of interface
> Injector, which is implemented by EBNFInjector2, and can be used as an
> example of usage of this method:
>
http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt /ATL/org.atl.engine.vm/src/org/atl/engine/vm/ModelLoader.jav a?revision=1.4&view=markup


> Best regards,

> Frédéric Jouault


> Milan Milanovic wrote:
>> Hi Frédéric,
>>
>> thank you on replying.
>>
>> Yes, it could be because of way the parser is invoked.
>>
>> Please, could you send to me (or post here) an example of using
>> inject method in EBNFInjector2 and of ModelLoader class from your
>> previous post ?
>>
>> --
>> Thank you in advance, Milan Milanovic
>>
>> Frédéric Jouault wrote:
>>
>>> Hi Milan,
>>
>>> The error message you get seems to mean that the file you are trying
>>> to parse does not conform to the grammar that is used to parse. This
>>> could be because of the way the parser is invoked.
>>
>>> Could you try to use the inject method on EBNFInjector2 instead of
>>> performImportation?
>>
>>
>>> Regards,
>>
>>> Frédéric Jouault
>>
>>> Milan Milanovic wrote:
>>>> Hi Frédéric,
>>>>
>>>> here is an example from my method (with error explanation) that I'm
>>>> using for injection:
>>>>
>>>> //...An excerpt from getOCLFromFile() method {
>>>>
>>>> URL oclmmurl = ATLTransformations.class.getResource("OCL/OCL.ecore");
>>>> ASMModel oclEMFmm = emfamh.loadModel("OCL", emfamh.getMof(),
>>>> oclmmurl.openStream());
>>>>
>>>> ASMModel ret = emfamh.newModel("IN", oclEMFmm);
>>>>
>>>> EBNFInjector2 ebnfi = new EBNFInjector2();
>>>> InputStream in = null;
>>>>
>>>> try {
>>>> in = new FileInputStream(inputFile);
>>>>
>>>> Class lexer = OCLLexer.class;
>>>> Class parser = OCLParser.class;
>>>>
>>>> ebnfi.performImportation(oclEMFmm, ret, in, "OCL", lexer, parser);
>>>>
>>>> // And in line above I got an error that is written in command line:
>>>> // "Error: 1:1: unexpected token: context."
>>>> //
>>>> // For input file (test.ocl): //
>>>> // context CustomerCard::printedName : String
>>>> // derive: owner.title.concat(' ').concat(owner.name)
>>>>
>>>> } catch(Exception e) {
>>>> e.printStackTrace();
>>>> }
>>>>
>>>> return ret;
>>>>
>>>> } // End of getOCLFromFile() method
>>>>
>>>> Any hint will be great !
>>>>
>>>> -- Thanks, Milan Milanovic
>>>>
>>>>
>>>> Frédéric Jouault wrote:
>>>>
>>>>> Hi Milan,
>>>>
>>>>> I have been using TCS injection from standalone Java applications
>>>>> for quite some time. TCS injection even started working in this
>>>>> context before it was ported to Eclipse.
>>>>
>>>>> Could you please be more specific about your problem?
>>>>
>>>>
>>>>> Regards,
>>>>
>>>>> Frédéric Jouault
>>>>
>>>>
>>>>> Milan Milanovic wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> did anyone managed to implement TCS injection into some standalone
>>>>>> Java application (outside of Eclipse environment) ?
>>>>>> I think that there is some problem with TCS, because when I try to
>>>>>> inject files with TCS in Eclipse it works, but when I implemented
>>>>>> injection into standalone Java application I got some error while
>>>>>> parsing input code, like:
>>>>>>
>>>>>> "Error: 1:1: unexpected token: context."
>>>>>>
>>>>>> This is the case when context is first word in code that is parsed.
>>>>>>
>>>>>> -- Best regards, Milan Milanovic
>>>>>>
>>>>
>>>>
>>
>>
Re: [ATL] TCS Injection problem in standalone Java application - Solved ! [message #27983 is a reply to message #27903] Mon, 02 April 2007 17:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: milanmilanovich.yahooo.com

Hi Frédéric,

I solved this situation. It works perfectly with performImportation, but
problem was that old version of my OCL-ebnfinjector was also somewhere in
the classpath as my new version, and it referenced to old version.

Sorry.

--
Best regards, Milan Milanovic

Milan Milanovic wrote:

> Hi Frédéric,

> is this wierd, when I give some wrong OCL code in the input file,
> like: cont Test

> it generates an error in command line:

> Warning: 1:1-1:10: could not set location of IN!<notnamedyet>, disabling
> further location settings.

> Error: <unknown location>: Constraint with name = cont was not found for
> ownedConstraint of OCL!OclModule.
> Error: <unknown location>: Constraint with name = Test was not found for
> ownedConstraint of OCL!OclModule.

> I'm not sure what this exactly means, that my OclModule have
> ownedConstraint
> reference ?

> This is not true, because my OclModule is defined like:

> template OclModule main
> : ownedElements
> ;

> Any hint will be useful !
Re: [ATL] TCS Injection problem in standalone Java application - Solved ! [message #28023 is a reply to message #27983] Tue, 03 April 2007 00:51 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 Milan,

I am glad to see that you have solved your problem.

It seems that you were indeed (unwillingly) trying to parse a file that
did not conform to the grammar that was used to parse :-).


Note that if you want the symbol table errors to be reported with a
correct location (instead of <unknown location>) you need to have the
location attribute on each of your metamodel class.
You also need to do this if you want the outline of TGE to work properly.

This is typically achieved by having all classes directly or indirectly
extend:

abstract class LocatedElement {
attribute location[0-1] : String;
}

If you additionally want to keep the comments, you can add the following
attributes to class LocatedElement:

attribute commentsBefore[*] ordered : String;
attribute commentsAfter[*] ordered : String;

Future versions of TCS should use Model Weaving to decorate the injected
model with locations and comments without actually changing the model or
its metamodel.


Best regards,

Frédéric Jouault


Milan Milanovic wrote:
> Hi Frédéric,
>
> I solved this situation. It works perfectly with performImportation, but
> problem was that old version of my OCL-ebnfinjector was also somewhere
> in the classpath as my new version, and it referenced to old version.
>
> Sorry.
>
> --
> Best regards, Milan Milanovic
>
> Milan Milanovic wrote:
>
>> Hi Frédéric,
>
>> is this wierd, when I give some wrong OCL code in the input file,
>> like: cont Test
>
>> it generates an error in command line:
>
>> Warning: 1:1-1:10: could not set location of IN!<notnamedyet>,
>> disabling further location settings.
>
>> Error: <unknown location>: Constraint with name = cont was not found
>> for ownedConstraint of OCL!OclModule.
>> Error: <unknown location>: Constraint with name = Test was not found
>> for ownedConstraint of OCL!OclModule.
>
>> I'm not sure what this exactly means, that my OclModule have
>> ownedConstraint reference ?
>
>> This is not true, because my OclModule is defined like:
>
>> template OclModule main
>> : ownedElements
>> ;
>
>> Any hint will be useful !
>
>
>
Re: [ATL] TCS Injection problem in standalone Java application - Solved ! [message #28254 is a reply to message #28023] Tue, 03 April 2007 16:00 Go to previous message
Eclipse UserFriend
Originally posted by: milanmilanovich.yahooo.com

Hi Frédéric,

> I am glad to see that you have solved your problem.

> It seems that you were indeed (unwillingly) trying to parse a file that
> did not conform to the grammar that was used to parse :-).

Yes, you are right :-).

> Note that if you want the symbol table errors to be reported with a
> correct location (instead of <unknown location>) you need to have the
> location attribute on each of your metamodel class.
> You also need to do this if you want the outline of TGE to work properly.

> This is typically achieved by having all classes directly or indirectly
> extend:

> abstract class LocatedElement {
> attribute location[0-1] : String;
> }

> If you additionally want to keep the comments, you can add the following
> attributes to class LocatedElement:

> attribute commentsBefore[*] ordered : String;
> attribute commentsAfter[*] ordered : String;

> Future versions of TCS should use Model Weaving to decorate the injected
> model with locations and comments without actually changing the model or
> its metamodel.

O.K. Thank you on these informations.

--
Best regards, Milan Milanovic

Frédéric Jouault wrote:

> Hi Milan,

> I am glad to see that you have solved your problem.

> It seems that you were indeed (unwillingly) trying to parse a file that
> did not conform to the grammar that was used to parse :-).


> Note that if you want the symbol table errors to be reported with a
> correct location (instead of <unknown location>) you need to have the
> location attribute on each of your metamodel class.
> You also need to do this if you want the outline of TGE to work properly.

> This is typically achieved by having all classes directly or indirectly
> extend:

> abstract class LocatedElement {
> attribute location[0-1] : String;
> }

> If you additionally want to keep the comments, you can add the following
> attributes to class LocatedElement:

> attribute commentsBefore[*] ordered : String;
> attribute commentsAfter[*] ordered : String;

> Future versions of TCS should use Model Weaving to decorate the injected
> model with locations and comments without actually changing the model or
> its metamodel.


> Best regards,

> Frédéric Jouault


> Milan Milanovic wrote:
>> Hi Frédéric,
>>
>> I solved this situation. It works perfectly with performImportation, but
>> problem was that old version of my OCL-ebnfinjector was also somewhere
>> in the classpath as my new version, and it referenced to old version.
>>
>> Sorry.
>>
>> --
>> Best regards, Milan Milanovic
>>
>> Milan Milanovic wrote:
>>
>>> Hi Frédéric,
>>
>>> is this wierd, when I give some wrong OCL code in the input file,
>>> like: cont Test
>>
>>> it generates an error in command line:
>>
>>> Warning: 1:1-1:10: could not set location of IN!<notnamedyet>,
>>> disabling further location settings.
>>
>>> Error: <unknown location>: Constraint with name = cont was not found
>>> for ownedConstraint of OCL!OclModule.
>>> Error: <unknown location>: Constraint with name = Test was not found
>>> for ownedConstraint of OCL!OclModule.
>>
>>> I'm not sure what this exactly means, that my OclModule have
>>> ownedConstraint reference ?
>>
>>> This is not true, because my OclModule is defined like:
>>
>>> template OclModule main
>>> : ownedElements
>>> ;
>>
>>> Any hint will be useful !
>>
>>
>>
Previous Topic:ATM/AM3 installation
Next Topic:[ATL] model numbers
Goto Forum:
  


Current Time: Sat Apr 27 03:07:56 GMT 2024

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

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

Back to the top