coan 4.2.4
|
![]() |
Modules | |
Macro-generated code. | |
Files | |
file | chew.c |
file | chew.h |
Typedefs | |
typedef enum comment_state | comment_state_t |
Enumerations | |
enum | comment_state { NO_COMMENT = false, C_COMMENT, CXX_COMMENT, STARTING_COMMENT, FINISHING_COMMENT, PSEUDO_COMMENT } |
enum | line_state_t { LS_NEUTER, LS_DIRECTIVE, LS_CODE } |
Functions | |
unsigned | eol (char const *cp) |
char const * | chew_on (char const *cp) |
char const * | chew_symbol (char const *cp) |
char const * | chew_continuation (char const *cp) |
char const * | chew_macro_call (char const *cp) |
char const * | chew_header_name (char const *cp) |
char const * | chew_string (char const *cp) |
char const * | chew_unbroken_string (char const *cp) |
void | chew_toplevel (void) |
typedef enum comment_state comment_state_t |
Enumeration of comment states
enum comment_state |
Enumeration of comment states
enum line_state_t |
char const* chew_continuation | ( | char const * | cp | ) |
Consume line-continuations at the input text pointer.
cp | The current text pointer |
The line buffer is extended with each continuation by appending the next physical line of input.
Definition at line 134 of file chew.c.
References eol(), and read_more().
Referenced by canonical_string_init_by_test(), canonical_string_parse_next_part(), char_escape_val(), chew_header_name(), chew_macro_call(), chew_string(), chew_symbol(), decode_utf8(), eval_character_constant(), eval_numeral(), eval_numeral_helper(), eval_numerical_character_constant(), eval_unary(), match_op(), and text_match().
char const* chew_header_name | ( | char const * | cp | ) |
Consume a header file name in source text until a delimiter or end of line is found.
cp | The current text pointer addressing a header file name. |
Definition at line 235 of file chew.c.
References chew_continuation(), and is_symbol_inner_char().
Referenced by eval_hash_include().
char const* chew_macro_call | ( | char const * | cp | ) |
Consume a preprocessor macro invocation.
cp | The current text pointer addressing a macro invocation. |
The function does not insist that cp initially addresses an identifier. It may also address '(' and in that case the function will consume an argument list until it passes a balancing ')' or reaches a character that cannot belong to an argument list.
Definition at line 201 of file chew.c.
References chew_continuation(), chew_macro_call(), chew_on(), chew_string(), and chew_symbol().
Referenced by chew_macro_call(), and eval_possible_symbol().
char const* chew_on | ( | char const * | cp | ) |
Consume whitespace, comments, quotation or the text of a free-form directive (hash-error,hash-pragma) in the source text and stop at the first character beyond all these.
cp | The current text pointer |
The function replenishes the line buffer and copes with line-continuations. It maintains state with respect to all syntactically significant categories of context.
Definition at line 277 of file chew.c.
References C_COMMENT, CXX_COMMENT, eol(), FINISHING_COMMENT, GET_PUBLIC, GET_STATE, GRIPE_NEWLINE_IN_QUOTE, GRIPE_STRAY_ESCAPE, GRIPE_UNCLOSED_QUOTE, LS_CODE, LS_NEUTER, NO_COMMENT, parse_error(), read_more(), report(), SET_PUBLIC, SET_STATE, and STARTING_COMMENT.
Referenced by canonical_string_init(), canonical_string_parse_next_part(), chew_macro_call(), chew_string(), chew_unbroken_string(), eval_hash_define(), eval_hash_include(), eval_hash_undef(), eval_if(), eval_line(), eval_table(), eval_unary(), short_circuit_and(), and short_circuit_or().
char const* chew_string | ( | char const * | cp | ) |
Consume a string until whitespace, comments or quotation are encountered, or a quoted string until it is closed.
cp | The current text pointer |
If *cp == '"' on entry a quoted string is recognised and consumed until closed.
The function consumes line-continuations.
Definition at line 155 of file chew.c.
References chew_continuation(), chew_on(), eol(), GET_PUBLIC, GRIPE_UNCLOSED_QUOTE, read_offset(), read_pos(), and report().
Referenced by chew_macro_call(), eval_hash_define(), and eval_hash_include().
char const* chew_symbol | ( | char const * | cp | ) |
Consume an identifier in the source text and stop at the next character.
cp | The current text pointer |
Definition at line 146 of file chew.c.
References chew_continuation(), is_symbol_inner_char(), and is_symbol_start_char().
Referenced by chew_macro_call(), and symbol_evaluate_status().
void chew_toplevel | ( | void | ) |
Reinitialise the line state and comment state
Definition at line 519 of file chew.c.
References LS_NEUTER, NO_COMMENT, SET_PUBLIC, and SET_STATE.
Referenced by node_proc().
char const* chew_unbroken_string | ( | char const * | cp | ) |
The function behaves like chew_string(), but stops if a line-continuation is encountered.
Definition at line 178 of file chew.c.
References chew_on(), eol(), GET_PUBLIC, GRIPE_UNCLOSED_QUOTE, is_line_continuation(), read_offset(), read_pos(), and report().
Referenced by canonical_string_parse_next_part().
unsigned eol | ( | char const * | cp | ) |
Say whether a char *
address a line end, either Unix type or Windows type.
cp | Text Pointer |
Definition at line 264 of file chew.c.
Referenced by chew_continuation(), chew_on(), chew_string(), chew_unbroken_string(), is_line_continuation(), and line_len().