diff --git a/RenpyLanguage.JSON-tmLanguage b/RenpyLanguage.JSON-tmLanguage
index d70a76c..9d8bf72 100644
--- a/RenpyLanguage.JSON-tmLanguage
+++ b/RenpyLanguage.JSON-tmLanguage
@@ -13,54 +13,30 @@
"patterns": [
{
- "begin": "^(\\s*)(label)(\\s)+(.*):",
+ "begin": "^(\\h*)(label)(\\s+)(.*):",
"beginCaptures":{
"2":{"name":"keyword.control.flow.renpy"},
"4":{"name":"variable.renpy"}
},
"patterns": [
{"include": "#ingame"},
-
- {
- "begin": "^(\\s)*python((\\s)+(\\w)*)?:(\\s)*$",
- "beginCaptures":{
- "0":{"name":"keyword.control.flow.renpy"}
- },
- "patterns": [
- {"include": "#python"},
- {"include": "source.python"}
- ],
- "end": "^(?!(\\1\\s+|\\s*$))",
- "name": "source.python.renpy"
- },
-
- {
- "match":"^(\\s*)(\\$)(.*)$\\n?",
- "patterns": [
- {"include": "#python"},
- {"include": "source.python"}
- ],
- "name": "source.python.renpy"
- },
-
- {
- "include":"source.python"
- }
-
+ {"include": "#python_block"},
+ {"include": "#python_line"},
+ {"include":"source.python"}
],
"end": "^(?!(\\1\\s+|\\s*$))",
"name": "source.renpy.ingame"
},
{
- "begin": "^(\\s)*(screen)(\\s)+(\\w+)(\\s)*(\\(.*\\))?(\\s)*:",
+ "begin": "^(\\h*)(screen)(\\s+)(\\w+)(\\s*)(\\(.*\\))?(\\s*):",
"beginCaptures":{
"2":{"name":"keyword.control.flow.renpy"},
"4":{"name":"variable.renpy"}
},
"patterns": [
{
- "begin":"^(\\s*)(imagemap).*:",
+ "begin":"^(\\s*)(imagemap)(\\s*):",
"beginCaptures":{
"2":{"name":"keyword.control.flow.renpy"}
},
@@ -74,24 +50,10 @@
"name": "source.renpy.screen"
},
- {
- "begin": "^(\\s)*(style)(\\s)+(.*)((\\s)+(is)(\\s)+(.*))?(\\s)*:",
- "beginCaptures":{
- "2":{"name":"keyword.control.flow.renpy"},
- "4":{"name":"variable.renpy"},
- "7":{"name":"variable.parameter.renpy"},
- "9":{"name":"variable.renpy"}
- },
- "patterns": [
- {"include": "#atl"},
- {"include": "source.python"}
- ],
- "end": "^(?!(\\1\\s+|\\s*$))",
- "name": "source.renpy.atl"
- },
+ {"include":"#style"},
{
- "begin": "^(\\s*)(transform)(\\s)+(.*):",
+ "begin": "^(\\h*)(transform)(\\s+)(\\w+)(\\s*):",
"beginCaptures":{
"2":{"name":"keyword.control.flow.renpy"},
"4":{"name":"variable.renpy"}
@@ -105,10 +67,10 @@
},
{
- "begin": "^(\\s*)(image|scene|show)((\\s)+(\\w)+)+:",
+ "begin": "^(\\s*)(image|scene|show)((\\s+)(\\w+))+:",
"beginCaptures":{
"2":{"name":"keyword.control.flow.renpy"},
- "4":{"name":"variable.renpy"}
+ "3":{"name":"variable.renpy"}
},
"patterns": [
{"include": "#transform"},
@@ -118,21 +80,10 @@
"name": "source.renpy.transform"
},
- {
- "begin": "^(\\s)*python((\\s)+(\\w)*)?:(\\s)*$",
- "beginCaptures":{
- "0":{"name":"keyword.control.flow.renpy"}
- },
- "patterns": [
- {"include": "#python"},
- {"include": "source.python"}
- ],
- "end": "^(?!(\\1\\s+|\\s*$))",
- "name": "source.python.renpy"
- },
+ {"include": "#python_block"},
{
- "begin": "^(\\s)*init(\\s)+((\\+|\\-)\\d+\\s+)?python((\\s)+(\\w)*)?:(\\s)*$",
+ "begin": "^(\\h*)init(\\s+)((\\+|\\-)\\d+\\s+)?python((\\s+)(\\w*))?:(\\s*)$",
"beginCaptures":{
"0":{"name":"keyword.control.flow.renpy"}
},
@@ -145,52 +96,14 @@
},
{
- "begin": "^(\\s)*init(\\s+(\\+|\\-)\\d+)?((\\s)+(\\w)*)?\\s*:(\\s)*$",
+ "begin": "^(\\h*)(init)(\\s+(\\+|\\-)\\d+)?(\\s+\\w*)?\\s*:\\s*$",
"beginCaptures":{
"0":{"name":"keyword.control.flow.renpy"}
},
"patterns": [
-
- {
- "begin": "^(\\s)*python((\\s)+(\\w)*)?:(\\s)*$",
- "beginCaptures":{
- "0":{"name":"keyword.control.flow.renpy"}
- },
- "patterns": [
- {"include": "#python"},
- {"include": "#init"},
- {"include": "source.python"}
- ],
- "end": "^(?!(\\1\\s+|\\s*$))",
- "name": "source.python.renpy.init"
- },
-
- {
- "match":"^(\\s*)(\\$)(.*)$\\n?",
- "patterns": [
- {"include": "#python"},
- {"include": "#init"},
- {"include": "source.python"}
- ],
- "name": "source.python.renpy.init"
- },
-
- {
- "begin": "^(\\s)*(style)(\\s)+(.*)((\\s)+(is)(\\s)+(.*))?(\\s)*:",
- "beginCaptures":{
- "2":{"name":"keyword.control.flow.renpy"},
- "4":{"name":"variable.renpy"},
- "7":{"name":"variable.parameter.renpy"},
- "9":{"name":"variable.renpy"}
- },
- "patterns": [
- {"include": "#atl"},
- {"include": "source.python"}
- ],
- "end": "^(?!(\\1\\s+|\\s*$))",
- "name": "source.renpy.atl"
- },
-
+ {"include":"#python_block_init"},
+ {"include":"#python_line_init"},
+ {"include":"#style"},
{"include": "source.python"}
],
"end": "^(?!(\\1\\s+|\\s*$))",
@@ -260,6 +173,22 @@
]
},
+ "style": {
+ "begin": "^(\\s*)(style)(\\s+\\w+)((\\s+)(is)(\\s+)(\\w+))?(\\s*):",
+ "beginCaptures":{
+ "2":{"name":"keyword.control.flow.renpy"},
+ "3":{"name":"variable.renpy"},
+ "6":{"name":"variable.parameter.renpy"},
+ "8":{"name":"variable.renpy"}
+ },
+ "patterns": [
+ {"include": "#atl"},
+ {"include": "source.python"}
+ ],
+ "end": "^(?!(\\1\\s+|\\s*$))",
+ "name": "source.renpy.atl"
+ },
+
"screen": {
"patterns": [
{
@@ -309,7 +238,7 @@
"python": {
"patterns": [
{
- "begin": "(\\s)*(renpy\\.)([a-zA-Z0-9_]*)",
+ "begin": "(\\s)*(renpy\\.)(\\w*)",
"beginCaptures":{
"0":{"name":"source.python"},
"2":{"name":"keyword.control.flow.renpy"},
@@ -319,8 +248,64 @@
}
]
+ },
+
+ "python_block": {
+ "begin": "^(\\s*)python(\\s+\\w+)?(\\s*):",
+ "beginCaptures":{
+ "0":{"name":"keyword.control.flow.renpy"}
+ },
+ "patterns": [
+ {"include": "#python"},
+ {"include": "source.python"}
+ ],
+ "end": "^(?!(\\1\\s+|\\s*$))",
+ "name": "source.python.renpy"
+ },
+
+ "python_line": {
+ "begin": "^(\\s*)(\\$)",
+ "beginCaptures":{
+ "2":{"name":"keyword.control.flow.renpy"}
+ },
+ "patterns": [
+ {"include": "#python"},
+ {"include": "source.python"}
+ ],
+ "end": "\\n",
+ "name": "source.python.renpy"
+ },
+
+ "python_block_init": {
+ "begin": "^(\\s*)python(\\s+\\w+)?(\\s*):",
+ "beginCaptures":{
+ "0":{"name":"keyword.control.flow.renpy"}
+ },
+ "patterns": [
+ {"include": "#python"},
+ {"include": "#init"},
+ {"include": "source.python"}
+ ],
+ "end": "^(?!(\\1\\s+|\\s*$))",
+ "name": "source.python.renpy.init"
+ },
+
+ "python_line_init": {
+ "begin": "^(\\s*)(\\$)",
+ "beginCaptures":{
+ "2":{"name":"keyword.control.flow.renpy"}
+ },
+ "patterns": [
+ {"include": "#python"},
+ {"include": "#init"},
+ {"include": "source.python"}
+ ],
+ "end": "\\n",
+ "name": "source.python.renpy.init"
}
+
+
},
"foldingStartMarker": "^\\s*(def|class)\\s+([.a-zA-Z0-9_ <]+)\\s*(\\((.*)\\))?\\s*:|\\{\\s*$|\\(\\s*$|\\[\\s*$|^\\s*\"\"\"(?=.)(?!.*\"\"\")",
diff --git a/RenpyLanguage.tmLanguage b/RenpyLanguage.tmLanguage
index 290caa4..8d7d655 100644
--- a/RenpyLanguage.tmLanguage
+++ b/RenpyLanguage.tmLanguage
@@ -27,7 +27,7 @@
begin
- ^(\s*)(label)(\s)+(.*):
+ ^(\h*)(label)(\s+)(.*):
beginCaptures
2
@@ -52,48 +52,12 @@
#ingame
- begin
- ^(\s)*python((\s)+(\w)*)?:(\s)*$
- beginCaptures
-
- 0
-
- name
- keyword.control.flow.renpy
-
-
- end
- ^(?!(\1\s+|\s*$))
- name
- source.python.renpy
- patterns
-
-
- include
- #python
-
-
- include
- source.python
-
-
+ include
+ #python_block
- match
- ^(\s*)(\$)(.*)$\n?
- name
- source.python.renpy
- patterns
-
-
- include
- #python
-
-
- include
- source.python
-
-
+ include
+ #python_line
include
@@ -103,7 +67,7 @@
begin
- ^(\s)*(screen)(\s)+(\w+)(\s)*(\(.*\))?(\s)*:
+ ^(\h*)(screen)(\s+)(\w+)(\s*)(\(.*\))?(\s*):
beginCaptures
2
@@ -125,7 +89,7 @@
begin
- ^(\s*)(imagemap).*:
+ ^(\s*)(imagemap)(\s*):
beginCaptures
2
@@ -155,50 +119,12 @@
- begin
- ^(\s)*(style)(\s)+(.*)((\s)+(is)(\s)+(.*))?(\s)*:
- beginCaptures
-
- 2
-
- name
- keyword.control.flow.renpy
-
- 4
-
- name
- variable.renpy
-
- 7
-
- name
- variable.parameter.renpy
-
- 9
-
- name
- variable.renpy
-
-
- end
- ^(?!(\1\s+|\s*$))
- name
- source.renpy.atl
- patterns
-
-
- include
- #atl
-
-
- include
- source.python
-
-
+ include
+ #style
begin
- ^(\s*)(transform)(\s)+(.*):
+ ^(\h*)(transform)(\s+)(\w+)(\s*):
beginCaptures
2
@@ -230,7 +156,7 @@
begin
- ^(\s*)(image|scene|show)((\s)+(\w)+)+:
+ ^(\s*)(image|scene|show)((\s+)(\w+))+:
beginCaptures
2
@@ -238,7 +164,7 @@
name
keyword.control.flow.renpy
- 4
+ 3
name
variable.renpy
@@ -261,35 +187,12 @@
- begin
- ^(\s)*python((\s)+(\w)*)?:(\s)*$
- beginCaptures
-
- 0
-
- name
- keyword.control.flow.renpy
-
-
- end
- ^(?!(\1\s+|\s*$))
- name
- source.python.renpy
- patterns
-
-
- include
- #python
-
-
- include
- source.python
-
-
+ include
+ #python_block
begin
- ^(\s)*init(\s)+((\+|\-)\d+\s+)?python((\s)+(\w)*)?:(\s)*$
+ ^(\h*)init(\s+)((\+|\-)\d+\s+)?python((\s+)(\w*))?:(\s*)$
beginCaptures
0
@@ -316,7 +219,7 @@
begin
- ^(\s)*init(\s+(\+|\-)\d+)?((\s)+(\w)*)?\s*:(\s)*$
+ ^(\h*)(init)(\s+(\+|\-)\d+)?(\s+\w*)?\s*:\s*$
beginCaptures
0
@@ -332,98 +235,16 @@
patterns
- begin
- ^(\s)*python((\s)+(\w)*)?:(\s)*$
- beginCaptures
-
- 0
-
- name
- keyword.control.flow.renpy
-
-
- end
- ^(?!(\1\s+|\s*$))
- name
- source.python.renpy.init
- patterns
-
-
- include
- #python
-
-
- include
- #init
-
-
- include
- source.python
-
-
+ include
+ #python_block_init
- match
- ^(\s*)(\$)(.*)$\n?
- name
- source.python.renpy.init
- patterns
-
-
- include
- #python
-
-
- include
- #init
-
-
- include
- source.python
-
-
+ include
+ #python_line_init
- begin
- ^(\s)*(style)(\s)+(.*)((\s)+(is)(\s)+(.*))?(\s)*:
- beginCaptures
-
- 2
-
- name
- keyword.control.flow.renpy
-
- 4
-
- name
- variable.renpy
-
- 7
-
- name
- variable.parameter.renpy
-
- 9
-
- name
- variable.renpy
-
-
- end
- ^(?!(\1\s+|\s*$))
- name
- source.renpy.atl
- patterns
-
-
- include
- #atl
-
-
- include
- source.python
-
-
+ include
+ #style
include
@@ -561,7 +382,7 @@
begin
- (\s)*(renpy\.)([a-zA-Z0-9_]*)
+ (\s)*(renpy\.)(\w*)
beginCaptures
0
@@ -585,6 +406,126 @@
+ python_block
+
+ begin
+ ^(\s*)python(\s+\w+)?(\s*):
+ beginCaptures
+
+ 0
+
+ name
+ keyword.control.flow.renpy
+
+
+ end
+ ^(?!(\1\s+|\s*$))
+ name
+ source.python.renpy
+ patterns
+
+
+ include
+ #python
+
+
+ include
+ source.python
+
+
+
+ python_block_init
+
+ begin
+ ^(\s*)python(\s+\w+)?(\s*):
+ beginCaptures
+
+ 0
+
+ name
+ keyword.control.flow.renpy
+
+
+ end
+ ^(?!(\1\s+|\s*$))
+ name
+ source.python.renpy.init
+ patterns
+
+
+ include
+ #python
+
+
+ include
+ #init
+
+
+ include
+ source.python
+
+
+
+ python_line
+
+ begin
+ ^(\s*)(\$)
+ beginCaptures
+
+ 2
+
+ name
+ keyword.control.flow.renpy
+
+
+ end
+ \n
+ name
+ source.python.renpy
+ patterns
+
+
+ include
+ #python
+
+
+ include
+ source.python
+
+
+
+ python_line_init
+
+ begin
+ ^(\s*)(\$)
+ beginCaptures
+
+ 2
+
+ name
+ keyword.control.flow.renpy
+
+
+ end
+ \n
+ name
+ source.python.renpy.init
+ patterns
+
+
+ include
+ #python
+
+
+ include
+ #init
+
+
+ include
+ source.python
+
+
+
screen
end
@@ -639,6 +580,49 @@
+ style
+
+ begin
+ ^(\s*)(style)(\s+\w+)((\s+)(is)(\s+)(\w+))?(\s*):
+ beginCaptures
+
+ 2
+
+ name
+ keyword.control.flow.renpy
+
+ 3
+
+ name
+ variable.renpy
+
+ 6
+
+ name
+ variable.parameter.renpy
+
+ 8
+
+ name
+ variable.renpy
+
+
+ end
+ ^(?!(\1\s+|\s*$))
+ name
+ source.renpy.atl
+ patterns
+
+
+ include
+ #atl
+
+
+ include
+ source.python
+
+
+
scopeName
source.renpy
diff --git a/messages.json b/messages.json
index 41e7afe..b081301 100644
--- a/messages.json
+++ b/messages.json
@@ -13,5 +13,6 @@
"1.1.03": "messages/1.1.3.txt",
"1.1.04": "messages/1.1.4.txt",
"1.1.05": "messages/1.1.5.txt",
- "1.1.06": "messages/1.1.6.txt"
+ "1.1.06": "messages/1.1.6.txt",
+ "1.1.07": "messages/1.1.7.txt"
}
diff --git a/messages/1.1.7.txt b/messages/1.1.7.txt
index bb0baaa..851270c 100644
--- a/messages/1.1.7.txt
+++ b/messages/1.1.7.txt
@@ -3,6 +3,7 @@ Sublime Renpy v1.1.7
Bugfixes:
-Fixed appearance of "screen" keyword in a screen block
+-Nested python blocks no longer leak context
Improvements: