1
1
mirror of https://github.com/github/semantic.git synced 2024-12-02 11:23:05 +03:00
Commit Graph

372 Commits

Author SHA1 Message Date
Ayman Nadeem
b266573ba4 clean up learning comments 2020-01-07 13:51:18 -05:00
Ayman Nadeem
759079f5da avoid cyclic imports 2020-01-07 13:44:10 -05:00
Ayman Nadeem
7ff1b2e6fa Fix -Wunrecognised-pragmas warning but adding -Wno-unused-top-binds warning to use in Main 2020-01-07 13:40:08 -05:00
Ayman Nadeem
e565b8c914 Deprecated: "Use Data.ByteString.Lazy.Char8.putStrLn instead 2020-01-07 13:38:27 -05:00
Ayman Nadeem
22ad567d34 The import of ‘encode’ from module ‘Data.Aeson’ is redundant 2020-01-07 13:22:08 -05:00
Ayman Nadeem
93b96462f2 Merge branch 'master' into json-output 2019-12-19 13:34:13 -05:00
Ayman Nadeem
439454c946 need aeson-pretty for encodePretty 2019-12-19 13:33:49 -05:00
Ayman Nadeem
e0b9e40c33 use encodePretty for pretty json output in console 2019-12-19 13:31:18 -05:00
Ayman Nadeem
af615d630d lazy bytestrings r 4 lazy girls 2019-12-19 13:30:56 -05:00
Ayman Nadeem
450017447e improve temp docs for GValue 2019-12-19 13:30:10 -05:00
Ayman Nadeem
ea364ff36e need bytestring 2019-12-19 10:16:47 -05:00
Ayman Nadeem
a8c0b9b21e add reminder to do this for range/span annotations properly 2019-12-19 10:11:55 -05:00
Ayman Nadeem
20eb10cf3c call toJSON if there is an instance, or marshal, print results 2019-12-19 10:11:36 -05:00
Ayman Nadeem
31ed149850 need Marshal 2019-12-19 10:08:18 -05:00
Ayman Nadeem
a3cc20811c import Aeson and alphabetize 2019-12-19 10:08:10 -05:00
Ayman Nadeem
c76c52757b aeson version in semantic-ast should match semantic 2019-12-19 10:00:03 -05:00
Ayman Nadeem
936ab9493a call marshal on Expr sum type 2019-12-19 09:59:29 -05:00
Ayman Nadeem
07560d24a1 let's use marshal on these example datatypes 2019-12-19 09:59:13 -05:00
Ayman Nadeem
f211f9ef98 copy Examples.hs from tree-sitter 2019-12-19 09:58:58 -05:00
Ayman Nadeem
be68edee65 we need undecidable instances 2019-12-19 09:58:06 -05:00
Ayman Nadeem
e82377960a import NonEmpty to make generic value instance work 2019-12-19 09:57:57 -05:00
Ayman Nadeem
4f627026be we can use fmap instead of having to use NonEmpty.map 2019-12-19 09:53:13 -05:00
Ayman Nadeem
1db98123c3 NonEmpty is also a type constructor represented by composition 2019-12-19 09:52:36 -05:00
Ayman Nadeem
74b14622e5 use generic composition to represent another type constructor, list 2019-12-19 09:51:49 -05:00
Ayman Nadeem
a919ee35cb need composition for Maybe, since Maybe is a type constructor that needs to take another type 2019-12-19 09:50:56 -05:00
Ayman Nadeem
c89a80ea50 value for text 2019-12-19 09:50:08 -05:00
Ayman Nadeem
d5d7ce9dfc explain GValue and gvalue 2019-12-19 09:49:50 -05:00
Ayman Nadeem
635c73670c s p a c e 2019-12-19 09:49:09 -05:00
Ayman Nadeem
11d3905242 describe how to extract value out of datum using GValue introduced below 2019-12-19 09:49:04 -05:00
Ayman Nadeem
e8ee760e64 move inductive case below base case 2019-12-18 17:38:35 -05:00
Ayman Nadeem
470092b60d WIP comment describing why we need GValue and assoc method 2019-12-18 17:26:34 -05:00
Ayman Nadeem
eede2725b7 proxy/typelits stuff no longer needed 2019-12-18 17:26:07 -05:00
Ayman Nadeem
1f2b1c3dd3 this is the base case for products 2019-12-18 17:25:34 -05:00
Ayman Nadeem
34de9472a7 move sum case below product and friends 2019-12-18 15:59:23 -05:00
Ayman Nadeem
d2319b0dcd we need sums! 2019-12-18 15:49:06 -05:00
Ayman Nadeem
5bb2fc45f5 we can straight up use the type synonym C1 with a single param instead of promoting MetaCons constructor 2019-12-18 15:48:55 -05:00
Ayman Nadeem
4950b2ff16 move comment explaining unM1 usage to relevant line 2019-12-18 15:46:36 -05:00
Ayman Nadeem
e0fa2fe5a5 no need to provide an instance for MarshalJSON anymore 2019-12-18 15:46:13 -05:00
Ayman Nadeem
83d4007174 Let's use Examples instead of Bar 2019-12-18 15:45:58 -05:00
Ayman Nadeem
0635151394 comment to self providing analogy for example Bar datatype 2019-12-18 15:45:38 -05:00
Ayman Nadeem
fa2d3402ef create an instance for the type constructors we wish to have MarshalJSON instances for 2019-12-18 15:45:16 -05:00
Ayman Nadeem
2b4b7532e7 explain to self why we additionally constrain default marshal definition 2019-12-18 15:44:37 -05:00
Ayman Nadeem
2451a005ca reason through generic instances needed to serialize example (Bar datatype) 2019-12-18 15:43:59 -05:00
Ayman Nadeem
5f08bc4c94 no longer need these 2019-12-18 14:03:53 -05:00
Ayman Nadeem
fe16f056f1 export the whole class because we might need other things 2019-12-18 14:03:14 -05:00
Timothy Clem
446da6b2fb Use the required newer tree-sitter packages 2019-12-18 10:26:32 -08:00
Timothy Clem
1393d691f7 ghc 8.8 fixes 2019-12-18 10:15:43 -08:00
Ayman Nadeem
480a122a1c Merge branch 'master' into json-output 2019-12-17 13:29:37 -05:00
Patrick Thomson
266a720fa9 Use PVP operator. 2019-12-16 12:20:05 -05:00
Ayman Nadeem
11b0d5d6aa add export list 2019-12-14 08:49:29 -05:00
Ayman Nadeem
71083b7e59 Data.Proxy and GHC.TypeLits are redundant for now 2019-12-14 08:46:22 -05:00
Ayman Nadeem
42b4e3fd5e add text to build-depends and format 2019-12-14 08:44:09 -05:00
Ayman Nadeem
9d3bcdaa09 fix typo 2019-12-14 08:37:55 -05:00
Ayman Nadeem
240e923b32 🔥 2019-12-14 08:37:38 -05:00
Ayman Nadeem
48e5156704 module name change to reflect where it is in Semantic 2019-12-14 08:37:05 -05:00
Ayman Nadeem
dcb6e8e0dd this is no longer in tree-sitter 2019-12-14 08:36:36 -05:00
Patrick Thomson
6bebd84deb Officially require GHC 8.8. 2019-12-13 15:48:49 -05:00
Patrick Thomson
dc69714053 Merge remote-tracking branch 'origin/master' into glorious-ghc-upgrade-8.8 2019-12-13 11:23:36 -05:00
Patrick Thomson
af1d62a75b Depend on newer tree-sitter. 2019-12-11 15:04:18 -05:00
Patrick Thomson
810d28f615 Merge remote-tracking branch 'origin/master' into glorious-ghc-upgrade-8.8 2019-12-11 12:31:30 -05:00
Ayman Nadeem
4fec0bed53 add TreeSitter.Marshal.JSON to exposed modules 2019-12-10 19:43:49 -05:00
Ayman Nadeem
a665b5066e Create JSON.hs 2019-12-10 19:43:22 -05:00
Ayman Nadeem
a8fe0e8be3 Merge branch 'master' into json-output 2019-12-10 18:36:16 -05:00
Timothy Clem
ec19540425
++tree-sitter 0.7
Also bumps parsers that changed
2019-12-10 16:34:26 -05:00
Rob Rix
a461c72ae4
Bump a few tree-sitter-* versions. 2019-12-10 15:10:25 -05:00
Timothy Clem
5926b47438 ++tree-sitter 0.7
Also bumps parsers that changed
2019-12-10 11:04:02 -08:00
Patrick Thomson
68ab3cbb97 semantic:exe now compiles 2019-12-10 13:32:56 -05:00
Ayman Nadeem
40dce32765 Merge branch 'master' into json-output 2019-12-10 12:13:16 -05:00
Timothy Clem
285ba19b2b Bump to latest tree-sitters 2019-12-09 09:52:42 -08:00
Ayman Nadeem
09b49637bf get rid of redundant imports 2019-11-19 15:39:45 -05:00
Ayman Nadeem
0bc12df5a3 stop warning on unused top binds 2019-11-19 15:39:37 -05:00
Ayman Nadeem
94432be85f add warnings to semantic-ast.cabal 2019-11-19 15:38:55 -05:00
Ayman Nadeem
706cf454f3 serialize to json and print (barring instances) 2019-11-19 10:09:32 -05:00
Ayman Nadeem
f2dd247042 import Data.Aeson 2019-11-19 10:08:56 -05:00
Ayman Nadeem
a98f2002ef add Json constructor 2019-11-19 10:08:45 -05:00
Ayman Nadeem
4e312180c7 turn on warnings 2019-11-19 10:08:32 -05:00
Ayman Nadeem
2336bb4475 include ghc-options to turn on all warnings 2019-11-19 10:08:22 -05:00
Ayman Nadeem
479eb3e716 add aeson to executable 2019-11-19 10:02:44 -05:00
Ayman Nadeem
1469aed341 add aeson to library 2019-11-19 10:02:36 -05:00
Ayman Nadeem
6627603e42 remove misc comments 2019-11-18 13:52:15 -05:00
Ayman Nadeem
200fa85740
Merge pull request #351 from github/semantic-ast-errors
Semantic AST polish
2019-10-24 12:21:39 -04:00
Ayman Nadeem
6603ce73fc change color to noColor 2019-10-24 11:55:47 -04:00
Ayman Nadeem
b711f9ed48 tackle JSON output in separate PR 2019-10-24 11:51:20 -04:00
Ayman Nadeem
052ac05dc5 COMPOSITION WITH FISHIES 2019-10-24 11:51:09 -04:00
Ayman Nadeem
e2127cacf4 eta reduce 2019-10-24 11:46:05 -04:00
Ayman Nadeem
adfd3bda0d abstract over Format with display 2019-10-24 11:45:43 -04:00
Ayman Nadeem
b5fd84e1bb reformat Format sum type 2019-10-24 11:31:29 -04:00
Ayman Nadeem
8944b279dc refactor format and ast do block 2019-10-24 11:28:53 -04:00
Ayman Nadeem
4475629775 order where clause operations chronologically 2019-10-23 12:01:55 -04:00
Ayman Nadeem
ed80f90faf visual separation ftw 2019-10-23 11:58:51 -04:00
Ayman Nadeem
a2cd91579f need traverse_ from Data.Foldable 2019-10-22 15:29:23 -04:00
Ayman Nadeem
79d971c432 express do block as composition 2019-10-22 15:28:27 -04:00
Ayman Nadeem
090ebfeffc extract lambda into a named function in where clause 2019-10-22 13:53:09 -04:00
Ayman Nadeem
a9f6068a7b color can only have if pretty 2019-10-22 13:41:13 -04:00
Ayman Nadeem
f876c0b5e0 redundant do blocks 2019-10-22 13:40:48 -04:00
Ayman Nadeem
0bee5c5d25 clean up usage docs 2019-10-22 13:40:35 -04:00
Ayman Nadeem
9b17db51b1 add qualified import 2019-10-22 13:40:27 -04:00
Ayman Nadeem
4c0de190ec use qualified imports to clean stuff up 2019-10-22 13:09:13 -04:00
Ayman Nadeem
45abf90917 indent case statements because lexical scoping 2019-10-22 12:33:19 -04:00
Ayman Nadeem
3e754c35b1 use for_ 2019-10-22 12:33:05 -04:00
Ayman Nadeem
1761656d27 jk use for_ so we don't ignore results 2019-10-22 12:28:23 -04:00
Ayman Nadeem
c67dc33184 let's support multiple formats 2019-10-22 10:50:58 -04:00
Ayman Nadeem
cf30f7672f tracked this by accident 2019-10-22 10:50:48 -04:00
Ayman Nadeem
659dae0bc8 use for because for_ discards the results 2019-10-21 13:56:03 -04:00
Rob Rix
d4fe4cedff
Add a tested-with field to semantic-ast. 2019-10-21 13:30:57 -04:00
Ayman Nadeem
3a778342f8 no longer provide --flag 2019-10-21 12:57:31 -04:00
Ayman Nadeem
90be70f045 specify usage pattern 2019-10-21 12:57:16 -04:00
Ayman Nadeem
86aa2be662 need for_ 2019-10-20 11:51:12 -04:00
Ayman Nadeem
e67ee6ee7b take multiple filepaths 2019-10-20 11:51:02 -04:00
Ayman Nadeem
ca30fe6c15 eliminate source into [ByteString] 2019-10-20 11:50:43 -04:00
Ayman Nadeem
19a0594fd1 bytestrings are now a list 2019-10-20 11:50:15 -04:00
Ayman Nadeem
83e0278119 discard thinking comments 2019-10-18 17:21:04 -04:00
Ayman Nadeem
7dcec7538b if option is specified, print no-color 2019-10-18 17:20:31 -04:00
Ayman Nadeem
bd7a16a52f add color to generateAST 2019-10-18 17:20:06 -04:00
Ayman Nadeem
d5be5ba582 make default color and option no-color 2019-10-18 17:19:52 -04:00
Ayman Nadeem
718dd27e4a need to use pPrintNoColor for no color option 2019-10-18 17:19:11 -04:00
Ayman Nadeem
51ce6dd303 create a boolean option to print with color 2019-10-18 13:43:54 -04:00
Ayman Nadeem
67760145e8 case over Format 2019-10-18 11:23:37 -04:00
Ayman Nadeem
1537f43fde add Pretty constructor to Format 2019-10-18 11:23:23 -04:00
Ayman Nadeem
fb5132d43f pull pretty-simple into semantic-ast 2019-10-18 11:23:01 -04:00
Ayman Nadeem
b0fb726d4d case over format 2019-10-18 11:14:56 -04:00
Ayman Nadeem
e0c60bf166 utf8-string is irrelevant now 2019-10-17 17:31:39 -04:00
Ayman Nadeem
a4ddeb45a4 go back to pack 2019-10-17 17:31:04 -04:00
Ayman Nadeem
4caeefe849 depend on utf8-string 2019-10-17 13:41:38 -04:00
Ayman Nadeem
322feb2d70 convert UTF8 ByteString without going through Text 2019-10-17 13:41:30 -04:00
Ayman Nadeem
6ab570c976 remove ApplicativeDo 2019-10-16 18:18:11 -04:00
Ayman Nadeem
0e32c5ec27 remove Read constraint 2019-10-16 15:15:55 -04:00
Ayman Nadeem
a45b8683ec correctly refactor 2019-10-16 15:15:03 -04:00
Ayman Nadeem
9b1345d0b9 factor bytestring out into where clause 2019-10-16 14:48:49 -04:00
Ayman Nadeem
200d341fe4 fix indentation 2019-10-16 14:17:07 -04:00
Ayman Nadeem
39f0b7b951 constrain bytestring 2019-10-16 14:07:12 -04:00
Ayman Nadeem
44116ae2f5 constrain tree-sitter-python 2019-10-16 14:03:13 -04:00
Ayman Nadeem
f4880a4bf9 fill in copyright field 2019-10-16 14:02:04 -04:00
Ayman Nadeem
621657b953 Update LICENSE 2019-10-16 13:56:40 -04:00
Ayman Nadeem
10fc563951 clean up readme 2019-10-16 11:53:38 -04:00
Ayman Nadeem
0250fe4950 camel case consistently 2019-10-16 11:53:32 -04:00
Ayman Nadeem
e047d3a6db change Ayman Nadeem to Semantic Authors 2019-10-16 10:57:21 -04:00
Ayman Nadeem
8129177e91 Delete test.py 2019-10-15 17:58:39 -04:00
Ayman Nadeem
c495483b22 remove TODOs - did these! 2019-10-15 17:57:18 -04:00
Ayman Nadeem
5bbf633909 bump tree-sitter to correct version 2019-10-15 17:19:21 -04:00
Ayman Nadeem
22a6a4f708 remove tree-sitter version altogether 2019-10-15 15:35:07 -04:00
Ayman Nadeem
c9219f71c3 Either makes this easier 2019-10-15 13:27:54 -04:00
Ayman Nadeem
be5f00ee50 express choice between either string or filepath options 2019-10-15 13:27:20 -04:00
Ayman Nadeem
d7ce6ef1d3 avoid the possibility of two Nothings 2019-10-15 13:23:00 -04:00
Ayman Nadeem
927a987f0d todos 2019-10-11 13:15:21 -04:00
Ayman Nadeem
e97daf47d5 I want to specify format first 2019-10-11 13:10:01 -04:00
Ayman Nadeem
7d6740224b move format in SemanticAST 2019-10-11 13:09:37 -04:00
Ayman Nadeem
0b6e3d5b3a parseAST handles this 2019-10-11 13:05:31 -04:00
Ayman Nadeem
7e358a8c2e parseAST handles this 2019-10-11 13:05:09 -04:00
Ayman Nadeem
08cbd88e71 will need to replace this with alternation above 2019-10-11 13:04:40 -04:00
Ayman Nadeem
db9e7da48f this has been subsumed by SemanticAST 2019-10-11 12:50:37 -04:00
Ayman Nadeem
cf609451ae lord forgive me for this nested case statement 2019-10-11 12:49:57 -04:00
Ayman Nadeem
5d4b34b39b downstream impact of changing datatype fields 2019-10-11 12:49:16 -04:00
Ayman Nadeem
9afcf11b83 this means sourceString now has to be an option 2019-10-11 12:48:53 -04:00
Ayman Nadeem
b2f2340c4c include both inputs in SemanticAST 2019-10-11 12:48:40 -04:00
Ayman Nadeem
a11decefcd remove flag for Normal/Verbose outputs 2019-10-10 15:02:21 -04:00
Ayman Nadeem
74d7802571 rename CLI to Main 2019-10-10 15:01:55 -04:00
Ayman Nadeem
c4a3217f8e add dependencies to executable part of cabal file 2019-10-10 15:00:19 -04:00
Ayman Nadeem
a8f4be8c72 Main squeeze 2019-10-10 14:59:56 -04:00
Ayman Nadeem
40565dd093 import CLI 2019-10-10 14:26:56 -04:00
Ayman Nadeem
e52b82ba5b import module with the right pack 2019-10-10 14:09:35 -04:00
Ayman Nadeem
e575b07fc4 typo 2019-10-10 14:09:24 -04:00
Ayman Nadeem
9098f1226a actually need the first element and to convert to bytestring 2019-10-10 14:08:59 -04:00
Ayman Nadeem
a589448ea2 add Read instances 2019-10-10 14:08:41 -04:00
Ayman Nadeem
5a707829d2 remove this library it's wrong 2019-10-10 13:17:27 -04:00
Ayman Nadeem
5b7b699415 remove unix 2019-10-10 13:14:59 -04:00
Ayman Nadeem
d9bfa588ce maybe I need bytestring not IO? 2019-10-10 13:14:24 -04:00
Ayman Nadeem
267ae4d46e reformat 2019-10-10 13:14:15 -04:00
Ayman Nadeem
b83e28b8de reformat Format 2019-10-10 13:13:51 -04:00
Ayman Nadeem
fc97a71b1e bye felicia 2019-10-10 13:13:35 -04:00
Ayman Nadeem
10eb0fe17f fix comment 2019-10-10 13:13:26 -04:00
Ayman Nadeem
29725e38d7 s p a c e 2019-10-03 18:56:58 -04:00
Ayman Nadeem
4a0faaad8a format is no longer a String 2019-10-03 18:56:34 -04:00
Ayman Nadeem
54d4cb9111 derive Read instance 2019-10-03 18:56:20 -04:00
Ayman Nadeem
7c221edcb7 this is no longer a string 2019-10-03 18:56:11 -04:00
Ayman Nadeem
6bd28316b3 need a datatype for input 2019-10-03 18:22:50 -04:00
Ayman Nadeem
572f4a555e move this 2019-10-03 18:12:16 -04:00
Ayman Nadeem
eaa38b3736 maybe introduce a separate datatype for formats? 2019-10-03 18:12:04 -04:00
Ayman Nadeem
40844a6c16 generateAST is responsible for parsing the bytestring 2019-10-03 18:11:44 -04:00
Ayman Nadeem
d8757e898c factor opts out of main 2019-10-03 18:11:28 -04:00
Ayman Nadeem
29e8048785 allow user to pass in a file or stdin 2019-10-03 17:57:21 -04:00
Ayman Nadeem
7570af708e define a way to pass in a file 2019-10-03 17:56:54 -04:00
Ayman Nadeem
ac5e0af406 define a way to pass in something from stdin 2019-10-03 17:56:38 -04:00
Ayman Nadeem
17f696fd49 change main to call generateAST 2019-10-02 15:25:11 -04:00
Ayman Nadeem
b4a0968406 move parseByteString into new generateAST function 2019-10-02 15:25:03 -04:00
Ayman Nadeem
ebdf8032e4 create a function to specify command line help text 2019-10-02 15:24:33 -04:00
Ayman Nadeem
edc214ce05 create semanticAST datatype 2019-10-02 15:24:17 -04:00
Ayman Nadeem
0abb65e4f4 let's try to use opt-parse applicative now 2019-10-02 14:34:58 -04:00
Ayman Nadeem
3e17a9b50d back to head 2019-10-02 14:34:41 -04:00
Ayman Nadeem
c051a786be use index 0 instead of head to get first element of arg list 2019-10-02 06:36:22 -04:00
Ayman Nadeem
86dc3f811b print output of parseByteString 2019-10-01 18:38:36 -04:00
Ayman Nadeem
1a0cdc2fb8 read entire file specified into a bytestring 2019-10-01 18:38:22 -04:00
Ayman Nadeem
e0a1a8091c take the first element so it's String not [String] 2019-10-01 18:37:23 -04:00
Ayman Nadeem
4d6ef1cf5c this is wrong 2019-10-01 18:37:11 -04:00
Ayman Nadeem
02ec2662ab get args 2019-10-01 18:36:44 -04:00
Ayman Nadeem
238b744668 I want IO () 2019-10-01 18:36:35 -04:00
Ayman Nadeem
27037ced1c FilePath is a type synonym for String 2019-10-01 18:36:00 -04:00
Ayman Nadeem
06fc90b1c8 need readFile 2019-10-01 18:35:50 -04:00
Ayman Nadeem
38c2c28f90 🚮extra space 2019-10-01 17:05:38 -04:00
Ayman Nadeem
d963e7ee79 change this to reflect parseByteString's type signature for now 2019-10-01 17:04:18 -04:00