diff --git a/scripts/prettyasserts.py b/scripts/prettyasserts.py index d1d193ad..3ea39100 100755 --- a/scripts/prettyasserts.py +++ b/scripts/prettyasserts.py @@ -35,7 +35,8 @@ LEXEMES = { 'paren': ['\(', '\)'], 'cmp': list(CMP.keys()), 'logic': ['\&\&', '\|\|'], - 'sep': [':', ';', '\{', '\}', ','], + 'sep': ['\?', ':', ','], + 'term': [';', '\{', '\}'], # specifically ops that conflict with cmp 'op': ['->', '>>', '<<'], } @@ -346,7 +347,7 @@ def p_expr(p): res.append(p.m) while True: res.append(p_exprs(p)) - if p.accept('sep'): + if p.accept('sep', 'term'): res.append(p.m) else: break @@ -374,7 +375,7 @@ def p_exprs(p): res = [] while True: res.append(p_expr(p)) - if p.accept('cmp', 'logic', ','): + if p.accept('cmp', 'logic', 'sep'): res.append(p.m) else: return ''.join(res) @@ -479,7 +480,7 @@ def main(input=None, output=None, *, try: while True: f.write(p_stmt(p)) - if p.accept('sep'): + if p.accept('term'): f.write(p.m) else: break diff --git a/tests/test_forphans.toml b/tests/test_forphans.toml index 6281777c..e1563c99 100644 --- a/tests/test_forphans.toml +++ b/tests/test_forphans.toml @@ -6085,7 +6085,7 @@ code = ''' } lfsr_file_write(&lfs, &sim_files[j]->file, wbuf, SIZE) => SIZE; lfsr_file_sync(&lfs, &sim_files[j]->file) - => ((!sim_files[j]->zombie) ? 0 : LFS_ERR_NOENT); + => (!sim_files[j]->zombie) ? 0 : LFS_ERR_NOENT; // close a file? } else if (op == 2) { @@ -6430,7 +6430,7 @@ code = ''' } lfsr_file_write(&lfs, &sim_files[j]->file, wbuf, SIZE) => SIZE; lfsr_file_sync(&lfs, &sim_files[j]->file) - => ((!sim_files[j]->zombie) ? 0 : LFS_ERR_NOENT); + => (!sim_files[j]->zombie) ? 0 : LFS_ERR_NOENT; // close a file? } else if (op == 2) { diff --git a/tests/test_wl.toml b/tests/test_wl.toml index 4c942b41..0e9ac9c6 100644 --- a/tests/test_wl.toml +++ b/tests/test_wl.toml @@ -513,7 +513,7 @@ code = ''' } lfsr_file_write(&lfs, &sim_files[j]->file, wbuf, SIZE) => SIZE; lfsr_file_sync(&lfs, &sim_files[j]->file) - => ((!sim_files[j]->zombie) ? 0 : LFS_ERR_NOENT); + => (!sim_files[j]->zombie) ? 0 : LFS_ERR_NOENT; // close a file? } else if (op == 2) { @@ -859,7 +859,7 @@ code = ''' } lfsr_file_write(&lfs, &sim_files[j]->file, wbuf, SIZE) => SIZE; lfsr_file_sync(&lfs, &sim_files[j]->file) - => ((!sim_files[j]->zombie) ? 0 : LFS_ERR_NOENT); + => (!sim_files[j]->zombie) ? 0 : LFS_ERR_NOENT; // close a file? } else if (op == 2) {