Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Created June 15, 2019 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseoliv/fb8e425f722bba4b6848ab4570c4b936 to your computer and use it in GitHub Desktop.
Save joseoliv/fb8e425f722bba4b6848ab4570c4b936 to your computer and use it in GitHub Desktop.
Number_bin
package metaobjectTest
@doc{*
This is a literal number annotation, an identifier follows a literal
number. The syntax for this annotation is
nbin or nBin or nBIN
in which 'n' is a literal number in base 2. 'n' can have numbers and
underscores but it should start with a number (otherwise the
compiler will consider it as an identifier). The metaobject uses method
Integer.valueOf(n, 2)
to parse the number 'n' in base 2.
*}
object Number_bin
func run {
assert 101bin == 5;
assert 10BIN == 2;
assert 111_111Bin == 63;
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment