equal
deleted
inserted
replaced
393 (* pretty_gram *) |
393 (* pretty_gram *) |
394 |
394 |
395 fun pretty_gram (Gram {tags, prods, chains, ...}) = |
395 fun pretty_gram (Gram {tags, prods, chains, ...}) = |
396 let |
396 let |
397 val print_nt = the o Inttab.lookup (Inttab.make (map swap (Symtab.dest tags))); |
397 val print_nt = the o Inttab.lookup (Inttab.make (map swap (Symtab.dest tags))); |
398 fun print_pri p = if p < 0 then "" else Symbol.make_sup ("(" ^ signed_string_of_int p ^ ")"); |
398 fun print_pri p = if p < 0 then "" else Symbol.make_sup ("(" ^ string_of_int p ^ ")"); |
399 |
399 |
400 fun pretty_symb (Terminal (Lexicon.Token (kind, s, _))) = |
400 fun pretty_symb (Terminal (Lexicon.Token (kind, s, _))) = |
401 if kind = Lexicon.Literal then Pretty.quote (Pretty.keyword1 s) else Pretty.str s |
401 if kind = Lexicon.Literal then Pretty.quote (Pretty.keyword1 s) else Pretty.str s |
402 | pretty_symb (Nonterminal (tag, p)) = Pretty.str (print_nt tag ^ print_pri p); |
402 | pretty_symb (Nonterminal (tag, p)) = Pretty.str (print_nt tag ^ print_pri p); |
403 |
403 |