Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/noirc_frontend/src/hir/comptime/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ impl<'interner> TokenPrettyPrinter<'interner> {
| Token::Slash
| Token::Percent
| Token::Ampersand
| Token::DeprecatedVectorStart
| Token::ShiftLeft
| Token::ShiftRight
| Token::LogicalAnd => {
Expand Down
2 changes: 0 additions & 2 deletions compiler/noirc_frontend/src/lexer/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@
let start = self.position;
self.next_char();
Ok(Token::LogicalAnd.into_span(start, start + 1))
} else if self.peek_char_is('[') {
self.single_char_token(Token::DeprecatedVectorStart)
} else {
self.single_char_token(Token::Ampersand)
}
Expand Down Expand Up @@ -188,7 +186,7 @@
self.next_char();
Err(LexerErrorKind::UnicodeCharacterLooksLikeSpaceButIsItNot { char: ch, location })
}
Some(ch) if Self::is_bidi_control(ch) => Err(LexerErrorKind::BidiControlCharacter {

Check warning on line 189 in compiler/noirc_frontend/src/lexer/lexer.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Bidi)

Check warning on line 189 in compiler/noirc_frontend/src/lexer/lexer.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (bidi)
char: ch,
location: self.location(Span::single_char(self.position)),
}),
Expand Down Expand Up @@ -534,8 +532,8 @@
});
}
},
other if Self::is_bidi_control(other) => {

Check warning on line 535 in compiler/noirc_frontend/src/lexer/lexer.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (bidi)
return Err(LexerErrorKind::BidiControlCharacter {

Check warning on line 536 in compiler/noirc_frontend/src/lexer/lexer.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Bidi)
char: other,
location: self.location(Span::single_char(self.position)),
});
Expand Down Expand Up @@ -624,8 +622,8 @@
found_curly = true;
break;
}
other if Self::is_bidi_control(other) => {

Check warning on line 625 in compiler/noirc_frontend/src/lexer/lexer.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (bidi)
return Err(LexerErrorKind::BidiControlCharacter {

Check warning on line 626 in compiler/noirc_frontend/src/lexer/lexer.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Bidi)
char: other,
location: self.location(Span::single_char(self.position)),
});
Expand Down Expand Up @@ -782,8 +780,8 @@
break;
}
self.next_char();
if Self::is_bidi_control(ch) {

Check warning on line 783 in compiler/noirc_frontend/src/lexer/lexer.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (bidi)
return Err(LexerErrorKind::BidiControlCharacter {

Check warning on line 784 in compiler/noirc_frontend/src/lexer/lexer.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Bidi)
char: ch,
location: self.location(Span::single_char(self.position)),
});
Expand Down Expand Up @@ -913,8 +911,8 @@
location: self.location(Span::single_char(self.position)),
});
}
if Self::is_bidi_control(ch) {

Check warning on line 914 in compiler/noirc_frontend/src/lexer/lexer.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (bidi)
return Err(LexerErrorKind::BidiControlCharacter {

Check warning on line 915 in compiler/noirc_frontend/src/lexer/lexer.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Bidi)
char: ch,
location: self.location(Span::single_char(self.position)),
});
Expand Down
3 changes: 0 additions & 3 deletions compiler/noirc_frontend/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ pub enum Token {
Percent,
/// &
Ampersand,
/// &
DeprecatedVectorStart,
/// @
At,
/// ^
Expand Down Expand Up @@ -388,7 +386,6 @@ impl Display for Token {
Token::Backslash => write!(f, "\\"),
Token::Percent => write!(f, "%"),
Token::Ampersand => write!(f, "&"),
Token::DeprecatedVectorStart => write!(f, "&"),
Token::At => write!(f, "@"),
Token::Caret => write!(f, "^"),
Token::ShiftLeft => write!(f, "<<"),
Expand Down
4 changes: 1 addition & 3 deletions compiler/noirc_frontend/src/parser/parser/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -961,9 +961,7 @@ impl Parser<'_> {

/// VectorExpression = '@' ArrayLiteral
fn parse_vector_literal(&mut self) -> Option<ArrayLiteralOrError> {
if !((self.at(Token::At) || self.at(Token::DeprecatedVectorStart))
&& self.next_is(Token::LeftBracket))
{
if !(self.at(Token::At) && self.next_is(Token::LeftBracket)) {
return None;
}

Expand Down
3 changes: 1 addition & 2 deletions compiler/noirc_frontend/src/parser/parser/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ impl Parser<'_> {
return Some(typ);
}

// The `&` may be lexed as a vector start if this is an array or vector type
if self.eat(Token::Ampersand) || self.eat(Token::DeprecatedVectorStart) {
if self.eat(Token::Ampersand) {
let mutable = self.eat_keyword(Keyword::Mut);

return Some(UnresolvedTypeData::Reference(
Expand Down
1 change: 0 additions & 1 deletion tooling/lsp/src/requests/semantic_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ impl<'args> SemanticTokenCollector<'args> {
| Token::Bang
| Token::DollarSign
| Token::At
| Token::DeprecatedVectorStart
| Token::EOF
| Token::Whitespace(_)
| Token::UnquoteMarker(_)
Expand Down
1 change: 0 additions & 1 deletion tooling/nargo_doc/src/html/colorize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ fn colorize_token(token: &LocatedToken, line: &str, result: &mut String) {
| Token::Backslash
| Token::Percent
| Token::Ampersand
| Token::DeprecatedVectorStart
| Token::At
| Token::Caret
| Token::ShiftLeft
Expand Down
15 changes: 1 addition & 14 deletions tooling/nargo_fmt/src/formatter/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,7 @@ impl ChunkFormatter<'_, '_> {

group.text(self.chunk(|formatter| {
if is_vector {
if formatter.is_at(Token::DeprecatedVectorStart) {
// Support the old vector syntax `&[1, 2, 3]`
formatter.bump();
formatter.write("@");
} else {
formatter.write_token(Token::At);
}
formatter.write_token(Token::At);
}
formatter.write_left_bracket();
}));
Expand Down Expand Up @@ -1573,13 +1567,6 @@ mod tests {
assert_format(src, expected);
}

#[test]
fn format_old_vector_syntax() {
let src = "global x = &[ 1 , 2 , 3 , ] ;";
let expected = "global x = @[1, 2, 3];\n";
assert_format(src, expected);
}

#[test]
fn format_repeated_array() {
let src = "global x = [ 1 ; 3 ] ;";
Expand Down
14 changes: 1 addition & 13 deletions tooling/nargo_fmt/src/formatter/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,7 @@ impl Formatter<'_> {
self.format_generic_type_args(generic_type_args);
}
UnresolvedTypeData::Reference(typ, mutable) => {
// `&` can be represented with Ampersand or VectorStart in the lexer depending
// on whether it's right next to a `[` or not.
match &self.token {
Token::Ampersand => {
self.write_token(Token::Ampersand);
}
Token::DeprecatedVectorStart => {
self.write_token(Token::DeprecatedVectorStart);
}
_ => {
panic!("Expected Ampersand or VectorStart, found {:?}", self.token);
}
}
self.write_token(Token::Ampersand);
if mutable {
self.write_keyword(Keyword::Mut);
self.write_space();
Expand Down
Loading