coan 4.2.4
The Chew component interface.
Collaboration diagram for The Chew component interface.:

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 Documentation

Enumeration of comment states


Enumeration Type Documentation

Enumeration of comment states

Enumerator:
NO_COMMENT 

Outside a comment

C_COMMENT 

In a C-style comment

CXX_COMMENT 

In a C++-style comment, i.e. // and end of line

STARTING_COMMENT 

Just after forward-slash + back-slash + newline

FINISHING_COMMENT 

Just after star + back-slash + newline in a C comment

PSEUDO_COMMENT 

In the text of a hash-error directive or the definiens of a hash-define

Definition at line 58 of file chew.h.

Enumeration of states of a source line

Enumerator:
LS_NEUTER 

Only whitespace and comments so far on the line

LS_DIRECTIVE 

Only whitespace, comments, and a hash- so far on the line

LS_CODE 

Source code found on the line (text other than whitespace, comments, or a #-directive)

Definition at line 74 of file chew.h.


Function Documentation

char const* chew_continuation ( char const *  cp)

Consume line-continuations at the input text pointer.

Parameters:
cpThe current text pointer
Returns:
Pointer to the next character of input following any sequence of 1 or more line-continuations, i.e. "\\n". If there is no such sequence cp is returned unchanged.

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().

Here is the call graph for this function:

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.

Parameters:
cpThe current text pointer addressing a header file name.
Returns:
A pointer to the next input character that cannot be part of the header file name, or NUL at end of line.

Definition at line 235 of file chew.c.

References chew_continuation(), and is_symbol_inner_char().

Referenced by eval_hash_include().

Here is the call graph for this function:

char const* chew_macro_call ( char const *  cp)

Consume a preprocessor macro invocation.

Parameters:
cpThe current text pointer addressing a macro invocation.
Returns:
A pointer to the next input character that cannot be part of a macro invocation, or NUL at end of line.

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().

Here is the call graph for this function:

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.

Parameters:
cpThe current text pointer
Returns:
A pointer to the next input character that is not to be chewed.

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().

Here is the call graph for this function:

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.

Parameters:
cpThe current text pointer
Returns:
A pointer to the character just passed the consumed string.

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().

Here is the call graph for this function:

char const* chew_symbol ( char const *  cp)

Consume an identifier in the source text and stop at the next character.

Parameters:
cpThe current text pointer
Returns:
A pointer to the next input character that cannot be part of an identifier.

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

unsigned eol ( char const *  cp)

Say whether a char * address a line end, either Unix type or Windows type.

Parameters:
cpText Pointer
Returns:
0 if cp does not address a newline sequence, otherwise the length of the newline sequence, i,e, 1 for Unix '
', 2 for Windows "\r\n"

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().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines