Add support for multiple types, see Readme:Usage
This commit is contained in:
@@ -15,38 +15,40 @@ local function_tree = {
|
||||
},
|
||||
}
|
||||
return {
|
||||
parent = { "function_declaration", "expression_statement", "variable_declaration" },
|
||||
parent = { func = { "function_declaration", "expression_statement", "variable_declaration" }, },
|
||||
|
||||
data = {
|
||||
["function_declaration"] = {
|
||||
["0"] = {
|
||||
func = {
|
||||
["function_declaration"] = {
|
||||
["0"] = {
|
||||
|
||||
extract = function(node)
|
||||
local results = {}
|
||||
local tree = function_tree
|
||||
local nodes = neogen.utilities.nodes:matching_nodes_from(node, tree)
|
||||
local res = neogen.utilities.extractors:extract_from_matched(nodes)
|
||||
extract = function(node)
|
||||
local results = {}
|
||||
local tree = function_tree
|
||||
local nodes = neogen.utilities.nodes:matching_nodes_from(node, tree)
|
||||
local res = neogen.utilities.extractors:extract_from_matched(nodes)
|
||||
|
||||
results.parameters = res.identifier
|
||||
results.return_statement = res.return_statement
|
||||
return results
|
||||
end,
|
||||
results.parameters = res.identifier
|
||||
results.return_statement = res.return_statement
|
||||
return results
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
["expression_statement|variable_declaration"] = {
|
||||
["1"] = {
|
||||
extract = function(node)
|
||||
local results = {}
|
||||
local tree = { { retrieve = "all", node_type = "function", subtree = function_tree } }
|
||||
local nodes = neogen.utilities.nodes:matching_nodes_from(node, tree)
|
||||
local res = neogen.utilities.extractors:extract_from_matched(nodes)
|
||||
["expression_statement|variable_declaration"] = {
|
||||
["1"] = {
|
||||
extract = function(node)
|
||||
local results = {}
|
||||
local tree = { { retrieve = "all", node_type = "function", subtree = function_tree } }
|
||||
local nodes = neogen.utilities.nodes:matching_nodes_from(node, tree)
|
||||
local res = neogen.utilities.extractors:extract_from_matched(nodes)
|
||||
|
||||
results.parameters = res.identifier
|
||||
results.return_statement = res.return_statement
|
||||
return results
|
||||
end,
|
||||
results.parameters = res.identifier
|
||||
results.return_statement = res.return_statement
|
||||
return results
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
template = {
|
||||
|
||||
Reference in New Issue
Block a user