<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://onto-wiki.eu/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ALustache%2FScanner</id>
	<title>Module:Lustache/Scanner - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://onto-wiki.eu/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ALustache%2FScanner"/>
	<link rel="alternate" type="text/html" href="https://onto-wiki.eu/w/index.php?title=Module:Lustache/Scanner&amp;action=history"/>
	<updated>2026-05-01T02:56:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://onto-wiki.eu/w/index.php?title=Module:Lustache/Scanner&amp;diff=45&amp;oldid=prev</id>
		<title>Maintenance script: Install package: OSW Core</title>
		<link rel="alternate" type="text/html" href="https://onto-wiki.eu/w/index.php?title=Module:Lustache/Scanner&amp;diff=45&amp;oldid=prev"/>
		<updated>2023-03-25T05:55:43Z</updated>

		<summary type="html">&lt;p&gt;Install package: OSW Core&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local string_find, string_match, string_sub =&lt;br /&gt;
      string.find, string.match, string.sub&lt;br /&gt;
&lt;br /&gt;
local scanner = {}&lt;br /&gt;
&lt;br /&gt;
-- Returns `true` if the tail is empty (end of string).&lt;br /&gt;
function scanner:eos()&lt;br /&gt;
  return self.tail == &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Tries to match the given regular expression at the current position.&lt;br /&gt;
-- Returns the matched text if it can match, `null` otherwise.&lt;br /&gt;
function scanner:scan(pattern)&lt;br /&gt;
  local match = string_match(self.tail, pattern)&lt;br /&gt;
&lt;br /&gt;
  if match and string_find(self.tail, pattern) == 1 then&lt;br /&gt;
    self.tail = string_sub(self.tail, #match + 1)&lt;br /&gt;
    self.pos = self.pos + #match&lt;br /&gt;
&lt;br /&gt;
    return match&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Skips all text until the given regular expression can be matched. Returns&lt;br /&gt;
-- the skipped string, which is the entire tail of this scanner if no match&lt;br /&gt;
-- can be made.&lt;br /&gt;
function scanner:scan_until(pattern)&lt;br /&gt;
&lt;br /&gt;
  local match&lt;br /&gt;
  local pos = string_find(self.tail, pattern)&lt;br /&gt;
&lt;br /&gt;
  if pos == nil then&lt;br /&gt;
    match = self.tail&lt;br /&gt;
    self.pos = self.pos + #self.tail&lt;br /&gt;
    self.tail = &amp;quot;&amp;quot;&lt;br /&gt;
  elseif pos == 1 then&lt;br /&gt;
    match = nil&lt;br /&gt;
  else&lt;br /&gt;
    match = string_sub(self.tail, 1, pos - 1)&lt;br /&gt;
    self.tail = string_sub(self.tail, pos)&lt;br /&gt;
    self.pos = self.pos + #match&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  return match&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function scanner:new(str)&lt;br /&gt;
  local out = {&lt;br /&gt;
    str  = str,&lt;br /&gt;
    tail = str,&lt;br /&gt;
    pos  = 1&lt;br /&gt;
  }&lt;br /&gt;
  return setmetatable(out, { __index = self } )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return scanner&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>