diff options
Diffstat (limited to 'server-beta')
-rw-r--r-- | server-beta/src/core/engineer.lua | 2 | ||||
-rw-r--r-- | server-beta/src/core/goto.lua | 13 | ||||
-rw-r--r-- | server-beta/src/core/label.lua | 3 | ||||
-rw-r--r-- | server-beta/test/definition/label.lua | 2 |
4 files changed, 19 insertions, 1 deletions
diff --git a/server-beta/src/core/engineer.lua b/server-beta/src/core/engineer.lua index 036095dc..9171af39 100644 --- a/server-beta/src/core/engineer.lua +++ b/server-beta/src/core/engineer.lua @@ -25,6 +25,8 @@ mt['boolean'] = require 'core.boolean' mt['string'] = require 'core.string' mt['table'] = require 'core.table' mt['select'] = require 'core.select' +mt['goto'] = require 'core.goto' +mt['label'] = require 'core.label' local specials = { ['_G'] = true, diff --git a/server-beta/src/core/goto.lua b/server-beta/src/core/goto.lua new file mode 100644 index 00000000..4652f8be --- /dev/null +++ b/server-beta/src/core/goto.lua @@ -0,0 +1,13 @@ +local guide = require 'parser.guide' + +local m = {} + +function m:def(source, callback) + local name = source[1] + local label = guide.getLabel(source, name) + if label then + callback(label) + end +end + +return m diff --git a/server-beta/src/core/label.lua b/server-beta/src/core/label.lua new file mode 100644 index 00000000..f05a57e6 --- /dev/null +++ b/server-beta/src/core/label.lua @@ -0,0 +1,3 @@ +local m = {} + +return m diff --git a/server-beta/test/definition/label.lua b/server-beta/test/definition/label.lua index 4859d70e..205915b6 100644 --- a/server-beta/test/definition/label.lua +++ b/server-beta/test/definition/label.lua @@ -23,7 +23,7 @@ end ]] TEST [[ -::<!LABEL!>:: +::LABEL:: goto <?LABEL?> ::<!LABEL!>:: ]] |