This repository has been archived by the owner on Aug 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow runAnalysis with custom Output
- Loading branch information
1 parent
4dd8e71
commit 8471b60
Showing
7 changed files
with
55 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import LeanInk.ListUtil | ||
import LeanInk.Configuration | ||
|
||
import Lean.Elab | ||
import Lean.Data.Lsp | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import LeanInk.Analysis.DataTypes | ||
import LeanInk.Configuration | ||
import LeanInk.ListUtil | ||
|
||
import Lean.Elab | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import LeanInk.Analysis.DataTypes | ||
|
||
namespace LeanInk.Annotation | ||
|
||
open LeanInk.Analysis | ||
|
||
universe u | ||
|
||
/- COMPOUND -/ | ||
structure Compound (β : Type u) where | ||
headPos : String.Pos | ||
fragments : List (Nat × β) | ||
deriving Inhabited | ||
|
||
structure Annotation where | ||
sentence : Compound Sentence | ||
tokens : List (Compound Token) | ||
|
||
namespace Compound | ||
def getFragments (self : Compound b) : List b := self.fragments.map (λ f => f.2) | ||
|
||
def tailPos { x : Type u } [Positional x] (self : Compound x) : Option String.Pos := (self.getFragments.map (λ f => Positional.tailPos f)).maximum? | ||
|
||
def empty { x : Type u } (headPos : String.Pos) : Compound x := { headPos := headPos, fragments := [] } | ||
end Compound | ||
|
||
instance {a : Type u} [ToString a] : ToString (Compound a) where | ||
toString (self : Compound a) : String := "<COMPOUND head:" ++ toString self.headPos ++ " fragments := " ++ toString self.getFragments ++ ">" |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
import LeanInk.Annotation.DataTypes | ||
|
||
namespace LeanInk | ||
|
||
open System | ||
open LeanInk.Annotation | ||
|
||
-- The `OutputType` specifies in which format the result of | ||
-- leanInks analysis gets returned. | ||
inductive OutputType where | ||
-- alectryonFragments describes the format used by Alectryon which basically is a list | ||
-- of fragments. Each fragment is either a `Text` or `Sentence`. TODO: specify further | ||
| alectryonFragments : OutputType | ||
|
||
-- The analyze `Configuration` describes all input specifications and infos for | ||
-- the LeanInk analysis execution context. It contains the list of input file paths, etc. | ||
structure Configuration where | ||
inputFilePath : FilePath | ||
inputFileContents : String | ||
outputType : OutputType | ||
lakeFile : Option FilePath | ||
verbose : Bool | ||
experimentalTypeInfo : Bool | ||
experimentalDocString : Bool | ||
experimentalSemanticType : Bool | ||
|
||
namespace Configuration | ||
def inputFileName (self : Configuration) : String := | ||
self.inputFilePath.toString | ||
end Configuration | ||
|
||
def inputFileName (self : Configuration) : String := | ||
self.inputFilePath.toString | ||
abbrev AnalysisM := ReaderT Configuration $ IO | ||
|
||
end Configuration | ||
structure Output where | ||
name : String | ||
genOutput : List Annotation -> AnalysisM UInt32 | ||
|
||
abbrev AnalysisM := ReaderT Configuration $ IO | ||
abbrev ExecM := ReaderT Configuration $ IO |