1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00
Commit Graph

5004 Commits

Author SHA1 Message Date
Rob Rix
99590a52d3 Map "block" onto ExpressionStatements. 2017-01-23 15:33:31 -05:00
Rob Rix
338522ab5c Flatten single-child expression lists. 2017-01-23 15:26:54 -05:00
Rob Rix
cfbe9b9b16 Flatten assignments out. 2017-01-23 15:22:00 -05:00
Rob Rix
258e136abb Flatten the variable declaration pattern. 2017-01-23 15:19:19 -05:00
Rob Rix
f6e6e7f516 Slightly more idiomatic handling of Select. 2017-01-23 15:13:50 -05:00
Rob Rix
110dc2129c Allow Case to fall through. 2017-01-23 15:13:22 -05:00
Rob Rix
281df3178f Handle Case language agnostically. 2017-01-23 15:12:38 -05:00
Rob Rix
e88e4c81ff Slightly more lenient handling of Case. 2017-01-23 15:12:12 -05:00
Rob Rix
122a34452a Let If & While fall through. 2017-01-23 15:12:02 -05:00
Rob Rix
7af836e39d 🔥 a redundant function call pattern. 2017-01-23 15:09:45 -05:00
Rob Rix
f761323f14 Let return statements fall through. 2017-01-23 15:08:40 -05:00
Rob Rix
f2dd0977ba Defer to the language-agnostic handling of Switch. 2017-01-23 15:06:55 -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
e5902d9358 Switch takes a list of subject clauses. 2017-01-23 15:02:52 -05:00
Rob Rix
0d52a93060 Placate hlint. 2017-01-23 15:02:08 -05:00
Rob Rix
ab8b6d4b37 Simplify the import of Go sources. 2017-01-23 14:47:42 -05:00
Rob Rix
f5d22fcc4d Syntax.Ty takes a list of fields. 2017-01-23 14:39:12 -05:00
Rob Rix
0474b79b97 🔥 some redundant uses of withCategory. 2017-01-23 14:33:48 -05:00
Rob Rix
413fd969f1 Simplify withRanges to get the children from the syntax. 2017-01-23 14:24:05 -05:00
Rob Rix
2540196cf3 Define the var assignment zippers tacitly. 2017-01-23 14:19:22 -05:00
Rob Rix
9092a9ebc2 Inline the range/source span lists. 2017-01-23 14:17:08 -05:00
Rob Rix
f55dd77f18 Allow variable & const declarations to fall through. 2017-01-23 14:15:42 -05:00
Rob Rix
e1df6cc471 Flatten the struct type pattern. 2017-01-23 14:14:24 -05:00
Timothy Clem
381549c045 Structure to produce toc summaries 2017-01-23 11:13:11 -08: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
fac36a16ab Fall through from Go term assignment. 2017-01-23 14:06:39 -05:00
Rob Rix
af4fcadc5f Var assignment patterns match partially. 2017-01-23 14:03:05 -05:00
Timothy Clem
02f87738c0 Plumb in cmd line option for new toc output format 2017-01-23 10:49:48 -08:00
Rob Rix
107124fe62 🔥 special handling of import_declaration. 2017-01-23 13:27:55 -05:00
Rob Rix
f6eea74747 Assign C.Import to S.Import. 2017-01-23 13:27:46 -05:00
Rob Rix
9c83566b34 Map import_spec into Import. 2017-01-23 13:27:27 -05:00
Rob Rix
4c48fe33dd Simplify how individual imports are flattened. 2017-01-23 13:23:07 -05:00
Rob Rix
aa1d770ab1 Flatten import declarations. 2017-01-23 13:21:20 -05:00
Rob Rix
b2456dce33 Flatten the field declaration patterns. 2017-01-23 13:19:39 -05:00
Rob Rix
f5bc950755 Flatten toIdent into toFieldDecl. 2017-01-23 13:17:49 -05:00
Rob Rix
9a98bd6c8e Flatten the type declaration pattern. 2017-01-23 13:14:42 -05:00
Rob Rix
9e61d8a2eb Flatten the defer/go statement patterns. 2017-01-23 13:14:01 -05:00
Rob Rix
b9a8207b93 Flatten the susbcript access patterns. 2017-01-23 13:13:16 -05:00
Rob Rix
2d3bffbad3 Flatten the slice/subscript access patterns. 2017-01-23 13:12:24 -05:00
Rob Rix
df6c2dae38 Flatten the struct patterns. 2017-01-23 13:09:39 -05:00
Rob Rix
bf618900ae Flatten the dictionary literal pattern. 2017-01-23 13:05:53 -05:00
Rob Rix
252e2a6f2d Flatten the array literal pattern. 2017-01-23 13:05:19 -05:00
Rob Rix
53eff8dc1a Flatten the composite_literal pattern match. 2017-01-23 13:02:35 -05:00
Rob Rix
2fc48d7ff8 Flatten the continue pattern. 2017-01-23 13:00:57 -05:00
Rob Rix
b3ee5042cb Flatten the break pattern. 2017-01-23 13:00:06 -05:00
Rob Rix
e284d73430 Flatten the pair pattern. 2017-01-23 12:59:25 -05:00
Rob Rix
c7bb1e5325 Flatten the module/package_name pattern somewhat. 2017-01-23 12:58:51 -05:00
Rob Rix
893cb771e6 Flatten the anonymous function pattern. 2017-01-23 12:54:21 -05:00
Rob Rix
ef5d6e9df5 Don’t attempt to convert cases. 2017-01-23 12:53:09 -05:00
Rob Rix
3a459a7f31 Flatten Method pattern matches. 2017-01-23 12:44:41 -05:00
Rob Rix
5c9a9c8eb5 Flatten the FunctionCall patterns. 2017-01-23 12:41:51 -05:00
Rob Rix
918dcd0498 Flatten the type assertion/conversion patterns. 2017-01-23 12:41:01 -05:00
Rob Rix
681dc71832 Flatten the Send pattern. 2017-01-23 12:40:00 -05:00
Rob Rix
07a5688d21 Flatten the pointer/channel type patterns. 2017-01-23 12:39:37 -05:00
Rob Rix
0b01b510a3 Combine the ParameterDecl patterns. 2017-01-23 12:38:33 -05:00
Rob Rix
1cd22e2df0 Flatten the function patterns to the top level. 2017-01-23 12:37:19 -05:00
Rob Rix
5e6f45e482 Flatten the for statement patterns to the top level. 2017-01-23 12:37:12 -05:00
Rob Rix
5c2a024607 Match against the category and children in one go. 2017-01-23 12:33:13 -05:00
joshvera
f8ecbf9286 WIP stub TOC renderer 2017-01-23 12:16:59 -05:00
joshvera
18c8a0124d Add a stub TOC renderer 2017-01-23 11:22:51 -05:00
Rob Rix
e81b1b65e1 JS relies on the default return rule. 2017-01-23 10:27:40 -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
848659cb31 Match method calls on the Syntax constructor. 2017-01-20 16:38:12 -05:00
Rob Rix
5da93d8274 Don’t match comments in JS or Ruby term assignment. 2017-01-20 16:35:33 -05:00
Rob Rix
f55d90084f Flatten the JS function/method call patterns. 2017-01-20 15:43:15 -05:00
Rob Rix
6d615d0f00 Flatten the JS try/catch/finally patterns. 2017-01-20 15:42:11 -05:00
Rob Rix
f68de599a7 Flatten the JS function patterns out. 2017-01-20 15:39:53 -05:00
Rob Rix
476f4ac567 JavaScript term assignment is actually partial. 2017-01-20 15:37:01 -05:00
Rob Rix
c27875b6f7 Consolidate the JS function patterns. 2017-01-20 15:34:50 -05:00
Rob Rix
eae2480d31 Allow malformed JS for statements to fall through. 2017-01-20 15:33:30 -05:00
Rob Rix
0744fa78b2 Consolidate the JS try/catch/finally patterns. 2017-01-20 15:32:25 -05:00
Rob Rix
89f8e3b1a3 Consolidate the JS function/method call patterns. 2017-01-20 15:30:00 -05:00
Rob Rix
f6d98c4c5d Allow top-level JS assignment errors to fall through. 2017-01-20 15:27:35 -05:00
Rob Rix
79a0386931 Correct Ruby’s Method pattern. 2017-01-20 15:25:53 -05:00
Rob Rix
438234b97d 🔥 specialization of the If rule for Ruby. 2017-01-20 15:21:55 -05:00
Rob Rix
24753de48d Add a default handler for if statements. 2017-01-20 15:20:36 -05:00
Rob Rix
9967585650 Ruby term assignment is actually partial. 2017-01-20 15:16:32 -05:00
Rob Rix
43c4cc7d23 Consolidate the method patterns. 2017-01-20 15:12:58 -05:00
Rob Rix
65ae07f301 Consolidate the lambda patterns. 2017-01-20 15:10:47 -05:00
Rob Rix
3fe41d324e Consolidate the method/function call patterns. 2017-01-20 15:08:55 -05:00
Rob Rix
0f99a0ff8f Allow top-level errors to fall through. 2017-01-20 15:08:40 -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
cff0db5528 Add field accessors for SourceSpan. 2017-01-20 14:44:23 -05:00
Rob Rix
0aa45a615b Reformat Info’s exports. 2017-01-20 14:44:10 -05:00
Rob Rix
fe155eac5a Move the sourceText getter out from between the Cost accessors. 2017-01-20 14:41:34 -05:00
Rob Rix
a24781d2bd 🔥 unionSourceSpans. 2017-01-20 14:38:39 -05:00
Rob Rix
546369c625 🔥 SourceSpan.maybeConcat. 2017-01-20 14:38:02 -05:00
Rob Rix
48f119539f Define unionSourceSpansFrom in terms of the Semigroup instance. 2017-01-20 14:37:52 -05:00
Rob Rix
7dc2406848 🔥 Range.maybeConcat. 2017-01-20 14:36:40 -05:00
Rob Rix
ea3278b745 Define unionRangesFrom in terms of the Semigroup instance. 2017-01-20 14:36:28 -05:00
Rob Rix
f8c4b00411 🔥 unionRanges. 2017-01-20 14:36:10 -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
e7e0e5c01c 🔥 an apparently redundant $!. 2017-01-20 14:11:41 -05:00
Rob Rix
c16e75c670 Don’t match errors specially in JS term assignment. 2017-01-20 14:11:05 -05:00
Rob Rix
e11c56b7a4 Don’t match unused fields. 2017-01-20 14:10:30 -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
2bf708aaeb Collapse C term assignment for now. 2017-01-20 13:53:12 -05:00
Rob Rix
af8b3bf268 Go term assignment is (notionally) partial. 2017-01-20 13:51:52 -05:00
Rob Rix
40eb0312ef 🔥 the old default term assignment function. 2017-01-20 13:50:25 -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
3f60857321 Merge branch 'better-record-pattern-matches' into consolidate-common-term-assignment-patterns 2017-01-19 16:38:38 -05:00
Rob Rix
c93d9abe0b Pass the annotations in whole. 2017-01-19 16:36:49 -05:00
Rob Rix
f6c750dde2 Merge branch 'better-record-pattern-matches' into consolidate-common-term-assignment-patterns 2017-01-19 16:00:12 -05:00
Rob Rix
8e1c5706b6 Replace uses of (.:) with (:.). 2017-01-19 15:46:28 -05:00
Rob Rix
9f707bcf3a Rename RCons to (:.).
We can’t use (.:) because Haskell doesn’t allow that. However, tokens starting with : are reserved for data constructors, so (:.) is, apparently, a perfectly cromulent constructor.
2017-01-19 15:42:51 -05:00
Rob Rix
d64108dfb8 Rename TermIndexOrNil to avoid clashing with new Record construction. 2017-01-19 15:41:50 -05:00
Rob Rix
877fec5e38 Rename RNil to Nil. 2017-01-19 15:36:04 -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
aff613148f Don’t map parse error productions per-language. 2017-01-19 15:13:07 -05:00
Rob Rix
4d1d84ef9f Map parse error categories in one place. 2017-01-19 15:09:22 -05:00
Rob Rix
abe529534a Don’t add “modifier” for now. 2017-01-19 14:05:51 -05:00
Rob Rix
cd5a51aa7a Disable -Wdeprecations on files pattern matching against Category.
We can’t 🔥 RescueModifier yet because of RWS instability. See also #778.
2017-01-19 14:01:48 -05:00
Rob Rix
ae7a91d9da Deprecate RescueModifier. 2017-01-19 14:01:01 -05:00
Rob Rix
eb8c09f2b5 Revert "🔥 RescueModifier."
This reverts commit 9eda5f256678287b9252a7c654ffcaf486b22c21.
2017-01-19 13:51:24 -05:00
Rob Rix
ca1647d45e Disambiguate the Rescue category 😞 2017-01-19 13:16:31 -05:00
Rob Rix
9c064da12f Compute a simpler string for rescue modifiers. 2017-01-19 13:14:40 -05:00
Rob Rix
21dabbe077 🔥 RescueModifier. 2017-01-19 13:13:57 -05:00
Rob Rix
8df4e8ca7b Look for Modifier Rescue, not RescueModifier. 2017-01-19 13:12:59 -05:00
Rob Rix
36a6760347 Match against Modifier categories where appropriate. 2017-01-19 13:09:39 -05:00
Rob Rix
2f3dfd2df7 Compact the unless/until rules. 2017-01-19 13:07:55 -05:00
Rob Rix
d9397f930c Handle Until/Unless in the same manner as the other control statements/modifiers. 2017-01-19 13:06:12 -05:00
Rob Rix
72f2260164 Ruby term assignment is pure except for operators. 2017-01-19 13:01:59 -05:00
Rob Rix
37141178ea Map Ruby modifier productions onto Modifier categories. 2017-01-19 12:56:09 -05:00
Rob Rix
408ad2ecc5 Add Modifier categories.
These are used when a normal syntactic category is attached as a modifier instead of as a statement, e.g.:

