module Hasmin.Parser.BorderRadius
( borderRadius
) where
import Data.Attoparsec.Text (Parser)
import qualified Data.Attoparsec.Text as A
import Data.List.NonEmpty (NonEmpty((:|)))
import Hasmin.Parser.Utils
import Hasmin.Parser.PercentageLength
import Hasmin.Types.BorderRadius
borderRadius :: Parser BorderRadius
borderRadius = do
x <- percentageLength <* skipComments
xs <- atMost 3 (percentageLength <* skipComments)
ys <- A.option [] $ A.char '/' *> atMost 4 (skipComments *> percentageLength)
pure $ BorderRadius (x:|xs) ys