Skip to main content

Module definition

Module definition 

Source
Expand description

Lua language definition and registration

This module defines the Lua language support for Codanna, providing tree-sitter-based parsing and symbol extraction for Lua codebases.

§AST Node Types and Symbol Mappings

The Lua parser uses tree-sitter-lua and handles the following primary node types and their corresponding symbol classifications:

§Function Declarations

  • Global functions (function_declaration) -> SymbolKind::Function
  • Local functions (local_function_declaration) -> SymbolKind::Function (Private)
  • Methods (colon syntax) -> SymbolKind::Method

§Variable Declarations

  • Local variables (variable_declaration) -> SymbolKind::Variable (Private)
  • Global assignments (assignment_statement) -> SymbolKind::Variable

§Table Constructs

  • Table constructors (table_constructor) -> SymbolKind::Class (when pattern detected)
  • Table fields (field) -> SymbolKind::Field

§Lua-Specific Language Features

The Lua parser handles unique Lua constructs including:

  • Module patterns (returning tables from files)
  • Metatable-based OOP patterns
  • Visibility via local keyword and underscore convention
  • require() for module imports

Structs§

LuaLanguage
Lua language definition