interscript 2.1.0rc4 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -6
  3. data/Rakefile +1 -9
  4. data/bin/console +8 -4
  5. data/interscript.gemspec +1 -2
  6. data/lib/interscript/compiler/javascript.rb +1 -6
  7. data/lib/interscript/compiler/ruby.rb +0 -5
  8. data/lib/interscript/dsl/document.rb +1 -2
  9. data/lib/interscript/dsl/group/parallel.rb +2 -2
  10. data/lib/interscript/dsl/group.rb +6 -7
  11. data/lib/interscript/dsl/tests.rb +2 -2
  12. data/lib/interscript/dsl.rb +2 -35
  13. data/lib/interscript/interpreter.rb +1 -5
  14. data/lib/interscript/node/alias_def.rb +0 -6
  15. data/lib/interscript/node/dependency.rb +0 -16
  16. data/lib/interscript/node/document.rb +0 -34
  17. data/lib/interscript/node/group.rb +2 -13
  18. data/lib/interscript/node/item/alias.rb +0 -12
  19. data/lib/interscript/node/item/any.rb +0 -7
  20. data/lib/interscript/node/item/capture.rb +0 -11
  21. data/lib/interscript/node/item/group.rb +1 -29
  22. data/lib/interscript/node/item/repeat.rb +0 -4
  23. data/lib/interscript/node/item/stage.rb +0 -4
  24. data/lib/interscript/node/item/string.rb +0 -7
  25. data/lib/interscript/node/item.rb +0 -4
  26. data/lib/interscript/node/metadata.rb +0 -10
  27. data/lib/interscript/node/rule/funcall.rb +2 -12
  28. data/lib/interscript/node/rule/run.rb +3 -16
  29. data/lib/interscript/node/rule/sub.rb +4 -165
  30. data/lib/interscript/node/rule.rb +0 -3
  31. data/lib/interscript/node/stage.rb +4 -30
  32. data/lib/interscript/node/tests.rb +0 -10
  33. data/lib/interscript/node.rb +0 -4
  34. data/lib/interscript/stdlib.rb +3 -45
  35. data/lib/interscript/version.rb +1 -1
  36. data/lib/interscript/visualize/json.rb +4 -12
  37. data/lib/interscript.rb +0 -78
  38. metadata +3 -19
  39. data/lib/interscript/detector.rb +0 -60
  40. data/lib/interscript/utils/helpers.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 467a62a606d559e17a097273bf77322bab4925dc83b7207d2950aa7d9f2ae39e
4
- data.tar.gz: 61964b5809ba483de5da3d79b4cba60863eaf42c36b27aeed99494087b34f8a8
3
+ metadata.gz: f92a8060d3eee8e0eb4815795294c045ccc7ad341c92a6ba48cb825be4598b95
4
+ data.tar.gz: 6b977f41c3b1ba80bf25ef1d120666a228bcfd050f31f0a87a9c9ceeb86f5007
5
5
  SHA512:
6
- metadata.gz: 0b790e39724a37d8dbc52247a5b87b6773dc05f91ce578aeb2fe8103891f7221cf61a22277024cc6167f146649898584d749bc16885e5e6f42a08e4ec888502e
7
- data.tar.gz: 9986e5e6dbe057c4fa4714998719c85b56ca3218b4f31f5369967ac14c4c49fad5e82aa8a98859fec7c55b86718c27886f0cfa3799956c077a49f67546c752dc
6
+ metadata.gz: 2fc32770358443ca0baae5416a918032b4a169fdc98b32d493fe1a487599fbdf9c5005fb53b98a25e5962f18f2ff52a1667010bda48394e891998437b2a2f1b6
7
+ data.tar.gz: a96e1cc807ebc83c9630b1a78f5b9c26558f771954b55622ec55d0f0b0ff17601a27a5753ab407dc49ec0db8d960940c811148c2872ba9c56e1b19baa3a7ccb7
data/Gemfile CHANGED
@@ -26,10 +26,4 @@ unless ENV["SKIP_JS"]
26
26
  end
27
27
  end
28
28
 
29
- group :rababa do
30
- gem 'rababa', github: 'interscript/rababa', ref: '70051da'
31
- end
32
-
33
- gem 'pry'
34
-
35
29
  gem 'simplecov', require: false, group: :test
