{"action":"created","comment":{"url":"https://api.github.com/repos/sublimehq/Packages/pulls/comments/65385725","id":65385725,"diff_hunk":"@@ -15,38 +16,205 @@ file_extensions:\n   - Snakefile\n first_line_match: ^#!/.*\\bpython\\d?\\b\n scope: source.python\n+\n variables:\n   # We support unicode here because Python 3 is the future\n   identifier_continue: '[[:alnum:]_]'\n   identifier: '\\b[[:alpha:]_]{{identifier_continue}}*\\b'\n-  path: '({{identifier}}\\.)*{{identifier}}'\n+  path: '({{identifier}} *\\. *)*{{identifier}}'\n   sql_indicator: \\s*(?:SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER)\\b\n \n contexts:\n   main:\n     - include: statements\n \n   statements:\n+    - include: inline_statements\n+    - include: block_statements\n     - include: classes\n     - include: functions\n     - include: decorators\n+    - include: modifiers\n+    - include: assignments\n+    - match: ;\n+      scope: punctuation.separator.statements.python\n     - include: expressions\n \n+  inline_statements:\n+    - include: imports\n+    - match: \\b(raise)\\b\n+      scope: keyword.control.flow.raise.python\n+      push:\n+        - meta_scope: meta.statement.raise.python\n+        - include: line_continuation_or_pop\n+        - match: \\b(from)\\b\n+          scope: keyword.control.flow.raise.from.python\n+          set:\n+            - meta_scope: meta.statement.raise.python\n+            - include: line_continuation_or_pop\n+            - include: expressions\n+        - include: expressions\n+    - match: \\b(assert)\\b\n+      scope: keyword.other.assert.python\n+      push:\n+        - meta_scope: meta.statement.assert.python\n+        - match: $\n+          pop: true\n+        - include: expressions\n+    - match: \\b(del)\\b\n+      scope: keyword.other.del.python\n+      push:\n+        - meta_scope: meta.statement.del.python\n+        - include: line_continuation_or_pop\n+        - include: expressions\n+    - match: \\b(print)\\b(?! *($|[,.()\\]}]))\n+      scope: keyword.other.print.python\n+      push:\n+        - meta_scope: meta.statement.print.python\n+        - include: line_continuation_or_pop\n+        - include: expressions\n+    - match: \\b(exec)\\b(?! *($|[,.()\\]}]))\n+      scope: keyword.other.exec.python\n+      push:\n+        - meta_scope: meta.statement.exec.python\n+        - include: line_continuation_or_pop\n+        - include: expressions\n+    - match: \\b(return)\\b\n+      scope: keyword.control.flow.return.python\n+    - match: \\b(break|continue|pass)\\b\n+      scope: keyword.control.flow.python\n+\n+  imports:\n+    - match: \\b(import)\\b\n+      scope: keyword.control.import.python\n+      push:\n+        - meta_scope: meta.statement.import.python\n+        - include: line_continuation_or_pop\n+        - include: import_alias\n+        - include: dotted_name\n+        - match: ','\n+          scope: punctuation.separator.import-list.python\n+    - match: \\b(from)\\b\n+      scope: keyword.control.import.from.python\n+      push:\n+        - meta_scope: meta.statement.import.python\n+          meta_content_scope: meta.import-source.python\n+        - include: line_continuation_or_pop\n+        - match: \\b(import)\\b\n+          scope: keyword.control.import.python\n+          set:\n+            - include: line_continuation_or_pop\n+            - match: ' *(\\()'\n+              captures:\n+                1: punctuation.definition.begin.import-list\n+              set:\n+                - meta_scope: meta.statement.import.python\n+                - include: comments\n+                - match: \\)\n+                  scope: punctuation.definition.end.import-list\n+                  pop: true\n+                - include: import_name_list\n+            - match: ''\n+              set:\n+                - meta_scope: meta.statement.import.python\n+                - include: line_continuation_or_pop\n+                - include: import_name_list\n+        - include: dotted_name\n+\n+  import_name_list:\n+    - match: ','\n+      scope: punctuation.separator.import-list.python\n+    - include: import_alias\n+    - include: name\n+    - match: \\*\n+      scope: keyword.other.import-all.python\n+    - match: \\S+\n+      scope: invalid.illegal.name.import.python\n+\n+  import_alias:\n+    - match: \\b(as)\\b\n+      scope: keyword.control.import.as.python\n+\n+  block_statements:\n+    # async for ... in ...:\n+    - match: \\b(async +)?(for)\\b\n+      captures:\n+        1: keyword.control.flow.async.python","path":"Python/Python.sublime-syntax","position":139,"original_position":139,"commit_id":"b5a617e71f640038102b589ffba75571574d5ab9","original_commit_id":"b5a617e71f640038102b589ffba75571574d5ab9","user":{"login":"wbond","id":41734,"avatar_url":"https://avatars.githubusercontent.com/u/41734?v=3","gravatar_id":"","url":"https://api.github.com/users/wbond","html_url":"https://github.com/wbond","followers_url":"https://api.github.com/users/wbond/followers","following_url":"https://api.github.com/users/wbond/following{/other_user}","gists_url":"https://api.github.com/users/wbond/gists{/gist_id}","starred_url":"https://api.github.com/users/wbond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbond/subscriptions","organizations_url":"https://api.github.com/users/wbond/orgs","repos_url":"https://api.github.com/users/wbond/repos","events_url":"https://api.github.com/users/wbond/events{/privacy}","received_events_url":"https://api.github.com/users/wbond/received_events","type":"User","site_admin":false},"body":"`async` should probably be `storage.modifier` here. Having some instances of `async` (before `def`) be one scope and others be a different scope would feel very off to me as a user. I think that `storage.modifier` is more correct than `keyword.control` since `async` is modifying how the `for` loop is being executed.","created_at":"2016-06-01T15:37:55Z","updated_at":"2016-06-01T15:37:55Z","html_url":"https://github.com/sublimehq/Packages/pull/386#discussion_r65385725","pull_request_url":"https://api.github.com/repos/sublimehq/Packages/pulls/386","_links":{"self":{"href":"https://api.github.com/repos/sublimehq/Packages/pulls/comments/65385725"},"html":{"href":"https://github.com/sublimehq/Packages/pull/386#discussion_r65385725"},"pull_request":{"href":"https://api.github.com/repos/sublimehq/Packages/pulls/386"}}},"pull_request":{"url":"https://api.github.com/repos/sublimehq/Packages/pulls/386","id":69868912,"html_url":"https://github.com/sublimehq/Packages/pull/386","diff_url":"https://github.com/sublimehq/Packages/pull/386.diff","patch_url":"https://github.com/sublimehq/Packages/pull/386.patch","issue_url":"https://api.github.com/repos/sublimehq/Packages/issues/386","number":386,"state":"open","locked":false,"title":"[Python] Improvements on highlighting with focus on keywords","user":{"login":"FichteFoll","id":931051,"avatar_url":"https://avatars.githubusercontent.com/u/931051?v=3","gravatar_id":"","url":"https://api.github.com/users/FichteFoll","html_url":"https://github.com/FichteFoll","followers_url":"https://api.github.com/users/FichteFoll/followers","following_url":"https://api.github.com/users/FichteFoll/following{/other_user}","gists_url":"https://api.github.com/users/FichteFoll/gists{/gist_id}","starred_url":"https://api.github.com/users/FichteFoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FichteFoll/subscriptions","organizations_url":"https://api.github.com/users/FichteFoll/orgs","repos_url":"https://api.github.com/users/FichteFoll/repos","events_url":"https://api.github.com/users/FichteFoll/events{/privacy}","received_events_url":"https://api.github.com/users/FichteFoll/received_events","type":"User","site_admin":false},"body":"I finally ~~found the time~~ made some time to work on this. There is still things left to be done, but especially keyword matching is greatly improved now for keywords that only occur in conjunction with other keywords (in statements, e.g. `for ... in ...:`). Additionally, list comprehensions are more properly matched and only where applicale and highlighting of `print` and `exec` is smarter.\r\n\r\nWhile I was working on it, I also \r\n\r\n- allowed dots in dotted_names to be surrounded by spaces,\r\n- made set literals have an appearance\r\n- unified context formatting (underscores and separated with empty lines)\r\n- added scopes for annotations, default values and all commas\r\n- made assignments in expressions illegal, as well as storage modifiers\r\n- made semicolons get matched\r\n- more...?\r\n\r\n---\r\n\r\n**Performance tests** (with `Lib/_pydecimal.py` (6300 lines) as bundled in Python 3.5)\r\n\r\nBefore: ~105ms\r\nAfter: ~105ms\r\n\r\n---\r\n\r\nWhat remains to be done is to make statements only match at the beginning of a line so that `for` or `def` may not appear in the middle of a line. There are a couple ways of doing this (I assume you know enough about this now thanks to the JavaScript rewrite), but this will be left up for later since it's another medium-scale change to scope management.\r\n\r\nItem-access and function calls also need to be revisited, not only because they still contain look-behinds but also because of how inaccurate they are. While function calls in general are alright, item access sometimes gets confused with list literals.\r\n\r\nAlso, decorators are clearly lacking at this moment. They should be parsed like an inline-keyword (in that they allow expressions to follow but do not span more than one line unless explicitly continued or wrapped in a group). They should also not be scoped as `entity.name.function.decorator` imo.\r\nI have a [change for this ready in a branch](https://github.com/FichteForks/Packages/commit/cd5628519bf67abab43a292a898ae6a38b279770) but it really takes some getting used to considering how long it has been \"wrong\". I will not be including this change in this PR and open a new one once this is merged.","created_at":"2016-05-12T16:40:10Z","updated_at":"2016-06-01T15:37:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"392dc4d6146765c3b146d3709cafcb3bcc9ba7be","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sublimehq/Packages/pulls/386/commits","review_comments_url":"https://api.github.com/repos/sublimehq/Packages/pulls/386/comments","review_comment_url":"https://api.github.com/repos/sublimehq/Packages/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sublimehq/Packages/issues/386/comments","statuses_url":"https://api.github.com/repos/sublimehq/Packages/statuses/b5a617e71f640038102b589ffba75571574d5ab9","head":{"label":"FichteForks:python_syntax_enh","ref":"python_syntax_enh","sha":"b5a617e71f640038102b589ffba75571574d5ab9","user":{"login":"FichteForks","id":12277212,"avatar_url":"https://avatars.githubusercontent.com/u/12277212?v=3","gravatar_id":"","url":"https://api.github.com/users/FichteForks","html_url":"https://github.com/FichteForks","followers_url":"https://api.github.com/users/FichteForks/followers","following_url":"https://api.github.com/users/FichteForks/following{/other_user}","gists_url":"https://api.github.com/users/FichteForks/gists{/gist_id}","starred_url":"https://api.github.com/users/FichteForks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FichteForks/subscriptions","organizations_url":"https://api.github.com/users/FichteForks/orgs","repos_url":"https://api.github.com/users/FichteForks/repos","events_url":"https://api.github.com/users/FichteForks/events{/privacy}","received_events_url":"https://api.github.com/users/FichteForks/received_events","type":"Organization","site_admin":false},"repo":{"id":37598292,"name":"Packages","full_name":"FichteForks/Packages","owner":{"login":"FichteForks","id":12277212,"avatar_url":"https://avatars.githubusercontent.com/u/12277212?v=3","gravatar_id":"","url":"https://api.github.com/users/FichteForks","html_url":"https://github.com/FichteForks","followers_url":"https://api.github.com/users/FichteForks/followers","following_url":"https://api.github.com/users/FichteForks/following{/other_user}","gists_url":"https://api.github.com/users/FichteForks/gists{/gist_id}","starred_url":"https://api.github.com/users/FichteForks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FichteForks/subscriptions","organizations_url":"https://api.github.com/users/FichteForks/orgs","repos_url":"https://api.github.com/users/FichteForks/repos","events_url":"https://api.github.com/users/FichteForks/events{/privacy}","received_events_url":"https://api.github.com/users/FichteForks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FichteForks/Packages","description":"","fork":true,"url":"https://api.github.com/repos/FichteForks/Packages","forks_url":"https://api.github.com/repos/FichteForks/Packages/forks","keys_url":"https://api.github.com/repos/FichteForks/Packages/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FichteForks/Packages/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FichteForks/Packages/teams","hooks_url":"https://api.github.com/repos/FichteForks/Packages/hooks","issue_events_url":"https://api.github.com/repos/FichteForks/Packages/issues/events{/number}","events_url":"https://api.github.com/repos/FichteForks/Packages/events","assignees_url":"https://api.github.com/repos/FichteForks/Packages/assignees{/user}","branches_url":"https://api.github.com/repos/FichteForks/Packages/branches{/branch}","tags_url":"https://api.github.com/repos/FichteForks/Packages/tags","blobs_url":"https://api.github.com/repos/FichteForks/Packages/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FichteForks/Packages/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FichteForks/Packages/git/refs{/sha}","trees_url":"https://api.github.com/repos/FichteForks/Packages/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FichteForks/Packages/statuses/{sha}","languages_url":"https://api.github.com/repos/FichteForks/Packages/languages","stargazers_url":"https://api.github.com/repos/FichteForks/Packages/stargazers","contributors_url":"https://api.github.com/repos/FichteForks/Packages/contributors","subscribers_url":"https://api.github.com/repos/FichteForks/Packages/subscribers","subscription_url":"https://api.github.com/repos/FichteForks/Packages/subscription","commits_url":"https://api.github.com/repos/FichteForks/Packages/commits{/sha}","git_commits_url":"https://api.github.com/repos/FichteForks/Packages/git/commits{/sha}","comments_url":"https://api.github.com/repos/FichteForks/Packages/comments{/number}","issue_comment_url":"https://api.github.com/repos/FichteForks/Packages/issues/comments{/number}","contents_url":"https://api.github.com/repos/FichteForks/Packages/contents/{+path}","compare_url":"https://api.github.com/repos/FichteForks/Packages/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FichteForks/Packages/merges","archive_url":"https://api.github.com/repos/FichteForks/Packages/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FichteForks/Packages/downloads","issues_url":"https://api.github.com/repos/FichteForks/Packages/issues{/number}","pulls_url":"https://api.github.com/repos/FichteForks/Packages/pulls{/number}","milestones_url":"https://api.github.com/repos/FichteForks/Packages/milestones{/number}","notifications_url":"https://api.github.com/repos/FichteForks/Packages/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FichteForks/Packages/labels{/name}","releases_url":"https://api.github.com/repos/FichteForks/Packages/releases{/id}","deployments_url":"https://api.github.com/repos/FichteForks/Packages/deployments","created_at":"2015-06-17T14:00:13Z","updated_at":"2016-04-19T00:53:43Z","pushed_at":"2016-06-01T12:24:54Z","git_url":"git://github.com/FichteForks/Packages.git","ssh_url":"git@github.com:FichteForks/Packages.git","clone_url":"https://github.com/FichteForks/Packages.git","svn_url":"https://github.com/FichteForks/Packages","homepage":null,"size":2828,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sublimehq:master","ref":"master","sha":"d228c5c5e56bdf6056afb131a2e5df43e8810281","user":{"login":"sublimehq","id":1161584,"avatar_url":"https://avatars.githubusercontent.com/u/1161584?v=3","gravatar_id":"","url":"https://api.github.com/users/sublimehq","html_url":"https://github.com/sublimehq","followers_url":"https://api.github.com/users/sublimehq/followers","following_url":"https://api.github.com/users/sublimehq/following{/other_user}","gists_url":"https://api.github.com/users/sublimehq/gists{/gist_id}","starred_url":"https://api.github.com/users/sublimehq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sublimehq/subscriptions","organizations_url":"https://api.github.com/users/sublimehq/orgs","repos_url":"https://api.github.com/users/sublimehq/repos","events_url":"https://api.github.com/users/sublimehq/events{/privacy}","received_events_url":"https://api.github.com/users/sublimehq/received_events","type":"User","site_admin":false},"repo":{"id":37357499,"name":"Packages","full_name":"sublimehq/Packages","owner":{"login":"sublimehq","id":1161584,"avatar_url":"https://avatars.githubusercontent.com/u/1161584?v=3","gravatar_id":"","url":"https://api.github.com/users/sublimehq","html_url":"https://github.com/sublimehq","followers_url":"https://api.github.com/users/sublimehq/followers","following_url":"https://api.github.com/users/sublimehq/following{/other_user}","gists_url":"https://api.github.com/users/sublimehq/gists{/gist_id}","starred_url":"https://api.github.com/users/sublimehq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sublimehq/subscriptions","organizations_url":"https://api.github.com/users/sublimehq/orgs","repos_url":"https://api.github.com/users/sublimehq/repos","events_url":"https://api.github.com/users/sublimehq/events{/privacy}","received_events_url":"https://api.github.com/users/sublimehq/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sublimehq/Packages","description":"","fork":false,"url":"https://api.github.com/repos/sublimehq/Packages","forks_url":"https://api.github.com/repos/sublimehq/Packages/forks","keys_url":"https://api.github.com/repos/sublimehq/Packages/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sublimehq/Packages/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sublimehq/Packages/teams","hooks_url":"https://api.github.com/repos/sublimehq/Packages/hooks","issue_events_url":"https://api.github.com/repos/sublimehq/Packages/issues/events{/number}","events_url":"https://api.github.com/repos/sublimehq/Packages/events","assignees_url":"https://api.github.com/repos/sublimehq/Packages/assignees{/user}","branches_url":"https://api.github.com/repos/sublimehq/Packages/branches{/branch}","tags_url":"https://api.github.com/repos/sublimehq/Packages/tags","blobs_url":"https://api.github.com/repos/sublimehq/Packages/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sublimehq/Packages/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sublimehq/Packages/git/refs{/sha}","trees_url":"https://api.github.com/repos/sublimehq/Packages/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sublimehq/Packages/statuses/{sha}","languages_url":"https://api.github.com/repos/sublimehq/Packages/languages","stargazers_url":"https://api.github.com/repos/sublimehq/Packages/stargazers","contributors_url":"https://api.github.com/repos/sublimehq/Packages/contributors","subscribers_url":"https://api.github.com/repos/sublimehq/Packages/subscribers","subscription_url":"https://api.github.com/repos/sublimehq/Packages/subscription","commits_url":"https://api.github.com/repos/sublimehq/Packages/commits{/sha}","git_commits_url":"https://api.github.com/repos/sublimehq/Packages/git/commits{/sha}","comments_url":"https://api.github.com/repos/sublimehq/Packages/comments{/number}","issue_comment_url":"https://api.github.com/repos/sublimehq/Packages/issues/comments{/number}","contents_url":"https://api.github.com/repos/sublimehq/Packages/contents/{+path}","compare_url":"https://api.github.com/repos/sublimehq/Packages/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sublimehq/Packages/merges","archive_url":"https://api.github.com/repos/sublimehq/Packages/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sublimehq/Packages/downloads","issues_url":"https://api.github.com/repos/sublimehq/Packages/issues{/number}","pulls_url":"https://api.github.com/repos/sublimehq/Packages/pulls{/number}","milestones_url":"https://api.github.com/repos/sublimehq/Packages/milestones{/number}","notifications_url":"https://api.github.com/repos/sublimehq/Packages/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sublimehq/Packages/labels{/name}","releases_url":"https://api.github.com/repos/sublimehq/Packages/releases{/id}","deployments_url":"https://api.github.com/repos/sublimehq/Packages/deployments","created_at":"2015-06-13T04:17:44Z","updated_at":"2016-06-01T00:45:43Z","pushed_at":"2016-06-01T15:16:58Z","git_url":"git://github.com/sublimehq/Packages.git","ssh_url":"git@github.com:sublimehq/Packages.git","clone_url":"https://github.com/sublimehq/Packages.git","svn_url":"https://github.com/sublimehq/Packages","homepage":null,"size":3985,"stargazers_count":2455,"watchers_count":2455,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":237,"mirror_url":null,"open_issues_count":51,"forks":237,"open_issues":51,"watchers":2455,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sublimehq/Packages/pulls/386"},"html":{"href":"https://github.com/sublimehq/Packages/pull/386"},"issue":{"href":"https://api.github.com/repos/sublimehq/Packages/issues/386"},"comments":{"href":"https://api.github.com/repos/sublimehq/Packages/issues/386/comments"},"review_comments":{"href":"https://api.github.com/repos/sublimehq/Packages/pulls/386/comments"},"review_comment":{"href":"https://api.github.com/repos/sublimehq/Packages/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sublimehq/Packages/pulls/386/commits"},"statuses":{"href":"https://api.github.com/repos/sublimehq/Packages/statuses/b5a617e71f640038102b589ffba75571574d5ab9"}}}}
{"actor":{"display_login":"wbond"}}