forked from square/mysql-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
43 lines (35 loc) · 1.01 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new do |c|
options = ['--color']
options += ["--format", "documentation"]
c.rspec_opts = options
end
desc "Generate Lexer"
task :lexer do
`rex mysql.rex.rb -o lib/mysql-parser/lexer.rb`
end
desc "Generate Parser"
task :parser do
`racc -t -v -O parser.output mysql.y.rb -o lib/mysql-parser/parser.rb`
end
desc "Generate literal"
task :generate_literal do
ruby "./bin/generate-literal"
end
desc "Sanity check"
task :sanity_check do
ruby "./bin/sanity_check"
end
desc "Generate Lexer and Parser"
task :generate => [:lexer, :parser, :sanity_check, :generate_literal,
:lexer, :parser]
# generate lexer/parser twice because we need :generate_literal to autogenerate
# lexer, but :generate_literal needs parser.output which is generated from
# the parser itself
# sanity check must come before generate literal to prevent generating
# bad literals
desc "Clean up"
task :cleanup do
`rm lib/mysql-parser/lexer.rb`
`rm lib/mysql-parser/parser.rb`
end