Closed wooorm closed 7 years ago
To clarify: you propose changes only to terminology, not to the functional spec?
Yes, only terms! Something like this:
### `Node`
...
```idl
interface Node {
type: string;
data: Data?;
- position: Location?;
+ position: Position?;
}
```
...
-#### `Location`
+#### `Position`
-**Location** references a range consisting of two points in a [Unist
+**Position** references a range consisting of two points in a [Unist
-file][file]. **Location** consists of a `start` and `end` position.
+file][file]. **Position** consists of a `start` and `end` point.
And, if relevant, an `indent` property.
...
```idl
-interface Location {
+interface Position {
- start: Position;
+ start: Point;
- end: Position;
+ end: Point;
indent: [uint32 >= 1]?;
}
```
-#### `Position`
+#### `Point`
-**Position** references a point consisting of two indices in a
+**Point** references a point consisting of two indices in a
[Unist file][file]: `line` and `column`, set to 1-based integers. An
`offset` (0-based) may be used.
```idl
-interface Position {
+interface Point {
line: uint32 >= 1;
column: uint32 >= 1;
offset: uint32 >= 0?;
}
```
What do you think?
I like it. :+1: The naming confused me when I first read the readme, and this would help.
Currently,
location
andposition
is used interchangeably, while they differ. This confusion derives fromnode.position
, which holds a location, and a location hasstart
andend
set to a position.I propose:
node.position
(aka “location”, “positional info”)node.position.start
,node.position.end
(as it refers to a point in a file)