yini-parser 1.3.3-beta → 1.4.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,5 +1,34 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.4.1-beta - 2026 Mar
4
+ - **Improved:** Error reporting now provides more accurate line and column positions in parser diagnostics.
5
+ - **Improved:** Invalid escape sequences in C-strings are now reported as proper user-facing syntax errors instead of internal/raw runtime errors.
6
+ - **Improved:** Parser diagnostics and metadata now use clearer and more consistent error/advice wording.
7
+ - **Fixed:** Several error paths that previously produced confusing internal stack traces or less precise locations now surface clearer parse-time messages.
8
+
9
+ ## 1.4.0-beta - 2026 Feb
10
+
11
+ ### ✨ Added
12
+ - Full implementation of **Classic (C) string literals** (`c"..."`, `C'...'`) according to specification section 6.2.
13
+ - Complete support for all defined escape sequences:
14
+ - `\\`, `\'`, `\"`, `\/`
15
+ - `\0`, `\?`, `\a`, `\b`, `\f`, `\n`, `\r`, `\t`, `\v`
16
+ - `\xhh` (2-digit hex)
17
+ - `\uhhhh` (UTF-16)
18
+ - `\Uhhhhhhhh` (UTF-32)
19
+ - `\oOOO` (octal, up to 3 digits, range `\o0`–`\o377`)
20
+
21
+ ### 🔒 Improved
22
+ - Strict validation of invalid escape sequences (e.g. `\z`, malformed `\x`, `\u`, `\U`, `\o`).
23
+ - Enforcement of control character rules (U+0000–U+001F must be escaped in Classic strings).
24
+ - Proper handling of Classic string concatenation (`+`) including mixed raw + classic combinations.
25
+
26
+ ### 🧪 Tests
27
+ - Expanded integration test coverage for Classic strings.
28
+ - Added validation tests for all escape types and error conditions.
29
+
30
+ ---
31
+
3
32
  ## 1.3.3-beta - 2025 Dec
4
33
  This release strengthens correctness and reliability, while preserving the existing API and improving guarantees.
5
34
  - **Added:**
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # YINI Parser for Node.js
2
2
  > **Readable configuration without YAML foot-guns or JSON noise.**
3
3
 
4
- The official TypeScript / Node.js parser for YINI. An INI-inspired configuration format with clear nesting, explicit types, and predictable parsing.
4
+ The official TypeScript / Node.js parser for **YINI** an INI-inspired, human-readable text format for structured information.
5
5
 
