rokucommunity / rokucommunity/brighterscript-formatter

Breaks BrighterScript regex literal on return statment

Open
#81 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
TypeScript
Stars
17
Forks
10
Avg merge
49m
Merged PRs (30d)
7

Description

starting code examples:

function getRegex() as dynamic
	regex = /([\xA9\xAE\x{2000}-\x{3300}\x{1F000}-\x{1FBFF}])/gmi
	return regex
end function

function getRegex() as dynamic
	return /([\xA9\xAE\x{2000}-\x{3300}\x{1F000}-\x{1FBFF}])/gmi
end function

after formatting:

function getRegex() as dynamic
	regex = /([\xA9\xAE\x{2000}-\x{3300}\x{1F000}-\x{1FBFF}])/gmi
	return regex
end function

function getRegex() as dynamic
	return / ([ \ xA9 \ xAE \ x{ 2000 } - \ x{ 3300 } \ x{ 1F000 } - \ x{ 1FBFF }]) / gmi
end function

As you can see the second functions regex is mutated after formatting.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the formatter output using the two BrighterScript examples in the issue, then trace how a regex literal is handled when it appears directly after return. Done means formatting preserves the second function's regex exactly rather than inserting spaces or changing its escapes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.