Skip to content
This repository was archived by the owner on Feb 20, 2022. It is now read-only.

Commit fb03277

Browse files
committed
MIT => GPL, full repo restructure & code refactor => modular languages
1 parent a3167f4 commit fb03277

29 files changed

Lines changed: 3114 additions & 2278 deletions

.gitignore

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
*.pyc
21
*.DS_Store
2+
*.pyc
3+
*.pyo
4+
*.sublime-workspace
5+
*.sublime-project
6+
*.idraw
7+
38
__old__.json
49
__old__.xml
5-
*.pyo
610

7-
*.idraw
11+
.ccom_cache
12+
.clic_cache
13+
.cdoc_cache
14+
15+
.ccom_todo
16+
.cdoc_toc
17+
18+
build
19+
readme.html

Gloom/LICENSE

Lines changed: 0 additions & 20 deletions
This file was deleted.

INFO

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#format CENTER 80
2+
3+
Python and Cython Syntax Highlighters
4+
=====================================
5+
6+
Version: {VERSION}
7+
File: {FILE}
8+
9+
For more information about the project, please visit
10+
<https://github.com/petervaro/python>.
11+
Copyright (C) 2013 - 2014 Peter Varo
12+
13+
This program is free software: you can redistribute it and/or modify it
14+
under the terms of the GNU General Public License as published by the
15+
Free Software Foundation, either version 3 of the License, or
16+
(at your option) any later version.
17+
18+
This program is distributed in the hope that it will be useful, but
19+
WITHOUT ANY WARRANTY; without even the implied warranty of
20+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21+
See the GNU General Public License for more details.
22+
23+
You should have received a copy of the GNU General Public License
24+
along with this program, most likely a file in the root directory,
25+
called 'LICENSE'. If not, see <http://www.gnu.org/licenses>.

LICENSE

Lines changed: 621 additions & 20 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 95 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,99 @@
11
# Python and Cython language bundles
22

3-
This repo is about Python 3.3+ and Cython 0.19.1+ related bundles for Sublime
3+
***THE MOST POPULAR (AND FEATURE RICH) PYTHON SYNTAX HIGHLIGHTER FOR SUBLIME
4+
(OVER 11,000 DOWNLOADS!)***
5+
6+
This repo is about python 3.3+ and cython 0.19.1+ related bundles for Sublime
47
Text 2/3 and TextMate editors and for online usage.
58

6-
![Preview](preview.png)
9+
![Preview](img/preview.png)
710

811
### Python 3.3
912

1013
Python 3.3 is a truly powerful version of python, with a lot new and creative
1114
features -- and some of them are actually bringing new or different syntaxes!
12-
Sadly, the only available `tmLanguage` and still popular syntax-highlight
13-
definition file is pretty old (only supports 2.x) and has some annoying bugs --
14-
and because of that, the syntax of these new features brake the full highlighting
15-
of the code, not to mention the lack of new built-in keywords and notations and
16-
extra unused one.
17-
18-
I do belive, that a good syntax highlighter for software developers has to be as
19-
much help as an auto-complete popup or a code linter script in a text editor.
20-
21-
That's why I implemented a new syntax definition, started from scratch and
22-
created especially for Python 3.3 and above. I did this with a python
23-
dictionary plus a little converter script and not in `JSON` (ugly double escape
24-
characters -- *Ouch!*) nor in `XML`/`tmLanguage` (com'n is there anyone, who
25-
likes to read-and-write these?). The result is a dynamic, reuseable, easy to read
26-
and write (syntax highlighted regexes -- with comments and variables!) and
27-
maintain and pretty short (old: 3331 lines, new: 1226 lines) syntax definition file!
15+
Unfortunately, the only available and default `tmLanguage` syntax-highlight
16+
definition file is pretty old (only supports 2.x) and has several annoying bugs
17+
and unfinished features -- not to mention, that the syntax of the new python
18+
features brake the full highlighting of the entire code.
19+
20+
I belive, that a good syntax highlighter for software developers has to be as
21+
much help as the auto-completion pop-up or a code linter script in a text
22+
editor.
23+
24+
That's why I have implemented a new syntax definition from scratch that is
25+
created especially for python 3.3 and above. I did this with a python
26+
structures, converters and buiuld scripts. *(I found editing `JSON` files with
27+
their ugly double escape characters or editing `XML`/`tmLanguage`s directly
28+
pretty annoying.)*
29+
30+
The end result is very flexible, dynamic, reuseable and easy to read and write
31+
(syntax highlighted regexes -- with comments and variables). It is also simple
32+
to maintain and pretty short too (the new version is only 35% of the old one)!
2833

2934
### Cython support
3035

31-
Unfortunately cython syntax highlighter definitions are also lack of updated,
32-
fully working and 100% python compatible syntax definitions! I created a brand
33-
new highlighter from scartch, based on the new Python one, but one of the future
34-
plans is to make this dictionary an addition/extended version of it, so the
35-
changes will automatically updated in both language files.
36+
Unfortunately cython syntax highlighter definitions also lack of updated,
37+
fully-working and 100% python compatible syntax definitions! I have created a
38+
brand-new build-system to combine and convert the highlighter based on the
39+
python one. With this tool, it is quite easy to keep up-to-date both the cython
40+
and the python definitions, and as a plus, I only have to maintain a single
41+
code-base. *Viva la* modularity!
3642

3743
### Highlight on web
3844

3945
***WORK IN PROGRESS***
4046

41-
After used to the syntax highlight in the text editor, sharing the code online
42-
with the same colors and highlights is evident! Thanks to Craig Campbell and his
43-
amazing [`Rainbow.js`](http://craig.is/making/rainbows/) it is also possible!
47+
Previously I wanted to support [`Rainbow.js`](http://craig.is/making/rainbows),
48+
but unfortunately this project hasn't been updated for almost a year now, it
49+
also has several very important, pending, open issues and without these the
50+
proper "translation" from my syntax highlighters to a Rainbow one is impossible.
51+
52+
Thankfully, there is a new, and very actively developed tool, called the
53+
[Ace Editor](http://ace.c9.io). I'm willing to support them, as they are
54+
providing a more feature rich syntax highlighter system, they call it
55+
`Ace Mode`. *(Further more, it is very similar to the `tmLanguage` system, and
56+
they also provide a tool for automatic `Mode` generation from `tmLanguage`,
57+
which is not perfect of course, as they claimed, but still better than
58+
nothing!)*
4459

45-
*At the moment a few features are missing from Rainbow.js to make it as powerful
46-
and complete as the tmLanguage files.. so I wait now :)*
60+
> The old, Rainbow-compatible version is still available:
61+
`etc/archive/js/Python.js`, but as before, it is still work-in-progress state,
62+
and it is very unlikely that I will finish it and/or support it in the future.
4763

4864
### New is better
4965

50-
Below some of the improvements:
51-
52-
- Added better number highlight:
53-
- all types of floating point notations are working now
54-
- all types of complex number notations are working now
55-
- new types of binary and octal number notations are supported
56-
- long integer is removed
57-
- The `...` syntax notation of `Ellipsis` is supported now
58-
- Declaration rules are extended with `nonlocal`
59-
- Ex-statements-now-functions (like `print`) are updated
60-
- New exceptions added
61-
- Function annotations are supported
62-
- Language variable `cls` added
63-
- Better regex support (multiline, grouping, comments and more are improved)
66+
Below are some of the most important improvements:
67+
68+
- Added better number highlighting:
69+
- All types of floating point notations are working now;
70+
- All types of complex number notations are working now;
71+
- New types of binary and octal-number notations are supported;
72+
- Long integer is removed.
73+
- The `...` syntax notation of `Ellipsis` is supported now.
74+
- Declaration rules are extended with `nonlocal`.
75+
- *Ex-statements-now-functions* (like `print`) are updated.
76+
- New Exception highlighting added.
77+
- Function annotations are now supported.
78+
- Conventional-language variable `cls` added.
79+
- Better regex support (multiline, grouping, comments and more are improved).
6480
- String and byte literals:
65-
- Byte notation added
66-
- Proper string prefixes added
67-
- All the unused built-in and magic functions/methods are removed
68-
- All the unused keywords and notations are removed
81+
- Byte notation added;
82+
- Proper string prefixes added.
83+
- All the unused built-in and magic functions/methods are now removed.
84+
- All the unused keywords and notations are now removed.
6985

7086
### Future plans
7187

72-
- Support format mini-language in strings
73-
- Create a better Twilight-based theme file
88+
- Support format mini-language in strings.
89+
- Create a better Twilight-based theme file.
7490

7591
### Installation
7692

7793
***Via Package Control***
7894

79-
The fastest and easiest way to install theses packages to Sublime Text is the
80-
follow:
95+
The fastest and easiest way to install these packages for Sublime Text is the
96+
following:
8197

8298
1. Install [Package Control](https://sublime.wbond.net/installation)
8399
2. Open `Tools``Command Palette`
@@ -87,18 +103,18 @@ follow:
87103

88104
***Set as default***
89105

90-
After you installed the language definition file successfully, all you have to do is
91-
assign the `.py` files to always open with this syntax highlighter. Go to
106+
After you installed the language definition file successfully, all you have to
107+
do is assign the `.py` files to always open with this syntax highlighter. Go to
92108

93109
`View``Syntax``Open all with current extension as...``Python 3`
94110

95111
To remove this setting, you can always overwrite this preference.
96112

97113
***Manual installation***
98114

99-
Download the tmLanguage files from the Python and Cython branches of this repository.
100-
Navigate to your `Packages` folder and create a `Python3` and/or a `Cython` folder(s)
101-
and copy the tmLanguage and sublime-build files into.
115+
Download the `tmLanguage` files from the python and Cython branches of this
116+
repository. Navigate to your `Packages` folder and create a `Python3` and/or a
117+
`Cython` folder(s) and copy the `tmLanguage` and sublime-build files into.
102118

103119
***Theme file***
104120

@@ -108,42 +124,38 @@ your old color theme to the new one.*
108124

109125
### Contribute
110126

111-
Any help is appreciated and more than welcome -- my goal is to make the
112-
*'de facto'* language bundle for Python 3. If you want to submit a change,
127+
Any help is appreciated and more than welcome -- my goal is to make this the
128+
*'de facto'* language bundle for python 3. If you want to submit a change,
113129
please use the following conventions when editing the original python files:
114130

115-
- variables uses `underscore_separated_names`,
116-
- all files uses 4 spaces for indentation,
117-
- `=` and `:` operators are aligned if length of variable names are similar
118-
- `(`, `[` and `{` start a new line, if possible and reasonable
119-
- each line tries to fit in the width 80 columns
120-
- comment separators can be easily generated with the `str_to_separator()`
131+
- variables uses `underscore_separated_names`;
132+
- all files uses 4 spaces for indentation;
133+
- `=` and `:` operators are aligned if length of variable names are similar;
134+
- `(`, `[` and `{` start a new line, if possible and reasonable;
135+
- each line must fit in the width 80 columns (code, text, etc.);
136+
- comment separators can be easily generated with the `src.utils.separator()`
121137
function
122138

123139
### Appreciation
124140

125-
*Thank you very much Jon Clements for all the support and answers about Python
126-
and regexes in general and of course thanks for all the wonderful members of the [**so**python](http://sopython.com) chat room! May the Cabbage be with us ;)*
127-
128-
### MIT LICENSE
141+
*Thank you very much Jon Clements for all the support and answers about python
142+
and regexes in general, Kevin, Ffisegydd, Zero Piraeus and Poke for the support,
143+
and of course thanks for all the wonderful members of the
144+
[sopython](http://sopython.com) chat room! May the Cabbage be with us ;)*
129145

130-
The MIT License (MIT)
146+
### LICENSE
131147

132-
Copyright (c) 2013-2014 Peter Varo
148+
Copyright (C) 2013 - 2014 Peter Varo
133149

134-
Permission is hereby granted, free of charge, to any person obtaining a copy of
135-
this software and associated documentation files (the "Software"), to deal in
136-
the Software without restriction, including without limitation the rights to
137-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
138-
the Software, and to permit persons to whom the Software is furnished to do so,
139-
subject to the following conditions:
150+
This program is free software: you can redistribute it and/or modify it under
151+
the terms of the GNU General Public License as published by the Free Software
152+
Foundation, either version 3 of the License, or (at your option) any later
153+
version.
140154

141-
The above copyright notice and this permission notice shall be included in all
142-
copies or substantial portions of the Software.
155+
This program is distributed in the hope that it will be useful, but WITHOUT ANY
156+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
157+
PARTICULAR PURPOSE. See the GNU General Public License for more details.
143158

144-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
145-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
146-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
147-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
148-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
149-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
159+
You should have received a copy of the GNU General Public License along with
160+
this program, most likely a file in the root directory, called 'LICENSE'. If
161+
not, see http://www.gnu.org/licenses.

0 commit comments

Comments
 (0)