Fork me on GitHub

A collection of tools and building blocks for the Parrot Virtual Machine.
Pages: HomeDevelopmentArticles and ExamplesWinxed


Rosella Parse

Overview

The Rosella Parse library is a basic utilities library for doing codepoint-level parsing on strings without the need to repeatedly take string indices and substrings. It has three components:

In addition, when using the macros, the Rosella/Builtins.winxed include file may be useful because it contains several macros that may be used to help with parsing tasks.

The intention is for this library to be equally effective for strings in all encodings. Currently, ASCII is best supported with Latin1 and UTF8 next. Support for non-ascii encodings will be improved over time.

Concepts

Namespaces

Rosella.Parse

The Rosella.Parse namespace contains all the parsing utilities.

setup_parse takes a string and returns the various stuctures and values needed for efficient parsing:

:(string str, var s, var b, int len) = Rosella.Parse.setup_parse(my_string);

These 4 return values are passed to almost all subsequent parsing routines. These values are:

Here is a list of some of the routines in Parse:

Winxed Include Files

Rosella/Parse.winxed

The basic include file for Parse. Loads the parse bytecode and provides forward declarations of the various namespaces and functions provided by the library.

Rosella/Ascii.winxed

An include file with declarations of various ASCII characters and a handful of macros for working with ASCII characters.

Rosella/Parse_Builtins.winxed

And include file with declarations of various macros for parsing strings of any encoding.

Examples

Winxed

NQP-rx

Users