mirror of
https://github.com/github/semantic.git
synced 2024-12-26 00:12:29 +03:00
Merge remote-tracking branch 'origin/master' into simplify-reprinter
also incorporates a number of changes. oops.
This commit is contained in:
commit
7129435dc8
@ -2,14 +2,8 @@ syntax = "proto3";
|
||||
|
||||
package github.semantic;
|
||||
|
||||
import "ruby_term.proto";
|
||||
import "ruby_diff.proto";
|
||||
import "json_term.proto";
|
||||
import "typescript_term.proto";
|
||||
import "typescript_diff.proto";
|
||||
import "python_term.proto";
|
||||
import "python_diff.proto";
|
||||
import "types.proto";
|
||||
import "terms.proto";
|
||||
import "error_details.proto";
|
||||
|
||||
option java_package = "com.github.semantic.analysis";
|
||||
@ -21,6 +15,8 @@ option go_package = "github.com/semantic/analysis/;analysis";
|
||||
service CodeAnalysis {
|
||||
// Parsing
|
||||
//
|
||||
// Parse source code blobs and return abstract syntax trees as adjacency list graph.
|
||||
rpc ParseTreeGraph (ParseTreeRequest) returns (ParseTreeGraphResponse);
|
||||
// Parse source code blobs and return abstract syntax trees.
|
||||
rpc ParseTree (ParseTreeRequest) returns (ParseTreeResponse);
|
||||
|
||||
@ -45,40 +41,48 @@ service CodeAnalysis {
|
||||
rpc CheckHealth (HealthCheckRequest) returns (HealthCheckResponse);
|
||||
}
|
||||
|
||||
// Term Requests and Responses
|
||||
//
|
||||
message ParseTreeRequest {
|
||||
repeated Blob blobs = 1;
|
||||
}
|
||||
|
||||
|
||||
// A ParseTreeResponse contains a list of syntax trees, one for each blob passed
|
||||
// in the request.
|
||||
message ParseTreeResponse {
|
||||
oneof response_type {
|
||||
RubyResponse ruby = 1;
|
||||
JSONResponse json = 2;
|
||||
TypeScriptResponse typescript = 3;
|
||||
PythonResponse python = 4;
|
||||
}
|
||||
DebugInfo error_info = 5;
|
||||
// The list of trees.
|
||||
repeated ParseTree trees = 1;
|
||||
// Entire response failed (e.g. a timeout)
|
||||
DebugInfo error_info = 2;
|
||||
}
|
||||
|
||||
message RubyResponse {
|
||||
repeated rubyterm.RubyTerm terms = 1;
|
||||
repeated DebugInfo errors = 2;
|
||||
// A ParseTreeResponse contains a list of syntax trees represented as adjacency
|
||||
// graphs, one for each blob passed in the request.
|
||||
message ParseTreeGraphResponse {
|
||||
// The list of graphs.
|
||||
repeated ParseTreeGraph graphs = 1;
|
||||
// Entire response failed (e.g. a timeout)
|
||||
DebugInfo error_info = 2;
|
||||
}
|
||||
|
||||
message JSONResponse {
|
||||
repeated jsonterm.JSONTerm terms = 1;
|
||||
repeated DebugInfo errors = 2;
|
||||
message ParseTreeGraph {
|
||||
TermGraph graph = 1;
|
||||
string error = 2;
|
||||
}
|
||||
|
||||
message TypeScriptResponse {
|
||||
repeated typescriptterm.TypeScriptTerm terms = 1;
|
||||
repeated DebugInfo errors = 2;
|
||||
// Diff Request & Responses
|
||||
//
|
||||
message DiffTreeRequest {
|
||||
repeated BlobPair blobPairs = 1;
|
||||
}
|
||||
|
||||
message PythonResponse {
|
||||
repeated pythonterm.PythonTerm terms = 1;
|
||||
repeated DebugInfo errors = 2;
|
||||
message DiffTreeResponse {
|
||||
repeated DiffTree diffs = 1;
|
||||
DebugInfo error_info = 2;
|
||||
}
|
||||
|
||||
// Diff summaries
|
||||
message SummarizeDiffRequest {
|
||||
repeated BlobPair blobPairs = 1;
|
||||
}
|
||||
@ -89,49 +93,6 @@ message SummarizeDiffResponse {
|
||||
DebugInfo error_info = 3;
|
||||
}
|
||||
|
||||
message DiffTreeRequest {
|
||||
repeated BlobPair blobPairs = 1;
|
||||
}
|
||||
|
||||
message DiffTreeResponse {
|
||||
oneof response_type {
|
||||
RubyDiffResponse ruby = 1;
|
||||
PythonDiffResponse python = 2;
|
||||
TypeScriptDiffResponse typescript = 3;
|
||||
}
|
||||
DebugInfo error_info = 4;
|
||||
}
|
||||
|
||||
message RubyDiffResponse {
|
||||
repeated rubydiff.RubyDiff diffs = 1;
|
||||
}
|
||||
|
||||
message PythonDiffResponse {
|
||||
repeated pythondiff.PythonDiff diffs = 1;
|
||||
}
|
||||
|
||||
message TypeScriptDiffResponse {
|
||||
repeated typescriptdiff.TypeScriptDiff diffs = 1;
|
||||
}
|
||||
|
||||
message CallGraphRequest {
|
||||
Project project = 1;
|
||||
}
|
||||
|
||||
message CallGraphResponse {
|
||||
AdjacencyList graph = 1;
|
||||
DebugInfo error_info = 2;
|
||||
}
|
||||
|
||||
message ImportGraphRequest {
|
||||
Project project = 1;
|
||||
}
|
||||
|
||||
message ImportGraphResponse {
|
||||
AdjacencyList graph = 1;
|
||||
DebugInfo error_info = 2;
|
||||
}
|
||||
|
||||
message DiffSummary {
|
||||
string term = 1;
|
||||
string name = 2;
|
||||
@ -145,6 +106,27 @@ message ParseError {
|
||||
string language = 3;
|
||||
}
|
||||
|
||||
// Call Graphs
|
||||
message CallGraphRequest {
|
||||
Project project = 1;
|
||||
}
|
||||
|
||||
message CallGraphResponse {
|
||||
ControlFlowGraph graph = 1;
|
||||
DebugInfo error_info = 2;
|
||||
}
|
||||
|
||||
// Import Graphs
|
||||
message ImportGraphRequest {
|
||||
Project project = 1;
|
||||
}
|
||||
|
||||
message ImportGraphResponse {
|
||||
ControlFlowGraph graph = 1;
|
||||
DebugInfo error_info = 2;
|
||||
}
|
||||
|
||||
// Health Check
|
||||
message HealthCheckRequest {
|
||||
string service = 1;
|
||||
}
|
||||
|
619
proto/go_diff.proto
Normal file
619
proto/go_diff.proto
Normal file
@ -0,0 +1,619 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.godiff;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.godiff";
|
||||
option go_package = "github.com/semantic/godiff;go";
|
||||
|
||||
message GoDiff {
|
||||
oneof diff {
|
||||
Merge merge = 1;
|
||||
Delete delete = 2;
|
||||
Insert insert = 3;
|
||||
Replace replace = 4;
|
||||
}
|
||||
message Merge {
|
||||
GoSyntax syntax = 1;
|
||||
}
|
||||
message Delete {
|
||||
GoSyntax before = 1;
|
||||
}
|
||||
message Insert {
|
||||
GoSyntax after = 1;
|
||||
}
|
||||
message Replace {
|
||||
GoSyntax before = 1;
|
||||
GoSyntax after = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message GoSyntax {
|
||||
oneof syntax {
|
||||
Comment comment = 1;
|
||||
Constructor constructor = 2;
|
||||
Function function = 3;
|
||||
Method method = 4;
|
||||
MethodSignature methodSignature = 5;
|
||||
Type type = 6;
|
||||
TypeAlias typeAlias = 7;
|
||||
Plus plus = 8;
|
||||
Minus minus = 9;
|
||||
Times times = 10;
|
||||
DividedBy dividedBy = 11;
|
||||
Modulo modulo = 12;
|
||||
Power power = 13;
|
||||
Negate negate = 14;
|
||||
FloorDivision floorDivision = 15;
|
||||
BOr bOr = 16;
|
||||
BAnd bAnd = 17;
|
||||
BXOr bXOr = 18;
|
||||
LShift lShift = 19;
|
||||
RShift rShift = 20;
|
||||
UnsignedRShift unsignedRShift = 21;
|
||||
Complement complement = 22;
|
||||
Call call = 23;
|
||||
LessThan lessThan = 24;
|
||||
LessThanEqual lessThanEqual = 25;
|
||||
GreaterThan greaterThan = 26;
|
||||
GreaterThanEqual greaterThanEqual = 27;
|
||||
Equal equal = 28;
|
||||
StrictEqual strictEqual = 29;
|
||||
Comparison comparison = 30;
|
||||
Subscript subscript = 31;
|
||||
Member member = 32;
|
||||
PostDecrement postDecrement = 33;
|
||||
PostIncrement postIncrement = 34;
|
||||
MemberAccess memberAccess = 35;
|
||||
And and = 36;
|
||||
Not not = 37;
|
||||
Or or = 38;
|
||||
XOr xOr = 39;
|
||||
Composite composite = 40;
|
||||
DefaultPattern defaultPattern = 41;
|
||||
Defer defer = 42;
|
||||
Field field = 43;
|
||||
Go go = 44;
|
||||
Label label = 45;
|
||||
Package package = 46;
|
||||
Receive receive = 47;
|
||||
ReceiveOperator receiveOperator = 48;
|
||||
Rune rune = 49;
|
||||
Select select = 50;
|
||||
Send send = 51;
|
||||
Slice slice = 52;
|
||||
TypeAssertion typeAssertion = 53;
|
||||
TypeConversion typeConversion = 54;
|
||||
TypeSwitch typeSwitch = 55;
|
||||
TypeSwitchGuard typeSwitchGuard = 56;
|
||||
Variadic variadic = 57;
|
||||
BidirectionalChannel bidirectionalChannel = 58;
|
||||
ReceiveChannel receiveChannel = 59;
|
||||
SendChannel sendChannel = 60;
|
||||
Import import = 61;
|
||||
QualifiedImport qualifiedImport = 62;
|
||||
SideEffectImport sideEffectImport = 63;
|
||||
Array array = 64;
|
||||
Complex complex = 65;
|
||||
Float float = 66;
|
||||
Hash hash = 67;
|
||||
Integer integer = 68;
|
||||
KeyValue keyValue = 69;
|
||||
Pointer pointer = 70;
|
||||
Reference reference = 71;
|
||||
TextElement textElement = 72;
|
||||
Assignment assignment = 73;
|
||||
Break break = 74;
|
||||
Continue continue = 75;
|
||||
For for = 76;
|
||||
ForEach forEach = 77;
|
||||
Goto goto = 78;
|
||||
If if = 79;
|
||||
Match match = 80;
|
||||
NoOp noOp = 81;
|
||||
Pattern pattern = 82;
|
||||
Return return = 83;
|
||||
Statements statements = 84;
|
||||
Context context = 85;
|
||||
Error error = 86;
|
||||
Empty empty = 87;
|
||||
Identifier identifier = 88;
|
||||
Annotation annotation = 89;
|
||||
TypeArray typeArray = 90;
|
||||
TypeFunction typeFunction = 91;
|
||||
Interface interface = 92;
|
||||
Map map = 93;
|
||||
Parenthesized parenthesized = 94;
|
||||
TypePointer typePointer = 95;
|
||||
TypeSlice typeSlice = 96;
|
||||
List list = 97;
|
||||
String string = 98;
|
||||
EscapeSequence escapeSequence = 99;
|
||||
}
|
||||
}
|
||||
|
||||
message Comment {
|
||||
string commentContent = 1;
|
||||
}
|
||||
|
||||
message Constructor {
|
||||
repeated GoDiff constructorContext = 1;
|
||||
GoDiff constructorName = 2;
|
||||
GoDiff constructorFields = 3;
|
||||
}
|
||||
|
||||
message Function {
|
||||
repeated GoDiff functionContext = 1;
|
||||
GoDiff functionName = 2;
|
||||
repeated GoDiff functionParameters = 3;
|
||||
GoDiff functionBody = 4;
|
||||
}
|
||||
|
||||
message Method {
|
||||
repeated GoDiff methodContext = 1;
|
||||
GoDiff methodReceiver = 2;
|
||||
GoDiff methodName = 3;
|
||||
repeated GoDiff methodParameters = 4;
|
||||
GoDiff methodBody = 5;
|
||||
}
|
||||
|
||||
message MethodSignature {
|
||||
repeated GoDiff methodSignatureContext = 1;
|
||||
GoDiff methodSignatureName = 2;
|
||||
repeated GoDiff methodSignatureParameters = 3;
|
||||
}
|
||||
|
||||
message Type {
|
||||
GoDiff typeName = 1;
|
||||
GoDiff typeKind = 2;
|
||||
}
|
||||
|
||||
message TypeAlias {
|
||||
repeated GoDiff typeAliasContext = 1;
|
||||
GoDiff typeAliasIdentifier = 2;
|
||||
GoDiff typeAliasKind = 3;
|
||||
}
|
||||
|
||||
message Plus {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Minus {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Times {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message DividedBy {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Modulo {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Power {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Negate {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message FloorDivision {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message BOr {
|
||||
GoDiff left = 1;
|
||||
GoDiff right = 2;
|
||||
}
|
||||
|
||||
message BAnd {
|
||||
GoDiff left = 1;
|
||||
GoDiff right = 2;
|
||||
}
|
||||
|
||||
message BXOr {
|
||||
GoDiff left = 1;
|
||||
GoDiff right = 2;
|
||||
}
|
||||
|
||||
message LShift {
|
||||
GoDiff left = 1;
|
||||
GoDiff right = 2;
|
||||
}
|
||||
|
||||
message RShift {
|
||||
GoDiff left = 1;
|
||||
GoDiff right = 2;
|
||||
}
|
||||
|
||||
message UnsignedRShift {
|
||||
GoDiff left = 1;
|
||||
GoDiff right = 2;
|
||||
}
|
||||
|
||||
message Complement {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message Call {
|
||||
repeated GoDiff callContext = 1;
|
||||
GoDiff callFunction = 2;
|
||||
repeated GoDiff callParams = 3;
|
||||
GoDiff callBlock = 4;
|
||||
}
|
||||
|
||||
message LessThan {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message LessThanEqual {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThan {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThanEqual {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Equal {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message StrictEqual {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Comparison {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Subscript {
|
||||
GoDiff lhs = 1;
|
||||
repeated GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Member {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message PostDecrement {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message PostIncrement {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message MemberAccess {
|
||||
GoDiff lhs = 1;
|
||||
bytes rhs = 2;
|
||||
}
|
||||
|
||||
message And {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Not {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message Or {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message XOr {
|
||||
GoDiff lhs = 1;
|
||||
GoDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Composite {
|
||||
GoDiff compositeType = 1;
|
||||
GoDiff compositeElement = 2;
|
||||
}
|
||||
|
||||
message DefaultPattern {
|
||||
GoDiff defaultPatternBody = 1;
|
||||
}
|
||||
|
||||
message Defer {
|
||||
GoDiff deferBody = 1;
|
||||
}
|
||||
|
||||
message Field {
|
||||
repeated GoDiff fieldContext = 1;
|
||||
GoDiff fieldName = 2;
|
||||
}
|
||||
|
||||
message Go {
|
||||
GoDiff goBody = 1;
|
||||
}
|
||||
|
||||
message Label {
|
||||
GoDiff labelName = 1;
|
||||
GoDiff labelStatement = 2;
|
||||
}
|
||||
|
||||
message Package {
|
||||
GoDiff packageName = 1;
|
||||
repeated GoDiff packageContents = 2;
|
||||
}
|
||||
|
||||
message Receive {
|
||||
GoDiff receiveSubject = 1;
|
||||
GoDiff receiveExpression = 2;
|
||||
}
|
||||
|
||||
message ReceiveOperator {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message Rune {
|
||||
string runeLiteral = 1;
|
||||
}
|
||||
|
||||
message Select {
|
||||
GoDiff selectCases = 1;
|
||||
}
|
||||
|
||||
message Send {
|
||||
GoDiff sendReceiver = 1;
|
||||
GoDiff sendValue = 2;
|
||||
}
|
||||
|
||||
message Slice {
|
||||
GoDiff sliceName = 1;
|
||||
GoDiff sliceLow = 2;
|
||||
GoDiff sliceHigh = 3;
|
||||
GoDiff sliceCapacity = 4;
|
||||
}
|
||||
|
||||
message TypeAssertion {
|
||||
GoDiff typeAssertionSubject = 1;
|
||||
GoDiff typeAssertionType = 2;
|
||||
}
|
||||
|
||||
message TypeConversion {
|
||||
GoDiff typeConversionType = 1;
|
||||
GoDiff typeConversionSubject = 2;
|
||||
}
|
||||
|
||||
message TypeSwitch {
|
||||
GoDiff typeSwitchSubject = 1;
|
||||
GoDiff typeSwitchCases = 2;
|
||||
}
|
||||
|
||||
message TypeSwitchGuard {
|
||||
GoDiff typeSwitchGuardSubject = 1;
|
||||
}
|
||||
|
||||
message Variadic {
|
||||
repeated GoDiff variadicContext = 1;
|
||||
GoDiff variadicIdentifier = 2;
|
||||
}
|
||||
|
||||
message BidirectionalChannel {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message ReceiveChannel {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message SendChannel {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message Import {
|
||||
ImportPath importFrom = 1;
|
||||
GoDiff importWildcardToken = 2;
|
||||
}
|
||||
|
||||
message QualifiedImport {
|
||||
ImportPath qualifiedImportFrom = 1;
|
||||
GoDiff qualifiedImportAlias = 2;
|
||||
}
|
||||
|
||||
message SideEffectImport {
|
||||
ImportPath sideEffectImportFrom = 1;
|
||||
GoDiff sideEffectImportToken = 2;
|
||||
}
|
||||
|
||||
message Array {
|
||||
repeated GoDiff arrayElements = 1;
|
||||
}
|
||||
|
||||
message Complex {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Float {
|
||||
string floatContent = 1;
|
||||
}
|
||||
|
||||
message Hash {
|
||||
repeated GoDiff hashElements = 1;
|
||||
}
|
||||
|
||||
message Integer {
|
||||
string integerContent = 1;
|
||||
}
|
||||
|
||||
message KeyValue {
|
||||
GoDiff key = 1;
|
||||
GoDiff value = 2;
|
||||
}
|
||||
|
||||
message Pointer {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message Reference {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message TextElement {
|
||||
string textElementContent = 1;
|
||||
}
|
||||
|
||||
message Assignment {
|
||||
repeated GoDiff assignmentContext = 1;
|
||||
GoDiff assignmentTarget = 2;
|
||||
GoDiff assignmentValue = 3;
|
||||
}
|
||||
|
||||
message Break {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message Continue {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message For {
|
||||
GoDiff forBefore = 1;
|
||||
GoDiff forCondition = 2;
|
||||
GoDiff forStep = 3;
|
||||
GoDiff forBody = 4;
|
||||
}
|
||||
|
||||
message ForEach {
|
||||
GoDiff forEachBinding = 1;
|
||||
GoDiff forEachSubject = 2;
|
||||
GoDiff forEachBody = 3;
|
||||
}
|
||||
|
||||
message Goto {
|
||||
GoDiff gotoLocation = 1;
|
||||
}
|
||||
|
||||
message If {
|
||||
GoDiff ifCondition = 1;
|
||||
GoDiff ifThenBody = 2;
|
||||
GoDiff ifElseBody = 3;
|
||||
}
|
||||
|
||||
message Match {
|
||||
GoDiff matchSubject = 1;
|
||||
GoDiff matchPatterns = 2;
|
||||
}
|
||||
|
||||
message NoOp {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message Pattern {
|
||||
GoDiff value = 1;
|
||||
GoDiff patternBody = 2;
|
||||
}
|
||||
|
||||
message Return {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message Statements {
|
||||
repeated GoDiff statements = 1;
|
||||
}
|
||||
|
||||
message Context {
|
||||
repeated GoDiff contextTerms = 1;
|
||||
GoDiff contextSubject = 2;
|
||||
}
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated GoDiff errorChildren = 4;
|
||||
}
|
||||
|
||||
message Empty { }
|
||||
|
||||
message Identifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message Annotation {
|
||||
GoDiff annotationSubject = 1;
|
||||
GoDiff annotationType = 2;
|
||||
}
|
||||
|
||||
message TypeArray {
|
||||
repeated GoDiff arraySize = 1;
|
||||
GoDiff arrayElementType = 2;
|
||||
}
|
||||
|
||||
message TypeFunction {
|
||||
repeated GoDiff functionParameters = 1;
|
||||
GoDiff functionReturn = 2;
|
||||
}
|
||||
|
||||
message Interface {
|
||||
repeated GoDiff values = 1;
|
||||
}
|
||||
|
||||
message Map {
|
||||
GoDiff mapKeyType = 1;
|
||||
GoDiff mapElementType = 2;
|
||||
}
|
||||
|
||||
message Parenthesized {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message TypePointer {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message TypeSlice {
|
||||
GoDiff value = 1;
|
||||
}
|
||||
|
||||
message List {
|
||||
repeated GoDiff listContent = 1;
|
||||
}
|
||||
|
||||
message String {
|
||||
repeated GoDiff stringElements = 1;
|
||||
}
|
||||
|
||||
message EscapeSequence {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message ImportPath {
|
||||
string unPath = 1;
|
||||
IsRelative pathIsRelative = 2;
|
||||
}
|
||||
|
||||
enum IsRelative {
|
||||
Unknown = 0;
|
||||
Relative = 1;
|
||||
NonRelative = 2;
|
||||
}
|
601
proto/go_term.proto
Normal file
601
proto/go_term.proto
Normal file
@ -0,0 +1,601 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.goterm;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.goterm";
|
||||
option go_package = "github.com/semantic/goterm;go";
|
||||
|
||||
message GoTerm {
|
||||
GoSyntax syntax = 1;
|
||||
}
|
||||
|
||||
message GoSyntax {
|
||||
oneof syntax {
|
||||
Comment comment = 1;
|
||||
Constructor constructor = 2;
|
||||
Function function = 3;
|
||||
Method method = 4;
|
||||
MethodSignature methodSignature = 5;
|
||||
Type type = 6;
|
||||
TypeAlias typeAlias = 7;
|
||||
Plus plus = 8;
|
||||
Minus minus = 9;
|
||||
Times times = 10;
|
||||
DividedBy dividedBy = 11;
|
||||
Modulo modulo = 12;
|
||||
Power power = 13;
|
||||
Negate negate = 14;
|
||||
FloorDivision floorDivision = 15;
|
||||
BOr bOr = 16;
|
||||
BAnd bAnd = 17;
|
||||
BXOr bXOr = 18;
|
||||
LShift lShift = 19;
|
||||
RShift rShift = 20;
|
||||
UnsignedRShift unsignedRShift = 21;
|
||||
Complement complement = 22;
|
||||
Call call = 23;
|
||||
LessThan lessThan = 24;
|
||||
LessThanEqual lessThanEqual = 25;
|
||||
GreaterThan greaterThan = 26;
|
||||
GreaterThanEqual greaterThanEqual = 27;
|
||||
Equal equal = 28;
|
||||
StrictEqual strictEqual = 29;
|
||||
Comparison comparison = 30;
|
||||
Subscript subscript = 31;
|
||||
Member member = 32;
|
||||
PostDecrement postDecrement = 33;
|
||||
PostIncrement postIncrement = 34;
|
||||
MemberAccess memberAccess = 35;
|
||||
And and = 36;
|
||||
Not not = 37;
|
||||
Or or = 38;
|
||||
XOr xOr = 39;
|
||||
Composite composite = 40;
|
||||
DefaultPattern defaultPattern = 41;
|
||||
Defer defer = 42;
|
||||
Field field = 43;
|
||||
Go go = 44;
|
||||
Label label = 45;
|
||||
Package package = 46;
|
||||
Receive receive = 47;
|
||||
ReceiveOperator receiveOperator = 48;
|
||||
Rune rune = 49;
|
||||
Select select = 50;
|
||||
Send send = 51;
|
||||
Slice slice = 52;
|
||||
TypeAssertion typeAssertion = 53;
|
||||
TypeConversion typeConversion = 54;
|
||||
TypeSwitch typeSwitch = 55;
|
||||
TypeSwitchGuard typeSwitchGuard = 56;
|
||||
Variadic variadic = 57;
|
||||
BidirectionalChannel bidirectionalChannel = 58;
|
||||
ReceiveChannel receiveChannel = 59;
|
||||
SendChannel sendChannel = 60;
|
||||
Import import = 61;
|
||||
QualifiedImport qualifiedImport = 62;
|
||||
SideEffectImport sideEffectImport = 63;
|
||||
Array array = 64;
|
||||
Complex complex = 65;
|
||||
Float float = 66;
|
||||
Hash hash = 67;
|
||||
Integer integer = 68;
|
||||
KeyValue keyValue = 69;
|
||||
Pointer pointer = 70;
|
||||
Reference reference = 71;
|
||||
TextElement textElement = 72;
|
||||
Assignment assignment = 73;
|
||||
Break break = 74;
|
||||
Continue continue = 75;
|
||||
For for = 76;
|
||||
ForEach forEach = 77;
|
||||
Goto goto = 78;
|
||||
If if = 79;
|
||||
Match match = 80;
|
||||
NoOp noOp = 81;
|
||||
Pattern pattern = 82;
|
||||
Return return = 83;
|
||||
Statements statements = 84;
|
||||
Context context = 85;
|
||||
Error error = 86;
|
||||
Empty empty = 87;
|
||||
Identifier identifier = 88;
|
||||
Annotation annotation = 89;
|
||||
TypeArray typeArray = 90;
|
||||
TypeFunction typeFunction = 91;
|
||||
Interface interface = 92;
|
||||
Map map = 93;
|
||||
Parenthesized parenthesized = 94;
|
||||
TypePointer typePointer = 95;
|
||||
TypeSlice typeSlice = 96;
|
||||
List list = 97;
|
||||
String string = 98;
|
||||
EscapeSequence escapeSequence = 99;
|
||||
}
|
||||
}
|
||||
|
||||
message Comment {
|
||||
string commentContent = 1;
|
||||
}
|
||||
|
||||
message Constructor {
|
||||
repeated GoTerm constructorContext = 1;
|
||||
GoTerm constructorName = 2;
|
||||
GoTerm constructorFields = 3;
|
||||
}
|
||||
|
||||
message Function {
|
||||
repeated GoTerm functionContext = 1;
|
||||
GoTerm functionName = 2;
|
||||
repeated GoTerm functionParameters = 3;
|
||||
GoTerm functionBody = 4;
|
||||
}
|
||||
|
||||
message Method {
|
||||
repeated GoTerm methodContext = 1;
|
||||
GoTerm methodReceiver = 2;
|
||||
GoTerm methodName = 3;
|
||||
repeated GoTerm methodParameters = 4;
|
||||
GoTerm methodBody = 5;
|
||||
}
|
||||
|
||||
message MethodSignature {
|
||||
repeated GoTerm methodSignatureContext = 1;
|
||||
GoTerm methodSignatureName = 2;
|
||||
repeated GoTerm methodSignatureParameters = 3;
|
||||
}
|
||||
|
||||
message Type {
|
||||
GoTerm typeName = 1;
|
||||
GoTerm typeKind = 2;
|
||||
}
|
||||
|
||||
message TypeAlias {
|
||||
repeated GoTerm typeAliasContext = 1;
|
||||
GoTerm typeAliasIdentifier = 2;
|
||||
GoTerm typeAliasKind = 3;
|
||||
}
|
||||
|
||||
message Plus {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Minus {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Times {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message DividedBy {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Modulo {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Power {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Negate {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message FloorDivision {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message BOr {
|
||||
GoTerm left = 1;
|
||||
GoTerm right = 2;
|
||||
}
|
||||
|
||||
message BAnd {
|
||||
GoTerm left = 1;
|
||||
GoTerm right = 2;
|
||||
}
|
||||
|
||||
message BXOr {
|
||||
GoTerm left = 1;
|
||||
GoTerm right = 2;
|
||||
}
|
||||
|
||||
message LShift {
|
||||
GoTerm left = 1;
|
||||
GoTerm right = 2;
|
||||
}
|
||||
|
||||
message RShift {
|
||||
GoTerm left = 1;
|
||||
GoTerm right = 2;
|
||||
}
|
||||
|
||||
message UnsignedRShift {
|
||||
GoTerm left = 1;
|
||||
GoTerm right = 2;
|
||||
}
|
||||
|
||||
message Complement {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message Call {
|
||||
repeated GoTerm callContext = 1;
|
||||
GoTerm callFunction = 2;
|
||||
repeated GoTerm callParams = 3;
|
||||
GoTerm callBlock = 4;
|
||||
}
|
||||
|
||||
message LessThan {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message LessThanEqual {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThan {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThanEqual {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Equal {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message StrictEqual {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Comparison {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Subscript {
|
||||
GoTerm lhs = 1;
|
||||
repeated GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Member {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message PostDecrement {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message PostIncrement {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message MemberAccess {
|
||||
GoTerm lhs = 1;
|
||||
bytes rhs = 2;
|
||||
}
|
||||
|
||||
message And {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Not {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message Or {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message XOr {
|
||||
GoTerm lhs = 1;
|
||||
GoTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Composite {
|
||||
GoTerm compositeType = 1;
|
||||
GoTerm compositeElement = 2;
|
||||
}
|
||||
|
||||
message DefaultPattern {
|
||||
GoTerm defaultPatternBody = 1;
|
||||
}
|
||||
|
||||
message Defer {
|
||||
GoTerm deferBody = 1;
|
||||
}
|
||||
|
||||
message Field {
|
||||
repeated GoTerm fieldContext = 1;
|
||||
GoTerm fieldName = 2;
|
||||
}
|
||||
|
||||
message Go {
|
||||
GoTerm goBody = 1;
|
||||
}
|
||||
|
||||
message Label {
|
||||
GoTerm labelName = 1;
|
||||
GoTerm labelStatement = 2;
|
||||
}
|
||||
|
||||
message Package {
|
||||
GoTerm packageName = 1;
|
||||
repeated GoTerm packageContents = 2;
|
||||
}
|
||||
|
||||
message Receive {
|
||||
GoTerm receiveSubject = 1;
|
||||
GoTerm receiveExpression = 2;
|
||||
}
|
||||
|
||||
message ReceiveOperator {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message Rune {
|
||||
string runeLiteral = 1;
|
||||
}
|
||||
|
||||
message Select {
|
||||
GoTerm selectCases = 1;
|
||||
}
|
||||
|
||||
message Send {
|
||||
GoTerm sendReceiver = 1;
|
||||
GoTerm sendValue = 2;
|
||||
}
|
||||
|
||||
message Slice {
|
||||
GoTerm sliceName = 1;
|
||||
GoTerm sliceLow = 2;
|
||||
GoTerm sliceHigh = 3;
|
||||
GoTerm sliceCapacity = 4;
|
||||
}
|
||||
|
||||
message TypeAssertion {
|
||||
GoTerm typeAssertionSubject = 1;
|
||||
GoTerm typeAssertionType = 2;
|
||||
}
|
||||
|
||||
message TypeConversion {
|
||||
GoTerm typeConversionType = 1;
|
||||
GoTerm typeConversionSubject = 2;
|
||||
}
|
||||
|
||||
message TypeSwitch {
|
||||
GoTerm typeSwitchSubject = 1;
|
||||
GoTerm typeSwitchCases = 2;
|
||||
}
|
||||
|
||||
message TypeSwitchGuard {
|
||||
GoTerm typeSwitchGuardSubject = 1;
|
||||
}
|
||||
|
||||
message Variadic {
|
||||
repeated GoTerm variadicContext = 1;
|
||||
GoTerm variadicIdentifier = 2;
|
||||
}
|
||||
|
||||
message BidirectionalChannel {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message ReceiveChannel {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message SendChannel {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message Import {
|
||||
ImportPath importFrom = 1;
|
||||
GoTerm importWildcardToken = 2;
|
||||
}
|
||||
|
||||
message QualifiedImport {
|
||||
ImportPath qualifiedImportFrom = 1;
|
||||
GoTerm qualifiedImportAlias = 2;
|
||||
}
|
||||
|
||||
message SideEffectImport {
|
||||
ImportPath sideEffectImportFrom = 1;
|
||||
GoTerm sideEffectImportToken = 2;
|
||||
}
|
||||
|
||||
message Array {
|
||||
repeated GoTerm arrayElements = 1;
|
||||
}
|
||||
|
||||
message Complex {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Float {
|
||||
string floatContent = 1;
|
||||
}
|
||||
|
||||
message Hash {
|
||||
repeated GoTerm hashElements = 1;
|
||||
}
|
||||
|
||||
message Integer {
|
||||
string integerContent = 1;
|
||||
}
|
||||
|
||||
message KeyValue {
|
||||
GoTerm key = 1;
|
||||
GoTerm value = 2;
|
||||
}
|
||||
|
||||
message Pointer {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message Reference {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message TextElement {
|
||||
string textElementContent = 1;
|
||||
}
|
||||
|
||||
message Assignment {
|
||||
repeated GoTerm assignmentContext = 1;
|
||||
GoTerm assignmentTarget = 2;
|
||||
GoTerm assignmentValue = 3;
|
||||
}
|
||||
|
||||
message Break {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message Continue {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message For {
|
||||
GoTerm forBefore = 1;
|
||||
GoTerm forCondition = 2;
|
||||
GoTerm forStep = 3;
|
||||
GoTerm forBody = 4;
|
||||
}
|
||||
|
||||
message ForEach {
|
||||
GoTerm forEachBinding = 1;
|
||||
GoTerm forEachSubject = 2;
|
||||
GoTerm forEachBody = 3;
|
||||
}
|
||||
|
||||
message Goto {
|
||||
GoTerm gotoLocation = 1;
|
||||
}
|
||||
|
||||
message If {
|
||||
GoTerm ifCondition = 1;
|
||||
GoTerm ifThenBody = 2;
|
||||
GoTerm ifElseBody = 3;
|
||||
}
|
||||
|
||||
message Match {
|
||||
GoTerm matchSubject = 1;
|
||||
GoTerm matchPatterns = 2;
|
||||
}
|
||||
|
||||
message NoOp {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message Pattern {
|
||||
GoTerm value = 1;
|
||||
GoTerm patternBody = 2;
|
||||
}
|
||||
|
||||
message Return {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message Statements {
|
||||
repeated GoTerm statements = 1;
|
||||
}
|
||||
|
||||
message Context {
|
||||
repeated GoTerm contextTerms = 1;
|
||||
GoTerm contextSubject = 2;
|
||||
}
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated GoTerm errorChildren = 4;
|
||||
}
|
||||
|
||||
message Empty { }
|
||||
|
||||
message Identifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message Annotation {
|
||||
GoTerm annotationSubject = 1;
|
||||
GoTerm annotationType = 2;
|
||||
}
|
||||
|
||||
message TypeArray {
|
||||
repeated GoTerm arraySize = 1;
|
||||
GoTerm arrayElementType = 2;
|
||||
}
|
||||
|
||||
message TypeFunction {
|
||||
repeated GoTerm functionParameters = 1;
|
||||
GoTerm functionReturn = 2;
|
||||
}
|
||||
|
||||
message Interface {
|
||||
repeated GoTerm values = 1;
|
||||
}
|
||||
|
||||
message Map {
|
||||
GoTerm mapKeyType = 1;
|
||||
GoTerm mapElementType = 2;
|
||||
}
|
||||
|
||||
message Parenthesized {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message TypePointer {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message TypeSlice {
|
||||
GoTerm value = 1;
|
||||
}
|
||||
|
||||
message List {
|
||||
repeated GoTerm listContent = 1;
|
||||
}
|
||||
|
||||
message String {
|
||||
repeated GoTerm stringElements = 1;
|
||||
}
|
||||
|
||||
message EscapeSequence {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message ImportPath {
|
||||
string unPath = 1;
|
||||
IsRelative pathIsRelative = 2;
|
||||
}
|
||||
|
||||
enum IsRelative {
|
||||
Unknown = 0;
|
||||
Relative = 1;
|
||||
NonRelative = 2;
|
||||
}
|
800
proto/haskell_diff.proto
Normal file
800
proto/haskell_diff.proto
Normal file
@ -0,0 +1,800 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.haskelldiff;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.haskelldiff";
|
||||
option go_package = "github.com/semantic/haskelldiff;haskell";
|
||||
|
||||
message HaskellDiff {
|
||||
oneof diff {
|
||||
Merge merge = 1;
|
||||
Delete delete = 2;
|
||||
Insert insert = 3;
|
||||
Replace replace = 4;
|
||||
}
|
||||
message Merge {
|
||||
HaskellSyntax syntax = 1;
|
||||
}
|
||||
message Delete {
|
||||
HaskellSyntax before = 1;
|
||||
}
|
||||
message Insert {
|
||||
HaskellSyntax after = 1;
|
||||
}
|
||||
message Replace {
|
||||
HaskellSyntax before = 1;
|
||||
HaskellSyntax after = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message HaskellSyntax {
|
||||
oneof syntax {
|
||||
Comment comment = 1;
|
||||
Constructor constructor = 2;
|
||||
Datatype datatype = 3;
|
||||
Function function = 4;
|
||||
Array array = 5;
|
||||
Character character = 6;
|
||||
Float float = 7;
|
||||
Integer integer = 8;
|
||||
TextElement textElement = 9;
|
||||
Tuple tuple = 10;
|
||||
If if = 11;
|
||||
Match match = 12;
|
||||
Pattern pattern = 13;
|
||||
AllConstructors allConstructors = 14;
|
||||
AnnotatedTypeVariable annotatedTypeVariable = 15;
|
||||
App app = 16;
|
||||
ArithmeticSequence arithmeticSequence = 17;
|
||||
AsPattern asPattern = 18;
|
||||
BindPattern bindPattern = 19;
|
||||
CaseGuardPattern caseGuardPattern = 20;
|
||||
Class class = 21;
|
||||
ConstructorIdentifier constructorIdentifier = 22;
|
||||
ConstructorOperator constructorOperator = 23;
|
||||
ConstructorPattern constructorPattern = 24;
|
||||
ConstructorSymbol constructorSymbol = 25;
|
||||
Context context = 26;
|
||||
ContextAlt contextAlt = 27;
|
||||
CPPDirective cPPDirective = 28;
|
||||
DefaultDeclaration defaultDeclaration = 29;
|
||||
DefaultSignature defaultSignature = 30;
|
||||
Deriving deriving = 31;
|
||||
Do do = 32;
|
||||
Empty empty = 33;
|
||||
Error error = 34;
|
||||
EqualityConstraint equalityConstraint = 35;
|
||||
Export export = 36;
|
||||
ExpressionTypeSignature expressionTypeSignature = 37;
|
||||
Field field = 38;
|
||||
FieldBind fieldBind = 39;
|
||||
FieldPattern fieldPattern = 40;
|
||||
FixityAlt fixityAlt = 41;
|
||||
FunctionalDependency functionalDependency = 42;
|
||||
FunctionConstructor functionConstructor = 43;
|
||||
FunctionGuardPattern functionGuardPattern = 44;
|
||||
FunctionType functionType = 45;
|
||||
GADT gADT = 46;
|
||||
GADTConstructor gADTConstructor = 47;
|
||||
Generator generator = 48;
|
||||
Guard guard = 49;
|
||||
HiddenImport hiddenImport = 50;
|
||||
Identifier identifier = 51;
|
||||
InfixConstructorIdentifier infixConstructorIdentifier = 52;
|
||||
InfixOperatorApp infixOperatorApp = 53;
|
||||
InfixVariableIdentifier infixVariableIdentifier = 54;
|
||||
ImplicitParameterIdentifier implicitParameterIdentifier = 55;
|
||||
Import import = 56;
|
||||
ImportAlias importAlias = 57;
|
||||
ImportDeclaration importDeclaration = 58;
|
||||
InfixDataConstructor infixDataConstructor = 59;
|
||||
InfixOperatorPattern infixOperatorPattern = 60;
|
||||
Instance instance = 61;
|
||||
IrrefutablePattern irrefutablePattern = 62;
|
||||
Kind kind = 63;
|
||||
KindFunctionType kindFunctionType = 64;
|
||||
KindListType kindListType = 65;
|
||||
KindParenthesizedConstructor kindParenthesizedConstructor = 66;
|
||||
KindSignature kindSignature = 67;
|
||||
KindTupleType kindTupleType = 68;
|
||||
LabeledConstruction labeledConstruction = 69;
|
||||
LabeledPattern labeledPattern = 70;
|
||||
LabeledUpdate labeledUpdate = 71;
|
||||
Lambda lambda = 72;
|
||||
LambdaCase lambdaCase = 73;
|
||||
LeftOperatorSection leftOperatorSection = 74;
|
||||
Let let = 75;
|
||||
ListComprehension listComprehension = 76;
|
||||
ListConstructor listConstructor = 77;
|
||||
ListPattern listPattern = 78;
|
||||
Module module = 79;
|
||||
ModuleExport moduleExport = 80;
|
||||
ModuleIdentifier moduleIdentifier = 81;
|
||||
NamedFieldPun namedFieldPun = 82;
|
||||
NegativeLiteral negativeLiteral = 83;
|
||||
NewType newType = 84;
|
||||
PatternGuard patternGuard = 85;
|
||||
Pragma pragma = 86;
|
||||
PrefixNegation prefixNegation = 87;
|
||||
PrimitiveConstructorIdentifier primitiveConstructorIdentifier = 88;
|
||||
PrimitiveVariableIdentifier primitiveVariableIdentifier = 89;
|
||||
PromotedTypeOperator promotedTypeOperator = 90;
|
||||
QualifiedConstructorIdentifier qualifiedConstructorIdentifier = 91;
|
||||
QualifiedInfixVariableIdentifier qualifiedInfixVariableIdentifier = 92;
|
||||
QualifiedModuleIdentifier qualifiedModuleIdentifier = 93;
|
||||
QualifiedImportDeclaration qualifiedImportDeclaration = 94;
|
||||
QualifiedTypeClassIdentifier qualifiedTypeClassIdentifier = 95;
|
||||
QualifiedTypeConstructorIdentifier qualifiedTypeConstructorIdentifier = 96;
|
||||
QualifiedVariableIdentifier qualifiedVariableIdentifier = 97;
|
||||
QuasiQuotation quasiQuotation = 98;
|
||||
QuasiQuotationDeclaration quasiQuotationDeclaration = 99;
|
||||
QuasiQuotationExpression quasiQuotationExpression = 100;
|
||||
QuasiQuotationExpressionBody quasiQuotationExpressionBody = 101;
|
||||
QuasiQuotationPattern quasiQuotationPattern = 102;
|
||||
QuasiQuotationQuoter quasiQuotationQuoter = 103;
|
||||
QuasiQuotationType quasiQuotationType = 104;
|
||||
QuotedName quotedName = 105;
|
||||
RecordDataConstructor recordDataConstructor = 106;
|
||||
RecordWildCards recordWildCards = 107;
|
||||
RightOperatorSection rightOperatorSection = 108;
|
||||
ScopedTypeVariables scopedTypeVariables = 109;
|
||||
Splice splice = 110;
|
||||
StandaloneDerivingInstance standaloneDerivingInstance = 111;
|
||||
Star star = 112;
|
||||
StrictPattern strictPattern = 113;
|
||||
StrictType strictType = 114;
|
||||
StrictTypeVariable strictTypeVariable = 115;
|
||||
TupleConstructor tupleConstructor = 116;
|
||||
TupleExpression tupleExpression = 117;
|
||||
TuplePattern tuplePattern = 118;
|
||||
Type type = 119;
|
||||
TypeApp typeApp = 120;
|
||||
TypeClass typeClass = 121;
|
||||
TypeClassIdentifier typeClassIdentifier = 122;
|
||||
TypeClassInstance typeClassInstance = 123;
|
||||
TypeConstructorExport typeConstructorExport = 124;
|
||||
TypeConstructorIdentifier typeConstructorIdentifier = 125;
|
||||
TypeFamily typeFamily = 126;
|
||||
TypeInstance typeInstance = 127;
|
||||
TypeOperator typeOperator = 128;
|
||||
TypePattern typePattern = 129;
|
||||
TypeSignature typeSignature = 130;
|
||||
TypeSynonym typeSynonym = 131;
|
||||
TypeVariableIdentifier typeVariableIdentifier = 132;
|
||||
UnitConstructor unitConstructor = 133;
|
||||
VariableIdentifier variableIdentifier = 134;
|
||||
VariableOperator variableOperator = 135;
|
||||
VariableSymbol variableSymbol = 136;
|
||||
ViewPattern viewPattern = 137;
|
||||
Wildcard wildcard = 138;
|
||||
TypeParameters typeParameters = 139;
|
||||
List list = 140;
|
||||
}
|
||||
}
|
||||
|
||||
message Comment {
|
||||
string commentContent = 1;
|
||||
}
|
||||
|
||||
message Constructor {
|
||||
repeated HaskellDiff constructorContext = 1;
|
||||
HaskellDiff constructorName = 2;
|
||||
HaskellDiff constructorFields = 3;
|
||||
}
|
||||
|
||||
message Datatype {
|
||||
HaskellDiff datatypeContext = 1;
|
||||
HaskellDiff datatypeName = 2;
|
||||
repeated HaskellDiff datatypeConstructors = 3;
|
||||
HaskellDiff datatypeDeriving = 4;
|
||||
}
|
||||
|
||||
message Function {
|
||||
repeated HaskellDiff functionContext = 1;
|
||||
HaskellDiff functionName = 2;
|
||||
repeated HaskellDiff functionParameters = 3;
|
||||
HaskellDiff functionBody = 4;
|
||||
}
|
||||
|
||||
message Array {
|
||||
repeated HaskellDiff arrayElements = 1;
|
||||
}
|
||||
|
||||
message Character {
|
||||
string characterContent = 1;
|
||||
}
|
||||
|
||||
message Float {
|
||||
string floatContent = 1;
|
||||
}
|
||||
|
||||
message Integer {
|
||||
string integerContent = 1;
|
||||
}
|
||||
|
||||
message TextElement {
|
||||
string textElementContent = 1;
|
||||
}
|
||||
|
||||
message Tuple {
|
||||
repeated HaskellDiff tupleContents = 1;
|
||||
}
|
||||
|
||||
message If {
|
||||
HaskellDiff ifCondition = 1;
|
||||
HaskellDiff ifThenBody = 2;
|
||||
HaskellDiff ifElseBody = 3;
|
||||
}
|
||||
|
||||
message Match {
|
||||
HaskellDiff matchSubject = 1;
|
||||
HaskellDiff matchPatterns = 2;
|
||||
}
|
||||
|
||||
message Pattern {
|
||||
HaskellDiff value = 1;
|
||||
HaskellDiff patternBody = 2;
|
||||
}
|
||||
|
||||
message AllConstructors { }
|
||||
|
||||
message AnnotatedTypeVariable {
|
||||
HaskellDiff annotatedTypeVariableIdentifier = 1;
|
||||
HaskellDiff annotatedTypeVariableannotation = 2;
|
||||
}
|
||||
|
||||
message App {
|
||||
HaskellDiff appLeft = 1;
|
||||
HaskellDiff appLeftTypeApp = 2;
|
||||
HaskellDiff appRight = 3;
|
||||
}
|
||||
|
||||
message ArithmeticSequence {
|
||||
HaskellDiff from = 1;
|
||||
repeated HaskellDiff next = 2;
|
||||
repeated HaskellDiff to = 3;
|
||||
}
|
||||
|
||||
message AsPattern {
|
||||
HaskellDiff asPatternLeft = 1;
|
||||
HaskellDiff asPatternRight = 2;
|
||||
}
|
||||
|
||||
message BindPattern {
|
||||
repeated HaskellDiff bindPatternLeft = 1;
|
||||
HaskellDiff bindPatternRight = 2;
|
||||
}
|
||||
|
||||
message CaseGuardPattern {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message Class {
|
||||
repeated HaskellDiff classContent = 1;
|
||||
}
|
||||
|
||||
message ConstructorIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message ConstructorOperator {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message ConstructorPattern {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message ConstructorSymbol {
|
||||
bytes constructorSymbolName = 1;
|
||||
}
|
||||
|
||||
message Context {
|
||||
repeated HaskellDiff contextTerms = 1;
|
||||
HaskellDiff contextSubject = 2;
|
||||
}
|
||||
|
||||
message ContextAlt {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message CPPDirective {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message DefaultDeclaration {
|
||||
repeated HaskellDiff defaultDeclarationContent = 1;
|
||||
}
|
||||
|
||||
message DefaultSignature {
|
||||
repeated HaskellDiff defaultSignatureName = 1;
|
||||
repeated HaskellDiff defaultSignatureContext = 2;
|
||||
HaskellDiff defaultSignatureContent = 3;
|
||||
}
|
||||
|
||||
message Deriving {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message Do {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message Empty { }
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated HaskellDiff errorChildren = 4;
|
||||
}
|
||||
|
||||
message EqualityConstraint {
|
||||
HaskellDiff equalityConstraintLeft = 1;
|
||||
HaskellDiff equalityConstraintRight = 2;
|
||||
}
|
||||
|
||||
message Export {
|
||||
HaskellDiff exportContent = 1;
|
||||
}
|
||||
|
||||
message ExpressionTypeSignature {
|
||||
repeated HaskellDiff expressionTypeSignatureName = 1;
|
||||
repeated HaskellDiff expressionTypeSignatureContext = 2;
|
||||
HaskellDiff expressionTypeSignatureContent = 3;
|
||||
}
|
||||
|
||||
message Field {
|
||||
HaskellDiff fieldName = 1;
|
||||
HaskellDiff fieldBody = 2;
|
||||
}
|
||||
|
||||
message FieldBind {
|
||||
HaskellDiff fieldBindLeft = 1;
|
||||
HaskellDiff fieldBindRight = 2;
|
||||
}
|
||||
|
||||
message FieldPattern {
|
||||
HaskellDiff fieldPatternLeft = 1;
|
||||
HaskellDiff fieldPatternRight = 2;
|
||||
}
|
||||
|
||||
message FixityAlt {
|
||||
HaskellDiff fixityPrecedence = 1;
|
||||
repeated HaskellDiff fixityIdentifier = 2;
|
||||
}
|
||||
|
||||
message FunctionalDependency {
|
||||
HaskellDiff functionalDependencyContent = 1;
|
||||
}
|
||||
|
||||
message FunctionConstructor { }
|
||||
|
||||
message FunctionGuardPattern {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message FunctionType {
|
||||
HaskellDiff functionTypeLeft = 1;
|
||||
HaskellDiff functionTypeRight = 2;
|
||||
}
|
||||
|
||||
message GADT {
|
||||
HaskellDiff gadtContext = 1;
|
||||
HaskellDiff gadtName = 2;
|
||||
HaskellDiff gadtConstructors = 3;
|
||||
}
|
||||
|
||||
message GADTConstructor {
|
||||
HaskellDiff gadtConstructorContext = 1;
|
||||
HaskellDiff gadtConstructorName = 2;
|
||||
HaskellDiff gadtConstructorTypeSignature = 3;
|
||||
}
|
||||
|
||||
message Generator {
|
||||
HaskellDiff generatorValue = 1;
|
||||
HaskellDiff generatorSource = 2;
|
||||
}
|
||||
|
||||
message Guard {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message HiddenImport {
|
||||
HaskellDiff hiddenimportContent = 1;
|
||||
}
|
||||
|
||||
message Identifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message InfixConstructorIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message InfixOperatorApp {
|
||||
HaskellDiff infixOperatorAppLeft = 1;
|
||||
HaskellDiff infixOperatorAppLeftTypeApp = 2;
|
||||
HaskellDiff infixOperatorAppOperator = 3;
|
||||
HaskellDiff infixOperatorAppRight = 4;
|
||||
}
|
||||
|
||||
message InfixVariableIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message ImplicitParameterIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message Import {
|
||||
HaskellDiff importContent = 1;
|
||||
}
|
||||
|
||||
message ImportAlias {
|
||||
HaskellDiff importAliasSource = 1;
|
||||
HaskellDiff importAliasName = 2;
|
||||
}
|
||||
|
||||
message ImportDeclaration {
|
||||
HaskellDiff importPackageQualifiedContent = 1;
|
||||
HaskellDiff importModule = 2;
|
||||
repeated HaskellDiff importSpec = 3;
|
||||
}
|
||||
|
||||
message InfixDataConstructor {
|
||||
repeated HaskellDiff infixDataConstructorContext = 1;
|
||||
HaskellDiff infixDataConstructorLeft = 2;
|
||||
HaskellDiff infixDataConstructorOperator = 3;
|
||||
HaskellDiff infixDataConstructorRight = 4;
|
||||
}
|
||||
|
||||
message InfixOperatorPattern {
|
||||
HaskellDiff infixOperatorPatternLeft = 1;
|
||||
HaskellDiff infixOperatorPatternOperator = 2;
|
||||
HaskellDiff infixOperatorPatternRight = 3;
|
||||
}
|
||||
|
||||
message Instance {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message IrrefutablePattern {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message Kind {
|
||||
HaskellDiff kindKind = 1;
|
||||
}
|
||||
|
||||
message KindFunctionType {
|
||||
HaskellDiff kindFunctionTypeLeft = 1;
|
||||
HaskellDiff kindFunctionTypeRight = 2;
|
||||
}
|
||||
|
||||
message KindListType {
|
||||
HaskellDiff kindListTypeKind = 1;
|
||||
}
|
||||
|
||||
message KindParenthesizedConstructor {
|
||||
HaskellDiff kindParenthesizedConstructorContent = 1;
|
||||
}
|
||||
|
||||
message KindSignature {
|
||||
HaskellDiff kindSignatureContent = 1;
|
||||
}
|
||||
|
||||
message KindTupleType {
|
||||
repeated HaskellDiff kindTupleType = 1;
|
||||
}
|
||||
|
||||
message LabeledConstruction {
|
||||
HaskellDiff labeledConstructionConstructor = 1;
|
||||
repeated HaskellDiff labeledConstructionFields = 2;
|
||||
}
|
||||
|
||||
message LabeledPattern {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message LabeledUpdate {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message Lambda {
|
||||
HaskellDiff lambdaHead = 1;
|
||||
HaskellDiff lambdaBody = 2;
|
||||
}
|
||||
|
||||
message LambdaCase {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message LeftOperatorSection {
|
||||
HaskellDiff lhs = 1;
|
||||
HaskellDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Let {
|
||||
repeated HaskellDiff letStatements = 1;
|
||||
HaskellDiff letInClause = 2;
|
||||
}
|
||||
|
||||
message ListComprehension {
|
||||
HaskellDiff comprehensionValue = 1;
|
||||
repeated HaskellDiff comprehensionSource = 2;
|
||||
}
|
||||
|
||||
message ListConstructor { }
|
||||
|
||||
message ListPattern {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message Module {
|
||||
repeated HaskellDiff moduleContext = 1;
|
||||
HaskellDiff moduleIdentifier = 2;
|
||||
repeated HaskellDiff moduleExports = 3;
|
||||
HaskellDiff moduleStatements = 4;
|
||||
}
|
||||
|
||||
message ModuleExport {
|
||||
HaskellDiff moduleExportContent = 1;
|
||||
}
|
||||
|
||||
message ModuleIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message NamedFieldPun {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message NegativeLiteral {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message NewType {
|
||||
repeated HaskellDiff newTypeContext = 1;
|
||||
HaskellDiff newTypeLeft = 2;
|
||||
HaskellDiff newTypeRight = 3;
|
||||
HaskellDiff newTypeDeriving = 4;
|
||||
}
|
||||
|
||||
message PatternGuard {
|
||||
HaskellDiff patternGuardPattern = 1;
|
||||
HaskellDiff patternGuardExpression = 2;
|
||||
}
|
||||
|
||||
message Pragma {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message PrefixNegation {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message PrimitiveConstructorIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message PrimitiveVariableIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message PromotedTypeOperator {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message QualifiedConstructorIdentifier {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message QualifiedInfixVariableIdentifier {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message QualifiedModuleIdentifier {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message QualifiedImportDeclaration {
|
||||
HaskellDiff qualifiedImportPackageQualifiedContent = 1;
|
||||
HaskellDiff qualifiedImportModule = 2;
|
||||
repeated HaskellDiff qualifiedImportSpec = 3;
|
||||
}
|
||||
|
||||
message QualifiedTypeClassIdentifier {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message QualifiedTypeConstructorIdentifier {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message QualifiedVariableIdentifier {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message QuasiQuotation {
|
||||
HaskellDiff quasiQuotationHead = 1;
|
||||
HaskellDiff quasiQuotationBody = 2;
|
||||
}
|
||||
|
||||
message QuasiQuotationDeclaration { }
|
||||
|
||||
message QuasiQuotationExpression { }
|
||||
|
||||
message QuasiQuotationExpressionBody {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message QuasiQuotationPattern { }
|
||||
|
||||
message QuasiQuotationQuoter {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message QuasiQuotationType { }
|
||||
|
||||
message QuotedName {
|
||||
HaskellDiff quotedNameContent = 1;
|
||||
}
|
||||
|
||||
message RecordDataConstructor {
|
||||
repeated HaskellDiff recordDataConstructorContext = 1;
|
||||
HaskellDiff recordDataConstructorName = 2;
|
||||
HaskellDiff recordDataConstructorFields = 3;
|
||||
}
|
||||
|
||||
message RecordWildCards { }
|
||||
|
||||
message RightOperatorSection {
|
||||
HaskellDiff lhs = 1;
|
||||
HaskellDiff rhs = 2;
|
||||
}
|
||||
|
||||
message ScopedTypeVariables {
|
||||
HaskellDiff scopedTypeVariablesContent = 1;
|
||||
}
|
||||
|
||||
message Splice {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message StandaloneDerivingInstance {
|
||||
repeated HaskellDiff standaloneDerivingInstanceContext = 1;
|
||||
HaskellDiff standaloneDerivingInstanceClass = 2;
|
||||
HaskellDiff standaloneDerivingInstanceInstance = 3;
|
||||
}
|
||||
|
||||
message Star { }
|
||||
|
||||
message StrictPattern {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message StrictType {
|
||||
HaskellDiff strictTypeIdentifier = 1;
|
||||
HaskellDiff strictTypeParameters = 2;
|
||||
}
|
||||
|
||||
message StrictTypeVariable {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message TupleConstructor {
|
||||
int64 tupleConstructorArity = 1;
|
||||
}
|
||||
|
||||
message TupleExpression {
|
||||
repeated HaskellDiff values = 1;
|
||||
}
|
||||
|
||||
message TuplePattern {
|
||||
repeated HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message Type {
|
||||
HaskellDiff typeIdentifier = 1;
|
||||
HaskellDiff typeParameters = 2;
|
||||
HaskellDiff typeKindSignature = 3;
|
||||
}
|
||||
|
||||
message TypeApp {
|
||||
HaskellDiff typeAppType = 1;
|
||||
}
|
||||
|
||||
message TypeClass {
|
||||
HaskellDiff typeClassContext = 1;
|
||||
HaskellDiff typeClassIdentifier = 2;
|
||||
repeated HaskellDiff typeClassParameters = 3;
|
||||
HaskellDiff typeClassBody = 4;
|
||||
}
|
||||
|
||||
message TypeClassIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message TypeClassInstance {
|
||||
repeated HaskellDiff typeClassInstanceContext = 1;
|
||||
HaskellDiff typeClassInstanceIdentifier = 2;
|
||||
HaskellDiff typeClassInstanceInstance = 3;
|
||||
HaskellDiff typeClassInstanceBody = 4;
|
||||
}
|
||||
|
||||
message TypeConstructorExport {
|
||||
HaskellDiff typeConstructorExportContent = 1;
|
||||
}
|
||||
|
||||
message TypeConstructorIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message TypeFamily {
|
||||
HaskellDiff typeFamilyIdentifier = 1;
|
||||
repeated HaskellDiff typeFamilyParameters = 2;
|
||||
HaskellDiff typeFamilySignature = 3;
|
||||
HaskellDiff typeFamilyBody = 4;
|
||||
}
|
||||
|
||||
message TypeInstance {
|
||||
HaskellDiff typeInstanceType = 1;
|
||||
HaskellDiff typeInstanceBody = 2;
|
||||
}
|
||||
|
||||
message TypeOperator {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message TypePattern {
|
||||
HaskellDiff typePatternContent = 1;
|
||||
}
|
||||
|
||||
message TypeSignature {
|
||||
repeated HaskellDiff typeSignatureName = 1;
|
||||
repeated HaskellDiff typeSignatureContext = 2;
|
||||
HaskellDiff typeSignatureContent = 3;
|
||||
}
|
||||
|
||||
message TypeSynonym {
|
||||
HaskellDiff typeSynonymLeft = 1;
|
||||
repeated HaskellDiff typeSynonymContext = 2;
|
||||
HaskellDiff typeSynonymRight = 3;
|
||||
}
|
||||
|
||||
message TypeVariableIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message UnitConstructor { }
|
||||
|
||||
message VariableIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message VariableOperator {
|
||||
HaskellDiff value = 1;
|
||||
}
|
||||
|
||||
message VariableSymbol {
|
||||
bytes variableSymbolName = 1;
|
||||
}
|
||||
|
||||
message ViewPattern {
|
||||
HaskellDiff viewPatternLeft = 1;
|
||||
HaskellDiff viewPatternRight = 2;
|
||||
}
|
||||
|
||||
message Wildcard { }
|
||||
|
||||
message TypeParameters {
|
||||
repeated HaskellDiff terms = 1;
|
||||
}
|
||||
|
||||
message List {
|
||||
repeated HaskellDiff listContent = 1;
|
||||
}
|
782
proto/haskell_term.proto
Normal file
782
proto/haskell_term.proto
Normal file
@ -0,0 +1,782 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.haskellterm;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.haskellterm";
|
||||
option go_package = "github.com/semantic/haskellterm;haskell";
|
||||
|
||||
message HaskellTerm {
|
||||
HaskellSyntax syntax = 1;
|
||||
}
|
||||
|
||||
message HaskellSyntax {
|
||||
oneof syntax {
|
||||
Comment comment = 1;
|
||||
Constructor constructor = 2;
|
||||
Datatype datatype = 3;
|
||||
Function function = 4;
|
||||
Array array = 5;
|
||||
Character character = 6;
|
||||
Float float = 7;
|
||||
Integer integer = 8;
|
||||
TextElement textElement = 9;
|
||||
Tuple tuple = 10;
|
||||
If if = 11;
|
||||
Match match = 12;
|
||||
Pattern pattern = 13;
|
||||
AllConstructors allConstructors = 14;
|
||||
AnnotatedTypeVariable annotatedTypeVariable = 15;
|
||||
App app = 16;
|
||||
ArithmeticSequence arithmeticSequence = 17;
|
||||
AsPattern asPattern = 18;
|
||||
BindPattern bindPattern = 19;
|
||||
CaseGuardPattern caseGuardPattern = 20;
|
||||
Class class = 21;
|
||||
ConstructorIdentifier constructorIdentifier = 22;
|
||||
ConstructorOperator constructorOperator = 23;
|
||||
ConstructorPattern constructorPattern = 24;
|
||||
ConstructorSymbol constructorSymbol = 25;
|
||||
Context context = 26;
|
||||
ContextAlt contextAlt = 27;
|
||||
CPPDirective cPPDirective = 28;
|
||||
DefaultDeclaration defaultDeclaration = 29;
|
||||
DefaultSignature defaultSignature = 30;
|
||||
Deriving deriving = 31;
|
||||
Do do = 32;
|
||||
Empty empty = 33;
|
||||
Error error = 34;
|
||||
EqualityConstraint equalityConstraint = 35;
|
||||
Export export = 36;
|
||||
ExpressionTypeSignature expressionTypeSignature = 37;
|
||||
Field field = 38;
|
||||
FieldBind fieldBind = 39;
|
||||
FieldPattern fieldPattern = 40;
|
||||
FixityAlt fixityAlt = 41;
|
||||
FunctionalDependency functionalDependency = 42;
|
||||
FunctionConstructor functionConstructor = 43;
|
||||
FunctionGuardPattern functionGuardPattern = 44;
|
||||
FunctionType functionType = 45;
|
||||
GADT gADT = 46;
|
||||
GADTConstructor gADTConstructor = 47;
|
||||
Generator generator = 48;
|
||||
Guard guard = 49;
|
||||
HiddenImport hiddenImport = 50;
|
||||
Identifier identifier = 51;
|
||||
InfixConstructorIdentifier infixConstructorIdentifier = 52;
|
||||
InfixOperatorApp infixOperatorApp = 53;
|
||||
InfixVariableIdentifier infixVariableIdentifier = 54;
|
||||
ImplicitParameterIdentifier implicitParameterIdentifier = 55;
|
||||
Import import = 56;
|
||||
ImportAlias importAlias = 57;
|
||||
ImportDeclaration importDeclaration = 58;
|
||||
InfixDataConstructor infixDataConstructor = 59;
|
||||
InfixOperatorPattern infixOperatorPattern = 60;
|
||||
Instance instance = 61;
|
||||
IrrefutablePattern irrefutablePattern = 62;
|
||||
Kind kind = 63;
|
||||
KindFunctionType kindFunctionType = 64;
|
||||
KindListType kindListType = 65;
|
||||
KindParenthesizedConstructor kindParenthesizedConstructor = 66;
|
||||
KindSignature kindSignature = 67;
|
||||
KindTupleType kindTupleType = 68;
|
||||
LabeledConstruction labeledConstruction = 69;
|
||||
LabeledPattern labeledPattern = 70;
|
||||
LabeledUpdate labeledUpdate = 71;
|
||||
Lambda lambda = 72;
|
||||
LambdaCase lambdaCase = 73;
|
||||
LeftOperatorSection leftOperatorSection = 74;
|
||||
Let let = 75;
|
||||
ListComprehension listComprehension = 76;
|
||||
ListConstructor listConstructor = 77;
|
||||
ListPattern listPattern = 78;
|
||||
Module module = 79;
|
||||
ModuleExport moduleExport = 80;
|
||||
ModuleIdentifier moduleIdentifier = 81;
|
||||
NamedFieldPun namedFieldPun = 82;
|
||||
NegativeLiteral negativeLiteral = 83;
|
||||
NewType newType = 84;
|
||||
PatternGuard patternGuard = 85;
|
||||
Pragma pragma = 86;
|
||||
PrefixNegation prefixNegation = 87;
|
||||
PrimitiveConstructorIdentifier primitiveConstructorIdentifier = 88;
|
||||
PrimitiveVariableIdentifier primitiveVariableIdentifier = 89;
|
||||
PromotedTypeOperator promotedTypeOperator = 90;
|
||||
QualifiedConstructorIdentifier qualifiedConstructorIdentifier = 91;
|
||||
QualifiedInfixVariableIdentifier qualifiedInfixVariableIdentifier = 92;
|
||||
QualifiedModuleIdentifier qualifiedModuleIdentifier = 93;
|
||||
QualifiedImportDeclaration qualifiedImportDeclaration = 94;
|
||||
QualifiedTypeClassIdentifier qualifiedTypeClassIdentifier = 95;
|
||||
QualifiedTypeConstructorIdentifier qualifiedTypeConstructorIdentifier = 96;
|
||||
QualifiedVariableIdentifier qualifiedVariableIdentifier = 97;
|
||||
QuasiQuotation quasiQuotation = 98;
|
||||
QuasiQuotationDeclaration quasiQuotationDeclaration = 99;
|
||||
QuasiQuotationExpression quasiQuotationExpression = 100;
|
||||
QuasiQuotationExpressionBody quasiQuotationExpressionBody = 101;
|
||||
QuasiQuotationPattern quasiQuotationPattern = 102;
|
||||
QuasiQuotationQuoter quasiQuotationQuoter = 103;
|
||||
QuasiQuotationType quasiQuotationType = 104;
|
||||
QuotedName quotedName = 105;
|
||||
RecordDataConstructor recordDataConstructor = 106;
|
||||
RecordWildCards recordWildCards = 107;
|
||||
RightOperatorSection rightOperatorSection = 108;
|
||||
ScopedTypeVariables scopedTypeVariables = 109;
|
||||
Splice splice = 110;
|
||||
StandaloneDerivingInstance standaloneDerivingInstance = 111;
|
||||
Star star = 112;
|
||||
StrictPattern strictPattern = 113;
|
||||
StrictType strictType = 114;
|
||||
StrictTypeVariable strictTypeVariable = 115;
|
||||
TupleConstructor tupleConstructor = 116;
|
||||
TupleExpression tupleExpression = 117;
|
||||
TuplePattern tuplePattern = 118;
|
||||
Type type = 119;
|
||||
TypeApp typeApp = 120;
|
||||
TypeClass typeClass = 121;
|
||||
TypeClassIdentifier typeClassIdentifier = 122;
|
||||
TypeClassInstance typeClassInstance = 123;
|
||||
TypeConstructorExport typeConstructorExport = 124;
|
||||
TypeConstructorIdentifier typeConstructorIdentifier = 125;
|
||||
TypeFamily typeFamily = 126;
|
||||
TypeInstance typeInstance = 127;
|
||||
TypeOperator typeOperator = 128;
|
||||
TypePattern typePattern = 129;
|
||||
TypeSignature typeSignature = 130;
|
||||
TypeSynonym typeSynonym = 131;
|
||||
TypeVariableIdentifier typeVariableIdentifier = 132;
|
||||
UnitConstructor unitConstructor = 133;
|
||||
VariableIdentifier variableIdentifier = 134;
|
||||
VariableOperator variableOperator = 135;
|
||||
VariableSymbol variableSymbol = 136;
|
||||
ViewPattern viewPattern = 137;
|
||||
Wildcard wildcard = 138;
|
||||
TypeParameters typeParameters = 139;
|
||||
List list = 140;
|
||||
}
|
||||
}
|
||||
|
||||
message Comment {
|
||||
string commentContent = 1;
|
||||
}
|
||||
|
||||
message Constructor {
|
||||
repeated HaskellTerm constructorContext = 1;
|
||||
HaskellTerm constructorName = 2;
|
||||
HaskellTerm constructorFields = 3;
|
||||
}
|
||||
|
||||
message Datatype {
|
||||
HaskellTerm datatypeContext = 1;
|
||||
HaskellTerm datatypeName = 2;
|
||||
repeated HaskellTerm datatypeConstructors = 3;
|
||||
HaskellTerm datatypeDeriving = 4;
|
||||
}
|
||||
|
||||
message Function {
|
||||
repeated HaskellTerm functionContext = 1;
|
||||
HaskellTerm functionName = 2;
|
||||
repeated HaskellTerm functionParameters = 3;
|
||||
HaskellTerm functionBody = 4;
|
||||
}
|
||||
|
||||
message Array {
|
||||
repeated HaskellTerm arrayElements = 1;
|
||||
}
|
||||
|
||||
message Character {
|
||||
string characterContent = 1;
|
||||
}
|
||||
|
||||
message Float {
|
||||
string floatContent = 1;
|
||||
}
|
||||
|
||||
message Integer {
|
||||
string integerContent = 1;
|
||||
}
|
||||
|
||||
message TextElement {
|
||||
string textElementContent = 1;
|
||||
}
|
||||
|
||||
message Tuple {
|
||||
repeated HaskellTerm tupleContents = 1;
|
||||
}
|
||||
|
||||
message If {
|
||||
HaskellTerm ifCondition = 1;
|
||||
HaskellTerm ifThenBody = 2;
|
||||
HaskellTerm ifElseBody = 3;
|
||||
}
|
||||
|
||||
message Match {
|
||||
HaskellTerm matchSubject = 1;
|
||||
HaskellTerm matchPatterns = 2;
|
||||
}
|
||||
|
||||
message Pattern {
|
||||
HaskellTerm value = 1;
|
||||
HaskellTerm patternBody = 2;
|
||||
}
|
||||
|
||||
message AllConstructors { }
|
||||
|
||||
message AnnotatedTypeVariable {
|
||||
HaskellTerm annotatedTypeVariableIdentifier = 1;
|
||||
HaskellTerm annotatedTypeVariableannotation = 2;
|
||||
}
|
||||
|
||||
message App {
|
||||
HaskellTerm appLeft = 1;
|
||||
HaskellTerm appLeftTypeApp = 2;
|
||||
HaskellTerm appRight = 3;
|
||||
}
|
||||
|
||||
message ArithmeticSequence {
|
||||
HaskellTerm from = 1;
|
||||
repeated HaskellTerm next = 2;
|
||||
repeated HaskellTerm to = 3;
|
||||
}
|
||||
|
||||
message AsPattern {
|
||||
HaskellTerm asPatternLeft = 1;
|
||||
HaskellTerm asPatternRight = 2;
|
||||
}
|
||||
|
||||
message BindPattern {
|
||||
repeated HaskellTerm bindPatternLeft = 1;
|
||||
HaskellTerm bindPatternRight = 2;
|
||||
}
|
||||
|
||||
message CaseGuardPattern {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message Class {
|
||||
repeated HaskellTerm classContent = 1;
|
||||
}
|
||||
|
||||
message ConstructorIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message ConstructorOperator {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message ConstructorPattern {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message ConstructorSymbol {
|
||||
bytes constructorSymbolName = 1;
|
||||
}
|
||||
|
||||
message Context {
|
||||
repeated HaskellTerm contextTerms = 1;
|
||||
HaskellTerm contextSubject = 2;
|
||||
}
|
||||
|
||||
message ContextAlt {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message CPPDirective {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message DefaultDeclaration {
|
||||
repeated HaskellTerm defaultDeclarationContent = 1;
|
||||
}
|
||||
|
||||
message DefaultSignature {
|
||||
repeated HaskellTerm defaultSignatureName = 1;
|
||||
repeated HaskellTerm defaultSignatureContext = 2;
|
||||
HaskellTerm defaultSignatureContent = 3;
|
||||
}
|
||||
|
||||
message Deriving {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message Do {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message Empty { }
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated HaskellTerm errorChildren = 4;
|
||||
}
|
||||
|
||||
message EqualityConstraint {
|
||||
HaskellTerm equalityConstraintLeft = 1;
|
||||
HaskellTerm equalityConstraintRight = 2;
|
||||
}
|
||||
|
||||
message Export {
|
||||
HaskellTerm exportContent = 1;
|
||||
}
|
||||
|
||||
message ExpressionTypeSignature {
|
||||
repeated HaskellTerm expressionTypeSignatureName = 1;
|
||||
repeated HaskellTerm expressionTypeSignatureContext = 2;
|
||||
HaskellTerm expressionTypeSignatureContent = 3;
|
||||
}
|
||||
|
||||
message Field {
|
||||
HaskellTerm fieldName = 1;
|
||||
HaskellTerm fieldBody = 2;
|
||||
}
|
||||
|
||||
message FieldBind {
|
||||
HaskellTerm fieldBindLeft = 1;
|
||||
HaskellTerm fieldBindRight = 2;
|
||||
}
|
||||
|
||||
message FieldPattern {
|
||||
HaskellTerm fieldPatternLeft = 1;
|
||||
HaskellTerm fieldPatternRight = 2;
|
||||
}
|
||||
|
||||
message FixityAlt {
|
||||
HaskellTerm fixityPrecedence = 1;
|
||||
repeated HaskellTerm fixityIdentifier = 2;
|
||||
}
|
||||
|
||||
message FunctionalDependency {
|
||||
HaskellTerm functionalDependencyContent = 1;
|
||||
}
|
||||
|
||||
message FunctionConstructor { }
|
||||
|
||||
message FunctionGuardPattern {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message FunctionType {
|
||||
HaskellTerm functionTypeLeft = 1;
|
||||
HaskellTerm functionTypeRight = 2;
|
||||
}
|
||||
|
||||
message GADT {
|
||||
HaskellTerm gadtContext = 1;
|
||||
HaskellTerm gadtName = 2;
|
||||
HaskellTerm gadtConstructors = 3;
|
||||
}
|
||||
|
||||
message GADTConstructor {
|
||||
HaskellTerm gadtConstructorContext = 1;
|
||||
HaskellTerm gadtConstructorName = 2;
|
||||
HaskellTerm gadtConstructorTypeSignature = 3;
|
||||
}
|
||||
|
||||
message Generator {
|
||||
HaskellTerm generatorValue = 1;
|
||||
HaskellTerm generatorSource = 2;
|
||||
}
|
||||
|
||||
message Guard {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message HiddenImport {
|
||||
HaskellTerm hiddenimportContent = 1;
|
||||
}
|
||||
|
||||
message Identifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message InfixConstructorIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message InfixOperatorApp {
|
||||
HaskellTerm infixOperatorAppLeft = 1;
|
||||
HaskellTerm infixOperatorAppLeftTypeApp = 2;
|
||||
HaskellTerm infixOperatorAppOperator = 3;
|
||||
HaskellTerm infixOperatorAppRight = 4;
|
||||
}
|
||||
|
||||
message InfixVariableIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message ImplicitParameterIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message Import {
|
||||
HaskellTerm importContent = 1;
|
||||
}
|
||||
|
||||
message ImportAlias {
|
||||
HaskellTerm importAliasSource = 1;
|
||||
HaskellTerm importAliasName = 2;
|
||||
}
|
||||
|
||||
message ImportDeclaration {
|
||||
HaskellTerm importPackageQualifiedContent = 1;
|
||||
HaskellTerm importModule = 2;
|
||||
repeated HaskellTerm importSpec = 3;
|
||||
}
|
||||
|
||||
message InfixDataConstructor {
|
||||
repeated HaskellTerm infixDataConstructorContext = 1;
|
||||
HaskellTerm infixDataConstructorLeft = 2;
|
||||
HaskellTerm infixDataConstructorOperator = 3;
|
||||
HaskellTerm infixDataConstructorRight = 4;
|
||||
}
|
||||
|
||||
message InfixOperatorPattern {
|
||||
HaskellTerm infixOperatorPatternLeft = 1;
|
||||
HaskellTerm infixOperatorPatternOperator = 2;
|
||||
HaskellTerm infixOperatorPatternRight = 3;
|
||||
}
|
||||
|
||||
message Instance {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message IrrefutablePattern {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message Kind {
|
||||
HaskellTerm kindKind = 1;
|
||||
}
|
||||
|
||||
message KindFunctionType {
|
||||
HaskellTerm kindFunctionTypeLeft = 1;
|
||||
HaskellTerm kindFunctionTypeRight = 2;
|
||||
}
|
||||
|
||||
message KindListType {
|
||||
HaskellTerm kindListTypeKind = 1;
|
||||
}
|
||||
|
||||
message KindParenthesizedConstructor {
|
||||
HaskellTerm kindParenthesizedConstructorContent = 1;
|
||||
}
|
||||
|
||||
message KindSignature {
|
||||
HaskellTerm kindSignatureContent = 1;
|
||||
}
|
||||
|
||||
message KindTupleType {
|
||||
repeated HaskellTerm kindTupleType = 1;
|
||||
}
|
||||
|
||||
message LabeledConstruction {
|
||||
HaskellTerm labeledConstructionConstructor = 1;
|
||||
repeated HaskellTerm labeledConstructionFields = 2;
|
||||
}
|
||||
|
||||
message LabeledPattern {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message LabeledUpdate {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message Lambda {
|
||||
HaskellTerm lambdaHead = 1;
|
||||
HaskellTerm lambdaBody = 2;
|
||||
}
|
||||
|
||||
message LambdaCase {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message LeftOperatorSection {
|
||||
HaskellTerm lhs = 1;
|
||||
HaskellTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Let {
|
||||
repeated HaskellTerm letStatements = 1;
|
||||
HaskellTerm letInClause = 2;
|
||||
}
|
||||
|
||||
message ListComprehension {
|
||||
HaskellTerm comprehensionValue = 1;
|
||||
repeated HaskellTerm comprehensionSource = 2;
|
||||
}
|
||||
|
||||
message ListConstructor { }
|
||||
|
||||
message ListPattern {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message Module {
|
||||
repeated HaskellTerm moduleContext = 1;
|
||||
HaskellTerm moduleIdentifier = 2;
|
||||
repeated HaskellTerm moduleExports = 3;
|
||||
HaskellTerm moduleStatements = 4;
|
||||
}
|
||||
|
||||
message ModuleExport {
|
||||
HaskellTerm moduleExportContent = 1;
|
||||
}
|
||||
|
||||
message ModuleIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message NamedFieldPun {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message NegativeLiteral {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message NewType {
|
||||
repeated HaskellTerm newTypeContext = 1;
|
||||
HaskellTerm newTypeLeft = 2;
|
||||
HaskellTerm newTypeRight = 3;
|
||||
HaskellTerm newTypeDeriving = 4;
|
||||
}
|
||||
|
||||
message PatternGuard {
|
||||
HaskellTerm patternGuardPattern = 1;
|
||||
HaskellTerm patternGuardExpression = 2;
|
||||
}
|
||||
|
||||
message Pragma {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message PrefixNegation {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message PrimitiveConstructorIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message PrimitiveVariableIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message PromotedTypeOperator {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message QualifiedConstructorIdentifier {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message QualifiedInfixVariableIdentifier {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message QualifiedModuleIdentifier {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message QualifiedImportDeclaration {
|
||||
HaskellTerm qualifiedImportPackageQualifiedContent = 1;
|
||||
HaskellTerm qualifiedImportModule = 2;
|
||||
repeated HaskellTerm qualifiedImportSpec = 3;
|
||||
}
|
||||
|
||||
message QualifiedTypeClassIdentifier {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message QualifiedTypeConstructorIdentifier {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message QualifiedVariableIdentifier {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message QuasiQuotation {
|
||||
HaskellTerm quasiQuotationHead = 1;
|
||||
HaskellTerm quasiQuotationBody = 2;
|
||||
}
|
||||
|
||||
message QuasiQuotationDeclaration { }
|
||||
|
||||
message QuasiQuotationExpression { }
|
||||
|
||||
message QuasiQuotationExpressionBody {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message QuasiQuotationPattern { }
|
||||
|
||||
message QuasiQuotationQuoter {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message QuasiQuotationType { }
|
||||
|
||||
message QuotedName {
|
||||
HaskellTerm quotedNameContent = 1;
|
||||
}
|
||||
|
||||
message RecordDataConstructor {
|
||||
repeated HaskellTerm recordDataConstructorContext = 1;
|
||||
HaskellTerm recordDataConstructorName = 2;
|
||||
HaskellTerm recordDataConstructorFields = 3;
|
||||
}
|
||||
|
||||
message RecordWildCards { }
|
||||
|
||||
message RightOperatorSection {
|
||||
HaskellTerm lhs = 1;
|
||||
HaskellTerm rhs = 2;
|
||||
}
|
||||
|
||||
message ScopedTypeVariables {
|
||||
HaskellTerm scopedTypeVariablesContent = 1;
|
||||
}
|
||||
|
||||
message Splice {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message StandaloneDerivingInstance {
|
||||
repeated HaskellTerm standaloneDerivingInstanceContext = 1;
|
||||
HaskellTerm standaloneDerivingInstanceClass = 2;
|
||||
HaskellTerm standaloneDerivingInstanceInstance = 3;
|
||||
}
|
||||
|
||||
message Star { }
|
||||
|
||||
message StrictPattern {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message StrictType {
|
||||
HaskellTerm strictTypeIdentifier = 1;
|
||||
HaskellTerm strictTypeParameters = 2;
|
||||
}
|
||||
|
||||
message StrictTypeVariable {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message TupleConstructor {
|
||||
int64 tupleConstructorArity = 1;
|
||||
}
|
||||
|
||||
message TupleExpression {
|
||||
repeated HaskellTerm values = 1;
|
||||
}
|
||||
|
||||
message TuplePattern {
|
||||
repeated HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message Type {
|
||||
HaskellTerm typeIdentifier = 1;
|
||||
HaskellTerm typeParameters = 2;
|
||||
HaskellTerm typeKindSignature = 3;
|
||||
}
|
||||
|
||||
message TypeApp {
|
||||
HaskellTerm typeAppType = 1;
|
||||
}
|
||||
|
||||
message TypeClass {
|
||||
HaskellTerm typeClassContext = 1;
|
||||
HaskellTerm typeClassIdentifier = 2;
|
||||
repeated HaskellTerm typeClassParameters = 3;
|
||||
HaskellTerm typeClassBody = 4;
|
||||
}
|
||||
|
||||
message TypeClassIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message TypeClassInstance {
|
||||
repeated HaskellTerm typeClassInstanceContext = 1;
|
||||
HaskellTerm typeClassInstanceIdentifier = 2;
|
||||
HaskellTerm typeClassInstanceInstance = 3;
|
||||
HaskellTerm typeClassInstanceBody = 4;
|
||||
}
|
||||
|
||||
message TypeConstructorExport {
|
||||
HaskellTerm typeConstructorExportContent = 1;
|
||||
}
|
||||
|
||||
message TypeConstructorIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message TypeFamily {
|
||||
HaskellTerm typeFamilyIdentifier = 1;
|
||||
repeated HaskellTerm typeFamilyParameters = 2;
|
||||
HaskellTerm typeFamilySignature = 3;
|
||||
HaskellTerm typeFamilyBody = 4;
|
||||
}
|
||||
|
||||
message TypeInstance {
|
||||
HaskellTerm typeInstanceType = 1;
|
||||
HaskellTerm typeInstanceBody = 2;
|
||||
}
|
||||
|
||||
message TypeOperator {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message TypePattern {
|
||||
HaskellTerm typePatternContent = 1;
|
||||
}
|
||||
|
||||
message TypeSignature {
|
||||
repeated HaskellTerm typeSignatureName = 1;
|
||||
repeated HaskellTerm typeSignatureContext = 2;
|
||||
HaskellTerm typeSignatureContent = 3;
|
||||
}
|
||||
|
||||
message TypeSynonym {
|
||||
HaskellTerm typeSynonymLeft = 1;
|
||||
repeated HaskellTerm typeSynonymContext = 2;
|
||||
HaskellTerm typeSynonymRight = 3;
|
||||
}
|
||||
|
||||
message TypeVariableIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message UnitConstructor { }
|
||||
|
||||
message VariableIdentifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message VariableOperator {
|
||||
HaskellTerm value = 1;
|
||||
}
|
||||
|
||||
message VariableSymbol {
|
||||
bytes variableSymbolName = 1;
|
||||
}
|
||||
|
||||
message ViewPattern {
|
||||
HaskellTerm viewPatternLeft = 1;
|
||||
HaskellTerm viewPatternRight = 2;
|
||||
}
|
||||
|
||||
message Wildcard { }
|
||||
|
||||
message TypeParameters {
|
||||
repeated HaskellTerm terms = 1;
|
||||
}
|
||||
|
||||
message List {
|
||||
repeated HaskellTerm listContent = 1;
|
||||
}
|
660
proto/java_diff.proto
Normal file
660
proto/java_diff.proto
Normal file
@ -0,0 +1,660 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.javadiff;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.javadiff";
|
||||
option go_package = "github.com/semantic/javadiff;java";
|
||||
|
||||
message JavaDiff {
|
||||
oneof diff {
|
||||
Merge merge = 1;
|
||||
Delete delete = 2;
|
||||
Insert insert = 3;
|
||||
Replace replace = 4;
|
||||
}
|
||||
message Merge {
|
||||
JavaSyntax syntax = 1;
|
||||
}
|
||||
message Delete {
|
||||
JavaSyntax before = 1;
|
||||
}
|
||||
message Insert {
|
||||
JavaSyntax after = 1;
|
||||
}
|
||||
message Replace {
|
||||
JavaSyntax before = 1;
|
||||
JavaSyntax after = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message JavaSyntax {
|
||||
oneof syntax {
|
||||
Comment comment = 1;
|
||||
Class class = 2;
|
||||
InterfaceDeclaration interfaceDeclaration = 3;
|
||||
Method method = 4;
|
||||
VariableDeclaration variableDeclaration = 5;
|
||||
Plus plus = 6;
|
||||
Minus minus = 7;
|
||||
Times times = 8;
|
||||
DividedBy dividedBy = 9;
|
||||
Modulo modulo = 10;
|
||||
Power power = 11;
|
||||
Negate negate = 12;
|
||||
FloorDivision floorDivision = 13;
|
||||
Call call = 14;
|
||||
LessThan lessThan = 15;
|
||||
LessThanEqual lessThanEqual = 16;
|
||||
GreaterThan greaterThan = 17;
|
||||
GreaterThanEqual greaterThanEqual = 18;
|
||||
Equal equal = 19;
|
||||
StrictEqual strictEqual = 20;
|
||||
Comparison comparison = 21;
|
||||
BOr bOr = 22;
|
||||
BXOr bXOr = 23;
|
||||
BAnd bAnd = 24;
|
||||
LShift lShift = 25;
|
||||
RShift rShift = 26;
|
||||
UnsignedRShift unsignedRShift = 27;
|
||||
Complement complement = 28;
|
||||
And and = 29;
|
||||
Not not = 30;
|
||||
Or or = 31;
|
||||
XOr xOr = 32;
|
||||
InstanceOf instanceOf = 33;
|
||||
MemberAccess memberAccess = 34;
|
||||
Subscript subscript = 35;
|
||||
Member member = 36;
|
||||
Super super = 37;
|
||||
This this = 38;
|
||||
AnnotatedType annotatedType = 39;
|
||||
JavaAnnotation javaAnnotation = 40;
|
||||
AnnotationField annotationField = 41;
|
||||
AnnotationTypeElement annotationTypeElement = 42;
|
||||
ArrayCreationExpression arrayCreationExpression = 43;
|
||||
AssertStatement assertStatement = 44;
|
||||
Asterisk asterisk = 45;
|
||||
CatchType catchType = 46;
|
||||
Constructor constructor = 47;
|
||||
ClassBody classBody = 48;
|
||||
ClassLiteral classLiteral = 49;
|
||||
DefaultValue defaultValue = 50;
|
||||
DimsExpr dimsExpr = 51;
|
||||
EnumDeclaration enumDeclaration = 52;
|
||||
GenericType genericType = 53;
|
||||
Import import = 54;
|
||||
Lambda lambda = 55;
|
||||
LambdaBody lambdaBody = 56;
|
||||
MethodReference methodReference = 57;
|
||||
Module module = 58;
|
||||
New new = 59;
|
||||
NewKeyword newKeyword = 60;
|
||||
Package package = 61;
|
||||
SpreadParameter spreadParameter = 62;
|
||||
StaticInitializer staticInitializer = 63;
|
||||
Synchronized synchronized = 64;
|
||||
TryWithResources tryWithResources = 65;
|
||||
TypeParameter typeParameter = 66;
|
||||
TypeWithModifiers typeWithModifiers = 67;
|
||||
Variable variable = 68;
|
||||
Wildcard wildcard = 69;
|
||||
WildcardBounds wildcardBounds = 70;
|
||||
Array array = 71;
|
||||
Boolean boolean = 72;
|
||||
Integer integer = 73;
|
||||
Float float = 74;
|
||||
Null null = 75;
|
||||
String string = 76;
|
||||
TextElement textElement = 77;
|
||||
Assignment assignment = 78;
|
||||
Break break = 79;
|
||||
Catch catch = 80;
|
||||
Continue continue = 81;
|
||||
DoWhile doWhile = 82;
|
||||
Finally finally = 83;
|
||||
For for = 84;
|
||||
ForEach forEach = 85;
|
||||
If if = 86;
|
||||
Match match = 87;
|
||||
Pattern pattern = 88;
|
||||
PostIncrement postIncrement = 89;
|
||||
PostDecrement postDecrement = 90;
|
||||
PreIncrement preIncrement = 91;
|
||||
PreDecrement preDecrement = 92;
|
||||
While while = 93;
|
||||
Statements statements = 94;
|
||||
Throw throw = 95;
|
||||
Try try = 96;
|
||||
Context context = 97;
|
||||
Empty empty = 98;
|
||||
Error error = 99;
|
||||
Identifier identifier = 100;
|
||||
AccessibilityModifier accessibilityModifier = 101;
|
||||
TypeArray typeArray = 102;
|
||||
Bool bool = 103;
|
||||
Int int = 104;
|
||||
Void void = 105;
|
||||
TypeFloat typeFloat = 106;
|
||||
Annotation annotation = 107;
|
||||
Return return = 108;
|
||||
List list = 109;
|
||||
}
|
||||
}
|
||||
|
||||
message Comment {
|
||||
string commentContent = 1;
|
||||
}
|
||||
|
||||
message Class {
|
||||
repeated JavaDiff classContext = 1;
|
||||
JavaDiff classIdentifier = 2;
|
||||
repeated JavaDiff classSuperclasses = 3;
|
||||
JavaDiff classBody = 4;
|
||||
}
|
||||
|
||||
message InterfaceDeclaration {
|
||||
repeated JavaDiff interfaceDeclarationContext = 1;
|
||||
JavaDiff interfaceDeclarationIdentifier = 2;
|
||||
repeated JavaDiff interfaceDeclarationSuperInterfaces = 3;
|
||||
JavaDiff interfaceDeclarationBody = 4;
|
||||
}
|
||||
|
||||
message Method {
|
||||
repeated JavaDiff methodContext = 1;
|
||||
JavaDiff methodReceiver = 2;
|
||||
JavaDiff methodName = 3;
|
||||
repeated JavaDiff methodParameters = 4;
|
||||
JavaDiff methodBody = 5;
|
||||
}
|
||||
|
||||
message VariableDeclaration {
|
||||
repeated JavaDiff variableDeclarations = 1;
|
||||
}
|
||||
|
||||
message Plus {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Minus {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Times {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message DividedBy {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Modulo {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Power {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Negate {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message FloorDivision {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Call {
|
||||
repeated JavaDiff callContext = 1;
|
||||
JavaDiff callFunction = 2;
|
||||
repeated JavaDiff callParams = 3;
|
||||
JavaDiff callBlock = 4;
|
||||
}
|
||||
|
||||
message LessThan {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message LessThanEqual {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThan {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThanEqual {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Equal {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message StrictEqual {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Comparison {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message BOr {
|
||||
JavaDiff left = 1;
|
||||
JavaDiff right = 2;
|
||||
}
|
||||
|
||||
message BXOr {
|
||||
JavaDiff left = 1;
|
||||
JavaDiff right = 2;
|
||||
}
|
||||
|
||||
message BAnd {
|
||||
JavaDiff left = 1;
|
||||
JavaDiff right = 2;
|
||||
}
|
||||
|
||||
message LShift {
|
||||
JavaDiff left = 1;
|
||||
JavaDiff right = 2;
|
||||
}
|
||||
|
||||
message RShift {
|
||||
JavaDiff left = 1;
|
||||
JavaDiff right = 2;
|
||||
}
|
||||
|
||||
message UnsignedRShift {
|
||||
JavaDiff left = 1;
|
||||
JavaDiff right = 2;
|
||||
}
|
||||
|
||||
message Complement {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message And {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Not {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message Or {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message XOr {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message InstanceOf {
|
||||
JavaDiff instanceOfSubject = 1;
|
||||
JavaDiff instanceOfObject = 2;
|
||||
}
|
||||
|
||||
message MemberAccess {
|
||||
JavaDiff lhs = 1;
|
||||
bytes rhs = 2;
|
||||
}
|
||||
|
||||
message Subscript {
|
||||
JavaDiff lhs = 1;
|
||||
repeated JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Member {
|
||||
JavaDiff lhs = 1;
|
||||
JavaDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Super { }
|
||||
|
||||
message This { }
|
||||
|
||||
message AnnotatedType {
|
||||
repeated JavaDiff annotationes = 1;
|
||||
JavaDiff annotatedType = 2;
|
||||
}
|
||||
|
||||
message JavaAnnotation {
|
||||
JavaDiff annotationName = 1;
|
||||
repeated JavaDiff annotationField = 2;
|
||||
}
|
||||
|
||||
message AnnotationField {
|
||||
JavaDiff annotationFieldName = 1;
|
||||
JavaDiff annotationFieldValue = 2;
|
||||
}
|
||||
|
||||
message AnnotationTypeElement {
|
||||
repeated JavaDiff modifiers = 1;
|
||||
JavaDiff annotationType = 2;
|
||||
JavaDiff identifier = 3;
|
||||
repeated JavaDiff dims = 4;
|
||||
JavaDiff defaultValue = 5;
|
||||
}
|
||||
|
||||
message ArrayCreationExpression {
|
||||
JavaDiff arrayCreationExpressionType = 1;
|
||||
repeated JavaDiff arrayCreationExpressionDims = 2;
|
||||
}
|
||||
|
||||
message AssertStatement {
|
||||
JavaDiff assertLHS = 1;
|
||||
repeated JavaDiff assertRHS = 2;
|
||||
}
|
||||
|
||||
message Asterisk { }
|
||||
|
||||
message CatchType {
|
||||
repeated JavaDiff types = 1;
|
||||
}
|
||||
|
||||
message Constructor {
|
||||
repeated JavaDiff constructorModifiers = 1;
|
||||
repeated JavaDiff constructorTypeParams = 2;
|
||||
JavaDiff constructorIdentifier = 3;
|
||||
repeated JavaDiff constructorParams = 4;
|
||||
repeated JavaDiff constructorThrows = 5;
|
||||
JavaDiff constructorBody = 6;
|
||||
}
|
||||
|
||||
message ClassBody {
|
||||
repeated JavaDiff classBodyExpression = 1;
|
||||
}
|
||||
|
||||
message ClassLiteral {
|
||||
JavaDiff classLiteralType = 1;
|
||||
}
|
||||
|
||||
message DefaultValue {
|
||||
JavaDiff defaultValueElement = 1;
|
||||
}
|
||||
|
||||
message DimsExpr {
|
||||
repeated JavaDiff dimsExprAnnotation = 1;
|
||||
repeated JavaDiff dimsExprExpression = 2;
|
||||
}
|
||||
|
||||
message EnumDeclaration {
|
||||
repeated JavaDiff enumDeclarationModifier = 1;
|
||||
JavaDiff enumDeclarationIdentifier = 2;
|
||||
repeated JavaDiff enumDeclarationSuperInterfaces = 3;
|
||||
repeated JavaDiff enumDeclarationConstant = 4;
|
||||
repeated JavaDiff enumDeclarationBody = 5;
|
||||
}
|
||||
|
||||
message GenericType {
|
||||
JavaDiff genericTypeIdentifier = 1;
|
||||
repeated JavaDiff genericTypeArguments = 2;
|
||||
}
|
||||
|
||||
message Import {
|
||||
repeated JavaDiff imports = 1;
|
||||
}
|
||||
|
||||
message Lambda {
|
||||
repeated JavaDiff lambdaParams = 1;
|
||||
JavaDiff lambdaBody = 2;
|
||||
}
|
||||
|
||||
message LambdaBody {
|
||||
repeated JavaDiff lambdaBodyExpression = 1;
|
||||
}
|
||||
|
||||
message MethodReference {
|
||||
JavaDiff methodReferenceType = 1;
|
||||
repeated JavaDiff methodReferenceTypeArgs = 2;
|
||||
JavaDiff methodReferenceIdentifier = 3;
|
||||
}
|
||||
|
||||
message Module {
|
||||
JavaDiff moduleIdentifier = 1;
|
||||
repeated JavaDiff moduleStatements = 2;
|
||||
}
|
||||
|
||||
message New {
|
||||
JavaDiff newType = 1;
|
||||
repeated JavaDiff newArgs = 2;
|
||||
repeated JavaDiff newClassBody = 3;
|
||||
}
|
||||
|
||||
message NewKeyword { }
|
||||
|
||||
message Package {
|
||||
repeated JavaDiff packages = 1;
|
||||
}
|
||||
|
||||
message SpreadParameter {
|
||||
JavaDiff spreadParameterVariableDeclarator = 1;
|
||||
}
|
||||
|
||||
message StaticInitializer {
|
||||
JavaDiff staticInitializerBlock = 1;
|
||||
}
|
||||
|
||||
message Synchronized {
|
||||
JavaDiff synchronizedSubject = 1;
|
||||
JavaDiff synchronizedBody = 2;
|
||||
}
|
||||
|
||||
message TryWithResources {
|
||||
repeated JavaDiff tryResources = 1;
|
||||
JavaDiff tryBody = 2;
|
||||
repeated JavaDiff tryCatch = 3;
|
||||
}
|
||||
|
||||
message TypeParameter {
|
||||
repeated JavaDiff typeParamAnnotation = 1;
|
||||
JavaDiff typeParamIdentifier = 2;
|
||||
repeated JavaDiff typeParamTypeBound = 3;
|
||||
}
|
||||
|
||||
message TypeWithModifiers {
|
||||
repeated JavaDiff types = 1;
|
||||
JavaDiff modifier = 2;
|
||||
}
|
||||
|
||||
message Variable {
|
||||
repeated JavaDiff variableModifiers = 1;
|
||||
JavaDiff variableType = 2;
|
||||
JavaDiff variableName = 3;
|
||||
}
|
||||
|
||||
message Wildcard {
|
||||
repeated JavaDiff wildcardAnnotation = 1;
|
||||
repeated JavaDiff wildcardBounds = 2;
|
||||
}
|
||||
|
||||
message WildcardBounds {
|
||||
oneof sum {
|
||||
JavaDiff wildcardBoundExtendsType = 1;
|
||||
JavaDiff wildcardBoundSuperType = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message Array {
|
||||
repeated JavaDiff arrayElements = 1;
|
||||
}
|
||||
|
||||
message Boolean {
|
||||
bool booleanContent = 1;
|
||||
}
|
||||
|
||||
message Integer {
|
||||
string integerContent = 1;
|
||||
}
|
||||
|
||||
message Float {
|
||||
string floatContent = 1;
|
||||
}
|
||||
|
||||
message Null { }
|
||||
|
||||
message String {
|
||||
repeated JavaDiff stringElements = 1;
|
||||
}
|
||||
|
||||
message TextElement {
|
||||
string textElementContent = 1;
|
||||
}
|
||||
|
||||
message Assignment {
|
||||
repeated JavaDiff assignmentContext = 1;
|
||||
JavaDiff assignmentTarget = 2;
|
||||
JavaDiff assignmentValue = 3;
|
||||
}
|
||||
|
||||
message Break {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message Catch {
|
||||
JavaDiff catchException = 1;
|
||||
JavaDiff catchBody = 2;
|
||||
}
|
||||
|
||||
message Continue {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message DoWhile {
|
||||
JavaDiff doWhileCondition = 1;
|
||||
JavaDiff doWhileBody = 2;
|
||||
}
|
||||
|
||||
message Finally {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message For {
|
||||
JavaDiff forBefore = 1;
|
||||
JavaDiff forCondition = 2;
|
||||
JavaDiff forStep = 3;
|
||||
JavaDiff forBody = 4;
|
||||
}
|
||||
|
||||
message ForEach {
|
||||
JavaDiff forEachBinding = 1;
|
||||
JavaDiff forEachSubject = 2;
|
||||
JavaDiff forEachBody = 3;
|
||||
}
|
||||
|
||||
message If {
|
||||
JavaDiff ifCondition = 1;
|
||||
JavaDiff ifThenBody = 2;
|
||||
JavaDiff ifElseBody = 3;
|
||||
}
|
||||
|
||||
message Match {
|
||||
JavaDiff matchSubject = 1;
|
||||
JavaDiff matchPatterns = 2;
|
||||
}
|
||||
|
||||
message Pattern {
|
||||
JavaDiff value = 1;
|
||||
JavaDiff patternBody = 2;
|
||||
}
|
||||
|
||||
message PostIncrement {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message PostDecrement {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message PreIncrement {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message PreDecrement {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message While {
|
||||
JavaDiff whileCondition = 1;
|
||||
JavaDiff whileBody = 2;
|
||||
}
|
||||
|
||||
message Statements {
|
||||
repeated JavaDiff statements = 1;
|
||||
}
|
||||
|
||||
message Throw {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message Try {
|
||||
JavaDiff tryBody = 1;
|
||||
repeated JavaDiff tryCatch = 2;
|
||||
}
|
||||
|
||||
message Context {
|
||||
repeated JavaDiff contextTerms = 1;
|
||||
JavaDiff contextSubject = 2;
|
||||
}
|
||||
|
||||
message Empty { }
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated JavaDiff errorChildren = 4;
|
||||
}
|
||||
|
||||
message Identifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message AccessibilityModifier {
|
||||
string contents = 1;
|
||||
}
|
||||
|
||||
message TypeArray {
|
||||
repeated JavaDiff arraySize = 1;
|
||||
JavaDiff arrayElementType = 2;
|
||||
}
|
||||
|
||||
message Bool { }
|
||||
|
||||
message Int { }
|
||||
|
||||
message Void { }
|
||||
|
||||
message TypeFloat { }
|
||||
|
||||
message Annotation {
|
||||
JavaDiff annotationSubject = 1;
|
||||
JavaDiff annotationType = 2;
|
||||
}
|
||||
|
||||
message Return {
|
||||
JavaDiff value = 1;
|
||||
}
|
||||
|
||||
message List {
|
||||
repeated JavaDiff listContent = 1;
|
||||
}
|
642
proto/java_term.proto
Normal file
642
proto/java_term.proto
Normal file
@ -0,0 +1,642 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.javaterm;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.javaterm";
|
||||
option go_package = "github.com/semantic/javaterm;java";
|
||||
|
||||
message JavaTerm {
|
||||
JavaSyntax syntax = 1;
|
||||
}
|
||||
|
||||
message JavaSyntax {
|
||||
oneof syntax {
|
||||
Comment comment = 1;
|
||||
Class class = 2;
|
||||
InterfaceDeclaration interfaceDeclaration = 3;
|
||||
Method method = 4;
|
||||
VariableDeclaration variableDeclaration = 5;
|
||||
Plus plus = 6;
|
||||
Minus minus = 7;
|
||||
Times times = 8;
|
||||
DividedBy dividedBy = 9;
|
||||
Modulo modulo = 10;
|
||||
Power power = 11;
|
||||
Negate negate = 12;
|
||||
FloorDivision floorDivision = 13;
|
||||
Call call = 14;
|
||||
LessThan lessThan = 15;
|
||||
LessThanEqual lessThanEqual = 16;
|
||||
GreaterThan greaterThan = 17;
|
||||
GreaterThanEqual greaterThanEqual = 18;
|
||||
Equal equal = 19;
|
||||
StrictEqual strictEqual = 20;
|
||||
Comparison comparison = 21;
|
||||
BOr bOr = 22;
|
||||
BXOr bXOr = 23;
|
||||
BAnd bAnd = 24;
|
||||
LShift lShift = 25;
|
||||
RShift rShift = 26;
|
||||
UnsignedRShift unsignedRShift = 27;
|
||||
Complement complement = 28;
|
||||
And and = 29;
|
||||
Not not = 30;
|
||||
Or or = 31;
|
||||
XOr xOr = 32;
|
||||
InstanceOf instanceOf = 33;
|
||||
MemberAccess memberAccess = 34;
|
||||
Subscript subscript = 35;
|
||||
Member member = 36;
|
||||
Super super = 37;
|
||||
This this = 38;
|
||||
AnnotatedType annotatedType = 39;
|
||||
JavaAnnotation javaAnnotation = 40;
|
||||
AnnotationField annotationField = 41;
|
||||
AnnotationTypeElement annotationTypeElement = 42;
|
||||
ArrayCreationExpression arrayCreationExpression = 43;
|
||||
AssertStatement assertStatement = 44;
|
||||
Asterisk asterisk = 45;
|
||||
CatchType catchType = 46;
|
||||
Constructor constructor = 47;
|
||||
ClassBody classBody = 48;
|
||||
ClassLiteral classLiteral = 49;
|
||||
DefaultValue defaultValue = 50;
|
||||
DimsExpr dimsExpr = 51;
|
||||
EnumDeclaration enumDeclaration = 52;
|
||||
GenericType genericType = 53;
|
||||
Import import = 54;
|
||||
Lambda lambda = 55;
|
||||
LambdaBody lambdaBody = 56;
|
||||
MethodReference methodReference = 57;
|
||||
Module module = 58;
|
||||
New new = 59;
|
||||
NewKeyword newKeyword = 60;
|
||||
Package package = 61;
|
||||
SpreadParameter spreadParameter = 62;
|
||||
StaticInitializer staticInitializer = 63;
|
||||
Synchronized synchronized = 64;
|
||||
TryWithResources tryWithResources = 65;
|
||||
TypeParameter typeParameter = 66;
|
||||
TypeWithModifiers typeWithModifiers = 67;
|
||||
Variable variable = 68;
|
||||
Wildcard wildcard = 69;
|
||||
WildcardBounds wildcardBounds = 70;
|
||||
Array array = 71;
|
||||
Boolean boolean = 72;
|
||||
Integer integer = 73;
|
||||
Float float = 74;
|
||||
Null null = 75;
|
||||
String string = 76;
|
||||
TextElement textElement = 77;
|
||||
Assignment assignment = 78;
|
||||
Break break = 79;
|
||||
Catch catch = 80;
|
||||
Continue continue = 81;
|
||||
DoWhile doWhile = 82;
|
||||
Finally finally = 83;
|
||||
For for = 84;
|
||||
ForEach forEach = 85;
|
||||
If if = 86;
|
||||
Match match = 87;
|
||||
Pattern pattern = 88;
|
||||
PostIncrement postIncrement = 89;
|
||||
PostDecrement postDecrement = 90;
|
||||
PreIncrement preIncrement = 91;
|
||||
PreDecrement preDecrement = 92;
|
||||
While while = 93;
|
||||
Statements statements = 94;
|
||||
Throw throw = 95;
|
||||
Try try = 96;
|
||||
Context context = 97;
|
||||
Empty empty = 98;
|
||||
Error error = 99;
|
||||
Identifier identifier = 100;
|
||||
AccessibilityModifier accessibilityModifier = 101;
|
||||
TypeArray typeArray = 102;
|
||||
Bool bool = 103;
|
||||
Int int = 104;
|
||||
Void void = 105;
|
||||
TypeFloat typeFloat = 106;
|
||||
Annotation annotation = 107;
|
||||
Return return = 108;
|
||||
List list = 109;
|
||||
}
|
||||
}
|
||||
|
||||
message Comment {
|
||||
string commentContent = 1;
|
||||
}
|
||||
|
||||
message Class {
|
||||
repeated JavaTerm classContext = 1;
|
||||
JavaTerm classIdentifier = 2;
|
||||
repeated JavaTerm classSuperclasses = 3;
|
||||
JavaTerm classBody = 4;
|
||||
}
|
||||
|
||||
message InterfaceDeclaration {
|
||||
repeated JavaTerm interfaceDeclarationContext = 1;
|
||||
JavaTerm interfaceDeclarationIdentifier = 2;
|
||||
repeated JavaTerm interfaceDeclarationSuperInterfaces = 3;
|
||||
JavaTerm interfaceDeclarationBody = 4;
|
||||
}
|
||||
|
||||
message Method {
|
||||
repeated JavaTerm methodContext = 1;
|
||||
JavaTerm methodReceiver = 2;
|
||||
JavaTerm methodName = 3;
|
||||
repeated JavaTerm methodParameters = 4;
|
||||
JavaTerm methodBody = 5;
|
||||
}
|
||||
|
||||
message VariableDeclaration {
|
||||
repeated JavaTerm variableDeclarations = 1;
|
||||
}
|
||||
|
||||
message Plus {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Minus {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Times {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message DividedBy {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Modulo {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Power {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Negate {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message FloorDivision {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Call {
|
||||
repeated JavaTerm callContext = 1;
|
||||
JavaTerm callFunction = 2;
|
||||
repeated JavaTerm callParams = 3;
|
||||
JavaTerm callBlock = 4;
|
||||
}
|
||||
|
||||
message LessThan {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message LessThanEqual {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThan {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThanEqual {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Equal {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message StrictEqual {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Comparison {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message BOr {
|
||||
JavaTerm left = 1;
|
||||
JavaTerm right = 2;
|
||||
}
|
||||
|
||||
message BXOr {
|
||||
JavaTerm left = 1;
|
||||
JavaTerm right = 2;
|
||||
}
|
||||
|
||||
message BAnd {
|
||||
JavaTerm left = 1;
|
||||
JavaTerm right = 2;
|
||||
}
|
||||
|
||||
message LShift {
|
||||
JavaTerm left = 1;
|
||||
JavaTerm right = 2;
|
||||
}
|
||||
|
||||
message RShift {
|
||||
JavaTerm left = 1;
|
||||
JavaTerm right = 2;
|
||||
}
|
||||
|
||||
message UnsignedRShift {
|
||||
JavaTerm left = 1;
|
||||
JavaTerm right = 2;
|
||||
}
|
||||
|
||||
message Complement {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message And {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Not {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message Or {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message XOr {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message InstanceOf {
|
||||
JavaTerm instanceOfSubject = 1;
|
||||
JavaTerm instanceOfObject = 2;
|
||||
}
|
||||
|
||||
message MemberAccess {
|
||||
JavaTerm lhs = 1;
|
||||
bytes rhs = 2;
|
||||
}
|
||||
|
||||
message Subscript {
|
||||
JavaTerm lhs = 1;
|
||||
repeated JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Member {
|
||||
JavaTerm lhs = 1;
|
||||
JavaTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Super { }
|
||||
|
||||
message This { }
|
||||
|
||||
message AnnotatedType {
|
||||
repeated JavaTerm annotationes = 1;
|
||||
JavaTerm annotatedType = 2;
|
||||
}
|
||||
|
||||
message JavaAnnotation {
|
||||
JavaTerm annotationName = 1;
|
||||
repeated JavaTerm annotationField = 2;
|
||||
}
|
||||
|
||||
message AnnotationField {
|
||||
JavaTerm annotationFieldName = 1;
|
||||
JavaTerm annotationFieldValue = 2;
|
||||
}
|
||||
|
||||
message AnnotationTypeElement {
|
||||
repeated JavaTerm modifiers = 1;
|
||||
JavaTerm annotationType = 2;
|
||||
JavaTerm identifier = 3;
|
||||
repeated JavaTerm dims = 4;
|
||||
JavaTerm defaultValue = 5;
|
||||
}
|
||||
|
||||
message ArrayCreationExpression {
|
||||
JavaTerm arrayCreationExpressionType = 1;
|
||||
repeated JavaTerm arrayCreationExpressionDims = 2;
|
||||
}
|
||||
|
||||
message AssertStatement {
|
||||
JavaTerm assertLHS = 1;
|
||||
repeated JavaTerm assertRHS = 2;
|
||||
}
|
||||
|
||||
message Asterisk { }
|
||||
|
||||
message CatchType {
|
||||
repeated JavaTerm types = 1;
|
||||
}
|
||||
|
||||
message Constructor {
|
||||
repeated JavaTerm constructorModifiers = 1;
|
||||
repeated JavaTerm constructorTypeParams = 2;
|
||||
JavaTerm constructorIdentifier = 3;
|
||||
repeated JavaTerm constructorParams = 4;
|
||||
repeated JavaTerm constructorThrows = 5;
|
||||
JavaTerm constructorBody = 6;
|
||||
}
|
||||
|
||||
message ClassBody {
|
||||
repeated JavaTerm classBodyExpression = 1;
|
||||
}
|
||||
|
||||
message ClassLiteral {
|
||||
JavaTerm classLiteralType = 1;
|
||||
}
|
||||
|
||||
message DefaultValue {
|
||||
JavaTerm defaultValueElement = 1;
|
||||
}
|
||||
|
||||
message DimsExpr {
|
||||
repeated JavaTerm dimsExprAnnotation = 1;
|
||||
repeated JavaTerm dimsExprExpression = 2;
|
||||
}
|
||||
|
||||
message EnumDeclaration {
|
||||
repeated JavaTerm enumDeclarationModifier = 1;
|
||||
JavaTerm enumDeclarationIdentifier = 2;
|
||||
repeated JavaTerm enumDeclarationSuperInterfaces = 3;
|
||||
repeated JavaTerm enumDeclarationConstant = 4;
|
||||
repeated JavaTerm enumDeclarationBody = 5;
|
||||
}
|
||||
|
||||
message GenericType {
|
||||
JavaTerm genericTypeIdentifier = 1;
|
||||
repeated JavaTerm genericTypeArguments = 2;
|
||||
}
|
||||
|
||||
message Import {
|
||||
repeated JavaTerm imports = 1;
|
||||
}
|
||||
|
||||
message Lambda {
|
||||
repeated JavaTerm lambdaParams = 1;
|
||||
JavaTerm lambdaBody = 2;
|
||||
}
|
||||
|
||||
message LambdaBody {
|
||||
repeated JavaTerm lambdaBodyExpression = 1;
|
||||
}
|
||||
|
||||
message MethodReference {
|
||||
JavaTerm methodReferenceType = 1;
|
||||
repeated JavaTerm methodReferenceTypeArgs = 2;
|
||||
JavaTerm methodReferenceIdentifier = 3;
|
||||
}
|
||||
|
||||
message Module {
|
||||
JavaTerm moduleIdentifier = 1;
|
||||
repeated JavaTerm moduleStatements = 2;
|
||||
}
|
||||
|
||||
message New {
|
||||
JavaTerm newType = 1;
|
||||
repeated JavaTerm newArgs = 2;
|
||||
repeated JavaTerm newClassBody = 3;
|
||||
}
|
||||
|
||||
message NewKeyword { }
|
||||
|
||||
message Package {
|
||||
repeated JavaTerm packages = 1;
|
||||
}
|
||||
|
||||
message SpreadParameter {
|
||||
JavaTerm spreadParameterVariableDeclarator = 1;
|
||||
}
|
||||
|
||||
message StaticInitializer {
|
||||
JavaTerm staticInitializerBlock = 1;
|
||||
}
|
||||
|
||||
message Synchronized {
|
||||
JavaTerm synchronizedSubject = 1;
|
||||
JavaTerm synchronizedBody = 2;
|
||||
}
|
||||
|
||||
message TryWithResources {
|
||||
repeated JavaTerm tryResources = 1;
|
||||
JavaTerm tryBody = 2;
|
||||
repeated JavaTerm tryCatch = 3;
|
||||
}
|
||||
|
||||
message TypeParameter {
|
||||
repeated JavaTerm typeParamAnnotation = 1;
|
||||
JavaTerm typeParamIdentifier = 2;
|
||||
repeated JavaTerm typeParamTypeBound = 3;
|
||||
}
|
||||
|
||||
message TypeWithModifiers {
|
||||
repeated JavaTerm types = 1;
|
||||
JavaTerm modifier = 2;
|
||||
}
|
||||
|
||||
message Variable {
|
||||
repeated JavaTerm variableModifiers = 1;
|
||||
JavaTerm variableType = 2;
|
||||
JavaTerm variableName = 3;
|
||||
}
|
||||
|
||||
message Wildcard {
|
||||
repeated JavaTerm wildcardAnnotation = 1;
|
||||
repeated JavaTerm wildcardBounds = 2;
|
||||
}
|
||||
|
||||
message WildcardBounds {
|
||||
oneof sum {
|
||||
JavaTerm wildcardBoundExtendsType = 1;
|
||||
JavaTerm wildcardBoundSuperType = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message Array {
|
||||
repeated JavaTerm arrayElements = 1;
|
||||
}
|
||||
|
||||
message Boolean {
|
||||
bool booleanContent = 1;
|
||||
}
|
||||
|
||||
message Integer {
|
||||
string integerContent = 1;
|
||||
}
|
||||
|
||||
message Float {
|
||||
string floatContent = 1;
|
||||
}
|
||||
|
||||
message Null { }
|
||||
|
||||
message String {
|
||||
repeated JavaTerm stringElements = 1;
|
||||
}
|
||||
|
||||
message TextElement {
|
||||
string textElementContent = 1;
|
||||
}
|
||||
|
||||
message Assignment {
|
||||
repeated JavaTerm assignmentContext = 1;
|
||||
JavaTerm assignmentTarget = 2;
|
||||
JavaTerm assignmentValue = 3;
|
||||
}
|
||||
|
||||
message Break {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message Catch {
|
||||
JavaTerm catchException = 1;
|
||||
JavaTerm catchBody = 2;
|
||||
}
|
||||
|
||||
message Continue {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message DoWhile {
|
||||
JavaTerm doWhileCondition = 1;
|
||||
JavaTerm doWhileBody = 2;
|
||||
}
|
||||
|
||||
message Finally {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message For {
|
||||
JavaTerm forBefore = 1;
|
||||
JavaTerm forCondition = 2;
|
||||
JavaTerm forStep = 3;
|
||||
JavaTerm forBody = 4;
|
||||
}
|
||||
|
||||
message ForEach {
|
||||
JavaTerm forEachBinding = 1;
|
||||
JavaTerm forEachSubject = 2;
|
||||
JavaTerm forEachBody = 3;
|
||||
}
|
||||
|
||||
message If {
|
||||
JavaTerm ifCondition = 1;
|
||||
JavaTerm ifThenBody = 2;
|
||||
JavaTerm ifElseBody = 3;
|
||||
}
|
||||
|
||||
message Match {
|
||||
JavaTerm matchSubject = 1;
|
||||
JavaTerm matchPatterns = 2;
|
||||
}
|
||||
|
||||
message Pattern {
|
||||
JavaTerm value = 1;
|
||||
JavaTerm patternBody = 2;
|
||||
}
|
||||
|
||||
message PostIncrement {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message PostDecrement {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message PreIncrement {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message PreDecrement {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message While {
|
||||
JavaTerm whileCondition = 1;
|
||||
JavaTerm whileBody = 2;
|
||||
}
|
||||
|
||||
message Statements {
|
||||
repeated JavaTerm statements = 1;
|
||||
}
|
||||
|
||||
message Throw {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message Try {
|
||||
JavaTerm tryBody = 1;
|
||||
repeated JavaTerm tryCatch = 2;
|
||||
}
|
||||
|
||||
message Context {
|
||||
repeated JavaTerm contextTerms = 1;
|
||||
JavaTerm contextSubject = 2;
|
||||
}
|
||||
|
||||
message Empty { }
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated JavaTerm errorChildren = 4;
|
||||
}
|
||||
|
||||
message Identifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message AccessibilityModifier {
|
||||
string contents = 1;
|
||||
}
|
||||
|
||||
message TypeArray {
|
||||
repeated JavaTerm arraySize = 1;
|
||||
JavaTerm arrayElementType = 2;
|
||||
}
|
||||
|
||||
message Bool { }
|
||||
|
||||
message Int { }
|
||||
|
||||
message Void { }
|
||||
|
||||
message TypeFloat { }
|
||||
|
||||
message Annotation {
|
||||
JavaTerm annotationSubject = 1;
|
||||
JavaTerm annotationType = 2;
|
||||
}
|
||||
|
||||
message Return {
|
||||
JavaTerm value = 1;
|
||||
}
|
||||
|
||||
message List {
|
||||
repeated JavaTerm listContent = 1;
|
||||
}
|
78
proto/json_diff.proto
Normal file
78
proto/json_diff.proto
Normal file
@ -0,0 +1,78 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.jsondiff;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.jsondiff";
|
||||
option go_package = "github.com/semantic/jsondiff;json";
|
||||
|
||||
message JSONDiff {
|
||||
oneof diff {
|
||||
Merge merge = 1;
|
||||
Delete delete = 2;
|
||||
Insert insert = 3;
|
||||
Replace replace = 4;
|
||||
}
|
||||
message Merge {
|
||||
JSONSyntax syntax = 1;
|
||||
}
|
||||
message Delete {
|
||||
JSONSyntax before = 1;
|
||||
}
|
||||
message Insert {
|
||||
JSONSyntax after = 1;
|
||||
}
|
||||
message Replace {
|
||||
JSONSyntax before = 1;
|
||||
JSONSyntax after = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message JSONSyntax {
|
||||
oneof syntax {
|
||||
Null null = 1;
|
||||
Array array = 2;
|
||||
Boolean boolean = 3;
|
||||
Hash hash = 4;
|
||||
Float float = 5;
|
||||
KeyValue keyValue = 6;
|
||||
TextElement textElement = 7;
|
||||
Error error = 8;
|
||||
}
|
||||
}
|
||||
|
||||
message Null { }
|
||||
|
||||
message Array {
|
||||
repeated JSONDiff arrayElements = 1;
|
||||
}
|
||||
|
||||
message Boolean {
|
||||
bool booleanContent = 1;
|
||||
}
|
||||
|
||||
message Hash {
|
||||
repeated JSONDiff hashElements = 1;
|
||||
}
|
||||
|
||||
message Float {
|
||||
string floatContent = 1;
|
||||
}
|
||||
|
||||
message KeyValue {
|
||||
JSONDiff key = 1;
|
||||
JSONDiff value = 2;
|
||||
}
|
||||
|
||||
message TextElement {
|
||||
string textElementContent = 1;
|
||||
}
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated JSONDiff errorChildren = 4;
|
||||
}
|
145
proto/markdown_diff.proto
Normal file
145
proto/markdown_diff.proto
Normal file
@ -0,0 +1,145 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.markdowndiff;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.markdowndiff";
|
||||
option go_package = "github.com/semantic/markdowndiff;markdown";
|
||||
|
||||
message MarkdownDiff {
|
||||
oneof diff {
|
||||
Merge merge = 1;
|
||||
Delete delete = 2;
|
||||
Insert insert = 3;
|
||||
Replace replace = 4;
|
||||
}
|
||||
message Merge {
|
||||
MarkdownSyntax syntax = 1;
|
||||
}
|
||||
message Delete {
|
||||
MarkdownSyntax before = 1;
|
||||
}
|
||||
message Insert {
|
||||
MarkdownSyntax after = 1;
|
||||
}
|
||||
message Replace {
|
||||
MarkdownSyntax before = 1;
|
||||
MarkdownSyntax after = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message MarkdownSyntax {
|
||||
oneof syntax {
|
||||
Document document = 1;
|
||||
BlockQuote blockQuote = 2;
|
||||
Heading heading = 3;
|
||||
HTMLBlock hTMLBlock = 4;
|
||||
OrderedList orderedList = 5;
|
||||
Paragraph paragraph = 6;
|
||||
ThematicBreak thematicBreak = 7;
|
||||
UnorderedList unorderedList = 8;
|
||||
Table table = 9;
|
||||
TableRow tableRow = 10;
|
||||
TableCell tableCell = 11;
|
||||
Code code = 12;
|
||||
Emphasis emphasis = 13;
|
||||
Image image = 14;
|
||||
LineBreak lineBreak = 15;
|
||||
Link link = 16;
|
||||
Strong strong = 17;
|
||||
Text text = 18;
|
||||
Strikethrough strikethrough = 19;
|
||||
Error error = 20;
|
||||
List list = 21;
|
||||
}
|
||||
}
|
||||
|
||||
message Document {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message BlockQuote {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message Heading {
|
||||
int64 headingLevel = 1;
|
||||
repeated MarkdownDiff headingContent = 2;
|
||||
repeated MarkdownDiff sectionContent = 3;
|
||||
}
|
||||
|
||||
message HTMLBlock {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message OrderedList {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message Paragraph {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message ThematicBreak { }
|
||||
|
||||
message UnorderedList {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message Table {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message TableRow {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message TableCell {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message Code {
|
||||
string codeLanguage = 1;
|
||||
string codeContent = 2;
|
||||
}
|
||||
|
||||
message Emphasis {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message Image {
|
||||
string imageURL = 1;
|
||||
string imageTitle = 2;
|
||||
}
|
||||
|
||||
message LineBreak { }
|
||||
|
||||
message Link {
|
||||
string linkUrl = 1;
|
||||
string linkTitle = 2;
|
||||
}
|
||||
|
||||
message Strong {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message Text {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Strikethrough {
|
||||
repeated MarkdownDiff values = 1;
|
||||
}
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated MarkdownDiff errorChildren = 4;
|
||||
}
|
||||
|
||||
message List {
|
||||
repeated MarkdownDiff listContent = 1;
|
||||
}
|
127
proto/markdown_term.proto
Normal file
127
proto/markdown_term.proto
Normal file
@ -0,0 +1,127 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.markdownterm;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.markdownterm";
|
||||
option go_package = "github.com/semantic/markdownterm;markdown";
|
||||
|
||||
message MarkdownTerm {
|
||||
MarkdownSyntax syntax = 1;
|
||||
}
|
||||
|
||||
message MarkdownSyntax {
|
||||
oneof syntax {
|
||||
Document document = 1;
|
||||
BlockQuote blockQuote = 2;
|
||||
Heading heading = 3;
|
||||
HTMLBlock hTMLBlock = 4;
|
||||
OrderedList orderedList = 5;
|
||||
Paragraph paragraph = 6;
|
||||
ThematicBreak thematicBreak = 7;
|
||||
UnorderedList unorderedList = 8;
|
||||
Table table = 9;
|
||||
TableRow tableRow = 10;
|
||||
TableCell tableCell = 11;
|
||||
Code code = 12;
|
||||
Emphasis emphasis = 13;
|
||||
Image image = 14;
|
||||
LineBreak lineBreak = 15;
|
||||
Link link = 16;
|
||||
Strong strong = 17;
|
||||
Text text = 18;
|
||||
Strikethrough strikethrough = 19;
|
||||
Error error = 20;
|
||||
List list = 21;
|
||||
}
|
||||
}
|
||||
|
||||
message Document {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message BlockQuote {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message Heading {
|
||||
int64 headingLevel = 1;
|
||||
repeated MarkdownTerm headingContent = 2;
|
||||
repeated MarkdownTerm sectionContent = 3;
|
||||
}
|
||||
|
||||
message HTMLBlock {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message OrderedList {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message Paragraph {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message ThematicBreak { }
|
||||
|
||||
message UnorderedList {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message Table {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message TableRow {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message TableCell {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message Code {
|
||||
string codeLanguage = 1;
|
||||
string codeContent = 2;
|
||||
}
|
||||
|
||||
message Emphasis {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message Image {
|
||||
string imageURL = 1;
|
||||
string imageTitle = 2;
|
||||
}
|
||||
|
||||
message LineBreak { }
|
||||
|
||||
message Link {
|
||||
string linkUrl = 1;
|
||||
string linkTitle = 2;
|
||||
}
|
||||
|
||||
message Strong {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message Text {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Strikethrough {
|
||||
repeated MarkdownTerm values = 1;
|
||||
}
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated MarkdownTerm errorChildren = 4;
|
||||
}
|
||||
|
||||
message List {
|
||||
repeated MarkdownTerm listContent = 1;
|
||||
}
|
723
proto/php_diff.proto
Normal file
723
proto/php_diff.proto
Normal file
@ -0,0 +1,723 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.phpdiff;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.phpdiff";
|
||||
option go_package = "github.com/semantic/phpdiff;php";
|
||||
|
||||
message PHPDiff {
|
||||
oneof diff {
|
||||
Merge merge = 1;
|
||||
Delete delete = 2;
|
||||
Insert insert = 3;
|
||||
Replace replace = 4;
|
||||
}
|
||||
message Merge {
|
||||
PHPSyntax syntax = 1;
|
||||
}
|
||||
message Delete {
|
||||
PHPSyntax before = 1;
|
||||
}
|
||||
message Insert {
|
||||
PHPSyntax after = 1;
|
||||
}
|
||||
message Replace {
|
||||
PHPSyntax before = 1;
|
||||
PHPSyntax after = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message PHPSyntax {
|
||||
oneof syntax {
|
||||
Comment comment = 1;
|
||||
Class class = 2;
|
||||
Function function = 3;
|
||||
Method method = 4;
|
||||
VariableDeclaration variableDeclaration = 5;
|
||||
Plus plus = 6;
|
||||
Minus minus = 7;
|
||||
Times times = 8;
|
||||
DividedBy dividedBy = 9;
|
||||
Modulo modulo = 10;
|
||||
Power power = 11;
|
||||
Negate negate = 12;
|
||||
FloorDivision floorDivision = 13;
|
||||
BAnd bAnd = 14;
|
||||
BOr bOr = 15;
|
||||
BXOr bXOr = 16;
|
||||
LShift lShift = 17;
|
||||
RShift rShift = 18;
|
||||
And and = 19;
|
||||
Not not = 20;
|
||||
Or or = 21;
|
||||
XOr xOr = 22;
|
||||
Call call = 23;
|
||||
Cast cast = 24;
|
||||
LessThan lessThan = 25;
|
||||
LessThanEqual lessThanEqual = 26;
|
||||
GreaterThan greaterThan = 27;
|
||||
GreaterThanEqual greaterThanEqual = 28;
|
||||
Equal equal = 29;
|
||||
StrictEqual strictEqual = 30;
|
||||
Comparison comparison = 31;
|
||||
InstanceOf instanceOf = 32;
|
||||
MemberAccess memberAccess = 33;
|
||||
New new = 34;
|
||||
SequenceExpression sequenceExpression = 35;
|
||||
Subscript subscript = 36;
|
||||
Member member = 37;
|
||||
Array array = 38;
|
||||
Float float = 39;
|
||||
Integer integer = 40;
|
||||
KeyValue keyValue = 41;
|
||||
TextElement textElement = 42;
|
||||
Assignment assignment = 43;
|
||||
Break break = 44;
|
||||
Catch catch = 45;
|
||||
Continue continue = 46;
|
||||
DoWhile doWhile = 47;
|
||||
Else else = 48;
|
||||
Finally finally = 49;
|
||||
For for = 50;
|
||||
ForEach forEach = 51;
|
||||
Goto goto = 52;
|
||||
If if = 53;
|
||||
Match match = 54;
|
||||
Pattern pattern = 55;
|
||||
Return return = 56;
|
||||
Statements statements = 57;
|
||||
Throw throw = 58;
|
||||
Try try = 59;
|
||||
While while = 60;
|
||||
Yield yield = 61;
|
||||
AliasAs aliasAs = 62;
|
||||
ArrayElement arrayElement = 63;
|
||||
BaseTypeDeclaration baseTypeDeclaration = 64;
|
||||
CastType castType = 65;
|
||||
ClassBaseClause classBaseClause = 66;
|
||||
ClassConstDeclaration classConstDeclaration = 67;
|
||||
ClassInterfaceClause classInterfaceClause = 68;
|
||||
ClassModifier classModifier = 69;
|
||||
Clone clone = 70;
|
||||
ConstDeclaration constDeclaration = 71;
|
||||
ConstructorDeclaration constructorDeclaration = 72;
|
||||
Context context = 73;
|
||||
Declare declare = 74;
|
||||
DeclareDirective declareDirective = 75;
|
||||
DestructorDeclaration destructorDeclaration = 76;
|
||||
Echo echo = 77;
|
||||
Empty empty = 78;
|
||||
EmptyIntrinsic emptyIntrinsic = 79;
|
||||
Error error = 80;
|
||||
ErrorControl errorControl = 81;
|
||||
EvalIntrinsic evalIntrinsic = 82;
|
||||
ExitIntrinsic exitIntrinsic = 83;
|
||||
GlobalDeclaration globalDeclaration = 84;
|
||||
Identifier identifier = 85;
|
||||
Include include = 86;
|
||||
IncludeOnce includeOnce = 87;
|
||||
InsteadOf insteadOf = 88;
|
||||
InterfaceBaseClause interfaceBaseClause = 89;
|
||||
InterfaceDeclaration interfaceDeclaration = 90;
|
||||
IssetIntrinsic issetIntrinsic = 91;
|
||||
LabeledStatement labeledStatement = 92;
|
||||
Namespace namespace = 93;
|
||||
NamespaceAliasingClause namespaceAliasingClause = 94;
|
||||
NamespaceName namespaceName = 95;
|
||||
NamespaceUseClause namespaceUseClause = 96;
|
||||
NamespaceUseDeclaration namespaceUseDeclaration = 97;
|
||||
NamespaceUseGroupClause namespaceUseGroupClause = 98;
|
||||
NewVariable newVariable = 99;
|
||||
PrintIntrinsic printIntrinsic = 100;
|
||||
PropertyDeclaration propertyDeclaration = 101;
|
||||
PropertyModifier propertyModifier = 102;
|
||||
QualifiedName qualifiedName = 103;
|
||||
RelativeScope relativeScope = 104;
|
||||
Require require = 105;
|
||||
RequireOnce requireOnce = 106;
|
||||
ReturnType returnType = 107;
|
||||
ScalarType scalarType = 108;
|
||||
ShellCommand shellCommand = 109;
|
||||
SimpleVariable simpleVariable = 110;
|
||||
Static static = 111;
|
||||
Text text = 112;
|
||||
TraitDeclaration traitDeclaration = 113;
|
||||
TraitUseClause traitUseClause = 114;
|
||||
TraitUseSpecification traitUseSpecification = 115;
|
||||
TypeDeclaration typeDeclaration = 116;
|
||||
Unset unset = 117;
|
||||
Update update = 118;
|
||||
UseClause useClause = 119;
|
||||
VariableName variableName = 120;
|
||||
Annotation annotation = 121;
|
||||
List list = 122;
|
||||
}
|
||||
}
|
||||
|
||||
message Comment {
|
||||
string commentContent = 1;
|
||||
}
|
||||
|
||||
message Class {
|
||||
repeated PHPDiff classContext = 1;
|
||||
PHPDiff classIdentifier = 2;
|
||||
repeated PHPDiff classSuperclasses = 3;
|
||||
PHPDiff classBody = 4;
|
||||
}
|
||||
|
||||
message Function {
|
||||
repeated PHPDiff functionContext = 1;
|
||||
PHPDiff functionName = 2;
|
||||
repeated PHPDiff functionParameters = 3;
|
||||
PHPDiff functionBody = 4;
|
||||
}
|
||||
|
||||
message Method {
|
||||
repeated PHPDiff methodContext = 1;
|
||||
PHPDiff methodReceiver = 2;
|
||||
PHPDiff methodName = 3;
|
||||
repeated PHPDiff methodParameters = 4;
|
||||
PHPDiff methodBody = 5;
|
||||
}
|
||||
|
||||
message VariableDeclaration {
|
||||
repeated PHPDiff variableDeclarations = 1;
|
||||
}
|
||||
|
||||
message Plus {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Minus {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Times {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message DividedBy {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Modulo {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Power {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Negate {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message FloorDivision {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message BAnd {
|
||||
PHPDiff left = 1;
|
||||
PHPDiff right = 2;
|
||||
}
|
||||
|
||||
message BOr {
|
||||
PHPDiff left = 1;
|
||||
PHPDiff right = 2;
|
||||
}
|
||||
|
||||
message BXOr {
|
||||
PHPDiff left = 1;
|
||||
PHPDiff right = 2;
|
||||
}
|
||||
|
||||
message LShift {
|
||||
PHPDiff left = 1;
|
||||
PHPDiff right = 2;
|
||||
}
|
||||
|
||||
message RShift {
|
||||
PHPDiff left = 1;
|
||||
PHPDiff right = 2;
|
||||
}
|
||||
|
||||
message And {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Not {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message Or {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message XOr {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Call {
|
||||
repeated PHPDiff callContext = 1;
|
||||
PHPDiff callFunction = 2;
|
||||
repeated PHPDiff callParams = 3;
|
||||
PHPDiff callBlock = 4;
|
||||
}
|
||||
|
||||
message Cast {
|
||||
PHPDiff castSubject = 1;
|
||||
PHPDiff castType = 2;
|
||||
}
|
||||
|
||||
message LessThan {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message LessThanEqual {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThan {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThanEqual {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Equal {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message StrictEqual {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Comparison {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message InstanceOf {
|
||||
PHPDiff instanceOfSubject = 1;
|
||||
PHPDiff instanceOfObject = 2;
|
||||
}
|
||||
|
||||
message MemberAccess {
|
||||
PHPDiff lhs = 1;
|
||||
bytes rhs = 2;
|
||||
}
|
||||
|
||||
message New {
|
||||
repeated PHPDiff newSubject = 1;
|
||||
}
|
||||
|
||||
message SequenceExpression {
|
||||
PHPDiff firstExpression = 1;
|
||||
PHPDiff secondExpression = 2;
|
||||
}
|
||||
|
||||
message Subscript {
|
||||
PHPDiff lhs = 1;
|
||||
repeated PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Member {
|
||||
PHPDiff lhs = 1;
|
||||
PHPDiff rhs = 2;
|
||||
}
|
||||
|
||||
message Array {
|
||||
repeated PHPDiff arrayElements = 1;
|
||||
}
|
||||
|
||||
message Float {
|
||||
string floatContent = 1;
|
||||
}
|
||||
|
||||
message Integer {
|
||||
string integerContent = 1;
|
||||
}
|
||||
|
||||
message KeyValue {
|
||||
PHPDiff key = 1;
|
||||
PHPDiff value = 2;
|
||||
}
|
||||
|
||||
message TextElement {
|
||||
string textElementContent = 1;
|
||||
}
|
||||
|
||||
message Assignment {
|
||||
repeated PHPDiff assignmentContext = 1;
|
||||
PHPDiff assignmentTarget = 2;
|
||||
PHPDiff assignmentValue = 3;
|
||||
}
|
||||
|
||||
message Break {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message Catch {
|
||||
PHPDiff catchException = 1;
|
||||
PHPDiff catchBody = 2;
|
||||
}
|
||||
|
||||
message Continue {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message DoWhile {
|
||||
PHPDiff doWhileCondition = 1;
|
||||
PHPDiff doWhileBody = 2;
|
||||
}
|
||||
|
||||
message Else {
|
||||
PHPDiff elseCondition = 1;
|
||||
PHPDiff elseBody = 2;
|
||||
}
|
||||
|
||||
message Finally {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message For {
|
||||
PHPDiff forBefore = 1;
|
||||
PHPDiff forCondition = 2;
|
||||
PHPDiff forStep = 3;
|
||||
PHPDiff forBody = 4;
|
||||
}
|
||||
|
||||
message ForEach {
|
||||
PHPDiff forEachBinding = 1;
|
||||
PHPDiff forEachSubject = 2;
|
||||
PHPDiff forEachBody = 3;
|
||||
}
|
||||
|
||||
message Goto {
|
||||
PHPDiff gotoLocation = 1;
|
||||
}
|
||||
|
||||
message If {
|
||||
PHPDiff ifCondition = 1;
|
||||
PHPDiff ifThenBody = 2;
|
||||
PHPDiff ifElseBody = 3;
|
||||
}
|
||||
|
||||
message Match {
|
||||
PHPDiff matchSubject = 1;
|
||||
PHPDiff matchPatterns = 2;
|
||||
}
|
||||
|
||||
message Pattern {
|
||||
PHPDiff value = 1;
|
||||
PHPDiff patternBody = 2;
|
||||
}
|
||||
|
||||
message Return {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message Statements {
|
||||
repeated PHPDiff statements = 1;
|
||||
}
|
||||
|
||||
message Throw {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message Try {
|
||||
PHPDiff tryBody = 1;
|
||||
repeated PHPDiff tryCatch = 2;
|
||||
}
|
||||
|
||||
message While {
|
||||
PHPDiff whileCondition = 1;
|
||||
PHPDiff whileBody = 2;
|
||||
}
|
||||
|
||||
message Yield {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message AliasAs {
|
||||
PHPDiff aliasAsName = 1;
|
||||
PHPDiff aliasAsModifier = 2;
|
||||
PHPDiff aliasAsClause = 3;
|
||||
}
|
||||
|
||||
message ArrayElement {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message BaseTypeDeclaration {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message CastType {
|
||||
string _castType = 1;
|
||||
}
|
||||
|
||||
message ClassBaseClause {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message ClassConstDeclaration {
|
||||
PHPDiff visibility = 1;
|
||||
repeated PHPDiff elements = 2;
|
||||
}
|
||||
|
||||
message ClassInterfaceClause {
|
||||
repeated PHPDiff values = 1;
|
||||
}
|
||||
|
||||
message ClassModifier {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Clone {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message ConstDeclaration {
|
||||
repeated PHPDiff values = 1;
|
||||
}
|
||||
|
||||
message ConstructorDeclaration {
|
||||
repeated PHPDiff modifiers = 1;
|
||||
repeated PHPDiff parameters = 2;
|
||||
PHPDiff body = 3;
|
||||
}
|
||||
|
||||
message Context {
|
||||
repeated PHPDiff contextTerms = 1;
|
||||
PHPDiff contextSubject = 2;
|
||||
}
|
||||
|
||||
message Declare {
|
||||
PHPDiff left = 1;
|
||||
PHPDiff right = 2;
|
||||
}
|
||||
|
||||
message DeclareDirective {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message DestructorDeclaration {
|
||||
repeated PHPDiff body = 1;
|
||||
PHPDiff name = 2;
|
||||
}
|
||||
|
||||
message Echo {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message Empty { }
|
||||
|
||||
message EmptyIntrinsic {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated PHPDiff errorChildren = 4;
|
||||
}
|
||||
|
||||
message ErrorControl {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message EvalIntrinsic {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message ExitIntrinsic {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message GlobalDeclaration {
|
||||
repeated PHPDiff values = 1;
|
||||
}
|
||||
|
||||
message Identifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message Include {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message IncludeOnce {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message InsteadOf {
|
||||
PHPDiff left = 1;
|
||||
PHPDiff right = 2;
|
||||
}
|
||||
|
||||
message InterfaceBaseClause {
|
||||
repeated PHPDiff values = 1;
|
||||
}
|
||||
|
||||
message InterfaceDeclaration {
|
||||
PHPDiff name = 1;
|
||||
PHPDiff base = 2;
|
||||
repeated PHPDiff declarations = 3;
|
||||
}
|
||||
|
||||
message IssetIntrinsic {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message LabeledStatement {
|
||||
PHPDiff _labeledStatementIdentifier = 1;
|
||||
}
|
||||
|
||||
message Namespace {
|
||||
repeated PHPDiff namespaceName = 1;
|
||||
PHPDiff namespaceBody = 2;
|
||||
}
|
||||
|
||||
message NamespaceAliasingClause {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message NamespaceName {
|
||||
repeated PHPDiff names = 1;
|
||||
}
|
||||
|
||||
message NamespaceUseClause {
|
||||
repeated PHPDiff values = 1;
|
||||
}
|
||||
|
||||
message NamespaceUseDeclaration {
|
||||
repeated PHPDiff values = 1;
|
||||
}
|
||||
|
||||
message NamespaceUseGroupClause {
|
||||
repeated PHPDiff values = 1;
|
||||
}
|
||||
|
||||
message NewVariable {
|
||||
repeated PHPDiff values = 1;
|
||||
}
|
||||
|
||||
message PrintIntrinsic {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message PropertyDeclaration {
|
||||
PHPDiff modifier = 1;
|
||||
repeated PHPDiff elements = 2;
|
||||
}
|
||||
|
||||
message PropertyModifier {
|
||||
PHPDiff visibility = 1;
|
||||
PHPDiff static = 2;
|
||||
}
|
||||
|
||||
message QualifiedName {
|
||||
PHPDiff name = 1;
|
||||
PHPDiff identifier = 2;
|
||||
}
|
||||
|
||||
message RelativeScope {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Require {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message RequireOnce {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message ReturnType {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message ScalarType {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message ShellCommand {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message SimpleVariable {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message Static {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Text {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message TraitDeclaration {
|
||||
PHPDiff traitName = 1;
|
||||
repeated PHPDiff traitStatements = 2;
|
||||
}
|
||||
|
||||
message TraitUseClause {
|
||||
repeated PHPDiff namespace = 1;
|
||||
PHPDiff alias = 2;
|
||||
}
|
||||
|
||||
message TraitUseSpecification {
|
||||
repeated PHPDiff values = 1;
|
||||
}
|
||||
|
||||
message TypeDeclaration {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message Unset {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message Update {
|
||||
PHPDiff _updateSubject = 1;
|
||||
}
|
||||
|
||||
message UseClause {
|
||||
repeated PHPDiff values = 1;
|
||||
}
|
||||
|
||||
message VariableName {
|
||||
PHPDiff value = 1;
|
||||
}
|
||||
|
||||
message Annotation {
|
||||
PHPDiff annotationSubject = 1;
|
||||
PHPDiff annotationType = 2;
|
||||
}
|
||||
|
||||
message List {
|
||||
repeated PHPDiff listContent = 1;
|
||||
}
|
721
proto/php_term.proto
Normal file
721
proto/php_term.proto
Normal file
@ -0,0 +1,721 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic.phpterm;
|
||||
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.phpterm";
|
||||
option go_package = "github.com/semantic/phpterm;php";
|
||||
|
||||
message PHPTerm {
|
||||
PHPSyntax syntax = 1;
|
||||
}
|
||||
|
||||
message PHPSyntax {
|
||||
oneof syntax {
|
||||
Comment comment = 1;
|
||||
Class class = 2;
|
||||
Function function = 3;
|
||||
Method method = 4;
|
||||
VariableDeclaration variableDeclaration = 5;
|
||||
Plus plus = 6;
|
||||
Minus minus = 7;
|
||||
Times times = 8;
|
||||
DividedBy dividedBy = 9;
|
||||
Modulo modulo = 10;
|
||||
Power power = 11;
|
||||
Negate negate = 12;
|
||||
FloorDivision floorDivision = 13;
|
||||
BAnd bAnd = 14;
|
||||
BOr bOr = 15;
|
||||
BXOr bXOr = 16;
|
||||
LShift lShift = 17;
|
||||
RShift rShift = 18;
|
||||
And and = 19;
|
||||
Not not = 20;
|
||||
Or or = 21;
|
||||
XOr xOr = 22;
|
||||
Call call = 23;
|
||||
Cast cast = 24;
|
||||
LessThan lessThan = 25;
|
||||
LessThanEqual lessThanEqual = 26;
|
||||
GreaterThan greaterThan = 27;
|
||||
GreaterThanEqual greaterThanEqual = 28;
|
||||
Equal equal = 29;
|
||||
StrictEqual strictEqual = 30;
|
||||
Comparison comparison = 31;
|
||||
InstanceOf instanceOf = 32;
|
||||
MemberAccess memberAccess = 33;
|
||||
New new = 34;
|
||||
SequenceExpression sequenceExpression = 35;
|
||||
Subscript subscript = 36;
|
||||
Member member = 37;
|
||||
Array array = 38;
|
||||
Float float = 39;
|
||||
Integer integer = 40;
|
||||
KeyValue keyValue = 41;
|
||||
TextElement textElement = 42;
|
||||
Assignment assignment = 43;
|
||||
Break break = 44;
|
||||
Catch catch = 45;
|
||||
Continue continue = 46;
|
||||
DoWhile doWhile = 47;
|
||||
Else else = 48;
|
||||
Finally finally = 49;
|
||||
For for = 50;
|
||||
ForEach forEach = 51;
|
||||
Goto goto = 52;
|
||||
If if = 53;
|
||||
Match match = 54;
|
||||
Pattern pattern = 55;
|
||||
Return return = 56;
|
||||
Statements statements = 57;
|
||||
Throw throw = 58;
|
||||
Try try = 59;
|
||||
While while = 60;
|
||||
Yield yield = 61;
|
||||
AliasAs aliasAs = 62;
|
||||
ArrayElement arrayElement = 63;
|
||||
BaseTypeDeclaration baseTypeDeclaration = 64;
|
||||
CastType castType = 65;
|
||||
ClassBaseClause classBaseClause = 66;
|
||||
ClassConstDeclaration classConstDeclaration = 67;
|
||||
ClassInterfaceClause classInterfaceClause = 68;
|
||||
ClassModifier classModifier = 69;
|
||||
Clone clone = 70;
|
||||
ConstDeclaration constDeclaration = 71;
|
||||
ConstructorDeclaration constructorDeclaration = 72;
|
||||
Context context = 73;
|
||||
Declare declare = 74;
|
||||
DeclareDirective declareDirective = 75;
|
||||
DestructorDeclaration destructorDeclaration = 76;
|
||||
Echo echo = 77;
|
||||
Empty empty = 78;
|
||||
EmptyIntrinsic emptyIntrinsic = 79;
|
||||
Error error = 80;
|
||||
ErrorControl errorControl = 81;
|
||||
EvalIntrinsic evalIntrinsic = 82;
|
||||
ExitIntrinsic exitIntrinsic = 83;
|
||||
GlobalDeclaration globalDeclaration = 84;
|
||||
Identifier identifier = 85;
|
||||
Include include = 86;
|
||||
IncludeOnce includeOnce = 87;
|
||||
InsteadOf insteadOf = 88;
|
||||
InterfaceBaseClause interfaceBaseClause = 89;
|
||||
InterfaceDeclaration interfaceDeclaration = 90;
|
||||
IssetIntrinsic issetIntrinsic = 91;
|
||||
LabeledStatement labeledStatement = 92;
|
||||
Namespace namespace = 93;
|
||||
NamespaceAliasingClause namespaceAliasingClause = 94;
|
||||
NamespaceName namespaceName = 95;
|
||||
NamespaceUseClause namespaceUseClause = 96;
|
||||
NamespaceUseDeclaration namespaceUseDeclaration = 97;
|
||||
NamespaceUseGroupClause namespaceUseGroupClause = 98;
|
||||
NewVariable newVariable = 99;
|
||||
PrintIntrinsic printIntrinsic = 100;
|
||||
PropertyDeclaration propertyDeclaration = 101;
|
||||
PropertyModifier propertyModifier = 102;
|
||||
QualifiedName qualifiedName = 103;
|
||||
RelativeScope relativeScope = 104;
|
||||
Require require = 105;
|
||||
RequireOnce requireOnce = 106;
|
||||
ReturnType returnType = 107;
|
||||
ScalarType scalarType = 108;
|
||||
ShellCommand shellCommand = 109;
|
||||
SimpleVariable simpleVariable = 110;
|
||||
Static static = 111;
|
||||
Text text = 112;
|
||||
TraitDeclaration traitDeclaration = 113;
|
||||
TraitUseClause traitUseClause = 114;
|
||||
TraitUseSpecification traitUseSpecification = 115;
|
||||
TypeDeclaration typeDeclaration = 116;
|
||||
Unset unset = 117;
|
||||
Update update = 118;
|
||||
UseClause useClause = 119;
|
||||
VariableName variableName = 120;
|
||||
Annotation annotation = 121;
|
||||
List list = 122;
|
||||
}
|
||||
}
|
||||
|
||||
message Comment {
|
||||
string commentContent = 1;
|
||||
}
|
||||
|
||||
message Class {
|
||||
repeated PHPTerm classContext = 1;
|
||||
PHPTerm classIdentifier = 2;
|
||||
repeated PHPTerm classSuperclasses = 3;
|
||||
PHPTerm classBody = 4;
|
||||
}
|
||||
|
||||
message Function {
|
||||
repeated PHPTerm functionContext = 1;
|
||||
PHPTerm functionName = 2;
|
||||
repeated PHPTerm functionParameters = 3;
|
||||
PHPTerm functionBody = 4;
|
||||
}
|
||||
|
||||
message Method {
|
||||
repeated PHPTerm methodContext = 1;
|
||||
PHPTerm methodReceiver = 2;
|
||||
PHPTerm methodName = 3;
|
||||
repeated PHPTerm methodParameters = 4;
|
||||
PHPTerm methodBody = 5;
|
||||
}
|
||||
|
||||
message VariableDeclaration {
|
||||
repeated PHPTerm variableDeclarations = 1;
|
||||
}
|
||||
|
||||
message Plus {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Minus {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Times {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message DividedBy {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Modulo {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Power {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Negate {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message FloorDivision {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message BAnd {
|
||||
PHPTerm left = 1;
|
||||
PHPTerm right = 2;
|
||||
}
|
||||
|
||||
message BOr {
|
||||
PHPTerm left = 1;
|
||||
PHPTerm right = 2;
|
||||
}
|
||||
|
||||
message BXOr {
|
||||
PHPTerm left = 1;
|
||||
PHPTerm right = 2;
|
||||
}
|
||||
|
||||
message LShift {
|
||||
PHPTerm left = 1;
|
||||
PHPTerm right = 2;
|
||||
}
|
||||
|
||||
message RShift {
|
||||
PHPTerm left = 1;
|
||||
PHPTerm right = 2;
|
||||
}
|
||||
|
||||
message And {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Not {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message Or {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message XOr {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Call {
|
||||
repeated PHPTerm callContext = 1;
|
||||
PHPTerm callFunction = 2;
|
||||
repeated PHPTerm callParams = 3;
|
||||
PHPTerm callBlock = 4;
|
||||
}
|
||||
|
||||
message Cast {
|
||||
PHPTerm castSubject = 1;
|
||||
PHPTerm castType = 2;
|
||||
}
|
||||
|
||||
message LessThan {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message LessThanEqual {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThan {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message GreaterThanEqual {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Equal {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message StrictEqual {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Comparison {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message InstanceOf {
|
||||
PHPTerm instanceOfSubject = 1;
|
||||
PHPTerm instanceOfObject = 2;
|
||||
}
|
||||
|
||||
message MemberAccess {
|
||||
PHPTerm lhs = 1;
|
||||
bytes rhs = 2;
|
||||
}
|
||||
|
||||
message New {
|
||||
repeated PHPTerm newSubject = 1;
|
||||
}
|
||||
|
||||
message SequenceExpression {
|
||||
PHPTerm firstExpression = 1;
|
||||
PHPTerm secondExpression = 2;
|
||||
}
|
||||
|
||||
message Subscript {
|
||||
PHPTerm lhs = 1;
|
||||
repeated PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Member {
|
||||
PHPTerm lhs = 1;
|
||||
PHPTerm rhs = 2;
|
||||
}
|
||||
|
||||
message Array {
|
||||
repeated PHPTerm arrayElements = 1;
|
||||
}
|
||||
|
||||
message Float {
|
||||
string floatContent = 1;
|
||||
}
|
||||
|
||||
message Integer {
|
||||
string integerContent = 1;
|
||||
}
|
||||
|
||||
message KeyValue {
|
||||
PHPTerm key = 1;
|
||||
PHPTerm value = 2;
|
||||
}
|
||||
|
||||
message TextElement {
|
||||
string textElementContent = 1;
|
||||
}
|
||||
|
||||
message Assignment {
|
||||
repeated PHPTerm assignmentContext = 1;
|
||||
PHPTerm assignmentTarget = 2;
|
||||
PHPTerm assignmentValue = 3;
|
||||
}
|
||||
|
||||
message Break {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message Catch {
|
||||
PHPTerm catchException = 1;
|
||||
PHPTerm catchBody = 2;
|
||||
}
|
||||
|
||||
message Continue {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message DoWhile {
|
||||
PHPTerm doWhileCondition = 1;
|
||||
PHPTerm doWhileBody = 2;
|
||||
}
|
||||
|
||||
message Else {
|
||||
PHPTerm elseCondition = 1;
|
||||
PHPTerm elseBody = 2;
|
||||
}
|
||||
|
||||
message Finally {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message For {
|
||||
PHPTerm forBefore = 1;
|
||||
PHPTerm forCondition = 2;
|
||||
PHPTerm forStep = 3;
|
||||
PHPTerm forBody = 4;
|
||||
}
|
||||
|
||||
message ForEach {
|
||||
PHPTerm forEachBinding = 1;
|
||||
PHPTerm forEachSubject = 2;
|
||||
PHPTerm forEachBody = 3;
|
||||
}
|
||||
|
||||
message Goto {
|
||||
PHPTerm gotoLocation = 1;
|
||||
}
|
||||
|
||||
message If {
|
||||
PHPTerm ifCondition = 1;
|
||||
PHPTerm ifThenBody = 2;
|
||||
PHPTerm ifElseBody = 3;
|
||||
}
|
||||
|
||||
message Match {
|
||||
PHPTerm matchSubject = 1;
|
||||
PHPTerm matchPatterns = 2;
|
||||
}
|
||||
|
||||
message Pattern {
|
||||
PHPTerm value = 1;
|
||||
PHPTerm patternBody = 2;
|
||||
}
|
||||
|
||||
message Return {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message Statements {
|
||||
repeated PHPTerm statements = 1;
|
||||
}
|
||||
|
||||
message Throw {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message Try {
|
||||
PHPTerm tryBody = 1;
|
||||
repeated PHPTerm tryCatch = 2;
|
||||
}
|
||||
|
||||
message While {
|
||||
PHPTerm whileCondition = 1;
|
||||
PHPTerm whileBody = 2;
|
||||
}
|
||||
|
||||
message Yield {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message AliasAs {
|
||||
PHPTerm aliasAsName = 1;
|
||||
PHPTerm aliasAsModifier = 2;
|
||||
PHPTerm aliasAsClause = 3;
|
||||
}
|
||||
|
||||
message ArrayElement {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message BaseTypeDeclaration {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message CastType {
|
||||
string _castType = 1;
|
||||
}
|
||||
|
||||
message ClassBaseClause {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message ClassConstDeclaration {
|
||||
PHPTerm visibility = 1;
|
||||
repeated PHPTerm elements = 2;
|
||||
}
|
||||
|
||||
message ClassInterfaceClause {
|
||||
repeated PHPTerm values = 1;
|
||||
}
|
||||
|
||||
message ClassModifier {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Clone {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message ConstDeclaration {
|
||||
repeated PHPTerm values = 1;
|
||||
}
|
||||
|
||||
message ConstructorDeclaration {
|
||||
repeated PHPTerm modifiers = 1;
|
||||
repeated PHPTerm parameters = 2;
|
||||
PHPTerm body = 3;
|
||||
}
|
||||
|
||||
message Context {
|
||||
repeated PHPTerm contextTerms = 1;
|
||||
PHPTerm contextSubject = 2;
|
||||
}
|
||||
|
||||
message Declare {
|
||||
PHPTerm left = 1;
|
||||
PHPTerm right = 2;
|
||||
}
|
||||
|
||||
message DeclareDirective {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message DestructorDeclaration {
|
||||
repeated PHPTerm body = 1;
|
||||
PHPTerm name = 2;
|
||||
}
|
||||
|
||||
message Echo {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message Empty { }
|
||||
|
||||
message EmptyIntrinsic {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message Error {
|
||||
repeated ErrorSite errorCallStack = 1;
|
||||
repeated string errorExpected = 2;
|
||||
string errorActual = 3;
|
||||
repeated PHPTerm errorChildren = 4;
|
||||
}
|
||||
|
||||
message ErrorControl {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message EvalIntrinsic {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message ExitIntrinsic {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message GlobalDeclaration {
|
||||
repeated PHPTerm values = 1;
|
||||
}
|
||||
|
||||
message Identifier {
|
||||
bytes name = 1;
|
||||
}
|
||||
|
||||
message Include {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message IncludeOnce {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message InsteadOf {
|
||||
PHPTerm left = 1;
|
||||
PHPTerm right = 2;
|
||||
}
|
||||
|
||||
message InterfaceBaseClause {
|
||||
repeated PHPTerm values = 1;
|
||||
}
|
||||
|
||||
message InterfaceDeclaration {
|
||||
PHPTerm name = 1;
|
||||
PHPTerm base = 2;
|
||||
repeated PHPTerm declarations = 3;
|
||||
}
|
||||
|
||||
message IssetIntrinsic {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message LabeledStatement {
|
||||
PHPTerm _labeledStatementIdentifier = 1;
|
||||
}
|
||||
|
||||
message Namespace {
|
||||
repeated PHPTerm namespaceName = 1;
|
||||
PHPTerm namespaceBody = 2;
|
||||
}
|
||||
|
||||
message NamespaceAliasingClause {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message NamespaceName {
|
||||
repeated PHPTerm names = 1;
|
||||
}
|
||||
|
||||
message NamespaceUseClause {
|
||||
repeated PHPTerm values = 1;
|
||||
}
|
||||
|
||||
message NamespaceUseDeclaration {
|
||||
repeated PHPTerm values = 1;
|
||||
}
|
||||
|
||||
message NamespaceUseGroupClause {
|
||||
repeated PHPTerm values = 1;
|
||||
}
|
||||
|
||||
message NewVariable {
|
||||
repeated PHPTerm values = 1;
|
||||
}
|
||||
|
||||
message PrintIntrinsic {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message PropertyDeclaration {
|
||||
PHPTerm modifier = 1;
|
||||
repeated PHPTerm elements = 2;
|
||||
}
|
||||
|
||||
message PropertyModifier {
|
||||
PHPTerm visibility = 1;
|
||||
PHPTerm static = 2;
|
||||
}
|
||||
|
||||
message QualifiedName {
|
||||
PHPTerm name = 1;
|
||||
PHPTerm identifier = 2;
|
||||
}
|
||||
|
||||
message RelativeScope {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Require {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message RequireOnce {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message ReturnType {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message ScalarType {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message ShellCommand {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message SimpleVariable {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message Static {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Text {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message TraitDeclaration {
|
||||
PHPTerm traitName = 1;
|
||||
repeated PHPTerm traitStatements = 2;
|
||||
}
|
||||
|
||||
message TraitUseClause {
|
||||
repeated PHPTerm namespace = 1;
|
||||
PHPTerm alias = 2;
|
||||
}
|
||||
|
||||
message TraitUseSpecification {
|
||||
repeated PHPTerm values = 1;
|
||||
}
|
||||
|
||||
message TypeDeclaration {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message Unset {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message Update {
|
||||
PHPTerm _updateSubject = 1;
|
||||
}
|
||||
|
||||
message UseClause {
|
||||
repeated PHPTerm values = 1;
|
||||
}
|
||||
|
||||
message VariableName {
|
||||
PHPTerm value = 1;
|
||||
}
|
||||
|
||||
message Annotation {
|
||||
PHPTerm annotationSubject = 1;
|
||||
PHPTerm annotationType = 2;
|
||||
}
|
||||
|
||||
message List {
|
||||
repeated PHPTerm listContent = 1;
|
||||
}
|
||||
|
||||
message Alias {
|
||||
bytes aliasValue = 1;
|
||||
bytes aliasName = 2;
|
||||
}
|
||||
|
||||
message ImportPath {
|
||||
string unPath = 1;
|
||||
IsRelative pathIsRelative = 2;
|
||||
}
|
||||
|
||||
enum IsRelative {
|
||||
Unknown = 0;
|
||||
Relative = 1;
|
||||
NonRelative = 2;
|
||||
}
|
63
proto/terms.proto
Normal file
63
proto/terms.proto
Normal file
@ -0,0 +1,63 @@
|
||||
// This file was generated by proto-gen. Do not edit by hand.
|
||||
syntax = "proto3";
|
||||
|
||||
package github.semantic;
|
||||
|
||||
import "go_term.proto";
|
||||
import "go_diff.proto";
|
||||
import "haskell_term.proto";
|
||||
import "haskell_diff.proto";
|
||||
import "java_term.proto";
|
||||
import "java_diff.proto";
|
||||
import "json_term.proto";
|
||||
import "json_diff.proto";
|
||||
import "markdown_term.proto";
|
||||
import "markdown_diff.proto";
|
||||
import "python_term.proto";
|
||||
import "python_diff.proto";
|
||||
import "ruby_term.proto";
|
||||
import "ruby_diff.proto";
|
||||
import "typescript_term.proto";
|
||||
import "typescript_diff.proto";
|
||||
import "php_term.proto";
|
||||
import "php_diff.proto";
|
||||
import "types.proto";
|
||||
|
||||
option java_package = "com.github.semantic.terms";
|
||||
option go_package = "github.com/semantic/terms;types";
|
||||
|
||||
message ParseTree {
|
||||
Language language = 1;
|
||||
string path = 2;
|
||||
oneof response_type {
|
||||
string error = 3;
|
||||
goterm.GoTerm go_tree = 4;
|
||||
haskellterm.HaskellTerm haskell_tree = 5;
|
||||
javaterm.JavaTerm java_tree = 6;
|
||||
jsonterm.JSONTerm json_tree = 7;
|
||||
markdownterm.MarkdownTerm markdown_tree = 8;
|
||||
pythonterm.PythonTerm python_tree = 9;
|
||||
rubyterm.RubyTerm ruby_tree = 10;
|
||||
typescriptterm.TypeScriptTerm typescript_tree = 11;
|
||||
phpterm.PHPTerm php_tree = 12;
|
||||
}
|
||||
}
|
||||
|
||||
message DiffTree {
|
||||
Language language_before = 1;
|
||||
Language language_after = 2;
|
||||
string path_before = 3;
|
||||
string path_after = 4;
|
||||
oneof response_type {
|
||||
string error = 5;
|
||||
godiff.GoDiff go_diff = 6;
|
||||
haskelldiff.HaskellDiff haskell_diff = 7;
|
||||
javadiff.JavaDiff java_diff = 8;
|
||||
jsondiff.JSONDiff json_diff = 9;
|
||||
markdowndiff.MarkdownDiff markdown_diff = 10;
|
||||
pythondiff.PythonDiff python_diff = 11;
|
||||
rubydiff.RubyDiff ruby_diff = 12;
|
||||
typescriptdiff.TypeScriptDiff typescript_diff = 13;
|
||||
phpdiff.PHPDiff php_diff = 14;
|
||||
}
|
||||
}
|
@ -21,15 +21,6 @@ enum Language {
|
||||
PHP = 11;
|
||||
}
|
||||
|
||||
enum VertexType {
|
||||
PACKAGE = 0;
|
||||
MODULE = 1;
|
||||
UNKNOWN_MODULE = 2;
|
||||
VARIABLE = 3;
|
||||
METHOD = 4;
|
||||
FUNCTION = 5;
|
||||
}
|
||||
|
||||
message BlobPair {
|
||||
Blob before = 1;
|
||||
Blob after = 2;
|
||||
@ -41,24 +32,14 @@ message Blob {
|
||||
Language blobLanguage = 3;
|
||||
}
|
||||
|
||||
message Edge {
|
||||
uint64 edgeFrom = 1;
|
||||
uint64 edgeTo = 2;
|
||||
}
|
||||
|
||||
message ErrorSite {
|
||||
string errorMessage = 1;
|
||||
SrcLoc errorLocation = 2;
|
||||
}
|
||||
|
||||
message AdjacencyList {
|
||||
repeated Vertex graphVertices = 1;
|
||||
repeated Edge graphEdges = 2;
|
||||
}
|
||||
|
||||
message Pos {
|
||||
int64 posLine = 1;
|
||||
int64 posColumn = 2;
|
||||
message Position {
|
||||
int64 line = 1;
|
||||
int64 column = 2;
|
||||
}
|
||||
|
||||
message Project {
|
||||
@ -69,8 +50,13 @@ message Project {
|
||||
}
|
||||
|
||||
message Span {
|
||||
Pos spanStart = 1;
|
||||
Pos spanEnd = 2;
|
||||
Position start = 1;
|
||||
Position end = 2;
|
||||
}
|
||||
|
||||
message Range {
|
||||
int64 start = 1;
|
||||
int64 end = 2;
|
||||
}
|
||||
|
||||
message SrcLoc {
|
||||
@ -83,8 +69,80 @@ message SrcLoc {
|
||||
int64 srcLocEndCol = 7;
|
||||
}
|
||||
|
||||
message Vertex {
|
||||
VertexType vertexType = 1;
|
||||
string vertexContents = 2;
|
||||
uint64 vertexTag = 3;
|
||||
message ControlFlowGraph {
|
||||
repeated ControlFlowVertex vertices = 1;
|
||||
repeated ControlFlowEdge edges = 2;
|
||||
}
|
||||
|
||||
message ControlFlowEdge {
|
||||
int64 source = 1;
|
||||
int64 target = 2;
|
||||
}
|
||||
|
||||
message ControlFlowVertex {
|
||||
oneof vertex {
|
||||
Package package = 1;
|
||||
Module module = 2;
|
||||
UnknownModule unknownModule = 3;
|
||||
Variable variable = 4;
|
||||
Method method = 5;
|
||||
Function function = 6;
|
||||
}
|
||||
message Package {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
}
|
||||
message Module {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
}
|
||||
message UnknownModule {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
}
|
||||
message Variable {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
string moduleName = 4;
|
||||
Span span = 5;
|
||||
}
|
||||
message Method {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
string moduleName = 4;
|
||||
Span span = 5;
|
||||
}
|
||||
message Function {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
string moduleName = 4;
|
||||
Span span = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message TermGraph {
|
||||
repeated TermVertex vertices = 1;
|
||||
repeated TermEdge edges = 2;
|
||||
}
|
||||
|
||||
message TermEdge {
|
||||
int64 source = 1;
|
||||
int64 target = 2;
|
||||
}
|
||||
|
||||
message TermVertex {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
TermAnnotation annotation = 3;
|
||||
}
|
||||
|
||||
message TermAnnotation {
|
||||
Range range = 1;
|
||||
Span span = 2;
|
||||
}
|
||||
|
@ -82,12 +82,15 @@ library
|
||||
, Data.Functor.Both
|
||||
, Data.Functor.Classes.Generic
|
||||
, Data.Graph
|
||||
, Data.Graph.Adjacency
|
||||
, Data.Graph.Vertex
|
||||
, Data.Graph.ControlFlowVertex
|
||||
, Data.Graph.TermVertex
|
||||
, Data.Graph.DiffVertex
|
||||
, Data.History
|
||||
, Data.JSON.Fields
|
||||
, Data.Language
|
||||
, Data.Map.Monoidal
|
||||
, Data.Proto.DiffTree
|
||||
, Data.Proto.ParseTree
|
||||
, Data.Patch
|
||||
, Data.Project
|
||||
, Data.Quieterm
|
||||
|
@ -1,7 +1,7 @@
|
||||
{-# LANGUAGE ScopedTypeVariables, TypeFamilies, TypeOperators #-}
|
||||
module Analysis.Abstract.Graph
|
||||
( Graph(..)
|
||||
, Vertex(..)
|
||||
, ControlFlowVertex(..)
|
||||
, moduleVertex
|
||||
, unknownModuleVertex
|
||||
, style
|
||||
@ -28,14 +28,14 @@ import Data.Abstract.Module (Module (moduleInfo), ModuleInfo (..))
|
||||
import Data.Abstract.Package (PackageInfo (..))
|
||||
import Data.ByteString.Builder
|
||||
import Data.Graph
|
||||
import Data.Graph.Vertex
|
||||
import Data.Graph.ControlFlowVertex
|
||||
import Data.Record
|
||||
import Data.Term
|
||||
import qualified Data.Map as Map
|
||||
import qualified Data.Text.Encoding as T
|
||||
import Prologue hiding (project)
|
||||
|
||||
style :: Style Vertex Builder
|
||||
style :: Style ControlFlowVertex Builder
|
||||
style = (defaultStyle (T.encodeUtf8Builder . vertexIdentifier))
|
||||
{ vertexAttributes = vertexAttributes
|
||||
, edgeAttributes = edgeAttributes
|
||||
@ -65,11 +65,11 @@ style = (defaultStyle (T.encodeUtf8Builder . vertexIdentifier))
|
||||
graphingTerms :: ( Member (Reader ModuleInfo) effects
|
||||
, Member (Reader Span) effects
|
||||
, Member (Env (Hole context (Located address))) effects
|
||||
, Member (State (Graph Vertex)) effects
|
||||
, Member (State (Map (Hole context (Located address)) Vertex)) effects
|
||||
, Member (State (Graph ControlFlowVertex)) effects
|
||||
, Member (State (Map (Hole context (Located address)) ControlFlowVertex)) effects
|
||||
, Member (Resumable (BaseError (EnvironmentError (Hole context (Located address))))) effects
|
||||
, AbstractValue (Hole context (Located address)) value effects
|
||||
, Member (Reader Vertex) effects
|
||||
, Member (Reader ControlFlowVertex) effects
|
||||
, HasField fields Span
|
||||
, VertexDeclaration syntax
|
||||
, Declarations1 syntax
|
||||
@ -108,8 +108,8 @@ graphingTerms recur term@(In a syntax) = do
|
||||
|
||||
-- | Add vertices to the graph for evaluated modules and the packages containing them.
|
||||
graphingPackages :: ( Member (Reader PackageInfo) effects
|
||||
, Member (State (Graph Vertex)) effects
|
||||
, Member (Reader Vertex) effects
|
||||
, Member (State (Graph ControlFlowVertex)) effects
|
||||
, Member (Reader ControlFlowVertex) effects
|
||||
)
|
||||
=> SubtermAlgebra Module term (TermEvaluator term address value effects a)
|
||||
-> SubtermAlgebra Module term (TermEvaluator term address value effects a)
|
||||
@ -120,8 +120,8 @@ graphingPackages recur m =
|
||||
graphingModules :: forall term address value effects a
|
||||
. ( Member (Modules address) effects
|
||||
, Member (Reader ModuleInfo) effects
|
||||
, Member (State (Graph Vertex)) effects
|
||||
, Member (Reader Vertex) effects
|
||||
, Member (State (Graph ControlFlowVertex)) effects
|
||||
, Member (Reader ControlFlowVertex) effects
|
||||
, PureEffects effects
|
||||
)
|
||||
=> SubtermAlgebra Module term (TermEvaluator term address value effects a)
|
||||
@ -160,10 +160,10 @@ graphingModuleInfo recur m = do
|
||||
-- | Add an edge from the current package to the passed vertex.
|
||||
packageInclusion :: ( Effectful m
|
||||
, Member (Reader PackageInfo) effects
|
||||
, Member (State (Graph Vertex)) effects
|
||||
, Member (State (Graph ControlFlowVertex)) effects
|
||||
, Monad (m effects)
|
||||
)
|
||||
=> Vertex
|
||||
=> ControlFlowVertex
|
||||
-> m effects ()
|
||||
packageInclusion v = do
|
||||
p <- currentPackage
|
||||
@ -172,20 +172,20 @@ packageInclusion v = do
|
||||
-- | Add an edge from the current module to the passed vertex.
|
||||
moduleInclusion :: ( Effectful m
|
||||
, Member (Reader ModuleInfo) effects
|
||||
, Member (State (Graph Vertex)) effects
|
||||
, Member (State (Graph ControlFlowVertex)) effects
|
||||
, Monad (m effects)
|
||||
)
|
||||
=> Vertex
|
||||
=> ControlFlowVertex
|
||||
-> m effects ()
|
||||
moduleInclusion v = do
|
||||
m <- currentModule
|
||||
appendGraph (vertex (moduleVertex m) `connect` vertex v)
|
||||
|
||||
-- | Add an edge from the passed variable name to the context it originated within.
|
||||
variableDefinition :: ( Member (State (Graph Vertex)) effects
|
||||
, Member (Reader Vertex) effects
|
||||
variableDefinition :: ( Member (State (Graph ControlFlowVertex)) effects
|
||||
, Member (Reader ControlFlowVertex) effects
|
||||
)
|
||||
=> Vertex
|
||||
=> ControlFlowVertex
|
||||
-> TermEvaluator term (Hole context (Located address)) value effects ()
|
||||
variableDefinition var = do
|
||||
context <- ask
|
||||
@ -195,6 +195,6 @@ appendGraph :: (Effectful m, Member (State (Graph v)) effects) => Graph v -> m e
|
||||
appendGraph = modify' . (<>)
|
||||
|
||||
|
||||
graphing :: (Effectful m, Effects effects, Functor (m (State (Graph Vertex) : effects)))
|
||||
=> m (State (Map (Hole context (Located address)) Vertex) ': State (Graph Vertex) ': effects) result -> m effects (Graph Vertex, result)
|
||||
graphing :: (Effectful m, Effects effects, Functor (m (State (Graph ControlFlowVertex) : effects)))
|
||||
=> m (State (Map (Hole context (Located address)) ControlFlowVertex) ': State (Graph ControlFlowVertex) ': effects) result -> m effects (Graph ControlFlowVertex, result)
|
||||
graphing = runState mempty . fmap snd . runState lowerBound
|
||||
|
@ -7,8 +7,14 @@ module Data.Graph
|
||||
, Lower(..)
|
||||
, simplify
|
||||
, topologicalSort
|
||||
, VertexTag(..)
|
||||
, Edge(..)
|
||||
, vertexList
|
||||
, edgeList
|
||||
) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import qualified Algebra.Graph as G
|
||||
import qualified Algebra.Graph.AdjacencyMap as A
|
||||
import Algebra.Graph.Class (connect, overlay, vertex)
|
||||
@ -17,7 +23,6 @@ import Control.Monad.Effect
|
||||
import Control.Monad.Effect.State
|
||||
import Data.Aeson
|
||||
import qualified Data.Set as Set
|
||||
import Prologue
|
||||
|
||||
-- | An algebraic graph with 'Ord', 'Semigroup', and 'Monoid' instances.
|
||||
newtype Graph vertex = Graph { unGraph :: G.Graph vertex }
|
||||
@ -78,10 +83,16 @@ extendVisited f (Visited a b) = Visited (f a) b
|
||||
extendOrder :: ([v] -> [v]) -> Visited v -> Visited v
|
||||
extendOrder f (Visited a b) = Visited a (f b)
|
||||
|
||||
|
||||
toAdjacencyMap :: Ord v => G.Graph v -> A.AdjacencyMap v
|
||||
toAdjacencyMap = Class.toGraph
|
||||
|
||||
vertexList :: Ord v => Graph v -> [v]
|
||||
vertexList = G.vertexList . unGraph
|
||||
|
||||
edgeList :: Ord v => Graph v -> [Edge v]
|
||||
edgeList = fmap Edge . G.edgeList . unGraph
|
||||
|
||||
-- Instances
|
||||
|
||||
instance Lower (Graph vertex) where
|
||||
lowerBound = Class.empty
|
||||
@ -106,12 +117,15 @@ instance Ord vertex => Ord (Graph vertex) where
|
||||
compare (Graph (G.Connect a1 a2)) (Graph (G.Connect b1 b2)) = (compare `on` Graph) a1 b1 <> (compare `on` Graph) a2 b2
|
||||
|
||||
|
||||
instance (Ord vertex, ToJSON vertex) => ToJSON (Graph vertex) where
|
||||
toJSON (Graph graph) = object ["vertices" .= G.vertexList graph, "edges" .= (JSONEdge <$> G.edgeList graph)]
|
||||
toEncoding (Graph graph) = pairs ("vertices" .= G.vertexList graph <> "edges" .= (JSONEdge <$> G.edgeList graph))
|
||||
class VertexTag vertex where
|
||||
uniqueTag :: vertex -> Int
|
||||
|
||||
newtype JSONEdge vertex = JSONEdge (vertex, vertex)
|
||||
instance (Ord vertex, ToJSON vertex, VertexTag vertex) => ToJSON (Graph vertex) where
|
||||
toJSON (Graph graph) = object ["vertices" .= G.vertexList graph, "edges" .= (Edge <$> G.edgeList graph)]
|
||||
toEncoding (Graph graph) = pairs ("vertices" .= G.vertexList graph <> "edges" .= (Edge <$> G.edgeList graph))
|
||||
|
||||
instance ToJSON vertex => ToJSON (JSONEdge vertex) where
|
||||
toJSON (JSONEdge (a, b)) = object ["source" .= a, "target" .= b]
|
||||
toEncoding (JSONEdge (a, b)) = pairs ("source" .= a <> "target" .= b)
|
||||
newtype Edge vertex = Edge (vertex, vertex)
|
||||
|
||||
instance (ToJSON vertex, VertexTag vertex) => ToJSON (Edge vertex) where
|
||||
toJSON (Edge (a, b)) = object ["source" .= uniqueTag a, "target" .= uniqueTag b]
|
||||
toEncoding (Edge (a, b)) = pairs ("source" .= uniqueTag a <> "target" .= uniqueTag b)
|
||||
|
@ -1,178 +0,0 @@
|
||||
{-# LANGUAGE DeriveAnyClass, LambdaCase, ScopedTypeVariables #-}
|
||||
|
||||
module Data.Graph.Adjacency
|
||||
( AdjacencyList (..)
|
||||
, Edge (..)
|
||||
, Tag
|
||||
, Vertex (..)
|
||||
, VertexType (..)
|
||||
, graphToAdjacencyList
|
||||
, importGraphToGraph
|
||||
, tagGraph
|
||||
, isCoherent
|
||||
) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Algebra.Graph.AdjacencyMap (adjacencyMap)
|
||||
import Algebra.Graph.Class (ToGraph (..), edges, vertices)
|
||||
import Control.Monad.Effect
|
||||
import Control.Monad.Effect.State
|
||||
import Control.Monad.Effect.Fresh
|
||||
import Data.Aeson
|
||||
import Data.Coerce
|
||||
import Data.HashMap.Strict (HashMap, (!))
|
||||
import qualified Data.HashMap.Strict as HashMap
|
||||
import Data.HashSet (HashSet)
|
||||
import qualified Data.HashSet as HashSet
|
||||
import Data.Map (Map)
|
||||
import qualified Data.Map as Map
|
||||
import Data.Set (Set)
|
||||
import qualified Data.Set as Set
|
||||
import Data.Span
|
||||
import qualified Data.Vector as Vec
|
||||
import Data.Word
|
||||
import GHC.Exts (fromList)
|
||||
import qualified Proto3.Suite as PB
|
||||
|
||||
import Data.Graph
|
||||
import qualified Data.Graph.Vertex as V
|
||||
|
||||
-- | Sum type corresponding to a protobuf enum for vertex types.
|
||||
data VertexType
|
||||
= PACKAGE
|
||||
| MODULE
|
||||
| UNKNOWN_MODULE
|
||||
| VARIABLE
|
||||
| METHOD
|
||||
| FUNCTION
|
||||
deriving (Eq, Ord, Show, Enum, Bounded, Generic, ToJSON, FromJSON, PB.Named, PB.Finite, PB.MessageField)
|
||||
|
||||
-- | Defaults to 'PACKAGE'.
|
||||
instance PB.HasDefault VertexType where def = PACKAGE
|
||||
|
||||
-- | Piggybacks on top of the 'Enumerated' instance, as the generated code would.
|
||||
-- This instance will get easier when we have DerivingVia, or a Generic instance
|
||||
-- that hooks into Enumerated.
|
||||
instance PB.Primitive VertexType where
|
||||
primType _ = PB.primType (Proxy @(PB.Enumerated VertexType))
|
||||
encodePrimitive f = PB.encodePrimitive f . PB.Enumerated . Right
|
||||
decodePrimitive = PB.decodePrimitive >>= \case
|
||||
(PB.Enumerated (Right r)) -> pure r
|
||||
other -> Prelude.fail ("VertexType decodeMessageField: unexpected value" <> show other)
|
||||
|
||||
-- | A tag used on each vertext of a 'Graph' to convert to an 'AdjacencyList'.
|
||||
type Tag = Word64
|
||||
|
||||
-- | A protobuf-compatible vertex type, with a unique 'Tag' identifier.
|
||||
data Vertex = Vertex
|
||||
{ vertexType :: VertexType
|
||||
, vertexContents :: Text
|
||||
, vertexTag :: Tag
|
||||
} deriving (Eq, Ord, Show, Generic, PB.Message, PB.Named)
|
||||
|
||||
-- | A protobuf-compatible edge type. Only tag information is carried;
|
||||
-- consumers are expected to look up nodes in the vertex list when necessary.
|
||||
data Edge = Edge { edgeFrom :: Tag, edgeTo :: Tag }
|
||||
deriving (Eq, Ord, Show, Generic, Hashable, PB.Named, PB.Message)
|
||||
|
||||
-- | An adjacency list-representation of a graph. You generally build these by calling
|
||||
-- 'graphToAdjacencyList' on an algebraic 'Graph'. This representation is less efficient and
|
||||
-- fluent than an ordinary 'Graph', but is more amenable to serialization.
|
||||
data AdjacencyList = AdjacencyList
|
||||
{ graphVertices :: PB.NestedVec Vertex
|
||||
, graphEdges :: PB.NestedVec Edge
|
||||
} deriving (Eq, Ord, Show, Generic, PB.Named, PB.Message)
|
||||
|
||||
-- | Convert an algebraic graph to an adjacency list.
|
||||
graphToAdjacencyList :: Graph V.Vertex -> AdjacencyList
|
||||
graphToAdjacencyList = taggedGraphToAdjacencyList . tagGraph . simplify
|
||||
|
||||
-- * Internal interface stuff
|
||||
|
||||
-- Using a PBGraph as the accumulator for the fold would incur
|
||||
-- significant overhead associated with Vector concatenation.
|
||||
-- We use this and then pay the O(v + e) to-Vector cost once.
|
||||
-- The fields are strict because we have StrictData on.
|
||||
data Acc = Acc [Vertex] (HashSet Edge)
|
||||
|
||||
-- Convert a graph with tagged members to a protobuf-compatible adjacency list.
|
||||
-- The Tag is necessary to build a canonical adjacency list.
|
||||
-- Since import graphs can be very large, this is written with speed in mind, in
|
||||
-- that we convert the graph to algebraic-graphs's 'AdjacencyMap' and then fold
|
||||
-- to build a 'Graph', avoiding inefficient vector concatenation.
|
||||
-- Time complexity, given V vertices and E edges, is at least O(2V + 2E + (V * E * log E)),
|
||||
-- plus whatever overhead converting the graph to 'AdjacencyMap' may entail.
|
||||
taggedGraphToAdjacencyList :: Graph (V.Vertex, Tag) -> AdjacencyList
|
||||
taggedGraphToAdjacencyList = accumToAdj . adjMapToAccum . adjacencyMap . toGraph . simplify
|
||||
where adjMapToAccum :: Map (V.Vertex, Tag) (Set (V.Vertex, Tag)) -> Acc
|
||||
adjMapToAccum = Map.foldlWithKey go (Acc [] mempty)
|
||||
|
||||
go :: Acc -> (V.Vertex, Tag) -> Set (V.Vertex, Tag) -> Acc
|
||||
go (Acc vs es) (v, from) edges = Acc (vertexToPB v from : vs) (Set.foldr' (add . snd) es edges)
|
||||
where add = HashSet.insert . Edge from
|
||||
|
||||
accumToAdj :: Acc -> AdjacencyList
|
||||
accumToAdj (Acc vs es) = AdjacencyList (fromList vs) (fromList (toList es))
|
||||
|
||||
vertexToPB :: V.Vertex -> Tag -> Vertex
|
||||
vertexToPB s = Vertex t (V.vertexIdentifier s) where
|
||||
t = case s of
|
||||
V.Package{} -> PACKAGE
|
||||
V.Module{} -> MODULE
|
||||
V.UnknownModule{} -> UNKNOWN_MODULE
|
||||
V.Variable{} -> VARIABLE
|
||||
V.Method{} -> METHOD
|
||||
V.Function{} -> FUNCTION
|
||||
|
||||
-- Annotate all vertices of a 'Graph' with a 'Tag', starting from 1.
|
||||
-- Two vertices @a@ and @b@ will share a 'Tag' iff @a == b@.
|
||||
tagGraph :: forall a . (Eq a, Hashable a) => Graph a -> Graph (a, Tag)
|
||||
tagGraph = unwrap . traverse go where
|
||||
|
||||
unwrap :: Eff '[Fresh, State (HashMap a Tag)] (Graph (a, Tag)) -> Graph (a, Tag)
|
||||
unwrap = run . fmap snd . runState HashMap.empty . runFresh 1
|
||||
|
||||
go :: a -> Eff '[Fresh, State (HashMap a Tag)] (a, Tag)
|
||||
go v = gets (HashMap.lookup v) >>= \case
|
||||
Just t -> pure (v, t)
|
||||
Nothing -> do
|
||||
next <- fromIntegral <$> fresh
|
||||
modify' (HashMap.insert v next)
|
||||
pure (v, next)
|
||||
|
||||
-- | This is the reverse of 'graphToAdjacencyList'. Don't use this outside of a testing context.
|
||||
-- N.B. @importGraphToGraph . graphToAdjacencyList@ is 'id', but @graphToAdjacencyList . importGraphToGraph@ is not.
|
||||
importGraphToGraph :: AdjacencyList -> Graph V.Vertex
|
||||
importGraphToGraph (AdjacencyList vs es) = simplify built
|
||||
where built = allEdges <> vertices unreferencedVertices
|
||||
|
||||
allEdges :: Graph V.Vertex
|
||||
allEdges = fmap fst (edges (foldr addEdge [] es))
|
||||
addEdge (Edge f t) xs = ((adjMap ! f, f), (adjMap ! t, t)) : xs
|
||||
adjMap = foldMap (\v -> HashMap.singleton (vertexTag v) (pbToVertex v)) vs
|
||||
|
||||
unreferencedVertices :: [V.Vertex]
|
||||
unreferencedVertices = pbToVertex <$> toList (Vec.filter isUnreferenced (coerce vs))
|
||||
|
||||
isUnreferenced :: Vertex -> Bool
|
||||
isUnreferenced v = not (vertexTag v `HashSet.member` edgedTags)
|
||||
|
||||
edgedTags :: HashSet Tag
|
||||
edgedTags = HashSet.fromList $ concatMap unEdge es where unEdge (Edge f t) = [f, t]
|
||||
|
||||
pbToVertex :: Vertex -> V.Vertex
|
||||
pbToVertex (Vertex t c _) = case t of
|
||||
PACKAGE -> V.Package c
|
||||
MODULE -> V.Module c
|
||||
UNKNOWN_MODULE -> V.UnknownModule c
|
||||
VARIABLE -> V.Variable c "unknown" emptySpan
|
||||
METHOD -> V.Method c "unknown" emptySpan
|
||||
FUNCTION -> V.Function c "unknown" emptySpan
|
||||
|
||||
|
||||
-- | For debugging: returns True if all edges reference a valid vertex tag.
|
||||
isCoherent :: AdjacencyList -> Bool
|
||||
isCoherent (AdjacencyList vs es) = all edgeValid es where
|
||||
edgeValid (Edge a b) = HashSet.member a allTags && HashSet.member b allTags
|
||||
allTags = HashSet.fromList (toList (vertexTag <$> vs))
|
@ -1,6 +1,6 @@
|
||||
{-# LANGUAGE DeriveAnyClass, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-}
|
||||
module Data.Graph.Vertex
|
||||
( Vertex (..)
|
||||
module Data.Graph.ControlFlowVertex
|
||||
( ControlFlowVertex (..)
|
||||
, packageVertex
|
||||
, moduleVertex
|
||||
, unknownModuleVertex
|
||||
@ -20,6 +20,8 @@ import Data.Abstract.Module (ModuleInfo (..))
|
||||
import Data.Abstract.Name
|
||||
import Data.Abstract.Package (PackageInfo (..))
|
||||
import Data.Aeson
|
||||
import Data.Graph (VertexTag (..))
|
||||
import qualified Data.Graph as G
|
||||
import Data.Record
|
||||
import Data.Span
|
||||
import qualified Data.Syntax as Syntax
|
||||
@ -27,40 +29,41 @@ import qualified Data.Syntax.Declaration as Declaration
|
||||
import qualified Data.Syntax.Expression as Expression
|
||||
import Data.Term
|
||||
import qualified Data.Text as T
|
||||
import GHC.Exts (fromList)
|
||||
import Prologue hiding (packageName)
|
||||
import Proto3.Suite
|
||||
import qualified Proto3.Suite as PB
|
||||
import qualified Proto3.Wire.Encode as Encode
|
||||
|
||||
-- | A vertex of some specific type.
|
||||
data Vertex
|
||||
-- | A vertex of representing some node in a control flow graph.
|
||||
data ControlFlowVertex
|
||||
= Package { vertexName :: Text }
|
||||
| Module { vertexName :: Text }
|
||||
| UnknownModule { vertexName :: Text }
|
||||
| Variable { vertexName :: Text, vertexModuleName :: Text, vertexSpan :: Span }
|
||||
| Method { vertexName :: Text, vertexModuleName :: Text, vertexSpan :: Span }
|
||||
| Function { vertexName :: Text, vertexModuleName :: Text, vertexSpan :: Span }
|
||||
deriving (Eq, Ord, Show, Generic, Hashable)
|
||||
deriving (Eq, Ord, Show, Generic, Hashable, Named)
|
||||
|
||||
packageVertex :: PackageInfo -> Vertex
|
||||
packageVertex :: PackageInfo -> ControlFlowVertex
|
||||
packageVertex (PackageInfo name _) = Package (formatName name)
|
||||
|
||||
moduleVertex :: ModuleInfo -> Vertex
|
||||
moduleVertex :: ModuleInfo -> ControlFlowVertex
|
||||
moduleVertex = Module . T.pack . modulePath
|
||||
|
||||
unknownModuleVertex :: ModuleInfo -> Vertex
|
||||
unknownModuleVertex :: ModuleInfo -> ControlFlowVertex
|
||||
unknownModuleVertex = UnknownModule . T.pack . modulePath
|
||||
|
||||
variableVertex :: Text -> ModuleInfo -> Span -> Vertex
|
||||
variableVertex :: Text -> ModuleInfo -> Span -> ControlFlowVertex
|
||||
variableVertex name ModuleInfo{..} = Variable name (T.pack modulePath)
|
||||
|
||||
methodVertex :: Text -> ModuleInfo -> Span -> Vertex
|
||||
methodVertex :: Text -> ModuleInfo -> Span -> ControlFlowVertex
|
||||
methodVertex name ModuleInfo{..} = Method name (T.pack modulePath)
|
||||
|
||||
functionVertex :: Text -> ModuleInfo -> Span -> Vertex
|
||||
functionVertex :: Text -> ModuleInfo -> Span -> ControlFlowVertex
|
||||
functionVertex name ModuleInfo{..} = Function name (T.pack modulePath)
|
||||
|
||||
instance ToJSON Vertex where
|
||||
toJSON v = object [ "name" .= vertexIdentifier v, "type" .= vertexToType v ]
|
||||
|
||||
vertexIdentifier :: Vertex -> Text
|
||||
vertexIdentifier :: ControlFlowVertex -> Text
|
||||
vertexIdentifier v@Package{..} = vertexName <> " (" <> vertexToType v <> ")"
|
||||
vertexIdentifier v@Module{..} = vertexName <> " (" <> vertexToType v <> ")"
|
||||
vertexIdentifier v@UnknownModule{..} = vertexName <> " (" <> vertexToType v <> ")"
|
||||
@ -72,7 +75,7 @@ showSpan (Span (Pos a b) (Pos c d)) = T.pack $
|
||||
<> " - "
|
||||
<> "[" <> show c <> ", " <> show d <> "]"
|
||||
|
||||
vertexToType :: Vertex -> Text
|
||||
vertexToType :: ControlFlowVertex -> Text
|
||||
vertexToType Package{} = "Package"
|
||||
vertexToType Module{} = "Module"
|
||||
vertexToType UnknownModule{} = "Unknown Module"
|
||||
@ -80,15 +83,83 @@ vertexToType Variable{} = "Variable"
|
||||
vertexToType Method{} = "Method"
|
||||
vertexToType Function{} = "Function"
|
||||
|
||||
instance Lower Vertex where
|
||||
lowerBound = Package ""
|
||||
|
||||
-- Instances
|
||||
|
||||
instance Named (G.Graph ControlFlowVertex) where nameOf _ = "ControlFlowGraph"
|
||||
|
||||
instance Message (G.Graph ControlFlowVertex) where
|
||||
encodeMessage _ graph = encodeMessageField 1 (NestedVec (fromList (G.vertexList graph)))
|
||||
<> encodeMessageField 2 (NestedVec (fromList (G.edgeList graph)))
|
||||
decodeMessage = error "decodeMessage not implemented for (G.Graph ControlFlowVertex)"
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Repeated . Named $ Single "ControlFlowVertex") (Single "vertices") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Repeated . Named $ Single "ControlFlowEdge") (Single "edges") [] Nothing
|
||||
]
|
||||
|
||||
instance Lower ControlFlowVertex where lowerBound = Package ""
|
||||
instance VertexTag ControlFlowVertex where uniqueTag = hash . vertexIdentifier
|
||||
|
||||
instance ToJSON ControlFlowVertex where
|
||||
toJSON v = object [ "name" .= vertexIdentifier v, "type" .= vertexToType v ]
|
||||
|
||||
instance Message ControlFlowVertex where
|
||||
encodeMessage _ v@Package{..} = Encode.embedded 1 (encodePrimitive 1 (uniqueTag v) <> encodePrimitive 2 vertexName <> encodePrimitive 3 (vertexIdentifier v))
|
||||
encodeMessage _ v@Module{..} = Encode.embedded 2 (encodePrimitive 1 (uniqueTag v) <> encodePrimitive 2 vertexName <> encodePrimitive 3 (vertexIdentifier v))
|
||||
encodeMessage _ v@UnknownModule{..} = Encode.embedded 3 (encodePrimitive 1 (uniqueTag v) <> encodePrimitive 2 vertexName <> encodePrimitive 3 (vertexIdentifier v))
|
||||
encodeMessage _ v@Variable{..} = Encode.embedded 4 (encodePrimitive 1 (uniqueTag v) <> encodePrimitive 2 vertexName <> encodePrimitive 3 (vertexIdentifier v) <> encodePrimitive 4 vertexModuleName <> Encode.embedded 5 (encodeMessage 1 vertexSpan))
|
||||
encodeMessage _ v@Method{..} = Encode.embedded 5 (encodePrimitive 1 (uniqueTag v) <> encodePrimitive 2 vertexName <> encodePrimitive 3 (vertexIdentifier v) <> encodePrimitive 4 vertexModuleName <> Encode.embedded 5 (encodeMessage 1 vertexSpan))
|
||||
encodeMessage _ v@Function{..} = Encode.embedded 6 (encodePrimitive 1 (uniqueTag v) <> encodePrimitive 2 vertexName <> encodePrimitive 3 (vertexIdentifier v) <> encodePrimitive 4 vertexModuleName <> Encode.embedded 5 (encodeMessage 1 vertexSpan))
|
||||
decodeMessage = error "decodeMessage not implemented for ControlFlowVertex"
|
||||
dotProto _ =
|
||||
[ DotProtoMessageOneOf (Single "vertex")
|
||||
[ DotProtoField 1 (Prim . Named $ Single "Package") (Single "package") [] Nothing
|
||||
, DotProtoField 2 (Prim . Named $ Single "Module") (Single "module") [] Nothing
|
||||
, DotProtoField 3 (Prim . Named $ Single "UnknownModule") (Single "unknownModule") [] Nothing
|
||||
, DotProtoField 4 (Prim . Named $ Single "Variable") (Single "variable") [] Nothing
|
||||
, DotProtoField 5 (Prim . Named $ Single "Method") (Single "method") [] Nothing
|
||||
, DotProtoField 6 (Prim . Named $ Single "Function") (Single "function") [] Nothing
|
||||
]
|
||||
]
|
||||
<> gen "Package" mempty
|
||||
<> gen "Module" mempty
|
||||
<> gen "UnknownModule" mempty
|
||||
<> gen "Variable" [ genModuleName, genSpan ]
|
||||
<> gen "Method" [ genModuleName, genSpan ]
|
||||
<> gen "Function" [ genModuleName, genSpan ]
|
||||
where
|
||||
genModuleName = DotProtoMessageField $ DotProtoField 4 (Prim PB.String) (Single "moduleName") [] Nothing
|
||||
genSpan = DotProtoMessageField $ DotProtoField 5 (Prim . Named $ Single (nameOf (Proxy @Span))) (Single "span") [] Nothing
|
||||
gen name extras =
|
||||
[ DotProtoMessageDefinition . DotProtoMessage (Single name) $
|
||||
(DotProtoMessageField $ DotProtoField 1 (Prim PB.Int64) (Single "id") [] Nothing)
|
||||
: (DotProtoMessageField $ DotProtoField 2 (Prim PB.String) (Single "name") [] Nothing)
|
||||
: (DotProtoMessageField $ DotProtoField 3 (Prim PB.String) (Single "description") [] Nothing)
|
||||
: extras
|
||||
]
|
||||
|
||||
|
||||
instance Named (G.Edge ControlFlowVertex) where nameOf _ = "ControlFlowEdge"
|
||||
|
||||
instance Message (G.Edge ControlFlowVertex) where
|
||||
encodeMessage _ (G.Edge (from, to)) = encodePrimitive 1 (uniqueTag from) <> encodePrimitive 2 (uniqueTag to)
|
||||
decodeMessage = error "decodeMessage not implemented for (G.Edge ControlFlowVertex)"
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim PB.Int64) (Single "source") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim PB.Int64) (Single "target") [] Nothing
|
||||
]
|
||||
|
||||
|
||||
-- TODO: This is potentially valuable just to get name's out of declarable things.
|
||||
-- Typeclasses to create 'ControlFlowVertex's from 'Term's. Also extracts
|
||||
-- 'Name's for terms with symbolic names like Identifiers and Declarations.
|
||||
|
||||
class VertexDeclaration syntax where
|
||||
toVertex :: (Declarations1 syntax, Foldable syntax, HasField fields Span)
|
||||
=> Record fields
|
||||
-> ModuleInfo
|
||||
-> syntax (Term syntax (Record fields))
|
||||
-> Maybe (Vertex, Name)
|
||||
-> Maybe (ControlFlowVertex, Name)
|
||||
|
||||
instance (VertexDeclaration' syntax syntax) => VertexDeclaration syntax where
|
||||
toVertex = toVertex'
|
||||
@ -98,7 +169,7 @@ class VertexDeclaration' whole syntax where
|
||||
=> Record fields
|
||||
-> ModuleInfo
|
||||
-> syntax (Term whole (Record fields))
|
||||
-> Maybe (Vertex, Name)
|
||||
-> Maybe (ControlFlowVertex, Name)
|
||||
|
||||
instance (VertexDeclarationStrategy syntax ~ strategy, VertexDeclarationWithStrategy strategy whole syntax) => VertexDeclaration' whole syntax where
|
||||
toVertex' = toVertexWithStrategy (Proxy :: Proxy strategy)
|
||||
@ -119,7 +190,7 @@ class VertexDeclarationWithStrategy (strategy :: Strategy) whole syntax where
|
||||
-> Record fields
|
||||
-> ModuleInfo
|
||||
-> syntax (Term whole (Record fields))
|
||||
-> Maybe (Vertex, Name)
|
||||
-> Maybe (ControlFlowVertex, Name)
|
||||
|
||||
-- | The 'Default' strategy produces 'Nothing'.
|
||||
instance VertexDeclarationWithStrategy 'Default whole syntax where
|
93
src/Data/Graph/DiffVertex.hs
Normal file
93
src/Data/Graph/DiffVertex.hs
Normal file
@ -0,0 +1,93 @@
|
||||
module Data.Graph.DiffVertex
|
||||
( DiffVertex(..)
|
||||
, DiffVertexTerm(..)
|
||||
, DeletedTerm(..)
|
||||
, InsertedTerm(..)
|
||||
, ReplacedTerm(..)
|
||||
, MergedTerm(..)
|
||||
|
||||
-- rexport
|
||||
, TermVertex(..)
|
||||
, TermAnnotation(..)
|
||||
) where
|
||||
|
||||
import Data.Graph
|
||||
import Data.Graph.TermVertex
|
||||
import Data.Aeson
|
||||
import Data.JSON.Fields
|
||||
import qualified Data.Text as T
|
||||
|
||||
-- Diffs
|
||||
|
||||
data DiffVertex
|
||||
= DiffVertex
|
||||
{ diffVertexId :: Int
|
||||
, diffVertexTerm :: DiffVertexTerm
|
||||
} deriving (Eq, Ord, Show)
|
||||
|
||||
data DiffVertexTerm
|
||||
= Deleted DeletedTerm
|
||||
| Inserted InsertedTerm
|
||||
| Replaced ReplacedTerm
|
||||
| Merged MergedTerm
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
data MergedTerm
|
||||
= MergedTerm
|
||||
{ mergedTermName :: String
|
||||
, mergedTermBefore :: TermAnnotation
|
||||
, mergedTermAfter :: TermAnnotation
|
||||
} deriving (Eq, Ord, Show)
|
||||
|
||||
data DeletedTerm
|
||||
= DeletedTerm
|
||||
{ deletedTermName :: String
|
||||
, deletedTermBefore :: TermAnnotation
|
||||
} deriving (Eq, Ord, Show)
|
||||
|
||||
data InsertedTerm
|
||||
= InsertedTerm
|
||||
{ insertedTermName :: String
|
||||
, insertedTermAfter :: TermAnnotation
|
||||
} deriving (Eq, Ord, Show)
|
||||
|
||||
data ReplacedTerm
|
||||
= ReplacedTerm
|
||||
{ replacedTermBefore :: DeletedTerm
|
||||
, replacedTermAfter :: InsertedTerm
|
||||
} deriving (Eq, Ord, Show)
|
||||
|
||||
-- Instances
|
||||
|
||||
instance ToJSON MergedTerm where
|
||||
toJSON MergedTerm{..} = object
|
||||
[ "term" .= mergedTermName
|
||||
, "before" .= mergedTermBefore
|
||||
, "after" .= mergedTermAfter
|
||||
]
|
||||
|
||||
instance ToJSON DeletedTerm where
|
||||
toJSON DeletedTerm{..} = object
|
||||
[ "term" .= deletedTermName
|
||||
, "before" .= deletedTermBefore
|
||||
]
|
||||
|
||||
instance ToJSON InsertedTerm where
|
||||
toJSON InsertedTerm{..} = object
|
||||
[ "term" .= insertedTermName
|
||||
, "after" .= insertedTermAfter
|
||||
]
|
||||
|
||||
instance ToJSON ReplacedTerm where
|
||||
toJSON (ReplacedTerm DeletedTerm{..} InsertedTerm{..})
|
||||
= object [ "before" .= deleted, "after" .= inserted ]
|
||||
where deleted = object $ [ "term" .= deletedTermName ] <> toJSONFields deletedTermBefore
|
||||
inserted = object $ [ "term" .= insertedTermName ] <> toJSONFields insertedTermAfter
|
||||
|
||||
instance ToJSON DiffVertex where
|
||||
toJSON (DiffVertex i (Deleted t)) = object [ "id" .= T.pack (show i), "deleted" .= t ]
|
||||
toJSON (DiffVertex i (Inserted t)) = object [ "id" .= T.pack (show i), "inserted" .= t ]
|
||||
toJSON (DiffVertex i (Replaced t)) = object [ "id" .= T.pack (show i), "replaced" .= t ]
|
||||
toJSON (DiffVertex i (Merged t)) = object [ "id" .= T.pack (show i), "merged" .= t ]
|
||||
|
||||
instance VertexTag DiffVertex where uniqueTag = diffVertexId
|
102
src/Data/Graph/TermVertex.hs
Normal file
102
src/Data/Graph/TermVertex.hs
Normal file
@ -0,0 +1,102 @@
|
||||
{-# LANGUAGE DeriveAnyClass, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-}
|
||||
module Data.Graph.TermVertex
|
||||
( TermVertex(..)
|
||||
, TermAnnotation(..)
|
||||
) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Graph
|
||||
import Data.JSON.Fields
|
||||
import Data.Range
|
||||
import Data.Span
|
||||
import GHC.Exts (fromList)
|
||||
import Proto3.Suite
|
||||
import qualified Proto3.Suite as PB
|
||||
import Proto3.Wire.Decode as Decode
|
||||
import Proto3.Wire.Encode as Encode
|
||||
|
||||
-- Terms
|
||||
|
||||
data TermVertex
|
||||
= TermVertex
|
||||
{ vertexId :: Int
|
||||
, vertexTermName :: String
|
||||
, vertexAnnotation :: TermAnnotation
|
||||
} deriving (Eq, Ord, Show, Generic, Named)
|
||||
|
||||
data TermAnnotation
|
||||
= TermAnnotation
|
||||
{ range :: Range
|
||||
, span :: Span
|
||||
} deriving (Eq, Ord, Show, Generic, Named)
|
||||
|
||||
|
||||
-- Instances
|
||||
|
||||
instance Named (Graph TermVertex) where nameOf _ = "TermGraph"
|
||||
instance Message (Graph TermVertex) where
|
||||
encodeMessage _ graph = encodeMessageField 1 (NestedVec (fromList (vertexList graph)))
|
||||
<> encodeMessageField 2 (NestedVec (fromList (edgeList graph)))
|
||||
decodeMessage = error "decodeMessage not implemented for (Graph TermVertex)"
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Repeated . Named $ Single "TermVertex") (Single "vertices") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Repeated . Named $ Single "TermEdge") (Single "edges") [] Nothing
|
||||
]
|
||||
|
||||
instance Named (Edge TermVertex) where nameOf _ = "TermEdge"
|
||||
instance Message (Edge TermVertex) where
|
||||
encodeMessage _ (Edge (from, to)) = encodePrimitive 1 (uniqueTag from) <> encodePrimitive 2 (uniqueTag to)
|
||||
decodeMessage = error "decodeMessage not implemented for (Edge TermVertex)"
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim PB.Int64) (Single "source") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim PB.Int64) (Single "target") [] Nothing
|
||||
]
|
||||
|
||||
instance Message TermVertex where
|
||||
encodeMessage _ TermVertex{..}
|
||||
= encodeMessageField 1 vertexId
|
||||
<> encodeMessageField 2 vertexTermName
|
||||
<> Encode.embedded 3 (encodeMessage 0 vertexAnnotation)
|
||||
decodeMessage _
|
||||
= TermVertex
|
||||
<$> Decode.at decodeMessageField 1
|
||||
<*> Decode.at decodeMessageField 2
|
||||
<*> embeddedAt (decodeMessage 0) 3
|
||||
where embeddedAt parser = Decode.at (Decode.embedded'' parser)
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim PB.Int64) (Single "id") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim PB.String) (Single "name") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 3 (Prim . Named $ Single "TermAnnotation") (Single "annotation") [] Nothing
|
||||
]
|
||||
|
||||
instance VertexTag TermVertex where uniqueTag = vertexId
|
||||
|
||||
instance ToJSON TermVertex where
|
||||
toJSON TermVertex{..} = object $
|
||||
[ "id" .= vertexId
|
||||
, "term" .= vertexTermName
|
||||
] <> toJSONFields vertexAnnotation
|
||||
toEncoding TermVertex{..} = pairs . fold $
|
||||
"id" .= vertexId
|
||||
: "term" .= vertexTermName
|
||||
: toJSONFields vertexAnnotation
|
||||
|
||||
instance Message TermAnnotation where
|
||||
encodeMessage _ TermAnnotation{..} = Encode.embedded 1 (encodeMessage 0 range) <> Encode.embedded 2 (encodeMessage 0 span)
|
||||
decodeMessage _ = TermAnnotation <$> embeddedAt (decodeMessage 0) 1 <*> embeddedAt (decodeMessage 0) 2
|
||||
where embeddedAt parser = Decode.at (Decode.embedded'' parser)
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim . Named $ Single (nameOf (Proxy @Range))) (Single "range") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim . Named $ Single (nameOf (Proxy @Span))) (Single "span") [] Nothing
|
||||
]
|
||||
|
||||
instance HasDefault TermAnnotation where
|
||||
def = TermAnnotation def def
|
||||
|
||||
instance ToJSON TermAnnotation where
|
||||
toJSON TermAnnotation{..} = object $ toJSONFields range <> toJSONFields span
|
||||
|
||||
instance ToJSONFields TermAnnotation where
|
||||
toJSONFields TermAnnotation{..} = toJSONFields range <> toJSONFields span
|
92
src/Data/Proto/DiffTree.hs
Normal file
92
src/Data/Proto/DiffTree.hs
Normal file
@ -0,0 +1,92 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
module Data.Proto.DiffTree (DiffTree(..), ResponseType(..)) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Data.Language
|
||||
import Data.Diff
|
||||
import qualified Language.Go.Assignment as Go
|
||||
import qualified Language.Haskell.Assignment as Haskell
|
||||
import qualified Language.Java.Assignment as Java
|
||||
import qualified Language.JSON.Assignment as JSON
|
||||
import qualified Language.Markdown.Assignment as Markdown
|
||||
import qualified Language.PHP.Assignment as PHP
|
||||
import qualified Language.Python.Assignment as Python
|
||||
import qualified Language.Ruby.Assignment as Ruby
|
||||
import qualified Language.TypeScript.Assignment as TypeScript
|
||||
import Proto3.Suite
|
||||
import qualified Proto3.Suite as PB
|
||||
import qualified Proto3.Wire.Encode as Encode
|
||||
|
||||
type GoDiff = Diff (Sum Go.Syntax) () ()
|
||||
type HaskellDiff = Diff (Sum Haskell.Syntax) () ()
|
||||
type JavaDiff = Diff (Sum Java.Syntax) () ()
|
||||
type JSONDiff = Diff (Sum JSON.Syntax) () ()
|
||||
type MarkdownDiff = Diff (Sum Markdown.Syntax) () ()
|
||||
type PythonDiff = Diff (Sum Python.Syntax) () ()
|
||||
type RubyDiff = Diff (Sum Ruby.Syntax) () ()
|
||||
type TypeScriptDiff = Diff (Sum TypeScript.Syntax) () ()
|
||||
type PHPDiff = Diff (Sum PHP.Syntax) () ()
|
||||
|
||||
data DiffTree
|
||||
= DiffTree
|
||||
{ languageBefore :: Language
|
||||
, languageAfter :: Language
|
||||
, pathBefore :: FilePath
|
||||
, pathAfter :: FilePath
|
||||
, responseType :: Maybe ResponseType
|
||||
} deriving (Eq, Show, Generic, Named)
|
||||
|
||||
data ResponseType
|
||||
= ParseDiffError String
|
||||
| GoDiffResponse GoDiff
|
||||
| HaskellDiffResponse HaskellDiff
|
||||
| JavaDiffResponse JavaDiff
|
||||
| JSONDiffResponse JSONDiff
|
||||
| MarkdownDiffResponse MarkdownDiff
|
||||
| PythonDiffResponse PythonDiff
|
||||
| RubyDiffResponse RubyDiff
|
||||
| TypeScriptDiffResponse TypeScriptDiff
|
||||
| PHPDiffResponse PHPDiff
|
||||
deriving (Eq, Show)
|
||||
|
||||
|
||||
-- Instances
|
||||
|
||||
instance Message DiffTree where
|
||||
encodeMessage _ DiffTree{..}
|
||||
= encodeMessageField 1 languageBefore
|
||||
<> encodeMessageField 2 languageAfter
|
||||
<> encodeMessageField 3 pathBefore
|
||||
<> encodeMessageField 4 pathAfter
|
||||
<> case responseType of
|
||||
Just (ParseDiffError x) -> Encode.embedded 5 (encodeMessageField 1 x)
|
||||
Just (GoDiffResponse x) -> Encode.embedded 6 (encodeMessage 1 x)
|
||||
Just (HaskellDiffResponse x) -> Encode.embedded 7 (encodeMessage 1 x)
|
||||
Just (JavaDiffResponse x) -> Encode.embedded 8 (encodeMessage 1 x)
|
||||
Just (JSONDiffResponse x) -> Encode.embedded 9 (encodeMessage 1 x)
|
||||
Just (MarkdownDiffResponse x) -> Encode.embedded 10 (encodeMessage 1 x)
|
||||
Just (PythonDiffResponse x) -> Encode.embedded 11 (encodeMessage 1 x)
|
||||
Just (RubyDiffResponse x) -> Encode.embedded 12 (encodeMessage 1 x)
|
||||
Just (TypeScriptDiffResponse x) -> Encode.embedded 13 (encodeMessage 1 x)
|
||||
Just (PHPDiffResponse x) -> Encode.embedded 14 (encodeMessage 1 x)
|
||||
_ -> mempty
|
||||
decodeMessage = error "decodeMessage not implemented for DiffTree"
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim . Named $ Single "Language") (Single "language_before") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim . Named $ Single "Language") (Single "language_after") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 3 (Prim PB.String) (Single "path_before") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 4 (Prim PB.String) (Single "path_after") [] Nothing
|
||||
, DotProtoMessageOneOf (Single "response_type")
|
||||
[ DotProtoField 5 (Prim PB.String) (Single "error") [] Nothing
|
||||
, DotProtoField 6 (Prim . Named $ Dots (Path ["godiff", "GoDiff"])) (Single "go_diff") [] Nothing
|
||||
, DotProtoField 7 (Prim . Named $ Dots (Path ["haskelldiff", "HaskellDiff"])) (Single "haskell_diff") [] Nothing
|
||||
, DotProtoField 8 (Prim . Named $ Dots (Path ["javadiff", "JavaDiff"])) (Single "java_diff") [] Nothing
|
||||
, DotProtoField 9 (Prim . Named $ Dots (Path ["jsondiff", "JSONDiff"])) (Single "json_diff") [] Nothing
|
||||
, DotProtoField 10 (Prim . Named $ Dots (Path ["markdowndiff", "MarkdownDiff"])) (Single "markdown_diff") [] Nothing
|
||||
, DotProtoField 11 (Prim . Named $ Dots (Path ["pythondiff", "PythonDiff"])) (Single "python_diff") [] Nothing
|
||||
, DotProtoField 12 (Prim . Named $ Dots (Path ["rubydiff", "RubyDiff"])) (Single "ruby_diff") [] Nothing
|
||||
, DotProtoField 13 (Prim . Named $ Dots (Path ["typescriptdiff", "TypeScriptDiff"])) (Single "typescript_diff") [] Nothing
|
||||
, DotProtoField 14 (Prim . Named $ Dots (Path ["phpdiff", "PHPDiff"])) (Single "php_diff") [] Nothing
|
||||
]
|
||||
]
|
86
src/Data/Proto/ParseTree.hs
Normal file
86
src/Data/Proto/ParseTree.hs
Normal file
@ -0,0 +1,86 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
module Data.Proto.ParseTree (ParseTree(..), ResponseType(..)) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Data.Language
|
||||
import Data.Term
|
||||
import qualified Language.Go.Assignment as Go
|
||||
import qualified Language.Haskell.Assignment as Haskell
|
||||
import qualified Language.Java.Assignment as Java
|
||||
import qualified Language.JSON.Assignment as JSON
|
||||
import qualified Language.Markdown.Assignment as Markdown
|
||||
import qualified Language.PHP.Assignment as PHP
|
||||
import qualified Language.Python.Assignment as Python
|
||||
import qualified Language.Ruby.Assignment as Ruby
|
||||
import qualified Language.TypeScript.Assignment as TypeScript
|
||||
import Proto3.Suite
|
||||
import qualified Proto3.Suite as PB
|
||||
import qualified Proto3.Wire.Encode as Encode
|
||||
|
||||
type GoTerm = Term (Sum Go.Syntax) ()
|
||||
type HaskellTerm = Term (Sum Haskell.Syntax) ()
|
||||
type JavaTerm = Term (Sum Java.Syntax) ()
|
||||
type JSONTerm = Term (Sum JSON.Syntax) ()
|
||||
type MarkdownTerm = Term (Sum Markdown.Syntax) ()
|
||||
type PythonTerm = Term (Sum Python.Syntax) ()
|
||||
type RubyTerm = Term (Sum Ruby.Syntax) ()
|
||||
type TypeScriptTerm = Term (Sum TypeScript.Syntax) ()
|
||||
type PHPTerm = Term (Sum PHP.Syntax) ()
|
||||
|
||||
data ParseTree
|
||||
= ParseTree
|
||||
{ language :: Language
|
||||
, path :: FilePath
|
||||
, responseType :: Maybe ResponseType
|
||||
} deriving (Eq, Show, Generic, Named)
|
||||
|
||||
data ResponseType
|
||||
= ParseError String
|
||||
| GoResponse GoTerm
|
||||
| HaskellResponse HaskellTerm
|
||||
| JavaResponse JavaTerm
|
||||
| JSONResponse JSONTerm
|
||||
| MarkdownResponse MarkdownTerm
|
||||
| PythonResponse PythonTerm
|
||||
| RubyResponse RubyTerm
|
||||
| TypeScriptResponse TypeScriptTerm
|
||||
| PHPResponse PHPTerm
|
||||
deriving (Eq, Show)
|
||||
|
||||
|
||||
-- Instances
|
||||
|
||||
instance Message ParseTree where
|
||||
encodeMessage _ ParseTree{..}
|
||||
= encodeMessageField 1 language
|
||||
<> encodeMessageField 2 path
|
||||
<> case responseType of
|
||||
Just (ParseError x) -> Encode.embedded 3 (encodeMessageField 1 x)
|
||||
Just (GoResponse x) -> Encode.embedded 4 (encodeMessage 1 x)
|
||||
Just (HaskellResponse x) -> Encode.embedded 5 (encodeMessage 1 x)
|
||||
Just (JavaResponse x) -> Encode.embedded 6 (encodeMessage 1 x)
|
||||
Just (JSONResponse x) -> Encode.embedded 7 (encodeMessage 1 x)
|
||||
Just (MarkdownResponse x) -> Encode.embedded 8 (encodeMessage 1 x)
|
||||
Just (PythonResponse x) -> Encode.embedded 9 (encodeMessage 1 x)
|
||||
Just (RubyResponse x) -> Encode.embedded 10 (encodeMessage 1 x)
|
||||
Just (TypeScriptResponse x) -> Encode.embedded 11 (encodeMessage 1 x)
|
||||
Just (PHPResponse x) -> Encode.embedded 12 (encodeMessage 1 x)
|
||||
_ -> mempty
|
||||
decodeMessage = error "decodeMessage not implemented for ParseTree"
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim . Named $ Single "Language") (Single "language") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim PB.String) (Single "path") [] Nothing
|
||||
, DotProtoMessageOneOf (Single "response_type")
|
||||
[ DotProtoField 3 (Prim PB.String) (Single "error") [] Nothing
|
||||
, DotProtoField 4 (Prim . Named $ Dots (Path ["goterm", "GoTerm"])) (Single "go_tree") [] Nothing
|
||||
, DotProtoField 5 (Prim . Named $ Dots (Path ["haskellterm", "HaskellTerm"])) (Single "haskell_tree") [] Nothing
|
||||
, DotProtoField 6 (Prim . Named $ Dots (Path ["javaterm", "JavaTerm"])) (Single "java_tree") [] Nothing
|
||||
, DotProtoField 7 (Prim . Named $ Dots (Path ["jsonterm", "JSONTerm"])) (Single "json_tree") [] Nothing
|
||||
, DotProtoField 8 (Prim . Named $ Dots (Path ["markdownterm", "MarkdownTerm"])) (Single "markdown_tree") [] Nothing
|
||||
, DotProtoField 9 (Prim . Named $ Dots (Path ["pythonterm", "PythonTerm"])) (Single "python_tree") [] Nothing
|
||||
, DotProtoField 10 (Prim . Named $ Dots (Path ["rubyterm", "RubyTerm"])) (Single "ruby_tree") [] Nothing
|
||||
, DotProtoField 11 (Prim . Named $ Dots (Path ["typescriptterm", "TypeScriptTerm"])) (Single "typescript_tree") [] Nothing
|
||||
, DotProtoField 12 (Prim . Named $ Dots (Path ["phpterm", "PHPTerm"])) (Single "php_tree") [] Nothing
|
||||
]
|
||||
]
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
module Data.Range
|
||||
( Range(..)
|
||||
, emptyRange
|
||||
@ -7,13 +8,16 @@ module Data.Range
|
||||
, subtractRange
|
||||
) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Data.Aeson
|
||||
import Data.JSON.Fields
|
||||
import Prologue
|
||||
import Proto3.Suite
|
||||
import Proto3.Wire.Decode as Decode
|
||||
|
||||
-- | A half-open interval of integers, defined by start & end indices.
|
||||
data Range = Range { start :: {-# UNPACK #-} !Int, end :: {-# UNPACK #-} !Int }
|
||||
deriving (Eq, Show, Generic)
|
||||
deriving (Eq, Show, Generic, Named)
|
||||
|
||||
emptyRange :: Range
|
||||
emptyRange = Range 0 0
|
||||
@ -54,3 +58,14 @@ instance ToJSONFields Range where
|
||||
|
||||
instance Lower Range where
|
||||
lowerBound = Range 0 0
|
||||
|
||||
instance HasDefault Range where
|
||||
def = lowerBound @Range
|
||||
|
||||
instance Message Range where
|
||||
encodeMessage _ Range{..} = encodeMessageField 1 start <> encodeMessageField 2 end
|
||||
decodeMessage _ = Range <$> Decode.at decodeMessageField 1 <*> Decode.at decodeMessageField 2
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim Int64) (Single "start") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim Int64) (Single "end") [] Nothing
|
||||
]
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
|
||||
module Data.Reprinting.Splice
|
||||
( Fragment(..)
|
||||
, copy
|
||||
@ -12,10 +14,12 @@ module Data.Reprinting.Splice
|
||||
, Indentation(..)
|
||||
) where
|
||||
|
||||
import Data.Reprinting.Token
|
||||
import Data.Sequence (singleton, fromList)
|
||||
import Prologue hiding (Element)
|
||||
|
||||
import Data.Machine
|
||||
|
||||
import Data.Reprinting.Token
|
||||
|
||||
-- | An intermediate representation of concrete syntax in the reprinting pipeline.
|
||||
data Fragment
|
||||
= Verbatim Text
|
||||
@ -28,16 +32,16 @@ data Fragment
|
||||
deriving (Eq, Show)
|
||||
|
||||
-- | Copy along some original, un-refactored 'Text'.
|
||||
copy :: Text -> Seq Fragment
|
||||
copy = singleton . Verbatim
|
||||
copy :: Text -> Plan k Fragment ()
|
||||
copy = yield . Verbatim
|
||||
|
||||
-- | Insert some new 'Text'.
|
||||
insert :: Element -> [Context] -> Text -> Seq Fragment
|
||||
insert el c = singleton . New el c
|
||||
insert :: Element -> [Context] -> Text -> Plan k Fragment ()
|
||||
insert el c = yield . New el c
|
||||
|
||||
-- | Defer processing an element to a later stage.
|
||||
defer :: Element -> [Context] -> Seq Fragment
|
||||
defer el = singleton . Defer el
|
||||
defer :: Element -> [Context] -> Plan k Fragment ()
|
||||
defer el = yield . Defer el
|
||||
|
||||
-- | The final representation of concrete syntax in the reprinting pipeline.
|
||||
data Splice
|
||||
@ -46,20 +50,20 @@ data Splice
|
||||
deriving (Eq, Show)
|
||||
|
||||
-- | Emit some 'Text' as a 'Splice'.
|
||||
emit :: Text -> Seq Splice
|
||||
emit = singleton . Emit
|
||||
emit :: Text -> Plan k Splice ()
|
||||
emit = yield . Emit
|
||||
|
||||
-- | Construct a layout 'Splice'.
|
||||
layout :: Whitespace -> Seq Splice
|
||||
layout = singleton . Layout
|
||||
layout :: Whitespace -> Plan k Splice ()
|
||||
layout = yield . Layout
|
||||
|
||||
-- | Construct multiple layouts.
|
||||
layouts :: [Whitespace] -> Seq Splice
|
||||
layouts = fromList . fmap Layout
|
||||
layouts :: [Whitespace] -> Plan k Splice ()
|
||||
layouts = traverse_ (yield . Layout)
|
||||
|
||||
-- | Single space.
|
||||
space :: Seq Splice
|
||||
space = layout Space
|
||||
space :: Plan k Splice ()
|
||||
space = yield (Layout Space)
|
||||
|
||||
-- | Indentation, spacing, and other whitespace.
|
||||
data Whitespace
|
||||
|
@ -19,20 +19,31 @@ import Data.JSON.Fields
|
||||
import GHC.Stack
|
||||
import Prologue
|
||||
|
||||
-- | Source position information
|
||||
-- | Source position information (1 indexed)
|
||||
data Pos = Pos
|
||||
{ posLine :: !Int
|
||||
, posColumn :: !Int
|
||||
}
|
||||
deriving (Show, Read, Eq, Ord, Generic, Hashable, Named, Message)
|
||||
deriving (Show, Read, Eq, Ord, Generic, Hashable)
|
||||
|
||||
instance MessageField Pos where
|
||||
encodeMessageField num = Encode.embedded num . encodeMessage (fieldNumber 1)
|
||||
decodeMessageField = fromMaybe def <$> Decode.embedded (decodeMessage (fieldNumber 1))
|
||||
protoType pr = messageField (Prim $ Named (Single (nameOf pr))) Nothing
|
||||
-- | A Span of position information
|
||||
data Span = Span
|
||||
{ spanStart :: Pos
|
||||
, spanEnd :: Pos
|
||||
}
|
||||
deriving (Show, Read, Eq, Ord, Generic, Hashable, Named)
|
||||
|
||||
instance HasDefault Pos where
|
||||
def = Pos 1 1
|
||||
|
||||
-- Instances
|
||||
|
||||
instance Named Pos where nameOf _ = "Position"
|
||||
instance Message Pos where
|
||||
encodeMessage _ Pos{..} = encodeMessageField 1 posLine <> encodeMessageField 2 posColumn
|
||||
decodeMessage _ = Pos <$> Decode.at decodeMessageField 1 <*> Decode.at decodeMessageField 2
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim Int64) (Single "line") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim Int64) (Single "column") [] Nothing
|
||||
]
|
||||
|
||||
instance A.ToJSON Pos where
|
||||
toJSON Pos{..} =
|
||||
@ -46,11 +57,18 @@ instance A.FromJSON Pos where
|
||||
instance Lower Pos where
|
||||
lowerBound = Pos 1 1
|
||||
|
||||
data Span = Span
|
||||
{ spanStart :: Pos
|
||||
, spanEnd :: Pos
|
||||
}
|
||||
deriving (Show, Read, Eq, Ord, Generic, Hashable, Named, Message)
|
||||
instance HasDefault Pos where
|
||||
def = lowerBound @Pos
|
||||
|
||||
|
||||
instance Message Span where
|
||||
encodeMessage _ Span{..} = Encode.embedded 1 (encodeMessage 1 spanStart) <> Encode.embedded 2 (encodeMessage 1 spanEnd)
|
||||
decodeMessage _ = Span <$> embeddedAt (decodeMessage 1) 1 <*> embeddedAt (decodeMessage 1) 2
|
||||
where embeddedAt parser = Decode.at (Decode.embedded'' parser)
|
||||
dotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim . Named $ Single (nameOf (Proxy @Pos))) (Single "start") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim . Named $ Single (nameOf (Proxy @Pos))) (Single "end") [] Nothing
|
||||
]
|
||||
|
||||
spanFromSrcLoc :: SrcLoc -> Span
|
||||
spanFromSrcLoc = Span . (Pos . srcLocStartLine <*> srcLocStartCol) <*> (Pos . srcLocEndLine <*> srcLocEndCol)
|
||||
@ -77,4 +95,7 @@ instance ToJSONFields Span where
|
||||
toJSONFields sourceSpan = [ "sourceSpan" .= sourceSpan ]
|
||||
|
||||
instance Lower Span where
|
||||
lowerBound = Span lowerBound lowerBound
|
||||
lowerBound = emptySpan
|
||||
|
||||
instance HasDefault Span where
|
||||
def = emptySpan
|
||||
|
@ -543,7 +543,7 @@ instance Show1 Cast where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Cast
|
||||
|
||||
data Super a = Super
|
||||
deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)
|
||||
deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1, Named1, Message1)
|
||||
|
||||
instance Eq1 Super where liftEq = genericLiftEq
|
||||
instance Ord1 Super where liftCompare = genericLiftCompare
|
||||
|
@ -2,14 +2,15 @@
|
||||
{-# OPTIONS_GHC -Wno-missing-export-lists #-}
|
||||
module Data.Syntax.Literal where
|
||||
|
||||
import Prelude hiding (Float, null)
|
||||
import Prologue hiding (Set, hash, null)
|
||||
|
||||
import Data.Abstract.Evaluatable as Eval
|
||||
import Data.JSON.Fields
|
||||
import Data.Scientific.Exts
|
||||
import qualified Data.Text as T
|
||||
import Diffing.Algorithm
|
||||
import Numeric.Exts
|
||||
import Prelude hiding (Float, null)
|
||||
import Prologue hiding (Set, hash, null)
|
||||
import Proto3.Suite.Class
|
||||
import Reprinting.Tokenize as Tok
|
||||
import Text.Read (readMaybe)
|
||||
@ -265,7 +266,7 @@ instance Evaluatable Set
|
||||
-- Pointers
|
||||
|
||||
-- | A declared pointer (e.g. var pointer *int in Go)
|
||||
newtype Pointer a = Pointer a
|
||||
newtype Pointer a = Pointer { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Pointer where liftEq = genericLiftEq
|
||||
@ -277,7 +278,7 @@ instance Evaluatable Pointer
|
||||
|
||||
|
||||
-- | A reference to a pointer's address (e.g. &pointer in Go)
|
||||
newtype Reference a = Reference a
|
||||
newtype Reference a = Reference { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Reference where liftEq = genericLiftEq
|
||||
|
@ -145,7 +145,7 @@ instance Evaluatable Assignment where
|
||||
pure (Rval rhs)
|
||||
|
||||
-- | Post increment operator (e.g. 1++ in Go, or i++ in C).
|
||||
newtype PostIncrement a = PostIncrement a
|
||||
newtype PostIncrement a = PostIncrement { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 PostIncrement where liftEq = genericLiftEq
|
||||
@ -157,7 +157,7 @@ instance Evaluatable PostIncrement
|
||||
|
||||
|
||||
-- | Post decrement operator (e.g. 1-- in Go, or i-- in C).
|
||||
newtype PostDecrement a = PostDecrement a
|
||||
newtype PostDecrement a = PostDecrement { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 PostDecrement where liftEq = genericLiftEq
|
||||
@ -168,8 +168,8 @@ instance Show1 PostDecrement where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable PostDecrement
|
||||
|
||||
-- | Pre increment operator (e.g. ++1 in C or Java).
|
||||
newtype PreIncrement a = PreIncrement a
|
||||
deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)
|
||||
newtype PreIncrement a = PreIncrement { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 PreIncrement where liftEq = genericLiftEq
|
||||
instance Ord1 PreIncrement where liftCompare = genericLiftCompare
|
||||
@ -180,8 +180,8 @@ instance Evaluatable PreIncrement
|
||||
|
||||
|
||||
-- | Pre decrement operator (e.g. --1 in C or Java).
|
||||
newtype PreDecrement a = PreDecrement a
|
||||
deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)
|
||||
newtype PreDecrement a = PreDecrement { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 PreDecrement where liftEq = genericLiftEq
|
||||
instance Ord1 PreDecrement where liftCompare = genericLiftCompare
|
||||
|
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE DataKinds, DeriveAnyClass, DeriveGeneric, MultiParamTypeClasses, UndecidableInstances #-}
|
||||
{-# LANGUAGE DataKinds, DeriveAnyClass, DuplicateRecordFields, DeriveGeneric, MultiParamTypeClasses, UndecidableInstances #-}
|
||||
{-# OPTIONS_GHC -Wno-missing-export-lists #-}
|
||||
module Data.Syntax.Type where
|
||||
|
||||
@ -11,7 +11,9 @@ import Proto3.Suite.Class
|
||||
import Reprinting.Tokenize
|
||||
|
||||
data Array a = Array { arraySize :: !(Maybe a), arrayElementType :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Message1)
|
||||
|
||||
instance Named1 Array where nameOf1 _ = "TypeArray"
|
||||
|
||||
instance Eq1 Array where liftEq = genericLiftEq
|
||||
instance Ord1 Array where liftCompare = genericLiftCompare
|
||||
@ -40,8 +42,9 @@ instance Tokenize Annotation where
|
||||
|
||||
|
||||
data Function a = Function { functionParameters :: ![a], functionReturn :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Message1)
|
||||
|
||||
instance Named1 Function where nameOf1 _ = "TypeFunction"
|
||||
instance Eq1 Function where liftEq = genericLiftEq
|
||||
instance Ord1 Function where liftCompare = genericLiftCompare
|
||||
instance Show1 Function where liftShowsPrec = genericLiftShowsPrec
|
||||
@ -50,7 +53,7 @@ instance Show1 Function where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Function
|
||||
|
||||
|
||||
newtype Interface a = Interface [a]
|
||||
newtype Interface a = Interface { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Interface where liftEq = genericLiftEq
|
||||
@ -72,7 +75,7 @@ instance Show1 Map where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Map
|
||||
|
||||
|
||||
newtype Parenthesized a = Parenthesized a
|
||||
newtype Parenthesized a = Parenthesized { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Parenthesized where liftEq = genericLiftEq
|
||||
@ -83,9 +86,10 @@ instance Show1 Parenthesized where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Parenthesized
|
||||
|
||||
|
||||
newtype Pointer a = Pointer a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
newtype Pointer a = Pointer { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Message1)
|
||||
|
||||
instance Named1 Pointer where nameOf1 _ = "TypePointer"
|
||||
instance Eq1 Pointer where liftEq = genericLiftEq
|
||||
instance Ord1 Pointer where liftCompare = genericLiftCompare
|
||||
instance Show1 Pointer where liftShowsPrec = genericLiftShowsPrec
|
||||
@ -94,7 +98,7 @@ instance Show1 Pointer where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Pointer
|
||||
|
||||
|
||||
newtype Product a = Product [a]
|
||||
newtype Product a = Product { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Product where liftEq = genericLiftEq
|
||||
@ -117,8 +121,9 @@ instance Evaluatable Readonly
|
||||
|
||||
|
||||
newtype Slice a = Slice { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Message1)
|
||||
|
||||
instance Named1 Slice where nameOf1 _ = "TypeSlice"
|
||||
instance Eq1 Slice where liftEq = genericLiftEq
|
||||
instance Ord1 Slice where liftCompare = genericLiftCompare
|
||||
instance Show1 Slice where liftShowsPrec = genericLiftShowsPrec
|
||||
@ -139,7 +144,7 @@ instance Evaluatable TypeParameters
|
||||
|
||||
-- data instead of newtype because no payload
|
||||
data Void a = Void
|
||||
deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Void where liftEq = genericLiftEq
|
||||
instance Ord1 Void where liftCompare = genericLiftCompare
|
||||
@ -150,7 +155,7 @@ instance Evaluatable Void
|
||||
|
||||
-- data instead of newtype because no payload
|
||||
data Int a = Int
|
||||
deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Int where liftEq = genericLiftEq
|
||||
instance Ord1 Int where liftCompare = genericLiftCompare
|
||||
@ -160,7 +165,9 @@ instance Show1 Int where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Int
|
||||
|
||||
data Float a = Float
|
||||
deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Message1)
|
||||
|
||||
instance Named1 Float where nameOf1 _ = "TypeFloat"
|
||||
|
||||
instance Eq1 Float where liftEq = genericLiftEq
|
||||
instance Ord1 Float where liftCompare = genericLiftCompare
|
||||
@ -170,7 +177,7 @@ instance Show1 Float where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Float
|
||||
|
||||
data Double a = Double
|
||||
deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Double where liftEq = genericLiftEq
|
||||
instance Ord1 Double where liftCompare = genericLiftCompare
|
||||
@ -180,7 +187,7 @@ instance Show1 Double where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Double
|
||||
|
||||
data Bool a = Bool
|
||||
deriving (Diffable, Eq, Foldable, Functor, Generic1, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Bool where liftEq = genericLiftEq
|
||||
instance Ord1 Bool where liftCompare = genericLiftCompare
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME
|
||||
module Language.Go.Assignment
|
||||
( assignment
|
||||
, Syntax
|
||||
@ -6,14 +7,14 @@ module Language.Go.Assignment
|
||||
, Term
|
||||
) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Assigning.Assignment hiding (Assignment, Error)
|
||||
import qualified Assigning.Assignment as Assignment
|
||||
import Data.Abstract.Name (Name, name)
|
||||
import Data.Record
|
||||
import Data.Syntax (contextualize, emptyTerm, parseError, handleError, infixContext, makeTerm, makeTerm', makeTerm'', makeTerm1)
|
||||
import Language.Go.Grammar as Grammar
|
||||
import Language.Go.Syntax as Go.Syntax
|
||||
import Language.Go.Type as Go.Type
|
||||
import qualified Assigning.Assignment as Assignment
|
||||
import Data.Syntax
|
||||
(contextualize, emptyTerm, handleError, infixContext, makeTerm, makeTerm', makeTerm'', makeTerm1, parseError)
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Comment as Comment
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
@ -21,9 +22,12 @@ import qualified Data.Syntax.Expression as Expression
|
||||
import qualified Data.Syntax.Literal as Literal
|
||||
import qualified Data.Syntax.Statement as Statement
|
||||
import qualified Data.Syntax.Type as Type
|
||||
import Data.Sum
|
||||
import qualified Data.Term as Term
|
||||
import Prologue
|
||||
import qualified Data.Diff as Diff
|
||||
import Language.Go.Grammar as Grammar
|
||||
import Language.Go.Syntax as Go.Syntax hiding (runeLiteral, labelName)
|
||||
import Language.Go.Type as Go.Type
|
||||
import Proto3.Suite (Named (..), Named1 (..))
|
||||
|
||||
type Syntax =
|
||||
'[ Comment.Comment
|
||||
@ -65,12 +69,6 @@ type Syntax =
|
||||
, Expression.Not
|
||||
, Expression.Or
|
||||
, Expression.XOr
|
||||
, Expression.Call
|
||||
, Expression.Comparison
|
||||
, Expression.Subscript
|
||||
, Statement.PostDecrement
|
||||
, Statement.PostIncrement
|
||||
, Expression.MemberAccess
|
||||
, Go.Syntax.Composite
|
||||
, Go.Syntax.DefaultPattern
|
||||
, Go.Syntax.Defer
|
||||
@ -136,6 +134,10 @@ type Syntax =
|
||||
type Term = Term.Term (Sum Syntax) (Record Location)
|
||||
type Assignment = Assignment.Assignment [] Grammar
|
||||
|
||||
-- For Protobuf serialization
|
||||
instance Named1 (Sum Syntax) where nameOf1 _ = "GoSyntax"
|
||||
instance Named (Term.Term (Sum Syntax) ()) where nameOf _ = "GoTerm"
|
||||
instance Named (Diff.Diff (Sum Syntax) () ()) where nameOf _ = "GoDiff"
|
||||
|
||||
-- | Assignment from AST in Go's grammar onto a program in Go's syntax.
|
||||
assignment :: Assignment Term
|
||||
|
@ -1,7 +1,9 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveAnyClass, LambdaCase #-}
|
||||
{-# OPTIONS_GHC -Wno-missing-export-lists #-}
|
||||
module Language.Go.Syntax where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Data.Abstract.BaseError
|
||||
import Data.Abstract.Evaluatable
|
||||
import Data.Abstract.Module
|
||||
@ -11,14 +13,35 @@ import Data.Aeson
|
||||
import Data.JSON.Fields
|
||||
import qualified Data.Text as T
|
||||
import Diffing.Algorithm
|
||||
import Prologue
|
||||
import Proto3.Suite.Class
|
||||
import Proto3.Suite
|
||||
import qualified Proto3.Wire.Encode as Encode
|
||||
import qualified Proto3.Wire.Decode as Decode
|
||||
import System.FilePath.Posix
|
||||
|
||||
data Relative = Relative | NonRelative
|
||||
deriving (Eq, Generic, Hashable, Ord, Show, ToJSON)
|
||||
data IsRelative = Unknown | Relative | NonRelative
|
||||
deriving (Bounded, Enum, Finite, Eq, Generic, Hashable, Ord, Show, ToJSON, Named, MessageField)
|
||||
|
||||
data ImportPath = ImportPath { unPath :: FilePath, pathIsRelative :: Relative }
|
||||
deriving (Eq, Generic, Hashable, Ord, Show, ToJSON)
|
||||
instance Primitive IsRelative where
|
||||
primType _ = primType (Proxy @(Enumerated IsRelative))
|
||||
encodePrimitive f = encodePrimitive f . Enumerated . Right
|
||||
decodePrimitive = decodePrimitive >>= \case
|
||||
(Enumerated (Right r)) -> pure r
|
||||
other -> Prelude.fail ("IsRelative decodeMessageField: unexpected value" <> show other)
|
||||
|
||||
instance HasDefault IsRelative where
|
||||
def = Unknown
|
||||
|
||||
data ImportPath = ImportPath { unPath :: FilePath, pathIsRelative :: IsRelative }
|
||||
deriving (Eq, Generic, Hashable, Ord, Show, ToJSON, Named, Message)
|
||||
|
||||
instance MessageField ImportPath where
|
||||
encodeMessageField num = Encode.embedded num . encodeMessage (fieldNumber 1)
|
||||
decodeMessageField = fromMaybe def <$> Decode.embedded (decodeMessage (fieldNumber 1))
|
||||
protoType _ = messageField (Prim $ Named (Single (nameOf (Proxy @ImportPath)))) Nothing
|
||||
|
||||
instance HasDefault ImportPath where
|
||||
def = ImportPath mempty Unknown
|
||||
|
||||
importPath :: Text -> ImportPath
|
||||
importPath str = let path = stripQuotes str in ImportPath (T.unpack path) (pathType path)
|
||||
@ -38,6 +61,7 @@ resolveGoImport :: ( Member (Modules address) effects
|
||||
)
|
||||
=> ImportPath
|
||||
-> Evaluator address value effects [ModulePath]
|
||||
resolveGoImport (ImportPath path Unknown) = throwResolutionError $ GoImportError path
|
||||
resolveGoImport (ImportPath path Relative) = do
|
||||
ModuleInfo{..} <- currentModule
|
||||
paths <- listModulesInDir (joinPaths (takeDirectory modulePath) path)
|
||||
@ -58,7 +82,7 @@ resolveGoImport (ImportPath path NonRelative) = do
|
||||
--
|
||||
-- If the list of symbols is empty copy everything to the calling environment.
|
||||
data Import a = Import { importFrom :: ImportPath, importWildcardToken :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Import where liftEq = genericLiftEq
|
||||
instance Ord1 Import where liftCompare = genericLiftCompare
|
||||
@ -78,7 +102,7 @@ instance Evaluatable Import where
|
||||
--
|
||||
-- If the list of symbols is empty copy and qualify everything to the calling environment.
|
||||
data QualifiedImport a = QualifiedImport { qualifiedImportFrom :: !ImportPath, qualifiedImportAlias :: !a}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 QualifiedImport where liftEq = genericLiftEq
|
||||
instance Ord1 QualifiedImport where liftCompare = genericLiftCompare
|
||||
@ -97,7 +121,7 @@ instance Evaluatable QualifiedImport where
|
||||
|
||||
-- | Side effect only imports (no symbols made available to the calling environment).
|
||||
data SideEffectImport a = SideEffectImport { sideEffectImportFrom :: !ImportPath, sideEffectImportToken :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 SideEffectImport where liftEq = genericLiftEq
|
||||
instance Ord1 SideEffectImport where liftCompare = genericLiftCompare
|
||||
@ -112,7 +136,7 @@ instance Evaluatable SideEffectImport where
|
||||
|
||||
-- A composite literal in Go
|
||||
data Composite a = Composite { compositeType :: !a, compositeElement :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Composite where liftEq = genericLiftEq
|
||||
instance Ord1 Composite where liftCompare = genericLiftCompare
|
||||
@ -123,7 +147,7 @@ instance Evaluatable Composite
|
||||
|
||||
-- | A default pattern in a Go select or switch statement (e.g. `switch { default: s() }`).
|
||||
newtype DefaultPattern a = DefaultPattern { defaultPatternBody :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 DefaultPattern where liftEq = genericLiftEq
|
||||
instance Ord1 DefaultPattern where liftCompare = genericLiftCompare
|
||||
@ -134,7 +158,7 @@ instance Evaluatable DefaultPattern
|
||||
|
||||
-- | A defer statement in Go (e.g. `defer x()`).
|
||||
newtype Defer a = Defer { deferBody :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Defer where liftEq = genericLiftEq
|
||||
instance Ord1 Defer where liftCompare = genericLiftCompare
|
||||
@ -145,7 +169,7 @@ instance Evaluatable Defer
|
||||
|
||||
-- | A go statement (i.e. go routine) in Go (e.g. `go x()`).
|
||||
newtype Go a = Go { goBody :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Go where liftEq = genericLiftEq
|
||||
instance Ord1 Go where liftCompare = genericLiftCompare
|
||||
@ -155,8 +179,8 @@ instance Show1 Go where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Go
|
||||
|
||||
-- | A label statement in Go (e.g. `label:continue`).
|
||||
data Label a = Label { _labelName :: !a, labelStatement :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data Label a = Label { labelName :: !a, labelStatement :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Label where liftEq = genericLiftEq
|
||||
instance Ord1 Label where liftCompare = genericLiftCompare
|
||||
@ -166,8 +190,8 @@ instance Show1 Label where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Label
|
||||
|
||||
-- | A rune literal in Go (e.g. `'⌘'`).
|
||||
newtype Rune a = Rune { _runeLiteral :: Text }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype Rune a = Rune { runeLiteral :: Text }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
-- TODO: Implement Eval instance for Rune
|
||||
instance Evaluatable Rune
|
||||
@ -178,7 +202,7 @@ instance Show1 Rune where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A select statement in Go (e.g. `select { case x := <-c: x() }` where each case is a send or receive operation on channels).
|
||||
newtype Select a = Select { selectCases :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
-- TODO: Implement Eval instance for Select
|
||||
instance Evaluatable Select
|
||||
@ -189,7 +213,7 @@ instance Show1 Select where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A send statement in Go (e.g. `channel <- value`).
|
||||
data Send a = Send { sendReceiver :: !a, sendValue :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Send where liftEq = genericLiftEq
|
||||
instance Ord1 Send where liftCompare = genericLiftCompare
|
||||
@ -200,7 +224,7 @@ instance Evaluatable Send
|
||||
|
||||
-- | A slice expression in Go (e.g. `a[1:4:3]` where a is a list, 1 is the low bound, 4 is the high bound, and 3 is the max capacity).
|
||||
data Slice a = Slice { sliceName :: !a, sliceLow :: !a, sliceHigh :: !a, sliceCapacity :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Slice where liftEq = genericLiftEq
|
||||
instance Ord1 Slice where liftCompare = genericLiftCompare
|
||||
@ -211,7 +235,7 @@ instance Evaluatable Slice
|
||||
|
||||
-- | A type switch statement in Go (e.g. `switch x.(type) { // cases }`).
|
||||
data TypeSwitch a = TypeSwitch { typeSwitchSubject :: !a, typeSwitchCases :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 TypeSwitch where liftEq = genericLiftEq
|
||||
instance Ord1 TypeSwitch where liftCompare = genericLiftCompare
|
||||
@ -222,7 +246,7 @@ instance Evaluatable TypeSwitch
|
||||
|
||||
-- | A type switch guard statement in a Go type switch statement (e.g. `switch i := x.(type) { // cases}`).
|
||||
newtype TypeSwitchGuard a = TypeSwitchGuard { typeSwitchGuardSubject :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 TypeSwitchGuard where liftEq = genericLiftEq
|
||||
instance Ord1 TypeSwitchGuard where liftCompare = genericLiftCompare
|
||||
@ -233,7 +257,7 @@ instance Evaluatable TypeSwitchGuard
|
||||
|
||||
-- | A receive statement in a Go select statement (e.g. `case value := <-channel` )
|
||||
data Receive a = Receive { receiveSubject :: !a, receiveExpression :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Receive where liftEq = genericLiftEq
|
||||
instance Ord1 Receive where liftCompare = genericLiftCompare
|
||||
@ -243,8 +267,8 @@ instance Show1 Receive where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Receive
|
||||
|
||||
-- | A receive operator unary expression in Go (e.g. `<-channel` )
|
||||
newtype ReceiveOperator a = ReceiveOperator a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ReceiveOperator a = ReceiveOperator { value :: a}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 ReceiveOperator where liftEq = genericLiftEq
|
||||
instance Ord1 ReceiveOperator where liftCompare = genericLiftCompare
|
||||
@ -255,7 +279,7 @@ instance Evaluatable ReceiveOperator
|
||||
|
||||
-- | A field declaration in a Go struct type declaration.
|
||||
data Field a = Field { fieldContext :: ![a], fieldName :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Field where liftEq = genericLiftEq
|
||||
instance Ord1 Field where liftCompare = genericLiftCompare
|
||||
@ -266,7 +290,7 @@ instance Evaluatable Field
|
||||
|
||||
|
||||
data Package a = Package { packageName :: !a, packageContents :: ![a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Package where liftEq = genericLiftEq
|
||||
instance Ord1 Package where liftCompare = genericLiftCompare
|
||||
@ -278,7 +302,7 @@ instance Evaluatable Package where
|
||||
|
||||
-- | A type assertion in Go (e.g. `x.(T)` where the value of `x` is not nil and is of type `T`).
|
||||
data TypeAssertion a = TypeAssertion { typeAssertionSubject :: !a, typeAssertionType :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 TypeAssertion where liftEq = genericLiftEq
|
||||
instance Ord1 TypeAssertion where liftCompare = genericLiftCompare
|
||||
@ -289,7 +313,7 @@ instance Evaluatable TypeAssertion
|
||||
|
||||
-- | A type conversion expression in Go (e.g. `T(x)` where `T` is a type and `x` is an expression that can be converted to type `T`).
|
||||
data TypeConversion a = TypeConversion { typeConversionType :: !a, typeConversionSubject :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 TypeConversion where liftEq = genericLiftEq
|
||||
instance Ord1 TypeConversion where liftCompare = genericLiftCompare
|
||||
@ -300,7 +324,7 @@ instance Evaluatable TypeConversion
|
||||
|
||||
-- | Variadic arguments and parameters in Go (e.g. parameter: `param ...Type`, argument: `Type...`).
|
||||
data Variadic a = Variadic { variadicContext :: [a], variadicIdentifier :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Variadic where liftEq = genericLiftEq
|
||||
instance Ord1 Variadic where liftCompare = genericLiftCompare
|
||||
|
@ -1,15 +1,17 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveAnyClass, DuplicateRecordFields #-}
|
||||
{-# OPTIONS_GHC -Wno-missing-export-lists #-}
|
||||
module Language.Go.Type where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Data.Abstract.Evaluatable
|
||||
import Data.JSON.Fields
|
||||
import Diffing.Algorithm
|
||||
import Proto3.Suite.Class
|
||||
|
||||
-- | A Bidirectional channel in Go (e.g. `chan`).
|
||||
newtype BidirectionalChannel a = BidirectionalChannel a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype BidirectionalChannel a = BidirectionalChannel { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 BidirectionalChannel where liftEq = genericLiftEq
|
||||
instance Ord1 BidirectionalChannel where liftCompare = genericLiftCompare
|
||||
@ -19,8 +21,8 @@ instance Show1 BidirectionalChannel where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable BidirectionalChannel
|
||||
|
||||
-- | A Receive channel in Go (e.g. `<-chan`).
|
||||
newtype ReceiveChannel a = ReceiveChannel a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ReceiveChannel a = ReceiveChannel { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 ReceiveChannel where liftEq = genericLiftEq
|
||||
instance Ord1 ReceiveChannel where liftCompare = genericLiftCompare
|
||||
@ -30,8 +32,8 @@ instance Show1 ReceiveChannel where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ReceiveChannel
|
||||
|
||||
-- | A Send channel in Go (e.g. `chan<-`).
|
||||
newtype SendChannel a = SendChannel a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype SendChannel a = SendChannel { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 SendChannel where liftEq = genericLiftEq
|
||||
instance Ord1 SendChannel where liftCompare = genericLiftCompare
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME
|
||||
module Language.Haskell.Assignment
|
||||
( assignment
|
||||
, Syntax
|
||||
@ -6,15 +7,16 @@ module Language.Haskell.Assignment
|
||||
, Term
|
||||
) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Assigning.Assignment hiding (Assignment, Error, count)
|
||||
import Data.ByteString.Char8 (count)
|
||||
import Data.Record
|
||||
import Data.Sum
|
||||
import Data.Syntax (emptyTerm, handleError, parseError, makeTerm, makeTerm1, makeTerm', makeTerm'', contextualize, postContextualize)
|
||||
import Language.Haskell.Grammar as Grammar
|
||||
import qualified Assigning.Assignment as Assignment
|
||||
import qualified Data.Abstract.Name as Name
|
||||
import Data.ByteString.Char8 (count)
|
||||
import qualified Data.List.NonEmpty as NonEmpty
|
||||
import Data.Record
|
||||
import Data.Syntax
|
||||
(contextualize, emptyTerm, handleError, makeTerm, makeTerm', makeTerm'', makeTerm1, parseError, postContextualize)
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Comment as Comment
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
@ -22,8 +24,10 @@ import qualified Data.Syntax.Literal as Literal
|
||||
import qualified Data.Syntax.Statement as Statement
|
||||
import qualified Data.Syntax.Type as Type
|
||||
import qualified Data.Term as Term
|
||||
import qualified Data.Diff as Diff
|
||||
import Language.Haskell.Grammar as Grammar
|
||||
import qualified Language.Haskell.Syntax as Syntax
|
||||
import Prologue
|
||||
import Proto3.Suite (Named (..), Named1 (..))
|
||||
|
||||
type Syntax = '[
|
||||
Comment.Comment
|
||||
@ -52,7 +56,7 @@ type Syntax = '[
|
||||
, Syntax.ConstructorPattern
|
||||
, Syntax.ConstructorSymbol
|
||||
, Syntax.Context
|
||||
, Syntax.Context'
|
||||
, Syntax.ContextAlt
|
||||
, Syntax.CPPDirective
|
||||
, Syntax.DefaultDeclaration
|
||||
, Syntax.DefaultSignature
|
||||
@ -66,7 +70,7 @@ type Syntax = '[
|
||||
, Syntax.Field
|
||||
, Syntax.FieldBind
|
||||
, Syntax.FieldPattern
|
||||
, Syntax.Fixity'
|
||||
, Syntax.FixityAlt
|
||||
, Syntax.FunctionalDependency
|
||||
, Syntax.FunctionConstructor
|
||||
, Syntax.FunctionGuardPattern
|
||||
@ -141,8 +145,8 @@ type Syntax = '[
|
||||
, Syntax.StrictPattern
|
||||
, Syntax.StrictType
|
||||
, Syntax.StrictTypeVariable
|
||||
, Syntax.Tuple
|
||||
, Syntax.TupleConstructor
|
||||
, Syntax.TupleExpression
|
||||
, Syntax.TuplePattern
|
||||
, Syntax.Type
|
||||
, Syntax.TypeApp
|
||||
@ -171,6 +175,11 @@ type Syntax = '[
|
||||
type Term = Term.Term (Sum Syntax) (Record Location)
|
||||
type Assignment = Assignment.Assignment [] Grammar
|
||||
|
||||
-- For Protobuf serialization
|
||||
instance Named1 (Sum Syntax) where nameOf1 _ = "HaskellSyntax"
|
||||
instance Named (Term.Term (Sum Syntax) ()) where nameOf _ = "HaskellTerm"
|
||||
instance Named (Diff.Diff (Sum Syntax) () ()) where nameOf _ = "HaskellDiff"
|
||||
|
||||
assignment :: Assignment Term
|
||||
assignment = handleError $ module' <|> parseError
|
||||
|
||||
@ -250,7 +259,7 @@ constructorSymbol :: Assignment Term
|
||||
constructorSymbol = makeTerm <$> symbol ConstructorSymbol <*> (Syntax.ConstructorSymbol . Name.name <$> source)
|
||||
|
||||
context' :: Assignment Term
|
||||
context' = makeTerm <$> symbol Context <*> children (Syntax.Context' <$> expressions)
|
||||
context' = makeTerm <$> symbol Context <*> children (Syntax.ContextAlt <$> expressions)
|
||||
|
||||
contextPattern :: Assignment Term
|
||||
contextPattern = symbol ContextPattern *> children expressions
|
||||
@ -453,7 +462,7 @@ fieldPattern :: Assignment Term
|
||||
fieldPattern = makeTerm <$> symbol FieldPattern <*> children (Syntax.FieldPattern <$> expression <*> expressions)
|
||||
|
||||
fixityDeclaration :: Assignment Term
|
||||
fixityDeclaration = makeTerm <$> symbol FixityDeclaration <*> children (Syntax.Fixity' <$> (integer <|> emptyTerm) <*> manyTerm expression)
|
||||
fixityDeclaration = makeTerm <$> symbol FixityDeclaration <*> children (Syntax.FixityAlt <$> (integer <|> emptyTerm) <*> manyTerm expression)
|
||||
|
||||
float :: Assignment Term
|
||||
float = makeTerm <$> symbol Float <*> (Literal.Float <$> source)
|
||||
@ -781,7 +790,7 @@ string :: Assignment Term
|
||||
string = makeTerm <$> symbol String <*> (Literal.TextElement <$> source)
|
||||
|
||||
tuple :: Assignment Term
|
||||
tuple = makeTerm <$> symbol TupleExpression <*> children (Syntax.Tuple <$> manyTerm expression)
|
||||
tuple = makeTerm <$> symbol TupleExpression <*> children (Syntax.TupleExpression <$> manyTerm expression)
|
||||
|
||||
tuplePattern :: Assignment Term
|
||||
tuplePattern = makeTerm <$> symbol TuplePattern <*> children (Syntax.TuplePattern <$> manyTerm expression)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,9 +9,11 @@ module Language.JSON.PrettyPrint
|
||||
import Prologue hiding (throwError)
|
||||
|
||||
import Control.Arrow
|
||||
import Control.Monad.Trans (lift)
|
||||
import Control.Monad.Effect
|
||||
import Control.Monad.Effect.Exception (Exc, throwError)
|
||||
import Data.Machine
|
||||
|
||||
import Data.Reprinting.Errors
|
||||
import Data.Reprinting.Splice
|
||||
import Data.Reprinting.Token
|
||||
@ -25,10 +27,9 @@ defaultJSONPipeline
|
||||
|
||||
-- | Print JSON syntax.
|
||||
printingJSON :: Monad m => ProcessT m Fragment Fragment
|
||||
printingJSON = auto step ~> flattened where
|
||||
step :: Fragment -> Seq Fragment
|
||||
printingJSON = repeatedly (await >>= step) where
|
||||
step s@(Defer el cs) =
|
||||
let ins = insert el cs
|
||||
let ins = yield . New el cs
|
||||
in case (el, listToMaybe cs) of
|
||||
(Truth True, _) -> ins "true"
|
||||
(Truth False, _) -> ins "false"
|
||||
@ -43,9 +44,8 @@ printingJSON = auto step ~> flattened where
|
||||
(TSep, Just TPair) -> ins ":"
|
||||
(TSep, Just THash) -> ins ","
|
||||
|
||||
_ -> pure s
|
||||
|
||||
step x = pure x
|
||||
_ -> yield s
|
||||
step x = yield x
|
||||
|
||||
-- TODO: Fill out and implement configurable options like indentation count,
|
||||
-- tabs vs. spaces, etc.
|
||||
@ -58,21 +58,21 @@ defaultBeautyOpts = JSONBeautyOpts 2 False
|
||||
-- | Produce JSON with configurable whitespace and layout.
|
||||
beautifyingJSON :: (Member (Exc TranslationError) effs)
|
||||
=> JSONBeautyOpts -> ProcessT (Eff effs) Fragment Splice
|
||||
beautifyingJSON _ = autoT (Kleisli step) ~> flattened where
|
||||
step (Defer el cs) = throwError (NoTranslation el cs)
|
||||
step (Verbatim txt) = pure $ emit txt
|
||||
step (New el cs txt) = pure $ case (el, listToMaybe cs) of
|
||||
(TOpen, Just THash) -> emit txt <> layouts [HardWrap, Indent 2 Spaces]
|
||||
(TClose, Just THash) -> layout HardWrap <> emit txt
|
||||
(TSep, Just TList) -> emit txt <> space
|
||||
(TSep, Just TPair) -> emit txt <> space
|
||||
(TSep, Just THash) -> emit txt <> layouts [HardWrap, Indent 2 Spaces]
|
||||
beautifyingJSON _ = repeatedly (await >>= step) where
|
||||
step (Defer el cs) = lift (throwError (NoTranslation el cs))
|
||||
step (Verbatim txt) = emit txt
|
||||
step (New el cs txt) = case (el, listToMaybe cs) of
|
||||
(TOpen, Just THash) -> emit txt *> layouts [HardWrap, Indent 2 Spaces]
|
||||
(TClose, Just THash) -> layout HardWrap *> emit txt
|
||||
(TSep, Just TList) -> emit txt *> space
|
||||
(TSep, Just TPair) -> emit txt *> space
|
||||
(TSep, Just THash) -> emit txt *> layouts [HardWrap, Indent 2 Spaces]
|
||||
_ -> emit txt
|
||||
|
||||
-- | Produce whitespace minimal JSON.
|
||||
minimizingJSON :: (Member (Exc TranslationError) effs)
|
||||
=> ProcessT (Eff effs) Fragment Splice
|
||||
minimizingJSON = autoT (Kleisli step) ~> flattened where
|
||||
step (Defer el cs) = throwError (NoTranslation el cs)
|
||||
step (Verbatim txt) = pure $ emit txt
|
||||
step (New _ _ txt) = pure $ emit txt
|
||||
minimizingJSON = repeatedly (await >>= step) where
|
||||
step (Defer el cs) = lift (throwError (NoTranslation el cs))
|
||||
step (Verbatim txt) = emit txt
|
||||
step (New _ _ txt) = emit txt
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME
|
||||
module Language.Java.Assignment
|
||||
( assignment
|
||||
, Syntax
|
||||
@ -6,16 +7,27 @@ module Language.Java.Assignment
|
||||
, Term
|
||||
) where
|
||||
|
||||
import Prelude hiding (break)
|
||||
import Prologue hiding (for, try, This, catches, finally)
|
||||
|
||||
import Assigning.Assignment hiding (Assignment, Error, try)
|
||||
import qualified Assigning.Assignment as Assignment
|
||||
import Data.Abstract.Name
|
||||
import Data.Functor (($>))
|
||||
import Data.List.NonEmpty (some1)
|
||||
import Data.Record
|
||||
import Data.Syntax (contextualize, emptyTerm, handleError, infixContext, makeTerm, makeTerm', makeTerm'', makeTerm1, parseError, postContextualize)
|
||||
import Data.Sum
|
||||
import Language.Java.Grammar as Grammar
|
||||
import qualified Language.Java.Syntax as Java.Syntax
|
||||
import qualified Assigning.Assignment as Assignment
|
||||
import Data.Syntax
|
||||
( contextualize
|
||||
, emptyTerm
|
||||
, handleError
|
||||
, infixContext
|
||||
, makeTerm
|
||||
, makeTerm'
|
||||
, makeTerm''
|
||||
, makeTerm1
|
||||
, parseError
|
||||
, postContextualize
|
||||
)
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Comment as Comment
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
@ -24,8 +36,10 @@ import qualified Data.Syntax.Literal as Literal
|
||||
import qualified Data.Syntax.Statement as Statement
|
||||
import qualified Data.Syntax.Type as Type
|
||||
import qualified Data.Term as Term
|
||||
import Prelude hiding (break)
|
||||
import Prologue hiding (for, try, This, catches, finally)
|
||||
import qualified Data.Diff as Diff
|
||||
import Language.Java.Grammar as Grammar
|
||||
import qualified Language.Java.Syntax as Java.Syntax
|
||||
import Proto3.Suite (Named (..), Named1 (..))
|
||||
|
||||
type Syntax =
|
||||
'[ Comment.Comment
|
||||
@ -142,6 +156,11 @@ type Syntax =
|
||||
type Term = Term.Term (Sum Syntax) (Record Location)
|
||||
type Assignment = Assignment.Assignment [] Grammar
|
||||
|
||||
-- For Protobuf serialization
|
||||
instance Named1 (Sum Syntax) where nameOf1 _ = "JavaSyntax"
|
||||
instance Named (Term.Term (Sum Syntax) ()) where nameOf _ = "JavaTerm"
|
||||
instance Named (Diff.Diff (Sum Syntax) () ()) where nameOf _ = "JavaDiff"
|
||||
|
||||
-- | Assignment from AST in Java's grammar onto a program in Java's syntax.
|
||||
assignment :: Assignment Term
|
||||
assignment = handleError $ makeTerm <$> symbol Grammar.Program <*> children (Statement.Statements <$> manyTerm expression) <|> parseError
|
||||
|
@ -3,12 +3,13 @@
|
||||
module Language.Java.Syntax where
|
||||
|
||||
import Data.Abstract.Evaluatable
|
||||
import Data.JSON.Fields
|
||||
import Diffing.Algorithm
|
||||
import Prologue hiding (Constructor)
|
||||
import Data.JSON.Fields
|
||||
import Proto3.Suite.Class
|
||||
|
||||
newtype Import a = Import [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype Import a = Import { imports :: [a]}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
|
||||
instance Eq1 Import where liftEq = genericLiftEq
|
||||
@ -19,7 +20,7 @@ instance Show1 Import where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Import
|
||||
|
||||
data Module a = Module { moduleIdentifier :: !a, moduleStatements :: ![a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
|
||||
instance Eq1 Module where liftEq = genericLiftEq
|
||||
@ -28,8 +29,8 @@ instance Show1 Module where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
instance Evaluatable Module
|
||||
|
||||
newtype Package a = Package [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype Package a = Package { packages :: [a]}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
|
||||
instance Eq1 Package where liftEq = genericLiftEq
|
||||
@ -40,7 +41,7 @@ instance Show1 Package where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Package
|
||||
|
||||
data EnumDeclaration a = EnumDeclaration { enumDeclarationModifier :: ![a], enumDeclarationIdentifier :: !a, enumDeclarationSuperInterfaces :: ![a], enumDeclarationConstant :: ![a], enumDeclarationBody :: ![a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 EnumDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 EnumDeclaration where liftCompare = genericLiftCompare
|
||||
@ -49,7 +50,7 @@ instance Evaluatable EnumDeclaration
|
||||
|
||||
|
||||
data Variable a = Variable { variableModifiers :: ![a], variableType :: !a, variableName :: !a}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Variable where liftEq = genericLiftEq
|
||||
instance Ord1 Variable where liftCompare = genericLiftCompare
|
||||
@ -59,7 +60,7 @@ instance Show1 Variable where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Variable
|
||||
|
||||
data Synchronized a = Synchronized { synchronizedSubject :: !a, synchronizedBody :: !a}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Synchronized where liftEq = genericLiftEq
|
||||
instance Ord1 Synchronized where liftCompare = genericLiftCompare
|
||||
@ -69,7 +70,7 @@ instance Show1 Synchronized where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Synchronized
|
||||
|
||||
data New a = New { newType :: !a, newArgs :: ![a], newClassBody :: Maybe a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 New where liftEq = genericLiftEq
|
||||
instance Ord1 New where liftCompare = genericLiftCompare
|
||||
@ -79,7 +80,7 @@ instance Show1 New where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable New
|
||||
|
||||
data Asterisk a = Asterisk
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Asterisk where liftEq = genericLiftEq
|
||||
instance Ord1 Asterisk where liftCompare = genericLiftCompare
|
||||
@ -90,7 +91,7 @@ instance Evaluatable Asterisk
|
||||
|
||||
|
||||
data Constructor a = Constructor { constructorModifiers :: ![a], constructorTypeParams :: ![a], constructorIdentifier :: !a, constructorParams :: ![a], constructorThrows :: ![a], constructorBody :: a}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Constructor where liftEq = genericLiftEq
|
||||
instance Ord1 Constructor where liftCompare = genericLiftCompare
|
||||
@ -100,7 +101,7 @@ instance Show1 Constructor where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Constructor
|
||||
|
||||
data TypeParameter a = TypeParameter { typeParamAnnotation :: ![a], typeParamIdentifier :: !a, typeParamTypeBound :: ![a]}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 TypeParameter where liftEq = genericLiftEq
|
||||
instance Ord1 TypeParameter where liftCompare = genericLiftCompare
|
||||
@ -110,8 +111,9 @@ instance Show1 TypeParameter where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable TypeParameter
|
||||
|
||||
data Annotation a = Annotation { annotationName :: !a, annotationField :: [a]}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Message1, Traversable)
|
||||
|
||||
instance Named1 Annotation where nameOf1 _ = "JavaAnnotation"
|
||||
instance Eq1 Annotation where liftEq = genericLiftEq
|
||||
instance Ord1 Annotation where liftCompare = genericLiftCompare
|
||||
instance Show1 Annotation where liftShowsPrec = genericLiftShowsPrec
|
||||
@ -120,7 +122,7 @@ instance Show1 Annotation where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Annotation
|
||||
|
||||
data AnnotationField a = AnnotationField { annotationFieldName :: a, annotationFieldValue :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 AnnotationField where liftEq = genericLiftEq
|
||||
instance Ord1 AnnotationField where liftCompare = genericLiftCompare
|
||||
@ -130,7 +132,7 @@ instance Show1 AnnotationField where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable AnnotationField
|
||||
|
||||
data GenericType a = GenericType { genericTypeIdentifier :: a, genericTypeArguments :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 GenericType where liftEq = genericLiftEq
|
||||
instance Ord1 GenericType where liftCompare = genericLiftCompare
|
||||
@ -140,7 +142,7 @@ instance Show1 GenericType where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable GenericType
|
||||
|
||||
data AnnotatedType a = AnnotatedType { annotationes :: [a], annotatedType :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 AnnotatedType where liftEq = genericLiftEq
|
||||
instance Ord1 AnnotatedType where liftCompare = genericLiftCompare
|
||||
@ -150,7 +152,7 @@ instance Show1 AnnotatedType where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable AnnotatedType
|
||||
|
||||
newtype CatchType a = CatchType { types :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 CatchType where liftEq = genericLiftEq
|
||||
instance Ord1 CatchType where liftCompare = genericLiftCompare
|
||||
@ -159,8 +161,8 @@ instance Show1 CatchType where liftShowsPrec = genericLiftShowsPrec
|
||||
-- TODO: Implement Eval instance for CatchType
|
||||
instance Evaluatable CatchType
|
||||
|
||||
data TypeWithModifiers a = TypeWithModifiers [a] a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data TypeWithModifiers a = TypeWithModifiers { types :: [a], modifier :: a}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 TypeWithModifiers where liftEq = genericLiftEq
|
||||
instance Ord1 TypeWithModifiers where liftCompare = genericLiftCompare
|
||||
@ -170,7 +172,7 @@ instance Show1 TypeWithModifiers where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable TypeWithModifiers
|
||||
|
||||
data Wildcard a = Wildcard { wildcardAnnotation :: [a], wildcardBounds :: Maybe a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Wildcard where liftEq = genericLiftEq
|
||||
instance Ord1 Wildcard where liftCompare = genericLiftCompare
|
||||
@ -179,8 +181,8 @@ instance Show1 Wildcard where liftShowsPrec = genericLiftShowsPrec
|
||||
-- TODO: Implement Eval instance for TypeWithModifiers
|
||||
instance Evaluatable Wildcard
|
||||
|
||||
data WildcardBounds a = WildcardBoundExtends { wildcardBoundType :: a} | WildcardBoundSuper { wildcardBoundType :: a}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data WildcardBounds a = WildcardBoundExtends { wildcardBoundExtendsType :: a} | WildcardBoundSuper { wildcardBoundSuperType :: a}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 WildcardBounds where liftEq = genericLiftEq
|
||||
instance Ord1 WildcardBounds where liftCompare = genericLiftCompare
|
||||
@ -190,7 +192,7 @@ instance Show1 WildcardBounds where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable WildcardBounds
|
||||
|
||||
newtype SpreadParameter a = SpreadParameter { spreadParameterVariableDeclarator :: a}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 SpreadParameter where liftEq = genericLiftEq
|
||||
instance Ord1 SpreadParameter where liftCompare = genericLiftCompare
|
||||
@ -200,7 +202,7 @@ instance Show1 SpreadParameter where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable SpreadParameter
|
||||
|
||||
newtype StaticInitializer a = StaticInitializer { staticInitializerBlock :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
|
||||
instance Eq1 StaticInitializer where liftEq = genericLiftEq
|
||||
@ -210,7 +212,7 @@ instance Show1 StaticInitializer where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable StaticInitializer
|
||||
|
||||
data MethodReference a = MethodReference { methodReferenceType :: !a, methodReferenceTypeArgs :: ![a], methodReferenceIdentifier :: !a}
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 MethodReference where liftEq = genericLiftEq
|
||||
instance Ord1 MethodReference where liftCompare = genericLiftCompare
|
||||
@ -220,7 +222,7 @@ instance Show1 MethodReference where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable MethodReference
|
||||
|
||||
data NewKeyword a = NewKeyword
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 NewKeyword where liftEq = genericLiftEq
|
||||
instance Ord1 NewKeyword where liftCompare = genericLiftCompare
|
||||
@ -230,7 +232,7 @@ instance Show1 NewKeyword where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable NewKeyword
|
||||
|
||||
data Lambda a = Lambda { lambdaParams :: ![a], lambdaBody :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 Lambda where liftEq = genericLiftEq
|
||||
instance Ord1 Lambda where liftCompare = genericLiftCompare
|
||||
@ -239,7 +241,7 @@ instance Show1 Lambda where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Lambda
|
||||
|
||||
newtype LambdaBody a = LambdaBody { lambdaBodyExpression :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 LambdaBody where liftEq = genericLiftEq
|
||||
instance Ord1 LambdaBody where liftCompare = genericLiftCompare
|
||||
@ -248,7 +250,7 @@ instance Show1 LambdaBody where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable LambdaBody
|
||||
|
||||
data ArrayCreationExpression a = ArrayCreationExpression { arrayCreationExpressionType :: !a, arrayCreationExpressionDims :: ![a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 ArrayCreationExpression where liftEq = genericLiftEq
|
||||
instance Ord1 ArrayCreationExpression where liftCompare = genericLiftCompare
|
||||
@ -257,7 +259,7 @@ instance Show1 ArrayCreationExpression where liftShowsPrec = genericLiftShowsPre
|
||||
instance Evaluatable ArrayCreationExpression
|
||||
|
||||
data DimsExpr a = DimsExpr { dimsExprAnnotation :: ![a], dimsExprExpression :: ![a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 DimsExpr where liftEq = genericLiftEq
|
||||
instance Ord1 DimsExpr where liftCompare = genericLiftCompare
|
||||
@ -266,7 +268,7 @@ instance Show1 DimsExpr where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable DimsExpr
|
||||
|
||||
newtype ClassBody a = ClassBody { classBodyExpression :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 ClassBody where liftEq = genericLiftEq
|
||||
instance Ord1 ClassBody where liftCompare = genericLiftCompare
|
||||
@ -275,7 +277,7 @@ instance Show1 ClassBody where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ClassBody
|
||||
|
||||
newtype ClassLiteral a = ClassLiteral { classLiteralType :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 ClassLiteral where liftEq = genericLiftEq
|
||||
instance Ord1 ClassLiteral where liftCompare = genericLiftCompare
|
||||
@ -284,7 +286,7 @@ instance Show1 ClassLiteral where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ClassLiteral
|
||||
|
||||
data TryWithResources a = TryWithResources { tryResources :: ![a], tryBody :: !a, tryCatch :: ![a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 TryWithResources where liftEq = genericLiftEq
|
||||
instance Ord1 TryWithResources where liftCompare = genericLiftCompare
|
||||
@ -294,7 +296,7 @@ instance Show1 TryWithResources where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable TryWithResources
|
||||
|
||||
data AssertStatement a = AssertStatement { assertLHS :: !a, assertRHS :: !(Maybe a) }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 AssertStatement where liftEq = genericLiftEq
|
||||
instance Ord1 AssertStatement where liftCompare = genericLiftCompare
|
||||
@ -304,7 +306,7 @@ instance Show1 AssertStatement where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable AssertStatement
|
||||
|
||||
newtype DefaultValue a = DefaultValue { defaultValueElement :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 DefaultValue where liftEq = genericLiftEq
|
||||
instance Ord1 DefaultValue where liftCompare = genericLiftCompare
|
||||
@ -313,7 +315,7 @@ instance Show1 DefaultValue where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable DefaultValue
|
||||
|
||||
data AnnotationTypeElement a = AnnotationTypeElement { modifiers :: ![a], annotationType :: a, identifier :: !a, dims :: ![a], defaultValue :: !a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Named1, Message1, Traversable)
|
||||
|
||||
instance Eq1 AnnotationTypeElement where liftEq = genericLiftEq
|
||||
instance Ord1 AnnotationTypeElement where liftCompare = genericLiftCompare
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME
|
||||
module Language.Markdown.Assignment
|
||||
( assignment
|
||||
, Syntax
|
||||
@ -6,18 +7,20 @@ module Language.Markdown.Assignment
|
||||
, Language.Markdown.Assignment.Term
|
||||
) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Assigning.Assignment hiding (Assignment, Error)
|
||||
import Data.Record
|
||||
import Data.Syntax (makeTerm)
|
||||
import qualified Data.Term as Term
|
||||
import Parsing.CMark as Grammar (Grammar(..))
|
||||
import qualified Assigning.Assignment as Assignment
|
||||
import qualified CMarkGFM
|
||||
import Data.Sum
|
||||
import Data.Record
|
||||
import Data.Syntax (makeTerm)
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Term as Term
|
||||
import qualified Data.Diff as Diff
|
||||
import qualified Data.Text as Text
|
||||
import qualified Language.Markdown.Syntax as Markup
|
||||
import Prologue
|
||||
import Parsing.CMark as Grammar (Grammar (..))
|
||||
import Proto3.Suite (Named (..), Named1 (..))
|
||||
|
||||
type Syntax =
|
||||
'[ Markup.Document
|
||||
@ -49,6 +52,10 @@ type Syntax =
|
||||
type Term = Term.Term (Sum Syntax) (Record Location)
|
||||
type Assignment = Assignment.Assignment (Term.TermF [] CMarkGFM.NodeType) Grammar
|
||||
|
||||
-- For Protobuf serialization
|
||||
instance Named1 (Sum Syntax) where nameOf1 _ = "MarkdownSyntax"
|
||||
instance Named (Term.Term (Sum Syntax) ()) where nameOf _ = "MarkdownTerm"
|
||||
instance Named (Diff.Diff (Sum Syntax) () ()) where nameOf _ = "MarkdownDiff"
|
||||
|
||||
assignment :: Assignment Term
|
||||
assignment = Syntax.handleError $ makeTerm <$> symbol Document <*> children (Markup.Document <$> many blockElement)
|
||||
|
@ -1,14 +1,16 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveAnyClass, DuplicateRecordFields #-}
|
||||
{-# OPTIONS_GHC -Wno-missing-export-lists #-}
|
||||
module Language.Markdown.Syntax where
|
||||
|
||||
import Prologue hiding (Text)
|
||||
import Data.JSON.Fields
|
||||
import qualified Data.Text as T
|
||||
import Diffing.Algorithm
|
||||
import Prologue hiding (Text)
|
||||
import Proto3.Suite
|
||||
import qualified Proto3.Suite as PB
|
||||
|
||||
newtype Document a = Document [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype Document a = Document { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 Document where liftEq = genericLiftEq
|
||||
instance Ord1 Document where liftCompare = genericLiftCompare
|
||||
@ -17,71 +19,71 @@ instance Show1 Document where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- Block elements
|
||||
|
||||
newtype Paragraph a = Paragraph [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype Paragraph a = Paragraph { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 Paragraph where liftEq = genericLiftEq
|
||||
instance Ord1 Paragraph where liftCompare = genericLiftCompare
|
||||
instance Show1 Paragraph where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data Heading a = Heading { headingLevel :: Int, headingContent :: [a], sectionContent :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 Heading where liftEq = genericLiftEq
|
||||
instance Ord1 Heading where liftCompare = genericLiftCompare
|
||||
instance Show1 Heading where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype UnorderedList a = UnorderedList [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype UnorderedList a = UnorderedList { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 UnorderedList where liftEq = genericLiftEq
|
||||
instance Ord1 UnorderedList where liftCompare = genericLiftCompare
|
||||
instance Show1 UnorderedList where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype OrderedList a = OrderedList [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype OrderedList a = OrderedList { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 OrderedList where liftEq = genericLiftEq
|
||||
instance Ord1 OrderedList where liftCompare = genericLiftCompare
|
||||
instance Show1 OrderedList where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype BlockQuote a = BlockQuote [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype BlockQuote a = BlockQuote { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 BlockQuote where liftEq = genericLiftEq
|
||||
instance Ord1 BlockQuote where liftCompare = genericLiftCompare
|
||||
instance Show1 BlockQuote where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data ThematicBreak a = ThematicBreak
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 ThematicBreak where liftEq = genericLiftEq
|
||||
instance Ord1 ThematicBreak where liftCompare = genericLiftCompare
|
||||
instance Show1 ThematicBreak where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype HTMLBlock a = HTMLBlock T.Text
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype HTMLBlock a = HTMLBlock { value :: T.Text }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 HTMLBlock where liftEq = genericLiftEq
|
||||
instance Ord1 HTMLBlock where liftCompare = genericLiftCompare
|
||||
instance Show1 HTMLBlock where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Table a = Table [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype Table a = Table { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 Table where liftEq = genericLiftEq
|
||||
instance Ord1 Table where liftCompare = genericLiftCompare
|
||||
instance Show1 Table where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype TableRow a = TableRow [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype TableRow a = TableRow { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 TableRow where liftEq = genericLiftEq
|
||||
instance Ord1 TableRow where liftCompare = genericLiftCompare
|
||||
instance Show1 TableRow where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype TableCell a = TableCell [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype TableCell a = TableCell { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 TableCell where liftEq = genericLiftEq
|
||||
instance Ord1 TableCell where liftCompare = genericLiftCompare
|
||||
@ -90,57 +92,82 @@ instance Show1 TableCell where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- Inline elements
|
||||
|
||||
newtype Strong a = Strong [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype Strong a = Strong { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 Strong where liftEq = genericLiftEq
|
||||
instance Ord1 Strong where liftCompare = genericLiftCompare
|
||||
instance Show1 Strong where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Emphasis a = Emphasis [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype Emphasis a = Emphasis { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 Emphasis where liftEq = genericLiftEq
|
||||
instance Ord1 Emphasis where liftCompare = genericLiftCompare
|
||||
instance Show1 Emphasis where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Text a = Text T.Text
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype Text a = Text { value :: T.Text}
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 Text where liftEq = genericLiftEq
|
||||
instance Ord1 Text where liftCompare = genericLiftCompare
|
||||
instance Show1 Text where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data Link a = Link { linkURL :: T.Text, linkTitle :: Maybe T.Text }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1)
|
||||
|
||||
instance Message1 Link where
|
||||
liftEncodeMessage _ _ Link{..} = encodeMessageField 1 linkURL <> maybe mempty (encodeMessageField 2) linkTitle
|
||||
liftDecodeMessage = undefined
|
||||
liftDotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim PB.String) (Single "linkUrl") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim PB.String) (Single "linkTitle") [] Nothing
|
||||
]
|
||||
|
||||
instance Eq1 Link where liftEq = genericLiftEq
|
||||
instance Ord1 Link where liftCompare = genericLiftCompare
|
||||
instance Show1 Link where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data Image a = Image { imageURL :: T.Text, imageTitle :: Maybe T.Text }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1)
|
||||
|
||||
instance Message1 Image where
|
||||
liftEncodeMessage _ _ Image{..} = encodeMessageField 1 imageURL <> maybe mempty (encodeMessageField 2) imageTitle
|
||||
liftDecodeMessage = undefined
|
||||
liftDotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim PB.String) (Single "imageURL") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim PB.String) (Single "imageTitle") [] Nothing
|
||||
]
|
||||
|
||||
instance Eq1 Image where liftEq = genericLiftEq
|
||||
instance Ord1 Image where liftCompare = genericLiftCompare
|
||||
instance Show1 Image where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data Code a = Code { codeLanguage :: Maybe T.Text, codeContent :: T.Text }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1)
|
||||
|
||||
instance Message1 Code where
|
||||
liftEncodeMessage _ _ Code{..} = maybe mempty (encodeMessageField 1) codeLanguage <> encodeMessageField 2 codeContent
|
||||
liftDecodeMessage = undefined
|
||||
liftDotProto _ =
|
||||
[ DotProtoMessageField $ DotProtoField 1 (Prim PB.String) (Single "codeLanguage") [] Nothing
|
||||
, DotProtoMessageField $ DotProtoField 2 (Prim PB.String) (Single "codeContent") [] Nothing
|
||||
]
|
||||
|
||||
|
||||
instance Eq1 Code where liftEq = genericLiftEq
|
||||
instance Ord1 Code where liftCompare = genericLiftCompare
|
||||
instance Show1 Code where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data LineBreak a = LineBreak
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 LineBreak where liftEq = genericLiftEq
|
||||
instance Ord1 LineBreak where liftCompare = genericLiftCompare
|
||||
instance Show1 LineBreak where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Strikethrough a = Strikethrough [a]
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1)
|
||||
newtype Strikethrough a = Strikethrough { values :: [a] }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Eq1 Strikethrough where liftEq = genericLiftEq
|
||||
instance Ord1 Strikethrough where liftCompare = genericLiftCompare
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME
|
||||
module Language.PHP.Assignment
|
||||
( assignment
|
||||
, Syntax
|
||||
@ -6,9 +7,14 @@ module Language.PHP.Assignment
|
||||
, Term
|
||||
) where
|
||||
|
||||
import Prologue
|
||||
|
||||
import Assigning.Assignment hiding (Assignment, Error)
|
||||
import qualified Assigning.Assignment as Assignment
|
||||
import qualified Data.Abstract.Name as Name
|
||||
import qualified Data.Diff as Diff
|
||||
import qualified Data.List.NonEmpty as NonEmpty
|
||||
import Data.Record
|
||||
import Data.Sum
|
||||
import Data.Syntax
|
||||
( contextualize
|
||||
, emptyTerm
|
||||
@ -20,10 +26,6 @@ import Data.Syntax
|
||||
, parseError
|
||||
, postContextualize
|
||||
)
|
||||
import Language.PHP.Grammar as Grammar
|
||||
import qualified Assigning.Assignment as Assignment
|
||||
import qualified Data.Abstract.Name as Name
|
||||
import qualified Data.List.NonEmpty as NonEmpty
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Comment as Comment
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
@ -32,8 +34,9 @@ import qualified Data.Syntax.Literal as Literal
|
||||
import qualified Data.Syntax.Statement as Statement
|
||||
import qualified Data.Syntax.Type as Type
|
||||
import qualified Data.Term as Term
|
||||
import Language.PHP.Grammar as Grammar
|
||||
import qualified Language.PHP.Syntax as Syntax
|
||||
import Prologue
|
||||
import Proto3.Suite (Named (..), Named1 (..))
|
||||
|
||||
type Syntax = '[
|
||||
Comment.Comment
|
||||
@ -89,7 +92,6 @@ type Syntax = '[
|
||||
, Statement.ForEach
|
||||
, Statement.Goto
|
||||
, Statement.If
|
||||
, Statement.If
|
||||
, Statement.Match
|
||||
, Statement.Pattern
|
||||
, Statement.Return
|
||||
@ -163,6 +165,11 @@ type Syntax = '[
|
||||
type Term = Term.Term (Sum Syntax) (Record Location)
|
||||
type Assignment = Assignment.Assignment [] Grammar
|
||||
|
||||
-- For Protobuf serialization
|
||||
instance Named1 (Sum Syntax) where nameOf1 _ = "PHPSyntax"
|
||||
instance Named (Term.Term (Sum Syntax) ()) where nameOf _ = "PHPTerm"
|
||||
instance Named (Diff.Diff (Sum Syntax) () ()) where nameOf _ = "PHPDiff"
|
||||
|
||||
-- | Assignment from AST in PHP's grammar onto a program in PHP's syntax.
|
||||
assignment :: Assignment Term
|
||||
assignment = handleError $ makeTerm <$> symbol Program <*> children (Statement.Statements <$> (bookend <$> (text <|> emptyTerm) <*> manyTerm statement <*> (text <|> emptyTerm))) <|> parseError
|
||||
|
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveAnyClass, DuplicateRecordFields #-}
|
||||
{-# OPTIONS_GHC -Wno-missing-export-lists #-}
|
||||
module Language.PHP.Syntax where
|
||||
|
||||
@ -6,14 +6,15 @@ import Data.Abstract.BaseError
|
||||
import Data.Abstract.Evaluatable
|
||||
import Data.Abstract.Module
|
||||
import Data.Abstract.Path
|
||||
import qualified Data.Text as T
|
||||
import Data.JSON.Fields
|
||||
import qualified Data.Language as Language
|
||||
import qualified Data.Text as T
|
||||
import Diffing.Algorithm
|
||||
import Prologue hiding (Text)
|
||||
import Proto3.Suite.Class
|
||||
|
||||
newtype Text a = Text T.Text
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype Text a = Text { value :: T.Text }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Text where liftEq = genericLiftEq
|
||||
instance Ord1 Text where liftCompare = genericLiftCompare
|
||||
@ -21,8 +22,8 @@ instance Show1 Text where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Text
|
||||
|
||||
|
||||
newtype VariableName a = VariableName a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype VariableName a = VariableName { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 VariableName where liftEq = genericLiftEq
|
||||
instance Ord1 VariableName where liftCompare = genericLiftCompare
|
||||
@ -74,8 +75,8 @@ include pathTerm f = do
|
||||
bindAll importedEnv
|
||||
pure (Rval v)
|
||||
|
||||
newtype Require a = Require a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype Require a = Require { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Require where liftEq = genericLiftEq
|
||||
instance Ord1 Require where liftCompare = genericLiftCompare
|
||||
@ -85,8 +86,8 @@ instance Evaluatable Require where
|
||||
eval (Require path) = include path load
|
||||
|
||||
|
||||
newtype RequireOnce a = RequireOnce a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype RequireOnce a = RequireOnce { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 RequireOnce where liftEq = genericLiftEq
|
||||
instance Ord1 RequireOnce where liftCompare = genericLiftCompare
|
||||
@ -96,8 +97,8 @@ instance Evaluatable RequireOnce where
|
||||
eval (RequireOnce path) = include path require
|
||||
|
||||
|
||||
newtype Include a = Include a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype Include a = Include { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Include where liftEq = genericLiftEq
|
||||
instance Ord1 Include where liftCompare = genericLiftCompare
|
||||
@ -107,8 +108,8 @@ instance Evaluatable Include where
|
||||
eval (Include path) = include path load
|
||||
|
||||
|
||||
newtype IncludeOnce a = IncludeOnce a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype IncludeOnce a = IncludeOnce { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 IncludeOnce where liftEq = genericLiftEq
|
||||
instance Ord1 IncludeOnce where liftCompare = genericLiftCompare
|
||||
@ -118,24 +119,24 @@ instance Evaluatable IncludeOnce where
|
||||
eval (IncludeOnce path) = include path require
|
||||
|
||||
|
||||
newtype ArrayElement a = ArrayElement a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ArrayElement a = ArrayElement { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ArrayElement where liftEq = genericLiftEq
|
||||
instance Ord1 ArrayElement where liftCompare = genericLiftCompare
|
||||
instance Show1 ArrayElement where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ArrayElement
|
||||
|
||||
newtype GlobalDeclaration a = GlobalDeclaration [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype GlobalDeclaration a = GlobalDeclaration { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 GlobalDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 GlobalDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 GlobalDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable GlobalDeclaration
|
||||
|
||||
newtype SimpleVariable a = SimpleVariable a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype SimpleVariable a = SimpleVariable { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 SimpleVariable where liftEq = genericLiftEq
|
||||
instance Ord1 SimpleVariable where liftCompare = genericLiftCompare
|
||||
@ -145,31 +146,31 @@ instance Evaluatable SimpleVariable
|
||||
|
||||
-- | TODO: Unify with TypeScript's PredefinedType
|
||||
newtype CastType a = CastType { _castType :: T.Text }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 CastType where liftEq = genericLiftEq
|
||||
instance Ord1 CastType where liftCompare = genericLiftCompare
|
||||
instance Show1 CastType where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable CastType
|
||||
|
||||
newtype ErrorControl a = ErrorControl a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ErrorControl a = ErrorControl { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ErrorControl where liftEq = genericLiftEq
|
||||
instance Ord1 ErrorControl where liftCompare = genericLiftCompare
|
||||
instance Show1 ErrorControl where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ErrorControl
|
||||
|
||||
newtype Clone a = Clone a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype Clone a = Clone { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Clone where liftEq = genericLiftEq
|
||||
instance Ord1 Clone where liftCompare = genericLiftCompare
|
||||
instance Show1 Clone where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Clone
|
||||
|
||||
newtype ShellCommand a = ShellCommand T.Text
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ShellCommand a = ShellCommand { value :: T.Text }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ShellCommand where liftEq = genericLiftEq
|
||||
instance Ord1 ShellCommand where liftCompare = genericLiftCompare
|
||||
@ -178,31 +179,31 @@ instance Evaluatable ShellCommand
|
||||
|
||||
-- | TODO: Combine with TypeScript update expression.
|
||||
newtype Update a = Update { _updateSubject :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Update where liftEq = genericLiftEq
|
||||
instance Ord1 Update where liftCompare = genericLiftCompare
|
||||
instance Show1 Update where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Update
|
||||
|
||||
newtype NewVariable a = NewVariable [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype NewVariable a = NewVariable { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 NewVariable where liftEq = genericLiftEq
|
||||
instance Ord1 NewVariable where liftCompare = genericLiftCompare
|
||||
instance Show1 NewVariable where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable NewVariable
|
||||
|
||||
newtype RelativeScope a = RelativeScope T.Text
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype RelativeScope a = RelativeScope { value :: T.Text }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 RelativeScope where liftEq = genericLiftEq
|
||||
instance Ord1 RelativeScope where liftCompare = genericLiftCompare
|
||||
instance Show1 RelativeScope where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable RelativeScope
|
||||
|
||||
data QualifiedName a = QualifiedName !a !a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data QualifiedName a = QualifiedName { name :: a, identifier :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 QualifiedName where liftEq = genericLiftEq
|
||||
instance Ord1 QualifiedName where liftCompare = genericLiftCompare
|
||||
@ -213,8 +214,8 @@ instance Evaluatable QualifiedName where
|
||||
namePtr <- subtermAddress name
|
||||
Rval <$> evaluateInScopedEnv namePtr (subtermAddress iden)
|
||||
|
||||
newtype NamespaceName a = NamespaceName (NonEmpty a)
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Diffable, FreeVariables1, Declarations1, ToJSONFields1)
|
||||
newtype NamespaceName a = NamespaceName { names :: NonEmpty a }
|
||||
deriving (Eq, Ord, Show, Foldable, Traversable, Functor, Generic1, Diffable, FreeVariables1, Declarations1, ToJSONFields1, Named1, Message1)
|
||||
|
||||
instance Hashable1 NamespaceName where liftHashWithSalt = foldl
|
||||
instance Eq1 NamespaceName where liftEq = genericLiftEq
|
||||
@ -225,32 +226,32 @@ instance Evaluatable NamespaceName where
|
||||
eval (NamespaceName xs) = Rval <$> foldl1 f (fmap subtermAddress xs)
|
||||
where f ns id = ns >>= flip evaluateInScopedEnv id
|
||||
|
||||
newtype ConstDeclaration a = ConstDeclaration [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ConstDeclaration a = ConstDeclaration { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ConstDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 ConstDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 ConstDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ConstDeclaration
|
||||
|
||||
data ClassConstDeclaration a = ClassConstDeclaration a [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data ClassConstDeclaration a = ClassConstDeclaration { visibility :: a, elements :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ClassConstDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 ClassConstDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 ClassConstDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ClassConstDeclaration
|
||||
|
||||
newtype ClassInterfaceClause a = ClassInterfaceClause [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ClassInterfaceClause a = ClassInterfaceClause { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ClassInterfaceClause where liftEq = genericLiftEq
|
||||
instance Ord1 ClassInterfaceClause where liftCompare = genericLiftCompare
|
||||
instance Show1 ClassInterfaceClause where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ClassInterfaceClause
|
||||
|
||||
newtype ClassBaseClause a = ClassBaseClause a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ClassBaseClause a = ClassBaseClause { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ClassBaseClause where liftEq = genericLiftEq
|
||||
instance Ord1 ClassBaseClause where liftCompare = genericLiftCompare
|
||||
@ -258,112 +259,112 @@ instance Show1 ClassBaseClause where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ClassBaseClause
|
||||
|
||||
|
||||
newtype UseClause a = UseClause [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype UseClause a = UseClause { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 UseClause where liftEq = genericLiftEq
|
||||
instance Ord1 UseClause where liftCompare = genericLiftCompare
|
||||
instance Show1 UseClause where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable UseClause
|
||||
|
||||
newtype ReturnType a = ReturnType a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ReturnType a = ReturnType { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ReturnType where liftEq = genericLiftEq
|
||||
instance Ord1 ReturnType where liftCompare = genericLiftCompare
|
||||
instance Show1 ReturnType where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ReturnType
|
||||
|
||||
newtype TypeDeclaration a = TypeDeclaration a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype TypeDeclaration a = TypeDeclaration { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 TypeDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 TypeDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 TypeDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable TypeDeclaration
|
||||
|
||||
newtype BaseTypeDeclaration a = BaseTypeDeclaration a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype BaseTypeDeclaration a = BaseTypeDeclaration { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 BaseTypeDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 BaseTypeDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 BaseTypeDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable BaseTypeDeclaration
|
||||
|
||||
newtype ScalarType a = ScalarType T.Text
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ScalarType a = ScalarType { value :: T.Text }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ScalarType where liftEq = genericLiftEq
|
||||
instance Ord1 ScalarType where liftCompare = genericLiftCompare
|
||||
instance Show1 ScalarType where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ScalarType
|
||||
|
||||
newtype EmptyIntrinsic a = EmptyIntrinsic a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype EmptyIntrinsic a = EmptyIntrinsic { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 EmptyIntrinsic where liftEq = genericLiftEq
|
||||
instance Ord1 EmptyIntrinsic where liftCompare = genericLiftCompare
|
||||
instance Show1 EmptyIntrinsic where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable EmptyIntrinsic
|
||||
|
||||
newtype ExitIntrinsic a = ExitIntrinsic a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ExitIntrinsic a = ExitIntrinsic { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ExitIntrinsic where liftEq = genericLiftEq
|
||||
instance Ord1 ExitIntrinsic where liftCompare = genericLiftCompare
|
||||
instance Show1 ExitIntrinsic where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ExitIntrinsic
|
||||
|
||||
newtype IssetIntrinsic a = IssetIntrinsic a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype IssetIntrinsic a = IssetIntrinsic { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 IssetIntrinsic where liftEq = genericLiftEq
|
||||
instance Ord1 IssetIntrinsic where liftCompare = genericLiftCompare
|
||||
instance Show1 IssetIntrinsic where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable IssetIntrinsic
|
||||
|
||||
newtype EvalIntrinsic a = EvalIntrinsic a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype EvalIntrinsic a = EvalIntrinsic { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 EvalIntrinsic where liftEq = genericLiftEq
|
||||
instance Ord1 EvalIntrinsic where liftCompare = genericLiftCompare
|
||||
instance Show1 EvalIntrinsic where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable EvalIntrinsic
|
||||
|
||||
newtype PrintIntrinsic a = PrintIntrinsic a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype PrintIntrinsic a = PrintIntrinsic { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 PrintIntrinsic where liftEq = genericLiftEq
|
||||
instance Ord1 PrintIntrinsic where liftCompare = genericLiftCompare
|
||||
instance Show1 PrintIntrinsic where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable PrintIntrinsic
|
||||
|
||||
newtype NamespaceAliasingClause a = NamespaceAliasingClause a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype NamespaceAliasingClause a = NamespaceAliasingClause { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 NamespaceAliasingClause where liftEq = genericLiftEq
|
||||
instance Ord1 NamespaceAliasingClause where liftCompare = genericLiftCompare
|
||||
instance Show1 NamespaceAliasingClause where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable NamespaceAliasingClause
|
||||
|
||||
newtype NamespaceUseDeclaration a = NamespaceUseDeclaration [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype NamespaceUseDeclaration a = NamespaceUseDeclaration { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 NamespaceUseDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 NamespaceUseDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 NamespaceUseDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable NamespaceUseDeclaration
|
||||
|
||||
newtype NamespaceUseClause a = NamespaceUseClause [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype NamespaceUseClause a = NamespaceUseClause { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 NamespaceUseClause where liftEq = genericLiftEq
|
||||
instance Ord1 NamespaceUseClause where liftCompare = genericLiftCompare
|
||||
instance Show1 NamespaceUseClause where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable NamespaceUseClause
|
||||
|
||||
newtype NamespaceUseGroupClause a = NamespaceUseGroupClause [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype NamespaceUseGroupClause a = NamespaceUseGroupClause { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 NamespaceUseGroupClause where liftEq = genericLiftEq
|
||||
instance Ord1 NamespaceUseGroupClause where liftCompare = genericLiftCompare
|
||||
@ -371,7 +372,7 @@ instance Show1 NamespaceUseGroupClause where liftShowsPrec = genericLiftShowsPre
|
||||
instance Evaluatable NamespaceUseGroupClause
|
||||
|
||||
data Namespace a = Namespace { namespaceName :: [a], namespaceBody :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Namespace where liftEq = genericLiftEq
|
||||
instance Ord1 Namespace where liftCompare = genericLiftCompare
|
||||
@ -394,7 +395,7 @@ instance Evaluatable Namespace where
|
||||
go [] = subtermAddress namespaceBody
|
||||
|
||||
data TraitDeclaration a = TraitDeclaration { traitName :: a, traitStatements :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 TraitDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 TraitDeclaration where liftCompare = genericLiftCompare
|
||||
@ -402,127 +403,127 @@ instance Show1 TraitDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable TraitDeclaration
|
||||
|
||||
data AliasAs a = AliasAs { aliasAsName :: a, aliasAsModifier :: a, aliasAsClause :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 AliasAs where liftEq = genericLiftEq
|
||||
instance Ord1 AliasAs where liftCompare = genericLiftCompare
|
||||
instance Show1 AliasAs where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable AliasAs
|
||||
|
||||
data InsteadOf a = InsteadOf a a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data InsteadOf a = InsteadOf { left :: a, right :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 InsteadOf where liftEq = genericLiftEq
|
||||
instance Ord1 InsteadOf where liftCompare = genericLiftCompare
|
||||
instance Show1 InsteadOf where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable InsteadOf
|
||||
|
||||
newtype TraitUseSpecification a = TraitUseSpecification [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype TraitUseSpecification a = TraitUseSpecification { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 TraitUseSpecification where liftEq = genericLiftEq
|
||||
instance Ord1 TraitUseSpecification where liftCompare = genericLiftCompare
|
||||
instance Show1 TraitUseSpecification where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable TraitUseSpecification
|
||||
|
||||
data TraitUseClause a = TraitUseClause [a] a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data TraitUseClause a = TraitUseClause { namespace :: [a], alias :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 TraitUseClause where liftEq = genericLiftEq
|
||||
instance Ord1 TraitUseClause where liftCompare = genericLiftCompare
|
||||
instance Show1 TraitUseClause where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable TraitUseClause
|
||||
|
||||
data DestructorDeclaration a = DestructorDeclaration [a] a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data DestructorDeclaration a = DestructorDeclaration { body:: [a], name :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 DestructorDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 DestructorDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 DestructorDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable DestructorDeclaration
|
||||
|
||||
newtype Static a = Static T.Text
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype Static a = Static { value :: T.Text }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Static where liftEq = genericLiftEq
|
||||
instance Ord1 Static where liftCompare = genericLiftCompare
|
||||
instance Show1 Static where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Static
|
||||
|
||||
newtype ClassModifier a = ClassModifier T.Text
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype ClassModifier a = ClassModifier { value :: T.Text }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ClassModifier where liftEq = genericLiftEq
|
||||
instance Ord1 ClassModifier where liftCompare = genericLiftCompare
|
||||
instance Show1 ClassModifier where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ClassModifier
|
||||
|
||||
data ConstructorDeclaration a = ConstructorDeclaration [a] [a] a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data ConstructorDeclaration a = ConstructorDeclaration { modifiers :: [a], parameters :: [a], body :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 ConstructorDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 ConstructorDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 ConstructorDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable ConstructorDeclaration
|
||||
|
||||
data PropertyDeclaration a = PropertyDeclaration a [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data PropertyDeclaration a = PropertyDeclaration { modifier :: a, elements :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 PropertyDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 PropertyDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 PropertyDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable PropertyDeclaration
|
||||
|
||||
data PropertyModifier a = PropertyModifier a a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data PropertyModifier a = PropertyModifier { visibility :: a , static :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 PropertyModifier where liftEq = genericLiftEq
|
||||
instance Ord1 PropertyModifier where liftCompare = genericLiftCompare
|
||||
instance Show1 PropertyModifier where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable PropertyModifier
|
||||
|
||||
data InterfaceDeclaration a = InterfaceDeclaration a a [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data InterfaceDeclaration a = InterfaceDeclaration { name :: a, base :: a, declarations :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 InterfaceDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 InterfaceDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 InterfaceDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable InterfaceDeclaration
|
||||
|
||||
newtype InterfaceBaseClause a = InterfaceBaseClause [a]
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype InterfaceBaseClause a = InterfaceBaseClause { values :: [a] }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 InterfaceBaseClause where liftEq = genericLiftEq
|
||||
instance Ord1 InterfaceBaseClause where liftCompare = genericLiftCompare
|
||||
instance Show1 InterfaceBaseClause where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable InterfaceBaseClause
|
||||
|
||||
newtype Echo a = Echo a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype Echo a = Echo { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Echo where liftEq = genericLiftEq
|
||||
instance Ord1 Echo where liftCompare = genericLiftCompare
|
||||
instance Show1 Echo where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Echo
|
||||
|
||||
newtype Unset a = Unset a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype Unset a = Unset { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Unset where liftEq = genericLiftEq
|
||||
instance Ord1 Unset where liftCompare = genericLiftCompare
|
||||
instance Show1 Unset where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Unset
|
||||
|
||||
data Declare a = Declare a a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
data Declare a = Declare { left :: a, right :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 Declare where liftEq = genericLiftEq
|
||||
instance Ord1 Declare where liftCompare = genericLiftCompare
|
||||
instance Show1 Declare where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable Declare
|
||||
|
||||
newtype DeclareDirective a = DeclareDirective a
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
newtype DeclareDirective a = DeclareDirective { value :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 DeclareDirective where liftEq = genericLiftEq
|
||||
instance Ord1 DeclareDirective where liftCompare = genericLiftCompare
|
||||
@ -530,7 +531,7 @@ instance Show1 DeclareDirective where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Evaluatable DeclareDirective
|
||||
|
||||
newtype LabeledStatement a = LabeledStatement { _labeledStatementIdentifier :: a }
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable)
|
||||
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
|
||||
|
||||
instance Eq1 LabeledStatement where liftEq = genericLiftEq
|
||||
instance Ord1 LabeledStatement where liftCompare = genericLiftCompare
|
||||
|
@ -1,70 +1,71 @@
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
|
||||
module Language.Python.PrettyPrint ( printingPython ) where
|
||||
|
||||
import Control.Arrow
|
||||
import Control.Monad
|
||||
import Control.Monad.Trans (lift)
|
||||
import Control.Monad.Effect
|
||||
import Control.Monad.Effect.Exception (Exc, throwError)
|
||||
import Data.Machine
|
||||
import Data.Reprinting.Errors
|
||||
import Data.Reprinting.Splice
|
||||
import Data.Reprinting.Token as Token
|
||||
import Data.Semigroup (stimes)
|
||||
import Data.Sequence (Seq)
|
||||
|
||||
-- | Print Python syntax.
|
||||
printingPython :: (Member (Exc TranslationError) effs) => ProcessT (Eff effs) Fragment Splice
|
||||
printingPython = autoT (Kleisli step) ~> flattened
|
||||
printingPython = repeatedly (await >>= step)
|
||||
|
||||
step :: (Member (Exc TranslationError) effs) => Fragment -> Eff effs (Seq Splice)
|
||||
step (Verbatim txt) = pure $ emit txt
|
||||
step (New _ _ txt) = pure $ emit txt
|
||||
step :: (Member (Exc TranslationError) effs) => Fragment -> PlanT k Splice (Eff effs) ()
|
||||
step (Verbatim txt) = emit txt
|
||||
step (New _ _ txt) = emit txt
|
||||
step (Defer el cs) = case (el, cs) of
|
||||
-- Function declarations
|
||||
(TOpen, TFunction:_) -> pure $ emit "def" <> space
|
||||
(TOpen, TParams:TFunction:_) -> pure $ emit "("
|
||||
(TClose, TParams:TFunction:_) -> pure $ emit "):"
|
||||
(TClose, TFunction:xs) -> pure $ endContext (depth xs)
|
||||
(TOpen, TFunction:_) -> emit "def" *> space
|
||||
(TOpen, TParams:TFunction:_) -> emit "("
|
||||
(TClose, TParams:TFunction:_) -> emit "):"
|
||||
(TClose, TFunction:xs) -> endContext (depth xs)
|
||||
|
||||
-- Return statements
|
||||
(TOpen, TReturn:_) -> pure $ emit "return" <> space
|
||||
(TClose, TReturn:_) -> pure mempty
|
||||
(TOpen, Imperative:TReturn:_) -> pure mempty
|
||||
(TSep, Imperative:TReturn:_) -> pure $ emit "," <> space
|
||||
(TClose, Imperative:TReturn:_) -> pure mempty -- Don't hardwarp or indent for return statements
|
||||
(TOpen, TReturn:_) -> emit "return" *> space
|
||||
(TClose, TReturn:_) -> pure ()
|
||||
(TOpen, Imperative:TReturn:_) -> pure ()
|
||||
(TSep, Imperative:TReturn:_) -> emit "," *> space
|
||||
(TClose, Imperative:TReturn:_) -> pure () -- Don't hardwarp or indent for return statements
|
||||
|
||||
-- If statements
|
||||
(TOpen, TIf:_) -> pure $ emit "if" <> space
|
||||
(TThen, TIf:_) -> pure $ emit ":"
|
||||
(TElse, TIf:xs) -> pure $ endContext (depth xs) <> emit "else:"
|
||||
(TClose, TIf:_) -> pure mempty
|
||||
(TOpen, TIf:_) -> emit "if" *> space
|
||||
(TThen, TIf:_) -> emit ":"
|
||||
(TElse, TIf:xs) -> endContext (depth xs) *> emit "else:"
|
||||
(TClose, TIf:_) -> pure ()
|
||||
|
||||
-- Booleans
|
||||
(Truth True, _) -> pure $ emit "True"
|
||||
(Truth False, _) -> pure $ emit "False"
|
||||
(Truth True, _) -> emit "True"
|
||||
(Truth False, _) -> emit "False"
|
||||
|
||||
-- Infix binary operators
|
||||
(TOpen, TInfixL _ p:xs) -> emitIf (p < prec xs) "("
|
||||
(TSym, TInfixL Add _:_) -> pure $ space <> emit "+" <> space
|
||||
(TSym, TInfixL Multiply _:_) -> pure $ space <> emit "*" <> space
|
||||
(TSym, TInfixL Subtract _:_) -> pure $ space <> emit "-" <> space
|
||||
(TSym, TInfixL Add _:_) -> space *> emit "+" *> space
|
||||
(TSym, TInfixL Multiply _:_) -> space *> emit "*" *> space
|
||||
(TSym, TInfixL Subtract _:_) -> space *> emit "-" *> space
|
||||
(TClose, TInfixL _ p:xs) -> emitIf (p < prec xs) ")"
|
||||
|
||||
-- General params handling
|
||||
(TOpen, TParams:_) -> pure $ emit "("
|
||||
(TSep, TParams:_) -> pure $ emit "," <> space
|
||||
(TClose, TParams:_) -> pure $ emit ")"
|
||||
(TOpen, TParams:_) -> emit "("
|
||||
(TSep, TParams:_) -> emit "," *> space
|
||||
(TClose, TParams:_) -> emit ")"
|
||||
|
||||
-- Imperative context and whitespace handling
|
||||
(TOpen, [Imperative]) -> pure mempty -- Don't indent at the top-level imperative context...
|
||||
(TClose, [Imperative]) -> pure $ layout HardWrap -- but end the program with a newline.
|
||||
(TOpen, Imperative:xs) -> pure $ layout HardWrap <> indent (depth xs)
|
||||
(TSep, Imperative:xs) -> pure $ layout HardWrap <> indent (depth xs)
|
||||
(TClose, Imperative:_) -> pure mempty
|
||||
(TOpen, [Imperative]) -> pure () -- Don't indent at the top-level imperative context...
|
||||
(TClose, [Imperative]) -> layout HardWrap -- but end the program with a newline.
|
||||
(TOpen, Imperative:xs) -> layout HardWrap *> indent (depth xs)
|
||||
(TSep, Imperative:xs) -> layout HardWrap *> indent (depth xs)
|
||||
(TClose, Imperative:_) -> pure ()
|
||||
|
||||
_ -> throwError (NoTranslation el cs)
|
||||
_ -> lift (throwError (NoTranslation el cs))
|
||||
|
||||
where
|
||||
emitIf predicate txt = pure $ if predicate then emit txt else mempty
|
||||
endContext times = layout HardWrap <> indent (pred times)
|
||||
emitIf predicate txt = when predicate (emit txt)
|
||||
endContext times = layout HardWrap *> indent (pred times)
|
||||
|
||||
prec :: [Context] -> Int
|
||||
prec cs = case filter isInfix cs of
|
||||
@ -78,7 +79,7 @@ depth :: [Context] -> Int
|
||||
depth = length . filter (== Imperative)
|
||||
|
||||
-- | Indent n times.
|
||||
indent :: Integral b => b -> Seq Splice
|
||||
indent :: Int -> Plan k Splice ()
|
||||
indent times
|
||||
| times > 0 = stimes times (layout (Indent 4 Spaces))
|
||||
| otherwise = mempty
|
||||
| times > 0 = replicateM_ times (layout (Indent 4 Spaces))
|
||||
| otherwise = pure ()
|
||||
|
@ -7,13 +7,14 @@ module Language.Ruby.Assignment
|
||||
, Term
|
||||
) where
|
||||
|
||||
import Prologue hiding (for, unless)
|
||||
|
||||
import Assigning.Assignment hiding (Assignment, Error)
|
||||
import qualified Assigning.Assignment as Assignment
|
||||
import Data.Abstract.Name (name)
|
||||
import Data.List (elem)
|
||||
import qualified Data.List.NonEmpty as NonEmpty
|
||||
import Data.Record
|
||||
import Data.Sum
|
||||
import Data.Syntax
|
||||
( contextualize
|
||||
, emptyTerm
|
||||
@ -37,7 +38,6 @@ import qualified Data.Term as Term
|
||||
import qualified Data.Diff as Diff
|
||||
import Language.Ruby.Grammar as Grammar
|
||||
import qualified Language.Ruby.Syntax as Ruby.Syntax
|
||||
import Prologue hiding (for, unless)
|
||||
import Proto3.Suite (Named (..), Named1 (..))
|
||||
|
||||
-- | The type of Ruby syntax.
|
||||
@ -133,14 +133,10 @@ type Syntax = '[
|
||||
type Term = Term.Term (Sum Syntax) (Record Location)
|
||||
type Assignment = Assignment.Assignment [] Grammar
|
||||
|
||||
instance Named1 (Sum Syntax) where
|
||||
nameOf1 _ = "RubySyntax"
|
||||
|
||||
instance Named (Term.Term (Sum Syntax) ()) where
|
||||
nameOf _ = "RubyTerm"
|
||||
|
||||
instance Named (Diff.Diff (Sum Syntax) () ()) where
|
||||
nameOf _ = "RubyDiff"
|
||||
-- For Protobuf serialization
|
||||
instance Named1 (Sum Syntax) where nameOf1 _ = "RubySyntax"
|
||||
instance Named (Term.Term (Sum Syntax) ()) where nameOf _ = "RubyTerm"
|
||||
instance Named (Diff.Diff (Sum Syntax) () ()) where nameOf _ = "RubyDiff"
|
||||
|
||||
-- | Assignment from AST in Ruby’s grammar onto a program in Ruby’s syntax.
|
||||
assignment :: Assignment Term
|
||||
|
@ -1,56 +1,57 @@
|
||||
{-# LANGUAGE Rank2Types #-}
|
||||
|
||||
module Language.Ruby.PrettyPrint ( printingRuby ) where
|
||||
|
||||
import Control.Arrow
|
||||
import Control.Monad
|
||||
import Control.Monad.Trans (lift)
|
||||
import Control.Monad.Effect
|
||||
import Control.Monad.Effect.Exception (Exc, throwError)
|
||||
import Data.Machine
|
||||
import Data.Sequence (Seq)
|
||||
import Data.Reprinting.Errors
|
||||
import Data.Reprinting.Splice
|
||||
import Data.Reprinting.Token as Token
|
||||
import Data.Semigroup (stimes)
|
||||
|
||||
-- | Print Ruby syntax.
|
||||
printingRuby :: (Member (Exc TranslationError) effs) => ProcessT (Eff effs) Fragment Splice
|
||||
printingRuby = autoT (Kleisli step) ~> flattened
|
||||
printingRuby = repeatedly (await >>= step)
|
||||
|
||||
step :: (Member (Exc TranslationError) effs) => Fragment -> Eff effs (Seq Splice)
|
||||
step (Verbatim txt) = pure $ emit txt
|
||||
step (New _ _ txt) = pure $ emit txt
|
||||
step :: (Member (Exc TranslationError) effs) => Fragment -> PlanT k Splice (Eff effs) ()
|
||||
step (Verbatim txt) = emit txt
|
||||
step (New _ _ txt) = emit txt
|
||||
step (Defer el cs) = case (el, cs) of
|
||||
(TOpen, TMethod:_) -> pure $ emit "def" <> space
|
||||
(TClose, TMethod:xs) -> pure $ endContext (depth xs) <> emit "end"
|
||||
(TOpen, TMethod:_) -> emit "def" *> space
|
||||
(TClose, TMethod:xs) -> endContext (depth xs) *> emit "end"
|
||||
|
||||
-- TODO: do..end vs {..} should be configurable.
|
||||
(TOpen, TFunction:_) -> pure $ space <> emit "do" <> space
|
||||
(TOpen, TParams:TFunction:_) -> pure $ emit "|"
|
||||
(TClose, TParams:TFunction:_) -> pure $ emit "|"
|
||||
(TClose, TFunction:xs) -> pure $ endContext (depth xs) <> emit "end"
|
||||
(TOpen, TFunction:_) -> space *> emit "do" *> space
|
||||
(TOpen, TParams:TFunction:_) -> emit "|"
|
||||
(TClose, TParams:TFunction:_) -> emit "|"
|
||||
(TClose, TFunction:xs) -> endContext (depth xs) *> emit "end"
|
||||
|
||||
-- TODO: Parens for calls are a style choice, make configurable.
|
||||
(TOpen, TParams:_) -> pure $ emit "("
|
||||
(TSep, TParams:_) -> pure $ emit "," <> space
|
||||
(TClose, TParams:_) -> pure $ emit ")"
|
||||
(TOpen, TParams:_) -> emit "("
|
||||
(TSep, TParams:_) -> emit "," *> space
|
||||
(TClose, TParams:_) -> emit ")"
|
||||
|
||||
(TOpen, TInfixL _ p:xs) -> emitIf (p < prec xs) "("
|
||||
(TSym, TInfixL Add _:_) -> pure $ space <> emit "+" <> space
|
||||
(TSym, TInfixL Multiply _:_) -> pure $ space <> emit "*" <> space
|
||||
(TSym, TInfixL Subtract _:_) -> pure $ space <> emit "-" <> space
|
||||
(TSym, TInfixL Add _:_) -> space *> emit "+" *> space
|
||||
(TSym, TInfixL Multiply _:_) -> space *> emit "*" *> space
|
||||
(TSym, TInfixL Subtract _:_) -> space *> emit "-" *> space
|
||||
(TClose, TInfixL _ p:xs) -> emitIf (p < prec xs) ")"
|
||||
|
||||
(TOpen, [Imperative]) -> pure mempty
|
||||
(TOpen, Imperative:xs) -> pure $ layout HardWrap <> indent (depth xs)
|
||||
(TSep, Imperative:xs) -> pure $ layout HardWrap <> indent (depth xs)
|
||||
(TClose, [Imperative]) -> pure $ layout HardWrap
|
||||
(TClose, Imperative:xs) -> pure $ indent (pred (depth xs))
|
||||
(TOpen, [Imperative]) -> pure ()
|
||||
(TOpen, Imperative:xs) -> layout HardWrap *> indent (depth xs)
|
||||
(TSep, Imperative:xs) -> layout HardWrap *> indent (depth xs)
|
||||
(TClose, [Imperative]) -> layout HardWrap
|
||||
(TClose, Imperative:xs) -> indent (pred (depth xs))
|
||||
|
||||
(TSep, TCall:_) -> pure $ emit "."
|
||||
(TSep, TCall:_) -> emit "."
|
||||
|
||||
_ -> throwError (NoTranslation el cs)
|
||||
_ -> lift (throwError (NoTranslation el cs))
|
||||
|
||||
where
|
||||
emitIf predicate txt = pure $ if predicate then emit txt else mempty
|
||||
endContext times = layout HardWrap <> indent (pred times)
|
||||
emitIf predicate txt = when predicate (emit txt)
|
||||
endContext times = layout HardWrap *> indent (pred times)
|
||||
|
||||
prec :: [Context] -> Int
|
||||
prec cs = case filter isInfix cs of
|
||||
@ -64,7 +65,7 @@ depth :: [Context] -> Int
|
||||
depth = length . filter (== Imperative)
|
||||
|
||||
-- | Indent n times.
|
||||
indent :: Integral b => b -> Seq Splice
|
||||
indent :: Int -> Plan k Splice ()
|
||||
indent times
|
||||
| times > 0 = stimes times (layout (Indent 2 Spaces))
|
||||
| otherwise = mempty
|
||||
| times > 0 = replicateM_ times (layout (Indent 2 Spaces))
|
||||
| otherwise = pure ()
|
||||
|
@ -33,7 +33,7 @@ import qualified Assigning.Assignment.Deterministic as Deterministic
|
||||
import qualified CMarkGFM
|
||||
import Data.Abstract.Evaluatable (HasPostlude, HasPrelude)
|
||||
import Data.AST
|
||||
import Data.Graph.Vertex (VertexDeclaration')
|
||||
import Data.Graph.ControlFlowVertex (VertexDeclaration')
|
||||
import Data.Kind
|
||||
import Data.Language
|
||||
import Data.Record
|
||||
|
@ -4,8 +4,6 @@ module Rendering.Graph
|
||||
, termStyle
|
||||
, diffStyle
|
||||
, ToTreeGraph(..)
|
||||
, TaggedVertex(..)
|
||||
, DiffTag(..)
|
||||
) where
|
||||
|
||||
import Algebra.Graph.Export.Dot
|
||||
@ -15,67 +13,89 @@ import Control.Monad.Effect.Fresh
|
||||
import Control.Monad.Effect.Reader
|
||||
import Data.Diff
|
||||
import Data.Graph
|
||||
import Data.Graph.TermVertex
|
||||
import Data.Graph.DiffVertex
|
||||
import Data.Range
|
||||
import Data.Span
|
||||
import Data.Record
|
||||
import Data.Patch
|
||||
import Data.String (IsString(..))
|
||||
import Data.Term
|
||||
import Prologue
|
||||
|
||||
-- TODO: rename as this isn't a render
|
||||
renderTreeGraph :: (Ord vertex, Recursive t, ToTreeGraph vertex (Base t)) => t -> Graph vertex
|
||||
renderTreeGraph = simplify . runGraph . cata toTreeGraph
|
||||
|
||||
runGraph :: Eff '[Reader (Graph vertex), Fresh] (Graph vertex) -> Graph vertex
|
||||
runGraph = run . runFresh 0 . runReader mempty
|
||||
|
||||
|
||||
termAlgebra :: (ConstructorName syntax, Foldable syntax, Member Fresh effs, Member (Reader (Graph (TaggedVertex tag))) effs)
|
||||
=> tag
|
||||
-> TermF syntax ann (Eff effs (Graph (TaggedVertex tag)))
|
||||
-> Eff effs (Graph (TaggedVertex tag))
|
||||
termAlgebra t (In _ syntax) = do
|
||||
i <- fresh
|
||||
parent <- ask
|
||||
let root = vertex (TaggedVertex i t (constructorName syntax))
|
||||
subGraph <- foldl' (\acc x -> overlay <$> acc <*> local (const root) x) (pure mempty) syntax
|
||||
pure (parent `connect` root `overlay` subGraph)
|
||||
|
||||
style :: (IsString string, Monoid string) => String -> (tag -> [Attribute string]) -> Style (TaggedVertex tag) string
|
||||
style name tagAttributes = (defaultStyle (fromString . show . vertexId))
|
||||
-- | GraphViz styling for terms
|
||||
termStyle :: (IsString string, Monoid string) => String -> Style TermVertex string
|
||||
termStyle name = (defaultStyle (fromString . show . vertexId))
|
||||
{ graphName = fromString (quote name)
|
||||
, vertexAttributes = vertexAttributes }
|
||||
where quote a = "\"" <> a <> "\""
|
||||
vertexAttributes TaggedVertex{..} = "label" := fromString vertexName : tagAttributes vertexTag
|
||||
|
||||
termStyle :: (IsString string, Monoid string) => String -> Style (TaggedVertex ()) string
|
||||
termStyle name = style name (const [])
|
||||
|
||||
diffStyle :: (IsString string, Monoid string) => String -> Style (TaggedVertex DiffTag) string
|
||||
diffStyle name = style name diffTagAttributes
|
||||
where diffTagAttributes Deleted = ["color" := "red"]
|
||||
diffTagAttributes Inserted = ["color" := "green"]
|
||||
diffTagAttributes Replaced = ["color" := "orange", "style" := "dashed"]
|
||||
diffTagAttributes _ = []
|
||||
|
||||
data TaggedVertex tag = TaggedVertex { vertexId :: Int, vertexTag :: tag, vertexName :: String }
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
data DiffTag = Deleted | Inserted | Replaced | Merged
|
||||
deriving (Eq, Ord, Show)
|
||||
vertexAttributes TermVertex{..} = ["label" := fromString vertexTermName]
|
||||
|
||||
-- | Graphviz styling for diffs
|
||||
diffStyle :: (IsString string, Monoid string) => String -> Style DiffVertex string
|
||||
diffStyle name = (defaultStyle (fromString . show . diffVertexId))
|
||||
{ graphName = fromString (quote name)
|
||||
, vertexAttributes = vertexAttributes }
|
||||
where quote a = "\"" <> a <> "\""
|
||||
vertexAttributes (DiffVertex _ (Deleted DeletedTerm{..})) = [ "label" := fromString deletedTermName, "color" := "red" ]
|
||||
vertexAttributes (DiffVertex _ (Inserted InsertedTerm{..})) = [ "label" := fromString insertedTermName, "color" := "green" ]
|
||||
vertexAttributes (DiffVertex _ (Replaced ReplacedTerm{..})) = [ "label" := "Replacement", "color" := "orange", "style" := "dashed" ]
|
||||
vertexAttributes (DiffVertex _ (Merged MergedTerm{..})) = [ "label" := fromString mergedTermName ]
|
||||
|
||||
class ToTreeGraph vertex t | t -> vertex where
|
||||
toTreeGraph :: (Member Fresh effs, Member (Reader (Graph vertex)) effs) => t (Eff effs (Graph vertex)) -> Eff effs (Graph vertex)
|
||||
|
||||
instance (ConstructorName syntax, Foldable syntax) => ToTreeGraph (TaggedVertex ()) (TermF syntax ann) where
|
||||
toTreeGraph = termAlgebra ()
|
||||
|
||||
instance (ConstructorName syntax, Foldable syntax) => ToTreeGraph (TaggedVertex DiffTag) (DiffF syntax ann1 ann2) where
|
||||
toTreeGraph d = case d of
|
||||
Merge t -> termAlgebra Merged t
|
||||
Patch (Delete t1) -> termAlgebra Deleted t1
|
||||
Patch (Insert t2) -> termAlgebra Inserted t2
|
||||
Patch (Replace t1 t2) -> do
|
||||
instance (ConstructorName syntax, Foldable syntax, HasField fields Range, HasField fields Span) =>
|
||||
ToTreeGraph TermVertex (TermF syntax (Record fields)) where
|
||||
toTreeGraph = termAlgebra where
|
||||
termAlgebra ::
|
||||
( ConstructorName syntax
|
||||
, HasField fields Range
|
||||
, HasField fields Span
|
||||
, Foldable syntax
|
||||
, Member Fresh effs
|
||||
, Member (Reader (Graph TermVertex)) effs
|
||||
)
|
||||
=> TermF syntax (Record fields) (Eff effs (Graph TermVertex))
|
||||
-> Eff effs (Graph TermVertex)
|
||||
termAlgebra (In ann syntax) = do
|
||||
i <- fresh
|
||||
parent <- ask
|
||||
let replace = vertex (TaggedVertex i Replaced "Replacement")
|
||||
graph <- local (const replace) (overlay <$> termAlgebra Deleted t1 <*> termAlgebra Inserted t2)
|
||||
let root = vertex (TermVertex i (constructorName syntax) (TermAnnotation (getField ann) (getField ann)))
|
||||
subGraph <- foldl' (\acc x -> overlay <$> acc <*> local (const root) x) (pure mempty) syntax
|
||||
pure (parent `connect` root `overlay` subGraph)
|
||||
|
||||
instance (ConstructorName syntax, Foldable syntax, HasField fields1 Range, HasField fields1 Span, HasField fields2 Range, HasField fields2 Span) =>
|
||||
ToTreeGraph DiffVertex (DiffF syntax (Record fields1) (Record fields2)) where
|
||||
toTreeGraph d = case d of
|
||||
Merge t@(In (a1, a2) syntax) -> diffAlgebra t (Merged (MergedTerm (constructorName syntax) (ann a1) (ann a2)))
|
||||
Patch (Delete t1@(In a1 syntax)) -> diffAlgebra t1 (Deleted (DeletedTerm (constructorName syntax) (ann a1)))
|
||||
Patch (Insert t2@(In a2 syntax)) -> diffAlgebra t2 (Inserted (InsertedTerm (constructorName syntax) (ann a2)))
|
||||
Patch (Replace t1@(In a1 syntax1) t2@(In a2 syntax2)) -> do
|
||||
i <- fresh
|
||||
parent <- ask
|
||||
let a = DeletedTerm (constructorName syntax1) (ann a1)
|
||||
let b = InsertedTerm (constructorName syntax2) (ann a2)
|
||||
let replace = vertex (DiffVertex i (Replaced (ReplacedTerm a b)))
|
||||
graph <- local (const replace) (overlay <$> diffAlgebra t1 (Deleted a) <*> diffAlgebra t2 (Inserted b))
|
||||
pure (parent `connect` replace `overlay` graph)
|
||||
where
|
||||
ann a = TermAnnotation (getField a) (getField a)
|
||||
diffAlgebra ::
|
||||
( Foldable f
|
||||
, Member Fresh effs
|
||||
, Member (Reader (Graph DiffVertex)) effs
|
||||
) => f (Eff effs (Graph DiffVertex)) -> DiffVertexTerm -> Eff effs (Graph DiffVertex)
|
||||
diffAlgebra syntax a = do
|
||||
i <- fresh
|
||||
parent <- ask
|
||||
let root = vertex (DiffVertex i a)
|
||||
subGraph <- foldl' (\acc x -> overlay <$> acc <*> local (const root) x) (pure mempty) syntax
|
||||
pure (parent `connect` root `overlay` subGraph)
|
||||
|
@ -2,7 +2,9 @@
|
||||
module Rendering.JSON
|
||||
( JSON(..)
|
||||
, renderJSONDiff
|
||||
, renderJSONAdjDiff
|
||||
, renderJSONTerm
|
||||
, renderJSONAdjTerm
|
||||
, renderJSONAST
|
||||
, renderSymbolTerms
|
||||
, renderJSONError
|
||||
@ -37,6 +39,17 @@ instance ToJSON a => ToJSON (JSONDiff a) where
|
||||
toJSON JSONDiff{..} = object [ "diff" .= jsonDiff, "stat" .= jsonDiffStat ]
|
||||
toEncoding JSONDiff{..} = pairs ("diff" .= jsonDiff <> "stat" .= jsonDiffStat)
|
||||
|
||||
-- | Render a diff to a value representing its JSON.
|
||||
renderJSONAdjDiff :: ToJSON a => BlobPair -> a -> JSON "diffs" SomeJSON
|
||||
renderJSONAdjDiff blobs diff = JSON [ SomeJSON (JSONAdjDiff (JSONStat blobs) diff) ]
|
||||
|
||||
data JSONAdjDiff a = JSONAdjDiff { jsonAdjDiffStat :: JSONStat, jsonAdjDiff :: a }
|
||||
deriving (Eq, Show)
|
||||
|
||||
instance ToJSON a => ToJSON (JSONAdjDiff a) where
|
||||
toJSON JSONAdjDiff{..} = object [ "graph" .= jsonAdjDiff, "stat" .= jsonAdjDiffStat ]
|
||||
toEncoding JSONAdjDiff{..} = pairs ("graph" .= jsonAdjDiff <> "stat" .= jsonAdjDiffStat)
|
||||
|
||||
newtype JSONStat = JSONStat { jsonStatBlobs :: BlobPair }
|
||||
deriving (Eq, Show)
|
||||
|
||||
@ -55,6 +68,15 @@ instance ToJSON a => ToJSON (JSONTerm a) where
|
||||
toJSON JSONTerm{..} = object ("tree" .= jsonTerm : toJSONFields jsonTermBlob)
|
||||
toEncoding JSONTerm{..} = pairs (fold ("tree" .= jsonTerm : toJSONFields jsonTermBlob))
|
||||
|
||||
renderJSONAdjTerm :: ToJSON a => Blob -> a -> JSON "trees" SomeJSON
|
||||
renderJSONAdjTerm blob content = JSON [ SomeJSON (JSONAdjTerm blob content) ]
|
||||
|
||||
data JSONAdjTerm a = JSONAdjTerm { jsonAdjTermBlob :: Blob, jsonAdjTerm :: a }
|
||||
deriving (Eq, Show)
|
||||
|
||||
instance ToJSON a => ToJSON (JSONAdjTerm a) where
|
||||
toJSON JSONAdjTerm{..} = object ("graph" .= jsonAdjTerm : toJSONFields jsonAdjTermBlob)
|
||||
toEncoding JSONAdjTerm{..} = pairs (fold ("graph" .= jsonAdjTerm : toJSONFields jsonAdjTermBlob))
|
||||
|
||||
renderJSONAST :: ToJSON a => Blob -> a -> JSON "trees" SomeJSON
|
||||
renderJSONAST blob content = JSON [ SomeJSON (JSONAST blob content) ]
|
||||
|
@ -3,7 +3,9 @@ module Rendering.Renderer
|
||||
( DiffRenderer(..)
|
||||
, TermRenderer(..)
|
||||
, renderJSONDiff
|
||||
, renderJSONAdjDiff
|
||||
, renderJSONTerm
|
||||
, renderJSONAdjTerm
|
||||
, renderJSONAST
|
||||
, renderToCDiff
|
||||
, renderRPCToCDiff
|
||||
@ -21,6 +23,7 @@ module Rendering.Renderer
|
||||
|
||||
import Data.ByteString.Builder
|
||||
import Data.Graph
|
||||
import Data.Graph.DiffVertex
|
||||
import Rendering.Graph as R
|
||||
import Rendering.JSON as R
|
||||
import Rendering.Symbol as R
|
||||
@ -32,10 +35,12 @@ data DiffRenderer output where
|
||||
ToCDiffRenderer :: DiffRenderer Summaries
|
||||
-- | Render to JSON with the format documented in docs/json-format.md
|
||||
JSONDiffRenderer :: DiffRenderer (JSON "diffs" SomeJSON)
|
||||
-- | Render to JSON as an adjacency list.
|
||||
JSONGraphDiffRenderer :: DiffRenderer (JSON "diffs" SomeJSON)
|
||||
-- | Render to a 'ByteString' formatted as nested s-expressions with patches indicated.
|
||||
SExpressionDiffRenderer :: DiffRenderer Builder
|
||||
-- | Render to a 'ByteString' formatted as a DOT description of the diff.
|
||||
DOTDiffRenderer :: DiffRenderer (Graph (TaggedVertex DiffTag))
|
||||
DOTDiffRenderer :: DiffRenderer (Graph DiffVertex)
|
||||
-- | Render to a 'ByteString' formatted using the 'Show' instance.
|
||||
ShowDiffRenderer :: DiffRenderer Builder
|
||||
|
||||
@ -46,12 +51,14 @@ deriving instance Show (DiffRenderer output)
|
||||
data TermRenderer output where
|
||||
-- | Render to JSON with the format documented in docs/json-format.md under “Term.”
|
||||
JSONTermRenderer :: TermRenderer (JSON "trees" SomeJSON)
|
||||
-- | Render to JSON as an adjacency list represenation.
|
||||
JSONGraphTermRenderer :: TermRenderer (JSON "trees" SomeJSON)
|
||||
-- | Render to a 'ByteString' formatted as nested s-expressions.
|
||||
SExpressionTermRenderer :: TermRenderer Builder
|
||||
-- | Render to a list of symbols.
|
||||
SymbolsTermRenderer :: SymbolFields -> TermRenderer (JSON "files" SomeJSON)
|
||||
-- | Render to a 'ByteString' formatted as a DOT description of the term.
|
||||
DOTTermRenderer :: TermRenderer (Graph (TaggedVertex ()))
|
||||
DOTTermRenderer :: TermRenderer (Graph TermVertex)
|
||||
-- | Render to a 'ByteString' formatted using the 'Show' instance.
|
||||
ShowTermRenderer :: TermRenderer Builder
|
||||
|
||||
|
@ -61,7 +61,7 @@ compile :: State -> Tokenizer a -> Machine.Plan k Token (State, a)
|
||||
compile p = \case
|
||||
Pure a -> pure (p, a)
|
||||
Bind a f -> compile p a >>= (\(new, v) -> compile new (f v))
|
||||
Tell t -> Machine.yield t *> pure (p, ())
|
||||
Tell t -> Machine.yield t $> (p, ())
|
||||
Get -> pure (p, p)
|
||||
Put p' -> pure (p', ())
|
||||
|
||||
|
@ -60,6 +60,7 @@ diffCommand = command "diff" (info diffArgumentsParser (progDesc "Compute change
|
||||
diffArgumentsParser = do
|
||||
renderer <- flag (Diff.runDiff SExpressionDiffRenderer) (Diff.runDiff SExpressionDiffRenderer) (long "sexpression" <> help "Output s-expression diff tree (default)")
|
||||
<|> flag' (Diff.runDiff JSONDiffRenderer) (long "json" <> help "Output JSON diff trees")
|
||||
<|> flag' (Diff.runDiff JSONGraphDiffRenderer) (long "json-graph" <> help "Output JSON diff trees")
|
||||
<|> flag' (Diff.runDiff ToCDiffRenderer) (long "toc" <> help "Output JSON table of contents diff summary")
|
||||
<|> flag' (Diff.runDiff DOTDiffRenderer) (long "dot" <> help "Output the diff as a DOT graph")
|
||||
<|> flag' (Diff.runDiff ShowDiffRenderer) (long "show" <> help "Output using the Show instance (debug only, format subject to change without notice)")
|
||||
@ -72,6 +73,7 @@ parseCommand = command "parse" (info parseArgumentsParser (progDesc "Generate pa
|
||||
parseArgumentsParser = do
|
||||
renderer <- flag (Parse.runParse SExpressionTermRenderer) (Parse.runParse SExpressionTermRenderer) (long "sexpression" <> help "Output s-expression parse trees (default)")
|
||||
<|> flag' (Parse.runParse JSONTermRenderer) (long "json" <> help "Output JSON parse trees")
|
||||
<|> flag' (Parse.runParse JSONGraphTermRenderer) (long "json-graph" <> help "Output JSON adjacency list")
|
||||
<|> flag' (Parse.runParse . SymbolsTermRenderer) (long "symbols" <> help "Output JSON symbol list")
|
||||
<*> (option symbolFieldsReader ( long "fields"
|
||||
<> help "Comma delimited list of specific fields to return (symbols output only)."
|
||||
|
@ -1,10 +1,6 @@
|
||||
{-# LANGUAGE ConstraintKinds, GADTs, RankNTypes, ScopedTypeVariables #-}
|
||||
module Semantic.Diff
|
||||
( runDiff
|
||||
, runPythonDiff
|
||||
, runRubyDiff
|
||||
, runTypeScriptDiff
|
||||
, runJSONDiff
|
||||
, diffBlobTOCPairs
|
||||
) where
|
||||
|
||||
@ -16,6 +12,7 @@ import Data.Diff
|
||||
import Data.JSON.Fields
|
||||
import Data.Record
|
||||
import Data.Term
|
||||
import Data.Graph.DiffVertex
|
||||
import Diffing.Algorithm (Diffable)
|
||||
import Parsing.Parser
|
||||
import Prologue hiding (MonadError(..))
|
||||
@ -25,62 +22,19 @@ import Semantic.IO (noLanguageForBlob)
|
||||
import Semantic.Telemetry as Stat
|
||||
import Semantic.Task as Task
|
||||
import Serializing.Format
|
||||
import qualified Language.TypeScript.Assignment as TypeScript
|
||||
import qualified Language.Ruby.Assignment as Ruby
|
||||
import qualified Language.JSON.Assignment as JSON
|
||||
import qualified Language.Python.Assignment as Python
|
||||
import Rendering.JSON (SomeJSON (..))
|
||||
import qualified Rendering.JSON as JSON
|
||||
|
||||
runDiff :: (Member Distribute effs, Member (Exc SomeException) effs, Member (Lift IO) effs, Member Task effs, Member Telemetry effs) => DiffRenderer output -> [BlobPair] -> Eff effs Builder
|
||||
runDiff ToCDiffRenderer = withParsedBlobPairs (decorate . declarationAlgebra) (render . renderToCDiff) >=> serialize JSON
|
||||
runDiff JSONDiffRenderer = withParsedBlobPairs (const pure) (render . renderJSONDiff) >=> serialize JSON
|
||||
runDiff JSONGraphDiffRenderer = withParsedBlobPairs (const pure) (render . renderAdjGraph) >=> serialize JSON
|
||||
where renderAdjGraph :: (Recursive t, ToTreeGraph DiffVertex (Base t)) => BlobPair -> t -> JSON.JSON "diffs" SomeJSON
|
||||
renderAdjGraph blob diff = renderJSONAdjDiff blob (renderTreeGraph diff)
|
||||
runDiff SExpressionDiffRenderer = withParsedBlobPairs (const pure) (const (serialize (SExpression ByConstructorName)))
|
||||
runDiff ShowDiffRenderer = withParsedBlobPairs (const pure) (const (serialize Show))
|
||||
runDiff DOTDiffRenderer = withParsedBlobPairs (const pure) (const (render renderTreeGraph)) >=> serialize (DOT (diffStyle "diffs"))
|
||||
|
||||
runRubyDiff :: (Member Telemetry effs, Member (Lift IO) effs, Member Distribute effs, Member Task effs) => [BlobPair] -> Eff effs [Diff (Sum Ruby.Syntax) () ()]
|
||||
runRubyDiff = flip distributeFor (\ (blobs :: BlobPair) -> do
|
||||
terms <- distributeFor blobs (parse rubyParser)
|
||||
diffs <- diffTerms blobs terms
|
||||
pure (bimap (const ()) (const ()) diffs))
|
||||
where
|
||||
diffTerms blobs terms = time "diff" languageTag $ do
|
||||
diff <- diff (runJoin terms)
|
||||
diff <$ writeStat (Stat.count "diff.nodes" (bilength diff) languageTag)
|
||||
where languageTag = languageTagForBlobPair blobs
|
||||
|
||||
runTypeScriptDiff :: (Member Telemetry effs, Member (Lift IO) effs, Member Distribute effs, Member Task effs) => [BlobPair] -> Eff effs [Diff (Sum TypeScript.Syntax) () ()]
|
||||
runTypeScriptDiff = flip distributeFor (\ (blobs :: BlobPair) -> do
|
||||
terms <- distributeFor blobs (parse typescriptParser)
|
||||
diffs <- diffTerms blobs terms
|
||||
pure (bimap (const ()) (const ()) diffs))
|
||||
where
|
||||
diffTerms blobs terms = time "diff" languageTag $ do
|
||||
diff <- diff (runJoin terms)
|
||||
diff <$ writeStat (Stat.count "diff.nodes" (bilength diff) languageTag)
|
||||
where languageTag = languageTagForBlobPair blobs
|
||||
|
||||
runPythonDiff :: (Member Telemetry effs, Member (Lift IO) effs, Member Distribute effs, Member Task effs) => [BlobPair] -> Eff effs [Diff (Sum Python.Syntax) () ()]
|
||||
runPythonDiff = flip distributeFor (\ (blobs :: BlobPair) -> do
|
||||
terms <- distributeFor blobs (parse pythonParser)
|
||||
diffs <- diffTerms blobs terms
|
||||
pure (bimap (const ()) (const ()) diffs))
|
||||
where
|
||||
diffTerms blobs terms = time "diff" languageTag $ do
|
||||
diff <- diff (runJoin terms)
|
||||
diff <$ writeStat (Stat.count "diff.nodes" (bilength diff) languageTag)
|
||||
where languageTag = languageTagForBlobPair blobs
|
||||
|
||||
runJSONDiff :: (Member Telemetry effs, Member (Lift IO) effs, Member Distribute effs, Member Task effs) => [BlobPair] -> Eff effs [Diff (Sum JSON.Syntax) () ()]
|
||||
runJSONDiff = flip distributeFor (\ (blobs :: BlobPair) -> do
|
||||
terms <- distributeFor blobs (parse jsonParser)
|
||||
diffs <- diffTerms blobs terms
|
||||
pure (bimap (const ()) (const ()) diffs))
|
||||
where
|
||||
diffTerms blobs terms = time "diff" languageTag $ do
|
||||
diff <- diff (runJoin terms)
|
||||
diff <$ writeStat (Stat.count "diff.nodes" (bilength diff) languageTag)
|
||||
where languageTag = languageTagForBlobPair blobs
|
||||
|
||||
data SomeTermPair typeclasses ann where
|
||||
SomeTermPair :: ApplyAll typeclasses syntax => Join These (Term syntax ann) -> SomeTermPair typeclasses ann
|
||||
|
||||
|
@ -7,7 +7,7 @@ module Semantic.Graph
|
||||
, runImportGraphToModuleInfos
|
||||
, GraphType(..)
|
||||
, Graph
|
||||
, Vertex
|
||||
, ControlFlowVertex
|
||||
, ConcreteEff(..)
|
||||
, style
|
||||
, parsePackage
|
||||
@ -47,7 +47,7 @@ import Data.Abstract.Value.Type as Type
|
||||
import Data.Blob
|
||||
import Data.Coerce
|
||||
import Data.Graph
|
||||
import Data.Graph.Vertex (VertexDeclarationStrategy, VertexDeclarationWithStrategy)
|
||||
import Data.Graph.ControlFlowVertex (VertexDeclarationStrategy, VertexDeclarationWithStrategy)
|
||||
import Data.Language as Language
|
||||
import Data.List (isPrefixOf, isSuffixOf)
|
||||
import Data.Project
|
||||
@ -70,7 +70,7 @@ runGraph :: forall effs. (Member Distribute effs, Member (Exc SomeException) eff
|
||||
=> GraphType
|
||||
-> Bool
|
||||
-> Project
|
||||
-> Eff effs (Graph Vertex)
|
||||
-> Eff effs (Graph ControlFlowVertex)
|
||||
runGraph ImportGraph _ project
|
||||
| SomeAnalysisParser parser (lang' :: Proxy lang) <- someAnalysisParser (Proxy :: Proxy AnalysisClasses) (projectLanguage project) = do
|
||||
let parse = if projectLanguage project == Language.Python then parsePythonPackage parser else fmap (fmap snd) . parsePackage parser
|
||||
@ -103,7 +103,7 @@ runCallGraph :: ( HasField fields Span
|
||||
-> Bool
|
||||
-> [Module term]
|
||||
-> Package term
|
||||
-> Eff effs (Graph Vertex)
|
||||
-> Eff effs (Graph ControlFlowVertex)
|
||||
runCallGraph lang includePackages modules package = do
|
||||
let analyzeTerm = withTermSpans . graphingTerms . cachingTerms
|
||||
analyzeModule = (if includePackages then graphingPackages else id) . convergingModules . graphingModules
|
||||
@ -122,7 +122,7 @@ runCallGraph lang includePackages modules package = do
|
||||
. resumingAddressError
|
||||
. runReader (packageInfo package)
|
||||
. runReader (lowerBound @Span)
|
||||
. runReader (lowerBound @Vertex)
|
||||
. runReader (lowerBound @ControlFlowVertex)
|
||||
. providingLiveSet
|
||||
. runReader (lowerBound @(ModuleTable (NonEmpty (Module (ModuleResult (Hole (Maybe Name) (Located Monovariant)))))))
|
||||
. raiseHandler (runModules (ModuleTable.modulePaths (packageModules package)))
|
||||
@ -142,7 +142,7 @@ runImportGraphToModuleInfos :: ( Declarations term
|
||||
)
|
||||
=> Proxy lang
|
||||
-> Package term
|
||||
-> Eff effs (Graph Vertex)
|
||||
-> Eff effs (Graph ControlFlowVertex)
|
||||
runImportGraphToModuleInfos lang (package :: Package term) = runImportGraph lang package allModuleInfos
|
||||
where allModuleInfos info = maybe (vertex (unknownModuleVertex info)) (foldMap (vertex . moduleVertex . moduleInfo)) (ModuleTable.lookup (modulePath info) (packageModules package))
|
||||
|
||||
|
@ -1,11 +1,5 @@
|
||||
{-# LANGUAGE GADTs, RankNTypes #-}
|
||||
module Semantic.Parse
|
||||
( runParse
|
||||
, runPythonParse
|
||||
, runRubyParse
|
||||
, runTypeScriptParse
|
||||
, runJSONParse
|
||||
) where
|
||||
module Semantic.Parse ( runParse ) where
|
||||
|
||||
import Analysis.ConstructorName (ConstructorName)
|
||||
import Analysis.Declaration (HasDeclaration, declarationAlgebra)
|
||||
@ -13,6 +7,7 @@ import Analysis.PackageDef (HasPackageDef)
|
||||
import Control.Monad.Effect.Exception
|
||||
import Data.AST
|
||||
import Data.Blob
|
||||
import Data.Graph.TermVertex
|
||||
import Data.JSON.Fields
|
||||
import Data.Quieterm
|
||||
import Data.Record
|
||||
@ -20,45 +15,23 @@ import Data.Term
|
||||
import Parsing.Parser
|
||||
import Prologue hiding (MonadError (..))
|
||||
import Rendering.Graph
|
||||
import Rendering.JSON (SomeJSON (..))
|
||||
import qualified Rendering.JSON as JSON
|
||||
import Rendering.Renderer
|
||||
import Semantic.IO (noLanguageForBlob)
|
||||
import Semantic.Task
|
||||
import Serializing.Format
|
||||
import qualified Language.Ruby.Assignment as Ruby
|
||||
import qualified Language.TypeScript.Assignment as TypeScript
|
||||
import qualified Language.JSON.Assignment as JSON
|
||||
import qualified Language.Python.Assignment as Python
|
||||
|
||||
runParse :: (Member Distribute effs, Member (Exc SomeException) effs, Member Task effs) => TermRenderer output -> [Blob] -> Eff effs Builder
|
||||
runParse JSONTermRenderer = withParsedBlobs renderJSONError (render . renderJSONTerm) >=> serialize JSON
|
||||
runParse JSONGraphTermRenderer = withParsedBlobs renderJSONError (render . renderAdjGraph) >=> serialize JSON
|
||||
where renderAdjGraph :: (Recursive t, ToTreeGraph TermVertex (Base t)) => Blob -> t -> JSON.JSON "trees" SomeJSON
|
||||
renderAdjGraph blob term = renderJSONAdjTerm blob (renderTreeGraph term)
|
||||
runParse SExpressionTermRenderer = withParsedBlobs (\_ _ -> mempty) (const (serialize (SExpression ByConstructorName)))
|
||||
runParse ShowTermRenderer = withParsedBlobs (\_ _ -> mempty) (const (serialize Show . quieterm))
|
||||
runParse (SymbolsTermRenderer fields) = withParsedBlobs (\_ _ -> mempty) (\ blob -> decorate (declarationAlgebra blob) >=> render (renderSymbolTerms . renderToSymbols fields blob)) >=> serialize JSON
|
||||
runParse DOTTermRenderer = withParsedBlobs (\_ _ -> mempty) (const (render renderTreeGraph)) >=> serialize (DOT (termStyle "terms"))
|
||||
|
||||
-- NB: Our gRPC interface requires concrete 'Term's for each language to know
|
||||
-- how to encode messages, so we have dedicated functions for parsing each
|
||||
-- supported language.
|
||||
runRubyParse :: (Member Distribute effs, Member (Exc SomeException) effs, Member Task effs)
|
||||
=> [Blob] -> Eff effs [Either SomeException (Term (Sum Ruby.Syntax) ())]
|
||||
runRubyParse = flip distributeFor $ \blob ->
|
||||
(Right . (() <$) <$> parse rubyParser blob) `catchError` (pure . Left)
|
||||
|
||||
runTypeScriptParse :: (Member Distribute effs, Member (Exc SomeException) effs, Member Task effs)
|
||||
=> [Blob] -> Eff effs [Either SomeException (Term (Sum TypeScript.Syntax) ())]
|
||||
runTypeScriptParse = flip distributeFor $ \blob -> do
|
||||
(Right . (() <$) <$> parse typescriptParser blob) `catchError` (pure . Left)
|
||||
|
||||
runPythonParse :: (Member Distribute effs, Member (Exc SomeException) effs, Member Task effs)
|
||||
=> [Blob] -> Eff effs [Either SomeException (Term (Sum Python.Syntax) ())]
|
||||
runPythonParse = flip distributeFor $ \blob -> do
|
||||
(Right . (() <$) <$> parse pythonParser blob) `catchError` (pure . Left)
|
||||
|
||||
runJSONParse :: (Member Distribute effs, Member (Exc SomeException) effs, Member Task effs)
|
||||
=> [Blob] -> Eff effs [Either SomeException (Term (Sum JSON.Syntax) ())]
|
||||
runJSONParse = flip distributeFor $ \blob -> do
|
||||
(Right . (() <$) <$> parse jsonParser blob) `catchError` (pure . Left)
|
||||
|
||||
withParsedBlobs ::
|
||||
( Member Distribute effs
|
||||
, Member (Exc SomeException) effs
|
||||
|
@ -11,7 +11,7 @@ import Data.List (uncons)
|
||||
|
||||
import Data.Abstract.Module
|
||||
import "semantic" Data.Graph (Graph (..), topologicalSort)
|
||||
import Data.Graph.Vertex
|
||||
import Data.Graph.ControlFlowVertex
|
||||
import Data.Span
|
||||
import qualified Data.Language as Language
|
||||
import Semantic.Config (defaultOptions)
|
||||
|
@ -43,7 +43,10 @@ spec = parallel $ do
|
||||
\sp -> shouldRoundtrip @BlobPair sp
|
||||
describe "spans" $
|
||||
prop "roundtrips" $
|
||||
\sp -> shouldRoundtrip @Span sp
|
||||
\x -> shouldRoundtrip @Span x
|
||||
describe "pos" $
|
||||
prop "roundtrips" $
|
||||
\x -> shouldRoundtrip @Pos x
|
||||
|
||||
describe "nulls" $
|
||||
prop "roundtrips" $
|
||||
|
@ -11,7 +11,7 @@
|
||||
(Statements
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{+(Integer)+}
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) })))))
|
||||
{-(Integer)-})))))
|
||||
|
@ -11,7 +11,7 @@
|
||||
(Statements
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{+(Integer)+}
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) })))))
|
||||
{-(Integer)-})))))
|
||||
|
@ -33,24 +33,16 @@
|
||||
{+(Plus
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Times
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})
|
||||
->(LShift
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+}) })
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Plus
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})
|
||||
->(RShift
|
||||
{+(LShift
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+}) })
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(RShift
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(DividedBy
|
||||
@ -84,6 +76,16 @@
|
||||
{+(KeyValue
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+})+})+})+})+}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Times
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Plus
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(LShift
|
||||
|
@ -4,59 +4,38 @@
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
{+(Type
|
||||
{+(Identifier)+}
|
||||
{+(BidirectionalChannel
|
||||
{+(ReceiveChannel
|
||||
{+(Identifier)+})+})+})+}
|
||||
{+(Type
|
||||
{+(Identifier)+}
|
||||
{+(SendChannel
|
||||
{+(SendChannel
|
||||
{+(Constructor
|
||||
{+(Empty)+}
|
||||
{+(Statements)+})+})+})+})+}
|
||||
{+(Type
|
||||
{+(Identifier)+}
|
||||
{+(SendChannel
|
||||
{+(ReceiveChannel
|
||||
{+(Identifier)+})+})+})+}
|
||||
{+(Type
|
||||
{+(Identifier)+}
|
||||
{+(ReceiveChannel
|
||||
{+(ReceiveChannel
|
||||
{+(Identifier)+})+})+})+}
|
||||
{+(Type
|
||||
{+(Identifier)+}
|
||||
{+(BidirectionalChannel
|
||||
{+(Parenthesized
|
||||
{+(ReceiveChannel
|
||||
{+(Identifier)+})+})+})+})+}
|
||||
{-(Type
|
||||
{-(Identifier)-}
|
||||
{-(BidirectionalChannel
|
||||
{-(ReceiveChannel
|
||||
{-(Identifier)-})-})-})-}
|
||||
{-(Type
|
||||
{-(Identifier)-}
|
||||
{-(SendChannel
|
||||
{-(SendChannel
|
||||
{-(Constructor
|
||||
{-(Empty)-}
|
||||
{-(Statements)-})-})-})-})-}
|
||||
{-(Type
|
||||
{-(Identifier)-}
|
||||
{-(SendChannel
|
||||
{-(ReceiveChannel
|
||||
{-(Identifier)-})-})-})-}
|
||||
{-(Type
|
||||
{-(Identifier)-}
|
||||
{-(ReceiveChannel
|
||||
{-(ReceiveChannel
|
||||
{-(Identifier)-})-})-})-}
|
||||
{-(Type
|
||||
{-(Identifier)-}
|
||||
{-(BidirectionalChannel
|
||||
{-(Parenthesized
|
||||
{-(ReceiveChannel
|
||||
{-(Identifier)-})-})-})-})-})))
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(BidirectionalChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(SendChannel
|
||||
(SendChannel
|
||||
(Constructor
|
||||
(Empty)
|
||||
(Statements)))))
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(SendChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Type
|
||||
(Identifier)
|
||||
(ReceiveChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Type
|
||||
(Identifier)
|
||||
(BidirectionalChannel
|
||||
(Parenthesized
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))))))
|
||||
|
@ -4,59 +4,38 @@
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
{+(Type
|
||||
{+(Identifier)+}
|
||||
{+(BidirectionalChannel
|
||||
{+(ReceiveChannel
|
||||
{+(Identifier)+})+})+})+}
|
||||
{+(Type
|
||||
{+(Identifier)+}
|
||||
{+(SendChannel
|
||||
{+(SendChannel
|
||||
{+(Constructor
|
||||
{+(Empty)+}
|
||||
{+(Statements)+})+})+})+})+}
|
||||
{+(Type
|
||||
{+(Identifier)+}
|
||||
{+(SendChannel
|
||||
{+(ReceiveChannel
|
||||
{+(Identifier)+})+})+})+}
|
||||
{+(Type
|
||||
{+(Identifier)+}
|
||||
{+(ReceiveChannel
|
||||
{+(ReceiveChannel
|
||||
{+(Identifier)+})+})+})+}
|
||||
{+(Type
|
||||
{+(Identifier)+}
|
||||
{+(BidirectionalChannel
|
||||
{+(Parenthesized
|
||||
{+(ReceiveChannel
|
||||
{+(Identifier)+})+})+})+})+}
|
||||
{-(Type
|
||||
{-(Identifier)-}
|
||||
{-(BidirectionalChannel
|
||||
{-(ReceiveChannel
|
||||
{-(Identifier)-})-})-})-}
|
||||
{-(Type
|
||||
{-(Identifier)-}
|
||||
{-(SendChannel
|
||||
{-(SendChannel
|
||||
{-(Constructor
|
||||
{-(Empty)-}
|
||||
{-(Statements)-})-})-})-})-}
|
||||
{-(Type
|
||||
{-(Identifier)-}
|
||||
{-(SendChannel
|
||||
{-(ReceiveChannel
|
||||
{-(Identifier)-})-})-})-}
|
||||
{-(Type
|
||||
{-(Identifier)-}
|
||||
{-(ReceiveChannel
|
||||
{-(ReceiveChannel
|
||||
{-(Identifier)-})-})-})-}
|
||||
{-(Type
|
||||
{-(Identifier)-}
|
||||
{-(BidirectionalChannel
|
||||
{-(Parenthesized
|
||||
{-(ReceiveChannel
|
||||
{-(Identifier)-})-})-})-})-})))
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(BidirectionalChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(SendChannel
|
||||
(SendChannel
|
||||
(Constructor
|
||||
(Empty)
|
||||
(Statements)))))
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(SendChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Type
|
||||
(Identifier)
|
||||
(ReceiveChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Type
|
||||
(Identifier)
|
||||
(BidirectionalChannel
|
||||
(Parenthesized
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))))))
|
||||
|
@ -4,21 +4,15 @@
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Statements)+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Statements)+})+}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Statements)-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Statements)-})-})))
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier))
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Statements))
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Statements)))))
|
||||
|
@ -4,20 +4,15 @@
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Statements)+})+}
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier))
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Statements) })
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Statements)-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Statements)-})-})))
|
||||
->(Identifier) }
|
||||
(Statements))
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Statements)))))
|
||||
|
@ -6,10 +6,10 @@
|
||||
{+(Identifier)+})+}
|
||||
{+(Import
|
||||
{+(TextElement)+})+}
|
||||
{ (QualifiedImport
|
||||
{-(Identifier)-})
|
||||
->(QualifiedImport
|
||||
{+(Identifier)+}) }
|
||||
{+(QualifiedImport
|
||||
{+(Identifier)+})+}
|
||||
{-(QualifiedImport
|
||||
{-(Identifier)-})-}
|
||||
{-(Import
|
||||
{-(TextElement)-})-}
|
||||
{-(QualifiedImport
|
||||
|
@ -4,36 +4,49 @@
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Slice
|
||||
(Identifier)
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Empty)
|
||||
(Empty))
|
||||
(Slice
|
||||
(Identifier)
|
||||
(Empty)
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Empty))
|
||||
(Slice
|
||||
(Identifier)
|
||||
{ (Empty)
|
||||
->(Integer) }
|
||||
{ (Empty)
|
||||
->(Integer) }
|
||||
(Empty))
|
||||
(Slice
|
||||
(Identifier)
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) })
|
||||
{+(Slice
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+}
|
||||
{+(Empty)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Slice
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+}
|
||||
{+(Integer)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Slice
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+}
|
||||
{+(Integer)+}
|
||||
{+(Empty)+})+}
|
||||
(Slice
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Integer)
|
||||
(Integer)
|
||||
(Empty)))))
|
||||
{ (Empty)
|
||||
->(Integer) }
|
||||
{ (Empty)
|
||||
->(Integer) })
|
||||
(Slice
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Empty)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Empty))
|
||||
{-(Slice
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-}
|
||||
{-(Empty)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Slice
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-}
|
||||
{-(Integer)-}
|
||||
{-(Integer)-})-}
|
||||
{-(Slice
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-}
|
||||
{-(Integer)-}
|
||||
{-(Empty)-})-})))
|
||||
|
@ -4,36 +4,50 @@
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Slice
|
||||
(Identifier)
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Empty)
|
||||
(Empty))
|
||||
(Slice
|
||||
(Identifier)
|
||||
(Empty)
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Empty))
|
||||
(Slice
|
||||
(Identifier)
|
||||
{ (Integer)
|
||||
->(Empty) }
|
||||
{ (Integer)
|
||||
->(Empty) }
|
||||
(Empty))
|
||||
(Slice
|
||||
(Identifier)
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) })
|
||||
{+(Slice
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+}
|
||||
{+(Empty)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Slice
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+}
|
||||
{+(Integer)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Slice
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+}
|
||||
{+(Empty)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Slice
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+}
|
||||
{+(Integer)+}
|
||||
{+(Integer)+})+}
|
||||
(Slice
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Integer)
|
||||
(Integer)
|
||||
(Empty)))))
|
||||
{ (Empty)
|
||||
->(Integer) }
|
||||
(Empty))
|
||||
{-(Slice
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-}
|
||||
{-(Integer)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Slice
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-}
|
||||
{-(Integer)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Slice
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-}
|
||||
{-(Integer)-}
|
||||
{-(Integer)-})-}
|
||||
{-(Slice
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-}
|
||||
{-(Integer)-}
|
||||
{-(Empty)-})-})))
|
||||
|
@ -70,19 +70,23 @@
|
||||
{-(Identifier)-})
|
||||
->(MemberAccess
|
||||
{+(Identifier)+}) })
|
||||
(Call
|
||||
{ (MemberAccess
|
||||
{-(Identifier)-})
|
||||
->(MemberAccess
|
||||
{+(Identifier)+}) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Empty))
|
||||
(Call
|
||||
{ (MemberAccess
|
||||
{-(Identifier)-})
|
||||
->(MemberAccess
|
||||
{+(Identifier)+}) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Empty)))))
|
||||
{+(Call
|
||||
{+(MemberAccess
|
||||
{+(Identifier)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Call
|
||||
{+(MemberAccess
|
||||
{+(Identifier)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{-(Call
|
||||
{-(MemberAccess
|
||||
{-(Identifier)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Call
|
||||
{-(MemberAccess
|
||||
{-(Identifier)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})))
|
||||
|
@ -70,19 +70,23 @@
|
||||
{-(Identifier)-})
|
||||
->(MemberAccess
|
||||
{+(Identifier)+}) })
|
||||
(Call
|
||||
{ (MemberAccess
|
||||
{-(Identifier)-})
|
||||
->(MemberAccess
|
||||
{+(Identifier)+}) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Empty))
|
||||
(Call
|
||||
{ (MemberAccess
|
||||
{-(Identifier)-})
|
||||
->(MemberAccess
|
||||
{+(Identifier)+}) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Empty)))))
|
||||
{+(Call
|
||||
{+(MemberAccess
|
||||
{+(Identifier)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Call
|
||||
{+(MemberAccess
|
||||
{+(Identifier)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{-(Call
|
||||
{-(MemberAccess
|
||||
{-(Identifier)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Call
|
||||
{-(MemberAccess
|
||||
{-(Identifier)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})))
|
||||
|
@ -6,25 +6,35 @@
|
||||
(Statements
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Negate
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Not
|
||||
(ReceiveOperator
|
||||
{ (Identifier)
|
||||
->(Identifier) }))
|
||||
(Pointer
|
||||
(Call
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Complement
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Reference
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(ReceiveOperator
|
||||
{ (Identifier)
|
||||
->(Identifier) }))))
|
||||
{+(Negate
|
||||
{+(Identifier)+})+}
|
||||
{+(Not
|
||||
{+(ReceiveOperator
|
||||
{+(Identifier)+})+})+}
|
||||
{+(Pointer
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Statements)+}
|
||||
{+(Empty)+})+})+}
|
||||
{+(Complement
|
||||
{+(Identifier)+})+}
|
||||
{+(Reference
|
||||
{+(Identifier)+})+}
|
||||
{+(ReceiveOperator
|
||||
{+(Identifier)+})+}
|
||||
{-(Negate
|
||||
{-(Identifier)-})-}
|
||||
{-(Not
|
||||
{-(ReceiveOperator
|
||||
{-(Identifier)-})-})-}
|
||||
{-(Pointer
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Statements)-}
|
||||
{-(Empty)-})-})-}
|
||||
{-(Complement
|
||||
{-(Identifier)-})-}
|
||||
{-(Reference
|
||||
{-(Identifier)-})-}
|
||||
{-(ReceiveOperator
|
||||
{-(Identifier)-})-})))
|
||||
|
@ -6,25 +6,35 @@
|
||||
(Statements
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Negate
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Not
|
||||
(ReceiveOperator
|
||||
{ (Identifier)
|
||||
->(Identifier) }))
|
||||
(Pointer
|
||||
(Call
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Complement
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Reference
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(ReceiveOperator
|
||||
{ (Identifier)
|
||||
->(Identifier) }))))
|
||||
{+(Negate
|
||||
{+(Identifier)+})+}
|
||||
{+(Not
|
||||
{+(ReceiveOperator
|
||||
{+(Identifier)+})+})+}
|
||||
{+(Pointer
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Statements)+}
|
||||
{+(Empty)+})+})+}
|
||||
{+(Complement
|
||||
{+(Identifier)+})+}
|
||||
{+(Reference
|
||||
{+(Identifier)+})+}
|
||||
{+(ReceiveOperator
|
||||
{+(Identifier)+})+}
|
||||
{-(Negate
|
||||
{-(Identifier)-})-}
|
||||
{-(Not
|
||||
{-(ReceiveOperator
|
||||
{-(Identifier)-})-})-}
|
||||
{-(Pointer
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Statements)-}
|
||||
{-(Empty)-})-})-}
|
||||
{-(Complement
|
||||
{-(Identifier)-})-}
|
||||
{-(Reference
|
||||
{-(Identifier)-})-}
|
||||
{-(ReceiveOperator
|
||||
{-(Identifier)-})-})))
|
||||
|
Loading…
Reference in New Issue
Block a user