Skip to content

Commit 08d69c8

Browse files
committed
Add note about weird refparser behaviour
1 parent 54587cc commit 08d69c8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,25 @@ name of compatibility, perhaps with a warning.)
549549
arises from `(set! pred char-hex?)` in `parse-number` accepting hex exponent
550550
digits, all of which are detected as invalid except for a trailing `f` when
551551
processed by `isnumtok_base`.
552+
* `begin` and `end` are not parsed as keywords when indexing. Typed comprehensions
553+
initially look the same, but can be distinguished from indexing once we handle
554+
a `for` token; it is safe to treat `begin` and `end` as keywords afterwards. The
555+
reference parser *only* handles this well when there's a newline before `for`:
556+
```julia
557+
Any[foo(i)
558+
for i in x if begin
559+
true
560+
end
561+
]
562+
```
563+
works, while
564+
```julia
565+
Any[foo(i) for i in x if begin
566+
true
567+
end
568+
]
569+
```
570+
does not. JuliaSyntax handles both cases.
552571

553572
## Parsing / AST oddities and warts
554573

0 commit comments

Comments
 (0)