redparse 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,66 @@
1
+ require 'test/unit'
2
+ require 'regxform'
3
+ require "redparse"
4
+
5
+ class XformTreeTest < Test::Unit::TestCase
6
+ include RedParse::Nodes
7
+ def test_replacing_with_self
8
+ pt=RedParse.new("1").parse
9
+ xformer=
10
+ LiteralNode >> ParenedNode[SequenceNode[LiteralNode[42],~:self]]
11
+ pt=pt.xform_tree!(xformer)
12
+ assert_equal(ParenedNode[SequenceNode[LiteralNode[42],LiteralNode[1]]], pt)
13
+ end
14
+
15
+ def test_modifying_same_node_twice
16
+ pt=RedParse.new("1").parse
17
+ xformers= [
18
+ LiteralNode >> ParenedNode[SequenceNode[StringNode['foo'],~:self]],
19
+ LiteralNode >> ParenedNode[SequenceNode[StringNode['bar'],~:self]]
20
+ ]
21
+ pt=pt.xform_tree!(*xformers)
22
+ assert_equal(ParenedNode[SequenceNode[StringNode['bar'],
23
+ ParenedNode[SequenceNode[StringNode['foo'],
24
+ LiteralNode[1]
25
+ ]]
26
+ ]], pt)
27
+ end
28
+
29
+ def test_modifying_same_node_thrice
30
+ pt=RedParse.new("1").parse
31
+ xformers= [
32
+ LiteralNode >> ParenedNode[SequenceNode[StringNode['foo'],~:self]],
33
+ LiteralNode >> ParenedNode[SequenceNode[StringNode['bar'],~:self]],
34
+ LiteralNode >> ParenedNode[SequenceNode[StringNode['baz'],~:self]],
35
+ ]
36
+ pt=pt.xform_tree!(*xformers)
37
+ assert_equal(ParenedNode[SequenceNode[StringNode['baz'],
38
+ ParenedNode[SequenceNode[StringNode['bar'],
39
+ ParenedNode[SequenceNode[StringNode['foo'],
40
+ LiteralNode[1]
41
+ ]]
42
+ ]]
43
+ ]], pt)
44
+ end
45
+
46
+ def mktmp
47
+ item_that{
48
+ #Process.kill "INT",0;
49
+ [['foo']]
50
+ }
51
+ end
52
+
53
+ def test_xform_tree_doesnt_modify_original
54
+ tree=RedParse.new('def foo.bar; baz end').parse
55
+ tree2=Marshal.load(Marshal.dump(tree))
56
+ tree.xform_tree!( -{:receiver => Node>>mktmp%:t} )
57
+ assert_equal tree, tree2
58
+ end
59
+
60
+ def test_xform_tree_doesnt_modify_original2
61
+ tree=RedParse.new('def foo.bar; baz end').parse
62
+ tree2=Marshal.load(Marshal.dump(tree))
63
+ tree.xform_tree!( -{:receiver => Node>>mktmp%:t} >> [~:t])
64
+ assert_equal tree, tree2
65
+ end
66
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redparse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clausen
8
8
  autorequire:
9
- bindir: bin/
9
+ bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-06 00:00:00 -07:00
12
+ date: 2010-01-03 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,9 +18,9 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ">="
21
+ - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.7.4
23
+ version: 0.7.7
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: reg
@@ -30,73 +30,74 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.4.7
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: hoe
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 1.12.2
33
+ version: 0.4.8
44
34
  version:
45
- description: RedParse is a ruby parser written in pure ruby. Instead of YACC or ANTLR, it's parse tool is a home-brewed "compiler-interpreter". (The tool is LALR(1)-equivalent and the 'parse language' is pretty nice, even in it's current crude form.)
46
- email: redparse-owner @at@ inforadical .dot. net
47
- executables:
48
- - redparse
35
+ description: RedParse is a ruby parser written in pure ruby. Instead of YACC or ANTLR, it's parse tool is a home-brewed "compiler-interpreter". (The tool is LALR(1)-equivalent and the 'parse language' is pretty nice, even in it's current crude form.) My intent is to have a completely correct parser for ruby, in 100% ruby. Currently, RedParse can parse all known ruby 1.8 constructions correctly. There might be some problems with unparsing or otherwise working with texts in a character set other than ascii. Some of the new ruby 1.9 constructions are supported in 1.9 mode. For more details on known problems, see below.
36
+ email: caleb (at) inforadical (dot) net
37
+ executables: []
38
+
49
39
  extensions: []
50
40
 
51
41
  extra_rdoc_files:
52
- - Manifest.txt
53
42
  - README.txt
54
- - History.txt
43
+ - COPYING.LGPL
55
44
  files:
56
- - lib/redparse/decisiontree.rb
57
- - lib/redparse/version.rb
58
- - lib/redparse/reg_more_sugar.rb
45
+ - COPYING.LGPL
46
+ - History.txt
47
+ - Makefile
48
+ - Manifest.txt
49
+ - README.txt
50
+ - Rakefile
51
+ - bin/redparse
52
+ - lib/redparse.rb
53
+ - lib/redparse/babynodes.rb
59
54
  - lib/redparse/babyparser.rb
55
+ - lib/redparse/cache.rb
56
+ - lib/redparse/compile.rb
57
+ - lib/redparse/decisiontree.rb
58
+ - lib/redparse/float_accurate_to_s.rb
59
+ - lib/redparse/generate.rb
60
60
  - lib/redparse/node.rb
61
- - lib/redparse/babynodes.rb
62
- - lib/redparse.rb
63
- - test/rp-locatetest.rb
61
+ - lib/redparse/parse_tree_server.rb
64
62
  - lib/redparse/problemfiles.rb
65
- - test/data/wvt.rb
66
- - test/data/mod.rb
67
- - test/data/bqhd2.rb
63
+ - lib/redparse/pthelper.rb
64
+ - lib/redparse/reg_more_sugar.rb
65
+ - lib/redparse/version.rb
66
+ - redparse.gemspec
68
67
  - test/data/__end.rb
69
- - test/data/hdx.rb
70
- - test/data/hd2.rb
71
- - test/data/be.rb
72
- - test/data/hd5.rb
73
- - test/data/if.rb
74
- - test/data/hdcat.rb
75
- - test/data/hd3.rb
76
- - test/data/pw.rb
77
68
  - test/data/__f.rb
78
- - test/data/jbridge.rb
69
+ - test/data/be.rb
70
+ - test/data/be2.rb
71
+ - test/data/bqhd.rb
72
+ - test/data/bqhd2.rb
73
+ - test/data/case.rb
74
+ - test/data/datetime.rb
75
+ - test/data/def_spec.rb
76
+ - test/data/defd.rb
79
77
  - test/data/hd-def.rb
80
78
  - test/data/hd.rb
79
+ - test/data/hd2.rb
80
+ - test/data/hd3.rb
81
81
  - test/data/hd4.rb
82
- - test/data/nl_as_strdelim.rb
83
- - test/data/defd.rb
84
- - test/data/datetime.rb
85
- - test/data/bqhd.rb
86
- - test/data/be2.rb
82
+ - test/data/hd5.rb
83
+ - test/data/hdcat.rb
84
+ - test/data/hdx.rb
87
85
  - test/data/heredoc.rb
88
- - test/data/case.rb
86
+ - test/data/if.rb
87
+ - test/data/jbridge.rb
88
+ - test/data/mod.rb
89
+ - test/data/nl_as_strdelim.rb
90
+ - test/data/pw.rb
91
+ - test/data/skkdictools.rb
92
+ - test/data/wvt.rb
93
+ - test/generate_parse_tree_server_rc.rb
94
+ - test/rp-locatetest.rb
95
+ - test/test_1.9.rb
96
+ - test/test_all.rb
89
97
  - test/test_redparse.rb
90
- - Manifest.txt
91
- - README.txt
92
- - History.txt
93
- - Rakefile
94
- - COPYING.LGPL
95
- - bin/redparse
96
- - lib/redparse/generate.rb
97
- - test/data/def_spec.rb
98
+ - test/test_xform_tree.rb
98
99
  has_rdoc: true
99
- homepage: http://github.com/coatl/redparse/
100
+ homepage: http://github.com/coatl/redparse
100
101
  post_install_message:
101
102
  rdoc_options:
102
103
  - --main
@@ -123,4 +124,4 @@ signing_key:
123
124
  specification_version: 2
124
125
  summary: RedParse is a ruby parser written in pure ruby.
125
126
  test_files:
126
- - test/test_redparse.rb
127
+ - test/test_all.rb