A C++20 implementation of a TOML parser and language server with JSON conversion capabilities.
- TOML Parsing: Validates and parses TOML files.
- JSON Conversion: Converts parsed TOML content into JSON format.
- Customized Validation: Validate a TOML file against a CSL schema.
- Language Server Support: LSP integration via standard IO, socket, and named pipe.
- Cross-Platform: Supports Windows, Unix-like systems and NodeJS environment.
- Testing: Works with toml-test test suite.
- C++20 Compiler (e.g., GCC 11+, Clang 12+, MSVC 2022+)
- CMake 3.12+
- Boost.Regex (included in
lib/regex
) - nlohmann/json (included in
lib/json
)
- Clone the repository:
git clone https://github.com/nullptr-0/toml.git cd toml
- Build from source:
- Build the native version:
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release cmake --build build
- Build WebAssembly module:
./BuildWasm
- Build the NodeJS version:
cd node npm install npm run compile
- Output to standard IO
path/to/toml --parse path/to/input.toml
- Output to file
path/to/toml --parse path/to/input.toml --output path/to/output.json
Outputs JSON and error/warning listings (and debug information if DEBUG preprocessor definition is present when building). Throws exceptions if DEBUG preprocessor definition is present when building.
- Output to standard IO
path/to/toml --parse path/to/input.toml --validate path/to/csl.csl
- Output to file
path/to/toml --parse path/to/input.toml --validate path/to/csl.csl --output path/to/output.json
- Standard IO Mode:
path/to/toml --langsvr --stdio
- Socket Mode:
or
path/to/toml --langsvr --socket=8080
path/to/toml --langsvr --port=8080
- Named Pipe Mode:
path/to/toml --langsvr --pipe=PipeName
- Input via Standard IO:
path/to/test --parse
- Input via File:
path/to/test --parse path/to/test.toml
Outputs JSON (and debug information and error/warning listings if DEBUG preprocessor definition is present when building). Throws exceptions if DEBUG preprocessor definition is present when building.
├── CMakeLists.txt
├── driver/ # Main and test driver
├── lexer/ # Lexer
├── rdparser/ # Recursive descent parser
├── validator/ # Validator
├── langsvr/ # Language Server
├── shared/ # Common utilities
├── node/ # NodeJS wrapper
└── lib/ # External Libraries
- Project License: Apache 2.0 License
- nlohmann/json: MIT License
- Boost.Regex: Boost Software License 1.0
- Fork the repository
- Create a feature branch
- Submit a pull request with tests
- Follow the C++ Core Guidelines
- Search in the issues in case a similar problem has already been reported
- Gather as much and detailed information as you can
- Create an issue
- Follow the “How To Ask Questions The Smart Way” Guidelines