Skip to content

Commit

Permalink
Merge branch 'topic/vadim/u151' into 'master'
Browse files Browse the repository at this point in the history
Update to Unicode 15.1:

Closes #221

See merge request eng/ide/VSS!292
  • Loading branch information
godunko committed Nov 20, 2023
2 parents 4fe0fe8 + d86a3ba commit 99f1473
Show file tree
Hide file tree
Showing 21 changed files with 6,382 additions and 6,006 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
run: echo "OS=osx" >> $GITHUB_ENV
- name: Get UCD.zip
run: |
curl -C - -o UCD-15.0.0.zip https://www.unicode.org/Public/15.0.0/ucd/UCD.zip
curl -C - -o UCD-15.1.0.zip https://www.unicode.org/Public/15.1.0/ucd/UCD.zip
mkdir vss/data/ucd
unzip UCD-15.0.0.zip -d vss/data/ucd
unzip UCD-15.1.0.zip -d vss/data/ucd
- name: Get regexp tests
run: |
curl -C - -o vss/data/re_tests https://raw.githubusercontent.com/Perl/perl5/blead/t/re/re_tests
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ build_and_test:
# Fetch tests' data into `./data/`
PACKAGE=vss-tests-data.tar.bz2
VERSION=3
VERSION=4
VSS_URL=https://gitlab.adacore-it.com/api/v4/projects/129
curl -L --header "JOB-TOKEN: $CI_JOB_TOKEN" \
$VSS_URL/packages/generic/$PACKAGE/$VERSION/$PACKAGE |\
Expand Down
6 changes: 3 additions & 3 deletions data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ To download extra data and create the package run:
rm -rf data
mkdir data
cd data
curl -o UCD-15.0.0.zip https://www.unicode.org/Public/15.0.0/ucd/UCD.zip
curl -o UCD-15.1.0.zip https://www.unicode.org/Public/15.1.0/ucd/UCD.zip
mkdir ucd
unzip UCD-15.0.0.zip -d ucd
rm -f UCD-15.0.0.zip
unzip UCD-15.1.0.zip -d ucd
rm -f UCD-15.1.0.zip
git clone https://github.com/nigeltao/parse-number-fxx-test-data
rm -rf parse-number-fxx-test-data/.git
git close https://github.com/json5/json5-tests.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package body VSS.Strings.Cursors.Iterators.Grapheme_Clusters is
use type VSS.Implementation.Referrers.Magic_String_Access;
use type VSS.Implementation.Strings.Character_Offset;
use all type VSS.Implementation.UCD_Core.GCB_Values;
use all type VSS.Implementation.UCD_Core.INCB_Values;

procedure Lookup_Grapheme_Cluster_Boundaries
(Self : in out Grapheme_Cluster_Iterator'Class;
Expand All @@ -39,7 +40,14 @@ package body VSS.Strings.Cursors.Iterators.Grapheme_Clusters is
(Handler : not null VSS.Implementation.Strings.String_Handler_Access;
Data : VSS.Implementation.Strings.String_Data;
Left : VSS.Implementation.Strings.Cursor) return Boolean;
-- Can string backward to check whether Rule GB11 should be applied.
-- Scan string backward to check whether Rule GB11 should be applied.

function Apply_InCB
(Handler : not null VSS.Implementation.Strings.String_Handler_Access;
Data : VSS.Implementation.Strings.String_Data;
Left : VSS.Implementation.Strings.Cursor;
Is_Linker : Boolean) return Boolean;
-- Scan string backward to check whether Rule GB9c should be applied.

-------------------
-- Apply_ExtPict --
Expand Down Expand Up @@ -73,6 +81,44 @@ package body VSS.Strings.Cursors.Iterators.Grapheme_Clusters is
end loop;
end Apply_ExtPict;

----------------
-- Apply_InCB --
----------------

function Apply_InCB
(Handler : not null VSS.Implementation.Strings.String_Handler_Access;
Data : VSS.Implementation.Strings.String_Data;
Left : VSS.Implementation.Strings.Cursor;
Is_Linker : Boolean) return Boolean
is
Position : VSS.Implementation.Strings.Cursor := Left;
Properties : VSS.Implementation.UCD_Core.Core_Data_Record;
Has_Linker : Boolean := Is_Linker;

begin
loop
if not Handler.Backward (Data, Position) then
return False;
end if;

Properties := Extract_Core_Data (Handler.Element (Data, Position));

case Properties.InCB is
when INCB_Linker =>
Has_Linker := True;

when INCB_Extend =>
null;

when INCB_Consonant =>
return Has_Linker;

when INCB_None =>
return False;
end case;
end loop;
end Apply_InCB;

--------------
-- Apply_RI --
--------------
Expand Down Expand Up @@ -207,6 +253,15 @@ package body VSS.Strings.Cursors.Iterators.Grapheme_Clusters is

null;

elsif Left_Properties.InCB in INCB_Linker | INCB_Extend
and then Right_Properties.InCB = INCB_Consonant
and then Apply_InCB
(Handler, Data, Left, Left_Properties.InCB = INCB_Linker)
then
-- Rule 9c.

null;

elsif Left_Properties.GCB = GCB_ZWJ
and then Right_Properties.ExtPict
and then Apply_ExtPict (Handler, Data, Left)
Expand Down Expand Up @@ -370,6 +425,15 @@ package body VSS.Strings.Cursors.Iterators.Grapheme_Clusters is

null;

elsif Left_Properties.InCB in INCB_Linker | INCB_Extend
and then Right_Properties.InCB = INCB_Consonant
and then Apply_InCB
(Handler, Data, Left, Left_Properties.InCB = INCB_Linker)
then
-- Rule GB9c.

null;

elsif Left_Properties.GCB = GCB_ZWJ
and then Right_Properties.ExtPict
and then Apply_ExtPict (Handler, Data, Left)
Expand Down
Loading

0 comments on commit 99f1473

Please sign in to comment.