From b1c6354464ab2c9f8f09217815a11317cc068cec Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 7 Jan 2018 16:51:29 -0800 Subject: Added substring operator %x|start - stop| --- lib/operators.nom | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/operators.nom') 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> ".." -- cgit v1.2.3