Adding python definition
This commit is contained in:
Родитель
ec275663b0
Коммит
1eed474d29
|
@ -279,12 +279,12 @@ namespace ICSharpCode.AvalonEdit.Folding
|
|||
// auto-close #regions only when opening the document
|
||||
if (isFirstUpdate) {
|
||||
section.IsFolded = newFolding.DefaultClosed;
|
||||
isFirstUpdate = false;
|
||||
}
|
||||
section.Tag = newFolding;
|
||||
}
|
||||
section.Title = newFolding.Name;
|
||||
}
|
||||
isFirstUpdate = false;
|
||||
// remove all outstanding old foldings:
|
||||
while (oldFoldingIndex < oldFoldings.Length) {
|
||||
FoldingSection oldSection = oldFoldings[oldFoldingIndex++];
|
||||
|
|
|
@ -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("PowerShell", new[] { ".ps1", ".psm1", ".psd1" }, "PowerShell.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("VB", new[] { ".vb" }, "VB-Mode.xshd");
|
||||
hlm.RegisterHighlighting("XML", (".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;" +
|
||||
|
|
|
@ -418,6 +418,7 @@
|
|||
<EmbeddedResource Include="Highlighting\Resources\JavaScript-Mode.xshd" />
|
||||
<EmbeddedResource Include="Highlighting\Resources\Patch-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\VB-Mode.xshd" />
|
||||
<EmbeddedResource Include="Highlighting\Resources\XML-Mode.xshd" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче