summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-05-17 19:09:29 +0900
committerYukihiro Matsumoto <[email protected]>2012-05-17 19:09:29 +0900
commit89e31b5838bc4c53aabfad92290e7e9fe3e55408 (patch)
treee63f3d07a195d262a62fbdbdcfba4c1aa929f164 /src
parent490fa452983b66048ce796f853b80bfae60c0388 (diff)
downloadmruby-89e31b5838bc4c53aabfad92290e7e9fe3e55408.tar.gz
mruby-89e31b5838bc4c53aabfad92290e7e9fe3e55408.zip
too many line count in nextc()
Diffstat (limited to 'src')
-rw-r--r--src/parse.y40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/parse.y b/src/parse.y
index d80fce87a..32026f09c 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -3003,29 +3003,31 @@ nextc(parser_state *p)
p->pb = p->pb->cdr;
cons_free(tmp);
}
- else if (p->f) {
- if (feof(p->f)) return -1;
- c = fgetc(p->f);
- if (c == EOF) return -1;
- }
- else if (!p->s || p->s >= p->send) {
- return -1;
- }
else {
- c = *p->s++;
- }
- if (c == '\n') {
- if (p->column < 0) {
- p->column++; // pushback caused an underflow
+ if (p->f) {
+ if (feof(p->f)) return -1;
+ c = fgetc(p->f);
+ if (c == EOF) return -1;
+ }
+ else if (!p->s || p->s >= p->send) {
+ return -1;
}
else {
- p->lineno++;
- p->column = 0;
+ c = *p->s++;
+ }
+ if (c == '\n') {
+ if (p->column < 0) {
+ p->column++; // pushback caused an underflow
+ }
+ else {
+ p->lineno++;
+ p->column = 0;
+ }
+ // must understand heredoc
+ }
+ else {
+ p->column++;
}
- // must understand heredoc
- }
- else {
- p->column++;
}
return c;
}