Skip to content

Commit

Permalink
Merge pull request #377 from FrozenAssassine/add_python
Browse files Browse the repository at this point in the history
This adds python #233
  • Loading branch information
FrozenAssassine authored Apr 10, 2023
2 parents 3629279 + a8ca7ae commit af57874
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions TextControlBox/Languages/Languages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,24 @@ public XML()
};
}
}
internal class Python : CodeLanguage
{
public Python()
{
this.Name = "Python";
this.Author = "Julius Kirsch";
this.Filter = new string[1] { ".py" };
this.Description = "Syntax highlighting for Python language";
this.Highlights = new SyntaxHighlights[]
{
new SyntaxHighlights("\\b([+-]?(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*))(?:[eE]([+-]?\\d+))?\\b", "#dd00dd", "#ff00ff"),
new SyntaxHighlights("\\b(and|as|assert|break|class|continue|def|del|elif|else|except|False|finally|for|from|global|if|import|in|is|lambda|None|nonlocal|not|or|pass|raise|return|True|try|while|with|yield)\\b", "#aa00cc", "#cc00ff"),
new SyntaxHighlights("(?<!(def\\s))(?<=^|\\s|.)[a-zA-Z_][\\w_]*(?=\\()", "#cc9900", "#ffbb00"),
new SyntaxHighlights("\"[^\\n]*?\"", "#ff5500", "#00FF00"),
new SyntaxHighlights("'[^\\n]*?'", "#00CA00", "#00FF00"),
new SyntaxHighlights("\\#.*", "#888888", "#646464"),
new SyntaxHighlights("\\\"\"\"(.|[\\r\\n])*\\\"\"\"", "#888888", "#646464"),
};
}
}
}
1 change: 1 addition & 0 deletions TextControlBox/TextControlBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2685,6 +2685,7 @@ public ScrollBarPosition ScrollBarPosition
{ "Javascript", new Javascript() },
{ "Json", new Json() },
{ "PHP", new PHP() },
{ "Python", new Python() },
{ "QSharp", new QSharp() },
{ "XML", new XML() },
};
Expand Down

0 comments on commit af57874

Please sign in to comment.