PEG Markdown Highlight
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
Functions
pmh_parser.h File Reference

Parser public interface. More...

#include <stdbool.h>
#include <stdlib.h>
#include <assert.h>
#include "pmh_definitions.h"

Go to the source code of this file.

Functions

void pmh_markdown_to_elements (char *text, int extensions, pmh_element **out_result[])
 Parse Markdown text, return elements.
void pmh_sort_elements_by_pos (pmh_element *element_lists[])
 Sort elements in list by start offset.
void pmh_free_elements (pmh_element **elems)
 Free pmh_element array.
char * pmh_element_name_from_type (pmh_element_type type)
 Get element type name.
pmh_element_type pmh_element_type_from_name (char *name)
 Get element type from a name.

Detailed Description

Parser public interface.


Function Documentation

Get element type name.

Parameters:
[in]typeThe type value to get the name for.
Returns:
The name of the given type as a null-terminated string.
See also:
pmh_element_type

Get element type from a name.

Parameters:
[in]nameThe name of the type.
Returns:
The element type corresponding to the given name.
See also:
pmh_element_type
void pmh_free_elements ( pmh_element **  elems)

Free pmh_element array.

Frees an pmh_element array returned by pmh_markdown_to_elements().

Parameters:
[in]elemsThe pmh_element array resulting from calling pmh_markdown_to_elements().
See also:
pmh_markdown_to_elements
void pmh_markdown_to_elements ( char *  text,
int  extensions,
pmh_element **  out_result[] 
)

Parse Markdown text, return elements.

Parses the given Markdown text and returns the results as an array of linked lists of elements, indexed by type.

Parameters:
[in]textThe Markdown text to parse for highlighting.
[in]extensionsThe extensions to use in parsing (a bitfield of pmh_extensions values).
[out]out_resultA pmh_element array, indexed by type, containing the results of the parsing (linked lists of elements). You must pass this to pmh_free_elements() when it's not needed anymore.
See also:
pmh_element_type
void pmh_sort_elements_by_pos ( pmh_element element_lists[])

Sort elements in list by start offset.

Sorts the linked lists of elements in the list returned by pmh_markdown_to_elements() by their start offsets (pos).

Parameters:
[in]element_listsArray of linked lists of elements (output from pmh_markdown_to_elements()).
See also:
pmh_markdown_to_elements
pmh_element::pos