Skip to content

Commit

Permalink
Rename to Kanayago
Browse files Browse the repository at this point in the history
  • Loading branch information
S-H-GAMELINKS committed Sep 2, 2024
1 parent 4ba5e98 commit 0b735e2
Show file tree
Hide file tree
Showing 95 changed files with 1,904 additions and 1,904 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ jobs:
- name: Run install
run: |
bundle exec rake build
gem install pkg/refine_tree-0.1.0.gem
gem install pkg/kanayago-0.1.0.gem
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ inherit_from: .rubocop_todo.yml
Metrics/BlockLength:
Exclude:
- Rakefile
- refine_tree.gemspec
- kanayago.gemspec

RBS:
Enabled: true
Expand Down
32 changes: 16 additions & 16 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Style/Documentation:
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Exclude:
- 'ext/refine_tree/extconf.rb'
- 'ext/kanayago/extconf.rb'

# Offense count: 508
# This cop supports safe autocorrection (--autocorrect).
Expand All @@ -44,18 +44,18 @@ Style/GlobalVars:
# SupportedShorthandSyntax: always, never, either, consistent, either_consistent
Style/HashSyntax:
Exclude:
- 'test/refine_tree/parse_class_test.rb'
- 'test/refine_tree/parse_const_decl_test.rb'
- 'test/refine_tree/parse_const_test.rb'
- 'test/refine_tree/parse_defn_test.rb'
- 'test/refine_tree/parse_fcall_test.rb'
- 'test/refine_tree/parse_float_test.rb'
- 'test/refine_tree/parse_if_test.rb'
- 'test/refine_tree/parse_imaginary_test.rb'
- 'test/refine_tree/parse_integer_test.rb'
- 'test/refine_tree/parse_ivar_test.rb'
- 'test/refine_tree/parse_lasgn_test.rb'
- 'test/refine_tree/parse_lvar_test.rb'
- 'test/refine_tree/parse_rational_test.rb'
- 'test/refine_tree/parse_string_test.rb'
- 'test/refine_tree/parse_sym_test.rb'
- 'test/kanayago/parse_class_test.rb'
- 'test/kanayago/parse_const_decl_test.rb'
- 'test/kanayago/parse_const_test.rb'
- 'test/kanayago/parse_defn_test.rb'
- 'test/kanayago/parse_fcall_test.rb'
- 'test/kanayago/parse_float_test.rb'
- 'test/kanayago/parse_if_test.rb'
- 'test/kanayago/parse_imaginary_test.rb'
- 'test/kanayago/parse_integer_test.rb'
- 'test/kanayago/parse_ivar_test.rb'
- 'test/kanayago/parse_lasgn_test.rb'
- 'test/kanayago/parse_lvar_test.rb'
- 'test/kanayago/parse_rational_test.rb'
- 'test/kanayago/parse_string_test.rb'
- 'test/kanayago/parse_sym_test.rb'
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source 'https://rubygems.org'

# Specify your gem's dependencies in refine_tree.gemspec
# Specify your gem's dependencies in kanayago.gemspec
gemspec

