--- libaegis/sub/expr_gram.y.orig 2020-06-17 17:51:38.214116000 -0400 +++ libaegis/sub/expr_gram.y 2020-06-17 17:52:02.149971000 -0400 @@ -1,22 +1,24 @@ /* - * aegis - project change supervisor - * Copyright (C) 1996, 1999, 2002, 2003, 2005-2008 Peter Miller + * aegis - project change supervisor + * Copyright (C) 1996, 1999, 2002, 2003, 2005-2008 Peter Miller + * Copyright (C) 2020 Aryeh M. Friedman * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * . + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + * . */ +%define api.prefix {sub_expr_gram_} %{ #include @@ -57,7 +59,7 @@ %union { - long lv_number; + long lv_number; } %type NUMBER expr @@ -94,7 +96,7 @@ trace(("}\n")); if (bad) - return ""; + return ""; return nstring::format("%ld", result); } @@ -112,21 +114,21 @@ /* * jiggery-pokery for yacc * - * Replace all calls to printf with a call to trace_printf. The - * trace_where_ is needed to set the location, and is safe, because - * yacc only invokes the printf with an if (be careful, the printf - * is not in a compound statement). + * Replace all calls to printf with a call to trace_printf. The + * trace_where_ is needed to set the location, and is safe, because + * yacc only invokes the printf with an if (be careful, the printf + * is not in a compound statement). */ #define printf trace_where_, trace_printf /* * jiggery-pokery for bison * - * Replace all calls to fprintf with a call to yydebugger. Ignore - * the first argument, it will be "stderr". The trace_where_ is - * needed to set the location, and is safe, because bison only - * invokes the printf with an if (be careful, the fprintf is not in - * a compound statement). + * Replace all calls to fprintf with a call to yydebugger. Ignore + * the first argument, it will be "stderr". The trace_where_ is + * needed to set the location, and is safe, because bison only + * invokes the printf with an if (be careful, the fprintf is not in + * a compound statement). */ #define fprintf trace_where_, yydebugger @@ -151,40 +153,41 @@ grammar: expr - { result = $1; } + { result = $1; } ; expr : LP expr RP - { $$ = $2; trace(("$$ = %ld;\n", $$)); } + { $$ = $2; trace(("$$ = %ld;\n", $$)); } | NUMBER - { $$ = $1; trace(("$$ = %ld;\n", $$)); } + { $$ = $1; trace(("$$ = %ld;\n", $$)); } | MINUS expr - %prec UNARY - { $$ = -$2; trace(("$$ = %ld;\n", $$)); } + %prec UNARY + { $$ = -$2; trace(("$$ = %ld;\n", $$)); } | expr PLUS expr - { $$ = $1 + $3; trace(("$$ = %ld;\n", $$)); } + { $$ = $1 + $3; trace(("$$ = %ld;\n", $$)); } | expr MINUS expr - { $$ = $1 - $3; trace(("$$ = %ld;\n", $$)); } + { $$ = $1 - $3; trace(("$$ = %ld;\n", $$)); } | expr MUL expr - { $$ = $1 * $3; trace(("$$ = %ld;\n", $$)); } + { $$ = $1 * $3; trace(("$$ = %ld;\n", $$)); } | expr DIV expr - { $$ = $3 ? $1 / $3 : 0; trace(("$$ = %ld;\n", $$)); } + { $$ = $3 ? $1 / $3 : 0; trace(("$$ = %ld;\n", $$)); } | expr MOD expr - { $$ = $3 ? $1 % $3 : 0; trace(("$$ = %ld;\n", $$)); } + { $$ = $3 ? $1 % $3 : 0; trace(("$$ = %ld;\n", $$)); } | expr EQ expr - { $$ = ($1 == $3); trace(("$$ = %ld;\n", $$)); } + { $$ = ($1 == $3); trace(("$$ = %ld;\n", $$)); } | expr NE expr - { $$ = ($1 != $3); trace(("$$ = %ld;\n", $$)); } + { $$ = ($1 != $3); trace(("$$ = %ld;\n", $$)); } | expr LT expr - { $$ = ($1 < $3); trace(("$$ = %ld;\n", $$)); } + { $$ = ($1 < $3); trace(("$$ = %ld;\n", $$)); } | expr LE expr - { $$ = ($1 <= $3); trace(("$$ = %ld;\n", $$)); } + { $$ = ($1 <= $3); trace(("$$ = %ld;\n", $$)); } | expr GT expr - { $$ = ($1 > $3); trace(("$$ = %ld;\n", $$)); } + { $$ = ($1 > $3); trace(("$$ = %ld;\n", $$)); } | expr GE expr - { $$ = ($1 >= $3); trace(("$$ = %ld;\n", $$)); } + { $$ = ($1 >= $3); trace(("$$ = %ld;\n", $$)); } | NOT expr - %prec UNARY - { $$ = (!$2); trace(("$$ = %ld;\n", $$)); } + %prec UNARY + { $$ = (!$2); trace(("$$ = %ld;\n", $$)); } ; +// vim: set ts=8 sw=4 et :