diff options
Diffstat (limited to 'src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp')
-rw-r--r-- | src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp index 90d980e10..a7aa5303d 100644 --- a/src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp +++ b/src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp @@ -16,10 +16,10 @@ static const SQChar *g_nnames[] = { - _SC("NONE"),_SC("OP_GREEDY"), _SC("OP_OR"), - _SC("OP_EXPR"),_SC("OP_NOCAPEXPR"),_SC("OP_DOT"), _SC("OP_CLASS"), - _SC("OP_CCLASS"),_SC("OP_NCLASS"),_SC("OP_RANGE"),_SC("OP_CHAR"), - _SC("OP_EOL"),_SC("OP_BOL"),_SC("OP_WB") + "NONE","OP_GREEDY", "OP_OR", + "OP_EXPR","OP_NOCAPEXPR","OP_DOT", "OP_CLASS", + "OP_CCLASS","OP_NCLASS","OP_RANGE","OP_CHAR", + "OP_EOL","OP_BOL","OP_WB" }; #endif @@ -99,7 +99,7 @@ static void sqstd_rex_error(SQRex *exp,const SQChar *error) static void sqstd_rex_expect(SQRex *exp, SQChar n){ if((*exp->_p) != n) - sqstd_rex_error(exp, _SC("expected paren")); + sqstd_rex_error(exp, "expected paren"); exp->_p++; } @@ -115,7 +115,7 @@ static SQChar sqstd_rex_escapechar(SQRex *exp) case 'f': exp->_p++; return '\f'; default: return (*exp->_p++); } - } else if(!scisprint(*exp->_p)) sqstd_rex_error(exp,_SC("letter expected")); + } else if(!scisprint(*exp->_p)) sqstd_rex_error(exp,"letter expected"); return (*exp->_p++); } @@ -159,7 +159,7 @@ static SQInteger sqstd_rex_charnode(SQRex *exp,SQBool isclass) } else if(!scisprint(*exp->_p)) { - sqstd_rex_error(exp,_SC("letter expected")); + sqstd_rex_error(exp,"letter expected"); } t = *exp->_p; exp->_p++; return sqstd_rex_newnode(exp,t); @@ -173,15 +173,15 @@ static SQInteger sqstd_rex_class(SQRex *exp) exp->_p++; }else ret = sqstd_rex_newnode(exp,OP_CLASS); - if(*exp->_p == ']') sqstd_rex_error(exp,_SC("empty class")); + if(*exp->_p == ']') sqstd_rex_error(exp,"empty class"); chain = ret; while(*exp->_p != ']' && exp->_p != exp->_eol) { if(*exp->_p == '-' && first != -1){ SQInteger r; - if(*exp->_p++ == ']') sqstd_rex_error(exp,_SC("unfinished range")); + if(*exp->_p++ == ']') sqstd_rex_error(exp,"unfinished range"); r = sqstd_rex_newnode(exp,OP_RANGE); - if(exp->_nodes[first].type>*exp->_p) sqstd_rex_error(exp,_SC("invalid range")); - if(exp->_nodes[first].type == OP_CCLASS) sqstd_rex_error(exp,_SC("cannot use character classes in ranges")); + if(exp->_nodes[first].type>*exp->_p) sqstd_rex_error(exp,"invalid range"); + if(exp->_nodes[first].type == OP_CCLASS) sqstd_rex_error(exp,"cannot use character classes in ranges"); exp->_nodes[r].left = exp->_nodes[first].type; SQInteger t = sqstd_rex_escapechar(exp); exp->_nodes[r].right = t; @@ -220,7 +220,7 @@ static SQInteger sqstd_rex_parsenumber(SQRex *exp) exp->_p++; while(isdigit(*exp->_p)) { ret = ret*10+(*exp->_p++-'0'); - if(positions==1000000000) sqstd_rex_error(exp,_SC("overflow in numeric constant")); + if(positions==1000000000) sqstd_rex_error(exp,"overflow in numeric constant"); positions *= 10; }; return ret; @@ -238,7 +238,7 @@ static SQInteger sqstd_rex_element(SQRex *exp) if(*exp->_p =='?') { exp->_p++; - sqstd_rex_expect(exp,_SC(':')); + sqstd_rex_expect(exp,':'); expr = sqstd_rex_newnode(exp,OP_NOCAPEXPR); } else @@ -246,13 +246,13 @@ static SQInteger sqstd_rex_element(SQRex *exp) SQInteger newn = sqstd_rex_list(exp); exp->_nodes[expr].left = newn; ret = expr; - sqstd_rex_expect(exp,_SC(')')); + sqstd_rex_expect(exp,')'); } break; case '[': exp->_p++; ret = sqstd_rex_class(exp); - sqstd_rex_expect(exp,_SC(']')); + sqstd_rex_expect(exp,']'); break; case SQREX_SYMBOL_END_OF_STRING: exp->_p++; ret = sqstd_rex_newnode(exp,OP_EOL);break; case SQREX_SYMBOL_ANY_CHAR: exp->_p++; ret = sqstd_rex_newnode(exp,OP_DOT);break; @@ -271,7 +271,7 @@ static SQInteger sqstd_rex_element(SQRex *exp) case SQREX_SYMBOL_GREEDY_ZERO_OR_ONE: p0 = 0; p1 = 1; exp->_p++; isgreedy = SQTrue; break; case '{': exp->_p++; - if(!isdigit(*exp->_p)) sqstd_rex_error(exp,_SC("number expected")); + if(!isdigit(*exp->_p)) sqstd_rex_error(exp,"number expected"); p0 = (unsigned short)sqstd_rex_parsenumber(exp); /*******************************/ switch(*exp->_p) { @@ -284,10 +284,10 @@ static SQInteger sqstd_rex_element(SQRex *exp) if(isdigit(*exp->_p)){ p1 = (unsigned short)sqstd_rex_parsenumber(exp); } - sqstd_rex_expect(exp,_SC('}')); + sqstd_rex_expect(exp,'}'); break; default: - sqstd_rex_error(exp,_SC(", or } expected")); + sqstd_rex_error(exp,", or } expected"); } /*******************************/ isgreedy = SQTrue; @@ -537,23 +537,23 @@ SQRex *sqstd_rex_compile(const SQChar *pattern,const SQChar **error) SQInteger res = sqstd_rex_list(exp); exp->_nodes[exp->_first].left = res; if(*exp->_p!='\0') - sqstd_rex_error(exp,_SC("unexpected character")); + sqstd_rex_error(exp,"unexpected character"); #ifdef _DEBUG { SQInteger nsize,i; SQRexNode *t; nsize = exp->_nsize; t = &exp->_nodes[0]; - scprintf(_SC("\n")); + scprintf("\n"); /* XXX -- The (int) casts are needed to silent warnings on 64bit systems (SQInteger is 64bit, %d assumes 32bit, (int) is 32bit) */ for(i = 0;i < nsize; i++) { if(exp->_nodes[i].type>MAX_CHAR) - scprintf(_SC("[%02d] %10s "),(int)i,g_nnames[exp->_nodes[i].type-MAX_CHAR]); + scprintf("[%02d] %10s ",(int)i,g_nnames[exp->_nodes[i].type-MAX_CHAR]); else - scprintf(_SC("[%02d] %10c "),(int)i,exp->_nodes[i].type); - scprintf(_SC("left %02d right %02d next %02d\n"),(int)exp->_nodes[i].left,(int)exp->_nodes[i].right,(int)exp->_nodes[i].next); + scprintf("[%02d] %10c ",(int)i,exp->_nodes[i].type); + scprintf("left %02d right %02d next %02d\n",(int)exp->_nodes[i].left,(int)exp->_nodes[i].right,(int)exp->_nodes[i].next); } - scprintf(_SC("\n")); + scprintf("\n"); } #endif exp->_matches = (SQRexMatch *) sq_malloc(exp->_nsubexpr * sizeof(SQRexMatch)); |