rugments 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +52 -0
- data/README.md +195 -0
- data/bin/rugmentize +6 -0
- data/lib/rugments/cli.rb +357 -0
- data/lib/rugments/formatter.rb +29 -0
- data/lib/rugments/formatters/html.rb +142 -0
- data/lib/rugments/formatters/null.rb +17 -0
- data/lib/rugments/formatters/terminal256.rb +174 -0
- data/lib/rugments/lexer.rb +431 -0
- data/lib/rugments/lexers/apache/keywords.yml +453 -0
- data/lib/rugments/lexers/apache.rb +67 -0
- data/lib/rugments/lexers/apple_script.rb +366 -0
- data/lib/rugments/lexers/c.rb +210 -0
- data/lib/rugments/lexers/clojure.rb +109 -0
- data/lib/rugments/lexers/coffeescript.rb +172 -0
- data/lib/rugments/lexers/common_lisp.rb +343 -0
- data/lib/rugments/lexers/conf.rb +22 -0
- data/lib/rugments/lexers/cpp.rb +63 -0
- data/lib/rugments/lexers/csharp.rb +85 -0
- data/lib/rugments/lexers/css.rb +269 -0
- data/lib/rugments/lexers/dart.rb +102 -0
- data/lib/rugments/lexers/diff.rb +39 -0
- data/lib/rugments/lexers/elixir.rb +105 -0
- data/lib/rugments/lexers/erb.rb +54 -0
- data/lib/rugments/lexers/erlang.rb +116 -0
- data/lib/rugments/lexers/factor.rb +300 -0
- data/lib/rugments/lexers/gherkin/keywords.rb +13 -0
- data/lib/rugments/lexers/gherkin.rb +135 -0
- data/lib/rugments/lexers/go.rb +176 -0
- data/lib/rugments/lexers/groovy.rb +102 -0
- data/lib/rugments/lexers/haml.rb +226 -0
- data/lib/rugments/lexers/handlebars.rb +77 -0
- data/lib/rugments/lexers/haskell.rb +181 -0
- data/lib/rugments/lexers/html.rb +92 -0
- data/lib/rugments/lexers/http.rb +78 -0
- data/lib/rugments/lexers/ini.rb +55 -0
- data/lib/rugments/lexers/io.rb +66 -0
- data/lib/rugments/lexers/java.rb +74 -0
- data/lib/rugments/lexers/javascript.rb +258 -0
- data/lib/rugments/lexers/literate_coffeescript.rb +31 -0
- data/lib/rugments/lexers/literate_haskell.rb +34 -0
- data/lib/rugments/lexers/llvm.rb +82 -0
- data/lib/rugments/lexers/lua/builtins.rb +21 -0
- data/lib/rugments/lexers/lua.rb +120 -0
- data/lib/rugments/lexers/make.rb +114 -0
- data/lib/rugments/lexers/markdown.rb +151 -0
- data/lib/rugments/lexers/matlab/builtins.rb +10 -0
- data/lib/rugments/lexers/matlab.rb +70 -0
- data/lib/rugments/lexers/moonscript.rb +108 -0
- data/lib/rugments/lexers/nginx.rb +69 -0
- data/lib/rugments/lexers/nim.rb +149 -0
- data/lib/rugments/lexers/objective_c.rb +188 -0
- data/lib/rugments/lexers/ocaml.rb +109 -0
- data/lib/rugments/lexers/perl.rb +195 -0
- data/lib/rugments/lexers/php/builtins.rb +192 -0
- data/lib/rugments/lexers/php.rb +162 -0
- data/lib/rugments/lexers/plain_text.rb +23 -0
- data/lib/rugments/lexers/prolog.rb +62 -0
- data/lib/rugments/lexers/properties.rb +53 -0
- data/lib/rugments/lexers/puppet.rb +126 -0
- data/lib/rugments/lexers/python.rb +225 -0
- data/lib/rugments/lexers/qml.rb +70 -0
- data/lib/rugments/lexers/r.rb +55 -0
- data/lib/rugments/lexers/racket.rb +540 -0
- data/lib/rugments/lexers/ruby.rb +413 -0
- data/lib/rugments/lexers/rust.rb +188 -0
- data/lib/rugments/lexers/sass/common.rb +172 -0
- data/lib/rugments/lexers/sass.rb +72 -0
- data/lib/rugments/lexers/scala.rb +140 -0
- data/lib/rugments/lexers/scheme.rb +109 -0
- data/lib/rugments/lexers/scss.rb +32 -0
- data/lib/rugments/lexers/sed.rb +167 -0
- data/lib/rugments/lexers/shell.rb +150 -0
- data/lib/rugments/lexers/slim.rb +222 -0
- data/lib/rugments/lexers/smalltalk.rb +114 -0
- data/lib/rugments/lexers/sml.rb +345 -0
- data/lib/rugments/lexers/sql.rb +138 -0
- data/lib/rugments/lexers/swift.rb +153 -0
- data/lib/rugments/lexers/tcl.rb +189 -0
- data/lib/rugments/lexers/tex.rb +70 -0
- data/lib/rugments/lexers/toml.rb +68 -0
- data/lib/rugments/lexers/vb.rb +162 -0
- data/lib/rugments/lexers/viml/keywords.rb +11 -0
- data/lib/rugments/lexers/viml.rb +99 -0
- data/lib/rugments/lexers/xml.rb +57 -0
- data/lib/rugments/lexers/yaml.rb +362 -0
- data/lib/rugments/plugins/redcarpet.rb +28 -0
- data/lib/rugments/regex_lexer.rb +432 -0
- data/lib/rugments/template_lexer.rb +23 -0
- data/lib/rugments/text_analyzer.rb +46 -0
- data/lib/rugments/theme.rb +202 -0
- data/lib/rugments/themes/base16.rb +128 -0
- data/lib/rugments/themes/colorful.rb +65 -0
- data/lib/rugments/themes/github.rb +69 -0
- data/lib/rugments/themes/monokai.rb +88 -0
- data/lib/rugments/themes/monokai_sublime.rb +89 -0
- data/lib/rugments/themes/thankful_eyes.rb +69 -0
- data/lib/rugments/token.rb +180 -0
- data/lib/rugments/util.rb +99 -0
- data/lib/rugments/version.rb +3 -0
- data/lib/rugments.rb +33 -0
- metadata +149 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
module Rugments
|
2
|
+
module Lexers
|
3
|
+
class ERB < TemplateLexer
|
4
|
+
title 'ERB'
|
5
|
+
desc 'Embedded ruby template files'
|
6
|
+
|
7
|
+
tag 'erb'
|
8
|
+
aliases 'eruby', 'rhtml'
|
9
|
+
|
10
|
+
filenames '*.erb', '*.erubis', '*.rhtml', '*.eruby'
|
11
|
+
|
12
|
+
def self.analyze_text(text)
|
13
|
+
return 0.4 if text =~ /<%.*%>/
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(opts = {})
|
17
|
+
@ruby_lexer = Ruby.new(opts)
|
18
|
+
|
19
|
+
super(opts)
|
20
|
+
end
|
21
|
+
|
22
|
+
start do
|
23
|
+
parent.reset!
|
24
|
+
@ruby_lexer.reset!
|
25
|
+
end
|
26
|
+
|
27
|
+
open = /<%%|<%=|<%#|<%-|<%/
|
28
|
+
close = /%%>|-%>|%>/
|
29
|
+
|
30
|
+
state :root do
|
31
|
+
rule /<%#/, Comment, :comment
|
32
|
+
|
33
|
+
rule open, Comment::Preproc, :ruby
|
34
|
+
|
35
|
+
rule /.+?(?=#{open})|.+/m do
|
36
|
+
delegate parent
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
state :comment do
|
41
|
+
rule close, Comment, :pop!
|
42
|
+
rule /.+(?=#{close})|.+/m, Comment
|
43
|
+
end
|
44
|
+
|
45
|
+
state :ruby do
|
46
|
+
rule close, Comment::Preproc, :pop!
|
47
|
+
|
48
|
+
rule /.+?(?=#{close})|.+/m do
|
49
|
+
delegate @ruby_lexer
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module Rugments
|
2
|
+
module Lexers
|
3
|
+
class Erlang < RegexLexer
|
4
|
+
title 'Erlang'
|
5
|
+
desc 'The Erlang programming language (erlang.org)'
|
6
|
+
tag 'erlang'
|
7
|
+
aliases 'erl'
|
8
|
+
filenames '*.erl', '*.hrl'
|
9
|
+
|
10
|
+
mimetypes 'text/x-erlang', 'application/x-erlang'
|
11
|
+
|
12
|
+
def self.analyze_text(text)
|
13
|
+
return 0.3 if text =~ /^-module[(]\w+[)][.]/
|
14
|
+
end
|
15
|
+
|
16
|
+
keywords = %w(
|
17
|
+
after begin case catch cond end fun if
|
18
|
+
let of query receive try when
|
19
|
+
)
|
20
|
+
|
21
|
+
builtins = %w(
|
22
|
+
abs append_element apply atom_to_list binary_to_list
|
23
|
+
bitstring_to_list binary_to_term bit_size bump_reductions
|
24
|
+
byte_size cancel_timer check_process_code delete_module
|
25
|
+
demonitor disconnect_node display element erase exit
|
26
|
+
float float_to_list fun_info fun_to_list
|
27
|
+
function_exported garbage_collect get get_keys
|
28
|
+
group_leader hash hd integer_to_list iolist_to_binary
|
29
|
+
iolist_size is_atom is_binary is_bitstring is_boolean
|
30
|
+
is_builtin is_float is_function is_integer is_list
|
31
|
+
is_number is_pid is_port is_process_alive is_record
|
32
|
+
is_reference is_tuple length link list_to_atom
|
33
|
+
list_to_binary list_to_bitstring list_to_existing_atom
|
34
|
+
list_to_float list_to_integer list_to_pid list_to_tuple
|
35
|
+
load_module localtime_to_universaltime make_tuple md5
|
36
|
+
md5_final md5_update memory module_loaded monitor
|
37
|
+
monitor_node node nodes open_port phash phash2
|
38
|
+
pid_to_list port_close port_command port_connect
|
39
|
+
port_control port_call port_info port_to_list
|
40
|
+
process_display process_flag process_info purge_module
|
41
|
+
put read_timer ref_to_list register resume_process
|
42
|
+
round send send_after send_nosuspend set_cookie
|
43
|
+
setelement size spawn spawn_link spawn_monitor
|
44
|
+
spawn_opt split_binary start_timer statistics
|
45
|
+
suspend_process system_flag system_info system_monitor
|
46
|
+
system_profile term_to_binary tl trace trace_delivered
|
47
|
+
trace_info trace_pattern trunc tuple_size tuple_to_list
|
48
|
+
universaltime_to_localtime unlink unregister whereis
|
49
|
+
)
|
50
|
+
|
51
|
+
operators = %r{(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)}
|
52
|
+
word_operators = %w(
|
53
|
+
and andalso band bnot bor bsl bsr bxor
|
54
|
+
div not or orelse rem xor
|
55
|
+
)
|
56
|
+
|
57
|
+
atom_re = %r{(?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]')}
|
58
|
+
|
59
|
+
variable_re = %r{(?:[A-Z_][a-zA-Z0-9_]*)}
|
60
|
+
|
61
|
+
escape_re = %r{(?:\\(?:[bdefnrstv\'"\\/]|[0-7][0-7]?[0-7]?|\^[a-zA-Z]))}
|
62
|
+
|
63
|
+
macro_re = %r{(?:#{variable_re}|#{atom_re})}
|
64
|
+
|
65
|
+
base_re = %r{(?:[2-9]|[12][0-9]|3[0-6])}
|
66
|
+
|
67
|
+
state :root do
|
68
|
+
rule(/\s+/, Text)
|
69
|
+
rule(/%.*\n/, Comment)
|
70
|
+
rule(%r{(#{keywords.join('|')})\b}, Keyword)
|
71
|
+
rule(%r{(#{builtins.join('|')})\b}, Name::Builtin)
|
72
|
+
rule(%r{(#{word_operators.join('|')})\b}, Operator::Word)
|
73
|
+
rule(/^-/, Punctuation, :directive)
|
74
|
+
rule(operators, Operator)
|
75
|
+
rule(/"/, Str, :string)
|
76
|
+
rule(/<</, Name::Label)
|
77
|
+
rule(/>>/, Name::Label)
|
78
|
+
rule %r{(#{atom_re})(:)} do
|
79
|
+
groups Name::Namespace, Punctuation
|
80
|
+
end
|
81
|
+
rule %r{(?:^|(?<=:))(#{atom_re})(\s*)(\()} do
|
82
|
+
groups Name::Function, Text, Punctuation
|
83
|
+
end
|
84
|
+
rule(%r{[+-]?#{base_re}#[0-9a-zA-Z]+}, Num::Integer)
|
85
|
+
rule(/[+-]?\d+/, Num::Integer)
|
86
|
+
rule(/[+-]?\d+.\d+/, Num::Float)
|
87
|
+
rule(%r{[\]\[:_@\".{}()|;,]}, Punctuation)
|
88
|
+
rule(variable_re, Name::Variable)
|
89
|
+
rule(atom_re, Name)
|
90
|
+
rule(%r{\?#{macro_re}}, Name::Constant)
|
91
|
+
rule(%r{\$(?:#{escape_re}|\\[ %]|[^\\])}, Str::Char)
|
92
|
+
rule(%r{##{atom_re}(:?\.#{atom_re})?}, Name::Label)
|
93
|
+
end
|
94
|
+
|
95
|
+
state :string do
|
96
|
+
rule(escape_re, Str::Escape)
|
97
|
+
rule(/"/, Str, :pop!)
|
98
|
+
rule(%r{~[0-9.*]*[~#+bBcdefginpPswWxX]}, Str::Interpol)
|
99
|
+
rule(%r{[^"\\~]+}, Str)
|
100
|
+
rule(/~/, Str)
|
101
|
+
end
|
102
|
+
|
103
|
+
state :directive do
|
104
|
+
rule %r{(define)(\s*)(\()(#{macro_re})} do
|
105
|
+
groups Name::Entity, Text, Punctuation, Name::Constant
|
106
|
+
pop!
|
107
|
+
end
|
108
|
+
rule %r{(record)(\s*)(\()(#{macro_re})} do
|
109
|
+
groups Name::Entity, Text, Punctuation, Name::Label
|
110
|
+
pop!
|
111
|
+
end
|
112
|
+
rule(atom_re, Name::Entity, :pop!)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,300 @@
|
|
1
|
+
module Rugments
|
2
|
+
module Lexers
|
3
|
+
class Factor < RegexLexer
|
4
|
+
title 'Factor'
|
5
|
+
desc 'Factor, the practical stack language (factorcode.org)'
|
6
|
+
tag 'factor'
|
7
|
+
filenames '*.factor'
|
8
|
+
mimetypes 'text/x-factor'
|
9
|
+
|
10
|
+
def self.analyze_text(text)
|
11
|
+
return 1 if text.shebang? 'factor'
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.builtins
|
15
|
+
@builtins ||= {}.tap do |builtins|
|
16
|
+
builtins[:kernel] = Set.new %w(
|
17
|
+
or 2bi 2tri while wrapper nip 4dip wrapper? bi*
|
18
|
+
callstack>array both? hashcode die dupd callstack
|
19
|
+
callstack? 3dup tri@ pick curry build ?execute 3bi prepose
|
20
|
+
>boolean if clone eq? tri* ? = swapd 2over 2keep 3keep clear
|
21
|
+
2dup when not tuple? dup 2bi* 2tri* call tri-curry object bi@
|
22
|
+
do unless* if* loop bi-curry* drop when* assert= retainstack
|
23
|
+
assert? -rot execute 2bi@ 2tri@ boa with either? 3drop bi
|
24
|
+
curry? datastack until 3dip over 3curry tri-curry* tri-curry@
|
25
|
+
swap and 2nip throw bi-curry (clone) hashcode* compose 2dip if
|
26
|
+
3tri unless compose? tuple keep 2curry equal? assert tri 2drop
|
27
|
+
most <wrapper> boolean? identity-hashcode identity-tuple?
|
28
|
+
null new dip bi-curry@ rot xor identity-tuple boolean
|
29
|
+
)
|
30
|
+
|
31
|
+
builtins[:assocs] = Set.new %w(
|
32
|
+
?at assoc? assoc-clone-like assoc= delete-at* assoc-partition
|
33
|
+
extract-keys new-assoc value? assoc-size map>assoc push-at
|
34
|
+
assoc-like key? assoc-intersect assoc-refine update
|
35
|
+
assoc-union assoc-combine at* assoc-empty? at+ set-at
|
36
|
+
assoc-all? assoc-subset? assoc-hashcode change-at assoc-each
|
37
|
+
assoc-diff zip values value-at rename-at inc-at enum? at cache
|
38
|
+
assoc>map <enum> assoc assoc-map enum value-at* assoc-map-as
|
39
|
+
>alist assoc-filter-as clear-assoc assoc-stack maybe-set-at
|
40
|
+
substitute assoc-filter 2cache delete-at assoc-find keys
|
41
|
+
assoc-any? unzip
|
42
|
+
)
|
43
|
+
|
44
|
+
builtins[:combinators] = Set.new %w(
|
45
|
+
case execute-effect no-cond no-case? 3cleave>quot 2cleave
|
46
|
+
cond>quot wrong-values? no-cond? cleave>quot no-case case>quot
|
47
|
+
3cleave wrong-values to-fixed-point alist>quot case-find
|
48
|
+
cond cleave call-effect 2cleave>quot recursive-hashcode
|
49
|
+
linear-case-quot spread spread>quot
|
50
|
+
)
|
51
|
+
|
52
|
+
builtins[:math] = Set.new %w(
|
53
|
+
number= if-zero next-power-of-2 each-integer ?1+
|
54
|
+
fp-special? imaginary-part unless-zero float>bits number?
|
55
|
+
fp-infinity? bignum? fp-snan? denominator fp-bitwise= *
|
56
|
+
+ power-of-2? - u>= / >= bitand log2-expects-positive <
|
57
|
+
log2 > integer? number bits>double 2/ zero? (find-integer)
|
58
|
+
bits>float float? shift ratio? even? ratio fp-sign bitnot
|
59
|
+
>fixnum complex? /i /f byte-array>bignum when-zero sgn >bignum
|
60
|
+
next-float u< u> mod recip rational find-last-integer >float
|
61
|
+
(all-integers?) 2^ times integer fixnum? neg fixnum sq bignum
|
62
|
+
(each-integer) bit? fp-qnan? find-integer complex <fp-nan>
|
63
|
+
real double>bits bitor rem fp-nan-payload all-integers?
|
64
|
+
real-part log2-expects-positive? prev-float align unordered?
|
65
|
+
float fp-nan? abs bitxor u<= odd? <= /mod rational? >integer
|
66
|
+
real? numerator
|
67
|
+
)
|
68
|
+
|
69
|
+
builtins[:sequences] = Set.new %w(
|
70
|
+
member-eq? append assert-sequence= find-last-from
|
71
|
+
trim-head-slice clone-like 3sequence assert-sequence? map-as
|
72
|
+
last-index-from reversed index-from cut* pad-tail
|
73
|
+
remove-eq! concat-as but-last snip trim-tail nths
|
74
|
+
nth 2selector sequence slice? <slice> partition
|
75
|
+
remove-nth tail-slice empty? tail* if-empty
|
76
|
+
find-from virtual-sequence? member? set-length
|
77
|
+
drop-prefix unclip unclip-last-slice iota map-sum
|
78
|
+
bounds-error? sequence-hashcode-step selector-for
|
79
|
+
accumulate-as map start midpoint@ (accumulate) rest-slice
|
80
|
+
prepend fourth sift accumulate! new-sequence follow map! like
|
81
|
+
first4 1sequence reverse slice unless-empty padding virtual@
|
82
|
+
repetition? set-last index 4sequence max-length set-second
|
83
|
+
immutable-sequence first2 first3 replicate-as reduce-index
|
84
|
+
unclip-slice supremum suffix! insert-nth trim-tail-slice
|
85
|
+
tail 3append short count suffix concat flip filter sum
|
86
|
+
immutable? reverse! 2sequence map-integers delete-all start*
|
87
|
+
indices snip-slice check-slice sequence? head map-find
|
88
|
+
filter! append-as reduce sequence= halves collapse-slice
|
89
|
+
interleave 2map filter-as binary-reduce slice-error? product
|
90
|
+
bounds-check? bounds-check harvest immutable virtual-exemplar
|
91
|
+
find produce remove pad-head last replicate set-fourth
|
92
|
+
remove-eq shorten reversed? map-find-last 3map-as
|
93
|
+
2unclip-slice shorter? 3map find-last head-slice pop* 2map-as
|
94
|
+
tail-slice* but-last-slice 2map-reduce iota? collector-for
|
95
|
+
accumulate each selector append! new-resizable cut-slice
|
96
|
+
each-index head-slice* 2reverse-each sequence-hashcode
|
97
|
+
pop set-nth ?nth <flat-slice> second join when-empty
|
98
|
+
collector immutable-sequence? <reversed> all? 3append-as
|
99
|
+
virtual-sequence subseq? remove-nth! push-either new-like
|
100
|
+
length last-index push-if 2all? lengthen assert-sequence
|
101
|
+
copy map-reduce move third first 3each tail? set-first prefix
|
102
|
+
bounds-error any? <repetition> trim-slice exchange surround
|
103
|
+
2reduce cut change-nth min-length set-third produce-as
|
104
|
+
push-all head? delete-slice rest sum-lengths 2each head*
|
105
|
+
infimum remove! glue slice-error subseq trim replace-slice
|
106
|
+
push repetition map-index trim-head unclip-last mismatch
|
107
|
+
)
|
108
|
+
|
109
|
+
builtins[:namespaces] = Set.new %w(
|
110
|
+
global +@ change set-namestack change-global init-namespaces
|
111
|
+
on off set-global namespace set with-scope bind with-variable
|
112
|
+
inc dec counter initialize namestack get get-global make-assoc
|
113
|
+
)
|
114
|
+
|
115
|
+
builtins[:arrays] = Set.new %w(
|
116
|
+
<array> 2array 3array pair >array 1array 4array pair?
|
117
|
+
array resize-array array?
|
118
|
+
)
|
119
|
+
|
120
|
+
builtins[:io] = Set.new %w(
|
121
|
+
+character+ bad-seek-type? readln each-morsel
|
122
|
+
stream-seek read print with-output-stream contents
|
123
|
+
write1 stream-write1 stream-copy stream-element-type
|
124
|
+
with-input-stream stream-print stream-read stream-contents
|
125
|
+
stream-tell tell-output bl seek-output bad-seek-type nl
|
126
|
+
stream-nl write flush stream-lines +byte+ stream-flush
|
127
|
+
read1 seek-absolute? stream-read1 lines stream-readln
|
128
|
+
stream-read-until each-line seek-end with-output-stream*
|
129
|
+
seek-absolute with-streams seek-input seek-relative?
|
130
|
+
input-stream stream-write read-partial seek-end?
|
131
|
+
seek-relative error-stream read-until with-input-stream*
|
132
|
+
with-streams* tell-input each-block output-stream
|
133
|
+
stream-read-partial each-stream-block each-stream-line
|
134
|
+
)
|
135
|
+
|
136
|
+
builtins[:strings] = Set.new %w(
|
137
|
+
resize-string >string <string> 1string string string?
|
138
|
+
)
|
139
|
+
|
140
|
+
builtins[:vectors] = Set.new %w(
|
141
|
+
with-return restarts return-continuation with-datastack
|
142
|
+
recover rethrow-restarts <restart> ifcc set-catchstack
|
143
|
+
>continuation< cleanup ignore-errors restart?
|
144
|
+
compute-restarts attempt-all-error error-thread
|
145
|
+
continue <continuation> attempt-all-error? condition?
|
146
|
+
<condition> throw-restarts error catchstack continue-with
|
147
|
+
thread-error-hook continuation rethrow callcc1
|
148
|
+
error-continuation callcc0 attempt-all condition
|
149
|
+
continuation? restart return
|
150
|
+
)
|
151
|
+
|
152
|
+
builtins[:continuations] = Set.new %w(
|
153
|
+
with-return restarts return-continuation with-datastack
|
154
|
+
recover rethrow-restarts <restart> ifcc set-catchstack
|
155
|
+
>continuation< cleanup ignore-errors restart?
|
156
|
+
compute-restarts attempt-all-error error-thread
|
157
|
+
continue <continuation> attempt-all-error? condition?
|
158
|
+
<condition> throw-restarts error catchstack continue-with
|
159
|
+
thread-error-hook continuation rethrow callcc1
|
160
|
+
error-continuation callcc0 attempt-all condition
|
161
|
+
continuation? restart return
|
162
|
+
)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
state :root do
|
167
|
+
rule /\s+/m, Text
|
168
|
+
|
169
|
+
rule /(:|::|MACRO:|MEMO:|GENERIC:|HELP:)(\s+)(\S+)/m do
|
170
|
+
groups Keyword, Text, Name::Function
|
171
|
+
end
|
172
|
+
|
173
|
+
rule /(M:|HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)/m do
|
174
|
+
groups Keyword, Text, Name::Class, Text, Name::Function
|
175
|
+
end
|
176
|
+
|
177
|
+
rule /\((?=\s)/, Name::Function, :stack_effect
|
178
|
+
rule /;(?=\s)/, Keyword
|
179
|
+
|
180
|
+
rule /(USING:)((?:\s|\\\s)+)/m do
|
181
|
+
groups Keyword::Namespace, Text
|
182
|
+
push :import
|
183
|
+
end
|
184
|
+
|
185
|
+
rule /(IN:|USE:|UNUSE:|QUALIFIED:|QUALIFIED-WITH:)(\s+)(\S+)/m do
|
186
|
+
groups Keyword::Namespace, Text, Name::Namespace
|
187
|
+
end
|
188
|
+
|
189
|
+
rule /(FROM:|EXCLUDE:)(\s+)(\S+)(\s+)(=>)/m do
|
190
|
+
groups Keyword::Namespace, Text, Name::Namespace, Text, Punctuation
|
191
|
+
end
|
192
|
+
|
193
|
+
rule /(?:ALIAS|DEFER|FORGET|POSTPONE):/, Keyword::Namespace
|
194
|
+
|
195
|
+
rule /(TUPLE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)/m do
|
196
|
+
groups(
|
197
|
+
Keyword, Text,
|
198
|
+
Name::Class, Text,
|
199
|
+
Punctuation, Text,
|
200
|
+
Name::Class
|
201
|
+
)
|
202
|
+
push :slots
|
203
|
+
end
|
204
|
+
|
205
|
+
rule /(TUPLE:)(\s+)(\S+)/m do
|
206
|
+
groups Keyword, Text, Name::Class
|
207
|
+
push :slots
|
208
|
+
end
|
209
|
+
|
210
|
+
rule /(UNION:|INTERSECTION:)(\s+)(\S+)/m do
|
211
|
+
groups Keyword, Text, Name::Class
|
212
|
+
end
|
213
|
+
|
214
|
+
rule /(PREDICATE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)/m do
|
215
|
+
groups(
|
216
|
+
Keyword, Text,
|
217
|
+
Name::Class, Text,
|
218
|
+
Punctuation, Text,
|
219
|
+
Name::Class
|
220
|
+
)
|
221
|
+
end
|
222
|
+
|
223
|
+
rule /(C:)(\s+)(\S+)(\s+)(\S+)/m do
|
224
|
+
groups(
|
225
|
+
Keyword, Text,
|
226
|
+
Name::Function, Text,
|
227
|
+
Name::Class
|
228
|
+
)
|
229
|
+
end
|
230
|
+
|
231
|
+
rule %r{
|
232
|
+
(INSTANCE|SLOT|MIXIN|SINGLETONS?|CONSTANT|SYMBOLS?|ERROR|SYNTAX
|
233
|
+
|ALIEN|TYPEDEF|FUNCTION|STRUCT):
|
234
|
+
}x, Keyword
|
235
|
+
|
236
|
+
rule /(?:<PRIVATE|PRIVATE>)/, Keyword::Namespace
|
237
|
+
|
238
|
+
rule /(MAIN:)(\s+)(\S+)/ do
|
239
|
+
groups Keyword::Namespace, Text, Name::Function
|
240
|
+
end
|
241
|
+
|
242
|
+
# strings
|
243
|
+
rule /"""\s+.*?\s+"""/, Str
|
244
|
+
rule /"(\\.|[^\\])*?"/, Str
|
245
|
+
rule /(CHAR:)(\s+)(\\[\\abfnrstv]*|\S)(?=\s)/, Str::Char
|
246
|
+
|
247
|
+
# comments
|
248
|
+
rule /!\s+.*$/, Comment
|
249
|
+
rule /#!\s+.*$/, Comment
|
250
|
+
|
251
|
+
# booleans
|
252
|
+
rule /[tf](?=\s)/, Name::Constant
|
253
|
+
|
254
|
+
# numbers
|
255
|
+
rule /-?\d+\.\d+(?=\s)/, Num::Float
|
256
|
+
rule /-?\d+(?=\s)/, Num::Integer
|
257
|
+
|
258
|
+
rule /HEX:\s+[a-fA-F\d]+(?=\s)/m, Num::Hex
|
259
|
+
rule /BIN:\s+[01]+(?=\s)/, Num::Bin
|
260
|
+
rule /OCT:\s+[0-7]+(?=\s)/, Num::Oct
|
261
|
+
|
262
|
+
rule %r{[-+/*=<>^](?=\s)}, Operator
|
263
|
+
|
264
|
+
rule /(?:deprecated|final|foldable|flushable|inline|recursive)(?=\s)/,
|
265
|
+
Keyword
|
266
|
+
|
267
|
+
rule /\S+/ do |m|
|
268
|
+
name = m[0]
|
269
|
+
|
270
|
+
if self.class.builtins.values.any? { |b| b.include? name }
|
271
|
+
token Name::Builtin
|
272
|
+
else
|
273
|
+
token Name
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
state :stack_effect do
|
279
|
+
rule /\s+/, Text
|
280
|
+
rule /\(/, Name::Function, :stack_effect
|
281
|
+
rule /\)/, Name::Function, :pop!
|
282
|
+
|
283
|
+
rule /--/, Name::Function
|
284
|
+
rule /\S+/, Name::Variable
|
285
|
+
end
|
286
|
+
|
287
|
+
state :slots do
|
288
|
+
rule /\s+/, Text
|
289
|
+
rule /;(?=\s)/, Keyword, :pop!
|
290
|
+
rule /\S+/, Name::Variable
|
291
|
+
end
|
292
|
+
|
293
|
+
state :import do
|
294
|
+
rule /;(?=\s)/, Keyword, :pop!
|
295
|
+
rule /\s+/, Text
|
296
|
+
rule /\S+/, Name::Namespace
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# automatically generated by `rake builtins:gherkin`
|
2
|
+
module Rugments
|
3
|
+
module Lexers
|
4
|
+
def Gherkin.keywords
|
5
|
+
@keywords ||= {}.tap do |k|
|
6
|
+
k[:feature] = Set.new ["Ability", "Ahoy matey!", "Arwedd", "Aspekt", "Besigheid Behoefte", "Business Need", "Caracteristica", "Característica", "Egenskab", "Egenskap", "Eiginleiki", "Feature", "Fitur", "Fonctionnalité", "Fonksyonalite", "Funcionalidade", "Funcionalitat", "Functionalitate", "Functionaliteit", "Funcţionalitate", "Funcționalitate", "Fungsi", "Funkcia", "Funkcija", "Funkcionalitāte", "Funkcionalnost", "Funkcja", "Funksie", "Funktionalität", "Funktionalitéit", "Funzionalità", "Fīča", "Hwaet", "Hwæt", "Jellemző", "Karakteristik", "Lastnost", "Mak", "Mogucnost", "Mogućnost", "Moznosti", "Možnosti", "OH HAI", "Omadus", "Ominaisuus", "Osobina", "Potrzeba biznesowa", "Požadavek", "Požiadavka", "Pretty much", "Qap", "Qu'meH 'ut", "Savybė", "Trajto", "Tính năng", "Vermoë", "Vlastnosť", "Właściwość", "Značilnost", "laH", "perbogh", "poQbogh malja'", "Özellik", "Δυνατότητα", "Λειτουργία", "Могућност", "Мөмкинлек", "Особина", "Свойство", "Функционал", "Функционалност", "Функция", "Функціонал", "Үзенчәлеклелек", "תכונה", "خاصية", "خصوصیت", "صلاحیت", "وِیژگی", "کاروبار کی ضرورت", "रूप लेख", "ਖਾਸੀਅਤ", "ਨਕਸ਼ ਨੁਹਾਰ", "ਮੁਹਾਂਦਰਾ", "గుణము", "ಹೆಚ್ಚಳ", "ความต้องการทางธุรกิจ", "ความสามารถ", "โครงหลัก", "フィーチャ", "功能", "機能", "기능"]
|
7
|
+
k[:element] = Set.new ["Abstract Scenario", "Abstrakt Scenario", "Achtergrond", "Aer", "Agtergrond", "All y'all", "Antecedentes", "Antecedents", "Atburðarás", "Awww, look mate", "B4", "Background", "Baggrund", "Bakgrund", "Bakgrunn", "Bakgrunnur", "Bối cảnh", "Cefndir", "Cenario", "Cenario de Fundo", "Cenário", "Cenário de Fundo", "Contesto", "Context", "Contexte", "Contexto", "Dasar", "Delineacao do Cenario", "Delineação do Cenário", "Dis is what went down", "Dyagram Senaryo", "Dyagram senaryo", "Esbozo do escenario", "Escenari", "Escenario", "Esquema de l'escenari", "Esquema del escenario", "Esquema do Cenario", "Esquema do Cenário", "First off", "Fono", "Forgatókönyv", "Forgatókönyv vázlat", "Fundo", "Geçmiş", "Grundlage", "Hannergrond", "Heave to", "Háttér", "Istorik", "Keadaan", "Khung kịch bản", "Khung tình huống", "Koncept", "Konsep skenario", "Kontekst", "Kontekstas", "Konteksts", "Kontext", "Konturo de la scenaro", "Kontèks", "Kịch bản", "Latar Belakang", "Lýsing Atburðarásar", "Lýsing Dæma", "MISHUN", "MISHUN SRSLY", "Menggariskan Senario", "Náčrt Scenára", "Náčrt Scenáru", "Náčrt Scénáře", "Oris scenarija", "Osnova", "Osnova Scenára", "Osnova scénáře", "Osnutek", "Ozadje", "Plan Senaryo", "Plan du Scénario", "Plan du scénario", "Plan senaryo", "Plang vum Szenario", "Pozadie", "Pozadina", "Pozadí", "Primer", "Raamstsenaarium", "Reckon it's like", "Rerefons", "Scenarie", "Scenarij", "Scenarijaus šablonas", "Scenarijus", "Scenario", "Scenario Amlinellol", "Scenario Outline", "Scenario Template", "Scenariomal", "Scenariomall", "Scenariu", "Scenariusz", "Scenaro", "Scenár", "Scenārijs", "Scenārijs pēc parauga", "Schema dello scenario", "Scénario", "Scénář", "Senario", "Senaryo", "Senaryo Deskripsyon", "Senaryo deskripsyon", "Senaryo taslağı", "Shiver me timbers", "Situai", "Situasie", "Situasie Uiteensetting", "Situācija", "Skenario", "Skenario konsep", "Skica", "Structura scenariu", "Structură scenariu", "Struktura scenarija", "Stsenaarium", "Swa", "Swa hwaer swa", "Swa hwær swa", "Szablon scenariusza", "Szenario", "Szenariogrundriss", "Tapaus", "Tapausaihio", "Taust", "Tausta", "Template Keadaan", "Template Senario", "Template Situai", "The thing of it is", "Tình huống", "Wharrimean is", "Yo-ho-ho", "Założenia", "lut", "lut chovnatlh", "mo'", "Ær", "Περιγραφή Σεναρίου", "Σενάριο", "Υπόβαθρο", "Кереш", "Контекст", "Концепт", "Основа", "Передумова", "Позадина", "Предистория", "Предыстория", "Пример", "Рамка на сценарий", "Скица", "Структура сценария", "Структура сценарија", "Структура сценарію", "Сценарий", "Сценарий структураси", "Сценарийның төзелеше", "Сценарио", "Сценарій", "Тарих", "רקע", "תבנית תרחיש", "תרחיש", "الخلفية", "الگوی سناریو", "زمینه", "سناریو", "سيناريو", "سيناريو مخطط", "منظر نامے کا خاکہ", "منظرنامہ", "پس منظر", "परिदृश्य", "परिदृश्य रूपरेखा", "पृष्ठभूमि", "ਪਟਕਥਾ", "ਪਟਕਥਾ ਢਾਂਚਾ", "ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ", "ਪਿਛੋਕੜ", "కథనం", "నేపథ్యం", "సన్నివేశం", "ಕಥಾಸಾರಾಂಶ", "ವಿವರಣೆ", "ಹಿನ್ನೆಲೆ", "สรุปเหตุการณ์", "เหตุการณ์", "แนวคิด", "โครงสร้างของเหตุการณ์", "シナリオ", "シナリオアウトライン", "シナリオテンプレ", "シナリオテンプレート", "テンプレ", "剧本", "剧本大纲", "劇本", "劇本大綱", "场景", "场景大纲", "場景", "場景大綱", "背景", "배경", "시나리오", "시나리오 개요"]
|
8
|
+
k[:examples] = Set.new ["Atburðarásir", "Beispiele", "Beispiller", "Cenarios", "Cenários", "Conto", "Contoh", "Contone", "Dead men tell no tales", "Dæmi", "Dữ liệu", "EXAMPLZ", "Egzanp", "Ejemplos", "Eksempler", "Ekzemploj", "Enghreifftiau", "Esempi", "Examples", "Exempel", "Exemple", "Exemples", "Exemplos", "Juhtumid", "Paraugs", "Pavyzdžiai", "Piemēri", "Primeri", "Primjeri", "Przykłady", "Príklady", "Példák", "Příklady", "Scenarijai", "Scenariji", "Scenarios", "Se the", "Se ðe", "Se þe", "Tapaukset", "Variantai", "Voorbeelde", "Voorbeelden", "You'll wanna", "ghantoH", "lutmey", "Örnekler", "Παραδείγματα", "Σενάρια", "Мисаллар", "Мисоллар", "Приклади", "Примери", "Примеры", "Сценарији", "Үрнәкләр", "דוגמאות", "امثلة", "مثالیں", "نمونه ها", "उदाहरण", "ਉਦਾਹਰਨਾਂ", "ఉదాహరణలు", "ಉದಾಹರಣೆಗಳು", "ชุดของตัวอย่าง", "ชุดของเหตุการณ์", "サンプル", "例", "例子", "예"]
|
9
|
+
k[:step] = Set.new ["'a", "'ach", "'ej", "*", "7", "A", "A taktiež", "A také", "A tiež", "A zároveň", "AN", "Aber", "Ac", "Adott", "Ak", "Akkor", "Ale", "Aleshores", "Ali", "Allora", "Alors", "Als", "Ama", "Amennyiben", "Amikor", "Ampak", "An", "Ananging", "And", "And y'all", "Angenommen", "Anrhegedig a", "Apabila", "Atesa", "Atunci", "Atès", "Avast!", "Aye", "BUT", "Bagi", "Banjur", "Bet", "Biết", "Blimey!", "Buh", "But", "But at the end of the day I reckon", "But y'all", "Cal", "Cand", "Cando", "Ce", "Cho", "Cuando", "Când", "DEN", "DaH ghu' bejlu'", "Dada", "Dadas", "Dado", "Dados", "Dan", "Dann", "Dano", "Dar", "Dat fiind", "Data", "Date", "Date fiind", "Dati", "Dati fiind", "Dato", "Daţi fiind", "Dați fiind", "De", "Den youse gotta", "Dengan", "Diberi", "Diyelim ki", "Do", "Donada", "Donat", "Donitaĵo", "Dun", "Duota", "E", "Eeldades", "Ef", "En", "Entao", "Entonces", "Então", "Entón", "Epi", "Et", "Etant donné", "Etant donnée", "Etant données", "Etant donnés", "Eğer ki", "Fakat", "Gangway!", "Gdy", "Gegeben sei", "Gegeben seien", "Gegeven", "Gegewe", "Gitt", "Given", "Given y'all", "Givet", "Givun", "Ha", "I", "I CAN HAZ", "In", "Ir", "It's just unbelievable", "Ja", "Jeśli", "Jeżeli", "Kad", "Kada", "Kadar", "Kai", "Kaj", "Když", "Kemudian", "Ketika", "Keď", "Khi", "Kiedy", "Ko", "Kui", "Kuid", "Kun", "Lan", "Le", "Le sa a", "Let go and haul", "Logo", "Lorsqu'<", "Lorsque", "Lè", "Lè sa a", "Ma", "Maar", "Mais", "Majd", "Mając", "Maka", "Manawa", "Mas", "Men", "Menawa", "Mutta", "Nalika", "Nalikaning", "Nanging", "Nato", "Nhưng", "Niin", "Njuk", "När", "Når", "O zaman", "Och", "Og", "Oletetaan", "Ond", "Onda", "Oraz", "Pak", "Pero", "Però", "Podano", "Pokiaľ", "Pokud", "Potem", "Potom", "Privzeto", "Pryd", "Quan", "Quand", "Quando", "Se", "Sed", "Si", "Siis", "Sipoze", "Sipoze Ke", "Sipoze ke", "Soit", "Stel", "Så", "Tad", "Tada", "Tak", "Takrat", "Tapi", "Ter", "Tetapi", "Tha", "Tha the", "Then", "Then y'all", "Thurh", "Thì", "Toda", "Too right", "Un", "Und", "Ve", "Vendar", "Và", "WEN", "Wanneer", "Wenn", "When", "When y'all", "Wtedy", "Wun", "Y", "Y'know", "Yeah nah", "Yna", "Youse know like when", "Youse know when youse got", "Za predpokladu", "Za předpokladu", "Zadan", "Zadani", "Zadano", "Zadate", "Zadato", "Zakładając", "Zaradi", "Zatati", "a", "an", "awer", "dann", "ghu' noblu'", "latlh", "mä", "qaSDI'", "ugeholl", "vaj", "wann", "És", "Étant donné", "Étant donnée", "Étant données", "Étant donnés", "Ða", "Ða ðe", "Ðurh", "Þa", "Þa þe", "Þegar", "Þurh", "Þá", "Če", "Şi", "Și", "Όταν", "Αλλά", "Δεδομένου", "Και", "Τότε", "І", "А", "А також", "Агар", "Але", "Али", "Аммо", "Бирок", "Ва", "Вә", "Дадено", "Дано", "Допустим", "Если", "Задате", "Задати", "Задато", "И", "К тому же", "Кад", "Када", "Когато", "Когда", "Коли", "Лекин", "Ләкин", "Нехай", "Но", "Нәтиҗәдә", "Онда", "Припустимо", "Припустимо, що", "Пусть", "Та", "Также", "То", "Тогда", "Тоді", "Унда", "Якщо", "Һәм", "Әгәр", "Әйтик", "Әмма", "אבל", "אז", "אזי", "בהינתן", "וגם", "כאשר", "آنگاه", "اذاً", "اما", "اور", "اگر", "با فرض", "بالفرض", "بفرض", "تب", "ثم", "جب", "عندما", "فرض کیا", "لكن", "لیکن", "متى", "هنگامی", "و", "پھر", "अगर", "और", "कदा", "किन्तु", "चूंकि", "जब", "तथा", "तदा", "तब", "पर", "परन्तु", "यदि", "ਅਤੇ", "ਜਦੋਂ", "ਜਿਵੇਂ ਕਿ", "ਜੇਕਰ", "ਤਦ", "ਪਰ", "అప్పుడు", "ఈ పరిస్థితిలో", "కాని", "చెప్పబడినది", "మరియు", "ಆದರೆ", "ನಂತರ", "ನೀಡಿದ", "ಮತ್ತು", "ಸ್ಥಿತಿಯನ್ನು", "กำหนดให้", "ดังนั้น", "เมื่อ", "แต่", "และ", "かつ<", "しかし<", "ただし<", "ならば<", "もし<", "並且<", "但し<", "但是<", "假如<", "假定<", "假設<", "假设<", "前提<", "同时<", "同時<", "并且<", "当<", "當<", "而且<", "那么<", "那麼<", "그러면<", "그리고<", "단<", "만약<", "만일<", "먼저<", "조건<", "하지만<"]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
module Rugments
|
2
|
+
module Lexers
|
3
|
+
class Gherkin < RegexLexer
|
4
|
+
tag 'gherkin'
|
5
|
+
aliases 'cucumber', 'behat'
|
6
|
+
|
7
|
+
title 'Gherkin'
|
8
|
+
desc 'A business-readable spec DSL ( github.com/cucumber/cucumber/wiki/Gherkin )'
|
9
|
+
|
10
|
+
filenames '*.feature'
|
11
|
+
mimetypes 'text/x-gherkin'
|
12
|
+
|
13
|
+
def self.analyze_text(text)
|
14
|
+
return 1 if text.shebang? 'cucumber'
|
15
|
+
end
|
16
|
+
|
17
|
+
# self-modifying method that loads the keywords file
|
18
|
+
def self.keywords
|
19
|
+
load Pathname.new(__FILE__).dirname.join('gherkin/keywords.rb')
|
20
|
+
keywords
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.step_regex
|
24
|
+
# in Gherkin's config, keywords that end in < don't
|
25
|
+
# need word boundaries at the ends - all others do.
|
26
|
+
@step_regex ||= Regexp.new(
|
27
|
+
keywords[:step].map do |w|
|
28
|
+
if w.end_with? '<'
|
29
|
+
Regexp.escape(w.chop)
|
30
|
+
else
|
31
|
+
"#{Regexp.escape(w)}\\b"
|
32
|
+
end
|
33
|
+
end.join('|')
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
rest_of_line = /.*?(?=[#\n])/
|
38
|
+
|
39
|
+
state :basic do
|
40
|
+
rule %r{#.*$}, Comment
|
41
|
+
rule /[ \r\t]+/, Text
|
42
|
+
end
|
43
|
+
|
44
|
+
state :root do
|
45
|
+
mixin :basic
|
46
|
+
rule %r{\n}, Text
|
47
|
+
rule %r{""".*?"""}m, Str
|
48
|
+
rule %r{@[^\s@]+}, Name::Tag
|
49
|
+
mixin :has_table
|
50
|
+
mixin :has_examples
|
51
|
+
end
|
52
|
+
|
53
|
+
state :has_scenarios do
|
54
|
+
rule %r{(.*?)(:)} do |m|
|
55
|
+
reset_stack
|
56
|
+
|
57
|
+
keyword = m[1]
|
58
|
+
keyword_tok = if self.class.keywords[:element].include? keyword
|
59
|
+
push :description; Keyword::Namespace
|
60
|
+
elsif self.class.keywords[:feature].include? keyword
|
61
|
+
push :feature_description; Keyword::Declaration
|
62
|
+
elsif self.class.keywords[:examples].include? keyword
|
63
|
+
push :example_description; Name::Namespace
|
64
|
+
else
|
65
|
+
Error
|
66
|
+
end
|
67
|
+
|
68
|
+
groups keyword_tok, Punctuation
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
state :has_examples do
|
73
|
+
mixin :has_scenarios
|
74
|
+
rule Gherkin.step_regex, Name::Function do
|
75
|
+
token Name::Function
|
76
|
+
reset_stack; push :step
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
state :has_table do
|
81
|
+
rule(/(?=[|])/) { push :table_header }
|
82
|
+
end
|
83
|
+
|
84
|
+
state :table_header do
|
85
|
+
rule /[^|\s]+/, Name::Variable
|
86
|
+
rule /\n/ do
|
87
|
+
token Text
|
88
|
+
goto :table
|
89
|
+
end
|
90
|
+
mixin :table
|
91
|
+
end
|
92
|
+
|
93
|
+
state :table do
|
94
|
+
mixin :basic
|
95
|
+
rule /\n/, Text, :table_bol
|
96
|
+
rule /[|]/, Punctuation
|
97
|
+
rule /[^|\s]+/, Name
|
98
|
+
end
|
99
|
+
|
100
|
+
state :table_bol do
|
101
|
+
rule(/(?=\s*[^\s|])/) { reset_stack }
|
102
|
+
rule(//) { pop! }
|
103
|
+
end
|
104
|
+
|
105
|
+
state :description do
|
106
|
+
mixin :basic
|
107
|
+
mixin :has_examples
|
108
|
+
rule /\n/, Text
|
109
|
+
rule rest_of_line, Text
|
110
|
+
end
|
111
|
+
|
112
|
+
state :feature_description do
|
113
|
+
mixin :basic
|
114
|
+
mixin :has_scenarios
|
115
|
+
rule /\n/, Text
|
116
|
+
rule rest_of_line, Text
|
117
|
+
end
|
118
|
+
|
119
|
+
state :example_description do
|
120
|
+
mixin :basic
|
121
|
+
mixin :has_table
|
122
|
+
rule /\n/, Text
|
123
|
+
rule rest_of_line, Text
|
124
|
+
end
|
125
|
+
|
126
|
+
state :step do
|
127
|
+
mixin :basic
|
128
|
+
rule /<.*?>/, Name::Variable
|
129
|
+
rule /".*?"/, Str
|
130
|
+
rule /\S+/, Text
|
131
|
+
rule rest_of_line, Text, :pop!
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|