Is_Code in H3.CC.
Use Wide_Character'First instead of Wide_Character'Val(0) Removed the terminator parameter in the H3.Strings
This commit is contained in:
@ -8,70 +8,70 @@ package body H3.CC is
|
||||
SP: constant Item_Type := Item_Type'Val(32);
|
||||
HT: constant Item_Type := Item_Type'Val(9);
|
||||
|
||||
function Is_Alpha (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Alpha (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return UC.Is_UTF_32_Letter(Item_Type'Pos(V));
|
||||
end Is_Alpha;
|
||||
|
||||
function Is_Alnum (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Alnum (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return UC.Is_UTF_32_Letter(Item_Type'Pos(V)) or else
|
||||
UC.Is_UTF_32_Digit(Item_Type'Pos(V));
|
||||
end Is_Alnum;
|
||||
|
||||
function Is_Blank (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Blank (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return V = SP or else V = HT;
|
||||
end Is_Blank;
|
||||
|
||||
function Is_Cntrl (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Cntrl (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return UC.Get_Category(Item_Type'Pos(V)) = UC.Cc;
|
||||
end Is_Cntrl;
|
||||
|
||||
function Is_Digit (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Digit (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return UC.Is_UTF_32_Digit(Item_Type'Pos(V));
|
||||
end Is_Digit;
|
||||
|
||||
function Is_Graph (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Graph (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return Is_Print(V) and then V /= SP;
|
||||
end Is_Graph;
|
||||
|
||||
function Is_Lower (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Lower (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return UC.Get_Category(Item_Type'Pos(V)) = UC.Ll;
|
||||
end Is_Lower;
|
||||
|
||||
function Is_Print (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Print (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return not UC.IS_UTF_32_Non_Graphic(Item_Type'Pos(V));
|
||||
end Is_Print;
|
||||
|
||||
function Is_Punct (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Punct (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
--return UC.Is_UTF_32_Punctuation(Item_Type'Pos(V));
|
||||
return Is_Print(V) and then not Is_Space(V) and then not Is_Alnum(V);
|
||||
end Is_Punct;
|
||||
|
||||
function Is_Space (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Space (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return UC.Is_UTF_32_Space(Item_Type'Pos(V)) or else
|
||||
UC.Is_UTF_32_Line_Terminator(Item_Type'Pos(V)) or else
|
||||
UC.Is_UTF_32_Line_Terminator(Item_Type'Pos(V)) or else
|
||||
V = HT;
|
||||
end Is_Space;
|
||||
|
||||
function Is_Upper (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Upper (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return UC.Get_Category(Item_Type'Pos(V)) = UC.Lu;
|
||||
end Is_Upper;
|
||||
|
||||
function Is_Xdigit (V: in Item_Type) return Standard.Boolean is
|
||||
function Is_Xdigit (V: in Item_Type) return Boolean is
|
||||
begin
|
||||
return UC.Is_UTF_32_Digit(Item_Type'Pos(V)) or else
|
||||
Item_Type'Pos(V) in Standard.Character'Pos('A') .. Standard.Character'Pos('F') or else
|
||||
Item_Type'Pos(V) in Standard.Character'Pos('a') .. Standard.Character'Pos('f');
|
||||
Item_Type'Pos(V) in System_Character'Pos('A') .. System_Character'Pos('F') or else
|
||||
Item_Type'Pos(V) in System_Character'Pos('a') .. System_Character'Pos('f');
|
||||
end Is_Xdigit;
|
||||
|
||||
function To_Lower (V: in Item_Type) return Item_Type is
|
||||
@ -84,7 +84,7 @@ package body H3.CC is
|
||||
return Item_Type'Val(UC.UTF_32_To_Upper_Case(Item_Type'Pos(V)));
|
||||
end To_Upper;
|
||||
|
||||
function Is_Class (V: in Item_Type; Cls: in Class) return Standard.Boolean is
|
||||
function Is_Class (V: in Item_Type; Cls: in Class) return Boolean is
|
||||
begin
|
||||
case Cls is
|
||||
when ALPHA => return Is_Alpha(V);
|
||||
@ -101,4 +101,11 @@ package body H3.CC is
|
||||
when XDIGIT => return Is_Xdigit(V);
|
||||
end case;
|
||||
end Is_Class;
|
||||
|
||||
function Is_Code (V: in Item_Type; Code: in Item_Code) return Boolean is
|
||||
begin
|
||||
-- a clumsy way to work around strong type checking
|
||||
-- with unknown Item_Type at the generic level?
|
||||
return Item_Type'Pos(V) = Code;
|
||||
end Is_Code;
|
||||
end H3.CC;
|
Reference in New Issue
Block a user