@guardian-network/policy-dsl 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/README.md +82 -0
  2. package/dist/antlr/generated/grammar/LacLangLexer.d.ts +53 -0
  3. package/dist/antlr/generated/grammar/LacLangLexer.d.ts.map +1 -0
  4. package/dist/antlr/generated/grammar/LacLangLexer.js +322 -0
  5. package/dist/antlr/generated/grammar/LacLangLexer.js.map +1 -0
  6. package/dist/antlr/generated/grammar/LacLangListener.d.ts +39 -0
  7. package/dist/antlr/generated/grammar/LacLangListener.d.ts.map +1 -0
  8. package/dist/antlr/generated/grammar/LacLangListener.js +3 -0
  9. package/dist/antlr/generated/grammar/LacLangListener.js.map +1 -0
  10. package/dist/antlr/generated/grammar/LacLangParser.d.ts +231 -0
  11. package/dist/antlr/generated/grammar/LacLangParser.d.ts.map +1 -0
  12. package/dist/antlr/generated/grammar/LacLangParser.js +1399 -0
  13. package/dist/antlr/generated/grammar/LacLangParser.js.map +1 -0
  14. package/dist/antlr/index.d.ts +4 -0
  15. package/dist/antlr/index.d.ts.map +1 -0
  16. package/dist/antlr/index.js +20 -0
  17. package/dist/antlr/index.js.map +1 -0
  18. package/dist/index.d.ts +4 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +23 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/ir-generation/hashing.helper.d.ts +3 -0
  23. package/dist/ir-generation/hashing.helper.d.ts.map +1 -0
  24. package/dist/ir-generation/hashing.helper.js +12 -0
  25. package/dist/ir-generation/hashing.helper.js.map +1 -0
  26. package/dist/ir-generation/index.d.ts +3 -0
  27. package/dist/ir-generation/index.d.ts.map +1 -0
  28. package/dist/ir-generation/index.js +19 -0
  29. package/dist/ir-generation/index.js.map +1 -0
  30. package/dist/ir-generation/parsed-state-to-ir.transformer.d.ts +11 -0
  31. package/dist/ir-generation/parsed-state-to-ir.transformer.d.ts.map +1 -0
  32. package/dist/ir-generation/parsed-state-to-ir.transformer.js +30 -0
  33. package/dist/ir-generation/parsed-state-to-ir.transformer.js.map +1 -0
  34. package/dist/transpiler/Transpiler.d.ts +17 -0
  35. package/dist/transpiler/Transpiler.d.ts.map +1 -0
  36. package/dist/transpiler/Transpiler.js +43 -0
  37. package/dist/transpiler/Transpiler.js.map +1 -0
  38. package/dist/transpiler/errors/ErrorFactory.d.ts +22 -0
  39. package/dist/transpiler/errors/ErrorFactory.d.ts.map +1 -0
  40. package/dist/transpiler/errors/ErrorFactory.js +62 -0
  41. package/dist/transpiler/errors/ErrorFactory.js.map +1 -0
  42. package/dist/transpiler/errors/helpers.d.ts +3 -0
  43. package/dist/transpiler/errors/helpers.d.ts.map +1 -0
  44. package/dist/transpiler/errors/helpers.js +6 -0
  45. package/dist/transpiler/errors/helpers.js.map +1 -0
  46. package/dist/transpiler/errors/index.d.ts +2 -0
  47. package/dist/transpiler/errors/index.d.ts.map +1 -0
  48. package/dist/transpiler/errors/index.js +18 -0
  49. package/dist/transpiler/errors/index.js.map +1 -0
  50. package/dist/transpiler/errors/validation-errors.d.ts +57 -0
  51. package/dist/transpiler/errors/validation-errors.d.ts.map +1 -0
  52. package/dist/transpiler/errors/validation-errors.js +132 -0
  53. package/dist/transpiler/errors/validation-errors.js.map +1 -0
  54. package/dist/transpiler/helpers/formatter.d.ts +10 -0
  55. package/dist/transpiler/helpers/formatter.d.ts.map +1 -0
  56. package/dist/transpiler/helpers/formatter.js +140 -0
  57. package/dist/transpiler/helpers/formatter.js.map +1 -0
  58. package/dist/transpiler/helpers/index.d.ts +5 -0
  59. package/dist/transpiler/helpers/index.d.ts.map +1 -0
  60. package/dist/transpiler/helpers/index.js +21 -0
  61. package/dist/transpiler/helpers/index.js.map +1 -0
  62. package/dist/transpiler/helpers/resources.helper.d.ts +4 -0
  63. package/dist/transpiler/helpers/resources.helper.d.ts.map +1 -0
  64. package/dist/transpiler/helpers/resources.helper.js +50 -0
  65. package/dist/transpiler/helpers/resources.helper.js.map +1 -0
  66. package/dist/transpiler/helpers/types.d.ts +12 -0
  67. package/dist/transpiler/helpers/types.d.ts.map +1 -0
  68. package/dist/transpiler/helpers/types.js +3 -0
  69. package/dist/transpiler/helpers/types.js.map +1 -0
  70. package/dist/transpiler/helpers/validations.helper.d.ts +8 -0
  71. package/dist/transpiler/helpers/validations.helper.d.ts.map +1 -0
  72. package/dist/transpiler/helpers/validations.helper.js +41 -0
  73. package/dist/transpiler/helpers/validations.helper.js.map +1 -0
  74. package/dist/transpiler/index.d.ts +3 -0
  75. package/dist/transpiler/index.d.ts.map +1 -0
  76. package/dist/transpiler/index.js +21 -0
  77. package/dist/transpiler/index.js.map +1 -0
  78. package/dist/transpiler/listener.d.ts +17 -0
  79. package/dist/transpiler/listener.d.ts.map +1 -0
  80. package/dist/transpiler/listener.js +94 -0
  81. package/dist/transpiler/listener.js.map +1 -0
  82. package/dist/transpiler/state/LatentState.d.ts +30 -0
  83. package/dist/transpiler/state/LatentState.d.ts.map +1 -0
  84. package/dist/transpiler/state/LatentState.js +130 -0
  85. package/dist/transpiler/state/LatentState.js.map +1 -0
  86. package/dist/transpiler/state/index.d.ts +3 -0
  87. package/dist/transpiler/state/index.d.ts.map +1 -0
  88. package/dist/transpiler/state/index.js +19 -0
  89. package/dist/transpiler/state/index.js.map +1 -0
  90. package/dist/transpiler/state/types.d.ts +42 -0
  91. package/dist/transpiler/state/types.d.ts.map +1 -0
  92. package/dist/transpiler/state/types.js +3 -0
  93. package/dist/transpiler/state/types.js.map +1 -0
  94. package/package.json +79 -0
  95. package/src/antlr/generated/grammar/LacLang.interp +88 -0
  96. package/src/antlr/generated/grammar/LacLang.tokens +52 -0
  97. package/src/antlr/generated/grammar/LacLangLexer.interp +108 -0
  98. package/src/antlr/generated/grammar/LacLangLexer.tokens +52 -0
  99. package/src/antlr/generated/grammar/LacLangLexer.ts +331 -0
  100. package/src/antlr/generated/grammar/LacLangListener.ts +216 -0
  101. package/src/antlr/generated/grammar/LacLangParser.ts +1484 -0
  102. package/src/antlr/index.ts +3 -0
  103. package/src/index.ts +3 -0
  104. package/src/ir-generation/hashing.helper.ts +13 -0
  105. package/src/ir-generation/index.ts +2 -0
  106. package/src/ir-generation/parsed-state-to-ir.transformer.ts +50 -0
  107. package/src/transpiler/Transpiler.ts +58 -0
  108. package/src/transpiler/errors/ErrorFactory.ts +130 -0
  109. package/src/transpiler/errors/helpers.ts +4 -0
  110. package/src/transpiler/errors/index.ts +1 -0
  111. package/src/transpiler/errors/validation-errors.ts +157 -0
  112. package/src/transpiler/helpers/formatter.ts +173 -0
  113. package/src/transpiler/helpers/index.ts +4 -0
  114. package/src/transpiler/helpers/resources.helper.ts +83 -0
  115. package/src/transpiler/helpers/types.ts +23 -0
  116. package/src/transpiler/helpers/validations.helper.ts +69 -0
  117. package/src/transpiler/index.ts +2 -0
  118. package/src/transpiler/listener.ts +180 -0
  119. package/src/transpiler/state/LatentState.ts +202 -0
  120. package/src/transpiler/state/index.ts +2 -0
  121. package/src/transpiler/state/types.ts +50 -0
