@@ -32,17 +32,17 @@ def from_node(cls, node: Node, parent: "Trie | None") -> "Trie":
3232 :rtype: "Trie"
3333 """
3434 if node .type == "option" :
35- text = UNI . node2text (node )
35+ text = UNI (node ). text
3636 if text .startswith ("no" ):
37- return cls (UNI . node2range (node ), parent , "no" )
37+ return cls (UNI (node ). range , parent , "no" )
3838 else :
39- return cls (UNI . node2range (node ), parent , "yes" )
39+ return cls (UNI (node ). range , parent , "yes" )
4040 if node .type == "int" :
41- return cls (UNI . node2range (node ), parent , int (UNI . node2text (node )))
41+ return cls (UNI (node ). range , parent , int (UNI (node ). text ))
4242 if node .type == "\n " :
43- return cls (UNI . node2range (node ), parent , "" )
43+ return cls (UNI (node ). range , parent , "" )
4444 if node .type in {"shell" , "string" , "quadoption" }:
45- return cls (UNI . node2range (node ), parent , UNI . node2text (node ))
45+ return cls (UNI (node ). range , parent , UNI (node ). text )
4646 if node .type == "file" :
4747 trie = cls (Range (Position (0 , 0 ), Position (1 , 0 )), parent , {})
4848 for child in node .children :
@@ -54,7 +54,7 @@ def from_node(cls, node: Node, parent: "Trie | None") -> "Trie":
5454 _value : dict [str , Trie ] = trie .value # type: ignore
5555 if _type not in _value :
5656 trie .value [_type ] = cls ( # type: ignore
57- UNI . node2range (child ),
57+ UNI (child ). range ,
5858 trie ,
5959 {} if _type != "source" else [],
6060 )
@@ -87,13 +87,13 @@ def from_node(cls, node: Node, parent: "Trie | None") -> "Trie":
8787 continue
8888 items += [grandchild ]
8989 for k , v in zip (items [::2 ], items [1 ::2 ], strict = False ):
90- value [UNI . node2text (k )] = cls .from_node (v , subtrie )
90+ value [UNI (k ). text ] = cls .from_node (v , subtrie )
9191 # set option nooption invoption & option ? option
9292 else :
9393 for grandchild in child .children [1 :]:
9494 if grandchild .type in {"&" , "?" , " " }:
9595 continue
96- text = UNI . node2text (grandchild )
96+ text = UNI (grandchild ). text
9797 if text .startswith ("no" ):
9898 # generate trie from option node
9999 value [text .split ("no" )[- 1 ]] = cls .from_node (
0 commit comments