Skip to content

Commit d1e727a

Browse files
committed
support using M: a as b correctly
JuliaLang/julia#37396 added support for this syntax as well, but CSTParser currently returns an error token.
1 parent fa69366 commit d1e727a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/components/keywords.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@ function parse_imports(ps::ParseState)
173173
elseif iscolon(ps.nt)
174174
ret = EXPR(kwt, EXPR[EXPR(EXPR(:OPERATOR, next(ps)), EXPR[arg])], EXPR[kw])
175175

176-
arg = parse_dot_mod(ps, true, allow_as)
176+
arg = parse_dot_mod(ps, true, true)
177177
push!(ret.args[1], arg)
178178
prevpos = position(ps)
179179
while iscomma(ps.nt)
180180
pushtotrivia!(ret.args[1], accept_comma(ps))
181-
arg = parse_dot_mod(ps, true, allow_as)
181+
arg = parse_dot_mod(ps, true, true)
182182
push!(ret.args[1], arg)
183183
prevpos = loop_check(ps, prevpos)
184184
end

test/parser.jl

+4
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,11 @@ end""" |> test_expr
899899
@testset "import .. as .. syntax" begin
900900
@test test_expr("import a as b")
901901
@test test_expr("import a as b, c")
902+
@test test_expr("import M: a as b")
903+
@test test_expr("import M: a as b, c")
902904
@test CSTParser.parse("using a as b")[2].head === :errortoken
905+
@test test_expr("using M: a as b")
906+
@test test_expr("using M: a as b, c")
903907
end
904908
end
905909
@testset "exor #201" begin

0 commit comments

Comments
 (0)