aboutsummaryrefslogtreecommitdiffstats
path: root/src/Utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.hs')
-rw-r--r--src/Utils.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Utils.hs b/src/Utils.hs
index 8ee2056..8dd233f 100644
--- a/src/Utils.hs
+++ b/src/Utils.hs
@@ -26,7 +26,8 @@ type Env = M.Map String AST
data LState = LState {
stateConfig :: Config,
- stateEnv :: Env
+ stateEnv :: Env,
+ stateDepth :: Int
}
type LContext a = StateT LState (ExceptT LException IO) a
@@ -53,6 +54,15 @@ insertEnv k v = do
env <- getEnv
putEnv $ M.insert k v env
+incrementDepth :: LContext ()
+incrementDepth =
+ modify (\s -> s { stateDepth = stateDepth s + 1 })
+
+getDepth :: LContext Int
+getDepth = do
+ s <- get
+ return $ stateDepth s
+
data Token = Token {
tokenContent :: String,
tokenRow :: Int,