Crate minparser

source ·
Expand description

Simple parsing tools

This crate is a collection of objects and algorithms shared among different crates that needs to implement a parser.

The predicates module contains some useful functions in order to analize ASCII and Unicode characters. Some of these functions are just wrappers of functions defined in the standard library.

A Position is an object that identifies a (textual) file and a position inside it, represented as a line index and a column index. The main role of a Position object is to uniquely identify a single character or a (textual) token inside a file in order to allow the user to easily find it.

A Pos<T> is just an object containing a T object and a Position. Usually you set T to be equal to char or to a custom token type.

A DefLine is a sort of “iterator” that returns Pos<Option<char>, FILE> in place of Option<char>. Moreover, it defines a lot of useful functions for parsing tokens from a text source.

Modules§

  • A collection of predicates for characters.

Structs§

  • A positioned iterator
  • An integer appender.
  • A positioned object, functionally equivalent to a struct containing an object of type T (the wrapped object) and its position as a Position<FILE> object.
  • A position.

Traits§

  • A sequential container that can accept new objects.
  • A sequential container with additional functionalities.
  • This trait allows you to easily create a Pos<T, F> object from a T object implementing the Posable traits thanks to its methods Posable::at and Posable::at_pos.