Skip to content

Commit

Permalink
Merge pull request #1256 from AviAvni/underscore-literals
Browse files Browse the repository at this point in the history
Underscore literals - fix float parsing and add negative tests
  • Loading branch information
KevinRansom authored Jun 20, 2016
2 parents 3365a62 + 37092ed commit 94e125a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/fsharp/lex.fsl
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ let xint8 = xinteger 'y'
let xint16 = xinteger 's'
let xint = xinteger
let xint32 = xinteger 'l'
let floatp = digit ((digit | separator)* digit)? '.' (digit (digit | separator)*)?
let floate = digit ((digit | separator)* digit)? ('.' (digit (digit | separator)*)? )? ('e'| 'E') ['+' '-']? digit (digit | separator)*
let floatp = digit ((digit | separator)* digit)? '.' (digit ((digit | separator)* digit)?)?
let floate = digit ((digit | separator)* digit)? ('.' (digit ((digit | separator)* digit)?)? )? ('e'| 'E') ['+' '-']? digit ((digit | separator)* digit)?
let float = floatp | floate
let bignum = integer ('I' | 'N' | 'Z' | 'Q' | 'R' | 'G')
let ieee64 = float
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//<Expects id="FS1156" span="(18,11-18,13)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(18,14-18,19)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS0599" span="(18,13-18,14)" status="error">Missing qualification after '.'</Expects>
//<Expects id="FS1156" span="(19,11-19,19)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(20,29-20,42)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(22,10-22,13)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(23,10-23,15)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(24,10-24,15)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(25,10-25,15)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(26,10-26,14)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(27,10-27,15)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(28,10-28,15)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(29,10-29,15)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(30,11-30,18)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(31,11-31,18)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>
//<Expects id="FS1156" span="(32,11-32,16)" status="error">This is not a valid numeric literal. Valid numeric literals include</Expects>

let pi1 = 3_.1415F
let pi2 = 3._1415F
let socialSecurityNumber1 = 999_99_9999_L
let x1 = _52
let x2 = 52_
let x3 = 0_x52
let x4 = 0x_52
let x5 = 0x52_
let x6 = 052_
let x7 = 0_o52
let x8 = 0o_52
let x9 = 0o52_
let x10 = 2.1_e2F
let x11 = 2.1e_2F
let x12 = 1.0_F
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ NOMONO,NoMT SOURCE=E_BasicConstantsBigNum40.fsx SCFLAGS="--test:ErrorRanges" # E
SOURCE=DecimalLiterals02.fs # DecimalLiterals02.fs

SOURCE=FullSetOfEscapeCharacters.fs # FullSetOfEscapeCharacters.fs
SOURCE=E_UnderscoreLiterals.fs SCFLAGS="--test:ErrorRanges" # E_UnderscoreLiterals.fs

0 comments on commit 94e125a

Please sign in to comment.