How to insert non-existing fields into the scope [message #1032571] |
Wed, 03 April 2013 06:51 |
Oren Mishali Messages: 15 Registered: March 2013 |
Junior Member |
|
|
Hi all,
I am interested in defining a DSL, whose expressions use existing class' fields, as well as fields that are not declared in any class (yet). The reason for doing so is that those "non-existing" fields are to be declared by generated AspectJ aspects (using Inter Type Declarations, see http://www.eclipse.org/aspectj/doc/next/progguide/language-interType.html).
As an example, consider the following DSL code:
Logger my.MyClass {
log when (sum > 0 && sum < 1000)
log when (_sum != sum)
}
The field sum is declared in the class MyClass, and is inserted into the scope in the regular way (ScopeProvider). However, the field _sum (note the leading underscore) is not defined in the class during the parsing of the DSL code, and as a result a compilation error is shown. I would like to remove that error for all identifiers starting with an underscore.
Is there a way to insert such identifiers into the scope although they are not defined anywhere?
Thanks,
Oren
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03879 seconds