mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 16:16:09 +03:00
Format values
This commit is contained in:
parent
0e2a0941cd
commit
bc669ccb7a
@ -59,6 +59,13 @@ parseThings flags =
|
||||
error
|
||||
|
||||
|
||||
formatValue value =
|
||||
"{ name = " ++ stringify value.name ++ """
|
||||
, comment = """ ++ stringify value.comment ++ """
|
||||
, tipe = """ ++ formatType value.tipe ++ """
|
||||
}"""
|
||||
|
||||
|
||||
formatAlias alias_ =
|
||||
"{ name = " ++ stringify alias_.name ++ """
|
||||
, args = """ ++ listOfThings stringify alias_.args ++ """
|
||||
@ -107,6 +114,7 @@ formatType type_ =
|
||||
stringify : String -> String
|
||||
stringify s =
|
||||
s
|
||||
|> String.replace "\\" "\\\\"
|
||||
|> String.replace "\"" "\\\""
|
||||
|> wrapInQuotes
|
||||
|
||||
@ -135,7 +143,7 @@ formatModule mod =
|
||||
, aliases = """ ++ listOfThings formatAlias mod.aliases ++ """
|
||||
, unions = """ ++ listOfThings formatUnion mod.unions ++ """
|
||||
, binops = []
|
||||
, values = []
|
||||
, values = """ ++ listOfThings formatValue mod.values ++ """
|
||||
}"""
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user