@@ -583,19 +583,64 @@ toParseErrorReport source modul =
583 toSpaceReport source space row col
583 toSpaceReport source space row col
585 ModuleEndOfFile row col ->
585 ModuleEndOfFile row col ->
586− let
586+ case Code.whatIsNext source row col of
587+ Code.Keyword keyword ->
587− region = toRegion row col
589+ region = toKeywordRegion row col keyword
589− Report.Report "EXPECTING END OF FILE" region [] $
591+ Report.Report "RESERVED WORD" region [] $
592+ Code.toSnippet source region Nothing
595+ "I got stuck on this reserved word:"
598+ "The name `" ++ keyword ++ "` is reserved, so try using a different name?"
603+ region = toKeywordRegion row col op
605+ Report.Report "UNEXPECTED SYMBOL" region [] $
590− Code.toSnippet source region Nothing
606+ Code.toSnippet source region Nothing
592− D.reflow $
608+ D.reflow $
609+ "I ran into an unexpected symbol:"
593− "I was not expecting to see anything more here:"
612+ "I was not expecting to see a " ++ op ++ " here. Try deleting it? Maybe\
594− ,
613+ \ I can give a better hint from there?"
596− "I think I have read all the declarations in the file and that there is nothing\
615+
616+ Code.Close term bracket ->
618+ region = toRegion row col
620+ Report.Report ("UNEXPECTED " ++ map Char.toUpper term) region [] $
621+ Code.toSnippet source region Nothing
624+ "I ran into an unexpected " ++ term ++ ":"
627+ "This " ++ bracket : " does not match up with an earlier open " ++ term ++ ". Try deleting it?"
632+ region = toRegion row col
634+ Report.Report "SYNTAX PROBLEM" region [] $
635+ Code.toSnippet source region Nothing
597− \ left to see, so whatever I am running into is confusing me a lot!"
641+ "Whatever I am running into is confusing me a lot! Normally I can give fairly\
642+ \ specific hints, but something is really tripping me up this time."
600 ModuleProblem row col ->
645 ModuleProblem row col ->
@@ -1060,7 +1105,7 @@ toTypeAliasReport source typeAlias startRow startCol =
1060 Code.toSnippet source surroundings (Just region)
1105 Code.toSnippet source surroundings (Just region)
1062 D.reflow $
1107 D.reflow $
1063− "I think I am parsing a type alias, but I got stuck here:"
1108+ "I am partway through parsing a type alias, but I got stuck here:"
1066 [ D.fillSep $
1111 [ D.fillSep $
@@ -1072,13 +1117,64 @@ toTypeAliasReport source typeAlias startRow startCol =
1074 AliasEquals row col ->
1119 AliasEquals row col ->
1075− error "TODO AliasEquals" row col
1120+ case Code.whatIsNext source row col of
1121+ Code.Keyword keyword ->
1123+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1124+ region = toKeywordRegion row col keyword
1126+ Report.Report "RESERVED WORD" region [] $
1127+ Code.toSnippet source surroundings (Just region)
1130+ "I ran into a reserved word unexpectedly while parsing this type alias:"
1134+ "It looks like you are trying use `" ++ keyword
1135+ ++ "` as a type variable, but it is a reserved word. Try using a different name?"
1142+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1143+ region = toRegion row col
1145+ Report.Report "PROBLEM IN TYPE ALIAS" region [] $
1146+ Code.toSnippet source surroundings (Just region)
1149+ "I am partway through parsing a type alias, but I got stuck here:"
1153+ "I was expecting to see a type variable or an an equals sign next."
1077 AliasBody tipe row col ->
1158 AliasBody tipe row col ->
1078 toTypeReport source tipe row col
1159 toTypeReport source tipe row col
1080 AliasIndentEquals row col ->
1161 AliasIndentEquals row col ->
1081− error "TODO AliasIndentEquals" row col
1162+ let
1163+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1164+ region = toRegion row col
1166+ Report.Report "UNFINISHED TYPE ALIAS" region [] $
1167+ Code.toSnippet source surroundings (Just region)
1170+ "I am partway through parsing a type alias, but I got stuck here:"
1174+ "I was expecting to see a type variable or an an equals sign next."
1083 AliasIndentBody row col ->
1179 AliasIndentBody row col ->
@@ -1149,28 +1245,157 @@ toCustomTypeReport source customType startRow startCol =
1151 CT_Equals row col ->
1247 CT_Equals row col ->
1152− error "TODO CT_Equals" row col
1248+ case Code.whatIsNext source row col of
1249+ Code.Keyword keyword ->
1251+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1252+ region = toKeywordRegion row col keyword
1254+ Report.Report "RESERVED WORD" region [] $
1255+ Code.toSnippet source surroundings (Just region)
1258+ "I ran into a reserved word unexpectedly while parsing this custom type:"
1262+ "It looks like you are trying use `" ++ keyword
1263+ ++ "` as a type variable, but it is a reserved word. Try using a different name?"
1270+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1271+ region = toRegion row col
1273+ Report.Report "PROBLEM IN CUSTOM TYPE" region [] $
1274+ Code.toSnippet source surroundings (Just region)
1277+ "I am partway through parsing a custom type, but I got stuck here:"
1281+ "I was expecting to see a type variable or an an equals sign next."
1154 CT_Bar row col ->
1286 CT_Bar row col ->
1155− error "TODO CT_Bar" row col
1287+ let
1288+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1289+ region = toRegion row col
1291+ Report.Report "PROBLEM IN CUSTOM TYPE" region [] $
1292+ Code.toSnippet source surroundings (Just region)
1295+ "I am partway through parsing a custom type, but I got stuck here:"
1299+ "I was expecting to see a vertical bar like | next."
1157 CT_Variant row col ->
1304 CT_Variant row col ->
1158− error "TODO CT_Variant" row col
1305+ let
1306+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1307+ region = toRegion row col
1309+ Report.Report "PROBLEM IN CUSTOM TYPE" region [] $
1310+ Code.toSnippet source surroundings (Just region)
1313+ "I am partway through parsing a custom type, but I got stuck here:"
1317+ ["I","was","expecting","to","see","a","variant","name","next."
1318+ ,"Something","like",D.dullyellow "Success","or",D.dullyellow "Sandwich" <> "."
1319+ ,"Any","name","that","starts","with","a","capital","letter","really!"
1160 CT_VariantArg tipe row col ->
1325 CT_VariantArg tipe row col ->
1161 toTypeReport source tipe row col
1326 toTypeReport source tipe row col
1163 CT_IndentEquals row col ->
1328 CT_IndentEquals row col ->
1164− error "TODO CT_IndentEquals" row col
1329+ let
1330+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1331+ region = toRegion row col
1333+ Report.Report "UNFINISHED CUSTOM TYPE" region [] $
1334+ Code.toSnippet source surroundings (Just region)
1337+ "I am partway through parsing a custom type, but I got stuck here:"
1341+ "I was expecting to see a type variable or an an equals sign next."
1166 CT_IndentBar row col ->
1346 CT_IndentBar row col ->
1167− error "TODO CT_IndentBar" row col
1347+ let
1348+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1349+ region = toRegion row col
1351+ Report.Report "UNFINISHED CUSTOM TYPE" region [] $
1352+ Code.toSnippet source surroundings (Just region)
1355+ "I am partway through parsing a custom type, but I got stuck here:"
1359+ "I was expecting to see a vertical bar like | next."
1169 CT_IndentAfterBar row col ->
1364 CT_IndentAfterBar row col ->
1170− error "TODO CT_IndentAfterBar" row col
1365+ let
1366+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1367+ region = toRegion row col
1369+ Report.Report "UNFINISHED CUSTOM TYPE" region [] $
1370+ Code.toSnippet source surroundings (Just region)
1373+ "I am partway through parsing a custom type, but I got stuck here:"
1377+ "I just saw a vertical bar, so I was expecting to see another variant defined next."
1172 CT_IndentAfterEquals row col ->
1382 CT_IndentAfterEquals row col ->
1173− error "TODO CT_IndentAfterEquals" row col
1383+ let
1384+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1385+ region = toRegion row col
1387+ Report.Report "UNFINISHED CUSTOM TYPE" region [] $
1388+ Code.toSnippet source surroundings (Just region)
1391+ "I am partway through parsing a custom type, but I got stuck here:"
1395+ "I just saw an equals sign, so I was expecting to see the first variant defined next."
1176customTypeNote :: D.Doc
1401customTypeNote :: D.Doc