Skip to content

scholtzm/luatree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

luatree

luatree is a Lua package for code analysis and inspection.

The goal of this package is to provide tools for analysis of syntax trees generated by luametrics and function call graphs generated by luadb module.

Some of the functions require usage of newer version of luametrics which is not available from LuaDist.

Installation

luatree is distributed as a standalone luadist package.

  1. git clone https://github.com/scholtzm/luatree.git
  2. /path/to/luadist /path/to/install/dir make luatree

You can also manually copy the luatree folder from the src subfolder into your lib/lua folder.

Usage

Using luatree is pretty simple ...

local luatree = require("luatree")

local tree_a = luatree.ast.tree.get_tree("local a")
local tree_b = luatree.ast.tree.get_tree("local b")

luatree.ast.tree.compare(tree_a, tree_b)

local changed_nodes = luatree.utils.get_tree_flag_count(tree_b, "modified")

print("A total of " .. changed_nodes .. " have changed in tree_b.")

Check different submodules to see what functions they export. Do not forget to read the comments.

Tests

luatree tests use busted library for their core functionality. Once you have busted and luatree installed, simply run the following command:

$ busted

License

MIT. See LICENSE.

About

Toolkit for luametrics and luadb modules.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors