ir: Add Ir.parse_spans for Isar command splitting#203
Closed
ike-mulder-aws wants to merge 1 commit intoawslabs:mainfrom
Closed
ir: Add Ir.parse_spans for Isar command splitting#203ike-mulder-aws wants to merge 1 commit intoawslabs:mainfrom
ike-mulder-aws wants to merge 1 commit intoawslabs:mainfrom
Conversation
Expose Isabelle's Outer_Syntax.parse_text via a new Ir.parse_spans command that takes a REPL id and text, outputting 1-based character offsets of each Isar command span. Signed-off-by: Ike Mulder <ikemul@amazon.com>
a7fd743 to
fe207c7
Compare
Comment on lines
+593
to
+600
| fun parse_spans id text = | ||
| let val thy = Toplevel.theory_of (last_state (the_repl id)) | ||
| val transitions = Outer_Syntax.parse_text thy (fn () => thy) Position.start text | ||
| in List.app (fn tr => | ||
| case Position.offset_of (Toplevel.pos_of tr) of | ||
| SOME off => out (string_of_int off) | ||
| | NONE => ()) transitions | ||
| end; |
Contributor
There was a problem hiding this comment.
Do we really want to expose this low-level functionality, or rather an Ir.explode or similar which 'refines' a REPL by splitting each of its steps into individual commands (either destructively, or creating a new REPL).
Contributor
Author
|
Closing this as this functionality can be achieved without changing the I/R API. Namely, one can |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose Isabelle's Outer_Syntax.parse_text via a new Ir.parse_spans command that takes a REPL id and text, outputting 1-based character offsets of each Isar command span. This can be useful for clients of I/R to do fine-grained stepping.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.