"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/parser.cpp" between
irods-4.2.5.tar.gz and irods-4.2.6.tar.gz

About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.

parser.cpp  (irods-4.2.5):parser.cpp  (irods-4.2.6)
skipping to change at line 258 skipping to change at line 258
} }
FPOS; FPOS;
dupString( e, &start, ( int )( pos.exprloc - start.exprloc ) , token->text ); dupString( e, &start, ( int )( pos.exprloc - start.exprloc ) , token->text );
break; break;
} }
else { else {
seekInFile( e, start.exprloc ); seekInFile( e, start.exprloc );
} }
} }
else if ( pathLiteral && ch == '/' ) { /* path */ else if ( pathLiteral && ch == '/' ) { /* path */
nextStringBase( e, token->text, "),; \t\r\n", 0, '\\', 0, token- >vars ); /* path can be used in a foreach loop or assignment, or as a function a rgument */ nextStringBase( e, token->text,MAX_TOKEN_TEXT_LEN, "),; \t\r\n", 0, '\\', 0, token->vars ); /* path can be used in a foreach loop or assignment, or as a function argument */
token->type = TK_PATH; token->type = TK_PATH;
break; break;
} }
char op[100]; char op[100];
dupString( e, &start, 10, op ); dupString( e, &start, 10, op );
int found = 0; int found = 0;
for ( i = 0; i < num_ops; i++ ) { for ( i = 0; i < num_ops; i++ ) {
int len = strlen( new_ops[i].string ); int len = strlen( new_ops[i].string );
if ( strncmp( op, new_ops[i].string, len ) == 0 && if ( strncmp( op, new_ops[i].string, len ) == 0 &&
skipping to change at line 322 skipping to change at line 322
else if ( ch == '\'' ) { else if ( ch == '\'' ) {
if ( nextString2( e, token->text, token->vars ) == -1 ) { if ( nextString2( e, token->text, token->vars ) == -1 ) {
token->type = N_ERROR; token->type = N_ERROR;
} }
else { else {
token->type = TK_STRING; token->type = TK_STRING;
} }
} }
else if ( ch == '`' ) { else if ( ch == '`' ) {
if ( lookAhead( e, 1 ) == '`' ) { if ( lookAhead( e, 1 ) == '`' ) {
if ( nextStringBase2( e, token->text, "``" ) == -1 ) { if ( nextStringBase2( e, token->text, MAX_TOKEN_TEXT_LEN, "` `" ) == -1 ) {
token->type = N_ERROR; token->type = N_ERROR;
} }
else { else {
token->type = TK_STRING; token->type = TK_STRING;
token->vars[0] = -1; token->vars[0] = -1;
} }
} }
else { else {
if ( nextStringBase( e, token->text, "`", 1, '\\', 1, token- >vars ) == -1 ) { if ( nextStringBase( e, token->text, MAX_TOKEN_TEXT_LEN, "`" , 1, '\\', 1, token->vars ) == -1 ) {
token->type = N_ERROR; token->type = N_ERROR;
} }
else { else {
token->type = TK_BACKQUOTED; token->type = TK_BACKQUOTED;
} }
} }
} }
else { else {
token->type = N_ERROR; token->type = N_ERROR;
} }
skipping to change at line 1553 skipping to change at line 1553
op = "&&"; op = "&&";
OR( Or ) OR( Or )
DONE( Junction ) DONE( Junction )
END_TRY( Or ) END_TRY( Or )
LOOP_END( Junction ) LOOP_END( Junction )
BUILD_NODE( N_QUERY_COND_JUNCTION, op, &start, n + 1, n + 1 ); BUILD_NODE( N_QUERY_COND_JUNCTION, op, &start, n + 1, n + 1 );
END_TRY( QueryCond ) END_TRY( QueryCond )
PARSER_FUNC_END( QueryCond ) PARSER_FUNC_END( QueryCond )
int nextStringBase2( Pointer *e, char *value, char* delim ) { int nextStringBase2( Pointer *e, char *value, int max_len, char* delim ) {
char *value0 = value;
nextChar( e ); nextChar( e );
int ch = nextChar( e ); int ch = nextChar( e );
while ( ch != -1 ) { while ( ch != -1 ) {
if (value >= value0 + max_len) {
return -1;
}
if ( delim[0] == ch && delim[1] == lookAhead( e, 1 ) ) { if ( delim[0] == ch && delim[1] == lookAhead( e, 1 ) ) {
if ( delim[0] == delim[1] ) { if ( delim[0] == delim[1] ) {
while ( lookAhead( e, 2 ) == delim[1] ) { while ( lookAhead( e, 2 ) == delim[1] ) {
*( value++ ) = delim[0]; *( value++ ) = delim[0];
if (value >= value0 + max_len) { return -1; }
nextChar( e ); nextChar( e );
} }
} }
*value = '\0'; *value = '\0';
nextChar( e ); nextChar( e );
nextChar( e ); nextChar( e );
return 0; return 0;
} }
*( value++ ) = ch; *( value++ ) = ch;
ch = nextChar( e ); ch = nextChar( e );
} }
return -1; return -1;
} }
/* /*
* return number of vars or -1 if no string found * return number of vars or -1 if no string found
*/ */
int nextStringBase( Pointer *e, char *value, char* delim, int consumeDelim, char escape, int cntOffset, int vars[] ) { int nextStringBase( Pointer *e, char *value, int max_len, char* delim, int consu meDelim, char escape, int cntOffset, int vars[] ) {
int mode = 1; /* 1 string 3 escape */ int mode = 1; /* 1 string 3 escape */
int nov = 0; int nov = 0;
char* value0 = value; char* value0 = value;
*value = lookAhead( e, 0 ); *value = lookAhead( e, 0 );
value++; value++;
int ch = nextChar( e ); int ch = nextChar( e );
while ( ch != -1 ) { while ( ch != -1 ) {
if (value >= value0 + max_len) {
return -1;
}
*value = ch; *value = ch;
switch ( mode ) { switch ( mode ) {
case 1: case 1:
if ( ch == escape ) { if ( ch == escape ) {
value--; value--;
mode = 3; mode = 3;
} }
else if ( strchr( delim, ch ) != NULL ) { else if ( strchr( delim, ch ) != NULL ) {
if ( consumeDelim ) { if ( consumeDelim ) {
value[1] = '\0'; value[1] = '\0';
skipping to change at line 1634 skipping to change at line 1642
else { else {
*value = ch; *value = ch;
} }
mode -= 2; mode -= 2;
} }
ch = nextChar( e ); ch = nextChar( e );
value ++; value ++;
} }
return -1; return -1;
} }
int nextStringParsed( Pointer *e, char *value, char* deliml, char *delimr, char *delim, int consumeDelim, int vars[] ) { int nextStringParsed( Pointer *e, char *value, int max_len, char* deliml, char * delimr, char *delim, int consumeDelim, int vars[] ) {
int mode = 0; /* level */ int mode = 0; /* level */
int nov = 0; int nov = 0;
char* value0 = value; char* value0 = value;
int ch = lookAhead( e, 0 ); int ch = lookAhead( e, 0 );
while ( ch != -1 ) { while ( ch != -1 ) {
if (value >= value0 + max_len) {
return -1;
}
*value = ch; *value = ch;
if ( strchr( deliml, ch ) != NULL ) { if ( strchr( deliml, ch ) != NULL ) {
mode ++; mode ++;
} }
else if ( mode > 0 && strchr( delimr, ch ) != NULL ) { else if ( mode > 0 && strchr( delimr, ch ) != NULL ) {
mode --; mode --;
} }
else if ( mode == 0 && strchr( delim, ch ) ) { else if ( mode == 0 && strchr( delim, ch ) ) {
if ( consumeDelim ) { if ( consumeDelim ) {
value[1] = '\0'; value[1] = '\0';
skipping to change at line 1669 skipping to change at line 1680
else if ( ( ch == '*' || ch == '$' ) && else if ( ( ch == '*' || ch == '$' ) &&
isalpha( lookAhead( e, 1 ) ) ) { isalpha( lookAhead( e, 1 ) ) ) {
vars[nov++] = value - value0; vars[nov++] = value - value0;
} }
ch = nextChar( e ); ch = nextChar( e );
value ++; value ++;
} }
return -1; return -1;
} }
int nextString( Pointer *e, char *value, int vars[] ) { int nextString( Pointer *e, char *value, int vars[] ) {
return nextStringBase( e, value, "\"", 1, '\\', 1, vars ); return nextStringBase( e, value, MAX_TOKEN_TEXT_LEN, "\"", 1, '\\', 1, vars );
} }
int nextString2( Pointer *e, char *value, int vars[] ) { int nextString2( Pointer *e, char *value, int vars[] ) {
return nextStringBase( e, value, "\'", 1, '\\', 1, vars ); return nextStringBase( e, value, MAX_TOKEN_TEXT_LEN,"\'", 1, '\\', 1, vars ) ;
} }
int getBinaryPrecedence( Token * token ) { int getBinaryPrecedence( Token * token ) {
int i; int i;
for ( i = 0; i < num_ops; i++ ) { for ( i = 0; i < num_ops; i++ ) {
if ( new_ops[i].arity == 2 && strcmp( new_ops[i].string, token->text ) = = 0 ) { if ( new_ops[i].arity == 2 && strcmp( new_ops[i].string, token->text ) = = 0 ) {
return new_ops[i].prec; return new_ops[i].prec;
} }
} }
return -1; return -1;
skipping to change at line 2829 skipping to change at line 2840
Label start; Label start;
token->exprloc = getFPos( &start, e, NULL )->exprloc; token->exprloc = getFPos( &start, e, NULL )->exprloc;
int ch = lookAhead( e, 0 ); int ch = lookAhead( e, 0 );
if ( ch == -1 ) { /* reach the end of stream */ if ( ch == -1 ) { /* reach the end of stream */
token->type = TK_EOS; token->type = TK_EOS;
strcpy( token->text, "EOS" ); strcpy( token->text, "EOS" );
} }
else { else {
ch = lookAhead( e, 0 ); ch = lookAhead( e, 0 );
if ( ch == '\"' ) { if ( ch == '\"' ) {
nextStringBase( e, token->text, "\"", 1, '\\', 1, token->vars ); nextStringBase( e, token->text, MAX_TOKEN_TEXT_LEN,"\"", 1, '\\', 1, token->vars );
skipWhitespace( e ); skipWhitespace( e );
} }
else if ( ch == '\'' ) { else if ( ch == '\'' ) {
nextStringBase( e, token->text, "\'", 1, '\\', 1, token->vars ); nextStringBase( e, token->text, MAX_TOKEN_TEXT_LEN,"\'", 1, '\\', 1, token->vars );
skipWhitespace( e ); skipWhitespace( e );
} }
else { else {
nextStringParsed( e, token->text, "(", ")", ",|)", 0, token->vars ); nextStringParsed( e, token->text, MAX_TOKEN_TEXT_LEN, "(", ")", ",|) ", 0, token->vars );
/* remove trailing ws */ /* remove trailing ws */
int l0; int l0;
l0 = strlen( token->text ); l0 = strlen( token->text );
while ( isspace( token->text[l0 - 1] ) ) { while ( isspace( token->text[l0 - 1] ) ) {
l0--; l0--;
} }
token->text[l0++] = '\0'; token->text[l0++] = '\0';
} }
token->type = TK_STRING; token->type = TK_STRING;
} }
 End of changes. 15 change blocks. 
11 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)