Skip to content

Conversation

@JohnnyMarnell
Copy link

@JohnnyMarnell JohnnyMarnell commented Sep 9, 2022

What a great repo, thank you! I tried it on a current .RPP I'm working on, I'm getting a few errors, but the gnarliest seems to be when a line (in my case, part of a jsfx <JS block) begins with a decimal param value.

I added 2 tests, one passes (first param is integer) and the other fails. (Wish I had a fix, but peg is new to me and I'm not yet grokking it).

I also included augmenting the error object with helpful context (highlighting failing line with approx +-5 lines surrounding), in case that's something other folks would also find helpful.

Hope to collab! @CharlesHolbrow

} catch (err) {
const {start, end} = err.location,
lines = rppString.split(/\r?\n/ig).map(l => ' ' + l)
err.nearLines = lines.slice(start.line - 4, start.line - 1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @JohnnyMarnell ! I'm publishing v0.4.2 to npm, which includes JSFX support.

I'm thinking about adding this too, but can you confirm that this works as expected when the calculated indices are outside the bounds of the array? For example when the error occurs on the very first or last line in the input string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants