Re: Does Beanshell Support Numeric Literals with Underscores?

Daniel Martin <martin-+m399P62/[email protected]> Wed, 10 Jun 2015 18:15:41 -0400
Newsgroups gmane.comp.java.beanshell.user
Message-ID <918B5A3B-6840-4C8A-9632-5809528086E0@aram>
Not only do underscores in numeric literals not work in beanshell, binary literals (literals beginning with "0b") don't work either!

When I had to store constants in binary in beanshell or java, I tended to use Integer.parseInt("01001100", 2)

In general, the syntax beanshell supports is approximately that of java 1.4, with a few allowed variances.

Beanshell hasn't change in nearly a decade; many people believe it was effectively abandoned by its creator.

There were some attempts to revive development in a "Beanshell 2.0" project, but so far as I know that never achieved much adoption.

> On Jun 10, 2015, at 4:39 PM, Edward Wong <[email protected]> wrote:
> 
> I apologize in advance if this isn't the right place to email this question. I'm trying to write some scripts in which I use binary values along with underscores to make it easier to read.
> 
> For Example:
> 
> int BIT_MASK = 0b1000_1111;
> 
> However when I try running this, I get an error that looks like this:
> 
> *** User input parse error at line 1, column 17.  Encountered: b1000_1111
> 
> Is it correct that "Numeric Literals with Underscores" isn't supported in Beanshell? Are there any plans to make it work?
> 
> ~ Edward Wong
> ------------------------------------------------------------------------------
> _______________________________________________
> Beanshell-users mailing list
> Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
> 

------------------------------------------------------------------------------