yini-parser 1.0.1-beta → 1.1.0-beta

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 (43) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +131 -328
  3. package/dist/YINI.d.ts +34 -11
  4. package/dist/YINI.js +206 -121
  5. package/dist/core/ASTBuilder.d.ts +191 -0
  6. package/dist/core/ASTBuilder.js +827 -0
  7. package/dist/core/ErrorDataHandler.d.ts +19 -19
  8. package/dist/core/ErrorDataHandler.js +258 -150
  9. package/dist/core/objectBuilder.d.ts +9 -3
  10. package/dist/core/objectBuilder.js +126 -163
  11. package/dist/core/types.d.ts +234 -44
  12. package/dist/core/types.js +7 -33
  13. package/dist/grammar/YiniLexer.d.ts +54 -48
  14. package/dist/grammar/YiniLexer.js +330 -293
  15. package/dist/grammar/YiniParser.d.ts +167 -150
  16. package/dist/grammar/YiniParser.js +1241 -1202
  17. package/dist/grammar/YiniParserVisitor.d.ts +59 -45
  18. package/dist/grammar/YiniParserVisitor.js +1 -1
  19. package/dist/index.d.ts +4 -2
  20. package/dist/index.js +298 -120
  21. package/dist/parseEntry.d.ts +3 -2
  22. package/dist/parseEntry.js +352 -81
  23. package/dist/parsers/extractHeaderParts.d.ts +3 -2
  24. package/dist/parsers/extractHeaderParts.js +1 -0
  25. package/dist/parsers/parseBoolean.d.ts +1 -1
  26. package/dist/parsers/parseBoolean.js +2 -1
  27. package/dist/parsers/parseNumber.d.ts +8 -3
  28. package/dist/parsers/parseNumber.js +50 -16
  29. package/dist/parsers/parseSectionHeader.d.ts +3 -2
  30. package/dist/parsers/parseSectionHeader.js +1 -0
  31. package/dist/utils/number.d.ts +3 -0
  32. package/dist/utils/number.js +18 -0
  33. package/dist/utils/object.d.ts +55 -0
  34. package/dist/utils/object.js +85 -0
  35. package/dist/utils/string.d.ts +21 -1
  36. package/dist/utils/string.js +39 -4
  37. package/dist/utils/system.d.ts +15 -0
  38. package/dist/utils/system.js +21 -0
  39. package/dist/yiniHelpers.d.ts +3 -0
  40. package/dist/yiniHelpers.js +43 -7
  41. package/package.json +3 -3
  42. package/dist/core/YINIVisitor.d.ts +0 -158
  43. package/dist/core/YINIVisitor.js +0 -1010
