@exercism/codemirror-lang-pascal 0.0.0-stage → 1.0.0
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 +153 -0
- package/LICENSE +21 -0
- package/README.md +218 -2
- package/dist/index.cjs +1703 -0
- package/dist/index.d.cts +124 -0
- package/dist/index.d.ts +124 -0
- package/dist/index.js +1696 -0
- package/package.json +57 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
## 1.0.0
|
|
2
|
+
|
|
3
|
+
This is Exercism's first release of the package, published as
|
|
4
|
+
`@exercism/codemirror-lang-pascal`. It adds completion of the names in scope and
|
|
5
|
+
of class and record members after a dot, snippets and more standard library
|
|
6
|
+
routines, and reads a few more Free Pascal forms.
|
|
7
|
+
|
|
8
|
+
### New features
|
|
9
|
+
|
|
10
|
+
Completion offers the names declared in the file, each only where it is in
|
|
11
|
+
scope. A subprogram's parameters, locals and `Result` count inside it,
|
|
12
|
+
including inside the subprograms nested in it. Inside a method, the fields,
|
|
13
|
+
methods and properties of its class and the classes it inherits from count
|
|
14
|
+
too, and so does `Self`. After `name.` it offers the members of the type of
|
|
15
|
+
`name`, or the values of an enumeration.
|
|
16
|
+
|
|
17
|
+
Snippets for `program`, a unit with its interface and implementation,
|
|
18
|
+
`procedure`, `function`, `begin`/`end`, `if`, the three `for` loops, `while`,
|
|
19
|
+
`repeat`, `case`, `try`, and class and record types.
|
|
20
|
+
|
|
21
|
+
More routines from SysUtils, StrUtils and Math, and the common exception
|
|
22
|
+
types. Keyword completion is turned off inside strings and comments, and
|
|
23
|
+
after a dot.
|
|
24
|
+
|
|
25
|
+
An empty array constant `()`, an array of one record or one array, and the
|
|
26
|
+
shift operators `<<` and `>>` parse.
|
|
27
|
+
|
|
28
|
+
### Bug fixes
|
|
29
|
+
|
|
30
|
+
`procedure A; inline;` at the top level kept `inline` as a statement after the
|
|
31
|
+
header, which left the body loose from its header. The directive now belongs
|
|
32
|
+
to the header.
|
|
33
|
+
|
|
34
|
+
## 0.5.0 (2026-08-15)
|
|
35
|
+
|
|
36
|
+
Five readings real Pascal has and this did not.
|
|
37
|
+
|
|
38
|
+
A closure may declare locals of its own between its header and its body, which
|
|
39
|
+
is what Delphi's threading and messaging code is written with. A constant may
|
|
40
|
+
be declared where a statement belongs, and its value is any expression the
|
|
41
|
+
block can work out. A type parameter may be held to `constructor` as well as to
|
|
42
|
+
`class`, so `<T: class, constructor>` reads as the one constraint list it is.
|
|
43
|
+
An attribute may name what it belongs to, and a run of `[assembly: ...]` on its
|
|
44
|
+
own is a declaration. `namespace RemObjects.Calendar;` opens an Oxygene unit.
|
|
45
|
+
|
|
46
|
+
The angle brackets read one word further: a `>` in front of `then`, `do`,
|
|
47
|
+
`else`, `end`, `to`, `downto` or `of` closes a list of type arguments, because
|
|
48
|
+
a comparison in front of any of those has nothing on its right.
|
|
49
|
+
|
|
50
|
+
94.29% of 13111 published files parse with no error node, up from 90.22%.
|
|
51
|
+
|
|
52
|
+
## 0.4.0 (2026-08-15)
|
|
53
|
+
|
|
54
|
+
A lock statement, an operator named after the type it belongs to, an extension
|
|
55
|
+
method whose body is one statement written behind the header, a choice written
|
|
56
|
+
in words where a value belongs, and every reserved word read as a name behind a
|
|
57
|
+
dot. The extension list comes from the corpus harness rather than being
|
|
58
|
+
repeated here.
|
|
59
|
+
|
|
60
|
+
## 0.3.0 (2026-08-13)
|
|
61
|
+
|
|
62
|
+
### Dialects
|
|
63
|
+
|
|
64
|
+
Free Pascal: the power operator, `extdecl`, an operator whose body names the
|
|
65
|
+
type it belongs to, a type parameter held to a constraint, a member of a
|
|
66
|
+
generic (`TAVLTree<T>.PNode`), a routine a library exports by number, and the
|
|
67
|
+
Amiga bindings' `syscall` with a calling convention in front of the library
|
|
68
|
+
base. Free Pascal's own compiler settled two of these: `compiler/tokens.pas`
|
|
69
|
+
lists the operators that may be overloaded, which is where `**` came from, and
|
|
70
|
+
the absence of `<<` from that table is why the shift written with angle
|
|
71
|
+
brackets is still read as an error.
|
|
72
|
+
|
|
73
|
+
Objective-C: a protocol somebody else owns, written as
|
|
74
|
+
`objcprotocol external name 'NSAccessibility' (NSObjectProtocol)`.
|
|
75
|
+
|
|
76
|
+
PascalABC.NET: a function type written as an arrow (`T -> boolean`,
|
|
77
|
+
`(integer, integer) -> real`, `T -> ()`), a choice written in words where a
|
|
78
|
+
value belongs, a body of one statement behind the header, extension methods,
|
|
79
|
+
`lock`, a conversion operator with type parameters of its own, and an operator
|
|
80
|
+
whose type stands in front of the word.
|
|
81
|
+
|
|
82
|
+
### Reading
|
|
83
|
+
|
|
84
|
+
An include file that holds a piece of a `var` section, which is how Free
|
|
85
|
+
Pascal writes a library's whole function table. A run of modifiers with no
|
|
86
|
+
semicolon between them (`cdecl varargs;`), which used to lose the header in
|
|
87
|
+
front of it as well. Hint directives on a variable and on a record field, which
|
|
88
|
+
only a constant could carry before. A generic subprogram standing after a type
|
|
89
|
+
section, told from a generic type by a tokenizer, because the reading that
|
|
90
|
+
carries the answer is pruned before the answer arrives. Every reserved word as
|
|
91
|
+
a name behind a dot, rather than the handful that had been listed.
|
|
92
|
+
|
|
93
|
+
### Coverage
|
|
94
|
+
|
|
95
|
+
36092 files of published Pascal, 433 MiB. 95.02% parse with no error node, up
|
|
96
|
+
from 89.90%. Of the five projects written in Object Pascal proper, 96.44%.
|
|
97
|
+
|
|
98
|
+
The measurement now counts `.inc` and `.dpk` alongside `.pas`, `.pp`, `.dpr`
|
|
99
|
+
and `.lpr`. An include file is real Free Pascal and a Delphi package is real
|
|
100
|
+
Delphi, and leaving them out flattered every figure this package has published.
|
|
101
|
+
Against the narrower list the earlier releases used, 94.78%, up from 92.90%.
|
|
102
|
+
|
|
103
|
+
Set aside from that: 439 files that are meant to fail, being Pascal-P6's
|
|
104
|
+
conformance suite, PascalABC.NET's error tests and Free Pascal's own
|
|
105
|
+
must-not-compile tests. Without them, 95.70% of 35653.
|
|
106
|
+
|
|
107
|
+
## 0.2.0 (2026-08-06)
|
|
108
|
+
|
|
109
|
+
### Dialects
|
|
110
|
+
|
|
111
|
+
Free Pascal's older spellings: the bracketed directive list
|
|
112
|
+
(`procedure Move(...); [public, alias: 'FPC_MOVE']`), `bitpacked`, a procedural
|
|
113
|
+
type that is `nested`, a code page on a string type, `otherwise` in a `case`,
|
|
114
|
+
and a modifier that runs on without a semicolon. `object` is no longer reserved,
|
|
115
|
+
so standard Pascal may name a variable with it.
|
|
116
|
+
|
|
117
|
+
PascalABC.NET: `match`, `yield`, `loop`, ranges as values, the conditional
|
|
118
|
+
expression, `??`, `?.`, `auto` and `partial` classes, type classes, type
|
|
119
|
+
parameters in square brackets, `static` on a field or a method, a variable that
|
|
120
|
+
takes its type from its value, patterns that take a value apart, and a method
|
|
121
|
+
written out inside the class that declares it.
|
|
122
|
+
|
|
123
|
+
Pascaline: `joins`, `fixed`, an array written with its length, and an array
|
|
124
|
+
constant closed by `end`. Standard Pascal passes a subprogram as a parameter,
|
|
125
|
+
which had no rule at all.
|
|
126
|
+
|
|
127
|
+
### Reading
|
|
128
|
+
|
|
129
|
+
Reserved words behind a dot (`System.Type`), the shebang of an `instantfpc`
|
|
130
|
+
script, a modifier written in front of a header, and an include file that holds
|
|
131
|
+
only the values of a table.
|
|
132
|
+
|
|
133
|
+
### Coverage
|
|
134
|
+
|
|
135
|
+
Against the same 29054 files, 92.90% parse with no error node, up from 77.10%.
|
|
136
|
+
Of the five projects written in Object Pascal proper, 95.16%, up from 84.21%.
|
|
137
|
+
|
|
138
|
+
## 0.1.0 (2026-08-06)
|
|
139
|
+
|
|
140
|
+
### First release
|
|
141
|
+
|
|
142
|
+
Pascal language support: a Lezer grammar covering Object Pascal as Free Pascal
|
|
143
|
+
and Delphi compile it, plus highlighting, folding, indentation and completion.
|
|
144
|
+
|
|
145
|
+
No Lezer grammar for Pascal existed anywhere, so there was nothing to be
|
|
146
|
+
compatible with. What a CodeMirror 6 editor fell back on was the stream mode
|
|
147
|
+
carried over from CodeMirror 5, which colours keywords, strings, numbers and
|
|
148
|
+
comments by reading one line at a time, and leaves no tree behind.
|
|
149
|
+
|
|
150
|
+
Measured against 29054 files of published Pascal, 346 MiB drawn from Free
|
|
151
|
+
Pascal, Lazarus, PascalABC.NET, the Castle Game Engine, mORMot, Indy and
|
|
152
|
+
Pascal-P6, 77.10% parse with no error node. Of the five projects written in
|
|
153
|
+
Object Pascal proper, 84.21%.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CodinCod
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,219 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @exercism/codemirror-lang-pascal
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This is Exercism's fork of
|
|
4
|
+
[@codincod/codemirror-lang-pascal](https://codeberg.org/reeven/codemirror-lang-pascal),
|
|
5
|
+
written by CodinCod. Exercism uses it for Delphi Pascal and Free Pascal in the
|
|
6
|
+
editor on [exercism.org](https://exercism.org). Our changes are on the
|
|
7
|
+
`main` branch.
|
|
8
|
+
|
|
9
|
+
The fork adds completion for the names declared in the file, each offered where
|
|
10
|
+
it is in scope, and for the members of a class or record after a dot. It also
|
|
11
|
+
adds snippets and more SysUtils, StrUtils and Math routines, and turns
|
|
12
|
+
completion off inside strings and comments. The grammar also reads Free Pascal's
|
|
13
|
+
empty array `()`, an array of one record, and the shift operators `<<` and
|
|
14
|
+
`>>`. A directive such as `inline` that follows a top-level header attaches to
|
|
15
|
+
that header.
|
|
16
|
+
|
|
17
|
+
The package exports `pascal()`, which includes both completion sources,
|
|
18
|
+
`pascalLanguage`, `pascalCompletion` (keywords, snippets, types, routines and
|
|
19
|
+
units), `localCompletionSource` (the names declared in the file), `snippets`
|
|
20
|
+
and `parser`.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
npm install @exercism/codemirror-lang-pascal
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The rest of this README is upstream's.
|
|
29
|
+
|
|
30
|
+
## @codincod/codemirror-lang-pascal
|
|
31
|
+
|
|
32
|
+
[ [**CHANGELOG**](https://codeberg.org/reeven/codemirror-lang-pascal/src/branch/master/CHANGELOG.md) ]
|
|
33
|
+
|
|
34
|
+
This package implements Pascal language support for the
|
|
35
|
+
[CodeMirror](https://codemirror.net/) code editor, using a
|
|
36
|
+
[Lezer](https://lezer.codemirror.net/) grammar written for this package.
|
|
37
|
+
|
|
38
|
+
No Lezer grammar for Pascal existed before this one. A Pascal file in a
|
|
39
|
+
CodeMirror 6 editor was read by the stream mode carried over from CodeMirror 5,
|
|
40
|
+
which recognises keywords, strings, numbers and comments, and has no tree to
|
|
41
|
+
fold, indent or navigate by.
|
|
42
|
+
|
|
43
|
+
Written in part for [CodinCod](https://codincod.com/), a competitive coding
|
|
44
|
+
platform, where it colours the editor people solve puzzles in.
|
|
45
|
+
|
|
46
|
+
This code is released under an
|
|
47
|
+
[MIT license](https://codeberg.org/reeven/codemirror-lang-pascal/src/branch/master/LICENSE).
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
import {EditorView, basicSetup} from "codemirror"
|
|
53
|
+
import {pascal} from "@exercism/codemirror-lang-pascal"
|
|
54
|
+
|
|
55
|
+
const view = new EditorView({
|
|
56
|
+
parent: document.body,
|
|
57
|
+
doc: `unit Greeting;
|
|
58
|
+
|
|
59
|
+
interface
|
|
60
|
+
|
|
61
|
+
type
|
|
62
|
+
TGreeter = class
|
|
63
|
+
private
|
|
64
|
+
FName: string;
|
|
65
|
+
public
|
|
66
|
+
constructor Create(const AName: string);
|
|
67
|
+
procedure Say;
|
|
68
|
+
end;
|
|
69
|
+
|
|
70
|
+
implementation
|
|
71
|
+
|
|
72
|
+
constructor TGreeter.Create(const AName: string);
|
|
73
|
+
begin
|
|
74
|
+
FName := AName;
|
|
75
|
+
end;
|
|
76
|
+
|
|
77
|
+
procedure TGreeter.Say;
|
|
78
|
+
begin
|
|
79
|
+
WriteLn('hello, ', FName);
|
|
80
|
+
end;
|
|
81
|
+
|
|
82
|
+
end.
|
|
83
|
+
`,
|
|
84
|
+
extensions: [basicSetup, pascal()]
|
|
85
|
+
})
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Coverage
|
|
89
|
+
|
|
90
|
+
Object Pascal as Free Pascal and Delphi compile it. Units, programs, libraries
|
|
91
|
+
and packages; classes, records, interfaces, helpers and metaclasses; properties
|
|
92
|
+
with their specifiers; generics on both the Delphi spelling and the Free Pascal
|
|
93
|
+
one; variant records; procedural types; RTTI attributes; the whole directive
|
|
94
|
+
vocabulary; inline variables; anonymous methods; assembler blocks; and every
|
|
95
|
+
number and string spelling the two compilers accept.
|
|
96
|
+
|
|
97
|
+
Three other dialects are read as far as they go without costing Object Pascal
|
|
98
|
+
anything. PascalABC.NET has `match`, `yield`, ranges as values, type classes and
|
|
99
|
+
a variable that takes its type from its value. Pascaline has `joins`, `fixed`
|
|
100
|
+
and an array written with its length. Standard Pascal passes a subprogram as a
|
|
101
|
+
parameter.
|
|
102
|
+
|
|
103
|
+
The top level is deliberately looser than a compiler's. An editor is shown
|
|
104
|
+
fragments as often as whole files, so a bare statement, a lone declaration and a
|
|
105
|
+
unit cut off halfway all parse.
|
|
106
|
+
|
|
107
|
+
Measured against 36092 files of published Pascal, 433 MiB, 95.02% parse with no
|
|
108
|
+
error node. By project:
|
|
109
|
+
|
|
110
|
+
| Project | Files | Clean |
|
|
111
|
+
| --- | ---: | ---: |
|
|
112
|
+
| Free Pascal | 22332 | 96.57% |
|
|
113
|
+
| Lazarus | 4976 | 96.32% |
|
|
114
|
+
| PascalABC.NET | 4405 | 90.62% |
|
|
115
|
+
| Castle Game Engine | 2470 | 95.43% |
|
|
116
|
+
| mORMot | 576 | 97.92% |
|
|
117
|
+
| Indy | 803 | 95.89% |
|
|
118
|
+
| Pascal-P6 | 530 | 47.55% |
|
|
119
|
+
|
|
120
|
+
The five Object Pascal projects together are 96.44% clean. Much of what is left
|
|
121
|
+
in the other two is not meant to parse: 246 of Pascal-P6's 278 failures are its
|
|
122
|
+
ISO conformance suite, files whose whole purpose is to be rejected, and
|
|
123
|
+
PascalABC.NET keeps a directory of compiler error tests beside its samples. Set
|
|
124
|
+
those aside, along with Free Pascal's must-not-compile tests, and 95.70% of the
|
|
125
|
+
remaining 35653 files parse.
|
|
126
|
+
|
|
127
|
+
The extensions counted are `.pas`, `.pp`, `.inc`, `.dpr`, `.lpr` and `.dpk`.
|
|
128
|
+
An include file is a piece of a unit rather than a unit, and Free Pascal writes
|
|
129
|
+
6752 of them; a Delphi package is a file Delphi compiles. Both are the language
|
|
130
|
+
and both are counted.
|
|
131
|
+
|
|
132
|
+
Measured a second way, against 13077 files the extensions gather from anywhere
|
|
133
|
+
rather than from seven named projects, 95.12% parse with no error node. That
|
|
134
|
+
corpus is the harder of the two: it holds every dialect at once, and what still
|
|
135
|
+
fails in it is mostly one file of one dialect at a time. Getting it there meant
|
|
136
|
+
teaching the grammar the anonymous method that declares locals, the constant
|
|
137
|
+
declared where a statement belongs, `<T: class, constructor>`, the attribute
|
|
138
|
+
that names what it belongs to, and the Oxygene namespace header, and getting
|
|
139
|
+
Puppet, Terraform, ppremake and a suite of files written to be rejected out of
|
|
140
|
+
the corpus, `.pp` being an extension four languages answer to.
|
|
141
|
+
|
|
142
|
+
Every project in the corpus has its own licence, so the corpus is kept out of this package.
|
|
143
|
+
|
|
144
|
+
## What a tokenizer has to settle
|
|
145
|
+
|
|
146
|
+
Some things about Pascal cannot be written as grammar rules, and they are the
|
|
147
|
+
whole of `tokens.ts`.
|
|
148
|
+
|
|
149
|
+
**Case does not matter.** `BEGIN`, `Begin` and `begin` are one word, and real
|
|
150
|
+
code uses all three. The reserved words are therefore recognised by a function
|
|
151
|
+
that lowercases a word before looking it up, rather than by a list of literals
|
|
152
|
+
in the grammar file.
|
|
153
|
+
|
|
154
|
+
**Most of the words are not reserved.** `read`, `write`, `name`, `index`,
|
|
155
|
+
`message`, `default`, `private` and the calling conventions are directives. They
|
|
156
|
+
mean something in one position and are ordinary names everywhere else, and a
|
|
157
|
+
single unit will often use one both ways. They come in through
|
|
158
|
+
`@external extend`, which offers the parser the keyword and leaves the
|
|
159
|
+
identifier standing wherever the keyword cannot go.
|
|
160
|
+
|
|
161
|
+
**An angle bracket is two different things.** `TList<Integer>` and `a < b` open
|
|
162
|
+
on the same character. Where a type belongs there is no comparison to be had and
|
|
163
|
+
the parser says so. Where an expression belongs the answer is further along the
|
|
164
|
+
line, so the tokenizer reads ahead to find it.
|
|
165
|
+
|
|
166
|
+
**An assembler block is not Pascal.** `asm ... end` holds another language, with
|
|
167
|
+
its own comment characters and its own uses for `[` and `%`. It is taken whole
|
|
168
|
+
by a tokenizer that looks only for the `end` that closes it.
|
|
169
|
+
|
|
170
|
+
**A modifier says nothing about what it binds.** `static` behind a header is a
|
|
171
|
+
directive and ends with a semicolon; in front of one it belongs to the method or
|
|
172
|
+
the field that follows. Free Pascal's `[public, alias: 'x']` and an RTTI
|
|
173
|
+
attribute are the same bracket, told apart by the word inside it. Both answers
|
|
174
|
+
lie past what a parser is allowed to look at, so a tokenizer reads ahead and
|
|
175
|
+
hands back a different token.
|
|
176
|
+
|
|
177
|
+
**The branch of a conditional the compiler would not read is skipped.** A
|
|
178
|
+
compiler reads one arm of a `{$ifdef}` and an editor is shown both, so a grammar
|
|
179
|
+
that reads what is in front of it sees one declaration written twice. Everything
|
|
180
|
+
from an `{$else}` to the `{$endif}` that closes it is passed over, which is what
|
|
181
|
+
the compiler does with the same file, and the only reading that yields a tree.
|
|
182
|
+
|
|
183
|
+
## What the tree does not say
|
|
184
|
+
|
|
185
|
+
**A subprogram body is a sibling of its header, never a child of another
|
|
186
|
+
subprogram.** Nothing before the body says whether there will be one: an
|
|
187
|
+
interface entry, a `forward`, an `external` and a full definition all open the
|
|
188
|
+
same way, and the answer can be thousands of lines off. A parser that goes
|
|
189
|
+
looking nests every header in a unit's interface section inside the one above
|
|
190
|
+
it, and buries `implementation` at the bottom. So a header ends the moment the
|
|
191
|
+
next declaration starts, and a procedure nested in another stands beside it.
|
|
192
|
+
Folding, indentation and highlighting want the body, and none of them wants the
|
|
193
|
+
nesting.
|
|
194
|
+
|
|
195
|
+
**A parenthesised list is not read for meaning.** The same brackets spell a
|
|
196
|
+
call, an index, an enumeration, a record constant and an array constant, and
|
|
197
|
+
which one is meant depends on what the name in front of them refers to. This
|
|
198
|
+
grammar knows what no name refers to, so it separates the five by what is inside
|
|
199
|
+
the brackets and no further.
|
|
200
|
+
|
|
201
|
+
**`^A` is a name, not a control character.** Turbo Pascal wrote control
|
|
202
|
+
characters as a caret and a letter, and Delphi still accepts `#13^J`. The same
|
|
203
|
+
caret spells a pointer dereference, and `PLooper^` and `^ALooper` differ only in
|
|
204
|
+
which side of the name it falls on. Real code dereferences constantly and writes
|
|
205
|
+
control characters rarely, so the caret is always the operator.
|
|
206
|
+
|
|
207
|
+
**A few PascalABC.NET spellings are left out.** Tuples, slices, `if` used as an
|
|
208
|
+
expression, a nullable `T?` and parameterless lambdas each collide with
|
|
209
|
+
something Object Pascal writes, and Object Pascal is what the grammar is for. A
|
|
210
|
+
tuple type and an enumeration are the same brackets around the same names; a
|
|
211
|
+
nullable type and the conditional expression are the same question mark.
|
|
212
|
+
|
|
213
|
+
## Building and testing
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
npm install # installs the dependencies and builds the package into dist/
|
|
217
|
+
npm run build # regenerates the parser, then rebuilds the package
|
|
218
|
+
npm test # builds the package, then runs the tests
|
|
219
|
+
```
|