data/Rakefile CHANGED
@@ -20,10 +20,7 @@ task :compile, [:compiler, :target] do |t, args|
20
20
 
21
21
  maplist = {}
22
22
 
23
- maps = Interscript.maps
24
- maps = Interscript.exclude_maps(maps, compiler: compiler, platform: false)
25
-
26
- maps.each do |map|
23
+ Interscript.maps.each do |map|
27
24
  code = compiler.(map).code
28
25
  File.write(args[:target] + "/" + map + "." + ext, code)
29
26
  maplist[map] = nil
@@ -71,7 +68,6 @@ task :generate_metadata_json do
71
68
  require "fileutils"
72
69
  require "json"
73
70
  require "interscript"
74
- require "interscript/compiler/javascript"
75
71
 
76
72
  FileUtils.rm_rf(file = __dir__+"/metadata.json")
77
73
 
@@ -79,10 +75,6 @@ task :generate_metadata_json do
79
75
  parsed_map = Interscript.parse(map)
80
76
  md = parsed_map.metadata.to_hash
81
77
  md["test"] = parsed_map.tests&.data&.first
82
- md["skip_js"] = Interscript.exclude_maps([map],
83
- compiler: Interscript::Compiler::Javascript,
84
- platform: false,
85
- ).empty?
86
78
  [map, md]
87
79
  end.to_h
88
80
 
data/bin/console CHANGED
@@ -3,8 +3,12 @@
3
3
  require "bundler/setup"
4
4
  require "interscript"
5
5
 
6
- require "interscript/utils/helpers"
7
- include Interscript::Utils::Helpers
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
8
 
9
- require "pry"
10
- Pry.start
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/interscript.gemspec CHANGED
@@ -27,6 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
 
29
29
  spec.add_dependency "thor"
30
- spec.add_dependency "interscript-maps", "~> #{Interscript::VERSION.split('.')[0,2].join(".")}.0a"
31
- spec.add_dependency "text"
30
+ spec.add_dependency "interscript-maps"
32
31
  end
@@ -53,7 +53,6 @@ class Interscript::Compiler::Javascript < Interscript::Compiler
53
53
 
54
54
  def compile_rule(r, map = @map, wrapper = false)
55
55
  c = ""
56
- return c if r.reverse_run == true
57
56
  case r
58
57
  when Interscript::Node::Stage
59
58
  c += "map.stages.#{r.name} = function(s) {\n"
@@ -76,7 +75,6 @@ class Interscript::Compiler::Javascript < Interscript::Compiler
76
75
  raise ArgumentError, "Can't parallelize rules with :not_before" if i.not_before
77
76
  raise ArgumentError, "Can't parallelize rules with :not_after" if i.not_after
78
77
 
79
- next if i.reverse_run == true
80
78
  a << [compile_item(i.from, map, :par), compile_item(i.to, map, :parstr)]
81
79
  end
82
80
  ah = a.hash.abs
@@ -90,8 +88,7 @@ class Interscript::Compiler::Javascript < Interscript::Compiler
90
88
  a = []
91
89
  Interscript::Stdlib.deterministic_sort_by_max_length(r.children).each do |i|
92
90
  raise ArgumentError, "Can't parallelize #{i.class}" unless Interscript::Node::Rule::Sub === i
93
-
94
- next if i.reverse_run == true
91
+
95
92
  a << [build_regexp(i, map), compile_item(i.to, map, :parstr)]
96
93
  end
97
94
  ah = a.hash.abs
@@ -105,8 +102,6 @@ class Interscript::Compiler::Javascript < Interscript::Compiler
105
102
  from = %{"#{build_regexp(r, map).gsub("/", "\\\\/")}"}
106
103
  if r.to == :upcase
107
104
  to = 'function(a){return a.toUpperCase();}'
108
- elsif r.to == :downcase
109
- to = 'function(a){return a.toLowerCase();}'
110
105
  else
111
106
  to = compile_item(r.to, map, :str)
112
107
  end
@@ -42,7 +42,6 @@ class Interscript::Compiler::Ruby < Interscript::Compiler
42
42
 
43
43
  def compile_rule(r, map = @map, wrapper = false)
