sdl4r 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +3 -0
- data/Rakefile +45 -0
- data/TODO.txt +117 -0
- data/lib/scratchpad.rb +49 -0
- data/lib/sdl4r/parser.rb +678 -0
- data/lib/sdl4r/reader.rb +171 -0
- data/lib/sdl4r/sdl.rb +242 -0
- data/lib/sdl4r/sdl_binary.rb +78 -0
- data/lib/sdl4r/sdl_parse_error.rb +44 -0
- data/lib/sdl4r/sdl_time_span.rb +301 -0
- data/lib/sdl4r/tag.rb +949 -0
- data/lib/sdl4r/token.rb +129 -0
- data/lib/sdl4r/tokenizer.rb +501 -0
- data/test/sdl4r/parser_test.rb +295 -0
- data/test/sdl4r/test.rb +541 -0
- data/test/sdl4r/test_basic_types.sdl +138 -0
- data/test/sdl4r/test_structures.sdl +180 -0
- metadata +81 -0
@@ -0,0 +1,138 @@
|
|
1
|
+
/**
|
2
|
+
* Test all 13 literal types
|
3
|
+
*
|
4
|
+
* @author Daniel Leuck
|
5
|
+
*/
|
6
|
+
|
7
|
+
-- String Tests -----------------------------------
|
8
|
+
|
9
|
+
string1 "hello"
|
10
|
+
string2 "hi"
|
11
|
+
string3 `aloha`
|
12
|
+
# note: string4 and string5 should appear as one line with no new line chars
|
13
|
+
string4 "hi \
|
14
|
+
there"
|
15
|
+
string5 "hi \
|
16
|
+
there \
|
17
|
+
joe"
|
18
|
+
string6 "line1\nline2"
|
19
|
+
# note: new lines should be preserved for string7 and string8
|
20
|
+
string7 `line1
|
21
|
+
line2` # note: this is continued from the line above
|
22
|
+
string8 `line1
|
23
|
+
line2
|
24
|
+
line3` -- note: the previous two lines are continued from "string8"
|
25
|
+
string9 `Anything should go in this line without escapes \ \\ \n \t " "" ' ''`
|
26
|
+
string10 "escapes \"\\\n\t"
|
27
|
+
# unicode strings - if these don't display properly download a unicode font
|
28
|
+
# such as Bitstream Cyberbit, Code2000
|
29
|
+
# (http://home.att.net/~jameskass/code2000_page.htm), or MS Arial
|
30
|
+
# Unicode (http://support.microsoft.com/default.aspx?scid=kb;en-us;287247) and
|
31
|
+
# ensure your text editor supports UTF8 encoding
|
32
|
+
japanese "日本語"
|
33
|
+
korean "여보세요"
|
34
|
+
russian "здравствулте"
|
35
|
+
xml `
|
36
|
+
<root type="widget">
|
37
|
+
<color red="255" green="0" blue="0"/>
|
38
|
+
<text>Hi there!</text>
|
39
|
+
</root>
|
40
|
+
`
|
41
|
+
line_test `
|
42
|
+
new line above and below
|
43
|
+
`
|
44
|
+
|
45
|
+
-- Character Tests -----------------------------------
|
46
|
+
|
47
|
+
char1 'a'
|
48
|
+
char2 'A'
|
49
|
+
char3 '\\'
|
50
|
+
char4 '\n'
|
51
|
+
char5 '\t'
|
52
|
+
char6 '\''
|
53
|
+
char7 '"'
|
54
|
+
char8 '日'
|
55
|
+
char9 '여'
|
56
|
+
char10 'з'
|
57
|
+
|
58
|
+
-- Number Tests -----------------------------------
|
59
|
+
|
60
|
+
int1 0
|
61
|
+
int2 5
|
62
|
+
int3 -100
|
63
|
+
int4 234253532
|
64
|
+
long1 0L
|
65
|
+
long2 5l // note: this is 5 followed by a lower case L.
|
66
|
+
long3 5L
|
67
|
+
long4 3904857398753453453L
|
68
|
+
float1 1.0F
|
69
|
+
float2 .23F
|
70
|
+
float3 -.34F
|
71
|
+
double1 2.0
|
72
|
+
double2 -0.234D
|
73
|
+
double3 2.34d
|
74
|
+
decimal1 0bd
|
75
|
+
decimal2 11.111111bd
|
76
|
+
decimal3 234535.3453453453454345345341242343BD
|
77
|
+
|
78
|
+
-- Boolean Tests -----------------------------------
|
79
|
+
|
80
|
+
light-on true
|
81
|
+
light-off false
|
82
|
+
|
83
|
+
light1 on
|
84
|
+
light2 off
|
85
|
+
|
86
|
+
-- Null Tests -----------------------------------
|
87
|
+
|
88
|
+
nothing null
|
89
|
+
|
90
|
+
-- Date Tests -----------------------------------
|
91
|
+
|
92
|
+
date1 2005/12/31
|
93
|
+
date2 1882/5/2
|
94
|
+
date3 1882/05/02
|
95
|
+
_way_back 582/09/16
|
96
|
+
|
97
|
+
-- Time Span Tests -----------------------------------
|
98
|
+
|
99
|
+
time1 12:30:00
|
100
|
+
time2 24:00:00
|
101
|
+
time3 1:00:00
|
102
|
+
time4 1:0:0
|
103
|
+
time5 12:30:2
|
104
|
+
time6 12:30:23
|
105
|
+
time7 12:30:23.1
|
106
|
+
time8 12:30:23.12
|
107
|
+
time9 12:30:23.123
|
108
|
+
time10 34d:12:30:23.1
|
109
|
+
time11 1d:12:30:0
|
110
|
+
time12 5d:12:30:23.123
|
111
|
+
time13 -12:30:23.123
|
112
|
+
time14 -5d:12:30:23.123
|
113
|
+
|
114
|
+
-- Date Time Tests -----------------------------------
|
115
|
+
|
116
|
+
date_time1 2005/12/31 12:30
|
117
|
+
date_time2 1882/5/2 12:30
|
118
|
+
date_time3 2005/12/31 1:00
|
119
|
+
date_time4 1882/5/2 1:00
|
120
|
+
date_time5 2005/12/31 12:30:23.12
|
121
|
+
date_time6 1882/5/2 12:30:23.123
|
122
|
+
date_time7 1882/5/2 12:30:23.123-JST
|
123
|
+
date_time8 985/04/11 12:30:23.123-PST
|
124
|
+
|
125
|
+
-- Binary Tests -----------------------------------
|
126
|
+
|
127
|
+
# bytes for UTF8 string "hi"
|
128
|
+
hi [aGk=]
|
129
|
+
// bytes for a small PNG image
|
130
|
+
png [
|
131
|
+
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAKnRFWHRDcmVhdGlvbiBUaW1l
|
132
|
+
AERpIDQgTXJ6IDIwMDMgMDA6MjQ6MDQgKzAxMDDdSQ6OAAAAB3RJTUUH0wMEAAcllPlrJgAA
|
133
|
+
AAlwSFlzAAAK8AAACvABQqw0mAAAAARnQU1BAACxjwv8YQUAAADQSURBVHjaY2CgEDCCyZn/
|
134
|
+
3YHkDhL1ejCkM+5kgXJ2zDQmXueShwwMh9+ALWSEGcCQfhZIvHlDnAk8PAwMHBxgJtyAa7bX
|
135
|
+
UdT8/cvA8Ps3hP7zB4FBYn/+vGbweqyJaoCmpiaKASDFv35BNMBoZMzwGKKOidJYoNgAuBdm
|
136
|
+
naXQgHRKDfgagxD89w8S+iAaFICwGIHFAgjrHUczAByySAaAMEgDLBphhv7/D8EYLgDZhAxA
|
137
|
+
mkAKYYbAMMwwDAOQXYDuDXRXgDC6AR7SW8jITNQAACjZgdj4VjlqAAAAAElFTkSuQmCC
|
138
|
+
]
|
@@ -0,0 +1,180 @@
|
|
1
|
+
/**
|
2
|
+
* Test structures including value lists, attribute lists,
|
3
|
+
* children, namespaces, etc.
|
4
|
+
*
|
5
|
+
* @author Daniel Leuck
|
6
|
+
*/
|
7
|
+
|
8
|
+
# test a tag with no values, attributes, or children
|
9
|
+
empty_tag
|
10
|
+
|
11
|
+
# test values (and comments)
|
12
|
+
values1 "hi"
|
13
|
+
values2 "hi" "ho"
|
14
|
+
values3 1 "ho"
|
15
|
+
values4 "hi" 5
|
16
|
+
values5 1 2
|
17
|
+
values6 1 2 3
|
18
|
+
values7 null "foo" false 1980/12/5
|
19
|
+
values8 null "foo" false 1980/12/5 12:30 `there` 15:23:12.234
|
20
|
+
values9 null "foo" false 1980/12/5 12:30 `there` 1989/8/12 15:23:12.234-JST
|
21
|
+
values10 null "foo" false 1980/12/5 12:30 `there` 15:23:12.234 \
|
22
|
+
"more stuff"
|
23
|
+
values11 null "foo" false 1980/12/5 12:30 `there` 123d:15:23:12.234 \
|
24
|
+
"more \
|
25
|
+
stuff \
|
26
|
+
here"
|
27
|
+
values12 1 /* 2 */ 3 # 4
|
28
|
+
values13 1/* 2 */3 # 4
|
29
|
+
values14 1/* 2 */3# 4
|
30
|
+
values15 1 2 /* 3 */\
|
31
|
+
4 5 \
|
32
|
+
6 # more comments
|
33
|
+
values16 1 2 /*
|
34
|
+
4 */ 5
|
35
|
+
values17 1 2 /*
|
36
|
+
|
37
|
+
4 */ 5
|
38
|
+
values18 1 2 /*
|
39
|
+
4 6
|
40
|
+
*/ 7
|
41
|
+
values19 1 /* 2 */ 3 /* 4 */ 5/*6*/7
|
42
|
+
values20 1 /* 2 */ 3 /* 4 */ 5/*6 7*/
|
43
|
+
values21 1 /* 2 */ 3 /* 4 */ 5/*6 7
|
44
|
+
*/
|
45
|
+
values22 "hi""ho" "ho"5"hi"
|
46
|
+
|
47
|
+
# test attributes (and comments)
|
48
|
+
atts1 name="joe"
|
49
|
+
atts2 size=5
|
50
|
+
atts3 name="joe" size=5
|
51
|
+
atts4 name="joe" size=5 smoker=false
|
52
|
+
atts5 name="joe" /* size=5 */ smoker=false
|
53
|
+
atts6 name="joe" /* size=5 */ \
|
54
|
+
smoker=false
|
55
|
+
atts7 name="joe" /* size=5 */ # smoker=false
|
56
|
+
atts8 name="joe" size=5 smoker=false text="hi\
|
57
|
+
" birthday=1972/05/23
|
58
|
+
atts9 key=[bXlrZXk=]
|
59
|
+
|
60
|
+
# test values and attributes
|
61
|
+
valatts1 "joe" size=5
|
62
|
+
valatts2 "joe" size=5 #comment...
|
63
|
+
valatts3 "joe" size=5#comment...
|
64
|
+
valatts4 "joe" size=5 weight=160 hat="big"
|
65
|
+
valatts5 "joe" `is a
|
66
|
+
nice guy` size=5 smoker=false
|
67
|
+
valatts6 "joe" `is a
|
68
|
+
nice guy` size=5 house=`big and
|
69
|
+
blue`
|
70
|
+
valatts7 "joe" `is a
|
71
|
+
nice guy` size=5 /* house=`big and
|
72
|
+
blue` */smoker=false
|
73
|
+
valatts8 "joe" `is a
|
74
|
+
nice guy` size=5 /* random
|
75
|
+
text in comments
|
76
|
+
*/ smoker=false
|
77
|
+
valatts9 "joe" `is a
|
78
|
+
nice guy` size=5/* random
|
79
|
+
text in comments
|
80
|
+
*/smoker=false
|
81
|
+
|
82
|
+
# test tags with children
|
83
|
+
parent {
|
84
|
+
son
|
85
|
+
daughter
|
86
|
+
}
|
87
|
+
|
88
|
+
grandparent {
|
89
|
+
child {
|
90
|
+
son
|
91
|
+
daughter
|
92
|
+
}
|
93
|
+
child {
|
94
|
+
son
|
95
|
+
daughter
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
grandparent2 name="Harold" age=93 {
|
100
|
+
child name="Harold II" age=60 smoker=false {
|
101
|
+
son name="Joe"
|
102
|
+
daughter name="Akiko" birthday=1976/04/18
|
103
|
+
}
|
104
|
+
child name="Jose" {
|
105
|
+
child name="child1"
|
106
|
+
child name="child2"
|
107
|
+
child name="child3"
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
-- Test tags with no names (content tags) --
|
112
|
+
|
113
|
+
"hello"
|
114
|
+
|
115
|
+
files {
|
116
|
+
"c:/file1.txt"
|
117
|
+
"c:/file2.txt"
|
118
|
+
"c:/folder" {
|
119
|
+
"c:/file3.txt"
|
120
|
+
"c:/file4.txt"
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
matrix {
|
125
|
+
1 2 3
|
126
|
+
4 5 6
|
127
|
+
}
|
128
|
+
|
129
|
+
-----------------------------------------
|
130
|
+
-- tests with namespaces, comments, etc.
|
131
|
+
-----------------------------------------
|
132
|
+
|
133
|
+
person:random_guy // nice guy
|
134
|
+
person:grandparent3 name="Harold" age=93 {
|
135
|
+
person:child name="Sabrina" age=93 smoker=false { #comment here...
|
136
|
+
person:son name="Joe" -- a bit odd...
|
137
|
+
person:daughter public:name="Akiko" private:smokes=true \
|
138
|
+
public:birthday=1976/04/18
|
139
|
+
dog name="Spot"
|
140
|
+
/* cat name="Scratches" */
|
141
|
+
}
|
142
|
+
/*
|
143
|
+
person:drunk_uncle funny_drunk=false {
|
144
|
+
person:angry_daughter name="Jill"
|
145
|
+
}
|
146
|
+
*/
|
147
|
+
person:child name="Jose" {
|
148
|
+
person:son
|
149
|
+
person:daughter
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
-----------------------------------------
|
154
|
+
-- tests with semicolon line endings
|
155
|
+
-----------------------------------------
|
156
|
+
tags {
|
157
|
+
tag1 1 2 3; tag2 foo="bar"; tag3
|
158
|
+
}
|
159
|
+
|
160
|
+
tagsA {
|
161
|
+
tag1
|
162
|
+
"fee" a=5; "fi"; "fo"
|
163
|
+
tag5
|
164
|
+
}
|
165
|
+
|
166
|
+
tagsB {
|
167
|
+
;1;;2;3;
|
168
|
+
}
|
169
|
+
|
170
|
+
tag4 {
|
171
|
+
"fee"; "fi"; "fo"
|
172
|
+
"fum"; "foo"
|
173
|
+
}
|
174
|
+
|
175
|
+
tag5 {
|
176
|
+
"fee"; "fi"; "fo"
|
177
|
+
"fum"; "foo"
|
178
|
+
}
|
179
|
+
|
180
|
+
tag6; tag7 a=1; tag8
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sdl4r
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 9
|
8
|
+
- 1
|
9
|
+
version: 0.9.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Philippe Vosges
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-07-29 00:00:00 +09:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: " The Simple Declarative Language provides an easy way to describe lists, maps,\n and trees of typed data in a compact, easy to read representation.\n For property files, configuration files, logs, and simple serialization\n requirements, SDL provides a compelling alternative to XML and Properties\n files.\n"
|
22
|
+
email: sdl-users@ikayzo.org
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- lib/scratchpad.rb
|
31
|
+
- lib/sdl4r/sdl_time_span.rb
|
32
|
+
- lib/sdl4r/reader.rb
|
33
|
+
- lib/sdl4r/sdl.rb
|
34
|
+
- lib/sdl4r/sdl_parse_error.rb
|
35
|
+
- lib/sdl4r/tag.rb
|
36
|
+
- lib/sdl4r/parser.rb
|
37
|
+
- lib/sdl4r/sdl_binary.rb
|
38
|
+
- lib/sdl4r/tokenizer.rb
|
39
|
+
- lib/sdl4r/token.rb
|
40
|
+
- README
|
41
|
+
- TODO.txt
|
42
|
+
- Rakefile
|
43
|
+
- test/sdl4r/test_structures.sdl
|
44
|
+
- test/sdl4r/parser_test.rb
|
45
|
+
- test/sdl4r/test.rb
|
46
|
+
- test/sdl4r/test_basic_types.sdl
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://www.ikayzo.org/confluence/display/SDL/Home
|
49
|
+
licenses: []
|
50
|
+
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
requirements:
|
73
|
+
- none
|
74
|
+
rubyforge_project: sdl4r
|
75
|
+
rubygems_version: 1.3.7
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: Simple Declarative Language for Ruby library
|
79
|
+
test_files:
|
80
|
+
- test/sdl4r/parser_test.rb
|
81
|
+
- test/sdl4r/test.rb
|