mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
import can have free whitespace around imported names
This commit is contained in:
parent
6867817df4
commit
71dad43c03
@ -409,9 +409,9 @@ local build_grammar = wrap_env(function()
|
|||||||
|
|
||||||
Local = key"local" * ((op"*" + op"^") / mark"declare_glob" + Ct(NameList) / mark"declare_with_shadows"),
|
Local = key"local" * ((op"*" + op"^") / mark"declare_glob" + Ct(NameList) / mark"declare_with_shadows"),
|
||||||
|
|
||||||
Import = key"import" * Ct(ImportNameList) * key"from" * Exp / mark"import",
|
Import = key"import" * Ct(ImportNameList) * SpaceBreak^0 * key"from" * Exp / mark"import",
|
||||||
ImportName = (sym"\\" * Ct(Cc"colon_stub" * Name) + Name),
|
ImportName = (sym"\\" * Ct(Cc"colon_stub" * Name) + Name),
|
||||||
ImportNameList = ImportName * (sym"," * ImportName)^0,
|
ImportNameList = SpaceBreak^0 * ImportName * ((SpaceBreak^1 + sym"," * SpaceBreak^0) * ImportName)^0,
|
||||||
|
|
||||||
NameList = Name * (sym"," * Name)^0,
|
NameList = Name * (sym"," * Name)^0,
|
||||||
|
|
||||||
|
@ -20,3 +20,29 @@ import something from a table
|
|||||||
if indent
|
if indent
|
||||||
import okay, \well from tables[100]
|
import okay, \well from tables[100]
|
||||||
|
|
||||||
|
do
|
||||||
|
import a, b, c from z
|
||||||
|
|
||||||
|
do
|
||||||
|
import a,
|
||||||
|
b, c from z
|
||||||
|
|
||||||
|
do
|
||||||
|
import a
|
||||||
|
b
|
||||||
|
c from z
|
||||||
|
|
||||||
|
do
|
||||||
|
import
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c from z
|
||||||
|
|
||||||
|
|
||||||
|
do
|
||||||
|
import
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
from z
|
||||||
|
|
||||||
|
@ -43,3 +43,18 @@ if indent then
|
|||||||
end)()
|
end)()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
do
|
||||||
|
a, b, c = z.a, z.b, z.c
|
||||||
|
end
|
||||||
|
do
|
||||||
|
a, b, c = z.a, z.b, z.c
|
||||||
|
end
|
||||||
|
do
|
||||||
|
a, b, c = z.a, z.b, z.c
|
||||||
|
end
|
||||||
|
do
|
||||||
|
a, b, c = z.a, z.b, z.c
|
||||||
|
end
|
||||||
|
do
|
||||||
|
a, b, c = z.a, z.b, z.c
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user