Ejemplo n.º 1
0
/*
** Pop the parser's stack once.
**
** If there is a destructor routine associated with the token which
** is popped from the stack, then call it.
*/
static void yy_pop_parser_stack(yyParser *pParser){
  yyStackEntry *yytos;
  assert( pParser->yyidx>=0 );
  yytos = &pParser->yystack[pParser->yyidx--];
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sPopping %s\n",
      yyTracePrompt,
      yyTokenName[yytos->major]);
  }
#endif
  yy_destructor(pParser, yytos->major, &yytos->minor);
}
Ejemplo n.º 2
0
/*
** Pop the parser's stack once.
**
** If there is a destructor routine associated with the token which
** is popped from the stack, then call it.
**
** Return the major token number for the symbol popped.
*/
static int yy_pop_parser_stack(yyParser *pParser){
  YYCODETYPE yymajor;
  yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];

  if( pParser->yyidx<0 ) return 0;
#ifndef NDEBUG
  if( yyTraceFILE && pParser->yyidx>=0 ){
    fprintf(yyTraceFILE,"%sPopping %s\n",
      yyTracePrompt,
      yyTokenName[yytos->major]);
  }
#endif
  yymajor = yytos->major;
  yy_destructor( yymajor, &yytos->minor);
  pParser->yyidx--;
  return yymajor;
}
Ejemplo n.º 3
0
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
  int yyruleno                 /* Number of the rule by which to reduce */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  configparserARG_FETCH;
  yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno>=0
        && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */

  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 0:
        /* No destructor defined for metalines */
        break;
      case 1:
        /* No destructor defined for metalines */
        /* No destructor defined for metaline */
        break;
      case 2:
        break;
      case 3:
        /* No destructor defined for varline */
        break;
      case 4:
        /* No destructor defined for global */
        break;
      case 5:
#line 115 "./configparser.y"
{ yymsp[-1].minor.yy78 = NULL; }
#line 822 "configparser.c"
  yy_destructor(1,&yymsp[0].minor);
        break;
      case 6:
        /* No destructor defined for include */
        break;
      case 7:
        /* No destructor defined for include_shell */
        break;
      case 8:
  yy_destructor(1,&yymsp[0].minor);
        break;
      case 9:
#line 144 "./configparser.y"
{
  if (ctx->ok) {
    buffer_copy_string_buffer(yymsp[0].minor.yy41->key, yymsp[-2].minor.yy43);
    if (strncmp(yymsp[-2].minor.yy43->ptr, "env.", sizeof("env.") - 1) == 0) {
      fprintf(stderr, "Setting env variable is not supported in conditional %d %s: %s\n",
          ctx->current->context_ndx,
          ctx->current->key->ptr, yymsp[-2].minor.yy43->ptr);
      ctx->ok = 0;
    } else if (NULL == array_get_element(ctx->current->value, yymsp[0].minor.yy41->key->ptr)) {
      array_insert_unique(ctx->current->value, yymsp[0].minor.yy41);
      yymsp[0].minor.yy41 = NULL;
    } else {
      fprintf(stderr, "Duplicate config variable in conditional %d %s: %s\n",
              ctx->current->context_ndx,
              ctx->current->key->ptr, yymsp[0].minor.yy41->key->ptr);
      ctx->ok = 0;
      yymsp[0].minor.yy41->free(yymsp[0].minor.yy41);
      yymsp[0].minor.yy41 = NULL;
    }
  }
  buffer_free(yymsp[-2].minor.yy43);
  yymsp[-2].minor.yy43 = NULL;
}
#line 859 "configparser.c"
  yy_destructor(2,&yymsp[-1].minor);
        break;
      case 10:
#line 168 "./configparser.y"
{
  array *vars = ctx->current->value;
  data_unset *du;

  if (strncmp(yymsp[-2].minor.yy43->ptr, "env.", sizeof("env.") - 1) == 0) {
    fprintf(stderr, "Appending env variable is not supported in conditional %d %s: %s\n",
        ctx->current->context_ndx,
        ctx->current->key->ptr, yymsp[-2].minor.yy43->ptr);
    ctx->ok = 0;
  } else if (NULL != (du = array_get_element(vars, yymsp[-2].minor.yy43->ptr))) {
    /* exists in current block */
    du = configparser_merge_data(du, yymsp[0].minor.yy41);
    if (NULL == du) {
      ctx->ok = 0;
    }
    else {
      buffer_copy_string_buffer(du->key, yymsp[-2].minor.yy43);
      array_replace(vars, du);
    }
    yymsp[0].minor.yy41->free(yymsp[0].minor.yy41);
  } else if (NULL != (du = configparser_get_variable(ctx, yymsp[-2].minor.yy43))) {
    du = configparser_merge_data(du, yymsp[0].minor.yy41);
    if (NULL == du) {
      ctx->ok = 0;
      du->free(du);
    }
    else {
      buffer_copy_string_buffer(du->key, yymsp[-2].minor.yy43);
      array_insert_unique(ctx->current->value, du);
    }
    yymsp[0].minor.yy41->free(yymsp[0].minor.yy41);
  } else {
    buffer_copy_string_buffer(yymsp[0].minor.yy41->key, yymsp[-2].minor.yy43);
    array_insert_unique(ctx->current->value, yymsp[0].minor.yy41);
  }
  buffer_free(yymsp[-2].minor.yy43);
  yymsp[-2].minor.yy43 = NULL;
  yymsp[0].minor.yy41 = NULL;
}
#line 903 "configparser.c"
  yy_destructor(3,&yymsp[-1].minor);
        break;
      case 11:
#line 208 "./configparser.y"
{
  if (strchr(yymsp[0].minor.yy0->ptr, '.') == NULL) {
    yygotominor.yy43 = buffer_init_string("var.");
    buffer_append_string_buffer(yygotominor.yy43, yymsp[0].minor.yy0);
    buffer_free(yymsp[0].minor.yy0);
    yymsp[0].minor.yy0 = NULL;
  } else {
    yygotominor.yy43 = yymsp[0].minor.yy0;
    yymsp[0].minor.yy0 = NULL;
  }
}
#line 919 "configparser.c"
        break;
      case 12:
#line 220 "./configparser.y"
{
  yygotominor.yy41 = configparser_merge_data(yymsp[-2].minor.yy41, yymsp[0].minor.yy41);
  if (NULL == yygotominor.yy41) {
    ctx->ok = 0;
  }
  yymsp[-2].minor.yy41 = NULL;
  yymsp[0].minor.yy41->free(yymsp[0].minor.yy41);
  yymsp[0].minor.yy41 = NULL;
}
#line 932 "configparser.c"
  yy_destructor(5,&yymsp[-1].minor);
        break;
      case 13:
#line 230 "./configparser.y"
{
  yygotominor.yy41 = yymsp[0].minor.yy41;
  yymsp[0].minor.yy41 = NULL;
}
#line 941 "configparser.c"
        break;
      case 14:
#line 235 "./configparser.y"
{
  yygotominor.yy41 = NULL;
  if (strncmp(yymsp[0].minor.yy43->ptr, "env.", sizeof("env.") - 1) == 0) {
    char *env;

    if (NULL != (env = getenv(yymsp[0].minor.yy43->ptr + 4))) {
      data_string *ds;
      ds = data_string_init();
      buffer_append_string(ds->value, env);
      yygotominor.yy41 = (data_unset *)ds;
    }
    else {
      fprintf(stderr, "Undefined env variable: %s\n", yymsp[0].minor.yy43->ptr + 4);
      ctx->ok = 0;
    }
  } else if (NULL == (yygotominor.yy41 = configparser_get_variable(ctx, yymsp[0].minor.yy43))) {
    fprintf(stderr, "Undefined config variable: %s\n", yymsp[0].minor.yy43->ptr);
    ctx->ok = 0;
  }
  if (!yygotominor.yy41) {
    /* make a dummy so it won't crash */
    yygotominor.yy41 = (data_unset *)data_string_init();
  }
  buffer_free(yymsp[0].minor.yy43);
  yymsp[0].minor.yy43 = NULL;
}
#line 971 "configparser.c"
        break;
      case 15:
#line 262 "./configparser.y"
{
  yygotominor.yy41 = (data_unset *)data_string_init();
  buffer_copy_string_buffer(((data_string *)(yygotominor.yy41))->value, yymsp[0].minor.yy0);
  buffer_free(yymsp[0].minor.yy0);
  yymsp[0].minor.yy0 = NULL;
}
#line 981 "configparser.c"
        break;
      case 16:
#line 269 "./configparser.y"
{
  yygotominor.yy41 = (data_unset *)data_integer_init();
  ((data_integer *)(yygotominor.yy41))->value = strtol(yymsp[0].minor.yy0->ptr, NULL, 10);
  buffer_free(yymsp[0].minor.yy0);
  yymsp[0].minor.yy0 = NULL;
}
#line 991 "configparser.c"
        break;
      case 17:
#line 275 "./configparser.y"
{
  yygotominor.yy41 = (data_unset *)data_array_init();
  array_free(((data_array *)(yygotominor.yy41))->value);
  ((data_array *)(yygotominor.yy41))->value = yymsp[0].minor.yy40;
  yymsp[0].minor.yy40 = NULL;
}
#line 1001 "configparser.c"
        break;
      case 18:
#line 281 "./configparser.y"
{
  yygotominor.yy40 = array_init();
}
#line 1008 "configparser.c"
  yy_destructor(8,&yymsp[-1].minor);
  yy_destructor(9,&yymsp[0].minor);
        break;
      case 19:
#line 284 "./configparser.y"
{
  yygotominor.yy40 = yymsp[-1].minor.yy40;
  yymsp[-1].minor.yy40 = NULL;
}
#line 1018 "configparser.c"
  yy_destructor(8,&yymsp[-2].minor);
  yy_destructor(9,&yymsp[0].minor);
        break;
      case 20:
#line 289 "./configparser.y"
{
  if (buffer_is_empty(yymsp[0].minor.yy41->key) ||
      NULL == array_get_element(yymsp[-2].minor.yy40, yymsp[0].minor.yy41->key->ptr)) {
    array_insert_unique(yymsp[-2].minor.yy40, yymsp[0].minor.yy41);
    yymsp[0].minor.yy41 = NULL;
  } else {
    fprintf(stderr, "Duplicate array-key: %s\n",
            yymsp[0].minor.yy41->key->ptr);
    ctx->ok = 0;
    yymsp[0].minor.yy41->free(yymsp[0].minor.yy41);
    yymsp[0].minor.yy41 = NULL;
  }

  yygotominor.yy40 = yymsp[-2].minor.yy40;
  yymsp[-2].minor.yy40 = NULL;
}
#line 1040 "configparser.c"
  yy_destructor(10,&yymsp[-1].minor);
        break;
      case 21:
#line 306 "./configparser.y"
{
  yygotominor.yy40 = yymsp[-1].minor.yy40;
  yymsp[-1].minor.yy40 = NULL;
}
#line 1049 "configparser.c"
  yy_destructor(10,&yymsp[0].minor);
        break;
      case 22:
#line 311 "./configparser.y"
{
  yygotominor.yy40 = array_init();
  array_insert_unique(yygotominor.yy40, yymsp[0].minor.yy41);
  yymsp[0].minor.yy41 = NULL;
}
#line 1059 "configparser.c"
        break;
      case 23:
#line 317 "./configparser.y"
{
  yygotominor.yy41 = yymsp[0].minor.yy41;
  yymsp[0].minor.yy41 = NULL;
}
#line 1067 "configparser.c"
        break;
      case 24:
#line 321 "./configparser.y"
{
  buffer_copy_string_buffer(yymsp[0].minor.yy41->key, yymsp[-2].minor.yy43);
  buffer_free(yymsp[-2].minor.yy43);
  yymsp[-2].minor.yy43 = NULL;

  yygotominor.yy41 = yymsp[0].minor.yy41;
  yymsp[0].minor.yy41 = NULL;
}
#line 1079 "configparser.c"
  yy_destructor(11,&yymsp[-1].minor);
        break;
      case 25:
  yy_destructor(1,&yymsp[0].minor);
        break;
      case 26:
        break;
      case 27:
#line 333 "./configparser.y"
{
  data_config *dc;
  dc = (data_config *)array_get_element(ctx->srv->config_context, "global");
  assert(dc);
  configparser_push(ctx, dc, 0);
}
#line 1095 "configparser.c"
  yy_destructor(12,&yymsp[0].minor);
        break;
      case 28:
#line 340 "./configparser.y"
{
  data_config *cur;

  cur = ctx->current;
  configparser_pop(ctx);

  assert(cur && ctx->current);

  yygotominor.yy78 = cur;
}
#line 1110 "configparser.c"
        /* No destructor defined for globalstart */
  yy_destructor(13,&yymsp[-2].minor);
        /* No destructor defined for metalines */
  yy_destructor(14,&yymsp[0].minor);
        break;
      case 29:
#line 351 "./configparser.y"
{
  assert(yymsp[-3].minor.yy78->context_ndx < yymsp[0].minor.yy78->context_ndx);
  yymsp[0].minor.yy78->prev = yymsp[-3].minor.yy78;
  yymsp[-3].minor.yy78->next = yymsp[0].minor.yy78;
  yygotominor.yy78 = yymsp[0].minor.yy78;
  yymsp[-3].minor.yy78 = NULL;
  yymsp[0].minor.yy78 = NULL;
}
#line 1126 "configparser.c"
        /* No destructor defined for eols */
  yy_destructor(15,&yymsp[-1].minor);
        break;
      case 30:
#line 360 "./configparser.y"
{
  yygotominor.yy78 = yymsp[0].minor.yy78;
  yymsp[0].minor.yy78 = NULL;
}
#line 1136 "configparser.c"
        break;
      case 31:
#line 365 "./configparser.y"
{
  data_config *cur;

  cur = ctx->current;
  configparser_pop(ctx);

  assert(cur && ctx->current);

  yygotominor.yy78 = cur;
}
#line 1150 "configparser.c"
        /* No destructor defined for context */
  yy_destructor(13,&yymsp[-2].minor);
        /* No destructor defined for metalines */
  yy_destructor(14,&yymsp[0].minor);
        break;
      case 32:
#line 376 "./configparser.y"
{
  data_config *dc;
  buffer *b, *rvalue, *op;

  if (ctx->ok && yymsp[0].minor.yy41->type != TYPE_STRING) {
    fprintf(stderr, "rvalue must be string");
    ctx->ok = 0;
  }

  switch(yymsp[-1].minor.yy27) {
  case CONFIG_COND_NE:
    op = buffer_init_string("!=");
    break;
  case CONFIG_COND_EQ:
    op = buffer_init_string("==");
    break;
  case CONFIG_COND_NOMATCH:
    op = buffer_init_string("!~");
    break;
  case CONFIG_COND_MATCH:
    op = buffer_init_string("=~");
    break;
  default:
    assert(0);
    return;
  }

  b = buffer_init();
  buffer_copy_string_buffer(b, ctx->current->key);
  buffer_append_string(b, "/");
  buffer_append_string_buffer(b, yymsp[-5].minor.yy0);
  buffer_append_string_buffer(b, yymsp[-3].minor.yy43);
  buffer_append_string_buffer(b, op);
  rvalue = ((data_string*)yymsp[0].minor.yy41)->value;
  buffer_append_string_buffer(b, rvalue);

  if (NULL != (dc = (data_config *)array_get_element(ctx->all_configs, b->ptr))) {
    configparser_push(ctx, dc, 0);
  } else {
    struct {
      comp_key_t comp;
      char *comp_key;
      size_t len;
    } comps[] = {
      { COMP_SERVER_SOCKET,      CONST_STR_LEN("SERVER[\"socket\"]"   ) },
      { COMP_HTTP_URL,           CONST_STR_LEN("HTTP[\"url\"]"        ) },
      { COMP_HTTP_HOST,          CONST_STR_LEN("HTTP[\"host\"]"       ) },
      { COMP_HTTP_REFERER,       CONST_STR_LEN("HTTP[\"referer\"]"    ) },
      { COMP_HTTP_USER_AGENT,    CONST_STR_LEN("HTTP[\"useragent\"]"  ) },
      { COMP_HTTP_USER_AGENT,    CONST_STR_LEN("HTTP[\"user-agent\"]"  ) },
      { COMP_HTTP_COOKIE,        CONST_STR_LEN("HTTP[\"cookie\"]"     ) },
      { COMP_HTTP_REMOTE_IP,     CONST_STR_LEN("HTTP[\"remoteip\"]"   ) },
      { COMP_HTTP_REMOTE_IP,     CONST_STR_LEN("HTTP[\"remote-ip\"]"   ) },
      { COMP_HTTP_QUERY_STRING,  CONST_STR_LEN("HTTP[\"querystring\"]") },
      { COMP_HTTP_QUERY_STRING,  CONST_STR_LEN("HTTP[\"query-string\"]") },
      { COMP_HTTP_REQUEST_METHOD, CONST_STR_LEN("HTTP[\"request-method\"]") },
      { COMP_HTTP_SCHEME,        CONST_STR_LEN("HTTP[\"scheme\"]"     ) },
      { COMP_UNSET, NULL, 0 },
    };
    size_t i;

    dc = data_config_init();

    buffer_copy_string_buffer(dc->key, b);
    buffer_copy_string_buffer(dc->op, op);
    buffer_copy_string_buffer(dc->comp_key, yymsp[-5].minor.yy0);
    buffer_append_string_len(dc->comp_key, CONST_STR_LEN("[\""));
    buffer_append_string_buffer(dc->comp_key, yymsp[-3].minor.yy43);
    buffer_append_string_len(dc->comp_key, CONST_STR_LEN("\"]"));
    dc->cond = yymsp[-1].minor.yy27;

    for (i = 0; comps[i].comp_key; i ++) {
      if (buffer_is_equal_string(
            dc->comp_key, comps[i].comp_key, comps[i].len)) {
        dc->comp = comps[i].comp;
        break;
      }
    }
    if (COMP_UNSET == dc->comp) {
      fprintf(stderr, "error comp_key %s", dc->comp_key->ptr);
      ctx->ok = 0;
    }

    switch(yymsp[-1].minor.yy27) {
    case CONFIG_COND_NE:
    case CONFIG_COND_EQ:
      dc->string = buffer_init_buffer(rvalue);
      break;
    case CONFIG_COND_NOMATCH:
    case CONFIG_COND_MATCH: {
#ifdef HAVE_PCRE_H
      const char *errptr;
      int erroff;

      if (NULL == (dc->regex =
          pcre_compile(rvalue->ptr, 0, &errptr, &erroff, NULL))) {
        dc->string = buffer_init_string(errptr);
        dc->cond = CONFIG_COND_UNSET;

        fprintf(stderr, "parsing regex failed: %s -> %s at offset %d\n",
            rvalue->ptr, errptr, erroff);

        ctx->ok = 0;
      } else if (NULL == (dc->regex_study =
          pcre_study(dc->regex, 0, &errptr)) &&
                 errptr != NULL) {
        fprintf(stderr, "studying regex failed: %s -> %s\n",
            rvalue->ptr, errptr);
        ctx->ok = 0;
      } else {
        dc->string = buffer_init_buffer(rvalue);
      }
#else
      fprintf(stderr, "can't handle '$%s[%s] =~ ...' as you compiled without pcre support. \n"
		      "(perhaps just a missing pcre-devel package ?) \n",
                      yymsp[-5].minor.yy0->ptr, yymsp[-3].minor.yy43->ptr);
      ctx->ok = 0;
#endif
      break;
    }

    default:
      fprintf(stderr, "unknown condition for $%s[%s]\n",
                      yymsp[-5].minor.yy0->ptr, yymsp[-3].minor.yy43->ptr);
      ctx->ok = 0;
      break;
    }

    configparser_push(ctx, dc, 1);
  }

  buffer_free(b);
  buffer_free(op);
  buffer_free(yymsp[-5].minor.yy0);
  yymsp[-5].minor.yy0 = NULL;
  buffer_free(yymsp[-3].minor.yy43);
  yymsp[-3].minor.yy43 = NULL;
  yymsp[0].minor.yy41->free(yymsp[0].minor.yy41);
  yymsp[0].minor.yy41 = NULL;
}
#line 1298 "configparser.c"
  yy_destructor(16,&yymsp[-6].minor);
  yy_destructor(18,&yymsp[-4].minor);
  yy_destructor(19,&yymsp[-2].minor);
        break;
      case 33:
#line 516 "./configparser.y"
{
  yygotominor.yy27 = CONFIG_COND_EQ;
}
#line 1308 "configparser.c"
  yy_destructor(20,&yymsp[0].minor);
        break;
      case 34:
#line 519 "./configparser.y"
{
  yygotominor.yy27 = CONFIG_COND_MATCH;
}
#line 1316 "configparser.c"
  yy_destructor(21,&yymsp[0].minor);
        break;
      case 35:
#line 522 "./configparser.y"
{
  yygotominor.yy27 = CONFIG_COND_NE;
}
#line 1324 "configparser.c"
  yy_destructor(22,&yymsp[0].minor);
        break;
      case 36:
#line 525 "./configparser.y"
{
  yygotominor.yy27 = CONFIG_COND_NOMATCH;
}
#line 1332 "configparser.c"
  yy_destructor(23,&yymsp[0].minor);
        break;
      case 37:
#line 529 "./configparser.y"
{
  yygotominor.yy43 = NULL;
  if (ctx->ok) {
    if (yymsp[0].minor.yy41->type == TYPE_STRING) {
      yygotominor.yy43 = buffer_init_buffer(((data_string*)yymsp[0].minor.yy41)->value);
    } else if (yymsp[0].minor.yy41->type == TYPE_INTEGER) {
      yygotominor.yy43 = buffer_init();
      buffer_copy_long(yygotominor.yy43, ((data_integer *)yymsp[0].minor.yy41)->value);
    } else {
      fprintf(stderr, "operand must be string");
      ctx->ok = 0;
    }
  }
  yymsp[0].minor.yy41->free(yymsp[0].minor.yy41);
  yymsp[0].minor.yy41 = NULL;
}
#line 1353 "configparser.c"
        break;
      case 38:
#line 546 "./configparser.y"
{
  if (ctx->ok) {
    if (0 != config_parse_file(ctx->srv, ctx, yymsp[0].minor.yy43->ptr)) {
      ctx->ok = 0;
    }
    buffer_free(yymsp[0].minor.yy43);
    yymsp[0].minor.yy43 = NULL;
  }
}
#line 1366 "configparser.c"
  yy_destructor(24,&yymsp[-1].minor);
        break;
      case 39:
#line 556 "./configparser.y"
{
  if (ctx->ok) {
    if (0 != config_parse_cmd(ctx->srv, ctx, yymsp[0].minor.yy43->ptr)) {
      ctx->ok = 0;
    }
    buffer_free(yymsp[0].minor.yy43);
    yymsp[0].minor.yy43 = NULL;
  }
}
#line 1380 "configparser.c"
  yy_destructor(25,&yymsp[-1].minor);
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yypParser,yygoto);
  if( yyact < YYNSTATE ){
    yy_shift(yypParser,yyact,yygoto,&yygotominor);
  }else if( yyact == YYNSTATE + YYNRULE + 1 ){
    yy_accept(yypParser);
  }
}
Ejemplo n.º 4
0
/* The main parser program.
** The first argument is a pointer to a structure obtained from
** "configparserAlloc" which describes the current state of the parser.
** The second argument is the major token number.  The third is
** the minor token.  The fourth optional argument is whatever the
** user wants (and specified in the grammar) and is available for
** use by the action routines.
**
** Inputs:
** <ul>
** <li> A pointer to the parser (an opaque structure.)
** <li> The major token number.
** <li> The minor token number.
** <li> An option argument of a grammar-specified type.
** </ul>
**
** Outputs:
** None.
*/
void configparser(
  void *yyp,                   /* The parser */
  int yymajor,                 /* The major token code number */
  configparserTOKENTYPE yyminor       /* The value for the token */
  configparserARG_PDECL               /* Optional %extra_argument parameter */
){
  YYMINORTYPE yyminorunion;
  int yyact;            /* The parser action. */
  int yyendofinput;     /* True if we are at the end of input */
  int yyerrorhit = 0;   /* True if yymajor has invoked an error */
  yyParser *yypParser;  /* The parser */

  /* (re)initialize the parser, if necessary */
  yypParser = (yyParser*)yyp;
  if( yypParser->yyidx<0 ){
    if( yymajor==0 ) return;
    yypParser->yyidx = 0;
    yypParser->yyerrcnt = -1;
    yypParser->yystack[0].stateno = 0;
    yypParser->yystack[0].major = 0;
  }
  yyminorunion.yy0 = yyminor;
  yyendofinput = (yymajor==0);
  configparserARG_STORE;

#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
  }
