1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 20:31:55 +03:00
Commit Graph

326 Commits

Author SHA1 Message Date
Rob Rix
d688109c81
🔥 DerivingStrategies. 2019-10-08 16:00:04 -04:00
Rob Rix
0206995e30
🔥 DeriveAnyClass. 2019-10-08 15:59:12 -04:00
Rob Rix
bfc998cdc0
🔥 a spurious MultiParamTypeClasses. 2019-10-08 15:58:26 -04:00
Rob Rix
29df1afb7b
Project using Prj. 2019-10-08 15:46:49 -04:00
Rob Rix
1aa33a2123
We don’t need DerivingVia now. 2019-10-08 15:46:04 -04:00
Rob Rix
a29670de49
🔥 GCompileSum. 2019-10-08 15:45:48 -04:00
Rob Rix
cb7ddc22a8
🔥 CompileSum. 2019-10-08 15:45:29 -04:00
Rob Rix
80b43c4009
Specialize the instance for :+:. 2019-10-08 15:45:08 -04:00
Rob Rix
1506aed1a7
Use GND for the PrimaryExpression instance. 2019-10-08 15:44:19 -04:00
Rob Rix
51e74b9b1e
Update semantic-python. 2019-10-08 15:01:34 -04:00
Rob Rix
a67b67db6f
Merge branch 'master' into precise-json 2019-10-08 14:36:36 -04:00
Patrick Thomson
665429fa92 We have these JSON instances already. 2019-10-07 20:16:54 -04:00
Patrick Thomson
8d9c7b9277
Unnecessary parens. 2019-10-07 17:46:07 -04:00
Patrick Thomson
a001a02b5c
Formatting. 2019-10-07 17:46:06 -04:00
Patrick Thomson
7eaf7423e0
Fix the generators and kill some unused imports. 2019-10-07 17:45:53 -04:00
Patrick Thomson
ae46a7b105
Make Data.Name.Name a newtype rather than a synonym.
The fact that `Name` was a simple alias for `Text` was creeping into
the error messages I'm seeing in `semantic-python`, which was a bit of
a buzzkill. This remedies that.
2019-10-07 17:45:53 -04:00
Rob Rix
dcc228d1fa
Update for the new shape of Name. 2019-10-07 17:36:35 -04:00
Rob Rix
c5fe348ed3
Simplify locFromTSSpan. 2019-10-07 17:34:15 -04:00
Rob Rix
d530c57141
Re-export tree_sitter_python from Language.Python. 2019-10-07 14:21:57 -04:00
Rob Rix
ae5591437f
Bump the constraints on tree-sitter{,-java,-python}. 2019-10-07 14:07:44 -04:00
Patrick Thomson
d380aabe89 spruce up the unit test 2019-10-07 12:17:52 -04:00
Patrick Thomson
5bd992bf8e Remove specious argument compilation instances. 2019-10-07 12:06:19 -04:00
Rob Rix
d07cc5508a
Move Language.Python & Language.Python.Tags into semantic-python. 2019-10-03 01:13:41 -04:00
Patrick Thomson
e62ec09c62 [semantic-python] Compile function calls.
Though this does not work with keyword arguments, list/dictionary
splats, or generator expressions, it suffices for the simple case.
2019-10-02 15:56:25 -04:00
Patrick Thomson
90f5c78b0d
Merge branch 'master' into json-and-core-are-breaking-up 2019-10-02 13:50:12 -04:00
Patrick Thomson
b33b98e75c Remove FileCheck conversion of Core to JSON.
Converting Core into JSON and querying it turned out to be an exercise
in frustration, since Core does not map naturally onto JSON. Indeed,
we have given up using it entirely thanks to the `CHECK-TREE`
directive, which is much more natural. This means we can drop it from
the test harness and remove the orphan instances that allowed it.
2019-10-02 11:23:33 -04:00
Patrick Thomson
7d93f390a6
Merge branch 'master' into abstract-actions-over-terms 2019-10-02 11:20:31 -04:00
Patrick Thomson
87a658d45b Fix tests and squash warnings. 2019-10-02 10:59:54 -04:00
Patrick Thomson
b7829dcde9 Fix GCompileSum instances. 2019-10-02 10:18:39 -04:00
Rob Rix
eb922e7e01
🔥 a redundant binding. 2019-10-02 09:59:26 -04:00
Rob Rix
7312997f29
🔥 a redundant import. 2019-10-02 09:59:21 -04:00
Patrick Thomson
e8e67161e0 Compile now has kind (Type -> Type) -> Constraint. 2019-10-02 09:57:17 -04:00
Rob Rix
ad3a810e17
Merge branch 'master' into semantic-tags 2019-09-30 13:52:14 -04:00
Patrick Thomson
b58e10313d Use the technical term. 2019-09-30 12:39:45 -04:00
Patrick Thomson
0671bffef3 More Haddocks. 2019-09-30 12:36:53 -04:00
Patrick Thomson
b3b1c8d016 Typo in comment. 2019-09-30 12:35:38 -04:00
Patrick Thomson
696d2fc786 Make desugar tail-recur (and we don't need a Stack). 2019-09-30 12:32:28 -04:00
Patrick Thomson
f7c4658ee6 Use a Stack so we can do a right fold over the assignments. 2019-09-30 12:18:06 -04:00
Patrick Thomson
af429a5933 Consolidate fmaps. 2019-09-28 09:44:55 -04:00
Patrick Thomson
de2c762d2c Typo in comment. 2019-09-27 18:18:00 -04:00
Patrick Thomson
8e6a1395c0 w h i t e s p a c e 2019-09-27 18:16:42 -04:00
Patrick Thomson
a51151afb5 Make sure chained assignments don't lose their location info. 2019-09-27 18:11:36 -04:00
Patrick Thomson
794265d3a9 Even more comments. 2019-09-27 17:56:19 -04:00
Patrick Thomson
54bc5c7505 Move desugar into a monad. 2019-09-27 17:38:50 -04:00
Patrick Thomson
825726d37e Add a lot of comments and some clarifying patterns. 2019-09-27 17:36:08 -04:00
Patrick Thomson
b1611e13e8 Initial stab at folding over multiple assignments. 2019-09-27 17:35:51 -04:00
Rob Rix
379b9d4f75
Fix the tests. 2019-09-27 15:15:37 -04:00
Rob Rix
bd73cd0e1d
Bump to the latest tree-sitter* packages. 2019-09-27 14:02:49 -04:00
Patrick Thomson
18a1a0d8b7 Avoid 'head', which is partial. 2019-09-24 00:57:22 -04:00
Patrick Thomson
1731df8bd8 Stray import. 2019-09-23 22:16:25 -04:00
Patrick Thomson
3926742c1d Improve parsing of FileCheck-style tags.
This used to operate via some fast-and-loose (ab)use of the Trifecta
API. A simpler way to do things is to use streaming-bytestring to load
a file line by line and parse directives until we encounter program text.
2019-09-23 22:00:44 -04:00
Patrick Thomson
6dcbe96a0c Fix warnings in Language.Python.Core. 2019-09-23 19:59:23 -04:00
Patrick Thomson
1990e2379b Merge remote-tracking branch 'origin/master' into remove-regular-compile 2019-09-23 19:56:08 -04:00
Patrick Thomson
a2e1ced785 Reinsert a FIXME. 2019-09-23 19:42:17 -04:00
Patrick Thomson
e98e483c13 Define Compile interface in terms of compileCC. 2019-09-23 13:30:23 -04:00
Patrick Thomson
a556e1d9ff fix typo 2019-09-23 13:02:50 -04:00
Patrick Thomson
0d994ca28a Less-specious implementation of ExpressionList compilation. 2019-09-23 12:48:58 -04:00
Patrick Thomson
19a1fa9cfc More cleanup. 2019-09-23 12:42:08 -04:00
Patrick Thomson
e7f84566b6 Add viaCompileCC helper. 2019-09-23 12:37:21 -04:00
Patrick Thomson
46c7d45865 Cleanup. 2019-09-23 12:33:45 -04:00
Patrick Thomson
54b5d379ea Fix Compile instance for ExpressionStatement and Assignment. 2019-09-23 12:31:25 -04:00
Patrick Thomson
dccc1942aa Break toplevel assignment case because it's wrong. 2019-09-23 12:13:40 -04:00
Patrick Thomson
375c975338 Use compileCC to build a record of toplevel bindings. 2019-09-23 11:56:40 -04:00
Patrick Thomson
4174fce11c Add Bindings type and reader effect. 2019-09-23 11:06:10 -04:00
Patrick Thomson
611877ad00 An infix fmap is cleaner here. 2019-09-19 15:35:25 -04:00
Patrick Thomson
2c24ee2539 Omit otiose default signature. 2019-09-19 15:35:08 -04:00
Patrick Thomson
a89cd0dad9 Eliminate inefficient RelPath->String->Text conversion. 2019-09-19 15:31:04 -04:00
Patrick Thomson
aaa73b20f2
Merge branch 'master' into provide-path-info 2019-09-19 08:22:04 -04:00
Patrick Thomson
d9f88fc046 Add a CHECK-TREE directive and simplify esoteric jq tests.
Due to the problems outlined in #245, the tests for return statements
were complicated and not testing useful properties. This patch adds a
new `CHECK-TREE` directive which lets you embed a Core expression
as a string, which is parsed and then compared against the result of
compiling the containing module.
2019-09-18 18:07:43 -04:00
Patrick Thomson
8dc4db0e21 No more filepath dependency. 2019-09-18 15:03:16 -04:00
Patrick Thomson
b94b3448c4 Ensure filename information is yielded in locate. 2019-09-18 14:51:06 -04:00
Patrick Thomson
328d1ac251 Everyone gets to depend on text. 2019-09-18 14:50:28 -04:00
Patrick Thomson
0dc0a534c6 Start using typed paths in tests. 2019-09-18 14:41:58 -04:00
Patrick Thomson
483494ccfd Remember to call locate on False. 2019-09-18 13:52:00 -04:00
Patrick Thomson
fc98de9e4d Change wording of justification for CoreSyntax type. 2019-09-18 13:51:45 -04:00
Patrick Thomson
da5bb84b05 Remove tree-sitter dependency from semantic-core. 2019-09-18 13:49:04 -04:00
Patrick Thomson
2aea021890 Use some tree information in a unit test. 2019-09-18 13:05:10 -04:00
Patrick Thomson
99a7806c20 Fix tests. 2019-09-18 12:35:54 -04:00
Patrick Thomson
0dafd1ef7f Make syntax instances preserve their location. 2019-09-18 12:35:34 -04:00
Patrick Thomson
b460c6e452 Add 'locate'. 2019-09-18 12:35:21 -04:00
Patrick Thomson
eae9f2d7f5 Add CoreSyntax constraint kind to clear up type signatures. 2019-09-18 12:13:08 -04:00
Patrick Thomson
e89e8462ef Reinstitute and rework Compile for ReturnStatement. 2019-09-18 10:48:41 -04:00
Patrick Thomson
7437a28014 Fix kindedness errors. 2019-09-17 16:26:45 -04:00
Patrick Thomson
5d5e50c733 Merge cleanup. 2019-09-17 16:19:10 -04:00
Patrick Thomson
8b017f90c3 Forgot a pure. 2019-09-17 11:12:26 -04:00
Patrick Thomson
aabfafc2e3 Address Rob's suggestions. 2019-09-17 11:11:59 -04:00
Patrick Thomson
7d0f817409 Merge branch 'bump-to-tree-sitter-0.2.1' into sempy-early-returns 2019-09-17 10:49:12 -04:00
Patrick Thomson
05d84ea500 Update to latest round of tree-sitter packages. 2019-09-17 10:46:20 -04:00
Patrick Thomson
8b66533c3b Bump to tree-sitter-python 0.3.0.0. 2019-09-16 13:36:52 -04:00
Patrick Thomson
b3ecc9fb56 Bump to tree-sitter-0.2.1. 2019-09-11 18:24:15 -04:00
Patrick Thomson
38722321ce Wording changes. 2019-09-11 15:41:48 -04:00
Patrick Thomson
73668094c7 Use DerivingVia to squash forgotten-compileCCSum bugs. 2019-09-11 12:50:53 -04:00
Patrick Thomson
9728ef0199 Check that returns work within if-clauses. 2019-09-11 12:22:24 -04:00
Patrick Thomson
b3a2221390 Work around #195. 2019-09-11 11:48:06 -04:00
Patrick Thomson
33ea661bf6 Institute compileCC. 2019-09-11 11:45:43 -04:00
Patrick Thomson
584e8721f1 Show more and prettier information in the failure dump. 2019-09-11 11:45:21 -04:00
Patrick Thomson
1cd1068323 Add test cases for translating early returns. 2019-09-11 11:44:46 -04:00
Patrick Thomson
7f833f08f5 Bump tree-sitter versions. 2019-09-09 11:39:29 -04:00
Patrick Thomson
245e5055f3 Forgot a liftToEncoding. 2019-09-04 23:10:54 -04:00
Patrick Thomson
a9328c3671 Derive JSON instances for the Core trees. 2019-09-04 23:10:54 -04:00
Patrick Thomson
5bae778b14 Move warnings into shared haskell component. 2019-09-03 13:35:33 -04:00
Patrick Thomson
a7bbd173d0 Formatting/includes. 2019-09-03 13:34:00 -04:00
Patrick Thomson
8369298101 Remove globally-specified default-extensions. 2019-09-03 13:33:45 -04:00
Patrick Thomson
25be284ad2 fix warnings 2019-08-29 09:32:39 -04:00
Patrick Thomson
efa949d402 better naming 2019-08-29 09:30:58 -04:00
Patrick Thomson
973490b5d4 Decomplect this whole thing by lifting it into IO. 2019-08-29 09:20:13 -04:00
Patrick Thomson
31fbc386e9 Enable multiple directives. 2019-08-29 08:52:38 -04:00
Patrick Thomson
1472fc87e7 kill ugly MonadFail hack 2019-08-27 11:34:24 -04:00
Patrick Thomson
a1b7eb9d5d remove otiose boolean check 2019-08-27 11:29:12 -04:00
Patrick Thomson
1c5ac83791 Corral orphan instances. 2019-08-27 11:27:53 -04:00
Patrick Thomson
80df9c1f1d pass the scope graph explicitly 2019-08-27 10:47:45 -04:00
Patrick Thomson
3fb0cc890c Fix redundant pattern match. 2019-08-27 10:35:47 -04:00
Patrick Thomson
7ddbee0006 Remove tests for future milestones for now to keep diffs small. 2019-08-27 10:33:53 -04:00
Patrick Thomson
102ba23513 Reformat comment so it's easier to read in diffs. 2019-08-27 10:25:21 -04:00
Patrick Thomson
8a44e901c7 More comprehensive error handling for uncompilable assignments. 2019-08-27 10:24:59 -04:00
Patrick Thomson
e1556cb16b Divest from RecordWildCards. 2019-08-27 10:20:10 -04:00
Patrick Thomson
f10e89184e Naming. 2019-08-26 09:13:50 -04:00
Patrick Thomson
5413a82272 Kill stray comment. 2019-08-22 16:14:12 +02:00
Patrick Thomson
811f693051 Use Analysis.ScopeGraph instead of my bad reimplementation 2019-08-16 15:54:17 -04:00
Patrick Thomson
59c6b5ecbc Fix commented-out changes 2019-08-16 15:16:00 -04:00
Patrick Thomson
655fdbf3f3 Clean up language pragmas 2019-08-16 14:55:03 -04:00
Patrick Thomson
909139e552 fix errors 2019-08-16 14:51:14 -04:00
Patrick Thomson
2a88e4b31f bad example but it passes the tests! 2019-08-16 14:48:21 -04:00
Patrick Thomson
daa36360a6 add failing tests 2019-08-16 13:24:11 -04:00
Patrick Thomson
dde59eb626 jq-based test suite works 2019-08-16 13:20:08 -04:00
Patrick Thomson
90dd0b4d33 Trying to bring up this test harness 2019-08-16 12:34:56 -04:00
Patrick Thomson
3fb642c06d Experiment with LLVM-style directives for test assertions 2019-08-13 16:35:11 -04:00
Patrick Thomson
dc47e90c00 Minimum viable patch such that all stage-1 fixtures compile 2019-08-13 16:19:20 -04:00
Patrick Thomson
5acd975b1b trying to get test cases in shape 2019-08-13 14:01:50 -04:00
Patrick Thomson
b4e24720d4 sections 3 and 4 2019-08-13 11:48:02 -04:00
Patrick Thomson
c95befdb22 Add tests for wave 2 2019-08-12 15:01:55 -04:00
Patrick Thomson
b8ba99ff12 Move these down a directory. 2019-08-12 14:52:43 -04:00
Patrick Thomson
4229e81dd3 Rename and reorg so that these are in line with the roadmap 2019-08-12 13:17:55 -04:00
Patrick Thomson
c578f767e7 some ideas 2019-08-08 13:23:36 -04:00
Rob Rix
cf8b344efc
Handle all the unimplemented cases with a helper. 2019-06-19 10:37:11 -04:00
Rob Rix
1164c87b01
Compile function definitions.
Co-Authored-By: Patrick Thomson <patrickt@users.noreply.github.com>
2019-06-17 12:01:55 -04:00
Rob Rix
d64e12d868
Compile identifiers.
Co-Authored-By: Patrick Thomson <patrickt@users.noreply.github.com>
2019-06-17 11:18:08 -04:00
Rob Rix
31d396ee91
Merge branch 'master' into semantic-python 2019-06-17 10:54:55 -04:00
Rob Rix
f2a9ebef39
Qualify the import of TreeSitter.Python.AST. 2019-06-12 10:23:42 -04:00
Rob Rix
b1a89c0d0e
🔥 redundant parens. 2019-06-11 17:10:19 -04:00
Rob Rix
6dd5010059
🔥 the orphan instances. 2019-06-11 17:10:09 -04:00
Rob Rix
9088708c7b
Compile boolean literals. 2019-06-11 13:10:41 -04:00
Rob Rix
eb7244236f
Split out instances for PrimaryExpression. 2019-06-11 13:09:14 -04:00
Rob Rix
c15bbcb00b
Not via. 2019-06-11 13:05:48 -04:00
Rob Rix
1a6812ed06
Split out instances for Expression. 2019-06-11 13:03:17 -04:00
Rob Rix
236771702b
Derive the Either instance. 2019-06-11 13:01:05 -04:00
Rob Rix
bd9aaa541e
Really really. 2019-06-11 13:00:04 -04:00
Rob Rix
4e24a1ee9e
No, really alphabetize. 2019-06-11 12:59:27 -04:00
Rob Rix
ead494ad3f
These are incurred by IfStatement. 2019-06-11 12:57:27 -04:00
Rob Rix
c8d1de416d
Alphabetize. 2019-06-11 12:56:37 -04:00
Rob Rix
5b539e8d4d
Add a FIXME re: the orphan instances. 2019-06-11 12:55:46 -04:00
Rob Rix
3728f06267
Split out the SimpleStatement cases. 2019-06-11 12:54:25 -04:00
Rob Rix
3b7a2f17b0
DerivingVia. 2019-06-11 12:51:47 -04:00
Rob Rix
602494f605
Define generic compilation of sum types. 2019-06-11 12:43:20 -04:00
Rob Rix
c4351553cb
Compile IfStatement. 2019-06-11 12:29:09 -04:00
Rob Rix
c3184f0354
Extract the default definition. 2019-06-11 12:13:21 -04:00
Rob Rix
0a329ae55b
Stub in compilation of statements. 2019-06-11 12:12:28 -04:00
Rob Rix
135b8b11c3
Give a default definition for Compile which just fails. 2019-06-11 12:12:04 -04:00
Rob Rix
07fa5567e5
Move the Either instance up. 2019-06-11 12:09:38 -04:00
Rob Rix
f09b3614d6
Define compilation of Either. 2019-06-11 12:08:52 -04:00
Rob Rix
37cab16c95
Rephrase Compile as a typeclass. 2019-06-11 12:06:11 -04:00
Rob Rix
23e18ade2e
Note a FIXME. 2019-06-11 12:05:06 -04:00
Rob Rix
41afbd6a91
Rename compileModule to compile. 2019-06-11 12:04:12 -04:00
Rob Rix
7da6b959f1
Error messages are good, actually. 2019-06-11 12:03:48 -04:00
Rob Rix
598000c3ab
Stub in compilation to Core. 2019-06-11 11:59:29 -04:00
Rob Rix
fb5b89817c
Qualify Python stuff if we need to. 2019-06-11 11:54:39 -04:00
Rob Rix
dd0831962b
Stub in a function to compile a Python module. 2019-06-11 11:47:48 -04:00
Rob Rix
04762dcbc4
Add an export list. 2019-06-11 11:45:46 -04:00
Rob Rix
5a2a9f4532
Turn on warnings. 2019-06-11 11:44:43 -04:00
Rob Rix
d09ab401c0
Add stability fields to core & python. 2019-06-11 11:25:20 -04:00
Rob Rix
40e9999b02
Add bug-reports fields. 2019-06-11 11:23:38 -04:00
Rob Rix
6894a756b1
Stub in a Language.Python.Core module. 2019-06-11 11:22:10 -04:00
Rob Rix
5563bc19a0
Depend on tree-sitter-python. 2019-06-11 11:20:58 -04:00
Rob Rix
52fa1a1c4a
Cabal complains if this file isn’t here. 2019-06-11 11:13:26 -04:00
Rob Rix
ebc025b600
Add some dependencies. 2019-06-11 11:12:12 -04:00
Rob Rix
4a9255a76c
Stub in a semantic-python package. 2019-06-11 11:06:11 -04:00