[PATCH] D120724: [pseudo] Add a print-grammar option in the tool

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 2 01:06:17 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7f99e1870f77: [pseudo] Add a print-grammar option in the tool (authored by hokein).
Herald added a project: All.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120724/new/

https://reviews.llvm.org/D120724

Files:
  clang/tools/clang-pseudo/ClangPseudo.cpp


Index: clang/tools/clang-pseudo/ClangPseudo.cpp
===================================================================
--- clang/tools/clang-pseudo/ClangPseudo.cpp
+++ clang/tools/clang-pseudo/ClangPseudo.cpp
@@ -24,6 +24,7 @@
 
 static opt<std::string>
     Grammar("grammar", desc("Parse and check a BNF grammar file."), init(""));
+static opt<bool> PrintGrammar("print-grammar", desc("Print the grammar."));
 static opt<bool> PrintGraph("print-graph",
                             desc("Print the LR graph for the grammar"));
 static opt<bool> PrintTable("print-table",
@@ -60,6 +61,8 @@
     }
     llvm::outs() << llvm::formatv("grammar file {0} is parsed successfully\n",
                                   Grammar);
+    if (PrintGrammar)
+      llvm::outs() << G->dump();
     if (PrintGraph)
       llvm::outs() << clang::syntax::pseudo::LRGraph::buildLR0(*G).dumpForTests(
           *G);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120724.412345.patch
Type: text/x-patch
Size: 896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220302/40931f2c/attachment-0001.bin>


More information about the cfe-commits mailing list