Merge pull request #114 from heldersepu/python_definition

Adding python definition
This commit is contained in:
Daniel Grunwald 2017-10-15 09:19:53 +02:00 коммит произвёл GitHub
Родитель 56fead7dd6 f7e9f07a4e
Коммит a872b2b9cc
3 изменённых файлов: 106 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,104 @@
<?xml version="1.0"?>
<SyntaxDefinition name="Python" extensions=".py;.pyw" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="Comment" foreground="Green" exampleText="# comment" />
<Color name="String" foreground="Gray" exampleText="name = 'abc'"/>
<Color name="MethodCall" foreground="Purple" exampleText="def Hello()"/>
<Color name="NumberLiteral" foreground="DarkBlue" exampleText="3.1415f"/>
<Color name="Keywords" fontWeight="bold" foreground="Blue" exampleText="if"/>
<Property name="DocCommentMarker" value="///" />
<RuleSet name="CommentMarkerSet">
<Keywords fontWeight="bold" foreground="Red">
<Word>TODO</Word>
<Word>FIXME</Word>
</Keywords>
<Keywords fontWeight="bold" foreground="#E0E000">
<Word>HACK</Word>
<Word>UNDONE</Word>
</Keywords>
</RuleSet>
<RuleSet>
<Span color="Comment" ruleSet="CommentMarkerSet">
<Begin>\#</Begin>
</Span>
<Span color="String" multiline="true">
<Begin>'''</Begin>
<End>'''</End>
</Span>
<Span color="String" multiline="true">
<Begin>"""</Begin>
<End>"""</End>
</Span>
<Span color="String">
<Begin>"</Begin>
<End>"</End>
<RuleSet>
<Span begin="\\" end="."/>
</RuleSet>
</Span>
<Span color="String">
<Begin>'</Begin>
<End>'</End>
<RuleSet>
<Span begin="\\" end="."/>
</RuleSet>
</Span>
<Keywords color="Keywords">
<Word>and</Word>
<Word>as</Word>
<Word>assert</Word>
<Word>break</Word>
<Word>class</Word>
<Word>continue</Word>
<Word>def</Word>
<Word>del</Word>
<Word>elif</Word>
<Word>else</Word>
<Word>except</Word>
<Word>exec</Word>
<Word>False</Word>
<Word>finally</Word>
<Word>for</Word>
<Word>from</Word>
<Word>global</Word>
<Word>if</Word>
<Word>import</Word>
<Word>in</Word>
<Word>is</Word>
<Word>lambda</Word>
<Word>None</Word>
<Word>nonlocal</Word>
<Word>not</Word>
<Word>or</Word>
<Word>pass</Word>
<Word>print</Word>
<Word>raise</Word>
<Word>return</Word>
<Word>True</Word>
<Word>try</Word>
<Word>while</Word>
<Word>with</Word>
<Word>yield</Word>
<Word>async</Word>
<Word>await</Word>
</Keywords>
<Rule color="MethodCall">
\b
[\d\w_]+ # an identifier
(?=\s*\() # followed by (
</Rule>
<Rule color="NumberLiteral">
\b0[xX][0-9a-fA-F]+ # hex number
( \b\d+(\.[0-9]+)? #number with optional floating point
| \.[0-9]+ #or just starting with floating point
)
([eE][+-]?[0-9]+)? # optional exponent
</Rule>
</RuleSet>
</SyntaxDefinition>

Просмотреть файл

@ -50,6 +50,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting
hlm.RegisterHighlighting("Patch", new[] { ".patch", ".diff" }, "Patch-Mode.xshd"); hlm.RegisterHighlighting("Patch", new[] { ".patch", ".diff" }, "Patch-Mode.xshd");
hlm.RegisterHighlighting("PowerShell", new[] { ".ps1", ".psm1", ".psd1" }, "PowerShell.xshd"); hlm.RegisterHighlighting("PowerShell", new[] { ".ps1", ".psm1", ".psd1" }, "PowerShell.xshd");
hlm.RegisterHighlighting("PHP", new[] { ".php" }, "PHP-Mode.xshd"); hlm.RegisterHighlighting("PHP", new[] { ".php" }, "PHP-Mode.xshd");
hlm.RegisterHighlighting("Python", new[] { ".py", ".pyw" }, "Python-Mode.xshd");
hlm.RegisterHighlighting("TeX", new[] { ".tex" }, "Tex-Mode.xshd"); hlm.RegisterHighlighting("TeX", new[] { ".tex" }, "Tex-Mode.xshd");
hlm.RegisterHighlighting("TSQL", new[] { ".sql" }, "TSQL-Mode.xshd"); hlm.RegisterHighlighting("TSQL", new[] { ".sql" }, "TSQL-Mode.xshd");
hlm.RegisterHighlighting("VB", new[] { ".vb" }, "VB-Mode.xshd"); hlm.RegisterHighlighting("VB", new[] { ".vb" }, "VB-Mode.xshd");

Просмотреть файл

@ -419,6 +419,7 @@
<EmbeddedResource Include="Highlighting\Resources\JavaScript-Mode.xshd" /> <EmbeddedResource Include="Highlighting\Resources\JavaScript-Mode.xshd" />
<EmbeddedResource Include="Highlighting\Resources\Patch-Mode.xshd" /> <EmbeddedResource Include="Highlighting\Resources\Patch-Mode.xshd" />
<EmbeddedResource Include="Highlighting\Resources\PHP-Mode.xshd" /> <EmbeddedResource Include="Highlighting\Resources\PHP-Mode.xshd" />
<EmbeddedResource Include="Highlighting\Resources\Python-Mode.xshd" />
<EmbeddedResource Include="Highlighting\Resources\Tex-Mode.xshd" /> <EmbeddedResource Include="Highlighting\Resources\Tex-Mode.xshd" />
<EmbeddedResource Include="Highlighting\Resources\VB-Mode.xshd" /> <EmbeddedResource Include="Highlighting\Resources\VB-Mode.xshd" />
<EmbeddedResource Include="Highlighting\Resources\XML-Mode.xshd" /> <EmbeddedResource Include="Highlighting\Resources\XML-Mode.xshd" />