module lang::dot::\syntax::Dot
rascal-0.40.16
Usage
import lang::dot::\syntax::Dot;
syntax DOT
start syntax DOT = Graph Id "{" StatementList "}" "\n"?;
syntax Reserved
keyword Reserved
= "graph"
| "digraph"
| "node"
| "edge"
| "subgraph"
;
syntax Graph
syntax Graph
= "graph"
| "digraph"
| AttrTag
;
syntax AttrTag
syntax AttrTag
= "node"
| "edge"
| "graph"
;
syntax Nod
syntax Nod
= NodeId
| Subgraph
;
syntax Id
lexical Id
= ([A-Z a-z 0-9 _] !<< [a-z A-Z 0-9 _][a-z A-Z 0-9 _]* !>> [0-9 A-Z _ a-z]) \ Reserved
| [\"] (![\"] | "\\\"")* [\"]
| [\-]? "." [0-9]+
| [\-]? [0-9]+ "." [0-9]*
;
syntax StatementList
syntax StatementList = StatementOptional*;
syntax Statement
syntax Statement
= NodeStatement
| EdgeStatement
| AttrStatement
| Id "=" Id
;
syntax StatementOptional
syntax StatementOptional = Statement ";"?;
syntax NodeStatement
syntax NodeStatement = Nod AttrList;
syntax EdgeStatement
syntax EdgeStatement = Nod EdgeRhs AttrList ;
syntax Edg
syntax Edg = EdgeOp Nod;
syntax EdgeOp
syntax EdgeOp = "-\>" | "--";
syntax EdgeRhs
syntax EdgeRhs = Edg+;
syntax NodeId
syntax NodeId
= Id
| Id Port
;
syntax Port
syntax Port = ":" Id Id?
// | ":" Id
// | ":" CompassPt
;
syntax AttrList
syntax AttrList = AttrList0*;
syntax AttrList0
syntax AttrList0 = "[" DotAttr* "]";
syntax DotAttr
syntax DotAttr = Id "=" Id | Id "=" Id "," ;
syntax AttrStatement
syntax AttrStatement = AttrTag AttrList;
syntax Subgraph
syntax Subgraph = ("subgraph" Id? )? "{" StatementList "}";
syntax Comment
lexical Comment = "/*" (![*] | [*] !>> "/")* "*/"
| "//" ![\n]* $
;
syntax LAYOUTLIST
layout LAYOUTLIST = LAYOUT* !>> [\ \t\n\r] !>> "//" !>> "/*"
;
syntax LAYOUT
lexical LAYOUT = Whitespace: [\ \t\n\r]
| @category="Comment" Comment
;