1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00
Commit Graph

1754 Commits

Author SHA1 Message Date
Rob Rix
dc148e31cb Don’t bother erasing the children collection. 2015-10-28 18:23:58 -04:00
Rob Rix
e2e37a011d Compute the count eagerly. 2015-10-28 18:22:53 -04:00
Rob Rix
8d4bc19dc1 Throw a string when we can’t make a String for a node name. 2015-10-28 18:17:16 -04:00
Rob Rix
b933d3ce0d String is an adequate ErrorType. 2015-10-28 18:17:01 -04:00
Rob Rix
b004a800b9 Terms’ annotations are Infos. 2015-10-28 18:12:16 -04:00
Rob Rix
08120cb79f Use the range’s JSON property. 2015-10-28 18:11:22 -04:00
Rob Rix
ba33e1c4a3 Ranges have a JSON property. 2015-10-28 18:11:01 -04:00
Rob Rix
ae6ecef9c2 Try constructing explicitly.
Maybe Xcode 7.0 will like this one better.
2015-10-28 18:07:04 -04:00
Rob Rix
04eaeffb1b Info has a set of string categories. 2015-10-28 17:51:54 -04:00
Rob Rix
ef7ce734d7 Arrays of CustomJSONConvertible elements have a JSON property. 2015-10-28 17:51:27 -04:00
Rob Rix
6688f223fe Use strings for the categories. 2015-10-28 17:48:51 -04:00
Rob Rix
f7f45444e0 Try to compute the name from the contents of the string. 2015-10-28 17:41:02 -04:00
Rob Rix
28ddedb967 Use the range property. 2015-10-28 17:36:29 -04:00
Rob Rix
06de75a3be Add a range property. 2015-10-28 17:36:23 -04:00
Rob Rix
6135553861 Find the correct keys within objects. 2015-10-28 17:32:11 -04:00
Rob Rix
691030332a Correct how names and categories are found. 2015-10-28 17:28:58 -04:00
Rob Rix
b13d3f7d59 Use the category method. 2015-10-28 17:24:41 -04:00
Rob Rix
90caa11870 Factor the private error type out. 2015-10-28 17:23:31 -04:00
Rob Rix
fac848e452 Compute nodes’ categories. 2015-10-28 17:23:06 -04:00
Rob Rix
fa137b30d8 Use the name accessor. 2015-10-28 16:56:00 -04:00
Rob Rix
56a87154de Add a method returning the node’s name as a Swift string. 2015-10-28 16:55:42 -04:00
Rob Rix
3b757bd1e7 Add a TSDocument typealias. 2015-10-28 16:55:28 -04:00
Rob Rix
a87434c683 Move the collection to the bottom. 2015-10-28 16:28:37 -04:00
Rob Rix
bd900197bc Note that the object map is incorrect. 2015-10-28 16:21:17 -04:00
Rob Rix
cdca67f8eb Handle pairs as Fixed. 2015-10-28 16:20:39 -04:00
Rob Rix
9d52d02214 Object literals are keyed. 2015-10-28 16:18:38 -04:00
Rob Rix
2a42c9554d Use the namedChildren collection’s count. 2015-10-28 15:38:20 -04:00
Rob Rix
156fb463f9 Map over the named child collection. 2015-10-28 15:31:08 -04:00
Rob Rix
5532001d94 Add a collection of named children. 2015-10-28 15:27:20 -04:00
Rob Rix
a674548395 Add a collection of children. 2015-10-28 15:22:29 -04:00
Rob Rix
1f9be9ecac Add a private collection type for node children. 2015-10-28 15:22:21 -04:00
Rob Rix
5f121471b5 Switch on the category. 2015-10-28 15:05:25 -04:00
Rob Rix
a40edc906d Revert "Terms are annotated with Info."
This reverts commit d5f4e70140a5ca808ed23ca4e4e2f4204c84e537.
2015-10-28 14:55:45 -04:00
Rob Rix
ab7c0d172c Terms are annotated with Info. 2015-10-28 14:41:13 -04:00
Rob Rix
9d0805c228 Revert "Revert "Don’t constrain the type to the protocol, pass it in directly.""
This reverts commit c813e703e4ee963d94c1d45e7c935731a4eb0c7e.
2015-10-28 14:38:56 -04:00
Rob Rix
a4da6cd33c Revert "Revert "Add a constructor to JSON which takes a CustomJSONConvertible.""
This reverts commit 6ea523a327bed0ce54e8d56373604f1a64c83200.
2015-10-28 14:38:51 -04:00
Rob Rix
502696a992 Info is Categorizable. 2015-10-28 14:38:17 -04:00
Rob Rix
0371c51340 Revert "Add a constructor to JSON which takes a CustomJSONConvertible."
This reverts commit 9e0d4208bed25824275ccc34092b8659fa316a2b.
2015-10-28 14:37:12 -04:00
Rob Rix
cdf4848357 Revert "Don’t constrain the type to the protocol, pass it in directly."
This reverts commit fb68f0c0ba30c0691c72170efa5c5204a027c8aa.
2015-10-28 14:37:08 -04:00
Rob Rix
4b47650de6 Revert "Can construct JSON from array literals of CustomJSONConvertible."
This reverts commit cabc221180851e236d39c717db2eefa9edc9f312.
2015-10-28 14:37:04 -04:00
Rob Rix
4f2e61054e Can construct JSON from array literals of CustomJSONConvertible. 2015-10-28 14:34:44 -04:00
Rob Rix
51dc49f3e0 Don’t constrain the type to the protocol, pass it in directly. 2015-10-28 14:34:16 -04:00
Rob Rix
04a782b5d0 Clean up the range function. 2015-10-28 14:32:59 -04:00
Rob Rix
5d6e10e25a Add a constructor to JSON which takes a CustomJSONConvertible. 2015-10-28 14:31:20 -04:00
Rob Rix
53217d03e5 Info is CustomJSONConvertible. 2015-10-28 14:27:52 -04:00
Rob Rix
039ada73bf Info is Equatable. 2015-10-28 14:23:58 -04:00
Rob Rix
a0e8d918dc Move Category into Info. 2015-10-28 14:22:55 -04:00
Rob Rix
2ea54805f1 Add an Info structure. 2015-10-28 14:22:07 -04:00
Rob Rix
83328cc0d0 Compute the categories for each node. 2015-10-28 14:20:46 -04:00
Rob Rix
c5685aa586 Add a Category type for the syntactic categories in a grammar under TSNode. 2015-10-28 14:13:41 -04:00
Rob Rix
173eb068a1 Compute histograms for both terms. 2015-10-28 14:03:53 -04:00
Rob Rix
a89657250b Throw an error and return nil if we can’t make a Swift string from some node’s name. 2015-10-28 12:33:03 -04:00
Rob Rix
f2c1cf871b Extract the name into a temporary. 2015-10-28 12:21:34 -04:00
Rob Rix
4d1d7d62e8 Patch.difference rethrows errors. 2015-10-28 12:15:36 -04:00
Rob Rix
89cd067c8f Patch.sum rethrows errors. 2015-10-28 12:15:18 -04:00
Rob Rix
c36b1df02b Patch.difference’s argument does not escape. 2015-10-28 12:14:58 -04:00
Rob Rix
5c44771b02 Patch.sum’s argument does not escape. 2015-10-28 12:14:43 -04:00
Rob Rix
0f7d7b2770 Patch.map rethrows errors. 2015-10-28 12:14:15 -04:00
Rob Rix
c03871468e CofreeType.ana rethrows errors. 2015-10-28 12:11:41 -04:00
Rob Rix
b28038cb63 CofreeType.ana’s argument does not escape. 2015-10-28 12:11:02 -04:00
Rob Rix
79dce9ba64 Implement CofreeType.ana without composition or application operators.
Once again, Swift doesn’t understand its own transitivity.
2015-10-28 12:10:37 -04:00
Rob Rix
010f45c15e Cofree.map rethrows errors. 2015-10-28 12:09:04 -04:00
Rob Rix
29e8a7598b Cofree.map’s argument does not escape. 2015-10-28 12:08:27 -04:00
Rob Rix
17987eff80 Free.ana rethrows errors. 2015-10-28 12:07:23 -04:00
Rob Rix
33bd0c5644 Free.ana’s argument does not escape. 2015-10-28 12:06:30 -04:00
Rob Rix
f469b4f691 Implement Free.ana without application or composition operators.
Swift can’t trace `noescape` or `rethrows` transitively through them.
2015-10-28 12:05:40 -04:00
Rob Rix
8ca7cf7599 Free.merge’s argument does not escape. 2015-10-28 12:04:56 -04:00
Rob Rix
d7eb23d291 Free.cata rethrows errors. 2015-10-28 11:58:13 -04:00
Rob Rix
9228031f5d Free.flatMap rethrows errors. 2015-10-28 11:57:29 -04:00
Rob Rix
feabaa01a7 Free.map rethrows errors. 2015-10-28 11:56:49 -04:00
Rob Rix
abab6f3c7b Free.sum’s cost function does not escape. 2015-10-28 11:55:38 -04:00
Rob Rix
9f60616f8b Free.reduce’s combining function does not escape. 2015-10-28 11:55:06 -04:00
Rob Rix
2252f8dbe6 Free.analysis rethrows errors. 2015-10-28 11:54:40 -04:00
Rob Rix
11a2d2700a Free.cata’s argument does not escape. 2015-10-28 11:53:47 -04:00
Rob Rix
d4aaf2eb55 Syntax.map rethrows errors. 2015-10-28 11:51:43 -04:00
Rob Rix
602522dd21 A few MB less whitespace. 2015-10-27 19:31:33 -04:00
Rob Rix
3bb61d1cc1 Ignore all JSON files in the UI folder. 2015-10-27 18:59:03 -04:00
Rob Rix
4f1c52ac24 Use a different JSON output for doubt-difftool. 2015-10-27 18:58:35 -04:00
Rob Rix
c129fbcdcd Load the JSON from the queried path or diff.json. 2015-10-27 18:57:08 -04:00
Rob Rix
74b2099a02 Add a query with the path to the JSON. 2015-10-27 18:56:53 -04:00
Rob Rix
8fbc71270e Open the URL of the UI. 2015-10-27 18:53:48 -04:00
Rob Rix
bf5b5616d5 Pass the UI page to the difftool. 2015-10-27 18:53:40 -04:00
Rob Rix
e64f01bf03 Load the fixtures and write out the diff to a given path. 2015-10-27 18:46:16 -04:00
Rob Rix
19eb676e8e Add before/after fixtures. 2015-10-27 18:45:26 -04:00
Rob Rix
c3c391f2cf Write the output to the third path. 2015-10-27 18:39:11 -04:00
Rob Rix
d120a5dac5 Serialize the diff to JSON. 2015-10-27 18:38:31 -04:00
Rob Rix
33de066844 Diff two terms. 2015-10-27 18:38:25 -04:00
Rob Rix
abfe582247 Use the Term typealias. 2015-10-27 18:37:59 -04:00
Rob Rix
1df957877e Add a typealias for Terms. 2015-10-27 18:37:34 -04:00
Rob Rix
db01456d8d Remove the POSIX file reading stuff. 2015-10-27 18:30:02 -04:00
Rob Rix
dfbbabd898 Load files into strings. 2015-10-27 18:29:44 -04:00
Rob Rix
9af1cb41a8 Add a readFile function. 2015-10-27 18:29:27 -04:00
Rob Rix
0eb13e39c0 Extract a function to parse a term. 2015-10-27 18:26:39 -04:00
Rob Rix
c14d82d737 Check that we have a valid file in the TSInput constructor. 2015-10-27 18:23:26 -04:00
Rob Rix
8615eec2c6 Only collect the named children. 2015-10-27 18:20:21 -04:00
Rob Rix
06185b9b4f Merge branch 'master' into parse-with-tree-sitter
Conflicts:
	prototype/Doubt.xcodeproj/project.pbxproj
