@@ -261,14 +261,14 @@ data Record
263data Tuple
263data Tuple
265− | TupleExpr Expr Row Col
264+ = TupleExpr Expr Row Col
266 | TupleSpace Space Row Col
265 | TupleSpace Space Row Col
267 | TupleEnd Row Col
266 | TupleEnd Row Col
268 | TupleOperatorClose Row Col
267 | TupleOperatorClose Row Col
269 | TupleOperatorReserved Operator Row Col
268 | TupleOperatorReserved Operator Row Col
271− | TupleIndentExpr Row Col
270+ | TupleIndentExpr1 Row Col
271+ | TupleIndentExprN Row Col
272 | TupleIndentEnd Row Col
272 | TupleIndentEnd Row Col
@@ -810,8 +810,8 @@ toExprReport source name expr _ _ =
810 Update _ _ _ ->
810 Update _ _ _ ->
811 error "TODO Update"
811 error "TODO Update"
813− Tuple _ _ _ ->
813+ Tuple tuple row col ->
814− error "TODO Tuple"
814+ toTupleReport source name tuple row col
816 Func func row col ->
816 Func func row col ->
817 toFuncReport source name func row col
817 toFuncReport source name func row col
@@ -856,21 +856,44 @@ toExprReport source name expr _ _ =
856 Report.toCodeSnippet source region Nothing
856 Report.toCodeSnippet source region Nothing
858 D.reflow $
858 D.reflow $
859− "I need to see an expression after this " ++ Name.toChars op ++ " operator:"
859+ "I was expecting to see an expression after this " ++ Name.toChars op ++ " operator:"
861− D.fillSep $
862+ [ D.fillSep $
862− ["You","can","just","put","anything","for","now,","like"
863+ ["You","can","just","put","anything","for","now,","like"
863− ,D.dullyellow "42","or",D.dullyellow"\"hello\"" <> "."
864+ ,D.dullyellow "42","or",D.dullyellow"\"hello\"" <> "."
864− ,"Once","there","is","something","there,","I","can","give","more"
865+ ,"Once","there","is","something","there,","I","can","give","more"
865− ,"specific","hints","about","what","type","of","value","is","needed!"
866+ ,"specific","hints","about","what","type","of","value","is","needed!"
869+ "This can happen if see reserved words like `let` or `as` unexpectedly.\
870+ \ I can get confused and not understand what is going on very well!"
869 OperatorReserved operator row col ->
874 OperatorReserved operator row col ->
870 toOperatorReport source name operator row col
875 toOperatorReport source name operator row col
872− Start _ _ ->
877+ Start row col ->
873− error "TODO Start"
878+ let region = toRegion row col in
879+ Report.Report "MISSING EXPRESSION" region [] $
880+ Report.toCodeSnippet source region Nothing
883+ "I was expecting to see an expression next:"
887+ ["You","can","just","put","anything","for","now,","like"
888+ ,D.dullyellow "42","or",D.dullyellow"\"hello\"" <> "."
889+ ,"Once","there","is","something","there,","I","can","give","more"
890+ ,"specific","hints","about","what","type","of","value","is","needed!"
893+ "This can happen if see reserved words like `let` or `as` unexpectedly.\
894+ \ I can get confused and not understand what is going on very well!"
875 Char char row col ->
898 Char char row col ->
876 toCharReport source char row col
899 toCharReport source char row col
@@ -1327,9 +1350,128 @@ toOperatorReport source name operator row col =
1353+toTupleReport :: Code.Source -> Name.Name -> Tuple -> Row -> Col -> Report.Report
1354+toTupleReport source name tuple startRow startCol =
1356+ TupleExpr expr row col ->
1357+ toExprReport source name expr row col
1359+ TupleSpace space row col ->
1360+ toSpaceReport source space row col
1362+ TupleEnd row col ->
1364+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1365+ region = toRegion row col
1367+ Report.Report "UNFINISHED PARENTHESES" region [] $
1368+ Report.toCodeSnippet source surroundings (Just region)
1371+ "I was expecting to see a closing parenthesis next:"
1374+ [ D.fillSep ["Try","adding","a",D.dullyellow ")","to","see","if","that","helps?"]
1376+ "This can happen if I see reserved words like `let` or `as` unexpectedly.\
1377+ \ So I could be stuck on some other problem, which is not letting me get to\
1378+ \ the closing parenthesis I am expecting to see."
1382+ TupleOperatorClose row col ->
1384+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1385+ region = toRegion row col
1387+ Report.Report "UNFINISHED OPERATOR FUNCTION" region [] $
1388+ Report.toCodeSnippet source surroundings (Just region)
1390+ D.reflow "I was expecting a closing parenthesis here:"
1392+ D.fillSep ["Try","adding","a",D.dullyellow ")","to","see","if","that","helps!"]
1395+ TupleOperatorReserved operator row col ->
1397+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1398+ region = toRegion row col
1400+ Report.Report "UNEXPECTED SYMBOL" region [] $
1401+ Report.toCodeSnippet source surroundings (Just region)
1404+ "I ran into an unexpected symbol here:"
1408+ OpDot -> ["Maybe","you","wanted","a","record","accessor","like",D.dullyellow ".x","or",D.dullyellow ".name","instead?"]
1409+ OpPipe -> ["Try",D.dullyellow "(||)","instead?","To","turn","boolean","OR","into","a","function?"]
1410+ OpArrow -> ["Maybe","you","wanted",D.dullyellow "(>)","or",D.dullyellow "(>=)","instead?"]
1411+ OpEquals -> ["Try",D.dullyellow "(==)","instead?","To","make","a","function","that","checks","equality?"]
1412+ OpHasType -> ["Try",D.dullyellow "(::)","instead?","To","add","values","to","the","front","of","lists?"]
1415+ TupleIndentExpr1 row col ->
1417+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1418+ region = toRegion row col
1420+ Report.Report "UNFINISHED PARENTHESES" region [] $
1421+ Report.toCodeSnippet source surroundings (Just region)
1424+ "I just saw an open parenthesis, so I was expecting to see an expression next."
1428+ ["Something","like",D.dullyellow "(4 + 5)","or"
1429+ ,D.dullyellow "(String.reverse \"desserts\")" <> "."
1430+ ,"Anything","where","you","are","putting","parentheses","around","normal","expressions."
1433+ "If you are trying to use the (+) syntax for referring to operators as functions (or\
1434+ \ the () syntax for the unit value) the issue may be that no spaces are allowed between\
1435+ \ the parentheses."
1439+ TupleIndentExprN row col ->
1441+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1442+ region = toRegion row col
1444+ Report.Report "UNFINISHED TUPLE" region [] $
1445+ Report.toCodeSnippet source surroundings (Just region)
1448+ "I just saw a comma, so I was expecting to see another expression in this tuple."
1451+ ["A","tuple","looks","like",D.dullyellow "(3,4)","or"
1452+ ,D.dullyellow "(\"Tom\",42)" <> ","
1453+ ,"so","I","think","there","is","an","expression","missing","here?"
1457+ TupleIndentEnd row col ->
1459+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1460+ region = toRegion row col
1462+ Report.Report "UNFINISHED PARENTHESES" region [] $
1463+ Report.toCodeSnippet source surroundings (Just region)
1466+ "I was expecting to see a closing parenthesis next:"
1468+ D.fillSep ["Try","adding","a",D.dullyellow ")","to","see","if","that","helps!"]
1330toListReport :: Code.Source -> Name.Name -> List -> Row -> Col -> Report.Report
1472toListReport :: Code.Source -> Name.Name -> List -> Row -> Col -> Report.Report
1331−toListReport source name func startRow startCol =
1473+toListReport source name list startRow startCol =
1332− case func of
1474+ case list of
1333 ListSpace space row col ->
1475 ListSpace space row col ->
1334 toSpaceReport source space row col
1476 toSpaceReport source space row col