diff --git a/src/fsharp/lex.fsl b/src/fsharp/lex.fsl index 1fab60bb7ba..89bf263e4ba 100644 --- a/src/fsharp/lex.fsl +++ b/src/fsharp/lex.fsl @@ -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 diff --git a/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/E_UnderscoreLiterals.fs b/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/E_UnderscoreLiterals.fs new file mode 100644 index 00000000000..6e1ba665f93 --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/E_UnderscoreLiterals.fs @@ -0,0 +1,32 @@ +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//Missing qualification after '.' +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include +//This is not a valid numeric literal. Valid numeric literals include + +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 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/env.lst b/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/env.lst index 83cd11faab1..500d42d77e1 100644 --- a/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/env.lst +++ b/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/env.lst @@ -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 \ No newline at end of file