sxdynam_parser.c File Reference

#include "sxversion.h"
#include "sxcommon.h"
#include "sxdynam_parser.h"
#include <memory.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
Include dependency graph for sxdynam_parser.c:

Go to the source code of this file.

Defines

#define SX_GLOBAL_VAR_SXDG
#define parse_stack_oflw()
#define WRITE(p, l)   ((bytes=(l))>0&&(write(file_descr, p, (size_t)bytes) == bytes))
#define READ(p, l)   ((bytes=(l))>0&&(read (file_descr, p, (size_t) bytes) == bytes))

Functions

static SXVOID P_oflw (SXINT old_size, SXINT new_size)
static SXVOID items_oflw (SXINT old_size, SXINT new_size)
static SXINT states_oflw (SXINT old_size, SXINT new_size)
static SXVOID xt_oflw (SXINT old_size, SXINT new_size)
static SXVOID transitions_oflw (SXINT old_size, SXINT new_size)
static SXVOID parse_stacks_oflw (SXINT old_size, SXINT new_size)
static SXVOID update_automaton (SXINT rule)
SXINT sxdp_rule_is_set (SXINT rhs_lgth, SXINT *symbols)
SXBOOLEAN sxdp_rule_is_activated (SXINT rule)
SXBOOLEAN sxdp_rule_set (SXINT rhs_lgth, SXINT *symbols, SXINT *rule, SXINT action_nb, SXINT prio, SXINT assoc)
SXVOID sxdp_rule_get_attr (SXINT rule, SXINT *action_nb, SXINT *prio, SXINT *assoc)
SXVOID sxdp_rule_set_attr (SXINT rule, SXINT action_nb, SXINT prio, SXINT assoc)
SXVOID sxdp_rule_activate (SXINT rule)
SXVOID sxdp_rule_deactivate (SXINT rule)
static SXVOID GC_states (void)
SXVOID sxdp_rule_delete (SXINT rule)
static SXBOOLEAN new_pstack (SXINT ops, SXINT state, SXINT ptok_no, SXINT *nps)
static SXBOOLEAN closure (SXINT item)
SXBOOLEAN sxdp_add_new_state (SXINT transition, SXINT *result)
static SXBOOLEAN check_viable_prefix (SXINT xps, SXINT *parse_stack)
static SXVOID reactivate_path (SXINT xps, SXINT pstack)
SXVOID sxdp_init_state (void)
static SXVOID push_next_state (SXINT state, SXINT symbol)
static SXVOID get_next_states (SXINT transition)
static SXBOOLEAN solve_conflicts (SXINT parse_stack, SXINT *la_lgth, SXINT *rule_or_trans, SXINT *pstack1)
static SXVOID read_a_tok (SXINT ptok_no)
static SXINT check_new_pstack (SXINT pstack_orig, SXINT pstack, SXINT state, SXINT ptok_no)
static SXINT parsact_DO (SXINT rule, SXINT rhs_lgth)
static SXVOID parsact_UNDO (SXINT rule, SXINT rhs_lgth, SXINT action)
static SXBOOLEAN check_reduce (SXINT pstack_orig, SXINT la_lgth, SXINT rule)
static SXINT check_t_trans (SXINT pstack, SXINT la_lgth, SXINT transition)
static SXVOID erase_pstack (SXINT pstack)
static SXVOID erase_subpstack (SXINT pstack)
static SXBOOLEAN call_solve_conflicts (SXINT pstack_orig, SXINT pstack, SXINT *la_lgth)
static SXINT reduce (SXINT rule, SXINT pstack_orig, SXINT pstack1)
static SXINT shift (void)
static SXBOOLEAN sxdp_parse_it (void)
SXBOOLEAN sxdp_new_xt (SXINT t, SXINT prdct, SXINT *xt, SXINT prio, SXINT assoc)
SXVOID sxdp_delete_xt (SXINT xt)
SXBOOLEAN sxdp_new_xnt (SXINT nt, SXINT prdct, SXINT *xnt)
SXVOID sxdp_delete_xnt (SXINT xnt)
SXBOOLEAN sxdp_write (sxfiledesc_t file_descr)
SXBOOLEAN sxdp_read (sxfiledesc_t file_descr)
SXVOID sxdp_alloc (SXINT rule_nb)
SXVOID sxdp_free (void)
static SXVOID sxdp_G0 (void)
SXINT sxdynam_parser (SXINT what_to_do, struct sxtables *arg)

Variables

static char ME [] = "DYNAM_PARSER"
char WHAT_SXDYNAM_PARSER [] = "@(#)SYNTAX - $Id: sxdynam_parser.c 1508 2008-08-19 15:58:13Z sagot $" WHAT_DEBUG
static struct pstack_to_attr empty_attr

Define Documentation

 
#define parse_stack_oflw (  ) 
Value:
sxpglobals.parse_stack =                        \
    (struct sxparstack*) sxrealloc (sxpglobals.parse_stack,     \
                    (SXDG.lgt1 *= 2) + 1,       \
                    sizeof (struct sxparstack))

Definition at line 66 of file sxdynam_parser.c.

