-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStateMachine.ts
123 lines (115 loc) · 2.97 KB
/
StateMachine.ts
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
///<reference path="StateMachineTypes.ts"/>
///<reference path="StateMachineHelper.ts"/>
//declare
const constantKey = `const `;
const exportKey = 'export ';
//AddId
export const LineTypes = {
AliasConstant:{} as Line,
BodyComment:{
conditionsToQualify:[
{
afterTrimming: LeftRightBoth.Left,
mustStartWith: '*'
}
]
} as Line,
ClosingComment:{
conditionsToQualify:[
{
afterTrimming: LeftRightBoth.Right,
mustEndWith: `*/`
}
]
} as Line,
ClosingObjectConstant:{
conditionsToQualify:[
{
afterTrimming: LeftRightBoth.Left,
mustEndWith: '}',
//actionIfTrue:
}
]
} as Line,
ClosingObjectPropertyValue:{} as Line,
EmptyLine:{
conditionsToQualify:[
{
afterTrimming: LeftRightBoth.Both,
length: 0
}
]
} as Line,
ObjectPropertyValue:{} as Line,
OpenComment:{
conditionsToQualify:[
{
afterTrimming: LeftRightBoth.Left,
mustStartWith: `/*`
}
]
} as Line,
OpenArrayExportConstant:{
conditionsToQualify:[
{
afterTrimming: LeftRightBoth.Both,
mustEndWith: '['
},
{
mustStartWith: exportKey + constantKey
}
]
} as Line,
OpenArrayLocalConstant:{
conditionsToQualify:[
{
afterTrimming: LeftRightBoth.Both,
mustEndWith: '['
},
{
mustStartWith: constantKey
}
]
} as Line,
OpenArrayPropertyValue:{} as Line,
OpenObjectConstant:{} as Line,
OpenObjectPropertyValue:{} as Line,
PrimitiveConstant:{} as Line,
PrimitivePropertyValue:{} as Line,
AllowedNextLineRules: [] as NextLineRule[],
}
const lt = LineTypes;
const openStatements = [lt.EmptyLine, lt.OpenComment, lt.OpenObjectConstant, lt.PrimitiveConstant];
const objectLiteralLines = [lt.PrimitivePropertyValue, lt.OpenObjectPropertyValue, lt.ClosingComment]
LineTypes.AllowedNextLineRules = [
{
PreviousLineType: null,
PossibleLineTypes: openStatements,
},
{
PreviousLineType: lt.OpenComment,
PossibleLineTypes: [
lt.ClosingComment,
lt.BodyComment,
]
},
{
PreviousLineType: lt.BodyComment,
PossibleLineTypes: [
lt.ClosingComment,
lt.BodyComment
]
},
{
PreviousLineType: lt.ClosingComment,
PossibleLineTypes: openStatements,
},
{
PreviousLineType: lt.OpenObjectConstant,
PossibleLineTypes:[
lt.PrimitivePropertyValue,
lt.OpenObjectPropertyValue,
lt.ClosingObjectConstant
]
}
]