diff --git a/Gopkg.lock b/Gopkg.lock index 00f3b4c93a6..d5388c65d18 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -34,7 +34,8 @@ revision = "de5bf2ad457846296e2031421a34e2568e304e35" [[projects]] - digest = "1:19c2dd79ebd83f79c358ed8890f7ff9f10060268f9051f39f5ea65c74045b59f" + branch = "master" + digest = "1:c9335bca964be4fd1d245e44d798f106f191a4d7dfd0217228a8fd58f0e93606" name = "github.com/awalterschulze/gographviz" packages = [ ".", @@ -45,8 +46,7 @@ "internal/token", ] pruneopts = "NUT" - revision = "c84395e536e1a1199093a4e6253d1bee99e4cd2a" - version = "v2.0" + revision = "fa59802746ab47bad3c8876d678d41299cdd1aaa" [[projects]] digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec" @@ -1163,7 +1163,6 @@ "github.com/emicklei/go-restful", "github.com/ghodss/yaml", "github.com/go-sql-driver/mysql", - "github.com/golang/glog", "github.com/golang/mock/gomock", "github.com/golang/protobuf/jsonpb", "github.com/golang/protobuf/proto", @@ -1215,6 +1214,7 @@ "k8s.io/client-go/plugin/pkg/client/auth/gcp", "k8s.io/client-go/rest", "k8s.io/code-generator/cmd/deepcopy-gen", + "k8s.io/klog", "sigs.k8s.io/controller-runtime/pkg/client", "sigs.k8s.io/controller-runtime/pkg/client/config", "sigs.k8s.io/controller-runtime/pkg/controller", diff --git a/pkg/common/v1alpha2/katib_manager_util.go b/pkg/common/v1alpha2/katib_manager_util.go index c6c409536ba..8a9d54ce3e3 100644 --- a/pkg/common/v1alpha2/katib_manager_util.go +++ b/pkg/common/v1alpha2/katib_manager_util.go @@ -157,3 +157,14 @@ func GetObservationLog(request *api_pb.GetObservationLogRequest) (*api_pb.GetObs kc := kcc.KatibManagerClient return kc.GetObservationLog(ctx, request) } + +func ValidateAlgorithmSettings(request *api_pb.ValidateAlgorithmSettingsRequest) (*api_pb.ValidateAlgorithmSettingsReply, error) { + ctx := context.Background() + kcc, err := getKatibManagerClientAndConn() + if err != nil { + return nil, err + } + defer closeKatibManagerConnection(kcc) + kc := kcc.KatibManagerClient + return kc.ValidateAlgorithmSettings(ctx, request) +} diff --git a/pkg/controller/v1alpha2/experiment/managerclient/managerclient.go b/pkg/controller/v1alpha2/experiment/managerclient/managerclient.go index 801f03f2911..83e15bfdbfb 100644 --- a/pkg/controller/v1alpha2/experiment/managerclient/managerclient.go +++ b/pkg/controller/v1alpha2/experiment/managerclient/managerclient.go @@ -14,6 +14,7 @@ type ManagerClient interface { DeleteExperimentInDB(instance *experimentsv1alpha2.Experiment) error UpdateExperimentStatusInDB(instance *experimentsv1alpha2.Experiment) error PreCheckRegisterExperimentInDB(inst *experimentsv1alpha2.Experiment) (*api_pb.PreCheckRegisterExperimentReply, error) + ValidateAlgorithmSettings(inst *experimentsv1alpha2.Experiment) (*api_pb.ValidateAlgorithmSettingsReply, error) } // DefaultClient implements the Client interface. @@ -70,6 +71,17 @@ func (d *DefaultClient) PreCheckRegisterExperimentInDB(inst *experimentsv1alpha2 return commonv1alpha2.PreCheckRegisterExperiment(request) } +func (d *DefaultClient) ValidateAlgorithmSettings(inst *experimentsv1alpha2.Experiment) (*api_pb.ValidateAlgorithmSettingsReply, error) { + algorithmName := inst.Spec.Algorithm.AlgorithmName + request := &api_pb.ValidateAlgorithmSettingsRequest{ + AlgorithmName: algorithmName, + ExperimentSpec: getExperimentSpec(inst), + } + + return commonv1alpha2.ValidateAlgorithmSettings(request) + +} + func getExperimentConf(instance *experimentsv1alpha2.Experiment) *api_pb.Experiment { experiment := &api_pb.Experiment{ Spec: &api_pb.ExperimentSpec{ @@ -89,28 +101,63 @@ func getExperimentConf(instance *experimentsv1alpha2.Experiment) *api_pb.Experim experiment.Name = instance.Name + experiment.Spec = getExperimentSpec(instance) + + return experiment + +} + +func getCondition(inst *experimentsv1alpha2.Experiment) api_pb.ExperimentStatus_ExperimentConditionType { + condition, _ := inst.GetLastConditionType() + switch condition { + case experimentsv1alpha2.ExperimentCreated: + return api_pb.ExperimentStatus_CREATED + case experimentsv1alpha2.ExperimentRunning: + return api_pb.ExperimentStatus_RUNNING + case experimentsv1alpha2.ExperimentRestarting: + return api_pb.ExperimentStatus_RESTARTING + case experimentsv1alpha2.ExperimentSucceeded: + return api_pb.ExperimentStatus_SUCCEEDED + case experimentsv1alpha2.ExperimentFailed: + return api_pb.ExperimentStatus_FAILED + default: + return api_pb.ExperimentStatus_UNKNOWN + } +} + +func getExperimentSpec(instance *experimentsv1alpha2.Experiment) *api_pb.ExperimentSpec { + + experimentSpec := &api_pb.ExperimentSpec{ + Objective: &api_pb.ObjectiveSpec{ + AdditionalMetricNames: []string{}, + }, + Algorithm: &api_pb.AlgorithmSpec{ + AlgorithmSetting: []*api_pb.AlgorithmSetting{}, + }, + } + //Populate Objective switch instance.Spec.Objective.Type { case commonapiv1alpha2.ObjectiveTypeMaximize: - experiment.Spec.Objective.Type = api_pb.ObjectiveType_MAXIMIZE + experimentSpec.Objective.Type = api_pb.ObjectiveType_MAXIMIZE case commonapiv1alpha2.ObjectiveTypeMinimize: - experiment.Spec.Objective.Type = api_pb.ObjectiveType_MINIMIZE + experimentSpec.Objective.Type = api_pb.ObjectiveType_MINIMIZE default: - experiment.Spec.Objective.Type = api_pb.ObjectiveType_UNKNOWN + experimentSpec.Objective.Type = api_pb.ObjectiveType_UNKNOWN } - experiment.Spec.Objective.Goal = float32(*instance.Spec.Objective.Goal) - experiment.Spec.Objective.ObjectiveMetricName = instance.Spec.Objective.ObjectiveMetricName + experimentSpec.Objective.Goal = float32(*instance.Spec.Objective.Goal) + experimentSpec.Objective.ObjectiveMetricName = instance.Spec.Objective.ObjectiveMetricName for _, m := range instance.Spec.Objective.AdditionalMetricNames { - experiment.Spec.Objective.AdditionalMetricNames = append(experiment.Spec.Objective.AdditionalMetricNames, m) + experimentSpec.Objective.AdditionalMetricNames = append(experimentSpec.Objective.AdditionalMetricNames, m) } //Populate Algorithm Spec - experiment.Spec.Algorithm.AlgorithmName = instance.Spec.Algorithm.AlgorithmName + experimentSpec.Algorithm.AlgorithmName = instance.Spec.Algorithm.AlgorithmName for _, as := range instance.Spec.Algorithm.AlgorithmSettings { - experiment.Spec.Algorithm.AlgorithmSetting = append( - experiment.Spec.Algorithm.AlgorithmSetting, + experimentSpec.Algorithm.AlgorithmSetting = append( + experimentSpec.Algorithm.AlgorithmSetting, &api_pb.AlgorithmSetting{ Name: as.Name, Value: as.Value, @@ -146,7 +193,7 @@ func getExperimentConf(instance *experimentsv1alpha2.Experiment) *api_pb.Experim } parameterSpecs.Parameters = append(parameterSpecs.Parameters, parameter) } - experiment.Spec.ParameterSpecs = parameterSpecs + experimentSpec.ParameterSpecs = parameterSpecs } //Populate NAS Experiment @@ -205,27 +252,8 @@ func getExperimentConf(instance *experimentsv1alpha2.Experiment) *api_pb.Experim nasConfig.Operations.Operation = append(nasConfig.Operations.Operation, operation) } - experiment.Spec.NasConfig = nasConfig + experimentSpec.NasConfig = nasConfig } - return experiment - -} - -func getCondition(inst *experimentsv1alpha2.Experiment) api_pb.ExperimentStatus_ExperimentConditionType { - condition, _ := inst.GetLastConditionType() - switch condition { - case experimentsv1alpha2.ExperimentCreated: - return api_pb.ExperimentStatus_CREATED - case experimentsv1alpha2.ExperimentRunning: - return api_pb.ExperimentStatus_RUNNING - case experimentsv1alpha2.ExperimentRestarting: - return api_pb.ExperimentStatus_RESTARTING - case experimentsv1alpha2.ExperimentSucceeded: - return api_pb.ExperimentStatus_SUCCEEDED - case experimentsv1alpha2.ExperimentFailed: - return api_pb.ExperimentStatus_FAILED - default: - return api_pb.ExperimentStatus_UNKNOWN - } + return experimentSpec } diff --git a/pkg/controller/v1alpha2/experiment/validator/validator.go b/pkg/controller/v1alpha2/experiment/validator/validator.go index d0b4d8bbde9..5353d7083a9 100644 --- a/pkg/controller/v1alpha2/experiment/validator/validator.go +++ b/pkg/controller/v1alpha2/experiment/validator/validator.go @@ -4,6 +4,8 @@ import ( "bytes" "fmt" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" batchv1beta "k8s.io/api/batch/v1beta1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" k8syaml "k8s.io/apimachinery/pkg/util/yaml" @@ -77,8 +79,19 @@ func (g *DefaultValidator) ValidateExperiment(instance *experimentsv1alpha2.Expe } func (g *DefaultValidator) validateAlgorithmSettings(inst *experimentsv1alpha2.Experiment) error { - // TODO: it need call ValidateAlgorithmSettings API of vizier-core manager, implement it when vizier-core done + + _, err := g.ValidateAlgorithmSettings(inst) + statusCode, _ := status.FromError(err) + + if statusCode.Code() == codes.Unknown { + return fmt.Errorf("Method ValidateAlgorithmSettings not found inside Suggestion service: %s", inst.Spec.Algorithm.AlgorithmName) + } + + if statusCode.Code() == codes.InvalidArgument || statusCode.Code() == codes.Unavailable { + return fmt.Errorf("ValidateAlgorithmSettings Error: %v", statusCode.Message()) + } return nil + } func (g *DefaultValidator) validateObjective(obj *commonapiv1alpha2.ObjectiveSpec) error { diff --git a/pkg/controller/v1alpha2/experiment/validator/validator_test.go b/pkg/controller/v1alpha2/experiment/validator/validator_test.go index c7c53a27ef5..c9028c89f13 100644 --- a/pkg/controller/v1alpha2/experiment/validator/validator_test.go +++ b/pkg/controller/v1alpha2/experiment/validator/validator_test.go @@ -115,6 +115,9 @@ spec: CanRegister: true, }, nil).AnyTimes() + mc.EXPECT().ValidateAlgorithmSettings(gomock.Any()).Return( + &api_pb.ValidateAlgorithmSettingsReply{}, nil).AnyTimes() + tcs := []struct { Instance *experimentsv1alpha2.Experiment Err bool diff --git a/pkg/mock/v1alpha2/experiment/managerclient/managerclient.go b/pkg/mock/v1alpha2/experiment/managerclient/managerclient.go index 4a69cd49347..f801ef59451 100644 --- a/pkg/mock/v1alpha2/experiment/managerclient/managerclient.go +++ b/pkg/mock/v1alpha2/experiment/managerclient/managerclient.go @@ -90,3 +90,18 @@ func (mr *MockManagerClientMockRecorder) UpdateExperimentStatusInDB(arg0 interfa mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateExperimentStatusInDB", reflect.TypeOf((*MockManagerClient)(nil).UpdateExperimentStatusInDB), arg0) } + +// ValidateAlgorithmSettings mocks base method +func (m *MockManagerClient) ValidateAlgorithmSettings(arg0 *v1alpha2.Experiment) (*v1alpha20.ValidateAlgorithmSettingsReply, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidateAlgorithmSettings", arg0) + ret0, _ := ret[0].(*v1alpha20.ValidateAlgorithmSettingsReply) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidateAlgorithmSettings indicates an expected call of ValidateAlgorithmSettings +func (mr *MockManagerClientMockRecorder) ValidateAlgorithmSettings(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateAlgorithmSettings", reflect.TypeOf((*MockManagerClient)(nil).ValidateAlgorithmSettings), arg0) +} diff --git a/vendor/github.com/awalterschulze/gographviz/CONTRIBUTORS b/vendor/github.com/awalterschulze/gographviz/CONTRIBUTORS index ba8ecc80cd8..3bbeed36ccf 100644 --- a/vendor/github.com/awalterschulze/gographviz/CONTRIBUTORS +++ b/vendor/github.com/awalterschulze/gographviz/CONTRIBUTORS @@ -1,2 +1,5 @@ Robin Eklind Walter Schulze +Xuanyi Chew +Nathan Kitchen +Ruud Kamphuis diff --git a/vendor/github.com/awalterschulze/gographviz/analyse.go b/vendor/github.com/awalterschulze/gographviz/analyse.go index f82421e2a11..fd9e25a8da3 100644 --- a/vendor/github.com/awalterschulze/gographviz/analyse.go +++ b/vendor/github.com/awalterschulze/gographviz/analyse.go @@ -54,11 +54,13 @@ func (w *graphVisitor) Visit(v ast.Elem) ast.Visitor { w.g.SetDir(graph.Type == ast.DIGRAPH) graphName := graph.ID.String() w.g.SetName(graphName) - return newStmtVisitor(w.g, graphName) + return newStmtVisitor(w.g, graphName, nil, nil) } -func newStmtVisitor(g errInterface, graphName string) *stmtVisitor { - return &stmtVisitor{g, graphName, make(map[string]string), make(map[string]string), make(map[string]string)} +func newStmtVisitor(g errInterface, graphName string, nodeAttrs, edgeAttrs map[string]string) *stmtVisitor { + nodeAttrs = ammend(make(map[string]string), nodeAttrs) + edgeAttrs = ammend(make(map[string]string), edgeAttrs) + return &stmtVisitor{g, graphName, nodeAttrs, edgeAttrs, make(map[string]string), make(map[string]struct{})} } type stmtVisitor struct { @@ -67,6 +69,7 @@ type stmtVisitor struct { currentNodeAttrs map[string]string currentEdgeAttrs map[string]string currentGraphAttrs map[string]string + createdNodes map[string]struct{} } func (w *stmtVisitor) Visit(v ast.Elem) ast.Visitor { @@ -109,9 +112,23 @@ func overwrite(attrs map[string]string, overwrite map[string]string) map[string] return attrs } +func (w *stmtVisitor) addNodeFromEdge(nodeID string) { + if _, ok := w.createdNodes[nodeID]; !ok { + w.createdNodes[nodeID] = struct{}{} + w.g.AddNode(w.graphName, nodeID, w.currentNodeAttrs) + } +} + 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) + nodeID := stmt.NodeID.String() + var defaultAttrs map[string]string + if _, ok := w.createdNodes[nodeID]; !ok { + defaultAttrs = w.currentNodeAttrs + w.createdNodes[nodeID] = struct{}{} + } + // else the defaults were already inherited + attrs := ammend(stmt.Attrs.GetMap(), defaultAttrs) + w.g.AddNode(w.graphName, nodeID, attrs) return &nilVisitor{} } @@ -121,7 +138,7 @@ func (w *stmtVisitor) edgeStmt(stmt ast.EdgeStmt) ast.Visitor { src := stmt.Source.GetID() srcName := src.String() if stmt.Source.IsNode() { - w.g.AddNode(w.graphName, srcName, w.currentNodeAttrs) + w.addNodeFromEdge(srcName) } srcPort := stmt.Source.GetPort() for i := range stmt.EdgeRHS { @@ -129,7 +146,7 @@ func (w *stmtVisitor) edgeStmt(stmt ast.EdgeStmt) ast.Visitor { dst := stmt.EdgeRHS[i].Destination.GetID() dstName := dst.String() if stmt.EdgeRHS[i].Destination.IsNode() { - w.g.AddNode(w.graphName, dstName, w.currentNodeAttrs) + w.addNodeFromEdge(dstName) } dstPort := stmt.EdgeRHS[i].Destination.GetPort() w.g.AddPortEdge(srcName, srcPort.String(), dstName, dstPort.String(), directed, attrs) @@ -162,7 +179,7 @@ func (w *stmtVisitor) graphAttrs(stmt ast.GraphAttrs) ast.Visitor { 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) + return newStmtVisitor(w.g, subGraphName, w.currentNodeAttrs, w.currentEdgeAttrs) } func (w *stmtVisitor) attr(stmt *ast.Attr) ast.Visitor { diff --git a/vendor/github.com/awalterschulze/gographviz/ast/ast.go b/vendor/github.com/awalterschulze/gographviz/ast/ast.go index 1487aacd680..446f8770c3a 100644 --- a/vendor/github.com/awalterschulze/gographviz/ast/ast.go +++ b/vendor/github.com/awalterschulze/gographviz/ast/ast.go @@ -21,12 +21,14 @@ import ( "math/rand" "sort" "strings" + "sync" "github.com/awalterschulze/gographviz/internal/token" ) var ( - r = rand.New(rand.NewSource(1234)) + r = rand.New(rand.NewSource(1234)) + randLock sync.Mutex ) type Visitor interface { @@ -104,7 +106,11 @@ func NewGraph(t, strict, id, l Attrib) (*Graph, error) { } func (this *Graph) String() string { - s := this.Type.String() + " " + this.ID.String() + " {\n" + var s string + if this.Strict { + s += "strict " + } + s += this.Type.String() + " " + this.ID.String() + " {\n" if this.StmtList != nil { s += this.StmtList.String() } @@ -179,12 +185,14 @@ type SubGraph struct { 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) - } +func NewSubGraph(maybeId, l Attrib) (*SubGraph, error) { + g := &SubGraph{} + if id, ok := maybeId.(ID); maybeId == nil || (ok && len(id) == 0) { + g.ID = ID(fmt.Sprintf("anon%d", randInt63())) + } else if ok && (len(id) > 0) { + g.ID = id + } else { + return nil, fmt.Errorf("expected maybeId.(ID) got=%v", maybeId) } if l != nil { g.StmtList = l.(StmtList) @@ -192,6 +200,13 @@ func NewSubGraph(id, l Attrib) (*SubGraph, error) { return g, nil } +func randInt63() int64 { + randLock.Lock() + result := r.Int63() + randLock.Unlock() + return result +} + func (this *SubGraph) GetID() ID { return this.ID } @@ -592,9 +607,9 @@ 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]) + p.ID1 = ID(ps[0]) + if len(ps) > 1 { + p.ID2 = ID(ps[1]) } } return &NodeID{ID(id), p} diff --git a/vendor/github.com/awalterschulze/gographviz/attr.go b/vendor/github.com/awalterschulze/gographviz/attr.go index 3d9f2acf1cd..35004fa0f3d 100644 --- a/vendor/github.com/awalterschulze/gographviz/attr.go +++ b/vendor/github.com/awalterschulze/gographviz/attr.go @@ -29,345 +29,345 @@ func NewAttr(key string) (Attr, error) { } const ( - // Damping http://www.graphviz.org/content/attrs#dDamping + // Damping http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:Damping Damping Attr = "Damping" - // K http://www.graphviz.org/content/attrs#dK + // K http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:K K Attr = "K" - // URL http://www.graphviz.org/content/attrs#dURL + // URL http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:URL URL Attr = "URL" - // Background http://www.graphviz.org/content/attrs#d_background + // Background http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:_background Background Attr = "_background" - // Area http://www.graphviz.org/content/attrs#darea + // Area http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:area Area Attr = "area" - // ArrowHead http://www.graphviz.org/content/attrs#darrowhead + // ArrowHead http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:arrowhead ArrowHead Attr = "arrowhead" - // ArrowSize http://www.graphviz.org/content/attrs#darrowsize + // ArrowSize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:arrowsize ArrowSize Attr = "arrowsize" - // ArrowTail http://www.graphviz.org/content/attrs#darrowtail + // ArrowTail http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:arrowtail ArrowTail Attr = "arrowtail" - // BB http://www.graphviz.org/content/attrs#dbb + // BB http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:bb BB Attr = "bb" - // BgColor http://www.graphviz.org/content/attrs#dbgcolor + // BgColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:bgcolor BgColor Attr = "bgcolor" - // Center http://www.graphviz.org/content/attrs#dcenter + // Center http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:center Center Attr = "center" - // Charset http://www.graphviz.org/content/attrs#dcharset + // Charset http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:charset Charset Attr = "charset" - // ClusterRank http://www.graphviz.org/content/attrs#dclusterrank + // ClusterRank http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:clusterrank ClusterRank Attr = "clusterrank" - // Color http://www.graphviz.org/content/attrs#dcolor + // Color http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:color Color Attr = "color" - // ColorScheme http://www.graphviz.org/content/attrs#dcolorscheme + // ColorScheme http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:colorscheme ColorScheme Attr = "colorscheme" - // Comment http://www.graphviz.org/content/attrs#dcomment + // Comment http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:comment Comment Attr = "comment" - // Compound http://www.graphviz.org/content/attrs#dcompound + // Compound http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:compound Compound Attr = "compound" - // Concentrate http://www.graphviz.org/content/attrs#dconcentrate + // Concentrate http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:concentrate Concentrate Attr = "concentrate" - // Constraint http://www.graphviz.org/content/attrs#dconstraint + // Constraint http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:constraint Constraint Attr = "constraint" - // Decorate http://www.graphviz.org/content/attrs#ddecorate + // Decorate http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:decorate Decorate Attr = "decorate" - // DefaultDist http://www.graphviz.org/content/attrs#ddefaultdist + // DefaultDist http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:defaultdist DefaultDist Attr = "defaultdist" - // Dim http://www.graphviz.org/content/attrs#ddim + // Dim http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:dim Dim Attr = "dim" - // Dimen http://www.graphviz.org/content/attrs#ddimen + // Dimen http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:dimen Dimen Attr = "dimen" - // Dir http://www.graphviz.org/content/attrs#ddir + // Dir http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:dir Dir Attr = "dir" - // DirEdgeConstraints http://www.graphviz.org/content/attrs#ddir + // DirEdgeConstraints http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:dir DirEdgeConstraints Attr = "diredgeconstraints" - // Distortion http://www.graphviz.org/content/attrs#ddistortion + // Distortion http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:distortion Distortion Attr = "distortion" - // DPI http://www.graphviz.org/content/attrs#ddpi + // DPI http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:dpi DPI Attr = "dpi" - // EdgeURL http://www.graphviz.org/content/attrs#d:edgeURL + // EdgeURL http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::edgeURL EdgeURL Attr = "edgeURL" - // EdgeHREF http://www.graphviz.org/content/attrs#d:edgehref + // EdgeHREF http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::edgehref EdgeHREF Attr = "edgehref" - // EdgeTarget http://www.graphviz.org/content/attrs#d:edgetarget + // EdgeTarget http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::edgetarget EdgeTarget Attr = "edgetarget" - // EdgeTooltip http://www.graphviz.org/content/attrs#d:edgetooltip + // EdgeTooltip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::edgetooltip EdgeTooltip Attr = "edgetooltip" - // Epsilon http://www.graphviz.org/content/attrs#d:epsilon + // Epsilon http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::epsilon Epsilon Attr = "epsilon" - // ESep http://www.graphviz.org/content/attrs#d:epsilon + // ESep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d::epsilon ESep Attr = "esep" - // FillColor http://www.graphviz.org/content/attrs#dfillcolor + // FillColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fillcolor FillColor Attr = "fillcolor" - // FixedSize http://www.graphviz.org/content/attrs#dfixedsize + // FixedSize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fixedsize FixedSize Attr = "fixedsize" - // FontColor http://www.graphviz.org/content/attrs#dfontcolor + // FontColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fontcolor FontColor Attr = "fontcolor" - // FontName http://www.graphviz.org/content/attrs#dfontname + // FontName http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fontname FontName Attr = "fontname" - // FontNames http://www.graphviz.org/content/attrs#dfontnames + // FontNames http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fontnames FontNames Attr = "fontnames" - // FontPath http://www.graphviz.org/content/attrs#dfontpath + // FontPath http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fontpath FontPath Attr = "fontpath" - // FontSize http://www.graphviz.org/content/attrs#dfontsize + // FontSize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:fontsize FontSize Attr = "fontsize" - // ForceLabels http://www.graphviz.org/content/attrs#dforcelabels + // ForceLabels http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:forcelabels ForceLabels Attr = "forcelabels" - // GradientAngle http://www.graphviz.org/content/attrs#dgradientangle + // GradientAngle http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:gradientangle GradientAngle Attr = "gradientangle" - // Group http://www.graphviz.org/content/attrs#dgroup + // Group http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:group Group Attr = "group" - // HeadURL http://www.graphviz.org/content/attrs#dheadURL + // HeadURL http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headURL HeadURL Attr = "headURL" - // HeadLP http://www.graphviz.org/content/attrs#dhead_lp + // HeadLP http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:head_lp HeadLP Attr = "head_lp" - // HeadClip http://www.graphviz.org/content/attrs#dheadclip + // HeadClip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headclip HeadClip Attr = "headclip" - // HeadHREF http://www.graphviz.org/content/attrs#dheadhref + // HeadHREF http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headhref HeadHREF Attr = "headhref" - // HeadLabel http://www.graphviz.org/content/attrs#dheadlabel + // HeadLabel http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headlabel HeadLabel Attr = "headlabel" - // HeadPort http://www.graphviz.org/content/attrs#dheadport + // HeadPort http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headport HeadPort Attr = "headport" - // HeadTarget http://www.graphviz.org/content/attrs#dheadtarget + // HeadTarget http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headtarget HeadTarget Attr = "headtarget" - // HeadTooltip http://www.graphviz.org/content/attrs#dheadtooltip + // HeadTooltip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:headtooltip HeadTooltip Attr = "headtooltip" - // Height http://www.graphviz.org/content/attrs#dheight + // Height http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:height Height Attr = "height" - // HREF http://www.graphviz.org/content/attrs#dhref + // HREF http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:href HREF Attr = "href" - // ID http://www.graphviz.org/content/attrs#did + // ID http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:id ID Attr = "id" - // Image http://www.graphviz.org/content/attrs#dimage + // Image http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:image Image Attr = "image" - // ImagePath http://www.graphviz.org/content/attrs#dimagepath + // ImagePath http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:imagepath ImagePath Attr = "imagepath" - // ImageScale http://www.graphviz.org/content/attrs#dimagescale + // ImageScale http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:imagescale ImageScale Attr = "imagescale" - // InputScale http://www.graphviz.org/content/attrs#dinputscale + // InputScale http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:inputscale InputScale Attr = "inputscale" - // Label http://www.graphviz.org/content/attrs#dlabel + // Label http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:label Label Attr = "label" - // LabelURL http://www.graphviz.org/content/attrs#dlabelURL + // LabelURL http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelURL LabelURL Attr = "labelURL" - // LabelScheme http://www.graphviz.org/content/attrs#dlabel_scheme + // LabelScheme http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:label_scheme LabelScheme Attr = "label_scheme" - // LabelAngle http://www.graphviz.org/content/attrs#dlabelangle + // LabelAngle http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelangle LabelAngle Attr = "labelangle" - // LabelDistance http://www.graphviz.org/content/attrs#dlabeldistance + // LabelDistance http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labeldistance LabelDistance Attr = "labeldistance" - // LabelFloat http://www.graphviz.org/content/attrs#dlabelfloat + // LabelFloat http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelfloat LabelFloat Attr = "labelfloat" - // LabelFontColor http://www.graphviz.org/content/attrs#dlabelfontcolor + // LabelFontColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelfontcolor LabelFontColor Attr = "labelfontcolor" - // LabelFontName http://www.graphviz.org/content/attrs#dlabelfontname + // LabelFontName http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelfontname LabelFontName Attr = "labelfontname" - // LabelFontSize http://www.graphviz.org/content/attrs#dlabelfontsize + // LabelFontSize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelfontsize LabelFontSize Attr = "labelfontsize" - // LabelHREF http://www.graphviz.org/content/attrs#dlabelhref + // LabelHREF http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelhref LabelHREF Attr = "labelhref" - // LabelJust http://www.graphviz.org/content/attrs#dlabeljust + // LabelJust http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labeljust LabelJust Attr = "labeljust" - // LabelLOC http://www.graphviz.org/content/attrs#dlabelloc + // LabelLOC http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labelloc LabelLOC Attr = "labelloc" - // LabelTarget http://www.graphviz.org/content/attrs#dlabeltarget + // LabelTarget http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labeltarget LabelTarget Attr = "labeltarget" - // LabelTooltip http://www.graphviz.org/content/attrs#dlabeltooltip + // LabelTooltip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:labeltooltip LabelTooltip Attr = "labeltooltip" - // Landscape http://www.graphviz.org/content/attrs#dlandscape + // Landscape http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:landscape Landscape Attr = "landscape" - // Layer http://www.graphviz.org/content/attrs#dlayer + // Layer http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layer Layer Attr = "layer" - // LayerListSep http://www.graphviz.org/content/attrs#dlayerlistsep + // LayerListSep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layerlistsep LayerListSep Attr = "layerlistsep" - // Layers http://www.graphviz.org/content/attrs#dlayers + // Layers http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layers Layers Attr = "layers" - // LayerSelect http://www.graphviz.org/content/attrs#dlayerselect + // LayerSelect http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layerselect LayerSelect Attr = "layerselect" - // LayerSep http://www.graphviz.org/content/attrs#dlayersep + // LayerSep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layersep LayerSep Attr = "layersep" - // Layout http://www.graphviz.org/content/attrs#dlayout + // Layout http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:layout Layout Attr = "layout" - // Len http://www.graphviz.org/content/attrs#dlen + // Len http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:len Len Attr = "len" - // Levels http://www.graphviz.org/content/attrs#dlevels + // Levels http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:levels Levels Attr = "levels" - // LevelsGap http://www.graphviz.org/content/attrs#dlevelsgap + // LevelsGap http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:levelsgap LevelsGap Attr = "levelsgap" - // LHead http://www.graphviz.org/content/attrs#dlhead + // LHead http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:lhead LHead Attr = "lhead" - // LHeight http://www.graphviz.org/content/attrs#dlheight + // LHeight http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:lheight LHeight Attr = "lheight" - // LP http://www.graphviz.org/content/attrs#dlp + // LP http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:lp LP Attr = "lp" - // LTail http://www.graphviz.org/content/attrs#dltail + // LTail http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:ltail LTail Attr = "ltail" - // LWidth http://www.graphviz.org/content/attrs#dlwidth + // LWidth http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:lwidth LWidth Attr = "lwidth" - // Margin http://www.graphviz.org/content/attrs#dmargin + // Margin http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:margin Margin Attr = "margin" - // MaxIter http://www.graphviz.org/content/attrs#dmaxiter + // MaxIter http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:maxiter MaxIter Attr = "maxiter" - // MCLimit http://www.graphviz.org/content/attrs#dmclimit + // MCLimit http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:mclimit MCLimit Attr = "mclimit" - // MinDist http://www.graphviz.org/content/attrs#dmindist + // MinDist http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:mindist MinDist Attr = "mindist" - // MinLen http://www.graphviz.org/content/attrs#dmindist + // MinLen http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:mindist MinLen Attr = "minlen" - // Mode http://www.graphviz.org/content/attrs#dmode + // Mode http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:mode Mode Attr = "mode" - // Model http://www.graphviz.org/content/attrs#dmodel + // Model http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:model Model Attr = "model" - // Mosek http://www.graphviz.org/content/attrs#dmosek + // Mosek http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:mosek Mosek Attr = "mosek" - // NewRank http://www.graphviz.org/content/attrs#dnewrank + // NewRank http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:newrank NewRank Attr = "newrank" - // NodeSep http://www.graphviz.org/content/attrs#dnodesep + // NodeSep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:nodesep NodeSep Attr = "nodesep" - // NoJustify http://www.graphviz.org/content/attrs#dnojustify + // NoJustify http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:nojustify NoJustify Attr = "nojustify" - // Normalize http://www.graphviz.org/content/attrs#dnormalize + // Normalize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:normalize Normalize Attr = "normalize" - // NoTranslate http://www.graphviz.org/content/attrs#dnotranslate + // NoTranslate http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:notranslate NoTranslate Attr = "notranslate" - // NSLimit http://www.graphviz.org/content/attrs#dnslimit + // NSLimit http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:nslimit NSLimit Attr = "nslimit" - // NSLimit1 http://www.graphviz.org/content/attrs#dnslimit1 + // NSLimit1 http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:nslimit1 NSLimit1 Attr = "nslimit1" - // Ordering http://www.graphviz.org/content/attrs#dnslimit1 + // Ordering http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:nslimit1 Ordering Attr = "ordering" - // Orientation http://www.graphviz.org/content/attrs#dorientation + // Orientation http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:orientation Orientation Attr = "orientation" - // OutputOrder http://www.graphviz.org/content/attrs#doutputorder + // OutputOrder http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:outputorder OutputOrder Attr = "outputorder" - // Overlap http://www.graphviz.org/content/attrs#doverlap + // Overlap http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:overlap Overlap Attr = "overlap" - // OverlapScaling http://www.graphviz.org/content/attrs#doverlap_scaling + // OverlapScaling http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:overlap_scaling OverlapScaling Attr = "overlap_scaling" - // OverlapShrink http://www.graphviz.org/content/attrs#doverlap_shrink + // OverlapShrink http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:overlap_shrink OverlapShrink Attr = "overlap_shrink" - // Pack http://www.graphviz.org/content/attrs#dpack + // Pack http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pack Pack Attr = "pack" - // PackMode http://www.graphviz.org/content/attrs#dpackmode + // PackMode http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:packmode PackMode Attr = "packmode" - // Pad http://www.graphviz.org/content/attrs#dpad + // Pad http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pad Pad Attr = "pad" - // Page http://www.graphviz.org/content/attrs#dpage + // Page http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:page Page Attr = "page" - // PageDir http://www.graphviz.org/content/attrs#dpagedir + // PageDir http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pagedir PageDir Attr = "pagedir" - // PenColor http://www.graphviz.org/content/attrs#dpencolor + // PenColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pencolor PenColor Attr = "pencolor" - // PenWidth http://www.graphviz.org/content/attrs#dpenwidth + // PenWidth http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:penwidth PenWidth Attr = "penwidth" - // Peripheries http://www.graphviz.org/content/attrs#dperipheries + // Peripheries http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:peripheries Peripheries Attr = "peripheries" - // Pin http://www.graphviz.org/content/attrs#dperipheries + // Pin http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:peripheries Pin Attr = "pin" - // Pos http://www.graphviz.org/content/attrs#dpos + // Pos http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:pos Pos Attr = "pos" - // QuadTree http://www.graphviz.org/content/attrs#dquadtree + // QuadTree http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:quadtree QuadTree Attr = "quadtree" - // Quantum http://www.graphviz.org/content/attrs#dquantum + // Quantum http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:quantum Quantum Attr = "quantum" - // Rank http://www.graphviz.org/content/attrs#drank + // Rank http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rank Rank Attr = "rank" - // RankDir http://www.graphviz.org/content/attrs#drankdir + // RankDir http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rankdir RankDir Attr = "rankdir" - // RankSep http://www.graphviz.org/content/attrs#dranksep + // RankSep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:ranksep RankSep Attr = "ranksep" - // Ratio http://www.graphviz.org/content/attrs#dratio + // Ratio http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:ratio Ratio Attr = "ratio" - // Rects http://www.graphviz.org/content/attrs#drects + // Rects http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rects Rects Attr = "rects" - // Regular http://www.graphviz.org/content/attrs#dregular + // Regular http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:regular Regular Attr = "regular" - // ReMinCross http://www.graphviz.org/content/attrs#dremincross + // ReMinCross http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:remincross ReMinCross Attr = "remincross" - // RepulsiveForce http://www.graphviz.org/content/attrs#drepulsiveforce + // RepulsiveForce http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:repulsiveforce RepulsiveForce Attr = "repulsiveforce" - // Resolution http://www.graphviz.org/content/attrs#dresolution + // Resolution http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:resolution Resolution Attr = "resolution" - // Root http://www.graphviz.org/content/attrs#droot + // Root http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:root Root Attr = "root" - // Rotate http://www.graphviz.org/content/attrs#drotate + // Rotate http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rotate Rotate Attr = "rotate" - // Rotation http://www.graphviz.org/content/attrs#drotation + // Rotation http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rotation Rotation Attr = "rotation" - // SameHead http://www.graphviz.org/content/attrs#dsamehead + // SameHead http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:samehead SameHead Attr = "samehead" - // SameTail http://www.graphviz.org/content/attrs#dsametail + // SameTail http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:sametail SameTail Attr = "sametail" - // SamplePoints http://www.graphviz.org/content/attrs#dsamplepoints + // SamplePoints http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:samplepoints SamplePoints Attr = "samplepoints" - // Scale http://www.graphviz.org/content/attrs#dscale + // Scale http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:scale Scale Attr = "scale" - // SearchSize http://www.graphviz.org/content/attrs#dsearchsize + // SearchSize http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:searchsize SearchSize Attr = "searchsize" - // Sep http://www.graphviz.org/content/attrs#dsep + // Sep http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:sep Sep Attr = "sep" - // Shape http://www.graphviz.org/content/attrs#dshape + // Shape http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:shape Shape Attr = "shape" - // ShapeFile http://www.graphviz.org/content/attrs#dshapefile + // ShapeFile http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:shapefile ShapeFile Attr = "shapefile" - // ShowBoxes http://www.graphviz.org/content/attrs#dshowboxes + // ShowBoxes http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:showboxes ShowBoxes Attr = "showboxes" - // Sides http://www.graphviz.org/content/attrs#dsides + // Sides http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:sides Sides Attr = "sides" - // Size http://www.graphviz.org/content/attrs#dsize + // Size http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:size Size Attr = "size" - // Skew http://www.graphviz.org/content/attrs#dskew + // Skew http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:skew Skew Attr = "skew" - // Smoothing http://www.graphviz.org/content/attrs#dsmoothing + // Smoothing http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:smoothing Smoothing Attr = "smoothing" - // SortV http://www.graphviz.org/content/attrs#dsortv + // SortV http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:sortv SortV Attr = "sortv" - // Splines http://www.graphviz.org/content/attrs#dsplines + // Splines http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:splines Splines Attr = "splines" - // Start http://www.graphviz.org/content/attrs#dstart + // Start http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:start Start Attr = "start" - // Style http://www.graphviz.org/content/attrs#dstyle + // Style http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:style Style Attr = "style" - // StyleSheet http://www.graphviz.org/content/attrs#dstylesheet + // StyleSheet http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:stylesheet StyleSheet Attr = "stylesheet" - // TailURL http://www.graphviz.org/content/attrs#dtailURL + // TailURL http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailURL TailURL Attr = "tailURL" - // TailLP http://www.graphviz.org/content/attrs#dtail_lp + // TailLP http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tail_lp TailLP Attr = "tail_lp" - // TailClip http://www.graphviz.org/content/attrs#dtailclip + // TailClip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailclip TailClip Attr = "tailclip" - // TailHREF http://www.graphviz.org/content/attrs#dtailhref + // TailHREF http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailhref TailHREF Attr = "tailhref" - // TailLabel http://www.graphviz.org/content/attrs#dtaillabel + // TailLabel http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:taillabel TailLabel Attr = "taillabel" - // TailPort http://www.graphviz.org/content/attrs#dtailport + // TailPort http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailport TailPort Attr = "tailport" - // TailTarget http://www.graphviz.org/content/attrs#dtailtarget + // TailTarget http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailtarget TailTarget Attr = "tailtarget" - // TailTooltip http://www.graphviz.org/content/attrs#dtailtooltip + // TailTooltip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tailtooltip TailTooltip Attr = "tailtooltip" - // Target http://www.graphviz.org/content/attrs#dtarget + // Target http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:target Target Attr = "target" - // Tooltip http://www.graphviz.org/content/attrs#dtooltip + // Tooltip http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tooltip Tooltip Attr = "tooltip" - // TrueColor http://www.graphviz.org/content/attrs#dtooltip + // TrueColor http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:tooltip TrueColor Attr = "truecolor" - // Vertices http://www.graphviz.org/content/attrs#dvertices + // Vertices http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:vertices Vertices Attr = "vertices" - // ViewPort http://www.graphviz.org/content/attrs#dviewport + // ViewPort http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:viewport ViewPort Attr = "viewport" - // VoroMargin http://www.graphviz.org/content/attrs#dvoro_margin + // VoroMargin http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:voro_margin VoroMargin Attr = "voro_margin" - // Weight http://www.graphviz.org/content/attrs#dweight + // Weight http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:weight Weight Attr = "weight" - // Width http://www.graphviz.org/content/attrs#dwidth + // Width http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:width Width Attr = "width" - // XDotVersion http://www.graphviz.org/content/attrs#dxdotversion + // XDotVersion http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:xdotversion XDotVersion Attr = "xdotversion" - // XLabel http://www.graphviz.org/content/attrs#dxlabel + // XLabel http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:xlabel XLabel Attr = "xlabel" - // XLP http://www.graphviz.org/content/attrs#dxlp + // XLP http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:xlp XLP Attr = "xlp" - // Z http://www.graphviz.org/content/attrs#dz + // Z http://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:z Z Attr = "z" // MinCross is not in the documentation, but found in the Ped_Lion_Share (lion_share.gv.txt) example diff --git a/vendor/github.com/awalterschulze/gographviz/escape.go b/vendor/github.com/awalterschulze/gographviz/escape.go index 13d8bebc197..91e68d9713b 100644 --- a/vendor/github.com/awalterschulze/gographviz/escape.go +++ b/vendor/github.com/awalterschulze/gographviz/escape.go @@ -75,6 +75,9 @@ func isID(s string) bool { if c == '-' { return false } + if c == '/' { + return false + } i++ } return pos diff --git a/vendor/github.com/awalterschulze/gographviz/graph.go b/vendor/github.com/awalterschulze/gographviz/graph.go index e2bef45b368..92b3f1cf889 100644 --- a/vendor/github.com/awalterschulze/gographviz/graph.go +++ b/vendor/github.com/awalterschulze/gographviz/graph.go @@ -97,6 +97,29 @@ func (g *Graph) AddNode(parentGraph string, name string, attrs map[string]string return nil } +// RemoveNode removes a node from the graph +func (g *Graph) RemoveNode(parentGraph string, name string) error { + err := g.Nodes.Remove(name) + if err != nil { + return err + } + + g.Relations.Remove(parentGraph, name) + + edges := NewEdges() + for _, e := range g.Edges.Edges { + if e.Dst == name || e.Src == name { + continue + } + + edges.Add(e) + } + + g.Edges = edges + + return nil +} + func (g *Graph) getAttrs(graphName string) (Attrs, error) { if g.Name == graphName { return g.Attrs, nil @@ -129,6 +152,32 @@ func (g *Graph) AddSubGraph(parentGraph string, name string, attrs map[string]st return nil } +// RemoveSubGraph removes the subgraph including nodes +func (g *Graph) RemoveSubGraph(parentGraph string, name string) error { + for child := range g.Relations.ParentToChildren[name] { + err := g.RemoveNode(parentGraph, child) + if err != nil { + return err + } + } + + g.Relations.Remove(parentGraph, name) + g.SubGraphs.Remove(name) + + edges := NewEdges() + for _, e := range g.Edges.Edges { + if e.Dst == name || e.DstPort == name || e.Src == name || e.SrcPort == name { + continue + } + + edges.Add(e) + } + + g.Edges = edges + + 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] diff --git a/vendor/github.com/awalterschulze/gographviz/internal/errors/errors.go b/vendor/github.com/awalterschulze/gographviz/internal/errors/errors.go index 4490dff08f8..3df79f0098d 100644 --- a/vendor/github.com/awalterschulze/gographviz/internal/errors/errors.go +++ b/vendor/github.com/awalterschulze/gographviz/internal/errors/errors.go @@ -3,8 +3,8 @@ package errors import ( - "bytes" "fmt" + "strings" "github.com/awalterschulze/gographviz/internal/token" ) @@ -20,32 +20,32 @@ type Error struct { StackTop int } -func (E *Error) String() string { - w := new(bytes.Buffer) +func (e *Error) String() string { + w := new(strings.Builder) fmt.Fprintf(w, "Error") - if E.Err != nil { - fmt.Fprintf(w, " %s\n", E.Err) + 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, "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 { + for _, sym := range e.ExpectedTokens { fmt.Fprintf(w, "%s ", sym) } fmt.Fprintf(w, "ErrorSymbol:\n") - for _, sym := range E.ErrorSymbols { + for _, sym := range e.ErrorSymbols { fmt.Fprintf(w, "%v\n", sym) } return w.String() } func (e *Error) Error() string { - w := new(bytes.Buffer) + w := new(strings.Builder) 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()) + fmt.Fprintf(w, ": %+v", e.Err) } else { fmt.Fprintf(w, ", expected one of: ") for _, expected := range e.ExpectedTokens { diff --git a/vendor/github.com/awalterschulze/gographviz/internal/lexer/acttab.go b/vendor/github.com/awalterschulze/gographviz/internal/lexer/acttab.go index 43f05ee3868..99462983aa9 100644 --- a/vendor/github.com/awalterschulze/gographviz/internal/lexer/acttab.go +++ b/vendor/github.com/awalterschulze/gographviz/internal/lexer/acttab.go @@ -15,8 +15,8 @@ type ActionRow struct { Ignore string } -func (this ActionRow) String() string { - return fmt.Sprintf("Accept=%d, Ignore=%s", this.Accept, this.Ignore) +func (a ActionRow) String() string { + return fmt.Sprintf("Accept=%d, Ignore=%s", a.Accept, a.Ignore) } var ActTab = ActionTable{ diff --git a/vendor/github.com/awalterschulze/gographviz/internal/lexer/lexer.go b/vendor/github.com/awalterschulze/gographviz/internal/lexer/lexer.go index e1832a45da6..c967f288681 100644 --- a/vendor/github.com/awalterschulze/gographviz/internal/lexer/lexer.go +++ b/vendor/github.com/awalterschulze/gographviz/internal/lexer/lexer.go @@ -3,11 +3,9 @@ package lexer import ( - // "fmt" "io/ioutil" "unicode/utf8" - // "github.com/awalterschulze/gographviz/internal/util" "github.com/awalterschulze/gographviz/internal/token" ) @@ -42,100 +40,75 @@ func NewLexerFile(fpath string) (*Lexer, error) { return NewLexer(src), nil } -func (this *Lexer) Scan() (tok *token.Token) { - - // fmt.Printf("Lexer.Scan() pos=%d\n", this.pos) - +func (l *Lexer) Scan() (tok *token.Token) { tok = new(token.Token) - if this.pos >= len(this.src) { + if l.pos >= len(l.src) { tok.Type = token.EOF - tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = this.pos, this.line, this.column + tok.Pos.Offset, tok.Pos.Line, tok.Pos.Column = l.pos, l.line, l.column return } - start, startLine, startColumn, end := this.pos, this.line, this.column, 0 + start, startLine, startColumn, end := l.pos, l.line, l.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) { + if l.pos >= len(l.src) { rune1 = -1 } else { - rune1, size = utf8.DecodeRune(this.src[this.pos:]) - this.pos += size + rune1, size = utf8.DecodeRune(l.src[l.pos:]) + l.pos += size } - // Production start + nextState := -1 if rune1 != -1 { - state = TransTab[state](rune1) - } else { - state = -1 + nextState = TransTab[state](rune1) } - // 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 + state = nextState if state != -1 { switch rune1 { case '\n': - this.line++ - this.column = 1 + l.line++ + l.column = 1 case '\r': - this.column = 1 + l.column = 1 case '\t': - this.column += 4 + l.column += 4 default: - this.column++ + l.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 + end = l.pos case ActTab[state].Ignore != "": - // fmt.Printf("\t Ignore(%s)\n", string(act)) - start, startLine, startColumn = this.pos, this.line, this.column + start, startLine, startColumn = l.pos, l.line, l.column state = 0 - if start >= len(this.src) { + if start >= len(l.src) { tok.Type = token.EOF } } } else { if tok.Type == token.INVALID { - end = this.pos + end = l.pos } } } if end > start { - this.pos = end - tok.Lit = this.src[start:end] + l.pos = end + tok.Lit = l.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 +func (l *Lexer) Reset() { + l.pos = 0 } /* @@ -324,5 +297,4 @@ Lexer symbols: 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 index ec29c5d145d..34782b99b41 100644 --- a/vendor/github.com/awalterschulze/gographviz/internal/lexer/transitiontable.go +++ b/vendor/github.com/awalterschulze/gographviz/internal/lexer/transitiontable.go @@ -10,7 +10,6 @@ transitionTable[s](r) returns the next state. type TransitionTable [NumStates]func(rune) int var TransTab = TransitionTable{ - // S0 func(r rune) int { switch { @@ -98,19 +97,15 @@ var TransTab = TransitionTable{ 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 { @@ -128,31 +123,24 @@ var TransTab = TransitionTable{ 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 { @@ -164,21 +152,17 @@ var TransTab = TransitionTable{ 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 { @@ -186,11 +170,9 @@ var TransTab = TransitionTable{ return 38 case r == 47: // ['/','/'] return 39 - } return NoState }, - // S8 func(r rune) int { switch { @@ -198,27 +180,21 @@ var TransTab = TransitionTable{ 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 { @@ -232,19 +208,15 @@ var TransTab = TransitionTable{ 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 { @@ -260,11 +232,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S14 func(r rune) int { switch { @@ -288,11 +258,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S15 func(r rune) int { switch { @@ -316,11 +284,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S16 func(r rune) int { switch { @@ -344,11 +310,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S17 func(r rune) int { switch { @@ -372,11 +336,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S18 func(r rune) int { switch { @@ -404,27 +366,21 @@ var TransTab = TransitionTable{ 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 { @@ -440,11 +396,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S22 func(r rune) int { switch { @@ -464,11 +418,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S23 func(r rune) int { switch { @@ -488,11 +440,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S24 func(r rune) int { switch { @@ -512,11 +462,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S25 func(r rune) int { switch { @@ -536,11 +484,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S26 func(r rune) int { switch { @@ -562,27 +508,21 @@ var TransTab = TransitionTable{ 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 { @@ -598,11 +538,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S30 func(r rune) int { switch { @@ -620,19 +558,15 @@ var TransTab = TransitionTable{ 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 { @@ -650,11 +584,9 @@ var TransTab = TransitionTable{ return 65 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 65 - } return NoState }, - // S33 func(r rune) int { switch { @@ -672,79 +604,61 @@ var TransTab = TransitionTable{ 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 { @@ -758,11 +672,9 @@ var TransTab = TransitionTable{ return 43 case 63 <= r && r <= 255: // ['?',\u00ff] return 41 - } return NoState }, - // S42 func(r rune) int { switch { @@ -772,19 +684,15 @@ var TransTab = TransitionTable{ 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 { @@ -800,11 +708,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S45 func(r rune) int { switch { @@ -824,11 +730,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S46 func(r rune) int { switch { @@ -852,11 +756,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S47 func(r rune) int { switch { @@ -876,11 +778,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S48 func(r rune) int { switch { @@ -900,11 +800,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S49 func(r rune) int { switch { @@ -922,11 +820,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S50 func(r rune) int { switch { @@ -944,11 +840,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S51 func(r rune) int { switch { @@ -968,11 +862,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S52 func(r rune) int { switch { @@ -992,11 +884,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S53 func(r rune) int { switch { @@ -1016,11 +906,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S54 func(r rune) int { switch { @@ -1040,11 +928,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S55 func(r rune) int { switch { @@ -1064,11 +950,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S56 func(r rune) int { switch { @@ -1088,11 +972,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S57 func(r rune) int { switch { @@ -1116,11 +998,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S58 func(r rune) int { switch { @@ -1140,11 +1020,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S59 func(r rune) int { switch { @@ -1162,11 +1040,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S60 func(r rune) int { switch { @@ -1186,11 +1062,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S61 func(r rune) int { switch { @@ -1210,11 +1084,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S62 func(r rune) int { switch { @@ -1234,11 +1106,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S63 func(r rune) int { switch { @@ -1256,11 +1126,9 @@ var TransTab = TransitionTable{ return 33 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 33 - } return NoState }, - // S64 func(r rune) int { switch { @@ -1278,11 +1146,9 @@ var TransTab = TransitionTable{ return 33 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 33 - } return NoState }, - // S65 func(r rune) int { switch { @@ -1300,11 +1166,9 @@ var TransTab = TransitionTable{ return 33 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 33 - } return NoState }, - // S66 func(r rune) int { switch { @@ -1312,23 +1176,18 @@ var TransTab = TransitionTable{ 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 { @@ -1340,11 +1199,9 @@ var TransTab = TransitionTable{ return 90 case 63 <= r && r <= 255: // ['?',\u00ff] return 68 - } return NoState }, - // S69 func(r rune) int { switch { @@ -1364,11 +1221,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S70 func(r rune) int { switch { @@ -1388,11 +1243,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S71 func(r rune) int { switch { @@ -1412,11 +1265,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S72 func(r rune) int { switch { @@ -1436,11 +1287,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S73 func(r rune) int { switch { @@ -1460,11 +1309,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S74 func(r rune) int { switch { @@ -1484,11 +1331,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S75 func(r rune) int { switch { @@ -1508,11 +1353,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S76 func(r rune) int { switch { @@ -1532,11 +1375,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S77 func(r rune) int { switch { @@ -1556,11 +1397,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S78 func(r rune) int { switch { @@ -1580,11 +1419,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S79 func(r rune) int { switch { @@ -1604,11 +1441,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S80 func(r rune) int { switch { @@ -1628,11 +1463,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S81 func(r rune) int { switch { @@ -1656,11 +1489,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S82 func(r rune) int { switch { @@ -1680,11 +1511,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S83 func(r rune) int { switch { @@ -1704,11 +1533,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S84 func(r rune) int { switch { @@ -1728,11 +1555,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S85 func(r rune) int { switch { @@ -1752,11 +1577,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S86 func(r rune) int { switch { @@ -1776,11 +1599,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S87 func(r rune) int { switch { @@ -1800,11 +1621,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S88 func(r rune) int { switch { @@ -1828,19 +1647,15 @@ var TransTab = TransitionTable{ 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 { @@ -1854,11 +1669,9 @@ var TransTab = TransitionTable{ return 43 case 63 <= r && r <= 255: // ['?',\u00ff] return 41 - } return NoState }, - // S91 func(r rune) int { switch { @@ -1876,11 +1689,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S92 func(r rune) int { switch { @@ -1898,11 +1709,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S93 func(r rune) int { switch { @@ -1920,11 +1729,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S94 func(r rune) int { switch { @@ -1940,11 +1747,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S95 func(r rune) int { switch { @@ -1964,11 +1769,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S96 func(r rune) int { switch { @@ -1988,11 +1791,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S97 func(r rune) int { switch { @@ -2008,11 +1809,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S98 func(r rune) int { switch { @@ -2032,11 +1831,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S99 func(r rune) int { switch { @@ -2056,11 +1853,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S100 func(r rune) int { switch { @@ -2080,11 +1875,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S101 func(r rune) int { switch { @@ -2104,11 +1897,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S102 func(r rune) int { switch { @@ -2128,11 +1919,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S103 func(r rune) int { switch { @@ -2150,11 +1939,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S104 func(r rune) int { switch { @@ -2172,11 +1959,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S105 func(r rune) int { switch { @@ -2196,11 +1981,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S106 func(r rune) int { switch { @@ -2220,11 +2003,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S107 func(r rune) int { switch { @@ -2244,11 +2025,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S108 func(r rune) int { switch { @@ -2268,11 +2047,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S109 func(r rune) int { switch { @@ -2292,11 +2069,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S110 func(r rune) int { switch { @@ -2316,11 +2091,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S111 func(r rune) int { switch { @@ -2340,11 +2113,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S112 func(r rune) int { switch { @@ -2360,11 +2131,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S113 func(r rune) int { switch { @@ -2384,11 +2153,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S114 func(r rune) int { switch { @@ -2406,11 +2173,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S115 func(r rune) int { switch { @@ -2430,11 +2195,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S116 func(r rune) int { switch { @@ -2452,11 +2215,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S117 func(r rune) int { switch { @@ -2474,11 +2235,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S118 func(r rune) int { switch { @@ -2498,11 +2257,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S119 func(r rune) int { switch { @@ -2522,11 +2279,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S120 func(r rune) int { switch { @@ -2546,11 +2301,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S121 func(r rune) int { switch { @@ -2568,11 +2321,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S122 func(r rune) int { switch { @@ -2590,11 +2341,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S123 func(r rune) int { switch { @@ -2614,11 +2363,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S124 func(r rune) int { switch { @@ -2638,11 +2385,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S125 func(r rune) int { switch { @@ -2662,11 +2407,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S126 func(r rune) int { switch { @@ -2682,11 +2425,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S127 func(r rune) int { switch { @@ -2706,11 +2447,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S128 func(r rune) int { switch { @@ -2730,11 +2469,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S129 func(r rune) int { switch { @@ -2754,11 +2491,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S130 func(r rune) int { switch { @@ -2778,11 +2513,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S131 func(r rune) int { switch { @@ -2802,11 +2535,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S132 func(r rune) int { switch { @@ -2826,11 +2557,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S133 func(r rune) int { switch { @@ -2850,11 +2579,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S134 func(r rune) int { switch { @@ -2870,11 +2597,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S135 func(r rune) int { switch { @@ -2894,11 +2619,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S136 func(r rune) int { switch { @@ -2918,11 +2641,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S137 func(r rune) int { switch { @@ -2942,11 +2663,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S138 func(r rune) int { switch { @@ -2966,11 +2685,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S139 func(r rune) int { switch { @@ -2990,11 +2707,9 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, - // S140 func(r rune) int { switch { @@ -3010,7 +2725,6 @@ var TransTab = TransitionTable{ return 29 case 65534 <= r && r <= 1114111: // [\ufffe,\U0010ffff] return 29 - } return NoState }, diff --git a/vendor/github.com/awalterschulze/gographviz/internal/parser/parser.go b/vendor/github.com/awalterschulze/gographviz/internal/parser/parser.go index fad5f402462..9a5338f1c29 100644 --- a/vendor/github.com/awalterschulze/gographviz/internal/parser/parser.go +++ b/vendor/github.com/awalterschulze/gographviz/internal/parser/parser.go @@ -3,8 +3,8 @@ package parser import ( - "bytes" "fmt" + "strings" parseError "github.com/awalterschulze/gographviz/internal/errors" "github.com/awalterschulze/gographviz/internal/token" @@ -26,53 +26,59 @@ type stack struct { const iNITIAL_STACK_SIZE = 100 func newStack() *stack { - return &stack{state: make([]int, 0, iNITIAL_STACK_SIZE), + 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 (s *stack) reset() { + s.state = s.state[:0] + s.attrib = s.attrib[:0] } -func (this *stack) push(s int, a Attrib) { - this.state = append(this.state, s) - this.attrib = append(this.attrib, a) +func (s *stack) push(state int, a Attrib) { + s.state = append(s.state, state) + s.attrib = append(s.attrib, a) } -func (this *stack) top() int { - return this.state[len(this.state)-1] +func (s *stack) top() int { + return s.state[len(s.state)-1] } -func (this *stack) peek(pos int) int { - return this.state[pos] +func (s *stack) peek(pos int) int { + return s.state[pos] } -func (this *stack) topIndex() int { - return len(this.state) - 1 +func (s *stack) topIndex() int { + return len(s.state) - 1 } -func (this *stack) popN(items int) []Attrib { - lo, hi := len(this.state)-items, len(this.state) +func (s *stack) popN(items int) []Attrib { + lo, hi := len(s.state)-items, len(s.state) - attrib := this.attrib[lo:hi] + attrib := s.attrib[lo:hi] - this.state = this.state[:lo] - this.attrib = this.attrib[:lo] + s.state = s.state[:lo] + s.attrib = s.attrib[:lo] return attrib } -func (S *stack) String() string { - w := new(bytes.Buffer) +func (s *stack) String() string { + w := new(strings.Builder) fmt.Fprintf(w, "stack:\n") - for i, st := range S.state { - fmt.Fprintf(w, "\t%d:%d , ", i, st) - if S.attrib[i] == nil { + 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]) + switch attr := s.attrib[i].(type) { + case *token.Token: + fmt.Fprintf(w, "%s", attr.Lit) + default: + fmt.Fprintf(w, "%v", attr) + } } fmt.Fprintf(w, "\n") } @@ -97,36 +103,36 @@ func NewParser() *Parser { return p } -func (P *Parser) Reset() { - P.stack.reset() - P.stack.push(0, nil) +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) { +func (p *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib *parseError.Error) { errorAttrib = &parseError.Error{ Err: err, - ErrorToken: P.nextToken, - ErrorSymbols: P.popNonRecoveryStates(), + ErrorToken: p.nextToken, + ErrorSymbols: p.popNonRecoveryStates(), ExpectedTokens: make([]string, 0, 8), } - for t, action := range actionTab[P.stack.top()].actions { + 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 + 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 { + 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 { + 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 } } @@ -134,9 +140,9 @@ func (P *Parser) Error(err error, scanner Scanner) (recovered bool, errorAttrib return } -func (P *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { - if rs, ok := P.firstRecoveryState(); ok { - errorSymbols := P.stack.popN(int(P.stack.topIndex() - rs)) +func (p *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol) { + if rs, ok := p.firstRecoveryState(); ok { + errorSymbols := p.stack.popN(p.stack.topIndex() - rs) removedAttribs = make([]parseError.ErrorSymbol, len(errorSymbols)) for i, e := range errorSymbols { removedAttribs[i] = e @@ -148,22 +154,22 @@ func (P *Parser) popNonRecoveryStates() (removedAttribs []parseError.ErrorSymbol } // 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 +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 + canRecover = actionTab[p.stack.peek(recoveryState)].canRecover } return } -func (P *Parser) newError(err error) error { +func (p *Parser) newError(err error) error { e := &parseError.Error{ Err: err, - StackTop: P.stack.top(), - ErrorToken: P.nextToken, + StackTop: p.stack.top(), + ErrorToken: p.nextToken, } - actRow := actionTab[P.stack.top()] + 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))) @@ -172,37 +178,35 @@ func (P *Parser) newError(err error) error { return e } -func (this *Parser) Parse(scanner Scanner) (res interface{}, err error) { - this.Reset() - this.nextToken = scanner.Scan() +func (p *Parser) Parse(scanner Scanner) (res interface{}, err error) { + p.Reset() + p.nextToken = scanner.Scan() for acc := false; !acc; { - action := actionTab[this.stack.top()].actions[this.nextToken.Type] + action := actionTab[p.stack.top()].actions[p.nextToken.Type] if action == nil { - if recovered, errAttrib := this.Error(nil, scanner); !recovered { - this.nextToken = errAttrib.ErrorToken - return nil, this.newError(nil) + if recovered, errAttrib := p.Error(nil, scanner); !recovered { + p.nextToken = errAttrib.ErrorToken + return nil, p.newError(nil) } - if action = actionTab[this.stack.top()].actions[this.nextToken.Type]; action == nil { + if action = actionTab[p.stack.top()].actions[p.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] + res = p.stack.popN(1)[0] acc = true case shift: - this.stack.push(int(act), this.nextToken) - this.nextToken = scanner.Scan() + p.stack.push(int(act), p.nextToken) + p.nextToken = scanner.Scan() case reduce: prod := productionsTable[int(act)] - attrib, err := prod.ReduceFunc(this.stack.popN(prod.NumSymbols)) + attrib, err := prod.ReduceFunc(p.stack.popN(prod.NumSymbols)) if err != nil { - return nil, this.newError(err) + return nil, p.newError(err) } else { - this.stack.push(gotoTab[this.stack.top()][prod.NTType], attrib) + p.stack.push(gotoTab[p.stack.top()][prod.NTType], attrib) } default: panic("unknown action: " + action.String()) diff --git a/vendor/github.com/awalterschulze/gographviz/internal/token/token.go b/vendor/github.com/awalterschulze/gographviz/internal/token/token.go index b1220168cb5..873fe8e30d7 100644 --- a/vendor/github.com/awalterschulze/gographviz/internal/token/token.go +++ b/vendor/github.com/awalterschulze/gographviz/internal/token/token.go @@ -25,8 +25,8 @@ type Pos struct { Column int } -func (this Pos) String() string { - return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", this.Offset, this.Line, this.Column) +func (p Pos) String() string { + return fmt.Sprintf("Pos(offset=%d, line=%d, column=%d)", p.Offset, p.Line, p.Column) } type TokenMap struct { @@ -34,27 +34,27 @@ type TokenMap struct { idMap map[string]Type } -func (this TokenMap) Id(tok Type) string { - if int(tok) < len(this.typeMap) { - return this.typeMap[tok] +func (m TokenMap) Id(tok Type) string { + if int(tok) < len(m.typeMap) { + return m.typeMap[tok] } return "unknown" } -func (this TokenMap) Type(tok string) Type { - if typ, exist := this.idMap[tok]; exist { +func (m TokenMap) Type(tok string) Type { + if typ, exist := m.idMap[tok]; exist { return typ } return INVALID } -func (this TokenMap) TokenString(tok *Token) string { +func (m 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) + return fmt.Sprintf("%s(%d,%s)", m.Id(tok.Type), tok.Type, tok.Lit) } -func (this TokenMap) StringType(typ Type) string { - return fmt.Sprintf("%s(%d)", this.Id(typ), typ) +func (m TokenMap) StringType(typ Type) string { + return fmt.Sprintf("%s(%d)", m.Id(typ), typ) } var TokMap = TokenMap{ diff --git a/vendor/github.com/awalterschulze/gographviz/nodes.go b/vendor/github.com/awalterschulze/gographviz/nodes.go index 6f0011a359d..960c2fe2685 100644 --- a/vendor/github.com/awalterschulze/gographviz/nodes.go +++ b/vendor/github.com/awalterschulze/gographviz/nodes.go @@ -15,6 +15,7 @@ package gographviz import ( + "fmt" "sort" ) @@ -35,11 +36,27 @@ 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. +// Remove removes a node +func (nodes *Nodes) Remove(name string) error { + for i := 0; i < len(nodes.Nodes); i++ { + if nodes.Nodes[i].Name != name { + continue + } + + nodes.Nodes = append(nodes.Nodes[:i], nodes.Nodes[i+1:]...) + delete(nodes.Lookup, name) + + return nil + } + + return fmt.Errorf("node %s not found", name) +} + +// Add adds a Node to the set of Nodes, extending 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) + n.Attrs.Extend(node.Attrs) return } nodes.Lookup[node.Name] = node diff --git a/vendor/github.com/awalterschulze/gographviz/relations.go b/vendor/github.com/awalterschulze/gographviz/relations.go index 95f1a720b30..64a65b5632c 100644 --- a/vendor/github.com/awalterschulze/gographviz/relations.go +++ b/vendor/github.com/awalterschulze/gographviz/relations.go @@ -42,6 +42,17 @@ func (relations *Relations) Add(parent string, child string) { relations.ChildToParents[child][parent] = true } +// Remove removes relation +func (relations *Relations) Remove(parent string, child string) { + if _, ok := relations.ParentToChildren[parent]; ok { + delete(relations.ParentToChildren[parent], child) + } + + if _, ok := relations.ChildToParents[child]; ok { + delete(relations.ChildToParents[child], parent) + } +} + // SortedChildren returns a list of sorted children of the given parent graph. func (relations *Relations) SortedChildren(parent string) []string { keys := make([]string, 0) diff --git a/vendor/github.com/awalterschulze/gographviz/subgraphs.go b/vendor/github.com/awalterschulze/gographviz/subgraphs.go index 2cc78fb3db7..092de01aa27 100644 --- a/vendor/github.com/awalterschulze/gographviz/subgraphs.go +++ b/vendor/github.com/awalterschulze/gographviz/subgraphs.go @@ -49,6 +49,11 @@ func (subgraphs *SubGraphs) Add(name string) { } } +// Remove removes a subgraph +func (subgraphs *SubGraphs) Remove(name string) { + delete(subgraphs.SubGraphs, name) +} + // Sorted returns a sorted list of SubGraphs. func (subgraphs *SubGraphs) Sorted() []*SubGraph { keys := make([]string, 0)