Skip to content

Commit

Permalink
Merge branch 'topic/vadim/merge_handler_and_data-2' into 'master'
Browse files Browse the repository at this point in the history
Reimplementation of the internal text data

See merge request eng/ide/VSS!322
  • Loading branch information
godunko committed Apr 23, 2024
2 parents 406bd06 + c3b88b1 commit f90e206
Show file tree
Hide file tree
Showing 56 changed files with 4,904 additions and 5,253 deletions.
76 changes: 4 additions & 72 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ variables:
stages:
- build_and_test
- build_dependent
- run_downstream_ci

#########
# BUILD #
Expand Down Expand Up @@ -189,78 +190,6 @@ build_gnatdoc:
# Build the ALS as a test
anod build gnatdoc4 --qualifier=$ACI_ANOD_QUALIFIER
build_als:
services:
- image:sandbox
- cpu:8
- mem:16
stage: build_dependent
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: manual
script:
- !reference [.basic-setup]
- !reference [.detect-branches]

- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/markdown
- ACI_SUBPROJECT_NAME=markdown
- !reference [.checkout-subproject]

- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/gnatdoc
- ACI_SUBPROJECT_NAME=gnatdoc$ACI_REPOSITORY_NAME_EDGE_SUFFIX
- !reference [.checkout-subproject]

- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/ada_language_server
- ACI_SUBPROJECT_NAME=ada_language_server$ACI_REPOSITORY_NAME_EDGE_SUFFIX
- !reference [.checkout-subproject]

- |
cd /it/wave
# Tell the anod sandbox to use our repository
anod vcs --add-repo vss $CI_PROJECT_DIR
# Build the ALS as a test
anod build als --qualifier=$ACI_ANOD_QUALIFIER
build_gs:
services:
- image:gtk-deps
- cpu:8
- mem:16
stage: build_dependent
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: manual
script:
- !reference [.basic-setup]
- !reference [.detect-branches]

- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/markdown
- ACI_SUBPROJECT_NAME=markdown
- !reference [.checkout-subproject]

- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/gnatdoc
- ACI_SUBPROJECT_NAME=gnatdoc$ACI_REPOSITORY_NAME_EDGE_SUFFIX
- !reference [.checkout-subproject]

- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/ada_language_server
- ACI_SUBPROJECT_NAME=ada_language_server$ACI_REPOSITORY_NAME_EDGE_SUFFIX
- !reference [.checkout-subproject]

- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/gnatstudio
- ACI_SUBPROJECT_NAME=gnatstudio$ACI_REPOSITORY_NAME_EDGE_SUFFIX
- !reference [.checkout-subproject]

- |
cd /it/wave
# Tell the anod sandbox to use our repository
anod vcs --add-repo vss $CI_PROJECT_DIR
# Build the ALS as a test
anod build gps --qualifier=$ACI_ANOD_QUALIFIER
build_lsif:
services:
- image:sandbox
Expand Down Expand Up @@ -310,6 +239,8 @@ build_lsif:
.run_ci_common: &run_ci_common
stage: build_dependent
rules:
- if: $CI_PIPELINE_SOURCE == 'push'
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: manual
allow_failure: true
Expand All @@ -320,6 +251,7 @@ build_lsif:
variables:
ACI_UPSTREAM_PROJECT_ID: $CI_PROJECT_ID
ACI_UPSTREAM_MERGE_REQUEST_IID: $CI_MERGE_REQUEST_IID
ACI_TRACK: edge

run_als_ci:
<<: *run_ci_common
Expand Down
16 changes: 8 additions & 8 deletions source/json/implementation/vss-json-push_writers.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (C) 2020-2021, AdaCore
-- Copyright (C) 2020-2024, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
Expand All @@ -8,7 +8,7 @@ with Ada.Assertions;

with VSS.Characters;
with VSS.Implementation.Strings;
with VSS.Implementation.String_Handlers;
with VSS.Implementation.Text_Handlers;
with VSS.Strings.Internals;
with VSS.Unicode;

Expand Down Expand Up @@ -308,16 +308,16 @@ package body VSS.JSON.Push_Writers is
Data : VSS.Implementation.Strings.String_Data
renames VSS.Strings.Internals.Data_Access_Constant (Item).all;
Handler : constant not null
VSS.Implementation.Strings.String_Handler_Access :=
VSS.Implementation.Strings.Handler (Data);
Position : VSS.Implementation.Strings.Cursor;
VSS.Implementation.Strings.Constant_Text_Handler_Access :=
VSS.Implementation.Strings.Constant_Handler (Data);
Position : aliased VSS.Implementation.Strings.Cursor;
Code : VSS.Unicode.Code_Point;

begin
Handler.Before_First_Character (Data, Position);
Handler.Before_First_Character (Position);

while Handler.Forward (Data, Position) loop
Code := Handler.Element (Data, Position);
while Handler.Forward (Position) loop
Code := Handler.Element (Position);

case Code is
when 16#00_0000# .. 16#00_0007#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ with Ada.Unchecked_Deallocation;

