[PATCH] D128795: [pseudo] Reimplement hardcoded error handling as a recovery strategy. NFC

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 06:39:22 PDT 2022


hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/pseudo/include/clang-pseudo/grammar/Grammar.h:89
 // FIXME: these should be provided as extensions instead.
-enum class RecoveryStrategy : uint8_t { None, Braces };
+enum class RecoveryStrategy : uint8_t { None, Braces, Eof };
 
----------------
I think there should be some documentation for the strategies here. (do you plan to add them when the above FIXME is fixed?)


================
Comment at: clang-tools-extra/pseudo/lib/grammar/GrammarBNF.cpp:122
+      // This ensures the overall parse never fails.
+      if (T->Nonterminals[Rule.Target].Name == "_") {
+        Rule.Recovery = RecoveryStrategy::Eof;
----------------
nit: use the `StartSymbol` global variable (we might want to rename it to `Underscore`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128795



More information about the cfe-commits mailing list