Changeset 392
- Timestamp:
- 05/19/07 05:58:46 (17 months ago)
- Location:
- branches/thune/thread_safe
- Files:
-
- 2 modified
-
parse.c (modified) (8 diffs)
-
tests/working/parse_block.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/thune/thread_safe/parse.c
r387 r392 606 606 607 607 608 #define CHECK_WORD(cell) \ 609 if( ! cell ) { \ 610 pe->error = PARSE_EX_ERROR; \ 611 return 0; } 612 608 613 /* 609 614 Returns zero if matching rule not found or exception occured. … … 717 722 { 718 723 tval = ur_wordCell( ut, rit ); 724 CHECK_WORD( tval ) 719 725 } 720 726 } … … 759 765 break; 760 766 767 case UR_ATOM_SET: 768 ++rit; 769 if( rit == rend ) 770 goto unexpected_end; 771 if( ! ur_is(rit, UT_WORD) ) 772 { 773 ur_throwErr( PARSE_EX, "parse set expected word" ); 774 pe->error = PARSE_EX_ERROR; 775 return 0; 776 } 777 { 778 UCell* cell = ur_wordCell( ut, rit ); 779 CHECK_WORD( cell ) 780 ur_copyCell( cell, iblk->ptr.cells[ pos ] ); 781 } 782 ++rit; 783 break; 784 761 785 //case UR_ATOM_COPY: 762 786 … … 764 788 { 765 789 tval = ur_wordCell( ut, rit ); 790 CHECK_WORD( tval ) 766 791 767 792 if( ur_is(tval, UT_BLOCK) ) … … 784 809 UCell* cell; 785 810 cell = ur_wordCell( ut, rit ); 811 CHECK_WORD( cell ) 786 812 ++rit; 787 813 … … 797 823 UCell* cell; 798 824 cell = ur_wordCell( ut, rit ); 825 CHECK_WORD( cell ) 799 826 ++rit; 800 827 … … 903 930 if( rit == rend ) 904 931 { 932 unexpected_end: 905 933 ur_throwErr( PARSE_EX, "Enexpected end of parse rule" ); 906 934 pe->error = PARSE_EX_ERROR; … … 914 942 { 915 943 tval = ur_wordCell( ut, rit ); 944 CHECK_WORD( tval ) 916 945 } 917 946 else -
branches/thune/thread_safe/tests/working/parse_block.t
r178 r392 10 10 prog [some[ 11 11 'min :a int! (["Minimum:" a/1] print) 12 | 'max :a [int! | decimal!] (["Maximum:" a/1] print)12 | 'max set a [int! | decimal!] (["Maximum:" a] print) 13 13 | 'fire :a word! (["Fired:" a/1] print) 14 14 | 'range :a int! int! (["Range:" a/1 "-" a/2] print)
