Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [XPAND] Problems with getting started with defining extension
[XPAND] Problems with getting started with defining extension [message #553116] Mon, 16 August 2010 13:59 Go to next message
Yvette is currently offline YvetteFriend
Messages: 13
Registered: May 2010
Junior Member
Hello,
I am still new in generating text via Xpand. I want to use java Code in my Template. For this I implemented the following java class

public class Helper
{
	public static String ReplaceWS(String s)
	{
		return s.replace(' ', '_');
	}
}



Then I defined and extension class called GeneratorExtension.ext, with the following content

«IMPORT autoMaisDimension»

java.lang.String ReplaceWS(String s) : 
   JAVA Helper.ReplaceWS();

In my template file, I use this lines to call the code:

«IMPORT autoMaisDimension»
«EXTENSION GeneratorExtension» 

«DEFINE csClass FOR Dimension»

....

«ReplaceWS("Hello World")»


I get the following error.
828  INFO  CompositeComponent - Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/
1219 ERROR AbstractExpressionsUsingWorkflowComponent - Error in Component  of type org.eclipse.xpand2.Generator: 
	EvaluationException : mismatched input '«' expecting EOF on line 1
	GeneratateDimension.xpt[469,24] on line 24 'ReplaceWS("Hello World")'
	[23,45] on line 1 'EXPAND GeneratateDimension::csClass FOR model'    

1219 ERROR WorkflowRunner     - Workflow interrupted. Reason: mismatched input '«' expecting EOF on line 1
1219 ERROR WorkflowRunner     - [ERROR]: mismatched input '«' expecting EOF on line 1(Element: ReplaceWS("Hello World"); Reported by: Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)
1219 ERROR WorkflowRunner     - [ERROR]: mismatched input '«' expecting EOF on line 1(Element: EXPRESSION: ReplaceWS("Hello World"); Reported by: Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)
1219 ERROR WorkflowRunner     - [ERROR]: mismatched input '«' expecting EOF on line 1(Element: org.eclipse.internal.xpand2.ast.FileStatement@1581593; Reported by: Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)
1219 ERROR WorkflowRunner     - [ERROR]: mismatched input '«' expecting EOF on line 1(Element: csClass : Dimension; Reported by: Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)
1219 ERROR WorkflowRunner     - [ERROR]: mismatched input '«' expecting EOF on line 1(Element: EXPAND GeneratateDimension::csClass FOR model; Reported by: Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)


Any idea what I made wrong? Do I have to define my extension in the workflow file?

Thanks a lot
Yvette
Re: [XPAND] Problems with getting started with defining extension [message #553132 is a reply to message #553116] Mon, 16 August 2010 14:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

your extension has a totally wrong syntax. have a look into the docs.
it works with this extension:

String ReplaceWS(String s) : 
   JAVA Helper.ReplaceWS(java.lang.String);


Regards
Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [XPAND] Problems with getting started with defining extension [message #553144 is a reply to message #553132] Mon, 16 August 2010 14:41 Go to previous messageGo to next message
Yvette is currently offline YvetteFriend
Messages: 13
Registered: May 2010
Junior Member
Thanks Christian,
do mean this doc http://www.openarchitectureware.org/pub/documentation/4.3.1/ html/contents/core_reference.html ?

But the change leads to the same error
Re: [XPAND] Problems with getting started with defining extension [message #553154 is a reply to message #553144] Mon, 16 August 2010 15:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

yes i mean the oaw docs or the newer ones at eclipse http://help.eclipse.org/helios/index.jsp (Section Xpand Docu)

Have you verified that the template works when leaving out the extension? I Tried it with the project created by the sample wizard and it works.

Regards
Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [XPAND] Problems with getting started with defining extension [message #553173 is a reply to message #553116] Mon, 16 August 2010 15:26 Go to previous messageGo to next message
Yvette is currently offline YvetteFriend
Messages: 13
Registered: May 2010
Junior Member
Hi Christian,
thanks a lot. I tried it without the extension and it works fine.

But it might be something else, I think the error message is quite strange:


EvaluationException : mismatched input '«' expecting EOF on line 1
	GeneratateDimension.xpt[470,24] on line 25 'ReplaceWS("Hello World")'
	[23,45] on line 1 'EXPAND GeneratateDimension::csClass FOR model'    

1328 ERROR WorkflowRunner     - Workflow interrupted. Reason: mismatched input '«' expecting EOF on line 1
1328 ERROR WorkflowRunner     - [ERROR]: mismatched input '«' expecting EOF on line 1(Element: ReplaceWS("Hello World"); Reported by: Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)
1328 ERROR WorkflowRunner     - [ERROR]: mismatched input '«' expecting EOF on line 1(Element: EXPRESSION: ReplaceWS("Hello World"); Reported by: Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)
1328 ERROR WorkflowRunner     - [ERROR]: mismatched input '«' expecting EOF on line 1(Element: org.eclipse.internal.xpand2.ast.FileStatement@1fe1feb; Reported by: Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)
1328 ERROR WorkflowRunner     - [ERROR]: mismatched input '«' expecting EOF on line 1(Element: csClass : Dimension; Reported by: Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)
1328 ERROR WorkflowRunner     - [ERROR]: mismatched input '«' expecting EOF on line 1(Element: EXPAND GeneratateDimension::csClass FOR model; Reported by: Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)


Encoding problems?

Thanks Yvette

[Updated on: Mon, 16 August 2010 15:27]

Report message to a moderator

Re: [XPAND] Problems with getting started with defining extension [message #553175 is a reply to message #553173] Mon, 16 August 2010 15:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

can you post a bit more of your template - maybe the place where you call the extension makes no sense?

Regards
Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [XPAND] Problems with getting started with defining extension [message #559451 is a reply to message #553116] Thu, 16 September 2010 16:33 Go to previous message
Eclipse UserFriend
Originally posted by: till.tillamma.de

Hi,

comment below.


Till

On 08/16/2010 03:59 PM, Yvette wrote:
> Hello,
> I am still new in generating text via Xpand. I want to use java Code in
> my Template. For this I implemented the following java class
>
>
> public class Helper
> {
> public static String ReplaceWS(String s)
> {
> return s.replace(' ', '_');
> }
> }
>
>
>
> Then I defined and extension class called GeneratorExtension.ext, with
> the following content
>
>
> «IMPORT autoMaisDimension»
As far as i know there is no use of the Guilletmots in an extension. The
correct Syntax would be:

import autoMaisDimension;

>
> java.lang.String ReplaceWS(String s) : JAVA Helper.ReplaceWS();
>
> In my template file, I use this lines to call the code:
>
>
> «IMPORT autoMaisDimension»
> «EXTENSION GeneratorExtension»
> «DEFINE csClass FOR Dimension»
>
> ...
>
> «ReplaceWS("Hello World")»
>
>
> I get the following error.
>
> 828 INFO CompositeComponent - Generator: generating
> 'GeneratateDimension::csClass FOR model' => src-gen/
> 1219 ERROR AbstractExpressionsUsingWorkflowComponent - Error in
> Component of type org.eclipse.xpand2.Generator: EvaluationException :
> mismatched input '«' expecting EOF on line 1
> GeneratateDimension.xpt[469,24] on line 24 'ReplaceWS("Hello World")'
> [23,45] on line 1 'EXPAND GeneratateDimension::csClass FOR model'
> 1219 ERROR WorkflowRunner - Workflow interrupted. Reason: mismatched
> input '«' expecting EOF on line 1
> 1219 ERROR WorkflowRunner - [ERROR]: mismatched input '«' expecting EOF
> on line 1(Element: ReplaceWS("Hello World"); Reported by: Generator:
> generating 'GeneratateDimension::csClass FOR model' => src-gen/)
> 1219 ERROR WorkflowRunner - [ERROR]: mismatched input '«' expecting EOF
> on line 1(Element: EXPRESSION: ReplaceWS("Hello World"); Reported by:
> Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)
> 1219 ERROR WorkflowRunner - [ERROR]: mismatched input '«' expecting EOF
> on line 1(Element:
> org.eclipse.internal.xpand2.ast.FileStatement@1581593; Reported by:
> Generator: generating 'GeneratateDimension::csClass FOR model' => src-gen/)
> 1219 ERROR WorkflowRunner - [ERROR]: mismatched input '«' expecting EOF
> on line 1(Element: csClass : Dimension; Reported by: Generator:
> generating 'GeneratateDimension::csClass FOR model' => src-gen/)
> 1219 ERROR WorkflowRunner - [ERROR]: mismatched input '«' expecting EOF
> on line 1(Element: EXPAND GeneratateDimension::csClass FOR model;
> Reported by: Generator: generating 'GeneratateDimension::csClass FOR
> model' => src-gen/)
>
>
> Any idea what I made wrong? Do I have to define my extension in the
> workflow file?
>
> Thanks a lot
> Yvette
>
Previous Topic:[xpand] problem calling xpand from Java
Next Topic:InstantiationException while assigning vaiables
Goto Forum:
  


Current Time: Wed Apr 24 16:50:53 GMT 2024

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

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

Back to the top