summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-05-12 02:40:32 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-05-12 02:40:32 -0700
commitf3374d7e95785d75710bea625fe47420c3978141 (patch)
treeed737193e0a5b954d52fe11dd9f6ead629341b8b /src
parente6631bf5af382b55aa6d47f60ab64f251cef3136 (diff)
parent40d122dedea41994dc227d2a3a5846d7e51ce3b4 (diff)
downloadmruby-f3374d7e95785d75710bea625fe47420c3978141.tar.gz
mruby-f3374d7e95785d75710bea625fe47420c3978141.zip
Merge pull request #122 from monaka/pr-simplify-peek_n-20110512
Simplify while loop in peek_n().
Diffstat (limited to 'src')
-rw-r--r--src/parse.y5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/parse.y b/src/parse.y
index 5bce579e7..4c339f0f4 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -3056,12 +3056,11 @@ peek_n(parser_state *p, int c, int n)
node *list = 0;
int c0;
- n++; /* must read 1 char */
- while (n--) {
+ do {
c0 = nextc(p);
if (c0 < 0) return FALSE;
list = push(list, (node*)(intptr_t)c0);
- }
+ } while(n--);
if (p->pb) {
p->pb = push(p->pb, (node*)list);
}