yyast/leaf.h File Reference

#include <yyast/types.h>
#include <yyast/utils.h>

Go to the source code of this file.

Defines

#define YA_LEAF(name)   ya_leaf(name)
 Leaf node, does not contain data or children.
#define YA_NULL   ya_null()
 Null node, unused child entry.

Functions

ya_t ya_literal (const char *restrict name, ya_type_t type, const void *restrict buf, size_t buf_size)
 Create an literal node.
ya_t ya_binary_float (const char *restrict name, const char *restrict buf, size_t buf_size, int base, int nr_bits)
 Create literal node from floating point literal string.
ya_t ya_integer (const char *restrict name, ya_type_t type, const char *restrict buf, size_t buf_size, int base)
 Create literal from an integer literal string.
ya_t ya_positive_integer (const char *restrict name, const char *restrict buf, size_t buf_size, int base)
 Create literal from an positive integer literal string.
ya_t ya_negative_integer (const char *restrict name, const char *restrict buf, size_t buf_size, int base)
 Create literal from an negative integer literal string.
ya_t ya_text (const char *restrict name, const char *restrict buf, size_t buf_size)
 Create text literal node for a string literal.
ya_t ya_leaf (const char *restrict name)
 Leaf node, does not contain data or children.
ya_t ya_null (void)
 Null node, unused child entry.


Define Documentation

#define YA_LEAF ( name   )     ya_leaf(name)

Leaf node, does not contain data or children.

Definition at line 118 of file leaf.h.

#define YA_NULL   ya_null()

Null node, unused child entry.

Definition at line 126 of file leaf.h.


Function Documentation

ya_t ya_binary_float ( const char *restrict  name,
const char *restrict  buf,
size_t  buf_size,
int  base,
int  nr_bits 
)

Create literal node from floating point literal string.

Parameters:
name name of the node.
buf Literal as string.
buf_size String size.
base 
nr_bits Nr of bits in the floating point format, only 64 bits is supported.
Returns:
The decoded literal node.

ya_t ya_integer ( const char *restrict  name,
ya_type_t  type,
const char *restrict  buf,
size_t  buf_size,
int  base 
)

Create literal from an integer literal string.

The RFC 4648 is used as a guide for encoding integers.

  • Base 0, has no alphabet, it always yields zero.
  • Base 1-31 and 33-36, These bases are encoded following an extended Base-16
  • Base 32, Base-32 is encoding
  • Base 37-64 These bases are encoded following Base-64

Parameters:
name name of the node.
type type of node, should be either YA_NODE_TYPE_POSITIVE_INTEGER or YA_NODE_TYPE_NEGATIVE_INTEGER.
buf Literal as string.
buf_size String size.
base The base of the literal. 0-64
Returns:
The decoded literal.

Definition at line 97 of file leaf.c.

References ya_error(), and ya_literal().

Referenced by ya_negative_integer(), and ya_positive_integer().

ya_t ya_leaf ( const char *restrict  name  ) 

Leaf node, does not contain data or children.

Definition at line 162 of file leaf.c.

References ya_literal(), and YA_NODE_TYPE_LEAF.

ya_t ya_literal ( const char *restrict  name,
ya_type_t  type,
const void *restrict  buf,
size_t  buf_size 
)

Create an literal node.

Parameters:
name name of the node.
type type of leaf node.
buf The memory which needs to be copied.
buf_size The amount of memory to be copied.

Definition at line 42 of file leaf.c.

References ya_position_s::column, ya_node_s::data, ya_position_s::file, ya_position_s::line, ya_node_s::name, ya_t::node, ya_t::position, ya_node_s::position, ya_node_s::size, ya_t::size, ya_t::type, ya_node_s::type, and ya_previous_position.

Referenced by ya_binary_float(), ya_integer(), ya_leaf(), ya_null(), and ya_text().

ya_t ya_negative_integer ( const char *restrict  name,
const char *restrict  buf,
size_t  buf_size,
int  base 
)

Create literal from an negative integer literal string.

The RFC 4648 is used as a guide for encoding integers. The integer literal should be passed without the base prefix (0x) or suffix (h). The integer literal should be passed without the negative sign (-).

  • Base 0, has no alphabet, it always yields zero.
  • Base 1-31 and 33-36, These bases are encoded following an extended Base-16
  • Base 32, Base-32 is encoding
  • Base 37-64 These bases are encoded following Base-64

Parameters:
name name of the node.
buf Literal as string.
buf_size String size.
base The base of the literal. 0-64
Returns:
The decoded literal.

Definition at line 177 of file leaf.c.

References ya_integer(), and YA_NODE_TYPE_NEGATIVE_INTEGER.

ya_t ya_null ( void   ) 

Null node, unused child entry.

Definition at line 167 of file leaf.c.

References ya_literal(), and YA_NODE_TYPE_NULL.

ya_t ya_positive_integer ( const char *restrict  name,
const char *restrict  buf,
size_t  buf_size,
int  base 
)

Create literal from an positive integer literal string.

The RFC 4648 is used as a guide for encoding integers. The integer literal should be passed without the base prefix (0x) or suffix (h).

  • Base 0, has no alphabet, it always yields zero.
  • Base 1-31 and 33-36, These bases are encoded following an extended Base-16
  • Base 32, Base-32 is encoding
  • Base 37-64 These bases are encoded following Base-64

Parameters:
name name of the node.
buf Literal as string.
buf_size String size.
base The base of the literal. 0-64
Returns:
The decoded literal.

Definition at line 172 of file leaf.c.

References ya_integer(), and YA_NODE_TYPE_POSITIVE_INTEGER.

ya_t ya_text ( const char *restrict  name,
const char *restrict  buf,
size_t  buf_size 
)

Create text literal node for a string literal.

Parameters:
name name of the node.
buf Literal as string.
buf_size String size.
Returns:
The decoded literal.

Definition at line 157 of file leaf.c.

References ya_literal(), and YA_NODE_TYPE_TEXT.

Referenced by ya_get_filenames().


Generated for yyast-1.0.1 by doxygen 1.5.6