CtplParser

CtplParser — Token tree parser

Synopsis

#include <ctpl/ctpl.h>

#define             CTPL_PARSER_ERROR
enum                CtplParserError;
gboolean            ctpl_parser_parse                   (const CtplToken *tree,
                                                         CtplEnviron *env,
                                                         CtplOutputStream *output,
                                                         GError **error);

Description

Parses a CtplToken tree against a CtplEnviron.

To parse a token tree, use ctpl_parser_parse().

Details

CTPL_PARSER_ERROR

#define CTPL_PARSER_ERROR  (ctpl_parser_error_quark ())

Error domain of CtplParser.


enum CtplParserError

typedef enum _CtplParserError
{
  CTPL_PARSER_ERROR_INCOMPATIBLE_SYMBOL,
  CTPL_PARSER_ERROR_SYMBOL_NOT_FOUND,
  CTPL_PARSER_ERROR_FAILED
} CtplParserError;

Error codes that parsing functions can throw, from the CTPL_PARSER_ERROR domain.

CTPL_PARSER_ERROR_INCOMPATIBLE_SYMBOL

A symbol is incompatible with is usage.

CTPL_PARSER_ERROR_SYMBOL_NOT_FOUND

A symbol cannot be found in the environment.

CTPL_PARSER_ERROR_FAILED

An error occurred without any precision on what failed.

ctpl_parser_parse ()

gboolean            ctpl_parser_parse                   (const CtplToken *tree,
                                                         CtplEnviron *env,
                                                         CtplOutputStream *output,
                                                         GError **error);

Parses a token tree against an environment and outputs the result to output.

tree :

A CtplToken from which start parsing

env :

A CtplEnviron representing the parsing environment

output :

A CtplInputStream in which write parsing output

error :

Location where return a GError or NULL to ignore errors

Returns :

TRUE on success, FALSE otherwise, in which case error shall be set to the error that occurred.