aboutsummaryrefslogtreecommitdiff
path: root/lib/operators.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-01-07 16:51:29 -0800
committerBruce Hill <bitbucket@bruce-hill.com>2018-01-07 16:51:29 -0800
commitb1c6354464ab2c9f8f09217815a11317cc068cec (patch)
tree4a845f34b913cdc89ed74ce238749d00a85c1001 /lib/operators.nom
parenta4c8e5ce65697a8ca7d146e2b31468b08d0d4ad7 (diff)
Added substring operator %x|start - stop|
Diffstat (limited to 'lib/operators.nom')
-rw-r--r--lib/operators.nom4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/operators.nom b/lib/operators.nom
index 9250214..cdf41fe 100644
--- a/lib/operators.nom
+++ b/lib/operators.nom
@@ -31,6 +31,10 @@ compile [..]
# Indexing:
compile [%obj'%key, %obj's %key, %obj -> %key] to: "(\(%obj as lua))[\(%key as lua)]"
+# Substring
+compile [%str |%start|] to: "\(%str as lua):sub(\(%start as lua), \(%start as lua))"
+compile [%str |%start - %stop|] to: "\(%str as lua):sub(\(%start as lua), \(%stop as lua))"
+
# Variable assignment operator, and += type versions
compile [%var = %val] to code:
lua> ".."