| `Keyword s
| `Number s -> s)
+let pp_assoc =
+ function
+ | Gramext.NonA -> "N"
+ | Gramext.LeftA -> "L"
+ | Gramext.RightA -> "R"
+
let rec pp_term ?(pp_parens = true) t =
let t_pp =
match t with
(String.concat ";"
(List.map (fun (_, n, v) -> sprintf "%s=%s" n v) attrs))
(pp_term ~pp_parens:false term)
- | Ast.AttributedTerm (_, term) when debug_printing ->
+ | Ast.AttributedTerm (`Level (prec, assoc), term) when debug_printing ->
+ sprintf "L(%d%s)[%s]" prec (pp_assoc assoc)
+ (pp_term ~pp_parens:false term)
+ | Ast.AttributedTerm (`Raw _, term) when debug_printing ->
+ sprintf "R[%s]" (pp_term ~pp_parens:false term)
+ | Ast.AttributedTerm (`Loc _, term) when debug_printing ->
sprintf "@[%s]" (pp_term ~pp_parens:false term)
+
| Ast.AttributedTerm (`Raw text, _) -> text
| Ast.AttributedTerm (_, term) -> pp_term ~pp_parens:false term