projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
masterをマージ
[YACASL2.git]
/
src
/
token.c
diff --git
a/src/token.c
b/src/token.c
index
68ed3a7
..
2757a7b
100644
(file)
--- a/
src/token.c
+++ b/
src/token.c
@@
-5,8
+5,8
@@
OPD *opdtok(const char *str)
{
OPD *opd = malloc(sizeof(OPD));
OPD *opdtok(const char *str)
{
OPD *opd = malloc(sizeof(OPD));
- char *p, *q, *
r, *
sepp;
- int sepc = ',', len;
+ char *p, *q, *sepp;
+ int sepc = ',', len
= 0
;
bool quoting = false;
opd->opdc = 0;
bool quoting = false;
opd->opdc = 0;
@@
-24,9
+24,16
@@
OPD *opdtok(const char *str)
if(*q == '=') {
q++;
}
if(*q == '=') {
q++;
}
- /* 「'」で囲まれた文字列の処理。「''」は無視 */
- if(*q == '\'' && *(q+1) != '\'' && !(p < q && *(q-1) == '\'')) {
- quoting = !quoting;
+ /* 「'」の場合 */
+ if(*q == '\'') {
+ /* 「''」以外の場合はquote値を反転 */
+ if(*(q+1) != '\'' && !(p < q && *(q-1) == '\'')) {
+ quoting = !quoting;
+ }
+ /* 「'」の分、文字列の長さを小さくする */
+ if(*(q+1) != '\'') {
+ len--;
+ }
}
if(quoting == true) {
/* 閉じ「'」がないまま文字列が終了した場合 */
}
if(quoting == true) {
/* 閉じ「'」がないまま文字列が終了した場合 */
@@
-43,12
+50,8
@@
OPD *opdtok(const char *str)
setcerr(121, NULL); /* cannot get operand token */
break;
}
setcerr(121, NULL); /* cannot get operand token */
break;
}
- len = strlen(r = p);
- while(*r != '\0' && (r = strstr(r, "''")) != NULL) {
- len--;
- r += 2;
- };
- if(len > OPDSIZE + 2) { /* OPDSIZE + 「'」2文字分 */
+ len += strlen(p);
+ if(len > OPDSIZE) {
setcerr(118, NULL); /* operand length is too long */
break;
}
setcerr(118, NULL); /* operand length is too long */
break;
}