49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/terse/keyword_ruby.rb', line 49
def self.generate_keywords
keywords = []
keys = [:req, :reqr, :i, :c, :m, :d, :e, :a, :r, :w]
keys.each do |key|
k = KeywordRuby.new key
case key
when :req
k.substitute = "require"
k.try_follow_on_regex = true
k.follow_on_substitute = "\"\#{$3}\""
when :reqr
k.substitute = "require_relative"
k.try_follow_on_regex = true
k.follow_on_substitute = "\"\#{$3}\""
when :i
k.substitute = "include"
when :c
k.substitute = "class"
k.needs_top_level_end = true
when :m
k.substitute = "module"
k.needs_top_level_end = true
when :d
k.substitute = "def"
k.needs_inner_end = true
when :e
k.substitute = "end"
k.is_end = true
when :a
k.substitute = "attr_accessor"
k.try_follow_on_regex = true
k.follow_on_substitute = "$3.to_sym"
when :r
k.substitute = "attr_reader"
k.try_follow_on_regex = true
k.follow_on_substitute = "$3.to_sym"
when :w
k.substitute = "attr_writer"
k.try_follow_on_regex = true
k.follow_on_substitute = "$3.to_sym"
else
puts "Unknown keyword #{key}"
end
keywords << k
end
keywords
end
|