Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

parser.c File Reference

Go to the source code of this file.

Defines

#define set_state(s)   do { tmp = p->state; p->state = s; p->prev_state = tmp; } while(0)
#define fetch_next_char()

Enumerations

enum  {
  S_START, S_IN_DOUBLE_QUOTE, S_IN_SINGLE_QUOTE, S_HTML,
  S_WAIT_PERC, S_START_CODE, S_CODE, S_WAIT_GT,
  S_EAT_NEWLINE
}
enum  { LF = 0xA, CR = 0xD }

Functions

int parser_run (parser_t *p)
void parser_set_cb_code (parser_t *p, parser_cb_code_t cb)
void parser_set_cb_html (parser_t *p, parser_cb_html_t cb)
void parser_set_cb_arg (parser_t *p, void *opaque)
void parser_set_io (parser_t *p, io_t *in, io_t *out)
int parser_free (parser_t *t)
int parser_reset (parser_t *p)
int parser_create (parser_t **pt)


Define Documentation

 
#define fetch_next_char  ) 
 

Value:

do { prev = c;                                                  \
            dbg_err_if((rc = io_getc(p->in, &c)) < 0);                  \
            if(rc == 0) break;                                          \
            if( (c == CR || c == LF) && prev != (c == CR ? LF : CR))    \
                p->line++;                                              \
        } while(0)

Referenced by parser_run().

#define set_state  )     do { tmp = p->state; p->state = s; p->prev_state = tmp; } while(0)
 

Referenced by parser_run().


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
LF 
CR 

Definition at line 32 of file parser.c.

anonymous enum
 

Enumeration values:
S_START 
S_IN_DOUBLE_QUOTE 
S_IN_SINGLE_QUOTE 
S_HTML 
S_WAIT_PERC 
S_START_CODE 
S_CODE 
S_WAIT_GT 
S_EAT_NEWLINE 

Definition at line 20 of file parser.c.


Function Documentation

int parser_create parser_t **  pt  ) 
 

Definition at line 245 of file parser.c.

References parser_free(), parser_reset(), and parser_t.

Referenced by translate_script_to_c().

int parser_free parser_t t  ) 
 

Definition at line 228 of file parser.c.

References parser_t.

Referenced by parser_create(), and translate_script_to_c().

int parser_reset parser_t p  ) 
 

Definition at line 234 of file parser.c.

References parser_s::cmd_code, parser_s::line, parser_t, parser_s::prev_state, and parser_s::state.

Referenced by parser_create().

int parser_run parser_t p  ) 
 

Definition at line 73 of file parser.c.

References parser_s::cmd_code, parser_s::code_line, CR, fetch_next_char, parser_s::line, parser_t, parser_s::prev_state, S_CODE, S_EAT_NEWLINE, S_HTML, S_IN_DOUBLE_QUOTE, S_IN_SINGLE_QUOTE, S_START, S_START_CODE, S_WAIT_GT, S_WAIT_PERC, set_state, and parser_s::state.

Referenced by translate_script_to_c().

void parser_set_cb_arg parser_t p,
void *  opaque
 

Definition at line 215 of file parser.c.

References parser_s::cb_arg, and parser_t.

Referenced by translate_script_to_c().

void parser_set_cb_code parser_t p,
parser_cb_code_t  cb
 

Definition at line 203 of file parser.c.

References parser_s::cb_code, and parser_t.

Referenced by translate_script_to_c().

void parser_set_cb_html parser_t p,
parser_cb_html_t  cb
 

Definition at line 209 of file parser.c.

References parser_s::cb_html, and parser_t.

Referenced by translate_script_to_c().

void parser_set_io parser_t p,
io_t in,
io_t out
 

Definition at line 221 of file parser.c.

References parser_s::in, io_t, parser_s::out, and parser_t.

Referenced by translate_script_to_c().


←Products
© 2005-2006 - KoanLogic S.r.l. - All rights reserved