allang-compiler-base 0.0.3 → 0.0.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allang-compiler-base",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@ interface tools{
13
13
  get():token[]
14
14
  }
15
15
  function create_match(func:(tool:tools)=>boolean,error:(log:log)=>void,to:()=>Tree):{func:(tool:tools)=>boolean,
16
- error:(log:log)=>void,to:()=>Tree}{
16
+ error:(log:log,tool:tools)=>void,to:()=>Tree}{
17
17
  return {
18
18
  func:func,
19
19
  to:to,
@@ -21,10 +21,10 @@ function create_match(func:(tool:tools)=>boolean,error:(log:log)=>void,to:()=>Tr
21
21
  }
22
22
  }
23
23
  function root_match(tool:tools,log:log,parser:(child:Tree[])=>Tree,...match:{func:((tool:tools)=>boolean)
24
- ,error:(log:log)=>void,to:()=>Tree}[]):Tree{
24
+ ,error:(log:log,tool:tools)=>void,to:()=>Tree}[]):Tree{
25
25
  let matches:Tree[]=[]
26
26
  for(let i=0;i<match.length;i++){
27
- if(!match[i].func(tool))match[i].error(log)
27
+ if(!match[i].func(tool))match[i].error(log,tool)
28
28
  else{
29
29
  matches.push(match[i].to())
30
30
  tool.flush()
@@ -33,10 +33,10 @@ function root_match(tool:tools,log:log,parser:(child:Tree[])=>Tree,...match:{fun
33
33
  return parser(matches)
34
34
  }
35
35
  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)=>void}[]):Tree{
36
+ ...match:{func:((tool:tools)=>boolean),error:(log:log,tool:tools)=>void}[]):Tree{
37
37
  let matches:(token[])[]=[]
38
38
  for(let i=0;i<match.length;i++){
39
- if(!match[i].func(tool))match[i].error(log)
39
+ if(!match[i].func(tool))match[i].error(log,tool)
40
40
  else{
41
41
  matches.push(tool.get())
42
42
  tool.flush()