squaresLab / Rooibos

2 stars 0 forks source link

Rooibos

Build Status

Match Semantics

Exact Matches (Match.find)

MATCH:

x = y; <-> x = :[1];

:[1] <-> x = y

NO MATCH:

x = y; <-> y = :[1];

MATCH:

foo ( bar, quux ) <-> foo ( :[1], :[2])

MATCH:

x = a + b; x = c + d; <-> x = :[1] + :[2] => :[1] = a, :[2] = b

Non-exact Matches (Match.all)

MATCH:

foo = bar; x = y; quux = bazz <-> x = :[1]; => :[1] = y

foo(bar, quux); foo(foobar, bazz) <-> foo(:[1], :[2])

Environment 1: :[1] = foobar, :[2] = bazz Environment 2: :[1] = bar, :[2] = quux

Say you add a semicolon to our template: foo(:[1], :[2]);, will only return one match. Yes, it is that good.

foo(foo(bar, bazz),quux) <-> foo(:[1], :[2])

Environment 1: :[1] = foo(bar, bazz), :[2] = quux Environment 2: :[1] = bar, :[2] = bazz