Skip to content

Commit

Permalink
Fix lint error and add additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbooth4 committed Feb 20, 2025
1 parent 54829cd commit 2f0698a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,10 @@ const checkTokenSequenceMatch = (
anchorTokenPosition + tokenOffset
).type;
} else {
// Note: positive lookahead starts at '2' because '1' is the current token.
const tokenOffset = direction === 'lookahead' ? i + 2 : -1 * (i + 1);
streamToken = parser.inputStream.LA(tokenOffset);
}
// Note: positive lookahead starts at '2' because '1' is the current token.


// Note: negative checking is < -1 becuase Token.EOF is -1, but below

Check failure on line 128 in packages/malloy/src/lang/syntax-errors/custom-error-messages.ts

View workflow job for this annotation

GitHub Actions / main / main

Delete `⏎`
// that we use negatives to indicate "does-not-match" rules.
Expand Down
10 changes: 10 additions & 0 deletions packages/malloy/src/lang/test/syntax-errors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,14 @@ describe('errors', () => {
)
);
});
test('run opening curly to EOF', () => {
expect(`
run: x -> {
`).toLogAtLeast(errorMessage("Missing '}' at '<EOF>'"));
});
test('source opening curly to EOF', () => {
expect(`
source: y is x extend {
`).toLogAtLeast(errorMessage("Missing '}' at '<EOF>'"));
});
});

0 comments on commit 2f0698a

Please sign in to comment.