Skip to content

Commit e810204

Browse files
committed
update docs
1 parent 5d57da6 commit e810204

File tree

5 files changed

+38
-12
lines changed

5 files changed

+38
-12
lines changed

doc/spec.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ Goals
55
# Structure with Pragmas
66

77
# Scalar Values
8-
- String
9-
- Number
10-
- Boolean
8+
9+
- string
10+
- number
11+
- boolean
1112

1213
# Collection Values
1314

14-
- Map
15-
- Vector
15+
- array
16+
- vector
17+
- map

examples/arc.arc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ fingerprint true
1515

1616
@http
1717
get /
18+
post /login
19+
post /logout
20+
post /posts
21+
patch /posts/:postID
22+
delete /posts/:postID
23+
get /posts/:postID
1824

1925
@ws
2026
join

readme.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ The format:
99
- Comments follow `#` symbols
1010
- Starts with a `@pragma`
1111
- Pragmas start with `@`
12-
- Pragmas contain either scalar values, `Array`, `Vector` or `Map`
13-
- Scalar values are either `String`, `Number` or `Boolean`
14-
- `Array` values are space seperated scalar values on a single line
15-
- `Vector` is a named array with newline seperated scalar values
16-
- `Map` is defined by a scalar value followed by vectors indented two spaces
12+
- Pragmas contain; scalar values or complex values
13+
- Scalar values are: `string`, `number` and `boolean`
14+
- Complex values are: `array`, `vector` and `map`
1715

1816
## Example
1917

@@ -27,10 +25,16 @@ another-value
2725
4.2 # Number
2826
true # Boolean
2927
30-
@another-section-of-vectors
28+
@section-of-arrays
3129
vector of values
3230
vector tuple
3331
32+
@vectors-section
33+
named
34+
vector
35+
of
36+
values
37+
3438
@this-section-has-a-map
3539
hello-world
3640
name some-value
@@ -58,10 +62,13 @@ Prints the following plain object to the console:
5862
4.2,
5963
true
6064
],
61-
"another-section-of-vectors": [
65+
"section-of-arrays": [
6266
["vector", "of", "values"],
6367
["vector", "tuple"]
6468
],
69+
"vectors-section": [
70+
{named: ["vector", "of", "values"]},
71+
],
6572
"this-section-has-a-map": [{
6673
"hello-world": {
6774
"name": "some-value"
@@ -70,4 +77,10 @@ Prints the following plain object to the console:
7077
}
7178
```
7279

80+
Things to notice:
81+
82+
- `array` values are space seperated scalar values on a single line
83+
- `vector` is a named `array` with scalar values indented two spaces on newlines
84+
- `map` is a named value followed by keys and values indented two spaces
85+
7386
[npm]: https://www.npmjs.com/package/@architect/parser

src/compat/arc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = function arc(code) {
2+
return parse(lex(code), schema)
3+
}

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
let arc = require('./compat/arc')
12
let json = require('./compat/json')
23
let yaml = require('./compat/yaml')
34
let stringify = require('./compat/stringify')
@@ -12,6 +13,7 @@ function parse(code) {
1213
return parser(lex(code))
1314
}
1415

16+
parse.arc = arc
1517
parse.json = json
1618
parse.yaml = yaml
1719
parse.stringify = stringify

0 commit comments

Comments
 (0)