diff options
Diffstat (limited to 'trex.c')
| -rw-r--r-- | trex.c | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -105,7 +105,7 @@ static void trex_error(TRex *exp,const TRexChar *error) } static void trex_expect(TRex *exp, int n){ - if((*exp->_p) != n) + if((*exp->_p) != n) trex_error(exp, _SC("expected paren")); exp->_p++; } @@ -144,31 +144,31 @@ static int trex_charnode(TRex *exp,TRexBool isclass) case 'r': exp->_p++; return trex_newnode(exp,'\r'); case 'f': exp->_p++; return trex_newnode(exp,'\f'); case 'v': exp->_p++; return trex_newnode(exp,'\v'); - case 'a': case 'A': case 'w': case 'W': case 's': case 'S': - case 'd': case 'D': case 'x': case 'X': case 'c': case 'C': - case 'p': case 'P': case 'l': case 'u': + case 'a': case 'A': case 'w': case 'W': case 's': case 'S': + case 'd': case 'D': case 'x': case 'X': case 'c': case 'C': + case 'p': case 'P': case 'l': case 'u': { - t = *exp->_p; exp->_p++; + t = *exp->_p; exp->_p++; return trex_charclass(exp,t); } - case 'b': + case 'b': case 'B': if(!isclass) { int node = trex_newnode(exp,OP_WB); exp->_nodes[node].left = *exp->_p; - exp->_p++; + exp->_p++; return node; } //else default - default: - t = *exp->_p; exp->_p++; + default: + t = *exp->_p; exp->_p++; return trex_newnode(exp,t); } } else if(!scisprint(*exp->_p)) { - + trex_error(exp,_SC("letter expected")); } - t = *exp->_p; exp->_p++; + t = *exp->_p; exp->_p++; return trex_newnode(exp,t); } static int trex_class(TRex *exp) @@ -179,11 +179,11 @@ static int trex_class(TRex *exp) ret = trex_newnode(exp,OP_NCLASS); exp->_p++; }else ret = trex_newnode(exp,OP_CLASS); - + if(*exp->_p == ']') trex_error(exp,_SC("empty class")); chain = ret; while(*exp->_p != ']' && exp->_p != exp->_eol) { - if(*exp->_p == '-' && first != -1){ + if(*exp->_p == '-' && first != -1){ int r,t; if(*exp->_p++ == ']') trex_error(exp,_SC("unfinished range")); r = trex_newnode(exp,OP_RANGE); @@ -297,7 +297,7 @@ static int trex_element(TRex *exp) trex_error(exp,_SC(", or } expected")); } /*******************************/ - isgreedy = TRex_True; + isgreedy = TRex_True; break; } @@ -384,7 +384,7 @@ static TRexBool trex_matchclass(TRex* exp,TRexNode *node,TRexChar c) static const TRexChar *trex_matchnode(TRex* exp,TRexNode *node,const TRexChar *str,TRexNode *next) { - + TRexNodeType type = node->type; switch(type) { case OP_GREEDY: { @@ -428,7 +428,7 @@ static const TRexChar *trex_matchnode(TRex* exp,TRexNode *node,const TRexChar *s } } } - + if(s >= exp->_eol) break; } @@ -467,7 +467,7 @@ static const TRexChar *trex_matchnode(TRex* exp,TRexNode *node,const TRexChar *s exp->_matches[capture].begin = cur; exp->_currsubexp++; } - + do { TRexNode *subnext = NULL; if(n->next != -1) { @@ -484,10 +484,10 @@ static const TRexChar *trex_matchnode(TRex* exp,TRexNode *node,const TRexChar *s } } while((n->next != -1) && (n = &exp->_nodes[n->next])); - if(capture != -1) + if(capture != -1) exp->_matches[capture].len = cur - exp->_matches[capture].begin; return cur; - } + } case OP_WB: if(str == exp->_bol && !isspace(*str) || (str == exp->_eol && !isspace(*(str-1))) |
