From a8ff162fa28702067dc3f9f657a6e16def2b0b87 Mon Sep 17 00:00:00 2001 From: Chris Leary Date: Fri, 19 Apr 2024 13:52:41 -0700 Subject: [PATCH] [DSLX:FE][cleanup] Switch from kChannel to kChan to reflect the keyword. PiperOrigin-RevId: 626460923 --- xls/dslx/fmt/ast_fmt.cc | 4 ++-- xls/dslx/frontend/parser.cc | 6 +++--- xls/dslx/frontend/scanner_keywords.inc | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xls/dslx/fmt/ast_fmt.cc b/xls/dslx/fmt/ast_fmt.cc index 92ffa66f95..ff7c725c92 100644 --- a/xls/dslx/fmt/ast_fmt.cc +++ b/xls/dslx/fmt/ast_fmt.cc @@ -267,7 +267,7 @@ DocRef Fmt(const TypeRefTypeAnnotation& n, const Comments& comments, DocRef Fmt(const ChannelTypeAnnotation& n, const Comments& comments, DocArena& arena) { std::vector pieces = { - arena.Make(Keyword::kChannel), + arena.Make(Keyword::kChan), arena.oangle(), Fmt(*n.payload(), comments, arena), arena.cangle(), @@ -750,7 +750,7 @@ DocRef Fmt(const Cast& n, const Comments& comments, DocArena& arena) { DocRef Fmt(const ChannelDecl& n, const Comments& comments, DocArena& arena) { std::vector pieces{ - arena.Make(Keyword::kChannel), + arena.Make(Keyword::kChan), arena.oangle(), Fmt(*n.type(), comments, arena), }; diff --git a/xls/dslx/frontend/parser.cc b/xls/dslx/frontend/parser.cc index 8cf62a8caa..5dab8fcbd5 100644 --- a/xls/dslx/frontend/parser.cc +++ b/xls/dslx/frontend/parser.cc @@ -554,7 +554,7 @@ absl::StatusOr Parser::ParseExpression(Bindings& bindings, if (peek->IsKeyword(Keyword::kUnrollFor)) { return ParseUnrollFor(bindings); } - if (peek->IsKeyword(Keyword::kChannel)) { + if (peek->IsKeyword(Keyword::kChan)) { return ParseChannelDecl(bindings); } if (peek->IsKeyword(Keyword::kSpawn)) { @@ -720,7 +720,7 @@ absl::StatusOr Parser::ParseTypeAnnotation( if (tok.IsTypeKeyword()) { // Builtin types. Pos start_pos = tok.span().start(); - if (tok.GetKeyword() == Keyword::kChannel) { + if (tok.GetKeyword() == Keyword::kChan) { XLS_RETURN_IF_ERROR(DropTokenOrError(TokenKind::kOAngle)); XLS_ASSIGN_OR_RETURN(TypeAnnotation * payload, ParseTypeAnnotation(bindings)); @@ -2467,7 +2467,7 @@ absl::StatusOr Parser::ParseProc(bool is_public, } absl::StatusOr Parser::ParseChannelDecl(Bindings& bindings) { - XLS_ASSIGN_OR_RETURN(Token channel, PopKeywordOrError(Keyword::kChannel)); + XLS_ASSIGN_OR_RETURN(Token channel, PopKeywordOrError(Keyword::kChan)); std::optional> dims = std::nullopt; XLS_RETURN_IF_ERROR(DropTokenOrError(TokenKind::kOAngle)); diff --git a/xls/dslx/frontend/scanner_keywords.inc b/xls/dslx/frontend/scanner_keywords.inc index 40d2e7fcb1..baccca581e 100644 --- a/xls/dslx/frontend/scanner_keywords.inc +++ b/xls/dslx/frontend/scanner_keywords.inc @@ -46,7 +46,7 @@ X(kSN, SN, "sN") \ X(kXN, XN, "xN") \ X(kBool, BOOL, "bool") \ - X(kChannel, CHANNEL, "chan") \ + X(kChan, CHAN, "chan") \ /* unsigned */ \ X(kU1, U1, "u1") \ X(kU2, U2, "u2") \ @@ -320,7 +320,7 @@ X(kSN, SN, "sN") \ X(kXN, XN, "xN") \ X(kBool, BOOL, "bool") \ - X(kChannel, CHANNEL, "chan") \ + X(kChan, CHAN, "chan") \ XLS_DSLX_SIZED_TYPE_KEYWORDS(X) \ /* done */