aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/grammar.ron
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-14 20:58:20 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-14 20:58:20 +0000
commite8e82ce032f8678929b015e6f70ac060bb2cf94c (patch)
tree9fb158e9f7115bb70cf2b8623b70710c55497ed4 /crates/ra_syntax/src/grammar.ron
parent784ff638e549a27503b719e5c2f0009b40d25364 (diff)
parent37ba237e6686d94783d1f025d23823ad7c0cb0c8 (diff)
Merge #485
485: Add type inference for a bunch of primitives r=flodiebold a=marcusklaas This PR adds inference for `&str`, `&[u8]`, `char`, `bool`, floats and integers. For floats and integers it uses type variables to infer the exact type, i.e. `u32`, from context when it's not annotated explicitly. I'm not quite happy with the implementation yet, but I think it mostly works now. Co-authored-by: Marcus Klaas de Vries <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/grammar.ron')
-rw-r--r--crates/ra_syntax/src/grammar.ron23
1 files changed, 22 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index dfd88bd10..bd8c5b411 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -426,11 +426,32 @@ Grammar(
426 "PrefixExpr": (options: ["Expr"]), 426 "PrefixExpr": (options: ["Expr"]),
427 "RangeExpr": (), 427 "RangeExpr": (),
428 "BinExpr": (), 428 "BinExpr": (),
429
430 "IntNumber": ( traits: ["AstToken"] ),
431 "FloatNumber": ( traits: ["AstToken"] ),
429 "String": ( traits: ["AstToken"] ), 432 "String": ( traits: ["AstToken"] ),
433 "RawString": ( traits: ["AstToken"] ),
430 "Byte": ( traits: ["AstToken"] ), 434 "Byte": ( traits: ["AstToken"] ),
435 "RawByteString": ( traits: ["AstToken"] ),
431 "ByteString": ( traits: ["AstToken"] ), 436 "ByteString": ( traits: ["AstToken"] ),
432 "Char": ( traits: ["AstToken"] ), 437 "Char": ( traits: ["AstToken"] ),
433 "Literal": (), 438 "TrueKw": ( traits: ["AstToken"] ),
439 "FalseKw": ( traits: ["AstToken"] ),
440 "LiteralExpr": (
441 enum: [
442 "String",
443 "ByteString",
444 "RawString",
445 "RawByteString",
446 "Char",
447 "Byte",
448 "IntNumber",
449 "FloatNumber",
450 "TrueKw",
451 "FalseKw",
452 ]
453 ),
454 "Literal": (options: ["LiteralExpr"]),
434 455
435 "Expr": ( 456 "Expr": (
436 enum: [ 457 enum: [