Wiki page eo.md changed with summary [general fixes] by Daniel Kolesa

This commit is contained in:
Daniel Kolesa 2019-10-18 08:01:58 -07:00 committed by www-data
parent 77b24c43cd
commit 2e13a3f5d2
1 changed files with 32 additions and 38 deletions

View File

@ -15,9 +15,9 @@ This is the quick reference, for a full definition see [Format in EBNF](#Eolian_
* Groups and blocks are defined within ``{`` and ``}``
* Some modifiers may be used, their meaning and scope are defined per context, such as ``@extern`` may be used with ``type``, ``enum`` and ``struct`` to denote they are already declared elsewhere (like an included header).
* Optional components are defined with ``[`` and ``]``.
* Most things (all toplevel declarations, methods, events etc.) let you add `@beta` in their tags section to mark it as beta API.
* Basic Definitions:
* **Variables**: ``var [@extern] name : type [= value] ;``
* **Constant**: ``const name : type = value ;``
* **Constant**: ``const [@extern] name : type = value ;``
* **Enumeration**: ``enum [@extern] name { field1, field2 [= value2] ... }``
* Structure Definitions:
* **Opaque**: ``struct [@extern] name ;``
@ -25,41 +25,39 @@ This is the quick reference, for a full definition see [Format in EBNF](#Eolian_
* **With fields**: ``struct name { field1 : type1 , field2 : type2 ... } ;``
* Type Definitions:
* **Simple**: ``type [@extern] name : other ;``
* **Simple with free function**: ``type @free( free_function ) name : other ;``
* **List**: ``type name : list<Child_Type>* ;``
* **Array**: ``type name : array<Child_Type>* ;``
* **Hash**: ``type name : hash<Key_Type , Value_Type>* ;``
* Object Definitions:
* **Common Body** for class, abstract, interface and mixin:
- ``legacy_prefix : prefix ;``
- ``eo_prefix: prefix ;``
- ``c_prefix : prefix ;``
- ``events { event_name_1 [@private | @protected | @beta | @hot] : type1 ; event_name_2 : type2 ; ... }``
- ``methods { list_of_methods_and_properties }``
- **Methods**: ``name [@protected | @const | @class | @pure_virtual] { method_body }``
* ``legacy: name ;``
* ``return: type [(expression)] [@warn_unused];``
* ``params { [@in | @out | @inout] name1 : type1 [(expression)] [@nonull | @nullable | @optional] ; name2 : type2 , ... }``
- **Properties**: ``@property name [@protected | @class | @pure_virtual ] { property_body }``
* ``get [@pure_virtual] [{ return: type ; legacy: name }]``
* ``set [@pure_virtual] [{ return: type ; legacy: name }]``
* ``values { name1 : type1 [(expression)] [@nonull | @nullable | @optional] ; name2 : type2 , ... }``
* ``keys { name1 : type1 [(expression)] [@nonull | @nullable | @optional] ; name2 : type2 , ... }``
* **Classes**: ``class name ( Base_Class1 , Base_Class2 ) { class_body }``
- **Methods**: ``name [@protected | @const | @static | @pure_virtual] { method_body }``
* ``return: type [(expression)] [@no_unused];``
* ``params { [@in | @out | @inout] name1 : type1 [(expression)] [@optional] ; name2 : type2 , ... }``
- **Properties**: ``@property name [@protected | @static | @pure_virtual ] { property_body }``
* ``get [@pure_virtual] [{ return: type ; }]``
* ``set [@pure_virtual] [{ return: type ; }]``
* ``values { name1 : type1 [(expression)] [@optional] ; name2 : type2 , ... }``
* ``keys { name1 : type1 [(expression)] [@optional] ; name2 : type2 , ... }``
* **Classes**: ``class name extends Base_Class1 implements Some_Interface composites Another_Interface ) { class_body }``
- ``data: private_data_type ``
- ``implements { class.constructor; class.destructor; [@auto | @empty] interface_name1 ; .local_name2 , ... }``
- ``constructors { method_name1 ; .local_method_name2 , ... }``
* **Abstract classes**: ``abstract name ( Base_Class1 , Base_Class2 ) { abstract_body }``
* **Abstract classes**: ``abstract name extends Base_Class1 { abstract_body }``
- ``data: private_data_type ``
- ``implements { class.constructor; class.destructor; [@auto | @empty] interface_name1 ; .local_name2 , ... }``
- ``constructors { method_name1 ; .local_method_name2 , ... }``
* **Mixins**: ``mixin name ( Base_Class1 , Base_Class2 ) { mixin_body }``
* **Mixins**: ``mixin name requires Some_Class extends Base_Class1 , Base_Class2 { mixin_body }``
- ``data: private_data_type ``
- ``implements { class.constructor; class.destructor; [@auto | @empty] interface_name1 ; .local_name2 , ... }``
* **Interfaces**: ``interface name ( Base_Class1 , Base_Class2 ) { interface_body }``
* **Interfaces**: ``interface name extends Base_Class1 , Base_Class2 { interface_body }``
- ``implements { class.constructor; class.destructor; }``
## Eolian File Format Example ##
Warning: This is out of date and does not reflect current Eolian syntax.
Before jumping to read the commented example file you may refer to the [Language Quick Reference](#Language_Quick_Reference) or check the full [Eolian file format](#Eolian_File_Format).
```c
@ -277,23 +275,20 @@ Before jumping to read the commented example file you may refer to the [Language
## Type Context Matrix ##
| | Value | Named struct | Enum | Pointer | Void |
| --------------- | ------ | ------------ | ------ | ------- | ------ |
| typedef | YES | **NO** | **NO** | YES | **NO** |
| return | YES | **NO** | **NO** | YES | **NO** |
| getter return | YES | **NO** | **NO** | YES | YES |
| in param | YES | **NO** | **NO** | YES | **NO** |
| out/inout param | YES | **NO** | **NO** | YES | YES |
| event | YES | **NO** | **NO** | YES | **NO** |
| struct field | YES | **NO** | **NO** | YES | **NO** |
| function param | YES | **NO** | **NO** | YES | **NO** |
| subtype | YES | **NO** | **NO** | YES | **NO** |
| pointer base | YES | **NO** | **NO** | YES | YES |
| const modifier | YES | **NO** | **NO** | YES | YES* |
| own modifier | **NO** | **NO** | **NO** | YES | **NO** |
| free modifier | **NO** | **NO** | **NO** | YES | **NO** |
\* Keep in mind that whether const void is allowed or not depends on the outer type. When the const void is a base for a pointer it's allowed, otherwise it is not.
| | Value | Named struct | Enum | Void |
| --------------- | ------ | ------------ | ------ | ------ |
| typedef | YES | **NO** | **NO** | **NO** |
| return | YES | **NO** | **NO** | **NO** |
| getter return | YES | **NO** | **NO** | YES |
| in param | YES | **NO** | **NO** | **NO** |
| out/inout param | YES | **NO** | **NO** | **NO** |
| event | YES | **NO** | **NO** | YES |
| struct field | YES | **NO** | **NO** | **NO** |
| function param | YES | **NO** | **NO** | **NO** |
| subtype | YES | **NO** | **NO** | **NO** |
| const modifier | YES | **NO** | **NO** | **NO** |
| own modifier | **NO** | **NO** | **NO** | **NO** |
| free modifier | **NO** | **NO** | **NO** | **NO** |
## Builtin Types ##
@ -330,10 +325,9 @@ Before jumping to read the commented example file you may refer to the [Language
| double | double | |
| bool | Eina_Bool | Eina type, builtin values true and false mapping to EINA_TRUE and EINA_FALSE |
| void | void | Not applicable in some contexts |
| void_ptr | void * | |
| string | const char * | |
| stringshare| Eina_Stringshare * | |
| generic_value | Eina_Value * | |
| any_value | Eina_Value * | |
## Eolian File Format ##