Rename to propane
This commit is contained in:
parent
fbd215098b
commit
ddadc2008b
4
Gemfile
4
Gemfile
@ -1,6 +1,4 @@
|
|||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
# Specify your gem's dependencies in imbecile.gemspec
|
|
||||||
gemspec
|
|
||||||
|
|
||||||
gem "rake"
|
gem "rake"
|
||||||
|
gem "rspec"
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
PATH
|
|
||||||
remote: .
|
|
||||||
specs:
|
|
||||||
imbecile (0.1.0)
|
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
@ -26,9 +21,8 @@ PLATFORMS
|
|||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
imbecile!
|
|
||||||
rake
|
rake
|
||||||
rspec (~> 3.0)
|
rspec
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.0.dev
|
2.4.0.dev
|
||||||
|
10
README.md
10
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
|
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:
|
Add this line to your application's Gemfile:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
gem 'imbecile'
|
gem 'propane'
|
||||||
```
|
```
|
||||||
|
|
||||||
And then execute:
|
And then execute:
|
||||||
@ -18,7 +18,7 @@ And then execute:
|
|||||||
|
|
||||||
Or install it yourself as:
|
Or install it yourself as:
|
||||||
|
|
||||||
$ gem install imbecile
|
$ gem install propane
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|||||||
|
|
||||||
## Contributing
|
## 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
|
## License
|
||||||
|
1
Rakefile
1
Rakefile
@ -1,4 +1,3 @@
|
|||||||
require "bundler/gem_tasks"
|
|
||||||
require "rspec/core/rake_task"
|
require "rspec/core/rake_task"
|
||||||
|
|
||||||
RSpec::Core::RakeTask.new(:spec, :example_pattern) do |task, args|
|
RSpec::Core::RakeTask.new(:spec, :example_pattern) do |task, args|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env ruby
|
|
||||||
|
|
||||||
require "imbecile"
|
|
||||||
|
|
||||||
exit Imbecile::CLI.run(ARGV.dup)
|
|
5
bin/propane
Executable file
5
bin/propane
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require "propane"
|
||||||
|
|
||||||
|
exit Propane::CLI.run(ARGV.dup)
|
@ -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
|
|
@ -1,2 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
exec bundle exec ruby bin/imbecile "$@"
|
|
@ -1,23 +1,23 @@
|
|||||||
require "erb"
|
require "erb"
|
||||||
require "set"
|
require "set"
|
||||||
require_relative "imbecile/cli"
|
require_relative "propane/cli"
|
||||||
require_relative "imbecile/code_point_range"
|
require_relative "propane/code_point_range"
|
||||||
require_relative "imbecile/fa"
|
require_relative "propane/fa"
|
||||||
require_relative "imbecile/fa/state"
|
require_relative "propane/fa/state"
|
||||||
require_relative "imbecile/fa/state/transition"
|
require_relative "propane/fa/state/transition"
|
||||||
require_relative "imbecile/lexer"
|
require_relative "propane/lexer"
|
||||||
require_relative "imbecile/lexer/dfa"
|
require_relative "propane/lexer/dfa"
|
||||||
require_relative "imbecile/parser"
|
require_relative "propane/parser"
|
||||||
require_relative "imbecile/parser/item"
|
require_relative "propane/parser/item"
|
||||||
require_relative "imbecile/parser/item_set"
|
require_relative "propane/parser/item_set"
|
||||||
require_relative "imbecile/regex"
|
require_relative "propane/regex"
|
||||||
require_relative "imbecile/regex/nfa"
|
require_relative "propane/regex/nfa"
|
||||||
require_relative "imbecile/regex/unit"
|
require_relative "propane/regex/unit"
|
||||||
require_relative "imbecile/rule"
|
require_relative "propane/rule"
|
||||||
require_relative "imbecile/token"
|
require_relative "propane/token"
|
||||||
require_relative "imbecile/version"
|
require_relative "propane/version"
|
||||||
|
|
||||||
class Imbecile
|
class Propane
|
||||||
|
|
||||||
# EOF.
|
# EOF.
|
||||||
TOKEN_EOF = 0xFFFFFFFC
|
TOKEN_EOF = 0xFFFFFFFC
|
||||||
@ -123,8 +123,8 @@ class Imbecile
|
|||||||
|
|
||||||
def run(input_file, output_file, log_file)
|
def run(input_file, output_file, log_file)
|
||||||
begin
|
begin
|
||||||
imbecile = Imbecile.new(File.read(input_file))
|
propane = Propane.new(File.read(input_file))
|
||||||
imbecile.generate(output_file, log_file)
|
propane.generate(output_file, log_file)
|
||||||
rescue Error => e
|
rescue Error => e
|
||||||
$stderr.puts e.message
|
$stderr.puts e.message
|
||||||
return 2
|
return 2
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
module CLI
|
module CLI
|
||||||
|
|
||||||
USAGE = <<EOF
|
USAGE = <<EOF
|
||||||
@ -24,7 +24,7 @@ EOF
|
|||||||
log_file = args[i]
|
log_file = args[i]
|
||||||
end
|
end
|
||||||
when "--version"
|
when "--version"
|
||||||
puts "imbecile v#{VERSION}"
|
puts "propane v#{VERSION}"
|
||||||
return 0
|
return 0
|
||||||
when "-h", "--help"
|
when "-h", "--help"
|
||||||
puts USAGE
|
puts USAGE
|
||||||
@ -45,7 +45,7 @@ EOF
|
|||||||
$stderr.puts "Error: cannot read #{params[0]}"
|
$stderr.puts "Error: cannot read #{params[0]}"
|
||||||
return 2
|
return 2
|
||||||
end
|
end
|
||||||
Imbecile.run(*params, log_file)
|
Propane.run(*params, log_file)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class CodePointRange
|
class CodePointRange
|
||||||
|
|
||||||
MAX_CODE_POINT = 0xFFFFFFFF
|
MAX_CODE_POINT = 0xFFFFFFFF
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
|
|
||||||
class FA
|
class FA
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class FA
|
class FA
|
||||||
|
|
||||||
class State
|
class State
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class FA
|
class FA
|
||||||
class State
|
class State
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class Lexer
|
class Lexer
|
||||||
|
|
||||||
# @return [DFA]
|
# @return [DFA]
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class Lexer
|
class Lexer
|
||||||
|
|
||||||
class DFA < FA
|
class DFA < FA
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
|
|
||||||
class Parser
|
class Parser
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class Parser
|
class Parser
|
||||||
|
|
||||||
class Item
|
class Item
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class Parser
|
class Parser
|
||||||
|
|
||||||
class ItemSet
|
class ItemSet
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class Regex
|
class Regex
|
||||||
|
|
||||||
attr_reader :unit
|
attr_reader :unit
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class Regex
|
class Regex
|
||||||
|
|
||||||
class NFA < FA
|
class NFA < FA
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class Regex
|
class Regex
|
||||||
|
|
||||||
class Unit
|
class Unit
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
|
|
||||||
class Rule
|
class Rule
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
|
|
||||||
class Token
|
class Token
|
||||||
|
|
@ -1,3 +1,3 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
VERSION = "0.1.0"
|
VERSION = "0.1.0"
|
||||||
end
|
end
|
2
propane.sh
Executable file
2
propane.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
exec bundle exec ruby -Ilib bin/propane "$@"
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
describe CodePointRange do
|
describe CodePointRange do
|
||||||
|
|
||||||
describe "#<=>" do
|
describe "#<=>" do
|
@ -50,13 +50,13 @@ class TestLexer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def run(grammar, input)
|
def run(grammar, input)
|
||||||
imbecile = Imbecile.new(grammar)
|
propane = Propane.new(grammar)
|
||||||
token_dfa = Imbecile::Lexer::DFA.new(imbecile.instance_variable_get(:@tokens))
|
token_dfa = Propane::Lexer::DFA.new(propane.instance_variable_get(:@tokens))
|
||||||
test_lexer = TestLexer.new(token_dfa)
|
test_lexer = TestLexer.new(token_dfa)
|
||||||
test_lexer.lex(input)
|
test_lexer.lex(input)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe Imbecile::Lexer::DFA do
|
describe Propane::Lexer::DFA do
|
||||||
it "lexes a simple token" do
|
it "lexes a simple token" do
|
||||||
expect(run(<<EOF, "foo")).to eq [["foo", "foo"]]
|
expect(run(<<EOF, "foo")).to eq [["foo", "foo"]]
|
||||||
token foo
|
token foo
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
class Parser
|
class Parser
|
||||||
|
|
||||||
describe Item do
|
describe Item do
|
@ -1,4 +1,4 @@
|
|||||||
class Imbecile
|
class Propane
|
||||||
RSpec.describe Regex do
|
RSpec.describe Regex do
|
||||||
|
|
||||||
it "parses an empty expression" do
|
it "parses an empty expression" do
|
@ -1,12 +1,12 @@
|
|||||||
require "fileutils"
|
require "fileutils"
|
||||||
|
|
||||||
describe Imbecile do
|
describe Propane do
|
||||||
def write_grammar(grammar)
|
def write_grammar(grammar)
|
||||||
File.write("spec/run/testparser.i", grammar)
|
File.write("spec/run/testparser.i", grammar)
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_parser
|
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
|
expect(result).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
require "bundler/setup"
|
require "bundler/setup"
|
||||||
require "imbecile"
|
require "propane"
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
# Enable flags like --only-failures and --next-failure
|
# Enable flags like --only-failures and --next-failure
|
||||||
|
Loading…
x
Reference in New Issue
Block a user