Hello community,
here is the log from the commit of package rubygem-treetop for openSUSE:Factory checked in at 2015-07-02 22:49:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-treetop (Old)
and /work/SRC/openSUSE:Factory/.rubygem-treetop.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-treetop"
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-treetop/rubygem-treetop.changes 2015-04-12 00:11:01.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-treetop.new/rubygem-treetop.changes 2015-07-03 00:20:35.000000000 +0200
@@ -1,0 +2,6 @@
+Tue Jun 30 04:31:25 UTC 2015 - coolo@suse.com
+
+- updated to version 1.6.3
+ no changelog found
+
+-------------------------------------------------------------------
Old:
----
treetop-1.6.2.gem
New:
----
treetop-1.6.3.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-treetop.spec ++++++
--- /var/tmp/diff_new_pack.AZ1LvN/_old 2015-07-03 00:20:35.000000000 +0200
+++ /var/tmp/diff_new_pack.AZ1LvN/_new 2015-07-03 00:20:35.000000000 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-treetop
-Version: 1.6.2
+Version: 1.6.3
Release: 0
%define mod_name treetop
%define mod_full_name %{mod_name}-%{version}
@@ -42,7 +42,7 @@
PreReq: update-alternatives
%description
-A Ruby-based text parsing and interpretation DSL.
+A Parsing Expression Grammar (PEG) Parser generator DSL for Ruby.
%prep
++++++ treetop-1.6.2.gem -> treetop-1.6.3.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile 2014-12-09 05:55:36.000000000 +0100
+++ new/Rakefile 2015-06-30 05:32:42.000000000 +0200
@@ -15,6 +15,7 @@
gem.homepage = "https://github.com/cjheath/treetop"
gem.platform = Gem::Platform::RUBY
gem.summary = "A Ruby-based text parsing and interpretation DSL"
+ gem.description = "A Parsing Expression Grammar (PEG) Parser generator DSL for Ruby"
gem.files = [
"LICENSE", "README.md", "Rakefile", "treetop.gemspec",
"{spec,lib,bin,examples}/**/*",
@@ -23,7 +24,6 @@
gem.bindir = "bin"
gem.executables = ["tt"]
gem.require_path = "lib"
- gem.autorequire = "treetop"
gem.has_rdoc = false
end
Jeweler::RubygemsDotOrgTasks.new
@@ -43,6 +43,13 @@
Treetop::Compiler::GrammarCompiler.new.compile(METAGRAMMAR_PATH)
end
+task :rebuild do
+ $:.unshift "lib"
+ require './lib/treetop'
+ load File.expand_path('../lib/treetop/compiler/metagrammar.rb', __FILE__)
+ Treetop::Compiler::GrammarCompiler.new.compile('lib/treetop/compiler/metagrammar.treetop')
+end
+
task :version do
puts RUBY_VERSION
end
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doc/syntactic_recognition.markdown new/doc/syntactic_recognition.markdown
--- old/doc/syntactic_recognition.markdown 2014-12-09 05:55:36.000000000 +0100
+++ new/doc/syntactic_recognition.markdown 2015-06-30 05:32:42.000000000 +0200
@@ -215,3 +215,6 @@
requires that the rule would produce the same result (if run again) as it produced the first time when
the result was remembered. If you violate this principle in your semantic predicates, be prepared to
fight Cerberus before you're allowed out of Hades again.
+
+There's an example of how to use semantic predicates to parse a language with white-space indented blocks
+in the examples directory.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/indented_blocks/indented_blocks.tt new/examples/indented_blocks/indented_blocks.tt
--- old/examples/indented_blocks/indented_blocks.tt 1970-01-01 01:00:00.000000000 +0100
+++ new/examples/indented_blocks/indented_blocks.tt 2015-06-30 05:32:42.000000000 +0200
@@ -0,0 +1,73 @@
+grammar IndentedBlocks
+ rule top
+ # Initialise the indent stack with a sentinel:
+ &{|s| @indents = [-1] }
+ foo:('foo'?)
+ nested_blocks
+ {
+ def inspect
+ nested_blocks.inspect
+ end
+ }
+ end
+
+ rule nested_blocks
+ (
+ # Do not try to extract this semantic predicate into a new rule.
+ # It will be memo-ized incorrectly because @indents.last will change.
+ !{|s|
+ # Peek at the following indentation:
+ save = index; i = _nt_indentation; index = save
+ # We're closing if the indentation is less or the same as our enclosing block's:
+ closing = i.text_value.length <= @indents.last
+ }
+ block
+ )*
+ {
+ def inspect
+ elements.map{|e| e.block.inspect}*"\n"
+ end
+ }
+ end
+
+ rule block
+ indented_line # The block's opening line
+ &{|s| # Push the indent level to the stack
+ level = s[0].indentation.text_value.length
+ @indents << level
+ true
+ }
+ nested_blocks # Parse any nested blocks
+ &{|s| # Pop the indent stack
+ # Note that under no circumstances should "nested_blocks" fail, or the stack will be mis-aligned
+ @indents.pop
+ true
+ }
+ {
+ def inspect
+ indented_line.inspect +
+ (nested_blocks.elements.size > 0 ? (
+ "\n{\n" +
+ nested_blocks.elements.map { |content|
+ content.block.inspect+"\n"
+ }*'' +
+ "}"
+ )
+ : "")
+ end
+ }
+ end
+
+ rule indented_line
+ indentation text:((!"\n" .)*) "\n"
+ {
+ def inspect
+ text.text_value
+ end
+ }
+ end
+
+ rule indentation
+ ' '*
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/indented_blocks/indented_blocks_test.rb new/examples/indented_blocks/indented_blocks_test.rb
--- old/examples/indented_blocks/indented_blocks_test.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/examples/indented_blocks/indented_blocks_test.rb 2015-06-30 05:32:42.000000000 +0200
@@ -0,0 +1,24 @@
+require 'polyglot'
+require 'byebug'
+require 'treetop'
+require 'indented_blocks'
+
+parser = IndentedBlocksParser.new
+
+input = < 0 && atomic.inline_modules.size > 0
suffix.compile(address, builder, self)
end
@@ -1492,12 +1476,8 @@
node_class_declarations.node_class_name
end
- def parent_modules
- node_class_declarations.inline_modules
- end
-
def inline_modules
- atomic.inline_modules + parent_modules
+ atomic.inline_modules + node_class_declarations.inline_modules
end
def inline_module_name
@@ -1517,7 +1497,6 @@
module Primary7
def compile(address, builder, parent_expression=nil)
- # debugger if node_class_declarations.inline_modules.size > 0 && atomic.inline_modules.size > 0
atomic.compile(address, builder, self)
end
@@ -1525,12 +1504,8 @@
node_class_declarations.node_class_name
end
- def parent_modules
- node_class_declarations.inline_modules
- end
-
def inline_modules
- atomic.inline_modules + parent_modules
+ atomic.inline_modules + node_class_declarations.inline_modules
end
def inline_module_name
@@ -1698,10 +1673,6 @@
sequence_primary.compile(lexical_address, builder)
end
- def parent_modules
- []
- end
-
def inline_modules
sequence_primary.inline_modules
end
@@ -1758,10 +1729,6 @@
sequence_primary.compile(lexical_address, builder)
end
- def parent_modules
- []
- end
-
def inline_modules
sequence_primary.inline_modules
end
@@ -1965,10 +1932,6 @@
elements[1]
end
- def parent_modules
- []
- end
-
def inline_modules
atomic.inline_modules
end
@@ -1995,9 +1958,6 @@
def prefixed_expression
atomic
end
- def parent_modules
- []
- end
def inline_modules
[]
end
@@ -2022,10 +1982,6 @@
nil
end
- def parent_modules
- []
- end
-
def inline_modules
atomic.inline_modules
end
@@ -2201,7 +2157,6 @@
node_class_expression.node_class_name
end
-# !!!! cjh !!!!!
def inline_modules
trailing_inline_module.inline_modules
end
@@ -2489,9 +2444,6 @@
end
module ParenthesizedExpression1
- def parent_modules
- []
- end
def inline_modules
parsing_expression.inline_modules
end
@@ -3594,9 +3546,6 @@
end
module TrailingInlineModule1
- def parent_modules
- []
- end
def inline_modules
[inline_module]
end
@@ -3607,9 +3556,6 @@
end
module TrailingInlineModule2
- def parent_modules
- []
- end
def inline_modules
[]
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/compiler/metagrammar.treetop new/lib/treetop/compiler/metagrammar.treetop
--- old/lib/treetop/compiler/metagrammar.treetop 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/compiler/metagrammar.treetop 2015-06-30 05:32:42.000000000 +0200
@@ -84,10 +84,6 @@
super.elements.map {|elt| elt.alternative}
end
- def parent_modules
- []
- end
-
def inline_modules
(alternatives.map {|alt| alt.inline_modules }).flatten
end
@@ -104,14 +100,10 @@
sequence_body.tail
end
- def parent_modules
- node_class_declarations.inline_modules
- end
-
def inline_modules
(sequence_elements.map {|elt| elt.inline_modules}).flatten +
[sequence_element_accessor_module] +
- parent_modules
+ node_class_declarations.inline_modules
end
def inline_module_name
@@ -158,10 +150,6 @@
atomic
end
- def parent_modules
- []
- end
-
def inline_modules
atomic.inline_modules
end
@@ -178,9 +166,6 @@
def prefixed_expression
atomic
end
- def parent_modules
- []
- end
def inline_modules
[]
end
@@ -188,7 +173,6 @@
/
atomic suffix node_class_declarations {
def compile(address, builder, parent_expression=nil)
- raise "Extraneous module ignored after suffix: #{input[interval].inspect}" if node_class_declarations.inline_modules.size > 0 && atomic.inline_modules.size > 0
suffix.compile(address, builder, self)
end
@@ -200,12 +184,8 @@
node_class_declarations.node_class_name
end
- def parent_modules
- node_class_declarations.inline_modules
- end
-
def inline_modules
- atomic.inline_modules + parent_modules
+ atomic.inline_modules + node_class_declarations.inline_modules
end
def inline_module_name
@@ -215,7 +195,6 @@
/
atomic node_class_declarations {
def compile(address, builder, parent_expression=nil)
- raise "Extraneous module ignored with nested atomic: #{input[interval].inspect}" if node_class_declarations.inline_modules.size > 0 && atomic.inline_modules.size > 0
atomic.compile(address, builder, self)
end
@@ -223,12 +202,8 @@
node_class_declarations.node_class_name
end
- def parent_modules
- node_class_declarations.inline_modules
- end
-
def inline_modules
- atomic.inline_modules + parent_modules
+ atomic.inline_modules + node_class_declarations.inline_modules
end
def inline_module_name
@@ -247,10 +222,6 @@
sequence_primary.compile(lexical_address, builder)
end
- def parent_modules
- []
- end
-
def inline_modules
sequence_primary.inline_modules
end
@@ -267,10 +238,6 @@
sequence_primary.compile(lexical_address, builder)
end
- def parent_modules
- []
- end
-
def inline_modules
sequence_primary.inline_modules
end
@@ -315,10 +282,6 @@
elements[1]
end
- def parent_modules
- []
- end
-
def inline_modules
atomic.inline_modules
end
@@ -335,9 +298,6 @@
def prefixed_expression
atomic
end
- def parent_modules
- []
- end
def inline_modules
[]
end
@@ -352,10 +312,6 @@
nil
end
- def parent_modules
- []
- end
-
def inline_modules
atomic.inline_modules
end
@@ -382,7 +338,6 @@
node_class_expression.node_class_name
end
-# !!!! cjh !!!!!
def inline_modules
trailing_inline_module.inline_modules
end
@@ -419,9 +374,6 @@
rule parenthesized_expression
'(' space? parsing_expression space? ')' <ParenthesizedExpression> {
- def parent_modules
- []
- end
def inline_modules
parsing_expression.inline_modules
end
@@ -487,9 +439,6 @@
rule trailing_inline_module
space inline_module {
- def parent_modules
- []
- end
def inline_modules
[inline_module]
end
@@ -500,9 +449,6 @@
}
/
'' {
- def parent_modules
- []
- end
def inline_modules
[]
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/compiler/node_classes/anything_symbol.rb new/lib/treetop/compiler/node_classes/anything_symbol.rb
--- old/lib/treetop/compiler/node_classes/anything_symbol.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/compiler/node_classes/anything_symbol.rb 2015-06-30 05:32:42.000000000 +0200
@@ -6,7 +6,7 @@
builder.if__ "index < input_length" do
if address == 0 || decorated?
assign_result "instantiate_node(#{node_class_name},input, index...(index + 1))"
- extend_result_with_inline_module parent_expression
+ extend_result_with_inline_module
else
assign_lazily_instantiated_node
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/compiler/node_classes/character_class.rb new/lib/treetop/compiler/node_classes/character_class.rb
--- old/lib/treetop/compiler/node_classes/character_class.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/compiler/node_classes/character_class.rb 2015-06-30 05:32:42.000000000 +0200
@@ -7,7 +7,7 @@
builder.if__ "has_terminal?(@regexps[gr = #{grounded_regexp(text_value)}] ||= Regexp.new(gr), :regexp, index)" do
if address == 0 || decorated?
assign_result "instantiate_node(#{node_class_name},input, index...(index + 1))"
- extend_result_with_inline_module parent_expression
+ extend_result_with_inline_module
else
assign_lazily_instantiated_node
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/compiler/node_classes/choice.rb new/lib/treetop/compiler/node_classes/choice.rb
--- old/lib/treetop/compiler/node_classes/choice.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/compiler/node_classes/choice.rb 2015-06-30 05:32:42.000000000 +0200
@@ -5,11 +5,11 @@
super
begin_comment(self)
use_vars :result, :start_index
- compile_alternatives(alternatives, parent_expression)
+ compile_alternatives(alternatives)
end_comment(self)
end
-
- def compile_alternatives(alternatives, parent_expression)
+
+ def compile_alternatives(alternatives)
obtain_new_subexpression_address
alternatives.first.compile(subexpression_address, builder)
builder.if__ subexpression_success? do
@@ -17,14 +17,14 @@
builder << "#{subexpression_result_var} = SyntaxNode.new(input, (index-1)...index) if #{subexpression_result_var} == true"
assign_result subexpression_result_var
extend_result_with_declared_module
- extend_result_with_inline_module parent_expression
+ extend_result_with_inline_module
end
builder.else_ do
if alternatives.size == 1
reset_index
assign_failure start_index_var
else
- compile_alternatives(alternatives[1..-1], parent_expression)
+ compile_alternatives(alternatives[1..-1])
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/compiler/node_classes/nonterminal.rb new/lib/treetop/compiler/node_classes/nonterminal.rb
--- old/lib/treetop/compiler/node_classes/nonterminal.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/compiler/node_classes/nonterminal.rb 2015-06-30 05:32:42.000000000 +0200
@@ -6,8 +6,8 @@
use_vars :result
assign_result text_value == 'super' ? 'super' : "_nt_#{text_value}"
extend_result_with_declared_module
- extend_result_with_inline_module parent_expression
+ extend_result_with_inline_module
end
end
end
-end
+end
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/compiler/node_classes/parsing_expression.rb new/lib/treetop/compiler/node_classes/parsing_expression.rb
--- old/lib/treetop/compiler/node_classes/parsing_expression.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/compiler/node_classes/parsing_expression.rb 2015-06-30 05:32:42.000000000 +0200
@@ -78,14 +78,8 @@
extend_result declared_module_name if declared_module_name
end
- def extend_result_with_inline_module parent_expression = nil
- # debugger if parent_expression && !parent_expression.respond_to?(:parent_modules)
- if parent_expression && parent_expression.parent_modules.size > 0
- parent_expression.parent_modules.each do |inline|
- extend_result inline.module_name
- end
- end
- extend_result inline_module_name if inline_module_name
+ def extend_result_with_inline_module
+ extend_result inline_module_name if inline_module_name
end
def reset_index
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/compiler/node_classes/repetition.rb new/lib/treetop/compiler/node_classes/repetition.rb
--- old/lib/treetop/compiler/node_classes/repetition.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/compiler/node_classes/repetition.rb 2015-06-30 05:32:42.000000000 +0200
@@ -28,9 +28,9 @@
parent_expression.inline_module_name
end
- def assign_and_extend_result parent_expression
+ def assign_and_extend_result
assign_result "instantiate_node(#{node_class_name},input, #{start_index_var}...index, #{accumulator_var})"
- extend_result_with_inline_module parent_expression
+ extend_result_with_inline_module
end
end
@@ -38,7 +38,7 @@
class ZeroOrMore < Repetition
def compile(address, builder, parent_expression)
super
- assign_and_extend_result parent_expression
+ assign_and_extend_result
end_comment(parent_expression)
end
@@ -55,7 +55,7 @@
assign_failure start_index_var
end
builder.else_ do
- assign_and_extend_result parent_expression
+ assign_and_extend_result
end
end_comment(parent_expression)
end
@@ -81,11 +81,11 @@
end
builder.else_ do
clean_unsaturated
- assign_and_extend_result parent_expression
+ assign_and_extend_result
end
else
clean_unsaturated
- assign_and_extend_result parent_expression
+ assign_and_extend_result
end
end_comment(parent_expression)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/compiler/node_classes/sequence.rb new/lib/treetop/compiler/node_classes/sequence.rb
--- old/lib/treetop/compiler/node_classes/sequence.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/compiler/node_classes/sequence.rb 2015-06-30 05:32:42.000000000 +0200
@@ -9,7 +9,7 @@
builder.if__ "#{accumulator_var}.last" do
assign_result "instantiate_node(#{node_class_name},input, #{start_index_var}...index, #{accumulator_var})"
extend_result sequence_element_accessor_module_name if sequence_element_accessor_module_name
- extend_result_with_inline_module parent_expression
+ extend_result_with_inline_module
end
builder.else_ do
reset_index
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/compiler/node_classes/terminal.rb new/lib/treetop/compiler/node_classes/terminal.rb
--- old/lib/treetop/compiler/node_classes/terminal.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/compiler/node_classes/terminal.rb 2015-06-30 05:32:42.000000000 +0200
@@ -25,13 +25,7 @@
builder.if__ "(match_len = has_terminal?(#{str}, #{mode}, index))" do
if address == 0 || decorated? || mode != 'false' || string_length > 1
assign_result "instantiate_node(#{node_class_name},input, index...(index + match_len))"
- # debugger if parent_expression and parent_expression.inline_modules.size > 0
- # extend_result_with_inline_module parent_expression
- if parent_expression
- parent_expression.inline_modules.each do |inline|
- extend_result inline.module_name
- end
- end
+ extend_result_with_inline_module
else
assign_lazily_instantiated_node
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/runtime/syntax_node.rb new/lib/treetop/runtime/syntax_node.rb
--- old/lib/treetop/runtime/syntax_node.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/runtime/syntax_node.rb 2015-06-30 05:32:42.000000000 +0200
@@ -60,7 +60,7 @@
end
end
- def inspect_self(indent="")
+ def inspect(indent="")
em = extension_modules
interesting_methods = methods-[em.last ? em.last.methods : nil]-self.class.instance_methods
im = interesting_methods.size > 0 ? " (#{interesting_methods.join(",")})" : ""
@@ -72,25 +72,18 @@
em.map{|m| "+"+m.to_s.sub(/.*:/,'')}*"" +
" offset=#{interval.first}" +
", #{tv.inspect}" +
- im
- end
-
- def inspect_children(indent="")
- return '' unless elements && elements.size > 0
- ":" +
- elements.map do |e|
- begin
- "\n"+e.inspect(indent+" ")
- rescue # Defend against inspect not taking a parameter
- "\n"+indent+" "+e.inspect
- end
- end.
- join("")
- end
-
- def inspect(indent="")
- inspect_self(indent) +
- inspect_children(indent)
+ im +
+ (elements && elements.size > 0 ?
+ ":" +
+ (elements||[]).map{|e|
+ begin
+ "\n"+e.inspect(indent+" ")
+ rescue # Defend against inspect not taking a parameter
+ "\n"+indent+" "+e.inspect
+ end
+ }.join("") :
+ ""
+ )
end
@@dot_id_counter = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/treetop/version.rb new/lib/treetop/version.rb
--- old/lib/treetop/version.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/lib/treetop/version.rb 2015-06-30 05:32:42.000000000 +0200
@@ -2,7 +2,7 @@
module VERSION #:nodoc:
MAJOR = 1
MINOR = 6
- TINY = 2
+ TINY = 3
STRING = [MAJOR, MINOR, TINY].join('.')
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2014-12-09 05:55:36.000000000 +0100
+++ new/metadata 2015-06-30 05:32:42.000000000 +0200
@@ -1,15 +1,15 @@
--- !ruby/object:Gem::Specification
name: treetop
version: !ruby/object:Gem::Version
- version: 1.6.2
+ version: 1.6.3
platform: ruby
authors:
- Nathan Sobo
- Clifford Heath
-autorequire: treetop
+autorequire:
bindir: bin
cert_chain: []
-date: 2014-12-09 00:00:00.000000000 Z
+date: 2015-06-30 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: polyglot
@@ -99,17 +99,17 @@
name: rake
requirement: !ruby/object:Gem::Requirement
requirements:
- - - ">="
+ - - "~>"
- !ruby/object:Gem::Version
- version: '0'
+ version: '10'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - ">="
+ - - "~>"
- !ruby/object:Gem::Version
- version: '0'
-description:
+ version: '10'
+description: A Parsing Expression Grammar (PEG) Parser generator DSL for Ruby
email: cliffordheath@gmail.com
executables:
- tt
@@ -132,6 +132,10 @@
- doc/syntactic_recognition.markdown
- doc/tt.1
- doc/using_in_ruby.markdown
+- examples/indented_blocks/indented_blocks.tt
+- examples/indented_blocks/indented_blocks_test.rb
+- examples/inner_outer.rb
+- examples/inner_outer.tt
- examples/lambda_calculus/arithmetic.rb
- examples/lambda_calculus/arithmetic.treetop
- examples/lambda_calculus/arithmetic_node_classes.rb
@@ -141,6 +145,8 @@
- examples/lambda_calculus/lambda_calculus_node_classes.rb
- examples/lambda_calculus/lambda_calculus_test.rb
- examples/lambda_calculus/test_helper.rb
+- examples/numerals.rb
+- examples/numerals.tt
- lib/treetop.rb
- lib/treetop/bootstrap_gen_1_metagrammar.rb
- lib/treetop/compiler.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/compiler/choice_spec.rb new/spec/compiler/choice_spec.rb
--- old/spec/compiler/choice_spec.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/spec/compiler/choice_spec.rb 2015-06-30 05:32:42.000000000 +0200
@@ -2,31 +2,22 @@
module ChoiceSpec
describe "A choice between terminal symbols" do
- testing_expression '("foo" { def foo_method; end } / "bar" { def bar_method; end } / "baz" { def baz_method; end }) {def bat_method; end}'
+ testing_expression '"foo" { def foo_method; end } / "bar" { def bar_method; end } / "baz" { def baz_method; end }'
it "successfully parses input matching any of the alternatives, returning a node that responds to methods defined in its respective inline module" do
result = parse('foo')
result.should_not be_nil
result.should respond_to(:foo_method)
- result.should_not respond_to(:bar_method)
- result.should_not respond_to(:baz_method)
- result.should respond_to(:bat_method)
-
+
result = parse('bar')
result.should_not be_nil
- result.should_not respond_to(:foo_method)
result.should respond_to(:bar_method)
- result.should_not respond_to(:baz_method)
- result.should respond_to(:bat_method)
-
+
result = parse('baz')
result.should_not be_nil
- result.should_not respond_to(:foo_method)
- result.should_not respond_to(:bar_method)
result.should respond_to(:baz_method)
- result.should respond_to(:bat_method)
end
-
+
it "upon parsing a string matching the second alternative, records the failure of the first terminal" do
result = parse('bar')
terminal_failures = parser.terminal_failures
@@ -35,18 +26,18 @@
failure.expected_string.should == '"foo"'
failure.index.should == 0
end
-
+
it "upon parsing a string matching the third alternative, records the failure of the first two terminals" do
result = parse('baz')
-
+
terminal_failures = parser.terminal_failures
-
+
terminal_failures.size.should == 2
failure_1 = terminal_failures[0]
failure_1.expected_string == 'foo'
failure_1.index.should == 0
-
+
failure_2 = terminal_failures[1]
failure_2.expected_string == 'bar'
failure_2.index.should == 0
@@ -62,7 +53,7 @@
end
end
- describe "A choice between terminals followed by a block" do
+ describe "A choice between terminals followed by a block" do
testing_expression "('a'/ 'bb' / [c]) { def a_method; end }"
it "extends a match of any of its subexpressions with a module created from the block" do
@@ -77,7 +68,7 @@
end
end
- describe "a choice followed by a declared module" do
+ describe "a choice followed by a declared module" do
testing_expression "('a'/ 'bb' / [c]) ChoiceSpec::TestModule"
it "extends a match of any of its subexpressions with a module created from the block" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/compiler/grammar_compiler_spec.rb new/spec/compiler/grammar_compiler_spec.rb
--- old/spec/compiler/grammar_compiler_spec.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/spec/compiler/grammar_compiler_spec.rb 2015-06-30 05:32:42.000000000 +0200
@@ -32,17 +32,17 @@
specify "compilation of a single file to a default file name" do
src_copy = "#{@tmpdir}/test_grammar.treetop"
File.open(source_path_with_treetop_extension) { |f| File.open(src_copy,'w'){|o|o.write(f.read)} }
- File.exists?(target_path).should be_false
+ File.exists?(target_path).should be_falsey
compiler.compile(src_copy)
- File.exists?(target_path).should be_true
+ File.exists?(target_path).should be_truthy
require target_path
Test::GrammarParser.new.parse('foo').should_not be_nil
end
specify "compilation of a single file to an explicit file name" do
- File.exists?(alternate_target_path).should be_false
+ File.exists?(alternate_target_path).should be_falsy
compiler.compile(source_path_with_treetop_extension, alternate_target_path)
- File.exists?(alternate_target_path).should be_true
+ File.exists?(alternate_target_path).should be_truthy
require alternate_target_path
Test::GrammarParser.new.parse('foo').should_not be_nil
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/compiler/parenthesized_expression_spec.rb new/spec/compiler/parenthesized_expression_spec.rb
--- old/spec/compiler/parenthesized_expression_spec.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/spec/compiler/parenthesized_expression_spec.rb 2015-06-30 05:32:42.000000000 +0200
@@ -19,15 +19,4 @@
end
end
end
-
- describe "An expression with code both inside and outside parentheses" do
- testing_expression '("foo" { def inner; end } ) { def outer; end} '
- it "should extend both code modules " do
- parse('foo') do |result|
- result.should respond_to(:inner)
- result.should respond_to(:outer)
- end
- end
- end
-
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/compiler/tt_compiler_spec.rb new/spec/compiler/tt_compiler_spec.rb
--- old/spec/compiler/tt_compiler_spec.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/spec/compiler/tt_compiler_spec.rb 2015-06-30 05:32:42.000000000 +0200
@@ -34,36 +34,36 @@
it 'can compile a grammar file' do
# puts %q{emulate 'tt dumb.tt'}
- system("ruby -S tt #{@test_grammar}").should be_true
+ system("ruby -S tt #{@test_grammar}").should be_truthy
- File.exists?(@test_ruby).should be_true
- File.zero?(@test_ruby).should_not be_true
+ File.exists?(@test_ruby).should be_truthy
+ File.zero?(@test_ruby).should_not be_truthy
end
it 'can compile a relative pathed grammar file' do
dir = File.basename(File.expand_path(File.dirname(@test_grammar)))
# puts %q{emulate 'tt "..//dumb.tt"'}
- system("cd #{@tmpdir}/..; ruby -S tt \"./#{dir}/#{@test_base}.tt\"").should be_true
+ system("cd #{@tmpdir}/..; ruby -S tt \"./#{dir}/#{@test_base}.tt\"").should be_truthy
- File.exists?(@test_ruby).should be_true
- File.zero?(@test_ruby).should_not be_true
+ File.exists?(@test_ruby).should be_truthy
+ File.zero?(@test_ruby).should_not be_truthy
end
it 'can compile an absolute pathed grammar file' do
# puts %q{emulate 'tt "/path/to/dumb.tt"'}
- system("ruby -S tt \"#{File.expand_path(@test_grammar)}\"").should be_true
+ system("ruby -S tt \"#{File.expand_path(@test_grammar)}\"").should be_truthy
- File.exists?(@test_ruby).should be_true
- File.zero?(@test_ruby).should_not be_true
+ File.exists?(@test_ruby).should be_truthy
+ File.zero?(@test_ruby).should_not be_truthy
end
it 'can compile without explicit file extensions' do
# puts %q{emulate 'tt dumb'}
- system("ruby -S tt #{@test_path}").should be_true
+ system("ruby -S tt #{@test_path}").should be_truthy
- File.exists?(@test_ruby).should be_true
- File.zero?(@test_ruby).should_not be_true
+ File.exists?(@test_ruby).should be_truthy
+ File.zero?(@test_ruby).should_not be_truthy
end
it 'skips nonexistent grammar file without failing or creating bogus output' do
@@ -72,17 +72,17 @@
(io.read =~ /ERROR.*?not exist.*?continuing/).should_not be_nil
end
- File.exists?("#{@test_base}.rb").should be_false
+ File.exists?("#{@test_base}.rb").should be_falsy
end
it 'can compile to a specified parser source file' do
# puts %q{emulate 'tt -o my_dumb_test_parser.rb dumb'}
pf = "#{@tmpdir}/my_dumb_test_parser.rb"
begin
- system("ruby -S tt -o #{pf} #{@test_path}").should be_true
+ system("ruby -S tt -o #{pf} #{@test_path}").should be_truthy
- File.exists?(pf).should be_true
- File.zero?(pf).should_not be_true
+ File.exists?(pf).should be_truthy
+ File.zero?(pf).should_not be_truthy
ensure
File.delete(pf) if File.exists?(pf)
end
@@ -92,10 +92,10 @@
# puts %q{emulate 'tt -o must_save_parser.rb dumb'}
pf = "#{@tmpdir}/must_save_parser.rb"
begin
- system("ruby -S tt -o #{pf} #{@test_path}").should be_true
+ system("ruby -S tt -o #{pf} #{@test_path}").should be_truthy
- File.exists?(pf).should be_true
- File.zero?(pf).should_not be_true
+ File.exists?(pf).should be_truthy
+ File.zero?(pf).should_not be_truthy
# Check that the magic comment is preserved:
written = File.open(pf, "r") { |f| s = f.read }
@@ -121,16 +121,16 @@
# puts %q{emulate 'tt -o must_save_parser.rb dumb'}
pf = "#{@tmpdir}/must_save_parser.rb"
begin
- system("ruby -S tt -o #{pf} #{@test_path}").should be_true
+ system("ruby -S tt -o #{pf} #{@test_path}").should be_truthy
- File.exists?(pf).should be_true
- File.zero?(pf).should_not be_true
+ File.exists?(pf).should be_truthy
+ File.zero?(pf).should_not be_truthy
orig_file_hash = Digest::SHA1.hexdigest(File.read(pf))
# Modify the file and make sure it gets reverted:
File.open(pf, "r+") { |f| f.gets; f.write("#") }
- system("ruby -S tt -o #{pf} #{@test_path}").should be_true
+ system("ruby -S tt -o #{pf} #{@test_path}").should be_truthy
Digest::SHA1.hexdigest(File.read(pf)).should == orig_file_hash
ensure
File.delete(pf) if File.exists?(pf)
@@ -139,13 +139,13 @@
it 'can be forced to overwrite existing file #{@test_path}' do
pf = "#{@test_path}.rb"
- system("echo some junk >#{pf}").should be_true
+ system("echo some junk >#{pf}").should be_truthy
- File.exists?(pf).should be_true
- File.zero?(pf).should_not be_true
+ File.exists?(pf).should be_truthy
+ File.zero?(pf).should_not be_truthy
orig_file_hash = Digest::SHA1.hexdigest(File.read(pf))
- system("ruby -S tt -f #{@test_path}").should be_true
+ system("ruby -S tt -f #{@test_path}").should be_truthy
Digest::SHA1.hexdigest(File.read(pf)).should_not == orig_file_hash
end
@@ -179,45 +179,45 @@
it 'can compile them in one invocation' do
# puts %q{emulate 'tt dumb1.tt dumb2.tt'}
- system("ruby -S tt #{@test_grammars.join(' ')}").should be_true
+ system("ruby -S tt #{@test_grammars.join(' ')}").should be_truthy
@test_bases.each do |f|
pf = "#{f}.rb"
- File.exists?(pf).should be_true
- File.zero?(pf).should_not be_true
+ File.exists?(pf).should be_truthy
+ File.zero?(pf).should_not be_truthy
end
end
it 'can compile them without explicit file extenstions' do
# puts %q{emulate 'tt dumb1 dumb2'}
- system("ruby -S tt #{@test_bases.join(' ')}").should be_true
+ system("ruby -S tt #{@test_bases.join(' ')}").should be_truthy
@test_bases.each do |f|
pf = "#{f}.rb"
- File.exists?(pf).should be_true
- File.zero?(pf).should_not be_true
+ File.exists?(pf).should be_truthy
+ File.zero?(pf).should_not be_truthy
end
end
it 'can skip nonexistent and invalid extension named grammar files' do
# puts %q{emulate 'tt not_here bad_ext.ttg dumb1 dumb2'}
- system("ruby -S tt not_here bad_ext.ttg #{@test_bases.join(' ')} >/dev/null 2>&1").should be_true
+ system("ruby -S tt not_here bad_ext.ttg #{@test_bases.join(' ')} >/dev/null 2>&1").should be_truthy
- File.exists?('not_here.rb').should_not be_true
- File.exists?('bad_ext.rb').should_not be_true
+ File.exists?('not_here.rb').should_not be_truthy
+ File.exists?('bad_ext.rb').should_not be_truthy
@test_bases.each do |f|
pf = "#{f}.rb"
- File.exists?(pf).should be_true
- File.zero?(pf).should_not be_true
+ File.exists?(pf).should be_truthy
+ File.zero?(pf).should_not be_truthy
end
end
it 'can not specify an output file' do
# puts %q{emulate 'tt -o my_bogus_test_parser.rb dumb1 dumb2'}
pf = 'my_bogus_test_parser.rb'
- system("ruby -S tt -o #{pf} #{@test_bases.join(' ')} >/dev/null 2>&1").should be_false
- File.exists?(pf).should be_false
+ system("ruby -S tt -o #{pf} #{@test_bases.join(' ')} >/dev/null 2>&1").should be_falsy
+ File.exists?(pf).should be_falsy
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/compiler/zero_or_more_spec.rb new/spec/compiler/zero_or_more_spec.rb
--- old/spec/compiler/zero_or_more_spec.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/spec/compiler/zero_or_more_spec.rb 2015-06-30 05:32:42.000000000 +0200
@@ -5,8 +5,6 @@
end
describe "zero or more of a terminal symbol followed by a node class declaration and a block" do
- # testing_expression '("foo" { def b_method; end } )* ZeroOrMoreSpec::Foo { def a_method; end }'
- # testing_expression '("foo" { def a_method; end } )* ZeroOrMoreSpec::Foo'
testing_expression '"foo"* ZeroOrMoreSpec::Foo { def a_method; end }'
it "successfully parses epsilon, returning an instance declared node class and recording a terminal failure" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/spec_helper.rb new/spec/spec_helper.rb
--- old/spec/spec_helper.rb 2014-12-09 05:55:36.000000000 +0100
+++ new/spec/spec_helper.rb 2015-06-30 05:32:42.000000000 +0200
@@ -63,7 +63,7 @@
def parse_multibyte(input, options = {})
require 'active_support/all'
- if RUBY_VERSION !~ /^(1\.9|2\.0)/ && 'NONE' == $KCODE then $KCODE = 'UTF8' end
+ if RUBY_VERSION !~ /^(1\.9|2\.)/ && 'NONE' == $KCODE then $KCODE = 'UTF8' end
# rspec 1.3 used to do something similar (set it to 'u') that we need
# for activerecord multibyte wrapper to kick in (1.8 only? @todo)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/treetop.gemspec new/treetop.gemspec
--- old/treetop.gemspec 2014-12-09 05:55:36.000000000 +0100
+++ new/treetop.gemspec 2015-06-30 05:32:42.000000000 +0200
@@ -2,17 +2,17 @@
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
-# stub: treetop 1.5.3 ruby lib
+# stub: treetop 1.6.3 ruby lib
Gem::Specification.new do |s|
s.name = "treetop"
- s.version = "1.5.3"
+ s.version = "1.6.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Nathan Sobo", "Clifford Heath"]
- s.autorequire = "treetop"
- s.date = "2014-03-21"
+ s.date = "2015-06-30"
+ s.description = "A Parsing Expression Grammar (PEG) Parser generator DSL for Ruby"
s.email = "cliffordheath@gmail.com"
s.executables = ["tt"]
s.extra_rdoc_files = [
@@ -34,16 +34,21 @@
"doc/syntactic_recognition.markdown",
"doc/tt.1",
"doc/using_in_ruby.markdown",
+ "examples/indented_blocks/indented_blocks.tt",
+ "examples/indented_blocks/indented_blocks_test.rb",
+ "examples/inner_outer.rb",
+ "examples/inner_outer.tt",
"examples/lambda_calculus/arithmetic.rb",
"examples/lambda_calculus/arithmetic.treetop",
"examples/lambda_calculus/arithmetic_node_classes.rb",
"examples/lambda_calculus/arithmetic_test.rb",
- "examples/lambda_calculus/lambda_calculus",
"examples/lambda_calculus/lambda_calculus.rb",
"examples/lambda_calculus/lambda_calculus.treetop",
"examples/lambda_calculus/lambda_calculus_node_classes.rb",
"examples/lambda_calculus/lambda_calculus_test.rb",
"examples/lambda_calculus/test_helper.rb",
+ "examples/numerals.rb",
+ "examples/numerals.tt",
"lib/treetop.rb",
"lib/treetop/bootstrap_gen_1_metagrammar.rb",
"lib/treetop/compiler.rb",