Skip to content

Commit

Permalink
Fix JSON highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
ltrzesniewski committed Dec 18, 2023
1 parent 30cad99 commit 4689cf6
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions ICSharpCode.AvalonEdit/Highlighting/Resources/Json.xshd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Color name="Punctuation" foreground="Black" />

<RuleSet name="String">
<Span begin="\\" end="."/>
<Span begin="\\" end="." />
</RuleSet>

<RuleSet name="Object">
Expand All @@ -22,27 +22,28 @@
<Begin>'</Begin>
<End>'</End>
</Span>
<Span color="Punctuation" ruleSet="Expression">
<Span color="Punctuation" ruleSet="Expression" multiline="true">
<Begin>:</Begin>
<End>(?= [,}] )</End>
</Span>
<Span color="Punctuation">
<Begin>,</Begin>
</Span>
<Rule color="Punctuation">
,
</Rule>
</RuleSet>

<RuleSet name="Array">
<Import ruleSet="Expression"/>
<Span color="Punctuation">
<Begin>,</Begin>
</Span>
<Import ruleSet="Expression" />
<Rule color="Punctuation">
,
</Rule>
</RuleSet>

<RuleSet name="Expression">
<Keywords color="Bool" >
<Keywords color="Bool">
<Word>true</Word>
<Word>false</Word>
</Keywords>
<Keywords color="Null" >
<Keywords color="Null">
<Word>null</Word>
</Keywords>
<Span color="String" ruleSet="String">
Expand All @@ -62,11 +63,22 @@
<End>\]</End>
</Span>
<Rule color="Number">
\b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?
-? \b
(?:
0[xX][0-9a-fA-F]+
|
(?:

[0-9]+ (?: \. [0-9]+ )?
|
\. [0-9]+
)
(?: [eE] [+-]? [0-9]+ )?
)
</Rule>
</RuleSet>

<RuleSet>
<Import ruleSet="Expression"/>
<Import ruleSet="Expression" />
</RuleSet>
</SyntaxDefinition>
</SyntaxDefinition>

0 comments on commit 4689cf6

Please sign in to comment.