| Summary: | DOT Editor - Support parsing of hex double values and exponents/scientific notation in Graphviz Dot documents for double attributes and in the DotPoint/DotRect grammars | ||
|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Matthias Wienand <matthias.wienand> |
| Component: | GEF DOT | Assignee: | gef-inbox <gef-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | eclipse |
| Version: | unspecified | ||
| Target Milestone: | 5.3.0 (2019-12) | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Dear Matthias, I looked this up in the graphviz reference. Double and Int values correspond to the C literals of those types. The important statement is: "The tools accept standard C representations for int and double types. For the bool type, TRUE values are represented by "true" or "yes" (case-insensitive) and any non-zero integer, and FALSE values by "false" or "no" (case-insensitive) and zero. " http://www.graphviz.org/doc/info/attrs.html A reference of the C grammar for these is located here: https://en.cppreference.com/w/c/language/integer_constant https://en.cppreference.com/w/c/language/floating_constant I have tried to reproduce your example: It appears the Dot grammar parses these values. However, not all subgrammars support them. In the first case (width) this is already correctly parsed and even displayed in DotGraphView. In the second case, I only find the issue with the bb and pos attributes. This is more specifically two (identical) issues with the DotPoint and DotRect grammars. It would need further verification, if further grammars are concerned. P.S.: I think your regex does not include the dot. I pushed a commit with the following changes to I pushed a commit with the following changes to the master branch: [559031] Extend DotRect, DotPoint grammars & double parser literals -Allow for all C float literals and hex integers in double valued attributes as well as the DotRect, DotPoint grammars -Allow for scientific notation in the DotRect, DotPoint grammars -implement static double parsing utility method for hex integers that are accepted by graphviz but not in by Double.valueOf to Double in new doubleValues package -use this method in DotAttributes for parsing Doubles, remove TODO to check Double.parseDouble against actual graphviz double parsing -use this method in specific value converter DotDoubleOnlyGrammarConverters in same package -bind as value converter in both DotRectRuntimeModule and DotPointRuntimeModule -implement DotParserTest test case using expanded on example from bug report and extend some DotAttribute test cases to cover grammar additions I also renamed the bug to account for the further changes that were immediately linked to the changes requested in the initial bug report. I am closing this as resolved fixed in 2020-03. |
Graphviz Dot allows scientific notation for numbers, which is currently not supported by GEF DOT. We should enable parsing of such numbers to be compatible. Example: $ dot graph { n[width="003e005"]} graph { graph [bb="0,0,2.16e+07,36"]; node [label="\N"]; n [height=0.5, pos="1.08e+07,18", width="3e+05"]; } I believe such numbers conform to this regex: [+-]? \d+ [eE] [+-]? \d+