aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/run.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-12-12 19:15:53 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2011-12-12 19:15:53 -0500
commit9f804f70df793dd2d50c0b14000ab83a6bc02b83 (patch)
tree12b826dc06b800d868854231d4db56d489697832 /modules/textadept/run.lua
parent51bfd53e48d5310eb786069b758e0430129daf54 (diff)
downloadtextadept-9f804f70df793dd2d50c0b14000ab83a6bc02b83.tar.gz
textadept-9f804f70df793dd2d50c0b14000ab83a6bc02b83.zip
Remove 'module' and update LuaDoc comments appropriately.
Diffstat (limited to 'modules/textadept/run.lua')
-rw-r--r--modules/textadept/run.lua30
1 files changed, 19 insertions, 11 deletions
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 8e1561f3..7267b486 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -3,12 +3,15 @@
local L = locale.localize
local events = events
+local M = {}
+
+--[[ This comment is for LuaDoc.
---
-- Module for running/executing source files.
-- Typically, language-specific modules populate the 'compile_command',
-- 'run_command', and 'error_detail' tables for a particular language's file
-- extension.
-module('_m.textadept.run', package.seeall)
+module('_m.textadept.run', package.seeall)]]
-- Markdown:
-- ## Run Events
@@ -40,7 +43,8 @@ events.RUN_OUTPUT = 'run_output'
-- + `%(filedir)`: The current file's directory path.
-- + `%(filename)`: The name of the file including extension.
-- + `%(filename_noext)`: The name of the file excluding extension.
-function execute(command)
+-- @name execute
+function M.execute(command)
local filepath = buffer.filename:iconv(_CHARSET, 'UTF-8')
local filedir, filename = '', filepath
if filepath:find('[/\\]') then
@@ -69,7 +73,7 @@ local function command(cmd_table)
buffer:save()
local action = cmd_table[buffer.filename:match('[^.]+$')]
if not action then return end
- return execute(type(action) == 'function' and action() or action)
+ return M.execute(type(action) == 'function' and action() or action)
end
---
@@ -79,15 +83,16 @@ end
-- This table is typically populated by language-specific modules.
-- @class table
-- @name compile_command
-compile_command = {}
+M.compile_command = {}
---
-- Compiles the file as specified by its extension in the `compile_command`
-- table.
-- @see compile_command
-function compile()
+-- @name compile
+function M.compile()
events.emit(events.COMPILE_OUTPUT, buffer:get_lexer(),
- command(compile_command))
+ command(M.compile_command))
end
events.connect(events.COMPILE_OUTPUT,
function(lexer, output) gui.print(output) end)
@@ -99,14 +104,15 @@ events.connect(events.COMPILE_OUTPUT,
-- This table is typically populated by language-specific modules.
-- @class table
-- @name run_command
-run_command = {}
+M.run_command = {}
---
-- Runs/executes the file as specified by its extension in the `run_command`
-- table.
-- @see run_command
-function run()
- events.emit(events.RUN_OUTPUT, buffer:get_lexer(), command(run_command))
+-- @name run
+function M.run()
+ events.emit(events.RUN_OUTPUT, buffer:get_lexer(), command(M.run_command))
end
events.connect(events.RUN_OUTPUT,
function(lexer, output) gui.print(output) end)
@@ -126,7 +132,7 @@ events.connect(events.RUN_OUTPUT,
-- This table is usually populated by language-specific modules.
-- @class table
-- @name error_detail
-error_detail = {}
+M.error_detail = {}
---
-- When the user double-clicks an error message, go to the line in the file
@@ -141,7 +147,7 @@ function goto_error(pos, line_num)
end
local buffer = buffer
line = buffer:get_line(line_num)
- for _, error_detail in pairs(error_detail) do
+ for _, error_detail in pairs(M.error_detail) do
local captures = { line:match(error_detail.pattern) }
if #captures > 0 then
local utf8_filename = captures[error_detail.filename]
@@ -159,3 +165,5 @@ function goto_error(pos, line_num)
end
end
events.connect(events.DOUBLE_CLICK, goto_error)
+
+return M