Only this pageAll pages
Powered by GitBook
1 of 5

TON

Loading...

Loading...

Tooling

Loading...

Editor Extensions

Installation

TON can be installed as a in two ways:

To install TON globally, run dotnet tool install ton -g. This will allow you to run the ton CLI driver anywhere, assuming you have .

To install TON locally in a .NET-based project with a , omit the -g option. This will require you to run dotnet ton from the project directory.

.NET tool
set up your PATH appropriately
tool manifest

CLI Driver

ton <command> [arguments...] [options...]

The ton command line tool is the driver for the reference implementation of TON. It supports evaluation, validation, formatting, and conversion of TON code and data files, and provides a language service for use in text editors.

Option
Description
Default

--color <color>

Specifies when to use colored output (auto, always, never).

auto

ton check

ton check <input>

Checks that a TON file evaluates successfully.

For a code file, this command runs the script to completion and discards any resulting data. For a data file, this command just checks whether the file parses successfully.

ton convert

ton convert <mode> <input> <output>

Converts between TON and other data formats.

Valid mode values are:

  • xml2ton: Convert an input XML file to a TON data file.

  • ton2xml: Convert an input TON code or data file to an XML file.

Note that conversion is done on a best-effort basis; some niche language constructs may not be translated.

ton format

ton format [input] [options...]

Formats a TON code or data file according to the official formatting conventions, or optionally in a minified fashion.

If no input file is given, this command reads from standard output and --fix will be ignored.

Option
Description
Default

--fix

Enables automatic in-place fixing.

false

--diff

Enables printing diffs instead of formatted code.

false

--minify

Enables minification instead of normal formatting.

false

ton info

ton info

Prints runtime environment information.

ton reduce

ton reduce <input> <output>

Converts a TON code file to a data file.

This command runs the script to completion and outputs the resulting data using the official formatting conventions. If this command is invoked with a data file as input, it effectively functions as a roundabout ton format.

ton serve

ton serve [options...]

Runs the TON language service.

Option
Description
Default

--stdio

Enables standard I/O communication.

true

The language service can be used by e.g. the .

Visual Studio Code extension

Home

This is currently in-development vaporware.

TON (Tree Object Notation) is a modern data language featuring two dialects: One for programmatic generation of data, and a static subset for safe data interchange.

The original motivation for the creation of TON was the maintenance of the sorts of large data sheets that video games often use to describe things like areas, items, quests, characters, skills, etc. The code dialect should be well-suited to any similar use case. On the other hand, the data dialect can is well-suited as a safe and more compact replacement for XML and JSON, e.g. in networked APIs.

TON is an open standard. This project provides both the specification and the reference implementation in C#.

TON is designed to be a pleasant and compact replacement for both and , combining the best qualities of each, while allowing advanced users to programmatically generate large data sets using the full language dialect. At its simplest, TON can be used as a static data format just like XML or JSON, while at its full potential, it can be used to maintain large and complex textual databases at a level of maintainability that such data formats simply cannot achieve.

XML
JSON