citrus 2.3.7 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
metadata CHANGED
@@ -1,34 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citrus
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 2
7
- - 3
8
- - 7
9
- version: 2.3.7
4
+ version: 2.4.0
10
5
  platform: ruby
11
6
  authors:
12
- - Michael Jackson
7
+ - Michael Jackson
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
11
 
17
- date: 2011-02-20 00:00:00 -08:00
12
+ date: 2011-05-11 00:00:00 -07:00
18
13
  default_executable:
19
14
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rake
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
30
- type: :development
31
- version_requirements: *id001
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
32
25
  description: Parsing Expressions for Ruby
33
26
  email: mjijackson@gmail.com
34
27
  executables: []
@@ -36,163 +29,169 @@ executables: []
36
29
  extensions: []
37
30
 
38
31
  extra_rdoc_files:
39
- - README
40
- - CHANGES
32
+ - README
33
+ - CHANGES
41
34
  files:
42
- - benchmark/after.dat
43
- - benchmark/before.dat
44
- - benchmark/seqpar.citrus
45
- - benchmark/seqpar.gnuplot
46
- - benchmark/seqpar.rb
47
- - doc/background.markdown
48
- - doc/example.markdown
49
- - doc/extras.markdown
50
- - doc/index.markdown
51
- - doc/license.markdown
52
- - doc/links.markdown
53
- - doc/syntax.markdown
54
- - doc/testing.markdown
55
- - examples/calc.citrus
56
- - examples/calc_test.rb
57
- - examples/calc_test.rbc
58
- - examples/email.citrus
59
- - examples/email_test.rb
60
- - examples/ipaddress.citrus
61
- - examples/ipaddress_test.rb
62
- - examples/ipaddress_test.rbc
63
- - examples/ipv4address.citrus
64
- - examples/ipv4address_test.rb
65
- - examples/ipv4address_test.rbc
66
- - examples/ipv6address.citrus
67
- - examples/ipv6address_test.rb
68
- - examples/ipv6address_test.rbc
69
- - lib/citrus.rb
70
- - lib/citrus/file.rb
71
- - lib/citrus/version.rb
72
- - test/alias_test.rb
73
- - test/alias_test.rbc
74
- - test/and_predicate_test.rb
75
- - test/and_predicate_test.rbc
76
- - test/but_predicate_test.rb
77
- - test/but_predicate_test.rbc
78
- - test/choice_test.rb
79
- - test/choice_test.rbc
80
- - test/extension_test.rb
81
- - test/extension_test.rbc
82
- - test/file_test.rb
83
- - test/file_test.rbc
84
- - test/grammar_test.rb
85
- - test/grammar_test.rbc
86
- - test/helper.rb
87
- - test/helper.rbc
88
- - test/input_test.rb
89
- - test/input_test.rbc
90
- - test/label_test.rb
91
- - test/label_test.rbc
92
- - test/match_test.rb
93
- - test/match_test.rbc
94
- - test/memoized_input_test.rb
95
- - test/memoized_input_test.rbc
96
- - test/multibyte_test.rb
97
- - test/multibyte_test.rbc
98
- - test/not_predicate_test.rb
99
- - test/not_predicate_test.rbc
100
- - test/parse_error_test.rb
101
- - test/parse_error_test.rbc
102
- - test/repeat_test.rb
103
- - test/repeat_test.rbc
104
- - test/sequence_test.rb
105
- - test/sequence_test.rbc
106
- - test/string_terminal_test.rb
107
- - test/string_terminal_test.rbc
108
- - test/super_test.rb
109
- - test/super_test.rbc
110
- - test/terminal_test.rb
111
- - test/terminal_test.rbc
112
- - test/_files/alias.citrus
113
- - test/_files/grammar1.citrus
114
- - test/_files/grammar2.citrus
115
- - test/_files/grammar3.citrus
116
- - test/_files/rule1.citrus
117
- - test/_files/rule2.citrus
118
- - test/_files/rule3.citrus
119
- - test/_files/super.citrus
120
- - test/_files/super2.citrus
121
- - citrus.gemspec
122
- - Rakefile
123
- - README
124
- - CHANGES
35
+ - benchmark/after.dat
36
+ - benchmark/before.dat
37
+ - benchmark/seqpar.citrus
38
+ - benchmark/seqpar.gnuplot
39
+ - benchmark/seqpar.rb
40
+ - doc/background.markdown
41
+ - doc/example.markdown
42
+ - doc/extras.markdown
43
+ - doc/index.markdown
44
+ - doc/license.markdown
45
+ - doc/links.markdown
46
+ - doc/syntax.markdown
47
+ - doc/testing.markdown
48
+ - lib/citrus/file.rb
49
+ - lib/citrus/grammars.rb
50
+ - lib/citrus/version.rb
51
+ - lib/citrus.rb
52
+ - test/_files/alias.citrus
53
+ - test/_files/grammar1.citrus
54
+ - test/_files/grammar2.citrus
55
+ - test/_files/grammar3.citrus
56
+ - test/_files/rule1.citrus
57
+ - test/_files/rule2.citrus
58
+ - test/_files/rule3.citrus
59
+ - test/_files/rule4.citrus
60
+ - test/_files/super.citrus
61
+ - test/_files/super2.citrus
62
+ - test/alias_test.rb
63
+ - test/alias_test.rbc
64
+ - test/and_predicate_test.rb
65
+ - test/and_predicate_test.rbc
66
+ - test/but_predicate_test.rb
67
+ - test/but_predicate_test.rbc
68
+ - test/choice_test.rb
69
+ - test/choice_test.rbc
70
+ - test/extension_test.rb
71
+ - test/extension_test.rbc
72
+ - test/file_test.rb
73
+ - test/file_test.rbc
74
+ - test/grammar_test.rb
75
+ - test/grammar_test.rbc
76
+ - test/grammars/calc_test.rb
77
+ - test/grammars/calc_test.rbc
78
+ - test/grammars/email_test.rb
79
+ - test/grammars/ipaddress_test.rb
80
+ - test/grammars/ipaddress_test.rbc
81
+ - test/grammars/ipv4address_test.rb
82
+ - test/grammars/ipv4address_test.rbc
83
+ - test/grammars/ipv6address_test.rb
84
+ - test/grammars/ipv6address_test.rbc
85
+ - test/grammars/uri_test.rb
86
+ - test/helper.rb
87
+ - test/helper.rbc
88
+ - test/input_test.rb
89
+ - test/input_test.rbc
90
+ - test/label_test.rb
91
+ - test/label_test.rbc
92
+ - test/match_test.rb
93
+ - test/match_test.rbc
94
+ - test/memoized_input_test.rb
95
+ - test/memoized_input_test.rbc
96
+ - test/multibyte_test.rb
97
+ - test/multibyte_test.rbc
98
+ - test/not_predicate_test.rb
99
+ - test/not_predicate_test.rbc
100
+ - test/parse_error_test.rb
101
+ - test/parse_error_test.rbc
102
+ - test/repeat_test.rb
103
+ - test/repeat_test.rbc
104
+ - test/sequence_test.rb
105
+ - test/sequence_test.rbc
106
+ - test/string_terminal_test.rb
107
+ - test/string_terminal_test.rbc
108
+ - test/super_test.rb
109
+ - test/super_test.rbc
110
+ - test/terminal_test.rb
111
+ - test/terminal_test.rbc
112
+ - citrus.gemspec
113
+ - Rakefile
114
+ - README
115
+ - CHANGES
125
116
  has_rdoc: true
