mozilla
您的搜索结果

    Syntax

    Status of this document

    This is just a sketch of the final XPIDL Syntax Documentation. I'm working on gathering all of the BNF and organizing the TOC of this document.

    Purpose of this document

    This document is not an introduction to XPIDL or IDL in general. It is more focused on XPIDL syntax and grammar. However, I plan to link all of the material to relevant introductory contents.

    Some simplifications

    In order to simplify the BNF, I will not include XPIDL comments in every place where they can be found. I rather describe them separately and explain how they can be used elsewhere outside the BNF. Otherwise, the BNF itself would get very mangled.

    Common BNF

    any-char :=any unicode char
    any-char-but-LF :=any unicode char excluding linefeed char code
    

    any-char and any-char-but-LF are used in a context-dependant manner as will be explained where appropiate.

    XPIDL Syntax (BNF)

    XPIDL Comments

    xpidl-comment := '/*' any-char* '*/'
    

    Comments are blocks of text which are not parsed by XPIDL interpreters. They are used as a form of documentation. A comment begins with an '/*' and ends with a '*/'. Valid XPIDL declarations inside comments are ignored.

    In the context of a xpidl-comment, any-char actually means any char excluding */ if they happen to be together and in that order , which represents the end of the comment itself.

    Identifiers

    /* Valid char for identifiers */
    xpidl-id-char := [a-zA-Z_0-9]
    
    /* Valid char for the beginning of identifiers */
    xpidl-id-char-valid-begin := [a-zA-Z]
    
    xpidl-valid-id := xpidl-id-char-valid-begin xpidl-id-char*
    
    xpidl-valid-id-list :=
           xpidl-valid-id |
           xpidl-valid-id ',' xpidl-valid-id-list
    

    Inline C headers

    inline-c-header := '{%C++ ' any-char* '%}'
    

    In the context of a inline-c-header, any-char actually means any char excluding %} if they happen to be together and in that order , which represent the end of the inline c headers section.

    Including other XPIDL

     xpidl-include := '#include "' any-char* '"\n'
    

    In the context of xpidl-include, any-char actually means any char but the quotation mark (").

    XPIDL Types

    xpidl-type := 
           'boolean' |
           'void' |
           'string' |
           xpidl-valid-id
    

    UUID

    xpidl-HEX := [a-fA-F0-9]
    
    xpidl-UUID := xpidl-HEX{8}'-'xpidl-HEX{4}'-'xpidl-HEX{4}'-'xpidl-HEX{4}'-'xpidl-HEX{12}
    

    Parameters

    xpidl-ARRAY-param-modifier := 'array'
    xpidl-SIZE_IS-param-modifier := 'size_is('xpidl-valid-id')'
    xpidl-RETVAL-param-modifier := 'retval'
    
    xpidl-param-modifier :=
          xpidl-ARRAY-param-modifier |
          xpidl-SIZE_IS-param-modifier |
          xpidl-RETVAL-param-modifier
    
    xpidl-param-modifier-list := 
           xpidl-param-modifier |
           xpidl-param-modifier ',' xpidl-param-modifier-list
    
    xpidl-param-modifier-list-decl := '[' xpidl-param-modifier-list ']'
    
    xpidl-param-type := 'in' | 'out' | 'inout'
    xpidl-param-decl := [ xpidl-param-modifier-list-decl ] xpidl-param-type xpidl-type xpidl-valid-id
    
    xpidl-param-list := 
           xpidl-param-decl |
           xpidl-param-decl ',' xpidl-param-list
    

    Attributes and Methods

    xpidl-attribute := 'attribute' xpidl-type xpidl-valid-id ';'
    
    xpidl-method := xpidl-type xpidl-valid-id '('[ xpidl-param-list ]');'
    
    xpidl-attr-or-method :=
           xpidl-attribute |
           xpidl-method
    

    Interfaces

    xpidl-interface-body := xpidl-attr-or-method*
    
    xpidl-scriptable-interface := 'scriptable'
    xpidl-interface-uuid := 'uuid('xpidl-UUID')'
    
    xpidl-interface-header := '['[ xpidl-scriptable-interface ','] xpidl-interface-uuid ']'
    
    
    
    xpidl-interface := 
           xpidl-interface-header
           'interface ' xpidl-valid-id [ ':' xpidl-valid-id-list ]
           '{'
               xpidl-interface-body
           '}'
    

    文档标签和贡献者

    标签: 
    此页面的贡献者有: ziyunfei, Klp99
    最后编辑者: ziyunfei,