Skip to content

Commit

Permalink
[DSLX:FE][cleanup] Switch from kChannel to kChan to reflect the keyword.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 626460923
  • Loading branch information
cdleary authored and copybara-github committed Apr 19, 2024
1 parent 035a9aa commit a8ff162
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions xls/dslx/fmt/ast_fmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ DocRef Fmt(const TypeRefTypeAnnotation& n, const Comments& comments,
DocRef Fmt(const ChannelTypeAnnotation& n, const Comments& comments,
DocArena& arena) {
std::vector<DocRef> pieces = {
arena.Make(Keyword::kChannel),
arena.Make(Keyword::kChan),
arena.oangle(),
Fmt(*n.payload(), comments, arena),
arena.cangle(),
Expand Down Expand Up @@ -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<DocRef> pieces{
arena.Make(Keyword::kChannel),
arena.Make(Keyword::kChan),
arena.oangle(),
Fmt(*n.type(), comments, arena),
};
Expand Down
6 changes: 3 additions & 3 deletions xls/dslx/frontend/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ absl::StatusOr<Expr*> 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)) {
Expand Down Expand Up @@ -720,7 +720,7 @@ absl::StatusOr<TypeAnnotation*> 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));
Expand Down Expand Up @@ -2467,7 +2467,7 @@ absl::StatusOr<Proc*> Parser::ParseProc(bool is_public,
}

absl::StatusOr<ChannelDecl*> Parser::ParseChannelDecl(Bindings& bindings) {
XLS_ASSIGN_OR_RETURN(Token channel, PopKeywordOrError(Keyword::kChannel));
XLS_ASSIGN_OR_RETURN(Token channel, PopKeywordOrError(Keyword::kChan));

std::optional<std::vector<Expr*>> dims = std::nullopt;
XLS_RETURN_IF_ERROR(DropTokenOrError(TokenKind::kOAngle));
Expand Down
4 changes: 2 additions & 2 deletions xls/dslx/frontend/scanner_keywords.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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") \
Expand Down Expand Up @@ -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 */

Expand Down

0 comments on commit a8ff162

Please sign in to comment.