```ruby
if foo then bar end
```

vs.

```ruby
bar if foo
```
2017-01-19 12:55:06 -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
fde31b836e Go term assignment is pure. 2017-01-19 12:02:35 -05:00
joshvera
ee10187ba1 Merge remote-tracking branch 'origin/master' into more-go-terms 2017-01-18 15:36:02 -05:00
joshvera
95d6f7a850 Add a maybeRecursively so we compare optional values as insertions or deletions when one side is missing 2017-01-18 15:08:30 -05:00
joshvera
9966b88f1b s/if statement/maybe 2017-01-18 14:07:39 -05:00
joshvera
7f396dd7b7 Rename Default to DefaultCase 2017-01-18 14:06:45 -05:00
joshvera
b3a300f745 Add docs 2017-01-18 14:02:06 -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
joshvera
d34b8e2354 Parse methods 2017-01-18 13:38:31 -05:00
joshvera
d4c33c0176 Map keyed_element to Pair 2017-01-18 13:01:25 -05:00
joshvera
0acdf470e4 Remove identifer_list wrapper in field declarations 2017-01-18 12:53:12 -05:00
joshvera
8e88838495 Merge remote-tracking branch 'origin/master' into more-go-terms 2017-01-18 11:14:03 -05:00
joshvera
0c24778b05 add rune literal case 2017-01-17 18:57:43 -05:00
joshvera
496e95a41f fix rune tests 2017-01-17 18:55:59 -05:00
joshvera
fc55bee5fc Change Break and Continue to take a Maybe 2017-01-17 17:20:50 -05:00
joshvera
0c36efc850 Fix ranges and categories for const var assignments 2017-01-17 17:10:34 -05:00
joshvera
c3201ed689 Map var declarations to VarDecl 2017-01-17 14:56:59 -05:00
joshvera
23450d64ee Clean up dead code 2017-01-17 13:20:46 -05:00
joshvera
e97330fe83 Map short var declarations to var assignments 2017-01-17 13:19:46 -05:00
joshvera
f3d29d894e Convert var_declaration to Indexed and var_spec to VarAssignment 2017-01-17 12:30:42 -05:00
joshvera
a95d57c8cf Parse struct type declarations 2017-01-17 12:23:56 -05:00
joshvera
71a147862a tags can only be strings in field declarations 2017-01-17 12:06:26 -05:00
joshvera
74b2b1715c Add correct ranges to errors 2017-01-17 11:54:11 -05:00
joshvera
52c4f1a7b4 Add tag to FieldDecl 2017-01-17 11:53:44 -05:00
Rick Winfrey
e0983245d2 Add missing category 2017-01-13 16:46:24 -08:00
Rick Winfrey
4fcd80a6fe Add qualified identifiers for Go 2017-01-13 16:46:16 -08:00
Rick Winfrey
27196d8f6b Add Go support for increment / decrement statements 2017-01-13 15:03:42 -08:00
Rick Winfrey
46345434ca Merge branch 'more-go-terms' of github.com:github/semantic-diff into more-go-terms 2017-01-12 16:09:48 -08:00
joshvera
cb2f0b7e7b unused param 2017-01-12 19:00:10 -05:00
Rick Winfrey
25c79a31de Merge branch 'more-go-terms' of github.com:github/semantic-diff into more-go-terms 2017-01-12 15:59:00 -08:00
Rick Winfrey
86a456b285 Merge remote 2017-01-12 15:54:14 -08:00
joshvera
2dd0f2c609 add missing send statement case in Renderer.Split 2017-01-12 18:53:20 -05:00
joshvera
e3505286ba Add function types 2017-01-12 18:52:11 -05:00
joshvera
741ccd4c05 Map unary_expression to Operator 2017-01-12 18:44:11 -05:00
joshvera
20ead53d1c Add send statements 2017-01-12 18:39:09 -05:00
joshvera
45fe48b1ad Map channel types 2017-01-12 18:33:13 -05:00
joshvera
79d9561c4f Make types identifiable for now 2017-01-12 18:28:49 -05:00
joshvera
98f2407677 Add Ty syntax 2017-01-12 17:56:41 -05:00
Rob Rix
9cb0d7a354 Merge branch 'master' into leancheck,-the-other-white-meat 2017-01-12 15:55:26 -05:00
Rob Rix
364d36f40f Use the Tier type synonym more widely. 2017-01-12 15:53:31 -05:00
Rick Winfrey
0880b41fc6 Add slice literal summary statements 2017-01-12 12:00:09 -08:00
Rick Winfrey
2563a26a8a Add Literal category 2017-01-12 11:59:38 -08:00
Rick Winfrey
7cd5da6ea6 Add SliceTy and Element to Split renderer 2017-01-12 11:47:29 -08:00
Rick Winfrey
d015068e5b Add mapping for slice types 2017-01-12 11:44:07 -08:00
Rick Winfrey
5fa1e51694 Add mapping for Slice literals and their elements 2017-01-12 11:43:44 -08:00
Rick Winfrey
1caeb18406 Add Element category 2017-01-12 11:38:44 -08:00
Rick Winfrey
b69badb184 Add SliceTy category 2017-01-12 11:38:35 -08:00
Rob Rix
b12aa44636 Replace the quaternary ToJSON instance over Record with an inductive one. 2017-01-12 14:23:36 -05:00
Rob Rix
3124447ad6 Define ToJSONList instances over records. 2017-01-12 14:23:18 -05:00
Rob Rix
a044e862b2 Define a typeclass for computing a record’s component Values. 2017-01-12 14:23:03 -05:00
Rick Winfrey
3a7259503d Add FieldDecl renderer entries 2017-01-11 15:26:56 -08:00
Rick Winfrey
ad9895a28c Merge branch 'more-go-terms' of github.com:github/semantic-diff into more-go-terms 2017-01-11 15:23:04 -08:00
Rick Winfrey
4bddf7952a Summarize FieldDecl 2017-01-11 15:10:45 -08:00