From dfd8f3bd6b12dc19cd5c4951d05b8a2ae18ceda6 Mon Sep 17 00:00:00 2001 From: Einhard Leichtfuß Date: Tue, 20 May 2025 22:28:05 +0200 Subject: Add relaxed expr parser This is just to parse expressions *without* checking for defined functions, and to be used in a first pass. --- src/Language/SimpleShell/Parser.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Language/SimpleShell/Parser.hs') diff --git a/src/Language/SimpleShell/Parser.hs b/src/Language/SimpleShell/Parser.hs index d75602b..be16c9f 100644 --- a/src/Language/SimpleShell/Parser.hs +++ b/src/Language/SimpleShell/Parser.hs @@ -4,6 +4,7 @@ module Language.SimpleShell.Parser ( Parser , lexeme , symbol + , commentFirstChars , lookupVar , lookupFun , declareVars @@ -50,12 +51,17 @@ initContext = Context } +-- Must be kept in sync with 'commentFirstChars'. sc :: Parser () sc = L.space space1 (L.skipLineComment "//") (L.skipBlockComment "/*" "*/") +-- | List of all characters that may start a comment. +commentFirstChars :: [Char] +commentFirstChars = "/" + lexeme :: Parser a -> Parser a lexeme = L.lexeme sc -- cgit v1.2.3