Changes between Version 41 and Version 42 of Lexical

Show
Ignore:
Timestamp:
12/09/09 20:05:24 (9 months ago)
Author:
unknwnsoljer (IP: 63.195.85.42)
Comment:

fixed: float literal. made an important note about integer suffixes.

Legend:

Unmodified
Added
Removed
Modified
  • Lexical

    v41 v42  
    466466}}} 
    467467 
     468Integers may not have redundant integer suffixes. For example, '0uU' and '0LL' are not lexically valid tokens. 
     469 
    468470Integer literals represent an integer value in several possible bases: decimal, hexadecimal, octal, and binary. Each are defined in a different manner: 
    469471 
     
    472474 * Octal integers start with a '0' (zero) and are written using the digits 0 through 7. 
    473475 * Binary integers start with '0b' or '0B' and are written using the digits 0 and 1. 
     476 
    474477 
    475478Any underscores ('_') representing digits (that is, after the selection prefix and among the digits) are ignored and are useful for splitting up large numbers, such as being used as a thousands separator: 
     
    520523        Float [Suffix] 
    521524        Decimal FloatSuffix [ImaginarySuffix] 
    522         Decimal [RealSuffix] ImaginarySuffix 
     525        DecimalDigit DecimalDigitOrUnderscore* [RealSuffix] ImaginarySuffix 
    523526 
    524527Float: 
     
    564567 
    565568 * Decimal floating point literals are a series of decimal digits (0 through 9), a single instance of '.', and then another series of decimal digits which comprise the fractional component.  Optionally, an exponent can be defined using 'e' or 'E' followed by a signed integer value.  If an exponent is present, the value of the literal is determined by raising 10 to the power of the exponent and multiplying by the numerical part.  This is similar to scientific notation. 
     569 * Decimal floating point literals may also be indicated by a float suffix ('f' or 'F') or imaginary suffix ('i'). 
    566570 * Hexadecimal floating point literals are a series of hexadecimal digits (0 through 9, 'a' through 'f', and 'A' through 'F'), a single instance of '.', and then another series of hexadecimal digits which comprise the fractional component.  An optional exponent is denoted by a 'p' or 'P' followed by a series of hexadecimal digits representing the exponent in base 2.  If an exponent is present, the value of the literal is determined by raising 2 to the power of the exponent and multiplying by the numerical part. 
    567571