uniqueness check restricted to certain (model) resources [message #1110763] |
Tue, 17 September 2013 09:53 |
Lars Martin Messages: 24 Registered: July 2009 |
Junior Member |
|
|
Here is the relevant portion of my sample dsl.
Variable:
name=ID '=' expression=Expression;
Expression:
IntConstant | StringConstant | VariableRef;
IntConstant:
value=INT;
StringConstant:
value=STRING;
VariableRef:
'$' variableRef=[Variable];
I've implemented a customized ImportUriGlobalScopeProvider that overwrites getImportedUris() to add builtin variables separated into two models 'default.mydsl' and 'readonly.mydsl'. The given grammar doesn't prevent the user to overwrite variables defined in 'readonly.mydsl' (same here for 'default.mydsl'). So how can I ensure that variables defined in 'readonly.mydsl' are not allowed to be overwritten:
default.mydsl:
readonly.mydsl:
current.mydsl (implicitly imports default.mydsl + readonly.mydsl):
NEW=""
RO=$RO
RO=""
RW="" <- assignment should not be allowed b/c RW is defined in readonly.mydsl
RW=$RO <- assignment should not be allowed b/c RW is defined in readonly.mydsl
Could NamesAreUniqueValidator + NamesAreUniqueValidationHelper help solve this problem? But how to restrict the uniqueness constraint to elements defined in readonly.mydsl?
Regards, Lars M
[Updated on: Tue, 17 September 2013 09:55] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02905 seconds