| ... | @@ -255,39 +255,39 @@ pub const Error = union(enum) { | ... | @@ -255,39 +255,39 @@ pub const Error = union(enum) { |
| 255 | } | 255 | } |
| 256 | } | 256 | } |
| 257 | | 257 | |
| 258 | pub const InvalidToken = SingleTokenError("Invalid token {}"); | 258 | pub const InvalidToken = SingleTokenError("Invalid token '{}'"); |
| 259 | pub const ExpectedContainerMembers = SingleTokenError("Expected test, comptime, var decl, or container field, found {}"); | 259 | pub const ExpectedContainerMembers = SingleTokenError("Expected test, comptime, var decl, or container field, found '{}'"); |
| 260 | pub const ExpectedStringLiteral = SingleTokenError("Expected string literal, found {}"); | 260 | pub const ExpectedStringLiteral = SingleTokenError("Expected string literal, found '{}'"); |
| 261 | pub const ExpectedIntegerLiteral = SingleTokenError("Expected integer literal, found {}"); | 261 | pub const ExpectedIntegerLiteral = SingleTokenError("Expected integer literal, found '{}'"); |
| 262 | pub const ExpectedIdentifier = SingleTokenError("Expected identifier, found {}"); | 262 | pub const ExpectedIdentifier = SingleTokenError("Expected identifier, found '{}'"); |
| 263 | pub const ExpectedStatement = SingleTokenError("Expected statement, found {}"); | 263 | pub const ExpectedStatement = SingleTokenError("Expected statement, found '{}'"); |
| 264 | pub const ExpectedVarDeclOrFn = SingleTokenError("Expected variable declaration or function, found {}"); | 264 | pub const ExpectedVarDeclOrFn = SingleTokenError("Expected variable declaration or function, found '{}'"); |
| 265 | pub const ExpectedVarDecl = SingleTokenError("Expected variable declaration, found {}"); | 265 | pub const ExpectedVarDecl = SingleTokenError("Expected variable declaration, found '{}'"); |
| 266 | pub const ExpectedReturnType = SingleTokenError("Expected 'var' or return type expression, found {}"); | 266 | pub const ExpectedReturnType = SingleTokenError("Expected 'var' or return type expression, found '{}'"); |
| 267 | pub const ExpectedAggregateKw = SingleTokenError("Expected " ++ @tagName(Token.Id.Keyword_struct) ++ ", " ++ @tagName(Token.Id.Keyword_union) ++ ", or " ++ @tagName(Token.Id.Keyword_enum) ++ ", found {}"); | 267 | pub const ExpectedAggregateKw = SingleTokenError("Expected '" ++ Token.Id.Keyword_struct.symbol() ++ "', '" ++ Token.Id.Keyword_union.symbol() ++ "', or '" ++ Token.Id.Keyword_enum.symbol() ++ "', found '{}'"); |
| 268 | pub const ExpectedEqOrSemi = SingleTokenError("Expected '=' or ';', found {}"); | 268 | pub const ExpectedEqOrSemi = SingleTokenError("Expected '=' or ';', found '{}'"); |
| 269 | pub const ExpectedSemiOrLBrace = SingleTokenError("Expected ';' or '{{', found {}"); | 269 | pub const ExpectedSemiOrLBrace = SingleTokenError("Expected ';' or '{{', found '{}'"); |
| 270 | pub const ExpectedSemiOrElse = SingleTokenError("Expected ';' or 'else', found {}"); | 270 | pub const ExpectedSemiOrElse = SingleTokenError("Expected ';' or 'else', found '{}'"); |
| 271 | pub const ExpectedLBrace = SingleTokenError("Expected '{{', found {}"); | 271 | pub const ExpectedLBrace = SingleTokenError("Expected '{{', found '{}'"); |
| 272 | pub const ExpectedLabelOrLBrace = SingleTokenError("Expected label or '{{', found {}"); | 272 | pub const ExpectedLabelOrLBrace = SingleTokenError("Expected label or '{{', found '{}'"); |
| 273 | pub const ExpectedColonOrRParen = SingleTokenError("Expected ':' or ')', found {}"); | 273 | pub const ExpectedColonOrRParen = SingleTokenError("Expected ':' or ')', found '{}'"); |
| 274 | pub const ExpectedLabelable = SingleTokenError("Expected 'while', 'for', 'inline', 'suspend', or '{{', found {}"); | 274 | pub const ExpectedLabelable = SingleTokenError("Expected 'while', 'for', 'inline', 'suspend', or '{{', found '{}'"); |
| 275 | pub const ExpectedInlinable = SingleTokenError("Expected 'while' or 'for', found {}"); | 275 | pub const ExpectedInlinable = SingleTokenError("Expected 'while' or 'for', found '{}'"); |
| 276 | pub const ExpectedAsmOutputReturnOrType = SingleTokenError("Expected '->' or " ++ @tagName(Token.Id.Identifier) ++ ", found {}"); | 276 | pub const ExpectedAsmOutputReturnOrType = SingleTokenError("Expected '->' or '" ++ Token.Id.Identifier.symbol() ++ "', found '{}'"); |
| 277 | pub const ExpectedSliceOrRBracket = SingleTokenError("Expected ']' or '..', found {}"); | 277 | pub const ExpectedSliceOrRBracket = SingleTokenError("Expected ']' or '..', found '{}'"); |
| 278 | pub const ExpectedTypeExpr = SingleTokenError("Expected type expression, found {}"); | 278 | pub const ExpectedTypeExpr = SingleTokenError("Expected type expression, found '{}'"); |
| 279 | pub const ExpectedPrimaryTypeExpr = SingleTokenError("Expected primary type expression, found {}"); | 279 | pub const ExpectedPrimaryTypeExpr = SingleTokenError("Expected primary type expression, found '{}'"); |
| 280 | pub const ExpectedExpr = SingleTokenError("Expected expression, found {}"); | 280 | pub const ExpectedExpr = SingleTokenError("Expected expression, found '{}'"); |
| 281 | pub const ExpectedPrimaryExpr = SingleTokenError("Expected primary expression, found {}"); | 281 | pub const ExpectedPrimaryExpr = SingleTokenError("Expected primary expression, found '{}'"); |
| 282 | pub const ExpectedParamList = SingleTokenError("Expected parameter list, found {}"); | 282 | pub const ExpectedParamList = SingleTokenError("Expected parameter list, found '{}'"); |
| 283 | pub const ExpectedPayload = SingleTokenError("Expected loop payload, found {}"); | 283 | pub const ExpectedPayload = SingleTokenError("Expected loop payload, found '{}'"); |
| 284 | pub const ExpectedBlockOrAssignment = SingleTokenError("Expected block or assignment, found {}"); | 284 | pub const ExpectedBlockOrAssignment = SingleTokenError("Expected block or assignment, found '{}'"); |
| 285 | pub const ExpectedBlockOrExpression = SingleTokenError("Expected block or expression, found {}"); | 285 | pub const ExpectedBlockOrExpression = SingleTokenError("Expected block or expression, found '{}'"); |
| 286 | pub const ExpectedExprOrAssignment = SingleTokenError("Expected expression or assignment, found {}"); | 286 | pub const ExpectedExprOrAssignment = SingleTokenError("Expected expression or assignment, found '{}'"); |
| 287 | pub const ExpectedPrefixExpr = SingleTokenError("Expected prefix expression, found {}"); | 287 | pub const ExpectedPrefixExpr = SingleTokenError("Expected prefix expression, found '{}'"); |
| 288 | pub const ExpectedLoopExpr = SingleTokenError("Expected loop expression, found {}"); | 288 | pub const ExpectedLoopExpr = SingleTokenError("Expected loop expression, found '{}'"); |
| 289 | pub const ExpectedDerefOrUnwrap = SingleTokenError("Expected pointer dereference or optional unwrap, found {}"); | 289 | pub const ExpectedDerefOrUnwrap = SingleTokenError("Expected pointer dereference or optional unwrap, found '{}'"); |
| 290 | pub const ExpectedSuffixOp = SingleTokenError("Expected pointer dereference, optional unwrap, or field access, found {}"); | 290 | pub const ExpectedSuffixOp = SingleTokenError("Expected pointer dereference, optional unwrap, or field access, found '{}'"); |
| 291 | | 291 | |
| 292 | pub const ExpectedParamType = SimpleError("Expected parameter type"); | 292 | pub const ExpectedParamType = SimpleError("Expected parameter type"); |
| 293 | pub const ExpectedPubItem = SimpleError("Pub must be followed by fn decl, var decl, or container member"); | 293 | pub const ExpectedPubItem = SimpleError("Pub must be followed by fn decl, var decl, or container member"); |
| ... | @@ -324,11 +324,11 @@ pub const Error = union(enum) { | ... | @@ -324,11 +324,11 @@ pub const Error = union(enum) { |
| 324 | return stream.print("`&&` is invalid. Note that `and` is boolean AND."); | 324 | return stream.print("`&&` is invalid. Note that `and` is boolean AND."); |
| 325 | }, | 325 | }, |
| 326 | .Invalid => { | 326 | .Invalid => { |
| 327 | return stream.print("expected {}, found invalid bytes", self.expected_id.symbol()); | 327 | return stream.print("expected '{}', found invalid bytes", self.expected_id.symbol()); |
| 328 | }, | 328 | }, |
| 329 | else => { | 329 | else => { |
| 330 | const token_name = found_token.id.symbol(); | 330 | const token_name = found_token.id.symbol(); |
| 331 | return stream.print("expected {}, found {}", self.expected_id.symbol(), token_name); | 331 | return stream.print("expected '{}', found '{}'", self.expected_id.symbol(), token_name); |
| 332 | }, | 332 | }, |
| 333 | } | 333 | } |
| 334 | } | 334 | } |
| ... | @@ -340,7 +340,7 @@ pub const Error = union(enum) { | ... | @@ -340,7 +340,7 @@ pub const Error = union(enum) { |
| 340 | | 340 | |
| 341 | pub fn render(self: *const ExpectedCommaOrEnd, tokens: *Tree.TokenList, stream: var) !void { | 341 | pub fn render(self: *const ExpectedCommaOrEnd, tokens: *Tree.TokenList, stream: var) !void { |
| 342 | const actual_token = tokens.at(self.token); | 342 | const actual_token = tokens.at(self.token); |
| 343 | return stream.print("expected ',' or {}, found {}", self.end_id.symbol(), actual_token.id.symbol()); | 343 | return stream.print("expected ',' or '{}', found '{}'", self.end_id.symbol(), actual_token.id.symbol()); |
| 344 | } | 344 | } |
| 345 | }; | 345 | }; |
| 346 | | 346 | |