[llvm] [NFC][TableGen] Elminate use of isalpha/isdigit from TGLexer (PR #104837)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 07:35:55 PDT 2024


================
@@ -38,6 +38,22 @@ struct PreprocessorDir {
 };
 } // end anonymous namespace
 
+/// Returns true if `C` is a valid character in an identifier. If `Position` is
+/// `First`, returns true if `C` is a valid first character of an identifier,
+/// else returns true if `C` is a valid non-first character of an identifier.
+/// Identifiers match the following regular expression:
+///   [a-zA-Z_][0-9a-zA-Z_]*
+enum IDCharPosition {
+  First = 0,
+  NotFirst = 1,
+};
+
+static bool IsValidIDChar(char C, IDCharPosition Position) {
----------------
jurahul wrote:

Done.

https://github.com/llvm/llvm-project/pull/104837


More information about the llvm-commits mailing list