#endif

  do{
    yyact = yy_find_shift_action(yypParser,yymajor);
    if( yyact<YYNSTATE ){
      yy_shift(yypParser,yyact,yymajor,&yyminorunion);
      yypParser->yyerrcnt--;
      if( yyendofinput && yypParser->yyidx>=0 ){
        yymajor = 0;
      }else{
        yymajor = YYNOCODE;
      }
    }else if( yyact < YYNSTATE + YYNRULE ){
      yy_reduce(yypParser,yyact-YYNSTATE);
    }else if( yyact == YY_ERROR_ACTION ){
      int yymx;
#ifndef NDEBUG
      if( yyTraceFILE ){
        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
      }
#endif
#ifdef YYERRORSYMBOL
      /* A syntax error has occurred.
      ** The response to an error depends upon whether or not the
      ** grammar defines an error token "ERROR".
      **
      ** This is what we do if the grammar does define ERROR:
      **
      **  * Call the %syntax_error function.
      **
      **  * Begin popping the stack until we enter a state where
      **    it is legal to shift the error symbol, then shift
      **    the error symbol.
      **
      **  * Set the error count to three.
      **
      **  * Begin accepting and shifting new tokens.  No new error
      **    processing will occur until three tokens have been
      **    shifted successfully.
      **
      */
      if( yypParser->yyerrcnt<0 ){
        yy_syntax_error(yypParser,yymajor,yyminorunion);
      }
      yymx = yypParser->yystack[yypParser->yyidx].major;
      if( yymx==YYERRORSYMBOL || yyerrorhit ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
             yyTracePrompt,yyTokenName[yymajor]);
        }
#endif
        yy_destructor(yymajor,&yyminorunion);
        yymajor = YYNOCODE;
      }else{
         while(
          yypParser->yyidx >= 0 &&
          yymx != YYERRORSYMBOL &&
          (yyact = yy_find_shift_action(yypParser,YYERRORSYMBOL)) >= YYNSTATE
        ){
          yy_pop_parser_stack(yypParser);
        }
        if( yypParser->yyidx < 0 || yymajor==0 ){
          yy_destructor(yymajor,&yyminorunion);
          yy_parse_failed(yypParser);
          yymajor = YYNOCODE;
        }else if( yymx!=YYERRORSYMBOL ){
          YYMINORTYPE u2;
          u2.YYERRSYMDT = 0;
          yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
        }
      }
      yypParser->yyerrcnt = 3;
      yyerrorhit = 1;
#else  /* YYERRORSYMBOL is not defined */
      /* This is what we do if the grammar does not define ERROR:
      **
      **  * Report an error message, and throw away the input token.
      **
      **  * If the input token is $, then fail the parse.
      **
      ** As before, subsequent error messages are suppressed until
      ** three input tokens have been successfully shifted.
      */
      if( yypParser->yyerrcnt<=0 ){
        yy_syntax_error(yypParser,yymajor,yyminorunion);
      }
      yypParser->yyerrcnt = 3;
      yy_destructor(yymajor,&yyminorunion);
      if( yyendofinput ){
        yy_parse_failed(yypParser);
      }
      yymajor = YYNOCODE;
#endif
    }else{
      yy_accept(yypParser);
      yymajor = YYNOCODE;
    }
  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
  return;
}
Ejemplo n.º 5
0
/* The main parser program.
** The first argument is a pointer to a structure obtained from
** "ParseAlloc" which describes the current state of the parser.
** The second argument is the major token number.  The third is
** the minor token.  The fourth optional argument is whatever the
** user wants (and specified in the grammar) and is available for
** use by the action routines.
**
** Inputs:
** <ul>
** <li> A pointer to the parser (an opaque structure.)
** <li> The major token number.
** <li> The minor token number.
** <li> An option argument of a grammar-specified type.
** </ul>
**
** Outputs:
** None.
*/
void
Parse (void *yyp,		/* The parser */
       int yymajor,		/* The major token code number */
       ParseTOKENTYPE yyminor	/* The value for the token */
       ParseARG_PDECL		/* Optional %extra_argument parameter */
    )
{
    YYMINORTYPE yyminorunion;
    int yyact;			/* The parser action. */
    int yyendofinput;		/* True if we are at the end of input */
#ifdef YYERRORSYMBOL
    int yyerrorhit = 0;		/* True if yymajor has invoked an error */
#endif
    yyParser *yypParser;	/* The parser */

    /* (re)initialize the parser, if necessary */
    yypParser = (yyParser *) yyp;
    if (yypParser->yyidx < 0)
      {
#if YYSTACKDEPTH<=0
	  if (yypParser->yystksz <= 0)
	    {
		/*memset(&yyminorunion, 0, sizeof(yyminorunion)); */
		yyminorunion = yyzerominor;
		yyStackOverflow (yypParser, &yyminorunion);
		return;
	    }
#endif
	  yypParser->yyidx = 0;
	  yypParser->yyerrcnt = -1;
	  yypParser->yystack[0].stateno = 0;
	  yypParser->yystack[0].major = 0;
      }
    yyminorunion.yy0 = yyminor;
    yyendofinput = (yymajor == 0);
    ParseARG_STORE;

#ifndef NDEBUG
    if (yyTraceFILE)
      {
	  fprintf (yyTraceFILE, "%sInput %s\n", yyTracePrompt,
		   yyTokenName[yymajor]);
      }
#endif

    do
      {
	  yyact = yy_find_shift_action (yypParser, (YYCODETYPE) yymajor);
	  if (yyact < YYNSTATE)
	    {
		assert (!yyendofinput);	/* Impossible to shift the $ token */
		yy_shift (yypParser, yyact, yymajor, &yyminorunion);
		yypParser->yyerrcnt--;
		yymajor = YYNOCODE;
	    }
	  else if (yyact < YYNSTATE + YYNRULE)
	    {
		yy_reduce (yypParser, yyact - YYNSTATE);
	    }
	  else
	    {
		assert (yyact == YY_ERROR_ACTION);
#ifdef YYERRORSYMBOL
		int yymx;
#endif
#ifndef NDEBUG
		if (yyTraceFILE)
		  {
		      fprintf (yyTraceFILE, "%sSyntax Error!\n", yyTracePrompt);
		  }
#endif
#ifdef YYERRORSYMBOL
		/* A syntax error has occurred.
		 ** The response to an error depends upon whether or not the
		 ** grammar defines an error token "ERROR".  
		 **
		 ** This is what we do if the grammar does define ERROR:
		 **
		 **  * Call the %syntax_error function.
		 **
		 **  * Begin popping the stack until we enter a state where
		 **    it is legal to shift the error symbol, then shift
		 **    the error symbol.
		 **
		 **  * Set the error count to three.
		 **
		 **  * Begin accepting and shifting new tokens.  No new error
		 **    processing will occur until three tokens have been
		 **    shifted successfully.
		 **
		 */
		if (yypParser->yyerrcnt < 0)
		  {
		      yy_syntax_error (yypParser, yymajor, yyminorunion);
		  }
		yymx = yypParser->yystack[yypParser->yyidx].major;
		if (yymx == YYERRORSYMBOL || yyerrorhit)
		  {
#ifndef NDEBUG
		      if (yyTraceFILE)
			{
			    fprintf (yyTraceFILE, "%sDiscard input token %s\n",
				     yyTracePrompt, yyTokenName[yymajor]);
			}
#endif
		      yy_destructor (yypParser, (YYCODETYPE) yymajor,
				     &yyminorunion);
		      yymajor = YYNOCODE;
		  }
		else
		  {
		      while (yypParser->yyidx >= 0 &&
			     yymx != YYERRORSYMBOL &&
			     (yyact =
			      yy_find_reduce_action (yypParser->yystack
						     [yypParser->yyidx].stateno,
						     YYERRORSYMBOL)) >=
			     YYNSTATE)
			{
			    yy_pop_parser_stack (yypParser);
			}
		      if (yypParser->yyidx < 0 || yymajor == 0)
			{
			    yy_destructor (yypParser, (YYCODETYPE) yymajor,
					   &yyminorunion);
			    yy_parse_failed (yypParser);
			    yymajor = YYNOCODE;
			}
		      else if (yymx != YYERRORSYMBOL)
			{
			    YYMINORTYPE u2;
			    u2.YYERRSYMDT = 0;
			    yy_shift (yypParser, yyact, YYERRORSYMBOL, &u2);
			}
		  }
		yypParser->yyerrcnt = 3;
		yyerrorhit = 1;
#elif defined(YYNOERRORRECOVERY)
		/* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
		 ** do any kind of error recovery.  Instead, simply invoke the syntax
		 ** error routine and continue going as if nothing had happened.
		 **
		 ** Applications can set this macro (for example inside %include) if
		 ** they intend to abandon the parse upon the first syntax error seen.
		 */
		yy_syntax_error (yypParser, yymajor, yyminorunion);
		yy_destructor (yypParser, (YYCODETYPE) yymajor, &yyminorunion);
		yymajor = YYNOCODE;

#else /* YYERRORSYMBOL is not defined */
		/* This is what we do if the grammar does not define ERROR:
		 **
		 **  * Report an error message, and throw away the input token.
		 **
		 **  * If the input token is $, then fail the parse.
		 **
		 ** As before, subsequent error messages are suppressed until
		 ** three input tokens have been successfully shifted.
		 */
		if (yypParser->yyerrcnt <= 0)
		  {
		      yy_syntax_error (yypParser, yymajor, yyminorunion);
		  }
		yypParser->yyerrcnt = 3;
		yy_destructor (yypParser, (YYCODETYPE) yymajor, &yyminorunion);
		if (yyendofinput)
		  {
		      yy_parse_failed (yypParser);
		  }
		yymajor = YYNOCODE;
#endif
	    }
      }
    while (yymajor != YYNOCODE && yypParser->yyidx >= 0);
    return;
}
Ejemplo n.º 6
0
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
  int yyruleno                 /* Number of the rule by which to reduce */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  ParseARG_FETCH;
  yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */

  /* Silence complaints from purify about yygotominor being uninitialized
  ** in some cases when it is copied into the stack after the following
  ** switch.  yygotominor is uninitialized when a rule reduces that does
  ** not set the value of its left-hand side nonterminal.  Leaving the
  ** value of the nonterminal uninitialized is utterly harmless as long
  ** as the value is never used.  So really the only thing this code
  ** accomplishes is to quieten purify.  
  **
  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
  ** without this code, their parser segfaults.  I'm not sure what there
  ** parser is doing to make this happen.  This is the second bug report
  ** from wireshark this week.  Clearly they are stressing Lemon in ways
  ** that it has not been previously stressed...  (SQLite ticket #2172)
  */
  /*memset(&yygotominor, 0, sizeof(yygotominor));*/
  yygotominor = yyzerominor;


  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 0: /* module ::= statements */
      case 1: /* statements ::= statement */
      case 2: /* statements ::= statements statement */
      case 34: /* element ::= operation */
      case 35: /* element ::= directive */
      case 38: /* element ::= */
      case 39: /* statements ::= statements error statement */
#line 56 "grammar.y"
{
}
#line 747 "grammar.c"
        break;
      case 3: /* statement ::= directive EOL */
      case 4: /* statement ::= constant EOL */
      case 5: /* statement ::= function EOL */
      case 6: /* statement ::= EOL */
      case 32: /* block ::= element EOL */
      case 33: /* block ::= block element EOL */
#line 61 "grammar.y"
{
  yy_destructor(1,&yymsp[0].minor);
}
#line 759 "grammar.c"
        break;
      case 7: /* constant ::= IDENT EQ expr */
#line 66 "grammar.y"
{
         Module_create_constant(state, yymsp[-2].minor.yy0, yymsp[0].minor.yy0); free(yymsp[-2].minor.yy0);
      yy_destructor(3,&yymsp[-1].minor);
}
#line 767 "grammar.c"
        break;
      case 8: /* parameters ::= LPAREN args RPAREN */
#line 70 "grammar.y"
{ yygotominor.yy7 = yymsp[-1].minor.yy7;   yy_destructor(4,&yymsp[-2].minor);
  yy_destructor(5,&yymsp[0].minor);
}
#line 774 "grammar.c"
        break;
      case 9: /* parameters ::= */
      case 12: /* args ::= */
#line 71 "grammar.y"
{ yygotominor.yy7 = calloc(1,sizeof(Parameters)); }
#line 780 "grammar.c"
        break;
      case 10: /* args ::= args COMMA expr */
#line 73 "grammar.y"
{ yymsp[-2].minor.yy7->args[yymsp[-2].minor.yy7->i++] = yymsp[0].minor.yy0; yygotominor.yy7=yymsp[-2].minor.yy7;   yy_destructor(6,&yymsp[-1].minor);
}
#line 786 "grammar.c"
        break;
      case 11: /* args ::= expr */
#line 74 "grammar.y"
{ yygotominor.yy7 = calloc(1,sizeof(Parameters)); yygotominor.yy7->args[yygotominor.yy7->i++] = yymsp[0].minor.yy0;}
#line 791 "grammar.c"
        break;
      case 13: /* operation ::= OP DOT TYPE parameters */
#line 78 "grammar.y"
{ Call_operation(state, state->current, yymsp[-3].minor.yy0, yymsp[-1].minor.yy0, yymsp[0].minor.yy7);   yy_destructor(8,&yymsp[-2].minor);
}
#line 797 "grammar.c"
        break;
      case 14: /* operation ::= OP parameters */
#line 81 "grammar.y"
{ Call_operation(state, state->current, yymsp[-1].minor.yy0, NULL, yymsp[0].minor.yy7); }
#line 802 "grammar.c"
        break;
      case 15: /* expr ::= HEX */
      case 16: /* expr ::= FLOAT */
      case 17: /* expr ::= INT */
      case 18: /* expr ::= STR */
      case 19: /* expr ::= CHR */
      case 20: /* expr ::= REG */
#line 83 "grammar.y"
{ yygotominor.yy0 = yymsp[0].minor.yy0; }
#line 812 "grammar.c"
        break;
      case 21: /* expr ::= IDENT */
#line 89 "grammar.y"
{ yygotominor.yy0 = Module_resolve_data(state, yymsp[0].minor.yy0); }
#line 817 "grammar.c"
        break;
      case 22: /* expr ::= function_reference */
#line 90 "grammar.y"
{ yygotominor.yy0 = yymsp[0].minor.yy52; }
#line 822 "grammar.c"
        break;
      case 23: /* expr ::= function_reference DOT IDENT */
#line 92 "grammar.y"
{ yygotominor.yy0 = Module_outside_function_data(state, yymsp[-2].minor.yy52, yymsp[0].minor.yy0);   yy_destructor(8,&yymsp[-1].minor);
}
#line 828 "grammar.c"
        break;
      case 24: /* expr ::= LABEL */
#line 95 "grammar.y"
{ yygotominor.yy0 = Label_expression(state->current, yymsp[0].minor.yy0); }
#line 833 "grammar.c"
        break;
      case 25: /* function_reference ::= IDENT DOT IDENT */
#line 99 "grammar.y"
{ yygotominor.yy52 = Module_resolve_function(state, yymsp[-2].minor.yy0, yymsp[0].minor.yy0);   yy_destructor(8,&yymsp[-1].minor);
}
#line 839 "grammar.c"
        break;
      case 26: /* directive ::= PERCENT IDENT parameters */
#line 102 "grammar.y"
{ Module_call_directive(state, yymsp[-1].minor.yy0, yymsp[0].minor.yy7);   yy_destructor(17,&yymsp[-2].minor);
}
#line 845 "grammar.c"
        break;
      case 27: /* function ::= FUNCTION function_decl block END */
#line 105 "grammar.y"
{ yygotominor.yy9 = Function_finalize(state, yymsp[-2].minor.yy9, yymsp[0].minor.yy0);   yy_destructor(18,&yymsp[-3].minor);
}
#line 851 "grammar.c"
        break;
      case 28: /* function_decl ::= IDENT LPAREN function_params RPAREN COLON TYPE */
#line 108 "grammar.y"
{
            yygotominor.yy9 = Function_create(state, yymsp[0].minor.yy0->value, yymsp[-5].minor.yy0->start, yymsp[-5].minor.yy0->len, yymsp[-3].minor.yy14); 
            free(yymsp[-5].minor.yy0); free(yymsp[0].minor.yy0);
          yy_destructor(4,&yymsp[-4].minor);
  yy_destructor(5,&yymsp[-2].minor);
  yy_destructor(20,&yymsp[-1].minor);
}
#line 862 "grammar.c"
        break;
      case 29: /* function_params ::= IDENT COLON TYPE */
#line 114 "grammar.y"
{ yygotominor.yy14 = FunctionParam_create(NULL, yymsp[-2].minor.yy0, yymsp[0].minor.yy0); free(yymsp[-2].minor.yy0); free(yymsp[0].minor.yy0);   yy_destructor(20,&yymsp[-1].minor);
}
#line 868 "grammar.c"
        break;
      case 30: /* function_params ::= function_params COMMA IDENT COLON TYPE */
#line 117 "grammar.y"
{
                    yygotominor.yy14 = FunctionParam_create(yymsp[-4].minor.yy14, yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
                    free(yymsp[-2].minor.yy0);  // these have to be here or double free
                    free(yymsp[0].minor.yy0);
                  yy_destructor(6,&yymsp[-3].minor);
  yy_destructor(20,&yymsp[-1].minor);
}
#line 879 "grammar.c"
        break;
      case 31: /* function_params ::= */
#line 122 "grammar.y"
{ yygotominor.yy14 = NULL; }
#line 884 "grammar.c"
        break;
      case 36: /* element ::= LABEL */
#line 129 "grammar.y"
{ Label_statement(state->current, yymsp[0].minor.yy0); free(yymsp[0].minor.yy0); }
#line 889 "grammar.c"
        break;
      case 37: /* element ::= IDENT EQ expr */
#line 130 "grammar.y"
{
         Module_create_function_constant(state, yymsp[-2].minor.yy0, yymsp[0].minor.yy0); free(yymsp[-2].minor.yy0);
        yy_destructor(3,&yymsp[-1].minor);
}
#line 897 "grammar.c"
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
  if( yyact < YYNSTATE ){
#ifdef NDEBUG
    /* If we are not debugging and the reduce action popped at least
    ** one element off the stack, then we can push the new element back
    ** onto the stack here, and skip the stack overflow test in yy_shift().
    ** That gives a significant speed improvement. */
    if( yysize ){
      yypParser->yyidx++;
      yymsp -= yysize-1;
      yymsp->stateno = yyact;
      yymsp->major = yygoto;
      yymsp->minor = yygotominor;
    }else
#endif
    {
      yy_shift(yypParser,yyact,yygoto,&yygotominor);
    }
  }else{
    assert( yyact == YYNSTATE + YYNRULE + 1 );
    yy_accept(yypParser);
  }
}
Ejemplo n.º 7
0
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
  int yyruleno                 /* Number of the rule by which to reduce */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  ParseARG_FETCH;
  yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */

  /* Silence complaints from purify about yygotominor being uninitialized
  ** in some cases when it is copied into the stack after the following
  ** switch.  yygotominor is uninitialized when a rule reduces that does
  ** not set the value of its left-hand side nonterminal.  Leaving the
  ** value of the nonterminal uninitialized is utterly harmless as long
  ** as the value is never used.  So really the only thing this code
  ** accomplishes is to quieten purify.  
  **
  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
  ** without this code, their parser segfaults.  I'm not sure what there
  ** parser is doing to make this happen.  This is the second bug report
  ** from wireshark this week.  Clearly they are stressing Lemon in ways
  ** that it has not been previously stressed...  (SQLite ticket #2172)
  */
  /*memset(&yygotominor, 0, sizeof(yygotominor));*/
  yygotominor = yyzerominor;


  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 0: /* config ::= vars */
#line 30 "src/parser.y"
{ state->settings = yymsp[0].minor.yy13; }
#line 754 "src/parser.c"
        break;
      case 1: /* vars ::= vars assignment */
#line 34 "src/parser.y"
{ 
        yygotominor.yy13 = tst_insert(yymsp[-1].minor.yy13, bdata(yymsp[0].minor.yy7->key->data), blength(yymsp[0].minor.yy7->key->data), yymsp[0].minor.yy7);
    }
#line 761 "src/parser.c"
        break;
      case 2: /* vars ::= assignment */
#line 39 "src/parser.y"
{
        yygotominor.yy13 = tst_insert(yygotominor.yy13, bdata(yymsp[0].minor.yy7->key->data), blength(yymsp[0].minor.yy7->key->data), yymsp[0].minor.yy7);
    }
#line 768 "src/parser.c"
        break;
      case 3: /* vars ::= vars EOF */
#line 43 "src/parser.y"
{ yygotominor.yy13 = yymsp[-1].minor.yy13;   yy_destructor(yypParser,1,&yymsp[0].minor);
}
#line 774 "src/parser.c"
        break;
      case 4: /* expr ::= QSTRING */
#line 47 "src/parser.y"
{ yygotominor.yy8 = Value_create(VAL_QSTRING, yymsp[0].minor.yy0); }
#line 779 "src/parser.c"
        break;
      case 5: /* expr ::= NUMBER */
#line 48 "src/parser.y"
{ yygotominor.yy8 = Value_create(VAL_NUMBER, yymsp[0].minor.yy0); }
#line 784 "src/parser.c"
        break;
      case 6: /* expr ::= class */
#line 49 "src/parser.y"
{ yygotominor.yy8 = Value_create(VAL_CLASS, yymsp[0].minor.yy11); }
#line 789 "src/parser.c"
        break;
      case 7: /* expr ::= list */
#line 50 "src/parser.y"
{ yygotominor.yy8 = Value_create(VAL_LIST, yymsp[0].minor.yy46); }
#line 794 "src/parser.c"
        break;
      case 8: /* expr ::= hash */
#line 51 "src/parser.y"
{ yygotominor.yy8 = Value_create(VAL_HASH, yymsp[0].minor.yy13); }
#line 799 "src/parser.c"
        break;
      case 9: /* expr ::= IDENT */
#line 52 "src/parser.y"
{ yygotominor.yy8 = Value_create(VAL_REF, yymsp[0].minor.yy0); }
#line 804 "src/parser.c"
        break;
      case 10: /* assignment ::= IDENT EQ expr */
#line 57 "src/parser.y"
{ 
        yygotominor.yy7 = malloc(sizeof(Pair)); yygotominor.yy7->key = yymsp[-2].minor.yy0; yygotominor.yy7->value = yymsp[0].minor.yy8; 
      yy_destructor(yypParser,5,&yymsp[-1].minor);
}
#line 812 "src/parser.c"
        break;
      case 11: /* class ::= CLASS LPAREN parameters RPAREN */
#line 64 "src/parser.y"
{ yygotominor.yy11 = calloc(sizeof(Class), 1); yygotominor.yy11->id = -1; yygotominor.yy11->ident = yymsp[-3].minor.yy0; yygotominor.yy11->params = yymsp[-1].minor.yy13;   yy_destructor(yypParser,7,&yymsp[-2].minor);
  yy_destructor(yypParser,8,&yymsp[0].minor);
}
#line 819 "src/parser.c"
        break;
      case 12: /* parameters ::= parameters COMMA assignment */
#line 69 "src/parser.y"
{ yygotominor.yy13 = tst_insert(yymsp[-2].minor.yy13, bdata(yymsp[0].minor.yy7->key->data), blength(yymsp[0].minor.yy7->key->data), yymsp[0].minor.yy7);   yy_destructor(yypParser,9,&yymsp[-1].minor);
}
#line 825 "src/parser.c"
        break;
      case 13: /* parameters ::= parameters assignment */
#line 72 "src/parser.y"
{ yygotominor.yy13 = tst_insert(yymsp[-1].minor.yy13, bdata(yymsp[0].minor.yy7->key->data), blength(yymsp[0].minor.yy7->key->data), yymsp[0].minor.yy7); }
#line 830 "src/parser.c"
        break;
      case 14: /* parameters ::= */
      case 22: /* hash_elements ::= */ yytestcase(yyruleno==22);
#line 75 "src/parser.y"
{ yygotominor.yy13 = NULL; }
#line 836 "src/parser.c"
        break;
      case 15: /* list ::= LBRACE list_elements RBRACE */
#line 79 "src/parser.y"
{ yygotominor.yy46 = yymsp[-1].minor.yy46;   yy_destructor(yypParser,10,&yymsp[-2].minor);
  yy_destructor(yypParser,11,&yymsp[0].minor);
}
#line 843 "src/parser.c"
        break;
      case 16: /* list_elements ::= list_elements COMMA expr */
#line 83 "src/parser.y"
{ yygotominor.yy46 = yymsp[-2].minor.yy46; list_append(yygotominor.yy46, lnode_create(yymsp[0].minor.yy8));   yy_destructor(yypParser,9,&yymsp[-1].minor);
}
#line 849 "src/parser.c"
        break;
      case 17: /* list_elements ::= list_elements expr */
#line 86 "src/parser.y"
{ yygotominor.yy46 = yymsp[-1].minor.yy46; list_append(yygotominor.yy46, lnode_create(yymsp[0].minor.yy8)); }
#line 854 "src/parser.c"
        break;
      case 18: /* list_elements ::= */
#line 89 "src/parser.y"
{ yygotominor.yy46 = list_create(LISTCOUNT_T_MAX); }
#line 859 "src/parser.c"
        break;
      case 19: /* hash ::= LBRACKET hash_elements RBRACKET */
#line 93 "src/parser.y"
{ yygotominor.yy13 = yymsp[-1].minor.yy13;   yy_destructor(yypParser,12,&yymsp[-2].minor);
  yy_destructor(yypParser,13,&yymsp[0].minor);
}
#line 866 "src/parser.c"
        break;
      case 20: /* hash_elements ::= hash_elements COMMA hash_pair */
#line 97 "src/parser.y"
{ yygotominor.yy13 = tst_insert(yymsp[-2].minor.yy13, bdata(yymsp[0].minor.yy17->key->data), blength(yymsp[0].minor.yy17->key->data), yymsp[0].minor.yy17);   yy_destructor(yypParser,9,&yymsp[-1].minor);
}
#line 872 "src/parser.c"
        break;
      case 21: /* hash_elements ::= hash_elements hash_pair */
#line 100 "src/parser.y"
{ yygotominor.yy13 = tst_insert(yymsp[-1].minor.yy13, bdata(yymsp[0].minor.yy17->key->data), blength(yymsp[0].minor.yy17->key->data), yymsp[0].minor.yy17); }
#line 877 "src/parser.c"
        break;
      case 23: /* hash_pair ::= QSTRING COLON expr */
#line 108 "src/parser.y"
{ 
        yygotominor.yy17 = malloc(sizeof(Pair)); yygotominor.yy17->key = yymsp[-2].minor.yy0; yygotominor.yy17->value = yymsp[0].minor.yy8; 
      yy_destructor(yypParser,14,&yymsp[-1].minor);
}
#line 885 "src/parser.c"
        break;
      default:
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
  if( yyact < YYNSTATE ){
#ifdef NDEBUG
    /* If we are not debugging and the reduce action popped at least
    ** one element off the stack, then we can push the new element back
    ** onto the stack here, and skip the stack overflow test in yy_shift().
    ** That gives a significant speed improvement. */
    if( yysize ){
      yypParser->yyidx++;
      yymsp -= yysize-1;
      yymsp->stateno = (YYACTIONTYPE)yyact;
      yymsp->major = (YYCODETYPE)yygoto;
      yymsp->minor = yygotominor;
    }else
#endif
    {
      yy_shift(yypParser,yyact,yygoto,&yygotominor);
    }
  }else{
    assert( yyact == YYNSTATE + YYNRULE + 1 );
    yy_accept(yypParser);
  }
}
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
  int yyruleno                 /* Number of the rule by which to reduce */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  ParseARG_FETCH;
  yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
    yysize = yyRuleInfo[yyruleno].nrhs;
    fprintf(yyTraceFILE, "%sReduce [%s] -> state %d.\n", yyTracePrompt,
      yyRuleName[yyruleno], yymsp[-yysize].stateno);
  }
#endif /* NDEBUG */

  /* Silence complaints from purify about yygotominor being uninitialized
  ** in some cases when it is copied into the stack after the following
  ** switch.  yygotominor is uninitialized when a rule reduces that does
  ** not set the value of its left-hand side nonterminal.  Leaving the
  ** value of the nonterminal uninitialized is utterly harmless as long
  ** as the value is never used.  So really the only thing this code
  ** accomplishes is to quieten purify.  
  **
  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
  ** without this code, their parser segfaults.  I'm not sure what there
  ** parser is doing to make this happen.  This is the second bug report
  ** from wireshark this week.  Clearly they are stressing Lemon in ways
  ** that it has not been previously stressed...  (SQLite ticket #2172)
  */
  /*memset(&yygotominor, 0, sizeof(yygotominor));*/
  yygotominor = yyzerominor;


  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 0: /* expression ::= expr */
#line 35 "/home/veei/git/calculator/expressions.grammar.y"
{ state->root = yymsp[0].minor.yy0; }
#line 809 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 1: /* identifier ::= IDENTIFIER */
#line 38 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_identifier(yymsp[0].minor.yy0, state->vpool);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
}
#line 817 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 2: /* identifier ::= identifier DOT IDENTIFIER */
#line 44 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_access_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
  yy_destructor(yypParser,18,&yymsp[-1].minor);
}
#line 827 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 3: /* term ::= identifier */
      case 8: /* expr ::= term */ yytestcase(yyruleno==8);
#line 50 "/home/veei/git/calculator/expressions.grammar.y"
{ yygotominor.yy0 = yymsp[0].minor.yy0; }
#line 833 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 4: /* term ::= INTEGER */
#line 53 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_integer(yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
}
#line 841 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 5: /* term ::= FLOAT */
#line 59 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_float(yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
}
#line 849 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 6: /* term ::= BOOLEAN */
#line 65 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_boolean(yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
}
#line 857 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 7: /* term ::= STRING */
#line 71 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_string(yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
}
#line 865 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 9: /* expr ::= expr PLUS expr */
#line 79 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_add_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,11,&yymsp[-1].minor);
}
#line 876 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 10: /* expr ::= expr MINUS expr */
#line 87 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_sub_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,12,&yymsp[-1].minor);
}
#line 887 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 11: /* expr ::= expr DIVIDE expr */
#line 95 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_div_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,15,&yymsp[-1].minor);
}
#line 898 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 12: /* expr ::= expr MOD expr */
#line 103 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_mod_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,16,&yymsp[-1].minor);
}
#line 909 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 13: /* expr ::= expr TIMES expr */
#line 111 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_times_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,14,&yymsp[-1].minor);
}
#line 920 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 14: /* expr ::= LEFT_P expr RIGHT_P */
#line 119 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = yymsp[-1].minor.yy0;
  yy_destructor(yypParser,23,&yymsp[-2].minor);
  yy_destructor(yypParser,24,&yymsp[0].minor);
}
#line 929 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 15: /* expr ::= MINUS expr */
#line 124 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_minus_operator(yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,12,&yymsp[-1].minor);
}
#line 939 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 16: /* expr ::= NOT expr */
#line 131 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_not_operator(yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,4,&yymsp[-1].minor);
}
#line 949 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 17: /* expr ::= expr AND expr */
#line 138 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_and_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,2,&yymsp[-1].minor);
}
#line 960 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 18: /* expr ::= expr OR expr */
#line 146 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_or_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,3,&yymsp[-1].minor);
}
#line 971 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 19: /* expr ::= expr LESS expr */
#line 154 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_less_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,5,&yymsp[-1].minor);
}
#line 982 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 20: /* expr ::= expr LESS_OR_EQUAL expr */
#line 162 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_less_or_equal_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,6,&yymsp[-1].minor);
}
#line 993 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 21: /* expr ::= expr GREATER expr */
#line 170 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_greater_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,7,&yymsp[-1].minor);
}
#line 1004 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 22: /* expr ::= expr GREATER_OR_EQUAL expr */
#line 178 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_greater_or_equal_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,8,&yymsp[-1].minor);
}
#line 1015 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 23: /* expr ::= expr EQUAL expr */
#line 186 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_equal_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,9,&yymsp[-1].minor);
}
#line 1026 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 24: /* expr ::= expr NOT_EQUAL expr */
#line 194 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_not_equal_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,10,&yymsp[-1].minor);
}
#line 1037 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      case 25: /* expr ::= identifier ASSIGN expr */
#line 202 "/home/veei/git/calculator/expressions.grammar.y"
{
    yygotominor.yy0 = create_assignment_operator(yymsp[-2].minor.yy0, yymsp[0].minor.yy0);
    add_to_temp_set(yygotominor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[-2].minor.yy0, state->temp_set);
    remove_from_temp_set(yymsp[0].minor.yy0, state->temp_set);
  yy_destructor(yypParser,1,&yymsp[-1].minor);
}
#line 1048 "/home/veei/git/calculator/expressions.grammar.cpp"
        break;
      default:
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
  if( yyact <= YY_MAX_SHIFTREDUCE ){
    if( yyact>YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
    /* If the reduce action popped at least
    ** one element off the stack, then we can push the new element back
    ** onto the stack here, and skip the stack overflow test in yy_shift().
    ** That gives a significant speed improvement. */
    if( yysize ){
      yypParser->yyidx++;
      yymsp -= yysize-1;
      yymsp->stateno = (YYACTIONTYPE)yyact;
      yymsp->major = (YYCODETYPE)yygoto;
      yymsp->minor = yygotominor;
      yyTraceShift(yypParser, yyact);
    }else{
      yy_shift(yypParser,yyact,yygoto,&yygotominor);
    }
  }else{
    assert( yyact == YY_ACCEPT_ACTION );
    yy_accept(yypParser);
  }
}
Ejemplo n.º 9
0
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
    yyParser *yypParser,         /* The parser */
    int yyruleno                 /* Number of the rule by which to reduce */
) {
    int yygoto;                     /* The next state */
    int yyact;                      /* The next action */
    YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
    yyStackEntry *yymsp;            /* The top of the parser's stack */
    int yysize;                     /* Amount to pop the stack */
    CLIParserARG_FETCH;
    yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
    if( yyTraceFILE && yyruleno>=0
            && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ) {
        fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
                yyRuleName[yyruleno]);
    }
