yini-parser 1.0.0-beta.1 → 1.0.1-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.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 1.0.0-beta.1
3
+ ## 1.0.1-beta - 2025 Aug
4
+ - Fixed catching lexer related errors correctly.
5
+ - Improves error and test handling for invalid YINI syntax.
6
+ - Grammar logic updated to catch bad systax specifically related to bad syntax for (key-value) members.
7
+ - Added another testing suite for reported and fixed tests.
8
+ - Added another testing suite for golden tests.
9
+ - Updated to the latest grammar (logic) version 1.0.0-rc.2.
10
+
11
+ ## 1.0.0-beta.1 - 2025-07-26
4
12
  - Package updated to **beta**. The core API is stabilizing, some more advanced features may still change.
5
13
  - Bugfix, fixed exports cleanly (so this lib can be imported in CJS and in full ESM).
6
14
  - Implemented support for colon lists, both empty and with elements, including nested lists. Also updated to the latest grammar, which fixes handling of empty lists with or without spaces or tabs between the brackets.
7
15
  - Optimized the top part of readme for npmjs Short Page.
8
16
  - Added a dir `examples/` with a few example Yini files, `compare-formats.md` and TS file.
9
- - Updated to the latest grammar (logic) to the spec 1.0.0-rc.1.
17
+ - Updated to the latest grammar (logic) version 1.0.0-rc.1.
10
18
 
11
19
  ## 1.0.0-alpha.7
12
20
  - Fixed serious bug that on error did exit process.
package/README.md CHANGED
@@ -71,7 +71,10 @@ false
71
71
  name: 'My Title',
72
72
  items: 25,
73
73
  darkMode: true,
74
- Special: { primaryColor: 3368601, isCaching: false }
74
+ Special: {
75
+ primaryColor: 3368601,
76
+ isCaching: false
77
+ }
75
78
  }
76
79
  }
77
80
  ```
@@ -547,6 +550,7 @@ We welcome feedback, bug reports, feature requests, and code contributions!
547
550
  - ➡️ [Official YINI Parser on npm](https://www.npmjs.com/package/yini-parser) (npm)
548
551
  - ➡️ [YINI Parser GitHub Repo](https://github.com/YINI-lang/yini-parser-typescript) (GitHub)
549
552
  - ➡️ [YINI vs Other Formats](https://github.com/YINI-lang/YINI-spec/blob/develop/Docs/Examples%20of%20YINI%20vs%20Other%20Formats.md)
553
+ - ➡️ [YINI Project](https://github.com/YINI-lang) (home)
550
554
 
551
555
  ---
552
556
 
package/dist/YINI.js CHANGED
@@ -50,8 +50,7 @@ YINI.parse = (yiniContent, strictMode = false, bailSensitivity = 'auto', include
50
50
  level = 0;
51
51
  if (strictMode)
52
52
  level = 1;
53
- if (process.env.NODE_ENV === 'test')
54
- level = 1;
53
+ // if (process.env.NODE_ENV === 'test') level = 1
55
54
  }
56
55
  else {
57
56
  level = bailSensitivity;
@@ -115,8 +114,7 @@ YINI.parseFile = (filePath, strictMode = false, bailSensitivity = 'auto', includ
115
114
  level = 0;
116
115
  if (strictMode)
117
116
  level = 1;
118
- if (process.env.NODE_ENV === 'test')
119
- level = 1;
117
+ // if (process.env.NODE_ENV === 'test') level = 1
120
118
  }
121
119
  else {
122
120
  level = bailSensitivity;
@@ -1,4 +1,4 @@
1
- import { 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';
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
2
  import YiniParserVisitor from '../grammar/YiniParserVisitor';
3
3
  import { ErrorDataHandler } from './ErrorDataHandler';
4
4
  export type TDataType = undefined | 'String' | 'Number-Integer' | 'Number-Float' | 'Boolean' | 'Null' | 'Object' | 'List';
@@ -42,6 +42,12 @@ export default class YINIVisitor<IResult> extends YiniParserVisitor<IResult> {
42
42
  * @returns { [sectionName]: sectionObj }
43
43
  */
44
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;
45
51
  /**
46
52
  * Visit a parse tree produced by `YiniParser.terminal_line`.
47
53
  * @param ctx the parse tree
@@ -496,6 +496,15 @@ class YINIVisitor extends YiniParserVisitor_1.default {
496
496
  members: members,
497
497
  };
498
498
  };
499
+ /**
500
+ * Visit a parse tree produced by `YiniParser.bad_member`.
501
+ * @param ctx the parse tree
502
+ * @return the visitor result
503
+ */
504
+ this.visitBad_member = (ctx) => {
505
+ ctx.REST;
506
+ this.errorHandler.pushOrBail(ctx, 'Syntax-Error', 'Invalid or malformed member found.', `Offending text: ${ctx.getText()}`);
507
+ };
499
508
  /**
500
509
  * Visit a parse tree produced by `YiniParser.section_members`.
501
510
  * In here will mount object onto members object.
@@ -46,6 +46,7 @@ export default class YiniLexer extends Lexer {
46
46
  static readonly LINE_COMMENT = 44;
47
47
  static readonly INLINE_COMMENT = 45;
48
48
  static readonly IDENT_INVALID = 46;
49
+ static readonly REST = 47;
49
50
  static readonly EOF: number;
50
51
  static readonly channelNames: string[];
51
52
  static readonly literalNames: (string | null)[];