@@ -0,0 +1,216 @@
1
+ // Generated from ./grammar/LacLang.g4 by ANTLR 4.9.0-SNAPSHOT
2
+
3
+ import { ParseTreeListener } from 'antlr4ts/tree/ParseTreeListener';
4
+
5
+ import {
6
+ ArgumentsListContext,
7
+ ArtifactDeclarationContext,
8
+ ConstantDeclarationContext,
9
+ ConstantsListContext,
10
+ DataTypeContext,
11
+ DirectiveContext,
12
+ DirectiveIndentifierContext,
13
+ EvaluateStatementContext,
14
+ Identifier_or_literalContext,
15
+ ImportStatementContext,
16
+ InjectedOnlyDirectiveContext,
17
+ InjectionModifierContext,
18
+ InstanceDeclarationContext,
19
+ LiteralContext,
20
+ ProgramContext,
21
+ StatementContext,
22
+ VarDeclarationContext,
23
+ } from './LacLangParser';
24
+
25
+ /**
26
+ * This interface defines a complete listener for a parse tree produced by
27
+ * `LacLangParser`.
28
+ */
29
+ export interface LacLangListener extends ParseTreeListener {
30
+ /**
31
+ * Enter a parse tree produced by `LacLangParser.program`.
32
+ * @param ctx the parse tree
33
+ */
34
+ enterProgram?: (ctx: ProgramContext) => void;
35
+ /**
36
+ * Exit a parse tree produced by `LacLangParser.program`.
37
+ * @param ctx the parse tree
38
+ */
39
+ exitProgram?: (ctx: ProgramContext) => void;
40
+
41
+ /**
42
+ * Enter a parse tree produced by `LacLangParser.statement`.
43
+ * @param ctx the parse tree
44
+ */
45
+ enterStatement?: (ctx: StatementContext) => void;
46
+ /**
47
+ * Exit a parse tree produced by `LacLangParser.statement`.
48
+ * @param ctx the parse tree
49
+ */
50
+ exitStatement?: (ctx: StatementContext) => void;
51
+
52
+ /**
53
+ * Enter a parse tree produced by `LacLangParser.importStatement`.
54
+ * @param ctx the parse tree
55
+ */
56
+ enterImportStatement?: (ctx: ImportStatementContext) => void;
57
+ /**
58
+ * Exit a parse tree produced by `LacLangParser.importStatement`.
59
+ * @param ctx the parse tree
60
+ */
61
+ exitImportStatement?: (ctx: ImportStatementContext) => void;
62
+
63
+ /**
64
+ * Enter a parse tree produced by `LacLangParser.directive`.
65
+ * @param ctx the parse tree
66
+ */
67
+ enterDirective?: (ctx: DirectiveContext) => void;
68
+ /**
69
+ * Exit a parse tree produced by `LacLangParser.directive`.
70
+ * @param ctx the parse tree
71
+ */
72
+ exitDirective?: (ctx: DirectiveContext) => void;
73
+
74
+ /**
75
+ * Enter a parse tree produced by `LacLangParser.directiveIndentifier`.
76
+ * @param ctx the parse tree
77
+ */
78
+ enterDirectiveIndentifier?: (ctx: DirectiveIndentifierContext) => void;
79
+ /**
80
+ * Exit a parse tree produced by `LacLangParser.directiveIndentifier`.
81
+ * @param ctx the parse tree
82
+ */
83
+ exitDirectiveIndentifier?: (ctx: DirectiveIndentifierContext) => void;
84
+
85
+ /**
86
+ * Enter a parse tree produced by `LacLangParser.injectedOnlyDirective`.
87
+ * @param ctx the parse tree
88
+ */
89
+ enterInjectedOnlyDirective?: (ctx: InjectedOnlyDirectiveContext) => void;
90
+ /**
91
+ * Exit a parse tree produced by `LacLangParser.injectedOnlyDirective`.
92
+ * @param ctx the parse tree
93
+ */
94
+ exitInjectedOnlyDirective?: (ctx: InjectedOnlyDirectiveContext) => void;
95
+
96
+ /**
97
+ * Enter a parse tree produced by `LacLangParser.varDeclaration`.
98
+ * @param ctx the parse tree
99
+ */
100
+ enterVarDeclaration?: (ctx: VarDeclarationContext) => void;
101
+ /**
102
+ * Exit a parse tree produced by `LacLangParser.varDeclaration`.
103
+ * @param ctx the parse tree
104
+ */
105
+ exitVarDeclaration?: (ctx: VarDeclarationContext) => void;
106
+
107
+ /**
108
+ * Enter a parse tree produced by `LacLangParser.injectionModifier`.
109
+ * @param ctx the parse tree
110
+ */
111
+ enterInjectionModifier?: (ctx: InjectionModifierContext) => void;
112
+ /**
113
+ * Exit a parse tree produced by `LacLangParser.injectionModifier`.
114
+ * @param ctx the parse tree
115
+ */
116
+ exitInjectionModifier?: (ctx: InjectionModifierContext) => void;
117
+
118
+ /**
119
+ * Enter a parse tree produced by `LacLangParser.constantDeclaration`.
120
+ * @param ctx the parse tree
121
+ */
122
+ enterConstantDeclaration?: (ctx: ConstantDeclarationContext) => void;
123
+ /**
124
+ * Exit a parse tree produced by `LacLangParser.constantDeclaration`.
125
+ * @param ctx the parse tree
126
+ */
127
+ exitConstantDeclaration?: (ctx: ConstantDeclarationContext) => void;
128
+
129
+ /**
130
+ * Enter a parse tree produced by `LacLangParser.artifactDeclaration`.
131
+ * @param ctx the parse tree
132
+ */
133
+ enterArtifactDeclaration?: (ctx: ArtifactDeclarationContext) => void;
134
+ /**
135
+ * Exit a parse tree produced by `LacLangParser.artifactDeclaration`.
136
+ * @param ctx the parse tree
137
+ */
138
+ exitArtifactDeclaration?: (ctx: ArtifactDeclarationContext) => void;
139
+
140
+ /**
141
+ * Enter a parse tree produced by `LacLangParser.instanceDeclaration`.
142
+ * @param ctx the parse tree
143
+ */
144
+ enterInstanceDeclaration?: (ctx: InstanceDeclarationContext) => void;
145
+ /**
146
+ * Exit a parse tree produced by `LacLangParser.instanceDeclaration`.
147
+ * @param ctx the parse tree
148
+ */
149
+ exitInstanceDeclaration?: (ctx: InstanceDeclarationContext) => void;
150
+
151
+ /**
152
+ * Enter a parse tree produced by `LacLangParser.evaluateStatement`.
153
+ * @param ctx the parse tree
154
+ */
155
+ enterEvaluateStatement?: (ctx: EvaluateStatementContext) => void;
156
+ /**
157
+ * Exit a parse tree produced by `LacLangParser.evaluateStatement`.
158
+ * @param ctx the parse tree
159
+ */
160
+ exitEvaluateStatement?: (ctx: EvaluateStatementContext) => void;
161
+
162
+ /**
163
+ * Enter a parse tree produced by `LacLangParser.dataType`.
164
+ * @param ctx the parse tree
165
+ */
166
+ enterDataType?: (ctx: DataTypeContext) => void;
167
+ /**
168
+ * Exit a parse tree produced by `LacLangParser.dataType`.
169
+ * @param ctx the parse tree
170
+ */
171
+ exitDataType?: (ctx: DataTypeContext) => void;
172
+
173
+ /**
174
+ * Enter a parse tree produced by `LacLangParser.constantsList`.
175
+ * @param ctx the parse tree
176
+ */
177
+ enterConstantsList?: (ctx: ConstantsListContext) => void;
178
+ /**
179
+ * Exit a parse tree produced by `LacLangParser.constantsList`.
180
+ * @param ctx the parse tree
181
+ */
182
+ exitConstantsList?: (ctx: ConstantsListContext) => void;
183
+
184
+ /**
185
+ * Enter a parse tree produced by `LacLangParser.argumentsList`.
186
+ * @param ctx the parse tree
187
+ */
188
+ enterArgumentsList?: (ctx: ArgumentsListContext) => void;
189
+ /**
190
+ * Exit a parse tree produced by `LacLangParser.argumentsList`.
191
+ * @param ctx the parse tree
192
+ */
193
+ exitArgumentsList?: (ctx: ArgumentsListContext) => void;
194
+
195
+ /**
196
+ * Enter a parse tree produced by `LacLangParser.identifier_or_literal`.
197
+ * @param ctx the parse tree
198
+ */
199
+ enterIdentifier_or_literal?: (ctx: Identifier_or_literalContext) => void;
200
+ /**
201
+ * Exit a parse tree produced by `LacLangParser.identifier_or_literal`.
202
+ * @param ctx the parse tree
203
+ */
204
+ exitIdentifier_or_literal?: (ctx: Identifier_or_literalContext) => void;
205
+
206
+ /**
207
+ * Enter a parse tree produced by `LacLangParser.literal`.
208
+ * @param ctx the parse tree
209
+ */
210
+ enterLiteral?: (ctx: LiteralContext) => void;
211
+ /**
212
+ * Exit a parse tree produced by `LacLangParser.literal`.
213
+ * @param ctx the parse tree
214
+ */
215
+ exitLiteral?: (ctx: LiteralContext) => void;
216
+ }