44
44
  c = ""
45
- return c if r.reverse_run == true
46
45
  case r
47
46
  when Interscript::Node::Stage
48
47
  c += "Interscript::Maps.add_map_stage \"#{@map.name}\", #{r.name.inspect} do |s|\n"
@@ -66,7 +65,6 @@ class Interscript::Compiler::Ruby < Interscript::Compiler
66
65
  raise ArgumentError, "Can't parallelize rules with :not_before" if i.not_before
67
66
  raise ArgumentError, "Can't parallelize rules with :not_after" if i.not_after
68
67
 
69
- next if i.reverse_run == true
70
68
  a << [compile_item(i.from, map, :par), compile_item(i.to, map, :parstr)]
71
69
  end
72
70
  ah = a.hash.abs
@@ -81,7 +79,6 @@ class Interscript::Compiler::Ruby < Interscript::Compiler
81
79
  Interscript::Stdlib.deterministic_sort_by_max_length(r.children).each do |i|
82
80
  raise ArgumentError, "Can't parallelize #{i.class}" unless Interscript::Node::Rule::Sub === i
83
81
 
84
- next if i.reverse_run == true
85
82
  a << [build_regexp(i, map), compile_item(i.to, map, :parstr)]
86
83
  end
87
84
  ah = a.hash.abs
@@ -95,8 +92,6 @@ class Interscript::Compiler::Ruby < Interscript::Compiler
95
92
  from = "/#{build_regexp(r, map).gsub("/", "\\\\/")}/"
96
93
  if r.to == :upcase
97
94
  to = '&:upcase'
98
- elsif r.to == :downcase
99
- to = '&:downcase'
100
95
  else
101
96
  to = compile_item(r.to, map, :str)
102
97
  end
@@ -37,11 +37,10 @@ class Interscript::DSL::Document
37
37
  @node.dep_aliases[dep.name] = dep if dep.name
38
38
  end
39
39
 
40
- def stage(name = :main, dont_reverse: false, &block)
40
+ def stage(name = :main, &block)
41
41
  puts "stage(#{name}) from #{self.inspect}" if $DEBUG
42
42
  stage = Interscript::DSL::Stage.new(name, &block)
43
43
  stage.node.doc_name = @node.name
44
- stage.node.dont_reverse = dont_reverse
45
44
  @node.stages[name] = stage.node
46
45
  end
47
46
  end
@@ -1,6 +1,6 @@
1
1
  class Interscript::DSL::Group::Parallel < Interscript::DSL::Group
2
- def initialize(reverse_run: nil, &block)
3
- @node = Interscript::Node::Group::Parallel.new(reverse_run: reverse_run)
2
+ def initialize(&block)
3
+ @node = Interscript::Node::Group::Parallel.new
4
4
  self.instance_exec(&block)
5
5
  end
6
6
  end
@@ -8,16 +8,16 @@ class Interscript::DSL::Group
8
8
  self.instance_exec(&block)
9
9
  end
10
10
 
11
- def run(stage, **kwargs)
11
+ def run(stage)
12
12
  if stage.class != Interscript::Node::Item::Stage
13
13
  raise TypeError, "I::Node::Item::Stage expected, got #{stage.class}"
14
14
  end
15
- @node.children << Interscript::Node::Rule::Run.new(stage, **kwargs)
15
+ @node.children << Interscript::Node::Rule::Run.new(stage)
16
16
  end
17
17
 
18
18
  def sub(from, to, **kwargs, &block)
19
- puts "sub(#{from.inspect},#{to}, kwargs = #{
20
- kwargs.inspect
19
+ puts "sub(#{from.inspect},#{to}, kargs = #{
20
+ kargs.inspect
21
21
  }) from #{self.inspect}" if $DEBUG
22
22
 
23
23
  rule = Interscript::Node::Rule::Sub.new(from, to, **kwargs)
@@ -25,7 +25,6 @@ class Interscript::DSL::Group
25
25
  end
26
26
 
27
27
  def upcase; :upcase; end
28
- def downcase; :downcase; end
29
28
 
30
29
  Interscript::Stdlib.available_functions.each do |fun|
31
30
  define_method fun do |**kwargs|
@@ -36,9 +35,9 @@ class Interscript::DSL::Group
36
35
  end
