Skip to content

Commit f3c3a79

Browse files
committed
Clean up ragel out put some more
1 parent 6993fab commit f3c3a79

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ group :development, :test do
1212
if RUBY_VERSION.to_f >= 2.7
1313
gem 'benchmark-ips', '~> 2.1'
1414
gem 'gouteur', '~> 1.1'
15-
gem 'rubocop', '~> 1.59'
15+
gem 'rubocop', '>= 1.80.2'
1616
end
1717
end

tasks/ragel.rake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ task ragel: 'ragel:install' do
1616
File
1717
.read(RAGEL_OUTPUT_PATH)
1818
.gsub(/[ \t]+$/, '') # remove trailing whitespace emitted by ragel
19+
.gsub(/ then$/, '') # remove redundant then keywords emitted by ragel
1920
.gsub(/(?<=\d,)[ \t]+|^[ \t]+(?=-?\d)/, '') # compact FSM tables (saves ~6KB)
21+
.gsub(/(?<=\S ) +/, '') # compact in-line spaces
2022
.gsub(/\n(?:[ \t]*\n){2,}/, "\n\n") # compact blank lines
2123

2224
File.open(RAGEL_OUTPUT_PATH, 'w') do |file|
@@ -31,6 +33,10 @@ task ragel: 'ragel:install' do
3133

3234
file.write(cleaned_contents)
3335
end
36+
37+
# Remove redundant begin/end blocks emitted by ragel.
38+
# This saves 1KB, but is disabled for now because it increases build time from 0.2s to 1s.
39+
# `bundle exec rubocop --only Style/RedundantBegin --autocorrect #{RAGEL_OUTPUT_PATH}`
3440
end
3541

3642
namespace :ragel do

0 commit comments

Comments
 (0)