New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[454629] Implement DotRecordLabel subgrammar. #5
Conversation
|
Issue tracker reference: |
|
Thanks for the contribution. It seems the build fails because the respective record-related packages are not exported with x-friends to the tests bundle. Could you please adjust that, so Travis CI is able to successfully build again? I will then look into the details. |
|
@nyssen Thanks for looking into this. I added another commit to address the issue. Should I squash them? I wasn't sure, if its safe to do this without creating a new branch/pull request. Or is it fine as is? |
|
Yes, you can squash both commits. |
515881e
to
0530bc6
Compare
|
Okay, this should now be updated and the commit squashed with correct author info. |
|
Sorry for the late response, but we have now taken a deeper look into the contribution. It looks good so far, but we have identified two things we would like to see improved. First, it would be nice, if the original Graphviz grammar rule names (i.e. rlabel, field, fieldid) would be reused in the Xtext grammar. Further, we would propose to introduce a String data type rule (corresponding to the string rule in the Graphviz grammar), and to replace the UNQUOTEDSTRING terminal rule, so that only quoted whitespace can be part of the String. That would bring the grammar closer to the original Graphviz grammar, and it would make the terminal converter obsolete. Do you agree? Would you like to update the contribution accordingly? |
|
Hi, I felt the names were confusing in part and that's why I changed them. I will look into this again, however. I see how it might be more understandable to stick with not necessarily ideal names than to make up new ones (which are opinion based). The UNQUOTEDSTRING rule essentially is the String rule in the original grammar. I have done it this way because if you look at Graphviz's rendering of PDF files it interpretes whitespace in HTML fashion. I felt it is best, to simple ignore this discrepancy and align ourselves at Graphviz pdf output and dot file creation practice. What do you think considering these points? On this note, I have in the meantime even considered to let the value converter remove double whitespace, line breaks and also resolve HTML escapes and the {, }, < and >, but not \n, \l, \r which are used later for formatting. |
|
Hi, cool stuff =)
Although the structure and the names chosen by you for the grammar rules are reasonable (I also prefer RotationWrapper to an inline rule), I would opt for sticking to the names used in the Graphviz documentation, because it helps to match Graphviz concepts to the implementation. Since we do not maintain documentation for the supported set of Graphviz Dot, users should be able to utilise the original Graphviz documentation.
Yes, I think using a String datatype that is comprised of multiple whitespace separated strings is a better alternative. Yes, you are right, escaped whitespace. I agree to this suggestion 100%, and I think it will be inline with the behaviour of Graphviz. With the current implementation, the record field name "Mid Dle \n T e x t" will not get its duplicate whitespace removed. Moreover, the record field name "abc\ \ \ \ " would have its last space removed due to the value converter, which is incorrect IMHO (should increase label width which affects formatting/layout). OTOH, if the rules are changed, so that only escaped whitespace is considered for a String, the resulting record field name would be "Mid Dle \n T e x t" or "abc\ \ \ \ ", respectively. Although this does only make a difference for the first case when the String is not yet interpreted, I still consider it to be closer to the Graphviz documentation.
Yes, we should try to behave just like Graphviz, even though that may differ from the Graphviz documentation. However, I do not see how changing the terminal and introducing a data type rule would edge away from the Graphviz behaviour. Can you give an example?
I would like to do without the value converter if possible. |
I think this might have had a reason in the created Type hierarchy. But I am not fully sure anymore. I would try to get this as close to the original grammar and add a comment if not and you can have a second look?
It most certainly is, I agree.
To be honest, this is the first time I wrote a grammar. So I thought, because Whitespace as such is hidden to the parser at the moment, it would become "MidDle\nText" and "abc\ \ \ \ ". I will have a look soon (sorry I am ill atm unfortunately) and check this. We will also need to check the behavior for
The way I understood the graphviz grammar, no unescaped whitespace can be part of a string.
At first I thought you wanted me to make "Mid Dle" illegal input that does not parse, which of course is completely contrary to Graphviz behavior. However, I feel, this was a misunderstanding on my part.
Thanks for the feedback. :) |
|
@nyssen @mwienand I produced two versions
Links to the relevant repos are above. Please have a look and I will then change this pull request or create a new one as you prefer. Two notes on changing to the String datatype and eliminating the Port type - both in my pov are neglible or discussable but I wanted to quickly point them out, too.
|
|
Can you also already have a look at this commit |
|
Commit prggz@13c4721 looks reasonable. I think it makes sense to merge it into this contribution. Please prepare this contribution as it should be from your point of view. Linking to several alternatives is really hard to review (as its technically hard to compare). My wish would be that the solution is as close to the Graphviz grammar as can be (while the actual Graphviz behavior should have precedence over the documented behavior), and that it comes without the value converter. |
- Create DotRecordLabel.xtext subgrammar with naming aligned to graphviz documentation - Include generated Stub classes - Implement DotRecordLabelJavaValidator.java methods in generated stub class - Implement DotRecordLabelTests.xtend test class and include in AllUiTests.java - Implement DotRecordLabel validation test case in DotValidatorTests.java - Updated MANIFEST.MF x-friends and .api_filters to allow travis build - refactored the getColorSchemeAttributeValue method to be used with any attribute as additional parameter in preparation for working on introducing recordLabel validation support - created a helper method with the original signature to ensure compatibility with existing code. Signed-off-by: Zoey Gerrit Prigge <zoey.prigge@uni-duesseldorf.de> Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=454629
0530bc6
to
0e41a95
Compare
|
@nyssen I have removed the value converter and the grammar is now (almost) identical in naming and structure to the graphviz one. Hoping this satisfies your expectations. |
|
Thanks for the contribution, the final state looks good. Tamas, thanks for having reviewed and merged the changes. |
terminal rule
class
AllUiTests.java
DotValidatorTests.java
Signed-off-by: Zoey Gerrit Prigge zoey.prigge@uni-duesseldorf.de
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=454629