@@ -1,158 +0,0 @@
1
- import { Bad_memberContext, Boolean_literalContext, ElementContext, ElementsContext, List_in_bracketsContext, ListContext, Member_colon_listContext, MemberContext, Null_literalContext, Number_literalContext, Object_literalContext, ObjectMemberContext, ObjectMemberListContext, Section_membersContext, SectionContext, String_concatContext, String_literalContext, Terminal_lineContext, ValueContext, YiniContext } from '../grammar/YiniParser.js';
2
- import YiniParserVisitor from '../grammar/YiniParserVisitor';
3
- import { ErrorDataHandler } from './ErrorDataHandler';
4
- export type TDataType = undefined | 'String' | 'Number-Integer' | 'Number-Float' | 'Boolean' | 'Null' | 'Object' | 'List';
5
- /**
6
- * This interface defines a complete generic visitor for a parse tree produced
7
- * by `YiniParser`.
8
- *
9
- * @param <IResult> The return type of the visit operation. Use `void` for
10
- * operations with no return type.
11
- */
12
- export default class YINIVisitor<IResult> extends YiniParserVisitor<IResult> {
13
- private reversedTree;
14
- private errorHandler;
15
- private isStrict;
16
- private lastActiveSectionAtLevels;
17
- private lastActiveSectionNameAtLevels;
18
- private numOfLevelOnes;
19
- private level;
20
- private prevLevel;
21
- private prevSectionName;
22
- private meta_numOfSections;
23
- private meta_numOfMembers;
24
- private meta_numOfChains;
25
- private meta_maxLevelSection;
26
- private existingSectionTitlesAtLevels;
27
- private hasDefinedSectionTitle;
28
- private setDefineSectionTitle;
29
- constructor(errorHandler: ErrorDataHandler, isStrict: boolean);
30
- private pushOnTree;
31
- private getDepthOfLevels;
32
- private setLastActiveSection;
33
- /**
34
- * Visit a parse tree produced by `YiniParser.yini`.
35
- * @param ctx the parse tree
36
- * @return the visitor result
37
- */
38
- visitYini: (ctx: YiniContext, isStrict?: boolean) => any;
39
- /**
40
- * Will visit here on EVERY section.
41
- * @param ctx the parse tree
42
- * @returns { [sectionName]: sectionObj }
43
- */
44
- visitSection: (ctx: SectionContext) => any;
45
- /**
46
- * Visit a parse tree produced by `YiniParser.bad_member`.
47
- * @param ctx the parse tree
48
- * @return the visitor result
49
- */
50
- visitBad_member: (ctx: Bad_memberContext) => any;
51
- /**
52
- * Visit a parse tree produced by `YiniParser.terminal_line`.
53
- * @param ctx the parse tree
54
- * @return the visitor result
55
- */
56
- visitTerminal_line?: (ctx: Terminal_lineContext) => IResult;
57
- /**
58
- * Visit a parse tree produced by `YiniParser.section_members`.
59
- * In here will mount object onto members object.
60
- * @param ctx the parse tree
61
- * @returns { key: value, ... }
62
- */
63
- visitSection_members: (ctx: Section_membersContext) => any;
64
- /**
65
- * Visit every single section or member (any key-value pair such as
66
- * key=value or key=[...] etc.).
67
- * @returns {
68
- type: resultType,
69
- key: resultKey,
70
- value: resultValue,
71
- }: IResult
72
- */
73
- visitMember: (ctx: MemberContext) => IResult;
74
- /**
75
- * Visit a parse tree produced by `YiniParser.member_colon_list`.
76
- * @param ctx the parse tree
77
- * @return the visitor result
78
- */
79
- visitMember_colon_list: (ctx: Member_colon_listContext) => IResult;
80
- /**
81
- * Visit a parse tree produced by `YiniParser.value`.
82
- * @param ctx the parse tree
83
- * @return the visitor result
84
- */
85
- visitValue: (ctx: ValueContext) => any;
86
- /**
87
- * Visit a parse tree produced by `YiniParser.string_literal`.
88
- * @param ctx the parse tree
89
- * @return the visitor result
90
- */
91
- visitString_literal: (ctx: String_literalContext) => IResult;
92
- /**
93
- * Visit a parse tree produced by `YiniParser.number_literal`.
94
- * @param ctx the parse tree
95
- * @return the visitor result
96
- */
97
- visitNumber_literal: (ctx: Number_literalContext) => IResult;
98
- /**
99
- * Visit a parse tree produced by `YiniParser.boolean_literal`.
100
- * @param ctx the parse tree
101
- * @return the visitor result
102
- */
103
- visitBoolean_literal: (ctx: Boolean_literalContext) => IResult;
104
- /**
105
- * Visit a parse tree produced by `YiniParser.null_literal`.
106
- * @param ctx the parse tree
107
- * @return the visitor result
108
- */
109
- visitNull_literal: (ctx: Null_literalContext) => IResult;
110
- /**
111
- * Visit a parse tree produced by `YiniParser.object_literal`.
112
- * @param ctx the parse tree
113
- * @return the visitor result
114
- */
115
- visitObject_literal: (ctx: Object_literalContext) => IResult;
116
- /**
117
- * Visit a parse tree produced by `YiniParser.objectMemberList`.
118
- * @param ctx the parse tree
119
- * @return the visitor result
120
- */
121
- visitObjectMemberList: (ctx: ObjectMemberListContext) => IResult;
122
- /**
123
- * Visit a parse tree produced by `YiniParser.objectMember`.
124
- * @param ctx the parse tree
125
- * @return the visitor result
126
- */
127
- visitObjectMember: (ctx: ObjectMemberContext) => IResult;
128
- /**
129
- * Visit a parse tree produced by `YiniParser.list`.
130
- * @param ctx the parse tree
131
- * @return the visitor result
132
- */
133
- visitList: (ctx: ListContext) => IResult;
134
- /**
135
- * Visit a parse tree produced by `YiniParser.list_in_brackets`.
136
- * @param ctx the parse tree
137
- * @return the visitor result
138
- */
139
- visitList_in_brackets: (ctx: List_in_bracketsContext) => IResult;
140
- /**
141
- * Visit a parse tree produced by `YiniParser.elements`.
142
- * @param ctx the parse tree
143
- * @return the visitor result
144
- */
145
- visitElements: (ctx: ElementsContext) => IResult;
146
- /**
147
- * Visit a parse tree produced by `YiniParser.element`.
148
- * @param ctx the parse tree
149
- * @return the visitor result
150
- */
151
- visitElement: (ctx: ElementContext) => any;
152
- /**
153
- * Visit a parse tree produced by `YiniParser.string_concat`.
154
- * @param ctx the parse tree
155
- * @return the visitor result
156
- */
157
- visitString_concat?: (ctx: String_concatContext) => IResult;
158
- }