Changeset 526


Ignore:
Timestamp:
Sep 1, 2017, 9:00:08 AM (5 years ago)
Author:
Maxim Reznik
Message:

Add character_literal resolution

Location:
trunk/ada-2012/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/ada-2012/src/ag/up.ag

    r523 r526  
    249249Rules for character_literal.character_literal_token :
    250250(.
    251       ${character_literal.Up} := 0;  --  FIXME
    252 .)
     251      Gela.Pass_Utils.Resolve.Character_Literal
     252        (Self.Compilation,
     253         ${character_literal.Up});
     254.)
     255
    253256Rules for explicit_dereference. :
    254257(.
  • trunk/ada-2012/src/api/gela-types-simple.ads

    r424 r526  
    2121   type Enumeration_Type_Access is access all Enumeration_Type'Class;
    2222   for Enumeration_Type_Access'Storage_Size use 0;
     23
     24   --------------------
     25   -- Character_Type --
     26   --------------------
     27
     28   type Character_Type is limited interface and Enumeration_Type;
     29
     30   type Character_Type_Access is access all Character_Type'Class;
     31   for Character_Type_Access'Storage_Size use 0;
    2332
    2433   -------------------------
  • trunk/ada-2012/src/api/gela-types-visitors.ads

    r422 r526  
    1111     (Self  : in out Type_Visitor;
    1212      Value : not null Gela.Types.Simple.Enumeration_Type_Access)
     13        is null;
     14
     15   not overriding procedure Character_Type
     16     (Self  : in out Type_Visitor;
     17      Value : not null Gela.Types.Simple.Character_Type_Access)
    1318        is null;
    1419
  • trunk/ada-2012/src/semantic/gela-plain_type_views.adb

    r484 r526  
    473473   begin
    474474      case Self.Category is
    475          when Gela.Type_Categories.A_Character |
    476               Gela.Type_Categories.A_Boolean |
     475         when Gela.Type_Categories.A_Character =>
     476            Visiter.Character_Type
     477              (Gela.Types.Simple.Character_Type_Access (Self));
     478         when Gela.Type_Categories.A_Boolean |
    477479              Gela.Type_Categories.An_Other_Enum =>
    478 
    479480            Visiter.Enumeration_Type
    480481              (Gela.Types.Simple.Enumeration_Type_Access (Self));
  • trunk/ada-2012/src/semantic/gela-plain_type_views.ads

    r484 r526  
    1414
    1515   type Type_View is new Gela.Type_Categories.Type_View
     16     and Gela.Types.Simple.Character_Type
    1617     and Gela.Types.Simple.Enumeration_Type
    1718     and Gela.Types.Simple.Signed_Integer_Type
     
    3839
    3940   type Type_View is new Gela.Type_Categories.Type_View
     41     and Gela.Types.Simple.Character_Type
    4042     and Gela.Types.Simple.Enumeration_Type
    4143     and Gela.Types.Simple.Signed_Integer_Type
  • trunk/ada-2012/src/semantic/gela-resolve-type_matchers.adb

    r503 r526  
    2626      Self.Match := True;  --  Value.Is_String;  FIXME
    2727   end Array_Type;
     28
     29   --------------------
     30   -- Character_Type --
     31   --------------------
     32
     33   overriding procedure Character_Type
     34     (Self  : in out Character_Type_Matcher;
     35      Value : not null Gela.Types.Simple.Character_Type_Access)
     36   is
     37      pragma Unreferenced (Value);
     38   begin
     39      Self.Match := True;
     40   end Character_Type;
    2841
    2942   -------------------------
  • trunk/ada-2012/src/semantic/gela-resolve-type_matchers.ads

    r503 r526  
    1010
    1111   type Array_Type_Matcher is
     12     new Gela.Interpretations.Type_Matcher with private;
     13
     14   type Character_Type_Matcher is
    1215     new Gela.Interpretations.Type_Matcher with private;
    1316
     
    6467      Value : not null Gela.Types.Arrays.Array_Type_Access);
    6568
     69   type Character_Type_Matcher is new Base_Type_Matcher with null record;
     70
     71   overriding procedure Character_Type
     72     (Self  : in out Character_Type_Matcher;
     73      Value : not null Gela.Types.Simple.Character_Type_Access);
     74
    6675end Gela.Resolve.Type_Matchers;
  • trunk/ada-2012/src/semantic/gela-resolve.adb

    r517 r526  
    284284   end Case_Statement;
    285285
     286   -----------------------
     287   -- Character_Literal --
     288   -----------------------
     289
     290   procedure Character_Literal
     291     (Comp   : Gela.Compilations.Compilation_Access;
     292      Result : out Gela.Interpretations.Interpretation_Set_Index)
     293   is
     294      Type_Matcher : constant Type_Matchers.Type_Matcher_Access :=
     295        new Type_Matchers.Character_Type_Matcher;
     296   begin
     297      Result := 0;
     298
     299      Comp.Context.Interpretation_Manager.Add_Expression_Category
     300        (Match => Gela.Interpretations.Type_Matcher_Access (Type_Matcher),
     301         Down => (1 .. 0 => 0),
     302         Result => Result);
     303   end Character_Literal;
     304
    286305   ----------------
    287306   -- Constraint --
  • trunk/ada-2012/src/semantic/gela-resolve.ads

    r490 r526  
    119119   --  Resolve Type_Up to be a type or an expression of some type,
    120120   --  then resolve Expr_Up to have this type.
     121
     122   procedure Character_Literal
     123     (Comp   : Gela.Compilations.Compilation_Access;
     124      Result : out Gela.Interpretations.Interpretation_Set_Index);
    121125
    122126   procedure Numeric_Literal
Note: See TracChangeset for help on using the changeset viewer.