From ddadc2008bc2125cbccf5bf3974139f761ceef0b Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sat, 28 May 2022 20:20:03 -0400 Subject: [PATCH] Rename to propane --- Gemfile | 4 +- Gemfile.lock | 8 +--- README.md | 10 ++--- Rakefile | 1 - bin/imbecile | 5 --- bin/propane | 5 +++ imbecile.gemspec | 31 --------------- imbecile.sh | 2 - lib/{imbecile.rb => propane.rb} | 38 +++++++++---------- lib/{imbecile => propane}/cli.rb | 6 +-- lib/{imbecile => propane}/code_point_range.rb | 2 +- lib/{imbecile => propane}/fa.rb | 2 +- lib/{imbecile => propane}/fa/state.rb | 2 +- .../fa/state/transition.rb | 2 +- lib/{imbecile => propane}/lexer.rb | 2 +- lib/{imbecile => propane}/lexer/dfa.rb | 2 +- lib/{imbecile => propane}/parser.rb | 2 +- lib/{imbecile => propane}/parser/item.rb | 2 +- lib/{imbecile => propane}/parser/item_set.rb | 2 +- lib/{imbecile => propane}/regex.rb | 2 +- lib/{imbecile => propane}/regex/nfa.rb | 2 +- lib/{imbecile => propane}/regex/unit.rb | 2 +- lib/{imbecile => propane}/rule.rb | 2 +- lib/{imbecile => propane}/token.rb | 2 +- lib/{imbecile => propane}/version.rb | 2 +- propane.sh | 2 + .../code_point_range_spec.rb | 2 +- spec/{imbecile => propane}/lexer/dfa_spec.rb | 6 +-- .../{imbecile => propane}/parser/item_spec.rb | 2 +- spec/{imbecile => propane}/regex_spec.rb | 2 +- spec/{imbecile_spec.rb => propane_spec.rb} | 4 +- spec/spec_helper.rb | 2 +- 32 files changed, 60 insertions(+), 100 deletions(-) delete mode 100755 bin/imbecile create mode 100755 bin/propane delete mode 100644 imbecile.gemspec delete mode 100755 imbecile.sh rename lib/{imbecile.rb => propane.rb} (80%) rename lib/{imbecile => propane}/cli.rb (91%) rename lib/{imbecile => propane}/code_point_range.rb (99%) rename lib/{imbecile => propane}/fa.rb (98%) rename lib/{imbecile => propane}/fa/state.rb (98%) rename lib/{imbecile => propane}/fa/state/transition.rb (96%) rename lib/{imbecile => propane}/lexer.rb (91%) rename lib/{imbecile => propane}/lexer/dfa.rb (99%) rename lib/{imbecile => propane}/parser.rb (99%) rename lib/{imbecile => propane}/parser/item.rb (98%) rename lib/{imbecile => propane}/parser/item_set.rb (98%) rename lib/{imbecile => propane}/regex.rb (99%) rename lib/{imbecile => propane}/regex/nfa.rb (95%) rename lib/{imbecile => propane}/regex/unit.rb (99%) rename lib/{imbecile => propane}/rule.rb (97%) rename lib/{imbecile => propane}/token.rb (97%) rename lib/{imbecile => propane}/version.rb (61%) create mode 100755 propane.sh rename spec/{imbecile => propane}/code_point_range_spec.rb (99%) rename spec/{imbecile => propane}/lexer/dfa_spec.rb (93%) rename spec/{imbecile => propane}/parser/item_spec.rb (95%) rename spec/{imbecile => propane}/regex_spec.rb (99%) rename spec/{imbecile_spec.rb => propane_spec.rb} (93%) diff --git a/Gemfile b/Gemfile index 0a60db2..d7eae8a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,4 @@ source "https://rubygems.org" -# Specify your gem's dependencies in imbecile.gemspec -gemspec - gem "rake" +gem "rspec" diff --git a/Gemfile.lock b/Gemfile.lock index 7804ffd..3b312b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,3 @@ -PATH - remote: . - specs: - imbecile (0.1.0) - GEM remote: https://rubygems.org/ specs: @@ -26,9 +21,8 @@ PLATFORMS ruby DEPENDENCIES - imbecile! rake - rspec (~> 3.0) + rspec BUNDLED WITH 2.4.0.dev diff --git a/README.md b/README.md index b7e5854..69d74b7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Imbecile +# Propane -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/imbecile`. To experiment with that code, run `bin/console` for an interactive prompt. +Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/propane`. To experiment with that code, run `bin/console` for an interactive prompt. TODO: Delete this and the text above, and describe your gem @@ -9,7 +9,7 @@ TODO: Delete this and the text above, and describe your gem Add this line to your application's Gemfile: ```ruby -gem 'imbecile' +gem 'propane' ``` And then execute: @@ -18,7 +18,7 @@ And then execute: Or install it yourself as: - $ gem install imbecile + $ gem install propane ## Usage @@ -32,7 +32,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/imbecile. +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/propane. ## License diff --git a/Rakefile b/Rakefile index 3882576..3a3c905 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,3 @@ -require "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec, :example_pattern) do |task, args| diff --git a/bin/imbecile b/bin/imbecile deleted file mode 100755 index 96cbee1..0000000 --- a/bin/imbecile +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env ruby - -require "imbecile" - -exit Imbecile::CLI.run(ARGV.dup) diff --git a/bin/propane b/bin/propane new file mode 100755 index 0000000..75e300a --- /dev/null +++ b/bin/propane @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby + +require "propane" + +exit Propane::CLI.run(ARGV.dup) diff --git a/imbecile.gemspec b/imbecile.gemspec deleted file mode 100644 index 59ceb58..0000000 --- a/imbecile.gemspec +++ /dev/null @@ -1,31 +0,0 @@ -require_relative 'lib/imbecile/version' - -Gem::Specification.new do |spec| - spec.name = "imbecile" - spec.version = Imbecile::VERSION - spec.authors = ["Josh Holtrop"] - spec.email = ["jholtrop@gmail.com"] - - spec.summary = %q{Imbecile is a LALR(1) parser generator targeting C and D} - spec.description = %q{Imbecile is a LALR(1) parser generator targeting C and D.} - spec.homepage = "http://todo.com/" - spec.license = "MIT" - spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0") - - spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'" - - spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = "http://todo.com/" - spec.metadata["changelog_uri"] = "http://todo.com/" - - # Specify which files should be added to the gem when it is released. - # The `git ls-files -z` loads the files in the RubyGem that have been added into git. - spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do - `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - end - spec.bindir = "exe" - spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } - spec.require_paths = ["lib"] - - spec.add_development_dependency "rspec", "~> 3.0" -end diff --git a/imbecile.sh b/imbecile.sh deleted file mode 100755 index e6445f5..0000000 --- a/imbecile.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec bundle exec ruby bin/imbecile "$@" diff --git a/lib/imbecile.rb b/lib/propane.rb similarity index 80% rename from lib/imbecile.rb rename to lib/propane.rb index 3b79797..7e1edc0 100644 --- a/lib/imbecile.rb +++ b/lib/propane.rb @@ -1,23 +1,23 @@ require "erb" require "set" -require_relative "imbecile/cli" -require_relative "imbecile/code_point_range" -require_relative "imbecile/fa" -require_relative "imbecile/fa/state" -require_relative "imbecile/fa/state/transition" -require_relative "imbecile/lexer" -require_relative "imbecile/lexer/dfa" -require_relative "imbecile/parser" -require_relative "imbecile/parser/item" -require_relative "imbecile/parser/item_set" -require_relative "imbecile/regex" -require_relative "imbecile/regex/nfa" -require_relative "imbecile/regex/unit" -require_relative "imbecile/rule" -require_relative "imbecile/token" -require_relative "imbecile/version" +require_relative "propane/cli" +require_relative "propane/code_point_range" +require_relative "propane/fa" +require_relative "propane/fa/state" +require_relative "propane/fa/state/transition" +require_relative "propane/lexer" +require_relative "propane/lexer/dfa" +require_relative "propane/parser" +require_relative "propane/parser/item" +require_relative "propane/parser/item_set" +require_relative "propane/regex" +require_relative "propane/regex/nfa" +require_relative "propane/regex/unit" +require_relative "propane/rule" +require_relative "propane/token" +require_relative "propane/version" -class Imbecile +class Propane # EOF. TOKEN_EOF = 0xFFFFFFFC @@ -123,8 +123,8 @@ class Imbecile def run(input_file, output_file, log_file) begin - imbecile = Imbecile.new(File.read(input_file)) - imbecile.generate(output_file, log_file) + propane = Propane.new(File.read(input_file)) + propane.generate(output_file, log_file) rescue Error => e $stderr.puts e.message return 2 diff --git a/lib/imbecile/cli.rb b/lib/propane/cli.rb similarity index 91% rename from lib/imbecile/cli.rb rename to lib/propane/cli.rb index 66b0679..2edb5a8 100644 --- a/lib/imbecile/cli.rb +++ b/lib/propane/cli.rb @@ -1,4 +1,4 @@ -class Imbecile +class Propane module CLI USAGE = <" do diff --git a/spec/imbecile/lexer/dfa_spec.rb b/spec/propane/lexer/dfa_spec.rb similarity index 93% rename from spec/imbecile/lexer/dfa_spec.rb rename to spec/propane/lexer/dfa_spec.rb index d692e0e..7adf125 100644 --- a/spec/imbecile/lexer/dfa_spec.rb +++ b/spec/propane/lexer/dfa_spec.rb @@ -50,13 +50,13 @@ class TestLexer end def run(grammar, input) - imbecile = Imbecile.new(grammar) - token_dfa = Imbecile::Lexer::DFA.new(imbecile.instance_variable_get(:@tokens)) + propane = Propane.new(grammar) + token_dfa = Propane::Lexer::DFA.new(propane.instance_variable_get(:@tokens)) test_lexer = TestLexer.new(token_dfa) test_lexer.lex(input) end -describe Imbecile::Lexer::DFA do +describe Propane::Lexer::DFA do it "lexes a simple token" do expect(run(<