diff --git a/anagrams.tlv b/anagrams.tlv index 70ef124..22c4685 100644 --- a/anagrams.tlv +++ b/anagrams.tlv @@ -60,6 +60,10 @@ > return s:sub(1,pos-1)..s:sub(pos+1) >end > + >function string.pos(s, sub) + > return string.find(s, sub, 1, true) -- plain=true to disable regular expressions + >end + > >-- TODO: backport utf-8 support from Lua 5.3 - __teliva_timestamp: original check_eq: diff --git a/break.tlv b/break.tlv index 8f06963..6a67653 100644 --- a/break.tlv +++ b/break.tlv @@ -60,6 +60,10 @@ > return s:sub(1,pos-1)..s:sub(pos+1) >end > + >function string.pos(s, sub) + > return string.find(s, sub, 1, true) -- plain=true to disable regular expressions + >end + > >-- TODO: backport utf-8 support from Lua 5.3 - __teliva_timestamp: original debugy: diff --git a/gemini.tlv b/gemini.tlv index 5600b3d..dfcd373 100644 --- a/gemini.tlv +++ b/gemini.tlv @@ -60,6 +60,10 @@ > return s:sub(1,pos-1)..s:sub(pos+1) >end > + >function string.pos(s, sub) + > return string.find(s, sub, 1, true) -- plain=true to disable regular expressions + >end + > >-- TODO: backport utf-8 support from Lua 5.3 - __teliva_timestamp: original debugy: diff --git a/graphviz.tlv b/graphviz.tlv index 549f73b..3757c0b 100644 --- a/graphviz.tlv +++ b/graphviz.tlv @@ -60,6 +60,10 @@ > return s:sub(1,pos-1)..s:sub(pos+1) >end > + >function string.pos(s, sub) + > return string.find(s, sub, 1, true) -- plain=true to disable regular expressions + >end + > >-- TODO: backport utf-8 support from Lua 5.3 - __teliva_timestamp: original debugy: @@ -548,17 +552,17 @@ > self:skip_whitespace_and_comments() > local c = self.chars.peek > if c == nil then return nil end - > if string.find('/*;,', c) then + > if string.pos('/*;,', c) then > -- should be skipped as comments > error('unexpected character '..c) - > elseif string.find('[]{}():=', c) then + > elseif string.pos('[]{}():=', c) then > -- single-char tokens > return self.chars:read() > elseif c == '"' then > return self:string() > elseif c == '<' then > error('html strings are not implemented yet') - > elseif string.find('-.0123456789', c) then + > elseif string.pos('-.0123456789', c) then > return self:numeral() > elseif string.match(c, '[%a_]') then > return self:identifier() @@ -571,7 +575,7 @@ > break -- end of chars > elseif string.match(c, '%s') then > self.chars:read() - > elseif string.match(',;', c) then + > elseif string.pos(',;', c) then > self.chars:read() > elseif c == '#' then > self.chars:read() -- skip @@ -623,7 +627,7 @@ > local c = self.chars.peek > if c == nil then > return result - > elseif string.find('-.0123456789', c) then + > elseif string.pos('-.0123456789', c) then > result = result..self.chars:read() > else > break diff --git a/life.tlv b/life.tlv index 836c5f3..96f5451 100644 --- a/life.tlv +++ b/life.tlv @@ -60,6 +60,10 @@ > return s:sub(1,pos-1)..s:sub(pos+1) >end > + >function string.pos(s, sub) + > return string.find(s, sub, 1, true) -- plain=true to disable regular expressions + >end + > >-- TODO: backport utf-8 support from Lua 5.3 - __teliva_timestamp: original debugy: diff --git a/lisp.tlv b/lisp.tlv index 1165cc6..ccda0d9 100644 --- a/lisp.tlv +++ b/lisp.tlv @@ -60,6 +60,10 @@ > return s:sub(1,pos-1)..s:sub(pos+1) >end > + >function string.pos(s, sub) + > return string.find(s, sub, 1, true) -- plain=true to disable regular expressions + >end + > >-- TODO: backport utf-8 support from Lua 5.3 - __teliva_timestamp: original debugy: diff --git a/template.tlv b/template.tlv index 2387368..70a4a24 100644 --- a/template.tlv +++ b/template.tlv @@ -60,6 +60,10 @@ > return s:sub(1,pos-1)..s:sub(pos+1) >end > + >function string.pos(s, sub) + > return string.find(s, sub, 1, true) -- plain=true to disable regular expressions + >end + > >-- TODO: backport utf-8 support from Lua 5.3 - __teliva_timestamp: original debugy: diff --git a/toot-toot.tlv b/toot-toot.tlv index 8f224c4..5d90789 100644 --- a/toot-toot.tlv +++ b/toot-toot.tlv @@ -60,6 +60,10 @@ > return s:sub(1,pos-1)..s:sub(pos+1) >end > + >function string.pos(s, sub) + > return string.find(s, sub, 1, true) -- plain=true to disable regular expressions + >end + > >-- TODO: backport utf-8 support from Lua 5.3 - __teliva_timestamp: original debugy: diff --git a/zet.tlv b/zet.tlv index 184cf92..decce6d 100644 --- a/zet.tlv +++ b/zet.tlv @@ -60,6 +60,10 @@ > return s:sub(1,pos-1)..s:sub(pos+1) >end > + >function string.pos(s, sub) + > return string.find(s, sub, 1, true) -- plain=true to disable regular expressions + >end + > >-- TODO: backport utf-8 support from Lua 5.3 - __teliva_timestamp: original debugy: