This repository has been archived by the owner on Jul 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparentChildMapping.nim
94 lines (92 loc) · 11.3 KB
/
parentChildMapping.nim
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
import construct
import tables
let parentKidMapping* =
{ckNamespace: @[ckClass, ckEnum, ckUsingDirective, ckMethod, ckExternAliasDirective, ckDelegate, ckInterface, ckProperty, ckStruct],
ckClass: @[ckMethod, ckConstructor, ckBaseList, ckIndexer, ckProperty, ckField, ckEnum, ckClass, ckTypeParameterList, ckTypeParameterConstraintClause, ckInterface, ckStruct],
ckMethod: @[ckPredefinedType, ckParameterList, ckLocalDeclarationStatement, ckReturnStatement, ckExpressionStatement, ckAssignmentExpression, ckVariableDeclarator, ckInvocationExpression, ckGenericName, ckIfStatement, ckArrowExpressionClause,
ckForStatement, ckDoStatement, ckWhileStatement, ckArrayType, ckUsingStatement, ckTryStatement, ckThrowStatement, ckTypeParameterList, ckExplicitInterfaceSpecifier, ckTypeParameterConstraintClause, ckCastExpression, ckYieldStatement,
ckTupleType, ckSwitchStatement, ckNullableType, ckLockStatement, ckForEachStatement],
ckEnum: @[ckEnumMember, ckBaseList],
ckEnumMember: @[ckEqualsValueClause, ckLiteralExpression],
ckParameterList: @[ckParameter],
ckReturnStatement: @[ckLiteralExpression, ckObjectCreationExpression, ckArgumentList, ckInvocationExpression, ckAssignmentExpression, ckBinaryExpression, ckCastExpression, ckConditionalExpression, ckMemberAccessExpression, ckTypeOfExpression,
ckThisExpression, ckSimpleLambdaExpression, ckPrefixUnaryExpression, ckParenthesizedLambdaExpression, ckParenthesizedExpression, ckArrayCreationExpression, ckPostfixUnaryExpression, ckInterpolatedStringExpression,
ckImplicitArrayCreationExpression],
ckConstructor: @[ckParameterList, ckExpressionStatement, ckAssignmentExpression, ckConstructorInitializer, ckArgumentList, ckLocalDeclarationStatement, ckArrowExpressionClause, ckReturnStatement],
ckIndexer: @[ckPredefinedType, ckExplicitInterfaceSpecifier, ckBracketedParameterList, ckParameter, ckAccessorList],
ckAccessorList: @[ckAccessor],
ckProperty: @[ckPredefinedType, ckAccessorList, ckArrayType, ckArrowExpressionClause, ckEqualsValueClause, ckExplicitInterfaceSpecifier, ckGenericName, ckLocalDeclarationStatement, ckNullableType],
ckExpressionStatement: @[ckInvocationExpression, ckArgumentList, ckArgument, ckAssignmentExpression, ckPostfixUnaryExpression, ckObjectCreationExpression, ckPrefixUnaryExpression, ckLiteralExpression, ckBinaryExpression, ckAwaitExpression,
ckConditionalAccessExpression],
ckLocalDeclarationStatement: @[ckVariable, ckGenericName, ckTypeArgumentList, ckVariableDeclarator, ckArgumentList, ckLiteralExpression],
ckVariableDeclarator: @[ckEqualsValueClause, ckObjectCreationExpression, ckBinaryExpression, ckMemberAccessExpression],
ckAssignmentExpression: @[ckObjectCreationExpression, ckGenericName, ckTypeArgumentList, ckArgumentList, ckCastExpression, ckMemberAccessExpression, ckLiteralExpression, ckInvocationExpression, ckAssignmentExpression, ckBinaryExpression,
ckInitializerExpression, ckParenthesizedLambdaExpression, ckSimpleLambdaExpression, ckThisExpression, ckPrefixUnaryExpression, ckArrayCreationExpression, ckConditionalExpression, ckElementAccessExpression, ckInterpolatedStringExpression,
ckParenthesizedExpression, ckTypeOfExpression, ckConditionalAccessExpression, ckDeclarationExpression, ckImplicitElementAccess],
ckObjectCreationExpression: @[ckInitializerExpression, ckGenericName, ckArgumentList, ckPredefinedType],
ckInitializerExpression: @[ckLiteralExpression, ckPrefixUnaryExpression, ckObjectCreationExpression, ckMemberAccessExpression, ckInitializerExpression, ckAssignmentExpression, ckArrayCreationExpression, ckParenthesizedLambdaExpression,
ckInvocationExpression, ckCastExpression, ckTypeOfExpression, ckBinaryExpression, ckSimpleLambdaExpression, ckConditionalExpression, ckInterpolatedStringExpression],
ckLiteralExpression: @[ckPrefixUnaryExpression, ckBinaryExpression],
ckVariable: @[ckGenericName, ckPredefinedType, ckVariableDeclarator, ckArrayType, ckNullableType, ckPointerType, ckRefType],
ckGenericName: @[ckTypeArgumentList],
ckUsingDirective: @[ckNameEquals, ckGenericName],
ckNameEquals: @[ckGenericName, ckPrefixUnaryExpression],
ckParameter: @[ckGenericName, ckPredefinedType, ckEqualsValueClause, ckArrayType, ckNullableType],
ckField: @[ckVariable, ckVariableDeclarator],
ckInvocationExpression: @[ckMemberAccessExpression, ckArgumentList, ckGenericName, ckElementAccessExpression, ckInvocationExpression, ckLiteralExpression],
ckEqualsValueClause: @[ckLiteralExpression, ckObjectCreationExpression, ckMemberAccessExpression, ckBinaryExpression, ckInvocationExpression, ckInitializerExpression, ckArrayCreationExpression, ckParenthesizedLambdaExpression,
ckConditionalExpression, ckPrefixUnaryExpression, ckCastExpression, ckElementAccessExpression, ckTypeOfExpression, ckInterpolatedStringExpression, ckSimpleLambdaExpression, ckParenthesizedExpression, ckAssignmentExpression,
ckImplicitArrayCreationExpression, ckConditionalAccessExpression, ckCheckedExpression, ckAwaitExpression, ckAnonymousMethodExpression],
ckArgumentList: @[ckArgument],
ckArgument: @[ckLiteralExpression, ckPrefixUnaryExpression, ckObjectCreationExpression, ckMemberAccessExpression, ckInvocationExpression, ckBinaryExpression, ckAssignmentExpression, ckSimpleLambdaExpression, ckInterpolatedStringExpression,
ckConditionalExpression, ckParenthesizedLambdaExpression, ckCastExpression, ckThisExpression, ckTypeOfExpression, ckElementAccessExpression, ckArrayCreationExpression, ckParenthesizedExpression, ckPostfixUnaryExpression, ckNameColon,
ckImplicitArrayCreationExpression, ckDefaultExpression, ckDeclarationExpression, ckAwaitExpression, ckAnonymousObjectCreationExpression],
ckTypeArgumentList: @[ckPredefinedType, ckGenericName, ckArrayType, ckTupleType],
ckPrefixUnaryExpression: @[ckLiteralExpression, ckInvocationExpression, ckObjectCreationExpression, ckMemberAccessExpression, ckParenthesizedExpression, ckCastExpression],
ckBracketedParameterList: @[ckParameter],
ckBaseList: @[ckSimpleBaseType, ckMemberAccessExpression, ckConstructorInitializer],
ckMemberAccessExpression: @[ckMemberAccessExpression, ckInvocationExpression, ckGenericName, ckElementAccessExpression, ckThisExpression, ckPredefinedType, ckObjectCreationExpression, ckParenthesizedExpression, ckTypeOfExpression,
ckLiteralExpression, ckArrayCreationExpression, ckInterpolatedStringExpression, ckBaseExpression],
ckBinaryExpression: @[ckMemberAccessExpression, ckLiteralExpression, ckBinaryExpression, ckTypeOfExpression, ckInvocationExpression, ckParenthesizedExpression, ckCastExpression, ckElementAccessExpression, ckPrefixUnaryExpression,
ckObjectCreationExpression, ckGenericName, ckPredefinedType, ckArrayType, ckPostfixUnaryExpression, ckThisExpression, ckCheckedExpression, ckConditionalAccessExpression],
ckTypeParameterList: @[ckTypeParameter],
ckTypeParameterConstraintClause: @[ckTypeConstraint],
ckTypeConstraint: @[ckGenericName],
ckIfStatement: @[ckBinaryExpression, ckInvocationExpression, ckPrefixUnaryExpression, ckThrowStatement, ckExpressionStatement, ckMemberAccessExpression, ckReturnStatement, ckBreakStatement, ckConditionalExpression, ckIfStatement,
ckLiteralExpression, ckParenthesizedExpression, ckElementAccessExpression, ckThrowExpression, ckElseClause, ckIsPatternExpression, ckYieldStatement],
ckCastExpression: @[ckThisExpression, ckParenthesizedExpression, ckPredefinedType, ckMemberAccessExpression, ckArrayType, ckInvocationExpression, ckGenericName, ckLiteralExpression, ckObjectCreationExpression, ckElementAccessExpression,
ckCastExpression, ckPrefixUnaryExpression, ckArrayCreationExpression, ckNullableType],
ckArrayType: @[ckPredefinedType, ckArrayRankSpecifier, ckGenericName],
ckArrayRankSpecifier: @[ckOmittedArraySizeExpression, ckBinaryExpression, ckLiteralExpression, ckMemberAccessExpression],
ckArrowExpressionClause: @[ckInvocationExpression, ckBinaryExpression, ckCastExpression, ckLiteralExpression, ckInterpolatedStringExpression, ckTypeOfExpression, ckObjectCreationExpression, ckMemberAccessExpression, ckAssignmentExpression,
ckParenthesizedLambdaExpression, ckArrayCreationExpression, ckConditionalExpression, ckSimpleLambdaExpression, ckElementAccessExpression],
ckSimpleLambdaExpression: @[ckParameter, ckAssignmentExpression, ckBinaryExpression, ckInvocationExpression, ckMemberAccessExpression, ckObjectCreationExpression, ckConditionalExpression, ckLiteralExpression, ckParenthesizedExpression,
ckPrefixUnaryExpression, ckSimpleLambdaExpression, ckCastExpression, ckAnonymousObjectCreationExpression, ckQueryExpression],
ckForStatement: @[ckVariable, ckBinaryExpression, ckPostfixUnaryExpression, ckForStatement, ckPrefixUnaryExpression, ckExpressionStatement, ckAssignmentExpression, ckIfStatement],
ckElementAccessExpression: @[ckBracketedArgumentList, ckInvocationExpression, ckMemberAccessExpression, ckElementAccessExpression, ckObjectCreationExpression, ckThisExpression, ckParenthesizedExpression, ckBaseExpression],
ckBracketedArgumentList: @[ckArgument],
ckSimpleBaseType: @[ckGenericName, ckPredefinedType],
ckWhileStatement: @[ckBinaryExpression, ckExpressionStatement, ckInvocationExpression, ckLiteralExpression, ckPrefixUnaryExpression],
ckParenthesizedExpression: @[ckBinaryExpression, ckCastExpression, ckConditionalExpression, ckPrefixUnaryExpression, ckPostfixUnaryExpression, ckParenthesizedLambdaExpression, ckMemberAccessExpression, ckInvocationExpression,
ckAssignmentExpression, ckArrayCreationExpression, ckLiteralExpression, ckObjectCreationExpression, ckSimpleLambdaExpression, ckIsPatternExpression, ckQueryExpression],
ckInterpolatedStringExpression: @[ckInterpolatedStringText, ckInterpolation],
ckThrowStatement: @[ckObjectCreationExpression, ckLiteralExpression, ckInvocationExpression],
ckConditionalExpression: @[ckParenthesizedExpression, ckLiteralExpression, ckMemberAccessExpression, ckBinaryExpression, ckCastExpression, ckInvocationExpression, ckObjectCreationExpression, ckPrefixUnaryExpression, ckInterpolatedStringExpression,
ckTypeOfExpression, ckThisExpression, ckAssignmentExpression],
ckArrayCreationExpression: @[ckArrayType, ckInitializerExpression],
ckUsingStatement: @[ckVariable, ckUsingStatement, ckExpressionStatement, ckMemberAccessExpression, ckCastExpression, ckAssignmentExpression, ckIfStatement, ckInvocationExpression, ckObjectCreationExpression],
ckParenthesizedLambdaExpression: @[ckParameterList, ckAssignmentExpression, ckConditionalExpression, ckMemberAccessExpression, ckObjectCreationExpression, ckPostfixUnaryExpression, ckInvocationExpression, ckBinaryExpression,
ckParenthesizedLambdaExpression, ckLiteralExpression, ckCastExpression, ckTypeOfExpression, ckPrefixUnaryExpression, ckElementAccessExpression],
ckTryStatement: @[ckCatchClause, ckFinallyClause],
ckCatchClause: @[ckCatch],
ckAccessor: @[ckReturnStatement, ckArrowExpressionClause],
ckConstructorInitializer: @[ckArgumentList],
ckInterpolation: @[ckMemberAccessExpression, ckPrefixUnaryExpression, ckLiteralExpression, ckBinaryExpression, ckInvocationExpression, ckCastExpression],
ckPostfixUnaryExpression: @[ckMemberAccessExpression, ckElementAccessExpression, ckInvocationExpression],
ckTypeOfExpression: @[ckPredefinedType],
ckExplicitInterfaceSpecifier: @[ckGenericName],
ckPredefinedType: @[ckGenericName],
ckDoStatement: @[ckBinaryExpression],
ckDelegate: @[],
}.toTable()
# echo parentKidMapping