sdl4r 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +13 -0
- data/README +2 -2
- data/Rakefile +3 -3
- data/TODO.txt +28 -11
- data/doc/classes/SDL4R.html +681 -0
- data/doc/classes/SDL4R/Parser.html +314 -0
- data/doc/classes/SDL4R/SdlBinary.html +303 -0
- data/doc/classes/SDL4R/SdlParseError.html +185 -0
- data/doc/classes/SDL4R/SdlTimeSpan.html +948 -0
- data/doc/classes/SDL4R/Tag.html +2028 -0
- data/doc/created.rid +1 -1
- data/doc/files/CHANGELOG.html +130 -0
- data/doc/files/LICENSE.html +756 -0
- data/doc/files/README.html +606 -0
- data/doc/files/lib/sdl4r/parser/reader_rb.html +108 -0
- data/doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html +101 -0
- data/doc/files/lib/sdl4r/parser/token_rb.html +101 -0
- data/doc/files/lib/sdl4r/parser/tokenizer_rb.html +101 -0
- data/doc/files/lib/sdl4r/parser_rb.html +108 -0
- data/doc/files/lib/sdl4r/sdl4r_rb.html +111 -0
- data/doc/files/lib/sdl4r/sdl_binary_rb.html +101 -0
- data/doc/files/lib/sdl4r/sdl_parse_error_rb.html +101 -0
- data/doc/files/lib/sdl4r/sdl_time_span_rb.html +101 -0
- data/doc/files/lib/sdl4r/tag_rb.html +110 -0
- data/doc/files/lib/sdl4r_rb.html +101 -0
- data/doc/fr_file_index.html +2 -1
- data/doc/fr_method_index.html +88 -82
- data/lib/sdl4r.rb +18 -0
- data/lib/sdl4r/parser.rb +2 -9
- data/lib/sdl4r/{sdl.rb → sdl4r.rb} +46 -7
- data/lib/sdl4r/sdl_time_span.rb +6 -1
- data/lib/sdl4r/tag.rb +6 -7
- data/test/sdl4r/parser_test.rb +4 -16
- data/test/sdl4r/sdl4r_test.rb +3 -13
- data/test/sdl4r/sdl_test.rb +39 -0
- metadata +29 -6
@@ -0,0 +1,606 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: README</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>README</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Thu Aug 05 23:35:08 +0900 2010</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<h1>SDL (Simple Declarative Language)</h1>
|
73
|
+
<h2>Getting Started with <a href="../classes/SDL4R.html">SDL4R</a></h2>
|
74
|
+
<p>
|
75
|
+
To get the Ruby Gem:
|
76
|
+
</p>
|
77
|
+
<pre>
|
78
|
+
gem install sdl4r
|
79
|
+
</pre>
|
80
|
+
<p>
|
81
|
+
Then, you can start reading SDL documents:
|
82
|
+
</p>
|
83
|
+
<pre>
|
84
|
+
require 'pathname'
|
85
|
+
require 'sdl4r'
|
86
|
+
|
87
|
+
root = SDL4R::read(Pathname.new("my_directory/my_config.sdl"))
|
88
|
+
puts root.attribute("port")
|
89
|
+
</pre>
|
90
|
+
<p>
|
91
|
+
Or you can create SDL documents with the API:
|
92
|
+
</p>
|
93
|
+
<pre>
|
94
|
+
require 'fileutils'
|
95
|
+
require 'sdl4r'
|
96
|
+
|
97
|
+
root = SDL4R::Tag.new("root") do
|
98
|
+
new_child("server") do
|
99
|
+
set_attribute("port", 1234)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
File.open("my_directory/my_config.sdl", "w") { |io|
|
103
|
+
io.write(root.children_to_string)
|
104
|
+
}
|
105
|
+
</pre>
|
106
|
+
<p>
|
107
|
+
which will write the following in your file:
|
108
|
+
</p>
|
109
|
+
<pre>
|
110
|
+
server port=1234
|
111
|
+
</pre>
|
112
|
+
<h2>SDL Documents</h2>
|
113
|
+
<p>
|
114
|
+
SDL documents are made up of Tags. A Tag contains
|
115
|
+
</p>
|
116
|
+
<ul>
|
117
|
+
<li>a name (if not present, the name "content" is used)
|
118
|
+
|
119
|
+
</li>
|
120
|
+
<li>a namespace (optional)
|
121
|
+
|
122
|
+
</li>
|
123
|
+
<li>0 or more values (optional)
|
124
|
+
|
125
|
+
</li>
|
126
|
+
<li>0 or more attributes (optional)
|
127
|
+
|
128
|
+
</li>
|
129
|
+
<li>0 or more children (optional)
|
130
|
+
|
131
|
+
</li>
|
132
|
+
</ul>
|
133
|
+
<p>
|
134
|
+
For the SDL code:
|
135
|
+
</p>
|
136
|
+
<pre>
|
137
|
+
size 4
|
138
|
+
smoker false
|
139
|
+
</pre>
|
140
|
+
<p>
|
141
|
+
Assuming this code is in a file called <tt>values.sdl</tt>, the values can
|
142
|
+
be read using the following code (ignoring exceptions):
|
143
|
+
</p>
|
144
|
+
<pre>
|
145
|
+
root = Tag.new("root").read(Pathname.new("values.sdl"))
|
146
|
+
size = root.child("size").value
|
147
|
+
smoker = root.child("smoker").value
|
148
|
+
</pre>
|
149
|
+
<p>
|
150
|
+
A tag is basically a data structure with a list of values, a map of
|
151
|
+
attributes, and (if it has a body) child tags. In the example above, the
|
152
|
+
<tt>values.sdl</tt> file is read into a tag called "root". It has
|
153
|
+
two children (tags) called "size" and "smoker". Both
|
154
|
+
these children have one value, no attributes, and no bodies.
|
155
|
+
</p>
|
156
|
+
<p>
|
157
|
+
SDL is often used for simple key-value mappings. To simplify things Tag has
|
158
|
+
the methods getValue and setValue which operate on the first element in the
|
159
|
+
values list. Also notice SDL understands types which are determined using
|
160
|
+
type inference.
|
161
|
+
</p>
|
162
|
+
<p>
|
163
|
+
The example above used the simple format common in property files:
|
164
|
+
</p>
|
165
|
+
<pre>
|
166
|
+
name value
|
167
|
+
</pre>
|
168
|
+
<p>
|
169
|
+
The full SDL tag format is:
|
170
|
+
</p>
|
171
|
+
<pre>
|
172
|
+
namespace:name value_list attribute_list {
|
173
|
+
children_tags
|
174
|
+
}
|
175
|
+
</pre>
|
176
|
+
<p>
|
177
|
+
where value_list is zero or more space separated SDL literals and
|
178
|
+
attribute_list is zero or more space separated
|
179
|
+
<tt>(namespace:)key=value</tt> pairs. The name, namespace, and keys are SDL
|
180
|
+
identifiers. Values are SDL literals. Namespace is optional for both tag
|
181
|
+
names and attributes. Tag bodies are also optional. SDL identifiers begin
|
182
|
+
with a unicode letter or an underscore (_) followed by zero or more unicode
|
183
|
+
letters, numbers, underscores (_), dashes (-) and periods (.).
|
184
|
+
</p>
|
185
|
+
<p>
|
186
|
+
Tags without bodies are terminated by a new line character (\n) and may be
|
187
|
+
continue onto the next line by placing a backslash (\) at the end of the
|
188
|
+
line. Tags may be nested to an arbitrary depth. SDL ignores all other white
|
189
|
+
space characters between tokens. Although nested blocks are indented by
|
190
|
+
convention, tabs have no significance in the language.
|
191
|
+
</p>
|
192
|
+
<h2>Anonymous Tags</h2>
|
193
|
+
<p>
|
194
|
+
SDL also supports anonymous tags which are assigned the name
|
195
|
+
"content". An anonymous tag starts with a literal and is followed
|
196
|
+
by zero or more additional literals and zero or more attributes. The
|
197
|
+
examples section below demonstrates the use of anonymous tags.
|
198
|
+
</p>
|
199
|
+
<pre>
|
200
|
+
greetings {
|
201
|
+
"hello" language="English"
|
202
|
+
}
|
203
|
+
|
204
|
+
# If we have a handle on the "greetings" tag we can access the
|
205
|
+
# anonymous child tag by calling
|
206
|
+
# Tag child1 = greetingTag.getChild("content");
|
207
|
+
</pre>
|
208
|
+
<h2>String literals</h2>
|
209
|
+
<p>
|
210
|
+
There are two ways to write String literals.
|
211
|
+
</p>
|
212
|
+
<h3>Starting and ending with double quotes (")</h3>
|
213
|
+
<p>
|
214
|
+
Double quotes, backslash characters (\), and new lines (\n) within this
|
215
|
+
type of String literal must be escaped like so:
|
216
|
+
</p>
|
217
|
+
<pre>
|
218
|
+
file "C:\\folder\\file.txt"
|
219
|
+
say "I said \"something\""
|
220
|
+
</pre>
|
221
|
+
<p>
|
222
|
+
This type of String literal can be continued on the next line by placing a
|
223
|
+
backslash (\) at the end of the line like so:
|
224
|
+
</p>
|
225
|
+
<pre>
|
226
|
+
line "this is a \
|
227
|
+
long string of text"
|
228
|
+
</pre>
|
229
|
+
<p>
|
230
|
+
White space before the first character in the second line will be ignored.
|
231
|
+
</p>
|
232
|
+
<h3>Starting and ending with a backquote (`)</h3>
|
233
|
+
<p>
|
234
|
+
This type of string literal can only be ended with a second backquote (`).
|
235
|
+
It is not necessary (or possible) to escape any type of character within a
|
236
|
+
backquote string literal. This type of literal can also span lines. All
|
237
|
+
white spaces are preserved including new lines.
|
238
|
+
</p>
|
239
|
+
<p>
|
240
|
+
Examples:
|
241
|
+
</p>
|
242
|
+
<pre>
|
243
|
+
file `C:\folder\file.txt`
|
244
|
+
say `I said "something"`
|
245
|
+
regex `\w+\.suite\(\)`
|
246
|
+
long_line `This is
|
247
|
+
a long line
|
248
|
+
fee fi fo fum`
|
249
|
+
</pre>
|
250
|
+
<p>
|
251
|
+
Note: SDL interprets new lines in `` String literals as a single new line
|
252
|
+
character (\n) regarless of the platform.
|
253
|
+
</p>
|
254
|
+
<h2>Binary literals</h2>
|
255
|
+
<p>
|
256
|
+
Binary literals use base64 characters enclosed in square brackets ([]). The
|
257
|
+
binary literal type can also span lines. White space is ignored.
|
258
|
+
</p>
|
259
|
+
<p>
|
260
|
+
Examples:
|
261
|
+
</p>
|
262
|
+
<pre>
|
263
|
+
key [sdf789GSfsb2+3324sf2] name="my key"
|
264
|
+
image [
|
265
|
+
R3df789GSfsb2edfSFSDF
|
266
|
+
uikuikk2349GSfsb2edfS
|
267
|
+
vFSDFR3df789GSfsb2edf
|
268
|
+
]
|
269
|
+
upload from="ikayzo.com" data=[
|
270
|
+
R3df789GSfsb2edfSFSDF
|
271
|
+
uikuikk2349GSfsb2edfS
|
272
|
+
vFSDFR3df789GSfsb2edf
|
273
|
+
]
|
274
|
+
</pre>
|
275
|
+
<h2>Date and Time Literals</h2>
|
276
|
+
<p>
|
277
|
+
SDL supports date, time span, and date/time literals. Date and Date/Time
|
278
|
+
literals use a 24 hour clock (0-23). If a timezone is not specified, the
|
279
|
+
default locale‘s timezone will be used.
|
280
|
+
</p>
|
281
|
+
<p>
|
282
|
+
Examples:
|
283
|
+
</p>
|
284
|
+
<ul>
|
285
|
+
<li>create a tag called "date" with a date value of Dec 5, 2005
|
286
|
+
|
287
|
+
<pre>
|
288
|
+
date 2005/12/05
|
289
|
+
</pre>
|
290
|
+
</li>
|
291
|
+
<li>various time span literals
|
292
|
+
|
293
|
+
<pre>
|
294
|
+
hours 03:00:00
|
295
|
+
minutes 00:12:00
|
296
|
+
seconds 00:00:42
|
297
|
+
short_time 00:12:32.423 # 12 minutes, 32 seconds, 423 milliseconds
|
298
|
+
long_time 30d:15:23:04.023 # 30 days, 15 hours, 23 mins, 4 secs, 23 millis
|
299
|
+
before -00:02:30 # 2 hours and 30 minutes ago
|
300
|
+
</pre>
|
301
|
+
</li>
|
302
|
+
<li>a date time literal
|
303
|
+
|
304
|
+
<pre>
|
305
|
+
in_japan 2005/12/05 14:12:23.345-JST
|
306
|
+
</pre>
|
307
|
+
</li>
|
308
|
+
</ul>
|
309
|
+
<h2>Literal Types</h2>
|
310
|
+
<p>
|
311
|
+
SDL 1.0 has thirteen literal types (parenthesis indicate optional
|
312
|
+
components)
|
313
|
+
</p>
|
314
|
+
<ol>
|
315
|
+
<li>string (unicode) - examples: <tt>"hello"</tt> or <tt>`aloha`</tt>
|
316
|
+
|
317
|
+
</li>
|
318
|
+
<li>character (unicode) - example: <tt>’/’</tt> Note: \uXXXX style
|
319
|
+
unicode escapes are not supported (or needed because sdl files are UTF8)
|
320
|
+
|
321
|
+
</li>
|
322
|
+
<li>integer (32 bits signed) - example: <tt>123</tt>
|
323
|
+
|
324
|
+
</li>
|
325
|
+
<li>long integer (64 bits signed) - examples: <tt>123L</tt> or <tt>123l</tt>
|
326
|
+
|
327
|
+
</li>
|
328
|
+
<li>float (32 bits signed) - examples <tt>123.43F</tt> <tt>123.43f</tt>
|
329
|
+
|
330
|
+
</li>
|
331
|
+
<li>double float (64 bits signed) - example: <tt>123.43</tt> or
|
332
|
+
<tt>123.43d</tt> or <tt>123.43D</tt>
|
333
|
+
|
334
|
+
</li>
|
335
|
+
<li>decimal (128+ bits signed) - example: <tt>123.44BD</tt> or
|
336
|
+
<tt>123.44bd</tt>
|
337
|
+
|
338
|
+
</li>
|
339
|
+
<li>boolean - examples: <tt>true</tt> or <tt>false</tt> or <tt>on</tt> or
|
340
|
+
<tt>off</tt>
|
341
|
+
|
342
|
+
</li>
|
343
|
+
<li>date yyyy/mm/dd - example <tt>2005/12/05</tt>
|
344
|
+
|
345
|
+
</li>
|
346
|
+
<li>date time yyyy/mm/dd hh:mm(:ss)(.xxx)(-ZONE) example - <tt>2005/12/05
|
347
|
+
05:21:23.532-JST</tt> notes: uses a 24 hour clock (0-23), only hours and
|
348
|
+
minutes are mandatory
|
349
|
+
|
350
|
+
</li>
|
351
|
+
<li>time span using the format (d:)hh:mm:ss(.xxx) notes: if the day component
|
352
|
+
is included it must be suffixed with a lower case ‘d’ examples
|
353
|
+
|
354
|
+
<pre>
|
355
|
+
12:14:42 # (12 hours, 14 minutes, 42 seconds)
|
356
|
+
00:09:12 # (9 minutes, 12 seconds)
|
357
|
+
00:00:01.023 # (1 second, 23 milliseconds)
|
358
|
+
23d:05:21:23.532 # (23 days, 5 hours, 21 minutes, 23 seconds, 532 milliseconds)
|
359
|
+
</pre>
|
360
|
+
</li>
|
361
|
+
<li>binary [base64] example - <tt>[sdf789GSfsb2+3324sf2]</tt>
|
362
|
+
|
363
|
+
</li>
|
364
|
+
<li><tt>null</tt>
|
365
|
+
|
366
|
+
</li>
|
367
|
+
</ol>
|
368
|
+
<p>
|
369
|
+
Timezones must be specified using a valid time zone ID (ex.
|
370
|
+
America/Los_Angeles), three letter abbreviation (ex. HST), or
|
371
|
+
GMT(+/-)hh(:mm) formatted custom timezone (ex. GMT+02 or GMT+02:30)
|
372
|
+
</p>
|
373
|
+
<p>
|
374
|
+
These types are designed to be portable across Java, .NET, and other
|
375
|
+
popular platforms.
|
376
|
+
</p>
|
377
|
+
<h2>SDL Comments</h2>
|
378
|
+
<p>
|
379
|
+
SDL supports four comment types.
|
380
|
+
</p>
|
381
|
+
<pre>
|
382
|
+
1. // single line comments identicle to those used in Java, C, etc. // style
|
383
|
+
comments can occur anywhere in a line. All text after // up to the new line
|
384
|
+
will be ignored.
|
385
|
+
2. # property style comments. They work the same way as //
|
386
|
+
3. -- separator comments useful for visually dividing content. They work the same way as //
|
387
|
+
4. Slash star (/*) style multiline comments. These begin with a slash
|
388
|
+
star and end with a star slash. Everything in between is ignored.
|
389
|
+
</pre>
|
390
|
+
<h2>Example</h2>
|
391
|
+
<p>
|
392
|
+
An example SDL file:
|
393
|
+
</p>
|
394
|
+
<pre>
|
395
|
+
# a tag having only a name
|
396
|
+
my_tag
|
397
|
+
|
398
|
+
# three tags acting as name value pairs
|
399
|
+
first_name "Akiko"
|
400
|
+
last_name "Johnson"
|
401
|
+
height 68
|
402
|
+
|
403
|
+
# a tag with a value list
|
404
|
+
person "Akiko" "Johnson" 68
|
405
|
+
|
406
|
+
# a tag with attributes
|
407
|
+
person first_name="Akiko" last_name="Johnson" height=68
|
408
|
+
|
409
|
+
# a tag with values and attributes
|
410
|
+
person "Akiko" "Johnson" height=60
|
411
|
+
|
412
|
+
# a tag with attributes using namespaces
|
413
|
+
person name:first-name="Akiko" name:last-name="Johnson"
|
414
|
+
|
415
|
+
# a tag with values, attributes, namespaces, and children
|
416
|
+
my_namespace:person "Akiko" "Johnson" dimensions:height=68 {
|
417
|
+
son "Nouhiro" "Johnson"
|
418
|
+
daughter "Sabrina" "Johnson" location="Italy" {
|
419
|
+
hobbies "swimming" "surfing"
|
420
|
+
languages "English" "Italian"
|
421
|
+
smoker false
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
------------------------------------------------------------------
|
426
|
+
// (notice the separator style comment above...)
|
427
|
+
|
428
|
+
# a log entry
|
429
|
+
# note - this tag has two values (date_time and string) and an
|
430
|
+
# attribute (error)
|
431
|
+
entry 2005/11/23 10:14:23.253-GMT "Something bad happened" error=true
|
432
|
+
|
433
|
+
# a long line
|
434
|
+
mylist "something" "another" true "shoe" 2002/12/13 "rock" \
|
435
|
+
"morestuff" "sink" "penny" 12:15:23.425
|
436
|
+
|
437
|
+
# a long string
|
438
|
+
text "this is a long rambling line of text with a continuation \
|
439
|
+
and it keeps going and going..."
|
440
|
+
|
441
|
+
# anonymous tag examples
|
442
|
+
|
443
|
+
files {
|
444
|
+
"/folder1/file.txt"
|
445
|
+
"/file2.txt"
|
446
|
+
}
|
447
|
+
|
448
|
+
# To retrieve the files as a list of strings
|
449
|
+
#
|
450
|
+
# List files = tag.getChild("files").getChildrenValues("content");
|
451
|
+
#
|
452
|
+
# We us the name "content" because the files tag has two children, each of
|
453
|
+
# which are anonymous tags (values with no name.) These tags are assigned
|
454
|
+
# the name "content"
|
455
|
+
|
456
|
+
matrix {
|
457
|
+
1 2 3
|
458
|
+
4 5 6
|
459
|
+
}
|
460
|
+
|
461
|
+
# To retrieve the values from the matrix (as a list of lists)
|
462
|
+
#
|
463
|
+
# List rows = tag.getChild("matrix").getChildrenValues("content");
|
464
|
+
</pre>
|
465
|
+
<p>
|
466
|
+
Example of getting the "location" attribute from the
|
467
|
+
"daughter" tag above (ignoring exceptions)
|
468
|
+
</p>
|
469
|
+
<pre>
|
470
|
+
root = SDL4R.read(Pathname.new("myfile.sdl"))
|
471
|
+
daughter = root.child("daughter", true) // recursive search
|
472
|
+
location = daughter.attribute("location")
|
473
|
+
</pre>
|
474
|
+
<p>
|
475
|
+
SDL is normally stored in a file with the .sdl extension. These files
|
476
|
+
should always be encoded using UTF8. SDL fully supports unicode in
|
477
|
+
identifiers and literals.
|
478
|
+
</p>
|
479
|
+
<h2>Ruby and SDL types</h2>
|
480
|
+
<p>
|
481
|
+
The following list gives what types are used in Ruby in order to represent
|
482
|
+
SDL types.
|
483
|
+
</p>
|
484
|
+
<table>
|
485
|
+
<tr><td valign="top"><b>SDL</b>:</td><td><b>Ruby</b>
|
486
|
+
|
487
|
+
</td></tr>
|
488
|
+
<tr><td valign="top">unicode string:</td><td>String
|
489
|
+
|
490
|
+
</td></tr>
|
491
|
+
<tr><td valign="top">unicode character:</td><td>single-character String
|
492
|
+
|
493
|
+
</td></tr>
|
494
|
+
<tr><td valign="top">integer (32 bits signed):</td><td>Integer (Fixnum or Bignum)
|
495
|
+
|
496
|
+
</td></tr>
|
497
|
+
<tr><td valign="top">long integer (64 bits signed):</td><td>Integer (Fixnum or Bignum)
|
498
|
+
|
499
|
+
</td></tr>
|
500
|
+
<tr><td valign="top">float (32 bits signed):</td><td>Float
|
501
|
+
|
502
|
+
</td></tr>
|
503
|
+
<tr><td valign="top">double float (64 bits signed):</td><td>Float
|
504
|
+
|
505
|
+
</td></tr>
|
506
|
+
<tr><td valign="top">decimal (128+ bits signed):</td><td>BigDecimal
|
507
|
+
|
508
|
+
</td></tr>
|
509
|
+
<tr><td valign="top">boolean:</td><td>true (TrueClass) and false (FalseClass)
|
510
|
+
|
511
|
+
</td></tr>
|
512
|
+
<tr><td valign="top">date (day):</td><td>Date
|
513
|
+
|
514
|
+
</td></tr>
|
515
|
+
<tr><td valign="top">date time:</td><td>DateTime (see <a
|
516
|
+
href="../classes/SDL4R.html#M000003">SDL4R#new_date_time</a> if you want to
|
517
|
+
get Time instances from the parsers)
|
518
|
+
|
519
|
+
</td></tr>
|
520
|
+
<tr><td valign="top">time span:</td><td>SdlTimeSpan
|
521
|
+
|
522
|
+
</td></tr>
|
523
|
+
<tr><td valign="top">binary:</td><td>SdlBinary (to avoid confusion with simple strings)
|
524
|
+
|
525
|
+
</td></tr>
|
526
|
+
<tr><td valign="top">null:</td><td>nil (NilClass)
|
527
|
+
|
528
|
+
</td></tr>
|
529
|
+
</table>
|
530
|
+
<p>
|
531
|
+
TO FIX: the handling of floating numbers in Ruby being different from the
|
532
|
+
Java world, the behavior of <a href="../classes/SDL4R.html">SDL4R</a> at
|
533
|
+
limits might not be perfect for the time being.
|
534
|
+
</p>
|
535
|
+
<h2>UTF-8 Support</h2>
|
536
|
+
<p>
|
537
|
+
In Ruby 1.8, in order to enable UTF-8 support, you may have to declare the
|
538
|
+
following lines:
|
539
|
+
</p>
|
540
|
+
<pre>
|
541
|
+
$KCODE = 'u'
|
542
|
+
require 'jcode'
|
543
|
+
</pre>
|
544
|
+
<p>
|
545
|
+
This will give you correct input and output and correct UTF-8
|
546
|
+
"general" sorting. Alternatively you can use the following
|
547
|
+
options when launching the Ruby interpreter:
|
548
|
+
</p>
|
549
|
+
<pre>
|
550
|
+
/path/to/ruby -Ku -rjcode
|
551
|
+
</pre>
|
552
|
+
<h2>License</h2>
|
553
|
+
<p>
|
554
|
+
Simple Declarative Language (SDL) for Ruby
|
555
|
+
</p>
|
556
|
+
<p>
|
557
|
+
Copyright 2005 Ikayzo, inc.
|
558
|
+
</p>
|
559
|
+
<p>
|
560
|
+
This program is free software. You can distribute or modify it under the
|
561
|
+
terms of the GNU Lesser General Public License version 2.1 as published by
|
562
|
+
the Free Software Foundation.
|
563
|
+
</p>
|
564
|
+
<p>
|
565
|
+
This program is distributed AS IS and WITHOUT WARRANTY. OF ANY KIND,
|
566
|
+
INCLUDING MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
567
|
+
Lesser General Public License for more details.
|
568
|
+
</p>
|
569
|
+
<p>
|
570
|
+
You should have received a copy of the GNU Lesser General Public License
|
571
|
+
along with this program; if not, contact the Free Software Foundation,
|
572
|
+
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
573
|
+
</p>
|
574
|
+
|
575
|
+
</div>
|
576
|
+
|
577
|
+
|
578
|
+
</div>
|
579
|
+
|
580
|
+
|
581
|
+
</div>
|
582
|
+
|
583
|
+
|
584
|
+
<!-- if includes -->
|
585
|
+
|
586
|
+
<div id="section">
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
|
595
|
+
<!-- if method_list -->
|
596
|
+
|
597
|
+
|
598
|
+
</div>
|
599
|
+
|
600
|
+
|
601
|
+
<div id="validator-badges">
|
602
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
603
|
+
</div>
|
604
|
+
|
605
|
+
</body>
|
606
|
+
</html>
|