diff --git a/PseudoEditor/MainWindow.xaml.cs b/PseudoEditor/MainWindow.xaml.cs index a6f3971..3392dfc 100644 --- a/PseudoEditor/MainWindow.xaml.cs +++ b/PseudoEditor/MainWindow.xaml.cs @@ -13,6 +13,9 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using System.Xml; +using ICSharpCode.AvalonEdit.Highlighting; +using ICSharpCode.AvalonEdit.Highlighting.Xshd; using Microsoft.Win32; using Path = System.IO.Path; @@ -25,15 +28,19 @@ public partial class MainWindow : Window { private string _currentFileName; private const string ProgramName = "PseudoEditor"; + private const string HighlightingFile = "PseudoHighlight.xshd"; public MainWindow() { InitializeComponent(); - Editor.Focus(); - ShowLineColumn(); Editor.TextArea.Caret.PositionChanged += (sender, args) => ShowLineColumn(); + + Editor.SyntaxHighlighting = + HighlightingLoader.Load(XmlReader.Create(HighlightingFile), HighlightingManager.Instance); + + Editor.Focus(); } private void ShowLineColumn() diff --git a/PseudoEditor/PseudoEditor.csproj b/PseudoEditor/PseudoEditor.csproj index 2dc9731..9312d91 100644 --- a/PseudoEditor/PseudoEditor.csproj +++ b/PseudoEditor/PseudoEditor.csproj @@ -100,6 +100,9 @@ SettingsSingleFileGenerator Settings.Designer.cs + + Always + diff --git a/PseudoEditor/PseudoHighlight.xshd b/PseudoEditor/PseudoHighlight.xshd new file mode 100644 index 0000000..e017b2c --- /dev/null +++ b/PseudoEditor/PseudoHighlight.xshd @@ -0,0 +1,46 @@ + + + + + + + + + + + " + " + + + + + + + + daca + altfel + atunci + cat timp + pentru + executa + sfarsit + intreg + real + text + scrie + scrieln + citeste + + + + + \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 + + + \ No newline at end of file