Repository: hylo-lang/hylo (swift)

Issue:
Lexer gets confused if it sees `e` after a number
This program fails parsing:
```
fun eat(_ x: sink Int) {}

public fun main() {
  var x = 0
  eat(x)
}
```
Adding a semicolon after `0` fixes the lexer error.

Pull request description:
Fixes https://github.com/hylo-lang/hyloc/issues/873

Patch:
diff --git a/Sources/FrontEnd/Parse/Lexer.swift b/Sources/FrontEnd/Parse/Lexer.swift
index a4e83cef6..b7dfc24a2 100644
--- a/Sources/FrontEnd/Parse/Lexer.swift
+++ b/Sources/FrontEnd/Parse/Lexer.swift
@@ -29,6 +29,7 @@ public struct Lexer: IteratorProtocol, Sequence {
 
       // Skip whitespaces.
       if sourceCode.text[index].isWhitespace {
+        previousTokenWasInt = false
         discard()
         continue
       }


Test patch:
diff --git a/Tests/HyloTests/TestCases/Parsing/NumberFollowedByEBlockCommentInBetween.hylo b/Tests/HyloTests/TestCases/Parsing/NumberFollowedByEBlockCommentInBetween.hylo
new file mode 100644
index 000000000..424d7e55a
--- /dev/null
+++ b/Tests/HyloTests/TestCases/Parsing/NumberFollowedByEBlockCommentInBetween.hylo
@@ -0,0 +1,6 @@
+//- parse expecting: success
+
+public fun main() {
+  var x = 0 /*hello*/
+  eat(x)
+}
diff --git a/Tests/HyloTests/TestCases/Parsing/NumberFollowedByELineCommentInBetween.hylo b/Tests/HyloTests/TestCases/Parsing/NumberFollowedByELineCommentInBetween.hylo
new file mode 100644
index 000000000..d22b2f166
--- /dev/null
+++ b/Tests/HyloTests/TestCases/Parsing/NumberFollowedByELineCommentInBetween.hylo
@@ -0,0 +1,6 @@
+//- parse expecting: success
+
+public fun main() {
+  var x = 0 //hello
+  eat(x)
+}
diff --git a/Tests/HyloTests/TestCases/Parsing/NumberFollowedByEOnNewLine.hylo b/Tests/HyloTests/TestCases/Parsing/NumberFollowedByEOnNewLine.hylo
new file mode 100644
index 000000000..7080bcb24
--- /dev/null
+++ b/Tests/HyloTests/TestCases/Parsing/NumberFollowedByEOnNewLine.hylo
@@ -0,0 +1,6 @@
+//- parse expecting: success
+
+public fun main() {
+  var x = 0
+  eat(x)
+}
diff --git a/Tests/HyloTests/TestCases/Parsing/NumberFollowedByESemiInBetween.hylo b/Tests/HyloTests/TestCases/Parsing/NumberFollowedByESemiInBetween.hylo
new file mode 100644
index 000000000..f30e65328
--- /dev/null
+++ b/Tests/HyloTests/TestCases/Parsing/NumberFollowedByESemiInBetween.hylo
@@ -0,0 +1,5 @@
+//- parse expecting: success
+
+public fun main() {
+  var x = 0; eat(x)
+}
diff --git a/Tests/HyloTests/TestCases/Parsing/NumberWithEInvalid.hylo b/Tests/HyloTests/TestCases/Parsing/NumberWithEInvalid.hylo
new file mode 100644
index 000000000..2c8da76e1
--- /dev/null
+++ b/Tests/HyloTests/TestCases/Parsing/NumberWithEInvalid.hylo
@@ -0,0 +1,7 @@
+//- parse expecting: failure
+
+let x0 = 1e1
+
+let x1 = 1 e1   //! diagnostic unexpected token 'name'
+
+let x2 = 1e 1   //! diagnostic unexpected token 'invalid'