Diagnostics: say more of what went wrong A missing end: an end left of its statement's line is noted, and a procedure closed by the module's end says so; "else if" gets help toward elsif. A type mismatch in an argument notes the parameter it goes to. Procedure types print their signature; a procedure used as a value says it returns nothing, or how to call it. + on strings, p.x through a pointer, s.len, assigning a constant, 'ab' and Begin in the wrong case each say what to write. can't read says why; can't find module says where it looked. Long source lines are cut around the place. Rt's trap report folds a recursion's repeated calls into one line with a count.
| @@ -273,37 +273,64 @@ | ||
| 273 | 273 | end; |
| 274 | 274 | end; |
| 275 | 275 | |
| 276 | +(* Says that n more calls are as the one before, if there are any; | |
| 277 | + the lines it takes *) | |
| 278 | +proc more(n: INT): INT; | |
| 279 | +begin | |
| 280 | + if n = 0 then return 0; end; | |
| 281 | + put(" and "); | |
| 282 | + putInt(n); | |
| 283 | + put(" more the same"); | |
| 284 | + say; | |
| 285 | + return 1; | |
| 286 | +end; | |
| 287 | + | |
| 276 | 288 | (* Says the calls under way, a line each, from the one at address ip |
| 277 | 289 | whose frame is at bp: where each is, and its variables, unless vars |
| 278 | - is false for the first. At most 20; a frame that isn't the | |
| 279 | - program's ends them. *) | |
| 290 | + is false for the first. At most 20 lines; a frame that isn't the | |
| 291 | + program's ends them. Calls of one procedure from one place, as in a | |
| 292 | + recursion that overflowed the stack, are told once, and counted. *) | |
| 280 | 293 | proc calls(ip, bp: UINT; vars: BOOL); |
| 281 | -var p: ^Proc; l: ^Local; i, n: INT; q: ^UINT; | |
| 294 | +var p, last: ^Proc; l: ^Local; i, n, same: INT; q: ^UINT; lastIp: UINT; | |
| 282 | 295 | begin |
| 283 | - for n := 1 to 20 do | |
| 296 | + n := 0; | |
| 297 | + same := 0; | |
| 298 | + last := nil; | |
| 299 | + lastIp := 0; | |
| 300 | + while n < 20 do | |
| 284 | 301 | p := procAt(ip); |
| 285 | - if p = nil then return; end; | |
| 286 | - put(" in "); | |
| 287 | - putStr(names() + INT(p^.name)); | |
| 288 | - put(" at "); | |
| 289 | - where(ip); | |
| 290 | - l := ^Local(^U8(places + 5) + 16 * places[0] + 20 * places[3]) + INT(p^.first); | |
| 291 | - if not vars or (p^.count = 0) then DEC(lineLen, 2); end; (* where's ": " *) | |
| 292 | - for i := 0 to INT(p^.count) - 1 do | |
| 293 | - if vars then | |
| 294 | - if i > 0 then put(", "); end; | |
| 295 | - putStr(names() + INT(l[i].name)); | |
| 296 | - put(" = "); | |
| 297 | - putValue(bp, l + i); | |
| 302 | + if p = nil then break; end; | |
| 303 | + if (p = last) and (ip = lastIp) then | |
| 304 | + INC(same); | |
| 305 | + else | |
| 306 | + n := n + more(same); | |
| 307 | + same := 0; | |
| 308 | + last := p; | |
| 309 | + lastIp := ip; | |
| 310 | + put(" in "); | |
| 311 | + putStr(names() + INT(p^.name)); | |
| 312 | + put(" at "); | |
| 313 | + where(ip); | |
| 314 | + l := ^Local(^U8(places + 5) + 16 * places[0] + 20 * places[3]) + INT(p^.first); | |
| 315 | + if not vars or (p^.count = 0) then DEC(lineLen, 2); end; (* where's ": " *) | |
| 316 | + for i := 0 to INT(p^.count) - 1 do | |
| 317 | + if vars then | |
| 318 | + if i > 0 then put(", "); end; | |
| 319 | + putStr(names() + INT(l[i].name)); | |
| 320 | + put(" = "); | |
| 321 | + putValue(bp, l + i); | |
| 322 | + end; | |
| 298 | 323 | end; |
| 324 | + say; | |
| 325 | + INC(n); | |
| 326 | + vars := true; | |
| 299 | 327 | end; |
| 300 | - say; | |
| 301 | - vars := true; | |
| 302 | 328 | q := ^UINT(bp); |
| 303 | - if (bp & 7 # 0) or (q[0] <= bp) then return; end; | |
| 329 | + if (bp & 7 # 0) or (q[0] <= bp) then break; end; | |
| 304 | 330 | ip := q[1] - 1; (* the call, by its return address *) |
| 305 | 331 | bp := q[0]; |
| 306 | 332 | end; |
| 333 | + more(same); | |
| 307 | 334 | end; |
| 308 | 335 | |
| 309 | 336 | (* Says on standard error the calls under way, from the one that calls |
| @@ -168,8 +168,12 @@ | ||
| 168 | 168 | { "file:line:col: kind: msg", then the line with p underlined. A tab |
| 169 | 169 | before p is copied into the underline, so that the two line up |
| 170 | 170 | whatever the terminal makes of tabs. } |
| 171 | +{ A long line is shown cut to this many bytes around the place, its | |
| 172 | + cut ends marked ... } | |
| 173 | +const ShownBytes = 100; | |
| 174 | + | |
| 171 | 175 | procedure Show(const p: TPos; const kind, kindColour, msg: shortstring); |
| 172 | -var line, start, stop, i, n: longint; buf: PChar; num, gutter: shortstring; | |
| 176 | +var line, start, stop, lo, hi, i, n: longint; buf: PChar; num, gutter: shortstring; | |
| 173 | 177 | begin |
| 174 | 178 | Locate(p, line, start); |
| 175 | 179 | buf := files[p.f].buf; |
| @@ -181,14 +185,24 @@ | ||
| 181 | 185 | num := IntStr(line); |
| 182 | 186 | while length(num) < 5 do num := ' ' + num; |
| 183 | 187 | gutter := Paint(Blue, num + ' |'); |
| 188 | + lo := start; hi := stop; | |
| 189 | + if hi - lo > ShownBytes then begin | |
| 190 | + if p.a - lo > ShownBytes div 2 then lo := p.a - ShownBytes div 2; | |
| 191 | + while (byte(buf[lo]) and $C0) = $80 do inc(lo); | |
| 192 | + if hi - lo > ShownBytes then hi := lo + ShownBytes; | |
| 193 | + while (hi < stop) and ((byte(buf[hi]) and $C0) = $80) do inc(hi); | |
| 194 | + end; | |
| 184 | 195 | write(StdErr, gutter, ' '); |
| 185 | - for i := start to stop - 1 do write(StdErr, buf[i]); | |
| 196 | + if lo > start then write(StdErr, '...'); | |
| 197 | + for i := lo to hi - 1 do write(StdErr, buf[i]); | |
| 198 | + if hi < stop then write(StdErr, '...'); | |
| 186 | 199 | writeln(StdErr); |
| 187 | 200 | write(StdErr, Paint(Blue, ' |'), ' '); |
| 188 | - for i := start to p.a - 1 do | |
| 201 | + if lo > start then write(StdErr, ' '); | |
| 202 | + for i := lo to p.a - 1 do | |
| 189 | 203 | if buf[i] = #9 then write(StdErr, #9) |
| 190 | 204 | else if (byte(buf[i]) and $C0) <> $80 then write(StdErr, ' '); |
| 191 | - if p.b < stop then n := Chars(buf, p.a, p.b) else n := Chars(buf, p.a, stop); | |
| 205 | + if p.b < hi then n := Chars(buf, p.a, p.b) else n := Chars(buf, p.a, hi); | |
| 192 | 206 | if n < 1 then n := 1; |
| 193 | 207 | writeln(StdErr, Paint(kindColour, StringOfChar('^', n))); |
| 194 | 208 | end; |
| @@ -411,6 +411,20 @@ | ||
| 411 | 411 | if x.ro then MarkAt(x.pos, Source(x.pos) + ' is ' + NameOf(x.obj^.module^.name) + '''s, and can''t be changed outside it'); |
| 412 | 412 | end; |
| 413 | 413 | |
| 414 | +var | |
| 415 | + passing: PObj; { the parameter the argument at passingAt goes to } | |
| 416 | + passingAt: TPos; | |
| 417 | + | |
| 418 | +{ An error in x's type; if x is an argument, a note at the parameter | |
| 419 | + it goes to. } | |
| 420 | +procedure Mismatch(const x: TItem; const msg: shortstring); | |
| 421 | +begin | |
| 422 | + Error(x.pos, msg); | |
| 423 | + if (passing <> nil) and (x.pos.f = passingAt.f) and (x.pos.a = passingAt.a) and (x.pos.b = passingAt.b) then | |
| 424 | + Note(passing^.pos, 'it goes to ' + NameOf(passing^.name) + ', declared here'); | |
| 425 | + Fail; | |
| 426 | +end; | |
| 427 | + | |
| 414 | 428 | procedure Coerce(var x: TItem; t: PType); |
| 415 | 429 | var s: PType; tmp: int64; |
| 416 | 430 | begin |
| @@ -426,7 +440,7 @@ | ||
| 426 | 440 | CopyTo(FrameAdr(tmp), x.val); |
| 427 | 441 | if t^.len > x.val then ZeroVar(FrameAdr(tmp + x.val), t^.len - x.val); |
| 428 | 442 | TempItem(x, t, tmp); |
| 429 | - end else MarkAt(x.pos, 'can''t use a string as ' + TypeName(t)); | |
| 443 | + end else Mismatch(x, 'can''t use a string as ' + TypeName(t)); | |
| 430 | 444 | exit; |
| 431 | 445 | end; |
| 432 | 446 | if x.mode in [mType, mBuiltin, mNone, mCase] then NotValue(x); |
| @@ -447,8 +461,12 @@ | ||
| 447 | 461 | if x.odd then MarkAt(x.pos, 'can''t make a slice of a field of a packed record'); |
| 448 | 462 | Address(x); |
| 449 | 463 | SliceOf(x, t, s^.len); |
| 450 | - end else | |
| 451 | - MarkAt(x.pos, 'can''t use ' + TypeName(s) + ' as ' + TypeName(t)); | |
| 464 | + end else if (x.mode = mProc) and (t^.form <> fProc) and (s^.base = nil) then | |
| 465 | + MarkAt(x.pos, Source(x.pos) + ' is a procedure, and returns nothing') | |
| 466 | + else if (x.mode = mProc) and (t^.form <> fProc) then | |
| 467 | + MarkHelp(x.pos, 'can''t use ' + TypeName(s) + ' as ' + TypeName(t), 'to call it, write ' + Source(x.pos) + '()') | |
| 468 | + else | |
| 469 | + Mismatch(x, 'can''t use ' + TypeName(s) + ' as ' + TypeName(t)); | |
| 452 | 470 | end; |
| 453 | 471 | |
| 454 | 472 | { Coerce where the types must be the same, as in a for loop, INC and |
| @@ -663,6 +681,8 @@ | ||
| 663 | 681 | SeqSlice(x) |
| 664 | 682 | else if (op = sPlus) and (x.mode = mStr) then |
| 665 | 683 | { two string constants to be joined: nothing to compute } |
| 684 | + else if (op = sPlus) and IsSeq(x.typ) then | |
| 685 | + MarkHelp(x.pos, '+ doesn''t join ' + What(x), 'strings are joined in a Buf: Buf.str(b, s)') | |
| 666 | 686 | else if x.mode in [mType, mBuiltin, mNone, mCase, mStr] then |
| 667 | 687 | NotValue(x) |
| 668 | 688 | else if x.mode <> mConst then |
| @@ -1070,11 +1090,13 @@ | ||
| 1070 | 1090 | exit; |
| 1071 | 1091 | end; |
| 1072 | 1092 | c.isF[c.n] := (p^.typ^.form = fReal) and not p^.isVar; |
| 1093 | + passing := p; | |
| 1094 | + passingAt := a.pos; | |
| 1073 | 1095 | if p^.isVar then begin |
| 1074 | 1096 | NotReadOnly(a); |
| 1075 | 1097 | if (a.mode <> mVar) or not a.isVar then MarkAt(a.pos, 'a var parameter needs a variable'); |
| 1076 | 1098 | if a.odd then MarkAt(a.pos, 'a field of a packed record can''t be a var parameter'); |
| 1077 | - if not Same(a.typ, p^.typ) then MarkAt(a.pos, 'a var parameter needs exactly ' + TypeName(p^.typ) + ', found ' + What(a)); | |
| 1099 | + if not Same(a.typ, p^.typ) then Mismatch(a, 'a var parameter needs exactly ' + TypeName(p^.typ) + ', found ' + What(a)); | |
| 1078 | 1100 | if a.vol then MarkAt(a.pos, 'can''t pass through a volatile pointer to a var parameter'); |
| 1079 | 1101 | Address(a); |
| 1080 | 1102 | s := AllocTemp(8, 8); |
| @@ -87,6 +87,9 @@ | ||
| 87 | 87 | deferred: array[0..63] of TDeferred; |
| 88 | 88 | numDeferred: longint; |
| 89 | 89 | making: boolean; { reading an instance's arguments, at its first use } |
| 90 | + stray: boolean; { an "end" in this procedure stood left of its statement's line } | |
| 91 | + strayAt: TPos; { ... the first such statement } | |
| 92 | + elseIf: boolean; { an "else if" in this procedure } | |
| 90 | 93 | useAt: TPos; { ... which is here } |
| 91 | 94 | |
| 92 | 95 | procedure Expression(var x: TItem; want: PType); forward; |
| @@ -110,6 +113,29 @@ | ||
| 110 | 113 | Next; |
| 111 | 114 | end; |
| 112 | 115 | |
| 116 | +{ The end of a block statement at start, whose line is indented to | |
| 117 | + ind. An "end" left of that was most likely meant for a block around | |
| 118 | + the statement, which leaves the statement's own "end" missing: the | |
| 119 | + first such is kept for EndMissing. } | |
| 120 | +procedure CloseEnd(const start: TPos; ind: longint); | |
| 121 | +begin | |
| 122 | + if (tok = sEnd) and not stray and (Indent < ind) then begin | |
| 123 | + stray := true; | |
| 124 | + strayAt := start; | |
| 125 | + end; | |
| 126 | + Expect(sEnd); | |
| 127 | +end; | |
| 128 | + | |
| 129 | +{ The error of a procedure or module whose own "end" isn't where it | |
| 130 | + should be, with what CloseEnd saw } | |
| 131 | +procedure EndMissing(const p: TPos; const msg: shortstring); | |
| 132 | +begin | |
| 133 | + Error(p, msg); | |
| 134 | + if stray then Note(strayAt, 'is this statement''s "end" missing? one further left closes it'); | |
| 135 | + if elseIf then Help('raz writes elsif: "else if" begins an if that needs its own "end"'); | |
| 136 | + Fail; | |
| 137 | +end; | |
| 138 | + | |
| 113 | 139 | function Name(const s: shortstring): longint; |
| 114 | 140 | begin |
| 115 | 141 | Name := Intern(@s[1], length(s)); |
| @@ -305,6 +331,7 @@ | ||
| 305 | 331 | Error(p, NameOf(n) + ' isn''t declared'); |
| 306 | 332 | if ModuleFile(n, dir, f) then Help(NameOf(n) + ' is a module: import ' + NameOf(n)) |
| 307 | 333 | else if (NameOf(n) = 'elif') or (NameOf(n) = 'elseif') then Help('raz writes elsif') |
| 334 | + else if Reserved(Name(LowerCase(NameOf(n)))) then Help('a reserved word is written in lower case: ' + LowerCase(NameOf(n))) | |
| 308 | 335 | else DidYouMean(Closest(n, -1)); |
| 309 | 336 | end; |
| 310 | 337 | |
| @@ -824,6 +851,20 @@ | ||
| 824 | 851 | end else if f <> nil then MarkAt(at, NameOf(c^.name) + ' needs its fields'); |
| 825 | 852 | end; |
| 826 | 853 | |
| 854 | +{ x, before ".", has no fields; tok is what follows. Other languages | |
| 855 | + write p.f through a pointer and s.len for a length. } | |
| 856 | +procedure FieldOfWhat(const x: TItem); | |
| 857 | +var msg, f: shortstring; | |
| 858 | +begin | |
| 859 | + msg := 'expected a record, found ' + What(x); | |
| 860 | + if tok = sIdent then f := NameOf(id) else f := ''; | |
| 861 | + if (x.typ^.form = fPtr) and (x.typ^.base^.form = fRecord) then | |
| 862 | + MarkHelp(x.pos, msg, 'through a pointer, write ' + Source(x.pos) + '^.' + f) | |
| 863 | + else if (x.typ^.form in [fArray, fSlice]) and ((f = 'len') or (f = 'length') or (f = 'size') or (f = 'count')) then | |
| 864 | + MarkHelp(x.pos, msg, 'its length is LEN(' + Source(x.pos) + ')'); | |
| 865 | + MarkAt(x.pos, msg); | |
| 866 | +end; | |
| 867 | + | |
| 827 | 868 | { A designator, with any selectors and calls after it. called tells |
| 828 | 869 | whether the last thing done was a call. } |
| 829 | 870 | procedure Designator(var x: TItem; var called: boolean); |
| @@ -845,7 +886,7 @@ | ||
| 845 | 886 | case tok of |
| 846 | 887 | sPeriod: begin |
| 847 | 888 | Next; |
| 848 | - if (x.mode <> mVar) or (x.typ^.form <> fRecord) then MarkAt(x.pos, 'expected a record, found ' + What(x)); | |
| 889 | + if (x.mode <> mVar) or (x.typ^.form <> fRecord) then FieldOfWhat(x); | |
| 849 | 890 | if tok <> sIdent then Expected('a field'); |
| 850 | 891 | f := FieldOf(x.typ); |
| 851 | 892 | Next; |
| @@ -1154,7 +1195,7 @@ | ||
| 1154 | 1195 | for i := numDefers - 1 downto base do RunDefer(defers[i]); |
| 1155 | 1196 | end; |
| 1156 | 1197 | |
| 1157 | -procedure IfStatement; | |
| 1198 | +procedure IfStatement(const start: TPos; ind: longint); | |
| 1158 | 1199 | var x: TItem; L, endL: longint; |
| 1159 | 1200 | begin |
| 1160 | 1201 | Next; |
| @@ -1178,13 +1219,14 @@ | ||
| 1178 | 1219 | Jump(endL); |
| 1179 | 1220 | Fix(L); |
| 1180 | 1221 | Next; |
| 1222 | + if tok = sIf then elseIf := true; | |
| 1181 | 1223 | Statements; |
| 1182 | 1224 | end else Fix(L); |
| 1183 | - Expect(sEnd); | |
| 1225 | + CloseEnd(start, ind); | |
| 1184 | 1226 | Fix(endL); |
| 1185 | 1227 | end; |
| 1186 | 1228 | |
| 1187 | -procedure WhileStatement; | |
| 1229 | +procedure WhileStatement(const start: TPos; ind: longint); | |
| 1188 | 1230 | var x: TItem; top, L: longint; lp: TLoop; old: PLoop; |
| 1189 | 1231 | begin |
| 1190 | 1232 | Next; |
| @@ -1196,7 +1238,7 @@ | ||
| 1196 | 1238 | Loop(lp, old); |
| 1197 | 1239 | Statements; |
| 1198 | 1240 | JumpBack(top); |
| 1199 | - Expect(sEnd); | |
| 1241 | + CloseEnd(start, ind); | |
| 1200 | 1242 | Fix(L); |
| 1201 | 1243 | Fix(lp.brk); |
| 1202 | 1244 | curLoop := old; |
| @@ -1218,7 +1260,7 @@ | ||
| 1218 | 1260 | Fix(lp.brk); |
| 1219 | 1261 | end; |
| 1220 | 1262 | |
| 1221 | -procedure ForStatement; | |
| 1263 | +procedure ForStatement(const start: TPos; ind: longint); | |
| 1222 | 1264 | var |
| 1223 | 1265 | o: PObj; v, a, b, s: TItem; bslot, step: int64; top, exitL: longint; |
| 1224 | 1266 | lp: TLoop; old: PLoop; |
| @@ -1260,7 +1302,7 @@ | ||
| 1260 | 1302 | Loop(lp, old); |
| 1261 | 1303 | Statements; |
| 1262 | 1304 | curLoop := old; |
| 1263 | - Expect(sEnd); | |
| 1305 | + CloseEnd(start, ind); | |
| 1264 | 1306 | ForNext(o, bslot, step, exitL, top); |
| 1265 | 1307 | Fix(exitL); |
| 1266 | 1308 | Fix(lp.brk); |
| @@ -1319,7 +1361,7 @@ | ||
| 1319 | 1361 | Fix(L); |
| 1320 | 1362 | end; |
| 1321 | 1363 | |
| 1322 | -procedure MatchStatement; | |
| 1364 | +procedure MatchStatement(const start: TPos; ind: longint); | |
| 1323 | 1365 | var |
| 1324 | 1366 | x: TItem; t: PType; c, f, o: PObj; p: int64; L, endL, n: longint; |
| 1325 | 1367 | seen: array[0..255] of boolean; hasElse: boolean; endAt: TPos; ls: TLabels; |
| @@ -1383,7 +1425,7 @@ | ||
| 1383 | 1425 | end; |
| 1384 | 1426 | end; |
| 1385 | 1427 | endAt := TokPos; |
| 1386 | - Expect(sEnd); | |
| 1428 | + CloseEnd(start, ind); | |
| 1387 | 1429 | if (t^.form = fInt) and not hasElse then |
| 1388 | 1430 | MarkHelp(endAt, 'a match on an integer needs an else arm', 'it may be empty: | else:'); |
| 1389 | 1431 | if not hasElse then begin |
| @@ -1409,6 +1451,8 @@ | ||
| 1409 | 1451 | array constant, nor any part of one. } |
| 1410 | 1452 | procedure Assignable(const x: TItem; n: longint); |
| 1411 | 1453 | begin |
| 1454 | + if (x.mode = mConst) and (Subject(x, n) = NameOf(n)) then | |
| 1455 | + MarkAt(x.pos, NameOf(n) + ' is a constant, and can''t be changed'); | |
| 1412 | 1456 | if (x.mode = mVar) and (x.obj <> nil) and (x.obj^.cls = oConst) then |
| 1413 | 1457 | MarkAt(x.pos, NameOf(x.obj^.name) + ' is a constant, and can''t be changed'); |
| 1414 | 1458 | if (x.mode <> mVar) or not x.isVar then MarkAt(x.pos, 'can''t assign to ' + Subject(x, n)); |
| @@ -1532,11 +1576,11 @@ | ||
| 1532 | 1576 | else MarkAt(x.pos, Subject(x, first) + ' isn''t a statement'); |
| 1533 | 1577 | end else Discard(x); |
| 1534 | 1578 | end; |
| 1535 | - sIf: IfStatement; | |
| 1536 | - sWhile: WhileStatement; | |
| 1579 | + sIf: IfStatement(start, Indent); | |
| 1580 | + sWhile: WhileStatement(start, Indent); | |
| 1537 | 1581 | sRepeat: RepeatStatement; |
| 1538 | - sFor: ForStatement; | |
| 1539 | - sMatch: MatchStatement; | |
| 1582 | + sFor: ForStatement(start, Indent); | |
| 1583 | + sMatch: MatchStatement(start, Indent); | |
| 1540 | 1584 | sReturn: begin |
| 1541 | 1585 | Next; |
| 1542 | 1586 | if deferring then MarkAt(SpanFrom(start), 'return can''t leave a deferred statement'); |
| @@ -1567,7 +1611,7 @@ | ||
| 1567 | 1611 | Jump(curLoop^.brk); |
| 1568 | 1612 | end; |
| 1569 | 1613 | sDefer: Defer; |
| 1570 | - else if AtLineStart then Expected('"end"') | |
| 1614 | + else if AtLineStart then EndMissing(MissingPos, 'expected "end", found ' + Found) | |
| 1571 | 1615 | else Expected('a statement'); |
| 1572 | 1616 | end; |
| 1573 | 1617 | ReleaseTemps(m); |
| @@ -1691,6 +1735,7 @@ | ||
| 1691 | 1735 | old := curResult; |
| 1692 | 1736 | curResult := sig^.base; |
| 1693 | 1737 | EnterBody(p^.chunk, line); |
| 1738 | + stray := false; elseIf := false; | |
| 1694 | 1739 | Statements; |
| 1695 | 1740 | NoteLine(CurLine, CurCol); |
| 1696 | 1741 | Expect(sEnd); |
| @@ -1762,7 +1807,8 @@ | ||
| 1762 | 1807 | CodeBody(p, sig, at); |
| 1763 | 1808 | end else if checkMode then SkipBody else Body(p, sig, line); |
| 1764 | 1809 | if tok = sIdent then begin |
| 1765 | - if id <> n then Mark('expected ' + NameOf(n) + ', found ' + NameOf(id)); | |
| 1810 | + if id = curModule^.name then EndMissing(TokPos, NameOf(n) + ' has no "end": this one closes the module') | |
| 1811 | + else if id <> n then EndMissing(TokPos, 'expected ' + NameOf(n) + ', found ' + NameOf(id)); | |
| 1766 | 1812 | Next; |
| 1767 | 1813 | end; |
| 1768 | 1814 | end; |
| @@ -2188,14 +2234,15 @@ | ||
| 2188 | 2234 | st: TScanState; saved: array[0..MaxDepth - 1] of longint; d: longint; |
| 2189 | 2235 | oldMod: PModule; oldCheck, oldChecks: boolean; m: PModule; |
| 2190 | 2236 | lib: PLib; start: TPos; alias, mname, line, oldPath: longint; o: PObj; body: longint; iargs: TArgs; |
| 2191 | - generic: boolean; argsAt: TScanState; | |
| 2237 | + generic: boolean; argsAt: TScanState; why: shortstring; | |
| 2192 | 2238 | begin |
| 2193 | 2239 | SaveScan(st); |
| 2194 | 2240 | SaveScopes(d, saved); |
| 2195 | 2241 | oldMod := curModule; oldCheck := checkMode; oldPath := curFile; oldChecks := checks; |
| 2196 | 2242 | checks := true; |
| 2197 | 2243 | curFile := Name(path); |
| 2198 | - if not Open(path) then Fatal('can''t read ' + path); | |
| 2244 | + why := Open(path); | |
| 2245 | + if why <> '' then Fatal('can''t read ' + path + ': ' + why); | |
| 2199 | 2246 | New(m); |
| 2200 | 2247 | FillChar(m^, SizeOf(TModule), 0); |
| 2201 | 2248 | m^.name := n; |
| @@ -2298,13 +2345,14 @@ | ||
| 2298 | 2345 | deferSlot := 0; |
| 2299 | 2346 | curResult := nil; |
| 2300 | 2347 | EnterBody(body, line); |
| 2348 | + stray := false; elseIf := false; | |
| 2301 | 2349 | Statements; |
| 2302 | 2350 | NoteLine(CurLine, CurCol); |
| 2303 | 2351 | Expect(sEnd); |
| 2304 | 2352 | EndProc(body); |
| 2305 | 2353 | end; |
| 2306 | 2354 | end else Expect(sEnd); |
| 2307 | - if (tok <> sIdent) or (id <> n) then Expected(NameOf(n)); | |
| 2355 | + if (tok <> sIdent) or (id <> n) then EndMissing(MissingPos, 'expected ' + NameOf(n) + ', found ' + Found); | |
| 2308 | 2356 | Next; |
| 2309 | 2357 | if tok <> sPeriod then Expected('"."'); |
| 2310 | 2358 | o := m^.first; |
| @@ -2445,7 +2493,13 @@ | ||
| 2445 | 2493 | if m <> nil then exit(m); |
| 2446 | 2494 | for i := 0 to numPending - 1 do |
| 2447 | 2495 | if IsModule(pending[i], name, args) then MarkAt(args.at, NameOf(name) + ' imports itself'); |
| 2448 | - if not ModuleFile(name, dir, f) then MarkAt(args.at, 'can''t find module ' + NameOf(name)); | |
| 2496 | + if not ModuleFile(name, dir, f) then begin | |
| 2497 | + Error(args.at, 'can''t find module ' + NameOf(name)); | |
| 2498 | + dir := ShownPath(SearchDir(-1)); | |
| 2499 | + for i := 0 to numInc do dir := dir + ', ' + ShownPath(SearchDir(i)); | |
| 2500 | + Help('looked for ' + NameOf(name) + '.raz in ' + dir); | |
| 2501 | + Fail; | |
| 2502 | + end; | |
| 2449 | 2503 | CheckOneModule(name, dir, f, args.at); |
| 2450 | 2504 | m := CompileFile(dir + '/' + f, name, args, false); |
| 2451 | 2505 | CheckSiblings(dir, f, name, m, args); |
| @@ -65,13 +65,15 @@ | ||
| 65 | 65 | |
| 66 | 66 | function Intern(p: PChar; n: longint): longint; |
| 67 | 67 | function NameOf(n: longint): shortstring; |
| 68 | -function Open(const path: shortstring): boolean; | |
| 68 | +function Reserved(n: longint): boolean; | |
| 69 | +function Open(const path: shortstring): shortstring; | |
| 69 | 70 | procedure Next; |
| 70 | 71 | procedure Mark(const msg: shortstring); |
| 71 | 72 | procedure MarkAt(const p: TPos; const msg: shortstring); |
| 72 | 73 | procedure MarkHelp(const p: TPos; const msg, hint: shortstring); |
| 73 | 74 | procedure Fail; |
| 74 | 75 | function AtLineStart: boolean; |
| 76 | +function Indent: longint; | |
| 75 | 77 | function SymText(s: TSym): shortstring; |
| 76 | 78 | function Found: shortstring; |
| 77 | 79 | |
| @@ -334,16 +336,37 @@ | ||
| 334 | 336 | AtLineStart := cur.tokPos = cur.tokLineStart; |
| 335 | 337 | end; |
| 336 | 338 | |
| 339 | +{ The column the current symbol's line is indented to } | |
| 340 | +function Indent: longint; | |
| 341 | +var i: longint; | |
| 342 | +begin | |
| 343 | + i := cur.tokLineStart; | |
| 344 | + while cur.buf[i] in [' ', #9] do inc(i); | |
| 345 | + Indent := i - cur.tokLineStart + 1; | |
| 346 | +end; | |
| 347 | + | |
| 337 | 348 | { Files } |
| 338 | 349 | |
| 339 | -function Open(const path: shortstring): boolean; | |
| 350 | +{ Name n is a reserved word } | |
| 351 | +function Reserved(n: longint): boolean; | |
| 352 | +begin | |
| 353 | + Reserved := n < NumWords; | |
| 354 | +end; | |
| 355 | + | |
| 356 | +{ Reads the file at path to scan it; '' if it can, else why not } | |
| 357 | +function Open(const path: shortstring): shortstring; | |
| 340 | 358 | var fd: cint; st: Stat; n, got, r: longint; p: shortstring; |
| 341 | 359 | begin |
| 342 | 360 | p := path + #0; |
| 343 | 361 | fd := FpOpen(@p[1], O_RDONLY); |
| 344 | - if fd < 0 then exit(false); | |
| 345 | - if FpFStat(fd, st) <> 0 then begin FpClose(fd); exit(false) end; | |
| 346 | - if (st.st_mode and S_IFMT) <> S_IFREG then begin FpClose(fd); exit(false) end; | |
| 362 | + if fd < 0 then | |
| 363 | + case FpGetErrno of | |
| 364 | + ESysENOENT: exit('there is no such file'); | |
| 365 | + ESysEACCES: exit('permission denied'); | |
| 366 | + else exit('it can''t be opened'); | |
| 367 | + end; | |
| 368 | + if FpFStat(fd, st) <> 0 then begin FpClose(fd); exit('it can''t be opened') end; | |
| 369 | + if (st.st_mode and S_IFMT) <> S_IFREG then begin FpClose(fd); exit('it isn''t a file') end; | |
| 347 | 370 | n := st.st_size; |
| 348 | 371 | cur.buf := GetMem(n + 1); |
| 349 | 372 | got := 0; |
| @@ -362,7 +385,7 @@ | ||
| 362 | 385 | cur.tokLine := 1; |
| 363 | 386 | cur.tokLineStart := 0; |
| 364 | 387 | cur.f := AddFile(path, cur.buf, n); |
| 365 | - Open := true; | |
| 388 | + Open := ''; | |
| 366 | 389 | end; |
| 367 | 390 | |
| 368 | 391 | procedure SaveScan(var st: TScanState); |
| @@ -724,7 +747,7 @@ | ||
| 724 | 747 | end; |
| 725 | 748 | |
| 726 | 749 | procedure Next; |
| 727 | -var c: char; start, h, v: longint; | |
| 750 | +var c: char; start, h, v, i: longint; | |
| 728 | 751 | begin |
| 729 | 752 | cur.prevEnd := cur.pos; |
| 730 | 753 | repeat |
| @@ -758,7 +781,13 @@ | ||
| 758 | 781 | inc(cur.pos); |
| 759 | 782 | if cur.buf[cur.pos] = '''' then LexError('empty character'); |
| 760 | 783 | v := LitChar(false); |
| 761 | - if cur.buf[cur.pos] <> '''' then LexError('character not closed'); | |
| 784 | + if cur.buf[cur.pos] <> '''' then begin | |
| 785 | + { 'ab': several characters, as some languages write a string } | |
| 786 | + i := cur.pos; | |
| 787 | + while not (cur.buf[i] in ['''', #10, #0]) do inc(i); | |
| 788 | + if cur.buf[i] = '''' then MarkBytes(cur.tokPos, i + 1, 'a character is one character: the string is "' + Text(cur.tokPos + 1, i) + '"') | |
| 789 | + else LexError('character not closed'); | |
| 790 | + end; | |
| 762 | 791 | inc(cur.pos); |
| 763 | 792 | tok := sChar; |
| 764 | 793 | ival := v; |
| @@ -466,7 +466,19 @@ | ||
| 466 | 466 | TypeName := s + ')'; |
| 467 | 467 | end; |
| 468 | 468 | fVariant: TypeName := 'variant'; |
| 469 | - fProc: TypeName := 'proc'; | |
| 469 | + fProc: begin | |
| 470 | + s := 'proc('; | |
| 471 | + f := t^.fields; | |
| 472 | + while f <> nil do begin | |
| 473 | + if f^.isVar then s := s + 'var '; | |
| 474 | + s := s + TypeName(f^.typ); | |
| 475 | + f := f^.next; | |
| 476 | + if f <> nil then s := s + ', '; | |
| 477 | + end; | |
| 478 | + s := s + ')'; | |
| 479 | + if t^.base <> nil then s := s + ': ' + TypeName(t^.base); | |
| 480 | + TypeName := s; | |
| 481 | + end; | |
| 470 | 482 | else TypeName := '?'; |
| 471 | 483 | end; |
| 472 | 484 | end; |
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | test/err/DeclManyElements.raz:5:2059: error: more than 1024 elements |
| 2 | - 5 | a := [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; | |
| 3 | - | ^ | |
| 2 | + 5 | ...0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; | |
| 3 | + | ^ | |
| 4 | 4 | raz: 1 error |
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | test/err/DeclManyNames.raz:2:327: error: more than 64 names in one declaration |
| 2 | - 2 | type R = record a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46, a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61, a62, a63, a64: I64 end; | |
| 3 | - | ^^^ | |
| 2 | + 2 | ...a54, a55, a56, a57, a58, a59, a60, a61, a62, a63, a64: I64 end; | |
| 3 | + | ^^^ | |
| 4 | 4 | raz: 1 error |
| @@ -0,0 +1,5 @@ | ||
| 1 | +test/err/ExprJoinStrings.raz:7:13: error: + doesn't join []U8 | |
| 2 | + 7 | Out.str(s + "def"); | |
| 3 | + | ^ | |
| 4 | +help: strings are joined in a Buf: Buf.str(b, s) | |
| 5 | +raz: 1 error |
| @@ -0,0 +1,9 @@ | ||
| 1 | +module ExprJoinStrings; | |
| 2 | +import Out; | |
| 3 | +proc main*; | |
| 4 | +var s: []U8; | |
| 5 | +begin | |
| 6 | + s := "abc"; | |
| 7 | + Out.str(s + "def"); | |
| 8 | +end; | |
| 9 | +end ExprJoinStrings. |
| @@ -0,0 +1,9 @@ | ||
| 1 | +test/err/ExprNoField.raz:7:10: error: expected a record, found ^R | |
| 2 | + 7 | n := p.x; | |
| 3 | + | ^ | |
| 4 | +help: through a pointer, write p^.x | |
| 5 | +test/err/ExprNoField.raz:8:10: error: expected a record, found []U8 | |
| 6 | + 8 | n := s.len; | |
| 7 | + | ^ | |
| 8 | +help: its length is LEN(s) | |
| 9 | +raz: 2 errors |
| @@ -0,0 +1,10 @@ | ||
| 1 | +module ExprNoField; | |
| 2 | +type R = record x: I64; end; | |
| 3 | +proc main*; | |
| 4 | +var r: R; p: ^R; s: []U8; n: I64; | |
| 5 | +begin | |
| 6 | + p := ADR(r); | |
| 7 | + n := p.x; | |
| 8 | + n := s.len; | |
| 9 | +end; | |
| 10 | +end ExprNoField. |
| @@ -0,0 +1,8 @@ | ||
| 1 | +test/err/ExprProcValue.raz:10:10: error: Out.ln is a procedure, and returns nothing | |
| 2 | + 10 | a := Out.ln; | |
| 3 | + | ^^^^^^ | |
| 4 | +test/err/ExprProcValue.raz:11:10: error: can't use proc(): (I64, I64) as I64 | |
| 5 | + 11 | a := pair; | |
| 6 | + | ^^^^ | |
| 7 | +help: to call it, write pair() | |
| 8 | +raz: 2 errors |
| @@ -0,0 +1,13 @@ | ||
| 1 | +module ExprProcValue; | |
| 2 | +import Out; | |
| 3 | +proc pair: (I64, I64); | |
| 4 | +begin | |
| 5 | + return 1, 2; | |
| 6 | +end; | |
| 7 | +proc main*; | |
| 8 | +var a: I64; | |
| 9 | +begin | |
| 10 | + a := Out.ln; | |
| 11 | + a := pair; | |
| 12 | +end; | |
| 13 | +end ExprProcValue. |
| @@ -0,0 +1,9 @@ | ||
| 1 | +test/err/NameKeywordCase.raz:7:5: error: Begin isn't declared | |
| 2 | + 7 | Begin | |
| 3 | + | ^^^^^ | |
| 4 | +help: a reserved word is written in lower case: begin | |
| 5 | +test/err/NameKeywordCase.raz:9:1: error: End isn't declared | |
| 6 | + 9 | End; | |
| 7 | + | ^^^ | |
| 8 | +help: a reserved word is written in lower case: end | |
| 9 | +raz: 2 errors |
| @@ -0,0 +1,10 @@ | ||
| 1 | +module NameKeywordCase; | |
| 2 | +import Out; | |
| 3 | +proc main*; | |
| 4 | +var a: I64; | |
| 5 | +begin | |
| 6 | + a := 1; | |
| 7 | + Begin | |
| 8 | + Out.int(a); | |
| 9 | +End; | |
| 10 | +end NameKeywordCase. |
| @@ -0,0 +1,8 @@ | ||
| 1 | +test/err/StmtElseIf.raz:12:5: error: main has no "end": this one closes the module | |
| 2 | + 12 | end StmtElseIf. | |
| 3 | + | ^^^^^^^^^^ | |
| 4 | +test/err/StmtElseIf.raz:6:5: note: is this statement's "end" missing? one further left closes it | |
| 5 | + 6 | if x > 0 then | |
| 6 | + | ^^ | |
| 7 | +help: raz writes elsif: "else if" begins an if that needs its own "end" | |
| 8 | +raz: 1 error |
| @@ -0,0 +1,12 @@ | ||
| 1 | +module StmtElseIf; | |
| 2 | +import Out; | |
| 3 | +proc main*; | |
| 4 | +var x: I64; | |
| 5 | +begin | |
| 6 | + if x > 0 then | |
| 7 | + Out.ln; | |
| 8 | + else if x < 0 then | |
| 9 | + Out.ln; | |
| 10 | + end; | |
| 11 | +end; | |
| 12 | +end StmtElseIf. |
| @@ -0,0 +1,7 @@ | ||
| 1 | +test/err/StmtEndMissing.raz:9:5: error: main has no "end": this one closes the module | |
| 2 | + 9 | end StmtEndMissing. | |
| 3 | + | ^^^^^^^^^^^^^^ | |
| 4 | +test/err/StmtEndMissing.raz:6:5: note: is this statement's "end" missing? one further left closes it | |
| 5 | + 6 | if x > 0 then | |
| 6 | + | ^^ | |
| 7 | +raz: 1 error |
| @@ -0,0 +1,9 @@ | ||
| 1 | +module StmtEndMissing; | |
| 2 | +import Out; | |
| 3 | +proc main*; | |
| 4 | +var x: I64; | |
| 5 | +begin | |
| 6 | + if x > 0 then | |
| 7 | + Out.int(x); | |
| 8 | +end; | |
| 9 | +end StmtEndMissing. |
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | test/err/StmtManyDefers.raz:9:173: error: more than 64 deferred statements in one procedure |
| 2 | - 9 | defer a := 1; defer a := 1; defer a := 1; defer a := 1; defer a := 1; defer a := 1; defer a := 1; defer a := 1; defer a := 1; defer a := 1; defer a := 1; defer a := 1; defer a := 1; | |
| 3 | - | ^^^^^ | |
| 2 | + 9 | ...a := 1; defer a := 1; defer a := 1; defer a := 1; defer a := 1; | |
| 3 | + | ^^^^^ | |
| 4 | 4 | raz: 1 error |
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | test/err/StmtManyNames.raz:2:315: error: more than 64 names in one declaration |
| 2 | - 2 | var a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46, a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61, a62, a63, a64: I64; | |
| 3 | - | ^^^ | |
| 2 | + 2 | ...a54, a55, a56, a57, a58, a59, a60, a61, a62, a63, a64: I64; | |
| 3 | + | ^^^ | |
| 4 | 4 | raz: 1 error |
| @@ -1,4 +1,7 @@ | ||
| 1 | 1 | conform/err/AtArgType.raz:7:8: error: can't use BOOL as I64 |
| 2 | 2 | 7 | Id(b); |
| 3 | 3 | | ^ |
| 4 | +conform/err/AtArgType.raz:2:9: note: it goes to a, declared here | |
| 5 | + 2 | proc Id(a: I64): I64; | |
| 6 | + | ^ | |
| 4 | 7 | raz: 1 error |
| @@ -1,4 +1,4 @@ | ||
| 1 | -conform/err/AtPCantAssign.raz:7:8: error: can't assign to k | |
| 1 | +conform/err/AtPCantAssign.raz:7:8: error: k is a constant, and can't be changed | |
| 2 | 2 | 7 | a, k := two(); |
| 3 | 3 | | ^ |
| 4 | 4 | raz: 1 error |
| @@ -1,4 +1,7 @@ | ||
| 1 | 1 | conform/err/GenVarExact.raz:6:7: error: a var parameter needs exactly I64, found I32 |
| 2 | 2 | 6 | P(x); |
| 3 | 3 | | ^ |
| 4 | +conform/err/GenVarExact.raz:2:12: note: it goes to a, declared here | |
| 5 | + 2 | proc P(var a: I64); begin end; | |
| 6 | + | ^ | |
| 4 | 7 | raz: 1 error |
| @@ -1,4 +1,4 @@ | ||
| 1 | -conform/err/ScanCharOpen.raz:5:10: error: character not closed | |
| 1 | +conform/err/ScanCharOpen.raz:5:10: error: a character is one character: the string is "ab" | |
| 2 | 2 | 5 | c := 'ab'; |
| 3 | - | ^^ | |
| 3 | + | ^^^^ | |
| 4 | 4 | raz: 1 error |
| @@ -1,4 +1,4 @@ | ||
| 1 | -conform/err/StmtAssignConst.raz:5:5: error: can't assign to k | |
| 1 | +conform/err/StmtAssignConst.raz:5:5: error: k is a constant, and can't be changed | |
| 2 | 2 | 5 | k := 2; |
| 3 | 3 | | ^ |
| 4 | 4 | raz: 1 error |
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | conform/err/StmtNoModule.raz:2:8: error: can't find module Nothing |
| 2 | 2 | 2 | import Nothing; |
| 3 | 3 | | ^^^^^^^ |
| 4 | +help: looked for Nothing.raz in conform/err, conform/err/mods, lib | |
| 4 | 5 | raz: 1 error |
| @@ -1,18 +1,5 @@ | ||
| 1 | 1 | test/run/StackOverflow.raz:7:1: stopped by a stack overflow |
| 2 | 2 | in StackOverflow.down at test/run/StackOverflow.raz:7:1 |
| 3 | 3 | in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 14 |
| 4 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 13 | |
| 5 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 12 | |
| 6 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 11 | |
| 7 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 10 | |
| 8 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 9 | |
| 9 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 8 | |
| 10 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 7 | |
| 11 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 6 | |
| 12 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 5 | |
| 13 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 4 | |
| 14 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 3 | |
| 15 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 2 | |
| 16 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 1 | |
| 17 | - in StackOverflow.down at test/run/StackOverflow.raz:11:5: n = 0 | |
| 4 | + and 14 more the same | |
| 18 | 5 | in StackOverflow.main at test/run/StackOverflow.raz:16:5 |
| @@ -1,21 +1,6 @@ | ||
| 1 | 1 | test/run/ThreadOverflow.raz:6:1: stopped by a stack overflow |
| 2 | 2 | in ThreadOverflow.down at test/run/ThreadOverflow.raz:6:1 |
| 3 | 3 | in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1926 |
| 4 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1925 | |
| 5 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1924 | |
| 6 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1923 | |
| 7 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1922 | |
| 8 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1921 | |
| 9 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1920 | |
| 10 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1919 | |
| 11 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1918 | |
| 12 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1917 | |
| 13 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1916 | |
| 14 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1915 | |
| 15 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1914 | |
| 16 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1913 | |
| 17 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1912 | |
| 18 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1911 | |
| 19 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1910 | |
| 20 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1909 | |
| 21 | - in ThreadOverflow.down at test/run/ThreadOverflow.raz:10:5: n = 1908 | |
| 4 | + and 1926 more the same | |
| 5 | + in ThreadOverflow.work at test/run/ThreadOverflow.raz:15:5: _arg = nil | |
| 6 | + in Thread.run at lib/Thread.linux-x86_64.raz:78:5: arg = 0x?, t = 0x? |
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | uses diag, scan; |
| 5 | 5 | var i: longint; |
| 6 | 6 | begin |
| 7 | - if not Open(ParamStr(1)) then Fatal('no file'); | |
| 7 | + if Open(ParamStr(1)) <> '' then Fatal('no file'); | |
| 8 | 8 | repeat |
| 9 | 9 | Next; |
| 10 | 10 | write(LineOf(TokPos), ':', TokPos.a, ' ', ord(tok)); |