ecoli_node_re_lex - Man Page

Name

ecoli_node_re_lex — Regex lexer node

— A lexer node using regular expressions for tokenization.  

Synopsis

Functions

struct ec_node * ec_node_re_lex (const char *id, struct ec_node *child)
int ec_node_re_lex_add (struct ec_node *gen_node, const char *pattern, int keep, const char *attr_name)

Detailed Description

A lexer node using regular expressions for tokenization.

Configuration Schema

schema re_lex {
    list patterns  {
        description "The list of patterns elements.";

        dict  {
            description "A pattern element.";

            string pattern  {
                description "The pattern to match.";
            }
            bool keep  {
                description "Whether to keep or drop the string matching the regular expression.";
            }
            string attr  {
                description "The optional attribute name to attach.";
            }
        }
    }
    node child  {
        description "The child node.";
    }
}

Function Documentation

struct ec_node * ec_node_re_lex (const char * id, struct ec_node * child)

Create a regex-based lexer node.

This node tokenizes the input using regular expressions added with ec_node_re_lex_add() and passes the resulting tokens to the child node.

Parameters

id The node identifier.
child The child node. It is consumed and will be freed when the parent is freed, or immediately on error.

Returns

The node, or NULL on error (errno is set).

int ec_node_re_lex_add (struct ec_node * gen_node, const char * pattern, int keep, const char * attr_name)

Add a token pattern to a regex lexer node.

Parameters

gen_node The regex lexer node.
pattern The regular expression pattern for matching tokens.
keep If non-zero, include matched tokens in the output; if zero, discard them.
attr_name Optional attribute name to attach to matched tokens, or NULL.

Returns

0 on success, -1 on error (errno is set).

Author

Generated automatically by Doxygen for Libecoli from the source code.

Referenced By

The man pages ec_node_re_lex(3) and ec_node_re_lex_add(3) are aliases of ecoli_node_re_lex(3).

Version 0.11.3 Libecoli