public
Description: A Ruby port of the Mozilla Javascript self-parser
Clone URL: git://github.com/nex3/rbnarcissus.git
Clean up Node a little.
nex3 (author)
Sat Jul 19 14:14:54 -0700 2008
commit  eebfe2ff9ec74b7143f0f6fb636e0fe9c0335406
tree    fea42799e1d738a99b86ac8eb0ca7b0dbe50b7d1
parent  110f59ffa9cd3112f3c300b2c1577e405ea55425
...
1
2
 
3
4
5
...
9
10
11
 
 
12
 
 
13
14
15
...
30
31
32
33
34
35
36
37
38
39
40
41
42
 
 
 
43
44
45
 
46
47
48
...
1
 
2
3
4
5
...
9
10
11
12
13
14
15
16
17
18
19
...
34
35
36
 
37
38
 
 
 
 
 
 
 
39
40
41
42
43
 
44
45
46
47
0
@@ -1,5 +1,5 @@
0
 module Narcissus
0
- class Node < Array
0
+ class Node
0
 
0
     attr_accessor :type, :value, :lineno, :start, :end, :tokenizer, :initializer
0
     attr_accessor :name, :params, :fun_decls, :var_decls, :body, :function_form
0
@@ -9,7 +9,11 @@ module Narcissus
0
     attr_accessor :catch_clauses, :var_name, :guard, :block, :discriminant, :cases
0
     attr_accessor :default_index, :case_label, :statements, :statement
0
 
0
+ attr_accessor :children
0
+
0
     def initialize(t, type = nil)
0
+ @children = []
0
+
0
       token = t.token
0
       if token
0
         if type != nil
0
@@ -30,19 +34,14 @@ module Narcissus
0
       #this.push(arguments[i]);
0
     end
0
 
0
- alias superPush push
0
     # Always use push to add operands to an expression, to update start and end.
0
     def push(kid)
0
- if kid.start and @start
0
- @start = kid.start if kid.start < @start
0
- end
0
- if kid.end and @end
0
- @end = kid.end if @end < kid.end
0
- end
0
- return superPush(kid)
0
+ @start = kid.start if kid.start && @start && kid.start < @start
0
+ @end = kid.end if kid.end && @end && @end < kid.end
0
+ @children.push(kid)
0
     end
0
 
0
- def getSource
0
+ def get_source
0
       return @tokenizer.source.slice(@start, @end)
0
     end
0
 

Comments

    No one has commented yet.