Add parsing for floating point attributes.
This is doing it in a suboptimal manner by recombining [integer period literal] into a string literal and parsing that via to_float.
PiperOrigin-RevId: 206855106
diff --git a/lib/Parser/Token.h b/lib/Parser/Token.h
index 670bd94..4e3b831 100644
--- a/lib/Parser/Token.h
+++ b/lib/Parser/Token.h
@@ -80,6 +80,10 @@
/// return None.
Optional<uint64_t> getUInt64IntegerValue() const;
+ /// For a floatliteral token, return its value as a double. Returns None in
+ /// the case of underflow or overflow.
+ Optional<double> getFloatingPointValue() const;
+
/// For an inttype token, return its bitwidth.
Optional<unsigned> getIntTypeBitwidth() const;
@@ -115,4 +119,3 @@
} // end namespace mlir
#endif // MLIR_LIB_PARSER_TOKEN_H
-