
#include "yodl.h"

void
gram_warn (char const *rule, char const *msg,...)
{
  va_list args;

  if (!flags.warn)
    return;

  /* urg, duplicate code in error_gram */
  if (!lexbuf || !*lexbuf)
    lexbuf = "<empty>";
  else if (*lexbuf == '\n')
    lexbuf = "<newline>";

  /*
    use GNU style message
    if only to enable yfte (TM) to take you there.
   */
  gnu_warning (rule);

  va_start (args, msg);
  gnu_vwarning (msg, args);
  va_end (args);
  gnu_warning ("last parsed symbol: `%s'", lexbuf);
}

