Difference between revisions of "Syntax diagrams"

From Liberty Eiffel Wiki
Jump to navigation Jump to search
(Reverted edit of Cadrian, changed back to last version by Colnet)
(typos + details about class name of formal parameter types)
Line 45: Line 45:
 
Inside the comment, the convention to denote Eiffel entities (i.e. variables,
 
Inside the comment, the convention to denote Eiffel entities (i.e. variables,
 
arguments or other features as well) is to enclose the corresponding name
 
arguments or other features as well) is to enclose the corresponding name
between ` and ' as follow:
+
between ` and ' as follows:
 
-- Here `my_variable' is supposed to be bla bla bla ...
 
-- Here `my_variable' is supposed to be bla bla bla ...
 
This convention allows some tools like [[Eiffeldoc]] or [[Short]] or emacs
 
This convention allows some tools like [[Eiffeldoc]] or [[Short]] or emacs
 
as well to use a different character font or color to emphasize the fact that
 
as well to use a different character font or color to emphasize the fact that
<TT>my_variable</TT> refer to some existing entity of the Eiffel code.
+
<TT>my_variable</TT> refers to some existing entity of the Eiffel code.
   
 
Also note that an URL inside the comment is also made automatically clickable
 
Also note that an URL inside the comment is also made automatically clickable
Line 122: Line 122:
 
A class name must start with a letter, an upper case letter as all other letters used in
 
A class name must start with a letter, an upper case letter as all other letters used in
 
that name.
 
that name.
The usage is not to use two consecutive '_' underscore character.
+
The usage is not to use two consecutive '_' underscore character, nor to end by an underscore character (by convention we keep simple names with a trailing underscore character, like <TT>O_</TT> as a formal parameter type of a generic type).
Some examples of valid class name:
+
Some examples of valid class names:
 
<TT>ARRAY</TT>,
 
<TT>ARRAY</TT>,
 
<TT>ANY</TT>,
 
<TT>ANY</TT>,

Revision as of 09:11, 24 June 2005

Syntax diagrams for the whole Eiffel language.

All items in alphabetical order: Assignment, Binary, Call, Class_declaration, Class_name, Clients, Comment, Compound, Creation_clause, Else_part, Entity_declaration_list, Expression, Feature_clause, Feature_declaration, Feature_name, Formal_generic_list, Infix_operator, Instruction, Loop, Manifest_string, New_export_item, Parent_list, Prefix_operator, Routine, Routine_body, Type, Unary, Unqualified_call, When_part.



A comment is made of one or more line segments, each beginning with two consecutive dash characters -- and extending to the end of the line:

Comment

Inside the comment, the convention to denote Eiffel entities (i.e. variables, arguments or other features as well) is to enclose the corresponding name between ` and ' as follows:

-- Here `my_variable' is supposed to be bla bla bla ...

This convention allows some tools like Eiffeldoc or Short or emacs as well to use a different character font or color to emphasize the fact that my_variable refers to some existing entity of the Eiffel code.

Also note that an URL inside the comment is also made automatically clickable by Eiffeldoc. This way, each time some class of our library needs a long explanation that does not reasonably fit in the Eiffel comment itself, we just add the URL into the comment. As an example, the following comment displayed by Eiffeldoc would bring you back here :

-- See also http://smarteiffel.loria.fr/wiki/en/index.php/Syntax_diagrams#Comment

Class declaration

Class_declaration

Related items: Assertion, Class_name, Creation_clause, Feature_clause, Formal_generic_list, Manifest_string, Parent_list.

Parent list

Parent_list

New export item

New_export_item

Creation clause

Creation_clause

Feature clause

Feature_clause

Clients

Clients

Feature declaration

Feature_declaration

Routine

Routine

Entity declaration list

Entity_declaration_list

Class name

A class name must use only upper case letters plus the '_' underscore character. A class name must start with a letter, an upper case letter as all other letters used in that name. The usage is not to use two consecutive '_' underscore character, nor to end by an underscore character (by convention we keep simple names with a trailing underscore character, like O_ as a formal parameter type of a generic type). Some examples of valid class names: ARRAY, ANY, LINKED_LIST.

Type

Type

Binary

Binary


Instruction

Instruction


Infix operator

Infix_operator


Prefix operator

Prefix_operator


Unary

Unary

Compound

Compound

Assignment

Assignment

When part

When_part

Else part

Else_part

Formal generic list

Formal_generic_list

Feature name

Feature_name

Routine body

Routine_body

Call

Call

Loop

Loop

Expression

Expression

Manifest string

Manifest_string

Unqualified call

Unqualified_call