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