~emersion/scfg

ref: f4faf7b9d4edd656f08865443fd2b314adeb29d8 scfg/README.md -rw-r--r-- 1.7 KiB
f4faf7b9Chris Vittal ABNF typographic fix 5 months ago

#scfg

A simple configuration file format.

The config file has one directive per line. Directives have a name, followed by parameters separated by space characters. Parameters may be quoted. Directives may have children in blocks delimited by "{" and "}". Lines beginning with "#" are comments.

Example:

train "Shinkansen" {
	model "E5" {
		max-speed 320km/h
		weight 453.5t

		lines-served "Tōhoku" "Hokkaido"
	}

	model "E7" {
		max-speed 275km/h
		weight 540t

		lines-served "Hokuriku" "Jōetsu"
	}
}

#Implementations

#Specification (draft)

Grammar in ABNF:

config = *directive

directive = directive-name [ 1*WSP directive-params ] [ 1*WSP block ] newline
directive-name = word
directive-params = [ word ] / word 1*( 1*WSP word )

block = "{" newline *directive "}"

word = atom / dquote-word / squote-word
atom = 1*( ACHAR / esc-pair )
dquote-word = DQUOTE *( DQCHAR / esc-pair ) DQUOTE
squote-word = "'" *SQCHAR "'"
esc-pair = "\" VCHAR

newline = *WSP LF *WSP

ACHAR = %x21 / %x23-26 / %x28-5B / %x5D-7A / %x7C / %x7E / %x80-10FFFF
	; any Unicode code point, excluding CTL, DQUOTE, "\", LF, "'", "{", "}", WSP
DQCHAR = ACHAR / "'" / "{" / "}" / WSP
	; any Unicode code point, excluding CTL, DQUOTE, "\", LF
SQCHAR = %x09 / %x20-26 / %x28-7E / %x80-10FFFF
	; any Unicode code point, excluding CTL, "'", LF
VCHAR = SQCHAR / "'"
	; any Unicode code point, excluding CTL, LF

#License

This specification text is licensed with CC-BY-SA.