Skip to content

Commit cdedc77

Browse files
committed
Avoid directly accessing ParseStream lookahead array in parser API
1 parent 9dd1ae2 commit cdedc77

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

src/parser.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,6 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
14051405
# A.@foo a b ==> (macrocall (. A (quote @foo)) a b)
14061406
# @A.foo a b ==> (macrocall (. A (quote @foo)) a b)
14071407
n_args = parse_space_separated_exprs(ps)
1408-
# TODO: Introduce K"doc" to make this hack less awful.
14091408
is_doc_macro = peek_behind(ps, macro_name_position).orig_kind == K"doc"
14101409
if is_doc_macro && n_args == 1
14111410
# Parse extended @doc args on next line

src/parser_api.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function parseall(::Type{T}, input...; rule=:toplevel, version=VERSION,
152152
end
153153
parse(stream; rule=rule)
154154
if (ignore_trivia && peek(stream, skip_newlines=true) != K"EndMarker") ||
155-
(!ignore_trivia && (peek(stream); kind(first(stream.lookahead)) != K"EndMarker"))
155+
(!ignore_trivia && (peek(stream, skip_newlines=false, skip_whitespace=false) != K"EndMarker"))
156156
emit_diagnostic(stream, error="unexpected text after parsing $rule")
157157
end
158158
if any_error(stream.diagnostics)

test/parse_stream.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using JuliaSyntax: ParseStream,
77
peek, peek_token,
88
bump, bump_trivia, bump_invisible,
9-
emit, emit_diagnostic
9+
emit, emit_diagnostic, TRIVIA_FLAG, INFIX_FLAG
1010

1111
code = """
1212
for i = 1:10

0 commit comments

Comments
 (0)