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.
- data/CHANGES +9 -0
- data/Rakefile +1 -1
- data/citrus.gemspec +0 -1
- data/lib/citrus.rb +13 -0
- data/lib/citrus/file.rb +12 -11
- data/lib/citrus/grammars.rb +11 -0
- data/lib/citrus/version.rb +1 -1
- data/test/_files/rule4.citrus +5 -0
- data/test/grammar_test.rb +2 -1
- data/{examples → test/grammars}/calc_test.rb +3 -4
- data/{examples → test/grammars}/calc_test.rbc +0 -0
- data/{examples → test/grammars}/email_test.rb +3 -5
- data/{examples → test/grammars}/ipaddress_test.rb +2 -7
- data/{examples → test/grammars}/ipaddress_test.rbc +0 -0
- data/{examples → test/grammars}/ipv4address_test.rb +2 -7
- data/{examples → test/grammars}/ipv4address_test.rbc +0 -0
- data/{examples → test/grammars}/ipv6address_test.rb +2 -7
- data/{examples → test/grammars}/ipv6address_test.rbc +0 -0
- data/test/grammars/uri_test.rb +53 -0
- data/test/memoized_input_test.rbc +488 -5
- metadata +160 -161
- data/examples/calc.citrus +0 -82
- data/examples/email.citrus +0 -161
- data/examples/ipaddress.citrus +0 -16
- data/examples/ipv4address.citrus +0 -26
- data/examples/ipv6address.citrus +0 -43
data/examples/ipaddress.citrus
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# The grammars in this file conform to the ABNF given in Appendix A of RFC 3986
|
|
2
|
-
# Uniform Resource Identifier (URI): Generic Syntax.
|
|
3
|
-
#
|
|
4
|
-
# See http://tools.ietf.org/html/rfc3986#appendix-A for more information.
|
|
5
|
-
|
|
6
|
-
require 'ipv4address'
|
|
7
|
-
require 'ipv6address'
|
|
8
|
-
|
|
9
|
-
grammar IPAddress
|
|
10
|
-
include IPv4Address
|
|
11
|
-
include IPv6Address
|
|
12
|
-
|
|
13
|
-
rule IPaddress
|
|
14
|
-
IPv4address | IPv6address
|
|
15
|
-
end
|
|
16
|
-
end
|
data/examples/ipv4address.citrus
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
grammar IPv4Address
|
|
2
|
-
# A host identified by an IPv4 literal address is represented in
|
|
3
|
-
# dotted-decimal notation (a sequence of four decimal numbers in the
|
|
4
|
-
# range 0 to 255, separated by "."), as described in [RFC1123] by
|
|
5
|
-
# reference to [RFC0952]. Note that other forms of dotted notation may
|
|
6
|
-
# be interpreted on some platforms, as described in Section 7.4, but
|
|
7
|
-
# only the dotted-decimal form of four octets is allowed by this
|
|
8
|
-
# grammar.
|
|
9
|
-
rule IPv4address
|
|
10
|
-
(dec-octet '.' dec-octet '.' dec-octet '.' dec-octet) {
|
|
11
|
-
def version; 4 end
|
|
12
|
-
}
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
rule dec-octet
|
|
16
|
-
'25' [0-5] # 250-255
|
|
17
|
-
| '2' [0-4] DIGIT # 200-249
|
|
18
|
-
| '1' DIGIT DIGIT # 100-199
|
|
19
|
-
| [1-9] DIGIT # 10-99
|
|
20
|
-
| DIGIT # 0-9
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
rule DIGIT
|
|
24
|
-
[0-9]
|
|
25
|
-
end
|
|
26
|
-
end
|
data/examples/ipv6address.citrus
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
require 'ipv4address'
|
|
2
|
-
|
|
3
|
-
grammar IPv6Address
|
|
4
|
-
include IPv4Address
|
|
5
|
-
|
|
6
|
-
# A 128-bit IPv6 address is divided into eight 16-bit pieces. Each
|
|
7
|
-
# piece is represented numerically in case-insensitive hexadecimal,
|
|
8
|
-
# using one to four hexadecimal digits (leading zeroes are permitted).
|
|
9
|
-
# The eight encoded pieces are given most-significant first, separated
|
|
10
|
-
# by colon characters. Optionally, the least-significant two pieces
|
|
11
|
-
# may instead be represented in IPv4 address textual format. A
|
|
12
|
-
# sequence of one or more consecutive zero-valued 16-bit pieces within
|
|
13
|
-
# the address may be elided, omitting all their digits and leaving
|
|
14
|
-
# exactly two consecutive colons in their place to mark the elision.
|
|
15
|
-
rule IPv6address
|
|
16
|
-
( (h16 ":")6*6 ls32
|
|
17
|
-
| "::" (h16 ":")5*5 ls32
|
|
18
|
-
| h16 ? "::" (h16 ":")4*4 ls32
|
|
19
|
-
| (h16 (":" h16)*1)? "::" (h16 ":")3*3 ls32
|
|
20
|
-
| (h16 (":" h16)*2)? "::" (h16 ":")2*2 ls32
|
|
21
|
-
| (h16 (":" h16)*3)? "::" h16 ":" ls32
|
|
22
|
-
| (h16 (":" h16)*4)? "::" ls32
|
|
23
|
-
| (h16 (":" h16)*5)? "::" h16
|
|
24
|
-
| (h16 (":" h16)*6)? "::"
|
|
25
|
-
) {
|
|
26
|
-
def version; 6 end
|
|
27
|
-
}
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# 16-bit address represented in hexadecimal.
|
|
31
|
-
rule h16
|
|
32
|
-
HEXDIG 1*4
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Least-significant 32 bits of address.
|
|
36
|
-
rule ls32
|
|
37
|
-
(h16 ":" h16) | IPv4address
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
rule HEXDIG
|
|
41
|
-
DIGIT | [a-fA-F] # Hexadecimal should be case-insensitive.
|
|
42
|
-
end
|
|
43
|
-
end
|