Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#398 Number literals - wrong syntax coloring

v0.5.x
closed-fixed
nobody
Editor (234)
5
2014-08-14
2007-05-20
Amir E. Aharoni
No

EPIC doesn't color unconventional number literals correctly.

Consider this code:
my @numbers = (
12345.67, # from perldata - colored correctly
345_000_000_000, # several digits before _ - only 345 is red
3.14_15_92, # from perldata - 3.14 is red
4_294_967_296, # from perldata - 4 is red
0b110_100_100, # bin from perldata - 420 - only 0 is red
0xdead_beef, # hex from perldata - 3735928559 - only 0xd is red
);

foreach (@numbers) {
print "number: $_\n";
}

This code works and prints the numbers correctly:

number: 12345.67
number: 345000000000
number: 3.141592
number: 4294967296
number: 420
number: 3735928559

In the editor they are syntax-colored incorrectly. In numbers with underscores everything up to the first underscore is colored red like a number and the rest is colored black.

In the binary number only the leading zero is colored red.

The hex number is the strangest: 0xd are red and rest is black.

I am using Eclipse 3.2.2 and EPIC 0.5.35 on Windows XP. The colors are defaults.

Thanks for your attention.

Appendix - from perldata:

(begin quote)
Numeric literals are specified in any of the following floating point or integer formats:

12345
12345.67
.23E-10 # a very small number
3.14_15_92 # a very important number
4_294_967_296 # underscore for legibility
0xff # hex
0xdead_beef # more hex
0377 # octal (only numbers, begins with 0)
0b011011 # binary

You are allowed to use underscores (underbars) in numeric literals between digits for legibility. You could, for example, group binary digits by threes (as for a Unix-style mode argument such as 0b110_100_100) or by fours (to represent nibbles, as in 0b1010_0110) or in other groups.
(end quote)

Discussion

  • test case for number literals

     
  • Jan Ploski
    Jan Ploski
    2007-05-21

    Logged In: YES
    user_id=86907
    Originator: NO

    Thanks for reporting. Fixed in CVS.

     
  • Jan Ploski
    Jan Ploski
    2007-05-27

    Logged In: YES
    user_id=86907
    Originator: NO

    Fixed in 0.5.37/0.6.5.

     
  • Jan Ploski
    Jan Ploski
    2007-05-27

    • status: open --> closed-fixed