-
Notifications
You must be signed in to change notification settings - Fork 0
/
test10.js
44 lines (39 loc) · 944 Bytes
/
test10.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// shortcut:
var treeMatch = JaM.treeMatch;
JaM.msg( "should match: " + treeMatch({{ a( b, c ) }}, {{ a( b, c ) }} ) );
JaM.msg( "should NOT match: " + treeMatch({{ a( b ) }}, {{ a( b, c ) }} ) );
JaM.msg( "should match: q = " + treeMatch({{ a( b, c ) }}, {{ a( @q, c ) }} ).q.value );
JaM.msg( "should NOT match: " + treeMatch({{ a( b, c ) }}, {{ a( @b ) }} ) );
JaM.msg( "should NOT match: " + treeMatch({{ a( b, c ) }}, {{ a( @b, q ) }} ) );
JaM.msg( "should match: " + treeMatch(
{{
def a( b, c ) {
foo;
bar;
}
}},
{{
def @name( @arg1, @arg2 ) {
@body1;
@body2;
}
}} ) );
JaM.msg( "should match: " + treeMatch(
{{
def a( b, c, d ) {
foo;
bar;
}
}},
{{
def @name( @arg1, @*args ) {
@*body
}
}} ) );
JaM.msg( "should match: " + treeMatch(
{{
foo( a, b ) { ( c, d ); e; f; }
}},
{{
foo( @*caargs ) { ( @*cfargs ); @*cbody }
}} ) );