summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <daniel@octaforge.org>2019-10-18 07:44:20 -0700
committerwww-data <www-data@enlightenment.org>2019-10-18 07:44:20 -0700
commitf433eebd2babcbf4ee346bd98266b0c668900753 (patch)
tree5a26600b1ad858915b6320d14580ff3ee3fc3509
parent82141079e14c605159b4fd03e382e962e5a50aea (diff)
Wiki page eo.md changed with summary [bnf update] by Daniel Kolesa
-rw-r--r--pages/contrib/docs/eo.md.txt174
1 files changed, 100 insertions, 74 deletions
diff --git a/pages/contrib/docs/eo.md.txt b/pages/contrib/docs/eo.md.txt
index 44679806d..b38bf3c26 100644
--- a/pages/contrib/docs/eo.md.txt
+++ b/pages/contrib/docs/eo.md.txt
@@ -358,157 +358,183 @@ Thus in the following EBNF you'll see:
358 358
359```ocaml 359```ocaml
360 (* Base definitions *) 360 (* Base definitions *)
361 361
362 chunk ::= { unit } 362 chunk ::= [ '#version' integer ] { unit }
363 integer ::= 0-9*
363 value ::= a-zA-Z0-9_* 364 value ::= a-zA-Z0-9_*
364 name_ns ::= value { '.' value } 365 name_ns ::= value { '.' value }
365 name ::= value 366 name ::= value
366 comment ::= '[[' any character ']]' 367 comment ::= '[[' any character ']]'
367 368
369 c_name_qual ::= '@c_name' '(' name ')'
370
368 (* 371 (*
369 * An unit is a basic unit of parsing in Eolian, aka all toplevel elements 372 * An unit is a basic unit of parsing in Eolian, aka all toplevel elements
370 * (that includes different types of classes, named structs and typedefs) 373 * (that includes different types of classes, named structs and typedefs)
371 *) 374 *)
372 375
373 unit ::= 'abstract' class_hdr '{' [ comment ] { class_body } '}' 376 unit ::= 'abstract' class_hdr '{' [ comment ] { class_body } '}'
374 | 'class' class_hdr '{' [ comment ] { class_body } '}' 377 | 'class' class_hdr '{' [ comment ] { class_body } '}'
375 | 'mixin' class_hdr '{' [ comment ] { class_body_mixin } '}' 378 | 'mixin' mixin_hdr '{' [ comment ] { class_body_mixin } '}'
376 | 'interface' class_hdr '{' [ comment ] { class_body_iface } '}' 379 | 'interface' iface_hdr '{' [ comment ] { class_body_iface } '}'
380 | ('import' | 'parse') name ';'
377 | 'type' { type_struct_attrs } name_ns ':' (type | struct | enum) ';' 381 | 'type' { type_struct_attrs } name_ns ':' (type | struct | enum) ';'
378 [ comment ] 382 [ comment ]
379 | 'const' name_ns ':' type '=' expr ';' [ comment ] 383 | 'function' { '@extern' | '@beta' | c_name_qual } name_ns '{'
380 | 'var' [ '@extern' ] name_ns ':' type [ '=' expr ] ';' [ comment ] 384 [ comment ] { method_body } '}'
385 | 'const' { '@extern' | '@beta' | c_name_qual } name_ns ':'
386 type '=' expr ';' [ comment ]
387 | 'error' { '@extern' | '@beta' | c_name_qual } name_ns '='
388 string ';' [ comment ]
381 | struct 389 | struct
382 | enum 390 | enum
383 391
384 (* 392 (*
385 * Types - they don't mention builtins or where void is allowed (not grammar) 393 * Types - they don't mention builtins or where void is allowed (not grammar)
386 *) 394 *)
387 395
388 type_complex ::= 'accessor' | 'array' | 'iterator' | 'hash' | 'list' 396 type_complex_owning ::= 'array' | 'list' | 'future'
389 397 type_complex_view ::= 'accesssor' | 'iterator' | 'slice' | 'rw_slice'
398
390 (* standard type definition - without named structs *) 399 (* standard type definition - without named structs *)
391 type ::= 'const' '(' type ')' 400 type ::= 'const' '(' type ')'
392 | 'own' '(' type_ptr ')' 401 | error '(' name_ns { ',' name_ns } ')'
393 | 'free' '(' type_ptr ',' name ')' 402 | type_complex_owning '<' type [ '@move' ] '>'
394 | 'struct' (name_ns | '{' [ comment ] { struct_field } '}') 403 | type_complex_view '<' type '>'
395 | 'enum' name_ns
396 | type '*' { '*' }
397 | type_complex '<' type { ',' type } '>'
398 | name_ns 404 | name_ns
399 405
400 (* attributes for structs and typedefs *) 406 (* attributes for structs and typedefs *)
401 type_struct_attrs ::= '@extern' | '@free' '(' name ')' 407 type_struct_attrs ::= '@extern' | '@beta' | c_name_qual | '@free' '(' name ')'
402 408
403 (* named struct definition *) 409 (* named struct definition *)
404 struct ::= 'struct' { type_struct_attrs } name_ns (';' | '{' [ comment ] 410 struct ::= 'struct' { type_struct_attrs } name_ns (';' | '{' [ comment ]
405 { struct_field } '}') 411 { struct_field } '}')
406 412
407 (* struct field definition *) 413 (* struct field definition *)
408 struct_field ::= name ':' type ';' [ comment ] 414 struct_field ::= name ':' type { '@by_ref' | '@move' } ';' [ comment ]
409 415
410 (* enum definition *) 416 (* enum definition *)
411 enum ::= 'enum' [ '@extern' ] name_ns '{' [ comment ] [ legacy ] 417 enum ::= 'enum' { '@extern' | '@beta' | c_name_qual } name_ns '{'
412 enum_field { ',' [ comment ] enum_field } [ comment ] '}' 418 [ comment ] enum_field { ',' [ comment ] enum_field } [ comment ] '}'
413 419
414 (* enum field definition *) 420 (* enum field definition *)
415 enum_field ::= name [ '=' expr ] 421 enum_field ::= name [ '=' expr ]
416 422
417 (* 423 (*
418 * Expressions - we don't handle operator precedences here 424 * Expressions - we don't handle operator precedences here
419 *) 425 *)
420 426
421 expr ::= 'true' | 'false' | 'null' | number | string | character 427 expr ::= 'true' | 'false' | 'null' | number | string | character
422 | expr binop expr | unop expr | name_ns 428 | expr binop expr | unop expr | name_ns
423 429
424 number ::= a number literal, described elsewhere 430 number ::= a number literal, described elsewhere
425 431
426 string ::= a string literal, described elsewhere 432 string ::= a string literal, described elsewhere
427 433
428 character ::= a character literal, described elsewhere 434 character ::= a character literal, described elsewhere
429 435
430 binop ::= binary operator, described elsewhere 436 binop ::= binary operator, described elsewhere
431 437
432 unop ::= unary operator, described elsewhere 438 unop ::= unary operator, described elsewhere
433 439
434 (* 440 (*
435 * Classes - everything related to class grammar 441 * Classes - everything related to class grammar
436 *) 442 *)
437 443
438 (* class header - name + optional inherits in parens *) 444 (* class header - name + optional inherits *)
439 class_hdr ::= name_ns [ '(' name_ns { ',' name_ns } ')' ] 445
440 446 class_hdr ::= { '@beta' | c_name_qual }
447 name_ns [ 'extends' name_ns ]
448 [ 'implements' name_ns { ',' name_ns } ]
449 [ 'composites' name_ns { ',' name_ns } ]
450
451 mixin_hdr ::= { '@beta' | c_name_qual }
452 name_ns [ 'requires' name_ns { ',' name_ns } ]
453 [ 'extends' name_ns { ',' name_ns } ]
454 [ 'composites' name_ns { ',' name_ns } ]
455
456 iface_hdr ::= { '@beta' | c_name_qual }
457 name_ns [ 'extends' name_ns { ',' name_ns } ]
458
441 (* common members shared by different class types *) 459 (* common members shared by different class types *)
442 class_body_common ::= 'legacy_prefix' ':' value ';' 460 class_body_common ::= 'event_c_prefix' ':' value ';'
443 | 'eo_prefix' ':' value ';' 461 | 'c_prefix' ':' value ';'
444 | 'methods' '{' { method | property } '}' 462 | 'methods' '{' { method | property } '}'
445 | 'events' '{' { event } '}' 463 | 'events' '{' { event } '}'
446 464 | 'parts' '{' { part } '}'
465
447 (* data member - not used for interfaces, used elsewhere *) 466 (* data member - not used for interfaces, used elsewhere *)
448 class_body_data ::= 'data' ':' value ';' 467 class_body_data ::= 'data' ':' value ';'
449 468
450 (* implements - the full form is allowed in everything but interfaces *) 469 (* implements - the full form is allowed in everything but interfaces *)
451 class_body_impls ::= 'implements' '{' { impl } '}' 470 class_body_impls ::= 'implements' '{' { impl } '}'
452 471
453 (* constructors - for class/abstract *) 472 (* constructors - for class/abstract *)
454 class_body_ctors ::= 'constructors' '{' { [ '.' ] name_ns ';' } '}' 473 class_body_ctors ::= 'constructors' '{' { [ '.' ] name_ns [ '@optional' ] ';' } '}'
455 474
456 (* members of regular classes, aka not interfaces or mixins *) 475 (* members of regular classes, aka not interfaces or mixins *)
457 class_body ::= class_body_common 476 class_body ::= class_body_common
458 | class_body_data 477 | class_body_data
459 | class_body_impls 478 | class_body_impls
460 | class_body_ctors 479 | class_body_ctors
461 480
462 (* members of interfaces - includes custom impl restrictions *) 481 (* members of interfaces - includes custom impl restrictions *)
463 class_body_iface ::= class_body_common 482 class_body_iface ::= class_body_common
464 | 'implements' '{' { impl_common } '}' 483 | 'implements' '{' { impl_common } '}'
465 484
466 (* members of mixins - like normal but doesn't allow ctors *) 485 (* members of mixins - like normal but doesn't allow ctors *)
467 class_body_mixin ::= class_body_common 486 class_body_mixin ::= class_body_common
468 | class_body_data 487 | class_body_data
469 | class_body_impls 488 | class_body_impls
470 489
471 (* implements that are allowed everywhere *) 490 (* implements that are allowed everywhere *)
472 impl_common ::= 'class' '.' ('constructor' | 'destructor') ';' 491 impl_common ::= 'class' '.' ('constructor' | 'destructor') ';'
473 492
474 (* implements specific for classes and mixins *) 493 (* implements specific for classes and mixins *)
475 impl ::= impl_common | [ '@auto' | '@empty' ] [ '.' ] name_ns ';' 494
476 495 impl_quals ::= '@auto' | '@empty'
496 impl_prop ::= [ impl_quals ] [ comment ] ';'
497
498 impl ::= impl_common | [ impl_quals ] [ '.' ] name_ns
499 ( '{' [ 'get' impl_prop ] [ 'set' impl_prop ] '}' | ';' [ comment ] )
500
477 (* how an event is defined *) 501 (* how an event is defined *)
478 event ::= name { ',' name } { '@private' | '@protected' | '@beta' | '@hot' } [ ':' type ] ';' 502 event ::= name { ',' name } {
479 503 '@private' | '@protected' | '@beta' | '@hot' | '@restart' }
504 [ ':' type ] ';'
505
506 (* how a part is defined *)
507 part ::= name [ '@beta' ] ':' name_ns ';' [ comment ]
508
480 (* 509 (*
481 * Everything related to constructors, methods and properties 510 * Everything related to constructors, methods and properties
482 *) 511 *)
483 512
484 (* method, like constructor but more modifiers *) 513 (* method, like constructor but more modifiers *)
485 method ::= name { '@protected' | '@const' | '@class' | '@pure_virtual' } 514 method ::= name { '@protected' | '@const' | '@static' | '@beta' | '@pure_virtual' }
486 '{' [ comment ] { method_body } '}' 515 '{' [ comment ] { method_body } '}'
487 516
488 (* inside of a method *) 517 (* inside of a method *)
489 method_body ::= return | legacy | 'params' '{' { param } '}' 518 method_body ::= return | 'params' '{' { param } '}'
490 519
491 (* property, has accessors *) 520 (* property, has accessors *)
492 property ::= '@property' name { '@protected' | '@class' | '@pure_virtual' | '@part' } '{' { property_body } '}' 521 property ::= '@property' name { '@protected' | '@static' | '@pure_virtual' | '@beta' } '{' { property_body } '}'
493 522
494 (* property body - get/set accessors, keys, values *) 523 (* property body - get/set accessors, keys, values *)
495 property_body ::= 'get' [ '@pure_virtual' ] '{' [ comment ] { return | legacy | 'keys' '{' { param_nodir } '}' | 'values' '{' { param_nodir } '}' } '}' 524 property_body ::= 'get' { '@pure_virtual' | '@protected' } '{' [ comment ] { return | 'keys' '{' { param_nodir } '}' | 'values' '{' { param_nodir } '}' } '}'
496 | 'set' [ '@pure_virtual' ] '{' [ comment ] { return | legacy | 'keys' '{' { param_nodir } '}' | 'values' '{' { param_nodir } '}' } '}' 525 | 'set' { '@pure_virtual' | '@protected' } '{' [ comment ] { return | 'keys' '{' { param_nodir } '}' | 'values' '{' { param_nodir } '}' } '}'
497 | 'keys' '{' { param_nodir } '}' 526 | 'keys' '{' { param_nodir } '}'
498 | 'values' '{' { param_nodir } '}' 527 | 'values' '{' { param_nodir } '}'
499 528
500 (* parameter without direction - implied @in *) 529 (* parameter without direction - implied @in *)
501 param_nodir ::= name ':' type [ '(' expr ')' ] [ { '@nonull' | '@nullable' | '@optional' } ] 530 param_nodir ::= name ':' type [ '(' expr ')' ] [ { '@by_ref' | '@move' | '@optional' } ]
502 ';' [ comment ] 531 ';' [ comment ]
503 532
504 (* parameter with direction - @in/@out/@inout *) 533 (* parameter with direction - @in/@out/@inout *)
505 param ::= [ '@in' | '@out' | '@inout' ] param_nodir 534 param ::= [ '@in' | '@out' | '@inout' ] param_nodir
506 535
507 (* legacy - used in methods and accessors to specify legacy name *) 536 return_suffix ::= [ '(' expr ')' ] { '@no_unused' | '@move' | '@by_ref' } ';' [ comment ]
508 legacy ::= 'legacy' ':' name ';' 537
509
510 return_suffix ::= [ '(' expr ')' ] [ '@warn_unused' ] ';' [ comment ]
511
512 (* return statement - used in methods and accessors - can have a default val *) 538 (* return statement - used in methods and accessors - can have a default val *)
513 return ::= 'return' ':' type return_suffix 539 return ::= 'return' ':' type return_suffix
514``` 540```