summaryrefslogtreecommitdiff
path: root/src/main/frege/buildclient/config/BuildParser.fr
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-01-24 17:29:45 +0100
committernea <nea@nea.moe>2023-01-24 17:29:45 +0100
commit5f74d9f5bc9bf58e1608bd94ad23c79d016e4256 (patch)
tree947f1edd05ec35c69e9f2a3029cadbbfa0a8838a /src/main/frege/buildclient/config/BuildParser.fr
parentd3c7f67bce284c8829ac53387dec0f863569fac6 (diff)
downloadbuildclient-5f74d9f5bc9bf58e1608bd94ad23c79d016e4256.tar.gz
buildclient-5f74d9f5bc9bf58e1608bd94ad23c79d016e4256.tar.bz2
buildclient-5f74d9f5bc9bf58e1608bd94ad23c79d016e4256.zip
Better error reporting
Diffstat (limited to 'src/main/frege/buildclient/config/BuildParser.fr')
-rw-r--r--src/main/frege/buildclient/config/BuildParser.fr5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/main/frege/buildclient/config/BuildParser.fr b/src/main/frege/buildclient/config/BuildParser.fr
index 23e15ff..367b177 100644
--- a/src/main/frege/buildclient/config/BuildParser.fr
+++ b/src/main/frege/buildclient/config/BuildParser.fr
@@ -29,7 +29,7 @@ lexer s = lex s 0
private lex :: String -> Int -> [Token]
private lex !cs !start
- | endOfSeq = []
+ | start >= cs.length = []
| ch == '\\' && at 1 == '\n' = lex cs (start + 2)
| ch == '\n' = Token.NewLine : lex cs (start + 1)
| ch.isWhitespace = lex cs (start + 1)
@@ -38,9 +38,8 @@ private lex !cs !start
| ch == '}' = Token.BraceClose : lex cs (start + 1)
| isDigit ch = takeWhile isDigit Token.Number 0 []
| isIdentifierStartChar ch = takeWhile isIdentifierChar Token.BareWord 0 []
- | otherwise -> [Token.ERROR{position=start, message="Unexpected character"}]
+ | otherwise -> [Token.ERROR{position=start, message="Unexpected character " ++ (show ch)}]
where
- endOfSeq = start >= cs.length
ch = at 0
at i = if start + i >= cs.length then '\0' else cs.charAt (start + i)
takeWhile charTest mapper off !acc