@@ -1233,7 +1233,7 @@ toDeclarationsReport source decl =
1233 case decl of
1233 case decl of
1234 DeclStart row col ->
1234 DeclStart row col ->
1235 case Code.whatIsNext source row col of
1235 case Code.whatIsNext source row col of
1236− Code.Close term _ ->
1236+ Code.Close term bracket ->
1238 region = toRegion row col
1238 region = toRegion row col
@@ -1243,7 +1243,7 @@ toDeclarationsReport source decl =
1243 D.reflow $
1243 D.reflow $
1244 "I was not expecting to see a " ++ term ++ " here:"
1244 "I was not expecting to see a " ++ term ++ " here:"
1245 , D.reflow $
1245 , D.reflow $
1246− "It does not match up with anything. Maybe try deleting it?"
1246+ "This " ++ bracket : " does not match up with an earlier open " ++ term ++ ". Try deleting it?"
1249 Code.Keyword keyword ->
1249 Code.Keyword keyword ->
@@ -4492,18 +4492,70 @@ toPTupleReport source context tuple startRow startCol =
4494 PTupleEnd row col ->
4494 PTupleEnd row col ->
4495+ case Code.whatIsNext source row col of
4496+ Code.Keyword keyword ->
4498+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
4499+ region = toKeywordRegion row col keyword
4501+ Report.Report "RESERVED WORD" region [] $
4502+ Code.toSnippet source surroundings (Just region) $
4505+ "I ran into a reserved word in this pattern:"
4508+ "The `" ++ keyword ++ "` keyword is reserved. Try using a different name instead!"
4511+ Code.Operator op ->
4496− surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
4513+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
4514+ region = toKeywordRegion row col op
4516+ Report.Report "UNEXPECTED SYMBOL" region [] $
4517+ Code.toSnippet source surroundings (Just region) $
4520+ "I ran into the " ++ op ++ " symbol unexpectedly in this pattern:"
4523+ "Only the :: symbol that works in patterns. It is useful if you\
4524+ \ are pattern matching on lists, trying to get the first element\
4525+ \ off the front. Did you want that instead?"
4528+ Code.Close term bracket ->
4530+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
4497− region = toRegion row col
4531+ region = toRegion row col
4533+ Report.Report ("STRAY " ++ map Char.toUpper term) region [] $
4534+ Code.toSnippet source surroundings (Just region) $
4537+ "I ran into a an unexpected " ++ term ++ " in this pattern:"
4540+ "This " ++ bracket : " does not match up with an earlier open " ++ term ++ ". Try deleting it?"
4545+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
4546+ region = toRegion row col
4499− Report.Report "UNFINISHED PARENTHESES" region [] $
4548+ Report.Report "UNFINISHED PARENTHESES" region [] $
4500− Code.toSnippet source surroundings (Just region) $
4549+ Code.toSnippet source surroundings (Just region) $
4502− D.reflow $
4551+ D.reflow $
4552+ "I was partway through parsing a pattern, but I got stuck here:"
4503− "I was expecting a closing parenthesis next:"
4555+ ["I","was","expecting","a","closing","parenthesis","next,","so"
4505− D.fillSep ["Try","adding","a",D.dullyellow ")","to","see","if","that","helps?"]
4556+ ,"try","adding","a",D.dullyellow ")","to","see","if","that","helps?"
4508 PTupleExpr pattern row col ->
4560 PTupleExpr pattern row col ->
4509 toPatternReport source context pattern row col
4561 toPatternReport source context pattern row col