
Page generated from: QSet_AI_v4.3.md
(AI-Learning Doc)
Version: 4.3
Purpose: Parse and generate Q-Set (.qset) files
Spec Reference: QSet\_Spec\_v4\_3.md
Q-Set is a simplified, human-readable data format for configuration files, tables, and structured text. Files use .qset extension (or .set with Q-Set conventions).
Key Principle: Default delimiters, line-based parsing, minimal escaping.
Group markers: [ ]
Text group: [{ }]
Field delimiter: |
Escape character: \
Secondary delim: ! (for nested arrays)
End of group: [EOG] or empty line
filename.qset ← Filename (optional but strongly recommended)
Comments outside groups ← Ignored by parser
Can span multiple lines
[GROUPNAME] ← Group start
Key|Value ← Key-value pairs
AnotherKey|AnotherValue
← Empty line = end of group
[TABLE_GROUP] ← Another group
{field1|field2|field3} ← Field definition
row1val1|row1val2|row1val3 ← Data rows
row2val1|row2val2|row2val3
[{TEXT_GROUP}] ← Text group (no escaping)
Raw text content here
Pipes | and backslashes \ are literal
No delimiter processing
[EOG] ← Explicit end (text groups don't end on empty lines)
[GROUPNAME] = Regular group start[{GROUPNAME}] = Text group start[EOG] = Explicit group end[A-Za-z0-9_-]+ (no spaces/special chars)\| → |)| delimiter{field|names} = field definition* When present: group becomes a table, subsequent lines are data rows
* Data rows should match field count (trailing empty fields may be omitted)
[EOG], new group, or EOF[EOG], new group marker, or EOF
config.qset
[DATABASE]
Host|localhost
Port|5432
User|admin
[APP_SETTINGS]
Theme|dark
Debug|true
data.qset
[USERS]
{id|username|email|active}
1|alice|alice@example.com|true
2|bob|bob@example.com|false
3|charlie|charlie@example.com|true
config.qset
[SERIAL_PORT]
protocol|rs232
9600|8|n|1|none
flow_control|rts/cts
No field validation - each line parsed independently.
content.qset
[{README}]
# Project Title
This content is **preserved exactly**.
Pipes | and backslashes \ are literal.
No escape processing happens here.
[EOG]
[CONFIG]
AppName|MyApp
mixed.qset
Application configuration and documentation
[METADATA]
Name|MyApplication
Version|2.1.0
[{LICENSE}]
MIT License
Copyright (c) 2025 Your Name
[EOG]
[FEATURES]
{id|name|enabled}
1|Authentication|true
2|Logging|true
3|Analytics|false
When to escape:
\|\ |Data is trimmed:
[PATHS]
WindowsPath|C:\Program Files\App
Expression|value > 10 \| value < 5
BackslashPipe|\mypath\ |data
Spaced| value with spaces |trimmed
Result after parsing:
WindowsPath → "C:\Program Files\App"
Expression → "value > 10 | value < 5"
BackslashPipe → "\mypath\ |data"
Spaced → "value with spaces" (outer spaces trimmed)
Text groups need NO escaping:
[{CODE}]
if (x | y) {
path = C:\Windows\System32
}
[EOG]
[MENU]
{id|label|subitems}
1|File|New!Open!Save!Exit
2|Edit|Cut!Copy!Paste
Parse: Split on |, then split subitems field on !
[CONTACTS]
{id|name|email|phone}
1|Alice|alice@example.com|
2|Bob||555-1234
Empty string between delimiters = empty field.
[TAGS]
production
staging
development
Each line = one value (no field delimiter).
CONFIG, app-settings, Users_2024My Config, [NESTED], settings!{field1|field2|field3}Groups without field definitions:
[SERIAL_CONFIG]
protocol|rs232
9600|8|n|1|none
Each line is independently valid. No field count validation needed.
[EMPTY_GROUP]
[NEXT_GROUP]
Key|Value
Valid. Empty group contains no data.
[CONFIG]
Key1|Value1
This is NOT a comment - it's data without delimiter
Key2|Value2
Lines without | in regular groups = single values.
[{DOCUMENTATION}]
Configuration groups use [GROUPNAME] syntax.
The [EOG] marker ends groups.
[EOG]
Content preserved literally until [EOG] at start of line.
Important: Only [EOG] at the start of a line ends the group. Mid-line [EOG] is literal text.
[{CODE_SAMPLE}]
To end a group, use [EOG] at the start of a line.
[EOG] with leading spaces is treated as content.
Not this [EOG] either - it's mid-line.
[EOG]
Only the final [EOG] (at column 0) terminates the group. The previous two are literal text content.
[CONFIG]
Key1|Value1
[CONFIG]
Key2|Value2
INVALID: Each group MUST have a unique name within the file. Duplicate group names violate the spec.
* Key-value configuration
* Tabular data with consistent structure
* Lists with field definitions
* Multi-line text (README, licenses, templates)
* Code samples
* Any content with literal `|` or `\`
* Base64-encoded data
* Groups: `ALL_CAPS` or `kebab-case`
* Fields: `lowercase` or `camelCase`
* Filename on line 1 (optional but **strongly recommended**)
* Comments before groups (optional)
* Related groups together
* Optional `[EOF]` marker at end
* Blank lines between groups
* Use `[EOG]` for explicit boundaries
* Comment sections for context
Unclosed text group:
[{TEXT}]
Content...
[NEXT_GROUP] ← Missing [EOG]
Invalid group name:
[My Config] ← Spaces not allowed
Mismatched field count (only when field definition exists):
{id|name|email}
1|Alice ← Missing email field
[EOG]Element Syntax Example Regular group [NAME] [CONFIG] Text group [{NAME}] [{LICENSE}] Field definition {f1|f2|f3} {id|name|email} Key-value key|value Host|localhost End group [EOG] or empty line [EOG] Escape pipe | expr|a > 5 | b < 3 Backslash+pipe \ | path|\ |data Nested array ! items|a!b!c Comment Outside groups # Any text Trim fields Auto after split | value | → "value"
When implementing Q-Set parser:
[EOG] explicit terminationWhen generating Q-Set files:
| in regular group data (use \|)\ |)[EOG] for text groups
1. Initialize: groups = {}, current_group = null, in_text_group = false
2. For each line:
a. If line starts with `[{NAME}]` (at column 0):
- Set current_group = NAME, in_text_group = true
- Create groups[NAME] = {type: 'text', content: ''}
b. Else if line starts with `[NAME]` (at column 0):
- Set current_group = NAME, in_text_group = false
- Create groups[NAME] = {type: 'regular', rows: []}
c. Else if line starts with `[EOG]` (at column 0):
- Set current_group = null, in_text_group = false
d. Else if line is empty:
- If not in_text_group: set current_group = null
- If in_text_group: append '\n' to content
e. Else if current_group exists:
- If in_text_group: append line to content
- Else: split on '|', process escapes, trim() each field, add to rows
f. Else: ignore (comment)
3. Return groups
Q-Set uses default delimiters only. For additional features including:
:::)…):!)[THIS-FILE]See SET File Core Specification v4.3
Spec Copyright (c) 2025 Kirk Siqveland
Licensed under CC BY 4.0