Changeset 452

Show
Ignore:
Timestamp:
08/19/07 18:31:07 (14 months ago)
Author:
krobillard
Message:

Tokenizer handles special char!.
ur_toStrT() now thread-safe for char! values.
Fixed Vim char! syntax.

Location:
branches/thune/thread_safe
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • branches/thune/thread_safe/charset.c

    r451 r452  
    3737 
    3838 
    39 /* Word: 0-9 a-z A-Z ?!.'+-*&|=_~ and all ascii >= 127 */ 
     39/* Word: 0-9 a-z A-Z ?!.+-*&|=_~ and all ascii >= 127 */ 
    4040uint8_t charset_word[32] = { 
    4141#ifdef UR_CONFIG_MACROS 
    42         0x00,0x00,0x00,0x00,0xC2,0x6C,0xFF,0xA3,    // Don't allow < > 
     42        0x00,0x00,0x00,0x00,0x42,0x6C,0xFF,0xA3,    // Don't allow < > 
    4343#else 
    44         0x00,0x00,0x00,0x00,0xC2,0x6C,0xFF,0xF3, 
     44        0x00,0x00,0x00,0x00,0x42,0x6C,0xFF,0xF3, 
    4545#endif 
    4646        0xFE,0xFF,0xFF,0x97,0xFF,0xFF,0xFF,0x57, 
  • branches/thune/thread_safe/doc/thune.vim

    r451 r452  
    1818syn case ignore 
    1919 
    20 " As per current users documentation 
    2120if version < 600 
    22   set isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~ 
     21  set iskeyword=@,48-57,?,!,.,+,-,*,&,\|,=,_,~ 
    2322else 
    24   setlocal isk=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~ 
     23  setlocal iskeyword=@,48-57,?,!,.,+,-,*,&,\|,=,_,~ 
    2524endif 
    2625 
     
    8584" Tuples 
    8685syn match       thuneTuple      "\(\d\+\.\)\{2,}" 
    87  
    8886" Characters 
    89 syn region  thuneChar   oneline start="'" end="'" contains=thuneSpecialChar 
     87syn match   thuneChar   "'\^\=.'" 
     88"syn match   thuneChar   "'\S\+'" 
     89 
    9090syn match       thuneSpecialChar contained "\^[^[:space:][]" 
    9191syn match       thuneSpecialChar contained "%\d\+" 
  • branches/thune/thread_safe/make.c

    r450 r452  
    538538  Returns -1 if failed. 
    539539*/ 
    540 static int _escapedCharacter( const char** cp, const char* end ) 
     540int ur_escapedCharacter( const char** cp, const char* end ) 
    541541{ 
    542542    int val; 
     
    649649        { 
    650650            ++cp; 
    651             *out++ = _escapedCharacter( &cp, end );  
     651            *out++ = ur_escapedCharacter( &cp, end );  
    652652        } 
    653653        else 
     
    14811481                    { 
    14821482                        ++spA; 
    1483                         ur_char(res) = _escapedCharacter( (const char**) &spA, 
    1484                                                           spB );  
     1483                        ur_char(res) = ur_escapedCharacter( 
     1484                                            (const char**) &spA, spB );  
    14851485                    } 
    14861486                    else 
  • branches/thune/thread_safe/print.c

    r450 r452  
    3232 
    3333extern int copyUtf16ToAscii( char* dest, const uint16_t* src, int len ); 
    34  
    35  
    36 static char charStr[] = "'?'"; 
    3734 
    3835 
     
    10471044            switch( ur_int(val) ) 
    10481045            { 
    1049                 case '\0': 
    1050                     append( out, "'^0'", 4 ); 
    1051                     break; 
    1052  
    10531046                case '\a': 
    10541047                    append( out, "'^(bell)'", 9 ); 
     
    10801073 
    10811074                default: 
    1082                     charStr[1] = (char) ur_int(val); 
    1083                     append(out, charStr, 3); 
     1075                { 
     1076                    char cstr[ 4 ]; 
     1077                    cstr[0] = '\''; 
     1078                    if( ur_int(val) < 10 ) 
     1079                    { 
     1080                        cstr[1] = '^'; 
     1081                        cstr[2] = ur_int(val) + '0'; 
     1082                        cstr[3] = '\''; 
     1083                        append( out, cstr, 4 ); 
     1084                    } 
     1085                    else 
     1086                    { 
     1087                        cstr[1] = (char) ur_int(val); 
     1088                        cstr[2] = '\''; 
     1089                        append(out, cstr, 3); 
     1090                    } 
     1091                } 
    10841092                    break; 
    10851093            } 
  • branches/thune/thread_safe/tokenize.c

    r451 r452  
    3131 
    3232extern void ur_bindDefault( UThread*, UIndex blkN ); 
     33extern int  ur_escapedCharacter( const char** cp, const char* end ); 
    3334 
    3435 
     
    546547quote: 
    547548 
    548     if( ((end - it) > 1) && it[1] == '\'' ) 
    549     { 
    550         cell = ur_appendCell( BLOCK, UT_CHAR ); 
    551         ur_int(cell) = token[1]; 
    552         it += 2; 
    553         goto set_eol; 
    554     } 
    555  
    556549    mode = UT_LITWORD; 
    557550 
    558551    SCAN_LOOP 
    559         if( ch == '/' ) 
     552        if( ch == '\'' ) 
     553        { 
     554            mode = UT_CHAR; 
     555            break; 
     556        } 
     557        else if( ch == '/' ) 
    560558        { 
    561559            mode = UT_LITSELECT; 
     
    563561        else if( ur_bitIsSet( charset_delimiters, ch ) )   // '[' 'word[] 
    564562        { 
     563            if( it == (token + 1) ) 
     564            { 
     565                ++it; 
     566                if( (it != end) && (*it == '\'') ) 
     567                    goto make_char; 
     568                goto quote_err; 
     569            } 
    565570            break; 
    566571        } 
     
    572577        if( it == token ) 
    573578            goto quote_err; 
    574         if( mode == UT_LITWORD ) 
     579 
     580        if( mode == UT_CHAR ) 
     581        { 
     582            ch = *token; 
     583            if( ch == '^' ) 
     584            { 
     585                ++token; 
     586                ch = ur_escapedCharacter( &token, it ); 
     587                if( ch < 0 ) 
     588                { 
     589                    syntaxError( "Invalid char" ); 
     590                } 
     591            } 
     592make_char: 
     593            ++it; 
     594            cell = ur_appendCell( BLOCK, UT_CHAR ); 
     595            ur_int(cell) = ch; 
     596        } 
     597        else if( mode == UT_LITWORD ) 
    575598        { 
    576599            cell = ur_appendWord( BLOCK, UT_LITWORD, token, it - token ); 
     
    632655        { 
    633656            mode = WORD_COLON; 
    634             break; 
    635         } 
    636         if( ch == '\'' ) 
    637         { 
    638             mode = UT_CHAR; 
    639657            break; 
    640658        }