sass-site/source/documentation/Sass/Util/MultibyteStringScanner.html
2018-10-22 14:13:05 -07:00

1684 lines
43 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Class: Sass::Util::MultibyteStringScanner
&mdash; Documentation by YARD 0.9.12
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="../../../assets/css/docs.css" type="text/css" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
hasFrames = window.top.frames.main ? true : false;
relpath = '../../';
framesUrl = "../../frames.html#!Sass/Util/MultibyteStringScanner.html";
</script>
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
</head>
<body>
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (M)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../Sass.html" title="Sass (module)">Sass</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Util.html" title="Sass::Util (module)">Util</a></span></span>
&raquo;
<span class="title">MultibyteStringScanner</span>
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
Class List
</a>
<a class="full_list_link" id="method_list_link"
href="../../method_list.html">
Method List
</a>
<a class="full_list_link" id="file_list_link"
href="../../file_list.html">
File List
</a>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Class: Sass::Util::MultibyteStringScanner
</h1>
<dl class="box">
<dt class="r1">Inherits:</dt>
<dd class="r1">
<span class="inheritName">StringScanner</span>
<ul class="fullTree">
<li>Object</li>
<li class="next">StringScanner</li>
<li class="next">Sass::Util::MultibyteStringScanner</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">.ruby-sass/lib/sass/util/multibyte_string_scanner.rb<span class="defines">,<br />
.ruby-sass/lib/sass/util/multibyte_string_scanner.rb,<br /> .ruby-sass/lib/sass/util/multibyte_string_scanner.rb</span>
</dd>
</dl>
<div class="clear"></div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>A wrapper of the native StringScanner class that works correctly with
multibyte character encodings. The native class deals only in bytes, not
characters, for methods like [#pos] and [#matched_size]. This class deals
only in characters, instead.</p>
</div>
</div>
<div class="tags">
</div>
<h2>
Class Method Summary
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#new-class_method" title="new (class method)">.<strong>new</strong>(str) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<h2>
Instance Method Summary
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#byte_matched_size-instance_method" title="#byte_matched_size (instance method)">#<strong>byte_matched_size</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#byte_pos-instance_method" title="#byte_pos (instance method)">#<strong>byte_pos</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#check-instance_method" title="#check (instance method)">#<strong>check</strong>(pattern) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#check_until-instance_method" title="#check_until (instance method)">#<strong>check_until</strong>(pattern) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#get_byte-instance_method" title="#get_byte (instance method)">#<strong>get_byte</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#getbyte-instance_method" title="#getbyte (instance method)">#<strong>getbyte</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#getch-instance_method" title="#getch (instance method)">#<strong>getch</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(str) &#x21d2; MultibyteStringScanner </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>A new instance of MultibyteStringScanner.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#is_a%3F-instance_method" title="#is_a? (instance method)">#<strong>is_a?</strong>(klass) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#match%3F-instance_method" title="#match? (instance method)">#<strong>match?</strong>(pattern) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#matched_size-instance_method" title="#matched_size (instance method)">#<strong>matched_size</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#peek-instance_method" title="#peek (instance method)">#<strong>peek</strong>(len) &#x21d2; Object </a>
(also: #peep)
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#pos-instance_method" title="#pos (instance method)">#<strong>pos</strong> &#x21d2; Object </a>
(also: #pointer)
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#pos=-instance_method" title="#pos= (instance method)">#<strong>pos=</strong>(n) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#reset-instance_method" title="#reset (instance method)">#<strong>reset</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#rest_size-instance_method" title="#rest_size (instance method)">#<strong>rest_size</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#scan-instance_method" title="#scan (instance method)">#<strong>scan</strong>(pattern) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#scan_full-instance_method" title="#scan_full (instance method)">#<strong>scan_full</strong>(pattern, advance_pointer_p, return_string_p) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#scan_until-instance_method" title="#scan_until (instance method)">#<strong>scan_until</strong>(pattern) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#search_full-instance_method" title="#search_full (instance method)">#<strong>search_full</strong>(pattern, advance_pointer_p, return_string_p) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#skip-instance_method" title="#skip (instance method)">#<strong>skip</strong>(pattern) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#skip_until-instance_method" title="#skip_until (instance method)">#<strong>skip_until</strong>(pattern) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#string=-instance_method" title="#string= (instance method)">#<strong>string=</strong>(str) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#terminate-instance_method" title="#terminate (instance method)">#<strong>terminate</strong> &#x21d2; Object </a>
(also: #clear)
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#unscan-instance_method" title="#unscan (instance method)">#<strong>unscan</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(str) &#x21d2; <tt><span class='object_link'><a href="" title="Sass::Util::MultibyteStringScanner (class)">MultibyteStringScanner</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a new instance of MultibyteStringScanner</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
9
10
11
12
13
14</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 9</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
<span class='kw'>super</span><span class='lparen'>(</span><span class='const'>StringScanner</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='ivar'>@mb_pos</span> <span class='op'>=</span> <span class='int'>0</span>
<span class='ivar'>@mb_matched_size</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='ivar'>@mb_last_pos</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(str) &#x21d2; <tt><span class='object_link'><a href="" title="Sass::Util::MultibyteStringScanner (class)">MultibyteStringScanner</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a new instance of MultibyteStringScanner</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
9
10
11
12
13
14</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 9</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
<span class='kw'>super</span><span class='lparen'>(</span><span class='const'>StringScanner</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='ivar'>@mb_pos</span> <span class='op'>=</span> <span class='int'>0</span>
<span class='ivar'>@mb_matched_size</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='ivar'>@mb_last_pos</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="new-class_method">
.<strong>new</strong>(str) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
36
37
38
39</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 36</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='const'>StringScanner</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_ascii_only?'>ascii_only?</span>
<span class='kw'>super</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="byte_matched_size-instance_method">
#<strong>byte_matched_size</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
42</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 42</span>
<span class='id identifier rubyid_alias_method'>alias_method</span> <span class='symbol'>:byte_matched_size</span><span class='comma'>,</span> <span class='symbol'>:matched_size</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="byte_pos-instance_method">
#<strong>byte_pos</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
41</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 41</span>
<span class='id identifier rubyid_alias_method'>alias_method</span> <span class='symbol'>:byte_pos</span><span class='comma'>,</span> <span class='symbol'>:pos</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="check-instance_method">
#<strong>check</strong>(pattern) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
44</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 44</span>
<span class='kw'>def</span> <span class='id identifier rubyid_check'>check</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid__match'>_match</span> <span class='kw'>super</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="check_until-instance_method">
#<strong>check_until</strong>(pattern) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
45</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 45</span>
<span class='kw'>def</span> <span class='id identifier rubyid_check_until'>check_until</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid__matched'>_matched</span> <span class='kw'>super</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="get_byte-instance_method">
#<strong>get_byte</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
59
60
61</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 59</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_byte'>get_byte</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>MultibyteStringScanner doesn&#39;t support #get_byte.</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="getbyte-instance_method">
#<strong>getbyte</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
63
64
65</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 63</span>
<span class='kw'>def</span> <span class='id identifier rubyid_getbyte'>getbyte</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>MultibyteStringScanner doesn&#39;t support #getbyte.</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="getch-instance_method">
#<strong>getch</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
46</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 46</span>
<span class='kw'>def</span> <span class='id identifier rubyid_getch'>getch</span><span class='semicolon'>;</span> <span class='id identifier rubyid__forward'>_forward</span> <span class='id identifier rubyid__match'>_match</span> <span class='kw'>super</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="is_a?-instance_method">
#<strong>is_a?</strong>(klass) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
16
17
18</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 16</span>
<span class='kw'>def</span> <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
<span class='id identifier rubyid___getobj__'>__getobj__</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='kw'>super</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="match?-instance_method">
#<strong>match?</strong>(pattern) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
47</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 47</span>
<span class='kw'>def</span> <span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid__size'>_size</span> <span class='id identifier rubyid_check'>check</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="matched_size-instance_method">
#<strong>matched_size</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
48</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 48</span>
<span class='kw'>def</span> <span class='id identifier rubyid_matched_size'>matched_size</span><span class='semicolon'>;</span> <span class='ivar'>@mb_matched_size</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="peek-instance_method">
#<strong>peek</strong>(len) &#x21d2; <tt>Object</tt>
<span class="aliases">Also known as:
<span class="names"><span id='peep-instance_method'>peep</span></span>
</span>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
49</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 49</span>
<span class='kw'>def</span> <span class='id identifier rubyid_peek'>peek</span><span class='lparen'>(</span><span class='id identifier rubyid_len'>len</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid_string'>string</span><span class='lbracket'>[</span><span class='ivar'>@mb_pos</span><span class='comma'>,</span> <span class='id identifier rubyid_len'>len</span><span class='rbracket'>]</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="pos-instance_method">
#<strong>pos</strong> &#x21d2; <tt>Object</tt>
<span class="aliases">Also known as:
<span class="names"><span id='pointer-instance_method'>pointer</span></span>
</span>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
51</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 51</span>
<span class='kw'>def</span> <span class='id identifier rubyid_pos'>pos</span><span class='semicolon'>;</span> <span class='ivar'>@mb_pos</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="pos=-instance_method">
#<strong>pos=</strong>(n) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 67</span>
<span class='kw'>def</span> <span class='id identifier rubyid_pos='>pos=</span><span class='lparen'>(</span><span class='id identifier rubyid_n'>n</span><span class='rparen'>)</span>
<span class='ivar'>@mb_last_pos</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='comment'># We set position kind of a lot during parsing, so we want it to be as
</span> <span class='comment'># efficient as possible. This is complicated by the fact that UTF-8 is a
</span> <span class='comment'># variable-length encoding, so it&#39;s difficult to find the byte length that
</span> <span class='comment'># corresponds to a given character length.
</span> <span class='comment'>#
</span> <span class='comment'># Our heuristic here is to try to count the fewest possible characters. So
</span> <span class='comment'># if the new position is close to the current one, just count the
</span> <span class='comment'># characters between the two; if the new position is closer to the
</span> <span class='comment'># beginning of the string, just count the characters from there.
</span> <span class='kw'>if</span> <span class='ivar'>@mb_pos</span> <span class='op'>-</span> <span class='id identifier rubyid_n'>n</span> <span class='op'>&lt;</span> <span class='ivar'>@mb_pos</span> <span class='op'>/</span> <span class='int'>2</span>
<span class='comment'># New position is close to old position
</span> <span class='id identifier rubyid_byte_delta'>byte_delta</span> <span class='op'>=</span> <span class='ivar'>@mb_pos</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_n'>n</span> <span class='op'>?</span> <span class='op'>-</span><span class='id identifier rubyid_string'>string</span><span class='lbracket'>[</span><span class='id identifier rubyid_n'>n</span><span class='op'>...</span><span class='ivar'>@mb_pos</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_bytesize'>bytesize</span> <span class='op'>:</span> <span class='id identifier rubyid_string'>string</span><span class='lbracket'>[</span><span class='ivar'>@mb_pos</span><span class='op'>...</span><span class='id identifier rubyid_n'>n</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_bytesize'>bytesize</span>
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_byte_pos'>byte_pos</span> <span class='op'>+</span> <span class='id identifier rubyid_byte_delta'>byte_delta</span><span class='rparen'>)</span>
<span class='kw'>else</span>
<span class='comment'># New position is close to BOS
</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_string'>string</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>...</span><span class='id identifier rubyid_n'>n</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_bytesize'>bytesize</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='ivar'>@mb_pos</span> <span class='op'>=</span> <span class='id identifier rubyid_n'>n</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="reset-instance_method">
#<strong>reset</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
90
91
92
93
94
95</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 90</span>
<span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span>
<span class='ivar'>@mb_pos</span> <span class='op'>=</span> <span class='int'>0</span>
<span class='ivar'>@mb_matched_size</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='ivar'>@mb_last_pos</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>super</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="rest_size-instance_method">
#<strong>rest_size</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
53</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 53</span>
<span class='kw'>def</span> <span class='id identifier rubyid_rest_size'>rest_size</span><span class='semicolon'>;</span> <span class='id identifier rubyid_rest'>rest</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="scan-instance_method">
#<strong>scan</strong>(pattern) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
54</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 54</span>
<span class='kw'>def</span> <span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid__forward'>_forward</span> <span class='id identifier rubyid__match'>_match</span> <span class='kw'>super</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="scan_full-instance_method">
#<strong>scan_full</strong>(pattern, advance_pointer_p, return_string_p) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
97
98
99
100
101</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 97</span>
<span class='kw'>def</span> <span class='id identifier rubyid_scan_full'>scan_full</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='id identifier rubyid_advance_pointer_p'>advance_pointer_p</span><span class='comma'>,</span> <span class='id identifier rubyid_return_string_p'>return_string_p</span><span class='rparen'>)</span>
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid__match'>_match</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='id identifier rubyid_advance_pointer_p'>advance_pointer_p</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
<span class='id identifier rubyid__forward'>_forward</span> <span class='id identifier rubyid_res'>res</span> <span class='kw'>if</span> <span class='id identifier rubyid_advance_pointer_p'>advance_pointer_p</span>
<span class='kw'>return</span> <span class='id identifier rubyid_res'>res</span> <span class='kw'>if</span> <span class='id identifier rubyid_return_string_p'>return_string_p</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="scan_until-instance_method">
#<strong>scan_until</strong>(pattern) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
55</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 55</span>
<span class='kw'>def</span> <span class='id identifier rubyid_scan_until'>scan_until</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid__forward'>_forward</span> <span class='id identifier rubyid__matched'>_matched</span> <span class='kw'>super</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="search_full-instance_method">
#<strong>search_full</strong>(pattern, advance_pointer_p, return_string_p) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
103
104
105
106
107</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 103</span>
<span class='kw'>def</span> <span class='id identifier rubyid_search_full'>search_full</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='id identifier rubyid_advance_pointer_p'>advance_pointer_p</span><span class='comma'>,</span> <span class='id identifier rubyid_return_string_p'>return_string_p</span><span class='rparen'>)</span>
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='id identifier rubyid_advance_pointer_p'>advance_pointer_p</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
<span class='id identifier rubyid__forward'>_forward</span> <span class='id identifier rubyid_res'>res</span> <span class='kw'>if</span> <span class='id identifier rubyid_advance_pointer_p'>advance_pointer_p</span>
<span class='id identifier rubyid__matched'>_matched</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span> <span class='kw'>if</span> <span class='id identifier rubyid_return_string_p'>return_string_p</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="skip-instance_method">
#<strong>skip</strong>(pattern) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
56</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 56</span>
<span class='kw'>def</span> <span class='id identifier rubyid_skip'>skip</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid__size'>_size</span> <span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="skip_until-instance_method">
#<strong>skip_until</strong>(pattern) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
57</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 57</span>
<span class='kw'>def</span> <span class='id identifier rubyid_skip_until'>skip_until</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid__matched'>_matched</span> <span class='id identifier rubyid__size'>_size</span> <span class='id identifier rubyid_scan_until'>scan_until</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="string=-instance_method">
#<strong>string=</strong>(str) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
109
110
111
112
113
114</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 109</span>
<span class='kw'>def</span> <span class='id identifier rubyid_string='>string=</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
<span class='ivar'>@mb_pos</span> <span class='op'>=</span> <span class='int'>0</span>
<span class='ivar'>@mb_matched_size</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='ivar'>@mb_last_pos</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>super</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="terminate-instance_method">
#<strong>terminate</strong> &#x21d2; <tt>Object</tt>
<span class="aliases">Also known as:
<span class="names"><span id='clear-instance_method'>clear</span></span>
</span>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
116
117
118
119
120
121</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 116</span>
<span class='kw'>def</span> <span class='id identifier rubyid_terminate'>terminate</span>
<span class='ivar'>@mb_pos</span> <span class='op'>=</span> <span class='id identifier rubyid_string'>string</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
<span class='ivar'>@mb_matched_size</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='ivar'>@mb_last_pos</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>super</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="unscan-instance_method">
#<strong>unscan</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
124
125
126
127
128</pre>
</td>
<td>
<pre class="code"><span class="info file"># File '.ruby-sass/lib/sass/util/multibyte_string_scanner.rb', line 124</span>
<span class='kw'>def</span> <span class='id identifier rubyid_unscan'>unscan</span>
<span class='kw'>super</span>
<span class='ivar'>@mb_pos</span> <span class='op'>=</span> <span class='ivar'>@mb_last_pos</span>
<span class='ivar'>@mb_last_pos</span> <span class='op'>=</span> <span class='ivar'>@mb_matched_size</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Oct 22 13:21:00 2018 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.12 (ruby-2.5.3).
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-535380-14', 'sass-lang.com');
ga('send', 'pageview');
</script>
</body>
</html>