INTERNAL.Document
module DIAGS = Cobol_common.Diagnostics
module TYPES : sig ... end
include module type of struct include TYPES end
type document = TYPES.document = {
project : Superbol_project__.Project.TYPES.project;
textdoc : Lsp.Text_document.t;
copybook : bool;
artifacts : Cobol_parser.Outputs.artifacts;
checked : checked_doc option;
rewinder : rewinder option;
parsing_diags : Cobol_parser.Diagnostics.ALL.t;
typecking_diags : Cobol_typeck.Diagnostics.t;
}
and checked_doc = Cobol_typeck.Outputs.t
and rewinder =
(Cobol_ptree.compilation_group option, Cobol_common.Behaviors.eidetic)
Cobol_parser.Outputs.output
Cobol_parser.rewinder
Raised by Document.checked
.
exception Internal_error of document * exn * Stdlib.Printexc.raw_backtrace
Raised by Document.load
and Document.update
; allows keeping consistent document contents.
type cached = TYPES.cached = {
doc_cache_filename : string;
doc_cache_checksum : Stdlib.Digest.t;
doc_cache_langid : string;
doc_cache_version : int;
doc_cache_pplog : Cobol_preproc.Trace.log;
doc_cache_tokens : Cobol_parser.Outputs.tokens_with_locs;
doc_cache_comments : Cobol_preproc.Text.comments;
doc_cache_ignored : Cobol_common.Srcloc.lexloc list;
doc_cache_checked : checked_doc option;
doc_cache_parsing_diags : Cobol_parser.Diagnostics.ALL.t;
doc_cache_typecking_diags : Cobol_typeck.Diagnostics.t;
}
Persistent representation (for caching)
type t = document
val uri : document -> Lsp__.Uri0.t
val language_id : document -> string
val rewindable_parse :
document ->
((Cobol_ptree.compilation_group option, Cobol_common.Behaviors.eidetic)
Cobol_parser__.Parser_outputs.output
* (Cobol_ptree.compilation_group option, Cobol_common.Behaviors.eidetic)
Cobol_parser__.Parser_outputs.output
Cobol_parser.rewinder)
Cobol_common__Diagnostics_accumulator.MAKE(Cobol_parser__.Parser_diagnostics.ALL).TYPES.with_diags
val no_artifacts : Cobol_parser.Outputs.artifacts
val reparse_and_analyze :
?position:Cobol_parser.position ->
document ->
document
val inspect_at :
position:Lsp.Types.Position.t ->
f:(Cobol_parser.inspectable_parser_state -> 'a) ->
document ->
'a option
inspect_at ~position ~f doc
passes to f
the state that is reached by the parser at position
in doc
. Returns None
on copybooks, or Some r
for r
the result of f
.
val blank :
project:Superbol_project__.Project.TYPES.project ->
Lsp.Text_document.t ->
document
Creates a record for a document that is not yet parsed or analyzed.
val load :
project:Superbol_project__.Project.TYPES.project ->
Lsp__.Types.DidOpenTextDocumentParams.t ->
document
val first_change_pos :
Lsp.Types.TextDocumentContentChangeEvent.t list ->
Cobol_parser.position
val checked : document -> checked_doc
Raises Unparseable
in case the document cannot be parsed entierely, or Copybook
in case the document is not a main program.
val diagnostics : document -> DIAGS.Set.t
Caching utilities
Raises Failure
in case of bad checksum.