Skip to content

Commit 4faf752

Browse files
authored
Add Phix (#1167)
1 parent 2b1752e commit 4faf752

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ Pascal
485485
Perl
486486
Perl6
487487
Pest
488+
Phix
488489
Php
489490
Po
490491
Poke

languages.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,14 @@
12301230
"quotes": [["\\\"", "\\\""], ["'", "'"]],
12311231
"extensions": ["pest"]
12321232
},
1233+
"Phix": {
1234+
"line_comment": ["--", "//", "#!"],
1235+
"multi_line_comments": [["/*", "*/"], ["--/*", "--*/"]],
1236+
"nested": true,
1237+
"quotes": [["\\\"", "\\\""], ["'", "'"]],
1238+
"verbatim_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["`", "`"]],
1239+
"extensions": ["e","exw"]
1240+
},
12331241
"Php": {
12341242
"name": "PHP",
12351243
"line_comment": ["#", "//"],

tests/data/phix.e

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* 40 lines 25 code 8 comments 7 blanks */
2+
3+
-- copied from cpp, not necessarily idiomatic Euphoria code
4+
5+
include std/sequence.e
6+
7+
-- bubble_sort_function
8+
public function bubble_sort(sequence a)
9+
integer t = 0
10+
integer j = length(a)
11+
integer s = 1
12+
while s > 0 do
13+
s = 0
14+
integer i = 2
15+
while i <= j do
16+
if a[i] < a[i - 1] then
17+
t = a[i]
18+
a[i] = a[i - 1]
19+
a[i - 1] = t
20+
s = 1
21+
end if
22+
i += 1
23+
end while
24+
j -= 1
25+
end while
26+
return a
27+
end function
28+
29+
sequence a = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1}
30+
31+
-- Single line comment
32+
? {"Before:", a}
33+
34+
a = bubble_sort(a)
35+
36+
/* multi
37+
* line
38+
* comment
39+
*/
40+
? {"After:", a, equal(a, {-31,0,1,2,2,4,65,83,99,782})}

0 commit comments

Comments
 (0)