Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Commit

Permalink
Refactoring: add number parser
Browse files Browse the repository at this point in the history
  • Loading branch information
UnkindPartition committed Feb 27, 2010
1 parent 5840c5f commit 1e514cd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ parameterSubst = do
d <- digit
return $ Positional $ read [d]

positional = do
n <- many1 digit
return $ Positional $ read n
positional = fmap Positional number

special = fmap Special $ oneOf "@*#?-$!0"

Expand All @@ -214,3 +212,9 @@ tokens = do
main = do
s <- getContents
print $ parse tokens "" s

--- Misc ---

number = do
n <- many1 digit
return $ read n

0 comments on commit 1e514cd

Please sign in to comment.