mirror of
https://git.freebsd.org/ports.git
synced 2025-04-30 18:46:38 -04:00
373 lines
7.6 KiB
Text
373 lines
7.6 KiB
Text
--- libaegis/sub/plural_gram.y.orig 2020-06-17 17:52:35.548476000 -0400
|
|
+++ libaegis/sub/plural_gram.y 2020-06-17 17:52:46.221850000 -0400
|
|
@@ -1,22 +1,24 @@
|
|
/*
|
|
- * aegis - project change supervisor
|
|
- * Copyright (C) 2002-2008 Peter Miller
|
|
+ * aegis - project change supervisor
|
|
+ * Copyright (C) 2002-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
|
|
- * <http://www.gnu.org/licenses/>.
|
|
+ * You should have received a copy of the GNU General Public License
|
|
+ * along with this program. If not, see
|
|
+ * <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
+%define api.prefix {sub_plural_gram_}
|
|
%{
|
|
|
|
#include <common/ac/stdarg.h>
|
|
@@ -114,9 +116,9 @@
|
|
|
|
trace(("}\n"));
|
|
if (bad)
|
|
- return 0;
|
|
+ return 0;
|
|
if (plural >= nplurals)
|
|
- return 0;
|
|
+ return 0;
|
|
return plural;
|
|
}
|
|
|
|
@@ -132,35 +134,35 @@
|
|
/*
|
|
* 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
|
|
|
|
static void
|
|
yydebugger(void *, const char *fmt, ...)
|
|
{
|
|
- va_list ap;
|
|
- string_ty *s;
|
|
+ va_list ap;
|
|
+ string_ty *s;
|
|
|
|
- va_start(ap, fmt);
|
|
- s = str_vformat(fmt, ap);
|
|
- va_end(ap);
|
|
- trace_printf("%s", s->str_text);
|
|
- str_free(s);
|
|
+ va_start(ap, fmt);
|
|
+ s = str_vformat(fmt, ap);
|
|
+ va_end(ap);
|
|
+ trace_printf("%s", s->str_text);
|
|
+ str_free(s);
|
|
}
|
|
|
|
#endif
|
|
@@ -170,138 +172,139 @@
|
|
%%
|
|
|
|
grammar:
|
|
- nplurals SEMI plural
|
|
- ;
|
|
+ nplurals SEMI plural
|
|
+ ;
|
|
|
|
nplurals
|
|
- : NPLURALS EQU INTEGER
|
|
- {
|
|
- nplurals = $3;
|
|
- }
|
|
- ;
|
|
+ : NPLURALS EQU INTEGER
|
|
+ {
|
|
+ nplurals = $3;
|
|
+ }
|
|
+ ;
|
|
|
|
plural
|
|
- : PLURAL EQU expr
|
|
- {
|
|
- plural = $3;
|
|
- }
|
|
- ;
|
|
+ : PLURAL EQU expr
|
|
+ {
|
|
+ plural = $3;
|
|
+ }
|
|
+ ;
|
|
|
|
expr
|
|
- : LP expr RP
|
|
- {
|
|
- $$ = $2;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | NUMBER
|
|
- {
|
|
- $$ = number;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | INTEGER
|
|
- {
|
|
- $$ = $1;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | MINUS expr
|
|
- %prec UNARY
|
|
- {
|
|
- $$ = -$2;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr PLUS expr
|
|
- {
|
|
- $$ = $1 + $3;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr MINUS expr
|
|
- {
|
|
- $$ = $1 - $3;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr MUL expr
|
|
- {
|
|
- $$ = $1 * $3;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr DIV expr
|
|
- {
|
|
- $$ = $3 ? $1 / $3 : 0;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr MOD expr
|
|
- {
|
|
- $$ = $3 ? $1 % $3 : 0;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr EQ expr
|
|
- {
|
|
- $$ = ($1 == $3);
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr NE expr
|
|
- {
|
|
- $$ = ($1 != $3);
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr LT expr
|
|
- {
|
|
- $$ = ($1 < $3);
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr LE expr
|
|
- {
|
|
- $$ = ($1 <= $3);
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr GT expr
|
|
- {
|
|
- $$ = ($1 > $3);
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr GE expr
|
|
- {
|
|
- $$ = ($1 >= $3);
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | NOT expr
|
|
- {
|
|
- $$ = (!$2);
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | BITNOT expr
|
|
- {
|
|
- $$ = ~$2;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr ANDAND expr
|
|
- {
|
|
- $$ = $1 && $3;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr BITAND expr
|
|
- {
|
|
- $$ = $1 & $3;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr OROR expr
|
|
- {
|
|
- $$ = $1 || $3;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr BITOR expr
|
|
- {
|
|
- $$ = $1 | $3;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr BITXOR expr
|
|
- {
|
|
- $$ = $1 ^ $3;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- | expr QUEST expr COLON expr
|
|
- {
|
|
- $$ = $1 ? $3 : $5;
|
|
- trace(("$$ = %u;\n", $$));
|
|
- }
|
|
- ;
|
|
+ : LP expr RP
|
|
+ {
|
|
+ $$ = $2;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | NUMBER
|
|
+ {
|
|
+ $$ = number;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | INTEGER
|
|
+ {
|
|
+ $$ = $1;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | MINUS expr
|
|
+ %prec UNARY
|
|
+ {
|
|
+ $$ = -$2;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr PLUS expr
|
|
+ {
|
|
+ $$ = $1 + $3;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr MINUS expr
|
|
+ {
|
|
+ $$ = $1 - $3;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr MUL expr
|
|
+ {
|
|
+ $$ = $1 * $3;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr DIV expr
|
|
+ {
|
|
+ $$ = $3 ? $1 / $3 : 0;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr MOD expr
|
|
+ {
|
|
+ $$ = $3 ? $1 % $3 : 0;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr EQ expr
|
|
+ {
|
|
+ $$ = ($1 == $3);
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr NE expr
|
|
+ {
|
|
+ $$ = ($1 != $3);
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr LT expr
|
|
+ {
|
|
+ $$ = ($1 < $3);
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr LE expr
|
|
+ {
|
|
+ $$ = ($1 <= $3);
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr GT expr
|
|
+ {
|
|
+ $$ = ($1 > $3);
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr GE expr
|
|
+ {
|
|
+ $$ = ($1 >= $3);
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | NOT expr
|
|
+ {
|
|
+ $$ = (!$2);
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | BITNOT expr
|
|
+ {
|
|
+ $$ = ~$2;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr ANDAND expr
|
|
+ {
|
|
+ $$ = $1 && $3;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr BITAND expr
|
|
+ {
|
|
+ $$ = $1 & $3;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr OROR expr
|
|
+ {
|
|
+ $$ = $1 || $3;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr BITOR expr
|
|
+ {
|
|
+ $$ = $1 | $3;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr BITXOR expr
|
|
+ {
|
|
+ $$ = $1 ^ $3;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ | expr QUEST expr COLON expr
|
|
+ {
|
|
+ $$ = $1 ? $3 : $5;
|
|
+ trace(("$$ = %u;\n", $$));
|
|
+ }
|
|
+ ;
|
|
+// vim: set ts=8 sw=4 et :
|