CS-Notes/docs/_style/prism-master/examples/prism-prolog.html
2018-12-19 14:09:39 +08:00

45 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h2>Comments</h2>
<pre><code>% This is a comment
/* This is a
multi-line comment */</code></pre>
<h2>Numbers</h2>
<pre><code>42
3.1415</code></pre>
<h2>Strings</h2>
<pre><code>"This is a string."
"This is a string \
on multiple lines."
"A string with \"quotes\" in it."
"Another string with ""quotes"" in it."</code></pre>
<h2>Example</h2>
<pre><code>:- dynamic fibo/2.
fibo(0, 1). fibo(1, 1).
fibo(N, F) :-
N >= 2, N1 is N - 1, N2 is N - 2,
fibo(N1, F1), fibo(N2, F2), F is F1 + F2,
assert(fibo(N,F):-!). % assert as first clause</code></pre>
<h2>Known failures</h2>
<p>There are certain edge cases where Prism will fail.
There are always such cases in every regex-based syntax highlighter.
However, Prism dares to be open and honest about them.
If a failure is listed here, it doesnt mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.
</p>
<h3>Null-ary predicates are not highlighted</h3>
<pre><code>halt.
trace.
:- if(test1).
section_1.
:- elif(test2).
section_2.
:- elif(test3).
section_3.
:- else.
section_else.
:- endif.</code></pre>