dango_generator 0.0.38
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/LICENSE +16 -0
- data/README.txt +41 -0
- data/dango_generator.rb +99 -0
- data/templates/as3/as3corelib-license.txt +33 -0
- data/templates/as3/as3corelib-readme.txt +5 -0
- data/templates/as3/com/adobe/crypto/MD5.as +256 -0
- data/templates/as3/com/adobe/crypto/SHA1.as +268 -0
- data/templates/as3/com/adobe/crypto/SHA224.as +255 -0
- data/templates/as3/com/adobe/crypto/SHA256.as +260 -0
- data/templates/as3/com/adobe/crypto/WSSEUsernameToken.as +117 -0
- data/templates/as3/com/adobe/errors/IllegalStateError.as +66 -0
- data/templates/as3/com/adobe/images/BitString.as +42 -0
- data/templates/as3/com/adobe/images/JPGEncoder.as +651 -0
- data/templates/as3/com/adobe/images/PNGEncoder.as +144 -0
- data/templates/as3/com/adobe/net/DynamicURLLoader.as +58 -0
- data/templates/as3/com/adobe/net/IURIResolver.as +79 -0
- data/templates/as3/com/adobe/net/URI.as +2469 -0
- data/templates/as3/com/adobe/net/URIEncodingBitmap.as +142 -0
- data/templates/as3/com/adobe/net/proxies/RFC2817Socket.as +204 -0
- data/templates/as3/com/adobe/serialization/json/JSON.as +88 -0
- data/templates/as3/com/adobe/serialization/json/JSONDecoder.as +218 -0
- data/templates/as3/com/adobe/serialization/json/JSONEncoder.as +302 -0
- data/templates/as3/com/adobe/serialization/json/JSONParseError.as +90 -0
- data/templates/as3/com/adobe/serialization/json/JSONToken.as +107 -0
- data/templates/as3/com/adobe/serialization/json/JSONTokenType.as +70 -0
- data/templates/as3/com/adobe/serialization/json/JSONTokenizer.as +550 -0
- data/templates/as3/com/adobe/utils/ArrayUtil.as +190 -0
- data/templates/as3/com/adobe/utils/DateUtil.as +666 -0
- data/templates/as3/com/adobe/utils/DictionaryUtil.as +90 -0
- data/templates/as3/com/adobe/utils/IntUtil.as +69 -0
- data/templates/as3/com/adobe/utils/NumberFormatter.as +77 -0
- data/templates/as3/com/adobe/utils/StringUtil.as +257 -0
- data/templates/as3/com/adobe/utils/XMLUtil.as +171 -0
- data/templates/as3/com/adobe/webapis/ServiceBase.as +51 -0
- data/templates/as3/com/adobe/webapis/URLLoaderBase.as +111 -0
- data/templates/as3/com/adobe/webapis/events/ServiceEvent.as +78 -0
- data/templates/as3/org/rubyforge/dango/DangoClientFramework.as +426 -0
- data/templates/as3/org/rubyforge/dango/DangoError.as +11 -0
- data/templates/as3/org/rubyforge/dango/DangoErrorCode.as +7 -0
- data/templates/as3/org/rubyforge/dango/DangoErrorEvent.as +23 -0
- data/templates/as3/org/rubyforge/dango/DangoReceiveEvent.as +21 -0
- data/templates/as3/org/rubyforge/dango/DangoURLLoader.as +127 -0
- data/templates/as3/org/rubyforge/dango/DangoURLLoaderEvent.as +29 -0
- data/templates/as3/org/rubyforge/dango/DangoUtil.as +84 -0
- data/templates/dango/config/development.yml +28 -0
- data/templates/dango/config/production.yml +3 -0
- data/templates/dango/config/system_message.yml +5 -0
- data/templates/dango/config/test.yml +3 -0
- data/templates/dango/server/99_dango_server.rb +22 -0
- data/templates/lib/dango_monitor_client.rb +1 -0
- data/templates/lib/dango_tester_client.rb +1 -0
- data/templates/script/dango_server +36 -0
- data/templates/tasks/dango.rake +2 -0
- metadata +108 -0
@@ -0,0 +1,550 @@
|
|
1
|
+
/*
|
2
|
+
Adobe Systems Incorporated(r) Source Code License Agreement
|
3
|
+
Copyright(c) 2005 Adobe Systems Incorporated. All rights reserved.
|
4
|
+
|
5
|
+
Please read this Source Code License Agreement carefully before using
|
6
|
+
the source code.
|
7
|
+
|
8
|
+
Adobe Systems Incorporated grants to you a perpetual, worldwide, non-exclusive,
|
9
|
+
no-charge, royalty-free, irrevocable copyright license, to reproduce,
|
10
|
+
prepare derivative works of, publicly display, publicly perform, and
|
11
|
+
distribute this source code and such derivative works in source or
|
12
|
+
object code form without any attribution requirements.
|
13
|
+
|
14
|
+
The name "Adobe Systems Incorporated" must not be used to endorse or promote products
|
15
|
+
derived from the source code without prior written permission.
|
16
|
+
|
17
|
+
You agree to indemnify, hold harmless and defend Adobe Systems Incorporated from and
|
18
|
+
against any loss, damage, claims or lawsuits, including attorney's
|
19
|
+
fees that arise or result from your use or distribution of the source
|
20
|
+
code.
|
21
|
+
|
22
|
+
THIS SOURCE CODE IS PROVIDED "AS IS" AND "WITH ALL FAULTS", WITHOUT
|
23
|
+
ANY TECHNICAL SUPPORT OR ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
|
24
|
+
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
25
|
+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ALSO, THERE IS NO WARRANTY OF
|
26
|
+
NON-INFRINGEMENT, TITLE OR QUIET ENJOYMENT. IN NO EVENT SHALL MACROMEDIA
|
27
|
+
OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
28
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
29
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
30
|
+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
31
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
32
|
+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE CODE, EVEN IF
|
33
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
*/
|
35
|
+
|
36
|
+
package com.adobe.serialization.json {
|
37
|
+
|
38
|
+
public class JSONTokenizer {
|
39
|
+
|
40
|
+
/** The object that will get parsed from the JSON string */
|
41
|
+
private var obj:Object;
|
42
|
+
|
43
|
+
/** The JSON string to be parsed */
|
44
|
+
private var jsonString:String;
|
45
|
+
|
46
|
+
/** The current parsing location in the JSON string */
|
47
|
+
private var loc:int;
|
48
|
+
|
49
|
+
/** The current character in the JSON string during parsing */
|
50
|
+
private var ch:String;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Constructs a new JSONDecoder to parse a JSON string
|
54
|
+
* into a native object.
|
55
|
+
*
|
56
|
+
* @param s The JSON string to be converted
|
57
|
+
* into a native object
|
58
|
+
*/
|
59
|
+
public function JSONTokenizer( s:String ) {
|
60
|
+
jsonString = s;
|
61
|
+
loc = 0;
|
62
|
+
|
63
|
+
// prime the pump by getting the first character
|
64
|
+
nextChar();
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Gets the next token in the input sting and advances
|
69
|
+
* the character to the next character after the token
|
70
|
+
*/
|
71
|
+
public function getNextToken():JSONToken {
|
72
|
+
var token:JSONToken = new JSONToken();
|
73
|
+
|
74
|
+
// skip any whitespace / comments since the last
|
75
|
+
// token was read
|
76
|
+
skipIgnored();
|
77
|
+
|
78
|
+
// examine the new character and see what we have...
|
79
|
+
switch ( ch ) {
|
80
|
+
|
81
|
+
case '{':
|
82
|
+
token.type = JSONTokenType.LEFT_BRACE;
|
83
|
+
token.value = '{';
|
84
|
+
nextChar();
|
85
|
+
break
|
86
|
+
|
87
|
+
case '}':
|
88
|
+
token.type = JSONTokenType.RIGHT_BRACE;
|
89
|
+
token.value = '}';
|
90
|
+
nextChar();
|
91
|
+
break
|
92
|
+
|
93
|
+
case '[':
|
94
|
+
token.type = JSONTokenType.LEFT_BRACKET;
|
95
|
+
token.value = '[';
|
96
|
+
nextChar();
|
97
|
+
break
|
98
|
+
|
99
|
+
case ']':
|
100
|
+
token.type = JSONTokenType.RIGHT_BRACKET;
|
101
|
+
token.value = ']';
|
102
|
+
nextChar();
|
103
|
+
break
|
104
|
+
|
105
|
+
case ',':
|
106
|
+
token.type = JSONTokenType.COMMA;
|
107
|
+
token.value = ',';
|
108
|
+
nextChar();
|
109
|
+
break
|
110
|
+
|
111
|
+
case ':':
|
112
|
+
token.type = JSONTokenType.COLON;
|
113
|
+
token.value = ':';
|
114
|
+
nextChar();
|
115
|
+
break;
|
116
|
+
|
117
|
+
case 't': // attempt to read true
|
118
|
+
var possibleTrue:String = "t" + nextChar() + nextChar() + nextChar();
|
119
|
+
|
120
|
+
if ( possibleTrue == "true" ) {
|
121
|
+
token.type = JSONTokenType.TRUE;
|
122
|
+
token.value = true;
|
123
|
+
nextChar();
|
124
|
+
} else {
|
125
|
+
parseError( "Expecting 'true' but found " + possibleTrue );
|
126
|
+
}
|
127
|
+
|
128
|
+
break;
|
129
|
+
|
130
|
+
case 'f': // attempt to read false
|
131
|
+
var possibleFalse:String = "f" + nextChar() + nextChar() + nextChar() + nextChar();
|
132
|
+
|
133
|
+
if ( possibleFalse == "false" ) {
|
134
|
+
token.type = JSONTokenType.FALSE;
|
135
|
+
token.value = false;
|
136
|
+
nextChar();
|
137
|
+
} else {
|
138
|
+
parseError( "Expecting 'false' but found " + possibleFalse );
|
139
|
+
}
|
140
|
+
|
141
|
+
break;
|
142
|
+
|
143
|
+
case 'n': // attempt to read null
|
144
|
+
|
145
|
+
var possibleNull:String = "n" + nextChar() + nextChar() + nextChar();
|
146
|
+
|
147
|
+
if ( possibleNull == "null" ) {
|
148
|
+
token.type = JSONTokenType.NULL;
|
149
|
+
token.value = null;
|
150
|
+
nextChar();
|
151
|
+
} else {
|
152
|
+
parseError( "Expecting 'null' but found " + possibleNull );
|
153
|
+
}
|
154
|
+
|
155
|
+
break;
|
156
|
+
|
157
|
+
case '"': // the start of a string
|
158
|
+
token = readString();
|
159
|
+
break;
|
160
|
+
|
161
|
+
default:
|
162
|
+
// see if we can read a number
|
163
|
+
if ( isDigit( ch ) || ch == '-' ) {
|
164
|
+
token = readNumber();
|
165
|
+
} else if ( ch == '' ) {
|
166
|
+
// check for reading past the end of the string
|
167
|
+
return null;
|
168
|
+
} else {
|
169
|
+
// not sure what was in the input string - it's not
|
170
|
+
// anything we expected
|
171
|
+
parseError( "Unexpected " + ch + " encountered" );
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
return token;
|
176
|
+
}
|
177
|
+
|
178
|
+
/**
|
179
|
+
* Attempts to read a string from the input string. Places
|
180
|
+
* the character location at the first character after the
|
181
|
+
* string. It is assumed that ch is " before this method is called.
|
182
|
+
*
|
183
|
+
* @return the JSONToken with the string value if a string could
|
184
|
+
* be read. Throws an error otherwise.
|
185
|
+
*/
|
186
|
+
private function readString():JSONToken {
|
187
|
+
// the token for the string we'll try to read
|
188
|
+
var token:JSONToken = new JSONToken();
|
189
|
+
token.type = JSONTokenType.STRING;
|
190
|
+
|
191
|
+
// the string to store the string we'll try to read
|
192
|
+
var string:String = "";
|
193
|
+
|
194
|
+
// advance past the first "
|
195
|
+
nextChar();
|
196
|
+
|
197
|
+
while ( ch != '"' && ch != '' ) {
|
198
|
+
|
199
|
+
// unescape the escape sequences in the string
|
200
|
+
if ( ch == '\\' ) {
|
201
|
+
|
202
|
+
// get the next character so we know what
|
203
|
+
// to unescape
|
204
|
+
nextChar();
|
205
|
+
|
206
|
+
switch ( ch ) {
|
207
|
+
|
208
|
+
case '"': // quotation mark
|
209
|
+
string += '"';
|
210
|
+
break;
|
211
|
+
|
212
|
+
case '/': // solidus
|
213
|
+
string += "/";
|
214
|
+
break;
|
215
|
+
|
216
|
+
case '\\': // reverse solidus
|
217
|
+
string += '\\';
|
218
|
+
break;
|
219
|
+
|
220
|
+
case 'b': // bell
|
221
|
+
string += '\b';
|
222
|
+
break;
|
223
|
+
|
224
|
+
case 'f': // form feed
|
225
|
+
string += '\f';
|
226
|
+
break;
|
227
|
+
|
228
|
+
case 'n': // newline
|
229
|
+
string += '\n';
|
230
|
+
break;
|
231
|
+
|
232
|
+
case 'r': // carriage return
|
233
|
+
string += '\r';
|
234
|
+
break;
|
235
|
+
|
236
|
+
case 't': // horizontal tab
|
237
|
+
string += '\t'
|
238
|
+
break;
|
239
|
+
|
240
|
+
case 'u':
|
241
|
+
// convert a unicode escape sequence
|
242
|
+
// to it's character value - expecting
|
243
|
+
// 4 hex digits
|
244
|
+
|
245
|
+
// save the characters as a string we'll convert to an int
|
246
|
+
var hexValue:String = "";
|
247
|
+
|
248
|
+
// try to find 4 hex characters
|
249
|
+
for ( var i:int = 0; i < 4; i++ ) {
|
250
|
+
// get the next character and determine
|
251
|
+
// if it's a valid hex digit or not
|
252
|
+
if ( !isHexDigit( nextChar() ) ) {
|
253
|
+
parseError( " Excepted a hex digit, but found: " + ch );
|
254
|
+
}
|
255
|
+
// valid, add it to the value
|
256
|
+
hexValue += ch;
|
257
|
+
}
|
258
|
+
|
259
|
+
// convert hexValue to an integer, and use that
|
260
|
+
// integrer value to create a character to add
|
261
|
+
// to our string.
|
262
|
+
string += String.fromCharCode( parseInt( hexValue, 16 ) );
|
263
|
+
|
264
|
+
break;
|
265
|
+
|
266
|
+
default:
|
267
|
+
// couldn't unescape the sequence, so just
|
268
|
+
// pass it through
|
269
|
+
string += '\\' + ch;
|
270
|
+
|
271
|
+
}
|
272
|
+
|
273
|
+
} else {
|
274
|
+
// didn't have to unescape, so add the character to the string
|
275
|
+
string += ch;
|
276
|
+
|
277
|
+
}
|
278
|
+
|
279
|
+
// move to the next character
|
280
|
+
nextChar();
|
281
|
+
|
282
|
+
}
|
283
|
+
|
284
|
+
// we read past the end of the string without closing it, which
|
285
|
+
// is a parse error
|
286
|
+
if ( ch == '' ) {
|
287
|
+
parseError( "Unterminated string literal" );
|
288
|
+
}
|
289
|
+
|
290
|
+
// move past the closing " in the input string
|
291
|
+
nextChar();
|
292
|
+
|
293
|
+
// attach to the string to the token so we can return it
|
294
|
+
token.value = string;
|
295
|
+
|
296
|
+
return token;
|
297
|
+
}
|
298
|
+
|
299
|
+
/**
|
300
|
+
* Attempts to read a number from the input string. Places
|
301
|
+
* the character location at the first character after the
|
302
|
+
* number.
|
303
|
+
*
|
304
|
+
* @return The JSONToken with the number value if a number could
|
305
|
+
* be read. Throws an error otherwise.
|
306
|
+
*/
|
307
|
+
private function readNumber():JSONToken {
|
308
|
+
// the token for the number we'll try to read
|
309
|
+
var token:JSONToken = new JSONToken();
|
310
|
+
token.type = JSONTokenType.NUMBER;
|
311
|
+
|
312
|
+
// the string to accumulate the number characters
|
313
|
+
// into that we'll convert to a number at the end
|
314
|
+
var input:String = "";
|
315
|
+
|
316
|
+
// check for a negative number
|
317
|
+
if ( ch == '-' ) {
|
318
|
+
input += '-';
|
319
|
+
nextChar();
|
320
|
+
}
|
321
|
+
|
322
|
+
// the number must start with a digit
|
323
|
+
if ( !isDigit( ch ) )
|
324
|
+
{
|
325
|
+
parseError( "Expecting a digit" );
|
326
|
+
}
|
327
|
+
|
328
|
+
// 0 can only be the first digit if it
|
329
|
+
// is followed by a decimal point
|
330
|
+
if ( ch == '0' )
|
331
|
+
{
|
332
|
+
input += ch;
|
333
|
+
nextChar();
|
334
|
+
|
335
|
+
// make sure no other digits come after 0
|
336
|
+
if ( isDigit( ch ) )
|
337
|
+
{
|
338
|
+
parseError( "A digit cannot immediately follow 0" );
|
339
|
+
}
|
340
|
+
}
|
341
|
+
else
|
342
|
+
{
|
343
|
+
// read numbers while we can
|
344
|
+
while ( isDigit( ch ) ) {
|
345
|
+
input += ch;
|
346
|
+
nextChar();
|
347
|
+
}
|
348
|
+
}
|
349
|
+
|
350
|
+
// check for a decimal value
|
351
|
+
if ( ch == '.' ) {
|
352
|
+
input += '.';
|
353
|
+
nextChar();
|
354
|
+
|
355
|
+
// after the decimal there has to be a digit
|
356
|
+
if ( !isDigit( ch ) )
|
357
|
+
{
|
358
|
+
parseError( "Expecting a digit" );
|
359
|
+
}
|
360
|
+
|
361
|
+
// read more numbers to get the decimal value
|
362
|
+
while ( isDigit( ch ) ) {
|
363
|
+
input += ch;
|
364
|
+
nextChar();
|
365
|
+
}
|
366
|
+
}
|
367
|
+
|
368
|
+
// check for scientific notation
|
369
|
+
if ( ch == 'e' || ch == 'E' )
|
370
|
+
{
|
371
|
+
input += "e"
|
372
|
+
nextChar();
|
373
|
+
// check for sign
|
374
|
+
if ( ch == '+' || ch == '-' )
|
375
|
+
{
|
376
|
+
input += ch;
|
377
|
+
nextChar();
|
378
|
+
}
|
379
|
+
|
380
|
+
// require at least one number for the exponent
|
381
|
+
// in this case
|
382
|
+
if ( !isDigit( ch ) )
|
383
|
+
{
|
384
|
+
parseError( "Scientific notation number needs exponent value" );
|
385
|
+
}
|
386
|
+
|
387
|
+
// read in the exponent
|
388
|
+
while ( isDigit( ch ) )
|
389
|
+
{
|
390
|
+
input += ch;
|
391
|
+
nextChar();
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
395
|
+
// convert the string to a number value
|
396
|
+
var num:Number = Number( input );
|
397
|
+
|
398
|
+
if ( isFinite( num ) && !isNaN( num ) ) {
|
399
|
+
token.value = num;
|
400
|
+
return token;
|
401
|
+
} else {
|
402
|
+
parseError( "Number " + num + " is not valid!" );
|
403
|
+
}
|
404
|
+
return null;
|
405
|
+
}
|
406
|
+
|
407
|
+
/**
|
408
|
+
* Reads the next character in the input
|
409
|
+
* string and advances the character location.
|
410
|
+
*
|
411
|
+
* @return The next character in the input string, or
|
412
|
+
* null if we've read past the end.
|
413
|
+
*/
|
414
|
+
private function nextChar():String {
|
415
|
+
return ch = jsonString.charAt( loc++ );
|
416
|
+
}
|
417
|
+
|
418
|
+
/**
|
419
|
+
* Advances the character location past any
|
420
|
+
* sort of white space and comments
|
421
|
+
*/
|
422
|
+
private function skipIgnored():void {
|
423
|
+
skipWhite();
|
424
|
+
skipComments();
|
425
|
+
skipWhite();
|
426
|
+
}
|
427
|
+
|
428
|
+
/**
|
429
|
+
* Skips comments in the input string, either
|
430
|
+
* single-line or multi-line. Advances the character
|
431
|
+
* to the first position after the end of the comment.
|
432
|
+
*/
|
433
|
+
private function skipComments():void {
|
434
|
+
if ( ch == '/' ) {
|
435
|
+
// Advance past the first / to find out what type of comment
|
436
|
+
nextChar();
|
437
|
+
switch ( ch ) {
|
438
|
+
case '/': // single-line comment, read through end of line
|
439
|
+
|
440
|
+
// Loop over the characters until we find
|
441
|
+
// a newline or until there's no more characters left
|
442
|
+
do {
|
443
|
+
nextChar();
|
444
|
+
} while ( ch != '\n' && ch != '' )
|
445
|
+
|
446
|
+
// move past the \n
|
447
|
+
nextChar();
|
448
|
+
|
449
|
+
break;
|
450
|
+
|
451
|
+
case '*': // multi-line comment, read until closing */
|
452
|
+
|
453
|
+
// move past the opening *
|
454
|
+
nextChar();
|
455
|
+
|
456
|
+
// try to find a trailing */
|
457
|
+
while ( true ) {
|
458
|
+
if ( ch == '*' ) {
|
459
|
+
// check to see if we have a closing /
|
460
|
+
nextChar();
|
461
|
+
if ( ch == '/') {
|
462
|
+
// move past the end of the closing */
|
463
|
+
nextChar();
|
464
|
+
break;
|
465
|
+
}
|
466
|
+
} else {
|
467
|
+
// move along, looking if the next character is a *
|
468
|
+
nextChar();
|
469
|
+
}
|
470
|
+
|
471
|
+
// when we're here we've read past the end of
|
472
|
+
// the string without finding a closing */, so error
|
473
|
+
if ( ch == '' ) {
|
474
|
+
parseError( "Multi-line comment not closed" );
|
475
|
+
}
|
476
|
+
}
|
477
|
+
|
478
|
+
break;
|
479
|
+
|
480
|
+
// Can't match a comment after a /, so it's a parsing error
|
481
|
+
default:
|
482
|
+
parseError( "Unexpected " + ch + " encountered (expecting '/' or '*' )" );
|
483
|
+
}
|
484
|
+
}
|
485
|
+
|
486
|
+
}
|
487
|
+
|
488
|
+
|
489
|
+
/**
|
490
|
+
* Skip any whitespace in the input string and advances
|
491
|
+
* the character to the first character after any possible
|
492
|
+
* whitespace.
|
493
|
+
*/
|
494
|
+
private function skipWhite():void {
|
495
|
+
|
496
|
+
// As long as there are spaces in the input
|
497
|
+
// stream, advance the current location pointer
|
498
|
+
// past them
|
499
|
+
while ( isWhiteSpace( ch ) ) {
|
500
|
+
nextChar();
|
501
|
+
}
|
502
|
+
|
503
|
+
}
|
504
|
+
|
505
|
+
/**
|
506
|
+
* Determines if a character is whitespace or not.
|
507
|
+
*
|
508
|
+
* @return True if the character passed in is a whitespace
|
509
|
+
* character
|
510
|
+
*/
|
511
|
+
private function isWhiteSpace( ch:String ):Boolean {
|
512
|
+
return ( ch == ' ' || ch == '\t' || ch == '\n' );
|
513
|
+
}
|
514
|
+
|
515
|
+
/**
|
516
|
+
* Determines if a character is a digit [0-9].
|
517
|
+
*
|
518
|
+
* @return True if the character passed in is a digit
|
519
|
+
*/
|
520
|
+
private function isDigit( ch:String ):Boolean {
|
521
|
+
return ( ch >= '0' && ch <= '9' );
|
522
|
+
}
|
523
|
+
|
524
|
+
/**
|
525
|
+
* Determines if a character is a digit [0-9].
|
526
|
+
*
|
527
|
+
* @return True if the character passed in is a digit
|
528
|
+
*/
|
529
|
+
private function isHexDigit( ch:String ):Boolean {
|
530
|
+
// get the uppercase value of ch so we only have
|
531
|
+
// to compare the value between 'A' and 'F'
|
532
|
+
var uc:String = ch.toUpperCase();
|
533
|
+
|
534
|
+
// a hex digit is a digit of A-F, inclusive ( using
|
535
|
+
// our uppercase constraint )
|
536
|
+
return ( isDigit( ch ) || ( uc >= 'A' && uc <= 'F' ) );
|
537
|
+
}
|
538
|
+
|
539
|
+
/**
|
540
|
+
* Raises a parsing error with a specified message, tacking
|
541
|
+
* on the error location and the original string.
|
542
|
+
*
|
543
|
+
* @param message The message indicating why the error occurred
|
544
|
+
*/
|
545
|
+
public function parseError( message:String ):void {
|
546
|
+
throw new JSONParseError( message, loc, jsonString );
|
547
|
+
}
|
548
|
+
}
|
549
|
+
|
550
|
+
}
|