rugments 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +52 -0
  3. data/README.md +195 -0
  4. data/bin/rugmentize +6 -0
  5. data/lib/rugments/cli.rb +357 -0
  6. data/lib/rugments/formatter.rb +29 -0
  7. data/lib/rugments/formatters/html.rb +142 -0
  8. data/lib/rugments/formatters/null.rb +17 -0
  9. data/lib/rugments/formatters/terminal256.rb +174 -0
  10. data/lib/rugments/lexer.rb +431 -0
  11. data/lib/rugments/lexers/apache/keywords.yml +453 -0
  12. data/lib/rugments/lexers/apache.rb +67 -0
  13. data/lib/rugments/lexers/apple_script.rb +366 -0
  14. data/lib/rugments/lexers/c.rb +210 -0
  15. data/lib/rugments/lexers/clojure.rb +109 -0
  16. data/lib/rugments/lexers/coffeescript.rb +172 -0
  17. data/lib/rugments/lexers/common_lisp.rb +343 -0
  18. data/lib/rugments/lexers/conf.rb +22 -0
  19. data/lib/rugments/lexers/cpp.rb +63 -0
  20. data/lib/rugments/lexers/csharp.rb +85 -0
  21. data/lib/rugments/lexers/css.rb +269 -0
  22. data/lib/rugments/lexers/dart.rb +102 -0
  23. data/lib/rugments/lexers/diff.rb +39 -0
  24. data/lib/rugments/lexers/elixir.rb +105 -0
  25. data/lib/rugments/lexers/erb.rb +54 -0
  26. data/lib/rugments/lexers/erlang.rb +116 -0
  27. data/lib/rugments/lexers/factor.rb +300 -0
  28. data/lib/rugments/lexers/gherkin/keywords.rb +13 -0
  29. data/lib/rugments/lexers/gherkin.rb +135 -0
  30. data/lib/rugments/lexers/go.rb +176 -0
  31. data/lib/rugments/lexers/groovy.rb +102 -0
  32. data/lib/rugments/lexers/haml.rb +226 -0
  33. data/lib/rugments/lexers/handlebars.rb +77 -0
  34. data/lib/rugments/lexers/haskell.rb +181 -0
  35. data/lib/rugments/lexers/html.rb +92 -0
  36. data/lib/rugments/lexers/http.rb +78 -0
  37. data/lib/rugments/lexers/ini.rb +55 -0
  38. data/lib/rugments/lexers/io.rb +66 -0
  39. data/lib/rugments/lexers/java.rb +74 -0
  40. data/lib/rugments/lexers/javascript.rb +258 -0
  41. data/lib/rugments/lexers/literate_coffeescript.rb +31 -0
  42. data/lib/rugments/lexers/literate_haskell.rb +34 -0
  43. data/lib/rugments/lexers/llvm.rb +82 -0
  44. data/lib/rugments/lexers/lua/builtins.rb +21 -0
  45. data/lib/rugments/lexers/lua.rb +120 -0
  46. data/lib/rugments/lexers/make.rb +114 -0
  47. data/lib/rugments/lexers/markdown.rb +151 -0
  48. data/lib/rugments/lexers/matlab/builtins.rb +10 -0
  49. data/lib/rugments/lexers/matlab.rb +70 -0
  50. data/lib/rugments/lexers/moonscript.rb +108 -0
  51. data/lib/rugments/lexers/nginx.rb +69 -0
  52. data/lib/rugments/lexers/nim.rb +149 -0
  53. data/lib/rugments/lexers/objective_c.rb +188 -0
  54. data/lib/rugments/lexers/ocaml.rb +109 -0
  55. data/lib/rugments/lexers/perl.rb +195 -0
  56. data/lib/rugments/lexers/php/builtins.rb +192 -0
  57. data/lib/rugments/lexers/php.rb +162 -0
  58. data/lib/rugments/lexers/plain_text.rb +23 -0
  59. data/lib/rugments/lexers/prolog.rb +62 -0
  60. data/lib/rugments/lexers/properties.rb +53 -0
  61. data/lib/rugments/lexers/puppet.rb +126 -0
  62. data/lib/rugments/lexers/python.rb +225 -0
  63. data/lib/rugments/lexers/qml.rb +70 -0
  64. data/lib/rugments/lexers/r.rb +55 -0
  65. data/lib/rugments/lexers/racket.rb +540 -0
  66. data/lib/rugments/lexers/ruby.rb +413 -0
  67. data/lib/rugments/lexers/rust.rb +188 -0
  68. data/lib/rugments/lexers/sass/common.rb +172 -0
  69. data/lib/rugments/lexers/sass.rb +72 -0
  70. data/lib/rugments/lexers/scala.rb +140 -0
  71. data/lib/rugments/lexers/scheme.rb +109 -0
  72. data/lib/rugments/lexers/scss.rb +32 -0
  73. data/lib/rugments/lexers/sed.rb +167 -0
  74. data/lib/rugments/lexers/shell.rb +150 -0
  75. data/lib/rugments/lexers/slim.rb +222 -0
  76. data/lib/rugments/lexers/smalltalk.rb +114 -0
  77. data/lib/rugments/lexers/sml.rb +345 -0
  78. data/lib/rugments/lexers/sql.rb +138 -0
  79. data/lib/rugments/lexers/swift.rb +153 -0
  80. data/lib/rugments/lexers/tcl.rb +189 -0
  81. data/lib/rugments/lexers/tex.rb +70 -0
  82. data/lib/rugments/lexers/toml.rb +68 -0
  83. data/lib/rugments/lexers/vb.rb +162 -0
  84. data/lib/rugments/lexers/viml/keywords.rb +11 -0
  85. data/lib/rugments/lexers/viml.rb +99 -0
  86. data/lib/rugments/lexers/xml.rb +57 -0
  87. data/lib/rugments/lexers/yaml.rb +362 -0
  88. data/lib/rugments/plugins/redcarpet.rb +28 -0
  89. data/lib/rugments/regex_lexer.rb +432 -0
  90. data/lib/rugments/template_lexer.rb +23 -0
  91. data/lib/rugments/text_analyzer.rb +46 -0
  92. data/lib/rugments/theme.rb +202 -0
  93. data/lib/rugments/themes/base16.rb +128 -0
  94. data/lib/rugments/themes/colorful.rb +65 -0
  95. data/lib/rugments/themes/github.rb +69 -0
  96. data/lib/rugments/themes/monokai.rb +88 -0
  97. data/lib/rugments/themes/monokai_sublime.rb +89 -0
  98. data/lib/rugments/themes/thankful_eyes.rb +69 -0
  99. data/lib/rugments/token.rb +180 -0
  100. data/lib/rugments/util.rb +99 -0
  101. data/lib/rugments/version.rb +3 -0
  102. data/lib/rugments.rb +33 -0
  103. metadata +149 -0
@@ -0,0 +1,453 @@
1
+ :sections:
2
+ - "DirectoryMatch"
3
+ - "Directory"
4
+ - "FilesMatch"
5
+ - "Files"
6
+ - "IfDefine"
7
+ - "IfModule"
8
+ - "LimitExcept"
9
+ - "Limit"
10
+ - "LocationMatch"
11
+ - "Location"
12
+ - "ProxyMatch"
13
+ - "Proxy"
14
+ - "VirtualHost"
15
+
16
+ :directives:
17
+ - "AcceptMutex"
18
+ - "AcceptPathInfo"
19
+ - "AccessConfig"
20
+ - "AccessFileName"
21
+ - "Action"
22
+ - "AddAlt"
23
+ - "AddAltByEncoding"
24
+ - "AddAltByType"
25
+ - "AddCharset"
26
+ - "AddDefaultCharset"
27
+ - "AddDescription"
28
+ - "AddEncoding"
29
+ - "AddHandler"
30
+ - "AddIcon"
31
+ - "AddIconByEncoding"
32
+ - "AddIconByType"
33
+ - "AddInputFilter"
34
+ - "AddLanguage"
35
+ - "AddModule"
36
+ - "AddModuleInfo"
37
+ - "AddOutputFilter"
38
+ - "AddOutputFilterByType"
39
+ - "AddType"
40
+ - "AgentLog"
41
+ - "Alias"
42
+ - "AliasMatch"
43
+ - "Allow from"
44
+ - "Allow"
45
+ - "AllowCONNECT"
46
+ - "AllowEncodedSlashes"
47
+ - "AllowOverride"
48
+ - "Anonymous"
49
+ - "Anonymous_Authoritative"
50
+ - "Anonymous_LogEmail"
51
+ - "Anonymous_MustGiveEmail"
52
+ - "Anonymous_NoUserID"
53
+ - "Anonymous_VerifyEmail"
54
+ - "AssignUserID"
55
+ - "AuthAuthoritative"
56
+ - "AuthDBAuthoritative"
57
+ - "AuthDBGroupFile"
58
+ - "AuthDBMAuthoritative"
59
+ - "AuthDBMGroupFile"
60
+ - "AuthDBMType"
61
+ - "AuthDBMUserFile"
62
+ - "AuthDBUserFile"
63
+ - "AuthDigestAlgorithm"
64
+ - "AuthDigestDomain"
65
+ - "AuthDigestFile"
66
+ - "AuthDigestGroupFile"
67
+ - "AuthDigestNcCheck"
68
+ - "AuthDigestNonceFormat"
69
+ - "AuthDigestNonceLifetime"
70
+ - "AuthDigestQop"
71
+ - "AuthDigestShmemSize"
72
+ - "AuthGroupFile"
73
+ - "AuthLDAPAuthoritative"
74
+ - "AuthLDAPBindDN"
75
+ - "AuthLDAPBindPassword"
76
+ - "AuthLDAPCharsetConfig"
77
+ - "AuthLDAPCompareDNOnServer"
78
+ - "AuthLDAPDereferenceAliases"
79
+ - "AuthLDAPEnabled"
80
+ - "AuthLDAPFrontPageHack"
81
+ - "AuthLDAPGroupAttribute"
82
+ - "AuthLDAPGroupAttributeIsDN"
83
+ - "AuthLDAPRemoteUserIsDN"
84
+ - "AuthLDAPUrl"
85
+ - "AuthName"
86
+ - "AuthType"
87
+ - "AuthUserFile"
88
+ - "BS2000Account"
89
+ - "BindAddress"
90
+ - "BrowserMatch"
91
+ - "BrowserMatchNoCase"
92
+ - "CGIMapExtension"
93
+ - "CacheDefaultExpire"
94
+ - "CacheDirLength"
95
+ - "CacheDirLevels"
96
+ - "CacheDisable"
97
+ - "CacheEnable"
98
+ - "CacheExpiryCheck"
99
+ - "CacheFile"
100
+ - "CacheForceCompletion"
101
+ - "CacheGcClean"
102
+ - "CacheGcDaily"
103
+ - "CacheGcInterval"
104
+ - "CacheGcMemUsage"
105
+ - "CacheGcUnused"
106
+ - "CacheIgnoreCacheControl"
107
+ - "CacheIgnoreNoLastMod"
108
+ - "CacheLastModifiedFactor"
109
+ - "CacheMaxExpire"
110
+ - "CacheMaxFileSize"
111
+ - "CacheMinFileSize"
112
+ - "CacheNegotiatedDocs"
113
+ - "CacheRoot"
114
+ - "CacheSize"
115
+ - "CacheTimeMargin"
116
+ - "CharsetDefault"
117
+ - "CharsetOptions"
118
+ - "CharsetSourceEnc"
119
+ - "CheckSpelling"
120
+ - "ChildPerUserID"
121
+ - "ClearModuleList"
122
+ - "ContentDigest"
123
+ - "CookieDomain"
124
+ - "CookieExpires"
125
+ - "CookieLog"
126
+ - "CookieName"
127
+ - "CookieStyle"
128
+ - "CookieTracking"
129
+ - "CoreDumpDirectory"
130
+ - "CustomLog"
131
+ - "Dav"
132
+ - "DavDepthInfinity"
133
+ - "DavLockDB"
134
+ - "DavMinTimeout"
135
+ - "DefaultIcon"
136
+ - "DefaultLanguage"
137
+ - "DefaultMode"
138
+ - "DefaultType"
139
+ - "DeflateBufferSize"
140
+ - "DeflateCompressionLevel"
141
+ - "DeflateFilterNote"
142
+ - "DeflateMemLevel"
143
+ - "DeflateWindowSize"
144
+ - "Deny"
145
+ - "DirectoryIndex"
146
+ - "DirectorySlash"
147
+ - "DocTitle"
148
+ - "DocTrailer"
149
+ - "DocumentRoot"
150
+ - "EnableExceptionHook"
151
+ - "EnableMMAP"
152
+ - "EnableSendfile"
153
+ - "ErrorDocument"
154
+ - "ErrorLog"
155
+ - "Example"
156
+ - "ExpiresActive"
157
+ - "ExpiresByType"
158
+ - "ExpiresDefault"
159
+ - "ExtFilterDefine"
160
+ - "ExtFilterOptions"
161
+ - "ExtendedStatus"
162
+ - "FancyIndexing"
163
+ - "FileETag"
164
+ - "ForceLanguagePriority"
165
+ - "ForceType"
166
+ - "ForensicLog"
167
+ - "Group"
168
+ - "HTMLDir"
169
+ - "HTTPLogFile"
170
+ - "HeadPrefix"
171
+ - "HeadSuffix"
172
+ - "Header"
173
+ - "HeaderName"
174
+ - "HideSys"
175
+ - "HideURL"
176
+ - "HostNameLookups"
177
+ - "HostnameLookups"
178
+ - "ISAPIAppendLogToErrors"
179
+ - "ISAPIAppendLogToQuery"
180
+ - "ISAPICacheFile"
181
+ - "ISAPIFakeAsync"
182
+ - "ISAPILogNotSupported"
183
+ - "ISAPIReadAheadBuffer"
184
+ - "IdentityCheck"
185
+ - "ImapBase"
186
+ - "ImapDefault"
187
+ - "ImapMenu"
188
+ - "Include"
189
+ - "IndexIgnore"
190
+ - "IndexOptions"
191
+ - "IndexOrderDefault"
192
+ - "KeepAlive"
193
+ - "KeepAliveTimeout"
194
+ - "LDAPCacheEntries"
195
+ - "LDAPCacheTTL"
196
+ - "LDAPOpCacheEntries"
197
+ - "LDAPOpCacheTTL"
198
+ - "LDAPSharedCacheFile"
199
+ - "LDAPSharedCacheSize"
200
+ - "LDAPTrustedCA"
201
+ - "LDAPTrustedCAType"
202
+ - "LanguagePriority"
203
+ - "LastURLs"
204
+ - "LimitInternalRecursion"
205
+ - "LimitRequestBody"
206
+ - "LimitRequestFields"
207
+ - "LimitRequestFieldsize"
208
+ - "LimitRequestLine"
209
+ - "LimitXMLRequestBody"
210
+ - "Listen"
211
+ - "ListenBacklog"
212
+ - "LoadFile"
213
+ - "LoadModule"
214
+ - "LockFile"
215
+ - "LogFormat"
216
+ - "LogLevel"
217
+ - "MCacheMaxObjectCount"
218
+ - "MCacheMaxObjectSize"
219
+ - "MCacheMaxStreamingBuffer"
220
+ - "MCacheMinObjectSize"
221
+ - "MCacheRemovalAlgorithm"
222
+ - "MCacheSize"
223
+ - "MMapFile"
224
+ - "MaxClients"
225
+ - "MaxKeepAliveRequests"
226
+ - "MaxMemFree"
227
+ - "MaxRequestsPerChild"
228
+ - "MaxRequestsPerThread"
229
+ - "MaxSpareServers"
230
+ - "MaxSpareThreads"
231
+ - "MaxThreads"
232
+ - "MaxThreadsPerChild"
233
+ - "MetaDir"
234
+ - "MetaFiles"
235
+ - "MetaSuffix"
236
+ - "MimeMagicFile"
237
+ - "MinSpareServers"
238
+ - "MinSpareThreads"
239
+ - "ModMimeUsePathInfo"
240
+ - "MultiviewsMatch"
241
+ - "NWSSLTrustedCerts"
242
+ - "NWSSLUpgradeable"
243
+ - "NameVirtualHost"
244
+ - "NoCache"
245
+ - "NoProxy"
246
+ - "NumServers"
247
+ - "Options"
248
+ - "Order"
249
+ - "PassEnv"
250
+ - "PidFile"
251
+ - "Port"
252
+ - "PrivateDir"
253
+ - "ProtocolEcho"
254
+ - "ProxyBadHeader"
255
+ - "ProxyBlock"
256
+ - "ProxyDomain"
257
+ - "ProxyErrorOverride"
258
+ - "ProxyIOBufferSize"
259
+ - "ProxyMaxForwards"
260
+ - "ProxyPass"
261
+ - "ProxyPassReverse"
262
+ - "ProxyPreserveHost"
263
+ - "ProxyReceiveBufferSize"
264
+ - "ProxyRemote"
265
+ - "ProxyRemoteMatch"
266
+ - "ProxyRequests"
267
+ - "ProxyTimeout"
268
+ - "ProxyVia"
269
+ - "RLimitCPU"
270
+ - "RLimitMEM"
271
+ - "RLimitNPROC"
272
+ - "ReadmeName"
273
+ - "Redirect"
274
+ - "RedirectMatch"
275
+ - "RedirectPermanent"
276
+ - "RedirectTemp"
277
+ - "RefererIgnore"
278
+ - "RefererLog"
279
+ - "RemoveCharset"
280
+ - "RemoveEncoding"
281
+ - "RemoveHandler"
282
+ - "RemoveInputFilter"
283
+ - "RemoveLanguage"
284
+ - "RemoveOutputFilter"
285
+ - "RemoveType"
286
+ - "RequestHeader"
287
+ - "Require"
288
+ - "ResourceConfig"
289
+ - "RewriteBase"
290
+ - "RewriteCond"
291
+ - "RewriteEngine"
292
+ - "RewriteLock"
293
+ - "RewriteLog"
294
+ - "RewriteLogLevel"
295
+ - "RewriteMap"
296
+ - "RewriteOptions"
297
+ - "RewriteRule"
298
+ - "SSIEndTag"
299
+ - "SSIErrorMsg"
300
+ - "SSIStartTag"
301
+ - "SSITimeFormat"
302
+ - "SSIUndefinedEcho"
303
+ - "SSLCACertificateFile"
304
+ - "SSLCACertificatePath"
305
+ - "SSLCARevocationFile"
306
+ - "SSLCARevocationPath"
307
+ - "SSLCertificateChainFile"
308
+ - "SSLCertificateFile"
309
+ - "SSLCertificateKeyFile"
310
+ - "SSLCipherSuite"
311
+ - "SSLEngine"
312
+ - "SSLMutex"
313
+ - "SSLOptions"
314
+ - "SSLPassPhraseDialog"
315
+ - "SSLProtocol"
316
+ - "SSLProxyCACertificateFile"
317
+ - "SSLProxyCACertificatePath"
318
+ - "SSLProxyCARevocationFile"
319
+ - "SSLProxyCARevocationPath"
320
+ - "SSLProxyCipherSuite"
321
+ - "SSLProxyEngine"
322
+ - "SSLProxyMachineCertificateFile"
323
+ - "SSLProxyMachineCertificatePath"
324
+ - "SSLProxyProtocol"
325
+ - "SSLProxyVerify"
326
+ - "SSLProxyVerifyDepth"
327
+ - "SSLRandomSeed"
328
+ - "SSLRequire"
329
+ - "SSLRequireSSL"
330
+ - "SSLSessionCache"
331
+ - "SSLSessionCacheTimeout"
332
+ - "SSLVerifyClient"
333
+ - "SSLVerifyDepth"
334
+ - "Satisfy"
335
+ - "ScoreBoardFile"
336
+ - "Script"
337
+ - "ScriptAlias"
338
+ - "ScriptAliasMatch"
339
+ - "ScriptInterpreterSource"
340
+ - "ScriptLog"
341
+ - "ScriptLogBuffer"
342
+ - "ScriptLogLength"
343
+ - "ScriptSock"
344
+ - "SecureListen"
345
+ - "SendBufferSize"
346
+ - "ServerAdmin"
347
+ - "ServerAlias"
348
+ - "ServerLimit"
349
+ - "ServerName"
350
+ - "ServerPath"
351
+ - "ServerRoot"
352
+ - "ServerSignature"
353
+ - "ServerTokens"
354
+ - "ServerType"
355
+ - "SetEnv"
356
+ - "SetEnvIf"
357
+ - "SetEnvIfNoCase"
358
+ - "SetHandler"
359
+ - "SetInputFilter"
360
+ - "SetOutputFilter"
361
+ - "StartServers"
362
+ - "StartThreads"
363
+ - "SuexecUserGroup"
364
+ - "ThreadLimit"
365
+ - "ThreadStackSize"
366
+ - "ThreadsPerChild"
367
+ - "TimeOut"
368
+ - "TopSites"
369
+ - "TopURLs"
370
+ - "TransferLog"
371
+ - "TypesConfig"
372
+ - "UnsetEnv"
373
+ - "UseCanonicalName"
374
+ - "User"
375
+ - "UserDir"
376
+ - "VirtualDocumentRoot"
377
+ - "VirtualDocumentRootIP"
378
+ - "VirtualScriptAlias"
379
+ - "VirtualScriptAliasIP"
380
+ - "Win32DisableAcceptEx"
381
+ - "XBitHack"
382
+ - "deny"
383
+ - "order"
384
+ - "require"
385
+ :values:
386
+ - "All"
387
+ - "AuthConfig"
388
+ - "Basic"
389
+ - "CONNECT"
390
+ - "DELETE"
391
+ - "Digest"
392
+ - "ExecCGI"
393
+ - "FancyIndexing"
394
+ - "FileInfo"
395
+ - "FollowSymLinks"
396
+ - "Full"
397
+ - "GET"
398
+ - "IconsAreLinks"
399
+ - "Includes"
400
+ - "IncludesNOEXEC"
401
+ - "Indexes"
402
+ - "Limit"
403
+ - "Minimal"
404
+ - "MultiViews"
405
+ - "None"
406
+ - "OPTIONS"
407
+ - "OS"
408
+ - "Options"
409
+ - "Options"
410
+ - "POST"
411
+ - "PUT"
412
+ - "ScanHTMLTitles"
413
+ - "SuppressDescription"
414
+ - "SuppressLastModified"
415
+ - "SuppressSize"
416
+ - "SymLinksIfOwnerMatch"
417
+ - "URL"
418
+ - "add"
419
+ - "allow"
420
+ - "any"
421
+ - "append"
422
+ - "deny"
423
+ - "double"
424
+ - "downgrade-1.0"
425
+ - "email"
426
+ - "env"
427
+ - "error"
428
+ - "force-response-1.0"
429
+ - "formatted"
430
+ - "from"
431
+ - "full"
432
+ - "gone"
433
+ - "group"
434
+ - "inetd"
435
+ - "inherit"
436
+ - "map"
437
+ - "mutual-failure"
438
+ - "nocontent"
439
+ - "nokeepalive"
440
+ - "none"
441
+ - "off"
442
+ - "on"
443
+ - "permanent"
444
+ - "referer"
445
+ - "seeother"
446
+ - "semi-formatted"
447
+ - "set"
448
+ - "standalone"
449
+ - "temporary"
450
+ - "unformatted"
451
+ - "unset"
452
+ - "user"
453
+ - "valid-user"
@@ -0,0 +1,67 @@
1
+ require 'yaml'
2
+
3
+ module Rugments
4
+ module Lexers
5
+ class Apache < RegexLexer
6
+ title 'Apache'
7
+ desc 'configuration files for Apache web server'
8
+ tag 'apache'
9
+ mimetypes 'text/x-httpd-conf', 'text/x-apache-conf'
10
+ filenames '.htaccess', 'httpd.conf'
11
+
12
+ class << self
13
+ attr_reader :keywords
14
+ end
15
+ # Load Apache keywords from separate YML file
16
+ @keywords = ::YAML.load(File.open(Pathname.new(__FILE__).dirname.join('apache/keywords.yml')))
17
+
18
+ def name_for_token(token)
19
+ if self.class.keywords[:sections].include? token
20
+ Name::Class
21
+ elsif self.class.keywords[:directives].include? token
22
+ Name::Label
23
+ elsif self.class.keywords[:values].include? token
24
+ Literal::String::Symbol
25
+ end
26
+ end
27
+
28
+ state :whitespace do
29
+ rule /\#.*?\n/, Comment
30
+ rule /[\s\n]+/m, Text
31
+ end
32
+
33
+ state :root do
34
+ mixin :whitespace
35
+
36
+ rule /(<\/?)(\w+)/ do |m|
37
+ groups Punctuation, name_for_token(m[2])
38
+ push :section
39
+ end
40
+
41
+ rule /\w+/ do |m|
42
+ token name_for_token(m[0])
43
+ push :directive
44
+ end
45
+ end
46
+
47
+ state :section do
48
+ mixin :whitespace
49
+
50
+ # Match section arguments
51
+ rule /([^>]+)?(>\n)/ do |_m|
52
+ groups Literal::String::Regex, Punctuation
53
+ pop!
54
+ end
55
+ end
56
+
57
+ state :directive do
58
+ # Match value literals and other directive arguments
59
+ rule /(\w+)*(.*?(\n|$))/ do |m|
60
+ token name_for_token(m[1]), m[1]
61
+ token Text, m[2]
62
+ pop!
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end