@@ -35,7 +35,7 @@ data Error
35data SyntaxProblem
35data SyntaxProblem
36 = Op Row Col
36 = Op Row Col
37 | OpBad BadOperator Row Col
37 | OpBad BadOperator Row Col
38− | Export Row Col
38+ | Name Row Col
39 | Space E.Space Row Col
39 | Space E.Space Row Col
40 | Comma Row Col
40 | Comma Row Col
41 | BadEnd Row Col
41 | BadEnd Row Col
@@ -88,8 +88,9 @@ toReports source err =
88 \ it will be easy to understand as people read the documentation!"
88 \ it will be easy to understand as people read the documentation!"
91− SyntaxProblem _ ->
91+ SyntaxProblem problem ->
92− error "TODO SyntaxProblem in docs"
92+ NE.singleton $
93+ toSyntaxProblemReport source problem
94 NameProblems problems ->
95 NameProblems problems ->
95 fmap (toNameProblemReport source) problems
96 fmap (toNameProblemReport source) problems
@@ -98,6 +99,66 @@ toReports source err =
98 fmap (toDefProblemReport source) problems
99 fmap (toDefProblemReport source) problems
106+toSyntaxProblemReport :: Code.Source -> SyntaxProblem -> Report.Report
107+toSyntaxProblemReport source problem =
109+ toSyntaxReport row col details =
111+ region = toRegion row col
113+ Report.Report "PROBLEM IN DOCS" region [] $
114+ Code.toSnippet source region Nothing
115+ ( D.reflow "I was partway through parsing your module documentation, but I got stuck here:"
119+ "Read through https://package.elm-lang.org/help/documentation-format for\
120+ \ tips on how to write module documentation!"
126+ toSyntaxReport row col $
127+ "I am trying to parse an operator like (+) or (*) but something is going wrong."
130+ toSyntaxReport row col $
131+ "I am trying to parse an operator like (+) or (*) but it looks like you are using\
132+ \ a reserved symbol in this case."
135+ toSyntaxReport row col $
136+ "I was expecting to see the name of another exposed value from this module."
138+ Space space row col ->
139+ E.toSpaceReport source space row col
142+ toSyntaxReport row col $
143+ "I was expecting to see a comma next."
146+ toSyntaxReport row col $
147+ "I am not really sure what I am getting stuck on though."
150+toRegion :: Row -> Col -> A.Region
153+ pos = A.Position row col
101toNameProblemReport :: Code.Source -> NameProblem -> Report.Report
162toNameProblemReport :: Code.Source -> NameProblem -> Report.Report
102toNameProblemReport source problem =
163toNameProblemReport source problem =
103 case problem of
164 case problem of
@@ -151,6 +212,10 @@ toNameProblemReport source problem =
154toDefProblemReport :: Code.Source -> DefProblem -> Report.Report
219toDefProblemReport :: Code.Source -> DefProblem -> Report.Report
155toDefProblemReport source problem =
220toDefProblemReport source problem =
156 case problem of
221 case problem of