func getParserData(pkg string, prods ast.SyntaxProdList, itemSets *items.ItemSets, symbols *symbols.Symbols, cfg config.Config) *parserData { return &parserData{ Debug: cfg.DebugParser(), ErrorImport: path.Join(pkg, "errors"), TokenImport: path.Join(pkg, "token"), NumProductions: len(prods), NumStates: itemSets.Size(), NumSymbols: symbols.NumSymbols(), } }
func getGotoTableData(itemSets *items.ItemSets, sym *symbols.Symbols) *gotoTableData { data := &gotoTableData{ NumNTSymbols: sym.NumNTSymbols(), Rows: make([]string, itemSets.Size()), } for i, set := range itemSets.List() { data.Rows[i] = genGotoRow(set, sym) } return data }
func getActionTableData(prods ast.SyntaxProdList, itemSets *items.ItemSets, tokMap *token.TokenMap) (actTab *actionTableData, conflicts map[int]items.RowConflicts) { actTab = &actionTableData{ Rows: make([]string, itemSets.Size()), } conflicts = make(map[int]items.RowConflicts) row, cnflcts := "", items.RowConflicts{} for i := range actTab.Rows { if row, cnflcts = genActionRow(prods, itemSets.Set(i), tokMap); len(cnflcts) > 0 { conflicts[i] = cnflcts } actTab.Rows[i] = row } return }