Parse an OCL String without any Kind Information [message #527776] |
Fri, 16 April 2010 12:50 |
Eclipse User |
|
|
|
Originally posted by: philipp.berger.student.hpi.uni-potsdam.de
Hey guys,
I currently working with ecore.OCL and I want to traverse and use an AST
of an OCLExpression. My problem is, that any helper I found require a
ConstraintKind.
Is there any possibility to convert a given String to an OCLExpression
without any Kind information?
Where can I locate such a parsing method?
Currently I just assume that myExpression is an Invariant (it can be
everything, post/body/init/def)
OCL ocl = org.eclipse.ocl.ecore.OCL.newInstance();
Helper helper = ocl.createOCLHelper();
OCLExpression<EClassifier>
myExpression=helper.createConstraint(ConstraintKind.INVARIAN T,
myExpressionAsString).getSpecification().getBodyExpression() ;
Can I assume that no matter which Kind I give the returned expression
spans the same AST?
Regards,
Phil
|
|
|
|
Re: Parse an OCL String without any Kind Information [message #527792 is a reply to message #527778] |
Fri, 16 April 2010 13:08 |
Eclipse User |
|
|
|
Originally posted by: philipp.berger.student.hpi.uni-potsdam.de
Hey Ed,
actually, there is no reason...
I beg your pardon, but I overlooked this method.
Thanks
Am 16.04.2010 14:56, schrieb Ed Willink:
> Hi Philipp
>
> An invariant is supposed to be Boolean valued, so if you do too much
> something may complain that your AST is not Boolean.
>
> Is there any reason why you don't just use createQuery(String) ?
>
> Regards
>
> Ed Willink
>
> On 16/04/2010 13:50, Philipp Berger wrote:
>> Hey guys,
>> I currently working with ecore.OCL and I want to traverse and use an AST
>> of an OCLExpression. My problem is, that any helper I found require a
>> ConstraintKind.
>> Is there any possibility to convert a given String to an OCLExpression
>> without any Kind information?
>> Where can I locate such a parsing method?
>>
>> Currently I just assume that myExpression is an Invariant (it can be
>> everything, post/body/init/def)
>>
>> OCL ocl = org.eclipse.ocl.ecore.OCL.newInstance();
>> Helper helper = ocl.createOCLHelper();
>> OCLExpression<EClassifier>
>> myExpression=helper.createConstraint(ConstraintKind.INVARIAN T,
>> myExpressionAsString).getSpecification().getBodyExpression() ;
>>
>> Can I assume that no matter which Kind I give the returned expression
>> spans the same AST?
>>
>> Regards,
>> Phil
>
|
|
|
Powered by
FUDForum. Page generated in 0.02806 seconds