Browse Source

py: Change macro var args in parser to be C99 compliant.

pull/210/merge
Damien George 11 years ago
parent
commit
00208ce194
  1. 2
      py/compile.c
  2. 8
      py/parse.c

2
py/compile.c

@ -23,7 +23,7 @@
typedef enum {
PN_none = 0,
#define DEF_RULE(rule, comp, kind, arg...) PN_##rule,
#define DEF_RULE(rule, comp, kind, ...) PN_##rule,
#include "grammar.h"
#undef DEF_RULE
PN_maximum_number_of,

8
py/parse.c

@ -40,7 +40,7 @@ typedef struct _rule_t {
enum {
RULE_none = 0,
#define DEF_RULE(rule, comp, kind, arg...) RULE_##rule,
#define DEF_RULE(rule, comp, kind, ...) RULE_##rule,
#include "grammar.h"
#undef DEF_RULE
RULE_maximum_number_of,
@ -56,9 +56,9 @@ enum {
#define opt_tok(t) (RULE_ARG_OPT_TOK | MP_TOKEN_##t)
#define opt_rule(r) (RULE_ARG_OPT_RULE | RULE_##r)
#ifdef USE_RULE_NAME
#define DEF_RULE(rule, comp, kind, arg...) static const rule_t rule_##rule = { RULE_##rule, kind, #rule, { arg } };
#define DEF_RULE(rule, comp, kind, ...) static const rule_t rule_##rule = { RULE_##rule, kind, #rule, { __VA_ARGS__ } };
#else
#define DEF_RULE(rule, comp, kind, arg...) static const rule_t rule_##rule = { RULE_##rule, kind, { arg } };
#define DEF_RULE(rule, comp, kind, ...) static const rule_t rule_##rule = { RULE_##rule, kind, { __VA_ARGS__ } };
#endif
#include "grammar.h"
#undef or
@ -74,7 +74,7 @@ enum {
static const rule_t *rules[] = {
NULL,
#define DEF_RULE(rule, comp, kind, arg...) &rule_##rule,
#define DEF_RULE(rule, comp, kind, ...) &rule_##rule,
#include "grammar.h"
#undef DEF_RULE
};

Loading…
Cancel
Save