Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Interpreter v.0: Fix norm
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumeAbel committed Dec 5, 2023
1 parent 7da3907 commit 9217e32
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/TextToAST.hs
Original file line number Diff line number Diff line change
@@ -67,7 +67,8 @@ cutAtClose (x:xs) = (x:cutAtClose xs)
nextToParse :: String -> String
nextToParse [] = []
nextToParse ('(':xs) = nextToParse' xs 1
nextToParse str | skipableChar (head str) = nextToParse (dropWhile skipableChar str)
nextToParse str | skipableChar (head str) = nextToParse
(dropWhile skipableChar str)
| (last str) == ')' = nextToParse (popBackPrths str)
| otherwise = dropWhile skipableChar
(dropWhile notSkipableChar (dropWhile skipableChar str))
@@ -87,7 +88,8 @@ createVariadic str =
createNodeFromFunction :: Symbol -> String -> String -> Int -> Maybe Tree
createNodeFromFunction [] _ _ _ = Nothing
createNodeFromFunction (_:xs) [] _ 0 = Just (Leaf (Symbol xs))
createNodeFromFunction (_:xs) str _ 0 = Just (Node xs (textToAST str) (Just Empty))
createNodeFromFunction (_:xs) str _ 0 = Just (Node xs (textToAST str)
(Just Empty))
createNodeFromFunction _ [] _ _ = Nothing
createNodeFromFunction (_:xs) str tail_ 1 = Just (Node xs (textToAST str)
(textToAST tail_))

0 comments on commit 9217e32

Please sign in to comment.