37
36
  end
38
37
 
39
- def parallel(**kwargs, &block)
38
+ def parallel(&block)
40
39
  puts "parallel(#{chars.inspect}) from #{self.inspect}" if $DEBUG
41
- group = Interscript::DSL::Group::Parallel.new(**kwargs, &block)
40
+ group = Interscript::DSL::Group::Parallel.new(&block)
42
41
  @node.children << group.node
43
42
  end
44
43
  end
@@ -6,7 +6,7 @@ class Interscript::DSL::Tests
6
6
  self.instance_exec(&block)
7
7
  end
8
8
 
9
- def test(from, to, reverse_run: nil)
10
- @node << [from, to, reverse_run]
9
+ def test(from,to)
10
+ @node << [from, to]
11
11
  end
12
12
  end
@@ -2,45 +2,12 @@ require "yaml"
2
2
 
3
3
  module Interscript::DSL
4
4
  @cache = {}
5
- def self.parse(map_name, reverse: true)
5
+ def self.parse(map_name)
6
6
  # map name aliases? here may be a place to wrap it
7
7
 
8
8
  return @cache[map_name] if @cache[map_name]
9
-
10
- # This is a composition, so let's make a new virtual map
11
- # that calls all maps in a sequence.
12
- if map_name.include? "|"
13
- map_parts = map_name.split("|").map(&:strip)
14
-
15
- doc = Interscript::DSL::Document.new(map_name) do
16
- map_parts.each_with_index do |i, idx|
17
- dependency i, as: :"part#{idx}"
18
- end
19
-
20
- stage {
21
- map_parts.each_with_index do |i, idx|
22
- run map[:"part#{idx}"].stage.main
23
- end
24
- }
25
- end.node
26
-
27
- return @cache[map_name] = doc
28
- end
29
-
30
- path = begin
31
- Interscript.locate(map_name)
32
- rescue Interscript::MapNotFoundError => e
33
- # But maybe we called the map in a reversed fashion?
34
- begin
35
- raise e if reverse == false # Protect from an infinite loop
36
- reverse_name = Interscript::Node::Document.reverse_name(map_name)
37
- return @cache[map_name] = parse(reverse_name, reverse: false).reverse
38
- rescue Interscript::MapNotFoundError
39
- raise e
40
- end
41
- end
9
+ path = Interscript.locate(map_name)
42
10
  library = path.end_with?(".iml")
43
-
44
11
  map_name = File.basename(path, ".imp")
45
12
  map_name = File.basename(map_name, ".iml")
46
13
 
@@ -76,7 +76,6 @@ class Interscript::Interpreter < Interscript::Compiler
76
76
  end
77
77
 
78
78
  def execute_rule r
79
- return if r.reverse_run == true
80
79
  case r
81
80
  when Interscript::Node::Group::Parallel
82
81
  if r.cached_tree
@@ -97,7 +96,6 @@ class Interscript::Interpreter < Interscript::Compiler
97
96
  raise ArgumentError, "Can't parallelize rules with :after" if i.after
98
97
  raise ArgumentError, "Can't parallelize rules with :not_before" if i.not_before
99
98
  raise ArgumentError, "Can't parallelize rules with :not_after" if i.not_after
100
- next if i.reverse_run == true
101
99
  subs_array << [build_item(i.from, :par), build_item(i.to, :parstr)]
102
100
  end
103
101
  tree = Interscript::Stdlib.parallel_replace_compile_tree(subs_array) #.sort_by{|k,v| -k.length})
@@ -110,7 +108,7 @@ class Interscript::Interpreter < Interscript::Compiler
110
108
  subs_array = []
111
109
  Interscript::Stdlib.deterministic_sort_by_max_length(r.children).each do |i| # rule.from.max_length gives somewhat better test results, why is that
112
110
  raise ArgumentError, "Can't parallelize #{i.class}" unless Interscript::Node::Rule::Sub === i
113
- next if i.reverse_run == true
111
+
114
112
  subs_array << [build_regexp(i), build_item(i.to, :parstr)]
115
113
  end
116
114
  r.subs_regexp = Interscript::Stdlib.parallel_regexp_compile(subs_array)
