-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathParseDrop.cpp
More file actions
42 lines (37 loc) · 939 Bytes
/
ParseDrop.cpp
File metadata and controls
42 lines (37 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// ParseDrop.cpp
// SQL parser and interpreter
//
// Created by 王璇 on 17/2/5.
// Copyright © 2017年 Xuan Wang. All rights reserved.
//
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "lexanal.h"
char ParseDrop(char check, char* tname, char* p, char* token, int token_code){
int i;
//get next token--TABLE
p=lex_anal( p, token, &token_code );//watch out for space
if(token_code!=TABLE){
printf("Error: keyword TABLE excepted");
check='N';
return check;
}
//get next token--table name
p=lex_anal( p, token, &token_code );
if(token_code!=IDENTIFIER){
printf("Error: table name expected");
check='N';
return check;
}
else{
//store table name
for(i=0;i<strlen(token);i++){
tname[i]=token[i];
}
tname[i]='\0';
return check='Y';
}
}