From cf999d19b6c534f7156515da61c8d55bd2e4c28c Mon Sep 17 00:00:00 2001 From: Rhiannon Morris Date: Wed, 15 Jul 2020 11:33:12 +0200 Subject: [PATCH] make identifier parsing a little more faithful --- make-pages/BuildVar.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/make-pages/BuildVar.hs b/make-pages/BuildVar.hs index 042d78e..d0e2052 100644 --- a/make-pages/BuildVar.hs +++ b/make-pages/BuildVar.hs @@ -98,11 +98,13 @@ chunks = reverse . go "" [] . trimEnd where go acc cs (c :. rest) = go (acc <> singleton c) cs rest splitVar s - | (var, s') <- Text.span isAlphaNum s, + | (var, s') <- Text.span isIdChar s, isLower (Text.head var) = (var, s') splitVar _ = error "invalid variable name" + isIdChar c = isAlphaNum c || c `elem` ['_', '\''] + lit s = (Lit, toStrictText s) trimEnd = Text.dropWhileEnd isSpace