idl_parser ::=
#ignore(C++)
#continue
[
'#' #!ignore ->'\n'
|
declaration(this)
]*
#empty
;
declaration(parent : node) ::=
#readIdentifier:sDecl
declaration<sDecl>(parent)
;
declaration<"struct">(parent : node) ::=
#continue
identifier:sName
=> insert parent.structures[sName].name = sName;
'{'
[attribute_declaration(parent.structures[sName])]*
'}'
';'
;
declaration<"typedef">(parent : node) ::=
"sequence"
'<'
=> local theType;
type_name(theType)
'>'
identifier:sAlias
';'
=> setall parent.sequences[sAlias] = theType;
|
->';'
;
declaration<"interface">(parent : node) ::=
#continue
identifier:sName
=> insert parent.interfaces[sName].name = sName;
=> localref interface = parent.interfaces[sName];
[
':' #continue
identifier:interface.inheritance
]?
'{'
[member_declaration(interface)]*
'}'
';'
;
member_declaration(parent : node) ::= attribute_declaration(parent) | method_declaration(parent);
attribute_declaration(parent : node) ::=
=> local bReadonly;
[#readIdentifier:"readonly":bReadonly]?
=> local theType;
type_name(theType)
identifier:sName
';'
=> insert parent.attributes[sName].name = sName;
=> setall parent.attributes[sName].type = theType;
=> if bReadonly insert parent.attributes[sName].readonly = bReadonly;
;
method_declaration(parent : node) ::=
=> local returnType;
[type_name(returnType) | #readIdentifier:"void"]
identifier:sName
'('
#continue
=> insert parent.methods[sName].name = sName;
=> localref method = parent.methods[sName];
=> setall method.type = returnType;
[
parameter(method)
[',' #continue parameter(method)]*
]?
')'
';'
;
parameter(parent : node) ::=
=> local param;
#readIdentifier:{"in", "inout", "out"}:param.mode
type_name(param.type)
identifier:param.name
=> setall parent.parameters[param.name] = param;
;
type_name(theType : node) ::=
#readIdentifier:sType
[
#check(sType in {"boolean", "double", "long", "string"})
=> insert theType = sType;
|
#check(this.interfaces.findElement(sType))
=> insert theType = sType;
=> insert theType.is_interface = true;
|
#check(this.structures.findElement(sType))
=> insert theType = sType;
=> insert theType.is_structure = true;
|
#check(this.sequences.findElement(sType))
=> {
setall theType.element = this.sequences[sType];
insert theType.is_sequence = true;
}
]
;
identifier:value ::=
#readIdentifier:identifier
#check(!(identifier in {"abstract", "any", "attribute", "boolean", "case", "char", "component", "const", "consults",
"context", "custom", "default", "double", "emits", "enum", "eventtype", "exception", "factory",
"FALSE", "finder", "fixed", "float", "getraises", "home", "import", "in", "inout", "interface",
"local", "long", "manages", "module", "multiple", "native", "Object", "octet", "oneway", "out",
"primarykey", "private", "provides", "public", "publishes", "raises", "readonly", "sequence",
"setraises", "short", "string", "struct", "supports", "switch", "TRUE", "truncatable", "typedef",
"typeid", "typeprefix", "union", "unsigned", "uses", "ValueBase", "valuetype", "wchar", "wstring"}))
;
Generated by CodeWorker v3.8.1 from CWscript2HTML.cwp.