-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Ada (generic). Closes #949
- Loading branch information
Showing
13 changed files
with
337 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Prism.languages.ada = { | ||
'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])*)?#(?:E[+-]?[0-9](?:_?[0-9])*)?/i | ||
}, | ||
{ | ||
pattern: /\b[0-9](?:_?[0-9])*(?:\.[0-9](?:_?[0-9])*)?(?:E[+-]?[0-9](?:_?[0-9])*)?\b/i | ||
} | ||
], | ||
'attr-name': /\b'\w+/i, | ||
'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, | ||
'boolean': /\b(?:true|false)\b/i, | ||
'operator': /<[=>]?|>=?|=>?|:=|\/=?|\*\*?|[&+-]/, | ||
'punctuation': /\.\.?|[,;():]/, | ||
'char': /'.'/, | ||
'variable': /\b[a-z](?:[_a-z\d])*\b/i | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<h1>Ada</h1> | ||
<p>To use this language, use the class "language-ada".</p> | ||
|
||
<h2>Strings</h2> | ||
<pre><code>"foo ""bar"" baz" | ||
"Multi-line strings are appended with a " & | ||
"ampersand symbole."</code></pre> | ||
|
||
<h2>Ada83 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> | ||
|
||
<h2>Ada 2012 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Integer'Size | ||
Character'Val | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["variable", "Integer"], ["attr-name", "'Size"], | ||
["variable", "Character"], ["attr-name", "'Val"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for attributes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
true | ||
false | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["boolean", "true"], | ||
["boolean", "false"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for booleans. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'f' | ||
'A' | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["char", "'f'"], | ||
["char", "'A'"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for chars. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- | ||
-- Foo bar | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["comment", "--"], | ||
["comment", "-- Foo bar"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
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 | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "abort"], | ||
["keyword", "abs"], | ||
["keyword", "abstract"], | ||
["keyword", "accept"], | ||
["keyword", "access"], | ||
["keyword", "aliased"], | ||
["keyword", "all"], | ||
["keyword", "and"], | ||
["keyword", "array"], | ||
["keyword", "at"], | ||
["keyword", "begin"], | ||
["keyword", "body"], | ||
["keyword", "case"], | ||
["keyword", "constant"], | ||
["keyword", "declare"], | ||
["keyword", "delay"], | ||
["keyword", "delta"], | ||
["keyword", "digits"], | ||
["keyword", "do"], | ||
["keyword", "else"], | ||
["keyword", "new"], | ||
["keyword", "return"], | ||
["keyword", "elsif"], | ||
["keyword", "end"], | ||
["keyword", "entry"], | ||
["keyword", "exception"], | ||
["keyword", "exit"], | ||
["keyword", "for"], | ||
["keyword", "function"], | ||
["keyword", "generic"], | ||
["keyword", "goto"], | ||
["keyword", "if"], | ||
["keyword", "in"], | ||
["keyword", "interface"], | ||
["keyword", "is"], | ||
["keyword", "limited"], | ||
["keyword", "loop"], | ||
["keyword", "mod"], | ||
["keyword", "not"], | ||
["keyword", "null"], | ||
["keyword", "of"], | ||
["keyword", "others"], | ||
["keyword", "out"], | ||
["keyword", "overriding"], | ||
["keyword", "package"], | ||
["keyword", "pragma"], | ||
["keyword", "private"], | ||
["keyword", "procedure"], | ||
["keyword", "protected"], | ||
["keyword", "raise"], | ||
["keyword", "range"], | ||
["keyword", "record"], | ||
["keyword", "rem"], | ||
["keyword", "renames"], | ||
["keyword", "requeue"], | ||
["keyword", "reverse"], | ||
["keyword", "select"], | ||
["keyword", "separate"], | ||
["keyword", "some"], | ||
["keyword", "subtype"], | ||
["keyword", "synchronized"], | ||
["keyword", "tagged"], | ||
["keyword", "task"], | ||
["keyword", "terminate"], | ||
["keyword", "then"], | ||
["keyword", "type"], | ||
["keyword", "until"], | ||
["keyword", "use"], | ||
["keyword", "when"], | ||
["keyword", "while"], | ||
["keyword", "with"], | ||
["keyword", "xor"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for keywords. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
42 | ||
42_000 | ||
3.14_15_9 | ||
0.4E+123_456 | ||
3.7e-7 | ||
1_6#Bad_Face#E-32_1 | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["number", "42"], | ||
["number", "42_000"], | ||
["number", "3.14_15_9"], | ||
["number", "0.4E+123_456"], | ||
["number", "3.7e-7"], | ||
["number", "1_6#Bad_Face#E-32_1"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for numbers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<> | ||
=> := | ||
< <= | ||
> >= | ||
= /= | ||
& + - | ||
* ** / | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["operator", "<>"], | ||
["operator", "=>"], ["operator", ":="], | ||
["operator", "<"], ["operator", "<="], | ||
["operator", ">"], ["operator", ">="], | ||
["operator", "="], ["operator", "/="], | ||
["operator", "&"], ["operator", "+"], ["operator", "-"], | ||
["operator", "*"], ["operator", "**"], ["operator", "/"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for operators. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"" | ||
"Foo""bar""" | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["string", "\"\""], | ||
["string", "\"Foo\"\"bar\"\"\""] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for strings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Byte | ||
foo_bar42 | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["variable", "Byte"], | ||
["variable", "foo_bar42"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for variables. |