[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.9 Finite State Machine Grammar

The preprocessing directives and comments are not part of the grammar. They are handled by the scanner/lexer. The following was extracted directly from the generated defParse-fsm.c source file. The "EVT:" is the token seen, the "STATE:" is the current state and the entries in this table describe the next state and the action to take. Invalid transitions were removed from the table.

 
dp_trans_table[ DP_STATE_CT ][ DP_EVENT_CT ] = {

  /* STATE 0:  DP_ST_INIT */
  { { DP_ST_NEED_DEF, NULL },                       /* EVT:  autogen */

  /* STATE 1:  DP_ST_NEED_DEF */
    { DP_ST_NEED_TPL, NULL },                       /* EVT:  definitions */

  /* STATE 2:  DP_ST_NEED_TPL */
    { DP_ST_NEED_SEMI, &dp_do_tpl_name },           /* EVT:  var_name */
    { DP_ST_NEED_SEMI, &dp_do_tpl_name },           /* EVT:  other_name */
    { DP_ST_NEED_SEMI, &dp_do_tpl_name },           /* EVT:  string */

  /* STATE 3:  DP_ST_NEED_SEMI */
    { DP_ST_NEED_NAME, NULL },                      /* EVT:  ; */

  /* STATE 4:  DP_ST_NEED_NAME */
  { { DP_ST_NEED_DEF, NULL },                       /* EVT:  autogen */
    { DP_ST_DONE, &dp_do_need_name_end },           /* EVT:  End-Of-File */
    { DP_ST_HAVE_NAME, &dp_do_need_name_var_name }, /* EVT:  var_name */
    { DP_ST_HAVE_VALUE, &dp_do_end_block },         /* EVT:  } */

  /* STATE 5:  DP_ST_HAVE_NAME */
    { DP_ST_NEED_NAME, &dp_do_empty_val },          /* EVT:  ; */
    { DP_ST_NEED_VALUE, &dp_do_have_name_lit_eq },  /* EVT:  = */
    { DP_ST_NEED_IDX, NULL },                       /* EVT:  [ */

  /* STATE 6:  DP_ST_NEED_VALUE */
    { DP_ST_HAVE_VALUE, &dp_do_str_value },         /* EVT:  var_name */
    { DP_ST_HAVE_VALUE, &dp_do_str_value },         /* EVT:  other_name */
    { DP_ST_HAVE_VALUE, &dp_do_str_value },         /* EVT:  string */
    { DP_ST_HAVE_VALUE, &dp_do_str_value },         /* EVT:  here_string */
    { DP_ST_HAVE_VALUE, &dp_do_str_value },         /* EVT:  number */
    { DP_ST_NEED_NAME, &dp_do_start_block },        /* EVT:  { */

  /* STATE 7:  DP_ST_NEED_IDX */
    { DP_ST_NEED_CBKT, &dp_do_indexed_name },       /* EVT:  var_name */
    { DP_ST_NEED_CBKT, &dp_do_indexed_name },       /* EVT:  number */

  /* STATE 8:  DP_ST_NEED_CBKT */
    { DP_ST_INDX_NAME, NULL }                       /* EVT:  ] */

  /* STATE 9:  DP_ST_INDX_NAME */
    { DP_ST_NEED_NAME, &dp_do_empty_val },          /* EVT:  ; */
    { DP_ST_NEED_VALUE, NULL },                     /* EVT:  = */

  /* STATE 10:  DP_ST_HAVE_VALUE */
    { DP_ST_NEED_NAME, NULL },                      /* EVT:  ; */
    { DP_ST_NEED_VALUE, &dp_do_next_val },          /* EVT:  , */

This document was generated by Bruce Korb on September, 30 2006 using texi2html 1.76.

Viewable With Any Browser   autogen Home