allang-compiler-base 0.0.2 → 0.0.3

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.2",
3
+ "version": "0.0.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/base/log.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  interface log{
2
- error(text:string,line:number):void
3
- warn(text:string,line:number):void
4
- info(text:string,line:number):void
2
+ error(text:string,line:string):void
3
+ warn(text:string,line:string):void
4
+ info(text:string,line:string):void
5
5
  }
6
6
  export {log}
@@ -12,20 +12,21 @@ interface tools{
12
12
  remove():void
13
13
  get():token[]
14
14
  }
15
- function create_match(func:(tool:tools)=>boolean,error:(log:log)=>void):{func:(tool:tools)=>boolean,
16
- error:(log:log)=>void}{
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}{
17
17
  return {
18
18
  func:func,
19
+ to:to,
19
20
  error:error
20
21
  }
21
22
  }
22
- function root_match(tool:tools,log:log,parser:(token:token[][])=>Tree,...match:{func:((tool:tools)=>boolean)
23
- ,error:(log:log)=>void}[]):Tree{
24
- let matches:(token[])[]=[]
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{
25
+ let matches:Tree[]=[]
25
26
  for(let i=0;i<match.length;i++){
26
27
  if(!match[i].func(tool))match[i].error(log)
27
28
  else{
28
- matches.push(tool.get())
29
+ matches.push(match[i].to())
29
30
  tool.flush()
30
31
  }
31
32
  }
@@ -45,5 +46,6 @@ function list_match(tool:tools,log:log,parser:(token:token[][])=>Tree,v?:(log:lo
45
46
  return parser(matches)
46
47
  }
47
48
  class Tree{
49
+ type:number
48
50
  }
49
51
  export {tools,Tree,list_match,root_match,create_match}