textpow 0.10.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/.travis.yml +7 -0
  2. data/Gemfile +10 -0
  3. data/Gemfile.lock +30 -0
  4. data/{History.txt → History.rdoc} +10 -0
  5. data/{README.txt → MIT-LICENSE.txt} +0 -30
  6. data/README.rdoc +82 -0
  7. data/Rakefile +42 -49
  8. data/bin/plist2syntax +0 -0
  9. data/bin/plist2yaml +0 -0
  10. data/examples/benchmark_js.rb +13 -0
  11. data/examples/jquery.js +9046 -0
  12. data/lib/textpow.rb +43 -3
  13. data/lib/textpow/debug_processor.rb +35 -35
  14. data/lib/textpow/recording_processor.rb +13 -0
  15. data/lib/textpow/score_manager.rb +60 -60
  16. data/lib/textpow/syntax.rb +303 -262
  17. data/lib/textpow/syntax/broken/markdown.syntax +519 -0
  18. data/lib/textpow/syntax/broken/php.syntax +1253 -0
  19. data/lib/textpow/syntax/buggy/nemerle.syntax +74 -0
  20. data/lib/textpow/syntax/old/YAML.yaml +160 -0
  21. data/lib/textpow/syntax/old/txt2tags.yaml +139 -0
  22. data/lib/textpow/syntax/source.actionscript.syntax +97 -0
  23. data/lib/textpow/syntax/source.active4d.library.syntax +21 -0
  24. data/lib/textpow/syntax/source.active4d.syntax +276 -0
  25. data/lib/textpow/syntax/source.ada.syntax +33 -0
  26. data/lib/textpow/syntax/source.antlr.syntax +151 -0
  27. data/lib/textpow/syntax/source.apache-config.mod_perl.syntax +50 -0
  28. data/lib/textpow/syntax/source.apache-config.syntax +191 -0
  29. data/lib/textpow/syntax/source.applescript.syntax +384 -0
  30. data/lib/textpow/syntax/source.asp.syntax +70 -0
  31. data/lib/textpow/syntax/source.asp.vb.net.syntax +129 -0
  32. data/lib/textpow/syntax/source.c++.qt.syntax +26 -0
  33. data/lib/textpow/syntax/source.c++.syntax +186 -0
  34. data/lib/textpow/syntax/source.c-sharp.syntax +59 -0
  35. data/lib/textpow/syntax/source.c.ragel.syntax +201 -0
  36. data/lib/textpow/syntax/source.c.syntax +414 -0
  37. data/lib/textpow/syntax/source.camlp4.ocaml.syntax +36 -0
  38. data/lib/textpow/syntax/source.cm.syntax +32 -0
  39. data/lib/textpow/syntax/source.coffee.syntax +216 -0
  40. data/lib/textpow/syntax/source.context-free.syntax +176 -0
  41. data/lib/textpow/syntax/source.css.beta.syntax +1925 -0
  42. data/lib/textpow/syntax/source.css.syntax +195 -0
  43. data/lib/textpow/syntax/source.d.syntax +142 -0
  44. data/lib/textpow/syntax/source.diff.syntax +81 -0
  45. data/lib/textpow/syntax/source.dot.syntax +47 -0
  46. data/lib/textpow/syntax/source.dylan.syntax +62 -0
  47. data/lib/textpow/syntax/source.eiffel.syntax +78 -0
  48. data/lib/textpow/syntax/source.erlang.syntax +922 -0
  49. data/lib/textpow/syntax/source.fortran.syntax +141 -0
  50. data/lib/textpow/syntax/source.fscript.syntax +80 -0
  51. data/lib/textpow/syntax/source.fxscript.syntax +142 -0
  52. data/lib/textpow/syntax/source.gri.syntax +83 -0
  53. data/lib/textpow/syntax/source.groovy.groovy.syntax +191 -0
  54. data/lib/textpow/syntax/source.haskell.syntax +88 -0
  55. data/lib/textpow/syntax/source.icalendar.syntax +32 -0
  56. data/lib/textpow/syntax/source.inform.syntax +48 -0
  57. data/lib/textpow/syntax/source.ini.syntax +55 -0
  58. data/lib/textpow/syntax/source.io.syntax +81 -0
  59. data/lib/textpow/syntax/source.java-props.syntax +20 -0
  60. data/lib/textpow/syntax/source.java.syntax +211 -0
  61. data/lib/textpow/syntax/source.js.greasemonkey.syntax +34 -0
  62. data/lib/textpow/syntax/source.js.jquery.syntax +114 -0
  63. data/lib/textpow/syntax/source.js.mootools.syntax +572 -0
  64. data/lib/textpow/syntax/source.js.prototype.bracketed.syntax +140 -0
  65. data/lib/textpow/syntax/source.js.prototype.syntax +72 -0
  66. data/lib/textpow/syntax/source.js.syntax +256 -0
  67. data/lib/textpow/syntax/source.js.yui.syntax +176 -0
  68. data/lib/textpow/syntax/source.json.syntax +136 -0
  69. data/lib/textpow/syntax/source.lex.syntax +219 -0
  70. data/lib/textpow/syntax/source.lighttpd-config.syntax +54 -0
  71. data/lib/textpow/syntax/source.lilypond.syntax +492 -0
  72. data/lib/textpow/syntax/source.lisp.syntax +61 -0
  73. data/lib/textpow/syntax/source.logo.syntax +29 -0
  74. data/lib/textpow/syntax/source.logtalk.syntax +152 -0
  75. data/lib/textpow/syntax/source.lua.syntax +86 -0
  76. data/lib/textpow/syntax/source.makefile.syntax +36 -0
  77. data/lib/textpow/syntax/source.matlab.syntax +142 -0
  78. data/lib/textpow/syntax/source.mel.syntax +92 -0
  79. data/lib/textpow/syntax/source.mips.syntax +66 -0
  80. data/lib/textpow/syntax/source.ml.syntax +121 -0
  81. data/lib/textpow/syntax/source.modula-3.syntax +47 -0
  82. data/lib/textpow/syntax/source.nant-build.syntax +53 -0
  83. data/lib/textpow/syntax/source.objc++.syntax +18 -0
  84. data/lib/textpow/syntax/source.objc.syntax +233 -0
  85. data/lib/textpow/syntax/source.ocaml.syntax +764 -0
  86. data/lib/textpow/syntax/source.ocamllex.syntax +167 -0
  87. data/lib/textpow/syntax/source.ocamlyacc.syntax +184 -0
  88. data/lib/textpow/syntax/source.open-gl.syntax +14 -0
  89. data/lib/textpow/syntax/source.pascal.syntax +77 -0
  90. data/lib/textpow/syntax/source.pascal.vectorscript.syntax +57 -0
  91. data/lib/textpow/syntax/source.perl.syntax +1113 -0
  92. data/lib/textpow/syntax/source.php.cake.syntax +55 -0
  93. data/lib/textpow/syntax/source.plist.tm-grammar.syntax +708 -0
  94. data/lib/textpow/syntax/source.postscript.syntax +114 -0
  95. data/lib/textpow/syntax/source.processing.syntax +106 -0
  96. data/lib/textpow/syntax/source.prolog.syntax +40 -0
  97. data/lib/textpow/syntax/source.python.django.syntax +21 -0
  98. data/lib/textpow/syntax/source.python.syntax +868 -0
  99. data/lib/textpow/syntax/source.qmake.syntax +114 -0
  100. data/lib/textpow/syntax/source.quake-config.syntax +32 -0
  101. data/lib/textpow/syntax/source.r-console.syntax +16 -0
  102. data/lib/textpow/syntax/source.r.syntax +81 -0
  103. data/lib/textpow/syntax/source.regexp.oniguruma.syntax +107 -0
  104. data/lib/textpow/syntax/source.regexp.python.syntax +109 -0
  105. data/lib/textpow/syntax/source.regexp.syntax +50 -0
  106. data/lib/textpow/syntax/source.remind.syntax +253 -0
  107. data/lib/textpow/syntax/source.rez.syntax +80 -0
  108. data/lib/textpow/syntax/source.ruby.experimental.syntax +145 -0
  109. data/lib/textpow/syntax/source.ruby.rails.syntax +88 -0
  110. data/lib/textpow/syntax/source.ruby.syntax +1035 -0
  111. data/lib/textpow/syntax/source.s5.syntax +69 -0
  112. data/lib/textpow/syntax/source.sass.syntax +45 -0
  113. data/lib/textpow/syntax/source.scheme.syntax +347 -0
  114. data/lib/textpow/syntax/source.scilab.syntax +41 -0
  115. data/lib/textpow/syntax/source.scss.syntax +527 -0
  116. data/lib/textpow/syntax/source.shell.syntax +384 -0
  117. data/lib/textpow/syntax/source.slate.syntax +149 -0
  118. data/lib/textpow/syntax/source.smarty.syntax +63 -0
  119. data/lib/textpow/syntax/source.sql.ruby.syntax +18 -0
  120. data/lib/textpow/syntax/source.sql.syntax +237 -0
  121. data/lib/textpow/syntax/source.ssh-config.syntax +33 -0
  122. data/lib/textpow/syntax/source.strings.syntax +39 -0
  123. data/lib/textpow/syntax/source.swig.syntax +57 -0
  124. data/lib/textpow/syntax/source.tcl.macports.syntax +163 -0
  125. data/lib/textpow/syntax/source.tcl.syntax +152 -0
  126. data/lib/textpow/syntax/source.yaml.syntax +160 -0
  127. data/lib/textpow/syntax/text.active4d-ini.syntax +50 -0
  128. data/lib/textpow/syntax/text.bbcode.syntax +287 -0
  129. data/lib/textpow/syntax/text.bibtex.syntax +151 -0
  130. data/lib/textpow/syntax/text.blog.html.syntax +41 -0
  131. data/lib/textpow/syntax/text.blog.markdown.syntax +42 -0
  132. data/lib/textpow/syntax/text.blog.syntax +27 -0
  133. data/lib/textpow/syntax/text.blog.textile.syntax +27 -0
  134. data/lib/textpow/syntax/text.gtdalt.syntax +143 -0
  135. data/lib/textpow/syntax/text.haml.syntax +88 -0
  136. data/lib/textpow/syntax/text.html.asp.net.syntax +424 -0
  137. data/lib/textpow/syntax/text.html.asp.syntax +27 -0
  138. data/lib/textpow/syntax/text.html.basic.syntax +362 -0
  139. data/lib/textpow/syntax/text.html.cfm.syntax +119 -0
  140. data/lib/textpow/syntax/text.html.django.syntax +36 -0
  141. data/lib/textpow/syntax/text.html.dokuwiki.syntax +204 -0
  142. data/lib/textpow/syntax/text.html.doxygen.syntax +43 -0
  143. data/lib/textpow/syntax/text.html.markdown.multimarkdown.syntax +39 -0
  144. data/lib/textpow/syntax/text.html.mason.syntax +119 -0
  145. data/lib/textpow/syntax/text.html.mediawiki.syntax +567 -0
  146. data/lib/textpow/syntax/text.html.mt.syntax +162 -0
  147. data/lib/textpow/syntax/text.html.ruby.syntax +40 -0
  148. data/lib/textpow/syntax/text.html.strict.active4d.syntax +311 -0
  149. data/lib/textpow/syntax/text.html.tcl.syntax +26 -0
  150. data/lib/textpow/syntax/text.html.textile.syntax +215 -0
  151. data/lib/textpow/syntax/text.html.tt.syntax +121 -0
  152. data/lib/textpow/syntax/text.html.twiki.syntax +241 -0
  153. data/lib/textpow/syntax/text.html.xhtml.1-strict.syntax +4027 -0
  154. data/lib/textpow/syntax/text.log.latex.syntax +50 -0
  155. data/lib/textpow/syntax/text.mail.markdown.syntax +118 -0
  156. data/lib/textpow/syntax/text.man.syntax +17 -0
  157. data/lib/textpow/syntax/text.moinmoin.syntax +189 -0
  158. data/lib/textpow/syntax/text.plain.gtd.syntax +22 -0
  159. data/lib/textpow/syntax/text.plain.release-notes.syntax +46 -0
  160. data/lib/textpow/syntax/text.plain.syntax +32 -0
  161. data/lib/textpow/syntax/text.plist.syntax +635 -0
  162. data/lib/textpow/syntax/text.pmwiki.syntax +113 -0
  163. data/lib/textpow/syntax/text.restructuredtext.syntax +250 -0
  164. data/lib/textpow/syntax/text.setext.syntax +147 -0
  165. data/lib/textpow/syntax/text.subversion-commit.syntax +36 -0
  166. data/lib/textpow/syntax/text.tabular.csv.syntax +68 -0
  167. data/lib/textpow/syntax/text.tabular.tsv.syntax +50 -0
  168. data/lib/textpow/syntax/text.tex.latex.beamer.syntax +41 -0
  169. data/lib/textpow/syntax/text.tex.latex.haskell.syntax +24 -0
  170. data/lib/textpow/syntax/text.tex.latex.memoir.syntax +64 -0
  171. data/lib/textpow/syntax/text.tex.latex.rd.syntax +91 -0
  172. data/lib/textpow/syntax/text.tex.latex.sweave.syntax +84 -0
  173. data/lib/textpow/syntax/text.tex.latex.syntax +566 -0
  174. data/lib/textpow/syntax/text.tex.math.syntax +49 -0
  175. data/lib/textpow/syntax/text.tex.syntax +86 -0
  176. data/lib/textpow/syntax/text.txt2tags.syntax +79 -0
  177. data/lib/textpow/syntax/text.xml.apple-dist.syntax +77 -0
  178. data/lib/textpow/syntax/text.xml.strict.syntax +92 -0
  179. data/lib/textpow/syntax/text.xml.syntax +180 -0
  180. data/lib/textpow/syntax/text.xml.xsl.syntax +60 -0
  181. data/lib/textpow/version.rb +3 -0
  182. data/spec/fixtures/objeck.plist +107 -0
  183. data/spec/fixtures/utf8.txt +1 -0
  184. data/spec/spec_helper.rb +2 -0
  185. data/spec/textpow/score_manager_spec.rb +20 -0
  186. data/spec/textpow/syntax_files_spec.rb +26 -0
  187. data/spec/textpow/syntax_spec.rb +225 -0
  188. data/spec/textpow_spec.rb +57 -0
  189. data/textpow.gemspec +19 -0
  190. metadata +246 -68
  191. data/Manifest.txt +0 -13
  192. data/mm/manual.mm +0 -266
  193. data/test/test_textpow.rb +0 -25
@@ -0,0 +1,201 @@
1
+ ---
2
+ name: Ragel
3
+ fileTypes:
4
+ - rl
5
+ - ragel
6
+ scopeName: source.c.ragel
7
+ repository:
8
+ regexp:
9
+ patterns:
10
+ - name: string.regexp.character-class.ragel
11
+ endCaptures:
12
+ "0":
13
+ name: punctuation.definition.string.end.ragel
14
+ begin: \[
15
+ beginCaptures:
16
+ "0":
17
+ name: punctuation.definition.string.begin.ragel
18
+ end: \]\s*[*?]?
19
+ - name: string.regexp.classic.ragel
20
+ endCaptures:
21
+ "0":
22
+ name: punctuation.definition.string.end.ragel
23
+ begin: \/
24
+ beginCaptures:
25
+ "0":
26
+ name: punctuation.definition.string.begin.ragel
27
+ end: \/\s*[*?]?
28
+ embedded_code:
29
+ patterns:
30
+ - name: source.c
31
+ begin: \{
32
+ beginCaptures:
33
+ "0":
34
+ name: punctuation.section.embedded.c
35
+ end: \}
36
+ patterns:
37
+ - include: source.c
38
+ comments:
39
+ patterns:
40
+ - name: comment.line.ragel
41
+ begin: "#"
42
+ beginCaptures:
43
+ "0":
44
+ name: punctuation.definition.comment.ragel
45
+ end: $\n?
46
+ action_name:
47
+ patterns:
48
+ - name: entity.name.type.action-reference.ragel
49
+ captures:
50
+ "1":
51
+ name: punctuation.definition.entity.ragel
52
+ match: ([@$>%])\s*([\w\d]+)
53
+ string_escaped_char:
54
+ patterns:
55
+ - name: constant.character.escape.ragel
56
+ match: \\(\\|[abefnprtv'"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2})
57
+ - name: invalid.illegal.unknown-escape.ragel
58
+ match: \\.
59
+ operators:
60
+ patterns:
61
+ - name: keyword.operator.contatenation.ragel
62
+ match: (\:\>\>?|\<\:)
63
+ source_ragel:
64
+ patterns:
65
+ - include: "#keywords"
66
+ - include: "#regexp"
67
+ - include: "#string"
68
+ - include: "#comments"
69
+ - include: "#embedded_code"
70
+ - name: meta.function.action.ragel
71
+ endCaptures:
72
+ "1":
73
+ name: punctuation.section.function.ragel
74
+ begin: (action)\s+([\w\d]+)\s+({)
75
+ beginCaptures:
76
+ "1":
77
+ name: keyword.other.action.ragel
78
+ "2":
79
+ name: entity.name.type.action.ragel
80
+ "3":
81
+ name: punctuation.section.function.ragel
82
+ end: (})
83
+ patterns:
84
+ - include: source.c
85
+ - name: meta.machine-definition.ragel
86
+ endCaptures:
87
+ "1":
88
+ name: punctuation.terminator.machine-definition.ragel
89
+ begin: ([\w\d]+)\s*(=)
90
+ beginCaptures:
91
+ "1":
92
+ name: entity.name.type.machine-definition.ragel
93
+ "2":
94
+ name: punctuation.separator.key-value.ragel
95
+ end: (;)
96
+ patterns:
97
+ - include: "#regexp"
98
+ - include: "#string"
99
+ - include: "#action_name"
100
+ - include: "#embedded_code"
101
+ - include: "#operators"
102
+ - include: "#comments"
103
+ - name: meta.machine-instantiation.ragel
104
+ endCaptures:
105
+ "1":
106
+ name: punctuation.terminator.machine-instantiation.ragel
107
+ begin: ([\w\d]+)\s*(:=)
108
+ beginCaptures:
109
+ "1":
110
+ name: entity.name.type.machine-instantiation.ragel
111
+ "2":
112
+ name: punctuation.separator.key-value.ragel
113
+ end: ;
114
+ patterns:
115
+ - include: "#regexp"
116
+ - include: "#string"
117
+ - include: "#action_name"
118
+ - include: "#embedded_code"
119
+ - include: "#operators"
120
+ - include: "#comments"
121
+ - name: meta.ragel.longest-match
122
+ begin: \|\*
123
+ end: \*\|
124
+ patterns:
125
+ - include: "#source_ragel"
126
+ string_placeholder:
127
+ patterns:
128
+ - name: constant.other.placeholder.ragel
129
+ match: "(?x)%\n\
130
+ \t\t\t\t\t\t(\\d+\\$)? # field (argument #)\n\
131
+ \t\t\t\t\t\t[#0\\- +']* # flags\n\
132
+ \t\t\t\t\t\t[,;:_]? # separator character (AltiVec)\n\
133
+ \t\t\t\t\t\t((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n\
134
+ \t\t\t\t\t\t(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n\
135
+ \t\t\t\t\t\t(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n\
136
+ \t\t\t\t\t\t[diouxXDOUeEfFgGaACcSspn%] # conversion type\n\
137
+ \t\t\t\t\t"
138
+ - name: invalid.illegal.placeholder.ragel
139
+ match: "%"
140
+ string:
141
+ patterns:
142
+ - name: string.quoted.double.ragel
143
+ endCaptures:
144
+ "0":
145
+ name: punctuation.definition.string.end.ragel
146
+ begin: "\""
147
+ beginCaptures:
148
+ "0":
149
+ name: punctuation.definition.string.begin.ragel
150
+ end: "\""
151
+ patterns:
152
+ - include: "#string_escaped_char"
153
+ - include: "#string_placeholder"
154
+ - name: string.quoted.single.ragel
155
+ endCaptures:
156
+ "0":
157
+ name: punctuation.definition.string.end.ragel
158
+ begin: "'"
159
+ beginCaptures:
160
+ "0":
161
+ name: punctuation.definition.string.begin.ragel
162
+ end: "'"
163
+ patterns:
164
+ - include: "#string_escaped_char"
165
+ keywords:
166
+ patterns:
167
+ - name: keyword.other.ragel
168
+ match: \b(machine|action|context|include|variable|access|write|contained)\b
169
+ uuid: F1172666-F07C-4F6A-B07D-E1AD08DE2070
170
+ foldingStartMarker: "(?x)\n\
171
+ \t\t /\\*\\*(?!\\*)\n\
172
+ \t\t|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))\n\
173
+ \t"
174
+ patterns:
175
+ - name: source.ragel
176
+ captures:
177
+ "0":
178
+ name: punctuation.section.embedded.ragel
179
+ begin: "%%{"
180
+ end: "}%%"
181
+ patterns:
182
+ - include: "#source_ragel"
183
+ - name: source.ragel
184
+ begin: "%%$"
185
+ beginCaptures:
186
+ "0":
187
+ name: punctuation.section.embedded.ragel
188
+ end: $
189
+ patterns:
190
+ - include: "#source_ragel"
191
+ - name: support.function.ragel
192
+ begin: "%%"
193
+ beginCaptures:
194
+ "0":
195
+ name: punctuation.section.embedded.ragel
196
+ end: $
197
+ patterns:
198
+ - include: "#keywords"
199
+ - include: source.c
200
+ foldingStopMarker: (?<!\*)\*\*/|^\s*\}
201
+ keyEquivalent: ^~R
@@ -0,0 +1,414 @@
1
+ ---
2
+ fileTypes:
3
+ - c
4
+ - h
5
+ firstLineMatch: -[*]-( Mode:)? C -[*]-
6
+ foldingStartMarker: "(?x)\n\
7
+ \t\t /\\*\\*(?!\\*)\n\
8
+ \t\t|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))\n\
9
+ \t"
10
+ foldingStopMarker: (?<!\*)\*\*/|^\s*\}
11
+ keyEquivalent: ^~C
12
+ name: C
13
+ patterns:
14
+ - include: "#preprocessor-rule-enabled"
15
+ - include: "#preprocessor-rule-disabled"
16
+ - include: "#preprocessor-rule-other"
17
+ - include: "#comments"
18
+ - match: \b(break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while)\b
19
+ name: keyword.control.c
20
+ - match: \b(asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void)\b
21
+ name: storage.type.c
22
+ - match: \b(const|extern|register|restrict|static|volatile|inline)\b
23
+ name: storage.modifier.c
24
+ - comment: common C constant naming idiom -- kConstantVariable
25
+ match: \bk[A-Z]\w*\b
26
+ name: constant.other.variable.mac-classic.c
27
+ - match: \bg[A-Z]\w*\b
28
+ name: variable.other.readwrite.global.mac-classic.c
29
+ - match: \bs[A-Z]\w*\b
30
+ name: variable.other.readwrite.static.mac-classic.c
31
+ - match: \b(NULL|true|false|TRUE|FALSE)\b
32
+ name: constant.language.c
33
+ - include: "#sizeof"
34
+ - match: \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b
35
+ name: constant.numeric.c
36
+ - begin: "\""
37
+ beginCaptures:
38
+ "0":
39
+ name: punctuation.definition.string.begin.c
40
+ end: "\""
41
+ endCaptures:
42
+ "0":
43
+ name: punctuation.definition.string.end.c
44
+ name: string.quoted.double.c
45
+ patterns:
46
+ - include: "#string_escaped_char"
47
+ - include: "#string_placeholder"
48
+ - begin: "&apos;"
49
+ beginCaptures:
50
+ "0":
51
+ name: punctuation.definition.string.begin.c
52
+ end: "&apos;"
53
+ endCaptures:
54
+ "0":
55
+ name: punctuation.definition.string.end.c
56
+ name: string.quoted.single.c
57
+ patterns:
58
+ - include: "#string_escaped_char"
59
+ - begin: "(?x)\n \t\t^\\s*\\#\\s*(define)\\s+ # define\n \t\t((?<id>[a-zA-Z_][a-zA-Z0-9_]*)) # macro name\n \t\t(?: # and optionally:\n \t\t (\\() # an open parenthesis\n \t\t (\n \t\t \\s* \\g<id> \\s* # first argument\n \t\t ((,) \\s* \\g<id> \\s*)* # additional arguments\n \t\t (?:\\.\\.\\.)? # varargs ellipsis?\n \t\t )\n \t\t (\\)) # a close parenthesis\n \t\t)?\n \t"
60
+ beginCaptures:
61
+ "1":
62
+ name: keyword.control.import.define.c
63
+ "2":
64
+ name: entity.name.function.preprocessor.c
65
+ "4":
66
+ name: punctuation.definition.parameters.c
67
+ "5":
68
+ name: variable.parameter.preprocessor.c
69
+ "7":
70
+ name: punctuation.separator.parameters.c
71
+ "8":
72
+ name: punctuation.definition.parameters.c
73
+ end: (?=(?://|/\*))|$
74
+ name: meta.preprocessor.macro.c
75
+ patterns:
76
+ - match: (?>\\\s*\n)
77
+ name: punctuation.separator.continuation.c
78
+ - include: $base
79
+ - begin: ^\s*#\s*(error|warning)\b
80
+ captures:
81
+ "1":
82
+ name: keyword.control.import.error.c
83
+ end: $
84
+ name: meta.preprocessor.diagnostic.c
85
+ patterns:
86
+ - match: (?>\\\s*\n)
87
+ name: punctuation.separator.continuation.c
88
+ - begin: ^\s*#\s*(include|import)\b\s+
89
+ captures:
90
+ "1":
91
+ name: keyword.control.import.include.c
92
+ end: (?=(?://|/\*))|$
93
+ name: meta.preprocessor.c.include
94
+ patterns:
95
+ - match: (?>\\\s*\n)
96
+ name: punctuation.separator.continuation.c
97
+ - begin: "\""
98
+ beginCaptures:
99
+ "0":
100
+ name: punctuation.definition.string.begin.c
101
+ end: "\""
102
+ endCaptures:
103
+ "0":
104
+ name: punctuation.definition.string.end.c
105
+ name: string.quoted.double.include.c
106
+ - begin: <
107
+ beginCaptures:
108
+ "0":
109
+ name: punctuation.definition.string.begin.c
110
+ end: ">"
111
+ endCaptures:
112
+ "0":
113
+ name: punctuation.definition.string.end.c
114
+ name: string.quoted.other.lt-gt.include.c
115
+ - include: "#pragma-mark"
116
+ - begin: ^\s*#\s*(define|defined|elif|else|if|ifdef|ifndef|line|pragma|undef)\b
117
+ captures:
118
+ "1":
119
+ name: keyword.control.import.c
120
+ end: (?=(?://|/\*))|$
121
+ name: meta.preprocessor.c
122
+ patterns:
123
+ - match: (?>\\\s*\n)
124
+ name: punctuation.separator.continuation.c
125
+ - match: \b(u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t)\b
126
+ name: support.type.sys-types.c
127
+ - match: \b(pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t)\b
128
+ name: support.type.pthread.c
129
+ - match: \b(int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t)\b
130
+ name: support.type.stdint.c
131
+ - match: \b(noErr|kNilOptions|kInvalidID|kVariableLengthArray)\b
132
+ name: support.constant.mac-classic.c
133
+ - match: \b(AbsoluteTime|Boolean|Byte|ByteCount|ByteOffset|BytePtr|CompTimeValue|ConstLogicalAddress|ConstStrFileNameParam|ConstStringPtr|Duration|Fixed|FixedPtr|Float32|Float32Point|Float64|Float80|Float96|FourCharCode|Fract|FractPtr|Handle|ItemCount|LogicalAddress|OptionBits|OSErr|OSStatus|OSType|OSTypePtr|PhysicalAddress|ProcessSerialNumber|ProcessSerialNumberPtr|ProcHandle|Ptr|ResType|ResTypePtr|ShortFixed|ShortFixedPtr|SignedByte|SInt16|SInt32|SInt64|SInt8|Size|StrFileName|StringHandle|StringPtr|TimeBase|TimeRecord|TimeScale|TimeValue|TimeValue64|UInt16|UInt32|UInt64|UInt8|UniChar|UniCharCount|UniCharCountPtr|UniCharPtr|UnicodeScalarValue|UniversalProcHandle|UniversalProcPtr|UnsignedFixed|UnsignedFixedPtr|UnsignedWide|UTF16Char|UTF32Char|UTF8Char)\b
134
+ name: support.type.mac-classic.c
135
+ - include: "#block"
136
+ - begin: |-
137
+ (?x)
138
+ (?: ^ # begin-of-line
139
+ |
140
+ (?: (?= \s ) (?<!else|new|return) (?<=\w) # or word + space before name
141
+ | (?= \s*[A-Za-z_] ) (?<!&&) (?<=[*&>]) # or type modifier before name
142
+ )
143
+ )
144
+ (\s*) (?!(while|for|do|if|else|switch|catch|enumerate|return|r?iterate)\s*\()
145
+ (
146
+ (?: [A-Za-z_][A-Za-z0-9_]*+ | :: )++ | # actual name
147
+ (?: (?<=operator) (?: [-*&<>=+!]+ | \(\) | \[\] ) ) # if it is a C++ operator
148
+ )
149
+ \s*(?=\()
150
+ beginCaptures:
151
+ "1":
152
+ name: punctuation.whitespace.function.leading.c
153
+ "3":
154
+ name: entity.name.function.c
155
+ "4":
156
+ name: punctuation.definition.parameters.c
157
+ end: (?<=\})|(?=#)|(;)
158
+ name: meta.function.c
159
+ patterns:
160
+ - include: "#comments"
161
+ - include: "#parens"
162
+ - match: \bconst\b
163
+ name: storage.modifier.c
164
+ - include: "#block"
165
+ repository:
166
+ access:
167
+ match: \.[a-zA-Z_][a-zA-Z_0-9]*\b(?!\s*\()
168
+ name: variable.other.dot-access.c
169
+ block:
170
+ begin: \{
171
+ end: \}
172
+ name: meta.block.c
173
+ patterns:
174
+ - include: "#block_innards"
175
+ block_innards:
176
+ patterns:
177
+ - include: "#preprocessor-rule-enabled-block"
178
+ - include: "#preprocessor-rule-disabled-block"
179
+ - include: "#preprocessor-rule-other-block"
180
+ - include: "#sizeof"
181
+ - include: "#access"
182
+ - captures:
183
+ "1":
184
+ name: punctuation.whitespace.support.function.leading.c
185
+ "2":
186
+ name: support.function.C99.c
187
+ match: (\s*)\b(hypot(f|l)?|s(scanf|ystem|nprintf|ca(nf|lb(n(f|l)?|ln(f|l)?))|i(n(h(f|l)?|f|l)?|gn(al|bit))|tr(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(jmp|vbuf|locale|buf)|qrt(f|l)?|w(scanf|printf)|rand)|n(e(arbyint(f|l)?|xt(toward(f|l)?|after(f|l)?))|an(f|l)?)|c(s(in(h(f|l)?|f|l)?|qrt(f|l)?)|cos(h(f)?|f|l)?|imag(f|l)?|t(ime|an(h(f|l)?|f|l)?)|o(s(h(f|l)?|f|l)?|nj(f|l)?|pysign(f|l)?)|p(ow(f|l)?|roj(f|l)?)|e(il(f|l)?|xp(f|l)?)|l(o(ck|g(f|l)?)|earerr)|a(sin(h(f|l)?|f|l)?|cos(h(f|l)?|f|l)?|tan(h(f|l)?|f|l)?|lloc|rg(f|l)?|bs(f|l)?)|real(f|l)?|brt(f|l)?)|t(ime|o(upper|lower)|an(h(f|l)?|f|l)?|runc(f|l)?|gamma(f|l)?|mp(nam|file))|i(s(space|n(ormal|an)|cntrl|inf|digit|u(nordered|pper)|p(unct|rint)|finite|w(space|c(ntrl|type)|digit|upper|p(unct|rint)|lower|al(num|pha)|graph|xdigit|blank)|l(ower|ess(equal|greater)?)|al(num|pha)|gr(eater(equal)?|aph)|xdigit|blank)|logb(f|l)?|max(div|abs))|di(v|fftime)|_Exit|unget(c|wc)|p(ow(f|l)?|ut(s|c(har)?|wc(har)?)|error|rintf)|e(rf(c(f|l)?|f|l)?|x(it|p(2(f|l)?|f|l|m1(f|l)?)?))|v(s(scanf|nprintf|canf|printf|w(scanf|printf))|printf|f(scanf|printf|w(scanf|printf))|w(scanf|printf)|a_(start|copy|end|arg))|qsort|f(s(canf|e(tpos|ek))|close|tell|open|dim(f|l)?|p(classify|ut(s|c|w(s|c))|rintf)|e(holdexcept|set(e(nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(aiseexcept|ror)|get(e(nv|xceptflag)|round))|flush|w(scanf|ide|printf|rite)|loor(f|l)?|abs(f|l)?|get(s|c|pos|w(s|c))|re(open|e|ad|xp(f|l)?)|m(in(f|l)?|od(f|l)?|a(f|l|x(f|l)?)?))|l(d(iv|exp(f|l)?)|o(ngjmp|cal(time|econv)|g(1(p(f|l)?|0(f|l)?)|2(f|l)?|f|l|b(f|l)?)?)|abs|l(div|abs|r(int(f|l)?|ound(f|l)?))|r(int(f|l)?|ound(f|l)?)|gamma(f|l)?)|w(scanf|c(s(s(tr|pn)|nc(py|at|mp)|c(spn|hr|oll|py|at|mp)|to(imax|d|u(l(l)?|max)|k|f|l(d|l)?|mbs)|pbrk|ftime|len|r(chr|tombs)|xfrm)|to(b|mb)|rtomb)|printf|mem(set|c(hr|py|mp)|move))|a(s(sert|ctime|in(h(f|l)?|f|l)?)|cos(h(f|l)?|f|l)?|t(o(i|f|l(l)?)|exit|an(h(f|l)?|2(f|l)?|f|l)?)|b(s|ort))|g(et(s|c(har)?|env|wc(har)?)|mtime)|r(int(f|l)?|ound(f|l)?|e(name|alloc|wind|m(ove|quo(f|l)?|ainder(f|l)?))|a(nd|ise))|b(search|towc)|m(odf(f|l)?|em(set|c(hr|py|mp)|move)|ktime|alloc|b(s(init|towcs|rtowcs)|towc|len|r(towc|len))))\b
188
+ - captures:
189
+ "1":
190
+ name: punctuation.whitespace.function-call.leading.c
191
+ "2":
192
+ name: support.function.any-method.c
193
+ "3":
194
+ name: punctuation.definition.parameters.c
195
+ match: |-
196
+ (?x) (?: (?= \s ) (?:(?<=else|new|return) | (?<!\w)) (\s+))?
197
+ (\b
198
+ (?!(while|for|do|if|else|switch|catch|enumerate|return|r?iterate)\s*\()(?:(?!NS)[A-Za-z_][A-Za-z0-9_]*+\b | :: )++ # actual name
199
+ )
200
+ \s*(\()
201
+ name: meta.function-call.c
202
+ - captures:
203
+ "1":
204
+ name: variable.other.c
205
+ "2":
206
+ name: punctuation.definition.parameters.c
207
+ match: |-
208
+ (?x)
209
+ (?x)
210
+ (?:
211
+ (?: (?= \s ) (?<!else|new|return) (?<=\w)\s+ # or word + space before name
212
+ )
213
+ )
214
+ (
215
+ (?: [A-Za-z_][A-Za-z0-9_]*+ | :: )++ | # actual name
216
+ (?: (?<=operator) (?: [-*&<>=+!]+ | \(\) | \[\] ) )? # if it is a C++ operator
217
+ )
218
+ \s*(\()
219
+ name: meta.initialization.c
220
+ - include: "#block"
221
+ - include: $base
222
+ comments:
223
+ patterns:
224
+ - captures:
225
+ "1":
226
+ name: meta.toc-list.banner.block.c
227
+ match: ^/\* =(\s*.*?)\s*= \*/$\n?
228
+ name: comment.block.c
229
+ - begin: /\*
230
+ captures:
231
+ "0":
232
+ name: punctuation.definition.comment.c
233
+ end: \*/
234
+ name: comment.block.c
235
+ - match: \*/.*\n
236
+ name: invalid.illegal.stray-comment-end.c
237
+ - captures:
238
+ "1":
239
+ name: meta.toc-list.banner.line.c
240
+ match: ^// =(\s*.*?)\s*=\s*$\n?
241
+ name: comment.line.banner.c++
242
+ - begin: //
243
+ beginCaptures:
244
+ "0":
245
+ name: punctuation.definition.comment.c
246
+ end: $\n?
247
+ name: comment.line.double-slash.c++
248
+ patterns:
249
+ - match: (?>\\\s*\n)
250
+ name: punctuation.separator.continuation.c++
251
+ disabled:
252
+ begin: ^\s*#\s*if(n?def)?\b.*$
253
+ comment: eat nested preprocessor if(def)s
254
+ end: ^\s*#\s*endif\b.*$
255
+ patterns:
256
+ - include: "#disabled"
257
+ - include: "#pragma-mark"
258
+ parens:
259
+ begin: \(
260
+ end: \)
261
+ name: meta.parens.c
262
+ patterns:
263
+ - include: $base
264
+ pragma-mark:
265
+ captures:
266
+ "1":
267
+ name: meta.preprocessor.c
268
+ "2":
269
+ name: keyword.control.import.pragma.c
270
+ "3":
271
+ name: meta.toc-list.pragma-mark.c
272
+ match: ^\s*(#\s*(pragma\s+mark)\s+(.*))
273
+ name: meta.section
274
+ preprocessor-rule-disabled:
275
+ begin: ^\s*(#(if)\s+(0)\b).*
276
+ captures:
277
+ "1":
278
+ name: meta.preprocessor.c
279
+ "2":
280
+ name: keyword.control.import.if.c
281
+ "3":
282
+ name: constant.numeric.preprocessor.c
283
+ end: ^\s*(#\s*(endif)\b)
284
+ patterns:
285
+ - begin: ^\s*(#\s*(else)\b)
286
+ captures:
287
+ "1":
288
+ name: meta.preprocessor.c
289
+ "2":
290
+ name: keyword.control.import.else.c
291
+ end: (?=^\s*#\s*endif\b.*$)
292
+ patterns:
293
+ - include: $base
294
+ - begin: ""
295
+ end: (?=^\s*#\s*(else|endif)\b.*$)
296
+ name: comment.block.preprocessor.if-branch
297
+ patterns:
298
+ - include: "#disabled"
299
+ - include: "#pragma-mark"
300
+ preprocessor-rule-disabled-block:
301
+ begin: ^\s*(#(if)\s+(0)\b).*
302
+ captures:
303
+ "1":
304
+ name: meta.preprocessor.c
305
+ "2":
306
+ name: keyword.control.import.if.c
307
+ "3":
308
+ name: constant.numeric.preprocessor.c
309
+ end: ^\s*(#\s*(endif)\b)
310
+ patterns:
311
+ - begin: ^\s*(#\s*(else)\b)
312
+ captures:
313
+ "1":
314
+ name: meta.preprocessor.c
315
+ "2":
316
+ name: keyword.control.import.else.c
317
+ end: (?=^\s*#\s*endif\b.*$)
318
+ patterns:
319
+ - include: "#block_innards"
320
+ - begin: ""
321
+ end: (?=^\s*#\s*(else|endif)\b.*$)
322
+ name: comment.block.preprocessor.if-branch.in-block
323
+ patterns:
324
+ - include: "#disabled"
325
+ - include: "#pragma-mark"
326
+ preprocessor-rule-enabled:
327
+ begin: ^\s*(#(if)\s+(0*1)\b)
328
+ captures:
329
+ "1":
330
+ name: meta.preprocessor.c
331
+ "2":
332
+ name: keyword.control.import.if.c
333
+ "3":
334
+ name: constant.numeric.preprocessor.c
335
+ end: ^\s*(#\s*(endif)\b)
336
+ patterns:
337
+ - begin: ^\s*(#\s*(else)\b).*
338
+ captures:
339
+ "1":
340
+ name: meta.preprocessor.c
341
+ "2":
342
+ name: keyword.control.import.else.c
343
+ contentName: comment.block.preprocessor.else-branch
344
+ end: (?=^\s*#\s*endif\b.*$)
345
+ patterns:
346
+ - include: "#disabled"
347
+ - include: "#pragma-mark"
348
+ - begin: ""
349
+ end: (?=^\s*#\s*(else|endif)\b.*$)
350
+ patterns:
351
+ - include: $base
352
+ preprocessor-rule-enabled-block:
353
+ begin: ^\s*(#(if)\s+(0*1)\b)
354
+ captures:
355
+ "1":
356
+ name: meta.preprocessor.c
357
+ "2":
358
+ name: keyword.control.import.if.c
359
+ "3":
360
+ name: constant.numeric.preprocessor.c
361
+ end: ^\s*(#\s*(endif)\b)
362
+ patterns:
363
+ - begin: ^\s*(#\s*(else)\b).*
364
+ captures:
365
+ "1":
366
+ name: meta.preprocessor.c
367
+ "2":
368
+ name: keyword.control.import.else.c
369
+ contentName: comment.block.preprocessor.else-branch.in-block
370
+ end: (?=^\s*#\s*endif\b.*$)
371
+ patterns:
372
+ - include: "#disabled"
373
+ - include: "#pragma-mark"
374
+ - begin: ""
375
+ end: (?=^\s*#\s*(else|endif)\b.*$)
376
+ patterns:
377
+ - include: "#block_innards"
378
+ preprocessor-rule-other:
379
+ begin: ^\s*(#\s*(if(n?def)?)\b.*?(?:(?=(?://|/\*))|$))
380
+ captures:
381
+ "1":
382
+ name: meta.preprocessor.c
383
+ "2":
384
+ name: keyword.control.import.c
385
+ end: ^\s*(#\s*(endif)\b).*$
386
+ patterns:
387
+ - include: $base
388
+ preprocessor-rule-other-block:
389
+ begin: ^\s*(#\s*(if(n?def)?)\b.*?(?:(?=(?://|/\*))|$))
390
+ captures:
391
+ "1":
392
+ name: meta.preprocessor.c
393
+ "2":
394
+ name: keyword.control.import.c
395
+ end: ^\s*(#\s*(endif)\b).*$
396
+ patterns:
397
+ - include: "#block_innards"
398
+ sizeof:
399
+ match: \b(sizeof)\b
400
+ name: keyword.operator.sizeof.c
401
+ string_escaped_char:
402
+ patterns:
403
+ - match: \\(\\|[abefnprtv&apos;"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2})
404
+ name: constant.character.escape.c
405
+ - match: \\.
406
+ name: invalid.illegal.unknown-escape.c
407
+ string_placeholder:
408
+ patterns:
409
+ - match: "(?x)%\n \t\t\t\t\t\t(\\d+\\$)? # field (argument #)\n \t\t\t\t\t\t[#0\\- +&apos;]* # flags\n \t\t\t\t\t\t[,;:_]? # separator character (AltiVec)\n \t\t\t\t\t\t((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n \t\t\t\t\t\t(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n \t\t\t\t\t\t(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n \t\t\t\t\t\t[diouxXDOUeEfFgGaACcSspn%] # conversion type\n \t\t\t\t\t"
410
+ name: constant.other.placeholder.c
411
+ - match: "%"
412
+ name: invalid.illegal.placeholder.c
413
+ scopeName: source.c
414
+ uuid: 25066DC2-6B1D-11D9-9D5B-000D93589AF6