aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2022-12-04 19:13:53 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2022-12-05 14:21:53 +0200
commiteb2e1e80b11825102c6fb80e04b0a0fffd4e63fb (patch)
treeed685b7cdf72320d0758904846df1a5747393853 /src
parent77117fa515c5853b5f756d899db0ec9b502298e7 (diff)
Fix line numbers in script file tokens
Diffstat (limited to 'src')
-rw-r--r--src/Interpreter.hs2
-rw-r--r--src/Tokenizer.hs12
2 files changed, 7 insertions, 7 deletions
diff --git a/src/Interpreter.hs b/src/Interpreter.hs
index 1f9153c..52b3a33 100644
--- a/src/Interpreter.hs
+++ b/src/Interpreter.hs
@@ -320,7 +320,7 @@ runScriptFile fileName = do
runInlineScript :: String -> String -> LContext [AST]
runInlineScript fileName src =
- runInlineScript' 0 fileName src
+ runInlineScript' 1 fileName src
runInlineScript' :: LineNo -> String -> String -> LContext [AST]
runInlineScript' lineNo fileName src = do
diff --git a/src/Tokenizer.hs b/src/Tokenizer.hs
index 777bedb..b38e568 100644
--- a/src/Tokenizer.hs
+++ b/src/Tokenizer.hs
@@ -97,10 +97,10 @@ tokenize' (row, col) fileName src = do
.> filter (\t -> length (tokenContent t) > 0)
where
- augment row col ('\r':'\n':rest) =
- TChar '\n' row col : augment (row + 1) 1 rest
- augment row col ('\n':rest) =
- TChar '\n' row col : augment (row + 1) 1 rest
- augment row col (c:rest) =
- TChar c row col : augment row (col + 1) rest
+ augment row' col' ('\r':'\n':rest) =
+ TChar '\n' row' col' : augment (row' + 1) 1 rest
+ augment row' col' ('\n':rest) =
+ TChar '\n' row' col' : augment (row' + 1) 1 rest
+ augment row' col' (c:rest) =
+ TChar c row' col' : augment row' (col' + 1) rest
augment _ _ [] = []