Changeset 46 for trunk/orca
- Timestamp:
- 02/13/06 17:46:20 (3 years ago)
- Location:
- trunk/orca
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/orca/ovalue.h
r44 r46 485 485 486 486 #define orType(val) (val)->type 487 #define orInteger(val) (val)->integer 487 #define orAtom(val) (val)->word.atom 488 #define orInt(val) (val)->integer 488 489 #define orLogic(val) (val)->integer 489 490 #define orDecimal(val) (val)->num.decimal -
trunk/orca/parse.c
r42 r46 24 24 25 25 26 #define OR_ATOM_OPT orEnv->atom_opt 27 #define OR_ATOM_SOME orEnv->atom_some 28 #define OR_ATOM_ANY orEnv->atom_any 29 #define OR_ATOM_BREAK orEnv->atom_break 30 #define OR_ATOM_SKIP orEnv->atom_skip 31 #define OR_ATOM_SET orEnv->atom_set 32 #define OR_ATOM_COPY orEnv->atom_copy 33 #define OR_ATOM_BAR orEnv->atom_bar 34 #define OR_ATOM_TO orEnv->atom_to 35 #define OR_ATOM_THRU orEnv->atom_thru 36 37 26 38 extern int orMatchString( const OString* strA, int iA, 27 39 const OString* strB, int iB ); … … 37 49 while( it != end ) 38 50 { 39 if( (it->type == OT_WORD) && 40 (it->word.atom == orEnv->atom_bar) ) 51 if( orIs(it, OT_WORD) && (orAtom(it) == OR_ATOM_BAR) ) 41 52 { 42 53 return it + 1; … … 85 96 { 86 97 case OT_WORD: 87 if( rit->word.atom == orEnv->atom_opt)98 if( orAtom(rit) == OR_ATOM_OPT ) 88 99 { 89 100 const OValue* r2 = rit + 1; … … 97 108 rit += 2; 98 109 } 99 else if( rit->word.atom == orEnv->atom_any)110 else if( orAtom(rit) == OR_ATOM_ANY ) 100 111 { 101 112 //until [not eval-pstr second it] … … 107 118 return 0; 108 119 109 if( r2->type == OT_WORD)120 if( orIs(r2, OT_WORD) ) 110 121 { 111 122 OBlock* ctxBlk; … … 113 124 } 114 125 115 if( r2->type == OT_BITSET)126 if( orIs(r2, OT_BITSET) ) 116 127 { 117 128 const uint8_t* it = str->byteArray + pos; … … 129 140 } 130 141 } 131 else if( rit->word.atom == orEnv->atom_some)142 else if( orAtom(rit) == OR_ATOM_SOME ) 132 143 { 133 144 const OValue* found; … … 138 149 return 0; 139 150 140 if( r2->type == OT_WORD)151 if( orIs(r2, OT_WORD) ) 141 152 { 142 153 OBlock* ctxBlk; … … 144 155 } 145 156 146 if( r2->type == OT_BLOCK)157 if( orIs(r2, OT_BLOCK) ) 147 158 { 148 159 OBlock* blk2; … … 169 180 } 170 181 } 171 else if( r2->type == OT_BITSET)182 else if( orIs(r2, OT_BITSET) ) 172 183 { 173 184 const uint8_t* it = str->byteArray + pos; … … 193 204 } 194 205 } 195 else if( rit->word.atom == orEnv->atom_break)206 else if( orAtom(rit) == OR_ATOM_BREAK ) 196 207 { 197 208 return rit; 198 209 } 199 else if( rit->word.atom == orEnv->atom_bar)210 else if( orAtom(rit) == OR_ATOM_BAR ) 200 211 { 201 212 goto complete; 202 213 } 203 else if( rit->word.atom == orEnv->atom_to)214 else if( orAtom(rit) == OR_ATOM_TO ) 204 215 { 205 216 int si; … … 224 235 } 225 236 /* 226 else if( rit->word.atom == orEnv->atom_thru)227 { 228 } 229 else if( rit->word.atom == orEnv->atom_skip)230 { 231 } 232 else if( rit->word.atom == orEnv->atom_set)233 { 234 } 235 else if( rit->word.atom == orEnv->atom_copy)237 else if( orAtom(rit) == OR_ATOM_THRU ) 238 { 239 } 240 else if( orAtom(rit) == OR_ATOM_SKIP ) 241 { 242 } 243 else if( orAtom(rit) == OR_ATOM_SET ) 244 { 245 } 246 else if( orAtom(rit) == OR_ATOM_COPY ) 236 247 { 237 248 } … … 244 255 orWordVal( rit, cblk, wval ); 245 256 246 if( wval->type == OT_BLOCK)257 if( orIs(wval, OT_BLOCK) ) 247 258 { 248 259 cblk = orBLOCK( wval ); … … 255 266 goto failed_eval; 256 267 } 257 else if( wval->type == OT_BITSET)268 else if( orIs(wval, OT_BITSET) ) 258 269 { 259 270 OString* bin = orSTRING( wval ); … … 296 307 return 0; 297 308 298 if( r2->type == OT_INTEGER)309 if( orIs(r2, OT_INTEGER) ) 299 310 { 300 311 int count = 0; 301 int maxCount = r2->integer;312 int maxCount = orInt(r2); 302 313 303 314 ++r2; … … 314 325 if( orErrorThrown ) 315 326 return 0; 316 if( (count >= rit->integer) && (count <= maxCount) )327 if( (count >= orInt(rit)) && (count <= maxCount) ) 317 328 rit += 3; 318 329 else … … 323 334 324 335 case OT_CHAR: 325 if( str->charArray[ pos ] == rit->integer)336 if( str->charArray[ pos ] == orInt(rit) ) 326 337 { 327 338 ++rit; … … 443 454 (void) useCase; 444 455 456 orRefAvailErr( 2 ); 445 457 orRefPush( OT_STRING, ser->index ); 446 458 … … 450 462 orRefPush( OT_BLOCK, rblkN ); 451 463 452 if( rules->type == OT_STRING)464 if( orIs(rules, OT_STRING) ) 453 465 { 454 466 custom = orMakeCharset( orSTRING(rules), rules->series.it ); … … 533 545 { 534 546 OValue* rules = a1 + 1; 535 if( a1->type == OT_STRING)547 if( orIs(a1, OT_STRING) ) 536 548 { 537 549 int all = orRefineSet(REF_PARSE_ALL) ? 1 : 0; 538 550 int useCase = orRefineSet(REF_PARSE_CASE) ? 1 : 0; 539 551 540 if( rules->type == OT_BLOCK)552 if( orIs(rules, OT_BLOCK) ) 541 553 parseStringRules( a1, rules, all, useCase ); 542 554 else 543 555 parseString( a1, rules, all, useCase ); 544 556 } 545 else if( a1->type == OT_BLOCK)557 else if( orIs(a1, OT_BLOCK) ) 546 558 { 547 559 parseBlock( a1, rules ); -
trunk/orca/tests/run_test
r44 r46 4 4 REBOL=rebol 5 5 #REBOL=./rebol 6 #REBOL=./rebol_view_1.2.47 6 7 7 8 #DIFF='diff -w --ignore-blank-lines'
