hipe-gorillagrammar 0.0.1beta
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +21 -0
- data/History.txt +8 -0
- data/LICENSE.txt +19 -0
- data/README.txt +11 -0
- data/Rakefile +25 -0
- data/Thorfile +135 -0
- data/hipe-gorillagrammar.gemspec +66 -0
- data/lib/hipe-gorillagrammar/extensions/syntax.rb +50 -0
- data/lib/hipe-gorillagrammar.rb +492 -0
- data/spec/argv.rb +3 -0
- data/spec/extensions/syntax_spec.rb +41 -0
- data/spec/grammar_spec.rb +91 -0
- data/spec/helpers.rb +5 -0
- data/spec/parse_tree_spec.rb +64 -0
- data/spec/parsing_spec.rb +304 -0
- data/spec/range_spec.rb +47 -0
- data/spec/regexp_spec.rb +24 -0
- data/spec/runtime_spec.rb +66 -0
- data/spec/sequence_spec.rb +85 -0
- data/spec/shorthand_spec.rb +186 -0
- data/spec/spec.opts +4 -0
- data/spec/symbol_reference_spec.rb +28 -0
- data/spec/symbol_spec.rb +45 -0
- metadata +88 -0
data/spec/symbol_spec.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#rake spec SPEC=spec/symbol_spec.rb
|
2
|
+
require 'hipe-gorillagrammar'
|
3
|
+
include Hipe::GorillaGrammar
|
4
|
+
|
5
|
+
describe NonTerminalSymbol, "with respect to reflection" do
|
6
|
+
before :each do
|
7
|
+
@g = Hipe.GorillaGrammar{
|
8
|
+
:a_string =~ "a string"
|
9
|
+
:a_regexp =~ /^[abc]+$/
|
10
|
+
:a_sequence =~ [:a_string, :a_regexp]
|
11
|
+
:a_range =~ (1..more).of(:a_string, :a_regexp)
|
12
|
+
:a_range2 =~ (1..2).of(:a_string, :a_regexp)
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should allow adequate basic reflection" do
|
17
|
+
g = @g
|
18
|
+
g.size.should == 5
|
19
|
+
g[:a_string].should be_kind_of StringTerminal
|
20
|
+
g[:a_regexp].should be_kind_of RegexpTerminal
|
21
|
+
g[:a_sequence].should be_kind_of Sequence
|
22
|
+
g[:a_range].should be_kind_of RangeOf
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should allow reflection and retrieval" do
|
26
|
+
g = @g
|
27
|
+
g[:a_sequence].should be_kind_of Sequence
|
28
|
+
g[:a_sequence].size.should == 2
|
29
|
+
g[:a_sequence][0].should be_kind_of SymbolReference
|
30
|
+
g[:a_sequence][1].should be_kind_of SymbolReference
|
31
|
+
g[:a_range].size.should == 2
|
32
|
+
g[:a_range][0].should be_kind_of SymbolReference
|
33
|
+
g[:a_range][1].should be_kind_of SymbolReference
|
34
|
+
g[:a_range].range.should == (1..Infinity)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should allow useful inspect() calls" do
|
38
|
+
g = @g
|
39
|
+
g[:a_string].inspect.should == %{:a_string"a string"(_)}
|
40
|
+
g[:a_regexp].inspect.should == %{:a_regexp/^[abc]+$/(_)}
|
41
|
+
g[:a_sequence].inspect.should == %{:a_sequence[::a_string, ::a_regexp]}
|
42
|
+
g[:a_range].inspect.should == %<:a_range(1 or more):(::a_string, ::a_regexp)>
|
43
|
+
g[:a_range2].inspect.should == %<:a_range2(1..2):(::a_string, ::a_regexp)>
|
44
|
+
end
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hipe-gorillagrammar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1beta
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Meves
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-23 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: LR Parser Generator (?) under 500 LOC with 100*% C1 test coverage. No useful AST yet. No useful docs yet.
|
17
|
+
email: mark.meves@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- History.txt
|
27
|
+
- LICENSE.txt
|
28
|
+
- README.txt
|
29
|
+
- Rakefile
|
30
|
+
- Thorfile
|
31
|
+
- hipe-gorillagrammar.gemspec
|
32
|
+
- lib/hipe-gorillagrammar.rb
|
33
|
+
- lib/hipe-gorillagrammar/extensions/syntax.rb
|
34
|
+
- spec/argv.rb
|
35
|
+
- spec/extensions/syntax_spec.rb
|
36
|
+
- spec/grammar_spec.rb
|
37
|
+
- spec/helpers.rb
|
38
|
+
- spec/parse_tree_spec.rb
|
39
|
+
- spec/parsing_spec.rb
|
40
|
+
- spec/range_spec.rb
|
41
|
+
- spec/regexp_spec.rb
|
42
|
+
- spec/runtime_spec.rb
|
43
|
+
- spec/sequence_spec.rb
|
44
|
+
- spec/shorthand_spec.rb
|
45
|
+
- spec/spec.opts
|
46
|
+
- spec/symbol_reference_spec.rb
|
47
|
+
- spec/symbol_spec.rb
|
48
|
+
has_rdoc: yard
|
49
|
+
homepage: http://github.com/hipe/hipe-gorillagrammar
|
50
|
+
licenses: []
|
51
|
+
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 1.3.1
|
68
|
+
version:
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.3.5
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: "'beta attempt at a simple LR parser generator driven by DSL under 500LOC 100% C1 test coverage'"
|
76
|
+
test_files:
|
77
|
+
- spec/argv.rb
|
78
|
+
- spec/grammar_spec.rb
|
79
|
+
- spec/helpers.rb
|
80
|
+
- spec/parse_tree_spec.rb
|
81
|
+
- spec/parsing_spec.rb
|
82
|
+
- spec/range_spec.rb
|
83
|
+
- spec/regexp_spec.rb
|
84
|
+
- spec/runtime_spec.rb
|
85
|
+
- spec/sequence_spec.rb
|
86
|
+
- spec/shorthand_spec.rb
|
87
|
+
- spec/symbol_reference_spec.rb
|
88
|
+
- spec/symbol_spec.rb
|