|
| 1 | +######################################## |
| 2 | +## Header |
| 3 | +######################################## |
| 4 | + |
| 5 | +name = meml |
| 6 | +file_extensions [] = meml; |
| 7 | + |
| 8 | +######################################## |
| 9 | +## Styles |
| 10 | +######################################## |
| 11 | + |
| 12 | +styles[] { |
| 13 | + .comment : style { |
| 14 | + color = #546E7A |
| 15 | + textmate_scope = comment |
| 16 | + pygments_scope = Comment |
| 17 | + } |
| 18 | + |
| 19 | + .keyword : style { |
| 20 | + color = #89DDFF |
| 21 | + textmate_scope = keyword |
| 22 | + pygments_scope = Keyword |
| 23 | + } |
| 24 | + |
| 25 | + .declaration : style { |
| 26 | + color = #89DDFF |
| 27 | + textmate_scope = punctuation.definition |
| 28 | + pygments_scope = Keyword.Declaration |
| 29 | + } |
| 30 | + |
| 31 | + .delcaration_identifier : style { |
| 32 | + color = #f07178 |
| 33 | + textmate_scope = variable.other.constant |
| 34 | + } |
| 35 | + |
| 36 | + .tag_identifier : style { |
| 37 | + color = #f07178 |
| 38 | + textmate_scope = entity.name.tag |
| 39 | + } |
| 40 | + |
| 41 | + .string : style { |
| 42 | + color = #C3E88D |
| 43 | + textmate_scope = string |
| 44 | + pygments_scope = String |
| 45 | + } |
| 46 | + |
| 47 | + .variable : style { |
| 48 | + color = #CCFFFF |
| 49 | + textmate_scope = variable |
| 50 | + } |
| 51 | + |
| 52 | + .punctuation : style { |
| 53 | + color = #89DDFF |
| 54 | + textmate_scope = punctuation |
| 55 | + pygments_scope = Punctuation |
| 56 | + } |
| 57 | + |
| 58 | + .punctuation_tag : style { |
| 59 | + color = #89DDFF |
| 60 | + textmate_scope = punctuation.definition.tag |
| 61 | + pygments_scope = Punctuation |
| 62 | + } |
| 63 | + |
| 64 | + .punctuation_string : style { |
| 65 | + color = #C3E88D |
| 66 | + textmate_scope = punctuation.definition.string |
| 67 | + pygments_scope = String.Double |
| 68 | + } |
| 69 | +} |
| 70 | + |
| 71 | +######################################## |
| 72 | +## Contexts |
| 73 | +######################################## |
| 74 | + |
| 75 | +contexts[] { |
| 76 | + main : context { |
| 77 | + # Keyword pattern |
| 78 | + : pattern { |
| 79 | + regex \= (import|from|export) |
| 80 | + styles[] = .keyword; |
| 81 | + } |
| 82 | + |
| 83 | + # Declaration pattern |
| 84 | + : pattern { |
| 85 | + regex \= (component) |
| 86 | + styles[] = .declaration; |
| 87 | + } |
| 88 | + |
| 89 | + # Tag identifier |
| 90 | + : pattern { |
| 91 | + regex \= ((?<=\(\s*)\w*(?=.*)) |
| 92 | + styles[] = .tag_identifier; |
| 93 | + } |
| 94 | + |
| 95 | + # Component keyword |
| 96 | + : pattern { |
| 97 | + regex \= ((?<=\(component\ )\w*) |
| 98 | + styles[] = .delcaration_identifier; |
| 99 | + } |
| 100 | + |
| 101 | + # Destructures |
| 102 | + : pattern { |
| 103 | + regex \= ((?<=\()\w*(, \w*)*(?=\))) |
| 104 | + styles[] = .delcaration_identifier; |
| 105 | + } |
| 106 | + |
| 107 | + # General punctuation |
| 108 | + : pattern { |
| 109 | + regex \= (\+|-|(?<!/)(/)(?!/)|\*|=) |
| 110 | + styles[] = .punctuation; |
| 111 | + } |
| 112 | + |
| 113 | + # Tag punctuation |
| 114 | + : pattern { |
| 115 | + regex \= (\(|\)) |
| 116 | + styles[] = .punctuation_tag; |
| 117 | + } |
| 118 | + |
| 119 | + # Tag properties |
| 120 | + : pattern { |
| 121 | + regex \= ((\w*)(?==)) |
| 122 | + styles[] = .variable; |
| 123 | + } |
| 124 | + |
| 125 | + # Comments |
| 126 | + : pattern { |
| 127 | + regex \= (//.*) |
| 128 | + styles[] = .comment; |
| 129 | + } |
| 130 | + |
| 131 | + # String (Double quotes) |
| 132 | + : inline_push { |
| 133 | + regex \= (") |
| 134 | + styles[] = .punctuation_string; |
| 135 | + default_style = .string |
| 136 | + : pop { |
| 137 | + regex \= (") |
| 138 | + styles[] = .punctuation_string; |
| 139 | + } |
| 140 | + } |
| 141 | + |
| 142 | + # String (Single quotes) |
| 143 | + : inline_push { |
| 144 | + regex \= (') |
| 145 | + styles[] = .punctuation_string; |
| 146 | + default_style = .string |
| 147 | + : pop { |
| 148 | + regex \= (') |
| 149 | + styles[] = .punctuation_string; |
| 150 | + } |
| 151 | + } |
| 152 | + } |
| 153 | +} |
0 commit comments