From e2c9782a65eb57f481d441d40161de427e1940ba Mon Sep 17 00:00:00 2001 From: Chris Angelico Date: Tue, 10 Jun 2014 05:05:57 +1000 Subject: [PATCH] More whitespace fixups --- py/lexer.c | 28 ++++++++++++++-------------- py/vstr.c | 8 ++++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/py/lexer.c b/py/lexer.c index 3aaa8fe8e5..1561a2d014 100644 --- a/py/lexer.c +++ b/py/lexer.c @@ -504,12 +504,12 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, mp_token_t *tok, bool firs case 'r': c = 0x0d; break; case 'u': case 'U': - if (is_bytes) { - // b'\u1234' == b'\\u1234' - vstr_add_char(&lex->vstr, '\\'); - break; - } - // Otherwise fall through. + if (is_bytes) { + // b'\u1234' == b'\\u1234' + vstr_add_char(&lex->vstr, '\\'); + break; + } + // Otherwise fall through. case 'x': { uint num = 0; @@ -527,7 +527,7 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, mp_token_t *tok, bool firs // roughly half a meg of storage. This form of Unicode escape may be added // later on, but it's definitely not a priority right now. -- CJA 20140607 assert(!"Unicode name escapes not supported"); - break; + break; default: if (c >= '0' && c <= '7') { // Octal sequence, 1-3 chars @@ -546,13 +546,13 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, mp_token_t *tok, bool firs } } if (c != MP_LEXER_CHAR_EOF) { - if (c < 0x110000 && !is_bytes) { - vstr_add_char(&lex->vstr, c); - } else if (c < 0x100 && is_bytes) { - vstr_add_byte(&lex->vstr, c); - } else { - assert(!"TODO: Throw an error, invalid escape code probably"); - } + if (c < 0x110000 && !is_bytes) { + vstr_add_char(&lex->vstr, c); + } else if (c < 0x100 && is_bytes) { + vstr_add_byte(&lex->vstr, c); + } else { + assert(!"TODO: Throw an error, invalid escape code probably"); + } } } else { vstr_add_char(&lex->vstr, CUR_CHAR(lex)); diff --git a/py/vstr.c b/py/vstr.c index 0b96a11e55..88f5ca61cf 100644 --- a/py/vstr.c +++ b/py/vstr.c @@ -205,20 +205,20 @@ void vstr_add_char(vstr_t *vstr, unichar c) { byte *buf = (byte*)vstr_add_len(vstr, 1); if (buf == NULL) { return; - } + } *buf = (byte)c; } else if (c < 0x800) { byte *buf = (byte*)vstr_add_len(vstr, 2); if (buf == NULL) { return; - } + } buf[0] = (c >> 6) | 0xC0; buf[1] = (c & 0x3F) | 0x80; } else if (c < 0x10000) { byte *buf = (byte*)vstr_add_len(vstr, 3); if (buf == NULL) { return; - } + } buf[0] = (c >> 12) | 0xE0; buf[1] = ((c >> 6) & 0x3F) | 0x80; buf[2] = (c & 0x3F) | 0x80; @@ -227,7 +227,7 @@ void vstr_add_char(vstr_t *vstr, unichar c) { byte *buf = (byte*)vstr_add_len(vstr, 4); if (buf == NULL) { return; - } + } buf[0] = (c >> 18) | 0xF0; buf[1] = ((c >> 12) & 0x3F) | 0x80; buf[2] = ((c >> 6) & 0x3F) | 0x80;