Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ada support #949

Closed
wants to merge 16 commits into from
Closed
19 changes: 19 additions & 0 deletions components.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,25 @@ var components = {
"require": "javascript",
"owner": "Golmote"
},
"ada83": {
"title": "Ada83",
"owner": "laguest"
},
"ada95": {
"title": "Ada95",
"require": "ada83",
"owner": "laguest"
},
"ada2005": {
"title": "Ada2005",
"require": "ada95",
"owner": "laguest"
},
"ada2012": {
"title": "Ada2012",
"require": "ada2005",
"owner": "laguest"
},
"apacheconf": {
"title": "Apache Configuration",
"owner": "GuiTeK"
Expand Down
8 changes: 8 additions & 0 deletions components/prism-ada2005.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Ada 2005
* Written Luke A. Guest
'string': /(\'|\")(\\?.)*?\1/,
*/
Prism.languages.ada2005 = Prism.languages.extend('ada95', {
'keyword': /\b(abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|new|return|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|interface|is|limited|loop|mod|not|null|of|others|out|overriding|package|pragma|private|procedure|protected|raise|range|record|rem|renames|requeue|reverse|select|separate|subtype|synchronized|tagged|task|terminate|then|type|until|use|when|while|with|xor)\b/i,
});
8 changes: 8 additions & 0 deletions components/prism-ada2012.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Ada 2012
* Written Luke A. Guest
'string': /(\'|\")(\\?.)*?\1/,
*/
Prism.languages.ada2012 = Prism.languages.extend('ada2005', {
'keyword': /\b(abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|new|return|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|interface|is|limited|loop|mod|not|null|of|others|out|overriding|package|pragma|private|procedure|protected|raise|range|record|rem|renames|requeue|reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until|use|when|while|with|xor)\b/i,
});
24 changes: 24 additions & 0 deletions components/prism-ada83.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Ada83
* Written Luke A. Guest
'string': /(\'|\")(\\?.)*?\1/,
*/
Prism.languages.ada83 = {
'comment': /--.*/,
'string': /"(""|[^\"\r\f\n])*?"/i,
'number': [
{
pattern: /\b[0-9](_?[0-9])*#[0-9A-F](_?[0-9A-F])*(\.[0-9A-F](_?[0-9A-F])*)?#(([eE][+]?[0-9](_?[0-9])*)|([eE][+]?[0-9](_?[0-9])*))?/i
},
{
pattern: /\b[0-9](_?[0-9])*(\.[0-9](_?[0-9])*)?(([eE][+]?[0-9](_?[0-9])*)|([eE]-[0-9](_?[0-9])*))?\b/
}
],
'attribute': /\b\'\w+/i,
'keyword': /\b(abort|abs|accept|access|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|new|return|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|is|limited|loop|mod|not|null|of|others|out|package|pragma|private|procedure|raise|range|record|rem|renames|reverse|select|separate|subtype|task|terminate|then|type|use|when|while|with|xor)\b/i,
'boolean': /\b(true|false)\b/i,
'operator': /<>|=>|&|:=|<=|>=|<|>/i,
'punctuation': /\.(\.?)|[,;():]/,
'char': /'.'/,
'variable': /\b[a-zA-Z](_|[a-zA-Z0-9])*\b/i
};
8 changes: 8 additions & 0 deletions components/prism-ada95.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Ada95
* Written Luke A. Guest
'string': /(\'|\")(\\?.)*?\1/,
*/
Prism.languages.ada95 = Prism.languages.extend('ada83', {
'keyword': /\b(abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|new|return|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|is|limited|loop|mod|not|null|of|others|out|package|pragma|private|procedure|protected|raise|range|record|rem|renames|requeue|reverse|select|separate|subtype|tagged|task|terminate|then|type|until|use|when|while|with|xor)\b/i,
});
30 changes: 30 additions & 0 deletions examples/prism-ada2005.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<h1>Ada 2005</h1>
<p>To use this language, use the class "language-ada2005".</p>

<h2>Strings</h2>
<pre><code>"foo ""bar"" baz"
"Multi-line strings are appended with a " &
"ampersand symbole."</code></pre>

<h2>Full example</h2>
<pre><code>package A is
type I is new interface;
end A;

with Ada.Text_IO; Use Ada.Text_IO;

-- Comments look like this.
procedure Test is
procedure Bah;
pragma Import (C, "Bah", "bah");

type Things is range 1 .. 10;
begin
Put_Line ("Hello"); -- Comments look like this.

Bah; -- Call C function.

for Index in Things'Range loop
null;
end loop;
end Test;</code></pre>
28 changes: 28 additions & 0 deletions examples/prism-ada2012.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<h1>Ada 2012</h1>
<p>To use this language, use the class "language-ada2012".</p>

<h2>Strings</h2>
<pre><code>"foo ""bar"" baz"
"Multi-line strings are appended with a " &
"ampersand symbole."</code></pre>

<h2>Full example</h2>
<pre><code>with Ada.Text_IO; Use Ada.Text_IO;

-- Comments look like this.
procedure Test is
procedure Bah with
Import => True, -- Shows the new aspect feature of the language.
Convention => C,
External_Name => "bah";

type Things is range 1 .. 10;
begin
Put_Line ("Hello"); -- Comments look like this.

Bah; -- Call C function.

for Index in Things'Range loop
null;
end loop;
end Test;</code></pre>
28 changes: 28 additions & 0 deletions examples/prism-ada83.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<h1>Ada83</h1>
<p>To use this language, use the class "language-ada83".</p>

<h2>Strings</h2>
<pre><code>"foo ""bar"" baz"
"Multi-line strings are appended with a " &
"ampersand symbole."</code></pre>

<h2>Full example</h2>
<pre><code>WITH ADA.TEXT_IO;

-- Comments look like this.

PROCEDURE TEST IS
BEGIN
ADA.TEXT_IO.PUT_LINE ("Hello"); -- Comments look like this.
END TEST;</code></pre>

<p>The code doesn't have to be in uppercase, but coding standards being as they were in 1983, any code you're likely to
come across will be uppercase.</p>

<pre><code>with Ada.Text_IO;

-- Comments look like this.
procedure Test is
begin
Ada.Text_IO.Put_Line ("Hello"); -- Comments look like this.
end Test;</code></pre>
26 changes: 26 additions & 0 deletions examples/prism-ada95.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<h1>Ada95</h1>
<p>To use this language, use the class "language-ada95".</p>

<h2>Strings</h2>
<pre><code>"foo """bar""" baz"
"Multi-line strings are appended with a " &
"ampersand symbole."</code></pre>

<h2>Full example</h2>
<pre><code>with Ada.Text_IO; Use Ada.Text_IO;

-- Comments look like this.
procedure Test is
procedure Bah;
pragma Import (C, "Bah", "bah");

type Things is range 1 .. 10;
begin
Put_Line ("Hello"); -- Comments look like this.

Bah; -- Call C function.

for Index in Things'Range loop
null;
end loop;
end Test;</code></pre>
4 changes: 4 additions & 0 deletions themes/prism.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ pre[class*="language-"] {
color: #07a;
}

.token.attribute {
color: #005980;
}

.token.function {
color: #DD4A68;
}
Expand Down