matrix-dsl

A simple DSL for fast generation of Matrix Bots or Application Services
git clone git://archive.git.mtrnord.blog/Nordgedanken/matrix-dsl.git
Log | Files | Refs | LICENSE

ast.go (670B)


      1 package lexer
      2 
      3 type Matrix struct {
      4 	Sections   []*Section        `{ @@ }`
      5 	Properties []*PropertyArrays `{ @@ }`
      6 }
      7 
      8 type Section struct {
      9 	Identifier string            `"[""[" @Ident "]""]"`
     10 	Properties []*PropertyArrays `{ @@ }`
     11 }
     12 
     13 type PropertyArrays struct {
     14 	Key    string   `@Ident ":"`
     15 	Arrays []*Array `[ { @@ } ]`
     16 	Value  *Value   `[ | @@ ]`
     17 	Event  *string  `[ | "["@Ident"]" ]`
     18 }
     19 
     20 type Property struct {
     21 	Key   string  `@Ident ":"`
     22 	Value *Value  `[ @@ ]`
     23 	Event *string `[ | "["@Ident"]" ]`
     24 }
     25 
     26 type Array struct {
     27 	Key        string      ` "-"`
     28 	Properties []*Property `{ @@ }`
     29 }
     30 
     31 type Value struct {
     32 	String *string ` @String`
     33 	Bool   *string `| @String`
     34 }