Skip to content

Commit

Permalink
Fix hex literal parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
yanex committed Oct 25, 2019
1 parent 5e21705 commit ec21fbe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions marco/parser/MarcoParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ internal class MarcoParser {
text.append(try state.advance())
parsedCount += 1
}

guard parsedCount > 0 else {
throw state.unexpectedCharacter(title: "Hexadecimal literal expected")
}

return parsedCount
}
Expand Down
10 changes: 10 additions & 0 deletions marcoTests/testData/error/hex.marco
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--before
{
foo 0x
}

--after
12: Hexadecimal literal expected '\n'

{
foo 0x💥

0 comments on commit ec21fbe

Please sign in to comment.