| Summary: | Generation of Dot.xtext grammar yields problems (1 error) | ||
|---|---|---|---|
| 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) M1 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Having taken a look at these errors/warnings and the DOT language specification (http://www.graphviz.org/doc/info/lang.html), I think we should change the grammar to the one listed below, so that ids and comments (/* ... */, // ..., # ...) are properly recognized as terminals (while we will probably have to re-consider whether terminals are appropriate for ids, in case HTML-strings are to be supported). What I changed in detail is that the grammar does no longer re-use the Xtext-Terminals grammar, but defines all terminals locally. I have also adjusted the ID terminal rule slightly (ordering). I have generated this grammar without errors/warnings, and the DOT tests can all be successfully passed). Fabian, do you see any objections in applying this change? /******************************************************************************* * Copyright (c) 2008, 2010 Michael Clay and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * Contributors: * Michael Clay - initial implementation, see bug 277380 * Fabian Steeg - updates for current Xtext and minor tweaks *******************************************************************************/ 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+=MainGraph)* ; MainGraph: (strict?="strict")? type=GraphType (name=ID)? "{" (stmts+=Stmt)* "}"; Stmt: ( Attribute | EdgeStmtNode | EdgeStmtSubgraph | NodeStmt | AttrStmt | Subgraph ) (";")?; EdgeStmtNode : node_id=NodeId (edgeRHS+=EdgeRhs)+ (attributes+=AttrList)*; EdgeStmtSubgraph : subgraph=Subgraph (edgeRHS+=EdgeRhs)+ (attributes+=AttrList)*; NodeStmt : name=ID (port=Port)? (attributes+=AttrList)*; Attribute: name=ID "=" value=ID; AttrStmt : type=AttributeType (attributes+=AttrList)+; AttrList : "[" {AttrList} (a_list+=AList)* "]"; AList: 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)?; 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"; terminal ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')* | ('-')?('.'('0'..'9')+) | ('0'..'9')+ ('.' ('0'..'9')*)? | ('"' ( '\\'('b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\') | !('\\'|'"') )* '"'); terminal ML_COMMENT : '/*' -> '*/'; terminal SL_COMMENT : ('//' | '#') !('\n'|'\r')* ('\r'? '\n')?; terminal WS : (' '|'\t'|'\r'|'\n')+; terminal ANY_OTHER: .; (In reply to Alexander Nyßen from comment #1) > I have generated this grammar without errors/warnings, and the DOT tests can > all be successfully passed). Fabian, do you see any objections in applying > this change? What you describe sounds good to me and as the tests pass I have no objections. Committed changes to origin/master: http://git.eclipse.org/c/gef/org.eclipse.gef4.git/commit/?id=4c5ca5399457e2c8173f3670c42395633be3b944 Resolving as fixed. *** Bug 441375 has been marked as a duplicate of this bug. *** |
The grammar generation within org.eclipse.gef4.graph yields the following problems: [java] 0 INFO StandaloneSetup - Registering platform uri '/opt/public/jobs/gef4-master/workspace' [java] 14276 INFO DirectoryCleaner - Cleaning /opt/public/jobs/gef4-master/workspace/org.eclipse.gef4.graph/../org.eclipse.gef4.graph.ui/src-gen [java] 14517 INFO LanguageConfig - generating infrastructure for org.eclipse.gef4.graph.internal.dot.parser.Dot with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, ParseTreeConstructorFragment, ResourceFactoryFragment, XtextAntlrUiGeneratorFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportURIScopingFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, FormatterFragment, LabelProviderFragment, OutlineTreeProviderFragment, QuickOutlineFragment, QuickOutlineFragment, JavaBasedContentAssistFragment, BuilderIntegrationFragment, QuickfixProviderFragment [java] 18058 INFO GenModelHelper - Registered GenModel 'http://www.eclipse.org/gef4/graph/internal/dot/parser/Dot' from 'platform:/resource/org.eclipse.gef4.graph/src-gen/org/eclipse/gef4/graph/internal/dot/parser/Dot.genmodel' [java] warning(200): ../org.eclipse.gef4.graph.ui/src-gen/org/eclipse/gef4/graph/internal/dot/parser/ui/contentassist/antlr/internal/InternalDot.g:2409:131: Decision can match input such as "'\\''"''\u0000'..'\uFFFF'" using multiple alternatives: 1, 2 [java] As a result, alternative(s) 2 were disabled for that input [java] warning(200): ../org.eclipse.gef4.graph.ui/src-gen/org/eclipse/gef4/graph/internal/dot/parser/ui/contentassist/antlr/internal/InternalDot.g:2409:131: Decision can match input such as "'\\''\\'" using multiple alternatives: 1, 2 [java] As a result, alternative(s) 2 were disabled for that input [java] error(208): ../org.eclipse.gef4.graph.ui/src-gen/org/eclipse/gef4/graph/internal/dot/parser/ui/contentassist/antlr/internal/InternalDot.g:2413:1: The following token definitions can never be matched because prior tokens match the same input: RULE_ID,RULE_INT [java] warning(200): ../org.eclipse.gef4.graph/src-gen/org/eclipse/gef4/graph/internal/dot/parser/parser/antlr/internal/InternalDot.g:1100:131: Decision can match input such as "'\\''"''\u0000'..'\uFFFF'" using multiple alternatives: 1, 2 [java] As a result, alternative(s) 2 were disabled for that input [java] warning(200): ../org.eclipse.gef4.graph/src-gen/org/eclipse/gef4/graph/internal/dot/parser/parser/antlr/internal/InternalDot.g:1100:131: Decision can match input such as "'\\''\\'" using multiple alternatives: 1, 2 [java] As a result, alternative(s) 2 were disabled for that input [java] error(208): ../org.eclipse.gef4.graph/src-gen/org/eclipse/gef4/graph/internal/dot/parser/parser/antlr/internal/InternalDot.g:1104:1: The following token definitions can never be matched because prior tokens match the same input: RULE_ID,RULE_INT [java] 23893 INFO JavaValidatorFragment - generating Java-based EValidator API [java] 24138 INFO Workflow - Done.