melina:meta/xml转换器

melina的Python项目详细描述


melina可以将meta.xml转换为元语言(类似于protobuf)并返回。

melina --meta-out DIR1 meta.xml  # to meta
melina --xml-out DIR2 meta.meta  # back to xml

melina --meta-stdout meta.xml > x.meta  # or to stdout

梅丽娜的语言就是这样的:

/// pdmeta: "1.1", domain: "f", product: "b", release: "AX", version: "1.5", revision: "198"
// line above is a header with meta module versions.
// It needs to be the first symbol in file and start with '///'
moSCALAR{// you can define managed objects like structs in C++
boolx;inty;stringz;};moCOMPLEX{// enum/struct fields contain definition of enum/struct
// enum/struct name should begin with small letter - after all it's a name of variable
enumx{A=1,B,C=2};structy{intz;structv{intw;};};};moCARDINALITY{// you can define cardinality of each managed object or struct field
intx;// required by default
optionalinty;// optional integer, may be null
repeatedintz;// list of integers
repeated(15)intz;// at most 15 'z' integers
};moDEFAULTS{// bool, int, string, enum can have default values
boolx[default=true];inty[default=12];stringz[default="foo bar"];enumv[default=12]{A=1,B=12};};moRANGES{// int/string fields can specify allowed ranges
// if int has a 3-param specifier, it's considered a "float"
int(0..12)x;// allowed integers from 0 to 12 inclusive
int(-0.5,0.5,0.001)y;// allowed floats from -0.5 to 0.5 inclusive with step 0.001
string(0..10)z;// allowed string length from 0 to 10 chars inclusive
};moUNITS{// integers can have units (for documentational purposes)
inty[units="kbps"];};/**
 * Example managed object description.
 */moCOMMENTS{// you can use C++-style '//foo' or '/*foo*/' comments in meta files
// doxygen-style comments '///foo' and '/**foo*/' are treated as mo/field description,
// if present immediately above or rightwards of mo/field
intx;/// Example scalar field description
inty;/** Example scalar field description *//**
     * Example complex type description.
     */structz{};/// Example complex type description.
structv{};};moCHILDREN->FIRST,SECOND,THIRD(10){// managed object can have children defined
// children can have max count specified in parens (at most 10 THIRD children)
};mo(hc)FLAGS{// each managed object has: hidden('h'), create('c'), update('u'), delete('d') flags.
// If not specified, hidden is assumed false, rest is assumed true.
// Specification may be provided as 'hcud' letters in parens.
};

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java的单元测试测试用例库。util。列出实现   java通过超类进行序列化/反序列化   java Android获取设备语言ISO字符串   java如何打开广告的行动。移动   Eclipse IDE for(嵌入式C/C++)开发者202012:经典的深色主题深黑色背景和菜单中的文本   java使用不同的内容动态创建TableView(JavaFX)   java JAXB将多个同名节点解组   java ClassDefNotFoundException,即使类由类加载器加载(服务器上安装了多个应用程序)   java有没有办法关闭在后端生成的MqttClient线程?   html如何在网站上的java小程序中包含图像?   java无法访问已分配给超类引用的子类实例变量   java在TableViewer中双击打开对话框   列出如何创建ListNode。JAVA   java如何从文本中输出的数组中放入随机图像