#endif /* NDEBUG */

    /* Silence complaints from purify about yygotominor being uninitialized
    ** in some cases when it is copied into the stack after the following
    ** switch.  yygotominor is uninitialized when a rule reduces that does
    ** not set the value of its left-hand side nonterminal.  Leaving the
    ** value of the nonterminal uninitialized is utterly harmless as long
    ** as the value is never used.  So really the only thing this code
    ** accomplishes is to quieten purify.
    **
    ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
    ** without this code, their parser segfaults.  I'm not sure what there
    ** parser is doing to make this happen.  This is the second bug report
    ** from wireshark this week.  Clearly they are stressing Lemon in ways
    ** that it has not been previously stressed...  (SQLite ticket #2172)
    */
    /*memset(&yygotominor, 0, sizeof(yygotominor));*/
    yygotominor = yyzerominor;


    switch( yyruleno ) {
    /* Beginning here are the reduction cases.  A typical example
    ** follows:
    **   case 0:
    **  #line <lineno> <grammarfile>
    **     { ... }           // User supplied code
    **  #line <lineno> <thisfile>
    **     break;
    */
    case 1: /* commands ::= commands command */
#line 41 "CLIParser.y"
        {
            commands->push_back(Pointer<CLICommand>(yymsp[0].minor.yy78));
        }
#line 801 "CLIParser.c"
        break;
    case 3: /* command ::= KEYWORD_RULE rule_command */
#line 46 "CLIParser.y"
        {   yygotominor.yy78 = yymsp[0].minor.yy78;
            yy_destructor(yypParser,3,&yymsp[-1].minor);
        }
#line 807 "CLIParser.c"
        break;
    case 4: /* command ::= KEYWORD_DEVICE device_command */
#line 47 "CLIParser.y"
        {   yygotominor.yy78 = yymsp[0].minor.yy78;
            yy_destructor(yypParser,4,&yymsp[-1].minor);
        }
#line 813 "CLIParser.c"
        break;
    case 5: /* rule_command ::= KEYWORD_APPEND string rule_append_options */
#line 52 "CLIParser.y"
        {
            yygotominor.yy78 = new RuleAppend(*yymsp[-1].minor.yy5, *yymsp[0].minor.yy39);
            delete yymsp[0].minor.yy39;
            yy_destructor(yypParser,5,&yymsp[-2].minor);
        }
#line 822 "CLIParser.c"
        break;
    case 6: /* rule_append_options ::= rule_append_options OPTION_PARENT seqn_value */
#line 57 "CLIParser.y"
        {
            yygotominor.yy39 = yymsp[-2].minor.yy39;
            yygotominor.yy39->parent_seqn = yymsp[0].minor.yy63;
            yy_destructor(yypParser,6,&yymsp[-1].minor);
        }
#line 831 "CLIParser.c"
        break;
    case 7: /* rule_append_options ::= rule_append_options OPTION_TIMEOUT timeout_value */
#line 62 "CLIParser.y"
        {
            yygotominor.yy39 = yymsp[-2].minor.yy39;
            yygotominor.yy39->timeout = yymsp[0].minor.yy63;
            yy_destructor(yypParser,7,&yymsp[-1].minor);
        }
#line 840 "CLIParser.c"
        break;
    case 8: /* rule_append_options ::= rule_append_options OPTION_PERMANENT boolean_value */
#line 67 "CLIParser.y"
        {
            yygotominor.yy39 = yymsp[-2].minor.yy39;
            yygotominor.yy39->permanent = yymsp[0].minor.yy65;
            yy_destructor(yypParser,8,&yymsp[-1].minor);
        }
#line 849 "CLIParser.c"
        break;
    case 9: /* rule_append_options ::= */
#line 72 "CLIParser.y"
        {
            yygotominor.yy39 = new RuleAppend::Options();
        }
#line 856 "CLIParser.c"
        break;
    case 10: /* rule_command ::= KEYWORD_REMOVE rule_remove_args */
#line 80 "CLIParser.y"
        {
            yy_destructor(yypParser,9,&yymsp[-1].minor);
        }
#line 863 "CLIParser.c"
        break;
    case 12: /* rule_command ::= KEYWORD_LIST */
    case 13: /* device_command ::= KEYWORD_LIST */
        yytestcase(yyruleno==13);
#line 86 "CLIParser.y"
        {
            yy_destructor(yypParser,10,&yymsp[0].minor);
        }
#line 871 "CLIParser.c"
        break;
    case 14: /* device_command ::= KEYWORD_RULE seqn_value */
#line 96 "CLIParser.y"
        {
            yy_destructor(yypParser,3,&yymsp[-1].minor);
        }
#line 878 "CLIParser.c"
        break;
    case 15: /* device_command ::= KEYWORD_HASH seqn_value */
#line 101 "CLIParser.y"
        {
            yy_destructor(yypParser,11,&yymsp[-1].minor);
        }
#line 885 "CLIParser.c"
        break;
    case 16: /* device_command ::= KEYWORD_SET_POLICY seqn_value target_value device_set_policy_options */
#line 106 "CLIParser.y"
        {
            yy_destructor(yypParser,12,&yymsp[-3].minor);
            yy_destructor(yypParser,29,&yymsp[0].minor);
        }
#line 893 "CLIParser.c"
        break;
    case 17: /* device_set_policy_options ::= device_set_policy_options device_set_policy_option */
#line 107 "CLIParser.y"
        {
            yy_destructor(yypParser,29,&yymsp[-1].minor);
        }
#line 900 "CLIParser.c"
        break;
    case 19: /* device_set_policy_option ::= OPTION_TIMEOUT timeout_value */
#line 109 "CLIParser.y"
        {
            yy_destructor(yypParser,7,&yymsp[-1].minor);
        }
#line 907 "CLIParser.c"
        break;
    case 20: /* device_set_policy_option ::= OPTION_PERMANENT boolean_value */
#line 110 "CLIParser.y"
        {
            yy_destructor(yypParser,8,&yymsp[-1].minor);
        }
#line 914 "CLIParser.c"
        break;
    case 21: /* device_set_policy_option ::= OPTION_PERMANENT */
#line 111 "CLIParser.y"
        {
            yy_destructor(yypParser,8,&yymsp[0].minor);
        }
#line 921 "CLIParser.c"
        break;
    case 22: /* seqn_value ::= NUMBER_UNSIGNED_INTEGER */
#line 116 "CLIParser.y"
        {
            yy_destructor(yypParser,13,&yymsp[0].minor);
        }
#line 928 "CLIParser.c"
        break;
    case 23: /* seqn_value ::= KEYWORD_LAST */
#line 117 "CLIParser.y"
        {
            yy_destructor(yypParser,14,&yymsp[0].minor);
        }
#line 935 "CLIParser.c"
        break;
    case 24: /* seqn_value ::= KEYWORD_ROOT */
#line 118 "CLIParser.y"
        {
            yy_destructor(yypParser,15,&yymsp[0].minor);
        }
#line 942 "CLIParser.c"
        break;
    case 25: /* timeout_value ::= NUMBER_UNSIGNED_INTEGER */
#line 120 "CLIParser.y"
        {
            yygotominor.yy63 = stringToNumber<uint32_t>(*yymsp[0].minor.yy0, 10);
        }
#line 949 "CLIParser.c"
        break;
    case 26: /* timeout_value ::= NUMBER_HOURS */
#line 124 "CLIParser.y"
        {
            yygotominor.yy63 = stringToNumber<uint32_t>(*yymsp[0].minor.yy0, 10);
            yygotominor.yy63 = yygotominor.yy63 * 60 * 60;
        }
#line 957 "CLIParser.c"
        break;
    case 27: /* timeout_value ::= NUMBER_MINUTES */
#line 129 "CLIParser.y"
        {
            yygotominor.yy63 = stringToNumber<uint32_t>(*yymsp[0].minor.yy0, 10);
            yygotominor.yy63 = yygotominor.yy63 * 60;
        }
#line 965 "CLIParser.c"
        break;
    case 28: /* timeout_value ::= NUMBER_DAYS */
#line 134 "CLIParser.y"
        {
            yygotominor.yy63 = stringToNumber<uint32_t>(*yymsp[0].minor.yy0, 10);
            yygotominor.yy63 = yygotominor.yy63 * 60 * 60 * 24;
        }
#line 973 "CLIParser.c"
        break;
    case 29: /* boolean_value ::= KEYWORD_FALSE */
#line 139 "CLIParser.y"
        {
            yygotominor.yy65 = false;
            yy_destructor(yypParser,19,&yymsp[0].minor);
        }
#line 981 "CLIParser.c"
        break;
    case 30: /* boolean_value ::= KEYWORD_TRUE */
#line 143 "CLIParser.y"
        {
            yygotominor.yy65 = true;
            yy_destructor(yypParser,20,&yymsp[0].minor);
        }
#line 989 "CLIParser.c"
        break;
    case 31: /* target_value ::= string */
#line 147 "CLIParser.y"
        {
            yy_destructor(yypParser,33,&yymsp[0].minor);
        }
#line 996 "CLIParser.c"
        break;
    case 32: /* string ::= STRING */
#line 149 "CLIParser.y"
        {
            yygotominor.yy5 = new std::string(*yymsp[0].minor.yy0);
        }
#line 1003 "CLIParser.c"
        break;
    case 33: /* string ::= DQ_STRING_BEGIN STRING DQ_STRING_END */
#line 153 "CLIParser.y"
        {
            yygotominor.yy5 = new std::string(*yymsp[-1].minor.yy0);
            yy_destructor(yypParser,22,&yymsp[-2].minor);
            yy_destructor(yypParser,23,&yymsp[0].minor);
        }
#line 1012 "CLIParser.c"
        break;
    default:
        /* (0) cli ::= commands */
        yytestcase(yyruleno==0);
        /* (2) commands ::= */ yytestcase(yyruleno==2);
        /* (11) rule_remove_args ::= seqn_value */ yytestcase(yyruleno==11);
        /* (18) device_set_policy_options ::= */ yytestcase(yyruleno==18);
        break;
    };
    yygoto = yyRuleInfo[yyruleno].lhs;
    yysize = yyRuleInfo[yyruleno].nrhs;
    yypParser->yyidx -= yysize;
    yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
    if( yyact < YYNSTATE ) {
#ifdef NDEBUG
        /* If we are not debugging and the reduce action popped at least
        ** one element off the stack, then we can push the new element back
        ** onto the stack here, and skip the stack overflow test in yy_shift().
        ** That gives a significant speed improvement. */
        if( yysize ) {
            yypParser->yyidx++;
            yymsp -= yysize-1;
            yymsp->stateno = (YYACTIONTYPE)yyact;
            yymsp->major = (YYCODETYPE)yygoto;
            yymsp->minor = yygotominor;
        } else
#endif
        {
            yy_shift(yypParser,yyact,yygoto,&yygotominor);
        }
    } else {
        assert( yyact == YYNSTATE + YYNRULE + 1 );
        yy_accept(yypParser);
    }
}
Ejemplo n.º 10
0
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
  int yyruleno                 /* Number of the rule by which to reduce */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  LineParserARG_FETCH;
  yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */

  /* Silence complaints from purify about yygotominor being uninitialized
  ** in some cases when it is copied into the stack after the following
  ** switch.  yygotominor is uninitialized when a rule reduces that does
  ** not set the value of its left-hand side nonterminal.  Leaving the
  ** value of the nonterminal uninitialized is utterly harmless as long
  ** as the value is never used.  So really the only thing this code
  ** accomplishes is to quieten purify.  
  **
  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
  ** without this code, their parser segfaults.  I'm not sure what there
  ** parser is doing to make this happen.  This is the second bug report
  ** from wireshark this week.  Clearly they are stressing Lemon in ways
  ** that it has not been previously stressed...  (SQLite ticket #2172)
  */
  /*memset(&yygotominor, 0, sizeof(yygotominor));*/
  yygotominor = yyzerominor;


  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 0: /* redirection ::= REDIRECT_INPUT_FROM_FILE ARGUMENT */
#line 51 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy4 = redir_alloc();
    BREAK_IF_ERRNO
    yygotominor.yy4->left_fd = redir_parse_left_fd(yymsp[-1].minor.yy0, 1, STDIN_FILENO);
    yygotominor.yy4->type = REDIRECT_INPUT_FROM_FILE;
    yygotominor.yy4->right_file = yymsp[0].minor.yy0;
}
#line 770 "line_parser.c"
        break;
      case 1: /* redirection ::= REDIRECT_INPUT_FROM_FILE_DESCRIPTOR ARGUMENT */
#line 59 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy4 = redir_alloc();
    BREAK_IF_ERRNO
    yygotominor.yy4->left_fd = redir_parse_left_fd(yymsp[-1].minor.yy0, 2, STDIN_FILENO);
    yygotominor.yy4->type = REDIRECT_INPUT_FROM_FILE_DESCRIPTOR;
    yygotominor.yy4->right_fd = redir_parse_fd(yymsp[0].minor.yy0);
    free(yymsp[0].minor.yy0);
}
#line 783 "line_parser.c"
        break;
      case 2: /* redirection ::= REDIRECT_OUTPUT_TO_FILE ARGUMENT */
#line 68 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy4 = redir_alloc();
    BREAK_IF_ERRNO
    yygotominor.yy4->left_fd = redir_parse_left_fd(yymsp[-1].minor.yy0, 1, STDOUT_FILENO);
    yygotominor.yy4->type = REDIRECT_OUTPUT_TO_FILE;
    yygotominor.yy4->right_file = yymsp[0].minor.yy0;
}
#line 795 "line_parser.c"
        break;
      case 3: /* redirection ::= REDIRECT_OUTPUT_TO_FILE_DESCRIPTOR ARGUMENT */
#line 76 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy4 = redir_alloc();
    BREAK_IF_ERRNO
    yygotominor.yy4->left_fd = redir_parse_left_fd(yymsp[-1].minor.yy0, 2, STDOUT_FILENO);
    yygotominor.yy4->type = REDIRECT_OUTPUT_TO_FILE_DESCRIPTOR;
    yygotominor.yy4->right_fd = redir_parse_fd(yymsp[0].minor.yy0);
    free(yymsp[0].minor.yy0);
}
#line 808 "line_parser.c"
        break;
      case 4: /* redirection ::= REDIRECT_OUTPUT_APPEND_TO_FILE ARGUMENT */
#line 85 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy4 = redir_alloc();
    BREAK_IF_ERRNO
    yygotominor.yy4->left_fd = redir_parse_left_fd(yymsp[-1].minor.yy0, 2, STDOUT_FILENO);
    yygotominor.yy4->type = REDIRECT_OUTPUT_APPEND_TO_FILE;
    yygotominor.yy4->right_file = yymsp[0].minor.yy0;
}
#line 820 "line_parser.c"
        break;
      case 5: /* command ::= ARGUMENT */
#line 94 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy2 = cmd_alloc();
    BREAK_IF_ERRNO
    strarr_append(&(yygotominor.yy2->args), yymsp[0].minor.yy0);
}
#line 830 "line_parser.c"
        break;
      case 6: /* command ::= redirection */
#line 100 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy2 = cmd_alloc();
    BREAK_IF_ERRNO
    ptrarr_append(&(yygotominor.yy2->redirs), yymsp[0].minor.yy4);
}
#line 840 "line_parser.c"
        break;
      case 7: /* command ::= command ARGUMENT */
#line 106 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy2 = yymsp[-1].minor.yy2;
    strarr_append(&(yygotominor.yy2->args), yymsp[0].minor.yy0);
}
#line 849 "line_parser.c"
        break;
      case 8: /* command ::= command redirection */
#line 111 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy2 = yymsp[-1].minor.yy2;
    ptrarr_append(&(yygotominor.yy2->redirs), yymsp[0].minor.yy4);
}
#line 858 "line_parser.c"
        break;
      case 9: /* commandList ::= command */
#line 117 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy13 = cmd_list_alloc();
    BREAK_IF_ERRNO
    ptrarr_append(&(yygotominor.yy13->cmds), yymsp[0].minor.yy2);
}
#line 868 "line_parser.c"
        break;
      case 10: /* commandList ::= commandList PIPE command */
