[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 12:57:17 PST 2025


================
@@ -0,0 +1,166 @@
+#include "clang/Parse/ParseHLSLRootSignature.h"
+
+namespace clang {
+namespace hlsl {
+
+// Lexer Definitions
+
+static bool IsNumberChar(char C) {
+  // TODO(#126565): extend for float support exponents
+  return isdigit(C); // integer support
+}
+
+bool RootSignatureLexer::LexNumber(RootSignatureToken &Result) {
+  // Retrieve the possible number
+  StringRef NumSpelling = Buffer.take_while(IsNumberChar);
----------------
llvm-beanz wrote:

If I'm reading this correctly right now if someone writes `1.3` the parser will break the token at the `.`, call it an integer literal and return `1` for the value. I assume that's not the expected behavior?

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


More information about the cfe-commits mailing list