allang-compiler-base 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -12,8 +12,9 @@ interface tools{
|
|
|
12
12
|
remove():void
|
|
13
13
|
get():token[]
|
|
14
14
|
}
|
|
15
|
-
function create_match(func:(tool:tools)=>boolean,error:(log:log
|
|
16
|
-
|
|
15
|
+
function create_match(func:(tool:tools)=>boolean,error:(log:log,tool:tools)=>void
|
|
16
|
+
,to:(tool:tools)=>Tree):{func:(tool:tools)=>boolean,
|
|
17
|
+
error:(log:log,tool:tools)=>void,to:(tool:tools)=>Tree}{
|
|
17
18
|
return {
|
|
18
19
|
func:func,
|
|
19
20
|
to:to,
|
|
@@ -21,19 +22,20 @@ function create_match(func:(tool:tools)=>boolean,error:(log:log)=>void,to:()=>Tr
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
function root_match(tool:tools,log:log,parser:(child:Tree[])=>Tree,...match:{func:((tool:tools)=>boolean)
|
|
24
|
-
,error:(log:log,tool:tools)=>void,to:()=>Tree}[]):Tree{
|
|
25
|
+
,error:(log:log,tool:tools)=>void,to:(tool:tools)=>Tree}[]):Tree{
|
|
25
26
|
let matches:Tree[]=[]
|
|
26
27
|
for(let i=0;i<match.length;i++){
|
|
27
28
|
if(!match[i].func(tool))match[i].error(log,tool)
|
|
28
29
|
else{
|
|
29
|
-
matches.push(match[i].to())
|
|
30
|
+
matches.push(match[i].to(tool))
|
|
30
31
|
tool.flush()
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
return parser(matches)
|
|
34
35
|
}
|
|
35
36
|
function list_match(tool:tools,log:log,parser:(token:token[][])=>Tree,v?:(log:log,token:token[])=>void,
|
|
36
|
-
...match:{func:((tool:tools)=>boolean),error:(log:log,tool:tools)=>void
|
|
37
|
+
...match:{func:((tool:tools)=>boolean),error:(log:log,tool:tools)=>void,
|
|
38
|
+
to:(tool:tools)=>Tree}[]):Tree{
|
|
37
39
|
let matches:(token[])[]=[]
|
|
38
40
|
for(let i=0;i<match.length;i++){
|
|
39
41
|
if(!match[i].func(tool))match[i].error(log,tool)
|