factor.py 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. """
  2. pygments.lexers.factor
  3. ~~~~~~~~~~~~~~~~~~~~~~
  4. Lexers for the Factor language.
  5. :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
  6. :license: BSD, see LICENSE for details.
  7. """
  8. from pygments.lexer import RegexLexer, bygroups, default, words
  9. from pygments.token import Text, Comment, Keyword, Name, String, Number, \
  10. Whitespace, Punctuation
  11. __all__ = ['FactorLexer']
  12. class FactorLexer(RegexLexer):
  13. """
  14. Lexer for the Factor language.
  15. """
  16. name = 'Factor'
  17. url = 'http://factorcode.org'
  18. aliases = ['factor']
  19. filenames = ['*.factor']
  20. mimetypes = ['text/x-factor']
  21. version_added = '1.4'
  22. builtin_kernel = words((
  23. '-rot', '2bi', '2bi@', '2bi*', '2curry', '2dip', '2drop', '2dup', '2keep', '2nip',
  24. '2over', '2tri', '2tri@', '2tri*', '3bi', '3curry', '3dip', '3drop', '3dup', '3keep',
  25. '3tri', '4dip', '4drop', '4dup', '4keep', '<wrapper>', '=', '>boolean', 'clone',
  26. '?', '?execute', '?if', 'and', 'assert', 'assert=', 'assert?', 'bi', 'bi-curry',
  27. 'bi-curry@', 'bi-curry*', 'bi@', 'bi*', 'boa', 'boolean', 'boolean?', 'both?',
  28. 'build', 'call', 'callstack', 'callstack>array', 'callstack?', 'clear', '(clone)',
  29. 'compose', 'compose?', 'curry', 'curry?', 'datastack', 'die', 'dip', 'do', 'drop',
  30. 'dup', 'dupd', 'either?', 'eq?', 'equal?', 'execute', 'hashcode', 'hashcode*',
  31. 'identity-hashcode', 'identity-tuple', 'identity-tuple?', 'if', 'if*',
  32. 'keep', 'loop', 'most', 'new', 'nip', 'not', 'null', 'object', 'or', 'over',
  33. 'pick', 'prepose', 'retainstack', 'rot', 'same?', 'swap', 'swapd', 'throw',
  34. 'tri', 'tri-curry', 'tri-curry@', 'tri-curry*', 'tri@', 'tri*', 'tuple',
  35. 'tuple?', 'unless', 'unless*', 'until', 'when', 'when*', 'while', 'with',
  36. 'wrapper', 'wrapper?', 'xor'), suffix=r'(\s+)')
  37. builtin_assocs = words((
  38. '2cache', '<enum>', '>alist', '?at', '?of', 'assoc', 'assoc-all?',
  39. 'assoc-any?', 'assoc-clone-like', 'assoc-combine', 'assoc-diff',
  40. 'assoc-diff!', 'assoc-differ', 'assoc-each', 'assoc-empty?',
  41. 'assoc-filter', 'assoc-filter!', 'assoc-filter-as', 'assoc-find',
  42. 'assoc-hashcode', 'assoc-intersect', 'assoc-like', 'assoc-map',
  43. 'assoc-map-as', 'assoc-partition', 'assoc-refine', 'assoc-size',
  44. 'assoc-stack', 'assoc-subset?', 'assoc-union', 'assoc-union!',
  45. 'assoc=', 'assoc>map', 'assoc?', 'at', 'at+', 'at*', 'cache', 'change-at',
  46. 'clear-assoc', 'delete-at', 'delete-at*', 'enum', 'enum?', 'extract-keys',
  47. 'inc-at', 'key?', 'keys', 'map>assoc', 'maybe-set-at', 'new-assoc', 'of',
  48. 'push-at', 'rename-at', 'set-at', 'sift-keys', 'sift-values', 'substitute',
  49. 'unzip', 'value-at', 'value-at*', 'value?', 'values', 'zip'), suffix=r'(\s+)')
  50. builtin_combinators = words((
  51. '2cleave', '2cleave>quot', '3cleave', '3cleave>quot', '4cleave',
  52. '4cleave>quot', 'alist>quot', 'call-effect', 'case', 'case-find',
  53. 'case>quot', 'cleave', 'cleave>quot', 'cond', 'cond>quot', 'deep-spread>quot',
  54. 'execute-effect', 'linear-case-quot', 'no-case', 'no-case?', 'no-cond',
  55. 'no-cond?', 'recursive-hashcode', 'shallow-spread>quot', 'spread',
  56. 'to-fixed-point', 'wrong-values', 'wrong-values?'), suffix=r'(\s+)')
  57. builtin_math = words((
  58. '-', '/', '/f', '/i', '/mod', '2/', '2^', '<', '<=', '<fp-nan>', '>',
  59. '>=', '>bignum', '>fixnum', '>float', '>integer', '(all-integers?)',
  60. '(each-integer)', '(find-integer)', '*', '+', '?1+',
  61. 'abs', 'align', 'all-integers?', 'bignum', 'bignum?', 'bit?', 'bitand',
  62. 'bitnot', 'bitor', 'bits>double', 'bits>float', 'bitxor', 'complex',
  63. 'complex?', 'denominator', 'double>bits', 'each-integer', 'even?',
  64. 'find-integer', 'find-last-integer', 'fixnum', 'fixnum?', 'float',
  65. 'float>bits', 'float?', 'fp-bitwise=', 'fp-infinity?', 'fp-nan-payload',
  66. 'fp-nan?', 'fp-qnan?', 'fp-sign', 'fp-snan?', 'fp-special?',
  67. 'if-zero', 'imaginary-part', 'integer', 'integer>fixnum',
  68. 'integer>fixnum-strict', 'integer?', 'log2', 'log2-expects-positive',
  69. 'log2-expects-positive?', 'mod', 'neg', 'neg?', 'next-float',
  70. 'next-power-of-2', 'number', 'number=', 'number?', 'numerator', 'odd?',
  71. 'out-of-fixnum-range', 'out-of-fixnum-range?', 'power-of-2?',
  72. 'prev-float', 'ratio', 'ratio?', 'rational', 'rational?', 'real',
  73. 'real-part', 'real?', 'recip', 'rem', 'sgn', 'shift', 'sq', 'times',
  74. 'u<', 'u<=', 'u>', 'u>=', 'unless-zero', 'unordered?', 'when-zero',
  75. 'zero?'), suffix=r'(\s+)')
  76. builtin_sequences = words((
  77. '1sequence', '2all?', '2each', '2map', '2map-as', '2map-reduce', '2reduce',
  78. '2selector', '2sequence', '3append', '3append-as', '3each', '3map', '3map-as',
  79. '3sequence', '4sequence', '<repetition>', '<reversed>', '<slice>', '?first',
  80. '?last', '?nth', '?second', '?set-nth', 'accumulate', 'accumulate!',
  81. 'accumulate-as', 'all?', 'any?', 'append', 'append!', 'append-as',
  82. 'assert-sequence', 'assert-sequence=', 'assert-sequence?',
  83. 'binary-reduce', 'bounds-check', 'bounds-check?', 'bounds-error',
  84. 'bounds-error?', 'but-last', 'but-last-slice', 'cartesian-each',
  85. 'cartesian-map', 'cartesian-product', 'change-nth', 'check-slice',
  86. 'check-slice-error', 'clone-like', 'collapse-slice', 'collector',
  87. 'collector-for', 'concat', 'concat-as', 'copy', 'count', 'cut', 'cut-slice',
  88. 'cut*', 'delete-all', 'delete-slice', 'drop-prefix', 'each', 'each-from',
  89. 'each-index', 'empty?', 'exchange', 'filter', 'filter!', 'filter-as', 'find',
  90. 'find-from', 'find-index', 'find-index-from', 'find-last', 'find-last-from',
  91. 'first', 'first2', 'first3', 'first4', 'flip', 'follow', 'fourth', 'glue', 'halves',
  92. 'harvest', 'head', 'head-slice', 'head-slice*', 'head*', 'head?',
  93. 'if-empty', 'immutable', 'immutable-sequence', 'immutable-sequence?',
  94. 'immutable?', 'index', 'index-from', 'indices', 'infimum', 'infimum-by',
  95. 'insert-nth', 'interleave', 'iota', 'iota-tuple', 'iota-tuple?', 'join',
  96. 'join-as', 'last', 'last-index', 'last-index-from', 'length', 'lengthen',
  97. 'like', 'longer', 'longer?', 'longest', 'map', 'map!', 'map-as', 'map-find',
  98. 'map-find-last', 'map-index', 'map-integers', 'map-reduce', 'map-sum',
  99. 'max-length', 'member-eq?', 'member?', 'midpoint@', 'min-length',
  100. 'mismatch', 'move', 'new-like', 'new-resizable', 'new-sequence',
  101. 'non-negative-integer-expected', 'non-negative-integer-expected?',
  102. 'nth', 'nths', 'pad-head', 'pad-tail', 'padding', 'partition', 'pop', 'pop*',
  103. 'prefix', 'prepend', 'prepend-as', 'produce', 'produce-as', 'product', 'push',
  104. 'push-all', 'push-either', 'push-if', 'reduce', 'reduce-index', 'remove',
  105. 'remove!', 'remove-eq', 'remove-eq!', 'remove-nth', 'remove-nth!', 'repetition',
  106. 'repetition?', 'replace-slice', 'replicate', 'replicate-as', 'rest',
  107. 'rest-slice', 'reverse', 'reverse!', 'reversed', 'reversed?', 'second',
  108. 'selector', 'selector-for', 'sequence', 'sequence-hashcode', 'sequence=',
  109. 'sequence?', 'set-first', 'set-fourth', 'set-last', 'set-length', 'set-nth',
  110. 'set-second', 'set-third', 'short', 'shorten', 'shorter', 'shorter?',
  111. 'shortest', 'sift', 'slice', 'slice-error', 'slice-error?', 'slice?',
  112. 'snip', 'snip-slice', 'start', 'start*', 'subseq', 'subseq?', 'suffix',
  113. 'suffix!', 'sum', 'sum-lengths', 'supremum', 'supremum-by', 'surround', 'tail',
  114. 'tail-slice', 'tail-slice*', 'tail*', 'tail?', 'third', 'trim',
  115. 'trim-head', 'trim-head-slice', 'trim-slice', 'trim-tail', 'trim-tail-slice',
  116. 'unclip', 'unclip-last', 'unclip-last-slice', 'unclip-slice', 'unless-empty',
  117. 'virtual-exemplar', 'virtual-sequence', 'virtual-sequence?', 'virtual@',
  118. 'when-empty'), suffix=r'(\s+)')
  119. builtin_namespaces = words((
  120. '+@', 'change', 'change-global', 'counter', 'dec', 'get', 'get-global',
  121. 'global', 'inc', 'init-namespaces', 'initialize', 'is-global', 'make-assoc',
  122. 'namespace', 'namestack', 'off', 'on', 'set', 'set-global', 'set-namestack',
  123. 'toggle', 'with-global', 'with-scope', 'with-variable', 'with-variables'),
  124. suffix=r'(\s+)')
  125. builtin_arrays = words((
  126. '1array', '2array', '3array', '4array', '<array>', '>array', 'array',
  127. 'array?', 'pair', 'pair?', 'resize-array'), suffix=r'(\s+)')
  128. builtin_io = words((
  129. '(each-stream-block-slice)', '(each-stream-block)',
  130. '(stream-contents-by-block)', '(stream-contents-by-element)',
  131. '(stream-contents-by-length-or-block)',
  132. '(stream-contents-by-length)', '+byte+', '+character+',
  133. 'bad-seek-type', 'bad-seek-type?', 'bl', 'contents', 'each-block',
  134. 'each-block-size', 'each-block-slice', 'each-line', 'each-morsel',
  135. 'each-stream-block', 'each-stream-block-slice', 'each-stream-line',
  136. 'error-stream', 'flush', 'input-stream', 'input-stream?',
  137. 'invalid-read-buffer', 'invalid-read-buffer?', 'lines', 'nl',
  138. 'output-stream', 'output-stream?', 'print', 'read', 'read-into',
  139. 'read-partial', 'read-partial-into', 'read-until', 'read1', 'readln',
  140. 'seek-absolute', 'seek-absolute?', 'seek-end', 'seek-end?',
  141. 'seek-input', 'seek-output', 'seek-relative', 'seek-relative?',
  142. 'stream-bl', 'stream-contents', 'stream-contents*', 'stream-copy',
  143. 'stream-copy*', 'stream-element-type', 'stream-flush',
  144. 'stream-length', 'stream-lines', 'stream-nl', 'stream-print',
  145. 'stream-read', 'stream-read-into', 'stream-read-partial',
  146. 'stream-read-partial-into', 'stream-read-partial-unsafe',
  147. 'stream-read-unsafe', 'stream-read-until', 'stream-read1',
  148. 'stream-readln', 'stream-seek', 'stream-seekable?', 'stream-tell',
  149. 'stream-write', 'stream-write1', 'tell-input', 'tell-output',
  150. 'with-error-stream', 'with-error-stream*', 'with-error>output',
  151. 'with-input-output+error-streams',
  152. 'with-input-output+error-streams*', 'with-input-stream',
  153. 'with-input-stream*', 'with-output-stream', 'with-output-stream*',
  154. 'with-output>error', 'with-output+error-stream',
  155. 'with-output+error-stream*', 'with-streams', 'with-streams*',
  156. 'write', 'write1'), suffix=r'(\s+)')
  157. builtin_strings = words((
  158. '1string', '<string>', '>string', 'resize-string', 'string',
  159. 'string?'), suffix=r'(\s+)')
  160. builtin_vectors = words((
  161. '1vector', '<vector>', '>vector', '?push', 'vector', 'vector?'),
  162. suffix=r'(\s+)')
  163. builtin_continuations = words((
  164. '<condition>', '<continuation>', '<restart>', 'attempt-all',
  165. 'attempt-all-error', 'attempt-all-error?', 'callback-error-hook',
  166. 'callcc0', 'callcc1', 'cleanup', 'compute-restarts', 'condition',
  167. 'condition?', 'continuation', 'continuation?', 'continue',
  168. 'continue-restart', 'continue-with', 'current-continuation',
  169. 'error', 'error-continuation', 'error-in-thread', 'error-thread',
  170. 'ifcc', 'ignore-errors', 'in-callback?', 'original-error', 'recover',
  171. 'restart', 'restart?', 'restarts', 'rethrow', 'rethrow-restarts',
  172. 'return', 'return-continuation', 'thread-error-hook', 'throw-continue',
  173. 'throw-restarts', 'with-datastack', 'with-return'), suffix=r'(\s+)')
  174. tokens = {
  175. 'root': [
  176. # factor allows a file to start with a shebang
  177. (r'#!.*$', Comment.Preproc),
  178. default('base'),
  179. ],
  180. 'base': [
  181. (r'\s+', Whitespace),
  182. # defining words
  183. (r'((?:MACRO|MEMO|TYPED)?:[:]?)(\s+)(\S+)',
  184. bygroups(Keyword, Whitespace, Name.Function)),
  185. (r'(M:[:]?)(\s+)(\S+)(\s+)(\S+)',
  186. bygroups(Keyword, Whitespace, Name.Class, Whitespace,
  187. Name.Function)),
  188. (r'(C:)(\s+)(\S+)(\s+)(\S+)',
  189. bygroups(Keyword, Whitespace, Name.Function, Whitespace,
  190. Name.Class)),
  191. (r'(GENERIC:)(\s+)(\S+)',
  192. bygroups(Keyword, Whitespace, Name.Function)),
  193. (r'(HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)',
  194. bygroups(Keyword, Whitespace, Name.Function, Whitespace,
  195. Name.Function)),
  196. (r'(\()(\s)', bygroups(Name.Function, Whitespace), 'stackeffect'),
  197. (r'(;)(\s)', bygroups(Keyword, Whitespace)),
  198. # imports and namespaces
  199. (r'(USING:)(\s+)',
  200. bygroups(Keyword.Namespace, Whitespace), 'vocabs'),
  201. (r'(USE:|UNUSE:|IN:|QUALIFIED:)(\s+)(\S+)',
  202. bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
  203. (r'(QUALIFIED-WITH:)(\s+)(\S+)(\s+)(\S+)',
  204. bygroups(Keyword.Namespace, Whitespace, Name.Namespace,
  205. Whitespace, Name.Namespace)),
  206. (r'(FROM:|EXCLUDE:)(\s+)(\S+)(\s+=>\s)',
  207. bygroups(Keyword.Namespace, Whitespace, Name.Namespace,
  208. Whitespace), 'words'),
  209. (r'(RENAME:)(\s+)(\S+)(\s+)(\S+)(\s+)(=>)(\s+)(\S+)',
  210. bygroups(Keyword.Namespace, Whitespace, Name.Function, Whitespace,
  211. Name.Namespace, Whitespace, Punctuation, Whitespace,
  212. Name.Function)),
  213. (r'(ALIAS:|TYPEDEF:)(\s+)(\S+)(\s+)(\S+)',
  214. bygroups(Keyword.Namespace, Whitespace, Name.Function, Whitespace,
  215. Name.Function)),
  216. (r'(DEFER:|FORGET:|POSTPONE:)(\s+)(\S+)',
  217. bygroups(Keyword.Namespace, Whitespace, Name.Function)),
  218. # tuples and classes
  219. (r'(TUPLE:|ERROR:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)',
  220. bygroups(Keyword, Whitespace, Name.Class, Whitespace, Punctuation,
  221. Whitespace, Name.Class), 'slots'),
  222. (r'(TUPLE:|ERROR:|BUILTIN:)(\s+)(\S+)',
  223. bygroups(Keyword, Whitespace, Name.Class), 'slots'),
  224. (r'(MIXIN:|UNION:|INTERSECTION:)(\s+)(\S+)',
  225. bygroups(Keyword, Whitespace, Name.Class)),
  226. (r'(PREDICATE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)',
  227. bygroups(Keyword, Whitespace, Name.Class, Whitespace,
  228. Punctuation, Whitespace, Name.Class)),
  229. (r'(C:)(\s+)(\S+)(\s+)(\S+)',
  230. bygroups(Keyword, Whitespace, Name.Function, Whitespace, Name.Class)),
  231. (r'(INSTANCE:)(\s+)(\S+)(\s+)(\S+)',
  232. bygroups(Keyword, Whitespace, Name.Class, Whitespace, Name.Class)),
  233. (r'(SLOT:)(\s+)(\S+)', bygroups(Keyword, Whitespace, Name.Function)),
  234. (r'(SINGLETON:)(\s+)(\S+)', bygroups(Keyword, Whitespace, Name.Class)),
  235. (r'SINGLETONS:', Keyword, 'classes'),
  236. # other syntax
  237. (r'(CONSTANT:|SYMBOL:|MAIN:|HELP:)(\s+)(\S+)',
  238. bygroups(Keyword, Whitespace, Name.Function)),
  239. (r'(SYMBOLS:)(\s+)', bygroups(Keyword, Whitespace), 'words'),
  240. (r'(SYNTAX:)(\s+)', bygroups(Keyword, Whitespace)),
  241. (r'(ALIEN:)(\s+)', bygroups(Keyword, Whitespace)),
  242. (r'(STRUCT:)(\s+)(\S+)', bygroups(Keyword, Whitespace, Name.Class)),
  243. (r'(FUNCTION:)(\s+)'
  244. r'(\S+)(\s+)(\S+)(\s+)'
  245. r'(\()(\s+)([^)]+)(\))(\s)',
  246. bygroups(Keyword.Namespace, Whitespace,
  247. Text, Whitespace, Name.Function, Whitespace,
  248. Punctuation, Whitespace, Text, Punctuation, Whitespace)),
  249. (r'(FUNCTION-ALIAS:)(\s+)'
  250. r'(\S+)(\s+)(\S+)(\s+)'
  251. r'(\S+)(\s+)'
  252. r'(\()(\s+)([^)]+)(\))(\s)',
  253. bygroups(Keyword.Namespace, Whitespace,
  254. Text, Whitespace, Name.Function, Whitespace,
  255. Name.Function, Whitespace,
  256. Punctuation, Whitespace, Text, Punctuation, Whitespace)),
  257. # vocab.private
  258. (r'(<PRIVATE|PRIVATE>)(\s)', bygroups(Keyword.Namespace, Whitespace)),
  259. # strings
  260. (r'"""\s(?:.|\n)*?\s"""', String),
  261. (r'"(?:\\\\|\\"|[^"])*"', String),
  262. (r'(\S+")(\s+)((?:\\\\|\\"|[^"])*")',
  263. bygroups(String, Whitespace, String)),
  264. (r'(CHAR:)(\s+)(\\[\\abfnrstv]|[^\\]\S*)(\s)',
  265. bygroups(String.Char, Whitespace, String.Char, Whitespace)),
  266. # comments
  267. (r'!\s+.*$', Comment),
  268. (r'#!\s+.*$', Comment),
  269. (r'/\*\s+(?:.|\n)*?\s\*/', Comment),
  270. # boolean constants
  271. (r'[tf]\b', Name.Constant),
  272. # symbols and literals
  273. (r'[\\$]\s+\S+', Name.Constant),
  274. (r'M\\\s+\S+\s+\S+', Name.Constant),
  275. # numbers
  276. (r'[+-]?(?:[\d,]*\d)?\.(?:\d([\d,]*\d)?)?(?:[eE][+-]?\d+)?\s', Number),
  277. (r'[+-]?\d(?:[\d,]*\d)?(?:[eE][+-]?\d+)?\s', Number),
  278. (r'0x[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s', Number),
  279. (r'NAN:\s+[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s', Number),
  280. (r'0b[01]+\s', Number.Bin),
  281. (r'0o[0-7]+\s', Number.Oct),
  282. (r'(?:\d([\d,]*\d)?)?\+\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s', Number),
  283. (r'(?:\-\d([\d,]*\d)?)?\-\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s', Number),
  284. # keywords
  285. (r'(?:deprecated|final|foldable|flushable|inline|recursive)\s',
  286. Keyword),
  287. # builtins
  288. (builtin_kernel, bygroups(Name.Builtin, Whitespace)),
  289. (builtin_assocs, bygroups(Name.Builtin, Whitespace)),
  290. (builtin_combinators, bygroups(Name.Builtin, Whitespace)),
  291. (builtin_math, bygroups(Name.Builtin, Whitespace)),
  292. (builtin_sequences, bygroups(Name.Builtin, Whitespace)),
  293. (builtin_namespaces, bygroups(Name.Builtin, Whitespace)),
  294. (builtin_arrays, bygroups(Name.Builtin, Whitespace)),
  295. (builtin_io, bygroups(Name.Builtin, Whitespace)),
  296. (builtin_strings, bygroups(Name.Builtin, Whitespace)),
  297. (builtin_vectors, bygroups(Name.Builtin, Whitespace)),
  298. (builtin_continuations, bygroups(Name.Builtin, Whitespace)),
  299. # everything else is text
  300. (r'\S+', Text),
  301. ],
  302. 'stackeffect': [
  303. (r'\s+', Whitespace),
  304. (r'(\()(\s+)', bygroups(Name.Function, Whitespace), 'stackeffect'),
  305. (r'(\))(\s+)', bygroups(Name.Function, Whitespace), '#pop'),
  306. (r'(--)(\s+)', bygroups(Name.Function, Whitespace)),
  307. (r'\S+', Name.Variable),
  308. ],
  309. 'slots': [
  310. (r'\s+', Whitespace),
  311. (r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
  312. (r'(\{)(\s+)(\S+)(\s+)([^}]+)(\s+)(\})(\s+)',
  313. bygroups(Text, Whitespace, Name.Variable, Whitespace,
  314. Text, Whitespace, Text, Whitespace)),
  315. (r'\S+', Name.Variable),
  316. ],
  317. 'vocabs': [
  318. (r'\s+', Whitespace),
  319. (r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
  320. (r'\S+', Name.Namespace),
  321. ],
  322. 'classes': [
  323. (r'\s+', Whitespace),
  324. (r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
  325. (r'\S+', Name.Class),
  326. ],
  327. 'words': [
  328. (r'\s+', Whitespace),
  329. (r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
  330. (r'\S+', Name.Function),
  331. ],
  332. }