Added LF conversion for darwin
This commit is contained in:
parent
12f388949c
commit
4a06f9cbf2
|
@ -250,13 +250,17 @@ proc parseEscape(self: Lexer) =
|
||||||
if not self.done():
|
if not self.done():
|
||||||
self.source[self.current + 1] = cast[char](0x0A)
|
self.source[self.current + 1] = cast[char](0x0A)
|
||||||
else:
|
else:
|
||||||
# Every other platform is kind enough to use
|
# Every other platform (except macos, thanks apple)
|
||||||
# the agreed upon LF standard, but again thanks
|
# is kind enough to use the agreed upon LF standard,
|
||||||
# to microsoft we need to convert \r\n back to \n
|
# but again thanks to microsoft we need to convert
|
||||||
# under actually sensible operating systems
|
# \r\n back to \n under actually sensible operating systems
|
||||||
if self.source[self.current - 1] == cast[char](0x0D):
|
if self.source[self.current - 1] == cast[char](0x0D):
|
||||||
self.source = self.source[0..<self.current] & self.source[self.current + 1..^1]
|
self.source = self.source[0..<self.current] & self.source[self.current + 1..^1]
|
||||||
|
when defined(darwin):
|
||||||
|
# Thanks apple, lol
|
||||||
self.source[self.current] = cast[char](0x0A)
|
self.source[self.current] = cast[char](0x0A)
|
||||||
|
else:
|
||||||
|
self.source[self.current] = cast[char](0X0D)
|
||||||
of 'r':
|
of 'r':
|
||||||
self.source[self.current] = cast[char](0x0D)
|
self.source[self.current] = cast[char](0x0D)
|
||||||
of 't':
|
of 't':
|
||||||
|
|
Loading…
Reference in New Issue