Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323230 - [Content Assist] Automatically escape identifiers which collide with keywords
Summary: [Content Assist] Automatically escape identifiers which collide with keywords
Status: CLOSED WONTFIX
Alias: None
Product: M2T
Classification: Modeling
Component: Xpand (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Darius Jockel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-20 06:38 EDT by Lothar Wendehals CLA
Modified: 2020-04-30 13:55 EDT (History)
3 users (show)

See Also:


Attachments
Patch (3.38 KB, patch)
2010-08-24 16:03 EDT, Darius Jockel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lothar Wendehals CLA 2010-08-20 06:38:08 EDT
Build Identifier: Helios

I have a class containing an attribute 'collect'. When referencing that in a DEFINE, Xpand gets confused. This is actually part of my template:

«DEFINE download FOR Download-»
«IF collect != null-»
«name»|COLLECT|«collect.value.toString()»
«ENDIF-»
...

When using auto-completion, Xpand correctly offers the collect-attribute from Download. The interpreter anyway recognizes 'collect' as the 'collect()' Xtend built-in function and throws an error hinting that a '(' is missing behind 'collect'.
I was really confused, especially since I did not know the Xtend function 'collect'. The error message was somehow misleading. After some time I was happy to find out that a had to escape the attribute's name by ^.
Anyway, the error message needs to be improved.

Reproducible: Always
Comment 1 Sven Efftinge CLA 2010-08-20 07:37:13 EDT
I'm afraid that this can't be fixed easily, since 'collect' is a keyword and the only possible occurrence is in front of a '('. Also we cannot mark the property in your meta model since it is not defined within Xpand...
Sorry. Thanks for posting anyway.
Comment 2 Lothar Wendehals CLA 2010-08-20 08:16:07 EDT
Maybe it is possible to automatically add the escape character (^) to the attribute's name when using the auto completion mechanism if the name conflicts with a keyword?
Comment 3 Sven Efftinge CLA 2010-08-20 08:22:00 EDT
Yes, that's a good solution. Still a bit complicated, since the built-in function collect is also proposed.
Comment 4 Darius Jockel CLA 2010-08-24 16:03:17 EDT
Created attachment 177365 [details]
Patch
Comment 5 Darius Jockel CLA 2010-08-24 16:04:55 EDT
Xpand and Extension SyntaxConstants are escaped
Comment 6 Sven Efftinge CLA 2010-08-25 02:59:05 EDT
I've rejected the changes since they would add a '^' in every case. 
There are a lot of cases (select, collect, etc.) where the keyword is meant to be a keyword not an identifier.
These cases need to be handled.
Comment 7 Karsten Thoms CLA 2020-04-30 13:55:23 EDT
This is a batch close of open M2T Xpand bugs. It is not planned work on this component in the foreseeable future. If you think this issue needs to be solved and you plan to contribute a fix then feel free to reopen it.