LibreOffice Developer's Guide: Appendix D - UNOIDL Syntax Specification

From The Document Foundation Wiki
Jump to navigation Jump to search

The following listing comprises the language specification for UNOIDL in pseudo BNF notation.

 idl-specification ::= declaration*
 
 declaration ::= enum-decl
              | plain-struct-decl
              | poly-struct-template-decl
              | exception-decl
              | interface-forward-decl
              | interface-decl
              | typedef-decl
              | constants-decl
              | module-decl
              | interface-service-decl
              | accumulated-service-decl
              | interface-singleton-decl
              | service-singleton-decl
 
 enum-decl ::= ["published"] "enum" identifier "{" enum-member-decl ("," enum-member-decl)* "}" ";"
 
 enum-member-decl ::= identifier ["=" expr]
 
 plain-struct-decl ::= ["published"] "struct" identifier [single-inheritance] "{" struct-member-decl* "}" ";"
 
 single-inheritance ::= ":" name
 
 struct-member-decl ::= type identifier ";"
 
 poly-struct-template-decl ::= ["published"] "struct" identifier struct-params 
                              "{" poly-struct-member-decl* "}" ";"
 
 struct-params ::= "<" identifier ("," identifier)* ">"
 
 poly-struct-member-decl ::= struct-member-decl | parametric-member-decl
 
 parametric-member-decl ::= identifier identifier ";"
 
 exception-decl ::= ["published"] "exception" identifier [single-inheritance] "{" struct-member-decl* "}" ";"
 
 interface-forward-decl ::= ["published"] "interface" identifier ";"
 
 interface-decl ::= ["published"] "interface" identifier [single-inheritance] "{" interface-member-decl* "}" ";"
 
 interface-member-decl ::= interface-inheritance-decl | attribute-decl | method-decl
 
 interface-inheritance-decl ::= ["[" "optional" "]"] "interface" name ";"
 
 attribute-decl ::= attribute-flags type identifier ["{" attribute-access-decl* "}"] ";"
 
 attribute-flags ::= "[" (attribute-flag ",")* "attribute" ("," attribute-flag)* "]"
 
 attribute-flag ::= "bound" | "readonly"
 
 attribute-access-decl ::= attribute-get-decl | attribute-set-decl
 
 attribute-get-decl ::= "get" exception-spec ";"
 
 attribute-set-decl ::= "set" exception-spec ";"
 
 exception-spec ::= "raises" "(" name ("," name)* ")"
 
 method-decl ::= type identifier "(" [method-param ("," method-param)*] ")" [exception-spec] ";"
 
 method-param ::= "[" direction "]" type identifier
 
 direction ::= "in" | "out" | "inout"
 
 typedef-decl ::= ["published"] "typedef" type identifier ";"
 
 const-decl ::= "const" type identifier "=" expr ";"
 
 constants-decl ::= ["published"] "constants" identifier "{" const-decl* "}" ";"
 
 module-decl ::= "module" identifier "{" declaration* "}" ";"
 
 interface-service-decl ::= ["published"] "service" identifier ":" name ["{" constructor-decl* "}"] ";"
 
 constructor-decl ::= identifier "(" [constructor-params] ")" [exception-spec] ";"
 
 constructor-params ::= rest-param | ctor-param ("," ctor-param)*
 
 rest-param ::= "[" "in" "]" "any" "..." identifier
 
 ctor-param ::= "[" "in" "]" type identifier
 
 accumulated-service-decl ::= ["published"] "service" identifier "{" service-member-decl* "}" ";"
 
 service-member-decl ::= service-inheritance-decl | interface-inheritance-decl | property-decl
 
 service-inheritance-decl ::= ["[" "optional" "]"] "service" name ";"
 
 property-decl ::= property-flags type identifier ";"
 
 property-flags ::= "[" (property-flag ",")* "property" ("," property-flag)* "]"
 
 property-flag ::= "bound" | "constrained" | "maybeambiguous" | "maybedefault" | "maybevoid" | "optional" | "readonly" | "removable" | "transient"
 
 interface-singleton-decl ::= ["published"] "singleton" identifier ":" name ";"
 
 service-singleton-decl ::= ["published"] "singleton" identifier "{" "service" name ";" "}" ";"
 
 type ::= simple-type | sequence-type | poly-struct-type | name
 
 simple-type ::= "void" | "boolean" | "byte" | "short" | "unsigned" "short" | "long" | "unsigned" "long" | "hyper" | "unsigned" "hyper" | "float" | "double" | "char" | "string" | "type" | "any"
 
 sequence-type ::= "sequence" "<" type ">"
 
 poly-struct-type ::= name "<" type ("," type)* ">"
 
 expr ::= [expr "|"] xor-expr
 
 xor-expr ::= [xor-expr "^"] and-expr
 
 and-expr ::= [and-expr "&"] shift-expr
 
 shift-expr ::= [shift-expr shift-op] add-expr
 
 shift-op ::= "<<" | ">>"
 
 add-expr ::= [add-expr add-op] mult-expr
 
 add-op ::= "+" | "-"
 
 mult-expr ::= [mult-expr mult-op] unary-expr
 
 mult-op ::= "*" | "/" | "%"
 
 unary-expr ::= [unary-op] primary-expr
 
 unary-op ::= "+" | "-" | "~"
 
 primary-expr ::= name | literal | "(" expr ")"
 
 literal ::= boolean-literal | <INTEGER-LITERAL> | <FLOATING-POINT-LITERAL>
 
 boolean-literal ::= "False" | "FALSE" | "True" | "TRUE"
 
 name ::= ["::"] (identifier "::")* identifier
 
 identifier ::= <IDENTIFIER>
Heckert GNU white.svg

Content on this page is licensed under the Public Documentation License (PDL).