Created
September 22, 2010 15:51
-
-
Save mro/591942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RagelParser.h | |
// | |
// Created by Marcus Rohrmoser on 24.06.10. | |
// Copyright 2010 Marcus Rohrmoser mobile Software. All rights reserved. | |
// | |
#define RAGEL_ERROR_DOMAIN @"_RAGEL_ERROR_DOMAIN_" | |
#define RAGEL_ERROR_CODE 110 | |
@interface RagelParser : NSObject {} | |
-(NSError *)parseError:(const char *)data position:(const char *)p; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RagelParser.m | |
// | |
// Created by Marcus Rohrmoser on 24.06.10. | |
// Copyright 2010 Marcus Rohrmoser mobile Software. All rights reserved. | |
// | |
#import "RagelParser.h" | |
@implementation RagelParser | |
-(NSError *)parseError:(const char *)data position:(const char *)p | |
{ | |
MRLogD( @"position:%d", (p - data) ); | |
NSDictionary *ui = [NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Couldn't parse transform '%s' - failed at %d", data, p - data], NSLocalizedDescriptionKey, | |
nil]; | |
return [NSError errorWithDomain:RAGEL_ERROR_DOMAIN code:RAGEL_ERROR_CODE userInfo:ui]; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default namespace = "" | |
start = | |
element query { | |
attribute columns { | |
xsd:integer { minInclusive = "0" } | |
}, | |
attribute rows { | |
xsd:integer { minInclusive = "0" } | |
}, | |
element row { | |
element dataid { xsd:integer }, | |
element freightpercent { | |
xsd:short { minInclusive = "-1" maxInclusive = "101" } | |
}, | |
element fromcountry { | |
"AD" | "AL" | "AM" | "AT" | "AZ" | "BA" | "BE" | "BG" | "BY" | "CH" | "CY" | "CZ" | "DE" | "DK" | "EE" | "ES" | "FI" | "FR" | "GB" | "GE" | "GR" | "HR" | "HU" | "IE" | "IS" | "IT" | "KZ" | "LI" | "LT" | "LU" | "LV" | "MC" | "MD" | "ME" | "MK" | "MT" | "NL" | "NO" | "PL" | "PT" | "RO" | "RS" | "RU" | "SE" | "SI" | "SK" | "TR" | "UA" | |
}, | |
element relevance { xsd:integer }?, | |
element tocountry { | |
"AD" | "AL" | "AM" | "AT" | "AZ" | "BA" | "BE" | "BG" | "BY" | "CH" | "CY" | "CZ" | "DE" | "DK" | "EE" | "ES" | "FI" | "FR" | "GB" | "GE" | "GR" | "HR" | "HU" | "IE" | "IS" | "IT" | "KZ" | "LI" | "LT" | "LU" | "LV" | "MC" | "MD" | "ME" | "MK" | "MT" | "NL" | "NO" | "PL" | "PT" | "RO" | "RS" | "RU" | "SE" | "SI" | "SK" | "TR" | "UA" | |
}, | |
element vehiclepercent { | |
xsd:short { minInclusive = "-1" maxInclusive = "101" } | |
} | |
}+ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// XmlLoader.h | |
// | |
// Created by Marcus Rohrmoser on 21.06.10. | |
// Copyright 2010 Marcus Rohrmoser mobile Software. All rights reserved. | |
// | |
#define NaN_MARKER 101 | |
@protocol XmlLoader | |
-(id)init; | |
-(BOOL)parseData:(NSData *)data error:(NSError **)error; | |
-(NSDictionary *)freightPercentFromTo; | |
-(NSArray *)fromCountries; | |
-(NSArray *)toCountries; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// XmlLoaderRagel.h | |
// | |
// Created by Marcus Rohrmoser on 24.06.10. | |
// Copyright 2010 Marcus Rohrmoser mobile Software. All rights reserved. | |
// | |
#import "RagelParser.h" | |
#import "XmlLoader.h" | |
/** <a href="http://www.complang.org/ragel/">Ragel</a> parser | |
* This file is auto-generated | |
* <p> | |
* DO NOT EDIT MANUALLY!!! | |
* </p> | |
*/ | |
@interface XmlLoaderRagel : RagelParser <XmlLoader> { | |
NSMutableDictionary *freightPercentFromTo; | |
NSMutableSet *fromCountries; | |
NSMutableSet *toCountries; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#line 1 "ragel/XmlLoaderRagel.rl" | |
// | |
// XmlLoaderRagel.m | |
// | |
// Created by Marcus Rohrmoser on 24.06.10. | |
// Copyright 2010 Marcus Rohrmoser mobile Software. All rights reserved. | |
// | |
#define USE_FLYWEIGHT 1 | |
#if USE_FLYWEIGHT | |
#import "CountryFactory.h" | |
#else | |
/// Flyweightish NSMutableSet | |
@interface NSMutableSet (MemberOrAdd) | |
-(id)memberOrAdd:(id)object; | |
@end | |
@implementation NSMutableSet (MemberOrAdd) | |
-(id)memberOrAdd:(id)object | |
{ | |
if ( object == nil ) | |
return nil; | |
NSString *ret = [self member:object]; | |
if ( ret == nil ) | |
[self addObject:(ret = object)]; | |
NSAssert(ret != nil, @""); | |
return ret; | |
} | |
@end | |
#endif | |
#import "XmlLoaderRagel.h" | |
//#ifdef MRLogD | |
//#undef MRLogD | |
//#endif | |
// | |
//// No Logging | |
//#define MRLogD(x,...) /* NSLog(x,##__VA_ARGS__) */ | |
/** <a href="http://www.complang.org/ragel/">Ragel</a> parser | |
* This file is auto-generated | |
* <p> | |
* DO NOT EDIT MANUALLY!!! | |
* </p> | |
*/ | |
@implementation XmlLoaderRagel | |
#line 205 "ragel/XmlLoaderRagel.rl" | |
#pragma mark Ragel Machine State Data | |
#line 63 "Generated/XmlLoaderRagel.m" | |
static const int freightPercentMachine_start = 1; | |
static const int freightPercentMachine_first_final = 273; | |
static const int freightPercentMachine_error = 0; | |
static const int freightPercentMachine_en_main = 1; | |
#line 210 "ragel/XmlLoaderRagel.rl" | |
#pragma mark Internal Helpers | |
-(void)addRowFrom:(char*)fromIso to:(char*)toIso freight:(char*)percent { | |
// MRLogD(@"row from:%s to:%s percent:%s", fromIso, toIso, percent); | |
const long tmp_percent = atol(percent); | |
if ( NaN_MARKER != tmp_percent ) { | |
#if ! USE_FLYWEIGHT | |
NSString *tmp_from = [NSString stringWithCString:fromIso encoding:NSASCIIStringEncoding]; | |
NSString *tmp_to = [NSString stringWithCString:toIso encoding:NSASCIIStringEncoding]; | |
tmp_from = [fromCountries memberOrAdd:tmp_from]; | |
tmp_to = [toCountries memberOrAdd:tmp_to]; | |
NSMutableDictionary *to = [freightPercentFromTo valueForKey:tmp_from]; | |
if ( to == nil ) | |
[freightPercentFromTo setValue:(to = [NSMutableDictionary dictionaryWithCapacity:50]) forKey:tmp_from]; | |
[to setValue:[NSNumber numberWithInteger:tmp_percent] forKey:tmp_to]; | |
#else | |
NSString *tmp_from = [CountryFactory countryFromCString:fromIso]; | |
NSString *tmp_to = [CountryFactory countryFromCString:toIso]; | |
NSMutableDictionary *to = [freightPercentFromTo valueForKey:tmp_from]; | |
if ( to == nil ) { | |
[freightPercentFromTo setValue:(to = [NSMutableDictionary dictionaryWithCapacity:50]) forKey:tmp_from]; | |
[fromCountries addObject:tmp_from]; | |
} | |
[to setValue:[NSNumber numberWithInteger:tmp_percent] forKey:tmp_to]; | |
[toCountries addObject:tmp_to]; | |
#endif | |
} | |
} | |
#define BUFSIZE 20 | |
-(BOOL)internal_parseChar:(const char*)data length:(int)length error:(NSError**)errPtr | |
{ | |
NSDate *t_start = [NSDate date]; | |
MRLogD(); | |
if(data == NULL) | |
return YES; | |
// high-level buffers | |
const char *start = NULL; | |
char buffer[BUFSIZE] = ""; | |
char fromcountry[BUFSIZE] = ""; | |
char tocountry[BUFSIZE] = ""; | |
char freightpercent[BUFSIZE] = ""; | |
// ragel variables (low level) | |
const char *p = data; | |
const char *pe = data + length; // pointer "end" | |
// const char *eof = pe; | |
int cs = 0; | |
// int top; | |
/////////////////////////////////////////////////////////// | |
// init ragel | |
#line 128 "Generated/XmlLoaderRagel.m" | |
{ | |
cs = freightPercentMachine_start; | |
} | |
#line 266 "ragel/XmlLoaderRagel.rl" | |
/////////////////////////////////////////////////////////// | |
// exec ragel | |
#line 137 "Generated/XmlLoaderRagel.m" | |
{ | |
if ( p == pe ) | |
goto _test_eof; | |
switch ( cs ) | |
{ | |
case 1: | |
switch( (*p) ) { | |
case 13: goto st2; | |
case 32: goto st2; | |
case 60: goto st212; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st2; | |
goto st0; | |
st0: | |
cs = 0; | |
goto _out; | |
st2: | |
if ( ++p == pe ) | |
goto _test_eof2; | |
case 2: | |
switch( (*p) ) { | |
case 13: goto st2; | |
case 32: goto st2; | |
case 60: goto st3; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st2; | |
goto st0; | |
st3: | |
if ( ++p == pe ) | |
goto _test_eof3; | |
case 3: | |
switch( (*p) ) { | |
case 33: goto st4; | |
case 113: goto st9; | |
} | |
goto st0; | |
st4: | |
if ( ++p == pe ) | |
goto _test_eof4; | |
case 4: | |
if ( (*p) == 45 ) | |
goto st5; | |
goto st0; | |
st5: | |
if ( ++p == pe ) | |
goto _test_eof5; | |
case 5: | |
if ( (*p) == 45 ) | |
goto st6; | |
goto st0; | |
st6: | |
if ( ++p == pe ) | |
goto _test_eof6; | |
case 6: | |
switch( (*p) ) { | |
case 13: goto st6; | |
case 45: goto st7; | |
} | |
if ( (*p) < 48 ) { | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st6; | |
} else if ( (*p) > 57 ) { | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st6; | |
} else if ( (*p) >= 65 ) | |
goto st6; | |
} else | |
goto st6; | |
goto st0; | |
st7: | |
if ( ++p == pe ) | |
goto _test_eof7; | |
case 7: | |
switch( (*p) ) { | |
case 13: goto st6; | |
case 45: goto st8; | |
} | |
if ( (*p) < 48 ) { | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st6; | |
} else if ( (*p) > 57 ) { | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st6; | |
} else if ( (*p) >= 65 ) | |
goto st6; | |
} else | |
goto st6; | |
goto st0; | |
st8: | |
if ( ++p == pe ) | |
goto _test_eof8; | |
case 8: | |
if ( (*p) == 62 ) | |
goto st2; | |
goto st0; | |
st9: | |
if ( ++p == pe ) | |
goto _test_eof9; | |
case 9: | |
if ( (*p) == 117 ) | |
goto st10; | |
goto st0; | |
st10: | |
if ( ++p == pe ) | |
goto _test_eof10; | |
case 10: | |
if ( (*p) == 101 ) | |
goto st11; | |
goto st0; | |
st11: | |
if ( ++p == pe ) | |
goto _test_eof11; | |
case 11: | |
if ( (*p) == 114 ) | |
goto st12; | |
goto st0; | |
st12: | |
if ( ++p == pe ) | |
goto _test_eof12; | |
case 12: | |
if ( (*p) == 121 ) | |
goto st13; | |
goto st0; | |
st13: | |
if ( ++p == pe ) | |
goto _test_eof13; | |
case 13: | |
switch( (*p) ) { | |
case 13: goto st14; | |
case 32: goto st14; | |
case 62: goto st20; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st14; | |
goto st0; | |
st14: | |
if ( ++p == pe ) | |
goto _test_eof14; | |
case 14: | |
switch( (*p) ) { | |
case 13: goto st14; | |
case 32: goto st14; | |
case 58: goto st15; | |
case 62: goto st20; | |
case 95: goto st15; | |
} | |
if ( (*p) < -8 ) { | |
if ( (*p) > -42 ) { | |
if ( -40 <= (*p) && (*p) <= -10 ) | |
goto st15; | |
} else if ( (*p) >= -64 ) | |
goto st15; | |
} else if ( (*p) > -1 ) { | |
if ( (*p) < 65 ) { | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st14; | |
} else if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st15; | |
} else | |
goto st15; | |
} else | |
goto st15; | |
goto st0; | |
st15: | |
if ( ++p == pe ) | |
goto _test_eof15; | |
case 15: | |
switch( (*p) ) { | |
case -41: goto st0; | |
case -9: goto st0; | |
case 13: goto st16; | |
case 32: goto st16; | |
case 47: goto st0; | |
case 61: goto st17; | |
case 96: goto st0; | |
} | |
if ( (*p) < 9 ) { | |
if ( (*p) < -72 ) { | |
if ( (*p) <= -74 ) | |
goto st0; | |
} else if ( (*p) > -65 ) { | |
if ( 0 <= (*p) && (*p) <= 8 ) | |
goto st0; | |
} else | |
goto st0; | |
} else if ( (*p) > 10 ) { | |
if ( (*p) < 59 ) { | |
if ( 11 <= (*p) && (*p) <= 44 ) | |
goto st0; | |
} else if ( (*p) > 64 ) { | |
if ( (*p) > 94 ) { | |
if ( 123 <= (*p) ) | |
goto st0; | |
} else if ( (*p) >= 91 ) | |
goto st0; | |
} else | |
goto st0; | |
} else | |
goto st16; | |
goto st15; | |
st16: | |
if ( ++p == pe ) | |
goto _test_eof16; | |
case 16: | |
switch( (*p) ) { | |
case 13: goto st16; | |
case 32: goto st16; | |
case 61: goto st17; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st16; | |
goto st0; | |
st17: | |
if ( ++p == pe ) | |
goto _test_eof17; | |
case 17: | |
switch( (*p) ) { | |
case 13: goto st17; | |
case 32: goto st17; | |
case 34: goto st18; | |
case 39: goto st19; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st17; | |
goto st0; | |
st18: | |
if ( ++p == pe ) | |
goto _test_eof18; | |
case 18: | |
if ( (*p) == 34 ) | |
goto st13; | |
goto st18; | |
st19: | |
if ( ++p == pe ) | |
goto _test_eof19; | |
case 19: | |
if ( (*p) == 39 ) | |
goto st13; | |
goto st19; | |
tr193: | |
#line 102 "ragel/XmlLoaderRagel.rl" | |
{ | |
[self addRowFrom:fromcountry to:tocountry freight:freightpercent]; | |
fromcountry[0] = 0; | |
tocountry[0] = 0; | |
freightpercent[0] = 0; | |
} | |
goto st20; | |
st20: | |
if ( ++p == pe ) | |
goto _test_eof20; | |
case 20: | |
#line 395 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 13: goto st20; | |
case 32: goto st20; | |
case 60: goto st21; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st20; | |
goto st0; | |
tr194: | |
#line 102 "ragel/XmlLoaderRagel.rl" | |
{ | |
[self addRowFrom:fromcountry to:tocountry freight:freightpercent]; | |
fromcountry[0] = 0; | |
tocountry[0] = 0; | |
freightpercent[0] = 0; | |
} | |
goto st21; | |
st21: | |
if ( ++p == pe ) | |
goto _test_eof21; | |
case 21: | |
#line 417 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 47: goto st22; | |
case 114: goto st34; | |
} | |
goto st0; | |
st22: | |
if ( ++p == pe ) | |
goto _test_eof22; | |
case 22: | |
if ( (*p) == 113 ) | |
goto st23; | |
goto st0; | |
st23: | |
if ( ++p == pe ) | |
goto _test_eof23; | |
case 23: | |
if ( (*p) == 117 ) | |
goto st24; | |
goto st0; | |
st24: | |
if ( ++p == pe ) | |
goto _test_eof24; | |
case 24: | |
if ( (*p) == 101 ) | |
goto st25; | |
goto st0; | |
st25: | |
if ( ++p == pe ) | |
goto _test_eof25; | |
case 25: | |
if ( (*p) == 114 ) | |
goto st26; | |
goto st0; | |
st26: | |
if ( ++p == pe ) | |
goto _test_eof26; | |
case 26: | |
if ( (*p) == 121 ) | |
goto st27; | |
goto st0; | |
st27: | |
if ( ++p == pe ) | |
goto _test_eof27; | |
case 27: | |
switch( (*p) ) { | |
case 13: goto st27; | |
case 32: goto st27; | |
case 62: goto st273; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st27; | |
goto st0; | |
st273: | |
if ( ++p == pe ) | |
goto _test_eof273; | |
case 273: | |
switch( (*p) ) { | |
case 13: goto st273; | |
case 32: goto st273; | |
case 60: goto st28; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st273; | |
goto st0; | |
st28: | |
if ( ++p == pe ) | |
goto _test_eof28; | |
case 28: | |
if ( (*p) == 33 ) | |
goto st29; | |
goto st0; | |
st29: | |
if ( ++p == pe ) | |
goto _test_eof29; | |
case 29: | |
if ( (*p) == 45 ) | |
goto st30; | |
goto st0; | |
st30: | |
if ( ++p == pe ) | |
goto _test_eof30; | |
case 30: | |
if ( (*p) == 45 ) | |
goto st31; | |
goto st0; | |
st31: | |
if ( ++p == pe ) | |
goto _test_eof31; | |
case 31: | |
switch( (*p) ) { | |
case 13: goto st31; | |
case 45: goto st32; | |
} | |
if ( (*p) < 48 ) { | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st31; | |
} else if ( (*p) > 57 ) { | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st31; | |
} else if ( (*p) >= 65 ) | |
goto st31; | |
} else | |
goto st31; | |
goto st0; | |
st32: | |
if ( ++p == pe ) | |
goto _test_eof32; | |
case 32: | |
switch( (*p) ) { | |
case 13: goto st31; | |
case 45: goto st33; | |
} | |
if ( (*p) < 48 ) { | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st31; | |
} else if ( (*p) > 57 ) { | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st31; | |
} else if ( (*p) >= 65 ) | |
goto st31; | |
} else | |
goto st31; | |
goto st0; | |
st33: | |
if ( ++p == pe ) | |
goto _test_eof33; | |
case 33: | |
if ( (*p) == 62 ) | |
goto st273; | |
goto st0; | |
st34: | |
if ( ++p == pe ) | |
goto _test_eof34; | |
case 34: | |
if ( (*p) == 111 ) | |
goto st35; | |
goto st0; | |
st35: | |
if ( ++p == pe ) | |
goto _test_eof35; | |
case 35: | |
if ( (*p) == 119 ) | |
goto st36; | |
goto st0; | |
st36: | |
if ( ++p == pe ) | |
goto _test_eof36; | |
case 36: | |
switch( (*p) ) { | |
case 13: goto st36; | |
case 32: goto st36; | |
case 62: goto st37; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st36; | |
goto st0; | |
st37: | |
if ( ++p == pe ) | |
goto _test_eof37; | |
case 37: | |
switch( (*p) ) { | |
case 13: goto st37; | |
case 32: goto st37; | |
case 60: goto st38; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st37; | |
goto st0; | |
st38: | |
if ( ++p == pe ) | |
goto _test_eof38; | |
case 38: | |
switch( (*p) ) { | |
case 100: goto st39; | |
case 102: goto st56; | |
} | |
goto st0; | |
st39: | |
if ( ++p == pe ) | |
goto _test_eof39; | |
case 39: | |
if ( (*p) == 97 ) | |
goto st40; | |
goto st0; | |
st40: | |
if ( ++p == pe ) | |
goto _test_eof40; | |
case 40: | |
if ( (*p) == 116 ) | |
goto st41; | |
goto st0; | |
st41: | |
if ( ++p == pe ) | |
goto _test_eof41; | |
case 41: | |
if ( (*p) == 97 ) | |
goto st42; | |
goto st0; | |
st42: | |
if ( ++p == pe ) | |
goto _test_eof42; | |
case 42: | |
if ( (*p) == 105 ) | |
goto st43; | |
goto st0; | |
st43: | |
if ( ++p == pe ) | |
goto _test_eof43; | |
case 43: | |
if ( (*p) == 100 ) | |
goto st44; | |
goto st0; | |
st44: | |
if ( ++p == pe ) | |
goto _test_eof44; | |
case 44: | |
switch( (*p) ) { | |
case 13: goto st44; | |
case 32: goto st44; | |
case 62: goto st45; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st44; | |
goto st0; | |
st45: | |
if ( ++p == pe ) | |
goto _test_eof45; | |
case 45: | |
switch( (*p) ) { | |
case 13: goto st45; | |
case 45: goto st45; | |
case 60: goto st46; | |
} | |
if ( (*p) < 48 ) { | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st45; | |
} else if ( (*p) > 57 ) { | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st45; | |
} else if ( (*p) >= 65 ) | |
goto st45; | |
} else | |
goto st45; | |
goto st0; | |
st46: | |
if ( ++p == pe ) | |
goto _test_eof46; | |
case 46: | |
if ( (*p) == 47 ) | |
goto st47; | |
goto st0; | |
st47: | |
if ( ++p == pe ) | |
goto _test_eof47; | |
case 47: | |
if ( (*p) == 100 ) | |
goto st48; | |
goto st0; | |
st48: | |
if ( ++p == pe ) | |
goto _test_eof48; | |
case 48: | |
if ( (*p) == 97 ) | |
goto st49; | |
goto st0; | |
st49: | |
if ( ++p == pe ) | |
goto _test_eof49; | |
case 49: | |
if ( (*p) == 116 ) | |
goto st50; | |
goto st0; | |
st50: | |
if ( ++p == pe ) | |
goto _test_eof50; | |
case 50: | |
if ( (*p) == 97 ) | |
goto st51; | |
goto st0; | |
st51: | |
if ( ++p == pe ) | |
goto _test_eof51; | |
case 51: | |
if ( (*p) == 105 ) | |
goto st52; | |
goto st0; | |
st52: | |
if ( ++p == pe ) | |
goto _test_eof52; | |
case 52: | |
if ( (*p) == 100 ) | |
goto st53; | |
goto st0; | |
st53: | |
if ( ++p == pe ) | |
goto _test_eof53; | |
case 53: | |
switch( (*p) ) { | |
case 13: goto st53; | |
case 32: goto st53; | |
case 62: goto st54; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st53; | |
goto st0; | |
st54: | |
if ( ++p == pe ) | |
goto _test_eof54; | |
case 54: | |
switch( (*p) ) { | |
case 13: goto st54; | |
case 32: goto st54; | |
case 60: goto st55; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st54; | |
goto st0; | |
st55: | |
if ( ++p == pe ) | |
goto _test_eof55; | |
case 55: | |
if ( (*p) == 102 ) | |
goto st56; | |
goto st0; | |
st56: | |
if ( ++p == pe ) | |
goto _test_eof56; | |
case 56: | |
if ( (*p) == 114 ) | |
goto st57; | |
goto st0; | |
st57: | |
if ( ++p == pe ) | |
goto _test_eof57; | |
case 57: | |
if ( (*p) == 101 ) | |
goto st58; | |
goto st0; | |
st58: | |
if ( ++p == pe ) | |
goto _test_eof58; | |
case 58: | |
if ( (*p) == 105 ) | |
goto st59; | |
goto st0; | |
st59: | |
if ( ++p == pe ) | |
goto _test_eof59; | |
case 59: | |
if ( (*p) == 103 ) | |
goto st60; | |
goto st0; | |
st60: | |
if ( ++p == pe ) | |
goto _test_eof60; | |
case 60: | |
if ( (*p) == 104 ) | |
goto st61; | |
goto st0; | |
st61: | |
if ( ++p == pe ) | |
goto _test_eof61; | |
case 61: | |
if ( (*p) == 116 ) | |
goto st62; | |
goto st0; | |
st62: | |
if ( ++p == pe ) | |
goto _test_eof62; | |
case 62: | |
if ( (*p) == 112 ) | |
goto st63; | |
goto st0; | |
st63: | |
if ( ++p == pe ) | |
goto _test_eof63; | |
case 63: | |
if ( (*p) == 101 ) | |
goto st64; | |
goto st0; | |
st64: | |
if ( ++p == pe ) | |
goto _test_eof64; | |
case 64: | |
if ( (*p) == 114 ) | |
goto st65; | |
goto st0; | |
st65: | |
if ( ++p == pe ) | |
goto _test_eof65; | |
case 65: | |
if ( (*p) == 99 ) | |
goto st66; | |
goto st0; | |
st66: | |
if ( ++p == pe ) | |
goto _test_eof66; | |
case 66: | |
if ( (*p) == 101 ) | |
goto st67; | |
goto st0; | |
st67: | |
if ( ++p == pe ) | |
goto _test_eof67; | |
case 67: | |
if ( (*p) == 110 ) | |
goto st68; | |
goto st0; | |
st68: | |
if ( ++p == pe ) | |
goto _test_eof68; | |
case 68: | |
if ( (*p) == 116 ) | |
goto st69; | |
goto st0; | |
st69: | |
if ( ++p == pe ) | |
goto _test_eof69; | |
case 69: | |
switch( (*p) ) { | |
case 13: goto st69; | |
case 32: goto st69; | |
case 62: goto st70; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st69; | |
goto st0; | |
st70: | |
if ( ++p == pe ) | |
goto _test_eof70; | |
case 70: | |
switch( (*p) ) { | |
case 13: goto st70; | |
case 32: goto st70; | |
case 45: goto tr71; | |
} | |
if ( (*p) > 10 ) { | |
if ( 48 <= (*p) && (*p) <= 57 ) | |
goto tr72; | |
} else if ( (*p) >= 9 ) | |
goto st70; | |
goto st0; | |
tr71: | |
#line 61 "ragel/XmlLoaderRagel.rl" | |
{ | |
start = p; | |
} | |
goto st71; | |
st71: | |
if ( ++p == pe ) | |
goto _test_eof71; | |
case 71: | |
#line 873 "Generated/XmlLoaderRagel.m" | |
if ( 48 <= (*p) && (*p) <= 57 ) | |
goto st72; | |
goto st0; | |
tr72: | |
#line 61 "ragel/XmlLoaderRagel.rl" | |
{ | |
start = p; | |
} | |
goto st72; | |
st72: | |
if ( ++p == pe ) | |
goto _test_eof72; | |
case 72: | |
#line 887 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 13: goto tr74; | |
case 32: goto tr74; | |
case 60: goto tr75; | |
} | |
if ( (*p) > 10 ) { | |
if ( 48 <= (*p) && (*p) <= 57 ) | |
goto st72; | |
} else if ( (*p) >= 9 ) | |
goto tr74; | |
goto st0; | |
tr74: | |
#line 65 "ragel/XmlLoaderRagel.rl" | |
{ | |
char *endmark = (char*)p; | |
const char c = *endmark; | |
*endmark = '\0'; | |
strncpy(buffer, start, BUFSIZE); | |
*endmark = c; | |
start = NULL; | |
} | |
goto st73; | |
st73: | |
if ( ++p == pe ) | |
goto _test_eof73; | |
case 73: | |
#line 914 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 13: goto st73; | |
case 32: goto st73; | |
case 60: goto st74; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st73; | |
goto st0; | |
tr75: | |
#line 65 "ragel/XmlLoaderRagel.rl" | |
{ | |
char *endmark = (char*)p; | |
const char c = *endmark; | |
*endmark = '\0'; | |
strncpy(buffer, start, BUFSIZE); | |
*endmark = c; | |
start = NULL; | |
} | |
goto st74; | |
st74: | |
if ( ++p == pe ) | |
goto _test_eof74; | |
case 74: | |
#line 938 "Generated/XmlLoaderRagel.m" | |
if ( (*p) == 47 ) | |
goto st75; | |
goto st0; | |
st75: | |
if ( ++p == pe ) | |
goto _test_eof75; | |
case 75: | |
if ( (*p) == 102 ) | |
goto st76; | |
goto st0; | |
st76: | |
if ( ++p == pe ) | |
goto _test_eof76; | |
case 76: | |
if ( (*p) == 114 ) | |
goto st77; | |
goto st0; | |
st77: | |
if ( ++p == pe ) | |
goto _test_eof77; | |
case 77: | |
if ( (*p) == 101 ) | |
goto st78; | |
goto st0; | |
st78: | |
if ( ++p == pe ) | |
goto _test_eof78; | |
case 78: | |
if ( (*p) == 105 ) | |
goto st79; | |
goto st0; | |
st79: | |
if ( ++p == pe ) | |
goto _test_eof79; | |
case 79: | |
if ( (*p) == 103 ) | |
goto st80; | |
goto st0; | |
st80: | |
if ( ++p == pe ) | |
goto _test_eof80; | |
case 80: | |
if ( (*p) == 104 ) | |
goto st81; | |
goto st0; | |
st81: | |
if ( ++p == pe ) | |
goto _test_eof81; | |
case 81: | |
if ( (*p) == 116 ) | |
goto st82; | |
goto st0; | |
st82: | |
if ( ++p == pe ) | |
goto _test_eof82; | |
case 82: | |
if ( (*p) == 112 ) | |
goto st83; | |
goto st0; | |
st83: | |
if ( ++p == pe ) | |
goto _test_eof83; | |
case 83: | |
if ( (*p) == 101 ) | |
goto st84; | |
goto st0; | |
st84: | |
if ( ++p == pe ) | |
goto _test_eof84; | |
case 84: | |
if ( (*p) == 114 ) | |
goto st85; | |
goto st0; | |
st85: | |
if ( ++p == pe ) | |
goto _test_eof85; | |
case 85: | |
if ( (*p) == 99 ) | |
goto st86; | |
goto st0; | |
st86: | |
if ( ++p == pe ) | |
goto _test_eof86; | |
case 86: | |
if ( (*p) == 101 ) | |
goto st87; | |
goto st0; | |
st87: | |
if ( ++p == pe ) | |
goto _test_eof87; | |
case 87: | |
if ( (*p) == 110 ) | |
goto st88; | |
goto st0; | |
st88: | |
if ( ++p == pe ) | |
goto _test_eof88; | |
case 88: | |
if ( (*p) == 116 ) | |
goto st89; | |
goto st0; | |
st89: | |
if ( ++p == pe ) | |
goto _test_eof89; | |
case 89: | |
switch( (*p) ) { | |
case 13: goto st89; | |
case 32: goto st89; | |
case 62: goto st90; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st89; | |
goto st0; | |
st90: | |
if ( ++p == pe ) | |
goto _test_eof90; | |
case 90: | |
switch( (*p) ) { | |
case 13: goto tr94; | |
case 32: goto tr94; | |
case 60: goto tr95; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto tr94; | |
goto st0; | |
tr94: | |
#line 87 "ragel/XmlLoaderRagel.rl" | |
{ | |
strncpy(freightpercent, buffer, BUFSIZE); | |
buffer[0] = 0; | |
} | |
goto st91; | |
st91: | |
if ( ++p == pe ) | |
goto _test_eof91; | |
case 91: | |
#line 1075 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 13: goto st91; | |
case 32: goto st91; | |
case 60: goto st92; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st91; | |
goto st0; | |
tr95: | |
#line 87 "ragel/XmlLoaderRagel.rl" | |
{ | |
strncpy(freightpercent, buffer, BUFSIZE); | |
buffer[0] = 0; | |
} | |
goto st92; | |
st92: | |
if ( ++p == pe ) | |
goto _test_eof92; | |
case 92: | |
#line 1095 "Generated/XmlLoaderRagel.m" | |
if ( (*p) == 102 ) | |
goto st93; | |
goto st0; | |
st93: | |
if ( ++p == pe ) | |
goto _test_eof93; | |
case 93: | |
if ( (*p) == 114 ) | |
goto st94; | |
goto st0; | |
st94: | |
if ( ++p == pe ) | |
goto _test_eof94; | |
case 94: | |
if ( (*p) == 111 ) | |
goto st95; | |
goto st0; | |
st95: | |
if ( ++p == pe ) | |
goto _test_eof95; | |
case 95: | |
if ( (*p) == 109 ) | |
goto st96; | |
goto st0; | |
st96: | |
if ( ++p == pe ) | |
goto _test_eof96; | |
case 96: | |
if ( (*p) == 99 ) | |
goto st97; | |
goto st0; | |
st97: | |
if ( ++p == pe ) | |
goto _test_eof97; | |
case 97: | |
if ( (*p) == 111 ) | |
goto st98; | |
goto st0; | |
st98: | |
if ( ++p == pe ) | |
goto _test_eof98; | |
case 98: | |
if ( (*p) == 117 ) | |
goto st99; | |
goto st0; | |
st99: | |
if ( ++p == pe ) | |
goto _test_eof99; | |
case 99: | |
if ( (*p) == 110 ) | |
goto st100; | |
goto st0; | |
st100: | |
if ( ++p == pe ) | |
goto _test_eof100; | |
case 100: | |
if ( (*p) == 116 ) | |
goto st101; | |
goto st0; | |
st101: | |
if ( ++p == pe ) | |
goto _test_eof101; | |
case 101: | |
if ( (*p) == 114 ) | |
goto st102; | |
goto st0; | |
st102: | |
if ( ++p == pe ) | |
goto _test_eof102; | |
case 102: | |
if ( (*p) == 121 ) | |
goto st103; | |
goto st0; | |
st103: | |
if ( ++p == pe ) | |
goto _test_eof103; | |
case 103: | |
switch( (*p) ) { | |
case 13: goto st103; | |
case 32: goto st103; | |
case 62: goto st104; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st103; | |
goto st0; | |
st104: | |
if ( ++p == pe ) | |
goto _test_eof104; | |
case 104: | |
switch( (*p) ) { | |
case 13: goto st104; | |
case 32: goto st104; | |
} | |
if ( (*p) > 10 ) { | |
if ( 65 <= (*p) && (*p) <= 90 ) | |
goto tr110; | |
} else if ( (*p) >= 9 ) | |
goto st104; | |
goto st0; | |
tr110: | |
#line 74 "ragel/XmlLoaderRagel.rl" | |
{ | |
start = p; | |
} | |
goto st105; | |
st105: | |
if ( ++p == pe ) | |
goto _test_eof105; | |
case 105: | |
#line 1205 "Generated/XmlLoaderRagel.m" | |
if ( 65 <= (*p) && (*p) <= 90 ) | |
goto st106; | |
goto st0; | |
st106: | |
if ( ++p == pe ) | |
goto _test_eof106; | |
case 106: | |
switch( (*p) ) { | |
case 13: goto tr112; | |
case 32: goto tr112; | |
case 60: goto tr113; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto tr112; | |
goto st0; | |
tr112: | |
#line 78 "ragel/XmlLoaderRagel.rl" | |
{ | |
char *endmark = (char*)p; | |
const char c = *endmark; | |
*endmark = '\0'; | |
strncpy(buffer, start, BUFSIZE); | |
*endmark = c; | |
start = NULL; | |
} | |
goto st107; | |
st107: | |
if ( ++p == pe ) | |
goto _test_eof107; | |
case 107: | |
#line 1236 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 13: goto st107; | |
case 32: goto st107; | |
case 60: goto st108; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st107; | |
goto st0; | |
tr113: | |
#line 78 "ragel/XmlLoaderRagel.rl" | |
{ | |
char *endmark = (char*)p; | |
const char c = *endmark; | |
*endmark = '\0'; | |
strncpy(buffer, start, BUFSIZE); | |
*endmark = c; | |
start = NULL; | |
} | |
goto st108; | |
st108: | |
if ( ++p == pe ) | |
goto _test_eof108; | |
case 108: | |
#line 1260 "Generated/XmlLoaderRagel.m" | |
if ( (*p) == 47 ) | |
goto st109; | |
goto st0; | |
st109: | |
if ( ++p == pe ) | |
goto _test_eof109; | |
case 109: | |
if ( (*p) == 102 ) | |
goto st110; | |
goto st0; | |
st110: | |
if ( ++p == pe ) | |
goto _test_eof110; | |
case 110: | |
if ( (*p) == 114 ) | |
goto st111; | |
goto st0; | |
st111: | |
if ( ++p == pe ) | |
goto _test_eof111; | |
case 111: | |
if ( (*p) == 111 ) | |
goto st112; | |
goto st0; | |
st112: | |
if ( ++p == pe ) | |
goto _test_eof112; | |
case 112: | |
if ( (*p) == 109 ) | |
goto st113; | |
goto st0; | |
st113: | |
if ( ++p == pe ) | |
goto _test_eof113; | |
case 113: | |
if ( (*p) == 99 ) | |
goto st114; | |
goto st0; | |
st114: | |
if ( ++p == pe ) | |
goto _test_eof114; | |
case 114: | |
if ( (*p) == 111 ) | |
goto st115; | |
goto st0; | |
st115: | |
if ( ++p == pe ) | |
goto _test_eof115; | |
case 115: | |
if ( (*p) == 117 ) | |
goto st116; | |
goto st0; | |
st116: | |
if ( ++p == pe ) | |
goto _test_eof116; | |
case 116: | |
if ( (*p) == 110 ) | |
goto st117; | |
goto st0; | |
st117: | |
if ( ++p == pe ) | |
goto _test_eof117; | |
case 117: | |
if ( (*p) == 116 ) | |
goto st118; | |
goto st0; | |
st118: | |
if ( ++p == pe ) | |
goto _test_eof118; | |
case 118: | |
if ( (*p) == 114 ) | |
goto st119; | |
goto st0; | |
st119: | |
if ( ++p == pe ) | |
goto _test_eof119; | |
case 119: | |
if ( (*p) == 121 ) | |
goto st120; | |
goto st0; | |
st120: | |
if ( ++p == pe ) | |
goto _test_eof120; | |
case 120: | |
switch( (*p) ) { | |
case 13: goto st120; | |
case 32: goto st120; | |
case 62: goto st121; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st120; | |
goto st0; | |
st121: | |
if ( ++p == pe ) | |
goto _test_eof121; | |
case 121: | |
switch( (*p) ) { | |
case 13: goto tr129; | |
case 32: goto tr129; | |
case 60: goto tr130; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto tr129; | |
goto st0; | |
tr129: | |
#line 92 "ragel/XmlLoaderRagel.rl" | |
{ | |
strncpy(fromcountry, buffer, BUFSIZE); | |
buffer[0] = 0; | |
} | |
goto st122; | |
st122: | |
if ( ++p == pe ) | |
goto _test_eof122; | |
case 122: | |
#line 1376 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 13: goto st122; | |
case 32: goto st122; | |
case 60: goto st123; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st122; | |
goto st0; | |
tr130: | |
#line 92 "ragel/XmlLoaderRagel.rl" | |
{ | |
strncpy(fromcountry, buffer, BUFSIZE); | |
buffer[0] = 0; | |
} | |
goto st123; | |
st123: | |
if ( ++p == pe ) | |
goto _test_eof123; | |
case 123: | |
#line 1396 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 114: goto st124; | |
case 116: goto st147; | |
} | |
goto st0; | |
st124: | |
if ( ++p == pe ) | |
goto _test_eof124; | |
case 124: | |
if ( (*p) == 101 ) | |
goto st125; | |
goto st0; | |
st125: | |
if ( ++p == pe ) | |
goto _test_eof125; | |
case 125: | |
if ( (*p) == 108 ) | |
goto st126; | |
goto st0; | |
st126: | |
if ( ++p == pe ) | |
goto _test_eof126; | |
case 126: | |
if ( (*p) == 101 ) | |
goto st127; | |
goto st0; | |
st127: | |
if ( ++p == pe ) | |
goto _test_eof127; | |
case 127: | |
if ( (*p) == 118 ) | |
goto st128; | |
goto st0; | |
st128: | |
if ( ++p == pe ) | |
goto _test_eof128; | |
case 128: | |
if ( (*p) == 97 ) | |
goto st129; | |
goto st0; | |
st129: | |
if ( ++p == pe ) | |
goto _test_eof129; | |
case 129: | |
if ( (*p) == 110 ) | |
goto st130; | |
goto st0; | |
st130: | |
if ( ++p == pe ) | |
goto _test_eof130; | |
case 130: | |
if ( (*p) == 99 ) | |
goto st131; | |
goto st0; | |
st131: | |
if ( ++p == pe ) | |
goto _test_eof131; | |
case 131: | |
if ( (*p) == 101 ) | |
goto st132; | |
goto st0; | |
st132: | |
if ( ++p == pe ) | |
goto _test_eof132; | |
case 132: | |
switch( (*p) ) { | |
case 13: goto st132; | |
case 32: goto st132; | |
case 62: goto st133; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st132; | |
goto st0; | |
st133: | |
if ( ++p == pe ) | |
goto _test_eof133; | |
case 133: | |
switch( (*p) ) { | |
case 13: goto st133; | |
case 45: goto st133; | |
case 60: goto st134; | |
} | |
if ( (*p) < 48 ) { | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st133; | |
} else if ( (*p) > 57 ) { | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st133; | |
} else if ( (*p) >= 65 ) | |
goto st133; | |
} else | |
goto st133; | |
goto st0; | |
st134: | |
if ( ++p == pe ) | |
goto _test_eof134; | |
case 134: | |
if ( (*p) == 47 ) | |
goto st135; | |
goto st0; | |
st135: | |
if ( ++p == pe ) | |
goto _test_eof135; | |
case 135: | |
if ( (*p) == 114 ) | |
goto st136; | |
goto st0; | |
st136: | |
if ( ++p == pe ) | |
goto _test_eof136; | |
case 136: | |
if ( (*p) == 101 ) | |
goto st137; | |
goto st0; | |
st137: | |
if ( ++p == pe ) | |
goto _test_eof137; | |
case 137: | |
if ( (*p) == 108 ) | |
goto st138; | |
goto st0; | |
st138: | |
if ( ++p == pe ) | |
goto _test_eof138; | |
case 138: | |
if ( (*p) == 101 ) | |
goto st139; | |
goto st0; | |
st139: | |
if ( ++p == pe ) | |
goto _test_eof139; | |
case 139: | |
if ( (*p) == 118 ) | |
goto st140; | |
goto st0; | |
st140: | |
if ( ++p == pe ) | |
goto _test_eof140; | |
case 140: | |
if ( (*p) == 97 ) | |
goto st141; | |
goto st0; | |
st141: | |
if ( ++p == pe ) | |
goto _test_eof141; | |
case 141: | |
if ( (*p) == 110 ) | |
goto st142; | |
goto st0; | |
st142: | |
if ( ++p == pe ) | |
goto _test_eof142; | |
case 142: | |
if ( (*p) == 99 ) | |
goto st143; | |
goto st0; | |
st143: | |
if ( ++p == pe ) | |
goto _test_eof143; | |
case 143: | |
if ( (*p) == 101 ) | |
goto st144; | |
goto st0; | |
st144: | |
if ( ++p == pe ) | |
goto _test_eof144; | |
case 144: | |
switch( (*p) ) { | |
case 13: goto st144; | |
case 32: goto st144; | |
case 62: goto st145; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st144; | |
goto st0; | |
st145: | |
if ( ++p == pe ) | |
goto _test_eof145; | |
case 145: | |
switch( (*p) ) { | |
case 13: goto st145; | |
case 32: goto st145; | |
case 60: goto st146; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st145; | |
goto st0; | |
st146: | |
if ( ++p == pe ) | |
goto _test_eof146; | |
case 146: | |
if ( (*p) == 116 ) | |
goto st147; | |
goto st0; | |
st147: | |
if ( ++p == pe ) | |
goto _test_eof147; | |
case 147: | |
if ( (*p) == 111 ) | |
goto st148; | |
goto st0; | |
st148: | |
if ( ++p == pe ) | |
goto _test_eof148; | |
case 148: | |
if ( (*p) == 99 ) | |
goto st149; | |
goto st0; | |
st149: | |
if ( ++p == pe ) | |
goto _test_eof149; | |
case 149: | |
if ( (*p) == 111 ) | |
goto st150; | |
goto st0; | |
st150: | |
if ( ++p == pe ) | |
goto _test_eof150; | |
case 150: | |
if ( (*p) == 117 ) | |
goto st151; | |
goto st0; | |
st151: | |
if ( ++p == pe ) | |
goto _test_eof151; | |
case 151: | |
if ( (*p) == 110 ) | |
goto st152; | |
goto st0; | |
st152: | |
if ( ++p == pe ) | |
goto _test_eof152; | |
case 152: | |
if ( (*p) == 116 ) | |
goto st153; | |
goto st0; | |
st153: | |
if ( ++p == pe ) | |
goto _test_eof153; | |
case 153: | |
if ( (*p) == 114 ) | |
goto st154; | |
goto st0; | |
st154: | |
if ( ++p == pe ) | |
goto _test_eof154; | |
case 154: | |
if ( (*p) == 121 ) | |
goto st155; | |
goto st0; | |
st155: | |
if ( ++p == pe ) | |
goto _test_eof155; | |
case 155: | |
switch( (*p) ) { | |
case 13: goto st155; | |
case 32: goto st155; | |
case 62: goto st156; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st155; | |
goto st0; | |
st156: | |
if ( ++p == pe ) | |
goto _test_eof156; | |
case 156: | |
switch( (*p) ) { | |
case 13: goto st156; | |
case 32: goto st156; | |
} | |
if ( (*p) > 10 ) { | |
if ( 65 <= (*p) && (*p) <= 90 ) | |
goto tr166; | |
} else if ( (*p) >= 9 ) | |
goto st156; | |
goto st0; | |
tr166: | |
#line 74 "ragel/XmlLoaderRagel.rl" | |
{ | |
start = p; | |
} | |
goto st157; | |
st157: | |
if ( ++p == pe ) | |
goto _test_eof157; | |
case 157: | |
#line 1684 "Generated/XmlLoaderRagel.m" | |
if ( 65 <= (*p) && (*p) <= 90 ) | |
goto st158; | |
goto st0; | |
st158: | |
if ( ++p == pe ) | |
goto _test_eof158; | |
case 158: | |
switch( (*p) ) { | |
case 13: goto tr168; | |
case 32: goto tr168; | |
case 60: goto tr169; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto tr168; | |
goto st0; | |
tr168: | |
#line 78 "ragel/XmlLoaderRagel.rl" | |
{ | |
char *endmark = (char*)p; | |
const char c = *endmark; | |
*endmark = '\0'; | |
strncpy(buffer, start, BUFSIZE); | |
*endmark = c; | |
start = NULL; | |
} | |
goto st159; | |
st159: | |
if ( ++p == pe ) | |
goto _test_eof159; | |
case 159: | |
#line 1715 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 13: goto st159; | |
case 32: goto st159; | |
case 60: goto st160; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st159; | |
goto st0; | |
tr169: | |
#line 78 "ragel/XmlLoaderRagel.rl" | |
{ | |
char *endmark = (char*)p; | |
const char c = *endmark; | |
*endmark = '\0'; | |
strncpy(buffer, start, BUFSIZE); | |
*endmark = c; | |
start = NULL; | |
} | |
goto st160; | |
st160: | |
if ( ++p == pe ) | |
goto _test_eof160; | |
case 160: | |
#line 1739 "Generated/XmlLoaderRagel.m" | |
if ( (*p) == 47 ) | |
goto st161; | |
goto st0; | |
st161: | |
if ( ++p == pe ) | |
goto _test_eof161; | |
case 161: | |
if ( (*p) == 116 ) | |
goto st162; | |
goto st0; | |
st162: | |
if ( ++p == pe ) | |
goto _test_eof162; | |
case 162: | |
if ( (*p) == 111 ) | |
goto st163; | |
goto st0; | |
st163: | |
if ( ++p == pe ) | |
goto _test_eof163; | |
case 163: | |
if ( (*p) == 99 ) | |
goto st164; | |
goto st0; | |
st164: | |
if ( ++p == pe ) | |
goto _test_eof164; | |
case 164: | |
if ( (*p) == 111 ) | |
goto st165; | |
goto st0; | |
st165: | |
if ( ++p == pe ) | |
goto _test_eof165; | |
case 165: | |
if ( (*p) == 117 ) | |
goto st166; | |
goto st0; | |
st166: | |
if ( ++p == pe ) | |
goto _test_eof166; | |
case 166: | |
if ( (*p) == 110 ) | |
goto st167; | |
goto st0; | |
st167: | |
if ( ++p == pe ) | |
goto _test_eof167; | |
case 167: | |
if ( (*p) == 116 ) | |
goto st168; | |
goto st0; | |
st168: | |
if ( ++p == pe ) | |
goto _test_eof168; | |
case 168: | |
if ( (*p) == 114 ) | |
goto st169; | |
goto st0; | |
st169: | |
if ( ++p == pe ) | |
goto _test_eof169; | |
case 169: | |
if ( (*p) == 121 ) | |
goto st170; | |
goto st0; | |
st170: | |
if ( ++p == pe ) | |
goto _test_eof170; | |
case 170: | |
switch( (*p) ) { | |
case 13: goto st170; | |
case 32: goto st170; | |
case 62: goto st171; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st170; | |
goto st0; | |
st171: | |
if ( ++p == pe ) | |
goto _test_eof171; | |
case 171: | |
switch( (*p) ) { | |
case 13: goto tr183; | |
case 32: goto tr183; | |
case 60: goto tr184; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto tr183; | |
goto st0; | |
tr183: | |
#line 97 "ragel/XmlLoaderRagel.rl" | |
{ | |
strncpy(tocountry, buffer, BUFSIZE); | |
buffer[0] = 0; | |
} | |
goto st172; | |
st172: | |
if ( ++p == pe ) | |
goto _test_eof172; | |
case 172: | |
#line 1841 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 13: goto st172; | |
case 32: goto st172; | |
case 60: goto st173; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st172; | |
goto st0; | |
tr184: | |
#line 97 "ragel/XmlLoaderRagel.rl" | |
{ | |
strncpy(tocountry, buffer, BUFSIZE); | |
buffer[0] = 0; | |
} | |
goto st173; | |
st173: | |
if ( ++p == pe ) | |
goto _test_eof173; | |
case 173: | |
#line 1861 "Generated/XmlLoaderRagel.m" | |
switch( (*p) ) { | |
case 47: goto st174; | |
case 118: goto st179; | |
} | |
goto st0; | |
st174: | |
if ( ++p == pe ) | |
goto _test_eof174; | |
case 174: | |
if ( (*p) == 114 ) | |
goto st175; | |
goto st0; | |
st175: | |
if ( ++p == pe ) | |
goto _test_eof175; | |
case 175: | |
if ( (*p) == 111 ) | |
goto st176; | |
goto st0; | |
st176: | |
if ( ++p == pe ) | |
goto _test_eof176; | |
case 176: | |
if ( (*p) == 119 ) | |
goto st177; | |
goto st0; | |
st177: | |
if ( ++p == pe ) | |
goto _test_eof177; | |
case 177: | |
switch( (*p) ) { | |
case 13: goto st177; | |
case 32: goto st177; | |
case 62: goto st178; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st177; | |
goto st0; | |
st178: | |
if ( ++p == pe ) | |
goto _test_eof178; | |
case 178: | |
switch( (*p) ) { | |
case 13: goto tr193; | |
case 32: goto tr193; | |
case 60: goto tr194; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto tr193; | |
goto st0; | |
st179: | |
if ( ++p == pe ) | |
goto _test_eof179; | |
case 179: | |
if ( (*p) == 101 ) | |
goto st180; | |
goto st0; | |
st180: | |
if ( ++p == pe ) | |
goto _test_eof180; | |
case 180: | |
if ( (*p) == 104 ) | |
goto st181; | |
goto st0; | |
st181: | |
if ( ++p == pe ) | |
goto _test_eof181; | |
case 181: | |
if ( (*p) == 105 ) | |
goto st182; | |
goto st0; | |
st182: | |
if ( ++p == pe ) | |
goto _test_eof182; | |
case 182: | |
if ( (*p) == 99 ) | |
goto st183; | |
goto st0; | |
st183: | |
if ( ++p == pe ) | |
goto _test_eof183; | |
case 183: | |
if ( (*p) == 108 ) | |
goto st184; | |
goto st0; | |
st184: | |
if ( ++p == pe ) | |
goto _test_eof184; | |
case 184: | |
if ( (*p) == 101 ) | |
goto st185; | |
goto st0; | |
st185: | |
if ( ++p == pe ) | |
goto _test_eof185; | |
case 185: | |
if ( (*p) == 112 ) | |
goto st186; | |
goto st0; | |
st186: | |
if ( ++p == pe ) | |
goto _test_eof186; | |
case 186: | |
if ( (*p) == 101 ) | |
goto st187; | |
goto st0; | |
st187: | |
if ( ++p == pe ) | |
goto _test_eof187; | |
case 187: | |
if ( (*p) == 114 ) | |
goto st188; | |
goto st0; | |
st188: | |
if ( ++p == pe ) | |
goto _test_eof188; | |
case 188: | |
if ( (*p) == 99 ) | |
goto st189; | |
goto st0; | |
st189: | |
if ( ++p == pe ) | |
goto _test_eof189; | |
case 189: | |
if ( (*p) == 101 ) | |
goto st190; | |
goto st0; | |
st190: | |
if ( ++p == pe ) | |
goto _test_eof190; | |
case 190: | |
if ( (*p) == 110 ) | |
goto st191; | |
goto st0; | |
st191: | |
if ( ++p == pe ) | |
goto _test_eof191; | |
case 191: | |
if ( (*p) == 116 ) | |
goto st192; | |
goto st0; | |
st192: | |
if ( ++p == pe ) | |
goto _test_eof192; | |
case 192: | |
switch( (*p) ) { | |
case 13: goto st192; | |
case 32: goto st192; | |
case 62: goto st193; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st192; | |
goto st0; | |
st193: | |
if ( ++p == pe ) | |
goto _test_eof193; | |
case 193: | |
switch( (*p) ) { | |
case 13: goto st193; | |
case 45: goto st193; | |
case 60: goto st194; | |
} | |
if ( (*p) < 48 ) { | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st193; | |
} else if ( (*p) > 57 ) { | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st193; | |
} else if ( (*p) >= 65 ) | |
goto st193; | |
} else | |
goto st193; | |
goto st0; | |
st194: | |
if ( ++p == pe ) | |
goto _test_eof194; | |
case 194: | |
if ( (*p) == 47 ) | |
goto st195; | |
goto st0; | |
st195: | |
if ( ++p == pe ) | |
goto _test_eof195; | |
case 195: | |
if ( (*p) == 118 ) | |
goto st196; | |
goto st0; | |
st196: | |
if ( ++p == pe ) | |
goto _test_eof196; | |
case 196: | |
if ( (*p) == 101 ) | |
goto st197; | |
goto st0; | |
st197: | |
if ( ++p == pe ) | |
goto _test_eof197; | |
case 197: | |
if ( (*p) == 104 ) | |
goto st198; | |
goto st0; | |
st198: | |
if ( ++p == pe ) | |
goto _test_eof198; | |
case 198: | |
if ( (*p) == 105 ) | |
goto st199; | |
goto st0; | |
st199: | |
if ( ++p == pe ) | |
goto _test_eof199; | |
case 199: | |
if ( (*p) == 99 ) | |
goto st200; | |
goto st0; | |
st200: | |
if ( ++p == pe ) | |
goto _test_eof200; | |
case 200: | |
if ( (*p) == 108 ) | |
goto st201; | |
goto st0; | |
st201: | |
if ( ++p == pe ) | |
goto _test_eof201; | |
case 201: | |
if ( (*p) == 101 ) | |
goto st202; | |
goto st0; | |
st202: | |
if ( ++p == pe ) | |
goto _test_eof202; | |
case 202: | |
if ( (*p) == 112 ) | |
goto st203; | |
goto st0; | |
st203: | |
if ( ++p == pe ) | |
goto _test_eof203; | |
case 203: | |
if ( (*p) == 101 ) | |
goto st204; | |
goto st0; | |
st204: | |
if ( ++p == pe ) | |
goto _test_eof204; | |
case 204: | |
if ( (*p) == 114 ) | |
goto st205; | |
goto st0; | |
st205: | |
if ( ++p == pe ) | |
goto _test_eof205; | |
case 205: | |
if ( (*p) == 99 ) | |
goto st206; | |
goto st0; | |
st206: | |
if ( ++p == pe ) | |
goto _test_eof206; | |
case 206: | |
if ( (*p) == 101 ) | |
goto st207; | |
goto st0; | |
st207: | |
if ( ++p == pe ) | |
goto _test_eof207; | |
case 207: | |
if ( (*p) == 110 ) | |
goto st208; | |
goto st0; | |
st208: | |
if ( ++p == pe ) | |
goto _test_eof208; | |
case 208: | |
if ( (*p) == 116 ) | |
goto st209; | |
goto st0; | |
st209: | |
if ( ++p == pe ) | |
goto _test_eof209; | |
case 209: | |
switch( (*p) ) { | |
case 13: goto st209; | |
case 32: goto st209; | |
case 62: goto st210; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st209; | |
goto st0; | |
st210: | |
if ( ++p == pe ) | |
goto _test_eof210; | |
case 210: | |
switch( (*p) ) { | |
case 13: goto st210; | |
case 32: goto st210; | |
case 60: goto st211; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st210; | |
goto st0; | |
st211: | |
if ( ++p == pe ) | |
goto _test_eof211; | |
case 211: | |
if ( (*p) == 47 ) | |
goto st174; | |
goto st0; | |
st212: | |
if ( ++p == pe ) | |
goto _test_eof212; | |
case 212: | |
switch( (*p) ) { | |
case 33: goto st4; | |
case 63: goto st213; | |
case 113: goto st9; | |
} | |
goto st0; | |
st213: | |
if ( ++p == pe ) | |
goto _test_eof213; | |
case 213: | |
if ( (*p) == 120 ) | |
goto st214; | |
goto st0; | |
st214: | |
if ( ++p == pe ) | |
goto _test_eof214; | |
case 214: | |
if ( (*p) == 109 ) | |
goto st215; | |
goto st0; | |
st215: | |
if ( ++p == pe ) | |
goto _test_eof215; | |
case 215: | |
if ( (*p) == 108 ) | |
goto st216; | |
goto st0; | |
st216: | |
if ( ++p == pe ) | |
goto _test_eof216; | |
case 216: | |
switch( (*p) ) { | |
case 13: goto st217; | |
case 32: goto st217; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st217; | |
goto st0; | |
st217: | |
if ( ++p == pe ) | |
goto _test_eof217; | |
case 217: | |
switch( (*p) ) { | |
case 13: goto st217; | |
case 32: goto st217; | |
case 118: goto st218; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st217; | |
goto st0; | |
st218: | |
if ( ++p == pe ) | |
goto _test_eof218; | |
case 218: | |
if ( (*p) == 101 ) | |
goto st219; | |
goto st0; | |
st219: | |
if ( ++p == pe ) | |
goto _test_eof219; | |
case 219: | |
if ( (*p) == 114 ) | |
goto st220; | |
goto st0; | |
st220: | |
if ( ++p == pe ) | |
goto _test_eof220; | |
case 220: | |
if ( (*p) == 115 ) | |
goto st221; | |
goto st0; | |
st221: | |
if ( ++p == pe ) | |
goto _test_eof221; | |
case 221: | |
if ( (*p) == 105 ) | |
goto st222; | |
goto st0; | |
st222: | |
if ( ++p == pe ) | |
goto _test_eof222; | |
case 222: | |
if ( (*p) == 111 ) | |
goto st223; | |
goto st0; | |
st223: | |
if ( ++p == pe ) | |
goto _test_eof223; | |
case 223: | |
if ( (*p) == 110 ) | |
goto st224; | |
goto st0; | |
st224: | |
if ( ++p == pe ) | |
goto _test_eof224; | |
case 224: | |
switch( (*p) ) { | |
case 13: goto st224; | |
case 32: goto st224; | |
case 61: goto st225; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st224; | |
goto st0; | |
st225: | |
if ( ++p == pe ) | |
goto _test_eof225; | |
case 225: | |
switch( (*p) ) { | |
case 13: goto st225; | |
case 32: goto st225; | |
case 34: goto st226; | |
case 39: goto st269; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st225; | |
goto st0; | |
st226: | |
if ( ++p == pe ) | |
goto _test_eof226; | |
case 226: | |
if ( (*p) == 49 ) | |
goto st227; | |
goto st0; | |
st227: | |
if ( ++p == pe ) | |
goto _test_eof227; | |
case 227: | |
if ( (*p) == 46 ) | |
goto st228; | |
goto st0; | |
st228: | |
if ( ++p == pe ) | |
goto _test_eof228; | |
case 228: | |
if ( 48 <= (*p) && (*p) <= 57 ) | |
goto st229; | |
goto st0; | |
st229: | |
if ( ++p == pe ) | |
goto _test_eof229; | |
case 229: | |
if ( (*p) == 34 ) | |
goto st230; | |
if ( 48 <= (*p) && (*p) <= 57 ) | |
goto st229; | |
goto st0; | |
st230: | |
if ( ++p == pe ) | |
goto _test_eof230; | |
case 230: | |
switch( (*p) ) { | |
case 13: goto st231; | |
case 32: goto st231; | |
case 63: goto st8; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st231; | |
goto st0; | |
st231: | |
if ( ++p == pe ) | |
goto _test_eof231; | |
case 231: | |
switch( (*p) ) { | |
case 13: goto st231; | |
case 32: goto st231; | |
case 63: goto st8; | |
case 101: goto st232; | |
case 115: goto st245; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st231; | |
goto st0; | |
st232: | |
if ( ++p == pe ) | |
goto _test_eof232; | |
case 232: | |
if ( (*p) == 110 ) | |
goto st233; | |
goto st0; | |
st233: | |
if ( ++p == pe ) | |
goto _test_eof233; | |
case 233: | |
if ( (*p) == 99 ) | |
goto st234; | |
goto st0; | |
st234: | |
if ( ++p == pe ) | |
goto _test_eof234; | |
case 234: | |
if ( (*p) == 111 ) | |
goto st235; | |
goto st0; | |
st235: | |
if ( ++p == pe ) | |
goto _test_eof235; | |
case 235: | |
if ( (*p) == 100 ) | |
goto st236; | |
goto st0; | |
st236: | |
if ( ++p == pe ) | |
goto _test_eof236; | |
case 236: | |
if ( (*p) == 105 ) | |
goto st237; | |
goto st0; | |
st237: | |
if ( ++p == pe ) | |
goto _test_eof237; | |
case 237: | |
if ( (*p) == 110 ) | |
goto st238; | |
goto st0; | |
st238: | |
if ( ++p == pe ) | |
goto _test_eof238; | |
case 238: | |
if ( (*p) == 103 ) | |
goto st239; | |
goto st0; | |
st239: | |
if ( ++p == pe ) | |
goto _test_eof239; | |
case 239: | |
switch( (*p) ) { | |
case 13: goto st239; | |
case 32: goto st239; | |
case 61: goto st240; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st239; | |
goto st0; | |
st240: | |
if ( ++p == pe ) | |
goto _test_eof240; | |
case 240: | |
switch( (*p) ) { | |
case 13: goto st240; | |
case 32: goto st240; | |
case 34: goto st241; | |
case 39: goto st267; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st240; | |
goto st0; | |
st241: | |
if ( ++p == pe ) | |
goto _test_eof241; | |
case 241: | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st242; | |
} else if ( (*p) >= 65 ) | |
goto st242; | |
goto st0; | |
st242: | |
if ( ++p == pe ) | |
goto _test_eof242; | |
case 242: | |
switch( (*p) ) { | |
case 34: goto st243; | |
case 95: goto st242; | |
} | |
if ( (*p) < 48 ) { | |
if ( 45 <= (*p) && (*p) <= 46 ) | |
goto st242; | |
} else if ( (*p) > 57 ) { | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st242; | |
} else if ( (*p) >= 65 ) | |
goto st242; | |
} else | |
goto st242; | |
goto st0; | |
st243: | |
if ( ++p == pe ) | |
goto _test_eof243; | |
case 243: | |
switch( (*p) ) { | |
case 13: goto st244; | |
case 32: goto st244; | |
case 63: goto st8; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st244; | |
goto st0; | |
st244: | |
if ( ++p == pe ) | |
goto _test_eof244; | |
case 244: | |
switch( (*p) ) { | |
case 13: goto st244; | |
case 32: goto st244; | |
case 63: goto st8; | |
case 115: goto st245; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st244; | |
goto st0; | |
st245: | |
if ( ++p == pe ) | |
goto _test_eof245; | |
case 245: | |
if ( (*p) == 116 ) | |
goto st246; | |
goto st0; | |
st246: | |
if ( ++p == pe ) | |
goto _test_eof246; | |
case 246: | |
if ( (*p) == 97 ) | |
goto st247; | |
goto st0; | |
st247: | |
if ( ++p == pe ) | |
goto _test_eof247; | |
case 247: | |
if ( (*p) == 110 ) | |
goto st248; | |
goto st0; | |
st248: | |
if ( ++p == pe ) | |
goto _test_eof248; | |
case 248: | |
if ( (*p) == 100 ) | |
goto st249; | |
goto st0; | |
st249: | |
if ( ++p == pe ) | |
goto _test_eof249; | |
case 249: | |
if ( (*p) == 97 ) | |
goto st250; | |
goto st0; | |
st250: | |
if ( ++p == pe ) | |
goto _test_eof250; | |
case 250: | |
if ( (*p) == 108 ) | |
goto st251; | |
goto st0; | |
st251: | |
if ( ++p == pe ) | |
goto _test_eof251; | |
case 251: | |
if ( (*p) == 111 ) | |
goto st252; | |
goto st0; | |
st252: | |
if ( ++p == pe ) | |
goto _test_eof252; | |
case 252: | |
if ( (*p) == 110 ) | |
goto st253; | |
goto st0; | |
st253: | |
if ( ++p == pe ) | |
goto _test_eof253; | |
case 253: | |
if ( (*p) == 101 ) | |
goto st254; | |
goto st0; | |
st254: | |
if ( ++p == pe ) | |
goto _test_eof254; | |
case 254: | |
switch( (*p) ) { | |
case 13: goto st254; | |
case 32: goto st254; | |
case 61: goto st255; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st254; | |
goto st0; | |
st255: | |
if ( ++p == pe ) | |
goto _test_eof255; | |
case 255: | |
switch( (*p) ) { | |
case 13: goto st255; | |
case 32: goto st255; | |
case 34: goto st256; | |
case 39: goto st262; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st255; | |
goto st0; | |
st256: | |
if ( ++p == pe ) | |
goto _test_eof256; | |
case 256: | |
switch( (*p) ) { | |
case 110: goto st257; | |
case 121: goto st260; | |
} | |
goto st0; | |
st257: | |
if ( ++p == pe ) | |
goto _test_eof257; | |
case 257: | |
if ( (*p) == 111 ) | |
goto st258; | |
goto st0; | |
st258: | |
if ( ++p == pe ) | |
goto _test_eof258; | |
case 258: | |
if ( (*p) == 34 ) | |
goto st259; | |
goto st0; | |
st259: | |
if ( ++p == pe ) | |
goto _test_eof259; | |
case 259: | |
switch( (*p) ) { | |
case 13: goto st259; | |
case 32: goto st259; | |
case 63: goto st8; | |
} | |
if ( 9 <= (*p) && (*p) <= 10 ) | |
goto st259; | |
goto st0; | |
st260: | |
if ( ++p == pe ) | |
goto _test_eof260; | |
case 260: | |
if ( (*p) == 101 ) | |
goto st261; | |
goto st0; | |
st261: | |
if ( ++p == pe ) | |
goto _test_eof261; | |
case 261: | |
if ( (*p) == 115 ) | |
goto st258; | |
goto st0; | |
st262: | |
if ( ++p == pe ) | |
goto _test_eof262; | |
case 262: | |
switch( (*p) ) { | |
case 110: goto st263; | |
case 121: goto st265; | |
} | |
goto st0; | |
st263: | |
if ( ++p == pe ) | |
goto _test_eof263; | |
case 263: | |
if ( (*p) == 111 ) | |
goto st264; | |
goto st0; | |
st264: | |
if ( ++p == pe ) | |
goto _test_eof264; | |
case 264: | |
if ( (*p) == 39 ) | |
goto st259; | |
goto st0; | |
st265: | |
if ( ++p == pe ) | |
goto _test_eof265; | |
case 265: | |
if ( (*p) == 101 ) | |
goto st266; | |
goto st0; | |
st266: | |
if ( ++p == pe ) | |
goto _test_eof266; | |
case 266: | |
if ( (*p) == 115 ) | |
goto st264; | |
goto st0; | |
st267: | |
if ( ++p == pe ) | |
goto _test_eof267; | |
case 267: | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st268; | |
} else if ( (*p) >= 65 ) | |
goto st268; | |
goto st0; | |
st268: | |
if ( ++p == pe ) | |
goto _test_eof268; | |
case 268: | |
switch( (*p) ) { | |
case 39: goto st243; | |
case 95: goto st268; | |
} | |
if ( (*p) < 48 ) { | |
if ( 45 <= (*p) && (*p) <= 46 ) | |
goto st268; | |
} else if ( (*p) > 57 ) { | |
if ( (*p) > 90 ) { | |
if ( 97 <= (*p) && (*p) <= 122 ) | |
goto st268; | |
} else if ( (*p) >= 65 ) | |
goto st268; | |
} else | |
goto st268; | |
goto st0; | |
st269: | |
if ( ++p == pe ) | |
goto _test_eof269; | |
case 269: | |
if ( (*p) == 49 ) | |
goto st270; | |
goto st0; | |
st270: | |
if ( ++p == pe ) | |
goto _test_eof270; | |
case 270: | |
if ( (*p) == 46 ) | |
goto st271; | |
goto st0; | |
st271: | |
if ( ++p == pe ) | |
goto _test_eof271; | |
case 271: | |
if ( 48 <= (*p) && (*p) <= 57 ) | |
goto st272; | |
goto st0; | |
st272: | |
if ( ++p == pe ) | |
goto _test_eof272; | |
case 272: | |
if ( (*p) == 39 ) | |
goto st230; | |
if ( 48 <= (*p) && (*p) <= 57 ) | |
goto st272; | |
goto st0; | |
} | |
_test_eof2: cs = 2; goto _test_eof; | |
_test_eof3: cs = 3; goto _test_eof; | |
_test_eof4: cs = 4; goto _test_eof; | |
_test_eof5: cs = 5; goto _test_eof; | |
_test_eof6: cs = 6; goto _test_eof; | |
_test_eof7: cs = 7; goto _test_eof; | |
_test_eof8: cs = 8; goto _test_eof; | |
_test_eof9: cs = 9; goto _test_eof; | |
_test_eof10: cs = 10; goto _test_eof; | |
_test_eof11: cs = 11; goto _test_eof; | |
_test_eof12: cs = 12; goto _test_eof; | |
_test_eof13: cs = 13; goto _test_eof; | |
_test_eof14: cs = 14; goto _test_eof; | |
_test_eof15: cs = 15; goto _test_eof; | |
_test_eof16: cs = 16; goto _test_eof; | |
_test_eof17: cs = 17; goto _test_eof; | |
_test_eof18: cs = 18; goto _test_eof; | |
_test_eof19: cs = 19; goto _test_eof; | |
_test_eof20: cs = 20; goto _test_eof; | |
_test_eof21: cs = 21; goto _test_eof; | |
_test_eof22: cs = 22; goto _test_eof; | |
_test_eof23: cs = 23; goto _test_eof; | |
_test_eof24: cs = 24; goto _test_eof; | |
_test_eof25: cs = 25; goto _test_eof; | |
_test_eof26: cs = 26; goto _test_eof; | |
_test_eof27: cs = 27; goto _test_eof; | |
_test_eof273: cs = 273; goto _test_eof; | |
_test_eof28: cs = 28; goto _test_eof; | |
_test_eof29: cs = 29; goto _test_eof; | |
_test_eof30: cs = 30; goto _test_eof; | |
_test_eof31: cs = 31; goto _test_eof; | |
_test_eof32: cs = 32; goto _test_eof; | |
_test_eof33: cs = 33; goto _test_eof; | |
_test_eof34: cs = 34; goto _test_eof; | |
_test_eof35: cs = 35; goto _test_eof; | |
_test_eof36: cs = 36; goto _test_eof; | |
_test_eof37: cs = 37; goto _test_eof; | |
_test_eof38: cs = 38; goto _test_eof; | |
_test_eof39: cs = 39; goto _test_eof; | |
_test_eof40: cs = 40; goto _test_eof; | |
_test_eof41: cs = 41; goto _test_eof; | |
_test_eof42: cs = 42; goto _test_eof; | |
_test_eof43: cs = 43; goto _test_eof; | |
_test_eof44: cs = 44; goto _test_eof; | |
_test_eof45: cs = 45; goto _test_eof; | |
_test_eof46: cs = 46; goto _test_eof; | |
_test_eof47: cs = 47; goto _test_eof; | |
_test_eof48: cs = 48; goto _test_eof; | |
_test_eof49: cs = 49; goto _test_eof; | |
_test_eof50: cs = 50; goto _test_eof; | |
_test_eof51: cs = 51; goto _test_eof; | |
_test_eof52: cs = 52; goto _test_eof; | |
_test_eof53: cs = 53; goto _test_eof; | |
_test_eof54: cs = 54; goto _test_eof; | |
_test_eof55: cs = 55; goto _test_eof; | |
_test_eof56: cs = 56; goto _test_eof; | |
_test_eof57: cs = 57; goto _test_eof; | |
_test_eof58: cs = 58; goto _test_eof; | |
_test_eof59: cs = 59; goto _test_eof; | |
_test_eof60: cs = 60; goto _test_eof; | |
_test_eof61: cs = 61; goto _test_eof; | |
_test_eof62: cs = 62; goto _test_eof; | |
_test_eof63: cs = 63; goto _test_eof; | |
_test_eof64: cs = 64; goto _test_eof; | |
_test_eof65: cs = 65; goto _test_eof; | |
_test_eof66: cs = 66; goto _test_eof; | |
_test_eof67: cs = 67; goto _test_eof; | |
_test_eof68: cs = 68; goto _test_eof; | |
_test_eof69: cs = 69; goto _test_eof; | |
_test_eof70: cs = 70; goto _test_eof; | |
_test_eof71: cs = 71; goto _test_eof; | |
_test_eof72: cs = 72; goto _test_eof; | |
_test_eof73: cs = 73; goto _test_eof; | |
_test_eof74: cs = 74; goto _test_eof; | |
_test_eof75: cs = 75; goto _test_eof; | |
_test_eof76: cs = 76; goto _test_eof; | |
_test_eof77: cs = 77; goto _test_eof; | |
_test_eof78: cs = 78; goto _test_eof; | |
_test_eof79: cs = 79; goto _test_eof; | |
_test_eof80: cs = 80; goto _test_eof; | |
_test_eof81: cs = 81; goto _test_eof; | |
_test_eof82: cs = 82; goto _test_eof; | |
_test_eof83: cs = 83; goto _test_eof; | |
_test_eof84: cs = 84; goto _test_eof; | |
_test_eof85: cs = 85; goto _test_eof; | |
_test_eof86: cs = 86; goto _test_eof; | |
_test_eof87: cs = 87; goto _test_eof; | |
_test_eof88: cs = 88; goto _test_eof; | |
_test_eof89: cs = 89; goto _test_eof; | |
_test_eof90: cs = 90; goto _test_eof; | |
_test_eof91: cs = 91; goto _test_eof; | |
_test_eof92: cs = 92; goto _test_eof; | |
_test_eof93: cs = 93; goto _test_eof; | |
_test_eof94: cs = 94; goto _test_eof; | |
_test_eof95: cs = 95; goto _test_eof; | |
_test_eof96: cs = 96; goto _test_eof; | |
_test_eof97: cs = 97; goto _test_eof; | |
_test_eof98: cs = 98; goto _test_eof; | |
_test_eof99: cs = 99; goto _test_eof; | |
_test_eof100: cs = 100; goto _test_eof; | |
_test_eof101: cs = 101; goto _test_eof; | |
_test_eof102: cs = 102; goto _test_eof; | |
_test_eof103: cs = 103; goto _test_eof; | |
_test_eof104: cs = 104; goto _test_eof; | |
_test_eof105: cs = 105; goto _test_eof; | |
_test_eof106: cs = 106; goto _test_eof; | |
_test_eof107: cs = 107; goto _test_eof; | |
_test_eof108: cs = 108; goto _test_eof; | |
_test_eof109: cs = 109; goto _test_eof; | |
_test_eof110: cs = 110; goto _test_eof; | |
_test_eof111: cs = 111; goto _test_eof; | |
_test_eof112: cs = 112; goto _test_eof; | |
_test_eof113: cs = 113; goto _test_eof; | |
_test_eof114: cs = 114; goto _test_eof; | |
_test_eof115: cs = 115; goto _test_eof; | |
_test_eof116: cs = 116; goto _test_eof; | |
_test_eof117: cs = 117; goto _test_eof; | |
_test_eof118: cs = 118; goto _test_eof; | |
_test_eof119: cs = 119; goto _test_eof; | |
_test_eof120: cs = 120; goto _test_eof; | |
_test_eof121: cs = 121; goto _test_eof; | |
_test_eof122: cs = 122; goto _test_eof; | |
_test_eof123: cs = 123; goto _test_eof; | |
_test_eof124: cs = 124; goto _test_eof; | |
_test_eof125: cs = 125; goto _test_eof; | |
_test_eof126: cs = 126; goto _test_eof; | |
_test_eof127: cs = 127; goto _test_eof; | |
_test_eof128: cs = 128; goto _test_eof; | |
_test_eof129: cs = 129; goto _test_eof; | |
_test_eof130: cs = 130; goto _test_eof; | |
_test_eof131: cs = 131; goto _test_eof; | |
_test_eof132: cs = 132; goto _test_eof; | |
_test_eof133: cs = 133; goto _test_eof; | |
_test_eof134: cs = 134; goto _test_eof; | |
_test_eof135: cs = 135; goto _test_eof; | |
_test_eof136: cs = 136; goto _test_eof; | |
_test_eof137: cs = 137; goto _test_eof; | |
_test_eof138: cs = 138; goto _test_eof; | |
_test_eof139: cs = 139; goto _test_eof; | |
_test_eof140: cs = 140; goto _test_eof; | |
_test_eof141: cs = 141; goto _test_eof; | |
_test_eof142: cs = 142; goto _test_eof; | |
_test_eof143: cs = 143; goto _test_eof; | |
_test_eof144: cs = 144; goto _test_eof; | |
_test_eof145: cs = 145; goto _test_eof; | |
_test_eof146: cs = 146; goto _test_eof; | |
_test_eof147: cs = 147; goto _test_eof; | |
_test_eof148: cs = 148; goto _test_eof; | |
_test_eof149: cs = 149; goto _test_eof; | |
_test_eof150: cs = 150; goto _test_eof; | |
_test_eof151: cs = 151; goto _test_eof; | |
_test_eof152: cs = 152; goto _test_eof; | |
_test_eof153: cs = 153; goto _test_eof; | |
_test_eof154: cs = 154; goto _test_eof; | |
_test_eof155: cs = 155; goto _test_eof; | |
_test_eof156: cs = 156; goto _test_eof; | |
_test_eof157: cs = 157; goto _test_eof; | |
_test_eof158: cs = 158; goto _test_eof; | |
_test_eof159: cs = 159; goto _test_eof; | |
_test_eof160: cs = 160; goto _test_eof; | |
_test_eof161: cs = 161; goto _test_eof; | |
_test_eof162: cs = 162; goto _test_eof; | |
_test_eof163: cs = 163; goto _test_eof; | |
_test_eof164: cs = 164; goto _test_eof; | |
_test_eof165: cs = 165; goto _test_eof; | |
_test_eof166: cs = 166; goto _test_eof; | |
_test_eof167: cs = 167; goto _test_eof; | |
_test_eof168: cs = 168; goto _test_eof; | |
_test_eof169: cs = 169; goto _test_eof; | |
_test_eof170: cs = 170; goto _test_eof; | |
_test_eof171: cs = 171; goto _test_eof; | |
_test_eof172: cs = 172; goto _test_eof; | |
_test_eof173: cs = 173; goto _test_eof; | |
_test_eof174: cs = 174; goto _test_eof; | |
_test_eof175: cs = 175; goto _test_eof; | |
_test_eof176: cs = 176; goto _test_eof; | |
_test_eof177: cs = 177; goto _test_eof; | |
_test_eof178: cs = 178; goto _test_eof; | |
_test_eof179: cs = 179; goto _test_eof; | |
_test_eof180: cs = 180; goto _test_eof; | |
_test_eof181: cs = 181; goto _test_eof; | |
_test_eof182: cs = 182; goto _test_eof; | |
_test_eof183: cs = 183; goto _test_eof; | |
_test_eof184: cs = 184; goto _test_eof; | |
_test_eof185: cs = 185; goto _test_eof; | |
_test_eof186: cs = 186; goto _test_eof; | |
_test_eof187: cs = 187; goto _test_eof; | |
_test_eof188: cs = 188; goto _test_eof; | |
_test_eof189: cs = 189; goto _test_eof; | |
_test_eof190: cs = 190; goto _test_eof; | |
_test_eof191: cs = 191; goto _test_eof; | |
_test_eof192: cs = 192; goto _test_eof; | |
_test_eof193: cs = 193; goto _test_eof; | |
_test_eof194: cs = 194; goto _test_eof; | |
_test_eof195: cs = 195; goto _test_eof; | |
_test_eof196: cs = 196; goto _test_eof; | |
_test_eof197: cs = 197; goto _test_eof; | |
_test_eof198: cs = 198; goto _test_eof; | |
_test_eof199: cs = 199; goto _test_eof; | |
_test_eof200: cs = 200; goto _test_eof; | |
_test_eof201: cs = 201; goto _test_eof; | |
_test_eof202: cs = 202; goto _test_eof; | |
_test_eof203: cs = 203; goto _test_eof; | |
_test_eof204: cs = 204; goto _test_eof; | |
_test_eof205: cs = 205; goto _test_eof; | |
_test_eof206: cs = 206; goto _test_eof; | |
_test_eof207: cs = 207; goto _test_eof; | |
_test_eof208: cs = 208; goto _test_eof; | |
_test_eof209: cs = 209; goto _test_eof; | |
_test_eof210: cs = 210; goto _test_eof; | |
_test_eof211: cs = 211; goto _test_eof; | |
_test_eof212: cs = 212; goto _test_eof; | |
_test_eof213: cs = 213; goto _test_eof; | |
_test_eof214: cs = 214; goto _test_eof; | |
_test_eof215: cs = 215; goto _test_eof; | |
_test_eof216: cs = 216; goto _test_eof; | |
_test_eof217: cs = 217; goto _test_eof; | |
_test_eof218: cs = 218; goto _test_eof; | |
_test_eof219: cs = 219; goto _test_eof; | |
_test_eof220: cs = 220; goto _test_eof; | |
_test_eof221: cs = 221; goto _test_eof; | |
_test_eof222: cs = 222; goto _test_eof; | |
_test_eof223: cs = 223; goto _test_eof; | |
_test_eof224: cs = 224; goto _test_eof; | |
_test_eof225: cs = 225; goto _test_eof; | |
_test_eof226: cs = 226; goto _test_eof; | |
_test_eof227: cs = 227; goto _test_eof; | |
_test_eof228: cs = 228; goto _test_eof; | |
_test_eof229: cs = 229; goto _test_eof; | |
_test_eof230: cs = 230; goto _test_eof; | |
_test_eof231: cs = 231; goto _test_eof; | |
_test_eof232: cs = 232; goto _test_eof; | |
_test_eof233: cs = 233; goto _test_eof; | |
_test_eof234: cs = 234; goto _test_eof; | |
_test_eof235: cs = 235; goto _test_eof; | |
_test_eof236: cs = 236; goto _test_eof; | |
_test_eof237: cs = 237; goto _test_eof; | |
_test_eof238: cs = 238; goto _test_eof; | |
_test_eof239: cs = 239; goto _test_eof; | |
_test_eof240: cs = 240; goto _test_eof; | |
_test_eof241: cs = 241; goto _test_eof; | |
_test_eof242: cs = 242; goto _test_eof; | |
_test_eof243: cs = 243; goto _test_eof; | |
_test_eof244: cs = 244; goto _test_eof; | |
_test_eof245: cs = 245; goto _test_eof; | |
_test_eof246: cs = 246; goto _test_eof; | |
_test_eof247: cs = 247; goto _test_eof; | |
_test_eof248: cs = 248; goto _test_eof; | |
_test_eof249: cs = 249; goto _test_eof; | |
_test_eof250: cs = 250; goto _test_eof; | |
_test_eof251: cs = 251; goto _test_eof; | |
_test_eof252: cs = 252; goto _test_eof; | |
_test_eof253: cs = 253; goto _test_eof; | |
_test_eof254: cs = 254; goto _test_eof; | |
_test_eof255: cs = 255; goto _test_eof; | |
_test_eof256: cs = 256; goto _test_eof; | |
_test_eof257: cs = 257; goto _test_eof; | |
_test_eof258: cs = 258; goto _test_eof; | |
_test_eof259: cs = 259; goto _test_eof; | |
_test_eof260: cs = 260; goto _test_eof; | |
_test_eof261: cs = 261; goto _test_eof; | |
_test_eof262: cs = 262; goto _test_eof; | |
_test_eof263: cs = 263; goto _test_eof; | |
_test_eof264: cs = 264; goto _test_eof; | |
_test_eof265: cs = 265; goto _test_eof; | |
_test_eof266: cs = 266; goto _test_eof; | |
_test_eof267: cs = 267; goto _test_eof; | |
_test_eof268: cs = 268; goto _test_eof; | |
_test_eof269: cs = 269; goto _test_eof; | |
_test_eof270: cs = 270; goto _test_eof; | |
_test_eof271: cs = 271; goto _test_eof; | |
_test_eof272: cs = 272; goto _test_eof; | |
_test_eof: {} | |
_out: {} | |
} | |
#line 269 "ragel/XmlLoaderRagel.rl" | |
NSError *err = cs < freightPercentMachine_first_final ? [self parseError:data position:p] : nil; | |
if ( errPtr != nil ) | |
*errPtr = err; | |
MRLogD(@"parse done, dt:%f]", -[t_start timeIntervalSinceNow]); | |
return err == nil; | |
} | |
-(BOOL)internal_parseData:(NSData*)data error:(NSError**)errPtr | |
{ | |
return [self internal_parseChar:data.bytes length:data.length error:errPtr]; | |
} | |
#pragma mark Public Interface | |
-(id)init | |
{ | |
MRLogD(); | |
if ( self = [super init] ) { | |
freightPercentFromTo = [[NSMutableDictionary alloc] initWithCapacity:50]; | |
fromCountries = [[NSMutableSet alloc] initWithCapacity:250]; | |
toCountries = [[NSMutableSet alloc] initWithCapacity:250]; | |
} | |
return self; | |
} | |
-(void)dealloc | |
{ | |
MRLogD(); | |
[freightPercentFromTo release]; | |
[fromCountries release]; | |
[toCountries release]; | |
[super dealloc]; | |
} | |
-(BOOL)parseData:(NSData*)data error:(NSError **)error | |
{ | |
MRLogD(); | |
NSAssert(error != nil, @"I need an error reference."); | |
return [self internal_parseData:data error:error]; | |
} | |
-(NSDictionary *)freightPercentFromTo | |
{ | |
return freightPercentFromTo; | |
} | |
-(NSArray *)fromCountries | |
{ | |
return [fromCountries allObjects]; | |
} | |
-(NSArray *)toCountries | |
{ | |
return [toCountries allObjects]; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// XmlLoaderRagel.m | |
// | |
// Created by Marcus Rohrmoser on 24.06.10. | |
// Copyright 2010 Marcus Rohrmoser mobile Software. All rights reserved. | |
// | |
#define USE_FLYWEIGHT 1 | |
#if USE_FLYWEIGHT | |
#import "CountryFactory.h" | |
#else | |
/// Flyweightish NSMutableSet | |
@interface NSMutableSet (MemberOrAdd) | |
-(id)memberOrAdd:(id)object; | |
@end | |
@implementation NSMutableSet (MemberOrAdd) | |
-(id)memberOrAdd:(id)object | |
{ | |
if ( object == nil ) | |
return nil; | |
NSString *ret = [self member:object]; | |
if ( ret == nil ) | |
[self addObject:(ret = object)]; | |
NSAssert(ret != nil, @""); | |
return ret; | |
} | |
@end | |
#endif | |
#import "XmlLoaderRagel.h" | |
//#ifdef MRLogD | |
//#undef MRLogD | |
//#endif | |
// | |
//// No Logging | |
//#define MRLogD(x,...) /* NSLog(x,##__VA_ARGS__) */ | |
/** <a href="http://www.complang.org/ragel/">Ragel</a> parser | |
* This file is auto-generated | |
* <p> | |
* DO NOT EDIT MANUALLY!!! | |
* </p> | |
*/ | |
@implementation XmlLoaderRagel | |
%%{ | |
machine freightPercentMachine; | |
####################################################### | |
## Define the actions | |
####################################################### | |
action start_number { | |
start = p; | |
} | |
action push_number { | |
char *endmark = (char*)p; | |
const char c = *endmark; | |
*endmark = '\0'; | |
strncpy(buffer, start, BUFSIZE); | |
*endmark = c; | |
start = NULL; | |
} | |
action start_iso { | |
start = p; | |
} | |
action push_iso { | |
char *endmark = (char*)p; | |
const char c = *endmark; | |
*endmark = '\0'; | |
strncpy(buffer, start, BUFSIZE); | |
*endmark = c; | |
start = NULL; | |
} | |
action push_freightpercent { | |
strncpy(freightpercent, buffer, BUFSIZE); | |
buffer[0] = 0; | |
} | |
action push_fromcountry { | |
strncpy(fromcountry, buffer, BUFSIZE); | |
buffer[0] = 0; | |
} | |
action push_tocountry { | |
strncpy(tocountry, buffer, BUFSIZE); | |
buffer[0] = 0; | |
} | |
action push_row { | |
[self addRowFrom:fromcountry to:tocountry freight:freightpercent]; | |
fromcountry[0] = 0; | |
tocountry[0] = 0; | |
freightpercent[0] = 0; | |
} | |
####################################################### | |
## Define the grammar | |
####################################################### | |
# http://www.w3.org/TR/REC-xml/#NT-Char | |
Char = 0x9 | 0xA | 0xD | [0-9] | [a-z] | [A-Z] | '-'; | |
# http://www.w3.org/TR/REC-xml/#NT-S | |
S = (0x20 | 0x9 | 0xD | 0xA)+; | |
# http://www.w3.org/TR/REC-xml/#NT-CharData | |
CharData = [^<&]* - ([^<&]* ']]>' [^<&]*); | |
# http://www.w3.org/TR/REC-xml/#NT-Comment | |
Comment = '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'; | |
NameStartChar = ":" | [A-Z] | "_" | [a-z] | 0xC0..0xD6 | 0xD8..0xF6 | 0xF8..0xFF; | |
NameChar = NameStartChar | "-" | "." | [0-9] | 0xB7; | |
# http://www.w3.org/TR/REC-xml/#NT-Name | |
Name = NameStartChar (NameChar)*; | |
# http://www.w3.org/TR/REC-xml/#NT-CharRef | |
CharRef = '&#' [0-9]+ ';' | |
| '&0x' [0-9a-fA-F]+ ';'; | |
# http://www.w3.org/TR/REC-xml/#NT-PEReference | |
PEReference = '%' Name ';'; | |
EntityRef = '&' Name ';'; | |
Reference = EntityRef | CharRef; | |
# http://www.w3.org/TR/REC-xml/#NT-AttValue | |
EntityValue = '"' ([^%&"] | PEReference | Reference)* '"' | |
| "'" ([^%&'] | PEReference | Reference)* "'"; | |
AttValue = '"' [^"]* '"' | |
| "'" [^']* "'"; | |
# http://www.w3.org/TR/REC-xml/#NT-Eq | |
Eq = S? '=' S?; | |
# no CData : http://www.w3.org/TR/REC-xml/#NT-content | |
# http://www.w3.org/TR/REC-xml/#NT-Attribute | |
Attribute = Name Eq AttValue; | |
STag = '<' Name (S Attribute)* S? '>'; | |
# http://www.w3.org/TR/REC-xml/#NT-ETag | |
ETag = '</' Name S? '>'; | |
# http://www.w3.org/TR/REC-xml/#NT-EmptyElemTag | |
EmptyElemTag = '<' Name (S Attribute)* S? '/>'; | |
# http://www.w3.org/TR/REC-xml/#NT-EncName | |
EncName = [A-Za-z] ([A-Za-z0-9._] | '-')*; # Encoding name contains only Latin characters | |
# http://www.w3.org/TR/REC-xml/#NT-EncodingDecl | |
EncodingDecl = S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" ); | |
# no PI: http://www.w3.org/TR/REC-xml/#NT-Misc | |
Misc = Comment | S; | |
# http://www.w3.org/TR/REC-xml/#NT-VersionNum | |
VersionNum = '1.' [0-9]+; | |
# http://www.w3.org/TR/REC-xml/#NT-VersionInfo | |
VersionInfo = S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"'); | |
# http://www.w3.org/TR/REC-xml/#NT-SDDecl | |
SDDecl = S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"')); | |
# http://www.w3.org/TR/REC-xml/#NT-XMLDecl | |
XMLDecl = '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'; | |
# http://www.w3.org/TR/REC-xml/#NT-prolog | |
prolog = XMLDecl? Misc*; | |
number_int = ('-'? [0-9]+) >start_number %push_number; | |
country_iso = ([A-Z][A-Z]) >start_iso %push_iso; | |
number_int_ws = S? number_int S?; | |
country_iso_ws = S? country_iso S?; | |
elem_dataid = '<dataid' S? '>' (Char - '<')* '</dataid' S? '>'; | |
elem_freightpercent = '<freightpercent' S? '>' number_int_ws '</freightpercent' S? '>' %push_freightpercent; | |
elem_fromcountry = '<fromcountry' S? '>' country_iso_ws '</fromcountry' S? '>' %push_fromcountry; | |
elem_relevance = '<relevance' S? '>' (Char - '<')* '</relevance' S? '>'; | |
elem_tocountry = '<tocountry' S? '>' country_iso_ws '</tocountry' S? '>' %push_tocountry; | |
elem_vehiclepercent = '<vehiclepercent' S? '>' (Char - '<')* '</vehiclepercent' S? '>'; | |
content_row = elem_dataid? S? elem_freightpercent S? elem_fromcountry S? elem_relevance? S? elem_tocountry S? elem_vehiclepercent?; | |
elem_row = ('<row' S? '>' S? content_row S? '</row' S? '>') %push_row; | |
elem_query = '<query' (S Attribute)* S? '>' (S? elem_row)* S? '</query' S? '>'; | |
# http://www.w3.org/TR/REC-xml/#NT-document | |
document = prolog elem_query Misc*; | |
main := document; | |
}%% | |
#pragma mark Ragel Machine State Data | |
%% write data; | |
#pragma mark Internal Helpers | |
-(void)addRowFrom:(char*)fromIso to:(char*)toIso freight:(char*)percent { | |
// MRLogD(@"row from:%s to:%s percent:%s", fromIso, toIso, percent); | |
const long tmp_percent = atol(percent); | |
if ( NaN_MARKER != tmp_percent ) { | |
#if ! USE_FLYWEIGHT | |
NSString *tmp_from = [NSString stringWithCString:fromIso encoding:NSASCIIStringEncoding]; | |
NSString *tmp_to = [NSString stringWithCString:toIso encoding:NSASCIIStringEncoding]; | |
tmp_from = [fromCountries memberOrAdd:tmp_from]; | |
tmp_to = [toCountries memberOrAdd:tmp_to]; | |
NSMutableDictionary *to = [freightPercentFromTo valueForKey:tmp_from]; | |
if ( to == nil ) | |
[freightPercentFromTo setValue:(to = [NSMutableDictionary dictionaryWithCapacity:50]) forKey:tmp_from]; | |
[to setValue:[NSNumber numberWithInteger:tmp_percent] forKey:tmp_to]; | |
#else | |
NSString *tmp_from = [CountryFactory countryFromCString:fromIso]; | |
NSString *tmp_to = [CountryFactory countryFromCString:toIso]; | |
NSMutableDictionary *to = [freightPercentFromTo valueForKey:tmp_from]; | |
if ( to == nil ) { | |
[freightPercentFromTo setValue:(to = [NSMutableDictionary dictionaryWithCapacity:50]) forKey:tmp_from]; | |
[fromCountries addObject:tmp_from]; | |
} | |
[to setValue:[NSNumber numberWithInteger:tmp_percent] forKey:tmp_to]; | |
[toCountries addObject:tmp_to]; | |
#endif | |
} | |
} | |
#define BUFSIZE 20 | |
-(BOOL)internal_parseChar:(const char*)data length:(int)length error:(NSError**)errPtr | |
{ | |
NSDate *t_start = [NSDate date]; | |
MRLogD(); | |
if(data == NULL) | |
return YES; | |
// high-level buffers | |
const char *start = NULL; | |
char buffer[BUFSIZE] = ""; | |
char fromcountry[BUFSIZE] = ""; | |
char tocountry[BUFSIZE] = ""; | |
char freightpercent[BUFSIZE] = ""; | |
// ragel variables (low level) | |
const char *p = data; | |
const char *pe = data + length; // pointer "end" | |
// const char *eof = pe; | |
int cs = 0; | |
// int top; | |
/////////////////////////////////////////////////////////// | |
// init ragel | |
%% write init; | |
/////////////////////////////////////////////////////////// | |
// exec ragel | |
%% write exec; | |
NSError *err = cs < freightPercentMachine_first_final ? [self parseError:data position:p] : nil; | |
if ( errPtr != nil ) | |
*errPtr = err; | |
MRLogD(@"parse done, dt:%f]", -[t_start timeIntervalSinceNow]); | |
return err == nil; | |
} | |
-(BOOL)internal_parseData:(NSData*)data error:(NSError**)errPtr | |
{ | |
return [self internal_parseChar:data.bytes length:data.length error:errPtr]; | |
} | |
#pragma mark Public Interface | |
-(id)init | |
{ | |
MRLogD(); | |
if ( self = [super init] ) { | |
freightPercentFromTo = [[NSMutableDictionary alloc] initWithCapacity:50]; | |
fromCountries = [[NSMutableSet alloc] initWithCapacity:250]; | |
toCountries = [[NSMutableSet alloc] initWithCapacity:250]; | |
} | |
return self; | |
} | |
-(void)dealloc | |
{ | |
MRLogD(); | |
[freightPercentFromTo release]; | |
[fromCountries release]; | |
[toCountries release]; | |
[super dealloc]; | |
} | |
-(BOOL)parseData:(NSData*)data error:(NSError **)error | |
{ | |
MRLogD(); | |
NSAssert(error != nil, @"I need an error reference."); | |
return [self internal_parseData:data error:error]; | |
} | |
-(NSDictionary *)freightPercentFromTo | |
{ | |
return freightPercentFromTo; | |
} | |
-(NSArray *)fromCountries | |
{ | |
return [fromCountries allObjects]; | |
} | |
-(NSArray *)toCountries | |
{ | |
return [toCountries allObjects]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment