@exercism/codemirror-lang-euphoria 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +49 -52
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,67 +1,24 @@
|
|
|
1
1
|
# @exercism/codemirror-lang-euphoria
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[@codincod/codemirror-lang-euphoria](https://codeberg.org/reeven/codemirror-lang-euphoria),
|
|
5
|
-
written by CodinCod. Exercism uses it for Euphoria in the editor on
|
|
6
|
-
[exercism.org](https://exercism.org). Our changes are on the `main`
|
|
7
|
-
branch.
|
|
8
|
-
|
|
9
|
-
The fork adds completion for the names declared in the file, each where it is
|
|
10
|
-
in scope. It also adds snippets, and completion for the public routines, types and constants of
|
|
11
|
-
OpenEuphoria's standard libraries. The common libraries (such as
|
|
12
|
-
`std/sequence.e`, `std/math.e` and `std/text.e`) are always offered. The others
|
|
13
|
-
(such as `std/map.e` and `std/regex.e`) are offered once the file includes
|
|
14
|
-
them. After a namespace such as `map:` or `stdseq:`, or one set with
|
|
15
|
-
`include ... as`, it offers only that library's names, and after `include` it
|
|
16
|
-
offers the library paths. Completion is switched off inside strings and comments, and
|
|
17
|
-
while a new name is being typed. The fork also colours a call through a
|
|
18
|
-
namespace, such as `map:put(...)`, as a call.
|
|
19
|
-
|
|
20
|
-
The package exports `euphoria()` and `phix()` (Phix is a related language that
|
|
21
|
-
the grammar also reads). Both include two completion sources:
|
|
22
|
-
`euphoriaCompletion` (keywords, snippets, built-ins and the standard libraries)
|
|
23
|
-
and `localCompletionSource` (the names declared in the file). The package also
|
|
24
|
-
exports `euphoriaLanguage`, `phixLanguage`, `snippets`, `libraries` and `parser`.
|
|
25
|
-
|
|
26
|
-
## Install
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
npm install @exercism/codemirror-lang-euphoria
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Exercism's Euphoria editor calls `euphoria()`:
|
|
33
|
-
|
|
34
|
-
```javascript
|
|
35
|
-
import {EditorView, basicSetup} from "codemirror"
|
|
36
|
-
import {euphoria} from "@exercism/codemirror-lang-euphoria"
|
|
37
|
-
|
|
38
|
-
new EditorView({
|
|
39
|
-
parent: document.body,
|
|
40
|
-
doc: `include std/io.e\nputs(1, "Hello, World!\\n")\n`,
|
|
41
|
-
extensions: [basicSetup, euphoria()]
|
|
42
|
-
})
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
The rest of this README is upstream's.
|
|
46
|
-
|
|
47
|
-
## @codincod/codemirror-lang-euphoria
|
|
48
|
-
|
|
49
|
-
[ [**CHANGELOG**](https://codeberg.org/reeven/codemirror-lang-euphoria/src/branch/master/CHANGELOG.md) ]
|
|
3
|
+
[ [**CHANGELOG**](CHANGELOG.md) ]
|
|
50
4
|
|
|
51
5
|
This package implements Euphoria and Phix language support for the
|
|
52
6
|
[CodeMirror](https://codemirror.net/) code editor, using a
|
|
53
7
|
[Lezer](https://lezer.codemirror.net/) grammar written for this package.
|
|
8
|
+
Exercism uses it in the Euphoria editor on [exercism.org](https://exercism.org).
|
|
54
9
|
|
|
55
10
|
Neither language had a grammar anywhere. There is no Lezer parser, no
|
|
56
11
|
tree-sitter grammar and no CodeMirror 5 stream mode for either, so a `.exw` file
|
|
57
12
|
in an editor was plain text, or at best the comments and strings a generic
|
|
58
13
|
fallback could find.
|
|
59
14
|
|
|
60
|
-
|
|
61
|
-
platform, where it colours the editor people solve puzzles in.
|
|
15
|
+
This code is released under an [MIT license](LICENSE).
|
|
62
16
|
|
|
63
|
-
|
|
64
|
-
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npm install @exercism/codemirror-lang-euphoria
|
|
21
|
+
```
|
|
65
22
|
|
|
66
23
|
## Usage
|
|
67
24
|
|
|
@@ -92,7 +49,39 @@ end for
|
|
|
92
49
|
```
|
|
93
50
|
|
|
94
51
|
Import `euphoria()` instead for Euphoria. The two are one grammar under two
|
|
95
|
-
dialects;
|
|
52
|
+
dialects; [One package, two languages](#one-package-two-languages) says what
|
|
53
|
+
the dialect decides.
|
|
54
|
+
|
|
55
|
+
Exercism's Euphoria editor calls `euphoria()`:
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
import {EditorView, basicSetup} from "codemirror"
|
|
59
|
+
import {euphoria} from "@exercism/codemirror-lang-euphoria"
|
|
60
|
+
|
|
61
|
+
new EditorView({
|
|
62
|
+
parent: document.body,
|
|
63
|
+
doc: `include std/io.e\nputs(1, "Hello, World!\\n")\n`,
|
|
64
|
+
extensions: [basicSetup, euphoria()]
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Completion
|
|
69
|
+
|
|
70
|
+
Completion offers keywords, snippets and built-ins, and the names declared in
|
|
71
|
+
the file, each where it is in scope. It also offers the public routines, types
|
|
72
|
+
and constants of OpenEuphoria's standard libraries. The common libraries (such
|
|
73
|
+
as `std/sequence.e`, `std/math.e` and `std/text.e`) are always offered. The
|
|
74
|
+
others (such as `std/map.e` and `std/regex.e`) are offered once the file
|
|
75
|
+
includes them. After a namespace such as `map:` or `stdseq:`, or one set with
|
|
76
|
+
`include ... as`, it offers only that library's names, and after `include` it
|
|
77
|
+
offers the library paths. Completion is switched off inside strings and
|
|
78
|
+
comments, and while a new name is being typed.
|
|
79
|
+
|
|
80
|
+
The package exports `euphoria()` and `phix()`. Both include two completion
|
|
81
|
+
sources: `euphoriaCompletion` (keywords, snippets, built-ins and the standard
|
|
82
|
+
libraries) and `localCompletionSource` (the names declared in the file). The
|
|
83
|
+
package also exports `euphoriaLanguage`, `phixLanguage`, `snippets`,
|
|
84
|
+
`libraries` and `parser`.
|
|
96
85
|
|
|
97
86
|
## One package, two languages
|
|
98
87
|
|
|
@@ -231,6 +220,9 @@ conditional operator, and `a?b:c` is both. The conditional wins, because a
|
|
|
231
220
|
branch is rarely a qualified name and a qualified name is common everywhere
|
|
232
221
|
else. Outside a conditional nothing changes: `math:floor(x)` reads as it should.
|
|
233
222
|
|
|
223
|
+
**A call through a namespace is a call.** `map:put(...)` is coloured as a
|
|
224
|
+
call, the same as `put(...)`.
|
|
225
|
+
|
|
234
226
|
## What the tree does not say
|
|
235
227
|
|
|
236
228
|
**A call is not made on a value.** `f(a)(b)` does not parse, because closing the
|
|
@@ -255,3 +247,8 @@ npm install # installs the dependencies and builds the package into dist/
|
|
|
255
247
|
npm run build # regenerates the parser, then rebuilds the package
|
|
256
248
|
npm test # builds the package, then runs the tests
|
|
257
249
|
```
|
|
250
|
+
|
|
251
|
+
## Contributing
|
|
252
|
+
|
|
253
|
+
Please read about how to [contribute to Exercism](https://exercism.org/docs/building).
|
|
254
|
+
Be sure to read the Exercism [Code of Conduct](https://exercism.org/docs/using/legal/code-of-conduct).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exercism/codemirror-lang-euphoria",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Euphoria and Phix language support for the CodeMirror code editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemirror",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"homepage": "https://github.com/exercism/codemirror-lang-euphoria",
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|
|
50
|
-
"url": "https://github.com/exercism/codemirror-lang-euphoria"
|
|
50
|
+
"url": "git+https://github.com/exercism/codemirror-lang-euphoria.git"
|
|
51
51
|
},
|
|
52
52
|
"bugs": {
|
|
53
53
|
"url": "https://github.com/exercism/codemirror-lang-euphoria/issues"
|