2015-10-27 18:15:53 -04:00
Rob Rix
97a7a105d2 Map to source ranges. 2015-10-27 18:13:49 -04:00
Rob Rix
76a67a7d8e Reformat. 2015-10-27 18:10:17 -04:00
Rob Rix
3f61255915 Capture node names, not strings. 2015-10-27 18:09:30 -04:00
Rob Rix
52a63856a8 Produce indexed nodes. 2015-10-27 18:09:23 -04:00
Rob Rix
1374cf8052 Phrase this as a guard. 2015-10-27 18:07:23 -04:00
Rob Rix
ac2a12a03f Construct a leaf term. 2015-10-27 18:07:00 -04:00
Rob Rix
5883a4bc8a Remove copy bundle resources phases. 2015-10-27 18:06:46 -04:00
Rob Rix
3cdcf08707 Share the difftool scheme. 2015-10-27 17:52:56 -04:00
Rob Rix
8f51aa55a6 Remove another temporary. 2015-10-27 16:28:04 -04:00
Rob Rix
0902bf0508 Remove an obsolete typealias. 2015-10-27 16:26:34 -04:00
Rob Rix
fc4098129f Inline a definition. 2015-10-27 16:26:24 -04:00
Rob Rix
2ef9eaa798 Remove an obsolete comment. 2015-10-27 16:25:25 -04:00
Rob Rix
db6bfbb85c Drop a couple of bindings. 2015-10-27 16:22:12 -04:00
Rob Rix
3b21c087a0 Remove a couple of redundant typealiases. 2015-10-27 16:18:54 -04:00
Rob Rix
3b3ee835ba Remove an unnecessary type annotation. 2015-10-27 16:18:48 -04:00
Rob Rix
a51eb87d92 🔥 String : CollectionType. 2015-10-27 16:15:42 -04:00
Rob Rix
3c7eae25b5 🔥 String.lift. 2015-10-27 16:15:28 -04:00
Rob Rix
82284e422a Always parse over String.CharacterView. 2015-10-27 16:15:11 -04:00
Rob Rix
25467794f9 More leaning on satisfy parsers. 2015-10-27 16:12:23 -04:00
Rob Rix
8a86a0a741 Lean on oneOf. 2015-10-27 16:12:14 -04:00
Rob Rix
3c203e8f43 Extract the key/term parser. 2015-10-27 16:11:45 -04:00
Rob Rix
c366e379a0 Inline charP. 2015-10-27 16:11:38 -04:00
Rob Rix
72abc9f9e2 Wipe out some indentation. 2015-10-27 16:11:31 -04:00
Rob Rix
176300b141 No need to import Either. 2015-10-27 16:11:26 -04:00
joshvera
0718e49343 Capture the quoted range in members' keys 2015-10-27 13:28:35 -04:00
joshvera
96bcc25b23 Calculate the key range from the previous range 2015-10-27 13:15:56 -04:00
joshvera
81f4112aca Merge branch 'master' into fix-dictionary-ranges 2015-10-27 12:58:24 -04:00
Rob Rix
9fd162fb1b Spacing. 2015-10-27 11:53:44 -04:00
Rob Rix
533f8753b9 Attempt to print the string. 2015-10-27 11:45:54 -04:00
Rob Rix
d29c6b5cdd Deal with EOF. 2015-10-27 11:45:42 -04:00
Rob Rix
ae111582d9 Pass in a capacity. 2015-10-27 11:40:03 -04:00
Rob Rix
687f9aab4a Die if we don’t get an extant file. 2015-10-27 11:39:51 -04:00
Rob Rix
c23f62d9cf Try to use the correct return value when seeking. 2015-10-27 11:33:18 -04:00
Rob Rix
f2b52a0620 Read data with getline. 2015-10-27 11:27:17 -04:00
joshvera
007a984c02 fix test 2015-10-27 11:23:12 -04:00
joshvera
57f15afc08 Change dict to be a .Keyed(.Keyed) node 2015-10-27 11:18:52 -04:00
Rob Rix
ef121e4bb1 We want the first passed argument, not the process name. 2015-10-27 11:18:05 -04:00
Rob Rix
5db484e815 Merge branch 'extract-js-from-html' into parse-with-tree-sitter 2015-10-27 11:16:43 -04:00
Rob Rix
db1a28a8ce We don’t need to build the to-C compiler. 2015-10-27 11:15:09 -04:00
Rob Rix
c107d9c0e2 DOM stuff is in its own file. 2015-10-27 11:12:27 -04:00
Rob Rix
f0ccfe0799 Diff is in its own file. 2015-10-27 11:11:45 -04:00
Rob Rix
9b22c3cbda Syntax is in its own file. 2015-10-27 11:10:38 -04:00
Rob Rix
2ef643cb40 Dictionary is in its own file. 2015-10-27 11:09:48 -04:00
Rob Rix
e0fda81376 Patch is in its own file. 2015-10-27 11:09:16 -04:00
Rob Rix
3270ec91c1 Term is in its own file. 2015-10-27 11:08:28 -04:00
Rob Rix
97da51dd2d Spacing. 2015-10-27 11:04:39 -04:00
Rob Rix
27d9aa9efe Attempt to parse the passed file. 2015-10-27 11:04:18 -04:00
Rob Rix
ce79e07cf8 Attempt to open and read a file with TSInput. 2015-10-27 11:04:00 -04:00
Rob Rix
a1a3a120ef Set the document’s language. 2015-10-27 10:02:22 -04:00
Rob Rix
0810a37a17 Make a document. 2015-10-27 10:02:12 -04:00
Rob Rix
8460e42d95 Bridge the JS language. 2015-10-27 10:01:57 -04:00
Rob Rix
0b2dbb05f6 Add the JS parser. 2015-10-27 10:00:52 -04:00
Rob Rix
1331cc2c02 Don’t import parser.h.
🎩 @maxbrunsfeld.
2015-10-27 09:50:26 -04:00
joshvera
3a1c4a3b0d parse whitespace around separators 2015-10-26 16:52:30 -04:00
joshvera
3d8b7c1832 Remove JSONLeaf from doubt-swift target 2015-10-26 16:45:09 -04:00
joshvera
b9be03e540 Add Fixed case to Syntax.equals 2015-10-26 16:38:07 -04:00
joshvera
3d84c3be73 Improve escape character parsing 2015-10-26 16:37:50 -04:00
joshvera
14fac1df3c don't parse whitespace ranges along with syntax 2015-10-26 16:37:34 -04:00
joshvera
98d8d52048 sepBy 2015-10-26 16:36:22 -04:00
Rob Rix
d09a151486 Add a bridging header importing tree-sitter. 2015-10-26 16:04:22 -04:00
Rob Rix
b5a0d950b3 Search for tree-sitter’s headers. 2015-10-26 16:02:31 -04:00
Rob Rix
c5f39d0997 Add a doubt-difftool target linking runtime and compiler. 2015-10-26 16:00:52 -04:00
Rob Rix
7d27a8405b More stupid metadata that Xcode needs to bump every so often. 2015-10-26 16:00:33 -04:00
Rob Rix
caae1694e3 Add a target for the tree-sitter compiler. 2015-10-26 15:52:21 -04:00
Rob Rix
3baa3e4e61 Build with the empty string. 2015-10-26 15:49:44 -04:00
Rob Rix
0e7639f0d6 Build and clean. 2015-10-26 15:45:51 -04:00
Rob Rix
64f7e9d30a Correct the directory. 2015-10-26 15:42:06 -04:00
Rob Rix
83337a55cc Build using the tree-sitter script. 2015-10-26 15:40:56 -04:00
Rob Rix
0c8ae2a286 Pass the action to the external build tool. 2015-10-26 15:40:50 -04:00
Rob Rix
39e372819b Add a script to build tree-sitter. 2015-10-26 15:40:22 -04:00
Rob Rix
13f91b80a3 Add a target for tree-sitter’s runtime library. 2015-10-26 15:36:07 -04:00
Rob Rix
98d4e1dd8f Okay, Xcode whatever you say. 2015-10-26 15:34:41 -04:00
joshvera
e59946aa0a Return Members as Fixed 2015-10-26 15:06:45 -04:00
joshvera
92539dec54 Make JSONLeaf and JSONParser public 2015-10-26 15:06:33 -04:00
joshvera
3802854f4e Add failing test 2015-10-26 15:05:58 -04:00
Rob Rix
7b6f185884 Add tree-sitter as a submodule. 2015-10-26 15:03:47 -04:00
joshvera
d40ec59f61 WIP .Fixed dictionaries 2015-10-26 13:31:25 -04:00
joshvera
29250af579 stub JSONParserTests 2015-10-26 13:31:09 -04:00
Rob Rix
ec06db7c08 Display Fixed nodes. 2015-10-26 09:35:54 -04:00
Rob Rix
53cea24ddc Map Fixed nodes. 2015-10-26 09:35:46 -04:00
Rob Rix
9bef60f2dd Construct Fixed nodes. 2015-10-26 09:35:42 -04:00
Rob Rix
9041ebafa1 Merge branch 'master' into diff-ui-shows-original-sources-for-unchanged-ranges-as-well
Conflicts:
	prototype/Doubt/Syntax.swift
2015-10-26 09:31:44 -04:00
Rob Rix
c0f9120d1b Classify replacements. 2015-10-23 21:29:21 -04:00
Rob Rix
72b97d1b3a Replacements are yellow. 2015-10-23 21:29:02 -04:00
Rob Rix
6a76b1d97e Assign classes to insertions. 2015-10-23 21:27:11 -04:00
Rob Rix
ee1d00a74c Assign classes to deletions. 2015-10-23 21:25:55 -04:00
Rob Rix
dc4fd6f659 Columns have no background colour. 2015-10-23 21:25:50 -04:00
Rob Rix
15813f38ef Allow the things to be side by side. 2015-10-23 21:22:58 -04:00
Rob Rix
4775d8e925 Apparently we pass this parameter, so let’s use it. 2015-10-23 21:22:28 -04:00
Rob Rix
28d7325647 Skip empty things. 2015-10-23 21:19:43 -04:00
Rob Rix
c01624abe9 Map ranges and stuff correctly. 2015-10-23 21:19:37 -04:00
Rob Rix
865dbe2eed Mapping into null is a bad idea. 2015-10-23 21:19:25 -04:00
Rob Rix
770e826340 Use classes to signal diffs. 2015-10-23 21:19:19 -04:00
Rob Rix
5939f3a865 Map the before and after terms separately I guess. 2015-10-23 21:05:51 -04:00
Rob Rix
fc60c75b14 Assign the range of patches. 2015-10-23 21:05:30 -04:00
Rob Rix
b7ac783e19 Get ranges for children. 2015-10-23 21:05:20 -04:00
Rob Rix
b3dfee8fc0 Terminate. 2015-10-23 20:51:31 -04:00
Rob Rix
8b1ae5f5b5 Separate Term decoding and construction. 2015-10-23 20:37:58 -04:00
Rob Rix
95cc7e7768 Diff catamorphisms. 2015-10-23 20:27:12 -04:00
Rob Rix
e152b0084c Use a term-to-DOM wrapper function. 2015-10-23 20:23:53 -04:00
Rob Rix
38ec0850c2 Default recur parameter. 2015-10-23 20:23:35 -04:00
Rob Rix
c51d66fe8d Correct how the diff is unpacked. 2015-10-23 19:25:21 -04:00
Rob Rix
fe2915a427 Try to map terms into DOM. 2015-10-23 19:24:13 -04:00
Rob Rix
7bff777b07 Attempt to correct Diff/DOM mapping. 2015-10-23 19:23:58 -04:00