diff --git a/grammars/rainmeter.cson b/grammars/rainmeter.cson index 16a9195..1e6e2b9 100644 --- a/grammars/rainmeter.cson +++ b/grammars/rainmeter.cson @@ -41,13 +41,21 @@ patterns: [ {include: '#bangs'} {include: '#math'} ]} - {begin: '(?i)^\\s*((Transition)?Update|DefaultUpdateDivider|AccurateText|DynamicWindowSize|Skin(Width|Height)|DragMargins|ToolTipHidden|Group|Image(Crop|Tint|Alpha|Flip|Rotate)|Greyscale|UseExifOrientation|ColorMatrix[1-5]|Background(Mode|Margins)?|SolidColor2?|GradientAngle|BevelType|(?!(ContextTitle|BlurRegion)1\\s*=)(ContextTitle|BlurRegion)\\d*|Blur|ToolTipHidden)\\s*=' + {begin: '(?i)^\\s*((Transition)?Update|DefaultUpdateDivider|AccurateText|DynamicWindowSize|Skin(Width|Height)|DragMargins|ToolTipHidden|Image(Crop|Tint|Alpha|Flip|Rotate)|Greyscale|UseExifOrientation|ColorMatrix[1-5]|Background(Mode|Margins)?|SolidColor2?|GradientAngle|BevelType|(?!BlurRegion1)BlurRegion\\d*|Blur)\\s*=' beginCaptures: {1: {name: 'option.rainmeter'}} end: '$' patterns: [ {include: '#variables'} {include: '#math'} ]} + {begin: '(?i)^\\s*(Group|(?!ContextTitle1)ContextTitle\\d*)\\s*=' + beginCaptures: {1: {name: 'option.rainmeter'}} + end: '$' + patterns: [ + {include: '#variables'} + {match: '[^\\n\"#\\[\\]]+' + name: 'string.rainmeter'} + ]} ]} # Metadata section @@ -60,12 +68,16 @@ patterns: [ beginCaptures: {1: {name: 'option.rainmeter'}} end: '$' patterns: [ + {match: '\\d' + name: 'constant.numeric.rainmeter'} + {match: '[^\\d\\n\"#\\[\\]]+' + name: 'string.rainmeter'} {include: '#variables'} ]} ]} # Meters and Measures - {begin: '(?i)^\\s*(\\[(?!Rainmeter|Variables|Metadata)[\\w\\d_]+\\])\\s*$' + {begin: '(?i)^\\s*(\\[(?!Rainmeter|Variables|Metadata)\\w+\\])\\s*$' beginCaptures: {1: {name: 'section.rainmeter'}} end: '(?=^\\s*\\[)' patterns: [ @@ -150,7 +162,7 @@ patterns: [ {include: '#math'} ]} # All other options - {begin: '(?i)^\\s*(MeterStyle|(?!MeasureName1)MeasureName\\d*|BevelType|AntiAlias|DynamicVariables|Group|Greyscale|(Mask)?Image(Path|Flip|Name)|UseExifOrientation|ColorMatrixN|ToolTip(Text|Title|Icon|Type|Hidden)|BarImage|BarOrientation|Flip|Bitmap(Image|ZeroFrame|Extend)|ButtonImage|Autoscale|Graph(Start|Orientation)|(Primary|Secondary|Both)Image(Path|Flip)?|PreserveAspectRatio|Tile|HorizontalLines|GraphStart|GraphOrientation|ControlAngle|(Pre|Post)fix|FontFace|String(Align|Style|Case|Effect)|ClipString|Percentual|(?!InlineSetting1|InlinePattern1)Inline(Setting|Pattern)\\d*|Disabled|Paused|IfConditionMode|IfMatchMode|Substitute|RegExpSubstitute|(Update|Unique)Random|Processor|Drive|Total|Label|Type|IgnoreRemovable|DiskQuota|Interface|Cumulative|Reg(H?Key|Value)|ScriptFile|String|TimeStamp|DaylightSavingTime|AddDaysToHours)\\s*=' + {begin: '(?i)^\\s*(MeterStyle|(?!MeasureName1)MeasureName\\d*|BevelType|AntiAlias|DynamicVariables|Greyscale|(Mask)?Image(Path|Flip|Name)|UseExifOrientation|ColorMatrixN|ToolTip(Text|Icon|Type|Hidden)|BarImage|BarOrientation|Flip|Bitmap(Image|ZeroFrame|Extend)|ButtonImage|Autoscale|Graph(Start|Orientation)|(Primary|Secondary|Both)Image(Path|Flip)?|PreserveAspectRatio|Tile|HorizontalLines|GraphStart|GraphOrientation|ControlAngle|String(Align|Style|Case|Effect)|ClipString|Percentual|(?!InlineSetting1)Inline(Setting)\\d*|Disabled|Paused|IfConditionMode|IfMatchMode|Substitute|RegExpSubstitute|(Update|Unique)Random|Processor|Drive|Total|Label|Type|IgnoreRemovable|DiskQuota|Interface|Cumulative|Reg(HKey|Value)|ScriptFile|TimeStamp|DaylightSavingTime|AddDaysToHours)\\s*=' beginCaptures: {1: {name: 'option.rainmeter'}} end: '$' patterns: [ @@ -189,6 +201,8 @@ patterns: [ patterns: [ {match: '%([aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%]|#?[cdHIjmMSUwWxyY]|E?[cCxXyY]|O?[deHImMSuUVwWy])' name: 'support.function.constant.rainmeter'} + {match: '.' + name: 'string.rainmeter'} {include: '#variables'} ]} # Formula @@ -202,13 +216,23 @@ patterns: [ {include: '#math'} ]} # Text - {begin: '(?i)^\\s*(Text)\\s*=' + {begin: '(?i)^\\s*((ToolTip)?Text)\\s*=' beginCaptures: {1: {name: 'option.rainmeter'}} end: '$' patterns: [ {match: '%\\d' name: 'support.function.constant.rainmeter'} + {match: '[^\\n\"#\\[\\]%]+' + name: 'string.rainmeter'} + {include: '#variables'} + ]} + {begin: '(?i)^\\s*(Group|ToolTipTitle|(Pre|Post)fix|FontFace|(?!InlinePattern1)InlinePattern\\d*|Substitute|RegKey|String)\\s*=' + beginCaptures: {1: {name: 'option.rainmeter'}} + end: '$' + patterns: [ {include: '#variables'} + {match: '[^\\n\"#\\[\\]]+' + name: 'string.rainmeter'} ]} ]} ] @@ -239,7 +263,7 @@ repository: # Section variables and their arguments sectionVars: - match: '(\\[[\\w\\d_]+)(:(|(?i)X|Y|W|H|EscapeRegExp|EncodeURL|Timestamp|(Min|Max)Value|(\\/[+-]?\\d+|%)(,\\d+,?)?|\\d+))?(\\])' + match: '(\\[\\w+)(:(|(?i)X|Y|W|H|EscapeRegExp|EncodeURL|Timestamp|(Min|Max)Value|(\\/[+-]?\\d+|%)(,\\d+,?)?|\\d+))?(\\])' captures: 1: {name: 'section.variable.rainmeter'} 2: {name: 'section.variable.arg.rainmeter'} @@ -262,7 +286,7 @@ repository: # All other - normal variables normalVars: - match: '(?!#\\*.+?\\*#)#[\\w\\d_]+#' + match: '(?!#\\*.+?\\*#)#\\w+#' name: 'variable.rainmeter' # All the variables combined diff --git a/styles/rainmeter.atom-text-editor.less b/styles/rainmeter.atom-text-editor.less index d92ac9d..d17315c 100644 --- a/styles/rainmeter.atom-text-editor.less +++ b/styles/rainmeter.atom-text-editor.less @@ -21,6 +21,7 @@ .section.variable{ color: @syntax-color-snippet; + background-color: rgba(red(@syntax-color-snippet), green(@syntax-color-snippet), blue(@syntax-color-snippet), 0.1); } .section.variable.arg{ @@ -60,7 +61,7 @@ } .value.constant{ - color: @syntax-color-constant; + color: @syntax-color-class; } .value.constant.important{