Skip to content

Support line continuation#1667

Merged
TwitchBronBron merged 11 commits intorokucommunity:masterfrom
luis-j-soares:feat/lms/line-continuation
Apr 27, 2026
Merged

Support line continuation#1667
TwitchBronBron merged 11 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).

For BrighterScript users, this PR adds parser support for that syntax in BrighterScript mode without introducing a separate feature flag.

Standard .brs behaviour remains unchanged unless allowBrighterScriptInBrightScript is already enabled, and transpiled output is still normalized back to ordinary single-line BrightScript.

Behaviour

  • Enabled in .bs files (BrighterScript mode)
  • Enabled in .brs files only when allowBrighterScriptInBrightScript is set, because those files are then parsed in BrighterScript mode
  • Standard .brs files still emit syntax errors for binary-operator continuation and multi-line call arguments
  • Continued expressions and continued call arguments transpile back to single-line BrightScript output
  • Existing multi-line collection literals used as call arguments remain supported in standard .brs

Coverage

  • precise negative tests for standard .brs syntax errors
  • transpile tests proving continued binary expressions and continued call arguments flatten back to one line
  • regression tests proving multi-line array and associative-array literals as call arguments are still valid in standard .brs

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 collections as arguments (supported since BrightScript's inception — unaffected by this change)

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

foo([
    1,
    2
])

@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
@TwitchBronBron TwitchBronBron enabled auto-merge (squash) April 27, 2026 18:27
@TwitchBronBron TwitchBronBron merged commit a08a2f4 into rokucommunity:master Apr 27, 2026
7 checks passed
@luis-j-soares luis-j-soares deleted the feat/lms/line-continuation branch April 28, 2026 15:22
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.

3 participants