antelope 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +25 -23
- data/.rspec +3 -3
- data/.travis.yml +10 -9
- data/.yardopts +7 -7
- data/CONTRIBUTING.md +38 -38
- data/GENERATORS.md +124 -124
- data/Gemfile +7 -7
- data/LICENSE.txt +22 -22
- data/README.md +104 -104
- data/Rakefile +2 -2
- data/TODO.md +58 -58
- data/antelope.gemspec +28 -28
- data/bin/antelope +7 -7
- data/examples/deterministic.ace +35 -35
- data/examples/example.ace +51 -50
- data/examples/example.err +192 -0
- data/examples/{example.output → example.inf} +384 -385
- data/examples/liquidscript.ace +233 -162
- data/examples/simple.ace +22 -22
- data/lib/antelope/ace/compiler.rb +334 -334
- data/lib/antelope/ace/errors.rb +48 -48
- data/lib/antelope/ace/grammar/generation.rb +80 -80
- data/lib/antelope/ace/grammar/loading.rb +53 -53
- data/lib/antelope/ace/grammar/precedences.rb +68 -65
- data/lib/antelope/ace/grammar/productions.rb +156 -150
- data/lib/antelope/ace/grammar/symbols.rb +66 -66
- data/lib/antelope/ace/grammar.rb +69 -69
- data/lib/antelope/ace/precedence.rb +61 -61
- data/lib/antelope/ace/production.rb +57 -57
- data/lib/antelope/ace/scanner/argument.rb +57 -57
- data/lib/antelope/ace/scanner/first.rb +89 -89
- data/lib/antelope/ace/scanner/second.rb +177 -177
- data/lib/antelope/ace/scanner/third.rb +27 -27
- data/lib/antelope/ace/scanner.rb +134 -134
- data/lib/antelope/ace/token/epsilon.rb +24 -24
- data/lib/antelope/ace/token/error.rb +26 -26
- data/lib/antelope/ace/token/nonterminal.rb +17 -17
- data/lib/antelope/ace/token/terminal.rb +17 -17
- data/lib/antelope/ace/token.rb +238 -238
- data/lib/antelope/ace.rb +53 -53
- data/lib/antelope/cli.rb +55 -55
- data/lib/antelope/errors.rb +8 -8
- data/lib/antelope/generation/constructor/first.rb +88 -88
- data/lib/antelope/generation/constructor/follow.rb +103 -103
- data/lib/antelope/generation/constructor/nullable.rb +64 -64
- data/lib/antelope/generation/constructor.rb +126 -126
- data/lib/antelope/generation/errors.rb +17 -17
- data/lib/antelope/generation/null.rb +13 -13
- data/lib/antelope/generation/recognizer/rule.rb +216 -216
- data/lib/antelope/generation/recognizer/state.rb +130 -130
- data/lib/antelope/generation/recognizer.rb +180 -180
- data/lib/antelope/generation/tableizer.rb +175 -154
- data/lib/antelope/generation.rb +15 -15
- data/lib/antelope/generator/base.rb +264 -264
- data/lib/antelope/generator/c.rb +11 -11
- data/lib/antelope/generator/c_header.rb +105 -105
- data/lib/antelope/generator/c_source.rb +39 -39
- data/lib/antelope/generator/error.rb +34 -0
- data/lib/antelope/generator/group.rb +57 -57
- data/lib/antelope/generator/html.rb +51 -0
- data/lib/antelope/generator/info.rb +47 -0
- data/lib/antelope/generator/null.rb +18 -18
- data/lib/antelope/generator/output.rb +17 -49
- data/lib/antelope/generator/ruby.rb +79 -79
- data/lib/antelope/generator/templates/c_header.ant +36 -36
- data/lib/antelope/generator/templates/c_source.ant +202 -202
- data/lib/antelope/generator/templates/error.ant +33 -0
- data/lib/antelope/generator/templates/html/antelope.css +1 -0
- data/lib/antelope/generator/templates/html/antelope.html +1 -0
- data/lib/antelope/generator/templates/html/antelope.js +1 -0
- data/lib/antelope/generator/templates/html/css.ant +53 -0
- data/lib/antelope/generator/templates/html/html.ant +82 -0
- data/lib/antelope/generator/templates/html/js.ant +9 -0
- data/lib/antelope/generator/templates/info.ant +53 -0
- data/lib/antelope/generator/templates/ruby.ant +178 -146
- data/lib/antelope/generator.rb +66 -63
- data/lib/antelope/template/compiler.rb +78 -78
- data/lib/antelope/template/errors.rb +9 -9
- data/lib/antelope/template/scanner.rb +109 -109
- data/lib/antelope/template.rb +65 -60
- data/lib/antelope/version.rb +6 -6
- data/lib/antelope.rb +13 -13
- data/optimizations.txt +42 -0
- data/spec/antelope/ace/compiler_spec.rb +60 -60
- data/spec/antelope/ace/scanner_spec.rb +27 -27
- data/spec/antelope/constructor_spec.rb +133 -136
- data/spec/antelope/template_spec.rb +50 -49
- data/spec/fixtures/simple.ace +22 -22
- data/spec/spec_helper.rb +39 -39
- data/spec/support/benchmark_helper.rb +5 -5
- data/spec/support/grammar_helper.rb +15 -15
- data/subl/Ace (Ruby).JSON-tmLanguage +94 -94
- data/subl/Ace (Ruby).tmLanguage +153 -153
- metadata +17 -6
- data/lib/antelope/generator/templates/output.ant +0 -68
@@ -1,15 +1,15 @@
|
|
1
|
-
module GrammarHelper
|
2
|
-
|
3
|
-
def grammar_for(grammar_file = "simple")
|
4
|
-
source_path = Pathname.new("../../fixtures").expand_path(__FILE__)
|
5
|
-
Ace::Grammar.from_file(source_path.children.select(&:file?)
|
6
|
-
.find { |x| x.to_s =~ /#{Regexp.escape(grammar_file)}\..*\z/ }.to_s)
|
7
|
-
end
|
8
|
-
|
9
|
-
def with_recognizer(grammar = simple_grammar)
|
10
|
-
recognizer = Generation::Recognizer.new(grammar).call
|
11
|
-
grammar
|
12
|
-
end
|
13
|
-
|
14
|
-
alias_method :simple_grammar, :grammar_for
|
15
|
-
end
|
1
|
+
module GrammarHelper
|
2
|
+
|
3
|
+
def grammar_for(grammar_file = "simple")
|
4
|
+
source_path = Pathname.new("../../fixtures").expand_path(__FILE__)
|
5
|
+
Ace::Grammar.from_file(source_path.children.select(&:file?)
|
6
|
+
.find { |x| x.to_s =~ /#{Regexp.escape(grammar_file)}\..*\z/ }.to_s)
|
7
|
+
end
|
8
|
+
|
9
|
+
def with_recognizer(grammar = simple_grammar)
|
10
|
+
recognizer = Generation::Recognizer.new(grammar).call
|
11
|
+
grammar
|
12
|
+
end
|
13
|
+
|
14
|
+
alias_method :simple_grammar, :grammar_for
|
15
|
+
end
|
@@ -1,94 +1,94 @@
|
|
1
|
-
// [PackageDev] target_format: plist, ext: tmLanguage
|
2
|
-
|
3
|
-
{
|
4
|
-
"name": "Ace (Ruby Host)",
|
5
|
-
"scopeName": "source.ace.ruby",
|
6
|
-
"fileTypes": [
|
7
|
-
"ace"
|
8
|
-
],
|
9
|
-
"uuid": "2d7fd617-f324-4476-9380-f5108efdf88d",
|
10
|
-
|
11
|
-
"patterns": [
|
12
|
-
{ "include": "#firstSection" }
|
13
|
-
],
|
14
|
-
|
15
|
-
"repository": {
|
16
|
-
"firstSection": {
|
17
|
-
"patterns": [
|
18
|
-
{
|
19
|
-
"begin": "%%",
|
20
|
-
"end": "a^",
|
21
|
-
"name": "meta.section.third.ace.ruby",
|
22
|
-
"patterns": [
|
23
|
-
{ "include": "#secondSection" }
|
24
|
-
]
|
25
|
-
},
|
26
|
-
{
|
27
|
-
"begin": "(%[A-Za-z0-9_.-]+)",
|
28
|
-
"end": "\\n",
|
29
|
-
"name": "meta.function.ace.ruby",
|
30
|
-
"beginCaptures": {
|
31
|
-
"1": { "name": "keyword.other.ace.ruby" }
|
32
|
-
},
|
33
|
-
"patterns": [
|
34
|
-
{
|
35
|
-
"match": "(<)((?:\\\\>|[^>])*)(>)",
|
36
|
-
"name": "string.quoted.other.ace.ruby"
|
37
|
-
},
|
38
|
-
{
|
39
|
-
"match": "(\\{)((?:\\\\}|[^}])*)(\\})",
|
40
|
-
"name": "string.quoted.other.ace.ruby"
|
41
|
-
},
|
42
|
-
{
|
43
|
-
"match": "(\\')((?:\\\\'|[^'])*)(\\')",
|
44
|
-
"name": "string.quoted.single.ace.ruby"
|
45
|
-
},
|
46
|
-
{
|
47
|
-
"match": "(\\\")((?:\\\\\"|[^\"])*)(\\\")",
|
48
|
-
"name": "string.quoted.double.ace.ruby"
|
49
|
-
},
|
50
|
-
{
|
51
|
-
"match": "(?<=\\s)([A-Za-z0-9_.-]+)(?=\\s)",
|
52
|
-
"name": "variable.parameter.ace.ruby"
|
53
|
-
}
|
54
|
-
]
|
55
|
-
}
|
56
|
-
]
|
57
|
-
|
58
|
-
},
|
59
|
-
"secondSection": {
|
60
|
-
"patterns": [
|
61
|
-
{
|
62
|
-
"begin": "%%",
|
63
|
-
"end": "a^",
|
64
|
-
"name": "meta.section.last.ace.ruby",
|
65
|
-
"patterns": [
|
66
|
-
{ "include": "source.ruby" }
|
67
|
-
]
|
68
|
-
},
|
69
|
-
{
|
70
|
-
"match": "[A-Za-z0-9._-]+:",
|
71
|
-
"name": "constant.other.symbol.ace.ruby"
|
72
|
-
},
|
73
|
-
{
|
74
|
-
"match": "(?<=\\s)[A-Z]+(?=\\s)",
|
75
|
-
"name": "variable.other.constant.ace.ruby"
|
76
|
-
},
|
77
|
-
{
|
78
|
-
"match": "\\|",
|
79
|
-
"name": "keyword.operator.ace.ruby"
|
80
|
-
},
|
81
|
-
{
|
82
|
-
"begin": "\\{",
|
83
|
-
"end": "\\}",
|
84
|
-
"patterns": [
|
85
|
-
{ "include": "source.ruby" }
|
86
|
-
]
|
87
|
-
}
|
88
|
-
]
|
89
|
-
},
|
90
|
-
"thirdSection": {
|
91
|
-
"patterns": []
|
92
|
-
}
|
93
|
-
}
|
94
|
-
}
|
1
|
+
// [PackageDev] target_format: plist, ext: tmLanguage
|
2
|
+
|
3
|
+
{
|
4
|
+
"name": "Ace (Ruby Host)",
|
5
|
+
"scopeName": "source.ace.ruby",
|
6
|
+
"fileTypes": [
|
7
|
+
"ace"
|
8
|
+
],
|
9
|
+
"uuid": "2d7fd617-f324-4476-9380-f5108efdf88d",
|
10
|
+
|
11
|
+
"patterns": [
|
12
|
+
{ "include": "#firstSection" }
|
13
|
+
],
|
14
|
+
|
15
|
+
"repository": {
|
16
|
+
"firstSection": {
|
17
|
+
"patterns": [
|
18
|
+
{
|
19
|
+
"begin": "%%",
|
20
|
+
"end": "a^",
|
21
|
+
"name": "meta.section.third.ace.ruby",
|
22
|
+
"patterns": [
|
23
|
+
{ "include": "#secondSection" }
|
24
|
+
]
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"begin": "(%[A-Za-z0-9_.-]+)",
|
28
|
+
"end": "\\n",
|
29
|
+
"name": "meta.function.ace.ruby",
|
30
|
+
"beginCaptures": {
|
31
|
+
"1": { "name": "keyword.other.ace.ruby" }
|
32
|
+
},
|
33
|
+
"patterns": [
|
34
|
+
{
|
35
|
+
"match": "(<)((?:\\\\>|[^>])*)(>)",
|
36
|
+
"name": "string.quoted.other.ace.ruby"
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"match": "(\\{)((?:\\\\}|[^}])*)(\\})",
|
40
|
+
"name": "string.quoted.other.ace.ruby"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"match": "(\\')((?:\\\\'|[^'])*)(\\')",
|
44
|
+
"name": "string.quoted.single.ace.ruby"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"match": "(\\\")((?:\\\\\"|[^\"])*)(\\\")",
|
48
|
+
"name": "string.quoted.double.ace.ruby"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"match": "(?<=\\s)([A-Za-z0-9_.-]+)(?=\\s)",
|
52
|
+
"name": "variable.parameter.ace.ruby"
|
53
|
+
}
|
54
|
+
]
|
55
|
+
}
|
56
|
+
]
|
57
|
+
|
58
|
+
},
|
59
|
+
"secondSection": {
|
60
|
+
"patterns": [
|
61
|
+
{
|
62
|
+
"begin": "%%",
|
63
|
+
"end": "a^",
|
64
|
+
"name": "meta.section.last.ace.ruby",
|
65
|
+
"patterns": [
|
66
|
+
{ "include": "source.ruby" }
|
67
|
+
]
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"match": "[A-Za-z0-9._-]+:",
|
71
|
+
"name": "constant.other.symbol.ace.ruby"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"match": "(?<=\\s)[A-Z]+(?=\\s)",
|
75
|
+
"name": "variable.other.constant.ace.ruby"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"match": "\\|",
|
79
|
+
"name": "keyword.operator.ace.ruby"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"begin": "\\{",
|
83
|
+
"end": "\\}",
|
84
|
+
"patterns": [
|
85
|
+
{ "include": "source.ruby" }
|
86
|
+
]
|
87
|
+
}
|
88
|
+
]
|
89
|
+
},
|
90
|
+
"thirdSection": {
|
91
|
+
"patterns": []
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
data/subl/Ace (Ruby).tmLanguage
CHANGED
@@ -1,153 +1,153 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
-
<plist version="1.0">
|
4
|
-
<dict>
|
5
|
-
<key>fileTypes</key>
|
6
|
-
<array>
|
7
|
-
<string>ace</string>
|
8
|
-
</array>
|
9
|
-
<key>name</key>
|
10
|
-
<string>Ace (Ruby Host)</string>
|
11
|
-
<key>patterns</key>
|
12
|
-
<array>
|
13
|
-
<dict>
|
14
|
-
<key>include</key>
|
15
|
-
<string>#firstSection</string>
|
16
|
-
</dict>
|
17
|
-
</array>
|
18
|
-
<key>repository</key>
|
19
|
-
<dict>
|
20
|
-
<key>firstSection</key>
|
21
|
-
<dict>
|
22
|
-
<key>patterns</key>
|
23
|
-
<array>
|
24
|
-
<dict>
|
25
|
-
<key>begin</key>
|
26
|
-
<string>%%</string>
|
27
|
-
<key>end</key>
|
28
|
-
<string>a^</string>
|
29
|
-
<key>name</key>
|
30
|
-
<string>meta.section.third.ace.ruby</string>
|
31
|
-
<key>patterns</key>
|
32
|
-
<array>
|
33
|
-
<dict>
|
34
|
-
<key>include</key>
|
35
|
-
<string>#secondSection</string>
|
36
|
-
</dict>
|
37
|
-
</array>
|
38
|
-
</dict>
|
39
|
-
<dict>
|
40
|
-
<key>begin</key>
|
41
|
-
<string>(%[A-Za-z0-9_.-]+)</string>
|
42
|
-
<key>beginCaptures</key>
|
43
|
-
<dict>
|
44
|
-
<key>1</key>
|
45
|
-
<dict>
|
46
|
-
<key>name</key>
|
47
|
-
<string>keyword.other.ace.ruby</string>
|
48
|
-
</dict>
|
49
|
-
</dict>
|
50
|
-
<key>end</key>
|
51
|
-
<string>\n</string>
|
52
|
-
<key>name</key>
|
53
|
-
<string>meta.function.ace.ruby</string>
|
54
|
-
<key>patterns</key>
|
55
|
-
<array>
|
56
|
-
<dict>
|
57
|
-
<key>match</key>
|
58
|
-
<string>(<)((?:\\>|[^>])*)(>)</string>
|
59
|
-
<key>name</key>
|
60
|
-
<string>string.quoted.other.ace.ruby</string>
|
61
|
-
</dict>
|
62
|
-
<dict>
|
63
|
-
<key>match</key>
|
64
|
-
<string>(\{)((?:\\}|[^}])*)(\})</string>
|
65
|
-
<key>name</key>
|
66
|
-
<string>string.quoted.other.ace.ruby</string>
|
67
|
-
</dict>
|
68
|
-
<dict>
|
69
|
-
<key>match</key>
|
70
|
-
<string>(\')((?:\\'|[^'])*)(\')</string>
|
71
|
-
<key>name</key>
|
72
|
-
<string>string.quoted.single.ace.ruby</string>
|
73
|
-
</dict>
|
74
|
-
<dict>
|
75
|
-
<key>match</key>
|
76
|
-
<string>(\")((?:\\"|[^"])*)(\")</string>
|
77
|
-
<key>name</key>
|
78
|
-
<string>string.quoted.double.ace.ruby</string>
|
79
|
-
</dict>
|
80
|
-
<dict>
|
81
|
-
<key>match</key>
|
82
|
-
<string>(?<=\s)([A-Za-z0-9_.-]+)(?=\s)</string>
|
83
|
-
<key>name</key>
|
84
|
-
<string>variable.parameter.ace.ruby</string>
|
85
|
-
</dict>
|
86
|
-
</array>
|
87
|
-
</dict>
|
88
|
-
</array>
|
89
|
-
</dict>
|
90
|
-
<key>secondSection</key>
|
91
|
-
<dict>
|
92
|
-
<key>patterns</key>
|
93
|
-
<array>
|
94
|
-
<dict>
|
95
|
-
<key>begin</key>
|
96
|
-
<string>%%</string>
|
97
|
-
<key>end</key>
|
98
|
-
<string>a^</string>
|
99
|
-
<key>name</key>
|
100
|
-
<string>meta.section.last.ace.ruby</string>
|
101
|
-
<key>patterns</key>
|
102
|
-
<array>
|
103
|
-
<dict>
|
104
|
-
<key>include</key>
|
105
|
-
<string>source.ruby</string>
|
106
|
-
</dict>
|
107
|
-
</array>
|
108
|
-
</dict>
|
109
|
-
<dict>
|
110
|
-
<key>match</key>
|
111
|
-
<string>[A-Za-z0-9._-]+:</string>
|
112
|
-
<key>name</key>
|
113
|
-
<string>constant.other.symbol.ace.ruby</string>
|
114
|
-
</dict>
|
115
|
-
<dict>
|
116
|
-
<key>match</key>
|
117
|
-
<string>(?<=\s)[A-Z]+(?=\s)</string>
|
118
|
-
<key>name</key>
|
119
|
-
<string>variable.other.constant.ace.ruby</string>
|
120
|
-
</dict>
|
121
|
-
<dict>
|
122
|
-
<key>match</key>
|
123
|
-
<string>\|</string>
|
124
|
-
<key>name</key>
|
125
|
-
<string>keyword.operator.ace.ruby</string>
|
126
|
-
</dict>
|
127
|
-
<dict>
|
128
|
-
<key>begin</key>
|
129
|
-
<string>\{</string>
|
130
|
-
<key>end</key>
|
131
|
-
<string>\}</string>
|
132
|
-
<key>patterns</key>
|
133
|
-
<array>
|
134
|
-
<dict>
|
135
|
-
<key>include</key>
|
136
|
-
<string>source.ruby</string>
|
137
|
-
</dict>
|
138
|
-
</array>
|
139
|
-
</dict>
|
140
|
-
</array>
|
141
|
-
</dict>
|
142
|
-
<key>thirdSection</key>
|
143
|
-
<dict>
|
144
|
-
<key>patterns</key>
|
145
|
-
<array/>
|
146
|
-
</dict>
|
147
|
-
</dict>
|
148
|
-
<key>scopeName</key>
|
149
|
-
<string>source.ace.ruby</string>
|
150
|
-
<key>uuid</key>
|
151
|
-
<string>2d7fd617-f324-4476-9380-f5108efdf88d</string>
|
152
|
-
</dict>
|
153
|
-
</plist>
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>fileTypes</key>
|
6
|
+
<array>
|
7
|
+
<string>ace</string>
|
8
|
+
</array>
|
9
|
+
<key>name</key>
|
10
|
+
<string>Ace (Ruby Host)</string>
|
11
|
+
<key>patterns</key>
|
12
|
+
<array>
|
13
|
+
<dict>
|
14
|
+
<key>include</key>
|
15
|
+
<string>#firstSection</string>
|
16
|
+
</dict>
|
17
|
+
</array>
|
18
|
+
<key>repository</key>
|
19
|
+
<dict>
|
20
|
+
<key>firstSection</key>
|
21
|
+
<dict>
|
22
|
+
<key>patterns</key>
|
23
|
+
<array>
|
24
|
+
<dict>
|
25
|
+
<key>begin</key>
|
26
|
+
<string>%%</string>
|
27
|
+
<key>end</key>
|
28
|
+
<string>a^</string>
|
29
|
+
<key>name</key>
|
30
|
+
<string>meta.section.third.ace.ruby</string>
|
31
|
+
<key>patterns</key>
|
32
|
+
<array>
|
33
|
+
<dict>
|
34
|
+
<key>include</key>
|
35
|
+
<string>#secondSection</string>
|
36
|
+
</dict>
|
37
|
+
</array>
|
38
|
+
</dict>
|
39
|
+
<dict>
|
40
|
+
<key>begin</key>
|
41
|
+
<string>(%[A-Za-z0-9_.-]+)</string>
|
42
|
+
<key>beginCaptures</key>
|
43
|
+
<dict>
|
44
|
+
<key>1</key>
|
45
|
+
<dict>
|
46
|
+
<key>name</key>
|
47
|
+
<string>keyword.other.ace.ruby</string>
|
48
|
+
</dict>
|
49
|
+
</dict>
|
50
|
+
<key>end</key>
|
51
|
+
<string>\n</string>
|
52
|
+
<key>name</key>
|
53
|
+
<string>meta.function.ace.ruby</string>
|
54
|
+
<key>patterns</key>
|
55
|
+
<array>
|
56
|
+
<dict>
|
57
|
+
<key>match</key>
|
58
|
+
<string>(<)((?:\\>|[^>])*)(>)</string>
|
59
|
+
<key>name</key>
|
60
|
+
<string>string.quoted.other.ace.ruby</string>
|
61
|
+
</dict>
|
62
|
+
<dict>
|
63
|
+
<key>match</key>
|
64
|
+
<string>(\{)((?:\\}|[^}])*)(\})</string>
|
65
|
+
<key>name</key>
|
66
|
+
<string>string.quoted.other.ace.ruby</string>
|
67
|
+
</dict>
|
68
|
+
<dict>
|
69
|
+
<key>match</key>
|
70
|
+
<string>(\')((?:\\'|[^'])*)(\')</string>
|
71
|
+
<key>name</key>
|
72
|
+
<string>string.quoted.single.ace.ruby</string>
|
73
|
+
</dict>
|
74
|
+
<dict>
|
75
|
+
<key>match</key>
|
76
|
+
<string>(\")((?:\\"|[^"])*)(\")</string>
|
77
|
+
<key>name</key>
|
78
|
+
<string>string.quoted.double.ace.ruby</string>
|
79
|
+
</dict>
|
80
|
+
<dict>
|
81
|
+
<key>match</key>
|
82
|
+
<string>(?<=\s)([A-Za-z0-9_.-]+)(?=\s)</string>
|
83
|
+
<key>name</key>
|
84
|
+
<string>variable.parameter.ace.ruby</string>
|
85
|
+
</dict>
|
86
|
+
</array>
|
87
|
+
</dict>
|
88
|
+
</array>
|
89
|
+
</dict>
|
90
|
+
<key>secondSection</key>
|
91
|
+
<dict>
|
92
|
+
<key>patterns</key>
|
93
|
+
<array>
|
94
|
+
<dict>
|
95
|
+
<key>begin</key>
|
96
|
+
<string>%%</string>
|
97
|
+
<key>end</key>
|
98
|
+
<string>a^</string>
|
99
|
+
<key>name</key>
|
100
|
+
<string>meta.section.last.ace.ruby</string>
|
101
|
+
<key>patterns</key>
|
102
|
+
<array>
|
103
|
+
<dict>
|
104
|
+
<key>include</key>
|
105
|
+
<string>source.ruby</string>
|
106
|
+
</dict>
|
107
|
+
</array>
|
108
|
+
</dict>
|
109
|
+
<dict>
|
110
|
+
<key>match</key>
|
111
|
+
<string>[A-Za-z0-9._-]+:</string>
|
112
|
+
<key>name</key>
|
113
|
+
<string>constant.other.symbol.ace.ruby</string>
|
114
|
+
</dict>
|
115
|
+
<dict>
|
116
|
+
<key>match</key>
|
117
|
+
<string>(?<=\s)[A-Z]+(?=\s)</string>
|
118
|
+
<key>name</key>
|
119
|
+
<string>variable.other.constant.ace.ruby</string>
|
120
|
+
</dict>
|
121
|
+
<dict>
|
122
|
+
<key>match</key>
|
123
|
+
<string>\|</string>
|
124
|
+
<key>name</key>
|
125
|
+
<string>keyword.operator.ace.ruby</string>
|
126
|
+
</dict>
|
127
|
+
<dict>
|
128
|
+
<key>begin</key>
|
129
|
+
<string>\{</string>
|
130
|
+
<key>end</key>
|
131
|
+
<string>\}</string>
|
132
|
+
<key>patterns</key>
|
133
|
+
<array>
|
134
|
+
<dict>
|
135
|
+
<key>include</key>
|
136
|
+
<string>source.ruby</string>
|
137
|
+
</dict>
|
138
|
+
</array>
|
139
|
+
</dict>
|
140
|
+
</array>
|
141
|
+
</dict>
|
142
|
+
<key>thirdSection</key>
|
143
|
+
<dict>
|
144
|
+
<key>patterns</key>
|
145
|
+
<array/>
|
146
|
+
</dict>
|
147
|
+
</dict>
|
148
|
+
<key>scopeName</key>
|
149
|
+
<string>source.ace.ruby</string>
|
150
|
+
<key>uuid</key>
|
151
|
+
<string>2d7fd617-f324-4476-9380-f5108efdf88d</string>
|
152
|
+
</dict>
|
153
|
+
</plist>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: antelope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Rodi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -117,7 +117,8 @@ files:
|
|
117
117
|
- bin/antelope
|
118
118
|
- examples/deterministic.ace
|
119
119
|
- examples/example.ace
|
120
|
-
- examples/example.
|
120
|
+
- examples/example.err
|
121
|
+
- examples/example.inf
|
121
122
|
- examples/liquidscript.ace
|
122
123
|
- examples/simple.ace
|
123
124
|
- lib/antelope.rb
|
@@ -160,19 +161,30 @@ files:
|
|
160
161
|
- lib/antelope/generator/c.rb
|
161
162
|
- lib/antelope/generator/c_header.rb
|
162
163
|
- lib/antelope/generator/c_source.rb
|
164
|
+
- lib/antelope/generator/error.rb
|
163
165
|
- lib/antelope/generator/group.rb
|
166
|
+
- lib/antelope/generator/html.rb
|
167
|
+
- lib/antelope/generator/info.rb
|
164
168
|
- lib/antelope/generator/null.rb
|
165
169
|
- lib/antelope/generator/output.rb
|
166
170
|
- lib/antelope/generator/ruby.rb
|
167
171
|
- lib/antelope/generator/templates/c_header.ant
|
168
172
|
- lib/antelope/generator/templates/c_source.ant
|
169
|
-
- lib/antelope/generator/templates/
|
173
|
+
- lib/antelope/generator/templates/error.ant
|
174
|
+
- lib/antelope/generator/templates/html/antelope.css
|
175
|
+
- lib/antelope/generator/templates/html/antelope.html
|
176
|
+
- lib/antelope/generator/templates/html/antelope.js
|
177
|
+
- lib/antelope/generator/templates/html/css.ant
|
178
|
+
- lib/antelope/generator/templates/html/html.ant
|
179
|
+
- lib/antelope/generator/templates/html/js.ant
|
180
|
+
- lib/antelope/generator/templates/info.ant
|
170
181
|
- lib/antelope/generator/templates/ruby.ant
|
171
182
|
- lib/antelope/template.rb
|
172
183
|
- lib/antelope/template/compiler.rb
|
173
184
|
- lib/antelope/template/errors.rb
|
174
185
|
- lib/antelope/template/scanner.rb
|
175
186
|
- lib/antelope/version.rb
|
187
|
+
- optimizations.txt
|
176
188
|
- spec/antelope/ace/compiler_spec.rb
|
177
189
|
- spec/antelope/ace/scanner_spec.rb
|
178
190
|
- spec/antelope/constructor_spec.rb
|
@@ -203,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
215
|
version: '0'
|
204
216
|
requirements: []
|
205
217
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.
|
218
|
+
rubygems_version: 2.4.5
|
207
219
|
signing_key:
|
208
220
|
specification_version: 4
|
209
221
|
summary: A compiler compiler, written in ruby.
|
@@ -216,4 +228,3 @@ test_files:
|
|
216
228
|
- spec/spec_helper.rb
|
217
229
|
- spec/support/benchmark_helper.rb
|
218
230
|
- spec/support/grammar_helper.rb
|
219
|
-
has_rdoc:
|
@@ -1,68 +0,0 @@
|
|
1
|
-
Productions:
|
2
|
-
{{
|
3
|
-
len = grammar.all_productions.size.to_s.size
|
4
|
-
productions = grammar.all_productions.
|
5
|
-
map { |x| ["#{x.label}: #{x.items.join(' ')}", x.block] }
|
6
|
-
body = productions.map { |_| _.first.size }.max
|
7
|
-
}}
|
8
|
-
{{ productions.each_with_index do |prod, i| }}
|
9
|
-
{{= "%#{len}s" % i }} {{= "%-#{body}s" % prod[0] }} {{= prod[1] }}
|
10
|
-
{{ end }}
|
11
|
-
|
12
|
-
{{ if unused_symbols.any? }}
|
13
|
-
Symbols unused in grammar:
|
14
|
-
{{ unused_symbols.each do |sym| }}
|
15
|
-
{{= sym }}
|
16
|
-
{{ end }}
|
17
|
-
{{ end }}
|
18
|
-
|
19
|
-
Precedence:
|
20
|
-
--- highest
|
21
|
-
{{ grammar.precedence.each do |pr| }}
|
22
|
-
{{= "%-8s" % pr.type }} {{= pr.level }}:
|
23
|
-
{{= "{" << pr.tokens.to_a.join(", ") << "}" }}
|
24
|
-
{{ end }}
|
25
|
-
--- lowest
|
26
|
-
|
27
|
-
{{
|
28
|
-
len = table.flatten.map(&:keys).flatten.map(&:size).max
|
29
|
-
states = grammar.states.to_a
|
30
|
-
}}
|
31
|
-
|
32
|
-
{{ table.each_with_index do |v, i| }}
|
33
|
-
{{ state = states[i] }}
|
34
|
-
State {{= i }}:
|
35
|
-
{{ state.rules.each do |rule| }}
|
36
|
-
{{= rule }}
|
37
|
-
{{= "{" << rule.lookahead.to_a.join(", ") << "}" }}
|
38
|
-
{{ end }}
|
39
|
-
{{
|
40
|
-
transitions = v.each.select { |_, a| a && a[0] == :state }
|
41
|
-
reductions = v.each.select { |_, a| a && a[0] == :reduce}
|
42
|
-
accepting = v.each.select { |_, a| a && a[0] == :accept}
|
43
|
-
conflicts = tableizer.conflicts[i].each
|
44
|
-
thing = [:transitions, :reductions, :accepting]
|
45
|
-
num_type = {
|
46
|
-
transitions: "State",
|
47
|
-
reductions: "Rule",
|
48
|
-
accepting: "Rule"
|
49
|
-
}
|
50
|
-
h = Hash[thing.zip([transitions, reductions, accepting])]
|
51
|
-
}}
|
52
|
-
{{ h.each do |key, value| }}
|
53
|
-
{{ next unless value.any? }}
|
54
|
-
{{= key }}:
|
55
|
-
{{ value.each do |token, (_, name)| }}
|
56
|
-
{{ token_value = grammar.terminals.
|
57
|
-
find { |_| _.name == token } || token }}
|
58
|
-
{{= token_value }}: {{= num_type[key] }} {{= name }}
|
59
|
-
{{ end }}
|
60
|
-
{{ end }}
|
61
|
-
{{ if conflicts.any? }}
|
62
|
-
conflicts:
|
63
|
-
{{ conflicts.each do |token, (first, second, rule, terminal)| }}
|
64
|
-
{{= token }}: {{= first.join(" ") }}/{{= second.join(" ") }} ({{= rule }} vs {{= terminal }})
|
65
|
-
{{ end }}
|
66
|
-
{{ end }}
|
67
|
-
|
68
|
-
{{ end }}
|