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 @@
<Word>of</Word> <Word>of</Word>
</Keywords> </Keywords>
<Rule foreground="MidnightBlue">[\d\w_]+(?=(\s*\())</Rule> <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>
<RuleSet name="comments set"> <RuleSet name="comments set">
<!-- allows nested /**/ comments, coloring them Green/Teal alternately --> <!-- allows nested /**/ comments, coloring them Green/Teal alternately -->

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

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

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

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

Loading…
Cancel
Save