Login

    Register

Managed Hosting

PROJECT CATEGORIES

 

Pattern
Project Home Wiki Known Issues Screenshots Contact Project

Author: RocketBoots (All RIAForge projects by this author)
Last Updated: April 23, 2015 12:57 AM
Version: 0.1
Views: 10,457
Downloads: 188
License: LGPL (GNU Lesser General Public License)

Description:

Pattern is a CFC that supports pattern-based assignment, assertions and flow control, for instance:

...p.match(''{a = c, b = d}'', {a = 1, b = 2}, variables);

will assign the value 1 to c, and 2 to d;

...p.match(''{type = 'member',
......firstname = firstName,
......surname = surname}'',
......people[i],
......variables);

will assign people[i].firstname to firstName and people[i].surname to surname, but only if people[i].type = 'member' - otherwise it will throw a NO_MATCH error. There's much more (check out the project wiki), and it's implemented with efficiency in mind.

It's like extending regular expression sub-expression matching to things other than strings. You could describe it as the love-child of cfset, cfif and cfswitch with super powers. It will change the way you write CFML.

The idea is not new - I first encountered it in the Erlang and more recently Elixir programming languages, but it has been implemented in many other languages, usually of the functional or declarative kind.

When I'm using languages other than Erlang I find that this is the feature I miss the most, which is why I created this library. It was developed on Railo 4 but should work with any of the closure-supporting CFML engines with minor tweaks. There is an extensive MX-Unit test case included if you want to migrate to another engine - I'll gratefully accept any contributions provided.

See the wiki for a tutorial. The tutorial is included in the download in .html and .md formats.

Last Update:

Release 0.1

Requirements:

Railo 4

Issue Tracker:

There are no issues for this project.

To enter issues for this (or any other) project, you must be logged in.