From 82d636bd0a152e475599bf63a3351408137b87da Mon Sep 17 00:00:00 2001 From: JRI98 <38755101+JRI98@users.noreply.github.com> Date: Wed, 30 Jul 2025 11:32:50 +0200 Subject: [PATCH 1/2] Fix parser fuzz crash by improving formatting of pattern alternatives zig build repro-parse -- -b YXBwW117ZjpwbGF0Zm9ybSIifVtdfHx7fW1hdGNoIDB7MHwjDTA9Pnt9CigpPT4wfQ== -v --- src/fmt.zig | 5 +- src/parse/Parser.zig | 3 - src/snapshots/crash_and_ellipsis_test.md | 298 ++++++++++----------- src/snapshots/fuzz_crash/fuzz_crash_009.md | 86 +++--- src/snapshots/fuzz_crash/fuzz_crash_010.md | 86 +++--- src/snapshots/fuzz_crash/fuzz_crash_013.md | 21 +- src/snapshots/fuzz_crash/fuzz_crash_024.md | 132 ++------- src/snapshots/fuzz_crash/fuzz_crash_029.md | 200 ++------------ src/snapshots/fuzz_crash/fuzz_crash_035.md | 21 +- src/snapshots/fuzz_crash/fuzz_crash_036.md | 40 ++- src/snapshots/fuzz_crash/fuzz_crash_040.md | 54 +--- src/snapshots/fuzz_crash/fuzz_crash_043.md | 68 +---- src/snapshots/fuzz_crash/fuzz_crash_044.md | 97 +------ src/snapshots/fuzz_crash/fuzz_crash_065.md | 47 +--- 14 files changed, 357 insertions(+), 801 deletions(-) diff --git a/src/fmt.zig b/src/fmt.zig index 351e7a80fb4..9802e697baf 100644 --- a/src/fmt.zig +++ b/src/fmt.zig @@ -1292,7 +1292,7 @@ const Formatter = struct { const pattern_region = fmt.nodeRegion(@intFromEnum(p)); _ = try fmt.formatPattern(p); fmt.curr_indent = curr_indent; - if (i < (a.patterns.span.len - 1)) { + if (i < a.patterns.span.len - 1) { if (multiline) { _ = try fmt.flushCommentsBefore(pattern_region.end); try fmt.ensureNewline(); @@ -1302,8 +1302,7 @@ const Formatter = struct { } try fmt.push('|'); const next_region = fmt.nodeRegion(@intFromEnum(patterns[i + 1])); - const flushed = try fmt.flushCommentsBefore(next_region.start); - if (flushed) { + if (multiline and try fmt.flushCommentsBefore(next_region.start)) { fmt.curr_indent += 1; try fmt.pushIndent(); } else { diff --git a/src/parse/Parser.zig b/src/parse/Parser.zig index cb41dfbbd4c..a6e89e474cf 100644 --- a/src/parse/Parser.zig +++ b/src/parse/Parser.zig @@ -1204,9 +1204,6 @@ fn parseStmtByType(self: *Parser, statementType: StatementType) std.mem.Allocato .region = .{ .start = start, .end = self.pos }, } }); return statement_idx; - } else if (statementType == .top_level and isCurly) { - // Blocks not allowed as top level statements - return try self.pushMalformed(AST.Statement.Idx, .statement_unexpected_token, start); } }, else => {}, diff --git a/src/snapshots/crash_and_ellipsis_test.md b/src/snapshots/crash_and_ellipsis_test.md index 27640efadae..7a94d7dddbf 100644 --- a/src/snapshots/crash_and_ellipsis_test.md +++ b/src/snapshots/crash_and_ellipsis_test.md @@ -13,11 +13,15 @@ testEllipsis = |_| ... # Test crash statement testCrash : U64 -> U64 -testCrash = |_| crash "This is a crash message" +testCrash = |_| { + crash "This is a crash message" +} # Test crash with different message testCrashSimple : U64 -> U64 -testCrashSimple = |_| crash "oops" +testCrashSimple = |_| { + crash "oops" +} main! = |_| { result1 = testEllipsis(42) @@ -27,74 +31,18 @@ main! = |_| { } ~~~ # EXPECTED -UNEXPECTED TOKEN IN EXPRESSION - crash_and_ellipsis_test.md:9:17:9:22 -UNEXPECTED TOKEN IN EXPRESSION - crash_and_ellipsis_test.md:13:23:13:28 -INVALID LAMBDA - :0:0:0:0 -INVALID STATEMENT - crash_and_ellipsis_test.md:9:23:9:48 -INVALID LAMBDA - :0:0:0:0 -INVALID STATEMENT - crash_and_ellipsis_test.md:13:29:13:35 -UNUSED VARIABLE - crash_and_ellipsis_test.md:17:5:17:12 -UNUSED VARIABLE - crash_and_ellipsis_test.md:18:5:18:12 -UNUSED VARIABLE - crash_and_ellipsis_test.md:16:5:16:12 +UNUSED VARIABLE - crash_and_ellipsis_test.md:21:5:21:12 +UNUSED VARIABLE - crash_and_ellipsis_test.md:22:5:22:12 +UNUSED VARIABLE - crash_and_ellipsis_test.md:20:5:20:12 +TYPE MISMATCH - crash_and_ellipsis_test.md:8:20:8:23 +TYPE MISMATCH - crash_and_ellipsis_test.md:14:26:14:29 # PROBLEMS -**UNEXPECTED TOKEN IN EXPRESSION** -The token **crash** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**crash_and_ellipsis_test.md:9:17:9:22:** -```roc -testCrash = |_| crash "This is a crash message" -``` - ^^^^^ - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **crash** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**crash_and_ellipsis_test.md:13:23:13:28:** -```roc -testCrashSimple = |_| crash "oops" -``` - ^^^^^ - - -**INVALID LAMBDA** -The body of this lambda expression is not valid. - -**INVALID STATEMENT** -The statement `expression` is not allowed at the top level. -Only definitions, type annotations, and imports are allowed at the top level. - -**crash_and_ellipsis_test.md:9:23:9:48:** -```roc -testCrash = |_| crash "This is a crash message" -``` - ^^^^^^^^^^^^^^^^^^^^^^^^^ - - -**INVALID LAMBDA** -The body of this lambda expression is not valid. - -**INVALID STATEMENT** -The statement `expression` is not allowed at the top level. -Only definitions, type annotations, and imports are allowed at the top level. - -**crash_and_ellipsis_test.md:13:29:13:35:** -```roc -testCrashSimple = |_| crash "oops" -``` - ^^^^^^ - - **UNUSED VARIABLE** Variable `result2` is not used anywhere in your code. If you don't need this variable, prefix it with an underscore like `_result2` to suppress this warning. The unused variable is declared here: -**crash_and_ellipsis_test.md:17:5:17:12:** +**crash_and_ellipsis_test.md:21:5:21:12:** ```roc result2 = testCrash(42) ``` @@ -106,7 +54,7 @@ Variable `result3` is not used anywhere in your code. If you don't need this variable, prefix it with an underscore like `_result3` to suppress this warning. The unused variable is declared here: -**crash_and_ellipsis_test.md:18:5:18:12:** +**crash_and_ellipsis_test.md:22:5:22:12:** ```roc result3 = testCrashSimple(42) ``` @@ -118,32 +66,64 @@ Variable `result1` is not used anywhere in your code. If you don't need this variable, prefix it with an underscore like `_result1` to suppress this warning. The unused variable is declared here: -**crash_and_ellipsis_test.md:16:5:16:12:** +**crash_and_ellipsis_test.md:20:5:20:12:** ```roc result1 = testEllipsis(42) ``` ^^^^^^^ +**TYPE MISMATCH** +This expression is used in an unexpected way: +**crash_and_ellipsis_test.md:8:20:8:23:** +```roc +testCrash : U64 -> U64 +``` + ^^^ + +It is of type: + _U64_ + +But you are trying to use it as: + _{}_ + +**TYPE MISMATCH** +This expression is used in an unexpected way: +**crash_and_ellipsis_test.md:14:26:14:29:** +```roc +testCrashSimple : U64 -> U64 +``` + ^^^ + +It is of type: + _U64_ + +But you are trying to use it as: + _{}_ + # TOKENS ~~~zig KwApp(1:1-1:4),OpenSquare(1:5-1:6),LowerIdent(1:6-1:11),CloseSquare(1:11-1:12),OpenCurly(1:13-1:14),LowerIdent(1:15-1:17),OpColon(1:17-1:18),KwPlatform(1:19-1:27),StringStart(1:28-1:29),StringPart(1:29-1:54),StringEnd(1:54-1:55),CloseCurly(1:56-1:57), LowerIdent(4:1-4:13),OpColon(4:14-4:15),UpperIdent(4:16-4:19),OpArrow(4:20-4:22),UpperIdent(4:23-4:26), LowerIdent(5:1-5:13),OpAssign(5:14-5:15),OpBar(5:16-5:17),Underscore(5:17-5:18),OpBar(5:18-5:19),TripleDot(5:20-5:23), LowerIdent(8:1-8:10),OpColon(8:11-8:12),UpperIdent(8:13-8:16),OpArrow(8:17-8:19),UpperIdent(8:20-8:23), -LowerIdent(9:1-9:10),OpAssign(9:11-9:12),OpBar(9:13-9:14),Underscore(9:14-9:15),OpBar(9:15-9:16),KwCrash(9:17-9:22),StringStart(9:23-9:24),StringPart(9:24-9:47),StringEnd(9:47-9:48), -LowerIdent(12:1-12:16),OpColon(12:17-12:18),UpperIdent(12:19-12:22),OpArrow(12:23-12:25),UpperIdent(12:26-12:29), -LowerIdent(13:1-13:16),OpAssign(13:17-13:18),OpBar(13:19-13:20),Underscore(13:20-13:21),OpBar(13:21-13:22),KwCrash(13:23-13:28),StringStart(13:29-13:30),StringPart(13:30-13:34),StringEnd(13:34-13:35), -LowerIdent(15:1-15:6),OpAssign(15:7-15:8),OpBar(15:9-15:10),Underscore(15:10-15:11),OpBar(15:11-15:12),OpenCurly(15:13-15:14), -LowerIdent(16:5-16:12),OpAssign(16:13-16:14),LowerIdent(16:15-16:27),NoSpaceOpenRound(16:27-16:28),Int(16:28-16:30),CloseRound(16:30-16:31), -LowerIdent(17:5-17:12),OpAssign(17:13-17:14),LowerIdent(17:15-17:24),NoSpaceOpenRound(17:24-17:25),Int(17:25-17:27),CloseRound(17:27-17:28), -LowerIdent(18:5-18:12),OpAssign(18:13-18:14),LowerIdent(18:15-18:30),NoSpaceOpenRound(18:30-18:31),Int(18:31-18:33),CloseRound(18:33-18:34), -OpenSquare(19:5-19:6),CloseSquare(19:6-19:7), -CloseCurly(20:1-20:2),EndOfFile(20:2-20:2), +LowerIdent(9:1-9:10),OpAssign(9:11-9:12),OpBar(9:13-9:14),Underscore(9:14-9:15),OpBar(9:15-9:16),OpenCurly(9:17-9:18), +KwCrash(10:2-10:7),StringStart(10:8-10:9),StringPart(10:9-10:32),StringEnd(10:32-10:33), +CloseCurly(11:1-11:2), +LowerIdent(14:1-14:16),OpColon(14:17-14:18),UpperIdent(14:19-14:22),OpArrow(14:23-14:25),UpperIdent(14:26-14:29), +LowerIdent(15:1-15:16),OpAssign(15:17-15:18),OpBar(15:19-15:20),Underscore(15:20-15:21),OpBar(15:21-15:22),OpenCurly(15:23-15:24), +KwCrash(16:2-16:7),StringStart(16:8-16:9),StringPart(16:9-16:13),StringEnd(16:13-16:14), +CloseCurly(17:1-17:2), +LowerIdent(19:1-19:6),OpAssign(19:7-19:8),OpBar(19:9-19:10),Underscore(19:10-19:11),OpBar(19:11-19:12),OpenCurly(19:13-19:14), +LowerIdent(20:5-20:12),OpAssign(20:13-20:14),LowerIdent(20:15-20:27),NoSpaceOpenRound(20:27-20:28),Int(20:28-20:30),CloseRound(20:30-20:31), +LowerIdent(21:5-21:12),OpAssign(21:13-21:14),LowerIdent(21:15-21:24),NoSpaceOpenRound(21:24-21:25),Int(21:25-21:27),CloseRound(21:27-21:28), +LowerIdent(22:5-22:12),OpAssign(22:13-22:14),LowerIdent(22:15-22:30),NoSpaceOpenRound(22:30-22:31),Int(22:31-22:33),CloseRound(22:33-22:34), +OpenSquare(23:5-23:6),CloseSquare(23:6-23:7), +CloseCurly(24:1-24:2),EndOfFile(24:2-24:2), ~~~ # PARSE ~~~clojure -(file @1.1-20.2 +(file @1.1-24.2 (app @1.1-1.57 (provides @1.5-1.12 (exposed-lower-ident @1.6-1.11 @@ -170,49 +150,53 @@ CloseCurly(20:1-20:2),EndOfFile(20:2-20:2), (ty-fn @8.13-8.23 (ty @8.13-8.16 (name "U64")) (ty @8.20-8.23 (name "U64")))) - (s-decl @9.1-9.22 + (s-decl @9.1-11.2 (p-ident @9.1-9.10 (raw "testCrash")) - (e-lambda @9.13-9.22 + (e-lambda @9.13-11.2 (args (p-underscore)) - (e-malformed @9.17-9.22 (reason "expr_unexpected_token")))) - (e-string @9.23-9.48 - (e-string-part @9.24-9.47 (raw "This is a crash message"))) - (s-type-anno @12.1-12.29 (name "testCrashSimple") - (ty-fn @12.19-12.29 - (ty @12.19-12.22 (name "U64")) - (ty @12.26-12.29 (name "U64")))) - (s-decl @13.1-13.28 - (p-ident @13.1-13.16 (raw "testCrashSimple")) - (e-lambda @13.19-13.28 + (e-block @9.17-11.2 + (statements + (s-crash @10.2-10.33 + (e-string @10.8-10.33 + (e-string-part @10.9-10.32 (raw "This is a crash message")))))))) + (s-type-anno @14.1-14.29 (name "testCrashSimple") + (ty-fn @14.19-14.29 + (ty @14.19-14.22 (name "U64")) + (ty @14.26-14.29 (name "U64")))) + (s-decl @15.1-17.2 + (p-ident @15.1-15.16 (raw "testCrashSimple")) + (e-lambda @15.19-17.2 (args (p-underscore)) - (e-malformed @13.23-13.28 (reason "expr_unexpected_token")))) - (e-string @13.29-13.35 - (e-string-part @13.30-13.34 (raw "oops"))) - (s-decl @15.1-20.2 - (p-ident @15.1-15.6 (raw "main!")) - (e-lambda @15.9-20.2 + (e-block @15.23-17.2 + (statements + (s-crash @16.2-16.14 + (e-string @16.8-16.14 + (e-string-part @16.9-16.13 (raw "oops")))))))) + (s-decl @19.1-24.2 + (p-ident @19.1-19.6 (raw "main!")) + (e-lambda @19.9-24.2 (args (p-underscore)) - (e-block @15.13-20.2 + (e-block @19.13-24.2 (statements - (s-decl @16.5-16.31 - (p-ident @16.5-16.12 (raw "result1")) - (e-apply @16.15-16.31 - (e-ident @16.15-16.27 (raw "testEllipsis")) - (e-int @16.28-16.30 (raw "42")))) - (s-decl @17.5-17.28 - (p-ident @17.5-17.12 (raw "result2")) - (e-apply @17.15-17.28 - (e-ident @17.15-17.24 (raw "testCrash")) - (e-int @17.25-17.27 (raw "42")))) - (s-decl @18.5-18.34 - (p-ident @18.5-18.12 (raw "result3")) - (e-apply @18.15-18.34 - (e-ident @18.15-18.30 (raw "testCrashSimple")) - (e-int @18.31-18.33 (raw "42")))) - (e-list @19.5-19.7))))))) + (s-decl @20.5-20.31 + (p-ident @20.5-20.12 (raw "result1")) + (e-apply @20.15-20.31 + (e-ident @20.15-20.27 (raw "testEllipsis")) + (e-int @20.28-20.30 (raw "42")))) + (s-decl @21.5-21.28 + (p-ident @21.5-21.12 (raw "result2")) + (e-apply @21.15-21.28 + (e-ident @21.15-21.24 (raw "testCrash")) + (e-int @21.25-21.27 (raw "42")))) + (s-decl @22.5-22.34 + (p-ident @22.5-22.12 (raw "result3")) + (e-apply @22.15-22.34 + (e-ident @22.15-22.30 (raw "testCrashSimple")) + (e-int @22.31-22.33 (raw "42")))) + (e-list @23.5-23.7))))))) ~~~ # FORMATTED ~~~roc @@ -224,13 +208,15 @@ testEllipsis = |_| ... # Test crash statement testCrash : U64 -> U64 -testCrash = |_| -"This is a crash message" +testCrash = |_| { + crash "This is a crash message" +} # Test crash with different message testCrashSimple : U64 -> U64 -testCrashSimple = |_| -"oops" +testCrashSimple = |_| { + crash "oops" +} main! = |_| { result1 = testEllipsis(42) @@ -255,62 +241,72 @@ main! = |_| { (ty @4.23-4.26 (name "U64")))))) (d-let (p-assign @9.1-9.10 (ident "testCrash")) - (e-runtime-error (tag "lambda_body_not_canonicalized")) + (e-lambda @9.13-11.2 + (args + (p-underscore @9.14-9.15)) + (e-block @9.17-11.2 + (s-crash @10.2-10.33 (msg "This is a crash message")) + (e-empty_record @9.17-11.2))) (annotation @9.1-9.10 (declared-type (ty-fn @8.13-8.23 (effectful false) (ty @8.13-8.16 (name "U64")) (ty @8.20-8.23 (name "U64")))))) (d-let - (p-assign @13.1-13.16 (ident "testCrashSimple")) - (e-runtime-error (tag "lambda_body_not_canonicalized")) - (annotation @13.1-13.16 + (p-assign @15.1-15.16 (ident "testCrashSimple")) + (e-lambda @15.19-17.2 + (args + (p-underscore @15.20-15.21)) + (e-block @15.23-17.2 + (s-crash @16.2-16.14 (msg "oops")) + (e-empty_record @15.23-17.2))) + (annotation @15.1-15.16 (declared-type - (ty-fn @12.19-12.29 (effectful false) - (ty @12.19-12.22 (name "U64")) - (ty @12.26-12.29 (name "U64")))))) + (ty-fn @14.19-14.29 (effectful false) + (ty @14.19-14.22 (name "U64")) + (ty @14.26-14.29 (name "U64")))))) (d-let - (p-assign @15.1-15.6 (ident "main!")) - (e-closure @15.9-20.2 + (p-assign @19.1-19.6 (ident "main!")) + (e-closure @19.9-24.2 (captures (capture @9.1-9.10 (ident "testCrash")) - (capture @13.1-13.16 (ident "testCrashSimple")) + (capture @15.1-15.16 (ident "testCrashSimple")) (capture @5.1-5.13 (ident "testEllipsis"))) - (e-lambda @15.9-20.2 + (e-lambda @19.9-24.2 (args - (p-underscore @15.10-15.11)) - (e-block @15.13-20.2 - (s-let @16.5-16.31 - (p-assign @16.5-16.12 (ident "result1")) - (e-call @16.15-16.31 - (e-lookup-local @16.15-16.27 + (p-underscore @19.10-19.11)) + (e-block @19.13-24.2 + (s-let @20.5-20.31 + (p-assign @20.5-20.12 (ident "result1")) + (e-call @20.15-20.31 + (e-lookup-local @20.15-20.27 (p-assign @5.1-5.13 (ident "testEllipsis"))) - (e-int @16.28-16.30 (value "42")))) - (s-let @17.5-17.28 - (p-assign @17.5-17.12 (ident "result2")) - (e-call @17.15-17.28 - (e-lookup-local @17.15-17.24 + (e-int @20.28-20.30 (value "42")))) + (s-let @21.5-21.28 + (p-assign @21.5-21.12 (ident "result2")) + (e-call @21.15-21.28 + (e-lookup-local @21.15-21.24 (p-assign @9.1-9.10 (ident "testCrash"))) - (e-int @17.25-17.27 (value "42")))) - (s-let @18.5-18.34 - (p-assign @18.5-18.12 (ident "result3")) - (e-call @18.15-18.34 - (e-lookup-local @18.15-18.30 - (p-assign @13.1-13.16 (ident "testCrashSimple"))) - (e-int @18.31-18.33 (value "42")))) - (e-empty_list @19.5-19.7)))))) + (e-int @21.25-21.27 (value "42")))) + (s-let @22.5-22.34 + (p-assign @22.5-22.12 (ident "result3")) + (e-call @22.15-22.34 + (e-lookup-local @22.15-22.30 + (p-assign @15.1-15.16 (ident "testCrashSimple"))) + (e-int @22.31-22.33 (value "42")))) + (e-empty_list @23.5-23.7)))))) ~~~ # TYPES ~~~clojure (inferred-types (defs (patt @5.1-5.13 (type "U64 -> U64")) - (patt @9.1-9.10 (type "Error")) - (patt @13.1-13.16 (type "Error")) - (patt @15.1-15.6 (type "_arg -> List(_elem)"))) + (patt @9.1-9.10 (type "U64 -> Error")) + (patt @15.1-15.16 (type "U64 -> Error")) + (patt @19.1-19.6 (type "_arg -> List(_elem)"))) (expressions (expr @5.16-5.23 (type "U64 -> U64")) - (expr @9.17-9.22 (type "Error")) - (expr @13.23-13.28 (type "Error")) - (expr @15.9-20.2 (type "_arg -> List(_elem)")))) + (expr @9.13-11.2 (type "U64 -> Error")) + (expr @15.19-17.2 (type "U64 -> Error")) + (expr @19.9-24.2 (type "_arg -> List(_elem)")))) ~~~ diff --git a/src/snapshots/fuzz_crash/fuzz_crash_009.md b/src/snapshots/fuzz_crash/fuzz_crash_009.md index 4ea5eb34006..995f84575d2 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_009.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_009.md @@ -15,13 +15,13 @@ foo = # EXPECTED UNCLOSED STRING - :0:0:0:0 MISSING HEADER - fuzz_crash_009.md:1:2:1:3 -PARSE ERROR - fuzz_crash_009.md:1:3:1:4 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_009.md:1:5:1:6 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_009.md:2:6:2:7 +PARSE ERROR - fuzz_crash_009.md:2:6:2:7 +PARSE ERROR - fuzz_crash_009.md:4:1:4:4 +UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_009.md:4:5:4:6 PARSE ERROR - fuzz_crash_009.md:6:12:6:12 -INVALID STATEMENT - fuzz_crash_009.md:1:4:1:5 -INVALID STATEMENT - fuzz_crash_009.md:1:5:1:6 -INVALID STATEMENT - fuzz_crash_009.md:2:6:2:7 +INVALID STATEMENT - fuzz_crash_009.md:1:3:4:4 +INVALID STATEMENT - fuzz_crash_009.md:4:5:4:6 +INVALID STATEMENT - fuzz_crash_009.md:6:5:6:12 # PROBLEMS **UNCLOSED STRING** This string is missing a closing quote. @@ -43,39 +43,39 @@ Here is the problematic code: **PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` +A parsing error occurred: `expected_expr_record_field_name` This is an unexpected parsing error. Please check your syntax. Here is the problematic code: -**fuzz_crash_009.md:1:3:1:4:** +**fuzz_crash_009.md:2:6:2:7:** ```roc - f{o, + ] ``` - ^ + ^ -**UNEXPECTED TOKEN IN EXPRESSION** -The token **,** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. +**PARSE ERROR** +A parsing error occurred: `expected_expr_close_curly_or_comma` +This is an unexpected parsing error. Please check your syntax. Here is the problematic code: -**fuzz_crash_009.md:1:5:1:6:** +**fuzz_crash_009.md:4:1:4:4:** ```roc - f{o, +foo = ``` - ^ +^^^ **UNEXPECTED TOKEN IN EXPRESSION** -The token **]** is not expected in an expression. +The token **=** is not expected in an expression. Expressions can be identifiers, literals, function calls, or operators. Here is the problematic code: -**fuzz_crash_009.md:2:6:2:7:** +**fuzz_crash_009.md:4:5:4:6:** ```roc - ] +foo = ``` - ^ + ^ **PARSE ERROR** @@ -94,20 +94,22 @@ Here is the problematic code: The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_009.md:1:4:1:5:** +**fuzz_crash_009.md:1:3:4:4:** ```roc f{o, + ] + +foo = ``` - ^ **INVALID STATEMENT** The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_009.md:1:5:1:6:** +**fuzz_crash_009.md:4:5:4:6:** ```roc - f{o, +foo = ``` ^ @@ -116,11 +118,11 @@ Only definitions, type annotations, and imports are allowed at the top level. The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_009.md:2:6:2:7:** +**fuzz_crash_009.md:6:5:6:12:** ```roc - ] + "onmo % ``` - ^ + ^^^^^^^ # TOKENS @@ -135,38 +137,24 @@ StringStart(6:5-6:6),StringPart(6:6-6:12),EndOfFile(6:12-6:12), (file @1.2-6.12 (malformed-header @1.2-1.3 (tag "missing_header")) (statements - (s-malformed @1.3-1.4 (tag "statement_unexpected_token")) - (e-ident @1.4-1.5 (raw "o")) - (e-malformed @1.5-1.6 (reason "expr_unexpected_token")) - (e-malformed @2.6-2.7 (reason "expr_unexpected_token")) - (s-decl @4.1-6.12 - (p-ident @4.1-4.4 (raw "foo")) - (e-string @6.5-6.12 - (e-string-part @6.6-6.12 (raw "onmo %")))))) + (e-malformed @4.1-4.4 (reason "expected_expr_close_curly_or_comma")) + (e-malformed @4.5-4.6 (reason "expr_unexpected_token")) + (e-string @6.5-6.12 + (e-string-part @6.6-6.12 (raw "onmo %"))))) ~~~ # FORMATTED ~~~roc -o - -foo = - - "onmo %" +"onmo %" ~~~ # CANONICALIZE ~~~clojure -(can-ir - (d-let - (p-assign @4.1-4.4 (ident "foo")) - (e-string @6.5-6.12 - (e-literal @6.6-6.12 (string "onmo %"))))) +(can-ir (empty true)) ~~~ # TYPES ~~~clojure (inferred-types - (defs - (patt @4.1-4.4 (type "Str"))) - (expressions - (expr @6.5-6.12 (type "Str")))) + (defs) + (expressions)) ~~~ diff --git a/src/snapshots/fuzz_crash/fuzz_crash_010.md b/src/snapshots/fuzz_crash/fuzz_crash_010.md index a3ab6d82e68..84e00cdb2fe 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_010.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_010.md @@ -15,13 +15,13 @@ foo = ASCII CONTROL CHARACTER - :0:0:0:0 UNCLOSED STRING - :0:0:0:0 MISSING HEADER - fuzz_crash_010.md:1:1:1:2 -PARSE ERROR - fuzz_crash_010.md:1:2:1:3 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_010.md:1:4:1:5 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_010.md:2:6:2:7 +PARSE ERROR - fuzz_crash_010.md:2:6:2:7 +PARSE ERROR - fuzz_crash_010.md:3:1:3:4 +UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_010.md:3:5:3:6 PARSE ERROR - fuzz_crash_010.md:5:35:5:35 -INVALID STATEMENT - fuzz_crash_010.md:1:3:1:4 -INVALID STATEMENT - fuzz_crash_010.md:1:4:1:5 -INVALID STATEMENT - fuzz_crash_010.md:2:6:2:7 +INVALID STATEMENT - fuzz_crash_010.md:1:2:3:4 +INVALID STATEMENT - fuzz_crash_010.md:3:5:3:6 +INVALID STATEMENT - fuzz_crash_010.md:5:5:5:35 # PROBLEMS **ASCII CONTROL CHARACTER** ASCII control characters are not allowed in Roc source code. @@ -46,39 +46,39 @@ H{o, **PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` +A parsing error occurred: `expected_expr_record_field_name` This is an unexpected parsing error. Please check your syntax. Here is the problematic code: -**fuzz_crash_010.md:1:2:1:3:** +**fuzz_crash_010.md:2:6:2:7:** ```roc -H{o, +  ] ``` - ^ + ^ -**UNEXPECTED TOKEN IN EXPRESSION** -The token **,** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. +**PARSE ERROR** +A parsing error occurred: `expected_expr_close_curly_or_comma` +This is an unexpected parsing error. Please check your syntax. Here is the problematic code: -**fuzz_crash_010.md:1:4:1:5:** +**fuzz_crash_010.md:3:1:3:4:** ```roc -H{o, +foo = ``` - ^ +^^^ **UNEXPECTED TOKEN IN EXPRESSION** -The token **]** is not expected in an expression. +The token **=** is not expected in an expression. Expressions can be identifiers, literals, function calls, or operators. Here is the problematic code: -**fuzz_crash_010.md:2:6:2:7:** +**fuzz_crash_010.md:3:5:3:6:** ```roc -  ] +foo = ``` - ^ + ^ **PARSE ERROR** @@ -97,33 +97,34 @@ Here is the problematic code: The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_010.md:1:3:1:4:** +**fuzz_crash_010.md:1:2:3:4:** ```roc H{o, +  ] +foo = ``` - ^ **INVALID STATEMENT** The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_010.md:1:4:1:5:** +**fuzz_crash_010.md:3:5:3:6:** ```roc -H{o, +foo = ``` - ^ + ^ **INVALID STATEMENT** The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_010.md:2:6:2:7:** +**fuzz_crash_010.md:5:5:5:35:** ```roc -  ] + "on (string 'onmo %'))) ``` - ^ + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # TOKENS @@ -138,37 +139,24 @@ StringStart(5:5-5:6),StringPart(5:6-5:35),EndOfFile(5:35-5:35), (file @1.1-5.35 (malformed-header @1.1-1.2 (tag "missing_header")) (statements - (s-malformed @1.2-1.3 (tag "statement_unexpected_token")) - (e-ident @1.3-1.4 (raw "o")) - (e-malformed @1.4-1.5 (reason "expr_unexpected_token")) - (e-malformed @2.6-2.7 (reason "expr_unexpected_token")) - (s-decl @3.1-5.35 - (p-ident @3.1-3.4 (raw "foo")) - (e-string @5.5-5.35 - (e-string-part @5.6-5.35 (raw "on (string 'onmo %')))")))))) + (e-malformed @3.1-3.4 (reason "expected_expr_close_curly_or_comma")) + (e-malformed @3.5-3.6 (reason "expr_unexpected_token")) + (e-string @5.5-5.35 + (e-string-part @5.6-5.35 (raw "on (string 'onmo %')))"))))) ~~~ # FORMATTED ~~~roc -o - -foo = - "on (string 'onmo %')))" +"on (string 'onmo %')))" ~~~ # CANONICALIZE ~~~clojure -(can-ir - (d-let - (p-assign @3.1-3.4 (ident "foo")) - (e-string @5.5-5.35 - (e-literal @5.6-5.35 (string "on (string 'onmo %')))"))))) +(can-ir (empty true)) ~~~ # TYPES ~~~clojure (inferred-types - (defs - (patt @3.1-3.4 (type "Str"))) - (expressions - (expr @5.5-5.35 (type "Str")))) + (defs) + (expressions)) ~~~ diff --git a/src/snapshots/fuzz_crash/fuzz_crash_013.md b/src/snapshots/fuzz_crash/fuzz_crash_013.md index e5a02172f56..ee431d33255 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_013.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_013.md @@ -9,7 +9,8 @@ type=file ~~~ # EXPECTED MISSING HEADER - fuzz_crash_013.md:1:1:1:2 -PARSE ERROR - fuzz_crash_013.md:1:2:1:3 +PARSE ERROR - fuzz_crash_013.md:1:3:1:3 +INVALID STATEMENT - fuzz_crash_013.md:1:2:1:3 # PROBLEMS **MISSING HEADER** Roc files must start with a module header. @@ -28,10 +29,21 @@ Here is the problematic code: **PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` +A parsing error occurred: `expected_expr_close_curly` This is an unexpected parsing error. Please check your syntax. Here is the problematic code: +**fuzz_crash_013.md:1:3:1:3:** +```roc +0{ +``` + + + +**INVALID STATEMENT** +The statement `expression` is not allowed at the top level. +Only definitions, type annotations, and imports are allowed at the top level. + **fuzz_crash_013.md:1:2:1:3:** ```roc 0{ @@ -48,11 +60,12 @@ Int(1:1-1:2),OpenCurly(1:2-1:3),EndOfFile(1:3-1:3), (file @1.1-1.3 (malformed-header @1.1-1.2 (tag "missing_header")) (statements - (s-malformed @1.2-1.3 (tag "statement_unexpected_token")))) + (e-block @1.2-1.3 + (statements)))) ~~~ # FORMATTED ~~~roc - +{} ~~~ # CANONICALIZE ~~~clojure diff --git a/src/snapshots/fuzz_crash/fuzz_crash_024.md b/src/snapshots/fuzz_crash/fuzz_crash_024.md index 5b0d75faec2..4940900b015 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_024.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_024.md @@ -16,15 +16,10 @@ var t= 0 # EXPECTED UNCLOSED STRING - :0:0:0:0 PARSE ERROR - fuzz_crash_024.md:1:9:1:15 -PARSE ERROR - fuzz_crash_024.md:1:18:1:19 UNEXPECTED TOKEN IN TYPE ANNOTATION - fuzz_crash_024.md:1:24:1:32 -PARSE ERROR - fuzz_crash_024.md:4:1:4:4 UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_024.md:4:8:4:9 -PARSE ERROR - fuzz_crash_024.md:7:1:7:4 -MALFORMED TYPE - fuzz_crash_024.md:1:24:1:32 -INVALID STATEMENT - fuzz_crash_024.md:1:33:1:53 -UNKNOWN OPERATOR - fuzz_crash_024.md:4:8:4:9 -DUPLICATE DEFINITION - fuzz_crash_024.md:7:5:7:6 +PARSE ERROR - fuzz_crash_024.md:7:9:7:9 +INVALID STATEMENT - fuzz_crash_024.md:1:18:7:9 # PROBLEMS **UNCLOSED STRING** This string is missing a closing quote. @@ -41,18 +36,6 @@ module [module ] { pf: platform ".-/main._]where # A ^^^^^^ -**PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**fuzz_crash_024.md:1:18:1:19:** -```roc -module [module ] { pf: platform ".-/main._]where # A -``` - ^ - - **UNEXPECTED TOKEN IN TYPE ANNOTATION** The token **platform** is not expected in a type annotation. Type annotations should contain types like _Str_, _Num a_, or _List U64_. @@ -65,18 +48,6 @@ module [module ] { pf: platform ".-/main._]where # A ^^^^^^^^ -**PARSE ERROR** -A parsing error occurred: `var_only_allowed_in_a_body` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**fuzz_crash_024.md:4:1:4:4:** -```roc -var t= ] -``` -^^^ - - **UNEXPECTED TOKEN IN EXPRESSION** The token **]** is not expected in an expression. Expressions can be identifiers, literals, function calls, or operators. @@ -90,65 +61,31 @@ var t= ] **PARSE ERROR** -A parsing error occurred: `var_only_allowed_in_a_body` +A parsing error occurred: `expected_expr_close_curly` This is an unexpected parsing error. Please check your syntax. Here is the problematic code: -**fuzz_crash_024.md:7:1:7:4:** +**fuzz_crash_024.md:7:9:7:9:** ```roc var t= 0 ``` -^^^ - - -**MALFORMED TYPE** -This type annotation is malformed or contains invalid syntax. - -**fuzz_crash_024.md:1:24:1:32:** -```roc -module [module ] { pf: platform ".-/main._]where # A -``` - ^^^^^^^^ + **INVALID STATEMENT** The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_024.md:1:33:1:53:** +**fuzz_crash_024.md:1:18:7:9:** ```roc module [module ] { pf: platform ".-/main._]where # A -``` - ^^^^^^^^^^^^^^^^^^^^ - -**UNKNOWN OPERATOR** -This looks like an operator, but it's not one I recognize! - -**fuzz_crash_024.md:4:8:4:9:** -```roc +#el var t= ] -``` - ^ - -Check the spelling and make sure you're using a valid Roc operator like `+`, `-`, `==`. -**DUPLICATE DEFINITION** -The name `t` is being redeclared in this scope. - -The redeclaration is here: -**fuzz_crash_024.md:7:5:7:6:** -```roc +#el var t= 0 ``` - ^ - -But `t` was already defined here: -**fuzz_crash_024.md:4:5:4:6:** -```roc -var t= ] -``` - ^ # TOKENS @@ -164,49 +101,38 @@ KwVar(7:1-7:4),LowerIdent(7:5-7:6),OpAssign(7:6-7:7),Int(7:8-7:9),EndOfFile(7:9- (exposes @1.8-1.17 (exposed-malformed @1.9-1.15 (reason "exposed_item_unexpected_token") @1.9-1.15))) (statements - (s-malformed @1.18-1.19 (tag "statement_unexpected_token")) - (s-type-anno @1.20-1.32 (name "pf") - (ty-malformed @1.24-1.32 (tag "ty_anno_unexpected_token"))) - (e-string @1.33-1.53 - (e-string-part @1.34-1.53 (raw ".-/main._]where # A"))) - (s-malformed @4.1-4.4 (tag "var_only_allowed_in_a_body")) - (s-decl @4.5-4.9 - (p-ident @4.5-4.6 (raw "t")) - (e-malformed @4.8-4.9 (reason "expr_unexpected_token"))) - (s-malformed @7.1-7.4 (tag "var_only_allowed_in_a_body")) - (s-decl @7.5-7.9 - (p-ident @7.5-7.6 (raw "t")) - (e-int @7.8-7.9 (raw "0"))))) + (e-block @1.18-7.9 + (statements + (s-type-anno @1.20-1.32 (name "pf") + (ty-malformed @1.24-1.32 (tag "ty_anno_unexpected_token"))) + (e-string @1.33-1.53 + (e-string-part @1.34-1.53 (raw ".-/main._]where # A"))) + (s-var @4.1-4.9 (name "t") + (e-malformed @4.8-4.9 (reason "expr_unexpected_token"))) + (s-var @7.1-7.9 (name "t") + (e-int @7.8-7.9 (raw "0"))))))) ~~~ # FORMATTED ~~~roc module [] -pf : -".-/main._]where # A" +{ + pf : + ".-/main._]where # A" -# el -t = + # el + var t = -# el -t = 0 + # el + var t = 0 +} ~~~ # CANONICALIZE ~~~clojure -(can-ir - (d-let - (p-assign @4.5-4.6 (ident "t")) - (e-runtime-error (tag "expr_not_canonicalized"))) - (d-let - (p-assign @7.5-7.6 (ident "t")) - (e-int @7.8-7.9 (value "0")))) +(can-ir (empty true)) ~~~ # TYPES ~~~clojure (inferred-types - (defs - (patt @4.5-4.6 (type "Error")) - (patt @7.5-7.6 (type "Num(_size)"))) - (expressions - (expr @4.8-4.9 (type "Error")) - (expr @7.8-7.9 (type "Num(_size)")))) + (defs) + (expressions)) ~~~ diff --git a/src/snapshots/fuzz_crash/fuzz_crash_029.md b/src/snapshots/fuzz_crash/fuzz_crash_029.md index d906c2425b6..20fa6bbf5b9 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_029.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_029.md @@ -27,34 +27,21 @@ ar, PARSE ERROR - fuzz_crash_029.md:4:4:4:5 PARSE ERROR - fuzz_crash_029.md:5:14:5:17 PARSE ERROR - fuzz_crash_029.md:5:9:5:13 -PARSE ERROR - fuzz_crash_029.md:5:22:5:23 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_029.md:5:23:5:24 UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_029.md:5:24:5:25 UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_029.md:6:4:6:5 UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_029.md:7:2:7:9 UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_029.md:10:2:10:10 -PARSE ERROR - fuzz_crash_029.md:12:3:12:4 -UNEXPECTED TOKEN IN TYPE ANNOTATION - fuzz_crash_029.md:13:6:13:7 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_029.md:13:7:13:10 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_029.md:13:10:13:11 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_029.md:13:11:13:12 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_029.md:13:19:13:20 UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_029.md:14:2:14:10 PARSE ERROR - fuzz_crash_029.md:17:4:17:4 LIST NOT CLOSED - fuzz_crash_029.md:17:4:17:4 -INVALID STATEMENT - fuzz_crash_029.md:5:23:5:24 +INVALID STATEMENT - fuzz_crash_029.md:5:22:5:24 INVALID STATEMENT - fuzz_crash_029.md:5:24:5:25 INVALID STATEMENT - fuzz_crash_029.md:6:4:6:5 INVALID STATEMENT - fuzz_crash_029.md:7:2:7:9 INVALID STATEMENT - fuzz_crash_029.md:8:3:9:4 INVALID STATEMENT - fuzz_crash_029.md:10:2:10:10 INVALID STATEMENT - fuzz_crash_029.md:11:3:11:8 -MALFORMED TYPE - fuzz_crash_029.md:13:6:13:7 -INVALID STATEMENT - fuzz_crash_029.md:13:7:13:10 -INVALID STATEMENT - fuzz_crash_029.md:13:10:13:11 -INVALID STATEMENT - fuzz_crash_029.md:13:11:13:12 -INVALID STATEMENT - fuzz_crash_029.md:13:13:13:17 -INVALID STATEMENT - fuzz_crash_029.md:13:19:13:20 +INVALID STATEMENT - fuzz_crash_029.md:12:3:13:20 INVALID STATEMENT - fuzz_crash_029.md:14:2:14:10 INVALID STATEMENT - fuzz_crash_029.md:15:3:17:4 # PROBLEMS @@ -106,30 +93,6 @@ Here is the problematic code: ^^^^ -**PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**fuzz_crash_029.md:5:22:5:23:** -```roc - n! : List(Str) => {}, # ure -``` - ^ - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **}** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**fuzz_crash_029.md:5:23:5:24:** -```roc - n! : List(Str) => {}, # ure -``` - ^ - - **UNEXPECTED TOKEN IN EXPRESSION** The token **,** is not expected in an expression. Expressions can be identifiers, literals, function calls, or operators. @@ -178,78 +141,6 @@ Here is the problematic code: ^^^^^^^^ -**PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**fuzz_crash_029.md:12:3:12:4:** -```roc - { # pen -``` - ^ - - -**UNEXPECTED TOKEN IN TYPE ANNOTATION** -The token **"** is not expected in a type annotation. -Type annotations should contain types like _Str_, _Num a_, or _List U64_. - -Here is the problematic code: -**fuzz_crash_029.md:13:6:13:7:** -```roc -pkg: "..l", mmen } # Cose -``` - ^ - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **..l** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**fuzz_crash_029.md:13:7:13:10:** -```roc -pkg: "..l", mmen } # Cose -``` - ^^^ - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **"** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**fuzz_crash_029.md:13:10:13:11:** -```roc -pkg: "..l", mmen } # Cose -``` - ^ - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **,** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**fuzz_crash_029.md:13:11:13:12:** -```roc -pkg: "..l", mmen } # Cose -``` - ^ - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **}** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**fuzz_crash_029.md:13:19:13:20:** -```roc -pkg: "..l", mmen } # Cose -``` - ^ - - **UNEXPECTED TOKEN IN EXPRESSION** The token **provides** is not expected in an expression. Expressions can be identifiers, literals, function calls, or operators. @@ -291,11 +182,11 @@ Here is the problematic code: The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_029.md:5:23:5:24:** +**fuzz_crash_029.md:5:22:5:24:** ```roc n! : List(Str) => {}, # ure ``` - ^ + ^^ **INVALID STATEMENT** @@ -364,69 +255,15 @@ Only definitions, type annotations, and imports are allowed at the top level. ^^^^^ -**MALFORMED TYPE** -This type annotation is malformed or contains invalid syntax. - -**fuzz_crash_029.md:13:6:13:7:** -```roc -pkg: "..l", mmen } # Cose -``` - ^ - - -**INVALID STATEMENT** -The statement `expression` is not allowed at the top level. -Only definitions, type annotations, and imports are allowed at the top level. - -**fuzz_crash_029.md:13:7:13:10:** -```roc -pkg: "..l", mmen } # Cose -``` - ^^^ - - **INVALID STATEMENT** The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_029.md:13:10:13:11:** -```roc -pkg: "..l", mmen } # Cose -``` - ^ - - -**INVALID STATEMENT** -The statement `expression` is not allowed at the top level. -Only definitions, type annotations, and imports are allowed at the top level. - -**fuzz_crash_029.md:13:11:13:12:** -```roc -pkg: "..l", mmen } # Cose -``` - ^ - - -**INVALID STATEMENT** -The statement `expression` is not allowed at the top level. -Only definitions, type annotations, and imports are allowed at the top level. - -**fuzz_crash_029.md:13:13:13:17:** -```roc -pkg: "..l", mmen } # Cose -``` - ^^^^ - - -**INVALID STATEMENT** -The statement `expression` is not allowed at the top level. -Only definitions, type annotations, and imports are allowed at the top level. - -**fuzz_crash_029.md:13:19:13:20:** +**fuzz_crash_029.md:12:3:13:20:** ```roc + { # pen pkg: "..l", mmen } # Cose ``` - ^ **INVALID STATEMENT** @@ -478,38 +315,35 @@ CloseSquare(17:3-17:4),EndOfFile(17:4-17:4), (malformed-header @4.4-5.8 (tag "expected_requires_rigids_close_curly")) (statements (s-malformed @5.9-5.21 (tag "expected_colon_after_type_annotation")) - (s-malformed @5.22-5.23 (tag "statement_unexpected_token")) - (e-malformed @5.23-5.24 (reason "expr_unexpected_token")) + (e-record @5.22-5.24) (e-malformed @5.24-5.25 (reason "expr_unexpected_token")) (e-malformed @6.4-6.5 (reason "expr_unexpected_token")) (e-malformed @7.2-7.9 (reason "expr_unexpected_token")) (e-list @8.3-9.4) (e-malformed @10.2-10.10 (reason "expr_unexpected_token")) (e-ident @11.3-11.8 (raw "vides")) - (s-malformed @12.3-12.4 (tag "statement_unexpected_token")) - (s-type-anno @13.1-13.7 (name "pkg") - (ty-malformed @13.6-13.7 (tag "ty_anno_unexpected_token"))) - (e-malformed @13.7-13.10 (reason "expr_unexpected_token")) - (e-malformed @13.10-13.11 (reason "expr_unexpected_token")) - (e-malformed @13.11-13.12 (reason "expr_unexpected_token")) - (e-ident @13.13-13.17 (raw "mmen")) - (e-malformed @13.19-13.20 (reason "expr_unexpected_token")) + (e-record @12.3-13.20 + (field (field "pkg") + (e-string @13.6-13.11 + (e-string-part @13.7-13.10 (raw "..l")))) + (field (field "mmen"))) (e-malformed @14.2-14.10 (reason "expr_unexpected_token")) (e-malformed @17.4-17.4 (reason "expected_expr_close_square_or_comma")))) ~~~ # FORMATTED ~~~roc # Co { } #ose +{} # ure # Ce # rd [] # Cse # Cd vides # Cd -# pen -pkg : -mmen -# Cose +{ # pen + pkg: "..l", + mmen, # Cose +} # Cose # Cd ~~~ diff --git a/src/snapshots/fuzz_crash/fuzz_crash_035.md b/src/snapshots/fuzz_crash/fuzz_crash_035.md index aeda3853b1e..1a7e609ba95 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_035.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_035.md @@ -9,13 +9,25 @@ module[]{ ~~~ # EXPECTED -PARSE ERROR - fuzz_crash_035.md:1:9:1:10 +PARSE ERROR - fuzz_crash_035.md:2:2:2:2 +INVALID STATEMENT - fuzz_crash_035.md:1:9:1:10 # PROBLEMS **PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` +A parsing error occurred: `expected_expr_close_curly` This is an unexpected parsing error. Please check your syntax. Here is the problematic code: +**fuzz_crash_035.md:2:2:2:2:** +```roc + +``` + + + +**INVALID STATEMENT** +The statement `expression` is not allowed at the top level. +Only definitions, type annotations, and imports are allowed at the top level. + **fuzz_crash_035.md:1:9:1:10:** ```roc module[]{ @@ -34,12 +46,13 @@ EndOfFile(2:2-2:2), (module @1.1-1.9 (exposes @1.7-1.9)) (statements - (s-malformed @1.9-1.10 (tag "statement_unexpected_token")))) + (e-block @1.9-1.10 + (statements)))) ~~~ # FORMATTED ~~~roc module [] - +{} ~~~ # CANONICALIZE diff --git a/src/snapshots/fuzz_crash/fuzz_crash_036.md b/src/snapshots/fuzz_crash/fuzz_crash_036.md index 48871b641d6..03ae8efec13 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_036.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_036.md @@ -8,43 +8,30 @@ type=file module[]{B ~~~ # EXPECTED -PARSE ERROR - fuzz_crash_036.md:1:9:1:10 PARSE ERROR - fuzz_crash_036.md:1:11:1:11 +INVALID STATEMENT - fuzz_crash_036.md:1:9:1:11 # PROBLEMS **PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` +A parsing error occurred: `expected_expr_close_curly` This is an unexpected parsing error. Please check your syntax. Here is the problematic code: -**fuzz_crash_036.md:1:9:1:10:** +**fuzz_crash_036.md:1:11:1:11:** ```roc module[]{B ``` - ^ - - -**PARSE ERROR** -Type applications require parentheses around their type arguments. - -I found a type followed by what looks like a type argument, but they need to be connected with parentheses. - -Instead of: - **List U8** + -Use: - **List(U8)** -Other valid examples: - `Dict(Str, Num)` - `Result(a, Str)` - `Maybe(List(U64))` +**INVALID STATEMENT** +The statement `expression` is not allowed at the top level. +Only definitions, type annotations, and imports are allowed at the top level. -Here is the problematic code: -**fuzz_crash_036.md:1:11:1:11:** +**fuzz_crash_036.md:1:9:1:11:** ```roc module[]{B ``` - + ^^ # TOKENS @@ -57,13 +44,16 @@ KwModule(1:1-1:7),OpenSquare(1:7-1:8),CloseSquare(1:8-1:9),OpenCurly(1:9-1:10),U (module @1.1-1.9 (exposes @1.7-1.9)) (statements - (s-malformed @1.9-1.10 (tag "statement_unexpected_token")) - (s-malformed @1.10-1.11 (tag "expected_colon_after_type_annotation")))) + (e-block @1.9-1.11 + (statements + (e-tag @1.10-1.11 (raw "B")))))) ~~~ # FORMATTED ~~~roc module [] - +{ + B +} ~~~ # CANONICALIZE ~~~clojure diff --git a/src/snapshots/fuzz_crash/fuzz_crash_040.md b/src/snapshots/fuzz_crash/fuzz_crash_040.md index ffaffe15ba3..b93be4d93d3 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_040.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_040.md @@ -9,40 +9,13 @@ app[]{f:platform""}{ o:0) ~~~ # EXPECTED -PARSE ERROR - fuzz_crash_040.md:1:20:1:21 -UNEXPECTED TOKEN IN TYPE ANNOTATION - fuzz_crash_040.md:2:3:2:4 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_040.md:2:4:2:5 -MALFORMED TYPE - fuzz_crash_040.md:2:3:2:4 -INVALID STATEMENT - fuzz_crash_040.md:2:4:2:5 +PARSE ERROR - fuzz_crash_040.md:2:4:2:5 +INVALID STATEMENT - fuzz_crash_040.md:1:20:2:5 # PROBLEMS **PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` +A parsing error occurred: `expected_expr_close_curly_or_comma` This is an unexpected parsing error. Please check your syntax. -Here is the problematic code: -**fuzz_crash_040.md:1:20:1:21:** -```roc -app[]{f:platform""}{ -``` - ^ - - -**UNEXPECTED TOKEN IN TYPE ANNOTATION** -The token **0** is not expected in a type annotation. -Type annotations should contain types like _Str_, _Num a_, or _List U64_. - -Here is the problematic code: -**fuzz_crash_040.md:2:3:2:4:** -```roc -o:0) -``` - ^ - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **)** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - Here is the problematic code: **fuzz_crash_040.md:2:4:2:5:** ```roc @@ -51,25 +24,15 @@ o:0) ^ -**MALFORMED TYPE** -This type annotation is malformed or contains invalid syntax. - -**fuzz_crash_040.md:2:3:2:4:** -```roc -o:0) -``` - ^ - - **INVALID STATEMENT** The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_040.md:2:4:2:5:** +**fuzz_crash_040.md:1:20:2:5:** ```roc +app[]{f:platform""}{ o:0) ``` - ^ # TOKENS @@ -90,17 +53,12 @@ LowerIdent(2:1-2:2),OpColon(2:2-2:3),Int(2:3-2:4),CloseRound(2:4-2:5),EndOfFile( (e-string @1.17-1.19 (e-string-part @1.18-1.18 (raw "")))))) (statements - (s-malformed @1.20-1.21 (tag "statement_unexpected_token")) - (s-type-anno @2.1-2.4 (name "o") - (ty-malformed @2.3-2.4 (tag "ty_anno_unexpected_token"))) - (e-malformed @2.4-2.5 (reason "expr_unexpected_token")))) + (e-malformed @2.4-2.5 (reason "expected_expr_close_curly_or_comma")))) ~~~ # FORMATTED ~~~roc app [] { f: platform "" } -o : - ~~~ # CANONICALIZE ~~~clojure diff --git a/src/snapshots/fuzz_crash/fuzz_crash_043.md b/src/snapshots/fuzz_crash/fuzz_crash_043.md index b01615fa5cf..b81508e96ff 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_043.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_043.md @@ -9,68 +9,18 @@ app[]{f:platform""}{ o:0}0 ~~~ # EXPECTED -PARSE ERROR - fuzz_crash_043.md:1:20:1:21 -UNEXPECTED TOKEN IN TYPE ANNOTATION - fuzz_crash_043.md:2:3:2:4 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_043.md:2:4:2:5 -MALFORMED TYPE - fuzz_crash_043.md:2:3:2:4 -INVALID STATEMENT - fuzz_crash_043.md:2:4:2:5 +INVALID STATEMENT - fuzz_crash_043.md:1:20:2:5 INVALID STATEMENT - fuzz_crash_043.md:2:5:2:6 # PROBLEMS -**PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**fuzz_crash_043.md:1:20:1:21:** -```roc -app[]{f:platform""}{ -``` - ^ - - -**UNEXPECTED TOKEN IN TYPE ANNOTATION** -The token **0** is not expected in a type annotation. -Type annotations should contain types like _Str_, _Num a_, or _List U64_. - -Here is the problematic code: -**fuzz_crash_043.md:2:3:2:4:** -```roc -o:0}0 -``` - ^ - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **}** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**fuzz_crash_043.md:2:4:2:5:** -```roc -o:0}0 -``` - ^ - - -**MALFORMED TYPE** -This type annotation is malformed or contains invalid syntax. - -**fuzz_crash_043.md:2:3:2:4:** -```roc -o:0}0 -``` - ^ - - **INVALID STATEMENT** The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_043.md:2:4:2:5:** +**fuzz_crash_043.md:1:20:2:5:** ```roc +app[]{f:platform""}{ o:0}0 ``` - ^ **INVALID STATEMENT** @@ -102,17 +52,17 @@ LowerIdent(2:1-2:2),OpColon(2:2-2:3),Int(2:3-2:4),CloseCurly(2:4-2:5),Int(2:5-2: (e-string @1.17-1.19 (e-string-part @1.18-1.18 (raw "")))))) (statements - (s-malformed @1.20-1.21 (tag "statement_unexpected_token")) - (s-type-anno @2.1-2.4 (name "o") - (ty-malformed @2.3-2.4 (tag "ty_anno_unexpected_token"))) - (e-malformed @2.4-2.5 (reason "expr_unexpected_token")) + (e-record @1.20-2.5 + (field (field "o") + (e-int @2.3-2.4 (raw "0")))) (e-int @2.5-2.6 (raw "0")))) ~~~ # FORMATTED ~~~roc app [] { f: platform "" } - -o : +{ + o: 0, +} 0 ~~~ # CANONICALIZE diff --git a/src/snapshots/fuzz_crash/fuzz_crash_044.md b/src/snapshots/fuzz_crash/fuzz_crash_044.md index 418aff91f7c..c84e78ec8a7 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_044.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_044.md @@ -11,94 +11,18 @@ app[]{f:platform""}{{0 "" ~~~ # EXPECTED -PARSE ERROR - fuzz_crash_044.md:1:20:1:21 -PARSE ERROR - fuzz_crash_044.md:1:21:1:22 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_044.md:2:1:2:2 -UNEXPECTED TOKEN IN EXPRESSION - fuzz_crash_044.md:2:2:2:3 -INVALID STATEMENT - fuzz_crash_044.md:1:22:1:23 -INVALID STATEMENT - fuzz_crash_044.md:2:1:2:2 -INVALID STATEMENT - fuzz_crash_044.md:2:2:2:3 +INVALID STATEMENT - fuzz_crash_044.md:1:20:2:3 INVALID STATEMENT - fuzz_crash_044.md:4:1:4:3 # PROBLEMS -**PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**fuzz_crash_044.md:1:20:1:21:** -```roc -app[]{f:platform""}{{0 -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**fuzz_crash_044.md:1:21:1:22:** -```roc -app[]{f:platform""}{{0 -``` - ^ - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **}** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**fuzz_crash_044.md:2:1:2:2:** -```roc -}} -``` -^ - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **}** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**fuzz_crash_044.md:2:2:2:3:** -```roc -}} -``` - ^ - - **INVALID STATEMENT** The statement `expression` is not allowed at the top level. Only definitions, type annotations, and imports are allowed at the top level. -**fuzz_crash_044.md:1:22:1:23:** +**fuzz_crash_044.md:1:20:2:3:** ```roc app[]{f:platform""}{{0 -``` - ^ - - -**INVALID STATEMENT** -The statement `expression` is not allowed at the top level. -Only definitions, type annotations, and imports are allowed at the top level. - -**fuzz_crash_044.md:2:1:2:2:** -```roc }} ``` -^ - - -**INVALID STATEMENT** -The statement `expression` is not allowed at the top level. -Only definitions, type annotations, and imports are allowed at the top level. - -**fuzz_crash_044.md:2:2:2:3:** -```roc -}} -``` - ^ **INVALID STATEMENT** @@ -131,19 +55,22 @@ StringStart(4:1-4:2),StringPart(4:2-4:2),StringEnd(4:2-4:3),EndOfFile(4:3-4:3), (e-string @1.17-1.19 (e-string-part @1.18-1.18 (raw "")))))) (statements - (s-malformed @1.20-1.21 (tag "statement_unexpected_token")) - (s-malformed @1.21-1.22 (tag "statement_unexpected_token")) - (e-int @1.22-1.23 (raw "0")) - (e-malformed @2.1-2.2 (reason "expr_unexpected_token")) - (e-malformed @2.2-2.3 (reason "expr_unexpected_token")) + (e-block @1.20-2.3 + (statements + (e-block @1.21-2.2 + (statements + (e-int @1.22-1.23 (raw "0")))))) (e-string @4.1-4.3 (e-string-part @4.2-4.2 (raw ""))))) ~~~ # FORMATTED ~~~roc app [] { f: platform "" } -0 - +{ + { + 0 + } +} "" ~~~ diff --git a/src/snapshots/fuzz_crash/fuzz_crash_065.md b/src/snapshots/fuzz_crash/fuzz_crash_065.md index 4667ae1ced8..c394e274c86 100644 --- a/src/snapshots/fuzz_crash/fuzz_crash_065.md +++ b/src/snapshots/fuzz_crash/fuzz_crash_065.md @@ -8,43 +8,17 @@ type=file module[]{R} ~~~ # EXPECTED -PARSE ERROR - fuzz_crash_065.md:1:9:1:10 -PARSE ERROR - fuzz_crash_065.md:1:11:1:12 +INVALID STATEMENT - fuzz_crash_065.md:1:9:1:12 # PROBLEMS -**PARSE ERROR** -A parsing error occurred: `statement_unexpected_token` -This is an unexpected parsing error. Please check your syntax. +**INVALID STATEMENT** +The statement `expression` is not allowed at the top level. +Only definitions, type annotations, and imports are allowed at the top level. -Here is the problematic code: -**fuzz_crash_065.md:1:9:1:10:** +**fuzz_crash_065.md:1:9:1:12:** ```roc module[]{R} ``` - ^ - - -**PARSE ERROR** -Type applications require parentheses around their type arguments. - -I found a type followed by what looks like a type argument, but they need to be connected with parentheses. - -Instead of: - **List U8** - -Use: - **List(U8)** - -Other valid examples: - `Dict(Str, Num)` - `Result(a, Str)` - `Maybe(List(U64))` - -Here is the problematic code: -**fuzz_crash_065.md:1:11:1:12:** -```roc -module[]{R} -``` - ^ + ^^^ # TOKENS @@ -57,13 +31,16 @@ KwModule(1:1-1:7),OpenSquare(1:7-1:8),CloseSquare(1:8-1:9),OpenCurly(1:9-1:10),U (module @1.1-1.9 (exposes @1.7-1.9)) (statements - (s-malformed @1.9-1.10 (tag "statement_unexpected_token")) - (s-malformed @1.10-1.12 (tag "expected_colon_after_type_annotation")))) + (e-block @1.9-1.12 + (statements + (e-tag @1.10-1.11 (raw "R")))))) ~~~ # FORMATTED ~~~roc module [] - +{ + R +} ~~~ # CANONICALIZE ~~~clojure From 6223e5d7d9a39c2140e02bc74efd2a8bfcffb43a Mon Sep 17 00:00:00 2001 From: JRI98 <38755101+JRI98@users.noreply.github.com> Date: Wed, 30 Jul 2025 22:05:37 +0200 Subject: [PATCH 2/2] Update snapshot to new syntax --- src/snapshots/match_expr/complex_list_tags.md | 1168 ++++------------- 1 file changed, 284 insertions(+), 884 deletions(-) diff --git a/src/snapshots/match_expr/complex_list_tags.md b/src/snapshots/match_expr/complex_list_tags.md index b3bc279897c..c7f2dc5f198 100644 --- a/src/snapshots/match_expr/complex_list_tags.md +++ b/src/snapshots/match_expr/complex_list_tags.md @@ -7,866 +7,193 @@ type=expr ~~~roc match events { [] => "no events" - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" - [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr (List.len rest)} more events" - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" + [Click(x, y)] => "single click at (${Num.toStr(x)}, ${Num.toStr(y)})" + [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr(List.len(rest))} more events" + [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr(dx)},${Num.toStr(dy)} then ${Num.toStr(dx2)},${Num.toStr(dy2)}" + [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr(amount)} then click at ${Num.toStr(x)},${Num.toStr(y)}" _ => "other event pattern" } ~~~ # EXPECTED -PARSE ERROR - complex_list_tags.md:3:22:3:23 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:3:53:3:54 -PARSE ERROR - complex_list_tags.md:3:54:3:54 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:3:54:3:56 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:3:56:3:58 -PARSE ERROR - complex_list_tags.md:3:58:3:58 -PARSE ERROR - complex_list_tags.md:3:69:3:69 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:3:69:3:70 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:3:70:3:71 -PARSE ERROR - complex_list_tags.md:3:71:3:71 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:3:71:3:72 -PARSE ERROR - complex_list_tags.md:4:36:4:37 -PARSE ERROR - complex_list_tags.md:4:79:4:79 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:4:83:4:84 -PARSE ERROR - complex_list_tags.md:4:84:4:84 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:4:84:4:85 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:4:85:4:97 -PARSE ERROR - complex_list_tags.md:4:97:4:97 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:4:97:4:98 -PARSE ERROR - complex_list_tags.md:5:53:5:54 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:5:74:5:75 -PARSE ERROR - complex_list_tags.md:5:75:5:75 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:5:75:5:76 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:5:76:5:78 -PARSE ERROR - complex_list_tags.md:5:78:5:78 -PARSE ERROR - complex_list_tags.md:5:90:5:90 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:5:90:5:91 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:5:91:5:97 -PARSE ERROR - complex_list_tags.md:5:97:5:97 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:5:97:5:99 -PARSE ERROR - complex_list_tags.md:5:109:5:109 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:5:112:5:113 -PARSE ERROR - complex_list_tags.md:5:113:5:113 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:5:113:5:114 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:5:114:5:116 -PARSE ERROR - complex_list_tags.md:5:116:5:116 -PARSE ERROR - complex_list_tags.md:5:129:5:129 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:5:129:5:130 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:5:130:5:130 -PARSE ERROR - complex_list_tags.md:5:130:5:130 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:5:130:5:131 -PARSE ERROR - complex_list_tags.md:6:55:6:56 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:6:81:6:82 -PARSE ERROR - complex_list_tags.md:6:82:6:82 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:6:82:6:97 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:6:97:6:99 -PARSE ERROR - complex_list_tags.md:6:99:6:99 -PARSE ERROR - complex_list_tags.md:6:110:6:110 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:6:110:6:111 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:6:111:6:112 -PARSE ERROR - complex_list_tags.md:6:112:6:112 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:6:112:6:114 -PARSE ERROR - complex_list_tags.md:6:124:6:124 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:6:125:6:126 -PARSE ERROR - complex_list_tags.md:6:126:6:126 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:6:126:6:126 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:6:126:6:127 -PARSE ERROR - complex_list_tags.md:7:5:7:5 -UNEXPECTED TOKEN IN EXPRESSION - complex_list_tags.md:7:5:7:6 -UNEXPECTED TOKEN IN PATTERN - complex_list_tags.md:7:7:7:9 -PARSE ERROR - complex_list_tags.md:7:10:7:10 UNDEFINED VARIABLE - complex_list_tags.md:1:7:1:13 -UNKNOWN OPERATOR - complex_list_tags.md:3:22:3:53 -UNUSED VARIABLE - complex_list_tags.md:3:12:3:13 -UNUSED VARIABLE - complex_list_tags.md:3:15:3:16 +UNDEFINED VARIABLE - complex_list_tags.md:3:42:3:51 +UNDEFINED VARIABLE - complex_list_tags.md:3:59:3:68 +UNDEFINED VARIABLE - complex_list_tags.md:4:59:4:68 +UNDEFINED VARIABLE - complex_list_tags.md:4:69:4:77 +UNDEFINED VARIABLE - complex_list_tags.md:5:62:5:71 +UNDEFINED VARIABLE - complex_list_tags.md:5:79:5:88 +UNDEFINED VARIABLE - complex_list_tags.md:5:101:5:110 +UNDEFINED VARIABLE - complex_list_tags.md:5:119:5:128 +UNUSED VARIABLE - complex_list_tags.md:1:1:1:1 +UNDEFINED VARIABLE - complex_list_tags.md:6:65:6:74 +UNDEFINED VARIABLE - complex_list_tags.md:6:100:6:109 +UNDEFINED VARIABLE - complex_list_tags.md:6:116:6:125 +UNUSED VARIABLE - complex_list_tags.md:1:1:1:1 # PROBLEMS -**PARSE ERROR** -A parsing error occurred: `string_expected_close_interpolation` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:3:22:3:23:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - ^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token **}** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:3:53:3:54:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:3:54:3:54:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **, ** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:3:54:3:56:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - ^^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token **${** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:3:56:3:58:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - ^^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:3:58:3:58:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:3:69:3:69:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **}** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:3:69:3:70:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - ^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token **)** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:3:70:3:71:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:3:71:3:71:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **"** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:3:71:3:72:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `string_expected_close_interpolation` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:4:36:4:37:** -```roc - [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr (List.len rest)} more events" -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:4:79:4:79:** -```roc - [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr (List.len rest)} more events" -``` - - - -**UNEXPECTED TOKEN IN PATTERN** -The token **)** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:4:83:4:84:** -```roc - [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr (List.len rest)} more events" -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:4:84:4:84:** -```roc - [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr (List.len rest)} more events" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **}** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:4:84:4:85:** -```roc - [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr (List.len rest)} more events" -``` - ^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token ** more events** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:4:85:4:97:** -```roc - [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr (List.len rest)} more events" -``` - ^^^^^^^^^^^^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:4:97:4:97:** -```roc - [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr (List.len rest)} more events" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **"** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:4:97:4:98:** -```roc - [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr (List.len rest)} more events" -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `string_expected_close_interpolation` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:5:53:5:54:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token **}** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:5:74:5:75:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:5:75:5:75:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **,** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:5:75:5:76:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token **${** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:5:76:5:78:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:5:78:5:78:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:5:90:5:90:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **}** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:5:90:5:91:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token ** then ** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:5:91:5:97:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^^^^^^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:5:97:5:97:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **${** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:5:97:5:99:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:5:109:5:109:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - - - -**UNEXPECTED TOKEN IN PATTERN** -The token **}** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:5:112:5:113:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:5:113:5:113:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **,** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:5:113:5:114:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token **${** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:5:114:5:116:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:5:116:5:116:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:5:129:5:129:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **}** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:5:129:5:130:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:5:130:5:130:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:5:130:5:130:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **"** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:5:130:5:131:** -```roc - [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr dx},${Num.toStr dy} then ${Num.toStr dx2},${Num.toStr dy2}" -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `string_expected_close_interpolation` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:6:55:6:56:** -```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" -``` - ^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token **}** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:6:81:6:82:** -```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" -``` - ^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:6:82:6:82:** -```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token ** then click at ** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:6:82:6:97:** -```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" -``` - ^^^^^^^^^^^^^^^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token **${** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:6:97:6:99:** -```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" -``` - ^^ - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:6:99:6:99:** -```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" -``` - - - -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. - -Here is the problematic code: -**complex_list_tags.md:6:110:6:110:** -```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" -``` - - - -**UNEXPECTED TOKEN IN EXPRESSION** -The token **}** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. - -Here is the problematic code: -**complex_list_tags.md:6:110:6:111:** -```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" -``` - ^ - - -**UNEXPECTED TOKEN IN PATTERN** -The token **,** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. +**UNDEFINED VARIABLE** +Nothing is named `events` in this scope. +Is there an `import` or `exposing` missing up-top? -Here is the problematic code: -**complex_list_tags.md:6:111:6:112:** +**complex_list_tags.md:1:7:1:13:** ```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" +match events { ``` - ^ + ^^^^^^ -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. +**UNDEFINED VARIABLE** +Nothing is named `toStr` in this scope. +Is there an `import` or `exposing` missing up-top? -Here is the problematic code: -**complex_list_tags.md:6:112:6:112:** +**complex_list_tags.md:3:42:3:51:** ```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" + [Click(x, y)] => "single click at (${Num.toStr(x)}, ${Num.toStr(y)})" ``` - + ^^^^^^^^^ -**UNEXPECTED TOKEN IN EXPRESSION** -The token **${** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. +**UNDEFINED VARIABLE** +Nothing is named `toStr` in this scope. +Is there an `import` or `exposing` missing up-top? -Here is the problematic code: -**complex_list_tags.md:6:112:6:114:** +**complex_list_tags.md:3:59:3:68:** ```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" + [Click(x, y)] => "single click at (${Num.toStr(x)}, ${Num.toStr(y)})" ``` - ^^ + ^^^^^^^^^ -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. +**UNDEFINED VARIABLE** +Nothing is named `toStr` in this scope. +Is there an `import` or `exposing` missing up-top? -Here is the problematic code: -**complex_list_tags.md:6:124:6:124:** +**complex_list_tags.md:4:59:4:68:** ```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" + [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr(List.len(rest))} more events" ``` - + ^^^^^^^^^ -**UNEXPECTED TOKEN IN PATTERN** -The token **}** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. +**UNDEFINED VARIABLE** +Nothing is named `len` in this scope. +Is there an `import` or `exposing` missing up-top? -Here is the problematic code: -**complex_list_tags.md:6:125:6:126:** +**complex_list_tags.md:4:69:4:77:** ```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" + [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr(List.len(rest))} more events" ``` - ^ + ^^^^^^^^ -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. +**UNDEFINED VARIABLE** +Nothing is named `toStr` in this scope. +Is there an `import` or `exposing` missing up-top? -Here is the problematic code: -**complex_list_tags.md:6:126:6:126:** +**complex_list_tags.md:5:62:5:71:** ```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" + [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr(dx)},${Num.toStr(dy)} then ${Num.toStr(dx2)},${Num.toStr(dy2)}" ``` - + ^^^^^^^^^ -**UNEXPECTED TOKEN IN EXPRESSION** -The token is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. +**UNDEFINED VARIABLE** +Nothing is named `toStr` in this scope. +Is there an `import` or `exposing` missing up-top? -Here is the problematic code: -**complex_list_tags.md:6:126:6:126:** +**complex_list_tags.md:5:79:5:88:** ```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" + [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr(dx)},${Num.toStr(dy)} then ${Num.toStr(dx2)},${Num.toStr(dy2)}" ``` - + ^^^^^^^^^ -**UNEXPECTED TOKEN IN PATTERN** -The token **"** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. +**UNDEFINED VARIABLE** +Nothing is named `toStr` in this scope. +Is there an `import` or `exposing` missing up-top? -Here is the problematic code: -**complex_list_tags.md:6:126:6:127:** +**complex_list_tags.md:5:101:5:110:** ```roc - [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr amount} then click at ${Num.toStr x},${Num.toStr y}" + [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr(dx)},${Num.toStr(dy)} then ${Num.toStr(dx2)},${Num.toStr(dy2)}" ``` - ^ + ^^^^^^^^^ -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. +**UNDEFINED VARIABLE** +Nothing is named `toStr` in this scope. +Is there an `import` or `exposing` missing up-top? -Here is the problematic code: -**complex_list_tags.md:7:5:7:5:** +**complex_list_tags.md:5:119:5:128:** ```roc - _ => "other event pattern" + [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr(dx)},${Num.toStr(dy)} then ${Num.toStr(dx2)},${Num.toStr(dy2)}" ``` - + ^^^^^^^^^ -**UNEXPECTED TOKEN IN EXPRESSION** -The token **_** is not expected in an expression. -Expressions can be identifiers, literals, function calls, or operators. +**UNUSED VARIABLE** +Variable `others` is not used anywhere in your code. -Here is the problematic code: -**complex_list_tags.md:7:5:7:6:** +If you don't need this variable, prefix it with an underscore like `_others` to suppress this warning. +The unused variable is declared here: +**complex_list_tags.md:1:1:1:1:** ```roc - _ => "other event pattern" +match events { ``` - ^ - -**UNEXPECTED TOKEN IN PATTERN** -The token **=>** is not expected in a pattern. -Patterns can contain identifiers, literals, lists, records, or tags. - -Here is the problematic code: -**complex_list_tags.md:7:7:7:9:** -```roc - _ => "other event pattern" -``` - ^^ -**PARSE ERROR** -A parsing error occurred: `match_branch_missing_arrow` -This is an unexpected parsing error. Please check your syntax. +**UNDEFINED VARIABLE** +Nothing is named `toStr` in this scope. +Is there an `import` or `exposing` missing up-top? -Here is the problematic code: -**complex_list_tags.md:7:10:7:10:** +**complex_list_tags.md:6:65:6:74:** ```roc - _ => "other event pattern" + [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr(amount)} then click at ${Num.toStr(x)},${Num.toStr(y)}" ``` - + ^^^^^^^^^ **UNDEFINED VARIABLE** -Nothing is named `events` in this scope. +Nothing is named `toStr` in this scope. Is there an `import` or `exposing` missing up-top? -**complex_list_tags.md:1:7:1:13:** +**complex_list_tags.md:6:100:6:109:** ```roc -match events { + [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr(amount)} then click at ${Num.toStr(x)},${Num.toStr(y)}" ``` - ^^^^^^ + ^^^^^^^^^ -**UNKNOWN OPERATOR** -This looks like an operator, but it's not one I recognize! +**UNDEFINED VARIABLE** +Nothing is named `toStr` in this scope. +Is there an `import` or `exposing` missing up-top? -**complex_list_tags.md:3:22:3:53:** +**complex_list_tags.md:6:116:6:125:** ```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" + [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr(amount)} then click at ${Num.toStr(x)},${Num.toStr(y)}" ``` - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ^^^^^^^^^ -Check the spelling and make sure you're using a valid Roc operator like `+`, `-`, `==`. **UNUSED VARIABLE** -Variable `x` is not used anywhere in your code. +Variable `remaining` is not used anywhere in your code. -If you don't need this variable, prefix it with an underscore like `_x` to suppress this warning. +If you don't need this variable, prefix it with an underscore like `_remaining` to suppress this warning. The unused variable is declared here: -**complex_list_tags.md:3:12:3:13:** +**complex_list_tags.md:1:1:1:1:** ```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" +match events { ``` - ^ -**UNUSED VARIABLE** -Variable `y` is not used anywhere in your code. - -If you don't need this variable, prefix it with an underscore like `_y` to suppress this warning. -The unused variable is declared here: -**complex_list_tags.md:3:15:3:16:** -```roc - [Click(x, y)] => "single click at (${Num.toStr x}, ${Num.toStr y})" -``` - ^ - # TOKENS ~~~zig KwMatch(1:1-1:6),LowerIdent(1:7-1:13),OpenCurly(1:14-1:15), OpenSquare(2:5-2:6),CloseSquare(2:6-2:7),OpFatArrow(2:8-2:10),StringStart(2:11-2:12),StringPart(2:12-2:21),StringEnd(2:21-2:22), -OpenSquare(3:5-3:6),UpperIdent(3:6-3:11),NoSpaceOpenRound(3:11-3:12),LowerIdent(3:12-3:13),Comma(3:13-3:14),LowerIdent(3:15-3:16),CloseRound(3:16-3:17),CloseSquare(3:17-3:18),OpFatArrow(3:19-3:21),StringStart(3:22-3:23),StringPart(3:23-3:40),OpenStringInterpolation(3:40-3:42),UpperIdent(3:42-3:45),NoSpaceDotLowerIdent(3:45-3:51),LowerIdent(3:52-3:53),CloseStringInterpolation(3:53-3:54),StringPart(3:54-3:56),OpenStringInterpolation(3:56-3:58),UpperIdent(3:58-3:61),NoSpaceDotLowerIdent(3:61-3:67),LowerIdent(3:68-3:69),CloseStringInterpolation(3:69-3:70),StringPart(3:70-3:71),StringEnd(3:71-3:72), -OpenSquare(4:5-4:6),UpperIdent(4:6-4:14),NoSpaceOpenRound(4:14-4:15),LowerIdent(4:15-4:18),CloseRound(4:18-4:19),Comma(4:19-4:20),DoubleDot(4:21-4:23),KwAs(4:24-4:26),LowerIdent(4:27-4:31),CloseSquare(4:31-4:32),OpFatArrow(4:33-4:35),StringStart(4:36-4:37),StringPart(4:37-4:41),OpenStringInterpolation(4:41-4:43),LowerIdent(4:43-4:46),CloseStringInterpolation(4:46-4:47),StringPart(4:47-4:57),OpenStringInterpolation(4:57-4:59),UpperIdent(4:59-4:62),NoSpaceDotLowerIdent(4:62-4:68),OpenRound(4:69-4:70),UpperIdent(4:70-4:74),NoSpaceDotLowerIdent(4:74-4:78),LowerIdent(4:79-4:83),CloseRound(4:83-4:84),CloseStringInterpolation(4:84-4:85),StringPart(4:85-4:97),StringEnd(4:97-4:98), -OpenSquare(5:5-5:6),UpperIdent(5:6-5:10),NoSpaceOpenRound(5:10-5:11),LowerIdent(5:11-5:13),Comma(5:13-5:14),LowerIdent(5:15-5:17),CloseRound(5:17-5:18),Comma(5:18-5:19),UpperIdent(5:20-5:24),NoSpaceOpenRound(5:24-5:25),LowerIdent(5:25-5:28),Comma(5:28-5:29),LowerIdent(5:30-5:33),CloseRound(5:33-5:34),Comma(5:34-5:35),DoubleDot(5:36-5:38),KwAs(5:39-5:41),LowerIdent(5:42-5:48),CloseSquare(5:48-5:49),OpFatArrow(5:50-5:52),StringStart(5:53-5:54),StringPart(5:54-5:60),OpenStringInterpolation(5:60-5:62),UpperIdent(5:62-5:65),NoSpaceDotLowerIdent(5:65-5:71),LowerIdent(5:72-5:74),CloseStringInterpolation(5:74-5:75),StringPart(5:75-5:76),OpenStringInterpolation(5:76-5:78),UpperIdent(5:78-5:81),NoSpaceDotLowerIdent(5:81-5:87),LowerIdent(5:88-5:90),CloseStringInterpolation(5:90-5:91),StringPart(5:91-5:97),OpenStringInterpolation(5:97-5:99),UpperIdent(5:99-5:102),NoSpaceDotLowerIdent(5:102-5:108),LowerIdent(5:109-5:112),CloseStringInterpolation(5:112-5:113),StringPart(5:113-5:114),OpenStringInterpolation(5:114-5:116),UpperIdent(5:116-5:119),NoSpaceDotLowerIdent(5:119-5:125),LowerIdent(5:126-5:129),CloseStringInterpolation(5:129-5:130),StringPart(5:130-5:130),StringEnd(5:130-5:131), -OpenSquare(6:5-6:6),UpperIdent(6:6-6:12),NoSpaceOpenRound(6:12-6:13),LowerIdent(6:13-6:19),CloseRound(6:19-6:20),Comma(6:20-6:21),UpperIdent(6:22-6:27),NoSpaceOpenRound(6:27-6:28),LowerIdent(6:28-6:29),Comma(6:29-6:30),LowerIdent(6:31-6:32),CloseRound(6:32-6:33),Comma(6:33-6:34),DoubleDot(6:35-6:37),KwAs(6:38-6:40),LowerIdent(6:41-6:50),CloseSquare(6:50-6:51),OpFatArrow(6:52-6:54),StringStart(6:55-6:56),StringPart(6:56-6:63),OpenStringInterpolation(6:63-6:65),UpperIdent(6:65-6:68),NoSpaceDotLowerIdent(6:68-6:74),LowerIdent(6:75-6:81),CloseStringInterpolation(6:81-6:82),StringPart(6:82-6:97),OpenStringInterpolation(6:97-6:99),UpperIdent(6:99-6:102),NoSpaceDotLowerIdent(6:102-6:108),LowerIdent(6:109-6:110),CloseStringInterpolation(6:110-6:111),StringPart(6:111-6:112),OpenStringInterpolation(6:112-6:114),UpperIdent(6:114-6:117),NoSpaceDotLowerIdent(6:117-6:123),LowerIdent(6:124-6:125),CloseStringInterpolation(6:125-6:126),StringPart(6:126-6:126),StringEnd(6:126-6:127), +OpenSquare(3:5-3:6),UpperIdent(3:6-3:11),NoSpaceOpenRound(3:11-3:12),LowerIdent(3:12-3:13),Comma(3:13-3:14),LowerIdent(3:15-3:16),CloseRound(3:16-3:17),CloseSquare(3:17-3:18),OpFatArrow(3:19-3:21),StringStart(3:22-3:23),StringPart(3:23-3:40),OpenStringInterpolation(3:40-3:42),UpperIdent(3:42-3:45),NoSpaceDotLowerIdent(3:45-3:51),NoSpaceOpenRound(3:51-3:52),LowerIdent(3:52-3:53),CloseRound(3:53-3:54),CloseStringInterpolation(3:54-3:55),StringPart(3:55-3:57),OpenStringInterpolation(3:57-3:59),UpperIdent(3:59-3:62),NoSpaceDotLowerIdent(3:62-3:68),NoSpaceOpenRound(3:68-3:69),LowerIdent(3:69-3:70),CloseRound(3:70-3:71),CloseStringInterpolation(3:71-3:72),StringPart(3:72-3:73),StringEnd(3:73-3:74), +OpenSquare(4:5-4:6),UpperIdent(4:6-4:14),NoSpaceOpenRound(4:14-4:15),LowerIdent(4:15-4:18),CloseRound(4:18-4:19),Comma(4:19-4:20),DoubleDot(4:21-4:23),KwAs(4:24-4:26),LowerIdent(4:27-4:31),CloseSquare(4:31-4:32),OpFatArrow(4:33-4:35),StringStart(4:36-4:37),StringPart(4:37-4:41),OpenStringInterpolation(4:41-4:43),LowerIdent(4:43-4:46),CloseStringInterpolation(4:46-4:47),StringPart(4:47-4:57),OpenStringInterpolation(4:57-4:59),UpperIdent(4:59-4:62),NoSpaceDotLowerIdent(4:62-4:68),NoSpaceOpenRound(4:68-4:69),UpperIdent(4:69-4:73),NoSpaceDotLowerIdent(4:73-4:77),NoSpaceOpenRound(4:77-4:78),LowerIdent(4:78-4:82),CloseRound(4:82-4:83),CloseRound(4:83-4:84),CloseStringInterpolation(4:84-4:85),StringPart(4:85-4:97),StringEnd(4:97-4:98), +OpenSquare(5:5-5:6),UpperIdent(5:6-5:10),NoSpaceOpenRound(5:10-5:11),LowerIdent(5:11-5:13),Comma(5:13-5:14),LowerIdent(5:15-5:17),CloseRound(5:17-5:18),Comma(5:18-5:19),UpperIdent(5:20-5:24),NoSpaceOpenRound(5:24-5:25),LowerIdent(5:25-5:28),Comma(5:28-5:29),LowerIdent(5:30-5:33),CloseRound(5:33-5:34),Comma(5:34-5:35),DoubleDot(5:36-5:38),KwAs(5:39-5:41),LowerIdent(5:42-5:48),CloseSquare(5:48-5:49),OpFatArrow(5:50-5:52),StringStart(5:53-5:54),StringPart(5:54-5:60),OpenStringInterpolation(5:60-5:62),UpperIdent(5:62-5:65),NoSpaceDotLowerIdent(5:65-5:71),NoSpaceOpenRound(5:71-5:72),LowerIdent(5:72-5:74),CloseRound(5:74-5:75),CloseStringInterpolation(5:75-5:76),StringPart(5:76-5:77),OpenStringInterpolation(5:77-5:79),UpperIdent(5:79-5:82),NoSpaceDotLowerIdent(5:82-5:88),NoSpaceOpenRound(5:88-5:89),LowerIdent(5:89-5:91),CloseRound(5:91-5:92),CloseStringInterpolation(5:92-5:93),StringPart(5:93-5:99),OpenStringInterpolation(5:99-5:101),UpperIdent(5:101-5:104),NoSpaceDotLowerIdent(5:104-5:110),NoSpaceOpenRound(5:110-5:111),LowerIdent(5:111-5:114),CloseRound(5:114-5:115),CloseStringInterpolation(5:115-5:116),StringPart(5:116-5:117),OpenStringInterpolation(5:117-5:119),UpperIdent(5:119-5:122),NoSpaceDotLowerIdent(5:122-5:128),NoSpaceOpenRound(5:128-5:129),LowerIdent(5:129-5:132),CloseRound(5:132-5:133),CloseStringInterpolation(5:133-5:134),StringPart(5:134-5:134),StringEnd(5:134-5:135), +OpenSquare(6:5-6:6),UpperIdent(6:6-6:12),NoSpaceOpenRound(6:12-6:13),LowerIdent(6:13-6:19),CloseRound(6:19-6:20),Comma(6:20-6:21),UpperIdent(6:22-6:27),NoSpaceOpenRound(6:27-6:28),LowerIdent(6:28-6:29),Comma(6:29-6:30),LowerIdent(6:31-6:32),CloseRound(6:32-6:33),Comma(6:33-6:34),DoubleDot(6:35-6:37),KwAs(6:38-6:40),LowerIdent(6:41-6:50),CloseSquare(6:50-6:51),OpFatArrow(6:52-6:54),StringStart(6:55-6:56),StringPart(6:56-6:63),OpenStringInterpolation(6:63-6:65),UpperIdent(6:65-6:68),NoSpaceDotLowerIdent(6:68-6:74),NoSpaceOpenRound(6:74-6:75),LowerIdent(6:75-6:81),CloseRound(6:81-6:82),CloseStringInterpolation(6:82-6:83),StringPart(6:83-6:98),OpenStringInterpolation(6:98-6:100),UpperIdent(6:100-6:103),NoSpaceDotLowerIdent(6:103-6:109),NoSpaceOpenRound(6:109-6:110),LowerIdent(6:110-6:111),CloseRound(6:111-6:112),CloseStringInterpolation(6:112-6:113),StringPart(6:113-6:114),OpenStringInterpolation(6:114-6:116),UpperIdent(6:116-6:119),NoSpaceDotLowerIdent(6:119-6:125),NoSpaceOpenRound(6:125-6:126),LowerIdent(6:126-6:127),CloseRound(6:127-6:128),CloseStringInterpolation(6:128-6:129),StringPart(6:129-6:129),StringEnd(6:129-6:130), Underscore(7:5-7:6),OpFatArrow(7:7-7:9),StringStart(7:10-7:11),StringPart(7:11-7:30),StringEnd(7:30-7:31), CloseCurly(8:1-8:2),EndOfFile(8:2-8:2), ~~~ @@ -879,40 +206,37 @@ CloseCurly(8:1-8:2),EndOfFile(8:2-8:2), (p-list @2.5-2.7) (e-string @2.11-2.22 (e-string-part @2.12-2.21 (raw "no events")))) - (branch @3.5-3.53 + (branch @3.5-3.74 (p-list @3.5-3.18 (p-tag @3.6-3.17 (raw "Click") (p-ident @3.12-3.13 (raw "x")) (p-ident @3.15-3.16 (raw "y")))) - (e-malformed @3.22-3.53 (reason "string_expected_close_interpolation"))) - (branch @3.53-3.56 - (p-malformed @3.53-3.54 (tag "pattern_unexpected_token")) - (e-malformed @3.54-3.56 (reason "expr_unexpected_token"))) - (branch @3.56-3.67 - (p-malformed @3.56-3.58 (tag "pattern_unexpected_token")) - (e-ident @3.58-3.67 (raw "Num.toStr"))) - (branch @3.68-3.70 - (p-ident @3.68-3.69 (raw "y")) - (e-malformed @3.69-3.70 (reason "expr_unexpected_token"))) - (branch @3.70-3.72 - (p-malformed @3.70-3.71 (tag "pattern_unexpected_token")) - (e-malformed @3.71-3.72 (reason "expr_unexpected_token"))) - (branch @4.5-4.70 + (e-string @3.22-3.74 + (e-string-part @3.23-3.40 (raw "single click at (")) + (e-apply @3.42-3.54 + (e-ident @3.42-3.51 (raw "Num.toStr")) + (e-ident @3.52-3.53 (raw "x"))) + (e-string-part @3.55-3.57 (raw ", ")) + (e-apply @3.59-3.71 + (e-ident @3.59-3.68 (raw "Num.toStr")) + (e-ident @3.69-3.70 (raw "y"))) + (e-string-part @3.72-3.73 (raw ")")))) + (branch @4.5-4.98 (p-list @4.5-4.32 (p-tag @4.6-4.19 (raw "KeyPress") (p-ident @4.15-4.18 (raw "key"))) (p-list-rest @4.21-4.31 (name "rest"))) - (e-malformed @4.36-4.70 (reason "string_expected_close_interpolation"))) - (branch @4.70-4.83 - (p-ident @4.70-4.78 (raw ".len")) - (e-ident @4.79-4.83 (raw "rest"))) - (branch @4.83-4.85 - (p-malformed @4.83-4.84 (tag "pattern_unexpected_token")) - (e-malformed @4.84-4.85 (reason "expr_unexpected_token"))) - (branch @4.85-4.98 - (p-malformed @4.85-4.97 (tag "pattern_unexpected_token")) - (e-malformed @4.97-4.98 (reason "expr_unexpected_token"))) - (branch @5.5-5.74 + (e-string @4.36-4.98 + (e-string-part @4.37-4.41 (raw "key ")) + (e-ident @4.43-4.46 (raw "key")) + (e-string-part @4.47-4.57 (raw " pressed, ")) + (e-apply @4.59-4.84 + (e-ident @4.59-4.68 (raw "Num.toStr")) + (e-apply @4.69-4.83 + (e-ident @4.69-4.77 (raw "List.len")) + (e-ident @4.78-4.82 (raw "rest")))) + (e-string-part @4.85-4.97 (raw " more events")))) + (branch @5.5-5.135 (p-list @5.5-5.49 (p-tag @5.6-5.18 (raw "Move") (p-ident @5.11-5.13 (raw "dx")) @@ -921,35 +245,25 @@ CloseCurly(8:1-8:2),EndOfFile(8:2-8:2), (p-ident @5.25-5.28 (raw "dx2")) (p-ident @5.30-5.33 (raw "dy2"))) (p-list-rest @5.36-5.48 (name "others"))) - (e-malformed @5.53-5.74 (reason "string_expected_close_interpolation"))) - (branch @5.74-5.76 - (p-malformed @5.74-5.75 (tag "pattern_unexpected_token")) - (e-malformed @5.75-5.76 (reason "expr_unexpected_token"))) - (branch @5.76-5.87 - (p-malformed @5.76-5.78 (tag "pattern_unexpected_token")) - (e-ident @5.78-5.87 (raw "Num.toStr"))) - (branch @5.88-5.91 - (p-ident @5.88-5.90 (raw "dy")) - (e-malformed @5.90-5.91 (reason "expr_unexpected_token"))) - (branch @5.91-5.99 - (p-malformed @5.91-5.97 (tag "pattern_unexpected_token")) - (e-malformed @5.97-5.99 (reason "expr_unexpected_token"))) - (branch @5.99-5.112 - (p-ident @5.99-5.108 (raw ".toStr")) - (e-ident @5.109-5.112 (raw "dx2"))) - (branch @5.112-5.114 - (p-malformed @5.112-5.113 (tag "pattern_unexpected_token")) - (e-malformed @5.113-5.114 (reason "expr_unexpected_token"))) - (branch @5.114-5.125 - (p-malformed @5.114-5.116 (tag "pattern_unexpected_token")) - (e-ident @5.116-5.125 (raw "Num.toStr"))) - (branch @5.126-5.130 - (p-ident @5.126-5.129 (raw "dy2")) - (e-malformed @5.129-5.130 (reason "expr_unexpected_token"))) - (branch @5.130-5.131 - (p-malformed @5.130-5.130 (tag "pattern_unexpected_token")) - (e-malformed @5.130-5.131 (reason "expr_unexpected_token"))) - (branch @6.5-6.81 + (e-string @5.53-5.135 + (e-string-part @5.54-5.60 (raw "moved ")) + (e-apply @5.62-5.75 + (e-ident @5.62-5.71 (raw "Num.toStr")) + (e-ident @5.72-5.74 (raw "dx"))) + (e-string-part @5.76-5.77 (raw ",")) + (e-apply @5.79-5.92 + (e-ident @5.79-5.88 (raw "Num.toStr")) + (e-ident @5.89-5.91 (raw "dy"))) + (e-string-part @5.93-5.99 (raw " then ")) + (e-apply @5.101-5.115 + (e-ident @5.101-5.110 (raw "Num.toStr")) + (e-ident @5.111-5.114 (raw "dx2"))) + (e-string-part @5.116-5.117 (raw ",")) + (e-apply @5.119-5.133 + (e-ident @5.119-5.128 (raw "Num.toStr")) + (e-ident @5.129-5.132 (raw "dy2"))) + (e-string-part @5.134-5.134 (raw "")))) + (branch @6.5-6.130 (p-list @6.5-6.51 (p-tag @6.6-6.20 (raw "Scroll") (p-ident @6.13-6.19 (raw "amount"))) @@ -957,30 +271,22 @@ CloseCurly(8:1-8:2),EndOfFile(8:2-8:2), (p-ident @6.28-6.29 (raw "x")) (p-ident @6.31-6.32 (raw "y"))) (p-list-rest @6.35-6.50 (name "remaining"))) - (e-malformed @6.55-6.81 (reason "string_expected_close_interpolation"))) - (branch @6.81-6.97 - (p-malformed @6.81-6.82 (tag "pattern_unexpected_token")) - (e-malformed @6.82-6.97 (reason "expr_unexpected_token"))) - (branch @6.97-6.108 - (p-malformed @6.97-6.99 (tag "pattern_unexpected_token")) - (e-ident @6.99-6.108 (raw "Num.toStr"))) - (branch @6.109-6.111 - (p-ident @6.109-6.110 (raw "x")) - (e-malformed @6.110-6.111 (reason "expr_unexpected_token"))) - (branch @6.111-6.114 - (p-malformed @6.111-6.112 (tag "pattern_unexpected_token")) - (e-malformed @6.112-6.114 (reason "expr_unexpected_token"))) - (branch @6.114-6.125 - (p-ident @6.114-6.123 (raw ".toStr")) - (e-ident @6.124-6.125 (raw "y"))) - (branch @6.125-6.126 - (p-malformed @6.125-6.126 (tag "pattern_unexpected_token")) - (e-malformed @6.126-6.126 (reason "expr_unexpected_token"))) - (branch @6.126-7.6 - (p-malformed @6.126-6.127 (tag "pattern_unexpected_token")) - (e-malformed @7.5-7.6 (reason "expr_unexpected_token"))) - (branch @7.7-7.31 - (p-malformed @7.7-7.9 (tag "pattern_unexpected_token")) + (e-string @6.55-6.130 + (e-string-part @6.56-6.63 (raw "scroll ")) + (e-apply @6.65-6.82 + (e-ident @6.65-6.74 (raw "Num.toStr")) + (e-ident @6.75-6.81 (raw "amount"))) + (e-string-part @6.83-6.98 (raw " then click at ")) + (e-apply @6.100-6.112 + (e-ident @6.100-6.109 (raw "Num.toStr")) + (e-ident @6.110-6.111 (raw "x"))) + (e-string-part @6.113-6.114 (raw ",")) + (e-apply @6.116-6.128 + (e-ident @6.116-6.125 (raw "Num.toStr")) + (e-ident @6.126-6.127 (raw "y"))) + (e-string-part @6.129-6.129 (raw "")))) + (branch @7.5-7.31 + (p-underscore) (e-string @7.10-7.31 (e-string-part @7.11-7.30 (raw "other event pattern")))))) ~~~ @@ -988,42 +294,136 @@ CloseCurly(8:1-8:2),EndOfFile(8:2-8:2), ~~~roc match events { [] => "no events" - [Click(x, y)] => - => - => Num.toStr - y => - => - [KeyPress(key), .. as rest] => - len => rest - => - => - [Move(dx, dy), Move(dx2, dy2), .. as others] => - => - => Num.toStr - dy => - => - toStr => dx2 - => - => Num.toStr - dy2 => - => - [Scroll(amount), Click(x, y), .. as remaining] => - => - => Num.toStr - x => - => - toStr => y - => - => - - => "other event pattern" + [Click(x, y)] => "single click at (${Num.toStr(x)}, ${Num.toStr(y)})" + [KeyPress(key), .. as rest] => "key ${key} pressed, ${Num.toStr(List.len(rest))} more events" + [Move(dx, dy), Move(dx2, dy2), .. as others] => "moved ${Num.toStr(dx)},${Num.toStr(dy)} then ${Num.toStr(dx2)},${Num.toStr(dy2)}" + [Scroll(amount), Click(x, y), .. as remaining] => "scroll ${Num.toStr(amount)} then click at ${Num.toStr(x)},${Num.toStr(y)}" + _ => "other event pattern" } ~~~ # CANONICALIZE ~~~clojure -(e-runtime-error (tag "expr_not_canonicalized")) +(e-match @1.1-8.2 + (match @1.1-8.2 + (cond + (e-runtime-error (tag "ident_not_in_scope"))) + (branches + (branch + (patterns + (pattern (degenerate false) + (p-list @2.5-2.7 + (patterns)))) + (value + (e-string @2.11-2.22 + (e-literal @2.12-2.21 (string "no events"))))) + (branch + (patterns + (pattern (degenerate false) + (p-list @3.5-3.18 + (patterns + (p-applied-tag @3.6-3.17))))) + (value + (e-string @3.22-3.74 + (e-literal @3.23-3.40 (string "single click at (")) + (e-call @3.42-3.54 + (e-runtime-error (tag "ident_not_in_scope")) + (e-lookup-local @3.52-3.53 + (p-assign @3.12-3.13 (ident "x")))) + (e-literal @3.55-3.57 (string ", ")) + (e-call @3.59-3.71 + (e-runtime-error (tag "ident_not_in_scope")) + (e-lookup-local @3.69-3.70 + (p-assign @3.15-3.16 (ident "y")))) + (e-literal @3.72-3.73 (string ")"))))) + (branch + (patterns + (pattern (degenerate false) + (p-list @4.5-4.32 + (patterns + (p-applied-tag @4.6-4.19)) + (rest-at (index 1) + (p-assign @1.1-1.1 (ident "rest")))))) + (value + (e-string @4.36-4.98 + (e-literal @4.37-4.41 (string "key ")) + (e-lookup-local @4.43-4.46 + (p-assign @4.15-4.18 (ident "key"))) + (e-literal @4.47-4.57 (string " pressed, ")) + (e-call @4.59-4.84 + (e-runtime-error (tag "ident_not_in_scope")) + (e-call @4.69-4.83 + (e-runtime-error (tag "ident_not_in_scope")) + (e-lookup-local @4.78-4.82 + (p-assign @1.1-1.1 (ident "rest"))))) + (e-literal @4.85-4.97 (string " more events"))))) + (branch + (patterns + (pattern (degenerate false) + (p-list @5.5-5.49 + (patterns + (p-applied-tag @5.6-5.18) + (p-applied-tag @5.20-5.34)) + (rest-at (index 2) + (p-assign @1.1-1.1 (ident "others")))))) + (value + (e-string @5.53-5.135 + (e-literal @5.54-5.60 (string "moved ")) + (e-call @5.62-5.75 + (e-runtime-error (tag "ident_not_in_scope")) + (e-lookup-local @5.72-5.74 + (p-assign @5.11-5.13 (ident "dx")))) + (e-literal @5.76-5.77 (string ",")) + (e-call @5.79-5.92 + (e-runtime-error (tag "ident_not_in_scope")) + (e-lookup-local @5.89-5.91 + (p-assign @5.15-5.17 (ident "dy")))) + (e-literal @5.93-5.99 (string " then ")) + (e-call @5.101-5.115 + (e-runtime-error (tag "ident_not_in_scope")) + (e-lookup-local @5.111-5.114 + (p-assign @5.25-5.28 (ident "dx2")))) + (e-literal @5.116-5.117 (string ",")) + (e-call @5.119-5.133 + (e-runtime-error (tag "ident_not_in_scope")) + (e-lookup-local @5.129-5.132 + (p-assign @5.30-5.33 (ident "dy2")))) + (e-literal @5.134-5.134 (string ""))))) + (branch + (patterns + (pattern (degenerate false) + (p-list @6.5-6.51 + (patterns + (p-applied-tag @6.6-6.20) + (p-applied-tag @6.22-6.33)) + (rest-at (index 2) + (p-assign @1.1-1.1 (ident "remaining")))))) + (value + (e-string @6.55-6.130 + (e-literal @6.56-6.63 (string "scroll ")) + (e-call @6.65-6.82 + (e-runtime-error (tag "ident_not_in_scope")) + (e-lookup-local @6.75-6.81 + (p-assign @6.13-6.19 (ident "amount")))) + (e-literal @6.83-6.98 (string " then click at ")) + (e-call @6.100-6.112 + (e-runtime-error (tag "ident_not_in_scope")) + (e-lookup-local @6.110-6.111 + (p-assign @6.28-6.29 (ident "x")))) + (e-literal @6.113-6.114 (string ",")) + (e-call @6.116-6.128 + (e-runtime-error (tag "ident_not_in_scope")) + (e-lookup-local @6.126-6.127 + (p-assign @6.31-6.32 (ident "y")))) + (e-literal @6.129-6.129 (string ""))))) + (branch + (patterns + (pattern (degenerate false) + (p-underscore @7.5-7.6))) + (value + (e-string @7.10-7.31 + (e-literal @7.11-7.30 (string "other event pattern")))))))) ~~~ # TYPES ~~~clojure -(expr @3.22-3.53 (type "Error")) +(expr @1.1-8.2 (type "Str")) ~~~