Ejemplo n.º 1
0
void DocumentPropertiesDialog::piTargetChanged ( const QString &text )
{
  const QModelIndex &idx = ui->listViewPI->currentIndex();
  QString oldKey = piKeyByIndex ( idx );
  QString value = _pi[oldKey];
  _pi.remove ( oldKey );

  QString correct_text = checkSymbols ( text );

  _pi.insert ( correct_text, value );
  piModel->setData ( idx, correct_text );
}
Ejemplo n.º 2
0
int scanFile(FILE *fp){
    if(fp == NULL){
        printf("File could not be found.\n");
        return -1;
    }

    printf("Reading in tokens...");

    while(fpeek(fp) != EOF){
        int tokenStart = fgetc(fp);
        int error = 0;

        //If we read whitespace, continue;
        if(tokenStart == '\n' || tokenStart == '\r' || tokenStart == '\t' ||
           tokenStart == '\v' || tokenStart == ' '){
               continue;
        }

        error = checkSymbols(fp, tokenStart);

        if(error == 4){
           printf("ERROR Invalid symbol '%c'\n", tokenStart);
           exit(4);
        }
        else if(error == 0){
           continue;
        }

        error = checkReservedWords(fp, tokenStart);

        if(error == -1){

           error = checkVariable(fp, tokenStart);

           if(error == 3){
               printf("ERROR Name exceeds 11 characters\n");
               exit(3);
           }
           else if(error == 0){
               continue;
           }
        }
        else if(error == 0){
           continue;
        }

        error = checkNumber(fp, tokenStart);

        if(error == 2){
           printf("ERROR number exceeds 5 digits\n");
           exit(2);
        }
        else if(error == 1){
           printf("ERROR Variables can't start with a letter");
           exit(1);
        }
        else if(error == 0){
           continue;
        }
    }

    createToken("null", 1);
    printf("COMPLETE\n");
    return 0;


}