diff options
author | Einhard Leichtfuß <alguien@respiranto.de> | 2025-05-20 22:28:05 +0200 |
---|---|---|
committer | Einhard Leichtfuß <alguien@respiranto.de> | 2025-05-20 22:36:33 +0200 |
commit | dfd8f3bd6b12dc19cd5c4951d05b8a2ae18ceda6 (patch) | |
tree | 18e08a04713d228e223baa87a493ef2602f3b298 /src/Language/SimpleShell/Parser.hs | |
parent | fd94a9d8a3e4fc86e5128715a2bc68187c872970 (diff) |
Add relaxed expr parser
This is just to parse expressions *without* checking for defined
functions, and to be used in a first pass.
Diffstat (limited to 'src/Language/SimpleShell/Parser.hs')
-rw-r--r-- | src/Language/SimpleShell/Parser.hs | 6 |
1 files changed, 6 insertions, 0 deletions
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 |