Go to file
Pavel Shevaev d228b43d1e
Publish PHP Package / docker (push) Successful in 7s Details
Adding support for custom file extension
2024-09-30 20:27:32 +03:00
.gitea/workflows Добавить .gitea/workflows/build_composer.yaml 2024-02-13 15:05:08 +03:00
tests Cleaning metagen package 2022-12-08 19:14:25 +03:00
.gitignore Cleaning metagen package 2022-12-08 19:14:25 +03:00
CHANGELOG.md Добавить CHANGELOG.md 2024-06-21 18:44:30 +03:00
README.md Изменил(а) на 'README.md' 2022-12-09 12:24:17 +03:00
composer.json Fixing autoload 2022-12-08 19:20:32 +03:00
metagen.inc.php Adding validation of type refs pointing to named functions 2024-05-31 20:51:48 +03:00
parser.inc.php Adding support for custom file extension 2024-09-30 20:27:32 +03:00
parser1.inc.php Starting to experiment with new metagen parser v2.0a 2024-04-11 20:16:32 +03:00
parser2.inc.php Starting to experiment with new metagen parser v2.0a 2024-04-11 20:16:32 +03:00

README.md

Metagen package is used to describe structures, interfaces, functions, RPC calls using DSL. This can be useful for codegen, bindings, etc.

Here is an example of some imaginary DSL:

#include enum.meta

func GetPlayer(
    id : uint32
) : DataPlayer

func Apply(
    fn : func(float, DataPlayer) : uint32
)

struct DataPlayer
    @POD @table:player @pkey:id
    id                : uint32
    version           : string @strmax:16
    gold              : uint8 @default:0 #bonus
    registered        : bool @default:true

    func Equals(
        o : DataPlayer
        v : uint32
    ) : bool,bool
end

struct ProtoBase
    id    : uint32
    title : string @strmax:16 @default:"Hello"
end

struct ProtoBuilding extends ProtoBase
    floors : int32
    arr : uint32[] @default:[1,2,3]
end

Look at tests for an actual API usage.