Add a Perl syntax highlighting mode.
This commit is contained in:
parent
376d8d2ebe
commit
2d1dda867a
4 changed files with 333 additions and 5 deletions
46
index.html
46
index.html
|
|
@ -23,6 +23,7 @@
|
|||
<option value="ruby">Ruby Document</option>
|
||||
<option value="c_cpp">C++ Document</option>
|
||||
<option value="coffee">CoffeeScript Document</option>
|
||||
<option value="perl">Perl Document</option>
|
||||
<option value="plain">Text Document</option>
|
||||
</select>
|
||||
</td>
|
||||
|
|
@ -80,6 +81,7 @@
|
|||
<option value="ruby">Ruby</option>
|
||||
<option value="c_cpp">C/C++</option>
|
||||
<option value="coffee">CoffeeScript</option>
|
||||
<option value="perl">Perl</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
|
|
@ -150,16 +152,16 @@
|
|||
</html></script>
|
||||
|
||||
<script type="text/editor" id="javatext">public class InfiniteLoop {
|
||||
|
||||
|
||||
/*
|
||||
* This will cause the program to hang...
|
||||
*
|
||||
*
|
||||
* Taken from:
|
||||
* http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
double d = Double.parseDouble("2.2250738585072012e-308");
|
||||
|
||||
|
||||
// unreachable code
|
||||
System.out.println("Value: " + d);
|
||||
}
|
||||
|
|
@ -219,7 +221,7 @@ At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergr
|
|||
</script>
|
||||
|
||||
<script type="text/editor" id="rubytext">#!/usr/bin/ruby
|
||||
|
||||
|
||||
# Program to find the factorial of a number
|
||||
def fact(n)
|
||||
if n == 0
|
||||
|
|
@ -270,6 +272,42 @@ do ->
|
|||
|
||||
var illegal</script>
|
||||
|
||||
<script type="text/editor" id="perltext">
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
my $num_primes = 0;
|
||||
my @primes;
|
||||
|
||||
# Put 2 as the first prime so we won't have an empty array
|
||||
$primes[$num_primes] = 2;
|
||||
$num_primes++;
|
||||
|
||||
MAIN_LOOP:
|
||||
for my $number_to_check (3 .. 200)
|
||||
{
|
||||
for my $p (0 .. ($num_primes-1))
|
||||
{
|
||||
if ($number_to_check % $primes[$p] == 0)
|
||||
{
|
||||
next MAIN_LOOP;
|
||||
}
|
||||
}
|
||||
|
||||
# If we reached this point it means $number_to_check is not
|
||||
# divisable by any prime number that came before it.
|
||||
$primes[$num_primes] = $number_to_check;
|
||||
$num_primes++;
|
||||
}
|
||||
|
||||
for my $p (0 .. ($num_primes-1))
|
||||
{
|
||||
print $primes[$p], ", ";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
</script>
|
||||
|
||||
<input id="cockpitInput" type="text"/>
|
||||
|
||||
<script src="demo/require.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue