| Summary: | Follow hyperlink to wrong location | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Peter Feiler <phf> | ||||||||||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||||||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||||||||
| Severity: | major | ||||||||||||||
| Priority: | P3 | CC: | christian.dietrich.opensource, phf, sebastian.zarnekow | ||||||||||||
| Version: | 2.0.1 | Flags: | sebastian.zarnekow:
indigo+
|
||||||||||||
| Target Milestone: | SR2 | ||||||||||||||
| Hardware: | PC | ||||||||||||||
| OS: | Windows XP | ||||||||||||||
| Whiteboard: | |||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
Peter Feiler
Created attachment 200956 [details]
the buggy grammar
This is the grammar with the buggy hyperlink. The unfodled version of the grammar [repeated backend] is included as comment - the hyperlink works for it.
Created attachment 200957 [details]
the mwe2 file for the grammar
Created attachment 200958 [details]
Sample model to illustrate the problem
The sample model can be used on both variants of the grammar
The Problem is actually the (Bus | Processor) that is not assigned (busorproc=(Bus | Processor)) My actual grammar is against an existing Ecore model so I cannot assign Bus/Processor as an element of Component. I have 40+ component types, each varying in the first set of elements, but all allowing the same remaing elements. This is enforced in the Ecore model by a class for each component type with the appropriate elements present or missing. As a result I have 40 grammar rules for which the front end differs but the backend is the same. So I wanted to define the backend once rather than copying and pasting it into each specific component rule. The produced model is exactly what I wanted. The Processor and Bus model model instances get assigned the modes and transition. The issue seems to be with mapping the location of the reference from the text into the model. The Node representing the reference is not contained in a Node with a pointer to the model element for the transition but to the component. I have attached another variant of the grammar that is closer to my real grammar. In that case the editor thinks that the link to the mode in the flow is not a hyperlink. The Node with a reference into the model is the package, which does not allow such an EReference. Created attachment 201042 [details]
Revised grammar with ignored Hyperlink reference
This is a revised version of the grammar showing an ignored hyperlink in addition to going to the wrong location. It can be used with the original mwe2 file.
Created attachment 201043 [details]
Example model for revised grammar
To summarize: the grammar I have and the flattened grammar (enclosed in comments in the grammar file) produce the same model, i.e., a model in which the Processor instance has all the elements (flows, modes, and transitions). Hallo Christian,
ich habe noch mal in der Dokumentation nachgesehen. Unter "unassigned Rule Calls" steht:
As AbstractToken could possibly return an instance of TokenA, TokenB or TokenC its type must be a super type for all these types. Since the return value of the called rule becomes the result of the current rule, it is possible to further change the state of the AST element by assigning additional features.
Example:
AbstractToken :
( TokenA |
TokenB |
TokenC ) (cardinality=('?'|'+'|'*'))?
;
Das ist genau was ich mit der Component Regel mache.
Component :
(Bus | Processor)
(=> 'flows'
((flow+=Flow)+ | (noFlows?='none' ';')))?
('modes' (mode+=Mode |
transition+=Transition)+
)?
'end' ';'
;
I noticed that when the hyperlink code walks up the INode hierarchy it does not find a composite node with a pointer into the model until it gets to the processor in the case of the mode reference in the transition, and until it gets to the package in the case of the mode reference in the Flow (in this case resulting in the reference not being recognized as a hyperlink at all). In the case of the flow the reference is an optional element of the rule.
I am stuck as I am moving our implementation of the SAE AADL standard into Xtext until this is resolved. My alternate route was the falttened grammar. In that case the grammar it is large enough that I get the "Too many constants" error despite using "fieldsPerClass" and avoiding backtrack (see bug 354101).
Sincerely
Peter Feiler, Software Engineering Institute
Pushed to master. Workaround: Override the ILocationInFileProvider Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |