languages/compiler/analyser.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "header.h"

Include dependency graph for analyser.c:

Go to the source code of this file.

Functions

static void read_program_ (struct analyser *a, int terminator)
static struct noderead_C (struct analyser *a)
static struct nodeC_style (struct analyser *a, char *s, int token)
static void fault (int n)
static void print_node_ (struct node *p, int n, char *s)
void print_program (struct analyser *a)
static struct nodenew_node (struct analyser *a, int type)
static char * name_of_mode (int n)
static char * name_of_type (int n)
static void count_error (struct analyser *a)
static void error2 (struct analyser *a, int n, int x)
static void error (struct analyser *a, int n)
static void error3 (struct analyser *a, struct node *p, symbol *b)
static void error4 (struct analyser *a, struct name *q)
static void omission_error (struct analyser *a, int n)
static int check_token (struct analyser *a, int code)
static int get_token (struct analyser *a, int code)
static struct namelook_for_name (struct analyser *a)
static struct namefind_name (struct analyser *a)
static void check_routine_mode (struct analyser *a, struct name *p, int mode)
static void check_name_type (struct analyser *a, struct name *p, int type)
static void read_names (struct analyser *a, int type)
static symbolnew_literalstring (struct analyser *a)
static int read_AE_test (struct analyser *a)
static int binding (int t)
static void name_to_node (struct analyser *a, struct node *p, int type)
static struct noderead_AE (struct analyser *a, int B)
static struct noderead_C_connection (struct analyser *a, struct node *q, int op)
static struct noderead_C_list (struct analyser *a)
static struct noderead_literalstring (struct analyser *a)
static void reverse_b (symbol *b)
static int compare_amongvec (const void *pv, const void *qv)
static void make_among (struct analyser *a, struct node *p, struct node *substring)
static struct noderead_among (struct analyser *a)
static struct noderead_substring (struct analyser *a)
static void check_modifyable (struct analyser *a)
static int next_symbol (symbol *p, symbol *W, int utf8)
static symbolalter_grouping (symbol *p, symbol *q, int style, int utf8)
static void read_define_grouping (struct analyser *a, struct name *q)
static void read_define_routine (struct analyser *a, struct name *q)
static void read_define (struct analyser *a)
static void read_backwardmode (struct analyser *a)
void read_program (struct analyser *a)
analysercreate_analyser (struct tokeniser *t)
void close_analyser (struct analyser *a)


Function Documentation

static void read_program_ ( struct analyser a,
int  terminator 
) [static]

Definition at line 834 of file analyser.c.

References c_backwardmode, c_booleans, c_define, c_externals, c_groupings, c_integers, c_ket, c_routines, c_strings, error(), omission_error(), read_backwardmode(), read_define(), read_names(), read_token(), repeat, t_boolean, t_external, t_grouping, t_integer, t_routine, t_string, analyser::tokeniser, and unless.

Referenced by read_backwardmode(), and read_program().

static struct node * read_C ( struct analyser a  )  [static, read]

Definition at line 565 of file analyser.c.

References node::AE, c_among, c_assign, c_assignto, c_atleast, c_atlimit, c_atmark, c_attach, c_backwards, c_booltest, c_bra, c_call, c_debug, c_delete, c_do, c_dollar, c_fail, c_false, c_gopast, c_goto, c_grouping, c_hop, c_insert, c_leftslice, c_literalstring, c_loop, c_minus, c_name, c_next, c_non, c_not, c_repeat, c_reverse, c_rightslice, c_set, c_setlimit, c_setmark, c_slicefrom, c_sliceto, C_style(), c_substring, c_test, c_tolimit, c_tomark, c_true, c_try, c_unset, check_modifyable(), check_routine_mode(), check_token(), error(), find_name(), get_token(), node::left, m_backward, m_forward, name::mode, node::mode, node::name, name_to_node(), new_node(), omission_error(), read_AE(), read_AE_test(), read_among(), read_C_list(), read_literalstring(), read_substring(), read_token(), t_boolean, t_external, t_grouping, t_integer, t_routine, t_string, tokeniser::token, analyser::tokeniser, node::type, name::type, unless, and name::used.

Referenced by C_style(), read_C_connection(), read_C_list(), and read_define_routine().

static struct node * C_style ( struct analyser a,
char *  s,
int  token 
) [static, read]

Definition at line 378 of file analyser.c.

References node::AE, node::aux, c_for, c_literalstring, c_name, error(), get_token(), node::left, node::literalstring, name_to_node(), new_literalstring(), new_node(), read_AE(), read_C(), read_token(), and analyser::tokeniser.

Referenced by read_AE(), and read_C().

static void fault ( int  n  )  [static]

Definition at line 14 of file analyser.c.

Referenced by name_of_mode(), and name_of_type().

static void print_node_ ( struct node p,
int  n,
char *  s 
) [static]

Definition at line 16 of file analyser.c.

References node::AE, node::aux, name::b, node::left, node::literalstring, node::name, name_of_token(), report_b(), node::right, node::type, and unless.

Referenced by print_program().

void print_program ( struct analyser a  ) 

Definition at line 34 of file analyser.c.

References print_node_(), and analyser::program.

Referenced by main().

static struct node* new_node ( struct analyser a,
int  type 
) [static, read]

Definition at line 38 of file analyser.c.

References node::AE, node::aux, node::left, tokeniser::line_number, analyser::mode, name::mode, node::name, NEW, analyser::nodes, node::right, and analyser::tokeniser.

Referenced by C_style(), read_AE(), read_among(), read_C(), read_C_connection(), read_C_list(), read_define_routine(), read_literalstring(), and read_substring().

static char* name_of_mode ( int  n  )  [static]

Definition at line 53 of file analyser.c.

References fault(), m_backward, and m_forward.

Referenced by error2().

static char* name_of_type ( int  n  )  [static]

Definition at line 62 of file analyser.c.

References fault().

Referenced by error2().

static void count_error ( struct analyser a  )  [static]

Definition at line 73 of file analyser.c.

References tokeniser::error_count, and analyser::tokeniser.

Referenced by error2(), error3(), and error4().

static void error2 ( struct analyser a,
int  n,
int  x 
) [static]

Definition at line 79 of file analyser.c.

References tokeniser::b, c_name, c_number, count_error(), tokeniser::get_depth, tokeniser::line_number, analyser::mode, name_of_mode(), name_of_token(), name_of_type(), tokeniser::number, tokeniser::omission, tokeniser::previous_token, report_b(), tokeniser::token, and analyser::tokeniser.

Referenced by check_name_type(), check_routine_mode(), error(), read_chars(), read_define_routine(), read_literal_string(), read_substring(), and read_token().

static void error ( struct analyser a,
int  n 
) [static]

Definition at line 143 of file analyser.c.

References error2().

Referenced by C_style(), check_modifyable(), error1(), error2(), find_name(), Xapian::Error::get_error_string(), main(), next_token(), omission_error(), Xapian::ErrorHandler::operator()(), read_AE(), read_AE_test(), read_among(), read_C(), read_define_grouping(), read_define_routine(), read_literal_string(), read_names(), read_program_(), and read_token().

static void error3 ( struct analyser a,
struct node p,
symbol b 
) [static]

Definition at line 145 of file analyser.c.

References tokeniser::b, count_error(), tokeniser::p, and report_b().

static void error4 ( struct analyser a,
struct name q 
) [static]

Definition at line 152 of file analyser.c.

References name::b, count_error(), and report_b().

Referenced by read_program().

static void omission_error ( struct analyser a,
int  n 
) [static]

Definition at line 158 of file analyser.c.

References error(), tokeniser::omission, and analyser::tokeniser.

Referenced by check_token(), read_C(), read_C_list(), and read_program_().

static int check_token ( struct analyser a,
int  code 
) [static]

Definition at line 163 of file analyser.c.

References omission_error(), tokeniser::token, and analyser::tokeniser.

Referenced by get_token(), read_backwardmode(), read_C(), and read_names().

static int get_token ( struct analyser a,
int  code 
) [static]

Definition at line 169 of file analyser.c.

References check_token(), read_token(), tokeniser::token_held, analyser::tokeniser, and unless.

Referenced by C_style(), read_AE(), read_among(), read_backwardmode(), read_C(), read_define(), read_define_routine(), and read_names().

static struct name* look_for_name ( struct analyser a  )  [static, read]

Definition at line 179 of file analyser.c.

