Skip to content

Commit

Permalink
Allow line continuation before "->" return anno; issue #51.
Browse files Browse the repository at this point in the history
  • Loading branch information
1st1 committed Aug 9, 2016
1 parent b2ca47e commit 1df75f1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions grammars/MagicPython.cson
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,9 @@ repository:
{
include: "#parameters"
}
{
include: "#line-continuation"
}
{
include: "#return-annotation"
}
Expand Down
6 changes: 4 additions & 2 deletions grammars/MagicPython.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
<string>Sconstruct</string>
<string>sconstruct</string>
<string>SConscript</string>
<string>gyp</string>
<string>gypi</string>
</array>
<key>first_line_match</key>
<string>^#!/.*\bpython[\d\.]*\b</string>
Expand Down Expand Up @@ -1905,6 +1903,10 @@
<key>include</key>
<string>#parameters</string>
</dict>
<dict>
<key>include</key>
<string>#line-continuation</string>
</dict>
<dict>
<key>include</key>
<string>#return-annotation</string>
Expand Down
1 change: 1 addition & 0 deletions grammars/src/MagicPython.syntax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ repository:
patterns:
- include: '#function-def-name'
- include: '#parameters'
- include: '#line-continuation'
- include: '#return-annotation'

function-def-name:
Expand Down
23 changes: 23 additions & 0 deletions test/functions/decl12.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
def get_streaks(s) \
-> 'spam': pass



def : meta.function.python, source.python, storage.type.function.python
: meta.function.python, source.python
get_streaks : entity.name.function.python, meta.function.python, source.python
( : meta.function.parameters.python, meta.function.python, punctuation.definition.parameters.begin.python, source.python
s : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.python
) : meta.function.parameters.python, meta.function.python, punctuation.definition.parameters.end.python, source.python
: meta.function.python, source.python
\ : meta.function.python, separator.continuation.line.python, source.python
: meta.function.python, source.python
: meta.function.python, source.python
-> : meta.function.python, punctuation.separator.annotation.result.python, source.python
: meta.function.python, source.python
' : meta.function.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.python
spam : meta.function.python, source.python, string.quoted.single.python
' : meta.function.python, punctuation.definition.string.end.python, source.python, string.quoted.single.python
: : meta.function.python, punctuation.section.function.begin.python, source.python
: source.python
pass : keyword.control.flow.python, source.python

0 comments on commit 1df75f1

Please sign in to comment.