| Summary: | Refactor Dot.xtext grammar to offer more concise AST. | ||
|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Alexander Nyßen <nyssen> |
| Component: | GEF DOT | Assignee: | Alexander Nyßen <nyssen> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | steeg |
| Version: | unspecified | ||
| Target Milestone: | 3.10.0 (Mars) M4 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Alexander Nyßen
Adjusted the grammar as outlined below, incorporating the following fixes: - Ensure NodeId is consistently used (also within NodeStmt, where name was directly set before) - Refactored modeling of Attributes, removing AList - Fixed Attributes could not be separated by ";" within lists - Renamed MainGraph to DotGraph (which seemed more intuitive) - Adjusted GraphCreatorInterpreter to handle the new structure grammar org.eclipse.gef4.internal.dot.parser.Dot hidden(WS, ML_COMMENT, SL_COMMENT) generate dot "http://www.eclipse.org/gef4/internal/dot/parser/Dot" import "http://www.eclipse.org/emf/2002/Ecore" as ecore GraphvizModel: (graphs+=DotGraph)*; DotGraph: (strict?="strict")? type=GraphType (name=ID)? "{" (stmts+=Stmt)* "}"; Stmt: (Attribute | EdgeStmtNode | EdgeStmtSubgraph | NodeStmt | AttrStmt | Subgraph) (";")?; EdgeStmtNode: node=NodeId (edgeRHS+=EdgeRhs)+ (attrLists+=AttrList)*; EdgeStmtSubgraph: subgraph=Subgraph (edgeRHS+=EdgeRhs)+ (attrLists+=AttrList)*; NodeStmt: node=NodeId (attrLists+=AttrList)*; AttrStmt: type=AttributeType (attrLists+=AttrList)+; AttrList: "[" (attributes+=Attribute ("," | ";")? )+ "]"; Attribute: name=ID "=" value=ID; Subgraph: {Subgraph} ("subgraph" name=ID?)? "{" (stmts+=Stmt)* "}"; Port: ":" name=ID (":" compass_pt=CompassPt)? | ":" compass_pt=CompassPt; EdgeRhs: (EdgeRhsNode | EdgeRhsSubgraph); EdgeRhsNode: op=EdgeOp node=NodeId; EdgeRhsSubgraph: op=EdgeOp subgraph=Subgraph; NodeId: name=ID (port=Port)?; // compass point values are no keywords (and thus allowed as part of an ID), // whereas node, edge, graph, digraph, subgraph, strict are keywords (and thus not allowed as part of an ID) ID: STRING | QUOTED_STRING | NUMERAL | "n" | "ne" | "e" | "se" | "s" | "sw" | "w" | "nw" | "c" | "_"; enum EdgeOp: directed="->" | undirected="--"; enum GraphType: graph="graph" | digraph="digraph"; enum AttributeType: graph="graph" | node="node" | edge="edge"; enum CompassPt: north="n" | northeast="ne" | east="e" | southeast="se" | south="s" | southwest="sw" | west="w" | northwest="nw" | center="c" | wildcard="_"; terminal STRING: ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*; terminal NUMERAL: ('-')? ('.' ('0'..'9')+) | ('0'..'9')+ ('.' ('0'..'9')*)?; terminal QUOTED_STRING: ('"' ('\\' ('b' | 't' | 'n' | 'f' | 'r' | 'u' | '"' | "'" | '\\') | !('\\' | '"'))* '"'); terminal ML_COMMENT: '/*'->'*/'; terminal SL_COMMENT: ('//' | '#') !('\n' | '\r')* ('\r'? '\n')?; terminal WS: (' ' | '\t' | '\r' | '\n')+; terminal ANY_OTHER: .; Run all tests, committed changes to origin/master. Resolving as fixed in 3.10.0M4. |