-
-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathgrammar.ne
More file actions
84 lines (63 loc) · 2.21 KB
/
Copy pathgrammar.ne
File metadata and controls
84 lines (63 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@preprocessor typescript
@{%
import { capture } from "../../util/grammarHelpers";
import { lexer } from "../lexer";
import {
bringMoveActionDescriptor,
containingScopeModifier,
createPlaceholderTarget,
partialPrimitiveTargetDescriptor,
primitiveDestinationDescriptor,
relativeScopeModifier,
simpleActionDescriptor,
simplePartialMark,
simpleScopeType,
surroundingPairScopeType,
} from "../grammarUtil";
%}
@lexer lexer
main -> action {% id %}
# --------------------------- Actions ---------------------------
action -> %simpleActionName target {%
([simpleActionName, target]) => simpleActionDescriptor(simpleActionName, target)
%}
action -> %bringMove target destination {%
([bringMove, target, destination]) => bringMoveActionDescriptor(bringMove, target, destination)
%}
# --------------------------- Destinations ---------------------------
destination -> primitiveDestination {% id %}
destination -> %insertionMode target {%
([insertionMode, target]) => primitiveDestinationDescriptor(insertionMode, target)
%}
# --------------------------- Targets ---------------------------
target -> primitiveTarget {% id %}
primitiveTarget -> modifier:+ {%
([modifiers]) => partialPrimitiveTargetDescriptor(modifiers, undefined)
%}
primitiveTarget -> mark {%
([mark]) => partialPrimitiveTargetDescriptor(undefined, mark)
%}
primitiveTarget -> modifier:+ mark {%
([modifiers, mark]) => partialPrimitiveTargetDescriptor(modifiers, mark)
%}
# --------------------------- Modifiers ---------------------------
modifier -> scopeType {%
([scopeType]) => containingScopeModifier(scopeType)
%}
modifier -> %direction scopeType {%
([direction, scopeType]) => relativeScopeModifier(scopeType, direction)
%}
# --------------------------- Scope types ---------------------------
scopeType -> %simpleScopeTypeType {%
([simpleScopeTypeType]) => simpleScopeType(simpleScopeTypeType)
%}
scopeType -> %pairedDelimiter {%
([delimiter]) => surroundingPairScopeType(delimiter)
%}
# --------------------------- Marks ---------------------------
mark -> %simpleMarkType {%
([simpleMarkType]) => simplePartialMark(simpleMarkType)
%}
mark -> %placeholderTarget {%
([placeholderTarget]) => createPlaceholderTarget(placeholderTarget)
%}