-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cancel parsing event #941
Cancel parsing event #941
Changes from all commits
62ab074
d12638f
105352c
df5652d
daed67e
8634298
6cb17fa
2029fc8
eed0df6
da65b44
7a64cb5
afb495f
c98da57
cbb788d
0a86985
dfe8a05
0852fb9
4a349a5
8536071
0e8c72d
f4a01c5
b537578
a881fb1
2d8bfff
3c487e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,19 @@ type outline_element = { | |
|
||
type outline = outline_element list | ||
|
||
|
||
type parsing_end_info = { | ||
unchanged_id: sentence_id option; | ||
invalid_ids: sentence_id_set; | ||
previous_document: document; | ||
parsed_document: document; | ||
} | ||
|
||
type event | ||
val pp_event : Format.formatter -> event -> unit | ||
|
||
type events = event Sel.Event.t list | ||
|
||
val raw_document : document -> RawDocument.t | ||
|
||
val outline : document -> outline | ||
|
@@ -45,10 +58,15 @@ val create_document : Vernacstate.Synterp.t -> string -> document | |
(** [create_document init_synterp_state text] creates a fresh document with content defined by | ||
[text] under [init_synterp_state]. *) | ||
|
||
val validate_document : document -> sentence_id option * sentence_id_set * document | ||
(** [validate_document doc] parses the document without forcing any execution | ||
and returns the id of the bottommost sentence of the prefix which has not changed | ||
since the previous validation, as well as the set of invalidated sentences *) | ||
val validate_document : document -> document * events | ||
(** [validate_document doc] triggers the parsing of the document line by line without | ||
launching any execution. *) | ||
|
||
val handle_event : document -> event -> document * events * parsing_end_info option | ||
(** [handle_event dpc ev] handles a parsing event for the document. One parsing event parses one line | ||
and prepares the next parsing event. Finally once the full parsing is done, the final event returs | ||
the id of the bottomost sentence of the prefix which has not changed since the previous validation | ||
as well as the set of invalidated sentences. *) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When parsing ends, we still have two documents, hence two cancelation handles. This is a bit confusing: which document should the client keep? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I catch your drift ? We have one "parsing" document which just became "parsed", and one "previous" document which is the version before all the new parsing events happened. |
||
|
||
type parsed_ast = { | ||
ast: Synterp.vernac_control_entry; | ||
|
@@ -63,6 +81,8 @@ type parsing_error = { | |
qf: Quickfix.t list option; | ||
} | ||
|
||
type parse_state | ||
|
||
val parse_errors : document -> parsing_error list | ||
(** [parse_errors doc] returns the list of sentences which failed to parse | ||
(see validate_document) together with their error message *) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should build a record for the return type, so that we can name all these documents