rokucommunity / rokucommunity/brighterscript
single-line if statement parsed wrong
Open
Nobody has claimed this yet.
parser
- Dominant language
- TypeScript
- Stars
- 208
- Forks
- 68
- Avg merge
- 8h 39m
- Merged PRs (30d)
- 39
Description
This test fails. The aa.value = 8 code turns into its own statement, and the else branch is empty. I don't think this happens in brs, so this is something we introduced in the brighterscript parser.
it('supports single-line if-else', () => {
let { tokens } = Lexer.scan(`
if foo > 5 then aa.value = ">5" else aa.value = 8
`);
let { statements, diagnostics } = Parser.parse(tokens);
expect(diagnostics).to.be.lengthOf(0);
let statement = statements[0] as IfStatement;
expect(statement).to.be.instanceof(IfStatement);
expect(statement.elseBranch).to.exist;
});
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the single-line if-else example and trace the tokens from Lexer.scan into Parser.parse. Confirm the parsed result is an IfStatement with an existing elseBranch, no diagnostics, and both assignment statements in their respective branches.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100