Browse Source

Fixed highlighting of number literals starting with dot. (http://community.sharpdevelop.net/forums/t/11716.aspx)

C#: don't highlighting "@int" as keyword.
pull/1/head
Daniel Grunwald 16 years ago
parent
commit
a0032825a7
  1. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/Boo.xshd
  2. 15
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/CSharp-Mode.xshd
  3. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/V1Loader.cs

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/Boo.xshd

@ -192,7 +192,7 @@ @@ -192,7 +192,7 @@
<Word>of</Word>
</Keywords>
<Rule foreground="MidnightBlue">[\d\w_]+(?=(\s*\())</Rule>
<Rule foreground="DarkBlue">\b0[xX][0-9a-fA-F]+|\b(\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?</Rule>
<Rule foreground="DarkBlue">\b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?</Rule>
</RuleSet>
<RuleSet name="comments set">
<!-- allows nested /**/ comments, coloring them Green/Teal alternately -->

15
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Resources/CSharp-Mode.xshd

@ -102,8 +102,9 @@ @@ -102,8 +102,9 @@
</RuleSet>
</Span>
<Rule color="Punctuation">
[?,.;()\[\]{}+\-/%*&lt;&gt;^+~!|&amp;]+
<!-- don't highlight "@int" as keyword -->
<Rule>
@[\w\d_]+
</Rule>
<Keywords fontWeight="bold" foreground="Black">
@ -268,11 +269,15 @@ @@ -268,11 +269,15 @@
<!-- Digits -->
<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
|
( \b\d+(\.[0-9]+)? #number with optional floating point
| \.[0-9]+ #or just starting with floating point
)
([eE][+-]?[0-9]+)? # optional exponent
</Rule>
<Rule color="Punctuation">
[?,.;()\[\]{}+\-/%*&lt;&gt;^+~!|&amp;]+
</Rule>
</RuleSet>
</SyntaxDefinition>

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/Xshd/V1Loader.cs

@ -69,8 +69,8 @@ namespace ICSharpCode.AvalonEdit.Highlighting.Xshd @@ -69,8 +69,8 @@ namespace ICSharpCode.AvalonEdit.Highlighting.Xshd
ColorReference = GetColorReference(syntaxDefinition["Digits"]),
RegexType = XshdRegexType.IgnorePatternWhitespace,
Regex = @"\b0[xX][0-9a-fA-F]+"
+ @"|\b"
+ @"(\d+(" + floatingPoint + ")?"
+ @"|"
+ @"(\b\d+(" + floatingPoint + ")?"
+ @"|" + floatingPoint + ")"
+ optionalExponent
});

Loading…
Cancel
Save