@@ -1478,24 +1478,6 @@ toFuncReport source name func frow fcol =
1478 region = A.Region pos pos
1478 region = A.Region pos pos
1480 case expectation of
1480 case expectation of
1482− error "TODO no parse error yet"
1485− error "TODO no parse error yet"
1490− Report.Report "NO TABS" region [] $
1491− Report.toCodeSnippet source region Nothing
1494− "I ran into a tab, but tabs are not allowed in Elm files."
1497− "Replace the tab with spaces."
1500 DocComment ->
1482 DocComment ->
1501 Report.Report "EXPECTING DOC COMMENT" region [] $
1483 Report.Report "EXPECTING DOC COMMENT" region [] $
@@ -1535,9 +1517,6 @@ toFuncReport source name func frow fcol =
1538− ReservedOperator op ->
1539− error "TODO ReservedOperator" op
1541 Wildcard ->
1520 Wildcard ->
1542 Report.Report "EXPECTING A WILDCARD" region [] $
1521 Report.Report "EXPECTING A WILDCARD" region [] $
1543 Report.toCodeSnippet source region Nothing
1522 Report.toCodeSnippet source region Nothing
@@ -1630,158 +1609,6 @@ toFuncReport source name func frow fcol =
1633−-- PARSE ERROR TO DOCS
1636−problemToDocs :: Problem -> (D.Doc, D.Doc)
1637−problemToDocs problem =
1641− "I ran into a tab, but tabs are not allowed in Elm files."
1643− "Replace the tab with spaces."
1646− EndOfFile_Comment ->
1648− "I got to the end of the file while parsing a multi-line comment."
1651− "Multi-line comments look like {- comment -}, and it looks like\
1652− \ you are missing the closing marker."
1655− "Nested multi-line comments like {- this {- and this -} -} are allowed.\
1656− \ The opening and closing markers must be balanced though, just\
1657− \ like parentheses in normal code. Maybe that is the problem?"
1661− EndOfFile_String ->
1663− "I got to the end of the file while parsing a string."
1665− "Strings look like \"this\" with double quotes on each end.\
1666− \ Is the closing double quote missing in your code?"
1669− EndOfFile_MultiString ->
1671− "I got to the end of the file while parsing a multi-line string."
1673− "Multi-line strings look like \"\"\"this\"\"\" with three double quotes\
1674− \ on each end. Is the closing triple quote missing in your code?"
1679− "I got to the end of the file while parsing a character."
1681− "Characters look like 'c' with single quotes on each end.\
1682− \ Is the closing single quote missing in your code?"
1687− "This string is missing the closing quote."
1690− "Elm strings like \"this\" cannot contain newlines."
1693− "For strings that CAN contain newlines, say \"\"\"this\"\"\" for Elm’s\
1694− \ multi-line string syntax. It allows unescaped newlines and double quotes."
1700− "This character is missing the closing quote."
1702− "Elm characters must start and end with a single quote. Valid examples\n\
1703− \ include 'a', 'b', '\n', 'ø', and '\\u{00F8}' for unicode code points."
1706− BadNumberDot numberBeforeDot ->
1708− "Numbers cannot end with a decimal points."
1712− D.fromString (show numberBeforeDot)
1714− "Saying " <> D.green number <> " or " <> D.green (number <> ".0") <> " will work though!"
1719− "Numbers cannot have letters or underscores in them."
1721− "Maybe a space is missing between a number and a variable?"
1726− "If you put the letter E in a number, it should followed by more digits."
1728− "If you want to say 1000, you can also say 1e3.\
1729− \ You cannot just end it with an E though!"
1734− "I see the start of a hex number, but not the end."
1736− "A hex number looks like 0x123ABC, where the 0x is followed by hexidecimal\
1737− \ digits. Valid hexidecimal digits include: 0123456789abcdefABCDEF"
1742− "Normal numbers cannot start with zeros. Take the zeros off the front."
1744− "Only numbers like 0x0040 or 0.25 can start with a zero."
1749− "Variable names cannot start with an underscore like this:"
1751− "Delete the underscore and it shoulld be fine!"
1754− Theories stack allTheories ->
1757− "Something went wrong while parsing " <> contextToString "your code" "" stack <> "."
1759− case Set.toList (Set.fromList allTheories) of
1763− "I do not have any suggestions though!"
1765− "Can you get it down to a <http://sscce.org> and share it at\
1766− \ <https://github.com/elm/error-message-catalog/issues>?\
1767− \ That way we can figure out how to give better advice!"
1772− "I was expecting to see "
1773− <> addPeriod (theoryToString stack theory)
1777− [ "I was expecting:"
1780− ++ map (bullet . theoryToString stack) theories
1785-- CONTEXT
1612-- CONTEXT
@@ -1834,160 +1661,4 @@ getAnchor stack =
1835 getAnchor rest
1662 getAnchor rest
1842−bullet :: String -> D.Doc
1844− D.hang 4 (" - " <> D.fillSep (map D.fromString (words point)))
1847−addPeriod :: String -> String
1849− if last msg `elem` ['`', ')', '.', '!', '?'] then
1855−theoryToString :: ContextStack -> Theory -> String
1856−theoryToString context theory =
1859− "the `" <> keyword <> "` keyword"
1863− "=" -> equalsTheory context
1864− "->" -> "an arrow (->) followed by an expression"
1865− ":" -> "the \"has type\" symbol (:) followed by a type"
1867− "|" -> barTheory context
1868− "::" -> "the cons operator (::) followed by more list elements"
1870− "-" -> "a minus sign (-)"
1871− "_" -> "an underscore"
1872− "(" -> "a left paren, for grouping or starting tuples"
1873− ")" -> "a closing paren"
1874− "[" -> "a left square bracket, for starting lists"
1875− "]" -> "a right square bracket, to end a list"
1876− "{" -> "a left curly brace, for starting records"
1877− "}" -> "a right curly brace, to end a record"
1878− "{-|" -> "a doc comment, like {-| this -}" --}
1879− _ -> "the (" <> symbol <> ") symbol"
1882− "a lower-case variable, like `x` or `user`"
1885− "an upper-case variable, like `Maybe` or `Just`"
1888− "an infix operator, like (+) or (==)"
1891− "a digit from 0 to 9"
1898− Decl -> "a declaration, like `x = 5` or `type alias Model = { ... }`"
1899− Expr -> "an expression, like x or 42"
1900− AfterOpExpr op -> "an expression after that (" <> Name.toChars op <> ") operator, like x or 42"
1901− ElseBranch -> "an `else` branch. An `if` must handle both possibilities."
1902− Arg -> "an argument, like `name` or `total`"
1903− Pattern -> "a pattern, like `name` or (Just x)"
1904− Type -> "a type, like Int or (List String)"
1905− Listing -> "a list of exposed values and types, like (..) or (x,y,z)"
1906− Exposing -> "something like `exposing (..)`"
1909−equalsTheory :: ContextStack -> String
1910−equalsTheory stack =
1913− "an equals sign (=)"
1915− (context, _) : rest ->
1917− ExprRecord -> "an equals sign (=) followed by an expression"
1918− Definition name -> "an equals sign (=) followed by " <> Name.toChars name <> "'s definition"
1919− TypeUnion -> "an equals sign (=) followed by the first union type constructor"
1920− TypeAlias -> "an equals sign (=) followed by the aliased type"
1921− _ -> equalsTheory rest
1924−barTheory :: ContextStack -> String
1928− "a vertical bar (|)"
1930− (context, _) : rest ->
1932− ExprRecord -> "a vertical bar (|) followed by the record fields you want to update"
1933− TypeRecord -> "a vertical bar (|) followed by some record field types"
1934− TypeUnion -> "a vertical bar (|) followed by more union type constructors"
1935− _ -> barTheory rest
1938−badSpace :: ContextStack -> String
1942− "more indentation? I was not done with that last thing yet."
1944− (context, _) : rest ->
1946− ExprIf -> "the end of that `if`" <> badSpaceExprEnd rest
1947− ExprLet -> "the end of that `let`" <> badSpaceExprEnd rest
1948− ExprFunc -> badSpace rest
1949− ExprCase -> "more of that `case`" <> badSpaceExprEnd rest
1950− ExprList -> "the end of that list" <> badSpaceExprEnd rest
1951− ExprTuple -> "a closing paren" <> badSpaceExprEnd rest
1952− ExprRecord -> "the end of that record" <> badSpaceExprEnd rest
1953− Definition name -> "the rest of " <> Name.toChars name <> "'s definition" <> badSpaceExprEnd stack
1954− Annotation name -> "the rest of " <> Name.toChars name <> "'s type annotation" <> badSpaceEnd
1955− TypeTuple -> "a closing paren" <> badSpaceEnd
1956− TypeRecord -> "the end of that record" <> badSpaceEnd
1957− PatternList -> "the end of that list" <> badSpaceEnd
1958− PatternTuple -> "a closing paren" <> badSpaceEnd
1959− PatternRecord -> "the end of that record" <> badSpaceEnd
1960− Module -> "something like `module Main exposing (..)`"
1961− Import -> "something like `import Html exposing (..)`"
1962− TypeUnion -> "more of that union type" <> badSpaceEnd
1963− TypeAlias -> "more of that type alias" <> badSpaceEnd
1964− Infix -> "more of that infix declaration" <> badSpaceEnd
1965− Port -> "more of that port declaration" <> badSpaceEnd
1968−badSpaceEnd :: String
1970− ". Maybe you forgot some code? Or you need more indentation?"
1973−badSpaceExprEnd :: ContextStack -> String
1974−badSpaceExprEnd stack =
1979− (Definition name, A.Position _ column) : _ ->
1982− if column <= 1 then
1985− "more indentation? (Try " <> show (column + 1) <> "+ spaces.)"
1987− ". Maybe you forgot some code? Or maybe the body of `"
1988− <> Name.toChars name
1989− <> "` needs " <> ending
1992− badSpaceExprEnd rest