#line 123 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy13 = yymsp[-2].minor.yy13;
    intarr_append(&(yygotominor.yy13->ops), PIPE);
    ptrarr_append(&(yygotominor.yy13->cmds), yymsp[0].minor.yy2);
  yy_destructor(yypParser,7,&yymsp[-1].minor);
}
#line 879 "line_parser.c"
        break;
      case 11: /* commandList ::= commandList OR command */
#line 129 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy13 = yymsp[-2].minor.yy13;
    intarr_append(&(yygotominor.yy13->ops), OR);
    ptrarr_append(&(yygotominor.yy13->cmds), yymsp[0].minor.yy2);
  yy_destructor(yypParser,8,&yymsp[-1].minor);
}
#line 890 "line_parser.c"
        break;
      case 12: /* commandList ::= commandList AND command */
#line 135 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy13 = yymsp[-2].minor.yy13;
    intarr_append(&(yygotominor.yy13->ops), AND);
    ptrarr_append(&(yygotominor.yy13->cmds), yymsp[0].minor.yy2);
  yy_destructor(yypParser,9,&yymsp[-1].minor);
}
#line 901 "line_parser.c"
        break;
      case 13: /* commandList ::= commandList BACKGROUND command */
#line 141 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy13 = yymsp[-2].minor.yy13;
    intarr_append(&(yygotominor.yy13->ops), BACKGROUND);
    ptrarr_append(&(yygotominor.yy13->cmds), yymsp[0].minor.yy2);
  yy_destructor(yypParser,10,&yymsp[-1].minor);
}
#line 912 "line_parser.c"
        break;
      case 14: /* commandList ::= commandList BACKGROUND */
#line 147 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy13 = yymsp[-1].minor.yy13;
    intarr_append(&(yygotominor.yy13->ops), BACKGROUND);
  yy_destructor(yypParser,10,&yymsp[0].minor);
}
#line 922 "line_parser.c"
        break;
      case 15: /* commandList ::= commandList SEMICOLON command */
#line 152 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy13 = yymsp[-2].minor.yy13;
    intarr_append(&(yygotominor.yy13->ops), SEMICOLON);
    ptrarr_append(&(yygotominor.yy13->cmds), yymsp[0].minor.yy2);
  yy_destructor(yypParser,11,&yymsp[-1].minor);
}
#line 933 "line_parser.c"
        break;
      case 16: /* commandList ::= commandList SEMICOLON */
#line 158 "line_parser.y"
{
    BREAK_IF_ERRNO
    yygotominor.yy13 = yymsp[-1].minor.yy13;
    intarr_append(&(yygotominor.yy13->ops), SEMICOLON);
  yy_destructor(yypParser,11,&yymsp[0].minor);
}
#line 943 "line_parser.c"
        break;
      case 17: /* start ::= commandList */
#line 164 "line_parser.y"
{
    BREAK_IF_ERRNO
    // Save our AST from being freed by Lemon!
    *cmd_list_p = yymsp[0].minor.yy13;
}
#line 952 "line_parser.c"
        break;
      default:
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
  if( yyact < YYNSTATE ){
#ifdef NDEBUG
    /* If we are not debugging and the reduce action popped at least
    ** one element off the stack, then we can push the new element back
    ** onto the stack here, and skip the stack overflow test in yy_shift().
    ** That gives a significant speed improvement. */
    if( yysize ){
      yypParser->yyidx++;
      yymsp -= yysize-1;
      yymsp->stateno = (YYACTIONTYPE)yyact;
      yymsp->major = (YYCODETYPE)yygoto;
      yymsp->minor = yygotominor;
    }else
#endif
    {
      yy_shift(yypParser,yyact,yygoto,&yygotominor);
    }
  }else{
    assert( yyact == YYNSTATE + YYNRULE + 1 );
    yy_accept(yypParser);
  }
}
Ejemplo n.º 11
0
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
  int yyruleno                 /* Number of the rule by which to reduce */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  phannot_ARG_FETCH;
  yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */

  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 0:
#line 86 "parser.php5.lemon"
{
	status->ret = yymsp[0].minor.yy36;
}
#line 632 "parser.php5.c"
        break;
      case 1:
      case 14:
      case 15:
#line 94 "parser.php5.lemon"
{
	yygotominor.yy36 = yymsp[0].minor.yy36;
}
#line 641 "parser.php5.c"
        break;
      case 2:
#line 102 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_zval_list(yymsp[-1].minor.yy36, yymsp[0].minor.yy36);
}
#line 648 "parser.php5.c"
        break;
      case 3:
      case 8:
#line 106 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_zval_list(NULL, yymsp[0].minor.yy36);
}
#line 656 "parser.php5.c"
        break;
      case 4:
#line 114 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_annotation(yymsp[-3].minor.yy0, yymsp[-1].minor.yy36, status->scanner_state);
  yy_destructor(2,&yymsp[-4].minor);
  yy_destructor(4,&yymsp[-2].minor);
  yy_destructor(5,&yymsp[0].minor);
}
#line 666 "parser.php5.c"
        break;
      case 5:
#line 118 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_annotation(yymsp[-2].minor.yy0, NULL, status->scanner_state);
  yy_destructor(2,&yymsp[-3].minor);
  yy_destructor(4,&yymsp[-1].minor);
  yy_destructor(5,&yymsp[0].minor);
}
#line 676 "parser.php5.c"
        break;
      case 6:
#line 122 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_annotation(yymsp[0].minor.yy0, NULL, status->scanner_state);
  yy_destructor(2,&yymsp[-1].minor);
}
#line 684 "parser.php5.c"
        break;
      case 7:
#line 130 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_zval_list(yymsp[-2].minor.yy36, yymsp[0].minor.yy36);
  yy_destructor(1,&yymsp[-1].minor);
}
#line 692 "parser.php5.c"
        break;
      case 9:
#line 142 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_named_item(NULL, yymsp[0].minor.yy36);
}
#line 699 "parser.php5.c"
        break;
      case 10:
      case 12:
#line 146 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy36);
  yy_destructor(7,&yymsp[-1].minor);
}
#line 708 "parser.php5.c"
        break;
      case 11:
      case 13:
#line 150 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_named_item(yymsp[-2].minor.yy0, yymsp[0].minor.yy36);
  yy_destructor(8,&yymsp[-1].minor);
}
#line 717 "parser.php5.c"
        break;
      case 16:
#line 174 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_IDENTIFIER, yymsp[0].minor.yy0);
}
#line 724 "parser.php5.c"
        break;
      case 17:
#line 178 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_INTEGER, yymsp[0].minor.yy0);
}
#line 731 "parser.php5.c"
        break;
      case 18:
#line 182 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_STRING, yymsp[0].minor.yy0);
}
#line 738 "parser.php5.c"
        break;
      case 19:
#line 186 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_DOUBLE, yymsp[0].minor.yy0);
}
#line 745 "parser.php5.c"
        break;
      case 20:
#line 190 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_NULL, NULL);
  yy_destructor(11,&yymsp[0].minor);
}
#line 753 "parser.php5.c"
        break;
      case 21:
#line 194 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_FALSE, NULL);
  yy_destructor(12,&yymsp[0].minor);
}
#line 761 "parser.php5.c"
        break;
      case 22:
#line 198 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_literal_zval(PHANNOT_T_TRUE, NULL);
  yy_destructor(13,&yymsp[0].minor);
}
#line 769 "parser.php5.c"
        break;
      case 23:
#line 202 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_array(yymsp[-1].minor.yy36);
  yy_destructor(14,&yymsp[-2].minor);
  yy_destructor(15,&yymsp[0].minor);
}
#line 778 "parser.php5.c"
        break;
      case 24:
#line 206 "parser.php5.lemon"
{
	yygotominor.yy36 = phannot_ret_array(yymsp[-1].minor.yy36);
  yy_destructor(16,&yymsp[-2].minor);
  yy_destructor(17,&yymsp[0].minor);
}
#line 787 "parser.php5.c"
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yypParser,yygoto);
  if( yyact < YYNSTATE ){
    yy_shift(yypParser,yyact,yygoto,&yygotominor);
  }else if( yyact == YYNSTATE + YYNRULE + 1 ){
    yy_accept(yypParser);
  }
}
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
  int yyruleno                 /* Number of the rule by which to reduce */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  ssiexprparserARG_FETCH;
  yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno>=0
        && (size_t)yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */

  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 0:
#line 29 "./mod_ssi_exprparser.y"
{
  ctx->val.bo = ssi_val_tobool(yymsp[0].minor.yy29);
  ctx->val.type = SSI_TYPE_BOOL;

  ssi_val_free(yymsp[0].minor.yy29);
}
#line 588 "mod_ssi_exprparser.c"
        break;
      case 1:
#line 36 "./mod_ssi_exprparser.y"
{
  int cmp;

  if (yymsp[-2].minor.yy29->type == SSI_TYPE_STRING &&
      yymsp[0].minor.yy29->type == SSI_TYPE_STRING) {
       cmp = strcmp(yymsp[-2].minor.yy29->str->ptr, yymsp[0].minor.yy29->str->ptr);
  } else {
    cmp = ssi_val_tobool(yymsp[-2].minor.yy29) - ssi_val_tobool(yymsp[0].minor.yy29);
  }

  yygotominor.yy29 = yymsp[-2].minor.yy29;

  switch(yymsp[-1].minor.yy8) {
  case SSI_COND_EQ: yygotominor.yy29->bo = (cmp == 0) ? 1 : 0; break;
  case SSI_COND_NE: yygotominor.yy29->bo = (cmp != 0) ? 1 : 0; break;
  case SSI_COND_GE: yygotominor.yy29->bo = (cmp >= 0) ? 1 : 0; break;
  case SSI_COND_GT: yygotominor.yy29->bo = (cmp > 0) ? 1 : 0; break;
  case SSI_COND_LE: yygotominor.yy29->bo = (cmp <= 0) ? 1 : 0; break;
  case SSI_COND_LT: yygotominor.yy29->bo = (cmp < 0) ? 1 : 0; break;
  }

  yygotominor.yy29->type = SSI_TYPE_BOOL;

  ssi_val_free(yymsp[0].minor.yy29);
}
#line 617 "mod_ssi_exprparser.c"
        break;
      case 2:
#line 61 "./mod_ssi_exprparser.y"
{
  yygotominor.yy29 = yymsp[0].minor.yy29;
}
#line 624 "mod_ssi_exprparser.c"
        break;
      case 3:
#line 64 "./mod_ssi_exprparser.y"
{
  int e;

  e = ssi_val_tobool(yymsp[-2].minor.yy29) && ssi_val_tobool(yymsp[0].minor.yy29);

  yygotominor.yy29 = yymsp[-2].minor.yy29;
  yygotominor.yy29->bo = e;
  yygotominor.yy29->type = SSI_TYPE_BOOL;
  ssi_val_free(yymsp[0].minor.yy29);
}
#line 638 "mod_ssi_exprparser.c"
  yy_destructor(1,&yymsp[-1].minor);
        break;
      case 4:
#line 75 "./mod_ssi_exprparser.y"
{
  int e;

  e = ssi_val_tobool(yymsp[-2].minor.yy29) || ssi_val_tobool(yymsp[0].minor.yy29);

  yygotominor.yy29 = yymsp[-2].minor.yy29;
  yygotominor.yy29->bo = e;
  yygotominor.yy29->type = SSI_TYPE_BOOL;
  ssi_val_free(yymsp[0].minor.yy29);
}
#line 653 "mod_ssi_exprparser.c"
  yy_destructor(2,&yymsp[-1].minor);
        break;
      case 5:
#line 86 "./mod_ssi_exprparser.y"
{
  int e;

  e = !ssi_val_tobool(yymsp[0].minor.yy29);

  yygotominor.yy29 = yymsp[0].minor.yy29;
  yygotominor.yy29->bo = e;
  yygotominor.yy29->type = SSI_TYPE_BOOL;
}
#line 667 "mod_ssi_exprparser.c"
  yy_destructor(9,&yymsp[-1].minor);
        break;
      case 6:
#line 95 "./mod_ssi_exprparser.y"
{
  yygotominor.yy29 = yymsp[-1].minor.yy29;
}
#line 675 "mod_ssi_exprparser.c"
  yy_destructor(10,&yymsp[-2].minor);
  yy_destructor(11,&yymsp[0].minor);
        break;
      case 7:
#line 99 "./mod_ssi_exprparser.y"
{
  yygotominor.yy29 = ssi_val_init();
  yygotominor.yy29->str = yymsp[0].minor.yy19;
  yygotominor.yy29->type = SSI_TYPE_STRING;
}
#line 686 "mod_ssi_exprparser.c"
        break;
      case 8:
#line 105 "./mod_ssi_exprparser.y"
{
  yygotominor.yy19 = yymsp[0].minor.yy0;
}
#line 693 "mod_ssi_exprparser.c"
        break;
      case 9:
#line 109 "./mod_ssi_exprparser.y"
{
  yygotominor.yy19 = yymsp[-1].minor.yy19;
  buffer_append_string_buffer(yygotominor.yy19, yymsp[0].minor.yy0);
  buffer_free(yymsp[0].minor.yy0);
}
#line 702 "mod_ssi_exprparser.c"
        break;
      case 10:
#line 115 "./mod_ssi_exprparser.y"
{ yygotominor.yy8 = SSI_COND_EQ; }
#line 707 "mod_ssi_exprparser.c"
  yy_destructor(3,&yymsp[0].minor);
        break;
      case 11:
#line 116 "./mod_ssi_exprparser.y"
{ yygotominor.yy8 = SSI_COND_NE; }
#line 713 "mod_ssi_exprparser.c"
  yy_destructor(4,&yymsp[0].minor);
        break;
      case 12:
#line 117 "./mod_ssi_exprparser.y"
{ yygotominor.yy8 = SSI_COND_LE; }
#line 719 "mod_ssi_exprparser.c"
  yy_destructor(8,&yymsp[0].minor);
        break;
      case 13:
#line 118 "./mod_ssi_exprparser.y"
{ yygotominor.yy8 = SSI_COND_GE; }
#line 725 "mod_ssi_exprparser.c"
  yy_destructor(6,&yymsp[0].minor);
        break;
      case 14:
#line 119 "./mod_ssi_exprparser.y"
{ yygotominor.yy8 = SSI_COND_LT; }
#line 731 "mod_ssi_exprparser.c"
  yy_destructor(7,&yymsp[0].minor);
        break;
      case 15:
#line 120 "./mod_ssi_exprparser.y"
{ yygotominor.yy8 = SSI_COND_GT; }
#line 737 "mod_ssi_exprparser.c"
  yy_destructor(5,&yymsp[0].minor);
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yypParser,yygoto);
  if( yyact < YYNSTATE ){
    yy_shift(yypParser,yyact,yygoto,&yygotominor);
  }else if( yyact == YYNSTATE + YYNRULE + 1 ){
    yy_accept(yypParser);
  }
}
Ejemplo n.º 13
0
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
  int yyruleno                 /* Number of the rule by which to reduce */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  BbParseARG_FETCH;
  yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */

  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 0:
#line 28 "core/bb-p.lemon"
{ yygotominor.yy5 = bb_program_new ();
	  bb_program_add_function_begin (yygotominor.yy5);
	  bb_program_append_program (yygotominor.yy5, yymsp[-2].minor.yy5);
	  bb_program_append_program (yygotominor.yy5, yymsp[0].minor.yy5);
	  bb_program_add_lazy_function (yygotominor.yy5, "add");   yy_destructor(2,&yymsp[-1].minor);
}
#line 592 "core/bb-p.c"
        break;
      case 1:
#line 34 "core/bb-p.lemon"
{ yygotominor.yy5 = bb_program_new ();
	  bb_program_add_function_begin (yygotominor.yy5);
	  bb_program_append_program (yygotominor.yy5, yymsp[-2].minor.yy5);
	  bb_program_append_program (yygotominor.yy5, yymsp[0].minor.yy5);
	  bb_program_add_lazy_function (yygotominor.yy5, "mul");   yy_destructor(4,&yymsp[-1].minor);
}
#line 602 "core/bb-p.c"
        break;
      case 2:
#line 40 "core/bb-p.lemon"
{ yygotominor.yy5 = bb_program_new ();
	  bb_program_add_function_begin (yygotominor.yy5);
	  bb_program_append_program (yygotominor.yy5, yymsp[-2].minor.yy5);
	  bb_program_append_program (yygotominor.yy5, yymsp[0].minor.yy5);
	  bb_program_add_lazy_function (yygotominor.yy5, "sub");   yy_destructor(3,&yymsp[-1].minor);
}
#line 612 "core/bb-p.c"
        break;
      case 3:
#line 46 "core/bb-p.lemon"
{ yygotominor.yy5 = bb_program_new ();
	  bb_program_add_function_begin (yygotominor.yy5);
	  bb_program_append_program (yygotominor.yy5, yymsp[0].minor.yy5);
	  bb_program_add_lazy_function (yygotominor.yy5, "neg");   yy_destructor(3,&yymsp[-1].minor);
}
#line 621 "core/bb-p.c"
        break;
      case 4:
#line 51 "core/bb-p.lemon"
{ yygotominor.yy5 = bb_program_new ();
	  bb_program_add_function_begin (yygotominor.yy5);
	  bb_program_append_program (yygotominor.yy5, yymsp[-2].minor.yy5);
	  bb_program_append_program (yygotominor.yy5, yymsp[0].minor.yy5);
	  bb_program_add_lazy_function (yygotominor.yy5, "div");   yy_destructor(5,&yymsp[-1].minor);
}
#line 631 "core/bb-p.c"
        break;
      case 5:
#line 58 "core/bb-p.lemon"
{ yygotominor.yy5 = bb_program_new ();
	  bb_program_append_program (yygotominor.yy5, yymsp[-1].minor.yy5);   yy_destructor(7,&yymsp[-2].minor);
  yy_destructor(8,&yymsp[0].minor);
}
#line 639 "core/bb-p.c"
        break;
      case 6:
#line 61 "core/bb-p.lemon"
{ yygotominor.yy5 = bb_program_new ();
	  bb_program_append_program (yygotominor.yy5, yymsp[-2].minor.yy5);
	  bb_program_append_program (yygotominor.yy5, yymsp[0].minor.yy5);   yy_destructor(1,&yymsp[-1].minor);
}
#line 647 "core/bb-p.c"
        break;
      case 7:
#line 65 "core/bb-p.lemon"
{ GValue value;
          char *end;
          gdouble nvalue = strtod (yymsp[0].minor.yy0, &end);
          if (yymsp[0].minor.yy0 == end)
            g_error ("error parsing number from %s", yymsp[0].minor.yy0);
	  memset (&value, 0, sizeof (value));
          if (strcmp (end, "sec") == 0 || strcmp (end, "s") == 0)
            {
              g_value_init (&value, BB_TYPE_DURATION);
              bb_value_set_duration (&value, BB_DURATION_UNITS_SECONDS, nvalue);
            }
          else if (strcmp (end, "samp") == 0)
            {
              g_value_init (&value, BB_TYPE_DURATION);
              bb_value_set_duration (&value, BB_DURATION_UNITS_SAMPLES, nvalue);
            }
          else if (strcmp (end, "beat") == 0 || strcmp (end, "b") == 0)
            {
              g_value_init (&value, BB_TYPE_DURATION);
              bb_value_set_duration (&value, BB_DURATION_UNITS_BEATS, nvalue);
            }
          else if (strcmp (end, "%") == 0)
            {
              g_value_init (&value, BB_TYPE_DURATION);
              bb_value_set_duration (&value, BB_DURATION_UNITS_NOTE_LENGTHS, nvalue * 0.01);
            }
          else if (*end != 0)
            {
              g_error ("garbage after number (garbage is '%s'", end);
            }
          else
            {
              g_value_init (&value, G_TYPE_DOUBLE);
              g_value_set_double (&value, nvalue);
            }
	  yygotominor.yy5 = bb_program_new ();
	  bb_program_add_push (yygotominor.yy5, &value); }
#line 688 "core/bb-p.c"
        break;
      case 8:
#line 104 "core/bb-p.lemon"
{ /* find or allocate parameter */
	  guint i;
	  for (i = 0; i < context->pspec_array->len; i++)
	    {
	      GParamSpec *p = g_ptr_array_index (context->pspec_array, i);
	      if (bb_param_spec_names_equal (p->name, yymsp[0].minor.yy0))
	        break;
            }
	  if (i == context->pspec_array->len)
	    {
              for (i = 0; i < context->n_source_pspecs; i++)
                if (bb_param_spec_names_equal (yymsp[0].minor.yy0, context->source_pspecs[i]->name))
                  break;
              if (i == context->n_source_pspecs)
		{
		  g_message ("warning: allocating double parameter named %s", yymsp[0].minor.yy0);
		  g_ptr_array_add (context->pspec_array,
				   g_param_spec_double (yymsp[0].minor.yy0,yymsp[0].minor.yy0,NULL,
				      -1e9,1e9,0,G_PARAM_READWRITE));
		  }
              else
                g_ptr_array_add (context->pspec_array, context->source_pspecs[i]);
              i = context->pspec_array->len - 1;
	    }
	  yygotominor.yy5 = bb_program_new ();
	  bb_program_add_push_param (yygotominor.yy5, i); }
#line 718 "core/bb-p.c"
        break;
      case 9:
#line 132 "core/bb-p.lemon"
{ BbBuiltinFunc f;
          yygotominor.yy5 = bb_program_new ();
	  f = bb_builtin_lookup (yymsp[-3].minor.yy0);
	  if (f != NULL)
	    {
	      bb_program_append_program (yygotominor.yy5, yymsp[-1].minor.yy5);
	      bb_program_add_builtin (yygotominor.yy5, yymsp[-3].minor.yy0, f);
	    }
	  else
	    {
	      /* TODO: try resolving the function now */
	      bb_program_add_function_begin (yygotominor.yy5);
	      bb_program_append_program (yygotominor.yy5, yymsp[-1].minor.yy5);
	      bb_program_add_lazy_function (yygotominor.yy5, yymsp[-3].minor.yy0);
	    }
	  yy_destructor(7,&yymsp[-2].minor);
  yy_destructor(8,&yymsp[0].minor);
}
#line 740 "core/bb-p.c"
        break;
      case 10:
#line 149 "core/bb-p.lemon"
{ BbBuiltinFunc f;
          yygotominor.yy5 = bb_program_new ();
	  f = bb_builtin_lookup (yymsp[-2].minor.yy0);
	  if (f != NULL)
	    bb_program_add_builtin (yygotominor.yy5, yymsp[-2].minor.yy0, f);
	  else
	    {
	      bb_program_add_function_begin (yygotominor.yy5);
	      bb_program_add_lazy_function (yygotominor.yy5, yymsp[-2].minor.yy0);
	    }
	  yy_destructor(7,&yymsp[-1].minor);
  yy_destructor(8,&yymsp[0].minor);
}
#line 757 "core/bb-p.c"
        break;
      case 11:
#line 163 "core/bb-p.lemon"
{ GType type = g_type_from_name (yymsp[-2].minor.yy0);
          guint v;
          GValue ev;
          if (type == 0 || !g_type_is_a (type, G_TYPE_ENUM))
            g_error ("no enum named '%s'", yymsp[-2].minor.yy0);
          if (!bb_enum_value_lookup (type, yymsp[0].minor.yy0, &v))
            g_error ("no value of %s named %s", yymsp[-2].minor.yy0, yymsp[0].minor.yy0);

          memset (&ev, 0, sizeof (ev));
          g_value_init (&ev, type);
          g_value_set_enum (&ev, v);
          yygotominor.yy5 = bb_program_new ();
          bb_program_add_push (yygotominor.yy5, &ev);   yy_destructor(6,&yymsp[-1].minor);
}
#line 775 "core/bb-p.c"
        break;
      case 12:
#line 178 "core/bb-p.lemon"
{ yygotominor.yy5 = bb_program_new ();
	  bb_program_add_push_special (yygotominor.yy5, BB_VM_SPECIAL_ARRAY_BEGIN);
	  bb_program_append_program (yygotominor.yy5, yymsp[-1].minor.yy5);
	  bb_program_add_builtin (yygotominor.yy5, "create_array", bb_builtin_create_array);   yy_destructor(11,&yymsp[-2].minor);
  yy_destructor(12,&yymsp[0].minor);
}
#line 785 "core/bb-p.c"
        break;
      case 13:
#line 184 "core/bb-p.lemon"
{ GValue v = BB_VALUE_INIT;
          yygotominor.yy5 = bb_program_new ();
	  g_value_init (&v, G_TYPE_STRING);
          g_value_set_string (&v, yymsp[0].minor.yy0);
	  bb_program_add_push (yygotominor.yy5, &v); }
#line 794 "core/bb-p.c"
        break;
      case 14:
#line 191 "core/bb-p.lemon"
{ if (context->program)
	    { g_warning ("got two programs"); }
	  else
	    { context->program = bb_program_ref (yymsp[0].minor.yy5); }
	}
#line 803 "core/bb-p.c"
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yypParser,yygoto);
  if( yyact < YYNSTATE ){
    yy_shift(yypParser,yyact,yygoto,&yygotominor);
  }else if( yyact == YYNSTATE + YYNRULE + 1 ){
    yy_accept(yypParser);
  }
}