@@ -131,8 +129,6 @@ class Interscript::Interpreter < Interscript::Compiler
131
129
  when Interscript::Node::Rule::Sub
132
130
  if r.to == :upcase
133
131
  @str = @str.gsub(Regexp.new(build_regexp(r)), &:upcase)
134
- elsif r.to == :downcase
135
- @str = @str.gsub(Regexp.new(build_regexp(r)), &:downcase)
136
132
  else
137
133
  @str = @str.gsub(Regexp.new(build_regexp(r)), build_item(r.to, :str))
138
134
  end
@@ -7,12 +7,6 @@ class Interscript::Node::AliasDef < Interscript::Node
7
7
  @data = data
8
8
  end
9
9
 
10
- def ==(other)
11
- super &&
12
- self.name == other.name &&
13
- self.data == other.data
14
- end
15
-
16
10
  def to_hash
17
11
  { :class => self.class.to_s,
18
12
  :name => @name,
@@ -4,22 +4,6 @@ class Interscript::Node::Dependency < Interscript::Node
4
4
  def initialize
5
5
  end
6
6
 
7
- def reverse
8
- rdep = self.class.new
9
- rdep.name = name
10
- rdep.full_name = Interscript::Node::Document.reverse_name(full_name)
11
- rdep.import = import
12
- rdep.document = document&.reverse
13
- rdep
14
- end
15
-
16
- def ==(other)
17
- super &&
18
- self.full_name == other.full_name &&
19
- self.import == other.import &&
20
- self.name == other.name
21
- end
22
-
23
7
  def to_hash
24
8
  { :class => self.class.to_s,
25
9
  :name => @name,
@@ -1,7 +1,6 @@
1
1
  class Interscript::Node::Document
2
2
  attr_accessor :metadata, :tests, :name
3
3
  attr_accessor :dependencies, :aliases, :stages, :dep_aliases
4
- attr_accessor :reversed_from
5
4
 
6
5
  def initialize
7
6
  puts "Interscript::Node::Document.new " if $DEBUG
@@ -35,39 +34,6 @@ class Interscript::Node::Document
35
34
  end
36
35
  end
37
36
 
38
- def reverse
39
- @reverse ||= self.class.new.tap do |rdoc|
40
- rdoc.name = self.class.reverse_name(name)
41
- rdoc.metadata = metadata&.reverse
42
- rdoc.tests = tests&.reverse
43
- rdoc.dependencies = dependencies.map(&:reverse)
44
- rdoc.stages = stages.transform_values(&:reverse)
45
- rdoc.dep_aliases = dep_aliases.transform_values(&:reverse)
46
- rdoc.aliases = aliases
47
- end
48
- end
49
-
50
- def self.reverse_name(name)
51
- newname = (name || "noname").split("-")
52
- newname[2], newname[3] = newname[3], newname[2] if newname.length >= 4
53
- newname = newname.join("-")
54
- if newname == name
55
- newname.gsub!("-reverse", "")
56
- end
57
- if newname == name
58
- newname += "-reverse"
59
- end
60
- newname
61
- end
62
-
63
- def ==(other)
64
- self.class == other.class &&
65
- self.metadata == other.metadata &&
66
- self.tests == other.tests &&
67
- self.stages == other.stages &&
68
- self.aliases == other.aliases
69
- end
70
-
71
37
  def to_hash
72
38
  { :class => self.class.to_s, :metadata => @metadata&.to_hash,
73
39
  :tests => @tests&.to_hash,
@@ -1,8 +1,7 @@
1
1
  class Interscript::Node::Group < Interscript::Node
2
- attr_accessor :children, :reverse_run
2
+ attr_accessor :children
3
3
 
4
- def initialize(reverse_run: nil)
5
- @reverse_run = reverse_run
4
+ def initialize
6
5
  @children = []
7
6
  end
8
7
 
@@ -21,21 +20,11 @@ class Interscript::Node::Group < Interscript::Node
21
20
  self
22
21
  end
23
22
 
24
- def reverse
25
- self.class.new(reverse_run: reverse_run.nil? ? nil : !reverse_run).tap do |r|
26
- r.children = self.children.reverse.map(&:reverse)
27
- end
28
- end
29
-
30
23
  def to_hash
31
24
  { :class => self.class.to_s,
32
25
  :children => @children.map{|x| x.to_hash} }
33
26
  end
34
27
 
35
- def ==(other)
36
- super && self.children == other.children && self.reverse_run == other.reverse_run
37
- end
38
-
39
28
  def inspect
40
29
  @children.map(&:inspect).join("\n").gsub(/^/, " ")
41
30
  end
@@ -10,10 +10,6 @@ class Interscript::Node::Item::Alias < Interscript::Node::Item
10
10
  !map && Interscript::Stdlib::ALIASES.has_key?(name)
11
11
  end
12
12
 
13
- def boundary_like?
14
- Interscript::Stdlib.boundary_like_alias?(name)
15
- end
16
-
17
13
  def max_length
18
14
  if stdlib?
19
15
  ([:none].include? name) ? 0 : 1
@@ -23,10 +19,6 @@ class Interscript::Node::Item::Alias < Interscript::Node::Item
23
19
  end
24
20
  end
25
21
 
26
- # Not implemented properly
27
- def downcase; self; end
28
- def upcase; self; end
29
-
30
22
  def first_string
31
23
  self
32
24
  end
@@ -40,10 +32,6 @@ class Interscript::Node::Item::Alias < Interscript::Node::Item
40
32
  }
41
33
  end
42
34
 
43
- def ==(other)
44
- super && self.name == other.name && self.map == other.map
45
- end
46
-
47
35
  def inspect
48
36
  if map
49
37
  "map.#{map}.#{name}"
@@ -25,9 +25,6 @@ class Interscript::Node::Item::Any < Interscript::Node::Item
25
25
  end
26
26
  end
27
27
 
28
- def downcase; self.class.new(self.data.map(&:downcase)); end
29
- def upcase; self.class.new(self.data.map(&:upcase)); end
30
-
31
28
  def first_string
32
29
  case @value
33
30
  when Array
@@ -73,10 +70,6 @@ class Interscript::Node::Item::Any < Interscript::Node::Item
73
70
  hash
74
71
  end
75
72
 
76
- def ==(other)
77
- super && self.data == other.data
78
- end
79
-
80
73
  def inspect
81
74
  "any(#{value.inspect})"
82
75
  end
@@ -15,18 +15,11 @@ class Interscript::Node::Item::CaptureGroup < Interscript::Node::Item
15
15
  data.nth_string
16
16
  end
17
17
 
18
- def downcase; self.dup.tap { |i| i.data = i.data.downcase }; end
19
- def upcase; self.dup.tap { |i| i.data = i.data.upcase }; end
20
-
21
18
  def to_hash
22
19
  { :class => self.class.to_s,
23
20
  :data => self.data.to_hash }
24
21
  end
25
22
 
26
- def ==(other)
27
- super && self.data == other.data
28
- end
29
-
30
23
  def inspect
31
24
  "capture(#{@data.inspect})"
32
25
  end
@@ -51,10 +44,6 @@ class Interscript::Node::Item::CaptureRef < Interscript::Node::Item
51
44
  :id => self.id }
52
45
  end
53
46
 
54
- def ==(other)
55
- super && self.id == other.id
56
- end
57
-
58
47
  def inspect
59
48
  "ref(#{@id.inspect})"
60
49
  end
@@ -10,35 +10,11 @@ class Interscript::Node::Item::Group < Interscript::Node::Item
10
10
  def +(item)
11
11
  item = Interscript::Node::Item.try_convert(item)
12
12
  out = self.dup
13
- if Interscript::Node::Item::Group === item
14
- out.children += item.children
15
- else
16
- out.children << item
17
- end
13
+ out.children << item
18
14
  out.verify!
19
15
  out
20
16
  end
21
17
 
22
- def compact
23
- out = self.dup do |n|
24
- n.children = n.children.reject do |i|
25
- (Interscript::Node::Alias === i && i.name == :none) ||
26
- (Interscript::Node::String === i && i.data == "")
27
- end
28
- end
29
-
30
- if out.children.count == 0
31
- Interscript::Node::Alias.new(:none)
32
- elsif out.children.count == 1
33
- out.children.first
34
- else
35
- out
36
- end
37
- end
38
-
39
- def downcase; self.dup.tap { |i| i.children = i.children.map(&:downcase) }; end
40
- def upcase; self.dup.tap { |i| i.children = i.children.map(&:upcase) }; end
41
-
42
18
  # Verify if a group is valid
43
19
  def verify!
44
20
  wrong = @children.find do |i|
@@ -69,10 +45,6 @@ class Interscript::Node::Item::Group < Interscript::Node::Item
69
45
  :children => self.children.map{|x| x.to_hash} }
