Enhance the type system to support arbitrary precision integers, which are
important for low-bitwidth inference cases and hardware synthesis targets.

Rename 'int' to 'affineint' to avoid confusion between "the integers" and "the int
type".

PiperOrigin-RevId: 202751508
diff --git a/lib/Parser/Lexer.cpp b/lib/Parser/Lexer.cpp
index 17755e0..8943200 100644
--- a/lib/Parser/Lexer.cpp
+++ b/lib/Parser/Lexer.cpp
@@ -140,6 +140,7 @@
 /// Lex a bare identifier or keyword that starts with a letter.
 ///
 ///   bare-id ::= letter (letter|digit|[_])*
+///   integer-type ::= `i[1-9][0-9]*`
 ///
 Token Lexer::lexBareIdentifierOrKeyword(const char *tokStart) {
   // Match the rest of the identifier regex: [0-9a-zA-Z_]*
@@ -149,6 +150,15 @@
   // Check to see if this identifier is a keyword.
   StringRef spelling(tokStart, curPtr-tokStart);
 
+  // Check for i123.
+  if (tokStart[0] == 'i') {
+    bool allDigits = true;
+    for (auto c : spelling.drop_front())
+      allDigits &= isdigit(c) != 0;
+    if (allDigits && spelling.size() != 1)
+      return Token(Token::inttype, spelling);
+  }
+
   Token::Kind kind = llvm::StringSwitch<Token::Kind>(spelling)
 #define TOK_KEYWORD(SPELLING) \
     .Case(#SPELLING, Token::kw_##SPELLING)