diff options
| author | Masaki Muranaka <[email protected]> | 2012-05-12 14:21:06 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2012-05-12 14:21:06 +0900 |
| commit | 40d122dedea41994dc227d2a3a5846d7e51ce3b4 (patch) | |
| tree | ed737193e0a5b954d52fe11dd9f6ead629341b8b | |
| parent | e6631bf5af382b55aa6d47f60ab64f251cef3136 (diff) | |
| download | mruby-40d122dedea41994dc227d2a3a5846d7e51ce3b4.tar.gz mruby-40d122dedea41994dc227d2a3a5846d7e51ce3b4.zip | |
Simplify while loop in peek_n().
| -rw-r--r-- | src/parse.y | 5 |
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); } |