with VSS.Characters.Latin;
with VSS.Characters.Punctuations;
with VSS.Implementation.String_Handlers;
with VSS.Implementation.Text_Handlers;
with VSS.Implementation.Strings;
with VSS.Regular_Expressions.ECMA_Parser;
with VSS.Regular_Expressions.Matches;
Expand Down Expand Up @@ -373,22 +373,21 @@ package body VSS.Regular_Expressions.Pike_Engines is
(Text : VSS.Strings.Virtual_String'Class;
Cursor : in out VSS.Implementation.Strings.Cursor)
is
use type VSS.Implementation.Strings.String_Handler_Access;
Ignore : Boolean;

Ignore : Boolean;
Data : constant
VSS.Strings.Internals.String_Data_Constant_Access :=
VSS.Strings.Internals.Data_Access_Constant (Text);
Handler : constant
VSS.Implementation.Strings.Constant_Text_Handler_Access :=
VSS.Implementation.Strings.Constant_Handler (Data.all);

Data : constant VSS.Strings.Internals.String_Data_Constant_Access :=
VSS.Strings.Internals.Data_Access_Constant (Text);

Handler : constant VSS.Implementation.Strings.String_Handler_Access :=
VSS.Implementation.Strings.Handler (Data.all);
begin
if VSS.Implementation.Strings.Is_Invalid (Cursor) then
null;
elsif Handler = null then
Cursor := (others => <>); -- Make it invalid

else
Ignore := Handler.Backward (Data.all, Cursor);
Ignore := Handler.Backward (Cursor);
end if;
end Step_Backward;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
--
-- Copyright (C) 2023, AdaCore
-- Copyright (C) 2023-2024, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--

with VSS.Implementation.Character_Codes;
with VSS.Implementation.Strings;
with VSS.Implementation.String_Handlers;
with VSS.Implementation.Text_Handlers;
with VSS.Strings.Internals;

package body VSS.Implementation.Line_Terminator is
Expand All @@ -19,68 +19,58 @@ package body VSS.Implementation.Line_Terminator is
(Terminator : VSS.Strings.Line_Terminator)
return VSS.Strings.Virtual_String
is
Data : VSS.Implementation.Strings.String_Data;
Offset : VSS.Implementation.Strings.Cursor_Offset;

begin
case Terminator is
when VSS.Strings.CR =>
VSS.Implementation.Strings.Handler (Data).Append
(Data,
VSS.Implementation.Character_Codes.Carriage_Return,
Offset);
return Result : VSS.Strings.Virtual_String do
declare
Text : constant not null
VSS.Implementation.Strings.Variable_Text_Handler_Access :=
VSS.Implementation.Strings.Variable_Handler
(VSS.Strings.Internals.Data_Access_Variable (Result).all);

when VSS.Strings.LF =>
VSS.Implementation.Strings.Handler (Data).Append
(Data,
VSS.Implementation.Character_Codes.Line_Feed,
Offset);
begin
case Terminator is
when VSS.Strings.CR =>
Text.Append
(VSS.Implementation.Character_Codes.Carriage_Return,
Offset);

when VSS.Strings.CRLF =>
VSS.Implementation.Strings.Handler (Data).Append
(Data,
VSS.Implementation.Character_Codes.Carriage_Return,
Offset);
VSS.Implementation.Strings.Handler (Data).Append
(Data,
VSS.Implementation.Character_Codes.Line_Feed,
Offset);
when VSS.Strings.LF =>
Text.Append
(VSS.Implementation.Character_Codes.Line_Feed, Offset);

when VSS.Strings.NEL =>
VSS.Implementation.Strings.Handler (Data).Append
(Data,
VSS.Implementation.Character_Codes.Next_Line,
Offset);
when VSS.Strings.CRLF =>
Text.Append
(VSS.Implementation.Character_Codes.Carriage_Return,
Offset);
Text.Append
(VSS.Implementation.Character_Codes.Line_Feed, Offset);

when VSS.Strings.VT =>
VSS.Implementation.Strings.Handler (Data).Append
(Data,
VSS.Implementation.Character_Codes.Line_Tabulation,
Offset);
when VSS.Strings.NEL =>
Text.Append
(VSS.Implementation.Character_Codes.Next_Line, Offset);

when VSS.Strings.FF =>
VSS.Implementation.Strings.Handler (Data).Append
(Data,
VSS.Implementation.Character_Codes.Form_Feed,
Offset);
when VSS.Strings.VT =>
Text.Append
(VSS.Implementation.Character_Codes.Line_Tabulation,
Offset);

when VSS.Strings.LS =>
VSS.Implementation.Strings.Handler (Data).Append
(Data,
VSS.Implementation.Character_Codes.Line_Separator,
Offset);
when VSS.Strings.FF =>
Text.Append
(VSS.Implementation.Character_Codes.Form_Feed, Offset);

when VSS.Strings.PS =>
VSS.Implementation.Strings.Handler (Data).Append
(Data,
VSS.Implementation.Character_Codes.Paragraph_Separator,
Offset);
end case;
when VSS.Strings.LS =>
Text.Append
(VSS.Implementation.Character_Codes.Line_Separator,
Offset);

return Result : constant VSS.Strings.Virtual_String :=
VSS.Strings.Internals.To_Virtual_String (Data)
do
VSS.Implementation.Strings.Unreference (Data);
when VSS.Strings.PS =>
Text.Append
(VSS.Implementation.Character_Codes.Paragraph_Separator,
Offset);
end case;
end;
end return;
end Sequence;

Expand Down
Loading

0 comments on commit f90e206

Please sign in to comment.