From: Andre Noll Date: Wed, 19 Mar 2025 23:17:40 +0000 (+0100) Subject: mp.y: Fix some trivialities. X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=62ddb47aed8039f02e887db9dedcbbe15ab23813;p=paraslash.git mp.y: Fix some trivialities. Some lines were indented with spaces rather than tabs, and the file contained a few stray semicolons with no effect. --- diff --git a/yy/mp.y b/yy/mp.y index 8df4f20e..dc04488f 100644 --- a/yy/mp.y +++ b/yy/mp.y @@ -353,9 +353,9 @@ bool mp_eval_ast(struct mp_ast_node *root, struct mp_context *ctx) %% program: - /* empty */ {*ast = NULL; return 0;} - | string {*ast = $1; return 0;} - | exp {*ast = $1; return 0;} + /* empty */ {*ast = NULL; return 0;} + | string {*ast = $1; return 0;} + | exp {*ast = $1; return 0;} | boolexp {*ast = $1; return 0;} string: STRING_LITERAL {$$ = $1;} @@ -364,15 +364,14 @@ string: STRING_LITERAL {$$ = $1;} | TITLE {$$ = mp_new_ast_leaf_node(TITLE);} | ALBUM {$$ = mp_new_ast_leaf_node(ALBUM);} | COMMENT {$$ = mp_new_ast_leaf_node(COMMENT);} -; exp: NUM {$$ = $1;} - | exp '+' exp {$$ = ast_node_new_binary('+', $1, $3);} - | exp '-' exp {$$ = ast_node_new_binary('-', $1, $3);} - | exp '*' exp {$$ = ast_node_new_binary('*', $1, $3);} - | exp '/' exp {$$ = ast_node_new_binary('/', $1, $3);} - | '-' exp %prec NEG {$$ = ast_node_new_unary(NEG, $2);} - | '(' exp ')' {$$ = $2;} + | exp '+' exp {$$ = ast_node_new_binary('+', $1, $3);} + | exp '-' exp {$$ = ast_node_new_binary('-', $1, $3);} + | exp '*' exp {$$ = ast_node_new_binary('*', $1, $3);} + | exp '/' exp {$$ = ast_node_new_binary('/', $1, $3);} + | '-' exp %prec NEG {$$ = ast_node_new_unary(NEG, $2);} + | '(' exp ')' {$$ = $2;} | YEAR {$$ = mp_new_ast_leaf_node(YEAR);} | NUM_ATTRIBUTES_SET {$$ = mp_new_ast_leaf_node(NUM_ATTRIBUTES_SET);} | NUM_PLAYED {$$ = mp_new_ast_leaf_node(NUM_PLAYED);} @@ -382,7 +381,6 @@ exp: NUM {$$ = $1;} | FREQUENCY {$$ = mp_new_ast_leaf_node(FREQUENCY);} | CHANNELS {$$ = mp_new_ast_leaf_node(CHANNELS);} | DURATION {$$ = mp_new_ast_leaf_node(DURATION);} -; boolexp: IS_SET '(' STRING_LITERAL ')' {$$ = ast_node_new_unary(IS_SET, $3);} | TRUE {$$ = mp_new_ast_leaf_node(TRUE);} @@ -409,7 +407,6 @@ boolexp: IS_SET '(' STRING_LITERAL ')' {$$ = ast_node_new_unary(IS_SET, $3);} } | string EQUAL string {$$ = ast_node_new_binary(EQUAL, $1, $3);} | string NOT_EQUAL string {$$ = ast_node_new_binary(NOT_EQUAL, $1, $3);} -; %% /* Called by yyparse() on error */