Skip to content

Commit

Permalink
Finish 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Dec 29, 2021
2 parents cb90783 + c735eba commit 6be5db0
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
runs-on: ubuntu-latest
env:
CI: true
ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') }}
ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'jruby' }}
strategy:
fail-fast: false
matrix:
ruby:
- 2.5
- 2.6
- 2.7
- 3.0
- 3.1
- ruby-head
- jruby
steps:
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- name: Run tests
run: bundle exec rspec spec || $ALLOW_FAILURES
run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES
- name: Coveralls GitHub Action
uses: coverallsapp/[email protected]
if: "matrix.ruby == '3.0'"
Expand Down
14 changes: 8 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ gem 'sxp', github: "dryruby/sxp.rb", branch: "develop"
gem 'rdf', github: "ruby-rdf/rdf", branch: "develop"

group :development do
gem 'rdf-spec', github: "ruby-rdf/rdf-spec", branch: "develop"
gem "byebug", platforms: :mri
gem 'psych', platforms: [:mri, :rbx]
gem "redcarpet", platforms: :mri
gem "rocco", platforms: :mri
gem "pygmentize", platforms: :mri
gem 'rdf-isomorphic', github: "ruby-rdf/rdf-isomorphic", branch: "develop"
gem 'rdf-spec', github: "ruby-rdf/rdf-spec", branch: "develop"
gem 'rdf-turtle', github: "ruby-rdf/rdf-turtle", branch: "develop"
gem "byebug", platforms: :mri
gem 'psych', platforms: [:mri, :rbx]
gem "redcarpet", platforms: :mri
gem "rocco", platforms: :mri
gem "pygmentize", platforms: :mri
end

group :development, :test do
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.1
2.3.0
1 change: 0 additions & 1 deletion bin/ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# * And with First/Follow rules

$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", 'lib')))
require "bundler/setup"
require 'rubygems'
require 'getoptlong'
require 'ebnf'
Expand Down
16 changes: 8 additions & 8 deletions ebnf.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ Gem::Specification.new do |gem|
gem.executables = %w(ebnf)
gem.require_paths = %w(lib)

gem.required_ruby_version = '>= 2.4'
gem.required_ruby_version = '>= 2.6'
gem.requirements = []
gem.add_runtime_dependency 'sxp', '~> 1.1'
gem.add_runtime_dependency 'sxp', '~> 1.2'
gem.add_runtime_dependency 'scanf', '~> 1.0'
gem.add_runtime_dependency 'rdf', '~> 3.1' # Required by sxp
gem.add_runtime_dependency 'rdf', '~> 3.2' # Required by sxp
gem.add_runtime_dependency 'htmlentities', '~> 4.3'
gem.add_runtime_dependency 'unicode-types', '~> 1.6'
gem.add_runtime_dependency 'amazing_print', '~> 1.2'
gem.add_development_dependency 'rdf-spec', '~> 3.1'
gem.add_development_dependency 'rdf-turtle', '~> 3.1'
gem.add_development_dependency 'nokogiri', '~> 1.10'
gem.add_runtime_dependency 'unicode-types', '~> 1.7'
gem.add_runtime_dependency 'amazing_print', '~> 1.4'
gem.add_development_dependency 'rdf-spec', '~> 3.2'
gem.add_development_dependency 'rdf-turtle', '~> 3.2'
gem.add_development_dependency 'nokogiri', '~> 1.12'
gem.add_development_dependency 'erubis', '~> 2.7'
gem.add_development_dependency 'rspec', '~> 3.10'
gem.add_development_dependency 'rspec-its', '~> 1.3'
Expand Down
4 changes: 3 additions & 1 deletion examples/abnf/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ def ast
end

# Output formatted S-Expression of grammar
def to_sxp
#
# @return [String]
def to_sxp(**options)
require 'sxp' unless defined?(SXP)
# Output rules as a formatted S-Expression
SXP::Generator.string(ast.map(&:for_sxp))
Expand Down
4 changes: 3 additions & 1 deletion examples/ebnf-ll1-parser/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ def initialize(input, **options, &block)
end

# Output formatted S-Expression of grammar
def to_sxp
#
# @return [String]
def to_sxp(**options)
require 'sxp' unless defined?(SXP)
# Output rules as a formatted S-Expression
SXP::Generator.string(@ast.map(&:for_sxp))
Expand Down
4 changes: 3 additions & 1 deletion examples/ebnf-peg-parser/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ def initialize(input, **options, &block)
end

# Output formatted S-Expression of grammar
def to_sxp
#
# @return [String]
def to_sxp(**options)
require 'sxp' unless defined?(SXP)
# Output rules as a formatted S-Expression
SXP::Generator.string(@ast.map(&:for_sxp))
Expand Down
4 changes: 3 additions & 1 deletion examples/isoebnf/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ def initialize(input, **options, &block)
end

# Output formatted S-Expression of grammar
def to_sxp
#
# @return [String]
def to_sxp(**options)
require 'sxp' unless defined?(SXP)
# Output rules as a formatted S-Expression
SXP::Generator.string(@ast.map(&:for_sxp))
Expand Down
3 changes: 2 additions & 1 deletion lib/ebnf/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ def each(kind, &block)

##
# Write out parsed syntax string as an S-Expression
#
# @return [String]
def to_sxp
def to_sxp(**options)
require 'sxp' unless defined?(SXP)
SXP::Generator.string(ast.map(&:for_sxp))
end
Expand Down
6 changes: 4 additions & 2 deletions lib/ebnf/rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,11 @@ def for_sxp
end

# Return SXP representation of this rule
#
# @return [String]
def to_sxp
def to_sxp(**options)
require 'sxp' unless defined?(SXP)
for_sxp.to_sxp
for_sxp.to_sxp(**options)
end

alias_method :to_s, :to_sxp
Expand Down Expand Up @@ -416,6 +417,7 @@ def inspect
# @param [Rule] other
# @return [Boolean]
def ==(other)
other.is_a?(Rule) &&
sym == other.sym &&
kind == other.kind &&
expr == other.expr
Expand Down
1 change: 1 addition & 0 deletions spec/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
it "parses generated SXP for #{input.inspect}" do
ast = parse(expected, format: :sxp).ast
ast.each {|r| expect(r).to be_a(EBNF::Rule)}
ast.to_sxp
expect(ast.to_sxp).to produce(expected, @debug)
end
end
Expand Down
4 changes: 3 additions & 1 deletion spec/ll1/data/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ def initialize(input, **options, &block)
end

# Output formatted S-Expression of grammar
def to_sxp
#
# @return [String]
def to_sxp(**options)
require 'sxp' unless defined?(SXP)
# Output rules as a formatted S-Expression
SXP::Generator.string(@ast.map(&:for_sxp))
Expand Down
4 changes: 3 additions & 1 deletion spec/peg/data/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ def initialize(input, **options, &block)
end

# Output formatted S-Expression of grammar
def to_sxp
#
# @return [String]
def to_sxp(**options)
require 'sxp' unless defined?(SXP)
# Output rules as a formatted S-Expression
SXP::Generator.string(@ast.map(&:for_sxp))
Expand Down

0 comments on commit 6be5db0

Please sign in to comment.