Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ulughann/noml
Non Overcomplicated Minimal Language (Notation Language under 7 semicolons)
https://github.com/ulughann/noml
config json markup-language toml yaml
Last synced: 3 months ago
JSON representation
Non Overcomplicated Minimal Language (Notation Language under 7 semicolons)
- Host: GitHub
- URL: https://github.com/ulughann/noml
- Owner: ulughann
- License: mit
- Created: 2023-12-27T17:21:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-27T21:06:23.000Z (about 1 year ago)
- Last Synced: 2024-09-11T22:38:25.515Z (5 months ago)
- Topics: config, json, markup-language, toml, yaml
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NOML
Non Overcomplicated, Minimal Language
By a high school student, under 25 LOC.
> This repository contains everything there is to know about Noml because there isn't much to know anyway.
## Objectives
Noml aims to *over*simplify the *overcomplicated* world of config files. It is a *minimal* language that is ***non overcomplicated** by definition. It also aims to be tiny, with the entire language being under 25 lines of code.
## Contents
- [NOML](#noml)
- [Objectives](#objectives)
- [Contents](#contents)
- [Example](#example)
- [Features](#features)
- [Small](#small)## Example
```py
title = NOML Exampleowner
name = Tom Preston-Wernerdatabase
server = 192.168.1.1
enabled = true
```## Features
### Small
No need to brag about how small it is, here have the entire source code.
```javascript
export function parse(code) {
const configMap = {};
let currentSegment;code.split`\n`.forEach((line = line.trim()) => {
if (line) {
if (line.includes("=")) {
const [key, rawValue] = line.split("=").map((str) => str.trim());
const value =
rawValue.startsWith('"') && rawValue.endsWith('"')
? rawValue.slice(1, -1)
: !isNaN(rawValue)
? +rawValue
: rawValue.toLowerCase() === "true"
? true
: rawValue.toLowerCase() === "false"
? false
: rawValue;if (currentSegment) configMap[currentSegment][key] = value;
else configMap[key] = value;
} else (currentSegment = line), (configMap[currentSegment] = {});
}
});return configMap;
}
```ps. you probably shouldn't use this in production.