Decl Enum -- Dichiarazione delle Enumerazioni


Le dicuarazioni enum definiscono un insieme di valori costanti. La grammatica prevista è la seguente.

declaration: 
           | enum_decl_stm
           | kon_decl_stm
           | vsel_decl_stm
enum_decl_stm: enum_decl ';'
kon_decl_stm: kon_decl ';'
vsel_decl_stm: vsel_decl ';'
enum_decl: enum_type comment(?) enum_body
enum_body: '{' enum_item_inter(s?) enum_item_last '}'
enum_item_inter: IDENTIFIER '=' const_value ',' comment(?)
enum_item_last:  IDENTIFIER '=' const_value     comment(?)
kon_decl: kon_type comment(?) kon_body
kon_body: '{' kon_item(s) '}'
kon_item: '#define' TOKEN TOKEN comment(?)
vsel_decl: vsel_type comment(?) vsel_body
vsel_body: '{' vsel_item(s) 'VSEL_END' '}'
vsel_item: '{' CHARKON ',' STRINGKON '}' ',' comment(?)
enum_type: 'enum' IDENTIFIER
kon_type: 'kondefine' IDENTIFIER
vsel_type: 'VSEL' IDENTIFIER '[]' '='
comment: line_comment(s?) block_comment(s?)
line_comment: / \/ \/ .*? $/xm
block_comment: /\s* \/ \* .*? \* \/ /xms

Un esempio di codice.

enum EnAppClass                 // Class of Application
                                /* Defines the application class */
  {
  kUnknwnAppClass      =  0,    // Undefined 
  kCStandardAppClass   =  1,    // Standard C   Program (unsupported)

  kArCuiAppClass       = 14,    // AR CUI   C++ Program (unsupported) 
  kArGuiAppClass       = 15     // AR GUI   C++ Program
  };

enum EnBmExcType                // Batch Execution Type
    {
    kBmExcNull      = 0,
    kBmExcDirect    = 'D',      // Direct Execution
    kBmExcLocal     = 'L',      // Local, controlled by arbmexc.exe
    kBmExcRemote    = 'R'       // Remote, shceduled by arbmsch.exe
    };

kondefine EnArPgmType           // Ar Programmer Type
    {
    #define kArPgmNull    0         // Non definito
    #define kArPgmIdiot   'I'       // Idiota
    #define kArPgmAverage 'A'       // Normale
    #define kArPgmSmart   'S'       // Furbo
    };
dsg.tag.decl.enum • LastModified: 14-9-2007 • John Peter Arnold