126
117
  homepage: http://mjijackson.com/citrus
127
118
  licenses: []
128
119
 
129
120
  post_install_message:
130
121
  rdoc_options:
131
- - --line-numbers
132
- - --inline-source
133
- - --title
134
- - Citrus
135
- - --main
136
- - Citrus
122
+ - --line-numbers
123
+ - --inline-source
124
+ - --title
125
+ - Citrus
126
+ - --main
127
+ - Citrus
137
128
  require_paths:
138
- - lib
129
+ - lib
139
130
  required_ruby_version: !ruby/object:Gem::Requirement
140
131
  requirements:
141
- - - ">="
142
- - !ruby/object:Gem::Version
143
- segments:
144
- - 0
145
- version: "0"
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: "0"
135
+ version:
146
136
  required_rubygems_version: !ruby/object:Gem::Requirement
147
137
  requirements:
148
- - - ">="
149
- - !ruby/object:Gem::Version
150
- segments:
151
- - 0
152
- version: "0"
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: "0"
141
+ version:
153
142
  requirements: []
154
143
 
155
144
  rubyforge_project:
156
- rubygems_version: 1.3.6
145
+ rubygems_version: 1.3.5
157
146
  signing_key:
158
147
  specification_version: 3
159
148
  summary: Parsing Expressions for Ruby
