1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00
Commit Graph

323 Commits

Author SHA1 Message Date
Rob Rix
94c448bef3 Take the range from the source. 2017-02-10 15:42:16 -05:00
Rob Rix
26efa43611 Close over the correct source. 2017-02-10 15:35:10 -05:00
Rob Rix
672ff179ed Source carries its Range. 2017-02-10 15:33:41 -05:00
Rob Rix
f723b576e1 Pass the getter in. 2017-02-10 12:59:22 -05:00
Rob Rix
ad5d659941 Cut down on crossing the FFI. 2017-02-10 12:58:15 -05:00
Rob Rix
5688c2b447 Pre-slice the source passed to toTerm. 2017-02-10 12:26:02 -05:00
Rob Rix
9bcabf21b7 Extract a function to retrieve the range for a node. 2017-02-10 12:24:10 -05:00
Rob Rix
bc2a29d84e Source is no longer parametric in the character type. 2017-02-10 11:21:24 -05:00
Rob Rix
e85eb49e0e Tidy up the imports a bit. 2017-02-10 11:02:38 -05:00
Rob Rix
060680f070 🔥 a redundant import. 2017-02-10 09:32:10 -05:00
Rob Rix
42871bcc94 Fix do notation. 2017-02-10 09:28:57 -05:00
Rob Rix
2108d7287a Use the new input string with length API. 2017-02-10 09:23:51 -05:00
Timothy Clem
d6796afd6f Pass Text to tree-sitter 2017-02-09 21:31:29 -08:00
Rob Rix
2929fb3cb4 Rename Syntax.Error to ParseError. 2017-01-25 03:09:53 -05:00
Rob Rix
296c53f187 Rename Category.Error to ParseError. 2017-01-25 03:08:06 -05:00
Rob Rix
833f2f755e Add a language-agnostic assignment of Throw. 2017-01-25 03:02:03 -05:00
Rob Rix
6207e474b6 Add a language-agnostic Yield assignment. 2017-01-25 02:58:04 -05:00
Rob Rix
9a4c92d735 Only pass the category to term assignment. 2017-01-23 16:04:31 -05:00
Rob Rix
a27edde9e4 Return Syntax from Go term assignment. 2017-01-23 16:01:42 -05:00
Rob Rix
281df3178f Handle Case language agnostically. 2017-01-23 15:12:38 -05:00
Rob Rix
e95ae2c5d9 Ruby uses Switch/Case like anyone else would. 2017-01-23 15:06:05 -05:00
Rob Rix
974020891a Assign Switch terms language-agnostically. 2017-01-23 15:04:05 -05:00
Rob Rix
a7cbea7051 Handle break/continue statements language-agnostically. 2017-01-23 14:09:07 -05:00
Rob Rix
a0bdcb9f60 Handle pairs in the default term assignment. 2017-01-23 14:07:47 -05:00
Rob Rix
3809b07723 Group language-agnostic patterns. 2017-01-20 16:49:45 -05:00
Rob Rix
ed217d9d10 Add language-agnostic handling of while statements. 2017-01-20 16:40:34 -05:00
Rob Rix
a49ca3cbe6 Add language-agnostic handling of return statements. 2017-01-20 16:39:27 -05:00
Rob Rix
24753de48d Add a default handler for if statements. 2017-01-20 15:20:36 -05:00
Rob Rix
c9af7b1196 Per-language term assignment is pure. 2017-01-20 15:03:40 -05:00
Rob Rix
6abb7d812a Handle operators in the default term assignment. 2017-01-20 14:59:49 -05:00
Rob Rix
a16f3b4e99 defaultTermAssignment receives the list of all children. 2017-01-20 14:55:43 -05:00
Rob Rix
3ed32e9225 defaultTermAssignment returns in IO. 2017-01-20 14:54:03 -05:00
Rob Rix
427afdf61c Ruby term assignment returns Syntax. 2017-01-20 14:15:09 -05:00
Rob Rix
600b861135 C term assignment returns Syntax. 2017-01-20 14:12:56 -05:00
Rob Rix
17ce8d6988 JavaScript term assignment returns Syntax. 2017-01-20 14:09:44 -05:00
Rob Rix
a538d39b31 Per-language term assignment returns Syntax, not Term. 2017-01-20 14:09:29 -05:00
Rob Rix
af8b3bf268 Go term assignment is (notionally) partial. 2017-01-20 13:51:52 -05:00
Rob Rix
27a01e8ddc Fall back to default term assignment if we don’t have a language. 2017-01-20 13:48:52 -05:00
Rob Rix
45621eedd8 JavaScript term assignment is (notionally) partial. 2017-01-20 13:47:06 -05:00
Rob Rix
2e7c4c2ac4 C term assignment is (notionally) partial. 2017-01-20 13:45:05 -05:00
Rob Rix
5432eaab34 Ruby term assignment is (notionally) partial. 2017-01-20 13:37:20 -05:00
Rob Rix
740f1ee174 Write a fallback path for partial term assignment. 2017-01-20 13:35:38 -05:00
Rob Rix
f84c578371 Construct parse error terms for all languages. 2017-01-20 13:11:04 -05:00
Rob Rix
44ecf732fa Curry defaultTermAssignment. 2017-01-20 13:07:19 -05:00
Rob Rix
a6c897163c Rename termConstructor to termAssignment. 2017-01-20 13:05:55 -05:00
Rob Rix
8dbf54bcca Export the default term assignment. 2017-01-20 13:04:36 -05:00
Rob Rix
c1e82f9b37 Define a default term assignment. 2017-01-20 13:03:52 -05:00
Rob Rix
1c0c7e4bdf Factor slicing the source out of term assignment. 2017-01-20 12:59:56 -05:00
Rob Rix
c93d9abe0b Pass the annotations in whole. 2017-01-19 16:36:49 -05:00
Rob Rix
b8901998ff Rename termConstructor to assignTerm. 2017-01-19 15:22:04 -05:00
Rob Rix
5ef2464550 Extract the overall term constructor to the top level. 2017-01-19 15:18:02 -05:00
Rob Rix
4d1d84ef9f Map parse error categories in one place. 2017-01-19 15:09:22 -05:00
Rob Rix
33040ea22e Assign terms based on the Category. 2017-01-19 12:26:45 -05:00
Rob Rix
83acde8ad4 Add a function computing the Category for a given language & production name. 2017-01-19 12:26:20 -05:00
Rob Rix
dbcfb85c1c This comment now applies to sourceSpan as well. 2017-01-18 13:40:55 -05:00
Rob Rix
0854ba66e2 Evaluate the SourceSpan strictly. 2017-01-18 13:39:58 -05:00
Rob Rix
60a8f588e4 Term assignment takes a pure SourceSpan.
We always access this now, so we don’t need to guard it in IO.
2017-01-18 13:39:40 -05:00
Timothy Clem
5c0ee56565 Bring in new tree-sitter API to query all child nodes 2016-12-06 11:21:31 -08:00
joshvera
30a3961409 Add go, defer, and subscript access statements 2016-11-14 19:05:02 -05:00
joshvera
0d58e97070 Merge remote-tracking branch 'origin/master' into go-parser 2016-11-02 15:25:50 -04:00
Timothy Clem
4b42939bf3 Basics of Ruby termConstructor 2016-10-19 08:30:46 -07:00
joshvera
9d81396317 construct Go terms with its termConstructor 2016-10-17 15:51:53 -04:00
joshvera
098655b1d9 Remove filepath from SourceSpan 2016-10-11 15:09:24 -04:00
joshvera
c0a8483263 Merge remote-tracking branch 'origin/master' into add-source-spans 2016-10-07 11:28:57 -04:00
joshvera
4c219279b2 SourceSpans are one-indexed 2016-10-06 18:31:06 -04:00
Timothy Clem
fa2f13ab74 Update to latest tree-sitter and parsers 2016-10-06 11:07:40 -07:00
joshvera
7ba5607cc8 Add source spans to terms 2016-10-05 17:27:45 -04:00
Rob Rix
fc43dd54a0 🔥 a redundant import. 2016-09-14 19:23:40 -04:00
Rick Winfrey
67d5bec5ff Format comment 2016-09-09 16:23:19 -05:00
Rob Rix
29e5b5d1da Filter empty nodes out at the assignment of children. 2016-09-08 09:42:16 -04:00
Rob Rix
eccaab1fbd Use record wildcards to destructure the source blob. 2016-09-08 09:40:00 -04:00
Rob Rix
8ff6b1aa96 Use $! instead of seq. 2016-09-08 09:39:19 -04:00
Rob Rix
1e9785fc67 Add a fallback term constructor for other languages. 2016-09-07 15:14:20 -04:00
Rob Rix
a1be4c2841 Map C productions into terms using a term constructor. 2016-09-07 15:11:55 -04:00
Rob Rix
c194d4578a Select the term constructor using the language. 2016-09-07 13:00:59 -04:00
Rob Rix
9750b252ed Rename the term constructor for JS. 2016-09-07 11:57:24 -04:00
Rob Rix
0c0a67ba65 Move javascriptTermConstructor into its own module. 2016-09-07 11:56:28 -04:00
Rob Rix
bd7fab0cd8 🔥 defaultCategoryForNodeName. 2016-09-07 10:31:58 -04:00
Rob Rix
18bcc8bd0c 🔥 categoriesForLanguage. 2016-09-07 10:31:52 -04:00
Rob Rix
b5534682a8 Construct in javascriptTermConstructor. 2016-08-25 18:20:40 -04:00
Rob Rix
07c0d89805 Declare the export list for TreeSitter. 2016-08-25 15:42:30 -04:00
joshvera
38fd0431f7 Fix semantic-git-diff-tests 2016-08-22 17:56:48 -04:00
joshvera
bbc2c2b9b2 Add the empty statement 2016-08-19 15:53:04 -04:00
Rick Winfrey
1b542a89ba Promote "rel_op" to general language production 2016-08-17 11:55:20 -05:00
Rick Winfrey
9907711099 Make "bitwise_op" a generic language production 2016-08-17 11:00:25 -05:00
joshvera
8bcf292ba0 Merge remote-tracking branch 'origin/master' into comma-summaries 2016-08-16 19:34:30 -04:00
Rick Winfrey
5f23992143 Merge branch 'master' into more-detail-more-problems 2016-08-16 16:10:04 -05:00
joshvera
329c050811 Merge remote-tracking branch 'origin/master' into comma-summaries 2016-08-16 15:44:09 -04:00
joshvera
a9c3bfa671 Add CommaOperator 2016-08-16 15:44:02 -04:00
Rick Winfrey
e29651ce07 Create Comment Category instances from TreeSitter productions 2016-08-16 13:09:43 -05:00
Rob Rix
62c5eb758f Apply fromIntegral strictly. 2016-08-16 11:35:12 -04:00
Rob Rix
fba230319b Be very explicit about evaluating the SourceSpan eagerly. 2016-08-16 11:04:52 -04:00
Rob Rix
1666c536f8 Take the SourceSpan in the monad. 2016-08-16 10:59:10 -04:00
Rob Rix
4190abe065 Generalize termConstructor to return its argument in a Monad. 2016-08-16 09:50:50 -04:00
Rob Rix
97e5ee5aa2 🔥 redundant parens. 2016-08-15 17:46:43 -04:00
Rob Rix
5a979aaf5b Document why sourceSpan isn’t evaluated eagerly any more. 2016-08-15 17:41:13 -04:00
Rob Rix
f1c1d85ec8 Don’t evaluate the sourceSpan strictly, i.e. only compute it when there are actually errors (but then use it eagerly). 2016-08-15 17:40:07 -04:00
Rob Rix
eb99b40a15 Don’t inline toTerm after all.
It’s recursive and we want to see how its performance breaks down a
little better.
2016-08-15 17:28:17 -04:00
Rob Rix
d4022e0c43 Define getChild using >>. 2016-08-15 17:25:56 -04:00
Rob Rix
3a87e5501d Evaluate sourceSpan eagerly too. 2016-08-15 17:17:03 -04:00
Rob Rix
8837f48d3d Bind range instead of assigning it. 2016-08-15 17:12:15 -04:00
Rob Rix
5adb799b48 INLINE a bunch of stuff in documentToTerm. 2016-08-15 17:04:45 -04:00
Rob Rix
042b3b9c29 Bind sourceSpan instead of assigning it. 2016-08-15 17:04:38 -04:00
joshvera
e209199016 Add If constructor to Syntax 2016-08-11 17:39:44 -04:00
Rob Rix
48213c4134 🔥 some stray blank lines. 2016-08-10 09:48:16 -04:00
Rob Rix
a5dce511fa Fix a missing import. 2016-08-02 12:08:26 -04:00
Rob Rix
54c86812f3 Merge branch 'master' into precompute-p,q-grams 2016-08-02 12:05:19 -04:00
joshvera
36c4001682 Merge remote-tracking branch 'origin/master' into throw-syntax 2016-08-01 13:55:44 -04:00
joshvera
ef4389a5c5 Merge remote-tracking branch 'origin/master' into constructors 2016-08-01 13:49:35 -04:00
joshvera
9bd34fe3ff Merge remote-tracking branch 'origin/master' into try-syntax 2016-08-01 13:38:50 -04:00
Josh Vera
fb9c89b509 Merge branch 'master' into method-definition-syntax 2016-08-01 12:58:05 -04:00
joshvera
7c1e6677a8 Add math_op 2016-08-01 12:19:05 -04:00
joshvera
dca3628afd Add comma_op mapping to Operator category in categoriesForLanguage 2016-08-01 12:07:04 -04:00
joshvera
e2d0b01ced Map JS new_expression to Constructor 2016-07-30 14:27:34 -04:00
joshvera
0e5255b7de Map method_definition to Method categories 2016-07-30 14:08:46 -04:00
joshvera
00613a034b Remove redundant import 2016-07-30 14:01:20 -04:00
joshvera
1dc3fb2727 Add a Class JS mapping in categoriesForLanguage 2016-07-29 16:28:51 -04:00
joshvera
ddcb6f6a1d Add Try/Catch/Finally cases to defaultCategoryForNodeName 2016-07-29 15:59:51 -04:00
joshvera
b97da37c79 Add Throw to defaultCategoryForNodeName 2016-07-29 15:33:15 -04:00
joshvera
ebda2e6900 Remove redundant import 2016-07-29 15:31:04 -04:00
joshvera
aa99744db7 Remove SourceSpan from Record 2016-07-29 14:12:44 -04:00
joshvera
f7286f927c Construct errors with a SourceSpan 2016-07-29 14:05:11 -04:00
joshvera
4493751dd7 Merge remote-tracking branch 'origin/master' into error-syntax 2016-07-29 12:18:14 -04:00
joshvera
fbc9e335a3 Merge remote-tracking branch 'origin/master' into error-syntax 2016-07-29 11:44:38 -04:00
joshvera
7f3cb2e9ef Merge remote-tracking branch 'origin/master' into loop-syntax 2016-07-29 11:42:25 -04:00
joshvera
d057e156cd Add Return case to Syntax 2016-07-28 14:34:53 -04:00
joshvera
7eac130089 Add DoWhile and While cases 2016-07-28 14:08:34 -04:00
joshvera
951617ff5e Add For cases to categoriesForLanguage and defaultCategoryForNodeName 2016-07-28 13:50:43 -04:00
joshvera
c7d7ee51aa Keep track of source spans 2016-07-27 18:11:55 -04:00
Rob Rix
d9de3545d8 Merge branch 'master' into precompute-p,q-grams
# Conflicts:
#	src/Category.hs
#	src/Diffing.hs
#	src/TreeSitter.hs
2016-07-26 15:52:37 -04:00
joshvera
30d4645dbb Add bool_op and expression_statement mapping to categoriesForLanguage 2016-07-25 14:57:14 -04:00
joshvera
70f9329f1a Merge remote-tracking branch 'origin/master' into syntax-redux 2016-07-22 12:36:03 -04:00
Rob Rix
1127fd2672 🔥 the ad hoc computation of term costs. 2016-07-15 17:49:27 -04:00
Rob Rix
b975559c6d Parameterize the Parser type synonym by functor and annotation. 2016-07-15 17:43:07 -04:00
Rob Rix
5bc2cd93f1 Only annotate terms & diffs with costs, not sizes. 2016-07-15 11:17:53 -04:00
Rob Rix
d1ed015446 Parser takes a list of field types. 2016-07-14 16:35:20 -04:00
joshvera
9973343364 Map dictionary literals to objects 2016-06-28 16:38:06 -04:00
joshvera
0a574871c9 Merge remote-tracking branch 'origin/master' into syntax-redux 2016-06-21 17:08:40 -04:00
Rick Winfrey
eb638a974b Provide JavaScript specific Operator categories for delete_op, type_op and void_op 2016-06-17 17:04:18 -05:00
Rick Winfrey
f2d5a2be04 Add Operator Category
Although we don’t currently receive operator productions from
TreeSitter directly, this is in anticipation of that.
2016-06-17 17:01:35 -05:00
Rick Winfrey
88dd8e3c6c Add Ternary Category / Syntax to DiffSummaries 2016-06-17 15:33:22 -05:00
Rick Winfrey
76c4037933 Add support for MathAssignment Category and Syntax 2016-06-17 14:57:51 -05:00
Rick Winfrey
3ac96be52c Add subscript_access case for defaultCategoryName 2016-06-17 14:39:47 -05:00
Rob Rix
1668e94427 Define Info as a synonym over Data.Record. 2016-06-17 13:33:50 -04:00
Rob Rix
7d95cb48dc Use the Cost & Size types in Info. 2016-06-17 13:30:48 -04:00
Rick Winfrey
d554636c5c Add JavaScript specific "generator_function" case to map to Function Syntax 2016-06-16 15:34:48 -05:00
Rick Winfrey
513c3b7ec7 Assign arrow_function productions as Function Syntax 2016-06-16 11:25:17 -05:00
Rick Winfrey
d8bfd5a629 Merge branch 'syntax-redux' of github.com:github/semantic-diff into syntax-redux 2016-06-16 09:57:11 -05:00
Rick Winfrey
f70bce09c2 Add true and false cases to defaultCategoryForNodeName 2016-06-16 09:55:13 -05:00
Rick Winfrey
6e3a2e2a4e Add JavaScript language specific categories for this, undefined and null 2016-06-16 09:54:46 -05:00