Home » Archived » GMT (Generative Modeling Technologies) » [TCS]About NullPointerException
[TCS]About NullPointerException [message #378183] |
Fri, 15 June 2007 05:01  |
Eclipse User |
|
|
|
Originally posted by: quentin.glineur.obeo.fr
Hi,
After a successful build of my TCS file, the parsing generates a
NullPointerException. I am wondering what it can be due to ?
(there is no indeterminism)
trace :
org.atl.engine.repositories.emf4atl.ASMEMFModelElement.asm2E MF(ASMEMFModelElement.java:303)
org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:223)
org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:903)
org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:442)
at org.atl.engine.injectors.ebnf.vbParser.my_Parameter(Unknown Source)
at org.atl.engine.injectors.ebnf.vbParser.my_Function(Unknown Source)
Quentin
|
|
| | |
Re: [TCS]About NullPointerException [message #378187 is a reply to message #378186] |
Fri, 15 June 2007 07:33   |
Eclipse User |
|
|
|
Hello,
I am not sure where the problem is.
However, I noticed that you use:
(hasVisibility ? visibility)
(hasQualifier ? qualifier)
(hasType ? "As" type)
Why not use isDefined?
(isDefined(visibility) ? visibility)
(isDefined(qualifier) ? qualifier)
(isDefined(type) ? "As" type)
I do not think this is the cause of the problem, but you might want to
make this change anyway ;-).
Please, report back when this is done.
Regards,
Frédéric Jouault
Quentin Glineur wrote:
> Hello again and thanks for your interest,
>
> I did not find any error on any console I know. Then, to complete my
> question I am providing an excerpt of the MM and the TCS. (It seems that
> the token stream runs until the My_Parameter name.)
>
> Quentin
>
> ____________________________________________________________ _________
> KM3 :
> ____________________________________________________________ _________
>
> class My_Function extends My_Feature {
> attribute hasVisibility : Boolean;
> attribute visibility[0-1] : VisibilityEnum;
> attribute name : String;
> reference parameters[*] ordered container : My_Parameter;
> attribute return : String;
> reference statements[1-*] ordered container : My_Statement;
> }
>
> class My_Parameter extends My_Data {
> attribute isOptional : Boolean;
> attribute hasQualifier : Boolean;
> attribute qualifier[0-1] : QualifierEnum;
> attribute name : String;
> attribute hasType : Boolean;
> attribute type[0-1] : String;
> attribute hasInitialValue : Boolean;
> }
>
> enumeration QualifierEnum {
> literal byRef;
> literal byVal;
> }
> ____________________________________________________________ _________
> TCS :
> ____________________________________________________________ _________
>
> template My_Function :
> (hasVisibility ? visibility)
> "Function"
> name
> "("
> parameters{separator = ","}
> ")"
> "As"
> return
> statements
> "End Function"
> ;
>
> template My_Parameter :
> (isOptional ? "Optional")
> (hasQualifier ? qualifier)
> name
> (hasType ? "As" type)
> ;
>
> enumerationTemplate QualifierEnum auto :
> #byval = "ByVal",
> #byref = "ByRef"
> ;
>
> ____________________________________________________________ _________
> Compilation output :
> ____________________________________________________________ _________
>
> JARGeneration:
> [antlr] ANTLR Parser Generator Version 2.7.5 (20050128)
> 1989-2005 jGuru.com
> [javac] Compiling 1 source file
> [javac] ----------
> [javac] 1. WARNING in
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
> (at line 5)
> [javac] import antlr.TokenStreamIOException;
> [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> [javac] The import antlr.TokenStreamIOException is never used
> [javac] ----------
> [javac] 2. WARNING in
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
> (at line 6)
> [javac] import antlr.ANTLRException;
> [javac] ^^^^^^^^^^^^^^^^^^^^
> [javac] The import antlr.ANTLRException is never used
> [javac] ----------
> [javac] 3. WARNING in
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
> (at line 7)
> [javac] import antlr.LLkParser;
> [javac] ^^^^^^^^^^^^^^^
> [javac] The import antlr.LLkParser is never used
> [javac] ----------
> [javac] 4. WARNING in
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
> (at line 12)
> [javac] import antlr.MismatchedTokenException;
> [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> [javac] The import antlr.MismatchedTokenException is never used
> [javac] ----------
> [javac] 5. WARNING in
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
> (at line 13)
> [javac] import antlr.SemanticException;
> [javac] ^^^^^^^^^^^^^^^^^^^^^^^
> [javac] The import antlr.SemanticException is never used
> [javac] ----------
> [javac] 5 problems (5 warnings)
> [jar] Building jar:
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\my-imp orter.jar
> BUILD SUCCESSFUL
> Total time: 2 seconds
>
> ____________________________________________________________ _________
> Parsing output :
> ____________________________________________________________ _________
>
>
>
>
> Frédéric Jouault a écrit :
>> Hello,
>>
>> Are you sure there is no syntactic or lexical error before this NPE?
>> You might want to check all consoles and error logs ;-).
>>
>> My guess is that my_Parameter tries to initialize a property with a
>> null value, but I cannot tell why without seeing both the metamodel
>> and TCS.
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Quentin Glineur wrote:
>>> Hi,
>>>
>>> After a successful build of my TCS file, the parsing generates a
>>> NullPointerException. I am wondering what it can be due to ?
>>> (there is no indeterminism)
>>>
>>> trace :
>>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.asm2E MF(ASMEMFModelElement.java:303)
>>>
>>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:223)
>>>
>>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:903)
>>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:442)
>>> at org.atl.engine.injectors.ebnf.Parser.my_Parameter(Unknown Source)
>>> at org.atl.engine.injectors.ebnf.Parser.my_Function(Unknown Source)
>>>
>>> Quentin
>
>
> ------------------------------------------------------------ ------------
>
>
> Buildfile: D:\workspaces\3.2\workspace\TCSSample\bridgeLight\Injection\ build.xml
>
> injection:
> [am3.loadModel] Loading of model MM
> [am3.loadModel] Loading of model M
> [am3.loadModel] Warning: 1:21-1:35: could not set location of M!<unnamed>, disabling further location settings.
> [am3.loadModel] java.lang.NullPointerException
> [am3.loadModel] at org.atl.engine.repositories.emf4atl.ASMEMFModelElement.asm2E MF(ASMEMFModelElement.java:303)
> [am3.loadModel] at org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:223)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:903)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:442)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.my_Parameter(Unknown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.my_Function(Unknown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.my_Feature(Unknown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.my_ContentElement(Unk nown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.my_Content(Unknown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.main(Unknown Source)
> [am3.loadModel] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [am3.loadModel] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> [am3.loadModel] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> [am3.loadModel] at java.lang.reflect.Method.invoke(Unknown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2$ANTLR2Wrapper.pa rse(EBNFInjector2.java:145)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:273)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:243)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:223)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:205)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.inject(EBNFInjec tor2.java:188)
> [am3.loadModel] at org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.ebnfInje ction(AM3AntToolKit.java:235)
> [am3.loadModel] at org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.ebnfInje ction(AM3AntToolKit.java:252)
> [am3.loadModel] at org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.inject(A M3AntToolKit.java:260)
> [am3.loadModel] at org.eclipse.gmt.am3.tools.ant.tasks.LoadModelTask.execute(Lo adModelTask.java:53)
> [am3.loadModel] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.j ava:275)
> [am3.loadModel] at org.apache.tools.ant.Task.perform(Task.java:364)
> [am3.loadModel] at org.apache.tools.ant.Target.execute(Target.java:341)
> [am3.loadModel] at org.apache.tools.ant.Target.performTasks(Target.java:369)
> [am3.loadModel] at org.apache.tools.ant.Project.executeSortedTargets(Project.ja va:1216)
> [am3.loadModel] at org.apache.tools.ant.Project.executeTarget(Project.java:1185 )
> [am3.loadModel] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(D efaultExecutor.java:40)
> [am3.loadModel] at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.exe cuteTargets(EclipseDefaultExecutor.java:32)
> [am3.loadModel] at org.apache.tools.ant.Project.executeTargets(Project.java:106 8)
> [am3.loadModel] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(Inte rnalAntRunner.java:706)
> [am3.loadModel] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(Inte rnalAntRunner.java:457)
> [am3.loadModel] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [am3.loadModel] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> [am3.loadModel] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> [am3.loadModel] at java.lang.reflect.Method.invoke(Unknown Source)
> [am3.loadModel] at org.eclipse.ant.core.AntRunner.run(AntRunner.java:356)
> [am3.loadModel] at org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDe legate$1.run(AntLaunchDelegate.java:230)
> [am3.loadModel] at java.lang.Thread.run(Unknown Source)
> [am3.saveModel] Saving model M
> BUILD SUCCESSFUL
> Total time: 297 milliseconds
|
|
|
Re: [TCS]About NullPointerException [message #378190 is a reply to message #378187] |
Fri, 15 June 2007 09:51   |
Eclipse User |
|
|
|
Originally posted by: quentin.glineur.obeo.fr
Ok, I have tried what you suggested but it did not bring any enhancement.
Though I have noticed that the tag for My_Function is outside the
My_Content tag (as it should) i.e :
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="obeo"
xmlns:_1="expressions" xmlns:_2="features">
<My_Content>
...
</My_Content>
<_2:My_Function visibility="public" name="add"/>
<_2:My_Parameter/>
</xmi:XMI>
If it could help your diagnostic...
Regards,
Quentin
Frédéric Jouault a écrit :
> Hello,
>
> I am not sure where the problem is.
>
> However, I noticed that you use:
> (hasVisibility ? visibility)
> (hasQualifier ? qualifier)
> (hasType ? "As" type)
>
> Why not use isDefined?
>
> (isDefined(visibility) ? visibility)
> (isDefined(qualifier) ? qualifier)
> (isDefined(type) ? "As" type)
>
> I do not think this is the cause of the problem, but you might want to
> make this change anyway ;-).
>
> Please, report back when this is done.
>
>
> Regards,
>
> Frédéric Jouault
>
>
> Quentin Glineur wrote:
>> Hello again and thanks for your interest,
>>
>> I did not find any error on any console I know. Then, to complete my
>> question I am providing an excerpt of the MM and the TCS. (It seems
>> that the token stream runs until the My_Parameter name.)
>>
>> Quentin
>>
>> ____________________________________________________________ _________
>> KM3 :
>> ____________________________________________________________ _________
>>
>> class My_Function extends My_Feature {
>> attribute hasVisibility : Boolean;
>> attribute visibility[0-1] : VisibilityEnum;
>> attribute name : String;
>> reference parameters[*] ordered container : My_Parameter;
>> attribute return : String;
>> reference statements[1-*] ordered container : My_Statement;
>> }
>>
>> class My_Parameter extends My_Data {
>> attribute isOptional : Boolean;
>> attribute hasQualifier : Boolean;
>> attribute qualifier[0-1] : QualifierEnum;
>> attribute name : String;
>> attribute hasType : Boolean;
>> attribute type[0-1] : String;
>> attribute hasInitialValue : Boolean;
>> }
>>
>> enumeration QualifierEnum {
>> literal byRef;
>> literal byVal;
>> }
>> ____________________________________________________________ _________
>> TCS :
>> ____________________________________________________________ _________
>>
>> template My_Function :
>> (hasVisibility ? visibility)
>> "Function"
>> name
>> "("
>> parameters{separator = ","}
>> ")"
>> "As"
>> return
>> statements
>> "End Function"
>> ;
>>
>> template My_Parameter :
>> (isOptional ? "Optional")
>> (hasQualifier ? qualifier)
>> name
>> (hasType ? "As" type)
>> ;
>>
>> enumerationTemplate QualifierEnum auto :
>> #byval = "ByVal",
>> #byref = "ByRef"
>> ;
>>
>> ____________________________________________________________ _________
>> Compilation output :
>> ____________________________________________________________ _________
>>
>> JARGeneration:
>> [antlr] ANTLR Parser Generator Version 2.7.5 (20050128)
>> 1989-2005 jGuru.com
>> [javac] Compiling 1 source file
>> [javac] ----------
>> [javac] 1. WARNING in
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
>> (at line 5)
>> [javac] import antlr.TokenStreamIOException;
>> [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> [javac] The import antlr.TokenStreamIOException is never used
>> [javac] ----------
>> [javac] 2. WARNING in
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
>> (at line 6)
>> [javac] import antlr.ANTLRException;
>> [javac] ^^^^^^^^^^^^^^^^^^^^
>> [javac] The import antlr.ANTLRException is never used
>> [javac] ----------
>> [javac] 3. WARNING in
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
>> (at line 7)
>> [javac] import antlr.LLkParser;
>> [javac] ^^^^^^^^^^^^^^^
>> [javac] The import antlr.LLkParser is never used
>> [javac] ----------
>> [javac] 4. WARNING in
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
>> (at line 12)
>> [javac] import antlr.MismatchedTokenException;
>> [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> [javac] The import antlr.MismatchedTokenException is never used
>> [javac] ----------
>> [javac] 5. WARNING in
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
>> (at line 13)
>> [javac] import antlr.SemanticException;
>> [javac] ^^^^^^^^^^^^^^^^^^^^^^^
>> [javac] The import antlr.SemanticException is never used
>> [javac] ----------
>> [javac] 5 problems (5 warnings)
>> [jar] Building jar:
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\my-imp orter.jar
>> BUILD SUCCESSFUL
>> Total time: 2 seconds
>>
>> ____________________________________________________________ _________
>> Parsing output :
>> ____________________________________________________________ _________
>>
>>
>>
>>
>> Frédéric Jouault a écrit :
>>> Hello,
>>>
>>> Are you sure there is no syntactic or lexical error before this NPE?
>>> You might want to check all consoles and error logs ;-).
>>>
>>> My guess is that my_Parameter tries to initialize a property with a
>>> null value, but I cannot tell why without seeing both the metamodel
>>> and TCS.
>>>
>>>
>>> Regards,
>>>
>>> Frédéric Jouault
>>>
>>>
>>> Quentin Glineur wrote:
>>>> Hi,
>>>>
>>>> After a successful build of my TCS file, the parsing generates a
>>>> NullPointerException. I am wondering what it can be due to ?
>>>> (there is no indeterminism)
>>>>
>>>> trace :
>>>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.asm2E MF(ASMEMFModelElement.java:303)
>>>>
>>>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:223)
>>>>
>>>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:903)
>>>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:442)
>>>> at org.atl.engine.injectors.ebnf.Parser.my_Parameter(Unknown Source)
>>>> at org.atl.engine.injectors.ebnf.Parser.my_Function(Unknown Source)
>>>>
>>>> Quentin
>>
>>
>> ------------------------------------------------------------ ------------
>>
>>
>> Buildfile:
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\Injection\ build.xml
>>
>> injection:
>> [am3.loadModel] Loading of model MM
>> [am3.loadModel] Loading of model M
>> [am3.loadModel] Warning: 1:21-1:35: could not set location of
>> M!<unnamed>, disabling further location settings.
>> [am3.loadModel] java.lang.NullPointerException
>> [am3.loadModel] at
>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.asm2E MF(ASMEMFModelElement.java:303)
>>
>> [am3.loadModel] at
>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:223)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:903)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:442)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.my_Parameter(Unknown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.my_Function(Unknown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.my_Feature(Unknown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.my_ContentElement(Unk nown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.my_Content(Unknown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.main(Unknown Source)
>> [am3.loadModel] at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> [am3.loadModel] at
>> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> [am3.loadModel] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> [am3.loadModel] at java.lang.reflect.Method.invoke(Unknown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2$ANTLR2Wrapper.pa rse(EBNFInjector2.java:145)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:273)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:243)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:223)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:205)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.inject(EBNFInjec tor2.java:188)
>>
>> [am3.loadModel] at
>> org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.ebnfInje ction(AM3AntToolKit.java:235)
>>
>> [am3.loadModel] at
>> org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.ebnfInje ction(AM3AntToolKit.java:252)
>>
>> [am3.loadModel] at
>> org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.inject(A M3AntToolKit.java:260)
>>
>> [am3.loadModel] at
>> org.eclipse.gmt.am3.tools.ant.tasks.LoadModelTask.execute(Lo adModelTask.java:53)
>>
>> [am3.loadModel] at
>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.j ava:275)
>> [am3.loadModel] at org.apache.tools.ant.Task.perform(Task.java:364)
>> [am3.loadModel] at
>> org.apache.tools.ant.Target.execute(Target.java:341)
>> [am3.loadModel] at
>> org.apache.tools.ant.Target.performTasks(Target.java:369)
>> [am3.loadModel] at
>> org.apache.tools.ant.Project.executeSortedTargets(Project.ja va:1216)
>> [am3.loadModel] at
>> org.apache.tools.ant.Project.executeTarget(Project.java:1185 )
>> [am3.loadModel] at
>> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(D efaultExecutor.java:40)
>>
>> [am3.loadModel] at
>> org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.exe cuteTargets(EclipseDefaultExecutor.java:32)
>>
>> [am3.loadModel] at
>> org.apache.tools.ant.Project.executeTargets(Project.java:106 8)
>> [am3.loadModel] at
>> org.eclipse.ant.internal.core.ant.InternalAntRunner.run(Inte rnalAntRunner.java:706)
>>
>> [am3.loadModel] at
>> org.eclipse.ant.internal.core.ant.InternalAntRunner.run(Inte rnalAntRunner.java:457)
>>
>> [am3.loadModel] at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> [am3.loadModel] at
>> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> [am3.loadModel] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> [am3.loadModel] at java.lang.reflect.Method.invoke(Unknown Source)
>> [am3.loadModel] at
>> org.eclipse.ant.core.AntRunner.run(AntRunner.java:356)
>> [am3.loadModel] at
>> org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDe legate$1.run(AntLaunchDelegate.java:230)
>>
>> [am3.loadModel] at java.lang.Thread.run(Unknown Source)
>> [am3.saveModel] Saving model M
>> BUILD SUCCESSFUL
>> Total time: 297 milliseconds
|
|
| | |
Re: [TCS]About NullPointerException [message #378195 is a reply to message #378192] |
Fri, 15 June 2007 14:57   |
Eclipse User |
|
|
|
Hello,
Your problem is that the byRef and byVal enumeration literals are
spelled byref and byval in the TCS. This is strange for a generated file
;-).
Checking for this kind of problem is already in the TODO list for the
TCS2Problem transformation.
Another problem I discovered: you should use "End" "Function" not "End
Function", because End and Function are two separate keywords.
You might also be interested in the VB zoo, which uses a VisualBasic
metamodel and TCS:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmt/AM3 /org.eclipse.am3.zoos.atlanticVB/build/?root=Technology_Proj ect
Best regards,
Frédéric Jouault
Quentin Glineur wrote:
> Here it comes !
> As a matter of fact, the KM3 and the TCS have been gotten by generation
> hence their form.
>
> The test file is adapted from one of the melon project.
>
> Regards,
> Quentin
>
> Frédéric Jouault a écrit :
>> Hello,
>>
>> > Ok, I have tried what you suggested but it did not bring any
>> enhancement.
>>
>> The enhancement is that you can remove unnecessary Boolean attributes
>> ;-).
>>
>>
>> > Though I have noticed that the tag for My_Function is outside the
>> > My_Content tag (as it should) i.e :
>> >
>> > <?xml version="1.0" encoding="ISO-8859-1"?>
>> > <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="obeo"
>> > xmlns:_1="expressions" xmlns:_2="features">
>> > <My_Content>
>> > ...
>> > </My_Content>
>> > <_2:My_Function visibility="public" name="add"/>
>> > <_2:My_Parameter/>
>> > </xmi:XMI>
>> >
>> > If it could help your diagnostic...
>>
>> This is probably caused by the error, of which it is therefore a
>> symptom, not a cause.
>>
>>
>> Is it possible for you to package your KM3 metamodel, TCS model, and
>> at least a sample and post it here, so that I can try to reproduce the
>> problem?
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>
>
> ------------------------------------------------------------ ------------
>
> package PrimitiveTypes {
>
> datatype String;
>
> datatype Boolean;
>
> datatype Integer;
> }
>
> package fr {
>
> package obeo {
>
> abstract class My_LangElement {
> attribute comment[0-1] : String;
> attribute endLineComment[0-1] : String;
> attribute naming[0-1] : String;
> attribute elementId[0-1] : String;
> attribute write : String;
> reference typing[0-1] : My_LangElement;
> reference crossReferences[*] ordered : My_LangElement;
> }
>
> class My_Content extends My_LangElement {
> reference elements[*] ordered container : My_ContentElement;
> }
>
>
> abstract class My_ContentElement extends My_LangElement {
>
> }
>
> class My_FileAttribute extends My_ContentElement {
> attribute name : String;
> reference initialValue[1-*] ordered container : My_Expression;
> }
>
> class My_Option extends My_ContentElement {
> attribute name : String;
> attribute hasEnablement : Boolean;
> attribute enablement[0-1] : EnablementEnum;
> }
>
> abstract class My_Data {
> }
> }
>
> package features {
>
> abstract class My_Feature extends My_Data, My_ContentElement {
> }
>
> class My_Function extends My_Feature {
> -- attribute hasVisibility : Boolean;
> attribute visibility[0-1] : VisibilityEnum;
> attribute name : String;
> reference parameters[*] ordered container : My_Parameter;
> attribute return : String;
> reference statements[1-*] ordered container : My_Statement;
> }
>
> class My_Parameter extends My_Data {
> attribute isOptional : Boolean;
> -- attribute hasQualifier : Boolean;
> attribute qualifier[0-1] : QualifierEnum;
> attribute name : String;
> -- attribute hasType : Boolean;
> attribute type[0-1] : String;
> attribute hasInitialValue : Boolean;
> }
> }
>
> package statements {
>
> abstract class My_Modifier extends My_LangElement {
> }
>
> abstract class My_Statement extends My_Modifier {
> }
>
> class My_RawBody extends My_Statement {
> attribute value[0-1] : String;
> }
> }
>
> package expressions {
>
> abstract class My_Expression extends My_LangElement {
> }
>
> class My_NegativeExpression extends My_Expression {
> reference expression container : My_Expression;
> }
>
>
> abstract class My_Value extends My_Expression {
> }
>
> abstract class My_Literal extends My_Value {
> }
>
> class My_Literal_Literal extends My_Literal {
> attribute value : String;
> }
>
> class My_Literal_Number extends My_Literal {
> attribute value : String;
> }
>
> class My_Literal_Value extends My_Literal {
> attribute value : String;
> }
>
> }
>
>
> package enumerations {
>
> enumeration EnablementEnum {
> literal Off;
> literal On;
> }
>
> enumeration VisibilityEnum {
> literal private;
> literal protected;
> literal public;
> }
>
> enumeration QualifierEnum {
> literal byRef;
> literal byVal;
> }
>
> }
> }
>
>
> ------------------------------------------------------------ ------------
>
> syntax vb {
>
> primitiveTemplate numberSymbol for String using NUMBER_PATTERN :
> value = "%token%";
>
> primitiveTemplate identifierSymbol for String default using IDENTIFIER_PATTERN :
> value = "%token%";
>
> primitiveTemplate literalSymbol for String using LITERAL_PATTERN :
> value = "%token%";
>
> primitiveTemplate valueSymbol for String using VALUE_PATTERN :
> value = "%token%";
>
> primitiveTemplate bodySymbol for String using BODY :
> value = "%token%";
>
> template My_Content main :
> elements
> ;
>
> template My_ContentElement abstract
> ;
>
> template My_FileAttribute :
> "Attribute"
> name
> "="
> initialValue{separator = ","}
> ;
>
> template My_Option :
> "Option"
> name
> (isDefined(enablement) ? enablement)
> ;
>
>
> template My_Feature abstract
> ;
>
> template My_Data abstract
> ;
>
> template My_RawBody :
> value{as = bodySymbol}
> ;
>
> template My_Function
> :
> (isDefined(visibility) ? visibility)
> "Function" name "(" parameters{separator = ","} ")" "As" return statements "End Function"
> ;
>
>
> template My_Parameter :
> (isOptional ? "Optional")
> (isDefined(qualifier) ? qualifier)
> name
> (isDefined(type) ? "As" type)
> ;
>
>
> template My_Statement abstract
> ;
>
>
> template My_Expression abstract
> ;
>
>
> template My_Value abstract
> ;
>
>
> template My_Literal abstract
> ;
>
> template My_Literal_Literal :
> value{as = literalSymbol}
> ;
>
>
> enumerationTemplate EnablementEnum auto :
> #off = "Off",
> #on = "On"
> ;
>
> enumerationTemplate VisibilityEnum auto :
> #public = "Public",
> #protected = "Protected",
> #private = "Private"
> ;
>
> enumerationTemplate QualifierEnum auto :
> #byval = "ByVal",
> #byref = "ByRef"
> ;
>
>
> symbols {
> parenthesisBegin = "(";
> parenthesisEnd = ")";
> coma = ",";
> dot = ".";
> eq = "=";
> }
>
>
> lexer = "
> class vbLexer extends Lexer;
>
> options {
> k = 5;
> charVocabulary = '\\0' .. '\\u00FF';
> testLiterals = false;
> }
>
> {
>
> protected Token makeToken(int t) {
> org.atl.engine.injectors.ebnf.LocationToken ret = null;
> tokenObjectClass = org.atl.engine.injectors.ebnf.LocationToken.class;
> ret = (org.atl.engine.injectors.ebnf.LocationToken)super.makeToken (t);
> ret.setEndLine(getLine());
> ret.setEndColumn(getColumn());
> return ret;
> }
>
> }
>
> protected
> NL
> : ( '\\r' '\\n'
> | '\\r'
> | '\\n'
> )
> {newline();}
> ;
>
> WS
> : ( ' '
> | '\\t'
> | NL
> )
> { $setType(Token.SKIP); }
> ;
>
> COMMENT
> : '\\''
> (~( '\\r'|'\\n'))*
> { $setType(Token.SKIP); }
> ;
>
> NUMBER_PATTERN
> : (NUMBER_REGEX)
> ;
>
> IDENTIFIER_PATTERN options{testLiterals=true;}
> : (IDENTIFIER_REGEX)
> ;
>
> LITERAL_PATTERN
> : (LITERAL_REGEX)
> ;
>
> VALUE_PATTERN
> : ( EVAL_REGEX | DATE_REGEX)
> ;
>
> //////////////////////////////////////////////////////////// //////////
>
> protected NUMBER_REGEX
> : ('0'..'9')+
> ('.' ('0'..'9')+)?
> ('!')?
> {System.out.println(\"Number : \" + $getText);}
> ;
>
> protected ALPHA
> : 'a'..'z'
> | 'A'..'Z'
> //For Unicode compatibility (from 0000 to 00ff)
> | '\\u00C0' .. '\\u00D6'
> | '\\u00D8' .. '\\u00F6'
> | '\\u00F8' .. '\\u00FF'
> ;
>
> protected
> DIGIT
> : '0'..'9'
> ;
>
> protected IDENTIFIER_CHAR
> : ('_' | ALPHA | DIGIT | '&')
> ;
>
> protected UNDERSCORED_CHAR
> : '_' IDENTIFIER_CHAR
> ;
>
> protected IDENTIFIER_REGEX
> : (ALPHA | UNDERSCORED_CHAR)
> (IDENTIFIER_CHAR)*
> {System.out.println(\"Identifier : \" + $getText);}
> ;
>
> protected EVAL_REGEX
> : '&'(ALPHA)+('&')?
> ;
>
> protected DATE_REGEX
> : '#' (DIGIT '/')+ '#'
> ;
>
> protected LITERAL_REGEX
> : '\"' ( ~('\"'))* '\"'
> {System.out.println(\"Literal : \" + $getText);}
> ;
>
> BODY
> : ('$'(options{greedy=false;}:('\\n' {newline();}| ~ '\\n'))* '$')
> {System.out.println(\"Body : \" + $getText);}
> ;
>
>
> ";
>
> }
>
>
> ------------------------------------------------------------ ------------
>
> Attribute VB_Name = "mMelonCtls_i"
> Option Explicit
>
> Public Function g_ControlSetValue(ByRef Control As MControl, ByVal Value As Long) As Boolean
> $
> If (Control Is Nothing) Then _
> Exit Function
>
> Control.Value = Value
> g_ControlSetValue = True
> $
> End Function
>
> Public Function g_ControlGetValue(ByRef Control As MControl, ByRef Value As Long) As Boolean
> $
> If (Control Is Nothing) Then _
> Exit Function
>
> Value = Control.Value
> g_ControlGetValue = True
> $
> End Function
>
> Public Function g_SliderInit(ByRef Slider As MControl, Optional ByVal Min As Long, Optional ByVal Max As Long, Optional ByVal Value As Long) As Boolean
> $
> If (Slider Is Nothing) Then _
> Exit Function
>
> On Error Resume Next
>
> Dim ps As CSlider
>
> Err.Clear
> Set ps = Slider
> If Err.Number = 0 Then
> If Min <> -1 Then _
> ps.Min = Min
>
> If Max <> -1 Then _
> ps.Max = Max
>
> If Value <> -1 Then _
> ps.Value = Value
>
> g_SliderInit = True
> End If
> $
> End Function
|
|
|
Re: [TCS]About NullPointerException [message #378260 is a reply to message #378195] |
Mon, 18 June 2007 04:24   |
Eclipse User |
|
|
|
Originally posted by: quentin.glineur.obeo.fr
Frédéric Jouault a écrit :
Hello,
> Hello,
>
> Your problem is that the byRef and byVal enumeration literals are
> spelled byref and byval in the TCS. This is strange for a generated file
> ;-).
Yet, you are right, this is one of the only piece of my code that are
still handcrafted !
> Checking for this kind of problem is already in the TODO list for the
> TCS2Problem transformation.
Great ! As a grain of sand, it has been jamming my work for quite long
time without being quickly identifiable: so thanks for your help !
>
> Another problem I discovered: you should use "End" "Function" not "End
> Function", because End and Function are two separate keywords.
>
Ok, this one is now fixed.
> You might also be interested in the VB zoo, which uses a VisualBasic
> metamodel and TCS:
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmt/AM3 /org.eclipse.am3.zoos.atlanticVB/build/?root=Technology_Proj ect
>
Thanks a lot, I will use it as inspiration !
Regards,
Quentin
>
> Best regards,
>
> Frédéric Jouault
>
>
> Quentin Glineur wrote:
>> Here it comes !
>> As a matter of fact, the KM3 and the TCS have been gotten by
>> generation hence their form.
>>
>> The test file is adapted from one of the melon project.
>>
>> Regards,
>> Quentin
>>
>> Frédéric Jouault a écrit :
>>> Hello,
>>>
>>> > Ok, I have tried what you suggested but it did not bring any
>>> enhancement.
>>>
>>> The enhancement is that you can remove unnecessary Boolean attributes
>>> ;-).
>>>
>>>
>>> > Though I have noticed that the tag for My_Function is outside the
>>> > My_Content tag (as it should) i.e :
>>> >
>>> > <?xml version="1.0" encoding="ISO-8859-1"?>
>>> > <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="obeo"
>>> > xmlns:_1="expressions" xmlns:_2="features">
>>> > <My_Content>
>>> > ...
>>> > </My_Content>
>>> > <_2:My_Function visibility="public" name="add"/>
>>> > <_2:My_Parameter/>
>>> > </xmi:XMI>
>>> >
>>> > If it could help your diagnostic...
>>>
>>> This is probably caused by the error, of which it is therefore a
>>> symptom, not a cause.
>>>
>>>
>>> Is it possible for you to package your KM3 metamodel, TCS model, and
>>> at least a sample and post it here, so that I can try to reproduce
>>> the problem?
>>>
>>>
>>> Regards,
>>>
>>> Frédéric Jouault
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> package PrimitiveTypes {
>>
>> datatype String;
>>
>> datatype Boolean;
>>
>> datatype Integer;
>> }
>>
>> package fr {
>>
>> package obeo {
>>
>> abstract class My_LangElement {
>> attribute comment[0-1] : String;
>> attribute endLineComment[0-1] : String;
>> attribute naming[0-1] : String;
>> attribute elementId[0-1] : String;
>> attribute write : String;
>> reference typing[0-1] : My_LangElement;
>> reference crossReferences[*] ordered : My_LangElement;
>> }
>>
>> class My_Content extends My_LangElement {
>> reference elements[*] ordered container : My_ContentElement;
>> }
>>
>>
>> abstract class My_ContentElement extends My_LangElement {
>>
>> }
>>
>> class My_FileAttribute extends My_ContentElement {
>> attribute name : String;
>> reference initialValue[1-*] ordered container : My_Expression;
>> }
>>
>> class My_Option extends My_ContentElement {
>> attribute name : String;
>> attribute hasEnablement : Boolean;
>> attribute enablement[0-1] : EnablementEnum;
>> }
>>
>> abstract class My_Data {
>> }
>> }
>>
>> package features {
>>
>> abstract class My_Feature extends My_Data, My_ContentElement
>> {
>> }
>>
>> class My_Function extends My_Feature {
>> -- attribute hasVisibility : Boolean;
>> attribute visibility[0-1] : VisibilityEnum;
>> attribute name : String;
>> reference parameters[*] ordered container : My_Parameter;
>> attribute return : String;
>> reference statements[1-*] ordered container : My_Statement;
>> }
>>
>> class My_Parameter extends My_Data {
>> attribute isOptional : Boolean;
>> -- attribute hasQualifier : Boolean;
>> attribute qualifier[0-1] : QualifierEnum;
>> attribute name : String;
>> -- attribute hasType : Boolean;
>> attribute type[0-1] : String;
>> attribute hasInitialValue : Boolean;
>> }
>> }
>>
>> package statements {
>>
>> abstract class My_Modifier extends My_LangElement
>> {
>> }
>>
>> abstract class My_Statement extends My_Modifier {
>> }
>>
>> class My_RawBody extends My_Statement {
>> attribute value[0-1] : String;
>> }
>> }
>>
>> package expressions {
>>
>> abstract class My_Expression extends My_LangElement
>> {
>> }
>>
>> class My_NegativeExpression extends My_Expression {
>> reference expression container : My_Expression;
>> }
>>
>>
>> abstract class My_Value extends My_Expression {
>> }
>>
>> abstract class My_Literal extends My_Value {
>> }
>>
>> class My_Literal_Literal extends My_Literal {
>> attribute value : String;
>> }
>>
>> class My_Literal_Number extends My_Literal {
>> attribute value : String;
>> }
>>
>> class My_Literal_Value extends My_Literal {
>> attribute value : String;
>> }
>>
>> }
>>
>>
>> package enumerations {
>>
>> enumeration EnablementEnum {
>> literal Off;
>> literal On;
>> }
>>
>> enumeration VisibilityEnum {
>> literal private;
>> literal protected;
>> literal public;
>> }
>>
>> enumeration QualifierEnum {
>> literal byRef;
>> literal byVal;
>> }
>>
>> }
>> }
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> syntax vb {
>>
>> primitiveTemplate numberSymbol for String using NUMBER_PATTERN :
>> value = "%token%";
>>
>> primitiveTemplate identifierSymbol for String default using
>> IDENTIFIER_PATTERN :
>> value = "%token%";
>>
>> primitiveTemplate literalSymbol for String using LITERAL_PATTERN :
>> value = "%token%";
>>
>> primitiveTemplate valueSymbol for String using VALUE_PATTERN :
>> value = "%token%";
>>
>> primitiveTemplate bodySymbol for String using BODY :
>> value = "%token%";
>>
>> template My_Content main :
>> elements
>> ;
>>
>> template My_ContentElement abstract ;
>>
>> template My_FileAttribute :
>> "Attribute"
>> name
>> "="
>> initialValue{separator = ","}
>> ;
>>
>> template My_Option :
>> "Option"
>> name
>> (isDefined(enablement) ? enablement)
>> ;
>>
>>
>> template My_Feature abstract ;
>>
>> template My_Data abstract ;
>>
>> template My_RawBody :
>> value{as = bodySymbol}
>> ;
>>
>> template My_Function
>> :
>> (isDefined(visibility) ? visibility)
>> "Function" name "(" parameters{separator = ","} ")" "As"
>> return statements "End Function"
>> ;
>>
>>
>> template My_Parameter :
>> (isOptional ? "Optional")
>> (isDefined(qualifier) ? qualifier) name
>> (isDefined(type) ? "As" type)
>> ;
>>
>>
>> template My_Statement abstract ;
>>
>>
>> template My_Expression abstract
>> ;
>>
>>
>> template My_Value abstract ;
>>
>>
>> template My_Literal abstract
>> ;
>>
>> template My_Literal_Literal :
>> value{as = literalSymbol}
>> ;
>>
>>
>> enumerationTemplate EnablementEnum auto :
>> #off = "Off",
>> #on = "On"
>> ;
>>
>> enumerationTemplate VisibilityEnum auto :
>> #public = "Public",
>> #protected = "Protected",
>> #private = "Private"
>> ;
>>
>> enumerationTemplate QualifierEnum auto :
>> #byval = "ByVal",
>> #byref = "ByRef"
>> ;
>>
>>
>> symbols {
>> parenthesisBegin = "(";
>> parenthesisEnd = ")";
>> coma = ",";
>> dot = ".";
>> eq = "=";
>> }
>>
>>
>> lexer = "
>> class vbLexer extends Lexer;
>>
>> options {
>> k = 5;
>> charVocabulary = '\\0' .. '\\u00FF';
>> testLiterals = false;
>> }
>>
>> {
>>
>> protected Token makeToken(int t) {
>> org.atl.engine.injectors.ebnf.LocationToken ret = null;
>> tokenObjectClass =
>> org.atl.engine.injectors.ebnf.LocationToken.class;
>> ret =
>> (org.atl.engine.injectors.ebnf.LocationToken)super.makeToken (t);
>> ret.setEndLine(getLine());
>> ret.setEndColumn(getColumn());
>> return ret;
>> }
>>
>> }
>>
>> protected
>> NL
>> : ( '\\r' '\\n'
>> | '\\r'
>> | '\\n'
>> )
>> {newline();}
>> ;
>>
>> WS
>> : ( ' '
>> | '\\t'
>> | NL
>> )
>> { $setType(Token.SKIP); }
>> ;
>>
>> COMMENT
>> : '\\''
>> (~( '\\r'|'\\n'))*
>> { $setType(Token.SKIP); }
>> ;
>>
>> NUMBER_PATTERN
>> : (NUMBER_REGEX)
>> ;
>>
>> IDENTIFIER_PATTERN options{testLiterals=true;}
>> : (IDENTIFIER_REGEX)
>> ;
>>
>> LITERAL_PATTERN
>> : (LITERAL_REGEX)
>> ;
>>
>> VALUE_PATTERN
>> : ( EVAL_REGEX | DATE_REGEX)
>> ;
>>
>> //////////////////////////////////////////////////////////// //////////
>>
>> protected NUMBER_REGEX
>> : ('0'..'9')+
>> ('.' ('0'..'9')+)?
>> ('!')?
>> {System.out.println(\"Number : \" + $getText);}
>> ;
>>
>> protected ALPHA
>> : 'a'..'z'
>> | 'A'..'Z'
>> //For Unicode compatibility (from 0000 to 00ff)
>> | '\\u00C0' .. '\\u00D6'
>> | '\\u00D8' .. '\\u00F6'
>> | '\\u00F8' .. '\\u00FF'
>> ;
>>
>> protected
>> DIGIT
>> : '0'..'9'
>> ;
>>
>> protected IDENTIFIER_CHAR
>> : ('_' | ALPHA | DIGIT | '&')
>> ;
>>
>> protected UNDERSCORED_CHAR
>> : '_' IDENTIFIER_CHAR
>> ;
>>
>> protected IDENTIFIER_REGEX
>> : (ALPHA | UNDERSCORED_CHAR)
>> (IDENTIFIER_CHAR)*
>> {System.out.println(\"Identifier : \" + $getText);}
>> ;
>>
>> protected EVAL_REGEX
>> : '&'(ALPHA)+('&')?
>> ;
>>
>> protected DATE_REGEX
>> : '#' (DIGIT '/')+ '#'
>> ;
>>
>> protected LITERAL_REGEX
>> : '\"' ( ~('\"'))* '\"'
>> {System.out.println(\"Literal : \" + $getText);}
>> ;
>>
>> BODY
>> : ('$'(options{greedy=false;}:('\\n' {newline();}| ~ '\\n'))* '$')
>> {System.out.println(\"Body : \" + $getText);}
>> ;
>>
>>
>> ";
>>
>> }
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> Attribute VB_Name = "mMelonCtls_i"
>> Option Explicit
>>
>> Public Function g_ControlSetValue(ByRef Control As MControl, ByVal
>> Value As Long) As Boolean
>> $
>> If (Control Is Nothing) Then _
>> Exit Function
>>
>> Control.Value = Value
>> g_ControlSetValue = True
>> $
>> End Function
>>
>> Public Function g_ControlGetValue(ByRef Control As MControl, ByRef
>> Value As Long) As Boolean
>> $
>> If (Control Is Nothing) Then _
>> Exit Function
>>
>> Value = Control.Value
>> g_ControlGetValue = True
>> $
>> End Function
>>
>> Public Function g_SliderInit(ByRef Slider As MControl, Optional ByVal
>> Min As Long, Optional ByVal Max As Long, Optional ByVal Value As Long)
>> As Boolean
>> $
>> If (Slider Is Nothing) Then _
>> Exit Function
>>
>> On Error Resume Next
>>
>> Dim ps As CSlider
>>
>> Err.Clear
>> Set ps = Slider
>> If Err.Number = 0 Then
>> If Min <> -1 Then _
>> ps.Min = Min
>>
>> If Max <> -1 Then _
>> ps.Max = Max
>>
>> If Value <> -1 Then _
>> ps.Value = Value
>>
>> g_SliderInit = True
>> End If
>> $
>> End Function
|
|
| |
Re: [TCS]About NullPointerException [message #378517 is a reply to message #378515] |
Thu, 19 July 2007 11:13  |
Eclipse User |
|
|
|
Originally posted by: quentin.glineur.obeo.fr
This is a multi-part message in MIME format.
--------------080607090607080802030600
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Hi Remi,
I am sorry but I do not understand your post :-/
If you are trying to get an injector from the files I have posted, be
sure to fix them the way Frederic told (i.e. correct the literal names
(byRef, byVal) either in KM3 or in TCS).
Regards,
Quentin GLINEUR
Remi Viaux a
|
|
|
Re: [TCS]About NullPointerException [message #601879 is a reply to message #378183] |
Fri, 15 June 2007 05:35  |
Eclipse User |
|
|
|
Hello,
Are you sure there is no syntactic or lexical error before this NPE?
You might want to check all consoles and error logs ;-).
My guess is that my_Parameter tries to initialize a property with a null
value, but I cannot tell why without seeing both the metamodel and TCS.
Regards,
Frédéric Jouault
Quentin Glineur wrote:
> Hi,
>
> After a successful build of my TCS file, the parsing generates a
> NullPointerException. I am wondering what it can be due to ?
> (there is no indeterminism)
>
> trace :
> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.asm2E MF(ASMEMFModelElement.java:303)
>
> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:223)
>
> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:903)
> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:442)
> at org.atl.engine.injectors.ebnf.vbParser.my_Parameter(Unknown Source)
> at org.atl.engine.injectors.ebnf.vbParser.my_Function(Unknown Source)
>
> Quentin
|
|
|
Re: [TCS]About NullPointerException [message #601904 is a reply to message #378184] |
Fri, 15 June 2007 07:13  |
Eclipse User |
|
|
|
Originally posted by: quentin.glineur.obeo.fr
This is a multi-part message in MIME format.
--------------060902090406040602000705
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Hello again and thanks for your interest,
I did not find any error on any console I know. Then, to complete my
question I am providing an excerpt of the MM and the TCS. (It seems that
the token stream runs until the My_Parameter name.)
Quentin
____________________________________________________________ _________
KM3 :
____________________________________________________________ _________
class My_Function extends My_Feature {
attribute hasVisibility : Boolean;
attribute visibility[0-1] : VisibilityEnum;
attribute name : String;
reference parameters[*] ordered container : My_Parameter;
attribute return : String;
reference statements[1-*] ordered container : My_Statement;
}
class My_Parameter extends My_Data {
attribute isOptional : Boolean;
attribute hasQualifier : Boolean;
attribute qualifier[0-1] : QualifierEnum;
attribute name : String;
attribute hasType : Boolean;
attribute type[0-1] : String;
attribute hasInitialValue : Boolean;
}
enumeration QualifierEnum {
literal byRef;
literal byVal;
}
____________________________________________________________ _________
TCS :
____________________________________________________________ _________
template My_Function :
(hasVisibility ? visibility)
"Function"
name
"("
parameters{separator = ","}
")"
"As"
return
statements
"End Function"
;
template My_Parameter :
(isOptional ? "Optional")
(hasQualifier ? qualifier)
name
(hasType ? "As" type)
;
enumerationTemplate QualifierEnum auto :
#byval = "ByVal",
#byref = "ByRef"
;
____________________________________________________________ _________
Compilation output :
____________________________________________________________ _________
JARGeneration:
[antlr] ANTLR Parser Generator Version 2.7.5 (20050128)
1989-2005 jGuru.com
[javac] Compiling 1 source file
[javac] ----------
[javac] 1. WARNING in
D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
(at line 5)
[javac] import antlr.TokenStreamIOException;
[javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[javac] The import antlr.TokenStreamIOException is never used
[javac] ----------
[javac] 2. WARNING in
D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
(at line 6)
[javac] import antlr.ANTLRException;
[javac] ^^^^^^^^^^^^^^^^^^^^
[javac] The import antlr.ANTLRException is never used
[javac] ----------
[javac] 3. WARNING in
D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
(at line 7)
[javac] import antlr.LLkParser;
[javac] ^^^^^^^^^^^^^^^
[javac] The import antlr.LLkParser is never used
[javac] ----------
[javac] 4. WARNING in
D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
(at line 12)
[javac] import antlr.MismatchedTokenException;
[javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[javac] The import antlr.MismatchedTokenException is never used
[javac] ----------
[javac] 5. WARNING in
D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
(at line 13)
[javac] import antlr.SemanticException;
[javac] ^^^^^^^^^^^^^^^^^^^^^^^
[javac] The import antlr.SemanticException is never used
[javac] ----------
[javac] 5 problems (5 warnings)
[jar] Building jar:
D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\my-imp orter.jar
BUILD SUCCESSFUL
Total time: 2 seconds
____________________________________________________________ _________
Parsing output :
____________________________________________________________ _________
Fr
|
|
|
Re: [TCS]About NullPointerException [message #601910 is a reply to message #378186] |
Fri, 15 June 2007 07:33  |
Eclipse User |
|
|
|
Hello,
I am not sure where the problem is.
However, I noticed that you use:
(hasVisibility ? visibility)
(hasQualifier ? qualifier)
(hasType ? "As" type)
Why not use isDefined?
(isDefined(visibility) ? visibility)
(isDefined(qualifier) ? qualifier)
(isDefined(type) ? "As" type)
I do not think this is the cause of the problem, but you might want to
make this change anyway ;-).
Please, report back when this is done.
Regards,
Frédéric Jouault
Quentin Glineur wrote:
> Hello again and thanks for your interest,
>
> I did not find any error on any console I know. Then, to complete my
> question I am providing an excerpt of the MM and the TCS. (It seems that
> the token stream runs until the My_Parameter name.)
>
> Quentin
>
> ____________________________________________________________ _________
> KM3 :
> ____________________________________________________________ _________
>
> class My_Function extends My_Feature {
> attribute hasVisibility : Boolean;
> attribute visibility[0-1] : VisibilityEnum;
> attribute name : String;
> reference parameters[*] ordered container : My_Parameter;
> attribute return : String;
> reference statements[1-*] ordered container : My_Statement;
> }
>
> class My_Parameter extends My_Data {
> attribute isOptional : Boolean;
> attribute hasQualifier : Boolean;
> attribute qualifier[0-1] : QualifierEnum;
> attribute name : String;
> attribute hasType : Boolean;
> attribute type[0-1] : String;
> attribute hasInitialValue : Boolean;
> }
>
> enumeration QualifierEnum {
> literal byRef;
> literal byVal;
> }
> ____________________________________________________________ _________
> TCS :
> ____________________________________________________________ _________
>
> template My_Function :
> (hasVisibility ? visibility)
> "Function"
> name
> "("
> parameters{separator = ","}
> ")"
> "As"
> return
> statements
> "End Function"
> ;
>
> template My_Parameter :
> (isOptional ? "Optional")
> (hasQualifier ? qualifier)
> name
> (hasType ? "As" type)
> ;
>
> enumerationTemplate QualifierEnum auto :
> #byval = "ByVal",
> #byref = "ByRef"
> ;
>
> ____________________________________________________________ _________
> Compilation output :
> ____________________________________________________________ _________
>
> JARGeneration:
> [antlr] ANTLR Parser Generator Version 2.7.5 (20050128)
> 1989-2005 jGuru.com
> [javac] Compiling 1 source file
> [javac] ----------
> [javac] 1. WARNING in
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
> (at line 5)
> [javac] import antlr.TokenStreamIOException;
> [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> [javac] The import antlr.TokenStreamIOException is never used
> [javac] ----------
> [javac] 2. WARNING in
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
> (at line 6)
> [javac] import antlr.ANTLRException;
> [javac] ^^^^^^^^^^^^^^^^^^^^
> [javac] The import antlr.ANTLRException is never used
> [javac] ----------
> [javac] 3. WARNING in
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
> (at line 7)
> [javac] import antlr.LLkParser;
> [javac] ^^^^^^^^^^^^^^^
> [javac] The import antlr.LLkParser is never used
> [javac] ----------
> [javac] 4. WARNING in
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
> (at line 12)
> [javac] import antlr.MismatchedTokenException;
> [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> [javac] The import antlr.MismatchedTokenException is never used
> [javac] ----------
> [javac] 5. WARNING in
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
> (at line 13)
> [javac] import antlr.SemanticException;
> [javac] ^^^^^^^^^^^^^^^^^^^^^^^
> [javac] The import antlr.SemanticException is never used
> [javac] ----------
> [javac] 5 problems (5 warnings)
> [jar] Building jar:
> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\my-imp orter.jar
> BUILD SUCCESSFUL
> Total time: 2 seconds
>
> ____________________________________________________________ _________
> Parsing output :
> ____________________________________________________________ _________
>
>
>
>
> Frédéric Jouault a écrit :
>> Hello,
>>
>> Are you sure there is no syntactic or lexical error before this NPE?
>> You might want to check all consoles and error logs ;-).
>>
>> My guess is that my_Parameter tries to initialize a property with a
>> null value, but I cannot tell why without seeing both the metamodel
>> and TCS.
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Quentin Glineur wrote:
>>> Hi,
>>>
>>> After a successful build of my TCS file, the parsing generates a
>>> NullPointerException. I am wondering what it can be due to ?
>>> (there is no indeterminism)
>>>
>>> trace :
>>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.asm2E MF(ASMEMFModelElement.java:303)
>>>
>>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:223)
>>>
>>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:903)
>>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:442)
>>> at org.atl.engine.injectors.ebnf.Parser.my_Parameter(Unknown Source)
>>> at org.atl.engine.injectors.ebnf.Parser.my_Function(Unknown Source)
>>>
>>> Quentin
>
>
> ------------------------------------------------------------ ------------
>
>
> Buildfile: D:\workspaces\3.2\workspace\TCSSample\bridgeLight\Injection\ build.xml
>
> injection:
> [am3.loadModel] Loading of model MM
> [am3.loadModel] Loading of model M
> [am3.loadModel] Warning: 1:21-1:35: could not set location of M!<unnamed>, disabling further location settings.
> [am3.loadModel] java.lang.NullPointerException
> [am3.loadModel] at org.atl.engine.repositories.emf4atl.ASMEMFModelElement.asm2E MF(ASMEMFModelElement.java:303)
> [am3.loadModel] at org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:223)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:903)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:442)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.my_Parameter(Unknown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.my_Function(Unknown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.my_Feature(Unknown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.my_ContentElement(Unk nown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.my_Content(Unknown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.vbParser.main(Unknown Source)
> [am3.loadModel] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [am3.loadModel] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> [am3.loadModel] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> [am3.loadModel] at java.lang.reflect.Method.invoke(Unknown Source)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2$ANTLR2Wrapper.pa rse(EBNFInjector2.java:145)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:273)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:243)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:223)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:205)
> [am3.loadModel] at org.atl.engine.injectors.ebnf.EBNFInjector2.inject(EBNFInjec tor2.java:188)
> [am3.loadModel] at org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.ebnfInje ction(AM3AntToolKit.java:235)
> [am3.loadModel] at org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.ebnfInje ction(AM3AntToolKit.java:252)
> [am3.loadModel] at org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.inject(A M3AntToolKit.java:260)
> [am3.loadModel] at org.eclipse.gmt.am3.tools.ant.tasks.LoadModelTask.execute(Lo adModelTask.java:53)
> [am3.loadModel] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.j ava:275)
> [am3.loadModel] at org.apache.tools.ant.Task.perform(Task.java:364)
> [am3.loadModel] at org.apache.tools.ant.Target.execute(Target.java:341)
> [am3.loadModel] at org.apache.tools.ant.Target.performTasks(Target.java:369)
> [am3.loadModel] at org.apache.tools.ant.Project.executeSortedTargets(Project.ja va:1216)
> [am3.loadModel] at org.apache.tools.ant.Project.executeTarget(Project.java:1185 )
> [am3.loadModel] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(D efaultExecutor.java:40)
> [am3.loadModel] at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.exe cuteTargets(EclipseDefaultExecutor.java:32)
> [am3.loadModel] at org.apache.tools.ant.Project.executeTargets(Project.java:106 8)
> [am3.loadModel] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(Inte rnalAntRunner.java:706)
> [am3.loadModel] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(Inte rnalAntRunner.java:457)
> [am3.loadModel] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [am3.loadModel] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> [am3.loadModel] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> [am3.loadModel] at java.lang.reflect.Method.invoke(Unknown Source)
> [am3.loadModel] at org.eclipse.ant.core.AntRunner.run(AntRunner.java:356)
> [am3.loadModel] at org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDe legate$1.run(AntLaunchDelegate.java:230)
> [am3.loadModel] at java.lang.Thread.run(Unknown Source)
> [am3.saveModel] Saving model M
> BUILD SUCCESSFUL
> Total time: 297 milliseconds
|
|
|
Re: [TCS]About NullPointerException [message #601939 is a reply to message #378187] |
Fri, 15 June 2007 09:51  |
Eclipse User |
|
|
|
Originally posted by: quentin.glineur.obeo.fr
Ok, I have tried what you suggested but it did not bring any enhancement.
Though I have noticed that the tag for My_Function is outside the
My_Content tag (as it should) i.e :
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="obeo"
xmlns:_1="expressions" xmlns:_2="features">
<My_Content>
...
</My_Content>
<_2:My_Function visibility="public" name="add"/>
<_2:My_Parameter/>
</xmi:XMI>
If it could help your diagnostic...
Regards,
Quentin
Frédéric Jouault a écrit :
> Hello,
>
> I am not sure where the problem is.
>
> However, I noticed that you use:
> (hasVisibility ? visibility)
> (hasQualifier ? qualifier)
> (hasType ? "As" type)
>
> Why not use isDefined?
>
> (isDefined(visibility) ? visibility)
> (isDefined(qualifier) ? qualifier)
> (isDefined(type) ? "As" type)
>
> I do not think this is the cause of the problem, but you might want to
> make this change anyway ;-).
>
> Please, report back when this is done.
>
>
> Regards,
>
> Frédéric Jouault
>
>
> Quentin Glineur wrote:
>> Hello again and thanks for your interest,
>>
>> I did not find any error on any console I know. Then, to complete my
>> question I am providing an excerpt of the MM and the TCS. (It seems
>> that the token stream runs until the My_Parameter name.)
>>
>> Quentin
>>
>> ____________________________________________________________ _________
>> KM3 :
>> ____________________________________________________________ _________
>>
>> class My_Function extends My_Feature {
>> attribute hasVisibility : Boolean;
>> attribute visibility[0-1] : VisibilityEnum;
>> attribute name : String;
>> reference parameters[*] ordered container : My_Parameter;
>> attribute return : String;
>> reference statements[1-*] ordered container : My_Statement;
>> }
>>
>> class My_Parameter extends My_Data {
>> attribute isOptional : Boolean;
>> attribute hasQualifier : Boolean;
>> attribute qualifier[0-1] : QualifierEnum;
>> attribute name : String;
>> attribute hasType : Boolean;
>> attribute type[0-1] : String;
>> attribute hasInitialValue : Boolean;
>> }
>>
>> enumeration QualifierEnum {
>> literal byRef;
>> literal byVal;
>> }
>> ____________________________________________________________ _________
>> TCS :
>> ____________________________________________________________ _________
>>
>> template My_Function :
>> (hasVisibility ? visibility)
>> "Function"
>> name
>> "("
>> parameters{separator = ","}
>> ")"
>> "As"
>> return
>> statements
>> "End Function"
>> ;
>>
>> template My_Parameter :
>> (isOptional ? "Optional")
>> (hasQualifier ? qualifier)
>> name
>> (hasType ? "As" type)
>> ;
>>
>> enumerationTemplate QualifierEnum auto :
>> #byval = "ByVal",
>> #byref = "ByRef"
>> ;
>>
>> ____________________________________________________________ _________
>> Compilation output :
>> ____________________________________________________________ _________
>>
>> JARGeneration:
>> [antlr] ANTLR Parser Generator Version 2.7.5 (20050128)
>> 1989-2005 jGuru.com
>> [javac] Compiling 1 source file
>> [javac] ----------
>> [javac] 1. WARNING in
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
>> (at line 5)
>> [javac] import antlr.TokenStreamIOException;
>> [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> [javac] The import antlr.TokenStreamIOException is never used
>> [javac] ----------
>> [javac] 2. WARNING in
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
>> (at line 6)
>> [javac] import antlr.ANTLRException;
>> [javac] ^^^^^^^^^^^^^^^^^^^^
>> [javac] The import antlr.ANTLRException is never used
>> [javac] ----------
>> [javac] 3. WARNING in
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
>> (at line 7)
>> [javac] import antlr.LLkParser;
>> [javac] ^^^^^^^^^^^^^^^
>> [javac] The import antlr.LLkParser is never used
>> [javac] ----------
>> [javac] 4. WARNING in
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
>> (at line 12)
>> [javac] import antlr.MismatchedTokenException;
>> [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> [javac] The import antlr.MismatchedTokenException is never used
>> [javac] ----------
>> [javac] 5. WARNING in
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\org\at l\engine\injectors\ebnf\myParser.java
>> (at line 13)
>> [javac] import antlr.SemanticException;
>> [javac] ^^^^^^^^^^^^^^^^^^^^^^^
>> [javac] The import antlr.SemanticException is never used
>> [javac] ----------
>> [javac] 5 problems (5 warnings)
>> [jar] Building jar:
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\TCS\my-imp orter.jar
>> BUILD SUCCESSFUL
>> Total time: 2 seconds
>>
>> ____________________________________________________________ _________
>> Parsing output :
>> ____________________________________________________________ _________
>>
>>
>>
>>
>> Frédéric Jouault a écrit :
>>> Hello,
>>>
>>> Are you sure there is no syntactic or lexical error before this NPE?
>>> You might want to check all consoles and error logs ;-).
>>>
>>> My guess is that my_Parameter tries to initialize a property with a
>>> null value, but I cannot tell why without seeing both the metamodel
>>> and TCS.
>>>
>>>
>>> Regards,
>>>
>>> Frédéric Jouault
>>>
>>>
>>> Quentin Glineur wrote:
>>>> Hi,
>>>>
>>>> After a successful build of my TCS file, the parsing generates a
>>>> NullPointerException. I am wondering what it can be due to ?
>>>> (there is no indeterminism)
>>>>
>>>> trace :
>>>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.asm2E MF(ASMEMFModelElement.java:303)
>>>>
>>>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:223)
>>>>
>>>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:903)
>>>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:442)
>>>> at org.atl.engine.injectors.ebnf.Parser.my_Parameter(Unknown Source)
>>>> at org.atl.engine.injectors.ebnf.Parser.my_Function(Unknown Source)
>>>>
>>>> Quentin
>>
>>
>> ------------------------------------------------------------ ------------
>>
>>
>> Buildfile:
>> D:\workspaces\3.2\workspace\TCSSample\bridgeLight\Injection\ build.xml
>>
>> injection:
>> [am3.loadModel] Loading of model MM
>> [am3.loadModel] Loading of model M
>> [am3.loadModel] Warning: 1:21-1:35: could not set location of
>> M!<unnamed>, disabling further location settings.
>> [am3.loadModel] java.lang.NullPointerException
>> [am3.loadModel] at
>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.asm2E MF(ASMEMFModelElement.java:303)
>>
>> [am3.loadModel] at
>> org.atl.engine.repositories.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:223)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:903)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.set(EBNFInjector 2.java:442)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.my_Parameter(Unknown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.my_Function(Unknown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.my_Feature(Unknown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.my_ContentElement(Unk nown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.my_Content(Unknown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.vbParser.main(Unknown Source)
>> [am3.loadModel] at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> [am3.loadModel] at
>> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> [am3.loadModel] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> [am3.loadModel] at java.lang.reflect.Method.invoke(Unknown Source)
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2$ANTLR2Wrapper.pa rse(EBNFInjector2.java:145)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:273)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:243)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:223)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.performImportati on(EBNFInjector2.java:205)
>>
>> [am3.loadModel] at
>> org.atl.engine.injectors.ebnf.EBNFInjector2.inject(EBNFInjec tor2.java:188)
>>
>> [am3.loadModel] at
>> org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.ebnfInje ction(AM3AntToolKit.java:235)
>>
>> [am3.loadModel] at
>> org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.ebnfInje ction(AM3AntToolKit.java:252)
>>
>> [am3.loadModel] at
>> org.eclipse.gmt.am3.tools.ant.toolkit.AM3AntToolKit.inject(A M3AntToolKit.java:260)
>>
>> [am3.loadModel] at
>> org.eclipse.gmt.am3.tools.ant.tasks.LoadModelTask.execute(Lo adModelTask.java:53)
>>
>> [am3.loadModel] at
>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.j ava:275)
>> [am3.loadModel] at org.apache.tools.ant.Task.perform(Task.java:364)
>> [am3.loadModel] at
>> org.apache.tools.ant.Target.execute(Target.java:341)
>> [am3.loadModel] at
>> org.apache.tools.ant.Target.performTasks(Target.java:369)
>> [am3.loadModel] at
>> org.apache.tools.ant.Project.executeSortedTargets(Project.ja va:1216)
>> [am3.loadModel] at
>> org.apache.tools.ant.Project.executeTarget(Project.java:1185 )
>> [am3.loadModel] at
>> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(D efaultExecutor.java:40)
>>
>> [am3.loadModel] at
>> org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.exe cuteTargets(EclipseDefaultExecutor.java:32)
>>
>> [am3.loadModel] at
>> org.apache.tools.ant.Project.executeTargets(Project.java:106 8)
>> [am3.loadModel] at
>> org.eclipse.ant.internal.core.ant.InternalAntRunner.run(Inte rnalAntRunner.java:706)
>>
>> [am3.loadModel] at
>> org.eclipse.ant.internal.core.ant.InternalAntRunner.run(Inte rnalAntRunner.java:457)
>>
>> [am3.loadModel] at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> [am3.loadModel] at
>> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> [am3.loadModel] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> [am3.loadModel] at java.lang.reflect.Method.invoke(Unknown Source)
>> [am3.loadModel] at
>> org.eclipse.ant.core.AntRunner.run(AntRunner.java:356)
>> [am3.loadModel] at
>> org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDe legate$1.run(AntLaunchDelegate.java:230)
>>
>> [am3.loadModel] at java.lang.Thread.run(Unknown Source)
>> [am3.saveModel] Saving model M
>> BUILD SUCCESSFUL
>> Total time: 297 milliseconds
|
|
|
Re: [TCS]About NullPointerException [message #601943 is a reply to message #378190] |
Fri, 15 June 2007 09:59  |
Eclipse User |
|
|
|
Hello,
> Ok, I have tried what you suggested but it did not bring any enhancement.
The enhancement is that you can remove unnecessary Boolean attributes ;-).
> Though I have noticed that the tag for My_Function is outside the
> My_Content tag (as it should) i.e :
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="obeo"
> xmlns:_1="expressions" xmlns:_2="features">
> <My_Content>
> ...
> </My_Content>
> <_2:My_Function visibility="public" name="add"/>
> <_2:My_Parameter/>
> </xmi:XMI>
>
> If it could help your diagnostic...
This is probably caused by the error, of which it is therefore a
symptom, not a cause.
Is it possible for you to package your KM3 metamodel, TCS model, and at
least a sample and post it here, so that I can try to reproduce the problem?
Regards,
Frédéric Jouault
|
|
|
Re: [TCS]About NullPointerException [message #601954 is a reply to message #378191] |
Fri, 15 June 2007 10:21  |
Eclipse User |
|
|
|
Originally posted by: quentin.glineur.obeo.fr
This is a multi-part message in MIME format.
--------------070902080003070704040908
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Here it comes !
As a matter of fact, the KM3 and the TCS have been gotten by generation
hence their form.
The test file is adapted from one of the melon project.
Regards,
Quentin
Fr
|
|
|
Re: [TCS]About NullPointerException [message #601980 is a reply to message #378192] |
Fri, 15 June 2007 14:57  |
Eclipse User |
|
|
|
Hello,
Your problem is that the byRef and byVal enumeration literals are
spelled byref and byval in the TCS. This is strange for a generated file
;-).
Checking for this kind of problem is already in the TODO list for the
TCS2Problem transformation.
Another problem I discovered: you should use "End" "Function" not "End
Function", because End and Function are two separate keywords.
You might also be interested in the VB zoo, which uses a VisualBasic
metamodel and TCS:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmt/AM3 /org.eclipse.am3.zoos.atlanticVB/build/?root=Technology_Proj ect
Best regards,
Frédéric Jouault
Quentin Glineur wrote:
> Here it comes !
> As a matter of fact, the KM3 and the TCS have been gotten by generation
> hence their form.
>
> The test file is adapted from one of the melon project.
>
> Regards,
> Quentin
>
> Frédéric Jouault a écrit :
>> Hello,
>>
>> > Ok, I have tried what you suggested but it did not bring any
>> enhancement.
>>
>> The enhancement is that you can remove unnecessary Boolean attributes
>> ;-).
>>
>>
>> > Though I have noticed that the tag for My_Function is outside the
>> > My_Content tag (as it should) i.e :
>> >
>> > <?xml version="1.0" encoding="ISO-8859-1"?>
>> > <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="obeo"
>> > xmlns:_1="expressions" xmlns:_2="features">
>> > <My_Content>
>> > ...
>> > </My_Content>
>> > <_2:My_Function visibility="public" name="add"/>
>> > <_2:My_Parameter/>
>> > </xmi:XMI>
>> >
>> > If it could help your diagnostic...
>>
>> This is probably caused by the error, of which it is therefore a
>> symptom, not a cause.
>>
>>
>> Is it possible for you to package your KM3 metamodel, TCS model, and
>> at least a sample and post it here, so that I can try to reproduce the
>> problem?
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>
>
> ------------------------------------------------------------ ------------
>
> package PrimitiveTypes {
>
> datatype String;
>
> datatype Boolean;
>
> datatype Integer;
> }
>
> package fr {
>
> package obeo {
>
> abstract class My_LangElement {
> attribute comment[0-1] : String;
> attribute endLineComment[0-1] : String;
> attribute naming[0-1] : String;
> attribute elementId[0-1] : String;
> attribute write : String;
> reference typing[0-1] : My_LangElement;
> reference crossReferences[*] ordered : My_LangElement;
> }
>
> class My_Content extends My_LangElement {
> reference elements[*] ordered container : My_ContentElement;
> }
>
>
> abstract class My_ContentElement extends My_LangElement {
>
> }
>
> class My_FileAttribute extends My_ContentElement {
> attribute name : String;
> reference initialValue[1-*] ordered container : My_Expression;
> }
>
> class My_Option extends My_ContentElement {
> attribute name : String;
> attribute hasEnablement : Boolean;
> attribute enablement[0-1] : EnablementEnum;
> }
>
> abstract class My_Data {
> }
> }
>
> package features {
>
> abstract class My_Feature extends My_Data, My_ContentElement {
> }
>
> class My_Function extends My_Feature {
> -- attribute hasVisibility : Boolean;
> attribute visibility[0-1] : VisibilityEnum;
> attribute name : String;
> reference parameters[*] ordered container : My_Parameter;
> attribute return : String;
> reference statements[1-*] ordered container : My_Statement;
> }
>
> class My_Parameter extends My_Data {
> attribute isOptional : Boolean;
> -- attribute hasQualifier : Boolean;
> attribute qualifier[0-1] : QualifierEnum;
> attribute name : String;
> -- attribute hasType : Boolean;
> attribute type[0-1] : String;
> attribute hasInitialValue : Boolean;
> }
> }
>
> package statements {
>
> abstract class My_Modifier extends My_LangElement {
> }
>
> abstract class My_Statement extends My_Modifier {
> }
>
> class My_RawBody extends My_Statement {
> attribute value[0-1] : String;
> }
> }
>
> package expressions {
>
> abstract class My_Expression extends My_LangElement {
> }
>
> class My_NegativeExpression extends My_Expression {
> reference expression container : My_Expression;
> }
>
>
> abstract class My_Value extends My_Expression {
> }
>
> abstract class My_Literal extends My_Value {
> }
>
> class My_Literal_Literal extends My_Literal {
> attribute value : String;
> }
>
> class My_Literal_Number extends My_Literal {
> attribute value : String;
> }
>
> class My_Literal_Value extends My_Literal {
> attribute value : String;
> }
>
> }
>
>
> package enumerations {
>
> enumeration EnablementEnum {
> literal Off;
> literal On;
> }
>
> enumeration VisibilityEnum {
> literal private;
> literal protected;
> literal public;
> }
>
> enumeration QualifierEnum {
> literal byRef;
> literal byVal;
> }
>
> }
> }
>
>
> ------------------------------------------------------------ ------------
>
> syntax vb {
>
> primitiveTemplate numberSymbol for String using NUMBER_PATTERN :
> value = "%token%";
>
> primitiveTemplate identifierSymbol for String default using IDENTIFIER_PATTERN :
> value = "%token%";
>
> primitiveTemplate literalSymbol for String using LITERAL_PATTERN :
> value = "%token%";
>
> primitiveTemplate valueSymbol for String using VALUE_PATTERN :
> value = "%token%";
>
> primitiveTemplate bodySymbol for String using BODY :
> value = "%token%";
>
> template My_Content main :
> elements
> ;
>
> template My_ContentElement abstract
> ;
>
> template My_FileAttribute :
> "Attribute"
> name
> "="
> initialValue{separator = ","}
> ;
>
> template My_Option :
> "Option"
> name
> (isDefined(enablement) ? enablement)
> ;
>
>
> template My_Feature abstract
> ;
>
> template My_Data abstract
> ;
>
> template My_RawBody :
> value{as = bodySymbol}
> ;
>
> template My_Function
> :
> (isDefined(visibility) ? visibility)
> "Function" name "(" parameters{separator = ","} ")" "As" return statements "End Function"
> ;
>
>
> template My_Parameter :
> (isOptional ? "Optional")
> (isDefined(qualifier) ? qualifier)
> name
> (isDefined(type) ? "As" type)
> ;
>
>
> template My_Statement abstract
> ;
>
>
> template My_Expression abstract
> ;
>
>
> template My_Value abstract
> ;
>
>
> template My_Literal abstract
> ;
>
> template My_Literal_Literal :
> value{as = literalSymbol}
> ;
>
>
> enumerationTemplate EnablementEnum auto :
> #off = "Off",
> #on = "On"
> ;
>
> enumerationTemplate VisibilityEnum auto :
> #public = "Public",
> #protected = "Protected",
> #private = "Private"
> ;
>
> enumerationTemplate QualifierEnum auto :
> #byval = "ByVal",
> #byref = "ByRef"
> ;
>
>
> symbols {
> parenthesisBegin = "(";
> parenthesisEnd = ")";
> coma = ",";
> dot = ".";
> eq = "=";
> }
>
>
> lexer = "
> class vbLexer extends Lexer;
>
> options {
> k = 5;
> charVocabulary = '\\0' .. '\\u00FF';
> testLiterals = false;
> }
>
> {
>
> protected Token makeToken(int t) {
> org.atl.engine.injectors.ebnf.LocationToken ret = null;
> tokenObjectClass = org.atl.engine.injectors.ebnf.LocationToken.class;
> ret = (org.atl.engine.injectors.ebnf.LocationToken)super.makeToken (t);
> ret.setEndLine(getLine());
> ret.setEndColumn(getColumn());
> return ret;
> }
>
> }
>
> protected
> NL
> : ( '\\r' '\\n'
> | '\\r'
> | '\\n'
> )
> {newline();}
> ;
>
> WS
> : ( ' '
> | '\\t'
> | NL
> )
> { $setType(Token.SKIP); }
> ;
>
> COMMENT
> : '\\''
> (~( '\\r'|'\\n'))*
> { $setType(Token.SKIP); }
> ;
>
> NUMBER_PATTERN
> : (NUMBER_REGEX)
> ;
>
> IDENTIFIER_PATTERN options{testLiterals=true;}
> : (IDENTIFIER_REGEX)
> ;
>
> LITERAL_PATTERN
> : (LITERAL_REGEX)
> ;
>
> VALUE_PATTERN
> : ( EVAL_REGEX | DATE_REGEX)
> ;
>
> //////////////////////////////////////////////////////////// //////////
>
> protected NUMBER_REGEX
> : ('0'..'9')+
> ('.' ('0'..'9')+)?
> ('!')?
> {System.out.println(\"Number : \" + $getText);}
> ;
>
> protected ALPHA
> : 'a'..'z'
> | 'A'..'Z'
> //For Unicode compatibility (from 0000 to 00ff)
> | '\\u00C0' .. '\\u00D6'
> | '\\u00D8' .. '\\u00F6'
> | '\\u00F8' .. '\\u00FF'
> ;
>
> protected
> DIGIT
> : '0'..'9'
> ;
>
> protected IDENTIFIER_CHAR
> : ('_' | ALPHA | DIGIT | '&')
> ;
>
> protected UNDERSCORED_CHAR
> : '_' IDENTIFIER_CHAR
> ;
>
> protected IDENTIFIER_REGEX
> : (ALPHA | UNDERSCORED_CHAR)
> (IDENTIFIER_CHAR)*
> {System.out.println(\"Identifier : \" + $getText);}
> ;
>
> protected EVAL_REGEX
> : '&'(ALPHA)+('&')?
> ;
>
> protected DATE_REGEX
> : '#' (DIGIT '/')+ '#'
> ;
>
> protected LITERAL_REGEX
> : '\"' ( ~('\"'))* '\"'
> {System.out.println(\"Literal : \" + $getText);}
> ;
>
> BODY
> : ('$'(options{greedy=false;}:('\\n' {newline();}| ~ '\\n'))* '$')
> {System.out.println(\"Body : \" + $getText);}
> ;
>
>
> ";
>
> }
>
>
> ------------------------------------------------------------ ------------
>
> Attribute VB_Name = "mMelonCtls_i"
> Option Explicit
>
> Public Function g_ControlSetValue(ByRef Control As MControl, ByVal Value As Long) As Boolean
> $
> If (Control Is Nothing) Then _
> Exit Function
>
> Control.Value = Value
> g_ControlSetValue = True
> $
> End Function
>
> Public Function g_ControlGetValue(ByRef Control As MControl, ByRef Value As Long) As Boolean
> $
> If (Control Is Nothing) Then _
> Exit Function
>
> Value = Control.Value
> g_ControlGetValue = True
> $
> End Function
>
> Public Function g_SliderInit(ByRef Slider As MControl, Optional ByVal Min As Long, Optional ByVal Max As Long, Optional ByVal Value As Long) As Boolean
> $
> If (Slider Is Nothing) Then _
> Exit Function
>
> On Error Resume Next
>
> Dim ps As CSlider
>
> Err.Clear
> Set ps = Slider
> If Err.Number = 0 Then
> If Min <> -1 Then _
> ps.Min = Min
>
> If Max <> -1 Then _
> ps.Max = Max
>
> If Value <> -1 Then _
> ps.Value = Value
>
> g_SliderInit = True
> End If
> $
> End Function
|
|
|
Re: [TCS]About NullPointerException [message #602020 is a reply to message #378195] |
Mon, 18 June 2007 04:24  |
Eclipse User |
|
|
|
Originally posted by: quentin.glineur.obeo.fr
Frédéric Jouault a écrit :
Hello,
> Hello,
>
> Your problem is that the byRef and byVal enumeration literals are
> spelled byref and byval in the TCS. This is strange for a generated file
> ;-).
Yet, you are right, this is one of the only piece of my code that are
still handcrafted !
> Checking for this kind of problem is already in the TODO list for the
> TCS2Problem transformation.
Great ! As a grain of sand, it has been jamming my work for quite long
time without being quickly identifiable: so thanks for your help !
>
> Another problem I discovered: you should use "End" "Function" not "End
> Function", because End and Function are two separate keywords.
>
Ok, this one is now fixed.
> You might also be interested in the VB zoo, which uses a VisualBasic
> metamodel and TCS:
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmt/AM3 /org.eclipse.am3.zoos.atlanticVB/build/?root=Technology_Proj ect
>
Thanks a lot, I will use it as inspiration !
Regards,
Quentin
>
> Best regards,
>
> Frédéric Jouault
>
>
> Quentin Glineur wrote:
>> Here it comes !
>> As a matter of fact, the KM3 and the TCS have been gotten by
>> generation hence their form.
>>
>> The test file is adapted from one of the melon project.
>>
>> Regards,
>> Quentin
>>
>> Frédéric Jouault a écrit :
>>> Hello,
>>>
>>> > Ok, I have tried what you suggested but it did not bring any
>>> enhancement.
>>>
>>> The enhancement is that you can remove unnecessary Boolean attributes
>>> ;-).
>>>
>>>
>>> > Though I have noticed that the tag for My_Function is outside the
>>> > My_Content tag (as it should) i.e :
>>> >
>>> > <?xml version="1.0" encoding="ISO-8859-1"?>
>>> > <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="obeo"
>>> > xmlns:_1="expressions" xmlns:_2="features">
>>> > <My_Content>
>>> > ...
>>> > </My_Content>
>>> > <_2:My_Function visibility="public" name="add"/>
>>> > <_2:My_Parameter/>
>>> > </xmi:XMI>
>>> >
>>> > If it could help your diagnostic...
>>>
>>> This is probably caused by the error, of which it is therefore a
>>> symptom, not a cause.
>>>
>>>
>>> Is it possible for you to package your KM3 metamodel, TCS model, and
>>> at least a sample and post it here, so that I can try to reproduce
>>> the problem?
>>>
>>>
>>> Regards,
>>>
>>> Frédéric Jouault
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> package PrimitiveTypes {
>>
>> datatype String;
>>
>> datatype Boolean;
>>
>> datatype Integer;
>> }
>>
>> package fr {
>>
>> package obeo {
>>
>> abstract class My_LangElement {
>> attribute comment[0-1] : String;
>> attribute endLineComment[0-1] : String;
>> attribute naming[0-1] : String;
>> attribute elementId[0-1] : String;
>> attribute write : String;
>> reference typing[0-1] : My_LangElement;
>> reference crossReferences[*] ordered : My_LangElement;
>> }
>>
>> class My_Content extends My_LangElement {
>> reference elements[*] ordered container : My_ContentElement;
>> }
>>
>>
>> abstract class My_ContentElement extends My_LangElement {
>>
>> }
>>
>> class My_FileAttribute extends My_ContentElement {
>> attribute name : String;
>> reference initialValue[1-*] ordered container : My_Expression;
>> }
>>
>> class My_Option extends My_ContentElement {
>> attribute name : String;
>> attribute hasEnablement : Boolean;
>> attribute enablement[0-1] : EnablementEnum;
>> }
>>
>> abstract class My_Data {
>> }
>> }
>>
>> package features {
>>
>> abstract class My_Feature extends My_Data, My_ContentElement
>> {
>> }
>>
>> class My_Function extends My_Feature {
>> -- attribute hasVisibility : Boolean;
>> attribute visibility[0-1] : VisibilityEnum;
>> attribute name : String;
>> reference parameters[*] ordered container : My_Parameter;
>> attribute return : String;
>> reference statements[1-*] ordered container : My_Statement;
>> }
>>
>> class My_Parameter extends My_Data {
>> attribute isOptional : Boolean;
>> -- attribute hasQualifier : Boolean;
>> attribute qualifier[0-1] : QualifierEnum;
>> attribute name : String;
>> -- attribute hasType : Boolean;
>> attribute type[0-1] : String;
>> attribute hasInitialValue : Boolean;
>> }
>> }
>>
>> package statements {
>>
>> abstract class My_Modifier extends My_LangElement
>> {
>> }
>>
>> abstract class My_Statement extends My_Modifier {
>> }
>>
>> class My_RawBody extends My_Statement {
>> attribute value[0-1] : String;
>> }
>> }
>>
>> package expressions {
>>
>> abstract class My_Expression extends My_LangElement
>> {
>> }
>>
>> class My_NegativeExpression extends My_Expression {
>> reference expression container : My_Expression;
>> }
>>
>>
>> abstract class My_Value extends My_Expression {
>> }
>>
>> abstract class My_Literal extends My_Value {
>> }
>>
>> class My_Literal_Literal extends My_Literal {
>> attribute value : String;
>> }
>>
>> class My_Literal_Number extends My_Literal {
>> attribute value : String;
>> }
>>
>> class My_Literal_Value extends My_Literal {
>> attribute value : String;
>> }
>>
>> }
>>
>>
>> package enumerations {
>>
>> enumeration EnablementEnum {
>> literal Off;
>> literal On;
>> }
>>
>> enumeration VisibilityEnum {
>> literal private;
>> literal protected;
>> literal public;
>> }
>>
>> enumeration QualifierEnum {
>> literal byRef;
>> literal byVal;
>> }
>>
>> }
>> }
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> syntax vb {
>>
>> primitiveTemplate numberSymbol for String using NUMBER_PATTERN :
>> value = "%token%";
>>
>> primitiveTemplate identifierSymbol for String default using
>> IDENTIFIER_PATTERN :
>> value = "%token%";
>>
>> primitiveTemplate literalSymbol for String using LITERAL_PATTERN :
>> value = "%token%";
>>
>> primitiveTemplate valueSymbol for String using VALUE_PATTERN :
>> value = "%token%";
>>
>> primitiveTemplate bodySymbol for String using BODY :
>> value = "%token%";
>>
>> template My_Content main :
>> elements
>> ;
>>
>> template My_ContentElement abstract ;
>>
>> template My_FileAttribute :
>> "Attribute"
>> name
>> "="
>> initialValue{separator = ","}
>> ;
>>
>> template My_Option :
>> "Option"
>> name
>> (isDefined(enablement) ? enablement)
>> ;
>>
>>
>> template My_Feature abstract ;
>>
>> template My_Data abstract ;
>>
>> template My_RawBody :
>> value{as = bodySymbol}
>> ;
>>
>> template My_Function
>> :
>> (isDefined(visibility) ? visibility)
>> "Function" name "(" parameters{separator = ","} ")" "As"
>> return statements "End Function"
>> ;
>>
>>
>> template My_Parameter :
>> (isOptional ? "Optional")
>> (isDefined(qualifier) ? qualifier) name
>> (isDefined(type) ? "As" type)
>> ;
>>
>>
>> template My_Statement abstract ;
>>
>>
>> template My_Expression abstract
>> ;
>>
>>
>> template My_Value abstract ;
>>
>>
>> template My_Literal abstract
>> ;
>>
>> template My_Literal_Literal :
>> value{as = literalSymbol}
>> ;
>>
>>
>> enumerationTemplate EnablementEnum auto :
>> #off = "Off",
>> #on = "On"
>> ;
>>
>> enumerationTemplate VisibilityEnum auto :
>> #public = "Public",
>> #protected = "Protected",
>> #private = "Private"
>> ;
>>
>> enumerationTemplate QualifierEnum auto :
>> #byval = "ByVal",
>> #byref = "ByRef"
>> ;
>>
>>
>> symbols {
>> parenthesisBegin = "(";
>> parenthesisEnd = ")";
>> coma = ",";
>> dot = ".";
>> eq = "=";
>> }
>>
>>
>> lexer = "
>> class vbLexer extends Lexer;
>>
>> options {
>> k = 5;
>> charVocabulary = '\\0' .. '\\u00FF';
>> testLiterals = false;
>> }
>>
>> {
>>
>> protected Token makeToken(int t) {
>> org.atl.engine.injectors.ebnf.LocationToken ret = null;
>> tokenObjectClass =
>> org.atl.engine.injectors.ebnf.LocationToken.class;
>> ret =
>> (org.atl.engine.injectors.ebnf.LocationToken)super.makeToken (t);
>> ret.setEndLine(getLine());
>> ret.setEndColumn(getColumn());
>> return ret;
>> }
>>
>> }
>>
>> protected
>> NL
>> : ( '\\r' '\\n'
>> | '\\r'
>> | '\\n'
>> )
>> {newline();}
>> ;
>>
>> WS
>> : ( ' '
>> | '\\t'
>> | NL
>> )
>> { $setType(Token.SKIP); }
>> ;
>>
>> COMMENT
>> : '\\''
>> (~( '\\r'|'\\n'))*
>> { $setType(Token.SKIP); }
>> ;
>>
>> NUMBER_PATTERN
>> : (NUMBER_REGEX)
>> ;
>>
>> IDENTIFIER_PATTERN options{testLiterals=true;}
>> : (IDENTIFIER_REGEX)
>> ;
>>
>> LITERAL_PATTERN
>> : (LITERAL_REGEX)
>> ;
>>
>> VALUE_PATTERN
>> : ( EVAL_REGEX | DATE_REGEX)
>> ;
>>
>> //////////////////////////////////////////////////////////// //////////
>>
>> protected NUMBER_REGEX
>> : ('0'..'9')+
>> ('.' ('0'..'9')+)?
>> ('!')?
>> {System.out.println(\"Number : \" + $getText);}
>> ;
>>
>> protected ALPHA
>> : 'a'..'z'
>> | 'A'..'Z'
>> //For Unicode compatibility (from 0000 to 00ff)
>> | '\\u00C0' .. '\\u00D6'
>> | '\\u00D8' .. '\\u00F6'
>> | '\\u00F8' .. '\\u00FF'
>> ;
>>
>> protected
>> DIGIT
>> : '0'..'9'
>> ;
>>
>> protected IDENTIFIER_CHAR
>> : ('_' | ALPHA | DIGIT | '&')
>> ;
>>
>> protected UNDERSCORED_CHAR
>> : '_' IDENTIFIER_CHAR
>> ;
>>
>> protected IDENTIFIER_REGEX
>> : (ALPHA | UNDERSCORED_CHAR)
>> (IDENTIFIER_CHAR)*
>> {System.out.println(\"Identifier : \" + $getText);}
>> ;
>>
>> protected EVAL_REGEX
>> : '&'(ALPHA)+('&')?
>> ;
>>
>> protected DATE_REGEX
>> : '#' (DIGIT '/')+ '#'
>> ;
>>
>> protected LITERAL_REGEX
>> : '\"' ( ~('\"'))* '\"'
>> {System.out.println(\"Literal : \" + $getText);}
>> ;
>>
>> BODY
>> : ('$'(options{greedy=false;}:('\\n' {newline();}| ~ '\\n'))* '$')
>> {System.out.println(\"Body : \" + $getText);}
>> ;
>>
>>
>> ";
>>
>> }
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> Attribute VB_Name = "mMelonCtls_i"
>> Option Explicit
>>
>> Public Function g_ControlSetValue(ByRef Control As MControl, ByVal
>> Value As Long) As Boolean
>> $
>> If (Control Is Nothing) Then _
>> Exit Function
>>
>> Control.Value = Value
>> g_ControlSetValue = True
>> $
>> End Function
>>
>> Public Function g_ControlGetValue(ByRef Control As MControl, ByRef
>> Value As Long) As Boolean
>> $
>> If (Control Is Nothing) Then _
>> Exit Function
>>
>> Value = Control.Value
>> g_ControlGetValue = True
>> $
>> End Function
>>
>> Public Function g_SliderInit(ByRef Slider As MControl, Optional ByVal
>> Min As Long, Optional ByVal Max As Long, Optional ByVal Value As Long)
>> As Boolean
>> $
>> If (Slider Is Nothing) Then _
>> Exit Function
>>
>> On Error Resume Next
>>
>> Dim ps As CSlider
>>
>> Err.Clear
>> Set ps = Slider
>> If Err.Number = 0 Then
>> If Min <> -1 Then _
>> ps.Min = Min
>>
>> If Max <> -1 Then _
>> ps.Max = Max
>>
>> If Value <> -1 Then _
>> ps.Value = Value
>>
>> g_SliderInit = True
>> End If
>> $
>> End Function
|
|
|
Re: [TCS]About NullPointerException [message #602715 is a reply to message #378260] |
Thu, 19 July 2007 10:25  |
Eclipse User |
|
|
|
Originally posted by: remi.viaux.mbda-systems.com
Hi Quentin,
Regenerate the ecore metamodel from you're km3 metamodel.
I had the same error that you Null pointer exception, and I had just
modified km3 file and forget to udate the ecore one.
After the regeneration, no more error appears
It's maybe another problem that you have, but just try ; it's easy to
check ^^
Regards,
Remi Viaux
|
|
|
Re: [TCS]About NullPointerException [message #602721 is a reply to message #378515] |
Thu, 19 July 2007 11:13  |
Eclipse User |
|
|
|
Originally posted by: quentin.glineur.obeo.fr
This is a multi-part message in MIME format.
--------------080607090607080802030600
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Hi Remi,
I am sorry but I do not understand your post :-/
If you are trying to get an injector from the files I have posted, be
sure to fix them the way Frederic told (i.e. correct the literal names
(byRef, byVal) either in KM3 or in TCS).
Regards,
Quentin GLINEUR
Remi Viaux a
|
|
|
Goto Forum:
Current Time: Sat Apr 26 11:46:16 EDT 2025
Powered by FUDForum. Page generated in 0.04894 seconds
|