Rob Rix
8acc962ad2
Offset leaves’ ranges to get the substrings.
2015-12-14 12:40:08 -05:00
Rob Rix
bac6b696a5
Make leaves within the parent’s substring.
2015-12-14 12:39:56 -05:00
Rob Rix
dbce74368f
Pass the start index to makeLeaf.
2015-12-14 12:39:09 -05:00
Rob Rix
41032f0399
We don’t need a $ here.
2015-12-14 12:37:23 -05:00
Rob Rix
6fc7632e93
Only pass the start index around.
2015-12-14 12:37:07 -05:00
Rob Rix
774f731ab1
Pass the source to makeLeaf.
2015-12-14 12:35:16 -05:00
Rob Rix
4dd9907130
Try negating the offset.
2015-12-14 12:34:18 -05:00
Rob Rix
4cd2b2db7a
Parentheses are not required here.
2015-12-14 12:25:09 -05:00
Rob Rix
a239384831
Work within recursively smaller and smaller substrings.
...
This resolves the O(n²) behaviour we were seeing.
2015-12-14 12:24:55 -05:00
Rob Rix
79e4860c62
Pass the source & root to recursive invocations.
2015-12-14 12:18:58 -05:00
Rob Rix
039e5849ca
Revert "Shadow the outer function’s name."
...
This reverts commit 4cb7c975334d540b9ef08d59724536d2bbd8fda0.
2015-12-14 12:17:35 -05:00
Rob Rix
c004eb739e
Revert "Push the inner function out and operate within substrings."
...
This reverts commit 435ba7a2e35d9a4bb61413b91895b88bf3cb2be9.
2015-12-14 12:17:30 -05:00
Rob Rix
b08bb04767
Push the inner function out and operate within substrings.
2015-12-14 12:16:44 -05:00
Rob Rix
1c3db7ae47
Shadow the outer function’s name.
2015-12-14 12:15:55 -05:00
Rob Rix
ae047f3012
Reorder the parameters for partial application.
2015-12-14 12:15:28 -05:00
Rob Rix
6dbaf9f53a
Replace wordy leaves in both terms.
2015-12-14 12:13:18 -05:00
Rob Rix
36747be406
Add a function replacing wordy leaves in a term with branches of per-word leaves.
2015-12-14 12:09:21 -05:00
Rob Rix
0944591fab
Add a function computing the ranges of non-whitespace substrings within a string.
2015-12-14 12:08:33 -05:00
Rob Rix
9e8a6f8456
Default to the line by line parser.
2015-12-09 10:36:37 -05:00
Rob Rix
a75c1b0482
No need to reinvent fmap.
2015-12-09 10:18:52 -05:00
Rob Rix
da3634c59a
parserForType
returns a Parser.
...
This change moves the languages out of IO. I believe this to be correct
(as they should be referentially transparent) but we may wish to review
that carefully.
2015-12-09 10:11:30 -05:00
Rob Rix
d7f415da04
Move all of the tree-sitter stuff into its own module.
2015-12-09 09:58:15 -05:00
Rob Rix
dcbf7bafb7
Use the Parser type.
2015-12-09 09:50:55 -05:00
Rob Rix
49910d1d1e
Render HTML to Html.
2015-12-07 14:34:58 -05:00
Rob Rix
a5e7341322
Push the let bindings out a bit.
2015-12-07 14:23:32 -05:00
joshvera
395cfde9aa
takeExtension returns extensions with dots
2015-12-04 16:25:01 -05:00
joshvera
d7089ec506
Remove unused parser type
2015-12-03 15:54:41 -05:00
joshvera
395eee7f7c
Merge remote-tracking branch 'origin/split-diffs-in-haskell' into select-grammar
2015-12-03 15:50:26 -05:00
joshvera
fae0a806f3
use ts_language_javascript
2015-12-03 15:44:08 -05:00
joshvera
d43ced80f5
we just say ts_language_javascript
2015-12-03 15:34:41 -05:00
joshvera
79f2f94c2c
Add ts_language_js as a language
2015-12-03 15:21:34 -05:00
joshvera
c20ea6ee78
Switch parsers on mediaType
2015-12-03 15:10:49 -05:00
joshvera
370fbe4819
remove duplicate imports
2015-12-03 14:03:10 -05:00
Rob Rix
bbcb3be6fc
Move Split & Unified into the library.
2015-12-03 11:37:18 -05:00
Rob Rix
51db79e961
(Incorrect) rendering of indexed nodes to rows.
2015-12-03 11:36:00 -05:00
Rob Rix
80dcd8efae
Return ranges from diffToRows.
2015-12-03 10:50:03 -05:00
Rob Rix
ffcb4d9c98
Zip left/right elements together.
2015-12-03 10:39:48 -05:00
Rob Rix
b075e8b18f
Add zipMaybe
.
2015-12-03 10:36:17 -05:00
Rob Rix
f8f392262d
Collect the left/right elements.
2015-12-03 10:20:02 -05:00
Rob Rix
db0b5eca8f
Remove an unused import.
2015-12-03 10:19:24 -05:00
Rob Rix
6a3fc9b6b9
Destructure the annotations.
2015-12-03 10:13:24 -05:00
Rob Rix
7873b0e6f3
Rename freeSyntaxToSplit to annotationAndSyntaxToRows.
2015-12-03 10:09:01 -05:00
Rob Rix
6a05ca0b25
Rename straightToSplit to diffToRows.
2015-12-03 10:07:26 -05:00
Rob Rix
485959b135
Row’s constructor is curried.
2015-12-03 10:06:39 -05:00
Rob Rix
bc57f7f871
Simplify Row to two HTML elements.
2015-12-03 10:05:18 -05:00
Rob Rix
c246b08cf4
Pass the annotations to freeSyntaxToSplit.
2015-12-03 10:03:45 -05:00
Rob Rix
1c55552a1b
Delegate free rendering to freeSyntaxToSplit.
2015-12-03 10:02:52 -05:00
Rob Rix
676c5c67ab
Compute the rows for free leaves.
2015-12-03 10:02:30 -05:00
Rob Rix
8db4f0f947
Add a Row type.
2015-12-03 10:02:08 -05:00
Rob Rix
f97b2aa8b4
Stub in a function rendering split diffs directly.
2015-12-03 09:10:00 -05:00
Rob Rix
4853095dbd
Merge branch 'split-diffs-in-haskell' of https://github.com/github/semantic-diff into split-diffs-in-haskell
2015-12-03 09:05:59 -05:00
joshvera
8438037658
remove uses of lineRange
2015-12-02 21:52:38 -05:00
joshvera
2a063d3277
Move Range to a module
2015-12-02 21:40:34 -05:00
Rob Rix
f01cf12567
Rename splitTerm
to termToHTML
.
2015-12-02 17:39:46 -05:00
Rob Rix
3990324bd0
Concatenate HTML lines in Dl elements. I hope.
2015-12-02 17:39:46 -05:00
Rob Rix
8cbe16883d
Concatenate HTML lines in Ul elements.
2015-12-02 17:39:46 -05:00
Rob Rix
c3cd1edc7d
Add a function which concatenates together HTML lines.
2015-12-02 17:39:46 -05:00
Rob Rix
5523a89eb5
Add a function which appends an element onto the last line of a list of HTML lines.
2015-12-02 17:39:46 -05:00
Rob Rix
0bf32bc50f
Only export split
.
2015-12-02 17:39:46 -05:00
Rob Rix
10e7c748cb
Split <ul> by line.
...
Surely this can’t be this easy.
2015-12-02 17:39:46 -05:00
Rob Rix
8e25d59506
Don’t split <dt>.
2015-12-02 17:39:46 -05:00
Rob Rix
87b86ba817
Split spans into lines.
2015-12-02 17:39:46 -05:00
Rob Rix
7d3542075d
Split text nodes into lines.
2015-12-02 17:39:46 -05:00
Rob Rix
b45b2c62f2
Represent Patch
HTML as Patch
es.
2015-12-02 17:39:46 -05:00
joshvera
1dd8d93ce1
use fromIntegral
2015-12-02 14:29:19 -05:00
Rob Rix
0996c1da5f
Apply a couple of linter-suggested eta reductions.
2015-12-02 09:26:36 -05:00
Rob Rix
0969736753
Infix fmap for reduced chaff.
2015-12-01 16:36:43 -05:00
Rob Rix
d574443969
Split rendering of unpatched leaves.
2015-12-01 16:34:26 -05:00
Rob Rix
3d291be3d3
Split rendering of keyed terms.
2015-12-01 16:18:49 -05:00
Rob Rix
05c20e8da6
Make a list of map elements.
2015-12-01 16:18:43 -05:00
Rob Rix
cb715cb8ea
Accumulate keyed elements.
2015-12-01 16:18:36 -05:00
Rob Rix
dd5c507f0c
Definition lists contain a list and not a map.
2015-12-01 16:18:19 -05:00
Rob Rix
3daa354cce
Add a term case.
2015-12-01 16:18:08 -05:00
Rob Rix
8387d7bc6e
Split rendering of fixed terms.
2015-12-01 16:07:53 -05:00
Rob Rix
9b1b1b8643
Extract a makeList function for lists.
2015-12-01 16:07:45 -05:00
Rob Rix
453499d4d7
Use subtext
.
2015-12-01 15:57:44 -05:00
Rob Rix
26625e1c1c
Add a function to produce a node from a subrange.
2015-12-01 15:57:37 -05:00
Rob Rix
776580768c
Handle indexed nodes (or pretend to).
2015-12-01 15:56:15 -05:00
Rob Rix
c44418272c
Render patches and terms to HTML (maybe)
2015-12-01 15:39:55 -05:00
Rob Rix
cc5cca02f7
Classification of terms by their categories.
2015-12-01 15:39:45 -05:00
Rob Rix
e6f75ea741
ClassNames Maybe???
2015-12-01 15:39:21 -05:00
Rob Rix
f68c0521a8
Add a stupid HTML type.
2015-12-01 15:31:02 -05:00
Rob Rix
6da6631302
Name the line range.
2015-12-01 15:30:54 -05:00
Rob Rix
25b1756419
Populate the line range.
2015-12-01 15:04:23 -05:00
Rob Rix
fe4e2cf260
Bridge to the node start/end point functions.
2015-12-01 14:59:29 -05:00
Rob Rix
1b5f6b848d
stub line ranges in Info
2015-12-01 14:51:21 -05:00
Rob Rix
f2ca75a276
Map patches into pairs of optional elements.
2015-12-01 14:35:41 -05:00
Rob Rix
9048d3101f
Map terms into elements.
2015-12-01 14:35:33 -05:00
Rob Rix
68ce3a200e
Add an Element type synonym.
2015-12-01 14:35:23 -05:00
Rob Rix
080fda5bdf
Stub in splitting.
2015-12-01 14:18:13 -05:00
Rob Rix
9f41d5072e
Only export the one symbol.
2015-12-01 11:38:48 -05:00
Rob Rix
8600d7d71b
Stub in split diff rendering.
2015-12-01 11:33:16 -05:00
Rob Rix
226dc1e966
Hide Data.Set.split
.
2015-12-01 11:33:10 -05:00
Rob Rix
5512f48ee5
Add a --split
option.
2015-12-01 11:32:52 -05:00
Rob Rix
f655c414f7
Bind the diff outside the output.
2015-12-01 11:26:46 -05:00
Rob Rix
bfb982f69e
Only format unified diffs when --unified is used.
2015-12-01 11:24:33 -05:00
Rob Rix
e8609ba886
Remove files
.
2015-12-01 11:22:28 -05:00
Rob Rix
0dbfbba869
Use the parsed arguments.
2015-12-01 11:22:26 -05:00
Rob Rix
250f52e01a
Parse the args with our parser.
2015-12-01 11:19:40 -05:00
Rob Rix
2976bb1f18
Add a parser for our arguments.
2015-12-01 11:15:13 -05:00
Rob Rix
b98839393d
Split the sources up into fields.
2015-12-01 11:15:05 -05:00
Rob Rix
3c1c4e6911
Add the model for our arguments.
2015-12-01 11:08:04 -05:00
Rob Rix
d5f53facd2
Stub in a Split module.
2015-12-01 10:56:27 -05:00
Rob Rix
be48dd844f
unifiedRange
operates on its argument, not the after
string.
2015-12-01 10:24:36 -05:00
Rob Rix
8a17c2eea9
Pass the source into annotationAndSyntaxToChunks
.
2015-11-30 18:50:08 -05:00
Rob Rix
701846c49d
Rename f
.
2015-11-30 18:28:40 -05:00
Rob Rix
8b74a99e7e
Everything is lists of chunks.
2015-11-27 14:28:06 -05:00
Rob Rix
4a6a17ce26
Remove `Unified.
2015-11-27 14:28:01 -05:00
Rob Rix
b1629443fb
Compute the chunks in a Unified
rendering.
2015-11-27 14:15:42 -05:00
Rob Rix
ea37bf8889
Add a Unified
datatype to render to.
2015-11-27 14:15:34 -05:00
Rob Rix
f2cede523e
Only take the difference # of characters.
2015-11-27 12:50:08 -05:00
Rob Rix
a2f190fb14
Export substring.
2015-11-27 12:49:46 -05:00
Rob Rix
6852e72e08
Factor Chunk out of substring.
2015-11-27 12:49:40 -05:00
Rob Rix
4aa89bd919
Print out the unified diff.
2015-11-27 12:42:00 -05:00
Rob Rix
070e60f149
Alphabetical order.
2015-11-27 12:41:38 -05:00
Rob Rix
acfb27ba9b
Diff things.
2015-11-27 12:22:05 -05:00
Rob Rix
bb9bf71d17
Merge branch 'master' into sunshine-lollipops-and-rainbows-everywhere
...
# Conflicts:
# semantic-diff.cabal
2015-11-27 11:36:18 -05:00
Rob Rix
c77b0e088e
Remove Console.
2015-11-27 11:33:46 -05:00
Rob Rix
afce15e01f
Use <> instead of mappend.
2015-11-27 11:32:31 -05:00
Rob Rix
3d65c325d1
We no longer need Console.
2015-11-27 11:31:35 -05:00
Rob Rix
5c295fdcec
Remove the Attribute
stuff.
2015-11-27 11:31:24 -05:00
Rob Rix
be328aa0c2
Unified rendering produces ByteStrings using rainbow.
2015-11-27 11:31:03 -05:00
Rob Rix
b109418ede
We don’t need format
after all.
2015-11-27 11:18:51 -05:00
Rob Rix
1010e10889
Add a binding to format a string.
2015-11-27 10:36:59 -05:00
Rob Rix
99e383a644
Move Console and Unified into the exe.
2015-11-27 10:14:12 -05:00
Rob Rix
908d6b9de0
Ingest Keyed nodes.
2015-11-27 09:19:40 -05:00
Rob Rix
1ecad15128
Import Data.Map again.
2015-11-27 09:19:09 -05:00
Rob Rix
854e2f7013
withNamedChildren returns name/child pairs.
2015-11-27 09:19:02 -05:00
Rob Rix
2353cf3798
Rename the parameter.
2015-11-26 16:28:17 -05:00
Rob Rix
0e68767028
Close over the function.
2015-11-26 16:27:57 -05:00
Rob Rix
fdc2942411
Just return the result directly.
2015-11-26 16:27:22 -05:00
Rob Rix
3b24a3cd34
Parsing returns a Term.
2015-11-26 16:25:55 -05:00
Rob Rix
ae7235eb69
Use withCString
instead of copying and freeing.
2015-11-26 16:24:57 -05:00
Rob Rix
4fd4c66f08
Rename parse
to documentToTerm
.
2015-11-26 16:22:27 -05:00
Rob Rix
253c461b12
Handle the alloca in parse
.
2015-11-26 16:22:01 -05:00
Rob Rix
f27f35c683
Better error messages.
2015-11-26 16:21:54 -05:00
Rob Rix
ac470d3fbb
We no longer require a Storable instance for TSLength.
2015-11-26 16:17:25 -05:00
Rob Rix
8a2fac6816
Construct a singleton set.
2015-11-26 16:15:56 -05:00
Rob Rix
4505c0f7e3
Don’t qualify member
and fromList
.
2015-11-26 16:15:39 -05:00
Rob Rix
f6f4ea05ed
Don’t import Data.Map
.
2015-11-26 16:14:34 -05:00
Rob Rix
54e931eabe
Handle the allocation within parseTreeSitterFile
.
2015-11-26 16:09:16 -05:00
Rob Rix
be6dc5e627
Once more remove withAlloc.
2015-11-26 16:07:25 -05:00
Rob Rix
ab7fa792ed
Use alloca instead of withAlloc.
2015-11-26 16:07:21 -05:00
Rob Rix
018f4dcbd5
Operate strictly recursively.
...
This means we’re ensured of using allocations solely within the scopes
in which they are valid.
2015-11-26 16:07:04 -05:00
Rob Rix
19818231f5
We can safely alloca
the root.
2015-11-26 15:37:57 -05:00
Rob Rix
49133ad240
Don’t import Generic.
2015-11-26 14:03:57 -05:00
Rob Rix
aaf4164e92
Don’t derive Generic.
2015-11-26 14:03:53 -05:00
Rob Rix
4d314d6729
Don’t import GHC.Prim.
2015-11-26 14:02:33 -05:00
Rob Rix
755cae0ae4
Don’t import CStorable.
2015-11-26 14:01:46 -05:00
Rob Rix
f15af07f2e
Don’t bother deriving CStorable.
2015-11-26 14:01:42 -05:00