tokenizer-0.1.0.0: Check uniqueness and tokenize safely
Copyright(c) Lev Dvorkin 2022
LicenseMIT
Maintainerlev_135@mail.ru
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

Text.Tokenizer.Uniqueness

Description

This module contains implementation of uniqueness checking algorithm based on Sardinas-Patterson's algorithm

Synopsis

Documentation

data Rem c Source #

Constructors

Rem1 [Repeatable c]

First list reminder. May be empty if there is no rem

Rem2 [Repeatable c]

Second list reminder. Always is nonempty

data MergeRes c Source #

Constructors

MergeRes 

Fields

data Suff c Source #

Dangling suffix

Constructors

Suff 

Fields

Instances

Instances details
Eq c => Eq (Suff c) Source # 
Instance details

Defined in Text.Tokenizer.Uniqueness

Methods

(==) :: Suff c -> Suff c -> Bool #

(/=) :: Suff c -> Suff c -> Bool #

Ord c => Ord (Suff c) Source # 
Instance details

Defined in Text.Tokenizer.Uniqueness

Methods

compare :: Suff c -> Suff c -> Ordering #

(<) :: Suff c -> Suff c -> Bool #

(<=) :: Suff c -> Suff c -> Bool #

(>) :: Suff c -> Suff c -> Bool #

(>=) :: Suff c -> Suff c -> Bool #

max :: Suff c -> Suff c -> Suff c #

min :: Suff c -> Suff c -> Suff c #

Show c => Show (Suff c) Source # 
Instance details

Defined in Text.Tokenizer.Uniqueness

Methods

showsPrec :: Int -> Suff c -> ShowS #

show :: Suff c -> String #

showList :: [Suff c] -> ShowS #

data Div c Source #

Result of division.

It looks like

      rtoks       |       lastTok
--------|---------|-----------------------|~~~~~
    rprefToks        |
-----|-----|---------|
suff (remained part):
              behind |     current        | ahead
              -------|====================|~~~~~

Constructors

Div 

Fields

Instances

Instances details
Eq c => Eq (Div c) Source # 
Instance details

Defined in Text.Tokenizer.Uniqueness

Methods

(==) :: Div c -> Div c -> Bool #

(/=) :: Div c -> Div c -> Bool #

Ord c => Ord (Div c) Source # 
Instance details

Defined in Text.Tokenizer.Uniqueness

Methods

compare :: Div c -> Div c -> Ordering #

(<) :: Div c -> Div c -> Bool #

(<=) :: Div c -> Div c -> Bool #

(>) :: Div c -> Div c -> Bool #

(>=) :: Div c -> Div c -> Bool #

max :: Div c -> Div c -> Div c #

min :: Div c -> Div c -> Div c #

Show c => Show (Div c) Source # 
Instance details

Defined in Text.Tokenizer.Uniqueness

Methods

showsPrec :: Int -> Div c -> ShowS #

show :: Div c -> String #

showList :: [Div c] -> ShowS #

stepDiv :: Ord c => Int -> Div c -> RToken c -> Alt (Div c) Source #

data ConflictTokens k c Source #

Two ways of tokenizing a string, demonstrating non-uniqueness

Constructors

ConflictTokens 

Fields

Instances

Instances details
(Eq k, Eq c) => Eq (ConflictTokens k c) Source # 
Instance details

Defined in Text.Tokenizer.Uniqueness

(Ord k, Ord c) => Ord (ConflictTokens k c) Source # 
Instance details

Defined in Text.Tokenizer.Uniqueness

(Show k, Show c) => Show (ConflictTokens k c) Source # 
Instance details

Defined in Text.Tokenizer.Uniqueness

checkUniqueTokenizing :: forall k c. Ord c => [Token k c] -> Either (ConflictTokens k c) () Source #

Check that there is no list of symbols, that can be decomposed to ways on the tokens from given list