160
149
  test_files:
161
- - test/alias_test.rb
162
- - test/alias_test.rbc
163
- - test/and_predicate_test.rb
164
- - test/and_predicate_test.rbc
165
- - test/but_predicate_test.rb
166
- - test/but_predicate_test.rbc
167
- - test/choice_test.rb
168
- - test/choice_test.rbc
169
- - test/extension_test.rb
170
- - test/extension_test.rbc
171
- - test/file_test.rb
172
- - test/file_test.rbc
173
- - test/grammar_test.rb
174
- - test/grammar_test.rbc
175
- - test/input_test.rb
176
- - test/input_test.rbc
177
- - test/label_test.rb
178
- - test/label_test.rbc
179
- - test/match_test.rb
180
- - test/match_test.rbc
181
- - test/memoized_input_test.rb
182
- - test/memoized_input_test.rbc
183
- - test/multibyte_test.rb
184
- - test/multibyte_test.rbc
185
- - test/not_predicate_test.rb
186
- - test/not_predicate_test.rbc
187
- - test/parse_error_test.rb
188
- - test/parse_error_test.rbc
189
- - test/repeat_test.rb
190
- - test/repeat_test.rbc
191
- - test/sequence_test.rb
192
- - test/sequence_test.rbc
193
- - test/string_terminal_test.rb
194
- - test/string_terminal_test.rbc
195
- - test/super_test.rb
196
- - test/super_test.rbc
197
- - test/terminal_test.rb
198
- - test/terminal_test.rbc
150
+ - test/alias_test.rb
151
+ - test/alias_test.rbc
152
+ - test/and_predicate_test.rb
153
+ - test/and_predicate_test.rbc
154
+ - test/but_predicate_test.rb
155
+ - test/but_predicate_test.rbc
156
+ - test/choice_test.rb
157
+ - test/choice_test.rbc
158
+ - test/extension_test.rb
159
+ - test/extension_test.rbc
160
+ - test/file_test.rb
161
+ - test/file_test.rbc
162
+ - test/grammar_test.rb
163
+ - test/grammar_test.rbc
164
+ - test/grammars/calc_test.rb
165
+ - test/grammars/calc_test.rbc
166
+ - test/grammars/email_test.rb
167
+ - test/grammars/ipaddress_test.rb
168
+ - test/grammars/ipaddress_test.rbc
169
+ - test/grammars/ipv4address_test.rb
170
+ - test/grammars/ipv4address_test.rbc
171
+ - test/grammars/ipv6address_test.rb
172
+ - test/grammars/ipv6address_test.rbc
173
+ - test/grammars/uri_test.rb
174
+ - test/input_test.rb
175
+ - test/input_test.rbc
176
+ - test/label_test.rb
177
+ - test/label_test.rbc
178
+ - test/match_test.rb
179
+ - test/match_test.rbc
180
+ - test/memoized_input_test.rb
181
+ - test/memoized_input_test.rbc
182
+ - test/multibyte_test.rb
183
+ - test/multibyte_test.rbc
184
+ - test/not_predicate_test.rb
185
+ - test/not_predicate_test.rbc
186
+ - test/parse_error_test.rb
187
+ - test/parse_error_test.rbc
188
+ - test/repeat_test.rb
189
+ - test/repeat_test.rbc
190
+ - test/sequence_test.rb
191
+ - test/sequence_test.rbc
192
+ - test/string_terminal_test.rb
193
+ - test/string_terminal_test.rbc
194
+ - test/super_test.rb
195
+ - test/super_test.rbc
196
+ - test/terminal_test.rb
197
+ - test/terminal_test.rbc
data/examples/calc.citrus DELETED
@@ -1,82 +0,0 @@
1
- # A grammar for mathematical formulas that apply basic mathematical operations
2
- # to all numbers, respecting operator precedence and grouping of expressions
3
- # while ignoring whitespace. This grammar should provide the same interpretation
4
- # as Ruby for all mathematical expressions.
5
- grammar Calc
6
-
7
- ## Hierarchical syntax
8
-
9
- rule term
10
- additive | factor
11
- end
12
-
13
- rule additive
14
- (factor operator:('+' | '-') space* term) {
15
- factor.value.send(operator.to_s, term.value)
16
- }
17
- end
18
-
19
- rule factor
20
- multiplicative | prefix
21
- end
22
-
23
- rule multiplicative
24
- (prefix operator:('*' | '/' | '%') space* factor) {
25
- prefix.value.send(operator.to_s, factor.value)
26
- }
27
- end
28
-
29
- rule prefix
30
- prefixed | exponent
31
- end
32
-
33
- rule prefixed
34
- (operator:('-' | '+' | '~') space* prefix) {
35
- s = operator.to_s
36
- s += '@' unless s == '~' # Unary + and - require an @.
37
- prefix.value.send(s)
38
- }
39
- end
40
-
41
- rule exponent
42
- exponential | primary
43
- end
44
-
45
- rule exponential
46
- (primary operator:'**' space* prefix) {
47
- primary.value.send(operator.to_s, prefix.value)
48
- }
49
- end
50
-
51
- rule primary
52
- group | number
53
- end
54
-
55
- rule group
56
- (lparen term rparen) {
57
- term.value
58
- }
59
- end
60
-
61
- ## Lexical syntax
62
-
63
- rule number
64
- float | integer
65
- end
66
-
67
- rule float
68
- (digits '.' digits space*) { to_f }
69
- end
70
-
71
- rule integer
72
- (digits space*) { to_i }
73
- end
74
-
75
- rule digits
76
- [0-9]+ ('_' [0-9]+)* # Numbers may contain underscores.
77
- end
78
-
79
- rule lparen '(' space* end
80
- rule rparen ')' space* end
81
- rule space [ \t\n\r] end
82
- end
@@ -1,161 +0,0 @@
1
- # A grammar for email addresses that closely conforms to RFC 5322, with the
2
- # notable exception that this grammar does not allow for folding white space
3
- # or comments within atoms.
4
- grammar EmailAddress
5
- root addr-spec
6
-
7
- # ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
8
- rule ALPHA
9
- [A-Za-z]
10
- end
11
-
12
- # DIGIT = %x30-39
13
- # ; 0-9
14
- rule DIGIT
15
- [0-9]
16
- end
17
-
18
- # DQUOTE = %x22
19
- # ; " (Double Quote)
20
- rule DQUOTE
21
- '"'
22
- end
23
-
24
- # NO-WS-CTL = %d1-8 / ; US-ASCII control characters
25
- # %d11 / ; that do not include the
26
- # %d12 / ; carriage return, line feed,
27
- # %d14-31 / ; and white space characters
28
- # %d127
29
- rule NO-WS-CTL
30
- [\x01-\x08\x0B\x0C\x0E-\x1F\x7F]
31
- end
32
-
33
- # quoted-pair = ("\" text) / obs-qp
34
- rule quoted-pair
35
- ("\\" text) | obs-qp
36
- end
37
-
38
- # atext = ALPHA / DIGIT / ; Printable US-ASCII
39
- # "!" / "#" / ; characters not including
40
- # "$" / "%" / ; specials. Used for atoms.
41
- # "&" / "'" /
42
- # "*" / "+" /
43
- # "-" / "/" /
44
- # "=" / "?" /
45
- # "^" / "_" /
46
- # "`" / "{" /
47
- # "|" / "}" /
48
- # "~"
49
- rule atext
50
- ALPHA | DIGIT | [!\#$\%&'*+-/=?^_`{|}~]
51
- end
52
-
53
- # atom = [CFWS] 1*atext [CFWS]
54
- rule atom
55
- atext 1*
56
- end
57
-
58
- # dot-atom-text = 1*atext *("." 1*atext)
59
- rule dot-atom-text
60
- atext 1* ("." atext 1*)*
61
- end
62
-
63
- # dot-atom = [CFWS] dot-atom-text [CFWS]
64
- rule dot-atom
65
- dot-atom-text
66
- end
67
-
68
- # qtext = %d33 / ; Printable US-ASCII
69
- # %d35-91 / ; characters not including
70
- # %d93-126 / ; "\" or the quote character
71
- # obs-qtext
72
- rule qtext
73
- [\x21\x23-\x5B\x5D-\x7E] | obs-qtext
74
- end
75
-
76
- # qcontent = qtext / quoted-pair
77
- rule qcontent
78
- qtext | quoted-pair
79
- end
80
-
81
- # quoted-string = [CFWS]
82
- # DQUOTE *([FWS] qcontent) [FWS] DQUOTE
83
- # [CFWS]
84
- rule quoted-string
85
- '"' qcontent* '"'
86
- end
87
-
88
- # word = atom / quoted-string
89
- rule word
90
- atom | quoted-string
91
- end
92
-
93
- # addr-spec = local-part "@" domain
94
- rule addr-spec
95
- local-part "@" domain
96
- end
97
-
98
- # local-part = dot-atom / quoted-string / obs-local-part
99
- rule local-part
100
- dot-atom | quoted-string | obs-local-part
101
- end
102
-
103
- # domain = dot-atom / domain-literal / obs-domain
104
- rule domain
105
- dot-atom | domain-literal | obs-domain
106
- end
107
-
108
- # domain-literal = [CFWS] "[" *([FWS] dcontent) [FWS] "]" [CFWS]
109
- rule domain-literal
110
- "[" dtext* "]"
111
- end
112
-
113
- # dtext = %d33-90 / ; Printable US-ASCII
114
- # %d94-126 / ; characters not including
115
- # obs-dtext ; "[", "]", or "\"
116
- rule dtext
117
- [\x21-\x5A\x5E-\x7E] | obs-dtext
118
- end
119
-
120
- # text = %d1-9 / ; Characters excluding CR
121
- # %d11 / ; and LF
122
- # %d12 /
123
- # %d14-127
124
- rule text
125
- [\x01-\x09\x0B\x0C\x0E-\x7F]
126
- end
127
-
128
- # obs-NO-WS-CTL = %d1-8 / ; US-ASCII control
129
- # %d11 / ; characters that do not
130
- # %d12 / ; include the carriage
131
- # %d14-31 / ; return, line feed, and
132
- # %d127 ; white space characters
133
- rule obs-NO-WS-CTL
134
- [\x01-\x08\x0B\x0C\x0E-\x1F\x7F]
135
- end
136
-
137
- # obs-qtext = obs-NO-WS-CTL
138
- rule obs-qtext
139
- obs-NO-WS-CTL
140
- end
141
-
142
- # obs-qp = "\" (%d0 / obs-NO-WS-CTL / LF / CR)
143
- rule obs-qp
144
- "\\" ("\x00" | obs-NO-WS-CTL | "\n" | "\r")
145
- end
146
-
147
- # obs-local-part = word *("." word)
148
- rule obs-local-part
149
- word ("." word)*
150
- end
151
-
152
- # obs-domain = atom *("." atom)
153
- rule obs-domain
154
- atom ("." atom)*
155
- end
156
-
157
- # obs-dtext = obs-NO-WS-CTL / quoted-pair
158
- rule obs-dtext
159
- obs-NO-WS-CTL | quoted-pair
160
- end
161
- end