From 2532b15d978c1f13aeed3099e022c49e2d2cfc4a Mon Sep 17 00:00:00 2001 From: Martin Janiczek Date: Sun, 21 Jul 2019 19:59:00 +0200 Subject: [PATCH] Fix comment This comment isn't in line with what the code actually does, and given code can't lie but comments can, the place to fix is probably the comment. See [findSubString](https://github.com/elm/parser/blob/master/src/Elm/Kernel/Parser.js#L123) - the `newOffset + smallString.length` means the target is pointed at the end of the found substring, not at its beginning. ```elm -- v = newOffset "Is 42 the answer? -- ^ = newOffset + smallString.length -- 1234567... ``` --- src/Parser/Advanced.elm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Parser/Advanced.elm b/src/Parser/Advanced.elm index 6af483b..1254747 100644 --- a/src/Parser/Advanced.elm +++ b/src/Parser/Advanced.elm @@ -1125,7 +1125,7 @@ isAsciiCode = findSubString "42" offset row col "Is 42 the answer?" --==> (newOffset, newRow, newCol) -If `offset = 0` we would get `(3, 1, 4)` +If `offset = 0` we would get `(3, 1, 6)` If `offset = 7` we would get `(-1, 1, 18)` -} findSubString : String -> Int -> Int -> Int -> String -> (Int, Int, Int)