Skip to content

Support line continuation#1667

Open
luis-j-soares wants to merge 7 commits intorokucommunity:masterfrom
luis-j-soares:feat/lms/line-continuation
Open

Support line continuation#1667
luis-j-soares wants to merge 7 commits intorokucommunity:masterfrom
luis-j-soares:feat/lms/line-continuation

Conversation

@luis-j-soares
Copy link
Copy Markdown
Collaborator

@luis-j-soares luis-j-soares commented Mar 28, 2026

A future OS release will introduce automatic line continuation in BrightScript, allowing expressions and function call arguments to span multiple lines after binary operators (+, -, *, /, \, mod, ^, and, or, and relational operators).

This PR adds parser support for that syntax behind an allowLineContinuation flag.

Behaviour

  • Always enabled in .bs files (BrighterScript mode)
  • Opt-in for .brs files via the new allowLineContinuation: true config option (or --allow-line-continuation on the CLI)
  • Also enabled implicitly when allowBrighterScriptInBrightScript is set, since that already forces BrighterScript mode

Examples

Arithmetic operators

result = value1 +
         value2 *
         value3

ratio = totalWidth -
        padding /
        columns

Boolean operators

condition = isValid and
            isEnabled or
            isRequired

Relational operators

isInRange = x >=
            minValue and
            x <=
            maxValue

Chained across multiple lines

total = basePrice +
        tax +
        shippingCost -
        discount

Function call arguments split across lines

result = calculateValue(
    param1,
    param2
)

Inline objects as arguments (supported since BrightScript's inception — unaffected by this flag)

foo({
    option1: true,
    option2: false
})

@luis-j-soares

This comment was marked as outdated.

@luis-j-soares

This comment was marked as outdated.

@luis-j-soares luis-j-soares marked this pull request as draft April 1, 2026 17:55
@markwpearce
Copy link
Copy Markdown
Collaborator

Will we need to update the formatter as well?

@luis-j-soares
Copy link
Copy Markdown
Collaborator Author

Will we need to update the formatter as well?

@markwpearce I would say so. I can open an issue and work on it once this PR is merged.

@luis-j-soares luis-j-soares marked this pull request as ready for review April 2, 2026 16:04
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