about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-18 10:37:29 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-03-18 10:43:48 -0700
commit29d53c21acc746c9e0f20211cb665e731a13bf82 (patch)
tree383e0672015f0c7f60b88a73882f51ac8d9c76e5
parent0374e82aa523c3f64a99aacacbc23eccb5c25404 (diff)
downloadteliva-29d53c21acc746c9e0f20211cb665e731a13bf82.tar.gz
graphviz: don't interpret substrings as regexes
-rw-r--r--anagrams.tlv4
-rw-r--r--break.tlv4
-rw-r--r--gemini.tlv4
-rw-r--r--graphviz.tlv14
-rw-r--r--life.tlv4
-rw-r--r--lisp.tlv4
-rw-r--r--template.tlv4
-rw-r--r--toot-toot.tlv4
-rw-r--r--zet.tlv4
9 files changed, 41 insertions, 5 deletions
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: