www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12813] New: Parser is confused between float and UFC syntax


          Issue ID: 12813
           Summary: Parser is confused between float and UFC syntax
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

According to the docs (lex)

Floating literals can have embedded ‘_’ characters, which are ignored. The
embedded ‘_’ are useful for formatting long literals to make them more
readable, such as using them as a thousands separator

And the following examples are given as valid.

123_456.567_8         // 123456.5678
1_2_3_4_5_6_._5_6_7_8 // 123456.5678
1_2_3_4_5_6_._5e-6_   // 123456.5e-6


123_456.567_8         // OK
1_2_3_4_5_6_._5_6_7_8 // ERROR no property '_5_6_7_8' for type 'int'
1_2_3_4_5_6_._5e-6_   // ERROR no property '_5e' for type 'int'

Marking as regression because this would have been fine before UFCs.

May 27 2014