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
4 changes: 2 additions & 2 deletions lib/src/compiler/tests/testdata/errors/143.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E001]: syntax error
--> src/compiler/tests/testdata/includes/included_error.yar:1:15
--> src/compiler/tests/testdata/includes/included_error.yar:1:16
|
1 | rule included {
| ^ expecting `condition`, found end of file
| ^ expecting `condition`, found end of file
3 changes: 3 additions & 0 deletions lib/src/compiler/tests/testdata/errors/153.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rule test {
strings:
$a = “foo”
5 changes: 5 additions & 0 deletions lib/src/compiler/tests/testdata/errors/153.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error[E001]: syntax error
--> line:3:10
|
3 | $a = “foo”
| ^^^^^ expecting STRING, regexp or `{`, found `“foo”`
4 changes: 2 additions & 2 deletions lib/src/compiler/tests/testdata/errors/64.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E001]: syntax error
--> line:1:27
--> line:1:28
|
1 | rule test { condition: true
| ^ expecting operator or `}`, found end of file
| ^ expecting operator or `}`, found end of file
4 changes: 2 additions & 2 deletions parser/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ impl<'src> ParserImpl<'src> {
None => {
// Special case when the end of the source is reached. The span
// used for error reporting is a zero-length span pointing to
// last byte in the source code.
let last = self.tokens.source().len().saturating_sub(1) as u32;
// the end of the code.
let last = self.tokens.source().len() as u32;
(None, None, Span(last..last))
}
Some(token) => (
Expand Down
2 changes: 1 addition & 1 deletion parser/src/parser/tests/testdata/basic-error-3.ast
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ERRORS:
- SyntaxError { message: "expecting operator or `}`, found end of file", span: Span(26..26) }
- SyntaxError { message: "expecting operator or `}`, found end of file", span: Span(27..27) }
2 changes: 1 addition & 1 deletion parser/src/parser/tests/testdata/basic-error-3.cst
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ SOURCE_FILE@0..27
TRUE_KW@23..27 "true"

ERRORS:
- [26..26]: expecting operator or `}`, found end of file
- [27..27]: expecting operator or `}`, found end of file
2 changes: 1 addition & 1 deletion parser/src/parser/tests/testdata/basic-error-3.cststream
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ End { kind: BOOLEAN_TERM, span: Span(23..27) }
End { kind: BOOLEAN_EXPR, span: Span(23..27) }
End { kind: CONDITION_BLK, span: Span(12..27) }
End { kind: ERROR, span: Span(0..27) }
Error { message: "expecting operator or `}`, found end of file", span: Span(26..26) }
Error { message: "expecting operator or `}`, found end of file", span: Span(27..27) }
End { kind: SOURCE_FILE, span: Span(0..27) }
Loading