Skip to content

Commit

Permalink
Merge pull request #319 from NeoKaios/fix/grammar-method-id
Browse files Browse the repository at this point in the history
Fix `method_id_paragraph` syntax
  • Loading branch information
nberth authored Jul 24, 2024
2 parents 76e06d7 + 67a17ae commit 941d5ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- Basic syntax highlighting for SQL statements embedded in `EXEC`/`END-EXEC` blocks [#290](https://github.com/OCamlPro/superbol-studio-oss/pull/290)

### Fixed
- Improvements to the grammar [#310](https://github.com/OCamlPro/superbol-studio-oss/pull/310)
- Improvements to the grammar [#310](https://github.com/OCamlPro/superbol-studio-oss/pull/310), [#319](https://github.com/OCamlPro/superbol-studio-oss/pull/319)
- Internal mishandling of tokens when dealing with some `EXEC`/`END-EXEC` blocks [#301](https://github.com/OCamlPro/superbol-studio-oss/pull/301)
- Internal pretty-printing routine for `EXEC`/`END-EXEC` blocks [#300](https://github.com/OCamlPro/superbol-studio-oss/pull/300)
- Support for line continuations that start with a text word [#294](https://github.com/OCamlPro/superbol-studio-oss/pull/294)
Expand Down
4 changes: 2 additions & 2 deletions src/lsp/cobol_parser/grammar.mly
Original file line number Diff line number Diff line change
Expand Up @@ -559,10 +559,10 @@ let interface_id_paragraph := (* +COB2002 *

let method_id_paragraph := (* +COB2002 *)
| METHOD_ID; "."; i = name; slo = as__strlit_;
o = bo(OVERRIDE); f = bo(IS?; FINAL; {});
o = bo(OVERRIDE); f = bo(IS?; FINAL; {}); ".";
{ i, NamedMethod { as_ = slo }, o, f }
| METHOD_ID; "."; pk = property_kind; PROPERTY; i = name;
o = bo(OVERRIDE); f = bo(IS?; FINAL; {});
o = bo(OVERRIDE); f = bo(IS?; FINAL; {}); ".";
{ i, PropertyMethod { kind = pk }, o, f }

let options_paragraph [@context options_paragraph] := (* +COB2002 *)
Expand Down
20 changes: 10 additions & 10 deletions test/lsp/lsp_document_symbol.ml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ let%expect_test "object-symbol" =
01 number-of-accounts PIC 9(5) VALUE ZERO.
PROCEDURE DIVISION.

METHOD-ID. newAccount
METHOD-ID. newAccount.
DATA DIVISION.
LOCAL-STORAGE SECTION.
LINKAGE SECTION.
Expand All @@ -292,14 +292,14 @@ let%expect_test "object-symbol" =
GOBACK.
END METHOD newAccount.

METHOD-ID. addAccount
METHOD-ID. addAccount.
PROCEDURE DIVISION.
method-start.
ADD 1 TO number-of-accounts.
GOBACK.
END METHOD addAccount.

METHOD-ID. removeAccount
METHOD-ID. removeAccount.
PROCEDURE DIVISION.
main-entry.
SUBTRACT 1 FROM number-of-accounts.
Expand All @@ -315,7 +315,7 @@ let%expect_test "object-symbol" =
01 the-date PIC 9(8).
PROCEDURE DIVISION.

METHOD-ID. displayUI
METHOD-ID. displayUI.
DATA DIVISION.
LOCAL-STORAGE SECTION.
01 in-data.
Expand Down Expand Up @@ -346,7 +346,7 @@ let%expect_test "object-symbol" =
COMPUTE in-amount = FUNCTION NUMVAL (in-wrk).
END METHOD displayUI.

METHOD-ID. balance
METHOD-ID. balance.
DATA DIVISION.
LOCAL-STORAGE SECTION.
01 display-balance PIC ZZZ,ZZZ,ZZ9.99B.
Expand All @@ -357,7 +357,7 @@ let%expect_test "object-symbol" =
GOBACK.
END METHOD balance.

METHOD-ID. deposit
METHOD-ID. deposit.
DATA DIVISION.
LINKAGE SECTION.
01 in-deposit PIC S9(9)V99.
Expand All @@ -367,7 +367,7 @@ let%expect_test "object-symbol" =
GOBACK.
END METHOD deposit.

METHOD-ID. withdraw
METHOD-ID. withdraw.
DATA DIVISION.
LINKAGE SECTION.
01 in-withdraw PIC S9(9)V99.
Expand All @@ -381,7 +381,7 @@ let%expect_test "object-symbol" =
GOBACK.
END METHOD withdraw.

METHOD-ID. initializeAccount
METHOD-ID. initializeAccount.
DATA DIVISION.
LINKAGE SECTION.
01 new-account-number PIC 9(5).
Expand Down Expand Up @@ -465,7 +465,7 @@ let%expect_test "interface-symbol" =
let end_with_postproc = document_symbol {cobol|
INTERFACE-ID. BaseFactoryInterface.
PROCEDURE DIVISION.
METHOD-ID. New2
METHOD-ID. New2.
DATA DIVISION.
LINKAGE SECTION.
01 outObject USAGE OBJECT REFERENCE ACTIVE-CLASS.
Expand All @@ -475,7 +475,7 @@ let%expect_test "interface-symbol" =

INTERFACE-ID. Interface.
PROCEDURE DIVISION.
METHOD-ID. FactoryObject
METHOD-ID. FactoryObject.
DATA DIVISION.
LINKAGE SECTION.
01 outFactory USAGE OBJECT REFERENCE FACTORY OF ACTIVE-CLASS.
Expand Down

0 comments on commit 941d5ef

Please sign in to comment.