Skip to content

Commit

Permalink
Minor tweaks and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nberth committed Oct 5, 2023
1 parent fa0abb5 commit ce6bf5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
9 changes: 4 additions & 5 deletions src/lsp/cobol_ast/misc_descr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,8 @@ let pp_select_clause ppf = function
| SelectRecordKey { key; source } ->
Fmt.pf ppf "RECORD %a%a"
pp_qualname key
Pretty.(list ~fopen:"SOURCE " ~fsep:"@ " ~fclose:"" ~fempty:""
pp_name') source
(Pretty.list ~fopen:"SOURCE " ~fsep:"@ " ~fclose:"" ~fempty:""
pp_name') source
| SelectRelativeKey n ->
Fmt.pf ppf "RELATIVE %a" pp_name' n
| SelectReserve n -> Fmt.pf ppf "RESERVE %a" pp_integer n
Expand Down Expand Up @@ -759,11 +759,10 @@ let pp_comment_entry: comment_entry Pretty.printer =
Fmt.(list ~sep:sp string)

let pp_informational_paragraph: informational_paragraph Pretty.printer =
Fmt.(any "@[<4>" ++ (* <- indent by 4 to avoid Area A *)
Fmt.(box ~indent:4 @@ (* <- indent by 4 to avoid Area A *)
pair ~sep:(any ".@ ")
pp_informational_paragraph_header
(pp_with_loc pp_comment_entry) ++
any "@]")
(pp_with_loc pp_comment_entry))

let pp_informational_paragraphs: informational_paragraphs Pretty.printer =
Fmt.(list ~sep:(any "@\n") (* force newlines *)
Expand Down
15 changes: 12 additions & 3 deletions src/lsp/cobol_parser/parser_outputs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,17 @@ type artifacts =
comments: Cobol_preproc.comments;
}

type ('a, 'm) output =
| Only: 'a -> ('a, Cobol_common.Behaviors.amnesic) output
| WithArtifacts: 'a * artifacts -> ('a, Cobol_common.Behaviors.eidetic) output
(** The output of parsing functions depends on its memorization abilities:
- an amnesic parse (when ['memo = Cobol_common.Behaviors.amnesic]) only
returns a parsing result (of type ['a]);
- an eidetic parse (when ['memo = Cobol_common.Behaviors.eidetic])
additionally returns some parsing artefacts. *)
type ('result, 'memo) output =
| Only:
'result -> ('result, Cobol_common.Behaviors.amnesic) output
| WithArtifacts:
'result * artifacts -> ('result, Cobol_common.Behaviors.eidetic) output

type 'm parsed_compilation_group = (PTree.compilation_group option, 'm) output

0 comments on commit ce6bf5c

Please sign in to comment.