#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
Include dependency graph for lemon.c:
Go to the source code of this file.
Classes | |
struct | s_options |
struct | symbol |
struct | rule |
struct | config |
struct | action |
struct | state |
struct | plink |
struct | lemon |
struct | acttab |
struct | pstate |
struct | axset |
struct | s_x1 |
struct | s_x1node |
struct | s_x2 |
struct | s_x2node |
struct | s_x3 |
struct | s_x3node |
struct | s_x4 |
struct | s_x4node |
Defines | |
#define | PRIVATE |
#define | MAXRHS 1000 |
#define | assert(X) if(!(X))myassert(__FILE__,__LINE__) |
#define | SetFind(X, Y) (X[Y]) |
#define | NO_OFFSET (-2147483647) |
#define | MemoryCheck(X) |
#define | acttab_size(X) ((X)->nAction) |
#define | acttab_yyaction(X, N) ((X)->aAction[N].action) |
#define | acttab_yylookahead(X, N) ((X)->aAction[N].lookahead) |
#define | ERRMSGSIZE 10000 |
#define | LINEWIDTH 79 |
#define | PREFIXLIMIT 60 |
#define | NEXT(A) (*(char**)(((unsigned long)A)+offset)) |
#define | LISTSIZE 30 |
#define | ISOPT(X) ((X)[0]=='-'||(X)[0]=='+'||strchr((X),'=')!=0) |
#define | LINESIZE 1000 |
Typedefs | |
typedef acttab | acttab |
typedef s_x1node | x1node |
typedef s_x2node | x2node |
typedef s_x3node | x3node |
typedef s_x4node | x4node |
Enumerations | |
enum | Boolean { B_FALSE = 0, B_TRUE } |
Functions | |
char * | msort () |
action * | Action_new () |
action * | Action_sort () |
void | myassert () |
void | FindRulePrecedences () |
void | FindFirstSets () |
void | FindStates () |
void | FindLinks () |
void | FindFollowSets () |
void | FindActions () |
void | Configlist_init () |
config * | Configlist_add () |
config * | Configlist_addbasis () |
void | Configlist_closure () |
void | Configlist_sort () |
void | Configlist_sortbasis () |
config * | Configlist_return () |
config * | Configlist_basis () |
void | Configlist_eat () |
void | Configlist_reset () |
void | ErrorMsg (const char *, int, const char *,...) |
int | OptInit () |
int | OptNArgs () |
char * | OptArg () |
void | OptErr () |
void | OptPrint () |
void | Parse () |
plink * | Plink_new () |
void | Plink_add () |
void | Plink_copy () |
void | Plink_delete () |
void | Reprint () |
void | ReportOutput () |
void | ReportTable () |
void | ReportHeader () |
void | CompressTables () |
void | SetSize () |
char * | SetNew () |
void | SetFree () |
int | SetAdd () |
int | SetUnion () |
char * | Strsafe () |
void | Strsafe_init () |
int | Strsafe_insert () |
char * | Strsafe_find () |
symbol * | Symbol_new () |
int | Symbolcmpp (const void *void_a, const void *void_b) |
void | Symbol_init () |
int | Symbol_insert () |
symbol * | Symbol_find () |
symbol * | Symbol_Nth () |
int | Symbol_count () |
symbol ** | Symbol_arrayof () |
int | Configcmp () |
state * | State_new () |
void | State_init () |
int | State_insert () |
state * | State_find () |
state ** | State_arrayof () |
void | Configtable_init () |
int | Configtable_insert () |
config * | Configtable_find () |
void | Configtable_clear () |
static int | actioncmp (struct action *ap1, struct action *ap2) |
action * | Action_sort (struct action *ap) |
void | Action_add (struct action **app, enum e_action type, struct symbol *sp, char *arg) |
void | acttab_free (acttab *p) |
acttab * | acttab_alloc (void) |
void | acttab_action (acttab *p, int lookahead, int action) |
int | acttab_insert (acttab *p) |
void | myassert (char *file, int line) |
void | FindRulePrecedences (struct lemon *xp) |
void | FindFirstSets (struct lemon *lemp) |
PRIVATE struct state * | getstate () |
void | FindStates (struct lemon *lemp) |
PRIVATE void | buildshifts () |
PRIVATE struct state * | getstate (struct lemon *lemp) |
PRIVATE void | buildshifts (struct lemon *lemp, struct state *stp) |
void | FindLinks (struct lemon *lemp) |
void | FindFollowSets (struct lemon *lemp) |
static int | resolve_conflict () |
void | FindActions (struct lemon *lemp) |
static int | resolve_conflict (struct action *apx, struct action *apy) |
PRIVATE struct config * | newconfig () |
PRIVATE void | deleteconfig (struct config *old) |
config * | Configlist_add (struct rule *rp, int dot) |
config * | Configlist_addbasis (struct rule *rp, int dot) |
void | Configlist_closure (struct lemon *lemp) |
void | Configlist_eat (struct config *cfp) |
static int | findbreak (char *msg, int min, int max) |
void | memory_error () |
static void | handle_D_option (char *z) |
static void | handle_o_option (char *z) |
static void | handle_h_option (char *z) |
int | main (int argc, char **argv) |
static char * | merge (char *a, char *b, int(*cmp)(), int offset) |
char * | msort (char *list, char **next, int(*cmp)()) |
static void | errline (int n, int k, FILE *err) |
static int | argindex (int n) |
static int | handleflags (int i, FILE *err) |
static int | handleswitch (int i, FILE *err) |
int | OptInit (char **a, struct s_options *o, FILE *err) |
char * | OptArg (int n) |
void | OptErr (int n) |
static void | parseonetoken (struct pstate *psp) |
static void | preprocess_input (char *z) |
void | Parse (struct lemon *gp) |
void | Plink_add (struct plink **plpp, struct config *cfp) |
void | Plink_copy (struct plink **to, struct plink *from) |
void | Plink_delete (struct plink *plp) |
PRIVATE char * | file_makename (struct lemon *lemp, char *suffix) |
PRIVATE FILE * | file_open (struct lemon *lemp, char *suffix, char *mode) |
void | Reprint (struct lemon *lemp) |
void | ConfigPrint (FILE *fp, struct config *cfp) |
int | PrintAction (struct action *ap, FILE *fp, int indent) |
void | ReportOutput (struct lemon *lemp) |
PRIVATE char * | pathsearch (char *argv0, char *name, int modemask) |
PRIVATE int | compute_action (struct lemon *lemp, struct action *ap) |
PRIVATE void | tplt_xfer (char *name, FILE *in, FILE *out, int *lineno) |
PRIVATE FILE * | tplt_open (struct lemon *lemp) |
PRIVATE void | tplt_linedir (FILE *out, int lineno, char *filename) |
PRIVATE void | tplt_print (FILE *out, struct lemon *lemp, char *str, int strln, int *lineno) |
void | emit_destructor_code (FILE *out, struct symbol *sp, struct lemon *lemp, int *lineno) |
int | has_destructor (struct symbol *sp, struct lemon *lemp) |
PRIVATE char * | append_str (char *zText, int n, int p1, int p2) |
PRIVATE void | translate_code (struct lemon *lemp, struct rule *rp) |
PRIVATE void | emit_code (FILE *out, struct rule *rp, struct lemon *lemp, int *lineno) |
void | print_stack_union (FILE *out, struct lemon *lemp, int *plineno, int mhflag) |
static const char * | minimum_size_type (int lwr, int upr) |
static int | axset_compare (const void *a, const void *b) |
void | ReportTable (struct lemon *lemp, int mhflag) |
void | ReportHeader (struct lemon *lemp) |
void | CompressTables (struct lemon *lemp) |
void | SetSize (int n) |
void | SetFree (char *s) |
int | SetAdd (char *s, int e) |
int | SetUnion (char *s1, char *s2) |
PRIVATE int | strhash (char *x) |
char * | Strsafe (char *y) |
int | Strsafe_insert (char *data) |
char * | Strsafe_find (char *key) |
symbol * | Symbol_new (char *x) |
int | Symbol_insert (struct symbol *data, char *key) |
symbol * | Symbol_find (char *key) |
symbol * | Symbol_Nth (int n) |
int | Configcmp (struct config *a, struct config *b) |
PRIVATE int | statecmp (struct config *a, struct config *b) |
PRIVATE int | statehash (struct config *a) |
int | State_insert (struct state *data, struct config *key) |
state * | State_find (struct config *key) |
PRIVATE int | confighash (struct config *a) |
int | Configtable_insert (struct config *data) |
config * | Configtable_find (struct config *key) |
void | Configtable_clear (int(*f)()) |
Variables | |
static struct config * | freelist = 0 |
static struct config * | current = 0 |
static struct config ** | currentend = 0 |
static struct config * | basis = 0 |
static struct config ** | basisend = 0 |
static int | nDefine = 0 |
static char ** | azDefine = 0 |
static char * | output_filename = 0 |
static char * | output_header_filename = 0 |
static char ** | argv |
static struct s_options * | op |
static FILE * | errstream |
static char | emsg [] = "Command line syntax error: " |
static struct plink * | plink_freelist = 0 |
static int | size = 0 |
static struct s_x1 * | x1a |
static struct s_x2 * | x2a |
static struct s_x3 * | x3a |
static struct s_x4 * | x4a |
#define MAXRHS 1000 |
#define assert | ( | X | ) | if(!(X))myassert(__FILE__,__LINE__) |
Definition at line 47 of file lemon.c.
Referenced by actioncmp(), acttab_insert(), append_str(), Configlist_add(), Configlist_addbasis(), Configlist_closure(), Configlist_eat(), emit_destructor_code(), Reprint(), and resolve_conflict().
#define SetFind | ( | X, | |||
Y | ) | (X[Y]) |
#define NO_OFFSET (-2147483647) |
#define MemoryCheck | ( | X | ) |
Value:
if((X)==0){ \ extern void memory_error(); \ memory_error(); \ }
Definition at line 280 of file lemon.c.
Referenced by getstate(), State_new(), Strsafe(), and Symbol_new().
#define acttab_yylookahead | ( | X, | |||
N | ) | ((X)->aAction[N].lookahead) |
#define ERRMSGSIZE 10000 |
#define LINEWIDTH 79 |
#define PREFIXLIMIT 60 |
#define NEXT | ( | A | ) | (*(char**)(((unsigned long)A)+offset)) |
#define ISOPT | ( | X | ) | ((X)[0]=='-'||(X)[0]=='+'||strchr((X),'=')!=0) |
#define LINESIZE 1000 |
Definition at line 2895 of file lemon.c.
Referenced by ReportHeader(), ReportTable(), and tplt_xfer().
char* msort | ( | ) |
Referenced by Action_sort(), Configlist_sort(), and Configlist_sortbasis().
struct action * Action_new | ( | ) | [read] |
Definition at line 338 of file lemon.c.
References freelist, config::next, and action::next.
Referenced by Action_add().
struct action* Action_sort | ( | ) | [read] |
void myassert | ( | ) |
void FindRulePrecedences | ( | ) |
Referenced by main().
void FindFirstSets | ( | ) |
Referenced by main().
void FindStates | ( | ) |
Referenced by main().
void FindLinks | ( | ) |
Referenced by main().
void FindFollowSets | ( | ) |
Referenced by main().
void FindActions | ( | ) |
Referenced by main().
void Configlist_init | ( | ) |
Definition at line 1074 of file lemon.c.
References basis, basisend, Configtable_init(), current, and currentend.
Referenced by FindStates().
struct config* Configlist_add | ( | ) | [read] |
Referenced by Configlist_closure().
struct config* Configlist_addbasis | ( | ) | [read] |
Referenced by buildshifts().
void Configlist_closure | ( | ) |
Referenced by getstate().
void Configlist_sort | ( | ) |
Definition at line 1191 of file lemon.c.
References Configcmp(), current, currentend, and msort().
Referenced by getstate().
void Configlist_sortbasis | ( | ) |
Definition at line 1199 of file lemon.c.
References basis, basisend, Configcmp(), current, and msort().
Referenced by getstate().
struct config * Configlist_return | ( | ) | [read] |
Definition at line 1208 of file lemon.c.
References current, and currentend.
Referenced by getstate().
struct config * Configlist_basis | ( | ) | [read] |
void Configlist_eat | ( | ) |
Referenced by getstate().
void Configlist_reset | ( | ) |
Definition at line 1084 of file lemon.c.
References basis, basisend, Configtable_clear(), current, and currentend.
Referenced by buildshifts().
void ErrorMsg | ( | const char * | , | |
int | , | |||
const char * | , | |||
... | ||||
) |
Definition at line 1274 of file lemon.c.
References ERRMSGSIZE, findbreak(), LINEWIDTH, and PREFIXLIMIT.
Referenced by Configlist_closure(), FindStates(), Parse(), parseonetoken(), and ReportTable().
int OptInit | ( | ) |
Referenced by main().
char* OptArg | ( | ) |
Referenced by main().
void OptErr | ( | ) |
void OptPrint | ( | ) |
Definition at line 1870 of file lemon.c.
References s_options::label, s_options::message, op, s_options::OPT_DBL, s_options::OPT_FDBL, s_options::OPT_FFLAG, s_options::OPT_FINT, s_options::OPT_FLAG, s_options::OPT_FSTR, s_options::OPT_INT, s_options::OPT_STR, and s_options::type.
Referenced by OptInit().
void Parse | ( | ) |
Referenced by main().
struct plink * Plink_new | ( | ) | [read] |
Definition at line 2554 of file lemon.c.
References plink::next, and plink_freelist.
Referenced by Plink_add().
void Plink_add | ( | ) |
Referenced by buildshifts().
void Plink_copy | ( | ) |
Referenced by getstate().
void Plink_delete | ( | ) |
Referenced by getstate().
void Reprint | ( | ) |
Referenced by main().
void ReportOutput | ( | ) |
Referenced by main().
void ReportTable | ( | ) |
Referenced by main().
void ReportHeader | ( | ) |
Referenced by main().
void CompressTables | ( | ) |
Referenced by main().
void SetSize | ( | ) |
Referenced by main().
char * SetNew | ( | ) |
Definition at line 3931 of file lemon.c.
References memory_error().
Referenced by Configlist_add(), Configlist_addbasis(), and FindFirstSets().
void SetFree | ( | ) |
Referenced by Configlist_eat().
int SetAdd | ( | ) |
Referenced by Configlist_closure().
int SetUnion | ( | ) |
Referenced by Configlist_closure().
char* Strsafe | ( | ) |
Referenced by parseonetoken(), and Symbol_new().
void Strsafe_init | ( | ) |
Definition at line 4042 of file lemon.c.
References s_x1::count, s_x1::ht, s_x1::size, s_x1::tbl, and x1a.
Referenced by main().
int Strsafe_insert | ( | ) |
Referenced by Strsafe().
char* Strsafe_find | ( | ) |
Referenced by Strsafe().
struct symbol* Symbol_new | ( | ) | [read] |
Referenced by main(), and parseonetoken().
int Symbolcmpp | ( | const void * | void_a, | |
const void * | void_b | |||
) |
Definition at line 4172 of file lemon.c.
References symbol::index, and symbol::name.
Referenced by main().
void Symbol_init | ( | ) |
Definition at line 4206 of file lemon.c.
References s_x2::count, s_x2::ht, s_x2::size, s_x2::tbl, and x2a.
Referenced by main().
int Symbol_insert | ( | ) |
Referenced by Symbol_new().
struct symbol* Symbol_find | ( | ) | [read] |
Referenced by FindStates(), and Symbol_new().
struct symbol* Symbol_Nth | ( | ) | [read] |
int Symbol_count | ( | ) |
struct symbol ** Symbol_arrayof | ( | ) | [read] |
Definition at line 4324 of file lemon.c.
References s_x2::count, s_x2node::data, s_x2::tbl, and x2a.
Referenced by main().
int Configcmp | ( | ) |
Referenced by Configlist_sort(), Configlist_sortbasis(), Configtable_find(), and Configtable_insert().
struct state * State_new | ( | ) | [read] |
void State_init | ( | ) |
Definition at line 4412 of file lemon.c.
References s_x3::count, s_x3::ht, s_x3::size, s_x3::tbl, and x3a.
Referenced by main().
int State_insert | ( | ) |
Referenced by getstate().
struct state* State_find | ( | ) | [read] |
Referenced by getstate().
struct state ** State_arrayof | ( | ) | [read] |
Definition at line 4511 of file lemon.c.
References s_x3::count, s_x3node::data, s_x3::tbl, and x3a.
Referenced by main().
void Configtable_init | ( | ) |
Definition at line 4558 of file lemon.c.
References s_x4::count, s_x4::ht, s_x4::size, s_x4::tbl, and x4a.
Referenced by Configlist_init().
int Configtable_insert | ( | ) |
Referenced by Configlist_add(), and Configlist_addbasis().
struct config* Configtable_find | ( | ) | [read] |
Referenced by Configlist_add(), and Configlist_addbasis().
void Configtable_clear | ( | ) |
Referenced by Configlist_reset().
Definition at line 359 of file lemon.c.
References assert, action::CONFLICT, rule::index, symbol::index, action::RD_RESOLVED, action::REDUCE, action::rp, action::sp, action::type, and action::x.
Referenced by Action_sort().
Definition at line 383 of file lemon.c.
References Action_new(), action::SHIFT, and action::sp.
Referenced by buildshifts(), and FindActions().
void acttab_free | ( | acttab * | p | ) |
void acttab_action | ( | acttab * | p, | |
int | lookahead, | |||
int | action | |||
) |
Definition at line 455 of file lemon.c.
References acttab::action, acttab::aLookahead, acttab::lookahead, acttab::mnAction, acttab::mnLookahead, acttab::mxLookahead, acttab::nLookahead, and acttab::nLookaheadAlloc.
int acttab_insert | ( | acttab * | p | ) |
Definition at line 488 of file lemon.c.
References acttab::aAction, acttab::action, acttab::aLookahead, assert, acttab::lookahead, acttab::mnLookahead, acttab::mxLookahead, acttab::nAction, acttab::nActionAlloc, and acttab::nLookahead.
void FindRulePrecedences | ( | struct lemon * | xp | ) |
Definition at line 591 of file lemon.c.
References rule::next, rule::nrhs, symbol::prec, rule::precsym, and rule::rhs.
void FindFirstSets | ( | struct lemon * | lemp | ) |
PRIVATE struct state* getstate | ( | ) | [read] |
Referenced by buildshifts().
void FindStates | ( | struct lemon * | lemp | ) |
Definition at line 671 of file lemon.c.
References Configlist_init(), ErrorMsg(), rule::lhs, symbol::name, rule::next, rule::nrhs, rule::rhs, symbol::rule, and Symbol_find().
PRIVATE void buildshifts | ( | ) |
Referenced by getstate().
Definition at line 730 of file lemon.c.
References state::ap, state::bp, config::bp, config::bplp, buildshifts(), state::cfp, Configlist_basis(), Configlist_closure(), Configlist_eat(), Configlist_return(), Configlist_sort(), Configlist_sortbasis(), config::fplp, state::index, MemoryCheck, Plink_copy(), Plink_delete(), State_find(), State_insert(), State_new(), and config::stp.
Definition at line 775 of file lemon.c.
References Action_add(), state::ap, state::cfp, Configlist_addbasis(), Configlist_reset(), config::dot, getstate(), config::next, rule::nrhs, Plink_add(), rule::rhs, config::rp, and config::status.
void FindLinks | ( | struct lemon * | lemp | ) |
Definition at line 823 of file lemon.c.
References state::cfp, plink::cfp, config::next, and config::stp.
void FindFollowSets | ( | struct lemon * | lemp | ) |
static int resolve_conflict | ( | ) | [static] |
void FindActions | ( | struct lemon * | lemp | ) |
Definition at line 896 of file lemon.c.
References Action_add(), state::ap, state::cfp, config::dot, config::fws, config::next, rule::nrhs, config::rp, and SetFind.
Definition at line 980 of file lemon.c.
References assert, symbol::assoc, symbol::LEFT, symbol::NONE, symbol::prec, rule::precsym, symbol::RIGHT, action::rp, action::sp, action::type, and action::x.
PRIVATE struct config* newconfig | ( | ) | [read] |
Definition at line 1047 of file lemon.c.
References freelist, and config::next.
Referenced by Configlist_add(), and Configlist_addbasis().
PRIVATE void deleteconfig | ( | struct config * | old | ) |
Definition at line 1094 of file lemon.c.
References assert, config::bp, config::bplp, Configtable_find(), Configtable_insert(), currentend, config::dot, config::fplp, config::fws, newconfig(), config::next, config::rp, SetNew(), and config::stp.
Definition at line 1121 of file lemon.c.
References assert, basisend, config::bp, config::bplp, Configtable_find(), Configtable_insert(), currentend, config::dot, config::fplp, config::fws, newconfig(), config::next, config::rp, SetNew(), and config::stp.
void Configlist_closure | ( | struct lemon * | lemp | ) |
Definition at line 1151 of file lemon.c.
References assert, B_FALSE, Configlist_add(), current, currentend, config::dot, ErrorMsg(), symbol::firstset, config::fws, symbol::index, symbol::lambda, rule::line, symbol::name, config::next, rule::nextlhs, symbol::NONTERMINAL, rule::nrhs, rule::rhs, config::rp, symbol::rule, SetAdd(), SetUnion(), symbol::TERMINAL, and symbol::type.
void Configlist_eat | ( | struct config * | cfp | ) |
Definition at line 1227 of file lemon.c.
References assert, deleteconfig(), config::next, and SetFree().
static int findbreak | ( | char * | msg, | |
int | min, | |||
int | max | |||
) | [static] |
static void handle_D_option | ( | char * | z | ) | [static] |
static void handle_o_option | ( | char * | z | ) | [static] |
static void handle_h_option | ( | char * | z | ) | [static] |
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 1378 of file lemon.c.
References lemon::accept, lemon::arg, lemon::argv0, lemon::basisflag, CompressTables(), lemon::error, lemon::errorcnt, lemon::errsym, lemon::extracode, lemon::failure, lemon::filename, FindActions(), FindFirstSets(), FindFollowSets(), FindLinks(), FindRulePrecedences(), FindStates(), handle_D_option(), handle_h_option(), handle_o_option(), lemon::has_fallback, lemon::include, symbol::index, symbol::name, lemon::name, lemon::nconflict, lemon::nsymbol, lemon::nterminal, s_options::OPT_FLAG, s_options::OPT_FSTR, OptArg(), OptInit(), OptNArgs(), lemon::outname, lemon::overflow, Parse(), ReportHeader(), ReportOutput(), ReportTable(), Reprint(), lemon::rule, SetSize(), lemon::stacksize, lemon::start, State_arrayof(), State_init(), Strsafe_init(), Symbol_arrayof(), Symbol_count(), Symbol_init(), Symbol_new(), Symbolcmpp(), lemon::symbols, lemon::tablesize, lemon::tokendest, lemon::tokenprefix, lemon::tokentype, lemon::vardest, and lemon::vartype.
static char* merge | ( | char * | a, | |
char * | b, | |||
int (*)() | cmp, | |||
int | offset | |||
) | [static] |
char* msort | ( | char * | list, | |
char ** | next, | |||
int (*)() | cmp | |||
) |
static void errline | ( | int | n, | |
int | k, | |||
FILE * | err | |||
) | [static] |
static int argindex | ( | int | n | ) | [static] |
static int handleflags | ( | int | i, | |
FILE * | err | |||
) | [static] |
Definition at line 1691 of file lemon.c.
References s_options::arg, errline(), s_options::func, s_options::label, op, s_options::OPT_FFLAG, s_options::OPT_FLAG, s_options::OPT_FSTR, and s_options::type.
Referenced by OptInit().
static int handleswitch | ( | int | i, | |
FILE * | err | |||
) | [static] |
Definition at line 1727 of file lemon.c.
References s_options::arg, errline(), s_options::func, s_options::label, op, s_options::OPT_DBL, s_options::OPT_FDBL, s_options::OPT_FFLAG, s_options::OPT_FINT, s_options::OPT_FLAG, s_options::OPT_FSTR, s_options::OPT_INT, s_options::OPT_STR, and s_options::type.
Referenced by OptInit().
int OptInit | ( | char ** | a, | |
struct s_options * | o, | |||
FILE * | err | |||
) |
Definition at line 1814 of file lemon.c.
References handleflags(), handleswitch(), op, and OptPrint().
char* OptArg | ( | int | n | ) |
void OptErr | ( | int | n | ) |
static void parseonetoken | ( | struct pstate * | psp | ) | [static] |
Definition at line 1969 of file lemon.c.
References rule::code, ErrorMsg(), rule::index, rule::lhs, rule::lhsalias, MAXRHS, rule::next, rule::nextlhs, rule::nrhs, rule::precsym, rule::rhs, rule::rhsalias, symbol::rule, rule::ruleline, Strsafe(), and Symbol_new().
Referenced by Parse().
static void preprocess_input | ( | char * | z | ) | [static] |
void Parse | ( | struct lemon * | gp | ) |
Definition at line 2399 of file lemon.c.
References pstate::errorcnt, ErrorMsg(), pstate::filename, pstate::firstrule, pstate::gp, pstate::INITIALIZE, parseonetoken(), preprocess_input(), pstate::state, pstate::tokenlineno, and pstate::tokenstart.
void Plink_delete | ( | struct plink * | plp | ) |
PRIVATE char* file_makename | ( | struct lemon * | lemp, | |
char * | suffix | |||
) |
PRIVATE FILE* file_open | ( | struct lemon * | lemp, | |
char * | suffix, | |||
char * | mode | |||
) |
Definition at line 2643 of file lemon.c.
References file_makename().
Referenced by ReportHeader(), ReportOutput(), and ReportTable().
void Reprint | ( | struct lemon * | lemp | ) |
Definition at line 2663 of file lemon.c.
References assert, symbol::index, rule::lhs, symbol::name, rule::next, rule::nrhs, rule::precsym, and rule::rhs.
void ConfigPrint | ( | FILE * | fp, | |
struct config * | cfp | |||
) |
Definition at line 2703 of file lemon.c.
References config::dot, rule::lhs, symbol::name, rule::nrhs, rule::rhs, and config::rp.
Referenced by ReportOutput().
int PrintAction | ( | struct action * | ap, | |
FILE * | fp, | |||
int | indent | |||
) |
Definition at line 2757 of file lemon.c.
References ERROR, rule::index, state::index, symbol::name, action::rp, action::sp, action::stp, action::type, and action::x.
void ReportOutput | ( | struct lemon * | lemp | ) |
Definition at line 2786 of file lemon.c.
References config::bp, state::bp, config::bplp, state::cfp, ConfigPrint(), file_open(), config::fplp, config::fws, state::index, config::next, and action::stp.
PRIVATE char* pathsearch | ( | char * | argv0, | |
char * | name, | |||
int | modemask | |||
) |
Definition at line 2880 of file lemon.c.
References action::ACCEPT, ERROR, rule::index, state::index, action::REDUCE, action::rp, action::SHIFT, action::stp, action::type, and action::x.
Referenced by ReportTable().
PRIVATE void tplt_xfer | ( | char * | name, | |
FILE * | in, | |||
FILE * | out, | |||
int * | lineno | |||
) |
PRIVATE FILE* tplt_open | ( | struct lemon * | lemp | ) |
PRIVATE void tplt_linedir | ( | FILE * | out, | |
int | lineno, | |||
char * | filename | |||
) |
Definition at line 2972 of file lemon.c.
Referenced by emit_code(), emit_destructor_code(), and tplt_print().
PRIVATE void tplt_print | ( | FILE * | out, | |
struct lemon * | lemp, | |||
char * | str, | |||
int | strln, | |||
int * | lineno | |||
) |
Definition at line 2987 of file lemon.c.
References lemon::filename, lemon::outname, and tplt_linedir().
Referenced by ReportTable().
Definition at line 3015 of file lemon.c.
References assert, symbol::destructor, symbol::destructorln, symbol::dtnum, lemon::filename, lemon::outname, action::sp, lemon::tokendest, lemon::tokendestln, tplt_linedir(), symbol::type, lemon::vardest, and lemon::vardestln.
PRIVATE char* append_str | ( | char * | zText, | |
int | n, | |||
int | p1, | |||
int | p2 | |||
) |
Definition at line 3129 of file lemon.c.
References append_str(), rule::code, symbol::dtnum, rule::lhs, rule::lhsalias, MAXRHS, rule::nrhs, rule::rhs, rule::rhsalias, and action::rp.
Definition at line 3204 of file lemon.c.
References rule::code, lemon::filename, rule::line, lemon::outname, action::rp, and tplt_linedir().
void print_stack_union | ( | FILE * | out, | |
struct lemon * | lemp, | |||
int * | plineno, | |||
int | mhflag | |||
) |
Definition at line 3235 of file lemon.c.
References lemon::nsymbol, and lemon::vartype.
Referenced by ReportTable().
static const char* minimum_size_type | ( | int | lwr, | |
int | upr | |||
) | [static] |
static int axset_compare | ( | const void * | a, | |
const void * | b | |||
) | [static] |
void ReportTable | ( | struct lemon * | lemp, | |
int | mhflag | |||
) |
Definition at line 3384 of file lemon.c.
References state::ap, atoi(), compute_action(), ErrorMsg(), file_makename(), file_open(), state::iDflt, symbol::index, state::iNtOfst, state::iTknOfst, LINESIZE, minimum_size_type(), action::next, state::nNtAct, NO_OFFSET, state::nTknAct, print_stack_union(), action::sp, axset::stp, tplt_open(), tplt_print(), and tplt_xfer().
void ReportHeader | ( | struct lemon * | lemp | ) |
void CompressTables | ( | struct lemon * | lemp | ) |
Definition at line 3867 of file lemon.c.
References state::ap, action::next, action::rp, action::type, and action::x.
PRIVATE int strhash | ( | char * | x | ) |
Definition at line 3991 of file lemon.c.
Referenced by Strsafe_find(), Strsafe_insert(), Symbol_find(), and Symbol_insert().
char* Strsafe | ( | char * | y | ) |
Definition at line 4003 of file lemon.c.
References MemoryCheck, Strsafe_find(), and Strsafe_insert().
int Strsafe_insert | ( | char * | data | ) |
Definition at line 4062 of file lemon.c.
References s_x1::count, s_x1node::data, s_x1node::from, s_x1::ht, s_x1node::next, s_x1::size, strhash(), s_x1::tbl, and x1a.
char* Strsafe_find | ( | char * | key | ) |
Definition at line 4119 of file lemon.c.
References s_x1node::data, s_x1::ht, s_x1node::next, s_x1::size, strhash(), and x1a.
struct symbol* Symbol_new | ( | char * | x | ) | [read] |
Definition at line 4138 of file lemon.c.
References symbol::assoc, B_FALSE, symbol::datatype, symbol::destructor, symbol::fallback, symbol::firstset, symbol::lambda, MemoryCheck, symbol::name, symbol::NONTERMINAL, symbol::prec, symbol::rule, Strsafe(), Symbol_find(), Symbol_insert(), symbol::TERMINAL, symbol::type, and symbol::UNK.
int Symbol_insert | ( | struct symbol * | data, | |
char * | key | |||
) |
Definition at line 4226 of file lemon.c.
References s_x2::count, s_x2node::data, s_x2node::from, s_x2::ht, s_x2node::key, s_x2node::next, s_x2::size, strhash(), s_x2::tbl, and x2a.
struct symbol* Symbol_find | ( | char * | key | ) | [read] |
Definition at line 4286 of file lemon.c.
References s_x2node::data, s_x2::ht, s_x2node::key, s_x2node::next, s_x2::size, strhash(), and x2a.
struct symbol* Symbol_Nth | ( | int | n | ) | [read] |
Definition at line 4349 of file lemon.c.
References config::bp.
Referenced by State_find(), and State_insert().
PRIVATE int statehash | ( | struct config * | a | ) |
Definition at line 4432 of file lemon.c.
References s_x3::count, s_x3node::data, s_x3node::from, s_x3::ht, s_x3node::key, s_x3node::next, s_x3::size, statecmp(), statehash(), s_x3::tbl, and x3a.
Definition at line 4492 of file lemon.c.
References s_x3node::data, s_x3::ht, s_x3node::key, s_x3node::next, s_x3::size, statecmp(), statehash(), and x3a.
PRIVATE int confighash | ( | struct config * | a | ) |
Definition at line 4525 of file lemon.c.
Referenced by Configtable_find(), and Configtable_insert().
int Configtable_insert | ( | struct config * | data | ) |
Definition at line 4578 of file lemon.c.
References Configcmp(), confighash(), s_x4::count, s_x4node::data, s_x4node::from, s_x4::ht, s_x4node::next, s_x4::size, s_x4::tbl, and x4a.
Definition at line 4635 of file lemon.c.
References Configcmp(), confighash(), s_x4node::data, s_x4::ht, s_x4node::next, s_x4::size, and x4a.
void Configtable_clear | ( | int(*)() | f | ) |
Definition at line 4653 of file lemon.c.
References s_x4::count, s_x4node::data, s_x4::ht, s_x4::tbl, and x4a.
Definition at line 1040 of file lemon.c.
Referenced by Action_new(), deleteconfig(), and newconfig().
Definition at line 1041 of file lemon.c.
Referenced by Configlist_closure(), Configlist_init(), Configlist_reset(), Configlist_return(), Configlist_sort(), Configlist_sortbasis(), and FlintSpellingTable::merge_changes().
struct config** currentend = 0 [static] |
Definition at line 1042 of file lemon.c.
Referenced by Configlist_add(), Configlist_addbasis(), Configlist_closure(), Configlist_init(), Configlist_reset(), Configlist_return(), and Configlist_sort().
Definition at line 1043 of file lemon.c.
Referenced by Configlist_basis(), Configlist_init(), Configlist_reset(), and Configlist_sortbasis().
Definition at line 1044 of file lemon.c.
Referenced by Configlist_addbasis(), Configlist_basis(), Configlist_init(), Configlist_reset(), and Configlist_sortbasis().
char* output_filename = 0 [static] |
char* output_header_filename = 0 [static] |
Definition at line 1634 of file lemon.c.
Referenced by handleflags(), handleswitch(), OptInit(), and OptPrint().
struct plink* plink_freelist = 0 [static] |
int size = 0 [static] |
Definition at line 3921 of file lemon.c.
Referenced by Xapian::WritableDatabase::add_document(), Xapian::WritableDatabase::add_spelling(), Xapian::WritableDatabase::add_synonym(), Xapian::Database::allterms_begin(), Xapian::WritableDatabase::begin_transaction(), Xapian::WritableDatabase::cancel_transaction(), Xapian::WritableDatabase::clear_synonyms(), Xapian::WritableDatabase::commit_transaction(), DEFINE_TESTCASE(), Xapian::WritableDatabase::delete_document(), Xapian::WritableDatabase::flush(), generate_grouping_table(), generate_substring(), Xapian::Database::get_avlength(), get_input(), make_among(), Xapian::ESet::max_size(), Xapian::MSet::max_size(), Btree::mid_point(), FlintTable::mid_point(), FlintVersion::read_and_check(), Xapian::WritableDatabase::remove_spelling(), Xapian::WritableDatabase::remove_synonym(), Xapian::WritableDatabase::replace_document(), QuartzTermListTable::set_entries(), and QuartzPositionListTable::set_positionlist().
Definition at line 4039 of file lemon.c.
Referenced by Strsafe_find(), Strsafe_init(), and Strsafe_insert().
Definition at line 4203 of file lemon.c.
Referenced by Symbol_arrayof(), Symbol_count(), Symbol_find(), Symbol_init(), Symbol_insert(), and Symbol_Nth().
Definition at line 4409 of file lemon.c.
Referenced by State_arrayof(), State_find(), State_init(), and State_insert().
Definition at line 4555 of file lemon.c.
Referenced by Configtable_clear(), Configtable_find(), Configtable_init(), and Configtable_insert().