Ignore:
Timestamp:
2003-05-01T10:59:14+12:00 (21 years ago)
Author:
kjdon
Message:

parseQuery (in GSDLQueryParser) now returns NULL if there has been a syntax error. So all the auxiliary functions either return NULl
if there is an error, or set an error flag to true. Queryer now tells the user that there has been invalid syntax rather than seg faulting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mgpp/text/Queryer.cpp

    r3365 r4210  
    242242      // regular query
    243243      queryTree = ParseQuery (queryArray, defaultBoolCombine, defaultStemMethod);
    244 
    245       // print the query
    246       PrintNode (cout, queryTree);
    247 
    248       MGQuery (indexData, queryInfo, queryTree, queryResult, level);
    249       if (shortOutput) {
    250     queryResult.printShort(cout);
    251     cout << "\n";
    252       }else {
    253     cout << queryResult;
    254     cout << "\n";
    255       }
    256       // delete the query
    257       if (queryTree != NULL) delete queryTree;
    258       queryTree = NULL;
     244      if (queryTree == NULL) {
     245    cout << "invalid syntax\n";
     246      } else {
     247    // print the query
     248    PrintNode (cout, queryTree);
     249   
     250    MGQuery (indexData, queryInfo, queryTree, queryResult, level);
     251    if (shortOutput) {
     252      queryResult.printShort(cout);
     253      cout << "\n";
     254    } else {
     255      cout << queryResult;
     256      cout << "\n";
     257    }
     258    // delete the query
     259    delete queryTree;
     260    queryTree = NULL;
     261      }
    259262    }
    260263  }
Note: See TracChangeset for help on using the changeset viewer.