home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / EXAMPLES / SUPERLIN / EXPAND_T.LF < prev    next >
Text File  |  1996-06-04  |  1KB  |  65 lines

  1. %%
  2. %%  FILE : expand_type.lf
  3. %%
  4. %%  Provides the function expand_type which unfolds all type aliases in
  5. %%  a type expression.
  6. %%
  7.  
  8.  
  9.  
  10. expand_type(Type) -> ExpandedType
  11.   | ExpandedType = expanded_type_of(Type),
  12.     ExpandedType.qualification = Type.qualification,
  13.     ExpandedType.store_class = Type.store_class,
  14.     (
  15.       has_feature(signed, Type, Signed),
  16.       !,
  17.       ExpandedType.signed = Signed
  18.     ;
  19.       succeed
  20.     ).    
  21.  
  22.  
  23. %
  24. % ------------------------------------------------------------------------------
  25. %
  26.  
  27.  
  28. expanded_type_of(type_alias(identifier(Name))) ->
  29.   expanded_type_of(syntactic_tree.type_definitions.Name.type).
  30.  
  31.  
  32. expanded_type_of(struct_name(identifier(Name))) ->
  33.   syntactic_tree.struct_definitions.Name.type.
  34.  
  35.  
  36. expanded_type_of(union_name(identifier(Name))) ->
  37.   syntactic_tree.union_definitions.Name.type.
  38.  
  39.  
  40. expanded_type_of(enum_name(identifier(Name))) ->
  41.   syntactic_tree.enum_definitions.Name.type.
  42.  
  43.  
  44. expanded_type_of(pointer(to => What, star => Star,
  45.                  qualification => Qualifier)) ->
  46.   pointer(to => expanded_type_of(What), star => Star, 
  47.           qualification => Qualifier).
  48.  
  49.  
  50. expanded_type_of(array(of => What, dimensions => Dimensions)) ->
  51.   array(of => expanded_type_of(What), dimensions => Dimensions).
  52.  
  53.  
  54. expanded_type_of(protected_type(InnerType)) ->
  55.   protected_type(expanded_type_of(InnerType)).
  56.  
  57.  
  58. expanded_type_of(SingleType) -> SingleType.
  59.  
  60.  
  61. %
  62. % ------------------------------------------------------------------------------
  63. %
  64.  
  65.