Rename to propane

This commit is contained in:
Josh Holtrop 2022-05-28 20:20:03 -04:00
parent fbd215098b
commit ddadc2008b
32 changed files with 60 additions and 100 deletions

View File

@ -1,6 +1,4 @@
source "https://rubygems.org"
# Specify your gem's dependencies in imbecile.gemspec
gemspec
gem "rake"
gem "rspec"

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,3 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec, :example_pattern) do |task, args|

View File

@ -1,5 +0,0 @@
#!/usr/bin/env ruby
require "imbecile"
exit Imbecile::CLI.run(ARGV.dup)

5
bin/propane Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env ruby
require "propane"
exit Propane::CLI.run(ARGV.dup)

View File

@ -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

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec bundle exec ruby bin/imbecile "$@"

View File

@ -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

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
module CLI
USAGE = <<EOF
@ -24,7 +24,7 @@ EOF
log_file = args[i]
end
when "--version"
puts "imbecile v#{VERSION}"
puts "propane v#{VERSION}"
return 0
when "-h", "--help"
puts USAGE
@ -45,7 +45,7 @@ EOF
$stderr.puts "Error: cannot read #{params[0]}"
return 2
end
Imbecile.run(*params, log_file)
Propane.run(*params, log_file)
end
end

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class CodePointRange
MAX_CODE_POINT = 0xFFFFFFFF

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class FA

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class FA
class State

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class FA
class State

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Lexer
# @return [DFA]

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Lexer
class DFA < FA

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Parser

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Parser
class Item

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Parser
class ItemSet

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Regex
attr_reader :unit

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Regex
class NFA < FA

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Regex
class Unit

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Rule

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Token

View File

@ -1,3 +1,3 @@
class Imbecile
class Propane
VERSION = "0.1.0"
end

2
propane.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec bundle exec ruby -Ilib bin/propane "$@"

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
describe CodePointRange do
describe "#<=>" do

View File

@ -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(<<EOF, "foo")).to eq [["foo", "foo"]]
token foo

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
class Parser
describe Item do

View File

@ -1,4 +1,4 @@
class Imbecile
class Propane
RSpec.describe Regex do
it "parses an empty expression" do

View File

@ -1,12 +1,12 @@
require "fileutils"
describe Imbecile do
describe Propane do
def write_grammar(grammar)
File.write("spec/run/testparser.i", grammar)
end
def build_parser
result = system(*%w[./imbecile.sh spec/run/testparser.i spec/run/testparser.d])
result = system(*%w[./propane.sh spec/run/testparser.i spec/run/testparser.d])
expect(result).to be_truthy
end

View File

@ -1,5 +1,5 @@
require "bundler/setup"
require "imbecile"
require "propane"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure