UNPKG

1.59 kBMarkdownView Raw
1Scopes
2======
3
4```js
5const obj = { foo: 'Foo', bar: 'Bar' };
6```
7
8```js
9const obj = {
10 foo: 'Foo',
11 bar: 'Bar'
12};
13```
14
15
16```fire
17const obj = { foo: 'foo', bar: 'bar' }
18```
19
20```fire
21const obj = {
22 foo: 'foo'
23 bar: 'bar'
24}
25```
26
27```fire
28const obj =
29 foo: 'foo'
30 bar: 'bar'
31
32const obj =
33 foo: 'foo'
34 bar: 'bar' <- indention error
35```
36
37* `{` or `{ + [indent]` or `[indent]`
38* foo
39* :
40* 'foo'
41* `,` or `[indent]`
42* bar
43* :
44* 'bar'
45* `}` or `[outdent] + }` or `[outdent]`
46
47walkScope(`}`)
48 * break on `}`
49 * split on `,` or `[indent]` or `, + [indent]`
50 * on outdent throw indention error
51
52walkScope() <- first item sets scope indention
53 * break on outdent
54 * split on `,` or `[indent]` or `, + [indent]`
55 * on indent throw indention error
56 * higher indention throw indention error
57
58---
59
60### Call expression
61
62```js
63foo('one', two)
64```
65
66```js
67foo(
68 'one',
69 two
70)
71
72foo(
73'one',
74two
75)
76
77foo(
78 'one',
79 two
80)
81```
82
83```fire
84foo('one', two)
85```
86
87```fire
88foo(
89 'one'
90 two
91)
92
93foo(
94'one'
95two
96)
97
98foo(
99 'one'
100 two
101)
102
103foo(
104 'one'
105 two <- indention error or
106)
107```
108
109```fire
110do foo
111 'one'
112 two
113
114
115do foo
116'one' <- syntax error
117two
118
119
120do foo
121 'one'
122 two
123```
124
125* foo
126* `(` or `( + [indent]`
127* `one`
128* `,` or `[indent]` or `, + [indent]`
129* two
130* `)` or `[outdent]`
131
132walkScope(')')
133 * break on ')'
134 * on outdent throw indention error
135 * split on `,` or `[indent]` or `, + [indent]`
136
137 walkScope('') <- first item sets scope indention
138 * break on ')'
139 * on outdent throw indention error
140 * split on `,` or `[indent]` or `, + [indent]`
141 * higher indention throw indention error
142
\No newline at end of file