UNPKG

@ciao-lang/ts-ciao-interface

Version:

Simple Ciao interface for node.

49 lines 14.1 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>A syntax highlighter &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="ExtraLibs.html">&#x2191;</a><a class="lpdoc-navbutton" href="assrt_write.html">&#x2190;</a><a class="lpdoc-navbutton" href="source_tree.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="ExtraLibs.html">PART VIII - Additional libraries</a> &raquo;<br/> </li><li><a href=""><strong>A syntax highlighter</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>A syntax highlighter</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#syntax_highlight"></a> This module implements a syntax highlighter for different source code languages. Currently it depends on external tools like <a class="lpdoc-idx-anchor" id="0" href="emacs.html"><tt>emacs</tt></a>.<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(syntax_highlight)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="1" href="#can_highlight/1"><tt>can_highlight/1</tt></a>, <a class="lpdoc-idx-anchor" id="2" href="#highlight_file_to_html_string/3"><tt>highlight_file_to_html_string/3</tt></a>, <a class="lpdoc-idx-anchor" id="3" href="#highlight_string_to_html_string/3"><tt>highlight_string_to_html_string/3</tt></a>, <a class="lpdoc-idx-anchor" id="4" href="#highlight_file_to_html_term/3"><tt>highlight_file_to_html_term/3</tt></a>, <a class="lpdoc-idx-anchor" id="5" href="#detect_language/2"><tt>detect_language/2</tt></a>. <li><em>Regular Types:</em><br/><a class="lpdoc-idx-anchor" id="6" href="#lang/1"><tt>lang/1</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">REGTYPE</span><a class="lpdoc-idx-anchor" id="lang/1" href="ciaosearch.html#lang/1">lang/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>lang(L)</tt> </span><p><span class="lpdoc-var">L</span> is a language for syntax highlight</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="can_highlight/1" href="ciaosearch.html#can_highlight/1">can_highlight/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>can_highlight(Lang)</tt> </span><p>Check if <span class="lpdoc-var">Lang</span> is a supported language (silently fails if any dependency for highlighting, e.g., emacs, ciao-mode, is not installed)</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="7" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Lang</span> is an atom. </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="8" href="#lang/1"><tt>syntax_highlight:lang/1</tt></a>)</span><span><span class="lpdoc-var">Lang</span> is a language for syntax highlight </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="highlight_file_to_html_string/3" href="ciaosearch.html#highlight_file_to_html_string/3">highlight_file_to_html_string/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>highlight_file_to_html_string(Lang,Input,Output)</tt> </span><p>Produce HTML <span class="lpdoc-var">Output</span> string with syntax highlight from <span class="lpdoc-var">Input</span> file (see <a class="lpdoc-idx-anchor" id="9" href="ciaosearch.html#highlight_to_html/3"><tt>highlight_to_html/3</tt></a>)</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="10" href="#lang/1"><tt>syntax_highlight:lang/1</tt></a>)</span><span><span class="lpdoc-var">Lang</span> is a language for syntax highlight </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="11" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Input</span> is an atom. </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">Output</span> is a string (a list of character codes). </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="13" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Lang</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="14" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Input</span> is currently a term which is not a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="highlight_string_to_html_string/3" href="ciaosearch.html#highlight_string_to_html_string/3">highlight_string_to_html_string/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>highlight_string_to_html_string(Lang,Input,Output)</tt> </span><p>Produce HTML <span class="lpdoc-var">Output</span> string with syntax highlight from <span class="lpdoc-var">Input</span> string (see <a class="lpdoc-idx-anchor" id="15" href="ciaosearch.html#highlight_to_html/3"><tt>highlight_to_html/3</tt></a>)</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="16" href="#lang/1"><tt>syntax_highlight:lang/1</tt></a>)</span><span><span class="lpdoc-var">Lang</span> is a language for syntax highlight </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="17" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">Input</span> is a string (a list of character codes). </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="18" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">Output</span> is a string (a list of character codes). </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="19" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Lang</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="20" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Input</span> is currently a term which is not a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="highlight_file_to_html_term/3" href="ciaosearch.html#highlight_file_to_html_term/3">highlight_file_to_html_term/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>highlight_file_to_html_term(Lang,Input,Output)</tt> </span><p>Produce HTML <span class="lpdoc-var">Output</span> term with syntax highlight from <span class="lpdoc-var">Input</span> file (see <a class="lpdoc-idx-anchor" id="21" href="ciaosearch.html#highlight_to_html/3"><tt>highlight_to_html/3</tt></a>)</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="22" href="#lang/1"><tt>syntax_highlight:lang/1</tt></a>)</span><span><span class="lpdoc-var">Lang</span> is a language for syntax highlight </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="23" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Input</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="24" href="html.html#html_term/1"><tt>html:html_term/1</tt></a>)</span><span><span class="lpdoc-var">Output</span> is a term representing HTML code. </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="25" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Lang</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="26" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Input</span> is currently a term which is not a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="detect_language/2" href="ciaosearch.html#detect_language/2">detect_language/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>detect_language(File,Lang)</tt> </span><p>Detect language <span class="lpdoc-var">Lang</span> of file <span class="lpdoc-var">File</span> (may look at contents)</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="27" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">File</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="28" href="#lang/1"><tt>syntax_highlight:lang/1</tt></a>)</span><span><span class="lpdoc-var">Lang</span> is a language for syntax highlight </span> <li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="29" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">File</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="30" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Lang</span> is a free variable. </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>System library modules:</em><br/><a class="lpdoc-idx-anchor" id="31" href="datafacts_rt.html"><tt>datafacts_rt</tt></a>, <a class="lpdoc-idx-anchor" id="32" href="lists.html"><tt>lists</tt></a>, <a class="lpdoc-idx-anchor" id="33" href="system.html"><tt>system</tt></a>, <a class="lpdoc-idx-anchor" id="34" href="ciaosearch.html#bundle_paths"><tt>bundle_paths</tt></a>, <a class="lpdoc-idx-anchor" id="35" href="process.html"><tt>process</tt></a>, <a class="lpdoc-idx-anchor" id="36" href="ciaosearch.html#emacs_batch"><tt>emacs_batch</tt></a>, <a class="lpdoc-idx-anchor" id="37" href="system_extra.html"><tt>system_extra</tt></a>, <a class="lpdoc-idx-anchor" id="38" href="port_reify.html"><tt>port_reify</tt></a>, <a class="lpdoc-idx-anchor" id="39" href="stream_utils.html"><tt>stream_utils</tt></a>, <a class="lpdoc-idx-anchor" id="40" href="html.html"><tt>html</tt></a>, <a class="lpdoc-idx-anchor" id="41" href="pathnames.html"><tt>pathnames</tt></a>. <li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="42" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="43" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="44" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="45" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="46" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="47" href="doccomments_doc.html"><tt>doccomments</tt></a>, <a class="lpdoc-idx-anchor" id="48" href="isomodes_doc.html"><tt>isomodes</tt></a>, <a class="lpdoc-idx-anchor" id="49" href="regtypes_doc.html"><tt>regtypes</tt></a>, <a class="lpdoc-idx-anchor" id="50" href="fsyntax_doc.html"><tt>fsyntax</tt></a>, <a class="lpdoc-idx-anchor" id="51" href="datafacts_doc.html"><tt>datafacts</tt></a>. </ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>