Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very large double-precision literals with a trailing # are treated like conditional compilation code #616

Closed
sjbarag opened this issue Jan 22, 2021 · 0 comments · Fixed by #617
Labels
bug Any difference between this BrightScript implementation and RBI, or otherwise unexpected behavior lexer Affects this project's lexer (aka scanner)

Comments

@sjbarag
Copy link
Owner

sjbarag commented Jan 22, 2021

In RBI it's perfectly valid to use a numeric literal of more than ten characters and still use the # operator to explicitly mark it as a double. In brs, that causes a lexing error:

sub main()
    if (3 >= 9999999999999999999#)
        print "oh no"
    else
        print "phew"
    end if
end sub
hash-in-conditional.brs(2,32-34): Found unexpected conditional-compilation string '#)'
Error occurred during lexing
@sjbarag sjbarag added bug Any difference between this BrightScript implementation and RBI, or otherwise unexpected behavior lexer Affects this project's lexer (aka scanner) labels Jan 22, 2021
sjbarag added a commit that referenced this issue Jan 22, 2021
RBI forces all literal numbers to double-precision if they're longer
than characters, and also allows such a number to be explicitly
designated a double with a trailing `#`.  `brs` didn't.  Look for a
trailing `#` when lexing long numeric literals, to avoid treating it
like a conditional compilation string.

fixes #616
sjbarag added a commit that referenced this issue Jan 22, 2021
#617)

RBI forces all literal numbers to double-precision if they're longer
than characters, and also allows such a number to be explicitly
designated a double with a trailing `#`.  `brs` didn't.  Look for a
trailing `#` when lexing long numeric literals, to avoid treating it
like a conditional compilation string.

fixes #616
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Any difference between this BrightScript implementation and RBI, or otherwise unexpected behavior lexer Affects this project's lexer (aka scanner)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant