gonum.org/v1/gonum@v0.14.0/graph/formats/dot/internal/parser/productionstable.go (about) 1 // Code generated by gocc; DO NOT EDIT. 2 3 // This file is dual licensed under CC0 and The Gonum License. 4 // 5 // Copyright ©2017 The Gonum Authors. All rights reserved. 6 // Use of this source code is governed by a BSD-style 7 // license that can be found in the LICENSE file. 8 // 9 // Copyright ©2017 Robin Eklind. 10 // This file is made available under a Creative Commons CC0 1.0 11 // Universal Public Domain Dedication. 12 13 package parser 14 15 import ( 16 "gonum.org/v1/gonum/graph/formats/dot/ast" 17 "gonum.org/v1/gonum/graph/formats/dot/internal/astx" 18 ) 19 20 type ( 21 ProdTab [numProductions]ProdTabEntry 22 ProdTabEntry struct { 23 String string 24 Id string 25 NTType int 26 Index int 27 NumSymbols int 28 ReduceFunc func([]Attrib, interface{}) (Attrib, error) 29 } 30 Attrib interface { 31 } 32 ) 33 34 var productionsTable = ProdTab{ 35 ProdTabEntry{ 36 String: `S' : File << >>`, 37 Id: "S'", 38 NTType: 0, 39 Index: 0, 40 NumSymbols: 1, 41 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 42 return X[0], nil 43 }, 44 }, 45 ProdTabEntry{ 46 String: `File : Graph << astx.NewFile(X[0]) >>`, 47 Id: "File", 48 NTType: 1, 49 Index: 1, 50 NumSymbols: 1, 51 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 52 return astx.NewFile(X[0]) 53 }, 54 }, 55 ProdTabEntry{ 56 String: `File : File Graph << astx.AppendGraph(X[0], X[1]) >>`, 57 Id: "File", 58 NTType: 1, 59 Index: 2, 60 NumSymbols: 2, 61 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 62 return astx.AppendGraph(X[0], X[1]) 63 }, 64 }, 65 ProdTabEntry{ 66 String: `Graph : OptStrict DirectedGraph OptID "{" OptStmtList "}" << astx.NewGraph(X[0], X[1], X[2], X[4]) >>`, 67 Id: "Graph", 68 NTType: 2, 69 Index: 3, 70 NumSymbols: 6, 71 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 72 return astx.NewGraph(X[0], X[1], X[2], X[4]) 73 }, 74 }, 75 ProdTabEntry{ 76 String: `OptStrict : empty << false, nil >>`, 77 Id: "OptStrict", 78 NTType: 3, 79 Index: 4, 80 NumSymbols: 0, 81 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 82 return false, nil 83 }, 84 }, 85 ProdTabEntry{ 86 String: `OptStrict : strict << true, nil >>`, 87 Id: "OptStrict", 88 NTType: 3, 89 Index: 5, 90 NumSymbols: 1, 91 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 92 return true, nil 93 }, 94 }, 95 ProdTabEntry{ 96 String: `DirectedGraph : graphx << false, nil >>`, 97 Id: "DirectedGraph", 98 NTType: 4, 99 Index: 6, 100 NumSymbols: 1, 101 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 102 return false, nil 103 }, 104 }, 105 ProdTabEntry{ 106 String: `DirectedGraph : digraph << true, nil >>`, 107 Id: "DirectedGraph", 108 NTType: 4, 109 Index: 7, 110 NumSymbols: 1, 111 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 112 return true, nil 113 }, 114 }, 115 ProdTabEntry{ 116 String: `StmtList : Stmt OptSemi << astx.NewStmtList(X[0]) >>`, 117 Id: "StmtList", 118 NTType: 5, 119 Index: 8, 120 NumSymbols: 2, 121 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 122 return astx.NewStmtList(X[0]) 123 }, 124 }, 125 ProdTabEntry{ 126 String: `StmtList : StmtList Stmt OptSemi << astx.AppendStmt(X[0], X[1]) >>`, 127 Id: "StmtList", 128 NTType: 5, 129 Index: 9, 130 NumSymbols: 3, 131 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 132 return astx.AppendStmt(X[0], X[1]) 133 }, 134 }, 135 ProdTabEntry{ 136 String: `OptStmtList : empty << >>`, 137 Id: "OptStmtList", 138 NTType: 6, 139 Index: 10, 140 NumSymbols: 0, 141 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 142 return nil, nil 143 }, 144 }, 145 ProdTabEntry{ 146 String: `OptStmtList : StmtList << >>`, 147 Id: "OptStmtList", 148 NTType: 6, 149 Index: 11, 150 NumSymbols: 1, 151 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 152 return X[0], nil 153 }, 154 }, 155 ProdTabEntry{ 156 String: `Stmt : NodeStmt << >>`, 157 Id: "Stmt", 158 NTType: 7, 159 Index: 12, 160 NumSymbols: 1, 161 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 162 return X[0], nil 163 }, 164 }, 165 ProdTabEntry{ 166 String: `Stmt : EdgeStmt << >>`, 167 Id: "Stmt", 168 NTType: 7, 169 Index: 13, 170 NumSymbols: 1, 171 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 172 return X[0], nil 173 }, 174 }, 175 ProdTabEntry{ 176 String: `Stmt : AttrStmt << >>`, 177 Id: "Stmt", 178 NTType: 7, 179 Index: 14, 180 NumSymbols: 1, 181 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 182 return X[0], nil 183 }, 184 }, 185 ProdTabEntry{ 186 String: `Stmt : Attr << >>`, 187 Id: "Stmt", 188 NTType: 7, 189 Index: 15, 190 NumSymbols: 1, 191 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 192 return X[0], nil 193 }, 194 }, 195 ProdTabEntry{ 196 String: `Stmt : Subgraph << >>`, 197 Id: "Stmt", 198 NTType: 7, 199 Index: 16, 200 NumSymbols: 1, 201 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 202 return X[0], nil 203 }, 204 }, 205 ProdTabEntry{ 206 String: `OptSemi : empty << >>`, 207 Id: "OptSemi", 208 NTType: 8, 209 Index: 17, 210 NumSymbols: 0, 211 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 212 return nil, nil 213 }, 214 }, 215 ProdTabEntry{ 216 String: `OptSemi : ";" << >>`, 217 Id: "OptSemi", 218 NTType: 8, 219 Index: 18, 220 NumSymbols: 1, 221 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 222 return X[0], nil 223 }, 224 }, 225 ProdTabEntry{ 226 String: `NodeStmt : Node OptAttrList << astx.NewNodeStmt(X[0], X[1]) >>`, 227 Id: "NodeStmt", 228 NTType: 9, 229 Index: 19, 230 NumSymbols: 2, 231 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 232 return astx.NewNodeStmt(X[0], X[1]) 233 }, 234 }, 235 ProdTabEntry{ 236 String: `EdgeStmt : Vertex Edge OptAttrList << astx.NewEdgeStmt(X[0], X[1], X[2]) >>`, 237 Id: "EdgeStmt", 238 NTType: 10, 239 Index: 20, 240 NumSymbols: 3, 241 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 242 return astx.NewEdgeStmt(X[0], X[1], X[2]) 243 }, 244 }, 245 ProdTabEntry{ 246 String: `Edge : DirectedEdge Vertex OptEdge << astx.NewEdge(X[0], X[1], X[2]) >>`, 247 Id: "Edge", 248 NTType: 11, 249 Index: 21, 250 NumSymbols: 3, 251 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 252 return astx.NewEdge(X[0], X[1], X[2]) 253 }, 254 }, 255 ProdTabEntry{ 256 String: `DirectedEdge : "--" << false, nil >>`, 257 Id: "DirectedEdge", 258 NTType: 12, 259 Index: 22, 260 NumSymbols: 1, 261 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 262 return false, nil 263 }, 264 }, 265 ProdTabEntry{ 266 String: `DirectedEdge : "->" << true, nil >>`, 267 Id: "DirectedEdge", 268 NTType: 12, 269 Index: 23, 270 NumSymbols: 1, 271 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 272 return true, nil 273 }, 274 }, 275 ProdTabEntry{ 276 String: `OptEdge : empty << >>`, 277 Id: "OptEdge", 278 NTType: 13, 279 Index: 24, 280 NumSymbols: 0, 281 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 282 return nil, nil 283 }, 284 }, 285 ProdTabEntry{ 286 String: `OptEdge : Edge << >>`, 287 Id: "OptEdge", 288 NTType: 13, 289 Index: 25, 290 NumSymbols: 1, 291 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 292 return X[0], nil 293 }, 294 }, 295 ProdTabEntry{ 296 String: `AttrStmt : Component AttrList << astx.NewAttrStmt(X[0], X[1]) >>`, 297 Id: "AttrStmt", 298 NTType: 14, 299 Index: 26, 300 NumSymbols: 2, 301 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 302 return astx.NewAttrStmt(X[0], X[1]) 303 }, 304 }, 305 ProdTabEntry{ 306 String: `Component : graphx << ast.GraphKind, nil >>`, 307 Id: "Component", 308 NTType: 15, 309 Index: 27, 310 NumSymbols: 1, 311 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 312 return ast.GraphKind, nil 313 }, 314 }, 315 ProdTabEntry{ 316 String: `Component : node << ast.NodeKind, nil >>`, 317 Id: "Component", 318 NTType: 15, 319 Index: 28, 320 NumSymbols: 1, 321 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 322 return ast.NodeKind, nil 323 }, 324 }, 325 ProdTabEntry{ 326 String: `Component : edge << ast.EdgeKind, nil >>`, 327 Id: "Component", 328 NTType: 15, 329 Index: 29, 330 NumSymbols: 1, 331 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 332 return ast.EdgeKind, nil 333 }, 334 }, 335 ProdTabEntry{ 336 String: `AttrList : "[" OptAList "]" << X[1], nil >>`, 337 Id: "AttrList", 338 NTType: 16, 339 Index: 30, 340 NumSymbols: 3, 341 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 342 return X[1], nil 343 }, 344 }, 345 ProdTabEntry{ 346 String: `AttrList : AttrList "[" OptAList "]" << astx.AppendAttrList(X[0], X[2]) >>`, 347 Id: "AttrList", 348 NTType: 16, 349 Index: 31, 350 NumSymbols: 4, 351 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 352 return astx.AppendAttrList(X[0], X[2]) 353 }, 354 }, 355 ProdTabEntry{ 356 String: `OptAttrList : empty << >>`, 357 Id: "OptAttrList", 358 NTType: 17, 359 Index: 32, 360 NumSymbols: 0, 361 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 362 return nil, nil 363 }, 364 }, 365 ProdTabEntry{ 366 String: `OptAttrList : AttrList << >>`, 367 Id: "OptAttrList", 368 NTType: 17, 369 Index: 33, 370 NumSymbols: 1, 371 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 372 return X[0], nil 373 }, 374 }, 375 ProdTabEntry{ 376 String: `AList : Attr OptSep << astx.NewAttrList(X[0]) >>`, 377 Id: "AList", 378 NTType: 18, 379 Index: 34, 380 NumSymbols: 2, 381 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 382 return astx.NewAttrList(X[0]) 383 }, 384 }, 385 ProdTabEntry{ 386 String: `AList : AList Attr OptSep << astx.AppendAttr(X[0], X[1]) >>`, 387 Id: "AList", 388 NTType: 18, 389 Index: 35, 390 NumSymbols: 3, 391 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 392 return astx.AppendAttr(X[0], X[1]) 393 }, 394 }, 395 ProdTabEntry{ 396 String: `OptAList : empty << >>`, 397 Id: "OptAList", 398 NTType: 19, 399 Index: 36, 400 NumSymbols: 0, 401 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 402 return nil, nil 403 }, 404 }, 405 ProdTabEntry{ 406 String: `OptAList : AList << >>`, 407 Id: "OptAList", 408 NTType: 19, 409 Index: 37, 410 NumSymbols: 1, 411 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 412 return X[0], nil 413 }, 414 }, 415 ProdTabEntry{ 416 String: `OptSep : empty << >>`, 417 Id: "OptSep", 418 NTType: 20, 419 Index: 38, 420 NumSymbols: 0, 421 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 422 return nil, nil 423 }, 424 }, 425 ProdTabEntry{ 426 String: `OptSep : ";" << >>`, 427 Id: "OptSep", 428 NTType: 20, 429 Index: 39, 430 NumSymbols: 1, 431 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 432 return X[0], nil 433 }, 434 }, 435 ProdTabEntry{ 436 String: `OptSep : "," << >>`, 437 Id: "OptSep", 438 NTType: 20, 439 Index: 40, 440 NumSymbols: 1, 441 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 442 return X[0], nil 443 }, 444 }, 445 ProdTabEntry{ 446 String: `Attr : ID "=" ID << astx.NewAttr(X[0], X[2]) >>`, 447 Id: "Attr", 448 NTType: 21, 449 Index: 41, 450 NumSymbols: 3, 451 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 452 return astx.NewAttr(X[0], X[2]) 453 }, 454 }, 455 ProdTabEntry{ 456 String: `Subgraph : OptSubgraphID "{" OptStmtList "}" << astx.NewSubgraph(X[0], X[2]) >>`, 457 Id: "Subgraph", 458 NTType: 22, 459 Index: 42, 460 NumSymbols: 4, 461 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 462 return astx.NewSubgraph(X[0], X[2]) 463 }, 464 }, 465 ProdTabEntry{ 466 String: `OptSubgraphID : empty << >>`, 467 Id: "OptSubgraphID", 468 NTType: 23, 469 Index: 43, 470 NumSymbols: 0, 471 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 472 return nil, nil 473 }, 474 }, 475 ProdTabEntry{ 476 String: `OptSubgraphID : subgraph OptID << X[1], nil >>`, 477 Id: "OptSubgraphID", 478 NTType: 23, 479 Index: 44, 480 NumSymbols: 2, 481 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 482 return X[1], nil 483 }, 484 }, 485 ProdTabEntry{ 486 String: `Vertex : Node << >>`, 487 Id: "Vertex", 488 NTType: 24, 489 Index: 45, 490 NumSymbols: 1, 491 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 492 return X[0], nil 493 }, 494 }, 495 ProdTabEntry{ 496 String: `Vertex : Subgraph << >>`, 497 Id: "Vertex", 498 NTType: 24, 499 Index: 46, 500 NumSymbols: 1, 501 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 502 return X[0], nil 503 }, 504 }, 505 ProdTabEntry{ 506 String: `Node : ID OptPort << astx.NewNode(X[0], X[1]) >>`, 507 Id: "Node", 508 NTType: 25, 509 Index: 47, 510 NumSymbols: 2, 511 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 512 return astx.NewNode(X[0], X[1]) 513 }, 514 }, 515 ProdTabEntry{ 516 String: `Port : ":" ID << astx.NewPort(X[1], nil) >>`, 517 Id: "Port", 518 NTType: 26, 519 Index: 48, 520 NumSymbols: 2, 521 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 522 return astx.NewPort(X[1], nil) 523 }, 524 }, 525 ProdTabEntry{ 526 String: `Port : ":" ID ":" ID << astx.NewPort(X[1], X[3]) >>`, 527 Id: "Port", 528 NTType: 26, 529 Index: 49, 530 NumSymbols: 4, 531 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 532 return astx.NewPort(X[1], X[3]) 533 }, 534 }, 535 ProdTabEntry{ 536 String: `OptPort : empty << >>`, 537 Id: "OptPort", 538 NTType: 27, 539 Index: 50, 540 NumSymbols: 0, 541 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 542 return nil, nil 543 }, 544 }, 545 ProdTabEntry{ 546 String: `OptPort : Port << >>`, 547 Id: "OptPort", 548 NTType: 27, 549 Index: 51, 550 NumSymbols: 1, 551 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 552 return X[0], nil 553 }, 554 }, 555 ProdTabEntry{ 556 String: `ID : id << astx.NewID(X[0]) >>`, 557 Id: "ID", 558 NTType: 28, 559 Index: 52, 560 NumSymbols: 1, 561 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 562 return astx.NewID(X[0]) 563 }, 564 }, 565 ProdTabEntry{ 566 String: `OptID : empty << "", nil >>`, 567 Id: "OptID", 568 NTType: 29, 569 Index: 53, 570 NumSymbols: 0, 571 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 572 return "", nil 573 }, 574 }, 575 ProdTabEntry{ 576 String: `OptID : ID << >>`, 577 Id: "OptID", 578 NTType: 29, 579 Index: 54, 580 NumSymbols: 1, 581 ReduceFunc: func(X []Attrib, C interface{}) (Attrib, error) { 582 return X[0], nil 583 }, 584 }, 585 }