From d91a200be020d4032e386373acdc8dc76fba5b3e Mon Sep 17 00:00:00 2001 From: Pete Lomax Date: Wed, 12 Jun 2024 06:34:47 +0100 Subject: [PATCH] add phix support (#16) --- README.md | 1 + languages.json | 8 ++++++++ tests/data/phix.e | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 tests/data/phix.e diff --git a/README.md b/README.md index 79d373f52..5cfa88d78 100644 --- a/README.md +++ b/README.md @@ -476,6 +476,7 @@ Perl Perl6 Pest Smalltalk +Phix Php Poke Polly diff --git a/languages.json b/languages.json index 6b0e64821..0f142f02c 100644 --- a/languages.json +++ b/languages.json @@ -1148,6 +1148,14 @@ "quotes": [["\\\"", "\\\""], ["'", "'"]], "extensions": ["pest"] }, + "Phix": { + "line_comment": ["--", "//", "#!"], + "multi_line_comments": [["/*", "*/"], ["--/*", "--*/"]], + "nested": true, + "quotes": [["\\\"", "\\\""], ["'", "'"]], + "verbatim_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["`", "`"]], + "extensions": ["e","exw"] + }, "Php": { "name": "PHP", "line_comment": ["#", "//"], diff --git a/tests/data/phix.e b/tests/data/phix.e new file mode 100644 index 000000000..71502b8c9 --- /dev/null +++ b/tests/data/phix.e @@ -0,0 +1,40 @@ +/* 40 lines 25 code 8 comments 7 blanks */ + +-- copied from cpp, not necessarily idiomatic Euphoria code + +include std/sequence.e + +-- bubble_sort_function +public function bubble_sort(sequence a) + integer t = 0 + integer j = length(a) + integer s = 1 + while s > 0 do + s = 0 + integer i = 2 + while i <= j do + if a[i] < a[i - 1] then + t = a[i] + a[i] = a[i - 1] + a[i - 1] = t + s = 1 + end if + i += 1 + end while + j -= 1 + end while + return a +end function + +sequence a = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1} + +-- Single line comment +? {"Before:", a} + +a = bubble_sort(a) + +/* multi + * line + * comment + */ +? {"After:", a, equal(a, {-31,0,1,2,2,4,65,83,99,782})}