70
46
  end
71
47
 
72
- def ==(other)
73
- super && self.children == other.children
74
- end
75
-
76
48
  def inspect
77
49
  @children.map(&:inspect).join("+")
78
50
  end
@@ -22,10 +22,6 @@ class Interscript::Node::Item::Repeat < Interscript::Node::Item
22
22
  :data => self.data.to_hash }
23
23
  end
24
24
 
25
- def ==(other)
26
- super && self.data == other.data
27
- end
28
-
29
25
  def inspect
30
26
  str = case self
31
27
  when Interscript::Node::Item::Maybe
@@ -13,10 +13,6 @@ class Interscript::Node::Item::Stage < Interscript::Node::Item
13
13
  }
14
14
  end
15
15
 
16
- def ==(other)
17
- super && self.name == other.name && self.map == other.map
18
- end
19
-
20
16
  def inspect
21
17
  if map
22
18
  "map.#{@map}.stage.#{@name}"
@@ -17,9 +17,6 @@ class Interscript::Node::Item::String < Interscript::Node::Item
17
17
  self.data
18
18
  end
19
19
 
20
- def downcase; self.dup.tap { |i| i.data = i.data.downcase }; end
21
- def upcase; self.dup.tap { |i| i.data = i.data.upcase }; end
22
-
23
20
  alias nth_string first_string
24
21
 
25
22
  def + other
@@ -36,10 +33,6 @@ class Interscript::Node::Item::String < Interscript::Node::Item
36
33
  end
37
34
  end
38
35
 
39
- def ==(other)
40
- super && self.data == other.data
41
- end
42
-
43
36
  def inspect
44
37
  @data.inspect
45
38
  end
@@ -36,10 +36,6 @@ class Interscript::Node::Item < Interscript::Node
36
36
  :item => self.item }
37
37
  end
38
38
 
39
- def ==(other)
40
- super
41
- end
42
-
43
39
  def self.try_convert(i)
44
40
  i = Interscript::Node::Item::String.new(i) if i.class == ::String
45
41
  raise TypeError, "Wrong type #{i.class}, expected I::Node::Item" unless Interscript::Node::Item === i
@@ -11,16 +11,6 @@ class Interscript::Node::MetaData < Interscript::Node
11
11
  @data[k]
12
12
  end
13
13
 
14
- def reverse
15
- self.class.new(data.dup, **{}).tap do |rmd|
16
- rmd[:source_script], rmd[:destination_script] = rmd[:destination_script], rmd[:source_script]
17
- end
18
- end
19
-
20
- def ==(other)
21
- super && self.data == other.data
22
- end
23
-
24
14
  def to_hash
25
15
  {:class => self.class.to_s,
26
16
  :data => @data}
@@ -1,8 +1,7 @@
1
1
  class Interscript::Node::Rule::Funcall < Interscript::Node::Rule
2
- attr_accessor :name, :kwargs, :reverse_run
3
- def initialize name, reverse_run: nil, **kwargs
2
+ attr_accessor :name, :kwargs
3
+ def initialize name, **kwargs
4
4
  @name = name
5
- @reverse_run = reverse_run
6
5
  @kwargs = kwargs
7
6
  end
8
7
 
@@ -13,15 +12,6 @@ class Interscript::Node::Rule::Funcall < Interscript::Node::Rule
13
12
  }
14
13
  end
15
14
 
16
- def reverse
17
- self.class.new(Interscript::Stdlib.reverse_function[@name.to_sym],
18
- reverse_run: reverse_run.nil? ? nil : !reverse_run, **kwargs)
19
- end
20
-
21
- def ==
22
- super && self.name == other.name && self.kwargs == other.kwargs
23
- end
24
-
25
15
  def inspect
26
16
  "#{@name} #{kwargs.inspect[1..-2]}"
27
17
  end