gem 'lrama', '~> 0.6'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
refine_tree (0.1.0)
kanayago (0.1.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -54,11 +54,11 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
kanayago!
lrama (~> 0.6)
minitest
rake (~> 13.0)
rake-compiler
refine_tree!
rubocop
rubocop-minitest
rubocop-on-rbs
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RefineTree
# Kanayago

Trying to Make Ruby's Parser Available as a Gem.

Expand All @@ -13,28 +13,28 @@ RUBY_CONFIGURE_OPTS="cppflags=-DUNIVERSAL_PARSER" rbenv install ruby-dev
Clone this repository.

```console
git clone https://github.com/S-H-GAMELINKS/refine_tree.git
git clone https://github.com/S-H-GAMELINKS/kanayago.git
```

Move `refine_tree` directory, and run `bundle install`.
Move `kanayago` directory, and run `bundle install`.

```console
cd refine_tree && bundle install
cd kanayago && bundle install
```

Finally, build `RefineTree` gem and install it.
Finally, build `Kanayago` gem and install it.

```console
bundle exec rake build
gem install pkg/refine_tree-0.1.0.gem
gem install pkg/kanayago-0.1.0.gem
```

## Usage

```ruby
require 'refine_tree/refine_tree'
require 'kanayago/kanayago'

result = RefineTree.parse('117 + 117')
result = Kanayago.parse('117 + 117')

p result
# =>
Expand Down Expand Up @@ -68,7 +68,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/S-H-GAMELINKS/refine_tree.
Bug reports and pull requests are welcome on GitHub at https://github.com/S-H-GAMELINKS/kanayago.

## Referenced implementations

Expand Down
16 changes: 8 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace :ruby_parser do
task :import do
`git clone https://github.com/ruby/ruby.git tmp/ruby --depth=1`

dist = File.expand_path('ext/refine_tree', __dir__)
dist = File.expand_path('ext/kanayago', __dir__)
ruby_dir = File.expand_path('tmp/ruby', __dir__)

directories = ['ccan', 'ccan/check_type', 'ccan/container', 'ccan/container_of', 'ccan/list', 'ccan/str',
Expand Down Expand Up @@ -120,12 +120,12 @@ namespace :ruby_parser do

desc 'build ruby parse.c and parse.h with lrama'
task :build do
sh 'bundle exec lrama -oext/refine_tree/parse.c -Hext/refine_tree/parse.h ext/refine_tree/parse.tmp.y'
sh 'bundle exec lrama -oext/kanayago/parse.c -Hext/kanayago/parse.h ext/kanayago/parse.tmp.y'
end

desc 'clean to ruby parser file'
task :clean do
dist = File.expand_path('./ext/refine_tree')
dist = File.expand_path('./ext/kanayago')

COPY_TARGETS.each do |target|
FileUtils.rm File.join(dist, target), force: true
Expand All @@ -148,10 +148,10 @@ end
task build: ['ruby_parser:build', 'compile']
task install: ['ruby_parser:build', 'compile']

GEMSPEC = Gem::Specification.load('refine_tree.gemspec')
GEMSPEC = Gem::Specification.load('kanayago.gemspec')

Rake::ExtensionTask.new('refine_tree', GEMSPEC) do |ext|
ext.lib_dir = 'lib/refine_tree'
Rake::ExtensionTask.new('kanayago', GEMSPEC) do |ext|
ext.lib_dir = 'lib/kanayago'
end

Rake::TestTask.new(:test) do |t|
Expand All @@ -160,12 +160,12 @@ Rake::TestTask.new(:test) do |t|
t.test_files = FileList['test/**/*_test.rb']
end

desc 'try to refine_tree code'
desc 'try to kanayago code'
task :run do
sh 'ruby test.rb'
end

desc 'debug to refine_tree code in gdb'
desc 'debug to kanayago code in gdb'
task :gdb do
sh 'bundle exec gdb --args ruby test.rb'
end
Expand Down
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# frozen_string_literal: true

require 'bundler/setup'
require 'mjollnir'
require 'kanayago'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions ext/refine_tree/extconf.rb → ext/kanayago/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
parse
parser_st
ruby_parser
refine_tree
kanayago
].map do |o|
o + ".#{$OBJEXT}"
end

append_cflags('-fvisibility=hidden')
append_cppflags('-DUNIVERSAL_PARSER=1')

$INCFLAGS << ' -I' << File.expand_path('../refine_tree', __dir__)
$INCFLAGS << ' -I' << File.expand_path('../kanayago', __dir__)
$INCFLAGS << ' -I' << File.expand_path('../..', __dir__)

create_makefile('refine_tree/refine_tree')
create_makefile('kanayago/kanayago')
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct lex_pointer_string {
long ptr;
};

// Add Ruby's Parser struct and enum for RefineTree
// Add Ruby's Parser struct and enum for Kanayago
enum lex_type {
lex_type_str,
lex_type_io,
Expand All @@ -36,7 +36,7 @@ struct ruby_parser {
} lex_array;
} data;
};
// End for RefineTree
// End for Kanayago

RUBY_SYMBOL_EXPORT_BEGIN
#ifdef UNIVERSAL_PARSER
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions ext/refine_tree/refine_tree.c → ext/kanayago/kanayago.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "refine_tree.h"
#include "kanayago.h"
#include "internal/ruby_parser.h"
#include "ruby/ruby.h"
#include "rubyparser.h"
Expand All @@ -7,7 +7,7 @@
#define symbol(arg) \
ID2SYM(rb_intern((arg)))

VALUE rb_mRefineTree;
VALUE rb_mKanayago;

static VALUE ast_to_hash(const NODE *);

Expand Down Expand Up @@ -413,8 +413,8 @@ parse(VALUE self, VALUE source)
}

RUBY_FUNC_EXPORTED void
Init_refine_tree(void)
Init_kanayago(void)
{
rb_mRefineTree = rb_define_module("RefineTree");
rb_define_module_function(rb_mRefineTree, "refine_tree_parse", parse, 1);
rb_mKanayago = rb_define_module("Kanayago");
rb_define_module_function(rb_mKanayago, "kanayago_parse", parse, 1);
}
10 changes: 5 additions & 5 deletions ext/refine_tree/refine_tree.h → ext/kanayago/kanayago.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef REFINE_TREE_H
#define REFINE_TREE_H 1
#ifndef KANAYAGO_H
#define KANAYAGO_H 1

#include "node.h"
#include "internal/ruby_parser.h"
Expand All @@ -13,9 +13,9 @@ VALUE rb_node_imaginary_literal_val(const NODE *);
VALUE rb_node_str_string_val(const NODE *);
VALUE rb_node_sym_string_val(const NODE *);

// Add extern for RefineTree
// Add extern for Kanayago
extern const rb_data_type_t ruby_parser_data_type;
extern const rb_data_type_t ast_data_type;
// End for RefineTree
// End for Kanayago

#endif /* REFINE_TREE_H */
#endif /* KANAYAGO_H */
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0b735e2

Please sign in to comment.