From 52db88269eb586371782b7e81f7e3aafd9a03822 Mon Sep 17 00:00:00 2001 From: ToyB-Chan Date: Fri, 31 Jan 2025 05:04:25 +0100 Subject: [PATCH] Update README.md --- README.md | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 767c9fe..86cbec9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,87 @@ + + # mini-file-format -minimalized ini + +Minimalized ini format with concrete format rules. Meant to be easily read and easily parsed. +Ends with `.mini` i.e. `config.mini`. + +## Sections and Keys + +- Sections are denoted by square brackets (`[Section]`). +- Subsections are nested within sections using dot notation (`[Section.Subsection]`). +- All subsections must be explicitly defined before use. +- Subsections can be empty. +- Keys within sections or subsections use `key = value` syntax. +- Key names may only contain `a-z`, `A-Z`, and `0-9`. +- Empty keys (i.e., keys without values) are not allowed. +- Spaces outside of strings are ignored. +- Comments are denoted by `#` and may only appear on separate lines. + +## Supported Data Types + +The format supports the following data types: + +### Integer +- Defined as a sequence of digits (`0-9`). +- Example: `value = 5` + +### String +- Strings are enclosed in double quotes (`""`). +- Strings support escape sequences using backslashes (`\`). +- Supported escape sequences: + - `\"` for a double quote (`"`) + - `\n` for a newline + - `\t` for a tab +- Example: `string = "Line 1\nLine 2"` +- Example: `string = "Tab\tSeparated"` +- Example: `string = "My \"escaped\" String"` + +### Array +- Arrays are enclosed in square brackets (`[]`) and contain comma-separated values. +- Arrays may only contain one datatype. +- Example: `array = [5, 6, 10]` + +### Boolean +- Boolean values are represented as `true` or `false`. +- Example: `myBool = false` + +### Floating-Point Numbers +- Floating-point numbers use `.` for decimal notation or `e` for scientific notation. +- Floats always end with `f`. +- Floats may also be whole numbers without a decimal point. +- Example: `anotherValue = 1.065f` +- Example: `thisToo = 1e18f` +- Example: `scientificFloat = 1.534e3f` +- Example: `wholeFloat = 1f` + +### Hexadecimal Numbers +- Hexadecimal numbers are prefixed with `0x`. +- Example: `hexValue = 0xFA8` + +### Binary Numbers +- Binary numbers are prefixed with `0b`. +- Example: `binValue = 0b0010010` + +### Underscore in Numbers +- Numbers can contain underscores (`_`) for readability. +- Example: `anotherDec = 1_000_375` + +## Example Structure +```text +[Section] +integer = 5 +string = "My String" +array = [5, 6, 10] +myBool = false + +# A comment +[Section.Subsection] +float = 1.065f +float2 = 1e18f +hexValue = 0xFA8 + +[Section.Subsection.Subsection] +binValue = 0b0010010 +anotherDec = 1_000_375 +``` +