JvmTypeReference and XExpression error [message #991465] |
Wed, 19 December 2012 06:00  |
Eclipse User |
|
|
|
I've tryed to do something like this (application of Xtext doc par. 10.5):
Variable:
type=JvmTypeReference name=ID ';'
;
Condition:
condition=XExpression
;
IfStatement:
'IF''('condition=Condition')''{'
'}'
;
but, when I write this:
I receive this compile error:
Quote:Couldn't resolve reference to JvmIdentifiableElement 'v2'.
I've also added "xbase.lib" in required plug-in.
Very thank you.
|
|
|
|
|
|
|
|
|
|
Re: JvmTypeReference and XExpression error [message #991528 is a reply to message #991508] |
Wed, 19 December 2012 11:59   |
Eclipse User |
|
|
|
I've tryed to add TypeProvider (can it stay in *.jvmodel package, right?) and changed Variable definition.
I've also added scope method (but I haven't got Model in my dsl, I used StatementBlock which contains variables).
But I receive an IllegalArgumentException.
@Singleton
public class TestgrammarTypeProvider extends XbaseTypeProvider {
@SuppressWarnings("restriction")
@Override
protected JvmTypeReference typeForIdentifiable(
JvmIdentifiableElement identifiable, boolean rawType) {
if (identifiable instanceof Variable) {
return ((Variable)identifiable).getType();
}
return super.typeForIdentifiable(identifiable, rawType);
}
}
@Override
protected IScope createLocalVarScope(IScope parentScope,
LocalVariableScopeContext scopeContext) {
if (EcoreUtil2.getContainerOfType(scopeContext.getContext(), Condition.class )!= null) {
StatementBlock m = EcoreUtil2.getContainerOfType(scopeContext.getContext(), StatementBlock.class );
if (m != null) {
return Scopes.scopeFor(m.getDeclarations(),super.createLocalVarScope(parentScope, scopeContext) );
}
}
return super.createLocalVarScope(parentScope, scopeContext);
}
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
return TestgrammarScopeProvider.class;
}
Variable returns jvmTypes::JvmIdentifiableElement:
{Variable}type=JvmTypeReference name=ID ';'
;
Christian very very thanks for your help.
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06292 seconds