6
- [![npm version](https://img.shields.io/npm/v/yini-parser.svg)](https://www.npmjs.com/package/yini-parser) [![All Test Suites](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-all-tests.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-all-tests.yml) [![All Regression Tests](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-regression-tests.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-regression-tests.yml) [![Grammar Drift Check](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-grammar-drift-check.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-grammar-drift-check.yml)
6
+ [![npm version](https://img.shields.io/npm/v/yini-parser.svg)](https://www.npmjs.com/package/yini-parser) [![All Test Suites](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-all-tests.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-all-tests.yml) [![All Regression Tests](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-regression-tests.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-regression-tests.yml) [![Grammar Drift Check](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-grammar-drift-check.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-grammar-drift-check.yml) [![npm downloads](https://img.shields.io/npm/dm/yini-parser)](https://www.npmjs.com/package/yini-parser)
7
7
 
8
8
  Designed to bring structure, clarity, and predictable behavior to real-world configuration needs. Well suited for applications, tools, and services that need readable yet structured configuration.
9
9
 
@@ -16,10 +16,19 @@ import YINI from 'yini-parser'
16
16
  const config = YINI.parseFile('./config.yini')
17
17
  ```
18
18
 
19
+ ```sh
20
+ npm run test
21
+ ```
22
+
19
23
  ➡️ See full [documentation or YINI format specification](https://github.com/YINI-lang/YINI-spec)
20
24
 
21
25
  ---
22
26
 
27
+ ## Example of YINI code
28
+ > A basic YINI configuration example, showing a section, nested section, comments:
29
+ ![YINI Config Example](./samples/basic.yini.png)
30
+ Source: [basic.yini](./samples/basic.yini)
31
+
23
32
  ## YINI Parser – (source code in TypeScript)
24
33
 
25
34
  A runtime parser for the official [YINI configuration file format](https://github.com/YINI-lang/YINI-spec).
@@ -28,12 +37,6 @@ The parser follows the official YINI specification and is implemented in TypeScr
28
37
 
29
38
  ---
30
39
 
31
- ### Who is this for?
32
-
33
- YINI is designed as an ideal option for application developers, platform teams, DevOps engineers, and anyone maintaining complex configuration at scale.
34
-
35
- ---
36
-
37
40
  ## Quick Start
38
41
 
39
42
  A small example using YINI in TypeScript/JavaScript:
@@ -43,8 +46,8 @@ import YINI from 'yini-parser'
43
46
  const config = YINI.parse(`
44
47
  // YINI is a simple, human-readable configuration file format.
45
48
 
46
- // Note: In YINI, spaces and tabs don't change meaning -
47
- // indentation is just for readability.
49
+ // Note: In YINI, spaces and tabs never change meaning.
50
+ // Indentation is only for readability.
48
51
 
49
52
  ^ App // Definition of section (group) "App"
50
53
  name = 'My Title' // Keys and values are written as key = value
@@ -86,20 +89,24 @@ false
86
89
 
87
90
  That's it!
88
91
 
89
- - ▶️ Link to [examples/](https://github.com/YINI-lang/yini-parser-typescript/tree/main/examples) files.
90
92
  - ▶️ Link to [Demo Apps](https://github.com/YINI-lang/yini-demo-apps/tree/main) with complete basic usage.
91
93
 
92
94
  ---
93
95
 
94
- ## 📂 Examples
96
+ ## Example 2
97
+ > A real-world YINI configuration example, showing sections, nesting, comments, and multiple data types:
98
+ ![YINI Config Example](./samples/config.yini.png)
99
+ Source: [config.yini](./samples/config.yini)
100
+
101
+ ## 📂 More Examples
102
+
103
+ - ▶️ Explore more [YINI examples](https://yini-lang.org/learn-yini/examples/?utm_source=yini-parser-ts&utm_medium=github&utm_campaign=repo-link&utm_content=readme).
95
104
 
96
- See the [examples/](https://github.com/YINI-lang/yini-parser-typescript/tree/main/examples) folder for:
105
+ ---
97
106
 
98
- - Basic YINI file with common types and comments
99
- - Nested sections example
100
- - Comparison with JSON/YAML config
107
+ ### Who is this for?
101
108
 
102
- These examples are also included in the npm package.
109
+ YINI is designed as an ideal option for application developers, platform teams, DevOps engineers, and anyone maintaining complex configuration at scale.
103
110
 
104
111
  ---
105
112
 
@@ -107,7 +114,7 @@ These examples are also included in the npm package.
107
114
  - **Indentation-independent structure:** The YINI config format is indentation-independent, meaning spaces and tabs never affect meaning.
108
115
  - **Explicit nesting for easy refactoring & large configs:** It uses clear header markers (`^`, `^^`, `^^^`) to define hierarchy (like in Markdown), without long dotted keys.
109
116
  - **Multiple data types:** Supports boolean literals (`true` / `false`, `Yes` / `No`, etc), numbers, arrays (lists), and JS-style objects natively, with explicit string syntax.
110
- - **Comments support:** YINI supports multiple comment styles (`#`, `//`, `/* ... */`, and `;`) allowing one to document config directly in the file.
117
+ - **Comments support:** YINI supports multiple comment styles (`#`, `//`, `/* ... */`, and `;`). Allows you to document configuration directly in the file.
111
118
  - **Predictable parsing rules:** Fewer production surprises, well-defined rules with optional strict and lenient modes, for different use cases.
112
119
 
113
120
  ---
@@ -118,9 +125,9 @@ These examples are also included in the npm package.
118
125
  - Easy programmatic usage.
119
126
  - Only the `YINI` class is exported; all internal details are private.
120
127
  - Arrays/Lists (bracketed): `list = [10, 20, 30]`
121
- - JavaScript-style objects.
128
+ - JavaScript-style objects (inline maps).
122
129
 
123
- **Enjoying YINI?** If you think this project is interesting, [consider giving it a star on GitHub](https://github.com/YINI-lang/yini-parser-typescript) — it's greatly appreciated.
130
+ ⭐ If you find this useful, please consider starring the project on GitHub.
124
131
 
125
132
  ---
126
133
 
@@ -155,7 +162,7 @@ pnpm add yini-parser
155
162
  const YINI = require('yini-parser').default;
156
163
  // (!) If you get undefined, try:
157
164
  // (Some Node.js setups require the .default property, others don't, due to ESM/CommonJS interop quirks.)
158
- const YINI = require('yini-parser');
165
+ // const YINI = require('yini-parser');
159
166
 
160
167
  // Parse from string.
161
168
  const config = YINI.parse(`
@@ -210,7 +217,7 @@ const configFromFile = YINI.parseFile('./config.yini');
210
217
  ### Planned & Upcoming Features
211
218
  Some advanced YINI features are still evolving and are tracked transparently.
212
219
 
213
- You can follow progress in the [YINI parser GitHub repo-FEATURE-CHECKLIST](https://github.com/YINI-lang/yini-parser-typescript/blob/main/FEATURE-CHECKLIST.md). Contributions and feature requests are welcome!
220
+ You can follow progress in the [YINI parser FEATURE-CHECKLIST](https://github.com/YINI-lang/yini-parser-typescript/blob/main/FEATURE-CHECKLIST.md). Contributions and feature requests are welcome!
214
221
 
215
222
  ---
216
223
 
@@ -225,13 +232,13 @@ If this library is useful to you, a GitHub star helps guide future development.
225
232
  ---
226
233
 
227
234
  ## 📚 Documentation
228
- - [Development Setup](https://github.com/YINI-lang/yini-parser-typescript/blob/main/docs/Development-Setup.md) — How to run, test, and build the project, etc.
235
+ - [Project Setup](https://github.com/YINI-lang/yini-parser-typescript/blob/main/docs/Project-Setup.md) — How to run, test, and build the project, etc.
229
236
  - [Conventions](https://github.com/YINI-lang/yini-parser-typescript/blob/main/docs/Conventions.md) — Project conventions, naming patterns, etc.
230
237
 
231
238
  ---
232
239
 
233
240
  ## Links
234
- - ➡️ [Read the YINI Specification](https://github.com/YINI-lang/YINI-spec/blob/release/YINI-Specification.md#table-of-contents)
241
+ - ➡️ [Read the YINI Specification](https://github.com/YINI-lang/YINI-spec/tree/production/YINI-Specification.md#table-of-contents)
235
242
  *Full formal spec for the YINI format, including syntax and features.*
236
243
 
237
244
  - ➡️ [YINI CLI on GitHub](https://github.com/YINI-lang/yini-cli)
@@ -240,6 +247,9 @@ If this library is useful to you, a GitHub star helps guide future development.
240
247
  - ➡️ [YINI Project](https://github.com/YINI-lang)
241
248
  *YINI home on GitHub.*
242
249
 
250
+ - ➡️ [YINI Homepage](https://yini-lang.org)
251
+ *Tutorials & Docs.*
252
+
243
253
  ---
244
254
 
245
255
  ## License
@@ -250,6 +260,8 @@ In this project on GitHub, the `libs` directory contains third party software an
250
260
  ---
251
261
 
252
262
  **^YINI ≡**
253
- > An INI-inspired configuration format with clear structure.
263
+ > Readable like INI. Structured like JSON. No indentation surprises.
264
+ >
265
+ > Predictable configuration with clear rules.
254
266
 
255
- [yini-lang.org](https://yini-lang.org) · [YINI on GitHub](https://github.com/YINI-lang)
267
+ [yini-lang.org](https://yini-lang.org/?utm_source=github&utm_medium=referral&utm_campaign=yini_parser_ts&utm_content=readme_footer) · [YINI on GitHub](https://github.com/YINI-lang)
package/dist/YINI.js CHANGED
@@ -24,7 +24,7 @@ class YINI {
24
24
  */
25
25
  static setTabSize(spaces) {
26
26
  if (spaces < 1 || spaces > 32) {
27
- new errorDataHandler_1.ErrorDataHandler('None/Ignore').pushOrBail(null, 'Fatal-Error', `Invalid tab size ${spaces} is out of range.`, 'Tab size must be between 1 and 32 spaces.');
27
+ new errorDataHandler_1.ErrorDataHandler('None/Ignore').pushOrBail(undefined, 'Fatal-Error', `Invalid tab size ${spaces} is out of range.`, 'Tab size must be between 1 and 32 spaces.');
28
28
  throw new RangeError(`Tab size ${spaces} is out of range (1–32).`);
29
29
  }
30
30
  this.g_tabSize = spaces;
package/dist/YINI.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"YINI.js","sourceRoot":"","sources":["../src/YINI.ts"],"names":[],"mappings":";;AAAA,sCAA6C;AAC7C,8DAA0D;AAC1D,sEAAqE;AACrE,4CAA4C;AAO5C,yCAAiE;AAEjE,MAAM,gBAAgB,GAAG,CAAC,CAAA,CAAC,6EAA6E;AAExG;;;;GAIG;AACH,MAAqB,IAAI;IAIrB;;OAEG;IACI,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,CAAC,SAAS,CAAA;IACzB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,UAAU,CAAC,MAAc;QACnC,IAAI,MAAM,GAAG,CAA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A;IACjB,CAAC;IA6GD,yEAAyE;IACzE,gGAAgG;IAChG,6HAA6H;IACtH,MAAM,CAAC,SAAS,CACnB,QAAgB,EAChB,IAA6B,EAAE,uBAAuB;IACtD,YAAgC,MAAM,EACtC,eAAe,GAAG,KAAK;QAEvB,IAAA,kBAAU,EAAC,iDAAiD,CAAC,CAAA;QAC7D,IAAA,kBAAU,EAAC,sBAAsB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QAElD,IAAA,kBAAU,GAAE,CAAA;QACZ,IAAA,kBAAU,EACN,iEAAiE,CACpE,CAAA;QACD,MAAM,OAAO,GAAG,IAAI,qBAAW,CAAC,MAAM,CAAC,CAAA;QAEvC,MAAM,MAAM,GAAG,IAAA,sCAAmB,EAAC,IAAI,CAAC;YACpC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,kCAAkC;YACxE,CAAC,CAAC,OAAO,CAAC,WAAW;YACf,4DAA4D;YAC5D,QAAQ,EACR,IAA2B,EAC3B,SAAS,EACT,eAAe,CAClB,CAAA;QAEP,IAAA,kBAAU,EAAC,kDAAkD,CAAC,CAAA;QAC9D,OAAO,MAAM,CAAA;IACjB,CAAC;;AAvTD,2IAA2I;AAC5H,cAAS,GAAG,gBAAgB,CAAA,CAAC,0CAA0C;kBAFrE,IAAI"}
@@ -30,6 +30,8 @@ export default class ASTBuilder<Result> extends YiniParserVisitor<Result> {
30
30
  constructor(errorHandler: ErrorDataHandler, options: IParseCoreOptions, sourceType: TSourceType, metaFileName: string | null);
31
31
  private hasDefinedSectionTitle;
32
32
  private setDefineSectionTitle;
33
+ private extractStringParts;
34
+ private extractStringKindAndValue;
33
35
  /** Attach a section to the stack respecting up/down moves (Spec 5.3). :contentReference[oaicite:7]{index=7} */
34
36
  private attachSection;
35
37
  /** Insert a key/value into current section (duplicate handling per options). */