mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-19 07:20:27 +00:00
Polish out support for reals and strings. (#2593)
Reals were mostly handled, but this PR adds storage of them. It also switches a little towards the FloatingPointType semantic from TokenizedBuffer. While real literals like `1.0` were handled, the type literals were not. This just adds `f64`, similar to how I also only support `i32`. The String type literal wasn't used, so I've added support in lexer and parser. Per discussion with @zygoloid String might be renamed based on the newer type literal plan, but it's still String in explorer and the design, so this is just consistent. The builtin_types.carbon tests the three basic types that are there right now. The test is added to both parser and semantics so that it's clear what the state is in both stages.
This commit is contained in:
1 parent
98041d70c2
commit
22d7cd19ed
40 files changed
+482
-189
No files matched your search
@@ -846,7 +846,8 @@ auto Parser::HandleExpressionInPostfixState() -> void {
|
||||
case TokenKind::StringLiteral:
|
||||
case TokenKind::IntegerTypeLiteral:
|
||||
case TokenKind::UnsignedIntegerTypeLiteral:
|
||||
case TokenKind::FloatingPointTypeLiteral: {
|
||||
case TokenKind::FloatingPointTypeLiteral:
|
||||
case TokenKind::StringTypeLiteral: {
|
||||
AddLeafNode(ParseNodeKind::Literal, Consume());
|
||||
PushState(state);
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user