aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
author2026-03-09 23:05:42 +0300
committer2026-03-09 23:05:42 +0300
commit00394a80501960ad26787b5c44435ed5ed67ad84 (patch)
tree672eb918c552c858f32e9533dc3799af6b75769f /example
parent'-' sign in words accepted (diff)
downloadconf-00394a80501960ad26787b5c44435ed5ed67ad84.tar.gz
conf-00394a80501960ad26787b5c44435ed5ed67ad84.tar.bz2
conf-00394a80501960ad26787b5c44435ed5ed67ad84.tar.xz
conf-00394a80501960ad26787b5c44435ed5ed67ad84.zip
Полностью переписал библиотеку. Перевёл с EBNF на PEG.v0.1.0
Diffstat (limited to '')
-rw-r--r--example/file.conf33
-rw-r--r--example/file2.conf7
-rw-r--r--example/main.go27
3 files changed, 0 insertions, 67 deletions
diff --git a/example/file.conf b/example/file.conf
deleted file mode 100644
index d23c7d7..0000000
--- a/example/file.conf
+++ /dev/null
@@ -1,33 +0,0 @@
-# one line comment
-
-simpe_key = "тест_кириллицы";
-simple_key_without_spaces = value;
-
-string_key =
- "value"
- 'string';
-
-multiline_string = `
- multiline
- string
- 123
-`;
-
-int_key = -123.456;
-bool_key = true;
-
-expression1 argument1 "argument2" 123;
-
-# comment can be everywhere
-group_directive_without_arguments {
- expression1 argument2 "string" 123 true;
- expression2 argument3 "string111" 123321 false;
- children_group "some argument" {
- # child group. Can be empty. This is equivalent to directive `children_group "some argument"`
- }
-}
-
-group_directive_with_argument "some other argument" 'second argument' {
- child_val = "children value";
-}
-
diff --git a/example/file2.conf b/example/file2.conf
deleted file mode 100644
index b22f06b..0000000
--- a/example/file2.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-rss = "https://neonxp.ru/feed/";
-db_file = $XDG_DATA_HOME "/pose/pose.db";
-
-telegram {
- token = "279146841:AAsome_secret_token_M";
- groups = "-1003888840756";
-}
diff --git a/example/main.go b/example/main.go
deleted file mode 100644
index c42ab3b..0000000
--- a/example/main.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "go.neonxp.ru/conf"
- "go.neonxp.ru/conf/visitor"
-)
-
-func main() {
- cfg := conf.New()
- if err := cfg.LoadFile("./example/file2.conf"); err != nil {
- panic(err)
- }
-
- pr := visitor.NewDefault()
- if err := cfg.Process(pr); err != nil {
- panic(err)
- }
-
- tok, err := pr.Get("telegram.token")
- if err != nil {
- panic(err)
- }
-
- fmt.Println(tok.String())
-}