UNPKG

@ciao-lang/ts-ciao-interface

Version:

Simple Ciao interface for node.

45 lines 9.62 kB
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>String processing &mdash; The Ciao System v1.22</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">&#9776;</span></a><div id="sidebar" class="lpdoc-sidebar"><div style="height: 40px; margin-left: auto; margin-right: auto"><img src="ciao-logo_autofig.png" width=auto height=100%></div><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="DataStructuresAlgs.html">&#x2191;</a><a class="lpdoc-navbutton" href="numlists.html">&#x2190;</a><a class="lpdoc-navbutton" href="fuzzy_search.html">&#x2192;</a><a class="lpdoc-navbutton" href="ciaosearch.html">&#x1F50D;</a></span><span><a href="ciaofulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciao.html">The Ciao System</a> &raquo;<br/> </li><li><a href="DataStructuresAlgs.html">PART VI - Data structures and algorithms</a> &raquo;<br/> </li><li><a href=""><strong>String processing</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>String processing</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#strings"></a> <strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Daniel Cabeza" href="ciaosearch.html#Daniel Cabeza">Daniel Cabeza</a>.<p> This module provides some string-related predicates, specially for including in grammars defining strings.<br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_module(library(strings)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="0" href="#whitespace/2"><tt>whitespace/2</tt></a>, <a class="lpdoc-idx-anchor" id="1" href="#whitespace0/2"><tt>whitespace0/2</tt></a>, <a class="lpdoc-idx-anchor" id="2" href="#string/3"><tt>string/3</tt></a>. </ul></ul></div></div><div id="Documentation on exports"><h2>Documentation on exports</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="whitespace/2" href="ciaosearch.html#whitespace/2">whitespace/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>whitespace(String,Rest)</tt> </span><p>In a grammar rule, as <tt>whitespace/0</tt>, represents whitespace (a positive number of space (32), tab (9), newline (10) or return (13) characters). Thus, <span class="lpdoc-var">Rest</span> is a proper suffix of <span class="lpdoc-var">String</span> with one or more whitespace characters removed. An example of use would be: <pre class="lpdoc-codeblock"> attrs([]) --&gt; &quot;&quot; attrs([N|Ns]) --&gt; whitespace, attr(N), attrs(Ns). </pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>whitespace(S1,S2)</tt> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="3" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">S1</span> is a string (a list of character codes). </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="4" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">S2</span> is a string (a list of character codes). </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="whitespace0/2" href="ciaosearch.html#whitespace0/2">whitespace0/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>whitespace0(String,Rest)</tt> </span><p>In a grammar rule, as <tt>whitespace0/0</tt>, represents possible whitespace (any number of space (32), tab (9), newline (10) or return (13) characters). Thus, <span class="lpdoc-var">Rest</span> is <span class="lpdoc-var">String</span> or a proper suffix of <span class="lpdoc-var">String</span> with one or more whitespace characters removed. An example of use would be:<p><pre class="lpdoc-codeblock"> assignment(N,V) --&gt; variable_name(N), whitespace0, &quot;=&quot;, whitespace0, value(V). </pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>whitespace0(S1,S2)</tt> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="5" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">S1</span> is a string (a list of character codes). </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="6" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">S2</span> is a string (a list of character codes). </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="string/3" href="ciaosearch.html#string/3">string/3</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>string(String,Head,Tail)</tt> </span><p>In a <a class="lpdoc-idx-anchor" id="7" href="ciaosearch.html#grammar rule">grammar rule</a>, as <tt>string/1</tt>, represents literally <span class="lpdoc-var">String</span>. An example of use would be:<p><pre class="lpdoc-codeblock">double(A) --&gt; string(A), string(A). </pre> <p><span class="lpdoc-usage-header">Usage 1:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>Call and exit should be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="8" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">String</span> is a string (a list of character codes). </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="9" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">Head</span> is a string (a list of character codes). </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="10" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">Tail</span> is a string (a list of character codes). </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="11" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">String</span> is a string (a list of character codes). </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="12" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">Head</span> is a string (a list of character codes). </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="13" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">Tail</span> is a string (a list of character codes). </span> </ul><p><span class="lpdoc-usage-header">Usage 2:</span><span class="lpdoc-usage-decl"><tt>string(A,B,C)</tt> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="14" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">C</span> is a list. </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="15" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">A</span> is a list. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="16" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">B</span> is a list. </span> </ul></div></div><p> </div><div id="Documentation on imports"><h2>Documentation on imports</h2>This module has the following direct dependencies:<ul class="lpdoc-itemize-minus"><li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="17" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="18" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="19" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="20" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="21" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="22" href="isomodes_doc.html"><tt>isomodes</tt></a>. </ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>