@exercism/codemirror-lang-lisp 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +80 -83
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.1
2
+
3
+ The README is restructured. This release is the first published from GitHub Actions, with npm provenance.
4
+
1
5
  # Changelog
2
6
 
3
7
  ## 1.0.0
package/README.md CHANGED
@@ -1,54 +1,44 @@
1
1
  # @exercism/codemirror-lang-lisp [![NPM version](https://img.shields.io/npm/v/@exercism/codemirror-lang-lisp.svg)](https://www.npmjs.org/package/@exercism/codemirror-lang-lisp)
2
2
 
3
- ## This fork
3
+ [ [**CHANGELOG**](CHANGELOG.md) ]
4
4
 
5
- This is Exercism's fork of
6
- [`@codincod/codemirror-lang-lisp`](https://codeberg.org/reeven/codemirror-lang-lisp)
7
- by CodinCod, released under the MIT license. Exercism uses it in the Common
8
- Lisp, Emacs Lisp and Lisp Flavoured Erlang (LFE) editors on
9
- [exercism.org](https://exercism.org). Our
10
- changes are on the `main` branch and are published as
11
- `@exercism/codemirror-lang-lisp`.
5
+ This package implements Lisp language support for the
6
+ [CodeMirror](https://codemirror.net/) code editor, using a
7
+ [Lezer](https://lezer.codemirror.net/) grammar written for this package.
12
8
 
13
- The grammar serves every Lisp dialect. The fork adds these nodes to it:
9
+ One parser serves the family: Common Lisp, Scheme, Racket, Emacs Lisp, and the
10
+ smaller dialects that share their reader. They differ in what the reader does
11
+ before the lists are built, and agree about everything after.
14
12
 
15
- - `LocalName` for a name bound by a parameter list or a binding form, such as
16
- `a` in `(defun f (a) ...)` and `x` in `(let ((x 1)) ...)`.
17
- - `IterationBinder` and `IterationBindings` for `dolist`, `dotimes`,
18
- `with-open-file` and the other forms where the list binds one name and then
19
- holds values. In `(dolist (x items) ...)` only `x` is bound.
20
- - `FunctionBinder`, `FunctionBindings` and `FunctionBinding` for `flet`,
21
- `labels` and `macrolet`.
22
- - `Definer` for `defvar`, `defparameter`, `defconstant`, `defstruct`,
23
- `defclass`, `deftype` and `define-condition`, with the name being defined as a
24
- `Definition`.
25
- - `LambdaKeyword` for `&optional`, `&key`, `&rest` and the other markers in a
26
- parameter list.
13
+ CodeMirror ships Common Lisp and Scheme as CodeMirror 5 stream modes. A stream
14
+ mode colours tokens and stops there. Without a tree there is no structural
15
+ folding, no indentation that knows what a form is, and no node-aware selection.
27
16
 
28
- Each of these nodes also covers the Emacs Lisp forms of the same shape, such as
29
- `cl-defun`, `defsubst`, `when-let*`, `seq-let`, `cl-dolist`, `cl-labels`,
30
- `defconst` and `defcustom`. The grammar reads Emacs Lisp characters (`?a`,
31
- `?\s`, `?\(`, `?\C-a`). Numbers and booleans come from the external
32
- tokenizer, which reads the whole symbol first, so `1+`, `1-` and `#topic` are
33
- symbols.
17
+ Exercism uses this package in the Common Lisp, Emacs Lisp and Lisp Flavoured Erlang
18
+ (LFE) editors on [exercism.org](https://exercism.org).
34
19
 
35
- The grammar has an `lfe` dialect for Lisp Flavoured Erlang. When it is on,
36
- `defun`, `defmacro` and `match-lambda` can be written as clauses, as in
37
- `(defun f ((0) 1) ((n) (* n (f (- n 1)))))`. Each clause is a `Clause` node,
38
- with its patterns in `Patterns` and the constructors in them, such as `(cons
39
- h t)`, in `PatternList`. The names in a pattern are `LocalName`s. `flet`,
40
- `flet*` and `fletrec` define local functions the same way. `defmodule` and
41
- `defrecord` are definers, and `receive`, `after`, `try`, `lc`, `bc` and `fun`
42
- are special forms. In the `lfe` dialect, special forms from the other dialects that LFE
43
- lacks, such as `loop` and `for`, are ordinary names. The external specializer
44
- `lfeWords` in `src/tokens.ts` reads these words when the dialect is on, so the
45
- other dialects are unaffected. In every dialect `#b(` and `#m(`
46
- open a vector, which is how LFE writes binaries and maps.
20
+ This code is released under an [MIT license](LICENSE).
47
21
 
48
- `defgeneric` and `defmethod` are binders, and a method qualifier such as
49
- `:before` may sit between the name and the parameter list. A form's body
50
- indents from its own open bracket, so a form that starts partway along a line
51
- indents correctly.
22
+ ## Install
23
+
24
+ ```
25
+ npm install @exercism/codemirror-lang-lisp
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ```javascript
31
+ import {EditorView, basicSetup} from "codemirror"
32
+ import {commonLisp} from "@exercism/codemirror-lang-lisp"
33
+
34
+ const view = new EditorView({
35
+ parent: document.body,
36
+ doc: `(defun greet (name)\n (format t "hello, ~a~%" name))`,
37
+ extensions: [basicSetup, commonLisp()]
38
+ })
39
+ ```
40
+
41
+ ## Completion
52
42
 
53
43
  The package has one entry point for each dialect, on top of the shared one:
54
44
 
@@ -129,45 +119,6 @@ language to `dialectSupport`. Then export the entry point from
129
119
  `src/index.ts`, and check that every other dialect still parses the example
130
120
  solutions of its Exercism track.
131
121
 
132
- [ [**CHANGELOG**](https://codeberg.org/reeven/codemirror-lang-lisp/src/branch/master/CHANGELOG.md) ]
133
-
134
- This package implements Lisp language support for the
135
- [CodeMirror](https://codemirror.net/) code editor, using a
136
- [Lezer](https://lezer.codemirror.net/) grammar written for this package.
137
-
138
- One parser serves the family: Common Lisp, Scheme, Racket, Emacs Lisp, and the
139
- smaller dialects that share their reader. They differ in what the reader does
140
- before the lists are built, and agree about everything after.
141
-
142
- CodeMirror ships Common Lisp and Scheme as CodeMirror 5 stream modes. A stream
143
- mode colours tokens and stops there. Without a tree there is no structural
144
- folding, no indentation that knows what a form is, and no node-aware selection.
145
-
146
- Written in part for [CodinCod](https://codincod.com/), a competitive coding
147
- platform, where it colours the editor people solve puzzles in.
148
-
149
- This code is released under an
150
- [MIT license](https://codeberg.org/reeven/codemirror-lang-lisp/src/branch/master/LICENSE).
151
-
152
- ## Install
153
-
154
- ```
155
- npm install @exercism/codemirror-lang-lisp
156
- ```
157
-
158
- ## Usage
159
-
160
- ```javascript
161
- import {EditorView, basicSetup} from "codemirror"
162
- import {commonLisp} from "@exercism/codemirror-lang-lisp"
163
-
164
- const view = new EditorView({
165
- parent: document.body,
166
- doc: `(defun greet (name)\n (format t "hello, ~a~%" name))`,
167
- extensions: [basicSetup, commonLisp()]
168
- })
169
- ```
170
-
171
122
  ## Coverage
172
123
 
173
124
  Which reader constructs the grammar carries was decided by counting them across
@@ -204,11 +155,52 @@ names it is passed has most of the file to say it with.
204
155
 
205
156
  Binding forms are known by name, because a parameter list is a list of names
206
157
  and not a call. `(defun f (a b) ...)` gives `f` a `Definition` node and leaves
207
- `a` and `b` as ordinary symbols, where a grammar that only knew about heads
158
+ `a` and `b` as `LocalName`s, where a grammar that only knew about heads
208
159
  would read `a` as a function. Nineteen forms are recognised (`lambda`, `let`
209
160
  and its relatives, `do`, `dolist`, `destructuring-bind` and so on), which is
210
161
  the set whose shape is always "an optional name, then a list of names".
211
162
 
163
+ The grammar serves every Lisp dialect, and has these nodes for the binding
164
+ forms:
165
+
166
+ - `LocalName` for a name bound by a parameter list or a binding form, such as
167
+ `a` in `(defun f (a) ...)` and `x` in `(let ((x 1)) ...)`.
168
+ - `IterationBinder` and `IterationBindings` for `dolist`, `dotimes`,
169
+ `with-open-file` and the other forms where the list binds one name and then
170
+ holds values. In `(dolist (x items) ...)` only `x` is bound.
171
+ - `FunctionBinder`, `FunctionBindings` and `FunctionBinding` for `flet`,
172
+ `labels` and `macrolet`.
173
+ - `Definer` for `defvar`, `defparameter`, `defconstant`, `defstruct`,
174
+ `defclass`, `deftype` and `define-condition`, with the name being defined as a
175
+ `Definition`.
176
+ - `LambdaKeyword` for `&optional`, `&key`, `&rest` and the other markers in a
177
+ parameter list.
178
+
179
+ Each of these nodes also covers the Emacs Lisp forms of the same shape, such as
180
+ `cl-defun`, `defsubst`, `when-let*`, `seq-let`, `cl-dolist`, `cl-labels`,
181
+ `defconst` and `defcustom`. The grammar reads Emacs Lisp characters (`?a`,
182
+ `?\s`, `?\(`, `?\C-a`). Numbers and booleans come from the external
183
+ tokenizer, which reads the whole symbol first, so `1+`, `1-` and `#topic` are
184
+ symbols.
185
+
186
+ The grammar has an `lfe` dialect for Lisp Flavoured Erlang. When it is on,
187
+ `defun`, `defmacro` and `match-lambda` can be written as clauses, as in
188
+ `(defun f ((0) 1) ((n) (* n (f (- n 1)))))`. Each clause is a `Clause` node,
189
+ with its patterns in `Patterns` and the constructors in them, such as `(cons
190
+ h t)`, in `PatternList`. The names in a pattern are `LocalName`s. `flet`,
191
+ `flet*` and `fletrec` define local functions the same way. `defmodule` and
192
+ `defrecord` are definers, and `receive`, `after`, `try`, `lc`, `bc` and `fun`
193
+ are special forms. In the `lfe` dialect, special forms from the other dialects that LFE
194
+ lacks, such as `loop` and `for`, are ordinary names. The external specializer
195
+ `lfeWords` in `src/tokens.ts` reads these words when the dialect is on, so the
196
+ other dialects are unaffected. In every dialect `#b(` and `#m(`
197
+ open a vector, which is how LFE writes binaries and maps.
198
+
199
+ `defgeneric` and `defmethod` are binders, and a method qualifier such as
200
+ `:before` may sit between the name and the parameter list. A form's body
201
+ indents from its own open bracket, so a form that starts partway along a line
202
+ indents correctly.
203
+
212
204
  ## Accuracy
213
205
 
214
206
  Measured against 5590 Rosetta Code snippets. A file counts as clean only when
@@ -323,3 +315,8 @@ and snippets, `lfeModuleFunctions` for the functions after `module:`, and
323
315
  **`parser`**`: LRParser`
324
316
 
325
317
  The raw Lezer parser, for tooling that wants the tree without an editor.
318
+
319
+ ## Contributing
320
+
321
+ Please read about how to [contribute to Exercism](https://exercism.org/docs/building).
322
+ 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-lisp",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Lisp language support for the CodeMirror code editor, with completion for Common Lisp, Emacs Lisp and LFE, as used on Exercism",
5
5
  "keywords": [
6
6
  "editor",
@@ -48,7 +48,7 @@
48
48
  "homepage": "https://github.com/exercism/codemirror-lang-lisp",
49
49
  "repository": {
50
50
  "type": "git",
51
- "url": "https://github.com/exercism/codemirror-lang-lisp"
51
+ "url": "git+https://github.com/exercism/codemirror-lang-lisp.git"
52
52
  },
53
53
  "bugs": {
54
54
  "url": "https://github.com/exercism/codemirror-lang-lisp/issues"