1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00
Commit Graph

487 Commits

Author SHA1 Message Date
joshvera
24015141b7 Add conduit 2015-12-30 18:00:57 -05:00
joshvera
609e713580 Move printDiff to its own function 2015-12-30 18:00:44 -05:00
joshvera
16013ae454 read and transcode text to unicode 2015-12-29 17:34:28 -05:00
joshvera
a3051c531d Merge remote-tracking branch 'origin/master' into use-text 2015-12-29 15:13:57 -05:00
Rob Rix
0866ef52bd Merge branch 'diff-performance' into patch 2015-12-24 16:33:24 -05:00
Rob Rix
9343e9d4ae Do all formatting within Sources. 2015-12-24 00:20:47 -05:00
Rob Rix
0ef7cdf93b Merge branch 'strictness' into patch 2015-12-23 18:06:47 -05:00
Rob Rix
c1973d052d Fold strictly. 2015-12-23 18:01:31 -05:00
Rob Rix
71c0719326 Remove a redundant import. 2015-12-23 18:01:01 -05:00
joshvera
888cad5791 pack file extension when passing to parserForType 2015-12-18 14:53:25 -05:00
joshvera
75a9a48249 eta reduce 2015-12-18 14:52:26 -05:00
joshvera
e2817db885 Convert lineByLineParser to return text 2015-12-18 14:48:44 -05:00
joshvera
12df3007f1 output text when given Split option 2015-12-18 14:48:33 -05:00
joshvera
cfc4a97f9d Merge remote-tracking branch 'origin/master' into use-bytestrings 2015-12-18 14:43:25 -05:00
Rob Rix
e75827ad7f Qualify the PatchOutput import. 2015-12-18 08:23:28 -05:00
Rob Rix
70c5179a6b Merge branch 'master' into patch 2015-12-17 17:34:45 -05:00
Rob Rix
5b150a72ae Render diffs as patches when --patch is used. 2015-12-17 17:23:06 -05:00
Rob Rix
10afe48d93 Add an argument to select patch output. 2015-12-17 17:19:13 -05:00
Rob Rix
e61140b10f Add a Patch case to Renderer. 2015-12-17 17:19:05 -05:00
Rob Rix
87de49129b Move the bridge sources into src/. 2015-12-17 13:05:53 -05:00
Rob Rix
96f189719a Move TreeSitter into the library. 2015-12-17 12:54:27 -05:00
Rob Rix
be2d4f5d76 Denote a bunch of C productions as being fixed. 2015-12-16 18:22:25 -05:00
Rob Rix
5755c314fb Bind the C language in the where clause. 2015-12-16 18:11:23 -05:00
Rob Rix
2ca8e7ca11 Reformat. 2015-12-16 18:10:39 -05:00
Rob Rix
136399bd66 Move fixedProductions into the language selection. 2015-12-16 18:10:13 -05:00
Rob Rix
4544d25974 Deparenthesize. 2015-12-16 18:09:32 -05:00
Rob Rix
86dfd83935 Swap the order of the language & constructor. 2015-12-16 18:08:51 -05:00
Rob Rix
a886a849f4 Move keyedProductions into the language selection. 2015-12-16 18:07:39 -05:00
Rob Rix
4898163d50 Move constructorForProductions into the library. 2015-12-16 16:27:03 -05:00
Rob Rix
3652773729 Move the Constructor type into the library. 2015-12-16 16:24:58 -05:00
Rob Rix
e47d3d4d3c Move the Parser type back into the library. 2015-12-16 16:24:23 -05:00
Rob Rix
1504a985de Rename Parser to Parsers. 2015-12-16 16:21:49 -05:00
Rob Rix
c6eb5f9722 Use the Constructor to build the terms. 2015-12-16 16:08:10 -05:00
Rob Rix
4c34d43691 Construct the Info inline. 2015-12-16 16:06:55 -05:00
Rob Rix
c2f37529b3 Pass the Constructor to documentToTerm. 2015-12-16 16:06:06 -05:00
Rob Rix
53046e4b0d Select a Language for a given file name extension. 2015-12-16 16:05:24 -05:00
Rob Rix
0769c00d1d Abstract a Language type. 2015-12-16 16:03:15 -05:00
Rob Rix
ec674a572a Construct keyed nodes when appropriate. 2015-12-16 16:02:59 -05:00
Rob Rix
829e443af8 Use fixed nodes when appropriate. 2015-12-16 16:01:43 -05:00
Rob Rix
82c96e18eb Default to indexed nodes. 2015-12-16 16:01:36 -05:00
Rob Rix
ffaa893b43 Rephrase constructorForProductions using a where clause. 2015-12-16 16:01:26 -05:00
Rob Rix
42850ef44e Constructors take a list of production name/child pairs. 2015-12-16 15:59:07 -05:00
Rob Rix
8ace751fcf Move the source string to Constructor. 2015-12-16 15:55:12 -05:00
Rob Rix
49fe2fc030 Stub in a function which builds a Constructor given sets of keyed & fixed production names & a source string. 2015-12-16 15:54:05 -05:00
Rob Rix
7c093e81da Qualify the import of Data.Set. 2015-12-16 15:49:46 -05:00
Rob Rix
326a4c9709 Constructors take Info instead of just the production name. 2015-12-16 15:45:30 -05:00
Rob Rix
c3d80962a1 Stub in the type of a constructor function. 2015-12-16 15:41:36 -05:00
Rob Rix
6270b4aa7e Remove the Haskell module. 2015-12-16 15:36:08 -05:00
Rob Rix
36e7e49f72 Don’t attempt to parse Haskell sources. 2015-12-16 15:35:57 -05:00
Rob Rix
51098e2023 Pretend like we know what we’re doing & parse with Trifecta instead. 2015-12-16 11:48:09 -05:00
Rob Rix
3cae267d77 Add a function to parse into a leaf term.
We aren’t using the source positions yet because O(n) 😭 will have
to sort this out later.
2015-12-16 10:29:23 -05:00
Rob Rix
5628582923 Revert "Add a Token type."
This reverts commit 7207d11e233b9e83db1fdf5e396195b36f9f802a.
2015-12-16 09:54:03 -05:00
Rob Rix
a950eff438 Revert "Tokenize strings."
This reverts commit 306fc275f7e0bd3c1a760d079a65e3c50fca7bb0.
2015-12-16 09:53:08 -05:00
Rob Rix
432e83f5b4 Revert "Split token representations up a bit."
This reverts commit 3970c6497c3577c6151f7cf339451b0473580796.
2015-12-16 09:51:31 -05:00
Rob Rix
42c83c2ea7 Stub in a parser for module declarations. 2015-12-16 09:51:07 -05:00
Rob Rix
0552f2184e Split token representations up a bit. 2015-12-16 09:50:40 -05:00
Rob Rix
751b4b749d Make it slightly more obvious when an error has occurred. 2015-12-16 09:50:29 -05:00
Rob Rix
da793e21d5 Tokenize strings. 2015-12-16 09:41:46 -05:00
Rob Rix
40e9068ed8 Add a Token type. 2015-12-16 09:41:32 -05:00
Rob Rix
6ea78f4318 Merge branch 'output-directory' into haskell-parser 2015-12-16 01:58:18 -05:00
Rob Rix
cd460e4567 Pass it to optional to make it optional, apparently. 2015-12-16 01:53:18 -05:00
Rob Rix
d0c3650045 Split the lines. 2015-12-16 01:42:53 -05:00
Rob Rix
dcbba9bf1b Replace the extension using the operator I guess? 2015-12-16 01:41:45 -05:00
Rob Rix
b26f16478f Provide a default value for the option.
I’m not sure that this is the best way of doing this.
2015-12-16 01:37:05 -05:00
Rob Rix
923e54ff9d Pick a filename if the output path is a directory. 2015-12-16 01:28:40 -05:00
Rob Rix
3a4c9f733d Move the write binding to the outer where clause. 2015-12-16 01:22:48 -05:00
Rob Rix
ed26ed4b80 Break the lambda out into a where clause. 2015-12-16 01:10:20 -05:00
Rob Rix
599663e83d 🔥 writeToFile. 2015-12-16 00:44:26 -05:00
Rob Rix
ba437bd477 Use case analysis instead of maybe. 2015-12-16 00:43:13 -05:00
Rob Rix
1ea542fccb Write split diffs to the output path or stdout. 2015-12-16 00:40:59 -05:00
Rob Rix
3216f77fce Add a helper to write files out. 2015-12-16 00:40:12 -05:00
Rob Rix
25394d2923 Import System.IO. 2015-12-16 00:39:07 -05:00
Rob Rix
5242c21b7a Rename the rendered diff bindings. 2015-12-16 00:26:13 -05:00
Rob Rix
0181673e55 Document the output option. 2015-12-15 23:33:48 -05:00
Rob Rix
d733d0627f Add an optional output dir argument. 2015-12-15 23:31:36 -05:00
Rob Rix
6b61950e6e Ditto for the field. 2015-12-15 23:24:04 -05:00
Rob Rix
d174a0c8c8 Rename Output to Renderer. 2015-12-15 23:23:45 -05:00
Rob Rix
d28ab9041d Use the strArgument shorthand. 2015-12-15 23:20:33 -05:00
joshvera
5fe694d2b8 nope gotta normalize sources in main 2015-12-15 17:42:37 -05:00
joshvera
d4b41f8109 just use TextIO.readFile 2015-12-15 16:08:35 -05:00
Rob Rix
e3c7aeeada .hs → Haskell. 2015-12-15 15:08:54 -05:00
Rob Rix
9c2b12a615 Stub in a runHaskellParser function. 2015-12-15 15:08:49 -05:00
Rob Rix
d766f346fa Stub in a Haskell parser. 2015-12-15 14:53:34 -05:00
Rob Rix
cbf313f011 Use languageForType to select a parser. 2015-12-15 14:40:49 -05:00
Rob Rix
31fcf6e33c Add a languageForType binding to TreeSitter. 2015-12-15 14:39:54 -05:00
Rob Rix
9c0bca7b67 Revert "Rephrase parserForType with pattern matching at the root."
This reverts commit 2b1c9004f73283445f8f3523898e88ba4ed131fd.
2015-12-15 14:38:31 -05:00
Rob Rix
fe85e31574 Rephrase parserForType with pattern matching at the root. 2015-12-15 14:38:20 -05:00
Rob Rix
46029defd2 Import Haskell. 2015-12-15 14:36:31 -05:00
Rob Rix
8e154e0016 Move parserForType into Parser. 2015-12-15 14:36:25 -05:00
Rob Rix
ac042e0c4a Remove some unnecessary parameters from makeLeaf. 2015-12-15 14:36:03 -05:00
Rob Rix
30c2d96066 TreeSitter doesn’t import Parser. 2015-12-15 14:35:48 -05:00
Rob Rix
5add0089a2 Lean on the Monoid instance. 2015-12-15 14:35:37 -05:00
Rob Rix
ad68d7beab Move Parser into the executable(s). 2015-12-15 14:35:11 -05:00
Rob Rix
706da9e13e Stub in a Haskell parser module. 2015-12-15 14:22:06 -05:00
joshvera
8f834c7779 Merge remote-tracking branch 'origin/master' into fix-unicode 2015-12-15 13:31:47 -05:00
joshvera
6eb8172fe4 output split diffs as Text 2015-12-15 13:29:58 -05:00
Rob Rix
2a43e355d7 Pairs are Fixed, not Indexed. 2015-12-15 09:14:23 -05:00
Rob Rix
f399b496d7 Get the substring of the keys for pair nodes. 2015-12-14 18:47:29 -05:00
Rob Rix
defc45eb4e Use getSubstring for arbitrary children of keyed nodes. 2015-12-14 18:47:20 -05:00
Rob Rix
8ba29d97a3 Add a binding to get the substring for a node. 2015-12-14 18:38:52 -05:00
Rob Rix
c6e5f89dfe Assign non-pairs a key from their substrings. 2015-12-14 18:36:46 -05:00
Rob Rix
09ec17cbb6 Stub in a function to map pairs to better keys. 2015-12-14 18:34:53 -05:00
Rob Rix
40f6df8b5d Merge branch 'master' into ordered-map 2015-12-14 17:35:08 -05:00
Rob Rix
d34bf7db42 Merge branch 'ordered-map' into split-rendering-of-keyed-nodes 2015-12-14 17:25:59 -05:00
Rob Rix
3c8b79f0b0 Correct some merge confusion. 2015-12-14 17:22:53 -05:00
Josh Vera
6850b402d4 Merge pull request #326 from github/post-process-leaf-nodes-in-terms
Post process leaf nodes in terms
2015-12-14 17:20:16 -05:00
joshvera
4d04a5b3dd Remove getLineRange 2015-12-14 17:15:44 -05:00
joshvera
824cc801f0 Remove ts_node_p_start_point and ts_node_p_end_point 2015-12-14 17:15:40 -05:00
Rob Rix
62815448c1 Use OrderedMap everywhere. 2015-12-14 17:12:47 -05:00
joshvera
e51492b8d5 Remove line range from Info 2015-12-14 15:52:39 -05:00
Rob Rix
cded6c0d7d Get the substrings out at the same time as computing the ranges. 2015-12-14 15:37:30 -05:00
Rob Rix
df4b74876a Rename the word ranges function. 2015-12-14 15:31:45 -05:00
Rob Rix
9c1dd640f5 Don’t bind subrange, since we only use it once. 2015-12-14 14:41:12 -05:00
Rob Rix
1d9e945aad Pass absolute start indices to children. 2015-12-14 14:40:30 -05:00
Rob Rix
714c8ff682 Compute the substring from the subrange. 2015-12-14 14:39:50 -05:00
Rob Rix
37f236d7d7 Remove redundant imports. 2015-12-14 14:15:46 -05:00
Rob Rix
4083829e12 Bind a different variable for the subrange. 2015-12-14 13:04:21 -05:00
Rob Rix
c115262f7f Share a single computation of the substring for each case. 2015-12-14 13:01:17 -05:00
Rob Rix
718399c7d9 Compute the substring once and only once. 2015-12-14 12:59:47 -05:00
Rob Rix
bf9aa915a3 Move rangesOfWordsFrom into Range.hs. 2015-12-14 12:44:48 -05:00
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