References name::b, tokeniser::b, analyser::names, name::next, name::referenced, repeat, SIZE, and analyser::tokeniser.

Referenced by find_name(), and read_names().

static struct name* find_name ( struct analyser a  )  [static, read]

Definition at line 195 of file analyser.c.

References error(), and look_for_name().

Referenced by name_to_node(), read_C(), read_define(), and read_define_grouping().

static void check_routine_mode ( struct analyser a,
struct name p,
int  mode 
) [static]

Definition at line 201 of file analyser.c.

References error2(), name::mode, and unless.

Referenced by make_among(), and read_C().

static void check_name_type ( struct analyser a,
struct name p,
int  type 
) [static]

Definition at line 206 of file analyser.c.

References error2(), t_boolean, t_external, t_grouping, t_integer, t_routine, t_string, and name::type.

Referenced by name_to_node(), read_define_grouping(), and read_define_routine().

static void read_names ( struct analyser a,
int  type 
) [static]

Definition at line 219 of file analyser.c.

References tokeniser::b, c_bra, c_ket, c_name, check_token(), copy_b(), error(), get_token(), look_for_name(), analyser::name_count, analyser::names, NEW, tokeniser::p, read_token(), repeat, tokeniser::token_held, analyser::tokeniser, symbol::type, and unless.

Referenced by read_program_().

static symbol* new_literalstring ( struct analyser a  )  [static]

Definition at line 243 of file analyser.c.

References tokeniser::b, copy_b(), analyser::literalstrings, NEW, tokeniser::p, and analyser::tokeniser.

Referenced by C_style(), and read_literalstring().

static int read_AE_test ( struct analyser a  )  [static]

Definition at line 251 of file analyser.c.

References c_assign, c_divideassign, c_eq, c_ge, c_gr, c_le, c_ls, c_mathassign, c_minusassign, c_multiplyassign, c_ne, c_plusassign, error(), read_token(), tokeniser::token, tokeniser::token_held, and analyser::tokeniser.

Referenced by read_C().

static int binding ( int  t  )  [static]

Definition at line 270 of file analyser.c.

References c_divide, c_minus, c_multiply, and c_plus.

Referenced by read_AE().

static void name_to_node ( struct analyser a,
struct node p,
int  type 
) [static]

Definition at line 278 of file analyser.c.

References check_name_type(), find_name(), node::name, unless, and name::used.

Referenced by C_style(), read_AE(), read_among(), and read_C().

static struct node* read_AE ( struct analyser a,
int  B 
) [static, read]

Definition at line 287 of file analyser.c.

References binding(), c_bra, c_cursor, c_ket, c_limit, c_maxint, c_minint, c_minus, c_name, c_neg, c_number, c_size, c_sizeof, C_style(), error(), get_token(), node::left, name_to_node(), new_node(), tokeniser::number, node::number, read_token(), repeat, node::right, tokeniser::token, tokeniser::token_held, analyser::tokeniser, and unless.

Referenced by C_style(), and read_C().

static struct node* read_C_connection ( struct analyser a,
struct node q,
int  op 
) [static, read]

Definition at line 337 of file analyser.c.

References node::left, new_node(), read_C(), read_token(), repeat, node::right, tokeniser::token_held, and analyser::tokeniser.

Referenced by read_C_list().

static struct node* read_C_list ( struct analyser a  )  [static, read]

Definition at line 353 of file analyser.c.

References c_and, c_bra, c_ket, c_or, node::left, new_node(), omission_error(), read_C(), read_C_connection(), read_token(), repeat, node::right, tokeniser::token_held, and analyser::tokeniser.

Referenced by read_among(), and read_C().

static struct node* read_literalstring ( struct analyser a  )  [static, read]

Definition at line 407 of file analyser.c.

References c_literalstring, node::literalstring, new_literalstring(), and new_node().

Referenced by read_among(), and read_C().

static void reverse_b ( symbol b  )  [static]

Definition at line 413 of file analyser.c.

References SIZE, and until.

Referenced by make_among().

static int compare_amongvec ( const void *  pv,
const void *  qv 
) [static]

Definition at line 421 of file analyser.c.

References amongvec::b, amongvec::i, amongvec::p, and amongvec::size.

Referenced by make_among().

static void make_among ( struct analyser a,
struct node p,
struct node substring 
) [static]

Definition at line 433 of file analyser.c.

References analyser::among_count, analyser::amongs, analyser::amongs_end, amongvec::b, among::b, c_bra, c_literalstring, check_routine_mode(), compare_amongvec(), amongvec::function, amongvec::i, node::left, node::literalstring, m_backward, node::mode, node::name, NEW, NEWVEC, among::next, node::number, amongvec::p, amongvec::result, reverse_b(), node::right, name::routine_called_from_among, size, SIZE, amongvec::size, node::type, unless, until, and w().

Referenced by read_among().

static struct node* read_among ( struct analyser a  )  [static, read]

Definition at line 514 of file analyser.c.

References c_among, c_bra, c_ket, c_literalstring, c_name, error(), tokeniser::error_count, get_token(), node::left, make_among(), name_to_node(), new_node(), node::number, read_C_list(), read_literalstring(), read_token(), repeat, node::right, analyser::substring, tokeniser::token_held, analyser::tokeniser, and unless.

Referenced by read_C().

static struct node* read_substring ( struct analyser a  )  [static, read]

Definition at line 553 of file analyser.c.

References c_substring, error2(), node::line_number, new_node(), and analyser::substring.

Referenced by read_C().

static void check_modifyable ( struct analyser a  )  [static]

Definition at line 561 of file analyser.c.

References error(), analyser::modifyable, and unless.

Referenced by read_C().

static int next_symbol ( symbol p,
symbol W,
int  utf8 
) [static]

Definition at line 705 of file analyser.c.

References get_utf8().

Referenced by alter_grouping().

static symbol* alter_grouping ( symbol p,
symbol q,
int  style,
int  utf8 
) [static]

Definition at line 715 of file analyser.c.

References add_to_b(), c_plus, next_symbol(), and SIZE.

Referenced by read_define_grouping().

static void read_define_grouping ( struct analyser a,
struct name q 
) [static]

Definition at line 741 of file analyser.c.

References alter_grouping(), tokeniser::b, grouping::b, c_literalstring, c_minus, c_name, c_plus, check_name_type(), name::count, create_b(), error(), find_name(), name::grouping, analyser::groupings, analyser::groupings_end, symbol::name, NEW, grouping::next, tokeniser::p, read_token(), repeat, SIZE, tokeniser::token, tokeniser::token_held, analyser::tokeniser, unless, and analyser::utf8.

Referenced by read_define().

static void read_define_routine ( struct analyser a,
struct name q 
) [static]

Definition at line 792 of file analyser.c.

References node::amongvar_needed, analyser::amongvar_needed, c_as, c_define, check_name_type(), name::definition, error(), error2(), get_token(), node::left, node::line_number, analyser::mode, name::mode, node::name, new_node(), analyser::program, analyser::program_end, read_C(), node::right, analyser::substring, and unless.

Referenced by read_define().

static void read_define ( struct analyser a  )  [static]

Definition at line 815 of file analyser.c.

References c_name, find_name(), get_token(), read_define_grouping(), read_define_routine(), t_grouping, name::type, and unless.

Referenced by read_program_().

static void read_backwardmode ( struct analyser a  )  [static]

Definition at line 824 of file analyser.c.

References c_bra, c_ket, check_token(), get_token(), m_backward, analyser::mode, name::mode, and read_program_().

Referenced by read_program_().

void read_program ( struct analyser a  ) 

Definition at line 857 of file analyser.c.

References name::b, name::definition, error4(), tokeniser::error_count, name::grouping, analyser::names, name::next, read_program_(), name::referenced, report_b(), t_external, t_grouping, t_routine, analyser::tokeniser, name::type, unless, until, and name::used.

Referenced by main().

struct analyser* create_analyser ( struct tokeniser t  )  [read]

Definition at line 904 of file analyser.c.

References m_forward, NEW, and t_size.

Referenced by main().

void close_analyser ( struct analyser a  ) 

Definition at line 921 of file analyser.c.

References analyser::amongs, name::b, literalstring::b, among::b, grouping::b, FREE, analyser::groupings, analyser::literalstrings, lose_b(), analyser::names, node::next, name::next, literalstring::next, among::next, grouping::next, analyser::nodes, and until.

Referenced by main().


Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.