Referenced by call_solve_conflicts(), check_reduce(), check_t_trans(), reduce(), and sxdp_parse_it().

#define READ ( p,
 )     ((bytes=(l))>0&&(read (file_descr, p, (size_t) bytes) == bytes))
#define SX_GLOBAL_VAR_SXDG

Definition at line 22 of file sxdynam_parser.c.

#define WRITE ( p,
 )     ((bytes=(l))>0&&(write(file_descr, p, (size_t)bytes) == bytes))

Function Documentation

static SXBOOLEAN call_solve_conflicts ( SXINT  pstack_orig,
SXINT  pstack,
SXINT *  la_lgth 
) [static]
static SXINT check_new_pstack ( SXINT  pstack_orig,
SXINT  pstack,
SXINT  state,
SXINT  ptok_no 
) [static]

Definition at line 845 of file sxdynam_parser.c.

References new_pstack(), sxerror(), and sxplocals.

Referenced by check_reduce().

static SXBOOLEAN check_reduce ( SXINT  pstack_orig,
SXINT  la_lgth,
SXINT  rule 
) [static]
static SXINT check_t_trans ( SXINT  pstack,
SXINT  la_lgth,
SXINT  transition 
) [static]
static SXBOOLEAN check_viable_prefix ( SXINT  xps,
SXINT *  parse_stack 
) [static]
static SXBOOLEAN closure ( SXINT  item  )  [static]

Definition at line 483 of file sxdynam_parser.c.

References SXFALSE, and SXTRUE.

Referenced by sxdp_add_new_state().

static SXVOID erase_pstack ( SXINT  pstack  )  [static]

Definition at line 1077 of file sxdynam_parser.c.

Referenced by solve_conflicts().

static SXVOID erase_subpstack ( SXINT  pstack  )  [static]

Definition at line 1090 of file sxdynam_parser.c.

Referenced by sxdynam_parser().

static SXVOID GC_states ( void   )  [static]

Definition at line 372 of file sxdynam_parser.c.

References SXFALSE, and sxlist_erase().

Referenced by sxdp_parse_it().

static SXVOID get_next_states ( SXINT  transition  )  [static]

Definition at line 765 of file sxdynam_parser.c.

References push_next_state(), SXBOOLEAN, sxdp_add_new_state(), SXFALSE, sxplocals, SXTRUE, and XxY_is_set().

Referenced by check_t_trans().

static SXVOID items_oflw ( SXINT  old_size,
SXINT  new_size 
) [static]

Definition at line 128 of file sxdynam_parser.c.

References sxba_calloc(), sxba_copy(), and sxba_resize().

Referenced by sxdp_alloc(), sxdp_G0(), and sxdp_read().

static SXBOOLEAN new_pstack ( SXINT  ops,
SXINT  state,
SXINT  ptok_no,
SXINT *  nps 
) [static]
static SXVOID P_oflw ( SXINT  old_size,
SXINT  new_size 
) [static]

Definition at line 79 of file sxdynam_parser.c.

References sxba_calloc(), sxba_copy(), and sxba_resize().

Referenced by sxdp_alloc(), sxdp_G0(), and sxdp_read().

static SXINT parsact_DO ( SXINT  rule,
SXINT  rhs_lgth 
) [static]

Definition at line 907 of file sxdynam_parser.c.

References action(), and sxplocals.

Referenced by call_solve_conflicts(), and check_reduce().

static SXVOID parsact_UNDO ( SXINT  rule,
SXINT  rhs_lgth,
SXINT  action 
) [static]

Definition at line 928 of file sxdynam_parser.c.

References sxplocals.

Referenced by call_solve_conflicts(), and check_reduce().

static SXVOID parse_stacks_oflw ( SXINT  old_size,
SXINT  new_size 
) [static]

Definition at line 235 of file sxdynam_parser.c.

Referenced by sxdp_alloc().

static SXVOID push_next_state ( SXINT  state,
SXINT  symbol 
) [static]

Definition at line 749 of file sxdynam_parser.c.

References sxdp_add_new_state(), and XxY_is_set().

Referenced by get_next_states().

static SXVOID reactivate_path ( SXINT  xps,
SXINT  pstack 
) [static]

Definition at line 676 of file sxdynam_parser.c.

References ME, SXFALSE, sxtrap(), XxY_is_set(), and XxY_set().

Referenced by call_solve_conflicts(), check_reduce(), and reduce().

static SXVOID read_a_tok ( SXINT  ptok_no  )  [static]

Definition at line 825 of file sxdynam_parser.c.

References sxplocals.

Referenced by solve_conflicts(), and sxdp_parse_it().

static SXINT reduce ( SXINT  rule,
SXINT  pstack_orig,
SXINT  pstack1 
) [static]
static SXINT shift ( void   )  [static]

Definition at line 1684 of file sxdynam_parser.c.

References ME, reduce(), solve_conflicts(), sxdp_add_new_state(), sxtrap(), and XxY_is_set().

Referenced by sxdp_parse_it().

static SXBOOLEAN solve_conflicts ( SXINT  parse_stack,
SXINT *  la_lgth,
SXINT *  rule_or_trans,
SXINT *  pstack1 
) [static]
static SXINT states_oflw ( SXINT  old_size,
SXINT  new_size 
) [static]

Definition at line 154 of file sxdynam_parser.c.

References sxba_calloc(), sxba_copy(), and sxba_resize().

Referenced by sxdp_alloc(), sxdp_G0(), and sxdp_read().

SXBOOLEAN sxdp_add_new_state ( SXINT  transition,
SXINT *  result 
)
SXVOID sxdp_alloc ( SXINT  rule_nb  ) 
SXVOID sxdp_delete_xnt ( SXINT  xnt  ) 

Definition at line 1825 of file sxdynam_parser.c.

SXVOID sxdp_delete_xt ( SXINT  xt  ) 

Definition at line 1811 of file sxdynam_parser.c.

SXVOID sxdp_free ( void   ) 

Definition at line 2002 of file sxdynam_parser.c.

References sxlist_free(), XxY_free(), and XxYxZ_free().

Referenced by sxdynam_parser().

static SXVOID sxdp_G0 ( void   )  [static]
SXVOID sxdp_init_state ( void   ) 

Definition at line 725 of file sxdynam_parser.c.

References sxlist_set(), and XxY_set().

SXBOOLEAN sxdp_new_xnt ( SXINT  nt,
SXINT  prdct,
SXINT *  xnt 
)

Definition at line 1818 of file sxdynam_parser.c.

References XxY_set().

SXBOOLEAN sxdp_new_xt ( SXINT  t,
SXINT  prdct,
SXINT *  xt,
SXINT  prio,
SXINT  assoc 
)

Definition at line 1793 of file sxdynam_parser.c.

References SXBOOLEAN, and XxY_set().

static SXBOOLEAN sxdp_parse_it ( void   )  [static]
SXBOOLEAN sxdp_read ( sxfiledesc_t  file_descr  ) 
SXVOID sxdp_rule_activate ( SXINT  rule  ) 

Definition at line 356 of file sxdynam_parser.c.

References update_automaton().

SXVOID sxdp_rule_deactivate ( SXINT  rule  ) 

Definition at line 364 of file sxdynam_parser.c.

References update_automaton().

Referenced by sxdp_rule_delete().

SXVOID sxdp_rule_delete ( SXINT  rule  ) 

Definition at line 438 of file sxdynam_parser.c.

References sxdp_rule_deactivate(), and SXTRUE.

SXVOID sxdp_rule_get_attr ( SXINT  rule,
SXINT *  action_nb,
SXINT *  prio,
SXINT *  assoc 
)

Definition at line 334 of file sxdynam_parser.c.

SXBOOLEAN sxdp_rule_is_activated ( SXINT  rule  ) 

Definition at line 284 of file sxdynam_parser.c.

SXINT sxdp_rule_is_set ( SXINT  rhs_lgth,
SXINT *  symbols 
)

Definition at line 270 of file sxdynam_parser.c.

References XxY_is_set(), and XxY_set().

SXBOOLEAN sxdp_rule_set ( SXINT  rhs_lgth,
SXINT *  symbols,
SXINT *  rule,
SXINT  action_nb,
SXINT  prio,
SXINT  assoc 
)

Definition at line 291 of file sxdynam_parser.c.

References SXBOOLEAN, and XxY_set().

SXVOID sxdp_rule_set_attr ( SXINT  rule,
SXINT  action_nb,
SXINT  prio,
SXINT  assoc 
)

Definition at line 343 of file sxdynam_parser.c.

SXBOOLEAN sxdp_write ( sxfiledesc_t  file_descr  ) 

Definition at line 1832 of file sxdynam_parser.c.

References bytes, sxba_write(), SXBOOLEAN, sxlist_write(), WRITE, and XxY_write().

SXINT sxdynam_parser ( SXINT  what_to_do,
struct sxtables arg 
)
static SXVOID transitions_oflw ( SXINT  old_size,
SXINT  new_size 
) [static]

Definition at line 215 of file sxdynam_parser.c.

References sxba_calloc(), and sxba_resize().

Referenced by sxdp_alloc(), sxdp_G0(), and sxdp_read().

static SXVOID update_automaton ( SXINT  rule  )  [static]

Definition at line 245 of file sxdynam_parser.c.

References SXTRUE.

Referenced by sxdp_rule_activate(), and sxdp_rule_deactivate().

static SXVOID xt_oflw ( SXINT  old_size,
SXINT  new_size 
) [static]

Definition at line 192 of file sxdynam_parser.c.

Referenced by sxdp_alloc(), sxdp_G0(), and sxdp_read().


Variable Documentation

struct pstack_to_attr empty_attr [static]

Definition at line 74 of file sxdynam_parser.c.

Referenced by new_pstack().

char ME[] = "DYNAM_PARSER" [static]
char WHAT_SXDYNAM_PARSER[] = "@(#)SYNTAX - $Id: sxdynam_parser.c 1508 2008-08-19 15:58:13Z sagot $" WHAT_DEBUG

Definition at line 33 of file sxdynam_parser.c.


Generated on Wed Apr 21 16:39:37 2010 for syntax-6.0b7 by  doxygen 1.6.1