Skip to content

Commit b4b3083

Browse files
author
Yury Selivanov
committed
Support 'from...import' syntax (no whitespace)
1 parent 2c9dcb6 commit b4b3083

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

grammars/MagicPython.cson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ repository:
815815
"from-import":
816816
match: '''
817817
(?x)
818-
^\\s* (from) (\\s+\\.*\\s*)
818+
\\s* (from) (\\s*\\.+\\s*)
819819
820820
'''
821821
captures:

grammars/MagicPython.syntax.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ repository:
570570
from-import:
571571
match: |
572572
(?x)
573-
^\s* (from) (\s+\.*\s*)
573+
\s* (from) (\s*\.+\s*)
574574
captures:
575575
'1': {name: keyword.control.flow.python}
576576

grammars/MagicPython.tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@
13181318
<dict>
13191319
<key>match</key>
13201320
<string>(?x)
1321-
^\s* (from) (\s+\.*\s*)
1321+
\s* (from) (\s*\.+\s*)
13221322
</string>
13231323
<key>captures</key>
13241324
<dict>

test/statements/import3.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from....import a
2+
from...import b
3+
from..import c
4+
5+
6+
7+
from : keyword.control.flow.python, source.python
8+
.... : source.python
9+
import : keyword.control.flow.python, source.python
10+
a : source.python
11+
from : keyword.control.flow.python, source.python
12+
... : source.python
13+
import : keyword.control.flow.python, source.python
14+
b : source.python
15+
from : keyword.control.flow.python, source.python
16+
.. : source.python
17+
import : keyword.control.flow.python, source.python
18+
c : source.python

0 commit comments

Comments
 (0)