+
Skip to content

jba/gdl

Repository files navigation

gdl

GDL is a declarative language inspired by the format of files like go.mod and go.work.

It can be used for configuration or declarative specifications.

Syntax

A file is sequence of lines. Blank lines and lines beginning with "//" are ignored.

Each line is split into words on whitespace. Exceptions:

  • Double-quoted strings, Go syntax.
  • Backquoted strings, Go syntax (they may span lines).
  • A final backslash continues the line.

A word is interpreted as an int, float, bool or string, according to Go syntax (except that strings don't require quotation). Only "true" and "false" are bools; other strings acceptable to strconv.ParseBool, like "t" and "FALSE", are not.

If the last word is "(", the other words in the line become a prefix to the following lines, up to a line consisting only of ")".

Example:

foo (
  bar
  baz
)

is equivalent to

foo bar
foo baz

Mapping To JSON

A JSON object {"a": 1, "b": 2} could be represented as

a 1
b 2

A JSON list [1, 2, 3] could be represented as

(
  1
  2
  3
)

About

A description language inspired by the Go file format.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载