From 79948848bd410c6e2afa48bd034d49b11d71ea7f Mon Sep 17 00:00:00 2001 From: Abhinav Dahiya Date: Mon, 8 Oct 2018 18:14:56 -0700 Subject: [PATCH] vendor: add /github.com/awalterschulze/gographviz --- Gopkg.lock | 16 + Gopkg.toml | 4 + .../awalterschulze/gographviz/AUTHORS | 15 + .../awalterschulze/gographviz/CONTRIBUTORS | 2 + .../awalterschulze/gographviz/LICENSE | 46 + .../awalterschulze/gographviz/analyse.go | 171 + .../awalterschulze/gographviz/ast/ast.go | 680 ++++ .../awalterschulze/gographviz/attr.go | 559 +++ .../awalterschulze/gographviz/attrs.go | 99 + .../awalterschulze/gographviz/catch.go | 101 + .../awalterschulze/gographviz/edges.go | 119 + .../awalterschulze/gographviz/escape.go | 192 ++ .../awalterschulze/gographviz/gographviz.go | 58 + .../awalterschulze/gographviz/graph.go | 148 + .../gographviz/internal/errors/errors.go | 56 + .../gographviz/internal/lexer/acttab.go | 587 ++++ .../gographviz/internal/lexer/lexer.go | 328 ++ .../internal/lexer/transitiontable.go | 3017 +++++++++++++++++ .../gographviz/internal/parser/action.go | 51 + .../gographviz/internal/parser/actiontable.go | 152 + .../gographviz/internal/parser/gototable.go | 56 + .../gographviz/internal/parser/main.go | 72 + .../gographviz/internal/parser/parser.go | 212 ++ .../internal/parser/productionstable.go | 623 ++++ .../gographviz/internal/token/token.go | 104 + .../awalterschulze/gographviz/nodes.go | 61 + .../awalterschulze/gographviz/relations.go | 53 + .../awalterschulze/gographviz/subgraphs.go | 64 + .../awalterschulze/gographviz/write.go | 172 + 29 files changed, 7818 insertions(+) create mode 100644 vendor/github.com/awalterschulze/gographviz/AUTHORS create mode 100644 vendor/github.com/awalterschulze/gographviz/CONTRIBUTORS create mode 100644 vendor/github.com/awalterschulze/gographviz/LICENSE create mode 100644 vendor/github.com/awalterschulze/gographviz/analyse.go create mode 100644 vendor/github.com/awalterschulze/gographviz/ast/ast.go create mode 100644 vendor/github.com/awalterschulze/gographviz/attr.go create mode 100644 vendor/github.com/awalterschulze/gographviz/attrs.go create mode 100644 vendor/github.com/awalterschulze/gographviz/catch.go create mode 100644 vendor/github.com/awalterschulze/gographviz/edges.go create mode 100644 vendor/github.com/awalterschulze/gographviz/escape.go create mode 100644 vendor/github.com/awalterschulze/gographviz/gographviz.go create mode 100644 vendor/github.com/awalterschulze/gographviz/graph.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/errors/errors.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/lexer/acttab.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/lexer/lexer.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/lexer/transitiontable.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/parser/action.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/parser/actiontable.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/parser/gototable.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/parser/main.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/parser/parser.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/parser/productionstable.go create mode 100644 vendor/github.com/awalterschulze/gographviz/internal/token/token.go create mode 100644 vendor/github.com/awalterschulze/gographviz/nodes.go create mode 100644 vendor/github.com/awalterschulze/gographviz/relations.go create mode 100644 vendor/github.com/awalterschulze/gographviz/subgraphs.go create mode 100644 vendor/github.com/awalterschulze/gographviz/write.go diff --git a/Gopkg.lock b/Gopkg.lock index b4eb1e29fa..2a369248fd 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -15,6 +15,21 @@ pruneopts = "NUT" revision = "2bd8b58cf4275aeb086ade613de226773e29e853" +[[projects]] + digest = "1:19c2dd79ebd83f79c358ed8890f7ff9f10060268f9051f39f5ea65c74045b59f" + name = "github.com/awalterschulze/gographviz" + packages = [ + ".", + "ast", + "internal/errors", + "internal/lexer", + "internal/parser", + "internal/token", + ] + pruneopts = "NUT" + revision = "c84395e536e1a1199093a4e6253d1bee99e4cd2a" + version = "v2.0" + [[projects]] digest = "1:06aeb1ae6ecd7695cddddb9a203df3fbb818c2d9864f8ac8f6fb372a8ef8f00c" name = "github.com/aws/aws-sdk-go" @@ -463,6 +478,7 @@ analyzer-version = 1 input-imports = [ "github.com/apparentlymart/go-cidr/cidr", + "github.com/awalterschulze/gographviz", "github.com/aws/aws-sdk-go/aws", "github.com/aws/aws-sdk-go/aws/session", "github.com/aws/aws-sdk-go/service/ec2", diff --git a/Gopkg.toml b/Gopkg.toml index 234fd155fd..959c71fb91 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -52,3 +52,7 @@ ignored = ["github.com/openshift/installer/tests*"] [[constraint]] name = "github.com/pkg/errors" version = "0.8.0" + +[[constraint]] + name = "github.com/awalterschulze/gographviz" + version = "2.0.0" diff --git a/vendor/github.com/awalterschulze/gographviz/AUTHORS b/vendor/github.com/awalterschulze/gographviz/AUTHORS new file mode 100644 index 0000000000..fa0713aa44 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/AUTHORS @@ -0,0 +1,15 @@ +# This is the official list of GoGraphviz authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS file, which +# lists people. For example, employees are listed in CONTRIBUTORS, +# but not in AUTHORS, because the employer holds the copyright. + +# Names should be added to this file as one of +# Organization's name +# Individual's name +# Individual's name + +# Please keep the list sorted. + +Vastech SA (PTY) LTD +Xavier Chassin +Walter Schulze diff --git a/vendor/github.com/awalterschulze/gographviz/CONTRIBUTORS b/vendor/github.com/awalterschulze/gographviz/CONTRIBUTORS new file mode 100644 index 0000000000..ba8ecc80cd --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/CONTRIBUTORS @@ -0,0 +1,2 @@ +Robin Eklind +Walter Schulze diff --git a/vendor/github.com/awalterschulze/gographviz/LICENSE b/vendor/github.com/awalterschulze/gographviz/LICENSE new file mode 100644 index 0000000000..6259ffd56c --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/LICENSE @@ -0,0 +1,46 @@ +Copyright 2013 GoGraphviz Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------------------------------------------------------------------------------- +Portions of gocc's source code has been derived from Go, and are covered by the +following license: +------------------------------------------------------------------------------- + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/github.com/awalterschulze/gographviz/analyse.go b/vendor/github.com/awalterschulze/gographviz/analyse.go new file mode 100644 index 0000000000..f82421e2a1 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/analyse.go @@ -0,0 +1,171 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import ( + "github.com/awalterschulze/gographviz/ast" +) + +// NewAnalysedGraph creates a Graph structure by analysing an Abstract Syntax Tree representing a parsed graph. +func NewAnalysedGraph(graph *ast.Graph) (*Graph, error) { + g := NewGraph() + if err := Analyse(graph, g); err != nil { + return nil, err + } + return g, nil +} + +// Analyse analyses an Abstract Syntax Tree representing a parsed graph into a newly created graph structure Interface. +func Analyse(graph *ast.Graph, g Interface) error { + gerr := newErrCatcher(g) + graph.Walk(&graphVisitor{gerr}) + return gerr.getError() +} + +type nilVisitor struct { +} + +func (w *nilVisitor) Visit(v ast.Elem) ast.Visitor { + return w +} + +type graphVisitor struct { + g errInterface +} + +func (w *graphVisitor) Visit(v ast.Elem) ast.Visitor { + graph, ok := v.(*ast.Graph) + if !ok { + return w + } + w.g.SetStrict(graph.Strict) + w.g.SetDir(graph.Type == ast.DIGRAPH) + graphName := graph.ID.String() + w.g.SetName(graphName) + return newStmtVisitor(w.g, graphName) +} + +func newStmtVisitor(g errInterface, graphName string) *stmtVisitor { + return &stmtVisitor{g, graphName, make(map[string]string), make(map[string]string), make(map[string]string)} +} + +type stmtVisitor struct { + g errInterface + graphName string + currentNodeAttrs map[string]string + currentEdgeAttrs map[string]string + currentGraphAttrs map[string]string +} + +func (w *stmtVisitor) Visit(v ast.Elem) ast.Visitor { + switch s := v.(type) { + case ast.NodeStmt: + return w.nodeStmt(s) + case ast.EdgeStmt: + return w.edgeStmt(s) + case ast.NodeAttrs: + return w.nodeAttrs(s) + case ast.EdgeAttrs: + return w.edgeAttrs(s) + case ast.GraphAttrs: + return w.graphAttrs(s) + case *ast.SubGraph: + return w.subGraph(s) + case *ast.Attr: + return w.attr(s) + case ast.AttrList: + return &nilVisitor{} + default: + //fmt.Fprintf(os.Stderr, "unknown stmt %T\n", v) + } + return w +} + +func ammend(attrs map[string]string, add map[string]string) map[string]string { + for key, value := range add { + if _, ok := attrs[key]; !ok { + attrs[key] = value + } + } + return attrs +} + +func overwrite(attrs map[string]string, overwrite map[string]string) map[string]string { + for key, value := range overwrite { + attrs[key] = value + } + return attrs +} + +func (w *stmtVisitor) nodeStmt(stmt ast.NodeStmt) ast.Visitor { + attrs := ammend(stmt.Attrs.GetMap(), w.currentNodeAttrs) + w.g.AddNode(w.graphName, stmt.NodeID.String(), attrs) + return &nilVisitor{} +} + +func (w *stmtVisitor) edgeStmt(stmt ast.EdgeStmt) ast.Visitor { + attrs := stmt.Attrs.GetMap() + attrs = ammend(attrs, w.currentEdgeAttrs) + src := stmt.Source.GetID() + srcName := src.String() + if stmt.Source.IsNode() { + w.g.AddNode(w.graphName, srcName, w.currentNodeAttrs) + } + srcPort := stmt.Source.GetPort() + for i := range stmt.EdgeRHS { + directed := bool(stmt.EdgeRHS[i].Op) + dst := stmt.EdgeRHS[i].Destination.GetID() + dstName := dst.String() + if stmt.EdgeRHS[i].Destination.IsNode() { + w.g.AddNode(w.graphName, dstName, w.currentNodeAttrs) + } + dstPort := stmt.EdgeRHS[i].Destination.GetPort() + w.g.AddPortEdge(srcName, srcPort.String(), dstName, dstPort.String(), directed, attrs) + src = dst + srcPort = dstPort + srcName = dstName + } + return w +} + +func (w *stmtVisitor) nodeAttrs(stmt ast.NodeAttrs) ast.Visitor { + w.currentNodeAttrs = overwrite(w.currentNodeAttrs, ast.AttrList(stmt).GetMap()) + return &nilVisitor{} +} + +func (w *stmtVisitor) edgeAttrs(stmt ast.EdgeAttrs) ast.Visitor { + w.currentEdgeAttrs = overwrite(w.currentEdgeAttrs, ast.AttrList(stmt).GetMap()) + return &nilVisitor{} +} + +func (w *stmtVisitor) graphAttrs(stmt ast.GraphAttrs) ast.Visitor { + attrs := ast.AttrList(stmt).GetMap() + for key, value := range attrs { + w.g.AddAttr(w.graphName, key, value) + } + w.currentGraphAttrs = overwrite(w.currentGraphAttrs, attrs) + return &nilVisitor{} +} + +func (w *stmtVisitor) subGraph(stmt *ast.SubGraph) ast.Visitor { + subGraphName := stmt.ID.String() + w.g.AddSubGraph(w.graphName, subGraphName, w.currentGraphAttrs) + return newStmtVisitor(w.g, subGraphName) +} + +func (w *stmtVisitor) attr(stmt *ast.Attr) ast.Visitor { + w.g.AddAttr(w.graphName, stmt.Field.String(), stmt.Value.String()) + return w +} diff --git a/vendor/github.com/awalterschulze/gographviz/ast/ast.go b/vendor/github.com/awalterschulze/gographviz/ast/ast.go new file mode 100644 index 0000000000..1487aacd68 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/ast/ast.go @@ -0,0 +1,680 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +//Abstract Syntax Tree representing the DOT grammar +package ast + +import ( + "errors" + "fmt" + "math/rand" + "sort" + "strings" + + "github.com/awalterschulze/gographviz/internal/token" +) + +var ( + r = rand.New(rand.NewSource(1234)) +) + +type Visitor interface { + Visit(e Elem) Visitor +} + +type Elem interface { + String() string +} + +type Walkable interface { + Walk(v Visitor) +} + +type Attrib interface{} + +type Bool bool + +const ( + FALSE = Bool(false) + TRUE = Bool(true) +) + +func (this Bool) String() string { + if this { + return "true" + } + return "false" +} + +func (this Bool) Walk(v Visitor) { + if v == nil { + return + } + v.Visit(this) +} + +type GraphType bool + +const ( + GRAPH = GraphType(false) + DIGRAPH = GraphType(true) +) + +func (this GraphType) String() string { + if this { + return "digraph" + } + return "graph" +} + +func (this GraphType) Walk(v Visitor) { + if v == nil { + return + } + v.Visit(this) +} + +type Graph struct { + Type GraphType + Strict bool + ID ID + StmtList StmtList +} + +func NewGraph(t, strict, id, l Attrib) (*Graph, error) { + g := &Graph{Type: t.(GraphType), Strict: bool(strict.(Bool)), ID: ID("")} + if id != nil { + g.ID = id.(ID) + } + if l != nil { + g.StmtList = l.(StmtList) + } + return g, nil +} + +func (this *Graph) String() string { + s := this.Type.String() + " " + this.ID.String() + " {\n" + if this.StmtList != nil { + s += this.StmtList.String() + } + s += "\n}\n" + return s +} + +func (this *Graph) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + this.Type.Walk(v) + this.ID.Walk(v) + this.StmtList.Walk(v) +} + +type StmtList []Stmt + +func NewStmtList(s Attrib) (StmtList, error) { + ss := make(StmtList, 1) + ss[0] = s.(Stmt) + return ss, nil +} + +func AppendStmtList(ss, s Attrib) (StmtList, error) { + this := ss.(StmtList) + this = append(this, s.(Stmt)) + return this, nil +} + +func (this StmtList) String() string { + if len(this) == 0 { + return "" + } + s := "" + for i := 0; i < len(this); i++ { + ss := this[i].String() + if len(ss) > 0 { + s += "\t" + ss + ";\n" + } + } + return s +} + +func (this StmtList) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + for i := range this { + this[i].Walk(v) + } +} + +type Stmt interface { + Elem + Walkable + isStmt() +} + +func (this NodeStmt) isStmt() {} +func (this EdgeStmt) isStmt() {} +func (this EdgeAttrs) isStmt() {} +func (this NodeAttrs) isStmt() {} +func (this GraphAttrs) isStmt() {} +func (this *SubGraph) isStmt() {} +func (this *Attr) isStmt() {} + +type SubGraph struct { + ID ID + StmtList StmtList +} + +func NewSubGraph(id, l Attrib) (*SubGraph, error) { + g := &SubGraph{ID: ID(fmt.Sprintf("anon%d", r.Int63()))} + if id != nil { + if len(id.(ID)) > 0 { + g.ID = id.(ID) + } + } + if l != nil { + g.StmtList = l.(StmtList) + } + return g, nil +} + +func (this *SubGraph) GetID() ID { + return this.ID +} + +func (this *SubGraph) GetPort() Port { + return NewPort(nil, nil) +} + +func (this *SubGraph) String() string { + gName := this.ID.String() + if strings.HasPrefix(gName, "anon") { + gName = "" + } + s := "subgraph " + this.ID.String() + " {\n" + if this.StmtList != nil { + s += this.StmtList.String() + } + s += "\n}\n" + return s +} + +func (this *SubGraph) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + this.ID.Walk(v) + this.StmtList.Walk(v) +} + +type EdgeAttrs AttrList + +func NewEdgeAttrs(a Attrib) (EdgeAttrs, error) { + return EdgeAttrs(a.(AttrList)), nil +} + +func (this EdgeAttrs) String() string { + s := AttrList(this).String() + if len(s) == 0 { + return "" + } + return `edge ` + s +} + +func (this EdgeAttrs) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + for i := range this { + this[i].Walk(v) + } +} + +type NodeAttrs AttrList + +func NewNodeAttrs(a Attrib) (NodeAttrs, error) { + return NodeAttrs(a.(AttrList)), nil +} + +func (this NodeAttrs) String() string { + s := AttrList(this).String() + if len(s) == 0 { + return "" + } + return `node ` + s +} + +func (this NodeAttrs) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + for i := range this { + this[i].Walk(v) + } +} + +type GraphAttrs AttrList + +func NewGraphAttrs(a Attrib) (GraphAttrs, error) { + return GraphAttrs(a.(AttrList)), nil +} + +func (this GraphAttrs) String() string { + s := AttrList(this).String() + if len(s) == 0 { + return "" + } + return `graph ` + s +} + +func (this GraphAttrs) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + for i := range this { + this[i].Walk(v) + } +} + +type AttrList []AList + +func NewAttrList(a Attrib) (AttrList, error) { + as := make(AttrList, 0) + if a != nil { + as = append(as, a.(AList)) + } + return as, nil +} + +func AppendAttrList(as, a Attrib) (AttrList, error) { + this := as.(AttrList) + if a == nil { + return this, nil + } + this = append(this, a.(AList)) + return this, nil +} + +func (this AttrList) String() string { + s := "" + for _, alist := range this { + ss := alist.String() + if len(ss) > 0 { + s += "[ " + ss + " ] " + } + } + if len(s) == 0 { + return "" + } + return s +} + +func (this AttrList) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + for i := range this { + this[i].Walk(v) + } +} + +func PutMap(attrmap map[string]string) AttrList { + attrlist := make(AttrList, 1) + attrlist[0] = make(AList, 0) + keys := make([]string, 0, len(attrmap)) + for key := range attrmap { + keys = append(keys, key) + } + sort.Strings(keys) + for _, name := range keys { + value := attrmap[name] + attrlist[0] = append(attrlist[0], &Attr{ID(name), ID(value)}) + } + return attrlist +} + +func (this AttrList) GetMap() map[string]string { + attrs := make(map[string]string) + for _, alist := range this { + for _, attr := range alist { + attrs[attr.Field.String()] = attr.Value.String() + } + } + return attrs +} + +type AList []*Attr + +func NewAList(a Attrib) (AList, error) { + as := make(AList, 1) + as[0] = a.(*Attr) + return as, nil +} + +func AppendAList(as, a Attrib) (AList, error) { + this := as.(AList) + attr := a.(*Attr) + this = append(this, attr) + return this, nil +} + +func (this AList) String() string { + if len(this) == 0 { + return "" + } + str := this[0].String() + for i := 1; i < len(this); i++ { + str += `, ` + this[i].String() + } + return str +} + +func (this AList) Walk(v Visitor) { + v = v.Visit(this) + for i := range this { + this[i].Walk(v) + } +} + +type Attr struct { + Field ID + Value ID +} + +func NewAttr(f, v Attrib) (*Attr, error) { + a := &Attr{Field: f.(ID)} + a.Value = ID("true") + if v != nil { + ok := false + a.Value, ok = v.(ID) + if !ok { + return nil, errors.New(fmt.Sprintf("value = %v", v)) + } + } + return a, nil +} + +func (this *Attr) String() string { + return this.Field.String() + `=` + this.Value.String() +} + +func (this *Attr) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + this.Field.Walk(v) + this.Value.Walk(v) +} + +type Location interface { + Elem + Walkable + isLocation() + GetID() ID + GetPort() Port + IsNode() bool +} + +func (this *NodeID) isLocation() {} +func (this *NodeID) IsNode() bool { return true } +func (this *SubGraph) isLocation() {} +func (this *SubGraph) IsNode() bool { return false } + +type EdgeStmt struct { + Source Location + EdgeRHS EdgeRHS + Attrs AttrList +} + +func NewEdgeStmt(id, e, attrs Attrib) (*EdgeStmt, error) { + var a AttrList = nil + var err error = nil + if attrs == nil { + a, err = NewAttrList(nil) + if err != nil { + return nil, err + } + } else { + a = attrs.(AttrList) + } + return &EdgeStmt{id.(Location), e.(EdgeRHS), a}, nil +} + +func (this EdgeStmt) String() string { + return strings.TrimSpace(this.Source.String() + this.EdgeRHS.String() + this.Attrs.String()) +} + +func (this EdgeStmt) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + this.Source.Walk(v) + this.EdgeRHS.Walk(v) + this.Attrs.Walk(v) +} + +type EdgeRHS []*EdgeRH + +func NewEdgeRHS(op, id Attrib) (EdgeRHS, error) { + return EdgeRHS{&EdgeRH{op.(EdgeOp), id.(Location)}}, nil +} + +func AppendEdgeRHS(e, op, id Attrib) (EdgeRHS, error) { + erhs := e.(EdgeRHS) + erhs = append(erhs, &EdgeRH{op.(EdgeOp), id.(Location)}) + return erhs, nil +} + +func (this EdgeRHS) String() string { + s := "" + for i := range this { + s += this[i].String() + } + return strings.TrimSpace(s) +} + +func (this EdgeRHS) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + for i := range this { + this[i].Walk(v) + } +} + +type EdgeRH struct { + Op EdgeOp + Destination Location +} + +func (this *EdgeRH) String() string { + return strings.TrimSpace(this.Op.String() + this.Destination.String()) +} + +func (this *EdgeRH) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + this.Op.Walk(v) + this.Destination.Walk(v) +} + +type NodeStmt struct { + NodeID *NodeID + Attrs AttrList +} + +func NewNodeStmt(id, attrs Attrib) (*NodeStmt, error) { + nid := id.(*NodeID) + var a AttrList = nil + var err error = nil + if attrs == nil { + a, err = NewAttrList(nil) + if err != nil { + return nil, err + } + } else { + a = attrs.(AttrList) + } + return &NodeStmt{nid, a}, nil +} + +func (this NodeStmt) String() string { + return strings.TrimSpace(this.NodeID.String() + ` ` + this.Attrs.String()) +} + +func (this NodeStmt) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + this.NodeID.Walk(v) + this.Attrs.Walk(v) +} + +type EdgeOp bool + +const ( + DIRECTED EdgeOp = true + UNDIRECTED EdgeOp = false +) + +func (this EdgeOp) String() string { + if this == DIRECTED { + return "->" + } + return "--" +} + +func (this EdgeOp) Walk(v Visitor) { + if v == nil { + return + } + v.Visit(this) +} + +type NodeID struct { + ID ID + Port Port +} + +func NewNodeID(id, port Attrib) (*NodeID, error) { + if port == nil { + return &NodeID{id.(ID), Port{"", ""}}, nil + } + return &NodeID{id.(ID), port.(Port)}, nil +} + +func MakeNodeID(id string, port string) *NodeID { + p := Port{"", ""} + if len(port) > 0 { + ps := strings.Split(port, ":") + p.ID1 = ID(ps[1]) + if len(ps) > 2 { + p.ID2 = ID(ps[2]) + } + } + return &NodeID{ID(id), p} +} + +func (this *NodeID) String() string { + return this.ID.String() + this.Port.String() +} + +func (this *NodeID) GetID() ID { + return this.ID +} + +func (this *NodeID) GetPort() Port { + return this.Port +} + +func (this *NodeID) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + this.ID.Walk(v) + this.Port.Walk(v) +} + +//TODO semantic analysis should decide which ID is an ID and which is a Compass Point +type Port struct { + ID1 ID + ID2 ID +} + +func NewPort(id1, id2 Attrib) Port { + port := Port{ID(""), ID("")} + if id1 != nil { + port.ID1 = id1.(ID) + } + if id2 != nil { + port.ID2 = id2.(ID) + } + return port +} + +func (this Port) String() string { + if len(this.ID1) == 0 { + return "" + } + s := ":" + this.ID1.String() + if len(this.ID2) > 0 { + s += ":" + this.ID2.String() + } + return s +} + +func (this Port) Walk(v Visitor) { + if v == nil { + return + } + v = v.Visit(this) + this.ID1.Walk(v) + this.ID2.Walk(v) +} + +type ID string + +func NewID(id Attrib) (ID, error) { + if id == nil { + return ID(""), nil + } + id_lit := string(id.(*token.Token).Lit) + return ID(id_lit), nil +} + +func (this ID) String() string { + return string(this) +} + +func (this ID) Walk(v Visitor) { + if v == nil { + return + } + v.Visit(this) +} diff --git a/vendor/github.com/awalterschulze/gographviz/attr.go b/vendor/github.com/awalterschulze/gographviz/attr.go new file mode 100644 index 0000000000..3d9f2acf1c --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/attr.go @@ -0,0 +1,559 @@ +//Copyright 2017 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http)://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import "fmt" + +// Attr is an attribute key +type Attr string + +// NewAttr creates a new attribute key by checking whether it is a valid key +func NewAttr(key string) (Attr, error) { + a, ok := validAttrs[key] + if !ok { + return Attr(""), fmt.Errorf("%s is not a valid attribute", key) + } + return a, nil +} + +const ( + // Damping http://www.graphviz.org/content/attrs#dDamping + Damping Attr = "Damping" + // K http://www.graphviz.org/content/attrs#dK + K Attr = "K" + // URL http://www.graphviz.org/content/attrs#dURL + URL Attr = "URL" + // Background http://www.graphviz.org/content/attrs#d_background + Background Attr = "_background" + // Area http://www.graphviz.org/content/attrs#darea + Area Attr = "area" + // ArrowHead http://www.graphviz.org/content/attrs#darrowhead + ArrowHead Attr = "arrowhead" + // ArrowSize http://www.graphviz.org/content/attrs#darrowsize + ArrowSize Attr = "arrowsize" + // ArrowTail http://www.graphviz.org/content/attrs#darrowtail + ArrowTail Attr = "arrowtail" + // BB http://www.graphviz.org/content/attrs#dbb + BB Attr = "bb" + // BgColor http://www.graphviz.org/content/attrs#dbgcolor + BgColor Attr = "bgcolor" + // Center http://www.graphviz.org/content/attrs#dcenter + Center Attr = "center" + // Charset http://www.graphviz.org/content/attrs#dcharset + Charset Attr = "charset" + // ClusterRank http://www.graphviz.org/content/attrs#dclusterrank + ClusterRank Attr = "clusterrank" + // Color http://www.graphviz.org/content/attrs#dcolor + Color Attr = "color" + // ColorScheme http://www.graphviz.org/content/attrs#dcolorscheme + ColorScheme Attr = "colorscheme" + // Comment http://www.graphviz.org/content/attrs#dcomment + Comment Attr = "comment" + // Compound http://www.graphviz.org/content/attrs#dcompound + Compound Attr = "compound" + // Concentrate http://www.graphviz.org/content/attrs#dconcentrate + Concentrate Attr = "concentrate" + // Constraint http://www.graphviz.org/content/attrs#dconstraint + Constraint Attr = "constraint" + // Decorate http://www.graphviz.org/content/attrs#ddecorate + Decorate Attr = "decorate" + // DefaultDist http://www.graphviz.org/content/attrs#ddefaultdist + DefaultDist Attr = "defaultdist" + // Dim http://www.graphviz.org/content/attrs#ddim + Dim Attr = "dim" + // Dimen http://www.graphviz.org/content/attrs#ddimen + Dimen Attr = "dimen" + // Dir http://www.graphviz.org/content/attrs#ddir + Dir Attr = "dir" + // DirEdgeConstraints http://www.graphviz.org/content/attrs#ddir + DirEdgeConstraints Attr = "diredgeconstraints" + // Distortion http://www.graphviz.org/content/attrs#ddistortion + Distortion Attr = "distortion" + // DPI http://www.graphviz.org/content/attrs#ddpi + DPI Attr = "dpi" + // EdgeURL http://www.graphviz.org/content/attrs#d:edgeURL + EdgeURL Attr = "edgeURL" + // EdgeHREF http://www.graphviz.org/content/attrs#d:edgehref + EdgeHREF Attr = "edgehref" + // EdgeTarget http://www.graphviz.org/content/attrs#d:edgetarget + EdgeTarget Attr = "edgetarget" + // EdgeTooltip http://www.graphviz.org/content/attrs#d:edgetooltip + EdgeTooltip Attr = "edgetooltip" + // Epsilon http://www.graphviz.org/content/attrs#d:epsilon + Epsilon Attr = "epsilon" + // ESep http://www.graphviz.org/content/attrs#d:epsilon + ESep Attr = "esep" + // FillColor http://www.graphviz.org/content/attrs#dfillcolor + FillColor Attr = "fillcolor" + // FixedSize http://www.graphviz.org/content/attrs#dfixedsize + FixedSize Attr = "fixedsize" + // FontColor http://www.graphviz.org/content/attrs#dfontcolor + FontColor Attr = "fontcolor" + // FontName http://www.graphviz.org/content/attrs#dfontname + FontName Attr = "fontname" + // FontNames http://www.graphviz.org/content/attrs#dfontnames + FontNames Attr = "fontnames" + // FontPath http://www.graphviz.org/content/attrs#dfontpath + FontPath Attr = "fontpath" + // FontSize http://www.graphviz.org/content/attrs#dfontsize + FontSize Attr = "fontsize" + // ForceLabels http://www.graphviz.org/content/attrs#dforcelabels + ForceLabels Attr = "forcelabels" + // GradientAngle http://www.graphviz.org/content/attrs#dgradientangle + GradientAngle Attr = "gradientangle" + // Group http://www.graphviz.org/content/attrs#dgroup + Group Attr = "group" + // HeadURL http://www.graphviz.org/content/attrs#dheadURL + HeadURL Attr = "headURL" + // HeadLP http://www.graphviz.org/content/attrs#dhead_lp + HeadLP Attr = "head_lp" + // HeadClip http://www.graphviz.org/content/attrs#dheadclip + HeadClip Attr = "headclip" + // HeadHREF http://www.graphviz.org/content/attrs#dheadhref + HeadHREF Attr = "headhref" + // HeadLabel http://www.graphviz.org/content/attrs#dheadlabel + HeadLabel Attr = "headlabel" + // HeadPort http://www.graphviz.org/content/attrs#dheadport + HeadPort Attr = "headport" + // HeadTarget http://www.graphviz.org/content/attrs#dheadtarget + HeadTarget Attr = "headtarget" + // HeadTooltip http://www.graphviz.org/content/attrs#dheadtooltip + HeadTooltip Attr = "headtooltip" + // Height http://www.graphviz.org/content/attrs#dheight + Height Attr = "height" + // HREF http://www.graphviz.org/content/attrs#dhref + HREF Attr = "href" + // ID http://www.graphviz.org/content/attrs#did + ID Attr = "id" + // Image http://www.graphviz.org/content/attrs#dimage + Image Attr = "image" + // ImagePath http://www.graphviz.org/content/attrs#dimagepath + ImagePath Attr = "imagepath" + // ImageScale http://www.graphviz.org/content/attrs#dimagescale + ImageScale Attr = "imagescale" + // InputScale http://www.graphviz.org/content/attrs#dinputscale + InputScale Attr = "inputscale" + // Label http://www.graphviz.org/content/attrs#dlabel + Label Attr = "label" + // LabelURL http://www.graphviz.org/content/attrs#dlabelURL + LabelURL Attr = "labelURL" + // LabelScheme http://www.graphviz.org/content/attrs#dlabel_scheme + LabelScheme Attr = "label_scheme" + // LabelAngle http://www.graphviz.org/content/attrs#dlabelangle + LabelAngle Attr = "labelangle" + // LabelDistance http://www.graphviz.org/content/attrs#dlabeldistance + LabelDistance Attr = "labeldistance" + // LabelFloat http://www.graphviz.org/content/attrs#dlabelfloat + LabelFloat Attr = "labelfloat" + // LabelFontColor http://www.graphviz.org/content/attrs#dlabelfontcolor + LabelFontColor Attr = "labelfontcolor" + // LabelFontName http://www.graphviz.org/content/attrs#dlabelfontname + LabelFontName Attr = "labelfontname" + // LabelFontSize http://www.graphviz.org/content/attrs#dlabelfontsize + LabelFontSize Attr = "labelfontsize" + // LabelHREF http://www.graphviz.org/content/attrs#dlabelhref + LabelHREF Attr = "labelhref" + // LabelJust http://www.graphviz.org/content/attrs#dlabeljust + LabelJust Attr = "labeljust" + // LabelLOC http://www.graphviz.org/content/attrs#dlabelloc + LabelLOC Attr = "labelloc" + // LabelTarget http://www.graphviz.org/content/attrs#dlabeltarget + LabelTarget Attr = "labeltarget" + // LabelTooltip http://www.graphviz.org/content/attrs#dlabeltooltip + LabelTooltip Attr = "labeltooltip" + // Landscape http://www.graphviz.org/content/attrs#dlandscape + Landscape Attr = "landscape" + // Layer http://www.graphviz.org/content/attrs#dlayer + Layer Attr = "layer" + // LayerListSep http://www.graphviz.org/content/attrs#dlayerlistsep + LayerListSep Attr = "layerlistsep" + // Layers http://www.graphviz.org/content/attrs#dlayers + Layers Attr = "layers" + // LayerSelect http://www.graphviz.org/content/attrs#dlayerselect + LayerSelect Attr = "layerselect" + // LayerSep http://www.graphviz.org/content/attrs#dlayersep + LayerSep Attr = "layersep" + // Layout http://www.graphviz.org/content/attrs#dlayout + Layout Attr = "layout" + // Len http://www.graphviz.org/content/attrs#dlen + Len Attr = "len" + // Levels http://www.graphviz.org/content/attrs#dlevels + Levels Attr = "levels" + // LevelsGap http://www.graphviz.org/content/attrs#dlevelsgap + LevelsGap Attr = "levelsgap" + // LHead http://www.graphviz.org/content/attrs#dlhead + LHead Attr = "lhead" + // LHeight http://www.graphviz.org/content/attrs#dlheight + LHeight Attr = "lheight" + // LP http://www.graphviz.org/content/attrs#dlp + LP Attr = "lp" + // LTail http://www.graphviz.org/content/attrs#dltail + LTail Attr = "ltail" + // LWidth http://www.graphviz.org/content/attrs#dlwidth + LWidth Attr = "lwidth" + // Margin http://www.graphviz.org/content/attrs#dmargin + Margin Attr = "margin" + // MaxIter http://www.graphviz.org/content/attrs#dmaxiter + MaxIter Attr = "maxiter" + // MCLimit http://www.graphviz.org/content/attrs#dmclimit + MCLimit Attr = "mclimit" + // MinDist http://www.graphviz.org/content/attrs#dmindist + MinDist Attr = "mindist" + // MinLen http://www.graphviz.org/content/attrs#dmindist + MinLen Attr = "minlen" + // Mode http://www.graphviz.org/content/attrs#dmode + Mode Attr = "mode" + // Model http://www.graphviz.org/content/attrs#dmodel + Model Attr = "model" + // Mosek http://www.graphviz.org/content/attrs#dmosek + Mosek Attr = "mosek" + // NewRank http://www.graphviz.org/content/attrs#dnewrank + NewRank Attr = "newrank" + // NodeSep http://www.graphviz.org/content/attrs#dnodesep + NodeSep Attr = "nodesep" + // NoJustify http://www.graphviz.org/content/attrs#dnojustify + NoJustify Attr = "nojustify" + // Normalize http://www.graphviz.org/content/attrs#dnormalize + Normalize Attr = "normalize" + // NoTranslate http://www.graphviz.org/content/attrs#dnotranslate + NoTranslate Attr = "notranslate" + // NSLimit http://www.graphviz.org/content/attrs#dnslimit + NSLimit Attr = "nslimit" + // NSLimit1 http://www.graphviz.org/content/attrs#dnslimit1 + NSLimit1 Attr = "nslimit1" + // Ordering http://www.graphviz.org/content/attrs#dnslimit1 + Ordering Attr = "ordering" + // Orientation http://www.graphviz.org/content/attrs#dorientation + Orientation Attr = "orientation" + // OutputOrder http://www.graphviz.org/content/attrs#doutputorder + OutputOrder Attr = "outputorder" + // Overlap http://www.graphviz.org/content/attrs#doverlap + Overlap Attr = "overlap" + // OverlapScaling http://www.graphviz.org/content/attrs#doverlap_scaling + OverlapScaling Attr = "overlap_scaling" + // OverlapShrink http://www.graphviz.org/content/attrs#doverlap_shrink + OverlapShrink Attr = "overlap_shrink" + // Pack http://www.graphviz.org/content/attrs#dpack + Pack Attr = "pack" + // PackMode http://www.graphviz.org/content/attrs#dpackmode + PackMode Attr = "packmode" + // Pad http://www.graphviz.org/content/attrs#dpad + Pad Attr = "pad" + // Page http://www.graphviz.org/content/attrs#dpage + Page Attr = "page" + // PageDir http://www.graphviz.org/content/attrs#dpagedir + PageDir Attr = "pagedir" + // PenColor http://www.graphviz.org/content/attrs#dpencolor + PenColor Attr = "pencolor" + // PenWidth http://www.graphviz.org/content/attrs#dpenwidth + PenWidth Attr = "penwidth" + // Peripheries http://www.graphviz.org/content/attrs#dperipheries + Peripheries Attr = "peripheries" + // Pin http://www.graphviz.org/content/attrs#dperipheries + Pin Attr = "pin" + // Pos http://www.graphviz.org/content/attrs#dpos + Pos Attr = "pos" + // QuadTree http://www.graphviz.org/content/attrs#dquadtree + QuadTree Attr = "quadtree" + // Quantum http://www.graphviz.org/content/attrs#dquantum + Quantum Attr = "quantum" + // Rank http://www.graphviz.org/content/attrs#drank + Rank Attr = "rank" + // RankDir http://www.graphviz.org/content/attrs#drankdir + RankDir Attr = "rankdir" + // RankSep http://www.graphviz.org/content/attrs#dranksep + RankSep Attr = "ranksep" + // Ratio http://www.graphviz.org/content/attrs#dratio + Ratio Attr = "ratio" + // Rects http://www.graphviz.org/content/attrs#drects + Rects Attr = "rects" + // Regular http://www.graphviz.org/content/attrs#dregular + Regular Attr = "regular" + // ReMinCross http://www.graphviz.org/content/attrs#dremincross + ReMinCross Attr = "remincross" + // RepulsiveForce http://www.graphviz.org/content/attrs#drepulsiveforce + RepulsiveForce Attr = "repulsiveforce" + // Resolution http://www.graphviz.org/content/attrs#dresolution + Resolution Attr = "resolution" + // Root http://www.graphviz.org/content/attrs#droot + Root Attr = "root" + // Rotate http://www.graphviz.org/content/attrs#drotate + Rotate Attr = "rotate" + // Rotation http://www.graphviz.org/content/attrs#drotation + Rotation Attr = "rotation" + // SameHead http://www.graphviz.org/content/attrs#dsamehead + SameHead Attr = "samehead" + // SameTail http://www.graphviz.org/content/attrs#dsametail + SameTail Attr = "sametail" + // SamplePoints http://www.graphviz.org/content/attrs#dsamplepoints + SamplePoints Attr = "samplepoints" + // Scale http://www.graphviz.org/content/attrs#dscale + Scale Attr = "scale" + // SearchSize http://www.graphviz.org/content/attrs#dsearchsize + SearchSize Attr = "searchsize" + // Sep http://www.graphviz.org/content/attrs#dsep + Sep Attr = "sep" + // Shape http://www.graphviz.org/content/attrs#dshape + Shape Attr = "shape" + // ShapeFile http://www.graphviz.org/content/attrs#dshapefile + ShapeFile Attr = "shapefile" + // ShowBoxes http://www.graphviz.org/content/attrs#dshowboxes + ShowBoxes Attr = "showboxes" + // Sides http://www.graphviz.org/content/attrs#dsides + Sides Attr = "sides" + // Size http://www.graphviz.org/content/attrs#dsize + Size Attr = "size" + // Skew http://www.graphviz.org/content/attrs#dskew + Skew Attr = "skew" + // Smoothing http://www.graphviz.org/content/attrs#dsmoothing + Smoothing Attr = "smoothing" + // SortV http://www.graphviz.org/content/attrs#dsortv + SortV Attr = "sortv" + // Splines http://www.graphviz.org/content/attrs#dsplines + Splines Attr = "splines" + // Start http://www.graphviz.org/content/attrs#dstart + Start Attr = "start" + // Style http://www.graphviz.org/content/attrs#dstyle + Style Attr = "style" + // StyleSheet http://www.graphviz.org/content/attrs#dstylesheet + StyleSheet Attr = "stylesheet" + // TailURL http://www.graphviz.org/content/attrs#dtailURL + TailURL Attr = "tailURL" + // TailLP http://www.graphviz.org/content/attrs#dtail_lp + TailLP Attr = "tail_lp" + // TailClip http://www.graphviz.org/content/attrs#dtailclip + TailClip Attr = "tailclip" + // TailHREF http://www.graphviz.org/content/attrs#dtailhref + TailHREF Attr = "tailhref" + // TailLabel http://www.graphviz.org/content/attrs#dtaillabel + TailLabel Attr = "taillabel" + // TailPort http://www.graphviz.org/content/attrs#dtailport + TailPort Attr = "tailport" + // TailTarget http://www.graphviz.org/content/attrs#dtailtarget + TailTarget Attr = "tailtarget" + // TailTooltip http://www.graphviz.org/content/attrs#dtailtooltip + TailTooltip Attr = "tailtooltip" + // Target http://www.graphviz.org/content/attrs#dtarget + Target Attr = "target" + // Tooltip http://www.graphviz.org/content/attrs#dtooltip + Tooltip Attr = "tooltip" + // TrueColor http://www.graphviz.org/content/attrs#dtooltip + TrueColor Attr = "truecolor" + // Vertices http://www.graphviz.org/content/attrs#dvertices + Vertices Attr = "vertices" + // ViewPort http://www.graphviz.org/content/attrs#dviewport + ViewPort Attr = "viewport" + // VoroMargin http://www.graphviz.org/content/attrs#dvoro_margin + VoroMargin Attr = "voro_margin" + // Weight http://www.graphviz.org/content/attrs#dweight + Weight Attr = "weight" + // Width http://www.graphviz.org/content/attrs#dwidth + Width Attr = "width" + // XDotVersion http://www.graphviz.org/content/attrs#dxdotversion + XDotVersion Attr = "xdotversion" + // XLabel http://www.graphviz.org/content/attrs#dxlabel + XLabel Attr = "xlabel" + // XLP http://www.graphviz.org/content/attrs#dxlp + XLP Attr = "xlp" + // Z http://www.graphviz.org/content/attrs#dz + Z Attr = "z" + + // MinCross is not in the documentation, but found in the Ped_Lion_Share (lion_share.gv.txt) example + MinCross Attr = "mincross" + // SSize is not in the documentation, but found in the siblings.gv.txt example + SSize Attr = "ssize" + // Outline is not in the documentation, but found in the siblings.gv.txt example + Outline Attr = "outline" + // F is not in the documentation, but found in the transparency.gv.txt example + F Attr = "f" +) + +var validAttrs = map[string]Attr{ + string(Damping): Damping, + string(K): K, + string(URL): URL, + string(Background): Background, + string(Area): Area, + string(ArrowHead): ArrowHead, + string(ArrowSize): ArrowSize, + string(ArrowTail): ArrowTail, + string(BB): BB, + string(BgColor): BgColor, + string(Center): Center, + string(Charset): Charset, + string(ClusterRank): ClusterRank, + string(Color): Color, + string(ColorScheme): ColorScheme, + string(Comment): Comment, + string(Compound): Compound, + string(Concentrate): Concentrate, + string(Constraint): Constraint, + string(Decorate): Decorate, + string(DefaultDist): DefaultDist, + string(Dim): Dim, + string(Dimen): Dimen, + string(Dir): Dir, + string(DirEdgeConstraints): DirEdgeConstraints, + string(Distortion): Distortion, + string(DPI): DPI, + string(EdgeURL): EdgeURL, + string(EdgeHREF): EdgeHREF, + string(EdgeTarget): EdgeTarget, + string(EdgeTooltip): EdgeTooltip, + string(Epsilon): Epsilon, + string(ESep): ESep, + string(FillColor): FillColor, + string(FixedSize): FixedSize, + string(FontColor): FontColor, + string(FontName): FontName, + string(FontNames): FontNames, + string(FontPath): FontPath, + string(FontSize): FontSize, + string(ForceLabels): ForceLabels, + string(GradientAngle): GradientAngle, + string(Group): Group, + string(HeadURL): HeadURL, + string(HeadLP): HeadLP, + string(HeadClip): HeadClip, + string(HeadHREF): HeadHREF, + string(HeadLabel): HeadLabel, + string(HeadPort): HeadPort, + string(HeadTarget): HeadTarget, + string(HeadTooltip): HeadTooltip, + string(Height): Height, + string(HREF): HREF, + string(ID): ID, + string(Image): Image, + string(ImagePath): ImagePath, + string(ImageScale): ImageScale, + string(InputScale): InputScale, + string(Label): Label, + string(LabelURL): LabelURL, + string(LabelScheme): LabelScheme, + string(LabelAngle): LabelAngle, + string(LabelDistance): LabelDistance, + string(LabelFloat): LabelFloat, + string(LabelFontColor): LabelFontColor, + string(LabelFontName): LabelFontName, + string(LabelFontSize): LabelFontSize, + string(LabelHREF): LabelHREF, + string(LabelJust): LabelJust, + string(LabelLOC): LabelLOC, + string(LabelTarget): LabelTarget, + string(LabelTooltip): LabelTooltip, + string(Landscape): Landscape, + string(Layer): Layer, + string(LayerListSep): LayerListSep, + string(Layers): Layers, + string(LayerSelect): LayerSelect, + string(LayerSep): LayerSep, + string(Layout): Layout, + string(Len): Len, + string(Levels): Levels, + string(LevelsGap): LevelsGap, + string(LHead): LHead, + string(LHeight): LHeight, + string(LP): LP, + string(LTail): LTail, + string(LWidth): LWidth, + string(Margin): Margin, + string(MaxIter): MaxIter, + string(MCLimit): MCLimit, + string(MinDist): MinDist, + string(MinLen): MinLen, + string(Mode): Mode, + string(Model): Model, + string(Mosek): Mosek, + string(NewRank): NewRank, + string(NodeSep): NodeSep, + string(NoJustify): NoJustify, + string(Normalize): Normalize, + string(NoTranslate): NoTranslate, + string(NSLimit): NSLimit, + string(NSLimit1): NSLimit1, + string(Ordering): Ordering, + string(Orientation): Orientation, + string(OutputOrder): OutputOrder, + string(Overlap): Overlap, + string(OverlapScaling): OverlapScaling, + string(OverlapShrink): OverlapShrink, + string(Pack): Pack, + string(PackMode): PackMode, + string(Pad): Pad, + string(Page): Page, + string(PageDir): PageDir, + string(PenColor): PenColor, + string(PenWidth): PenWidth, + string(Peripheries): Peripheries, + string(Pin): Pin, + string(Pos): Pos, + string(QuadTree): QuadTree, + string(Quantum): Quantum, + string(Rank): Rank, + string(RankDir): RankDir, + string(RankSep): RankSep, + string(Ratio): Ratio, + string(Rects): Rects, + string(Regular): Regular, + string(ReMinCross): ReMinCross, + string(RepulsiveForce): RepulsiveForce, + string(Resolution): Resolution, + string(Root): Root, + string(Rotate): Rotate, + string(Rotation): Rotation, + string(SameHead): SameHead, + string(SameTail): SameTail, + string(SamplePoints): SamplePoints, + string(Scale): Scale, + string(SearchSize): SearchSize, + string(Sep): Sep, + string(Shape): Shape, + string(ShapeFile): ShapeFile, + string(ShowBoxes): ShowBoxes, + string(Sides): Sides, + string(Size): Size, + string(Skew): Skew, + string(Smoothing): Smoothing, + string(SortV): SortV, + string(Splines): Splines, + string(Start): Start, + string(Style): Style, + string(StyleSheet): StyleSheet, + string(TailURL): TailURL, + string(TailLP): TailLP, + string(TailClip): TailClip, + string(TailHREF): TailHREF, + string(TailLabel): TailLabel, + string(TailPort): TailPort, + string(TailTarget): TailTarget, + string(TailTooltip): TailTooltip, + string(Target): Target, + string(Tooltip): Tooltip, + string(TrueColor): TrueColor, + string(Vertices): Vertices, + string(ViewPort): ViewPort, + string(VoroMargin): VoroMargin, + string(Weight): Weight, + string(Width): Width, + string(XDotVersion): XDotVersion, + string(XLabel): XLabel, + string(XLP): XLP, + string(Z): Z, + + string(MinCross): MinCross, + string(SSize): SSize, + string(Outline): Outline, + string(F): F, +} diff --git a/vendor/github.com/awalterschulze/gographviz/attrs.go b/vendor/github.com/awalterschulze/gographviz/attrs.go new file mode 100644 index 0000000000..a00eeb7dd7 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/attrs.go @@ -0,0 +1,99 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import ( + "sort" +) + +// Attrs represents attributes for an Edge, Node or Graph. +type Attrs map[Attr]string + +// NewAttrs creates an empty Attributes type. +func NewAttrs(m map[string]string) (Attrs, error) { + as := make(Attrs) + for k, v := range m { + if err := as.Add(k, v); err != nil { + return nil, err + } + } + return as, nil +} + +// Add adds an attribute name and value. +func (attrs Attrs) Add(field string, value string) error { + a, err := NewAttr(field) + if err != nil { + return err + } + attrs.add(a, value) + return nil +} + +func (attrs Attrs) add(field Attr, value string) { + attrs[field] = value +} + +// Extend adds the attributes into attrs Attrs type overwriting duplicates. +func (attrs Attrs) Extend(more Attrs) { + for key, value := range more { + attrs.add(key, value) + } +} + +// Ammend only adds the missing attributes to attrs Attrs type. +func (attrs Attrs) Ammend(more Attrs) { + for key, value := range more { + if _, ok := attrs[key]; !ok { + attrs.add(key, value) + } + } +} + +func (attrs Attrs) toMap() map[string]string { + m := make(map[string]string) + for k, v := range attrs { + m[string(k)] = v + } + return m +} + +type attrList []Attr + +func (attrs attrList) Len() int { return len(attrs) } +func (attrs attrList) Less(i, j int) bool { + return attrs[i] < attrs[j] +} +func (attrs attrList) Swap(i, j int) { + attrs[i], attrs[j] = attrs[j], attrs[i] +} + +func (attrs Attrs) sortedNames() []Attr { + keys := make(attrList, 0) + for key := range attrs { + keys = append(keys, key) + } + sort.Sort(keys) + return []Attr(keys) +} + +// Copy returns a copy of the attributes map +func (attrs Attrs) Copy() Attrs { + mm := make(Attrs) + for k, v := range attrs { + mm[k] = v + } + return mm +} diff --git a/vendor/github.com/awalterschulze/gographviz/catch.go b/vendor/github.com/awalterschulze/gographviz/catch.go new file mode 100644 index 0000000000..7a4ed1183d --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/catch.go @@ -0,0 +1,101 @@ +//Copyright 2017 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import ( + "fmt" + "strings" +) + +type errInterface interface { + SetStrict(strict bool) + SetDir(directed bool) + SetName(name string) + AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) + AddEdge(src, dst string, directed bool, attrs map[string]string) + AddNode(parentGraph string, name string, attrs map[string]string) + AddAttr(parentGraph string, field, value string) + AddSubGraph(parentGraph string, name string, attrs map[string]string) + String() string + getError() error +} + +func newErrCatcher(g Interface) errInterface { + return &errCatcher{g, nil} +} + +type errCatcher struct { + Interface + errs []error +} + +func (e *errCatcher) SetStrict(strict bool) { + if err := e.Interface.SetStrict(strict); err != nil { + e.errs = append(e.errs, err) + } +} + +func (e *errCatcher) SetDir(directed bool) { + if err := e.Interface.SetDir(directed); err != nil { + e.errs = append(e.errs, err) + } +} + +func (e *errCatcher) SetName(name string) { + if err := e.Interface.SetName(name); err != nil { + e.errs = append(e.errs, err) + } +} + +func (e *errCatcher) AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) { + if err := e.Interface.AddPortEdge(src, srcPort, dst, dstPort, directed, attrs); err != nil { + e.errs = append(e.errs, err) + } +} + +func (e *errCatcher) AddEdge(src, dst string, directed bool, attrs map[string]string) { + if err := e.Interface.AddEdge(src, dst, directed, attrs); err != nil { + e.errs = append(e.errs, err) + } +} + +func (e *errCatcher) AddAttr(parentGraph string, field, value string) { + if err := e.Interface.AddAttr(parentGraph, field, value); err != nil { + e.errs = append(e.errs, err) + } +} + +func (e *errCatcher) AddSubGraph(parentGraph string, name string, attrs map[string]string) { + if err := e.Interface.AddSubGraph(parentGraph, name, attrs); err != nil { + e.errs = append(e.errs, err) + } +} + +func (e *errCatcher) AddNode(parentGraph string, name string, attrs map[string]string) { + if err := e.Interface.AddNode(parentGraph, name, attrs); err != nil { + e.errs = append(e.errs, err) + } +} + +func (e *errCatcher) getError() error { + if len(e.errs) == 0 { + return nil + } + ss := make([]string, len(e.errs)) + for i, err := range e.errs { + ss[i] = err.Error() + } + return fmt.Errorf("errors: [%s]", strings.Join(ss, ",")) +} diff --git a/vendor/github.com/awalterschulze/gographviz/edges.go b/vendor/github.com/awalterschulze/gographviz/edges.go new file mode 100644 index 0000000000..bde9269cca --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/edges.go @@ -0,0 +1,119 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import ( + "sort" +) + +// Edge represents an Edge. +type Edge struct { + Src string + SrcPort string + Dst string + DstPort string + Dir bool + Attrs Attrs +} + +// Edges represents a set of Edges. +type Edges struct { + SrcToDsts map[string]map[string][]*Edge + DstToSrcs map[string]map[string][]*Edge + Edges []*Edge +} + +// NewEdges creates a blank set of Edges. +func NewEdges() *Edges { + return &Edges{make(map[string]map[string][]*Edge), make(map[string]map[string][]*Edge), make([]*Edge, 0)} +} + +// Add adds an Edge to the set of Edges. +func (edges *Edges) Add(edge *Edge) { + if _, ok := edges.SrcToDsts[edge.Src]; !ok { + edges.SrcToDsts[edge.Src] = make(map[string][]*Edge) + } + if _, ok := edges.SrcToDsts[edge.Src][edge.Dst]; !ok { + edges.SrcToDsts[edge.Src][edge.Dst] = make([]*Edge, 0) + } + edges.SrcToDsts[edge.Src][edge.Dst] = append(edges.SrcToDsts[edge.Src][edge.Dst], edge) + + if _, ok := edges.DstToSrcs[edge.Dst]; !ok { + edges.DstToSrcs[edge.Dst] = make(map[string][]*Edge) + } + if _, ok := edges.DstToSrcs[edge.Dst][edge.Src]; !ok { + edges.DstToSrcs[edge.Dst][edge.Src] = make([]*Edge, 0) + } + edges.DstToSrcs[edge.Dst][edge.Src] = append(edges.DstToSrcs[edge.Dst][edge.Src], edge) + + edges.Edges = append(edges.Edges, edge) +} + +// Sorted returns a sorted list of Edges. +func (edges Edges) Sorted() []*Edge { + es := make(edgeSorter, len(edges.Edges)) + copy(es, edges.Edges) + sort.Sort(es) + return es +} + +type edgeSorter []*Edge + +func (es edgeSorter) Len() int { return len(es) } +func (es edgeSorter) Swap(i, j int) { es[i], es[j] = es[j], es[i] } +func (es edgeSorter) Less(i, j int) bool { + if es[i].Src < es[j].Src { + return true + } else if es[i].Src > es[j].Src { + return false + } + + if es[i].Dst < es[j].Dst { + return true + } else if es[i].Dst > es[j].Dst { + return false + } + + if es[i].SrcPort < es[j].SrcPort { + return true + } else if es[i].SrcPort > es[j].SrcPort { + return false + } + + if es[i].DstPort < es[j].DstPort { + return true + } else if es[i].DstPort > es[j].DstPort { + return false + } + + if es[i].Dir != es[j].Dir { + return es[i].Dir + } + + attrs := es[i].Attrs.Copy() + for k, v := range es[j].Attrs { + attrs[k] = v + } + + for _, k := range attrs.sortedNames() { + if es[i].Attrs[k] < es[j].Attrs[k] { + return true + } else if es[i].Attrs[k] > es[j].Attrs[k] { + return false + } + } + + return false +} diff --git a/vendor/github.com/awalterschulze/gographviz/escape.go b/vendor/github.com/awalterschulze/gographviz/escape.go new file mode 100644 index 0000000000..13d8bebc19 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/escape.go @@ -0,0 +1,192 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import ( + "fmt" + "strings" + "text/template" + "unicode" +) + +// Escape is just a Graph that escapes some strings when required. +type Escape struct { + *Graph +} + +// NewEscape returns a graph which will try to escape some strings when required +func NewEscape() *Escape { + return &Escape{NewGraph()} +} + +func isHTML(s string) bool { + if len(s) == 0 { + return false + } + ss := strings.TrimSpace(s) + if ss[0] != '<' { + return false + } + count := 0 + for _, c := range ss { + if c == '<' { + count++ + } + if c == '>' { + count-- + } + } + if count == 0 { + return true + } + return false +} + +func isLetter(ch rune) bool { + return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || + ch >= 0x80 && unicode.IsLetter(ch) && ch != 'ε' +} + +func isID(s string) bool { + i := 0 + pos := false + for _, c := range s { + if i == 0 { + if !isLetter(c) { + return false + } + pos = true + } + if unicode.IsSpace(c) { + return false + } + if c == '-' { + return false + } + i++ + } + return pos +} + +func isDigit(ch rune) bool { + return '0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch) +} + +func isNumber(s string) bool { + state := 0 + for _, c := range s { + if state == 0 { + if isDigit(c) || c == '.' { + state = 2 + } else if c == '-' { + state = 1 + } else { + return false + } + } else if state == 1 { + if isDigit(c) || c == '.' { + state = 2 + } + } else if c != '.' && !isDigit(c) { + return false + } + } + return (state == 2) +} + +func isStringLit(s string) bool { + if !strings.HasPrefix(s, `"`) || !strings.HasSuffix(s, `"`) { + return false + } + var prev rune + for _, r := range s[1 : len(s)-1] { + if r == '"' && prev != '\\' { + return false + } + prev = r + } + return true +} + +func esc(s string) string { + if len(s) == 0 { + return s + } + if isHTML(s) { + return s + } + ss := strings.TrimSpace(s) + if ss[0] == '<' { + return fmt.Sprintf("\"%s\"", strings.Replace(s, "\"", "\\\"", -1)) + } + if isID(s) { + return s + } + if isNumber(s) { + return s + } + if isStringLit(s) { + return s + } + return fmt.Sprintf("\"%s\"", template.HTMLEscapeString(s)) +} + +func escAttrs(attrs map[string]string) map[string]string { + newAttrs := make(map[string]string) + for k, v := range attrs { + newAttrs[esc(k)] = esc(v) + } + return newAttrs +} + +// SetName sets the graph name and escapes it, if needed. +func (escape *Escape) SetName(name string) error { + return escape.Graph.SetName(esc(name)) +} + +// AddPortEdge adds an edge with ports and escapes the src, dst and attrs, if needed. +func (escape *Escape) AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) error { + return escape.Graph.AddPortEdge(esc(src), srcPort, esc(dst), dstPort, directed, escAttrs(attrs)) +} + +// AddEdge adds an edge and escapes the src, dst and attrs, if needed. +func (escape *Escape) AddEdge(src, dst string, directed bool, attrs map[string]string) error { + return escape.AddPortEdge(src, "", dst, "", directed, attrs) +} + +// AddNode adds a node and escapes the parentGraph, name and attrs, if needed. +func (escape *Escape) AddNode(parentGraph string, name string, attrs map[string]string) error { + return escape.Graph.AddNode(esc(parentGraph), esc(name), escAttrs(attrs)) +} + +// AddAttr adds an attribute and escapes the parentGraph, field and value, if needed. +func (escape *Escape) AddAttr(parentGraph string, field, value string) error { + return escape.Graph.AddAttr(esc(parentGraph), esc(field), esc(value)) +} + +// AddSubGraph adds a subgraph and escapes the parentGraph, name and attrs, if needed. +func (escape *Escape) AddSubGraph(parentGraph string, name string, attrs map[string]string) error { + return escape.Graph.AddSubGraph(esc(parentGraph), esc(name), escAttrs(attrs)) +} + +// IsNode returns whether the, escaped if needed, name is a node in the graph. +func (escape *Escape) IsNode(name string) bool { + return escape.Graph.IsNode(esc(name)) +} + +// IsSubGraph returns whether the, escaped if needed, name is a subgraph in the grahp. +func (escape *Escape) IsSubGraph(name string) bool { + return escape.Graph.IsSubGraph(esc(name)) +} diff --git a/vendor/github.com/awalterschulze/gographviz/gographviz.go b/vendor/github.com/awalterschulze/gographviz/gographviz.go new file mode 100644 index 0000000000..277228eb51 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/gographviz.go @@ -0,0 +1,58 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +//Package gographviz provides parsing for the DOT grammar into +//an abstract syntax tree representing a graph, +//analysis of the abstract syntax tree into a more usable structure, +//and writing back of this structure into the DOT format. +package gographviz + +import ( + "github.com/awalterschulze/gographviz/ast" + "github.com/awalterschulze/gographviz/internal/parser" +) + +var _ Interface = NewGraph() + +//Interface allows you to parse the graph into your own structure. +type Interface interface { + SetStrict(strict bool) error + SetDir(directed bool) error + SetName(name string) error + AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) error + AddEdge(src, dst string, directed bool, attrs map[string]string) error + AddNode(parentGraph string, name string, attrs map[string]string) error + AddAttr(parentGraph string, field, value string) error + AddSubGraph(parentGraph string, name string, attrs map[string]string) error + String() string +} + +//Parse parses the buffer into a abstract syntax tree representing the graph. +func Parse(buf []byte) (*ast.Graph, error) { + return parser.ParseBytes(buf) +} + +//ParseString parses the buffer into a abstract syntax tree representing the graph. +func ParseString(buf string) (*ast.Graph, error) { + return parser.ParseBytes([]byte(buf)) +} + +//Read parses and creates a new Graph from the data. +func Read(buf []byte) (*Graph, error) { + st, err := Parse(buf) + if err != nil { + return nil, err + } + return NewAnalysedGraph(st) +} diff --git a/vendor/github.com/awalterschulze/gographviz/graph.go b/vendor/github.com/awalterschulze/gographviz/graph.go new file mode 100644 index 0000000000..e2bef45b36 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/graph.go @@ -0,0 +1,148 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import ( + "fmt" + "strings" +) + +// Graph is the analysed representation of the Graph parsed from the DOT format. +type Graph struct { + Attrs Attrs + Name string + Directed bool + Strict bool + Nodes *Nodes + Edges *Edges + SubGraphs *SubGraphs + Relations *Relations +} + +// NewGraph creates a new empty graph, ready to be populated. +func NewGraph() *Graph { + return &Graph{ + Attrs: make(Attrs), + Name: "", + Directed: false, + Strict: false, + Nodes: NewNodes(), + Edges: NewEdges(), + SubGraphs: NewSubGraphs(), + Relations: NewRelations(), + } +} + +// SetStrict sets whether a graph is strict. +// If the graph is strict then multiple edges are not allowed between the same pairs of nodes, +// see dot man page. +func (g *Graph) SetStrict(strict bool) error { + g.Strict = strict + return nil +} + +// SetDir sets whether the graph is directed (true) or undirected (false). +func (g *Graph) SetDir(dir bool) error { + g.Directed = dir + return nil +} + +// SetName sets the graph name. +func (g *Graph) SetName(name string) error { + g.Name = name + return nil +} + +// AddPortEdge adds an edge to the graph from node src to node dst. +// srcPort and dstPort are the port the node ports, leave as empty strings if it is not required. +// This does not imply the adding of missing nodes. +func (g *Graph) AddPortEdge(src, srcPort, dst, dstPort string, directed bool, attrs map[string]string) error { + as, err := NewAttrs(attrs) + if err != nil { + return err + } + g.Edges.Add(&Edge{src, srcPort, dst, dstPort, directed, as}) + return nil +} + +// AddEdge adds an edge to the graph from node src to node dst. +// This does not imply the adding of missing nodes. +// If directed is set to true then SetDir(true) must also be called or there will be a syntax error in the output. +func (g *Graph) AddEdge(src, dst string, directed bool, attrs map[string]string) error { + return g.AddPortEdge(src, "", dst, "", directed, attrs) +} + +// AddNode adds a node to a graph/subgraph. +// If not subgraph exists use the name of the main graph. +// This does not imply the adding of a missing subgraph. +func (g *Graph) AddNode(parentGraph string, name string, attrs map[string]string) error { + as, err := NewAttrs(attrs) + if err != nil { + return err + } + g.Nodes.Add(&Node{name, as}) + g.Relations.Add(parentGraph, name) + return nil +} + +func (g *Graph) getAttrs(graphName string) (Attrs, error) { + if g.Name == graphName { + return g.Attrs, nil + } + sub, ok := g.SubGraphs.SubGraphs[graphName] + if !ok { + return nil, fmt.Errorf("graph or subgraph %s does not exist", graphName) + } + return sub.Attrs, nil +} + +// AddAttr adds an attribute to a graph/subgraph. +func (g *Graph) AddAttr(parentGraph string, field string, value string) error { + a, err := g.getAttrs(parentGraph) + if err != nil { + return err + } + return a.Add(field, value) +} + +// AddSubGraph adds a subgraph to a graph/subgraph. +func (g *Graph) AddSubGraph(parentGraph string, name string, attrs map[string]string) error { + g.Relations.Add(parentGraph, name) + g.SubGraphs.Add(name) + for key, value := range attrs { + if err := g.AddAttr(name, key, value); err != nil { + return err + } + } + return nil +} + +// IsNode returns whether a given node name exists as a node in the graph. +func (g *Graph) IsNode(name string) bool { + _, ok := g.Nodes.Lookup[name] + return ok +} + +// IsSubGraph returns whether a given subgraph name exists as a subgraph in the graph. +func (g *Graph) IsSubGraph(name string) bool { + _, ok := g.SubGraphs.SubGraphs[name] + return ok +} + +func (g *Graph) isClusterSubGraph(name string) bool { + isSubGraph := g.IsSubGraph(name) + isCluster := strings.HasPrefix(name, "cluster") + return isSubGraph && isCluster +} diff --git a/vendor/github.com/awalterschulze/gographviz/internal/errors/errors.go b/vendor/github.com/awalterschulze/gographviz/internal/errors/errors.go new file mode 100644 index 0000000000..4490dff08f --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/errors/errors.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package errors + +import ( + "bytes" + "fmt" + + "github.com/awalterschulze/gographviz/internal/token" +) + +type ErrorSymbol interface { +} + +type Error struct { + Err error + ErrorToken *token.Token + ErrorSymbols []ErrorSymbol + ExpectedTokens []string + StackTop int +} + +func (E *Error) String() string { + w := new(bytes.Buffer) + fmt.Fprintf(w, "Error") + if E.Err != nil { + fmt.Fprintf(w, " %s\n", E.Err) + } else { + fmt.Fprintf(w, "\n") + } + fmt.Fprintf(w, "Token: type=%d, lit=%s\n", E.ErrorToken.Type, E.ErrorToken.Lit) + fmt.Fprintf(w, "Pos: offset=%d, line=%d, column=%d\n", E.ErrorToken.Pos.Offset, E.ErrorToken.Pos.Line, E.ErrorToken.Pos.Column) + fmt.Fprintf(w, "Expected one of: ") + for _, sym := range E.ExpectedTokens { + fmt.Fprintf(w, "%s ", sym) + } + fmt.Fprintf(w, "ErrorSymbol:\n") + for _, sym := range E.ErrorSymbols { + fmt.Fprintf(w, "%v\n", sym) + } + return w.String() +} + +func (e *Error) Error() string { + w := new(bytes.Buffer) + fmt.Fprintf(w, "Error in S%d: %s, %s", e.StackTop, token.TokMap.TokenString(e.ErrorToken), e.ErrorToken.Pos.String()) + if e.Err != nil { + fmt.Fprintf(w, e.Err.Error()) + } else { + fmt.Fprintf(w, ", expected one of: ") + for _, expected := range e.ExpectedTokens { + fmt.Fprintf(w, "%s ", expected) + } + } + return w.String() +} diff --git a/vendor/github.com/awalterschulze/gographviz/internal/lexer/acttab.go b/vendor/github.com/awalterschulze/gographviz/internal/lexer/acttab.go new file mode 100644 index 0000000000..43f05ee386 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/lexer/acttab.go @@ -0,0 +1,587 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + "fmt" + + "github.com/awalterschulze/gographviz/internal/token" +) + +type ActionTable [NumStates]ActionRow + +type ActionRow struct { + Accept token.Type + Ignore string +} + +func (this ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", this.Accept, this.Ignore) +} + +var ActTab = ActionTable{ + ActionRow{ // S0 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S1 + Accept: -1, + Ignore: "!whitespace", + }, + ActionRow{ // S2 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S3 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S4 + Accept: 13, + Ignore: "", + }, + ActionRow{ // S5 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S6 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S7 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S8 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S9 + Accept: 14, + Ignore: "", + }, + ActionRow{ // S10 + Accept: 7, + Ignore: "", + }, + ActionRow{ // S11 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S12 + Accept: 8, + Ignore: "", + }, + ActionRow{ // S13 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S14 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S15 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S16 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S17 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S18 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S19 + Accept: 11, + Ignore: "", + }, + ActionRow{ // S20 + Accept: 12, + Ignore: "", + }, + ActionRow{ // S21 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S22 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S23 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S24 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S25 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S26 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S27 + Accept: 3, + Ignore: "", + }, + ActionRow{ // S28 + Accept: 4, + Ignore: "", + }, + ActionRow{ // S29 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S30 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S31 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S32 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S33 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S34 + Accept: -1, + Ignore: "!comment", + }, + ActionRow{ // S35 + Accept: 17, + Ignore: "", + }, + ActionRow{ // S36 + Accept: 16, + Ignore: "", + }, + ActionRow{ // S37 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S38 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S39 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S40 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S41 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S42 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S43 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S44 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S45 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S46 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S47 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S48 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S49 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S50 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S51 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S52 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S53 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S54 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S55 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S56 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S57 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S58 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S59 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S60 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S61 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S62 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S63 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S64 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S65 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S66 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S67 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S68 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S69 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S70 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S71 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S72 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S73 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S74 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S75 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S76 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S77 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S78 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S79 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S80 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S81 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S82 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S83 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S84 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S85 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S86 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S87 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S88 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S89 + Accept: -1, + Ignore: "!comment", + }, + ActionRow{ // S90 + Accept: 0, + Ignore: "", + }, + ActionRow{ // S91 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S92 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S93 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S94 + Accept: 10, + Ignore: "", + }, + ActionRow{ // S95 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S96 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S97 + Accept: 9, + Ignore: "", + }, + ActionRow{ // S98 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S99 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S100 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S101 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S102 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S103 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S104 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S105 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S106 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S107 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S108 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S109 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S110 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S111 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S112 + Accept: 2, + Ignore: "", + }, + ActionRow{ // S113 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S114 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S115 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S116 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S117 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S118 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S119 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S120 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S121 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S122 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S123 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S124 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S125 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S126 + Accept: 5, + Ignore: "", + }, + ActionRow{ // S127 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S128 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S129 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S130 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S131 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S132 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S133 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S134 + Accept: 6, + Ignore: "", + }, + ActionRow{ // S135 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S136 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S137 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S138 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S139 + Accept: 18, + Ignore: "", + }, + ActionRow{ // S140 + Accept: 15, + Ignore: "", + }, +} diff --git a/vendor/github.com/awalterschulze/gographviz/internal/lexer/lexer.go b/vendor/github.com/awalterschulze/gographviz/internal/lexer/lexer.go new file mode 100644 index 0000000000..e1832a45da --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/lexer/lexer.go @@ -0,0 +1,328 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +import ( + // "fmt" + "io/ioutil" + "unicode/utf8" + + // "github.com/awalterschulze/gographviz/internal/util" + "github.com/awalterschulze/gographviz/internal/token" +) + +const ( + NoState = -1 + NumStates = 141 + NumSymbols = 184 +) + +type Lexer struct { + src []byte + pos int + line int + column int +} + +func NewLexer(src []byte) *Lexer { + lexer := &Lexer{ + src: src, + pos: 0, + line: 1, + column: 1, + } + return lexer +} + +func NewLexerFile(fpath string) (*Lexer, error) { + src, err := ioutil.ReadFile(fpath) + if err != nil { + return nil, err + } + return NewLexer(src), nil +} + +func (this *Lexer) Scan() (tok *token.Token) { + + // fmt.Printf("Lexer.Scan() pos=%d\n", this.pos) + + tok = new(token.Token) + if this.pos >= len(this.src) { + tok.Type = token.EOF + tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = this.pos, this.line, this.column + return + } + start, startLine, startColumn, end := this.pos, this.line, this.column, 0 + tok.Type = token.INVALID + state, rune1, size := 0, rune(-1), 0 + for state != -1 { + + // fmt.Printf("\tpos=%d, line=%d, col=%d, state=%d\n", this.pos, this.line, this.column, state) + + if this.pos >= len(this.src) { + rune1 = -1 + } else { + rune1, size = utf8.DecodeRune(this.src[this.pos:]) + this.pos += size + } + + // Production start + if rune1 != -1 { + state = TransTab[state](rune1) + } else { + state = -1 + } + // Production end + + // Debug start + // nextState := -1 + // if rune1 != -1 { + // nextState = TransTab[state](rune1) + // } + // fmt.Printf("\tS%d, : tok=%s, rune == %s(%x), next state == %d\n", state, token.TokMap.Id(tok.Type), util.RuneToString(rune1), rune1, nextState) + // fmt.Printf("\t\tpos=%d, size=%d, start=%d, end=%d\n", this.pos, size, start, end) + // if nextState != -1 { + // fmt.Printf("\t\taction:%s\n", ActTab[nextState].String()) + // } + // state = nextState + // Debug end + + if state != -1 { + + switch rune1 { + case '\n': + this.line++ + this.column = 1 + case '\r': + this.column = 1 + case '\t': + this.column += 4 + default: + this.column++ + } + + switch { + case ActTab[state].Accept != -1: + tok.Type = ActTab[state].Accept + // fmt.Printf("\t Accept(%s), %s(%d)\n", string(act), token.TokMap.Id(tok), tok) + end = this.pos + case ActTab[state].Ignore != "": + // fmt.Printf("\t Ignore(%s)\n", string(act)) + start, startLine, startColumn = this.pos, this.line, this.column + state = 0 + if start >= len(this.src) { + tok.Type = token.EOF + } + + } + } else { + if tok.Type == token.INVALID { + end = this.pos + } + } + } + if end > start { + this.pos = end + tok.Lit = this.src[start:end] + } else { + tok.Lit = []byte{} + } + tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = start, startLine, startColumn + + // fmt.Printf("Token at %s: %s \"%s\"\n", tok.String(), token.TokMap.Id(tok.Type), tok.Lit) + + return +} + +func (this *Lexer) Reset() { + this.pos = 0 +} + +/* +Lexer symbols: +0: 'n' +1: 'o' +2: 'd' +3: 'e' +4: 'N' +5: 'o' +6: 'd' +7: 'e' +8: 'N' +9: 'O' +10: 'D' +11: 'E' +12: 'e' +13: 'd' +14: 'g' +15: 'e' +16: 'E' +17: 'd' +18: 'g' +19: 'e' +20: 'E' +21: 'D' +22: 'G' +23: 'E' +24: 'g' +25: 'r' +26: 'a' +27: 'p' +28: 'h' +29: 'G' +30: 'r' +31: 'a' +32: 'p' +33: 'h' +34: 'G' +35: 'R' +36: 'A' +37: 'P' +38: 'H' +39: 'd' +40: 'i' +41: 'g' +42: 'r' +43: 'a' +44: 'p' +45: 'h' +46: 'D' +47: 'i' +48: 'g' +49: 'r' +50: 'a' +51: 'p' +52: 'h' +53: 'd' +54: 'i' +55: 'G' +56: 'r' +57: 'a' +58: 'p' +59: 'h' +60: 'D' +61: 'i' +62: 'G' +63: 'r' +64: 'a' +65: 'p' +66: 'h' +67: 'D' +68: 'I' +69: 'G' +70: 'R' +71: 'A' +72: 'P' +73: 'H' +74: 's' +75: 'u' +76: 'b' +77: 'g' +78: 'r' +79: 'a' +80: 'p' +81: 'h' +82: 'S' +83: 'u' +84: 'b' +85: 'g' +86: 'r' +87: 'a' +88: 'p' +89: 'h' +90: 's' +91: 'u' +92: 'b' +93: 'G' +94: 'r' +95: 'a' +96: 'p' +97: 'h' +98: 'S' +99: 'u' +100: 'b' +101: 'G' +102: 'r' +103: 'a' +104: 'p' +105: 'h' +106: 'S' +107: 'U' +108: 'B' +109: 'G' +110: 'R' +111: 'A' +112: 'P' +113: 'H' +114: 's' +115: 't' +116: 'r' +117: 'i' +118: 'c' +119: 't' +120: 'S' +121: 't' +122: 'r' +123: 'i' +124: 'c' +125: 't' +126: 'S' +127: 'T' +128: 'R' +129: 'I' +130: 'C' +131: 'T' +132: '{' +133: '}' +134: ';' +135: '=' +136: '[' +137: ']' +138: ',' +139: ':' +140: '-' +141: '>' +142: '-' +143: '-' +144: '_' +145: '-' +146: '.' +147: '-' +148: '.' +149: '\' +150: '"' +151: '\' +152: '"' +153: '"' +154: '=' +155: '<' +156: '>' +157: '<' +158: '>' +159: '/' +160: '/' +161: '\n' +162: '#' +163: '\n' +164: '/' +165: '*' +166: '*' +167: '*' +168: '/' +169: ' ' +170: '\t' +171: '\r' +172: '\n' +173: \u0001-'!' +174: '#'-'[' +175: ']'-\u007f +176: 'a'-'z' +177: 'A'-'Z' +178: '0'-'9' +179: \u0080-\ufffc +180: \ufffe-\U0010ffff +181: \u0001-';' +182: '?'-\u00ff +183: . + +*/ diff --git a/vendor/github.com/awalterschulze/gographviz/internal/lexer/transitiontable.go b/vendor/github.com/awalterschulze/gographviz/internal/lexer/transitiontable.go new file mode 100644 index 0000000000..ec29c5d145 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/lexer/transitiontable.go @@ -0,0 +1,3017 @@ +// Code generated by gocc; DO NOT EDIT. + +package lexer + +/* +Let s be the current state +Let r be the current input rune +transitionTable[s](r) returns the next state. +*/ +type TransitionTable [NumStates]func(rune) int + +var TransTab = TransitionTable{ + + // S0 + func(r rune) int { + switch { + case r == 9: // ['\t','\t'] + return 1 + case r == 10: // ['\n','\n'] + return 1 + case r == 13: // ['\r','\r'] + return 1 + case r == 32: // [' ',' '] + return 1 + case r == 34: // ['"','"'] + return 2 + case r == 35: // ['#','#'] + return 3 + case r == 44: // [',',','] + return 4 + case r == 45: // ['-','-'] + return 5 + case r == 46: // ['.','.'] + return 6 + case r == 47: // ['/','/'] + return 7 + case 48 <= r && r <= 57: // ['0','9'] + return 8 + case r == 58: // [':',':'] + return 9 + case r == 59: // [';',';'] + return 10 + case r == 60: // ['<','<'] + return 11 + case r == 61: // ['=','='] + return 12 + case 65 <= r && r <= 67: // ['A','C'] + return 13 + case r == 68: // ['D','D'] + return 14 + case r == 69: // ['E','E'] + return 15 + case r == 70: // ['F','F'] + return 13 + case r == 71: // ['G','G'] + return 16 + case 72 <= r && r <= 77: // ['H','M'] + return 13 + case r == 78: // ['N','N'] + return 17 + case 79 <= r && r <= 82: // ['O','R'] + return 13 + case r == 83: // ['S','S'] + return 18 + case 84 <= r && r <= 90: // ['T','Z'] + return 13 + case r == 91: // ['[','['] + return 19 + case r == 93: // [']',']'] + return 20 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 99: // ['a','c'] + return 13 + case r == 100: // ['d','d'] + return 22 + case r == 101: // ['e','e'] + return 23 + case r == 102: // ['f','f'] + return 13 + case r == 103: // ['g','g'] + return 24 + case 104 <= r && r <= 109: // ['h','m'] + return 13 + case r == 110: // ['n','n'] + return 25 + case 111 <= r && r <= 114: // ['o','r'] + return 13 + case r == 115: // ['s','s'] + return 26 + case 116 <= r && r <= 122: // ['t','z'] + return 13 + case r == 123: // ['{','{'] + return 27 + case r == 125: // ['}','}'] + return 28 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S1 + func(r rune) int { + switch { + + } + return NoState + }, + + // S2 + func(r rune) int { + switch { + case 1 <= r && r <= 33: // [\u0001,'!'] + return 30 + case r == 34: // ['"','"'] + return 31 + case 35 <= r && r <= 91: // ['#','['] + return 30 + case r == 92: // ['\','\'] + return 32 + case 93 <= r && r <= 127: // [']',\u007f] + return 30 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 33 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 33 + + } + return NoState + }, + + // S3 + func(r rune) int { + switch { + case r == 10: // ['\n','\n'] + return 34 + + default: + return 3 + } + + }, + + // S4 + func(r rune) int { + switch { + + } + return NoState + }, + + // S5 + func(r rune) int { + switch { + case r == 45: // ['-','-'] + return 35 + case r == 46: // ['.','.'] + return 6 + case 48 <= r && r <= 57: // ['0','9'] + return 8 + case r == 62: // ['>','>'] + return 36 + + } + return NoState + }, + + // S6 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 37 + + } + return NoState + }, + + // S7 + func(r rune) int { + switch { + case r == 42: // ['*','*'] + return 38 + case r == 47: // ['/','/'] + return 39 + + } + return NoState + }, + + // S8 + func(r rune) int { + switch { + case r == 46: // ['.','.'] + return 40 + case 48 <= r && r <= 57: // ['0','9'] + return 8 + + } + return NoState + }, + + // S9 + func(r rune) int { + switch { + + } + return NoState + }, + + // S10 + func(r rune) int { + switch { + + } + return NoState + }, + + // S11 + func(r rune) int { + switch { + case 1 <= r && r <= 59: // [\u0001,';'] + return 41 + case r == 60: // ['<','<'] + return 42 + case r == 61: // ['=','='] + return 41 + case r == 62: // ['>','>'] + return 43 + case 63 <= r && r <= 255: // ['?',\u00ff] + return 41 + + } + return NoState + }, + + // S12 + func(r rune) int { + switch { + + } + return NoState + }, + + // S13 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S14 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 72: // ['A','H'] + return 13 + case r == 73: // ['I','I'] + return 45 + case 74 <= r && r <= 90: // ['J','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 104: // ['a','h'] + return 13 + case r == 105: // ['i','i'] + return 46 + case 106 <= r && r <= 122: // ['j','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S15 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 67: // ['A','C'] + return 13 + case r == 68: // ['D','D'] + return 47 + case 69 <= r && r <= 90: // ['E','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 99: // ['a','c'] + return 13 + case r == 100: // ['d','d'] + return 48 + case 101 <= r && r <= 122: // ['e','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S16 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 81: // ['A','Q'] + return 13 + case r == 82: // ['R','R'] + return 49 + case 83 <= r && r <= 90: // ['S','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 50 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S17 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 78: // ['A','N'] + return 13 + case r == 79: // ['O','O'] + return 51 + case 80 <= r && r <= 90: // ['P','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 110: // ['a','n'] + return 13 + case r == 111: // ['o','o'] + return 52 + case 112 <= r && r <= 122: // ['p','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S18 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 83: // ['A','S'] + return 13 + case r == 84: // ['T','T'] + return 53 + case r == 85: // ['U','U'] + return 54 + case 86 <= r && r <= 90: // ['V','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 115: // ['a','s'] + return 13 + case r == 116: // ['t','t'] + return 55 + case r == 117: // ['u','u'] + return 56 + case 118 <= r && r <= 122: // ['v','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S19 + func(r rune) int { + switch { + + } + return NoState + }, + + // S20 + func(r rune) int { + switch { + + } + return NoState + }, + + // S21 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S22 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 104: // ['a','h'] + return 13 + case r == 105: // ['i','i'] + return 57 + case 106 <= r && r <= 122: // ['j','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S23 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 99: // ['a','c'] + return 13 + case r == 100: // ['d','d'] + return 58 + case 101 <= r && r <= 122: // ['e','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S24 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 59 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S25 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 110: // ['a','n'] + return 13 + case r == 111: // ['o','o'] + return 60 + case 112 <= r && r <= 122: // ['p','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S26 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 115: // ['a','s'] + return 13 + case r == 116: // ['t','t'] + return 61 + case r == 117: // ['u','u'] + return 62 + case 118 <= r && r <= 122: // ['v','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S27 + func(r rune) int { + switch { + + } + return NoState + }, + + // S28 + func(r rune) int { + switch { + + } + return NoState + }, + + // S29 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S30 + func(r rune) int { + switch { + case 1 <= r && r <= 33: // [\u0001,'!'] + return 30 + case r == 34: // ['"','"'] + return 31 + case 35 <= r && r <= 91: // ['#','['] + return 30 + case r == 92: // ['\','\'] + return 32 + case 93 <= r && r <= 127: // [']',\u007f] + return 30 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 33 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 33 + + } + return NoState + }, + + // S31 + func(r rune) int { + switch { + + } + return NoState + }, + + // S32 + func(r rune) int { + switch { + case 1 <= r && r <= 33: // [\u0001,'!'] + return 63 + case r == 34: // ['"','"'] + return 64 + case 35 <= r && r <= 91: // ['#','['] + return 63 + case r == 92: // ['\','\'] + return 64 + case 93 <= r && r <= 127: // [']',\u007f] + return 63 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 65 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 65 + + } + return NoState + }, + + // S33 + func(r rune) int { + switch { + case 1 <= r && r <= 33: // [\u0001,'!'] + return 30 + case r == 34: // ['"','"'] + return 31 + case 35 <= r && r <= 91: // ['#','['] + return 30 + case r == 92: // ['\','\'] + return 32 + case 93 <= r && r <= 127: // [']',\u007f] + return 30 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 33 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 33 + + } + return NoState + }, + + // S34 + func(r rune) int { + switch { + + } + return NoState + }, + + // S35 + func(r rune) int { + switch { + + } + return NoState + }, + + // S36 + func(r rune) int { + switch { + + } + return NoState + }, + + // S37 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 37 + + } + return NoState + }, + + // S38 + func(r rune) int { + switch { + case r == 42: // ['*','*'] + return 66 + + default: + return 38 + } + + }, + + // S39 + func(r rune) int { + switch { + case r == 10: // ['\n','\n'] + return 34 + + default: + return 39 + } + + }, + + // S40 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 67 + + } + return NoState + }, + + // S41 + func(r rune) int { + switch { + case 1 <= r && r <= 59: // [\u0001,';'] + return 41 + case r == 60: // ['<','<'] + return 42 + case r == 61: // ['=','='] + return 41 + case r == 62: // ['>','>'] + return 43 + case 63 <= r && r <= 255: // ['?',\u00ff] + return 41 + + } + return NoState + }, + + // S42 + func(r rune) int { + switch { + case 1 <= r && r <= 59: // [\u0001,';'] + return 68 + case r == 61: // ['=','='] + return 68 + case 63 <= r && r <= 255: // ['?',\u00ff] + return 68 + + } + return NoState + }, + + // S43 + func(r rune) int { + switch { + + } + return NoState + }, + + // S44 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S45 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 70: // ['A','F'] + return 13 + case r == 71: // ['G','G'] + return 69 + case 72 <= r && r <= 90: // ['H','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S46 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 70: // ['A','F'] + return 13 + case r == 71: // ['G','G'] + return 70 + case 72 <= r && r <= 90: // ['H','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 102: // ['a','f'] + return 13 + case r == 103: // ['g','g'] + return 71 + case 104 <= r && r <= 122: // ['h','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S47 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 70: // ['A','F'] + return 13 + case r == 71: // ['G','G'] + return 72 + case 72 <= r && r <= 90: // ['H','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S48 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 102: // ['a','f'] + return 13 + case r == 103: // ['g','g'] + return 73 + case 104 <= r && r <= 122: // ['h','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S49 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case r == 65: // ['A','A'] + return 74 + case 66 <= r && r <= 90: // ['B','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S50 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 75 + case 98 <= r && r <= 122: // ['b','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S51 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 67: // ['A','C'] + return 13 + case r == 68: // ['D','D'] + return 76 + case 69 <= r && r <= 90: // ['E','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S52 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 99: // ['a','c'] + return 13 + case r == 100: // ['d','d'] + return 77 + case 101 <= r && r <= 122: // ['e','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S53 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 81: // ['A','Q'] + return 13 + case r == 82: // ['R','R'] + return 78 + case 83 <= r && r <= 90: // ['S','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S54 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case r == 65: // ['A','A'] + return 13 + case r == 66: // ['B','B'] + return 79 + case 67 <= r && r <= 90: // ['C','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S55 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 80 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S56 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 13 + case r == 98: // ['b','b'] + return 81 + case 99 <= r && r <= 122: // ['c','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S57 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 70: // ['A','F'] + return 13 + case r == 71: // ['G','G'] + return 82 + case 72 <= r && r <= 90: // ['H','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 102: // ['a','f'] + return 13 + case r == 103: // ['g','g'] + return 83 + case 104 <= r && r <= 122: // ['h','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S58 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 102: // ['a','f'] + return 13 + case r == 103: // ['g','g'] + return 84 + case 104 <= r && r <= 122: // ['h','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S59 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 85 + case 98 <= r && r <= 122: // ['b','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S60 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 99: // ['a','c'] + return 13 + case r == 100: // ['d','d'] + return 86 + case 101 <= r && r <= 122: // ['e','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S61 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 87 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S62 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 13 + case r == 98: // ['b','b'] + return 88 + case 99 <= r && r <= 122: // ['c','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S63 + func(r rune) int { + switch { + case 1 <= r && r <= 33: // [\u0001,'!'] + return 30 + case r == 34: // ['"','"'] + return 31 + case 35 <= r && r <= 91: // ['#','['] + return 30 + case r == 92: // ['\','\'] + return 32 + case 93 <= r && r <= 127: // [']',\u007f] + return 30 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 33 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 33 + + } + return NoState + }, + + // S64 + func(r rune) int { + switch { + case 1 <= r && r <= 33: // [\u0001,'!'] + return 30 + case r == 34: // ['"','"'] + return 31 + case 35 <= r && r <= 91: // ['#','['] + return 30 + case r == 92: // ['\','\'] + return 32 + case 93 <= r && r <= 127: // [']',\u007f] + return 30 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 33 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 33 + + } + return NoState + }, + + // S65 + func(r rune) int { + switch { + case 1 <= r && r <= 33: // [\u0001,'!'] + return 30 + case r == 34: // ['"','"'] + return 31 + case 35 <= r && r <= 91: // ['#','['] + return 30 + case r == 92: // ['\','\'] + return 32 + case 93 <= r && r <= 127: // [']',\u007f] + return 30 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 33 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 33 + + } + return NoState + }, + + // S66 + func(r rune) int { + switch { + case r == 42: // ['*','*'] + return 66 + case r == 47: // ['/','/'] + return 89 + + default: + return 38 + } + + }, + + // S67 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 67 + + } + return NoState + }, + + // S68 + func(r rune) int { + switch { + case 1 <= r && r <= 59: // [\u0001,';'] + return 68 + case r == 61: // ['=','='] + return 68 + case r == 62: // ['>','>'] + return 90 + case 63 <= r && r <= 255: // ['?',\u00ff] + return 68 + + } + return NoState + }, + + // S69 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 81: // ['A','Q'] + return 13 + case r == 82: // ['R','R'] + return 91 + case 83 <= r && r <= 90: // ['S','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S70 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 92 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S71 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 93 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S72 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 68: // ['A','D'] + return 13 + case r == 69: // ['E','E'] + return 94 + case 70 <= r && r <= 90: // ['F','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S73 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 100: // ['a','d'] + return 13 + case r == 101: // ['e','e'] + return 94 + case 102 <= r && r <= 122: // ['f','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S74 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 79: // ['A','O'] + return 13 + case r == 80: // ['P','P'] + return 95 + case 81 <= r && r <= 90: // ['Q','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S75 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 111: // ['a','o'] + return 13 + case r == 112: // ['p','p'] + return 96 + case 113 <= r && r <= 122: // ['q','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S76 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 68: // ['A','D'] + return 13 + case r == 69: // ['E','E'] + return 97 + case 70 <= r && r <= 90: // ['F','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S77 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 100: // ['a','d'] + return 13 + case r == 101: // ['e','e'] + return 97 + case 102 <= r && r <= 122: // ['f','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S78 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 72: // ['A','H'] + return 13 + case r == 73: // ['I','I'] + return 98 + case 74 <= r && r <= 90: // ['J','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S79 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 70: // ['A','F'] + return 13 + case r == 71: // ['G','G'] + return 99 + case 72 <= r && r <= 90: // ['H','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S80 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 104: // ['a','h'] + return 13 + case r == 105: // ['i','i'] + return 100 + case 106 <= r && r <= 122: // ['j','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S81 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 70: // ['A','F'] + return 13 + case r == 71: // ['G','G'] + return 101 + case 72 <= r && r <= 90: // ['H','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 102: // ['a','f'] + return 13 + case r == 103: // ['g','g'] + return 102 + case 104 <= r && r <= 122: // ['h','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S82 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 103 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S83 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 104 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S84 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 100: // ['a','d'] + return 13 + case r == 101: // ['e','e'] + return 94 + case 102 <= r && r <= 122: // ['f','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S85 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 111: // ['a','o'] + return 13 + case r == 112: // ['p','p'] + return 105 + case 113 <= r && r <= 122: // ['q','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S86 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 100: // ['a','d'] + return 13 + case r == 101: // ['e','e'] + return 97 + case 102 <= r && r <= 122: // ['f','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S87 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 104: // ['a','h'] + return 13 + case r == 105: // ['i','i'] + return 106 + case 106 <= r && r <= 122: // ['j','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S88 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 70: // ['A','F'] + return 13 + case r == 71: // ['G','G'] + return 107 + case 72 <= r && r <= 90: // ['H','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 102: // ['a','f'] + return 13 + case r == 103: // ['g','g'] + return 108 + case 104 <= r && r <= 122: // ['h','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S89 + func(r rune) int { + switch { + + } + return NoState + }, + + // S90 + func(r rune) int { + switch { + case 1 <= r && r <= 59: // [\u0001,';'] + return 41 + case r == 60: // ['<','<'] + return 42 + case r == 61: // ['=','='] + return 41 + case r == 62: // ['>','>'] + return 43 + case 63 <= r && r <= 255: // ['?',\u00ff] + return 41 + + } + return NoState + }, + + // S91 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case r == 65: // ['A','A'] + return 109 + case 66 <= r && r <= 90: // ['B','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S92 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 110 + case 98 <= r && r <= 122: // ['b','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S93 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 111 + case 98 <= r && r <= 122: // ['b','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S94 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S95 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 71: // ['A','G'] + return 13 + case r == 72: // ['H','H'] + return 112 + case 73 <= r && r <= 90: // ['I','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S96 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 103: // ['a','g'] + return 13 + case r == 104: // ['h','h'] + return 112 + case 105 <= r && r <= 122: // ['i','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S97 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S98 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 66: // ['A','B'] + return 13 + case r == 67: // ['C','C'] + return 113 + case 68 <= r && r <= 90: // ['D','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S99 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 81: // ['A','Q'] + return 13 + case r == 82: // ['R','R'] + return 114 + case 83 <= r && r <= 90: // ['S','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S100 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 98: // ['a','b'] + return 13 + case r == 99: // ['c','c'] + return 115 + case 100 <= r && r <= 122: // ['d','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S101 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 116 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S102 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 117 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S103 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 118 + case 98 <= r && r <= 122: // ['b','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S104 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 119 + case 98 <= r && r <= 122: // ['b','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S105 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 103: // ['a','g'] + return 13 + case r == 104: // ['h','h'] + return 112 + case 105 <= r && r <= 122: // ['i','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S106 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 98: // ['a','b'] + return 13 + case r == 99: // ['c','c'] + return 120 + case 100 <= r && r <= 122: // ['d','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S107 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 121 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S108 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 113: // ['a','q'] + return 13 + case r == 114: // ['r','r'] + return 122 + case 115 <= r && r <= 122: // ['s','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S109 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 79: // ['A','O'] + return 13 + case r == 80: // ['P','P'] + return 123 + case 81 <= r && r <= 90: // ['Q','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S110 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 111: // ['a','o'] + return 13 + case r == 112: // ['p','p'] + return 124 + case 113 <= r && r <= 122: // ['q','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S111 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 111: // ['a','o'] + return 13 + case r == 112: // ['p','p'] + return 125 + case 113 <= r && r <= 122: // ['q','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S112 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S113 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 83: // ['A','S'] + return 13 + case r == 84: // ['T','T'] + return 126 + case 85 <= r && r <= 90: // ['U','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S114 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case r == 65: // ['A','A'] + return 127 + case 66 <= r && r <= 90: // ['B','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S115 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 115: // ['a','s'] + return 13 + case r == 116: // ['t','t'] + return 126 + case 117 <= r && r <= 122: // ['u','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S116 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 128 + case 98 <= r && r <= 122: // ['b','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S117 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 129 + case 98 <= r && r <= 122: // ['b','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S118 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 111: // ['a','o'] + return 13 + case r == 112: // ['p','p'] + return 130 + case 113 <= r && r <= 122: // ['q','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S119 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 111: // ['a','o'] + return 13 + case r == 112: // ['p','p'] + return 131 + case 113 <= r && r <= 122: // ['q','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S120 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 115: // ['a','s'] + return 13 + case r == 116: // ['t','t'] + return 126 + case 117 <= r && r <= 122: // ['u','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S121 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 132 + case 98 <= r && r <= 122: // ['b','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S122 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case r == 97: // ['a','a'] + return 133 + case 98 <= r && r <= 122: // ['b','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S123 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 71: // ['A','G'] + return 13 + case r == 72: // ['H','H'] + return 134 + case 73 <= r && r <= 90: // ['I','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S124 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 103: // ['a','g'] + return 13 + case r == 104: // ['h','h'] + return 134 + case 105 <= r && r <= 122: // ['i','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S125 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 103: // ['a','g'] + return 13 + case r == 104: // ['h','h'] + return 134 + case 105 <= r && r <= 122: // ['i','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S126 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S127 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 79: // ['A','O'] + return 13 + case r == 80: // ['P','P'] + return 135 + case 81 <= r && r <= 90: // ['Q','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S128 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 111: // ['a','o'] + return 13 + case r == 112: // ['p','p'] + return 136 + case 113 <= r && r <= 122: // ['q','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S129 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 111: // ['a','o'] + return 13 + case r == 112: // ['p','p'] + return 137 + case 113 <= r && r <= 122: // ['q','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S130 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 103: // ['a','g'] + return 13 + case r == 104: // ['h','h'] + return 134 + case 105 <= r && r <= 122: // ['i','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S131 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 103: // ['a','g'] + return 13 + case r == 104: // ['h','h'] + return 134 + case 105 <= r && r <= 122: // ['i','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S132 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 111: // ['a','o'] + return 13 + case r == 112: // ['p','p'] + return 138 + case 113 <= r && r <= 122: // ['q','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S133 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 111: // ['a','o'] + return 13 + case r == 112: // ['p','p'] + return 139 + case 113 <= r && r <= 122: // ['q','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S134 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S135 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 71: // ['A','G'] + return 13 + case r == 72: // ['H','H'] + return 140 + case 73 <= r && r <= 90: // ['I','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S136 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 103: // ['a','g'] + return 13 + case r == 104: // ['h','h'] + return 140 + case 105 <= r && r <= 122: // ['i','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S137 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 103: // ['a','g'] + return 13 + case r == 104: // ['h','h'] + return 140 + case 105 <= r && r <= 122: // ['i','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S138 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 103: // ['a','g'] + return 13 + case r == 104: // ['h','h'] + return 140 + case 105 <= r && r <= 122: // ['i','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S139 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 103: // ['a','g'] + return 13 + case r == 104: // ['h','h'] + return 140 + case 105 <= r && r <= 122: // ['i','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, + + // S140 + func(r rune) int { + switch { + case 48 <= r && r <= 57: // ['0','9'] + return 44 + case 65 <= r && r <= 90: // ['A','Z'] + return 13 + case r == 95: // ['_','_'] + return 21 + case 97 <= r && r <= 122: // ['a','z'] + return 13 + case 128 <= r && r <= 65532: // [\u0080,\ufffc] + return 29 + case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] + return 29 + + } + return NoState + }, +} diff --git a/vendor/github.com/awalterschulze/gographviz/internal/parser/action.go b/vendor/github.com/awalterschulze/gographviz/internal/parser/action.go new file mode 100644 index 0000000000..54bc55e962 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/parser/action.go @@ -0,0 +1,51 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "fmt" +) + +type action interface { + act() + String() string +} + +type ( + accept bool + shift int // value is next state index + reduce int // value is production index +) + +func (this accept) act() {} +func (this shift) act() {} +func (this reduce) act() {} + +func (this accept) Equal(that action) bool { + if _, ok := that.(accept); ok { + return true + } + return false +} + +func (this reduce) Equal(that action) bool { + that1, ok := that.(reduce) + if !ok { + return false + } + return this == that1 +} + +func (this shift) Equal(that action) bool { + that1, ok := that.(shift) + if !ok { + return false + } + return this == that1 +} + +func (this accept) String() string { return "accept(0)" } +func (this shift) String() string { return fmt.Sprintf("shift:%d", this) } +func (this reduce) String() string { + return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String) +} diff --git a/vendor/github.com/awalterschulze/gographviz/internal/parser/actiontable.go b/vendor/github.com/awalterschulze/gographviz/internal/parser/actiontable.go new file mode 100644 index 0000000000..2a8629f2f6 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/parser/actiontable.go @@ -0,0 +1,152 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "bytes" + "compress/gzip" + "encoding/gob" +) + +type ( + actionTable [numStates]actionRow + actionRow struct { + canRecover bool + actions [numSymbols]action + } +) + +var actionTab = actionTable{} + +func init() { + tab := []struct { + CanRecover bool + Actions []struct { + Index int + Action int + Amount int + } + }{} + data := []byte{ + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x9c, 0x97, 0x4f, 0x88, 0x5b, 0x55, + 0x1b, 0xc6, 0xcf, 0x7b, 0xe7, 0x7e, 0xd3, 0xf9, 0x66, 0xa6, 0xa5, 0x0c, 0xf3, 0x85, 0x61, 0x18, + 0x86, 0x10, 0xc2, 0x10, 0x42, 0x08, 0x21, 0x0c, 0x21, 0xe4, 0x8b, 0x21, 0x8e, 0x65, 0xd0, 0x21, + 0x84, 0x10, 0x42, 0x08, 0x31, 0x86, 0x9a, 0xa6, 0x21, 0x0d, 0xf1, 0x36, 0x4c, 0xd3, 0xa1, 0xe0, + 0x1f, 0x6a, 0xad, 0xda, 0x95, 0xb8, 0x70, 0xe1, 0xca, 0xa5, 0x0b, 0x17, 0x22, 0xe2, 0x42, 0x5c, + 0x88, 0x0b, 0xe9, 0x42, 0x5c, 0xba, 0x10, 0x17, 0x22, 0x2e, 0x5c, 0x89, 0xb8, 0x10, 0x11, 0x17, + 0xbd, 0x72, 0xcf, 0x2f, 0x3d, 0x99, 0xd4, 0xc9, 0xe4, 0x26, 0x74, 0x71, 0x6e, 0x4e, 0xef, 0xf3, + 0x7b, 0x9e, 0x73, 0xce, 0x7b, 0xce, 0x3d, 0x73, 0xd1, 0x7d, 0xdb, 0x12, 0xcb, 0x7d, 0xa0, 0xc4, + 0xbd, 0xa7, 0x54, 0xc4, 0x7d, 0x7d, 0x49, 0x2c, 0xf7, 0x9e, 0x12, 0x4b, 0x56, 0x9f, 0x79, 0xd1, + 0x29, 0x5f, 0xbf, 0x76, 0xf3, 0xe4, 0xfa, 0xb1, 0x58, 0x4a, 0x2e, 0x3c, 0x7d, 0x6d, 0x78, 0xe3, + 0xa6, 0x73, 0x4b, 0xdc, 0xb7, 0x94, 0x52, 0x4f, 0xb9, 0x6f, 0x5a, 0x22, 0xf1, 0xe7, 0x5f, 0xb8, + 0x35, 0x3c, 0xbe, 0x7d, 0x6d, 0x18, 0x7c, 0x39, 0xf8, 0x9c, 0xd3, 0xbe, 0x7e, 0x27, 0x78, 0xc3, + 0x19, 0xfe, 0x3f, 0xc8, 0x9b, 0xa3, 0xe7, 0x97, 0x6e, 0xde, 0x76, 0x86, 0xde, 0x73, 0xf0, 0x55, + 0x4f, 0x2a, 0xee, 0x7d, 0xa5, 0x62, 0xee, 0x1b, 0x9e, 0xcd, 0x7d, 0x25, 0x4b, 0xf2, 0x1f, 0x2d, + 0x14, 0x5b, 0xc9, 0x32, 0x3a, 0x1e, 0xb5, 0x4c, 0x6c, 0xa5, 0xd4, 0xa3, 0xff, 0x3d, 0x74, 0x1f, + 0x28, 0xf7, 0xae, 0xb5, 0x24, 0xb6, 0xf7, 0x4f, 0xc9, 0xaa, 0xd8, 0xb2, 0xac, 0x64, 0x5d, 0x6c, + 0x59, 0x51, 0xca, 0x12, 0xb1, 0x94, 0xb2, 0x2c, 0x59, 0x16, 0x5b, 0x56, 0x95, 0x84, 0xc5, 0x96, + 0x4b, 0xba, 0xc3, 0x7b, 0xfd, 0x32, 0xef, 0x6d, 0x98, 0x37, 0x36, 0xc7, 0x6f, 0x5c, 0xd0, 0x6f, + 0x6c, 0x29, 0xdd, 0xbf, 0xad, 0x64, 0x45, 0x6c, 0xd9, 0x51, 0xb2, 0x21, 0xb6, 0xc4, 0x95, 0x6c, + 0x8a, 0x2d, 0x09, 0x25, 0xbb, 0x62, 0xcb, 0x3e, 0x9a, 0x94, 0x36, 0xf3, 0x5e, 0x4e, 0x8f, 0x9e, + 0x2c, 0x39, 0x31, 0xe0, 0xcc, 0x69, 0x6b, 0xaf, 0x23, 0x77, 0xbe, 0xd3, 0x81, 0x2f, 0xa7, 0x43, + 0xfd, 0x14, 0x10, 0x5b, 0x8e, 0x94, 0xb2, 0x96, 0x9f, 0xe0, 0xcc, 0x00, 0x58, 0xde, 0x3f, 0xa5, + 0xac, 0x8b, 0x62, 0x8b, 0x25, 0x57, 0x95, 0x4e, 0x7c, 0xd5, 0xb3, 0xd7, 0xcd, 0x25, 0x9a, 0xcb, + 0x62, 0x4b, 0xd1, 0x63, 0xe9, 0x5f, 0x9b, 0x34, 0x01, 0x9a, 0x1d, 0xb1, 0xa5, 0xec, 0x91, 0xf5, + 0xaf, 0x20, 0x4d, 0x88, 0x26, 0xac, 0x9b, 0xb3, 0x07, 0x57, 0x99, 0x91, 0xed, 0x82, 0x4e, 0x14, + 0x22, 0x51, 0x88, 0x44, 0x21, 0x32, 0x84, 0xc8, 0x10, 0xc2, 0x35, 0x84, 0x4f, 0x48, 0x29, 0x6b, + 0x45, 0x6b, 0xf6, 0xd0, 0xec, 0xa1, 0xd9, 0xf3, 0x46, 0x61, 0x4b, 0x0d, 0xe9, 0x1e, 0xd2, 0x3d, + 0xa4, 0x7b, 0x48, 0xf7, 0x8c, 0x34, 0x86, 0x34, 0x86, 0x34, 0xc6, 0x04, 0xc4, 0x90, 0xc6, 0x90, + 0xc6, 0x90, 0xc6, 0x90, 0xc6, 0x8c, 0x34, 0x8e, 0x34, 0x8e, 0x34, 0x8e, 0x34, 0x8e, 0x34, 0x8e, + 0x34, 0x8e, 0x34, 0x8e, 0x34, 0x6e, 0xa4, 0x09, 0xa4, 0x09, 0xa4, 0x09, 0xa4, 0x09, 0xa4, 0x09, + 0xa4, 0x09, 0xa4, 0x09, 0xa4, 0x09, 0xa5, 0xac, 0x55, 0x2d, 0x4d, 0x22, 0x4d, 0x22, 0x4d, 0x22, + 0x4d, 0x22, 0x4d, 0x22, 0x4d, 0x22, 0x4d, 0x7a, 0x8b, 0x63, 0x4b, 0xd3, 0x5b, 0x1c, 0xfb, 0xf1, + 0xe2, 0x24, 0x27, 0x6a, 0x67, 0xfc, 0xb4, 0xa6, 0xe1, 0x0d, 0xe0, 0x0d, 0xe0, 0x0d, 0xe0, 0x0d, + 0xe0, 0x0d, 0xe0, 0x0d, 0x35, 0xd2, 0x68, 0x8f, 0xc6, 0x59, 0x1e, 0x0d, 0x53, 0xee, 0xbd, 0x71, + 0xb9, 0x53, 0x6f, 0x27, 0x6a, 0xb4, 0x43, 0xb4, 0xc1, 0x09, 0x06, 0x27, 0x5e, 0xbd, 0xe9, 0x66, + 0x83, 0x66, 0x93, 0x26, 0x40, 0xb3, 0x43, 0xb3, 0x4b, 0x13, 0xa4, 0x09, 0xd1, 0x84, 0x47, 0xdb, + 0xed, 0xac, 0x7a, 0x73, 0x7c, 0xd4, 0xdb, 0x93, 0x9a, 0x63, 0x5f, 0x1b, 0x70, 0x9a, 0xe3, 0x1d, + 0x5f, 0xea, 0x57, 0xcc, 0x3e, 0xdc, 0x98, 0xc2, 0x79, 0x6d, 0x81, 0xe4, 0xee, 0xdd, 0x19, 0xa2, + 0xff, 0xea, 0x05, 0xd8, 0x67, 0x01, 0xf6, 0x59, 0x80, 0x7d, 0x16, 0x60, 0x9f, 0x99, 0xdf, 0x67, + 0xe6, 0xf7, 0x59, 0x61, 0xef, 0x28, 0xde, 0xe5, 0x67, 0x58, 0x37, 0xde, 0xa2, 0x6e, 0x79, 0xff, + 0xf1, 0x00, 0xa8, 0xfb, 0xce, 0xb4, 0x28, 0xef, 0xce, 0x9c, 0x07, 0xad, 0x7f, 0xcf, 0xd4, 0x5d, + 0x8b, 0x54, 0x2d, 0x52, 0xb5, 0x48, 0xd5, 0x22, 0x55, 0x8b, 0x54, 0x2d, 0xea, 0xa1, 0x45, 0xa8, + 0x16, 0x85, 0xd0, 0xa2, 0x10, 0x5a, 0x44, 0x6c, 0x8d, 0xd1, 0xef, 0x9b, 0x39, 0x5e, 0x35, 0x27, + 0x4b, 0x18, 0x93, 0x30, 0x26, 0x61, 0xe8, 0x61, 0xe8, 0x61, 0xb0, 0x61, 0x40, 0x61, 0xa3, 0x89, + 0xa0, 0x89, 0xa0, 0x89, 0xa0, 0x89, 0xa0, 0x89, 0xa0, 0x89, 0xa0, 0x89, 0x98, 0xc1, 0x94, 0xd0, + 0x94, 0xd0, 0x94, 0x18, 0x4c, 0x09, 0x69, 0x09, 0x69, 0x69, 0x62, 0x13, 0x95, 0xce, 0xda, 0x44, + 0x25, 0xa5, 0xac, 0x25, 0x3d, 0xab, 0xee, 0x07, 0x4c, 0xa0, 0xfb, 0xa1, 0x1a, 0x0f, 0x6e, 0x49, + 0x7b, 0x1c, 0x03, 0x38, 0x46, 0x72, 0x6c, 0xfa, 0x87, 0xf4, 0x0f, 0xe9, 0x1f, 0x9a, 0xd5, 0x4f, + 0x11, 0x2d, 0x45, 0xb4, 0x14, 0xd1, 0x52, 0x44, 0x4b, 0x11, 0x2d, 0x35, 0xb9, 0xfa, 0x29, 0x10, + 0xe3, 0x02, 0x4a, 0x83, 0x48, 0x83, 0x48, 0x83, 0x48, 0x83, 0x48, 0x83, 0x48, 0x4f, 0x22, 0xd2, + 0x20, 0xd2, 0x06, 0xd1, 0x04, 0xd1, 0x04, 0xd1, 0x04, 0xd1, 0x04, 0xd1, 0x04, 0xd1, 0x9c, 0x44, + 0x34, 0x41, 0x34, 0xcd, 0x1c, 0x17, 0x40, 0x14, 0x40, 0x14, 0x40, 0x14, 0x40, 0x14, 0x40, 0x14, + 0x26, 0xe6, 0xb8, 0x70, 0xd6, 0x1c, 0x17, 0xa6, 0x15, 0xf0, 0x47, 0xbe, 0x36, 0xb2, 0xfb, 0xb1, + 0xa9, 0xb2, 0xe5, 0x69, 0xa4, 0x4f, 0x7c, 0x7d, 0x90, 0xed, 0x69, 0xf2, 0x4f, 0x17, 0x39, 0x09, + 0x3e, 0xf3, 0xe5, 0xb9, 0x39, 0x4d, 0xfe, 0xf9, 0x22, 0x9e, 0x5f, 0xf8, 0xf2, 0xdc, 0x36, 0x4f, + 0x81, 0x69, 0xa0, 0x2f, 0x67, 0x80, 0x46, 0x67, 0xd0, 0x57, 0xa7, 0xce, 0x20, 0x5b, 0x5f, 0x57, + 0xdc, 0xaf, 0x95, 0x6c, 0x89, 0x25, 0xcf, 0x2a, 0xd9, 0xa6, 0x09, 0xeb, 0xe6, 0x71, 0xd5, 0x65, + 0x28, 0x99, 0x0c, 0x25, 0x93, 0xa1, 0x64, 0x32, 0x94, 0x4c, 0x86, 0x92, 0xc9, 0x70, 0xc6, 0x64, + 0x28, 0x99, 0x0c, 0x84, 0x8c, 0xde, 0x55, 0xda, 0xf4, 0xa1, 0x87, 0xb6, 0xc5, 0xfd, 0xe6, 0x94, + 0xf9, 0x92, 0x36, 0x3d, 0xc0, 0xf4, 0x00, 0xc9, 0xc1, 0x28, 0x94, 0xfe, 0x44, 0x6d, 0xd1, 0x6c, + 0x4f, 0x7e, 0xb0, 0xf8, 0x98, 0x77, 0xc9, 0xd4, 0x25, 0x53, 0x97, 0x4c, 0x5d, 0x32, 0x75, 0xc9, + 0xd4, 0x25, 0x4c, 0x97, 0x03, 0xaf, 0xcb, 0x81, 0xd7, 0x05, 0xd4, 0x35, 0x17, 0x8a, 0x28, 0xa0, + 0x28, 0xa0, 0x28, 0xa0, 0x28, 0xa0, 0x28, 0xa0, 0x28, 0xa0, 0x28, 0xd2, 0xa8, 0x91, 0x4e, 0xfb, + 0x24, 0x4f, 0x7e, 0x8b, 0x77, 0x27, 0xe3, 0xaf, 0x6b, 0x69, 0x1b, 0x69, 0x1b, 0x69, 0x1b, 0x69, + 0x1b, 0x69, 0x1b, 0x69, 0x9b, 0x29, 0x6d, 0x73, 0x6d, 0x74, 0xbf, 0x85, 0xd4, 0x66, 0x34, 0x6d, + 0x46, 0xd3, 0x86, 0xdb, 0x36, 0x5c, 0x7f, 0x91, 0xe6, 0xb8, 0x1e, 0x50, 0x01, 0x65, 0xb0, 0x65, + 0xb0, 0x65, 0xb0, 0x65, 0xb0, 0x65, 0xb0, 0xe5, 0xc9, 0x73, 0xa7, 0x0c, 0xa2, 0x7c, 0xfe, 0x59, + 0x3c, 0xd7, 0x0d, 0x7c, 0xfd, 0xdc, 0x7b, 0xf7, 0xc2, 0x17, 0x6e, 0x8e, 0xc5, 0x2a, 0xd8, 0x2a, + 0xd8, 0x2a, 0xd8, 0x2a, 0xd8, 0x2a, 0xd8, 0x2a, 0xd8, 0x2a, 0xbc, 0x2a, 0xbc, 0x2a, 0xbc, 0x2a, + 0xbc, 0xaa, 0xe1, 0x55, 0xe0, 0x55, 0xe0, 0x55, 0xe0, 0x55, 0xe0, 0x55, 0xe0, 0x55, 0xe0, 0x55, + 0xe0, 0x55, 0xe0, 0x55, 0xe0, 0x55, 0xe0, 0x55, 0xcc, 0x7d, 0xd0, 0xfd, 0x6e, 0x7c, 0x21, 0x64, + 0x4d, 0x8a, 0x38, 0x14, 0x71, 0x28, 0xe2, 0x30, 0xfa, 0xcb, 0xa3, 0x88, 0x43, 0x71, 0x72, 0x4d, + 0x8a, 0x40, 0x8b, 0x66, 0x13, 0x39, 0x20, 0x1c, 0x10, 0x0e, 0x08, 0x07, 0x84, 0x03, 0xc2, 0x41, + 0xea, 0x90, 0xce, 0x21, 0x9d, 0x03, 0xc8, 0x99, 0x76, 0x12, 0x7d, 0xbf, 0xc8, 0x39, 0xf8, 0x83, + 0xaf, 0x73, 0x70, 0xdd, 0x3c, 0x5d, 0x32, 0x4f, 0x2b, 0xd3, 0x90, 0x3f, 0xfa, 0x42, 0xee, 0x9a, + 0xa7, 0xad, 0x69, 0xa0, 0x9f, 0x7c, 0x81, 0x76, 0xcc, 0xda, 0xe4, 0x98, 0xd8, 0x1c, 0x13, 0x9b, + 0x63, 0x62, 0x73, 0x4c, 0x6c, 0x8e, 0x89, 0xcd, 0xb1, 0xfa, 0x39, 0xe6, 0x37, 0xc7, 0x8c, 0xe6, + 0xc6, 0x27, 0xe6, 0xcf, 0x67, 0x9c, 0x98, 0xa3, 0x2b, 0xda, 0x2f, 0xc6, 0x27, 0x8b, 0x4f, 0x16, + 0x9f, 0x2c, 0x3e, 0x59, 0x7c, 0xb2, 0xf8, 0x64, 0xf1, 0xc9, 0xe2, 0x93, 0xc5, 0x27, 0x6b, 0x8e, + 0xdf, 0x2b, 0x9c, 0xaf, 0x57, 0xe8, 0xbf, 0x32, 0x36, 0x39, 0xe5, 0xf7, 0xab, 0xa9, 0xea, 0x3a, + 0x7e, 0x75, 0xfc, 0xea, 0xf8, 0xd5, 0xf1, 0xab, 0xe3, 0x57, 0xc7, 0xaf, 0x8e, 0x5f, 0x9d, 0xba, + 0xa9, 0x53, 0x37, 0x75, 0x5c, 0xea, 0x86, 0x57, 0x83, 0x57, 0x83, 0x57, 0x83, 0x37, 0xfa, 0xf3, + 0xb3, 0x06, 0xaf, 0x06, 0xaf, 0x06, 0xaf, 0x06, 0xaf, 0x06, 0xaf, 0x06, 0xaf, 0x36, 0x6d, 0xd9, + 0x7e, 0x5b, 0xa4, 0x0e, 0x7f, 0xf7, 0x77, 0x83, 0xf9, 0xc3, 0xec, 0xa2, 0x1e, 0x83, 0xe8, 0x31, + 0x88, 0x1e, 0x83, 0xe8, 0x31, 0x88, 0x1e, 0x83, 0xe8, 0x91, 0xbe, 0x47, 0xfa, 0x1e, 0xe9, 0x7b, + 0xa4, 0xef, 0x19, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, + 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x60, 0xda, 0x88, 0xfe, 0xf4, 0x55, 0xbd, 0x97, 0xcd, 0x53, + 0xd0, 0xd4, 0x57, 0x9e, 0x44, 0x79, 0x12, 0xe5, 0x49, 0x94, 0x27, 0x51, 0x9e, 0x44, 0x79, 0xd6, + 0x27, 0x4f, 0xb0, 0x3c, 0x51, 0xf2, 0xa6, 0xbe, 0x8e, 0xa8, 0xaf, 0x23, 0xfa, 0x8f, 0x4c, 0xff, + 0xbf, 0xbf, 0xeb, 0xf4, 0x1f, 0xd2, 0x7f, 0x48, 0xff, 0xa1, 0xa9, 0x94, 0x0e, 0x49, 0x3a, 0x24, + 0xe9, 0x90, 0xa4, 0x43, 0x92, 0x0e, 0x49, 0x3a, 0x24, 0xe9, 0x90, 0xa4, 0xc3, 0x14, 0x75, 0x98, + 0xa2, 0x0e, 0xbc, 0x8e, 0xe1, 0xcd, 0xf5, 0xa1, 0x3c, 0xf7, 0x0b, 0xb9, 0x36, 0xc7, 0x7d, 0x24, + 0xe0, 0xe3, 0x5a, 0xb2, 0x36, 0xc7, 0xd1, 0x1c, 0x58, 0xf4, 0x84, 0xfe, 0x6b, 0x91, 0x9d, 0xf1, + 0xf7, 0x0c, 0x11, 0x55, 0xdc, 0x27, 0x79, 0x9f, 0xe4, 0x7d, 0x92, 0xf7, 0x49, 0xde, 0x27, 0x79, + 0x9f, 0xc8, 0x7d, 0x22, 0xf7, 0x89, 0xdc, 0x27, 0x72, 0xdf, 0x4c, 0x81, 0xbf, 0x7d, 0x15, 0xf0, + 0xb1, 0xbd, 0xd6, 0xe6, 0xd8, 0x5e, 0x81, 0x45, 0x77, 0xd9, 0xa3, 0x19, 0xb3, 0xb3, 0x36, 0xc7, + 0xec, 0x04, 0x66, 0x4f, 0xd2, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x47, 0x5c, 0x26, 0x6b, + 0x16, 0x00, 0x00, + } + buf, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + panic(err) + } + dec := gob.NewDecoder(buf) + if err := dec.Decode(&tab); err != nil { + panic(err) + } + + for i, row := range tab { + actionTab[i].canRecover = row.CanRecover + for _, a := range row.Actions { + switch a.Action { + case 0: + actionTab[i].actions[a.Index] = accept(true) + case 1: + actionTab[i].actions[a.Index] = reduce(a.Amount) + case 2: + actionTab[i].actions[a.Index] = shift(a.Amount) + } + } + } +} diff --git a/vendor/github.com/awalterschulze/gographviz/internal/parser/gototable.go b/vendor/github.com/awalterschulze/gographviz/internal/parser/gototable.go new file mode 100644 index 0000000000..dc33aacb1f --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/parser/gototable.go @@ -0,0 +1,56 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "bytes" + "compress/gzip" + "encoding/gob" +) + +const numNTSymbols = 17 + +type ( + gotoTable [numStates]gotoRow + gotoRow [numNTSymbols]int +) + +var gotoTab = gotoTable{} + +func init() { + tab := [][]int{} + data := []byte{ + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe2, 0xfd, 0xdf, 0xcd, 0xc4, 0xc8, + 0xf4, 0xbf, 0x87, 0x81, 0xf1, 0x7f, 0x17, 0x03, 0x03, 0xcf, 0xff, 0x4e, 0x10, 0xaf, 0x8b, 0x81, + 0x91, 0x85, 0x81, 0xe1, 0x1f, 0xa7, 0xc6, 0xff, 0x1e, 0x86, 0xff, 0x0d, 0x82, 0x8c, 0x4c, 0x8c, + 0xa8, 0x40, 0x90, 0x11, 0x1d, 0x60, 0x88, 0xf0, 0x10, 0xa1, 0x46, 0x4c, 0x90, 0x91, 0x51, 0x41, + 0x49, 0x45, 0x8b, 0x91, 0x91, 0x51, 0x83, 0x51, 0xcd, 0x88, 0x51, 0x87, 0x51, 0x8e, 0x08, 0x5d, + 0x98, 0x22, 0x36, 0x18, 0x22, 0x0e, 0x82, 0x8c, 0x8c, 0x2e, 0x44, 0x9a, 0xec, 0x81, 0x22, 0xe2, + 0x43, 0x9a, 0x7b, 0x02, 0xa0, 0x22, 0x61, 0x94, 0xfb, 0x82, 0x54, 0x91, 0x28, 0x10, 0x11, 0x03, + 0x13, 0x49, 0xc2, 0x50, 0x93, 0x82, 0x21, 0x92, 0xc6, 0xc8, 0xc8, 0x98, 0x81, 0xa2, 0x0b, 0x01, + 0x72, 0xb0, 0xda, 0x55, 0x80, 0x11, 0x1a, 0x25, 0x44, 0x84, 0x4f, 0x15, 0x79, 0x71, 0x8a, 0x11, + 0x86, 0xff, 0x9b, 0x88, 0x35, 0xe8, 0x7f, 0xd7, 0xff, 0x1e, 0x18, 0xb3, 0x8d, 0x88, 0xf8, 0xf8, + 0x3f, 0x89, 0x08, 0x47, 0xfd, 0x9f, 0x46, 0x51, 0x1c, 0xfd, 0x9f, 0x05, 0x37, 0x68, 0x0e, 0xaa, + 0xaa, 0xff, 0x4b, 0x18, 0xff, 0x2f, 0x62, 0xfc, 0xbf, 0x80, 0xe6, 0xc9, 0xe4, 0xff, 0x0a, 0x54, + 0x27, 0xfc, 0x5f, 0x43, 0xa5, 0x98, 0x21, 0x46, 0xcd, 0xff, 0x6d, 0xc4, 0x58, 0x86, 0xa9, 0x6d, + 0x0f, 0x35, 0xdd, 0xf8, 0xff, 0x10, 0x5a, 0xc2, 0x20, 0x32, 0xe4, 0x18, 0x19, 0xff, 0x9f, 0x20, + 0x4f, 0x1f, 0xbd, 0x45, 0xfe, 0x5f, 0x60, 0xfc, 0x7f, 0x0e, 0x92, 0x98, 0xfe, 0x5f, 0xc2, 0x17, + 0x74, 0x01, 0xe4, 0xda, 0xf7, 0xff, 0x1a, 0xf9, 0x39, 0xf8, 0x0e, 0x15, 0x8a, 0x77, 0x0a, 0x0a, + 0x58, 0x0a, 0x8a, 0x65, 0x7c, 0xf1, 0xff, 0xff, 0x09, 0x69, 0x46, 0xbd, 0xc0, 0x63, 0xd4, 0x2b, + 0xf2, 0x03, 0xf7, 0xd3, 0xc0, 0x06, 0xee, 0x60, 0x13, 0xc1, 0x0c, 0xa0, 0x3f, 0xf4, 0x0a, 0x20, + 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xfa, 0xd1, 0x1a, 0x46, 0x09, 0x00, 0x00, + } + buf, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + panic(err) + } + dec := gob.NewDecoder(buf) + if err := dec.Decode(&tab); err != nil { + panic(err) + } + for i := 0; i < numStates; i++ { + for j := 0; j < numNTSymbols; j++ { + gotoTab[i][j] = tab[i][j] + } + } +} diff --git a/vendor/github.com/awalterschulze/gographviz/internal/parser/main.go b/vendor/github.com/awalterschulze/gographviz/internal/parser/main.go new file mode 100644 index 0000000000..0253f930bc --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/parser/main.go @@ -0,0 +1,72 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +//A parser for the DOT grammar. +package parser + +import ( + "fmt" + "io" + "io/ioutil" + "os" + + "github.com/awalterschulze/gographviz/ast" + "github.com/awalterschulze/gographviz/internal/lexer" +) + +//Parses a DOT string and outputs the +//abstract syntax tree representing the graph. +func ParseString(dotString string) (*ast.Graph, error) { + return ParseBytes([]byte(dotString)) +} + +//Parses the bytes representing a DOT string +//and outputs the abstract syntax tree representing the graph. +func ParseBytes(dotBytes []byte) (*ast.Graph, error) { + lex := lexer.NewLexer(dotBytes) + parser := NewParser() + st, err := parser.Parse(lex) + if err != nil { + return nil, err + } + g, ok := st.(*ast.Graph) + if !ok { + panic(fmt.Sprintf("Parser did not return an *ast.Graph, but rather a %T", st)) + } + return g, nil +} + +//Parses a reader which contains a DOT string +//and outputs the abstract syntax tree representing the graph. +func Parse(r io.Reader) (*ast.Graph, error) { + bytes, err := ioutil.ReadAll(r) + if err != nil { + return nil, err + } + return ParseBytes(bytes) +} + +//Parses a file which contains a DOT string +//and outputs the abstract syntax tree representing the graph. +func ParseFile(filename string) (*ast.Graph, error) { + f, err := os.Open(filename) + if err != nil { + return nil, err + } + g, err := Parse(f) + if err := f.Close(); err != nil { + return nil, err + } + return g, err +} diff --git a/vendor/github.com/awalterschulze/gographviz/internal/parser/parser.go b/vendor/github.com/awalterschulze/gographviz/internal/parser/parser.go new file mode 100644 index 0000000000..fad5f40246 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/parser/parser.go @@ -0,0 +1,212 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import ( + "bytes" + "fmt" + + parseError "github.com/awalterschulze/gographviz/internal/errors" + "github.com/awalterschulze/gographviz/internal/token" +) + +const ( + numProductions = 60 + numStates = 128 + numSymbols = 36 +) + +// Stack + +type stack struct { + state []int + attrib []Attrib +} + +const iNITIAL_STACK_SIZE = 100 + +func newStack() *stack { + return &stack{state: make([]int, 0, iNITIAL_STACK_SIZE), + attrib: make([]Attrib, 0, iNITIAL_STACK_SIZE), + } +} + +func (this *stack) reset() { + this.state = this.state[0:0] + this.attrib = this.attrib[0:0] +} + +func (this *stack) push(s int, a Attrib) { + this.state = append(this.state, s) + this.attrib = append(this.attrib, a) +} + +func (this *stack) top() int { + return this.state[len(this.state)-1] +} + +func (this *stack) peek(pos int) int { + return this.state[pos] +} + +func (this *stack) topIndex() int { + return len(this.state) - 1 +} + +func (this *stack) popN(items int) []Attrib { + lo, hi := len(this.state)-items, len(this.state) + + attrib := this.attrib[lo:hi] + + this.state = this.state[:lo] + this.attrib = this.attrib[:lo] + + return attrib +} + +func (S *stack) String() string { + w := new(bytes.Buffer) + fmt.Fprintf(w, "stack:\n") + for i, st := range S.state { + fmt.Fprintf(w, "\t%d:%d , ", i, st) + if S.attrib[i] == nil { + fmt.Fprintf(w, "nil") + } else { + fmt.Fprintf(w, "%v", S.attrib[i]) + } + fmt.Fprintf(w, "\n") + } + return w.String() +} + +// Parser + +type Parser struct { + stack *stack + nextToken *token.Token + pos int +} + +type Scanner interface { + Scan() (tok *token.Token) +} + +func NewParser() *Parser { + p := &Parser{stack: newStack()} + p.Reset() + return p +} + +func (P *Parser) Reset() { + P.stack.reset() + P.stack.push(0, nil) +} + +func (P *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { + errorAttrib = &parseError.Error{ + Err: err, + ErrorToken: P.nextToken, + ErrorSymbols: P.popNonRecoveryStates(), + ExpectedTokens: make([]string, 0, 8), + } + for t, action := range actionTab[P.stack.top()].actions { + if action != nil { + errorAttrib.ExpectedTokens = append(errorAttrib.ExpectedTokens, token.TokMap.Id(token.Type(t))) + } + } + + if action := actionTab[P.stack.top()].actions[token.TokMap.Type("error")]; action != nil { + P.stack.push(int(action.(shift)), errorAttrib) // action can only be shift + } else { + return + } + + if action := actionTab[P.stack.top()].actions[P.nextToken.Type]; action != nil { + recovered = true + } + for !recovered && P.nextToken.Type != token.EOF { + P.nextToken = scanner.Scan() + if action := actionTab[P.stack.top()].actions[P.nextToken.Type]; action != nil { + recovered = true + } + } + + return +} + +func (P *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := P.firstRecoveryState(); ok { + errorSymbols := P.stack.popN(int(P.stack.topIndex() - rs)) + removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) + for i, e := range errorSymbols { + removedAttribs[i] = e + } + } else { + removedAttribs = []parseError.ErrorSymbol{} + } + return +} + +// recoveryState points to the highest state on the stack, which can recover +func (P *Parser) firstRecoveryState() (recoveryState int, canRecover bool) { + recoveryState, canRecover = P.stack.topIndex(), actionTab[P.stack.top()].canRecover + for recoveryState > 0 && !canRecover { + recoveryState-- + canRecover = actionTab[P.stack.peek(recoveryState)].canRecover + } + return +} + +func (P *Parser) newError(err error) error { + e := &parseError.Error{ + Err: err, + StackTop: P.stack.top(), + ErrorToken: P.nextToken, + } + actRow := actionTab[P.stack.top()] + for i, t := range actRow.actions { + if t != nil { + e.ExpectedTokens = append(e.ExpectedTokens, token.TokMap.Id(token.Type(i))) + } + } + return e +} + +func (this *Parser) Parse(scanner Scanner) (res interface{}, err error) { + this.Reset() + this.nextToken = scanner.Scan() + for acc := false; !acc; { + action := actionTab[this.stack.top()].actions[this.nextToken.Type] + if action == nil { + if recovered, errAttrib := this.Error(nil, scanner); !recovered { + this.nextToken = errAttrib.ErrorToken + return nil, this.newError(nil) + } + if action = actionTab[this.stack.top()].actions[this.nextToken.Type]; action == nil { + panic("Error recovery led to invalid action") + } + } + + // fmt.Printf("S%d %s %s\n", this.stack.top(), token.TokMap.TokenString(this.nextToken), action.String()) + + switch act := action.(type) { + case accept: + res = this.stack.popN(1)[0] + acc = true + case shift: + this.stack.push(int(act), this.nextToken) + this.nextToken = scanner.Scan() + case reduce: + prod := productionsTable[int(act)] + attrib, err := prod.ReduceFunc(this.stack.popN(prod.NumSymbols)) + if err != nil { + return nil, this.newError(err) + } else { + this.stack.push(gotoTab[this.stack.top()][prod.NTType], attrib) + } + default: + panic("unknown action: " + action.String()) + } + } + return res, nil +} diff --git a/vendor/github.com/awalterschulze/gographviz/internal/parser/productionstable.go b/vendor/github.com/awalterschulze/gographviz/internal/parser/productionstable.go new file mode 100644 index 0000000000..3262aefd3b --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/parser/productionstable.go @@ -0,0 +1,623 @@ +// Code generated by gocc; DO NOT EDIT. + +package parser + +import "github.com/awalterschulze/gographviz/ast" + +type ( + //TODO: change type and variable names to be consistent with other tables + ProdTab [numProductions]ProdTabEntry + ProdTabEntry struct { + String string + Id string + NTType int + Index int + NumSymbols int + ReduceFunc func([]Attrib) (Attrib, error) + } + Attrib interface { + } +) + +var productionsTable = ProdTab{ + ProdTabEntry{ + String: `S' : DotGraph << >>`, + Id: "S'", + NTType: 0, + Index: 0, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `DotGraph : graphx "{" "}" << ast.NewGraph(ast.GRAPH, ast.FALSE, nil, nil) >>`, + Id: "DotGraph", + NTType: 1, + Index: 1, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.GRAPH, ast.FALSE, nil, nil) + }, + }, + ProdTabEntry{ + String: `DotGraph : strict graphx "{" "}" << ast.NewGraph(ast.GRAPH, ast.TRUE, nil, nil) >>`, + Id: "DotGraph", + NTType: 1, + Index: 2, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.GRAPH, ast.TRUE, nil, nil) + }, + }, + ProdTabEntry{ + String: `DotGraph : graphx Id "{" "}" << ast.NewGraph(ast.GRAPH, ast.FALSE, X[1], nil) >>`, + Id: "DotGraph", + NTType: 1, + Index: 3, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.GRAPH, ast.FALSE, X[1], nil) + }, + }, + ProdTabEntry{ + String: `DotGraph : strict graphx Id "{" "}" << ast.NewGraph(ast.GRAPH, ast.TRUE, X[2], nil) >>`, + Id: "DotGraph", + NTType: 1, + Index: 4, + NumSymbols: 5, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.GRAPH, ast.TRUE, X[2], nil) + }, + }, + ProdTabEntry{ + String: `DotGraph : graphx "{" StmtList "}" << ast.NewGraph(ast.GRAPH, ast.FALSE, nil, X[2]) >>`, + Id: "DotGraph", + NTType: 1, + Index: 5, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.GRAPH, ast.FALSE, nil, X[2]) + }, + }, + ProdTabEntry{ + String: `DotGraph : graphx Id "{" StmtList "}" << ast.NewGraph(ast.GRAPH, ast.FALSE, X[1], X[3]) >>`, + Id: "DotGraph", + NTType: 1, + Index: 6, + NumSymbols: 5, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.GRAPH, ast.FALSE, X[1], X[3]) + }, + }, + ProdTabEntry{ + String: `DotGraph : strict graphx "{" StmtList "}" << ast.NewGraph(ast.GRAPH, ast.TRUE, nil, X[3]) >>`, + Id: "DotGraph", + NTType: 1, + Index: 7, + NumSymbols: 5, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.GRAPH, ast.TRUE, nil, X[3]) + }, + }, + ProdTabEntry{ + String: `DotGraph : strict graphx Id "{" StmtList "}" << ast.NewGraph(ast.GRAPH, ast.TRUE, X[2], X[4]) >>`, + Id: "DotGraph", + NTType: 1, + Index: 8, + NumSymbols: 6, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.GRAPH, ast.TRUE, X[2], X[4]) + }, + }, + ProdTabEntry{ + String: `DotGraph : digraph "{" "}" << ast.NewGraph(ast.DIGRAPH, ast.FALSE, nil, nil) >>`, + Id: "DotGraph", + NTType: 1, + Index: 9, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.DIGRAPH, ast.FALSE, nil, nil) + }, + }, + ProdTabEntry{ + String: `DotGraph : strict digraph "{" "}" << ast.NewGraph(ast.DIGRAPH, ast.TRUE, nil, nil) >>`, + Id: "DotGraph", + NTType: 1, + Index: 10, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.DIGRAPH, ast.TRUE, nil, nil) + }, + }, + ProdTabEntry{ + String: `DotGraph : digraph Id "{" "}" << ast.NewGraph(ast.DIGRAPH, ast.FALSE, X[1], nil) >>`, + Id: "DotGraph", + NTType: 1, + Index: 11, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.DIGRAPH, ast.FALSE, X[1], nil) + }, + }, + ProdTabEntry{ + String: `DotGraph : strict digraph Id "{" "}" << ast.NewGraph(ast.DIGRAPH, ast.TRUE, X[2], nil) >>`, + Id: "DotGraph", + NTType: 1, + Index: 12, + NumSymbols: 5, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.DIGRAPH, ast.TRUE, X[2], nil) + }, + }, + ProdTabEntry{ + String: `DotGraph : digraph "{" StmtList "}" << ast.NewGraph(ast.DIGRAPH, ast.FALSE, nil, X[2]) >>`, + Id: "DotGraph", + NTType: 1, + Index: 13, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.DIGRAPH, ast.FALSE, nil, X[2]) + }, + }, + ProdTabEntry{ + String: `DotGraph : digraph Id "{" StmtList "}" << ast.NewGraph(ast.DIGRAPH, ast.FALSE, X[1], X[3]) >>`, + Id: "DotGraph", + NTType: 1, + Index: 14, + NumSymbols: 5, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.DIGRAPH, ast.FALSE, X[1], X[3]) + }, + }, + ProdTabEntry{ + String: `DotGraph : strict digraph "{" StmtList "}" << ast.NewGraph(ast.DIGRAPH, ast.TRUE, nil, X[3]) >>`, + Id: "DotGraph", + NTType: 1, + Index: 15, + NumSymbols: 5, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.DIGRAPH, ast.TRUE, nil, X[3]) + }, + }, + ProdTabEntry{ + String: `DotGraph : strict digraph Id "{" StmtList "}" << ast.NewGraph(ast.DIGRAPH, ast.TRUE, X[2], X[4]) >>`, + Id: "DotGraph", + NTType: 1, + Index: 16, + NumSymbols: 6, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraph(ast.DIGRAPH, ast.TRUE, X[2], X[4]) + }, + }, + ProdTabEntry{ + String: `StmtList : Stmt1 << ast.NewStmtList(X[0]) >>`, + Id: "StmtList", + NTType: 2, + Index: 17, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewStmtList(X[0]) + }, + }, + ProdTabEntry{ + String: `StmtList : StmtList Stmt1 << ast.AppendStmtList(X[0], X[1]) >>`, + Id: "StmtList", + NTType: 2, + Index: 18, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendStmtList(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `Stmt1 : Stmt << X[0], nil >>`, + Id: "Stmt1", + NTType: 3, + Index: 19, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Stmt1 : Stmt ";" << X[0], nil >>`, + Id: "Stmt1", + NTType: 3, + Index: 20, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Stmt : Id "=" Id << ast.NewAttr(X[0], X[2]) >>`, + Id: "Stmt", + NTType: 4, + Index: 21, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewAttr(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `Stmt : NodeStmt << X[0], nil >>`, + Id: "Stmt", + NTType: 4, + Index: 22, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Stmt : EdgeStmt << X[0], nil >>`, + Id: "Stmt", + NTType: 4, + Index: 23, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Stmt : AttrStmt << X[0], nil >>`, + Id: "Stmt", + NTType: 4, + Index: 24, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `Stmt : SubGraphStmt << X[0], nil >>`, + Id: "Stmt", + NTType: 4, + Index: 25, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return X[0], nil + }, + }, + ProdTabEntry{ + String: `AttrStmt : graphx AttrList << ast.NewGraphAttrs(X[1]) >>`, + Id: "AttrStmt", + NTType: 5, + Index: 26, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewGraphAttrs(X[1]) + }, + }, + ProdTabEntry{ + String: `AttrStmt : node AttrList << ast.NewNodeAttrs(X[1]) >>`, + Id: "AttrStmt", + NTType: 5, + Index: 27, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewNodeAttrs(X[1]) + }, + }, + ProdTabEntry{ + String: `AttrStmt : edge AttrList << ast.NewEdgeAttrs(X[1]) >>`, + Id: "AttrStmt", + NTType: 5, + Index: 28, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewEdgeAttrs(X[1]) + }, + }, + ProdTabEntry{ + String: `AttrList : "[" "]" << ast.NewAttrList(nil) >>`, + Id: "AttrList", + NTType: 6, + Index: 29, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewAttrList(nil) + }, + }, + ProdTabEntry{ + String: `AttrList : "[" AList "]" << ast.NewAttrList(X[1]) >>`, + Id: "AttrList", + NTType: 6, + Index: 30, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewAttrList(X[1]) + }, + }, + ProdTabEntry{ + String: `AttrList : AttrList "[" "]" << ast.AppendAttrList(X[0], nil) >>`, + Id: "AttrList", + NTType: 6, + Index: 31, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendAttrList(X[0], nil) + }, + }, + ProdTabEntry{ + String: `AttrList : AttrList "[" AList "]" << ast.AppendAttrList(X[0], X[2]) >>`, + Id: "AttrList", + NTType: 6, + Index: 32, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendAttrList(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `AList : Attr << ast.NewAList(X[0]) >>`, + Id: "AList", + NTType: 7, + Index: 33, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewAList(X[0]) + }, + }, + ProdTabEntry{ + String: `AList : AList Attr << ast.AppendAList(X[0], X[1]) >>`, + Id: "AList", + NTType: 7, + Index: 34, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendAList(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `AList : AList "," Attr << ast.AppendAList(X[0], X[2]) >>`, + Id: "AList", + NTType: 7, + Index: 35, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendAList(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `Attr : Id << ast.NewAttr(X[0], nil) >>`, + Id: "Attr", + NTType: 8, + Index: 36, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewAttr(X[0], nil) + }, + }, + ProdTabEntry{ + String: `Attr : Id "=" Id << ast.NewAttr(X[0], X[2]) >>`, + Id: "Attr", + NTType: 8, + Index: 37, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewAttr(X[0], X[2]) + }, + }, + ProdTabEntry{ + String: `EdgeStmt : NodeId EdgeRHS << ast.NewEdgeStmt(X[0], X[1], nil) >>`, + Id: "EdgeStmt", + NTType: 9, + Index: 38, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewEdgeStmt(X[0], X[1], nil) + }, + }, + ProdTabEntry{ + String: `EdgeStmt : NodeId EdgeRHS AttrList << ast.NewEdgeStmt(X[0], X[1], X[2]) >>`, + Id: "EdgeStmt", + NTType: 9, + Index: 39, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewEdgeStmt(X[0], X[1], X[2]) + }, + }, + ProdTabEntry{ + String: `EdgeStmt : SubGraphStmt EdgeRHS << ast.NewEdgeStmt(X[0], X[1], nil) >>`, + Id: "EdgeStmt", + NTType: 9, + Index: 40, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewEdgeStmt(X[0], X[1], nil) + }, + }, + ProdTabEntry{ + String: `EdgeStmt : SubGraphStmt EdgeRHS AttrList << ast.NewEdgeStmt(X[0], X[1], X[2]) >>`, + Id: "EdgeStmt", + NTType: 9, + Index: 41, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewEdgeStmt(X[0], X[1], X[2]) + }, + }, + ProdTabEntry{ + String: `EdgeRHS : EdgeOp NodeId << ast.NewEdgeRHS(X[0], X[1]) >>`, + Id: "EdgeRHS", + NTType: 10, + Index: 42, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewEdgeRHS(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `EdgeRHS : EdgeOp SubGraphStmt << ast.NewEdgeRHS(X[0], X[1]) >>`, + Id: "EdgeRHS", + NTType: 10, + Index: 43, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewEdgeRHS(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `EdgeRHS : EdgeRHS EdgeOp NodeId << ast.AppendEdgeRHS(X[0], X[1], X[2]) >>`, + Id: "EdgeRHS", + NTType: 10, + Index: 44, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendEdgeRHS(X[0], X[1], X[2]) + }, + }, + ProdTabEntry{ + String: `EdgeRHS : EdgeRHS EdgeOp SubGraphStmt << ast.AppendEdgeRHS(X[0], X[1], X[2]) >>`, + Id: "EdgeRHS", + NTType: 10, + Index: 45, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.AppendEdgeRHS(X[0], X[1], X[2]) + }, + }, + ProdTabEntry{ + String: `NodeStmt : NodeId << ast.NewNodeStmt(X[0], nil) >>`, + Id: "NodeStmt", + NTType: 11, + Index: 46, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewNodeStmt(X[0], nil) + }, + }, + ProdTabEntry{ + String: `NodeStmt : NodeId AttrList << ast.NewNodeStmt(X[0], X[1]) >>`, + Id: "NodeStmt", + NTType: 11, + Index: 47, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewNodeStmt(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `NodeId : Id << ast.NewNodeID(X[0], nil) >>`, + Id: "NodeId", + NTType: 12, + Index: 48, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewNodeID(X[0], nil) + }, + }, + ProdTabEntry{ + String: `NodeId : Id Port << ast.NewNodeID(X[0], X[1]) >>`, + Id: "NodeId", + NTType: 12, + Index: 49, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewNodeID(X[0], X[1]) + }, + }, + ProdTabEntry{ + String: `Port : ":" Id << ast.NewPort(X[1], nil), nil >>`, + Id: "Port", + NTType: 13, + Index: 50, + NumSymbols: 2, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewPort(X[1], nil), nil + }, + }, + ProdTabEntry{ + String: `Port : ":" Id ":" Id << ast.NewPort(X[1], X[3]), nil >>`, + Id: "Port", + NTType: 13, + Index: 51, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewPort(X[1], X[3]), nil + }, + }, + ProdTabEntry{ + String: `SubGraphStmt : "{" StmtList "}" << ast.NewSubGraph(nil, X[1]) >>`, + Id: "SubGraphStmt", + NTType: 14, + Index: 52, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSubGraph(nil, X[1]) + }, + }, + ProdTabEntry{ + String: `SubGraphStmt : subgraph "{" StmtList "}" << ast.NewSubGraph(nil, X[2]) >>`, + Id: "SubGraphStmt", + NTType: 14, + Index: 53, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSubGraph(nil, X[2]) + }, + }, + ProdTabEntry{ + String: `SubGraphStmt : subgraph Id "{" StmtList "}" << ast.NewSubGraph(X[1], X[3]) >>`, + Id: "SubGraphStmt", + NTType: 14, + Index: 54, + NumSymbols: 5, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSubGraph(X[1], X[3]) + }, + }, + ProdTabEntry{ + String: `SubGraphStmt : subgraph "{" "}" << ast.NewSubGraph(nil, nil) >>`, + Id: "SubGraphStmt", + NTType: 14, + Index: 55, + NumSymbols: 3, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSubGraph(nil, nil) + }, + }, + ProdTabEntry{ + String: `SubGraphStmt : subgraph Id "{" "}" << ast.NewSubGraph(X[1], nil) >>`, + Id: "SubGraphStmt", + NTType: 14, + Index: 56, + NumSymbols: 4, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewSubGraph(X[1], nil) + }, + }, + ProdTabEntry{ + String: `EdgeOp : "->" << ast.DIRECTED, nil >>`, + Id: "EdgeOp", + NTType: 15, + Index: 57, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.DIRECTED, nil + }, + }, + ProdTabEntry{ + String: `EdgeOp : "--" << ast.UNDIRECTED, nil >>`, + Id: "EdgeOp", + NTType: 15, + Index: 58, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.UNDIRECTED, nil + }, + }, + ProdTabEntry{ + String: `Id : id << ast.NewID(X[0]) >>`, + Id: "Id", + NTType: 16, + Index: 59, + NumSymbols: 1, + ReduceFunc: func(X []Attrib) (Attrib, error) { + return ast.NewID(X[0]) + }, + }, +} diff --git a/vendor/github.com/awalterschulze/gographviz/internal/token/token.go b/vendor/github.com/awalterschulze/gographviz/internal/token/token.go new file mode 100644 index 0000000000..b1220168cb --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/internal/token/token.go @@ -0,0 +1,104 @@ +// Code generated by gocc; DO NOT EDIT. + +package token + +import ( + "fmt" +) + +type Token struct { + Type + Lit []byte + Pos +} + +type Type int + +const ( + INVALID Type = iota + EOF +) + +type Pos struct { + Offset int + Line int + Column int +} + +func (this Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", this.Offset, this.Line, this.Column) +} + +type TokenMap struct { + typeMap []string + idMap map[string]Type +} + +func (this TokenMap) Id(tok Type) string { + if int(tok) < len(this.typeMap) { + return this.typeMap[tok] + } + return "unknown" +} + +func (this TokenMap) Type(tok string) Type { + if typ, exist := this.idMap[tok]; exist { + return typ + } + return INVALID +} + +func (this TokenMap) TokenString(tok *Token) string { + //TODO: refactor to print pos & token string properly + return fmt.Sprintf("%s(%d,%s)", this.Id(tok.Type), tok.Type, tok.Lit) +} + +func (this TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", this.Id(typ), typ) +} + +var TokMap = TokenMap{ + typeMap: []string{ + "INVALID", + "$", + "graphx", + "{", + "}", + "strict", + "digraph", + ";", + "=", + "node", + "edge", + "[", + "]", + ",", + ":", + "subgraph", + "->", + "--", + "id", + }, + + idMap: map[string]Type{ + "INVALID": 0, + "$": 1, + "graphx": 2, + "{": 3, + "}": 4, + "strict": 5, + "digraph": 6, + ";": 7, + "=": 8, + "node": 9, + "edge": 10, + "[": 11, + "]": 12, + ",": 13, + ":": 14, + "subgraph": 15, + "->": 16, + "--": 17, + "id": 18, + }, +} diff --git a/vendor/github.com/awalterschulze/gographviz/nodes.go b/vendor/github.com/awalterschulze/gographviz/nodes.go new file mode 100644 index 0000000000..6f0011a359 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/nodes.go @@ -0,0 +1,61 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import ( + "sort" +) + +// Node represents a Node. +type Node struct { + Name string + Attrs Attrs +} + +// Nodes represents a set of Nodes. +type Nodes struct { + Lookup map[string]*Node + Nodes []*Node +} + +// NewNodes creates a new set of Nodes. +func NewNodes() *Nodes { + return &Nodes{make(map[string]*Node), make([]*Node, 0)} +} + +// Add adds a Node to the set of Nodes, ammending the attributes of an already existing node. +func (nodes *Nodes) Add(node *Node) { + n, ok := nodes.Lookup[node.Name] + if ok { + n.Attrs.Ammend(node.Attrs) + return + } + nodes.Lookup[node.Name] = node + nodes.Nodes = append(nodes.Nodes, node) +} + +// Sorted returns a sorted list of nodes. +func (nodes Nodes) Sorted() []*Node { + keys := make([]string, 0, len(nodes.Lookup)) + for key := range nodes.Lookup { + keys = append(keys, key) + } + sort.Strings(keys) + nodeList := make([]*Node, len(keys)) + for i := range keys { + nodeList[i] = nodes.Lookup[keys[i]] + } + return nodeList +} diff --git a/vendor/github.com/awalterschulze/gographviz/relations.go b/vendor/github.com/awalterschulze/gographviz/relations.go new file mode 100644 index 0000000000..95f1a720b3 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/relations.go @@ -0,0 +1,53 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import ( + "sort" +) + +// Relations represents the relations between graphs and nodes. +// Each node belongs the main graph or a subgraph. +type Relations struct { + ParentToChildren map[string]map[string]bool + ChildToParents map[string]map[string]bool +} + +// NewRelations creates an empty set of relations. +func NewRelations() *Relations { + return &Relations{make(map[string]map[string]bool), make(map[string]map[string]bool)} +} + +// Add adds a node to a parent graph. +func (relations *Relations) Add(parent string, child string) { + if _, ok := relations.ParentToChildren[parent]; !ok { + relations.ParentToChildren[parent] = make(map[string]bool) + } + relations.ParentToChildren[parent][child] = true + if _, ok := relations.ChildToParents[child]; !ok { + relations.ChildToParents[child] = make(map[string]bool) + } + relations.ChildToParents[child][parent] = true +} + +// SortedChildren returns a list of sorted children of the given parent graph. +func (relations *Relations) SortedChildren(parent string) []string { + keys := make([]string, 0) + for key := range relations.ParentToChildren[parent] { + keys = append(keys, key) + } + sort.Strings(keys) + return keys +} diff --git a/vendor/github.com/awalterschulze/gographviz/subgraphs.go b/vendor/github.com/awalterschulze/gographviz/subgraphs.go new file mode 100644 index 0000000000..2cc78fb3db --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/subgraphs.go @@ -0,0 +1,64 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import ( + "sort" +) + +// SubGraph represents a Subgraph. +type SubGraph struct { + Attrs Attrs + Name string +} + +// NewSubGraph creates a new Subgraph. +func NewSubGraph(name string) *SubGraph { + return &SubGraph{ + Attrs: make(Attrs), + Name: name, + } +} + +// SubGraphs represents a set of SubGraphs. +type SubGraphs struct { + SubGraphs map[string]*SubGraph +} + +// NewSubGraphs creates a new blank set of SubGraphs. +func NewSubGraphs() *SubGraphs { + return &SubGraphs{make(map[string]*SubGraph)} +} + +// Add adds and creates a new Subgraph to the set of SubGraphs. +func (subgraphs *SubGraphs) Add(name string) { + if _, ok := subgraphs.SubGraphs[name]; !ok { + subgraphs.SubGraphs[name] = NewSubGraph(name) + } +} + +// Sorted returns a sorted list of SubGraphs. +func (subgraphs *SubGraphs) Sorted() []*SubGraph { + keys := make([]string, 0) + for key := range subgraphs.SubGraphs { + keys = append(keys, key) + } + sort.Strings(keys) + s := make([]*SubGraph, len(keys)) + for i, key := range keys { + s[i] = subgraphs.SubGraphs[key] + } + return s +} diff --git a/vendor/github.com/awalterschulze/gographviz/write.go b/vendor/github.com/awalterschulze/gographviz/write.go new file mode 100644 index 0000000000..2c18a5b8f4 --- /dev/null +++ b/vendor/github.com/awalterschulze/gographviz/write.go @@ -0,0 +1,172 @@ +//Copyright 2013 GoGraphviz Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +package gographviz + +import ( + "fmt" + + "github.com/awalterschulze/gographviz/ast" +) + +type writer struct { + *Graph + writtenLocations map[string]bool +} + +func newWriter(g *Graph) *writer { + return &writer{g, make(map[string]bool)} +} + +func appendAttrs(list ast.StmtList, attrs Attrs) ast.StmtList { + for _, name := range attrs.sortedNames() { + stmt := &ast.Attr{ + Field: ast.ID(name), + Value: ast.ID(attrs[name]), + } + list = append(list, stmt) + } + return list +} + +func (w *writer) newSubGraph(name string) (*ast.SubGraph, error) { + sub := w.SubGraphs.SubGraphs[name] + w.writtenLocations[sub.Name] = true + s := &ast.SubGraph{} + s.ID = ast.ID(sub.Name) + s.StmtList = appendAttrs(s.StmtList, sub.Attrs) + children := w.Relations.SortedChildren(name) + for _, child := range children { + if w.IsNode(child) { + s.StmtList = append(s.StmtList, w.newNodeStmt(child)) + } else if w.IsSubGraph(child) { + subgraph, err := w.newSubGraph(child) + if err != nil { + return nil, err + } + s.StmtList = append(s.StmtList, subgraph) + } else { + return nil, fmt.Errorf("%v is not a node or a subgraph", child) + } + } + return s, nil +} + +func (w *writer) newNodeID(name string, port string) *ast.NodeID { + node := w.Nodes.Lookup[name] + return ast.MakeNodeID(node.Name, port) +} + +func (w *writer) newNodeStmt(name string) *ast.NodeStmt { + node := w.Nodes.Lookup[name] + id := ast.MakeNodeID(node.Name, "") + w.writtenLocations[node.Name] = true + return &ast.NodeStmt{ + NodeID: id, + Attrs: ast.PutMap(node.Attrs.toMap()), + } +} + +func (w *writer) newLocation(name string, port string) (ast.Location, error) { + if w.IsNode(name) { + return w.newNodeID(name, port), nil + } else if w.isClusterSubGraph(name) { + if len(port) != 0 { + return nil, fmt.Errorf("subgraph cannot have a port: %v", port) + } + return ast.MakeNodeID(name, port), nil + } else if w.IsSubGraph(name) { + if len(port) != 0 { + return nil, fmt.Errorf("subgraph cannot have a port: %v", port) + } + return w.newSubGraph(name) + } + return nil, fmt.Errorf("%v is not a node or a subgraph", name) +} + +func (w *writer) newEdgeStmt(edge *Edge) (*ast.EdgeStmt, error) { + src, err := w.newLocation(edge.Src, edge.SrcPort) + if err != nil { + return nil, err + } + dst, err := w.newLocation(edge.Dst, edge.DstPort) + if err != nil { + return nil, err + } + stmt := &ast.EdgeStmt{ + Source: src, + EdgeRHS: ast.EdgeRHS{ + &ast.EdgeRH{ + Op: ast.EdgeOp(edge.Dir), + Destination: dst, + }, + }, + Attrs: ast.PutMap(edge.Attrs.toMap()), + } + return stmt, nil +} + +func (w *writer) Write() (*ast.Graph, error) { + t := &ast.Graph{} + t.Strict = w.Strict + t.Type = ast.GraphType(w.Directed) + t.ID = ast.ID(w.Name) + + t.StmtList = appendAttrs(t.StmtList, w.Attrs) + + for _, edge := range w.Edges.Edges { + e, err := w.newEdgeStmt(edge) + if err != nil { + return nil, err + } + t.StmtList = append(t.StmtList, e) + } + + subGraphs := w.SubGraphs.Sorted() + for _, s := range subGraphs { + if _, ok := w.writtenLocations[s.Name]; !ok { + if _, ok := w.Relations.ParentToChildren[w.Name][s.Name]; ok { + s, err := w.newSubGraph(s.Name) + if err != nil { + return nil, err + } + t.StmtList = append(t.StmtList, s) + } + } + } + + nodes := w.Nodes.Sorted() + for _, n := range nodes { + if _, ok := w.writtenLocations[n.Name]; !ok { + t.StmtList = append(t.StmtList, w.newNodeStmt(n.Name)) + } + } + + return t, nil +} + +// WriteAst creates an Abstract Syntrax Tree from the Graph. +func (g *Graph) WriteAst() (*ast.Graph, error) { + w := newWriter(g) + return w.Write() +} + +// String returns a DOT string representing the Graph. +func (g *Graph) String() string { + w, err := g.WriteAst() + if err != nil { + return fmt.Sprintf("error: %v", err) + } + return w.String() +}