1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Merge branch 'master' into abstract-abstract-semantics

This commit is contained in:
Rob Rix 2018-07-04 10:44:44 -04:00
commit aac98ec0ef
26 changed files with 2018 additions and 693 deletions

View File

@ -6,86 +6,86 @@ summary: Scrap Your Boilerplate
homepage: https://www.cs.uu.nl/wiki/GenericProgramming/SYB
license: bsd-3-clause
---
This library (libraries/syb) is derived from code from several
sources:
* Code from the GHC project which is largely (c) The University of
Glasgow, and distributable under a BSD-style license (see below),
* Code from the Haskell 98 Report which is (c) Simon Peyton Jones
and freely redistributable (but see the full license for
restrictions).
* Code from the Haskell Foreign Function Interface specification,
which is (c) Manuel M. T. Chakravarty and freely redistributable
(but see the full license for restrictions).
The full text of these licenses is reproduced below. All of the
licenses are BSD-style or compatible.
-----------------------------------------------------------------------------
The Glasgow Haskell Compiler License
Copyright 2004, The University Court of the University of Glasgow.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither name of the University nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
-----------------------------------------------------------------------------
Code derived from the document "Report on the Programming Language
Haskell 98", is distributed under the following license:
Copyright (c) 2002 Simon Peyton Jones
The authors intend this Report to belong to the entire Haskell
community, and so we grant permission to copy and distribute it for
any purpose, provided that it is reproduced in its entirety,
including this Notice. Modified versions of this Report may also be
copied and distributed for any purpose, provided that the modified
version is clearly presented as such, and that it does not claim to
be a definition of the Haskell 98 Language.
-----------------------------------------------------------------------------
Code derived from the document "The Haskell 98 Foreign Function
Interface, An Addendum to the Haskell 98 Report" is distributed under
the following license:
Copyright (c) 2002 Manuel M. T. Chakravarty
The authors intend this Report to belong to the entire Haskell
community, and so we grant permission to copy and distribute it for
any purpose, provided that it is reproduced in its entirety,
including this Notice. Modified versions of this Report may also be
copied and distributed for any purpose, provided that the modified
version is clearly presented as such, and that it does not claim to
be a definition of the Haskell 98 Foreign Function Interface.
-----------------------------------------------------------------------------
This library (libraries/syb) is derived from code from several
sources:
* Code from the GHC project which is largely (c) The University of
Glasgow, and distributable under a BSD-style license (see below),
* Code from the Haskell 98 Report which is (c) Simon Peyton Jones
and freely redistributable (but see the full license for
restrictions).
* Code from the Haskell Foreign Function Interface specification,
which is (c) Manuel M. T. Chakravarty and freely redistributable
(but see the full license for restrictions).
The full text of these licenses is reproduced below. All of the
licenses are BSD-style or compatible.
-----------------------------------------------------------------------------
The Glasgow Haskell Compiler License
Copyright 2004, The University Court of the University of Glasgow.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither name of the University nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
-----------------------------------------------------------------------------
Code derived from the document "Report on the Programming Language
Haskell 98", is distributed under the following license:
Copyright (c) 2002 Simon Peyton Jones
The authors intend this Report to belong to the entire Haskell
community, and so we grant permission to copy and distribute it for
any purpose, provided that it is reproduced in its entirety,
including this Notice. Modified versions of this Report may also be
copied and distributed for any purpose, provided that the modified
version is clearly presented as such, and that it does not claim to
be a definition of the Haskell 98 Language.
-----------------------------------------------------------------------------
Code derived from the document "The Haskell 98 Foreign Function
Interface, An Addendum to the Haskell 98 Report" is distributed under
the following license:
Copyright (c) 2002 Manuel M. T. Chakravarty
The authors intend this Report to belong to the entire Haskell
community, and so we grant permission to copy and distribute it for
any purpose, provided that it is reproduced in its entirety,
including this Notice. Modified versions of this Report may also be
copied and distributed for any purpose, provided that the modified
version is clearly presented as such, and that it does not claim to
be a definition of the Haskell 98 Foreign Function Interface.
-----------------------------------------------------------------------------

View File

@ -0,0 +1,33 @@
---
type: cabal
name: wl-pprint
version: 1.2.1
summary: The Wadler/Leijen Pretty Printer
homepage:
license: bsd-2-clause
---
Copyright 2000, Daan Leijen. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
This software is provided by the copyright holders "as is" and any
express or implied warranties, including, but not limited to, the
implied warranties of merchantability and fitness for a particular
purpose are disclaimed. In no event shall the copyright holders be
liable for any direct, indirect, incidental, special, exemplary, or
consequential damages (including, but not limited to, procurement of
substitute goods or services; loss of use, data, or profits; or
business interruption) however caused and on any theory of liability,
whether in contract, strict liability, or tort (including negligence
or otherwise) arising in any way out of the use of this software, even
if advised of the possibility of such damage.

View File

@ -1,10 +1,16 @@
syntax = "proto3";
package github.semantic;
import "ruby.proto";
import "json.proto";
import "typescript.proto";
import "types.proto";
import "error_details.proto";
option java_package = "com.github.semantic.analysis";
option go_package = "github.com/semantic/analysis/;analysis";
package github.semantic;
// Semantic's CodeAnalysis service provides endpoints for parsing, analyzing, and
// comparing source code.
@ -12,8 +18,7 @@ service CodeAnalysis {
// Parsing
//
// Parse source code blobs and return abstract syntax trees.
rpc ParseTree(ParseTreeRequest) returns (ParseTreeResponse);
rpc ParseRaw (ParseTreeRequest) returns (RawParseTreeResponse);
rpc ParseTree (ParseTreeRequest) returns (ParseTreeResponse);
// Diffing
//
@ -38,12 +43,23 @@ message ParseTreeRequest {
}
message ParseTreeResponse {
bytes json_tree = 1;
repeated ParseError errors = 2;
oneof response_type {
RubyResponse ruby = 1;
JSONResponse json = 2;
TypeScriptResponse typescript = 3;
}
}
message RawParseTreeResponse {
repeated Term terms = 1;
message RubyResponse {
repeated ruby.RubyTerm terms = 1;
}
message JSONResponse {
repeated json.JSONTerm terms = 1;
}
message TypeScriptResponse {
repeated typescript.TypeScriptTerm terms = 1;
}
message SummarizeDiffRequest {

59
proto/json.proto Normal file
View File

@ -0,0 +1,59 @@
syntax = "proto3";
package github.semantic;
import "types.proto";
option java_package = "com.github.semantic.json";
option go_package = "github.com/semantic/json;json";
message JSONTerm {
JSONSyntax syntax = 1;
}
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 JSONTerm arrayElements = 1;
}
message Boolean {
bool booleanContent = 1;
}
message Hash {
repeated JSONTerm hashElements = 1;
}
message Float {
string floatContent = 1;
}
message KeyValue {
JSONTerm key = 1;
JSONTerm value = 2;
}
message TextElement {
string textElementContent = 1;
}
message Error {
repeated ErrorSite errorCallStack = 1;
repeated string errorExpected = 2;
string errorActual = 3;
repeated JSONTerm errorChildren = 4;
}

480
proto/ruby.proto Normal file
View File

@ -0,0 +1,480 @@
syntax = "proto3";
package github.semantic;
import "types.proto";
option java_package = "com.github.semantic.ruby";
option go_package = "github.com/semantic/ruby;ruby";
message RubyTerm {
RubySyntax syntax = 1;
}
message Comment {
string commentContent = 1;
}
message Function {
repeated RubyTerm functionContext = 1;
RubyTerm functionName = 2;
repeated RubyTerm functionParameters = 3;
RubyTerm functionBody = 4;
}
message Method {
repeated RubyTerm methodContext = 1;
RubyTerm methodReceiver = 2;
RubyTerm methodName = 3;
repeated RubyTerm methodParameters = 4;
RubyTerm methodBody = 5;
}
message File { }
message Line { }
message Error {
repeated ErrorSite errorCallStack = 1;
repeated string errorExpected = 2;
string errorActual = 3;
repeated RubyTerm errorChildren = 4;
}
message And {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message BAnd {
RubyTerm left = 1;
RubyTerm right = 2;
}
message BOr {
RubyTerm left = 1;
RubyTerm right = 2;
}
message BXOr {
RubyTerm left = 1;
RubyTerm right = 2;
}
message Call {
repeated RubyTerm callContext = 1;
RubyTerm callFunction = 2;
repeated RubyTerm callParams = 3;
RubyTerm callBlock = 4;
}
message Comparison {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Complement {
RubyTerm value = 1;
}
message DividedBy {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Enumeration {
RubyTerm enumerationStart = 1;
RubyTerm enumerationEnd = 2;
RubyTerm enumerationStep = 3;
}
message Equal {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message FloorDivision {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message GreaterThan {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message GreaterThanEqual {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message LShift {
RubyTerm left = 1;
RubyTerm right = 2;
}
message LessThan {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message LessThanEqual {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Matches {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Member {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message MemberAccess {
RubyTerm lhs = 1;
bytes rhs = 2;
}
message Minus {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Modulo {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Negate {
RubyTerm term = 1;
}
message Not {
RubyTerm term = 1;
}
message NotMatches {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Or {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Plus {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Power {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message RShift {
RubyTerm left = 1;
RubyTerm right = 2;
}
message ScopeResolution {
repeated RubyTerm scopes = 1;
}
message StrictEqual {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Subscript {
RubyTerm lhs = 1;
repeated RubyTerm rhs = 2;
}
message Times {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message XOr {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Array {
repeated RubyTerm arrayElements = 1;
}
message Boolean {
bool booleanContent = 1;
}
message Complex {
string value = 1;
}
message Float {
string floatContent = 1;
}
message Hash {
repeated RubyTerm hashElements = 1;
}
message Integer {
string integerContent = 1;
}
message KeyValue {
RubyTerm key = 1;
RubyTerm value = 2;
}
message Null { }
message Rational {
string value = 1;
}
message Regex {
string regexContent = 1;
}
message String {
repeated RubyTerm stringElements = 1;
}
message Symbol {
string symbolContent = 1;
}
message TextElement {
string textElementContent = 1;
}
message Class {
RubyTerm classIdentifier = 1;
repeated RubyTerm classSuperClass = 2;
RubyTerm classBody = 3;
}
message Load {
RubyTerm loadPath = 1;
repeated RubyTerm loadWrap = 2;
}
message LowPrecedenceAnd {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message LowPrecedenceOr {
RubyTerm lhs = 1;
RubyTerm rhs = 2;
}
message Module {
RubyTerm moduleIdentifier = 1;
repeated RubyTerm moduleStatements = 2;
}
message Require {
bool requireRelative = 1;
RubyTerm requirePath = 2;
}
message Send {
repeated RubyTerm sendReceiver = 1;
repeated RubyTerm sendSelector = 2;
repeated RubyTerm sendArgs = 3;
repeated RubyTerm sendBlock = 4;
}
message Assignment {
repeated RubyTerm assignmentContext = 1;
RubyTerm assignmentTarget = 2;
RubyTerm assignmentValue = 3;
}
message Break {
RubyTerm term = 1;
}
message Catch {
RubyTerm catchException = 1;
RubyTerm catchBody = 2;
}
message Continue {
RubyTerm term = 1;
}
message Else {
RubyTerm elseCondition = 1;
RubyTerm elseBody = 2;
}
message Finally {
RubyTerm term = 1;
}
message ForEach {
RubyTerm forEachBinding = 1;
RubyTerm forEachSubject = 2;
RubyTerm forEachBody = 3;
}
message If {
RubyTerm ifCondition = 1;
RubyTerm ifThenBody = 2;
RubyTerm ifElseBody = 3;
}
message Match {
RubyTerm matchSubject = 1;
RubyTerm matchPatterns = 2;
}
message Pattern {
RubyTerm value = 1;
RubyTerm patternBody = 2;
}
message Retry {
RubyTerm term = 1;
}
message Return {
RubyTerm term = 1;
}
message ScopeEntry {
repeated RubyTerm terms = 1;
}
message ScopeExit {
repeated RubyTerm terms = 1;
}
message Statements {
repeated RubyTerm statements = 1;
}
message Try {
RubyTerm tryBody = 1;
repeated RubyTerm tryCatch = 2;
}
message While {
RubyTerm whileCondition = 1;
RubyTerm whileBody = 2;
}
message Yield {
RubyTerm term = 1;
}
message RubySyntax {
oneof syntax {
Comment comment = 1;
Function function = 2;
Boolean boolean = 3;
Method method = 4;
File file = 5;
Line line = 6;
Plus plus = 7;
Minus minus = 8;
Times times = 9;
DividedBy dividedBy = 10;
Modulo modulo = 11;
Power power = 12;
Negate negate = 13;
FloorDivision floorDivision = 14;
BAnd bAnd = 15;
BOr bOr = 16;
BXOr bXOr = 17;
LShift lShift = 18;
RShift rShift = 19;
Complement complement = 20;
And and = 21;
Not not = 22;
Or or = 23;
XOr xOr = 24;
Call call = 25;
LessThan lessThan = 26;
LessThanEqual lessThanEqual = 27;
GreaterThan greaterThan = 28;
GreaterThanEqual greaterThanEqual = 29;
Equal equal = 30;
StrictEqual strictEqual = 31;
Comparison comparison = 32;
Enumeration enumeration = 33;
Matches matches = 34;
NotMatches notMatches = 35;
MemberAccess memberAccess = 36;
ScopeResolution scopeResolution = 37;
Subscript subscript = 38;
Member member = 39;
Array array = 40;
Complex complex = 41;
Float float = 42;
Hash hash = 43;
Integer integer = 44;
KeyValue keyValue = 45;
Null null = 46;
Rational rational = 47;
Regex regex = 48;
String string = 49;
Symbol symbol = 50;
TextElement textElement = 51;
Assignment assignment = 52;
Break break = 53;
Catch catch = 54;
Continue continue = 55;
Else else = 56;
Finally finally = 57;
ForEach forEach = 58;
If if = 59;
Match match = 60;
Pattern pattern = 61;
Retry retry = 62;
Return return = 63;
ScopeEntry scopeEntry = 64;
ScopeExit scopeExit = 65;
Statements statements = 66;
Try try = 67;
While while = 68;
Yield yield = 69;
Context context = 70;
Empty empty = 71;
Error error = 72;
Identifier identifier = 73;
Class class = 74;
Load load = 75;
LowPrecedenceAnd lowPrecedenceAnd = 76;
LowPrecedenceOr lowPrecedenceOr = 77;
Module module = 78;
Require require = 79;
Send send = 80;
List list = 81;
}
}
message Context {
repeated RubyTerm contextTerms = 1;
RubyTerm contextSubject = 2;
}
message Empty { }
message Identifier {
bytes name = 1;
}
message List {
repeated RubyTerm listContent = 1;
}

View File

@ -1,367 +1,81 @@
syntax = "proto3";
package github.semantic;
option java_package = "com.github.semantic.types";
option go_package = "github.com/semantic/types;types";
enum Language {UNKNOWN = 0;
GO = 1;
HASKELL = 2;
JAVA = 3;
JAVASCRIPT = 4;
JSON = 5;
JSX = 6;
MARKDOWN = 7;
PYTHON = 8;
RUBY = 9;
TYPESCRIPT = 10;
PHP = 11;}
enum VertexType {PACKAGE = 0;
MODULE = 1;
VARIABLE = 2;}
message Term { Syntax syntax = 1;
}
message Blob { bytes blobSource = 1;
string blobPath = 2;
Language blobLanguage = 3;
}
message Edge { uint64 edgeFrom = 1;
uint64 edgeTo = 2;
}
message ErrorSite { string errorMessage = 1;
SrcLoc errorLocation = 2;
}
message ImportGraph { repeated Vertex graphVertices = 1;
repeated Edge graphEdges = 2;
}
message Pos { int64 posLine = 1;
int64 posColumn = 2;
}
message Project { string projectRootDir = 1;
repeated Blob projectBlobs = 2;
Language projectLanguage = 3;
repeated string projectExcludeDirs = 4 [packed = false];
}
message Span { Pos spanStart = 1;
Pos spanEnd = 2;
}
message SrcLoc { string srcLocPackage = 1;
string srcLocModule = 2;
string srcLocFile = 3;
int64 srcLocStartLine = 4;
int64 srcLocStartCol = 5;
int64 srcLocEndLine = 6;
int64 srcLocEndCol = 7;
}
message Vertex { VertexType vertexType = 1;
string vertexContents = 2;
uint64 vertexTag = 3;
}
message Comment { string commentContent = 1;
}
message Function { repeated Term functionContext = 1;
Term functionName = 2;
repeated Term functionParameters = 3;
Term functionBody = 4;
}
message Method { repeated Term methodContext = 1;
Term methodReceiver = 2;
Term methodName = 3;
repeated Term methodParameters = 4;
Term methodBody = 5;
}
message File {
}
message Line {
}
message Error { repeated ErrorSite errorCallStack = 1;
repeated string errorExpected = 2;
string errorActual = 3;
repeated Term errorChildren = 4;
}
message And { Term lhs = 1;
Term rhs = 2;
}
message BAnd { Term left = 1;
Term right = 2;
}
message BOr { Term left = 1;
Term right = 2;
}
message BXOr { Term left = 1;
Term right = 2;
}
message Call { repeated Term callContext = 1;
Term callFunction = 2;
repeated Term callParams = 3;
Term callBlock = 4;
}
message Comparison { Term lhs = 1;
Term rhs = 2;
}
message Complement { Term value = 1;
}
message DividedBy { Term lhs = 1;
Term rhs = 2;
}
message Enumeration { Term enumerationStart = 1;
Term enumerationEnd = 2;
Term enumerationStep = 3;
}
message Equal { Term lhs = 1;
Term rhs = 2;
}
message FloorDivision { Term lhs = 1;
Term rhs = 2;
}
message GreaterThan { Term lhs = 1;
Term rhs = 2;
}
message GreaterThanEqual { Term lhs = 1;
Term rhs = 2;
}
message LShift { Term left = 1;
Term right = 2;
}
message LessThan { Term lhs = 1;
Term rhs = 2;
}
message LessThanEqual { Term lhs = 1;
Term rhs = 2;
}
message Matches { Term lhs = 1;
Term rhs = 2;
}
message Member { Term lhs = 1;
Term rhs = 2;
}
message MemberAccess { Term lhs = 1;
bytes rhs = 2;
}
message Minus { Term lhs = 1;
Term rhs = 2;
}
message Modulo { Term lhs = 1;
Term rhs = 2;
}
message Negate { Term term = 1;
}
message Not { Term term = 1;
}
message NotMatches { Term lhs = 1;
Term rhs = 2;
}
message Or { Term lhs = 1;
Term rhs = 2;
}
message Plus { Term lhs = 1;
Term rhs = 2;
}
message Power { Term lhs = 1;
Term rhs = 2;
}
message RShift { Term left = 1;
Term right = 2;
}
message ScopeResolution { repeated Term scopes = 1;
}
message StrictEqual { Term lhs = 1;
Term rhs = 2;
}
message Subscript { Term lhs = 1;
repeated Term rhs = 2;
}
message Times { Term lhs = 1;
Term rhs = 2;
}
message XOr { Term lhs = 1;
Term rhs = 2;
}
message Array { repeated Term arrayElements = 1;
}
message Boolean { bool booleanContent = 1;
}
message Complex { string value = 1;
}
message Float { string floatContent = 1;
}
message Hash { repeated Term hashElements = 1;
}
message Integer { string integerContent = 1;
}
message KeyValue { Term key = 1;
Term value = 2;
}
message Null {
}
message Rational { string value = 1;
}
message Regex { string regexContent = 1;
}
message String { repeated Term stringElements = 1;
}
message Symbol { string symbolContent = 1;
}
message TextElement { string textElementContent = 1;
}
message Class { Term classIdentifier = 1;
repeated Term classSuperClass = 2;
Term classBody = 3;
}
message Load { Term loadPath = 1;
repeated Term loadWrap = 2;
}
message LowPrecedenceAnd { Term lhs = 1;
Term rhs = 2;
}
message LowPrecedenceOr { Term lhs = 1;
Term rhs = 2;
}
message Module { Term moduleIdentifier = 1;
repeated Term moduleStatements = 2;
}
message Require { bool requireRelative = 1;
Term requirePath = 2;
}
message Send { repeated Term sendReceiver = 1;
repeated Term sendSelector = 2;
repeated Term sendArgs = 3;
repeated Term sendBlock = 4;
}
message Assignment { repeated Term assignmentContext = 1;
Term assignmentTarget = 2;
Term assignmentValue = 3;
}
message Break { Term term = 1;
}
message Catch { Term catchException = 1;
Term catchBody = 2;
}
message Continue { Term term = 1;
}
message Else { Term elseCondition = 1;
Term elseBody = 2;
}
message Finally { Term term = 1;
}
message ForEach { Term forEachBinding = 1;
Term forEachSubject = 2;
Term forEachBody = 3;
}
message If { Term ifCondition = 1;
Term ifThenBody = 2;
Term ifElseBody = 3;
}
message Match { Term matchSubject = 1;
Term matchPatterns = 2;
}
message Pattern { Term value = 1;
Term patternBody = 2;
}
message Retry { Term term = 1;
}
message Return { Term term = 1;
}
message ScopeEntry { repeated Term terms = 1;
}
message ScopeExit { repeated Term terms = 1;
}
message Statements { repeated Term statements = 1;
}
message Try { Term tryBody = 1;
repeated Term tryCatch = 2;
}
message While { Term whileCondition = 1;
Term whileBody = 2;
}
message Yield { Term term = 1;
}
message Syntax { oneof syntax {Comment comment = 1;
Function function = 2;
Boolean boolean = 3;
Method method = 4;
File file = 5;
Line line = 6;
Plus plus = 7;
Minus minus = 8;
Times times = 9;
DividedBy dividedBy = 10;
Modulo modulo = 11;
Power power = 12;
Negate negate = 13;
FloorDivision floorDivision = 14;
BAnd bAnd = 15;
BOr bOr = 16;
BXOr bXOr = 17;
LShift lShift = 18;
RShift rShift = 19;
Complement complement = 20;
And and = 21;
Not not = 22;
Or or = 23;
XOr xOr = 24;
Call call = 25;
LessThan lessThan = 26;
LessThanEqual lessThanEqual = 27;
GreaterThan greaterThan = 28;
GreaterThanEqual greaterThanEqual = 29;
Equal equal = 30;
StrictEqual strictEqual = 31;
Comparison comparison = 32;
Enumeration enumeration = 33;
Matches matches = 34;
NotMatches notMatches = 35;
MemberAccess memberAccess = 36;
ScopeResolution scopeResolution = 37;
Subscript subscript = 38;
Member member = 39;
Array array = 40;
Complex complex = 41;
Float float = 42;
Hash hash = 43;
Integer integer = 44;
KeyValue keyValue = 45;
Null null = 46;
Rational rational = 47;
Regex regex = 48;
String string = 49;
Symbol symbol = 50;
TextElement textElement = 51;
Assignment assignment = 52;
Break break = 53;
Catch catch = 54;
Continue continue = 55;
Else else = 56;
Finally finally = 57;
ForEach forEach = 58;
If if = 59;
Match match = 60;
Pattern pattern = 61;
Retry retry = 62;
Return return = 63;
ScopeEntry scopeEntry = 64;
ScopeExit scopeExit = 65;
Statements statements = 66;
Try try = 67;
While while = 68;
Yield yield = 69;
Context context = 70;
Empty empty = 71;
Error error = 72;
Identifier identifier = 73;
Class class = 74;
Load load = 75;
LowPrecedenceAnd lowPrecedenceAnd = 76;
LowPrecedenceOr lowPrecedenceOr = 77;
Module module = 78;
Require require = 79;
Send send = 80;
List list = 81;}
}
message Context { repeated Term contextTerms = 1;
Term contextSubject = 2;
}
message Empty {
}
message Identifier { bytes name = 1;
}
message List { repeated Term listContent = 1;
}
enum Language {
UNKNOWN = 0;
GO = 1;
HASKELL = 2;
JAVA = 3;
JAVASCRIPT = 4;
JSON = 5;
JSX = 6;
MARKDOWN = 7;
PYTHON = 8;
RUBY = 9;
TYPESCRIPT = 10;
PHP = 11;
}
enum VertexType {
PACKAGE = 0;
MODULE = 1;
VARIABLE = 2;
}
message Blob {
bytes blobSource = 1;
string blobPath = 2;
Language blobLanguage = 3;
}
message Edge {
uint64 edgeFrom = 1;
uint64 edgeTo = 2;
}
message ErrorSite {
string errorMessage = 1;
SrcLoc errorLocation = 2;
}
message ImportGraph {
repeated Vertex graphVertices = 1;
repeated Edge graphEdges = 2;
}
message Pos {
int64 posLine = 1;
int64 posColumn = 2;
}
message Project {
string projectRootDir = 1;
repeated Blob projectBlobs = 2;
Language projectLanguage = 3;
repeated string projectExcludeDirs = 4[packed = false] ;
}
message Span {
Pos spanStart = 1;
Pos spanEnd = 2;
}
message SrcLoc {
string srcLocPackage = 1;
string srcLocModule = 2;
string srcLocFile = 3;
int64 srcLocStartLine = 4;
int64 srcLocStartCol = 5;
int64 srcLocEndLine = 6;
int64 srcLocEndCol = 7;
}
message Vertex {
VertexType vertexType = 1;
string vertexContents = 2;
uint64 vertexTag = 3;
}

962
proto/typescript.proto Normal file
View File

@ -0,0 +1,962 @@
syntax = "proto3";
package github.semantic;
import "types.proto";
option java_package = "com.github.semantic.typescript";
option go_package = "github.com/semantic/typescript;typescript";
message TypeScriptTerm {
TypeScriptSyntax syntax = 1;
}
message Alias {
bytes aliasValue = 1;
bytes aliasName = 2;
}
message ImportPath {
string unPath = 1;
Relative pathIsRelative = 2;
}
enum Relative {
Unknown = 0;
Relative = 1;
NonRelative = 2;
}
message TypeScriptSyntax {
oneof syntax {
Comment comment = 1;
HashBang hashBang = 2;
Class class = 3;
Function function = 4;
Method method = 5;
MethodSignature methodSignature = 6;
InterfaceDeclaration interfaceDeclaration = 7;
PublicFieldDefinition publicFieldDefinition = 8;
VariableDeclaration variableDeclaration = 9;
TypeAlias typeAlias = 10;
Plus plus = 11;
Minus minus = 12;
Times times = 13;
DividedBy dividedBy = 14;
Modulo modulo = 15;
Power power = 16;
Negate negate = 17;
FloorDivision floorDivision = 18;
BAnd bAnd = 19;
BOr bOr = 20;
BXOr bXOr = 21;
LShift lShift = 22;
RShift rShift = 23;
UnsignedRShift unsignedRShift = 24;
Complement complement = 25;
And and = 26;
Not not = 27;
Or or = 28;
XOr xOr = 29;
Call call = 30;
Cast cast = 31;
LessThan lessThan = 32;
LessThanEqual lessThanEqual = 33;
GreaterThan greaterThan = 34;
GreaterThanEqual greaterThanEqual = 35;
Equal equal = 36;
StrictEqual strictEqual = 37;
Comparison comparison = 38;
Enumeration enumeration = 39;
MemberAccess memberAccess = 40;
NonNullExpression nonNullExpression = 41;
ScopeResolution scopeResolution = 42;
SequenceExpression sequenceExpression = 43;
Subscript subscript = 44;
Member member = 45;
Delete delete = 46;
Void void = 47;
Typeof typeof = 48;
InstanceOf instanceOf = 49;
New new = 50;
Await await = 51;
Array array = 52;
Boolean boolean = 53;
Float float = 54;
Hash hash = 55;
Integer integer = 56;
KeyValue keyValue = 57;
Null null = 58;
String string = 59;
TextElement textElement = 60;
Regex regex = 61;
Assignment assignment = 62;
Break break = 63;
Catch catch = 64;
Continue continue = 65;
DoWhile doWhile = 66;
Else else = 67;
Finally finally = 68;
For for = 69;
ForEach forEach = 70;
If if = 71;
Match match = 72;
Pattern pattern = 73;
Retry retry = 74;
Return return = 75;
ScopeEntry scopeEntry = 76;
ScopeExit scopeExit = 77;
Statements statements = 78;
Throw throw = 79;
Try try = 80;
While while = 81;
Yield yield = 82;
AccessibilityModifier accessibilityModifier = 83;
Empty empty = 84;
Error error = 85;
Identifier identifier = 86;
Context context = 87;
Readonly readonly = 88;
TypeParameters typeParameters = 89;
TypeParameter typeParameter = 90;
Constraint constraint = 91;
ParenthesizedType parenthesizedType = 92;
DefaultType defaultType = 93;
PredefinedType predefinedType = 94;
TypeIdentifier typeIdentifier = 95;
NestedIdentifier nestedIdentifier = 96;
NestedTypeIdentifier nestedTypeIdentifier = 97;
GenericType genericType = 98;
TypeArguments typeArguments = 99;
TypePredicate typePredicate = 100;
CallSignature callSignature = 101;
ConstructSignature constructSignature = 102;
ArrayType arrayType = 103;
LookupType lookupType = 104;
FlowMaybeType flowMaybeType = 105;
TypeQuery typeQuery = 106;
IndexTypeQuery indexTypeQuery = 107;
ThisType thisType = 108;
ExistentialType existentialType = 109;
AbstractMethodSignature abstractMethodSignature = 110;
IndexSignature indexSignature = 111;
ObjectType objectType = 112;
LiteralType literalType = 113;
Union union = 114;
Intersection intersection = 115;
Module module = 116;
InternalModule internalModule = 117;
FunctionType functionType = 118;
Tuple tuple = 119;
Constructor constructor = 120;
TypeAssertion typeAssertion = 121;
ImportAlias importAlias = 122;
Debugger debugger = 123;
ShorthandPropertyIdentifier shorthandPropertyIdentifier = 124;
Super super = 125;
Undefined undefined = 126;
ClassHeritage classHeritage = 127;
AbstractClass abstractClass = 128;
ImplementsClause implementsClause = 129;
JsxElement jsxElement = 130;
JsxSelfClosingElement jsxSelfClosingElement = 131;
JsxOpeningElement jsxOpeningElement = 132;
JsxText jsxText = 133;
JsxClosingElement jsxClosingElement = 134;
JsxExpression jsxExpression = 135;
JsxAttribute jsxAttribute = 136;
JsxFragment jsxFragment = 137;
JsxNamespaceName jsxNamespaceName = 138;
OptionalParameter optionalParameter = 139;
RequiredParameter requiredParameter = 140;
RestParameter restParameter = 141;
PropertySignature propertySignature = 142;
AmbientDeclaration ambientDeclaration = 143;
EnumDeclaration enumDeclaration = 144;
ExtendsClause extendsClause = 145;
AmbientFunction ambientFunction = 146;
ImportRequireClause importRequireClause = 147;
ImportClause importClause = 148;
LabeledStatement labeledStatement = 149;
Annotation annotation = 150;
With with = 151;
ForOf forOf = 152;
This this = 153;
Update update = 154;
ComputedPropertyName computedPropertyName = 155;
Decorator decorator = 156;
Import import = 157;
QualifiedAliasedImport qualifiedAliasedImport = 158;
SideEffectImport sideEffectImport = 159;
DefaultExport defaultExport = 160;
QualifiedExport qualifiedExport = 161;
QualifiedExportFrom qualifiedExportFrom = 162;
JavaScriptRequire javaScriptRequire = 163;
List list = 164;
}
}
message Comment {
string commentContent = 1;
}
message HashBang {
string value = 1;
}
message Class {
repeated TypeScriptTerm classContext = 1;
TypeScriptTerm classIdentifier = 2;
repeated TypeScriptTerm classSuperclasses = 3;
TypeScriptTerm classBody = 4;
}
message Function {
repeated TypeScriptTerm functionContext = 1;
TypeScriptTerm functionName = 2;
repeated TypeScriptTerm functionParameters = 3;
TypeScriptTerm functionBody = 4;
}
message Method {
repeated TypeScriptTerm methodContext = 1;
TypeScriptTerm methodReceiver = 2;
TypeScriptTerm methodName = 3;
repeated TypeScriptTerm methodParameters = 4;
TypeScriptTerm methodBody = 5;
}
message MethodSignature {
repeated TypeScriptTerm methodSignatureContext = 1;
TypeScriptTerm methodSignatureName = 2;
repeated TypeScriptTerm methodSignatureParameters = 3;
}
message InterfaceDeclaration {
repeated TypeScriptTerm interfaceDeclarationContext = 1;
TypeScriptTerm interfaceDeclarationIdentifier = 2;
TypeScriptTerm interfaceDeclarationBody = 3;
}
message PublicFieldDefinition {
repeated TypeScriptTerm publicFieldContext = 1;
TypeScriptTerm publicFieldPropertyName = 2;
TypeScriptTerm publicFieldValue = 3;
}
message VariableDeclaration {
repeated TypeScriptTerm variableDeclarations = 1;
}
message TypeAlias {
repeated TypeScriptTerm typeAliasContext = 1;
TypeScriptTerm typeAliasIdentifier = 2;
TypeScriptTerm typeAliasKind = 3;
}
message Plus {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Minus {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Times {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message DividedBy {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Modulo {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Power {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Negate {
TypeScriptTerm term = 1;
}
message FloorDivision {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message BAnd {
TypeScriptTerm left = 1;
TypeScriptTerm right = 2;
}
message BOr {
TypeScriptTerm left = 1;
TypeScriptTerm right = 2;
}
message BXOr {
TypeScriptTerm left = 1;
TypeScriptTerm right = 2;
}
message LShift {
TypeScriptTerm left = 1;
TypeScriptTerm right = 2;
}
message RShift {
TypeScriptTerm left = 1;
TypeScriptTerm right = 2;
}
message UnsignedRShift {
TypeScriptTerm left = 1;
TypeScriptTerm right = 2;
}
message Complement {
TypeScriptTerm value = 1;
}
message And {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Not {
TypeScriptTerm term = 1;
}
message Or {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message XOr {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Call {
repeated TypeScriptTerm callContext = 1;
TypeScriptTerm callFunction = 2;
repeated TypeScriptTerm callParams = 3;
TypeScriptTerm callBlock = 4;
}
message Cast {
TypeScriptTerm castSubject = 1;
TypeScriptTerm castType = 2;
}
message LessThan {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message LessThanEqual {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message GreaterThan {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message GreaterThanEqual {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Equal {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message StrictEqual {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Comparison {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Enumeration {
TypeScriptTerm enumerationStart = 1;
TypeScriptTerm enumerationEnd = 2;
TypeScriptTerm enumerationStep = 3;
}
message MemberAccess {
TypeScriptTerm lhs = 1;
bytes rhs = 2;
}
message NonNullExpression {
TypeScriptTerm nonNullExpression = 1;
}
message ScopeResolution {
repeated TypeScriptTerm scopes = 1;
}
message SequenceExpression {
TypeScriptTerm firstExpression = 1;
TypeScriptTerm secondExpression = 2;
}
message Subscript {
TypeScriptTerm lhs = 1;
repeated TypeScriptTerm rhs = 2;
}
message Member {
TypeScriptTerm lhs = 1;
TypeScriptTerm rhs = 2;
}
message Delete {
TypeScriptTerm value = 1;
}
message Void {
TypeScriptTerm value = 1;
}
message Typeof {
TypeScriptTerm value = 1;
}
message InstanceOf {
TypeScriptTerm instanceOfSubject = 1;
TypeScriptTerm instanceOfObject = 2;
}
message New {
repeated TypeScriptTerm newSubject = 1;
}
message Await {
TypeScriptTerm awaitSubject = 1;
}
message Array {
repeated TypeScriptTerm arrayElements = 1;
}
message Boolean {
bool booleanContent = 1;
}
message Float {
string floatContent = 1;
}
message Hash {
repeated TypeScriptTerm hashElements = 1;
}
message Integer {
string integerContent = 1;
}
message KeyValue {
TypeScriptTerm key = 1;
TypeScriptTerm value = 2;
}
message Null { }
message String {
repeated TypeScriptTerm stringElements = 1;
}
message TextElement {
string textElementContent = 1;
}
message Regex {
string regexContent = 1;
}
message Assignment {
repeated TypeScriptTerm assignmentContext = 1;
TypeScriptTerm assignmentTarget = 2;
TypeScriptTerm assignmentValue = 3;
}
message Break {
TypeScriptTerm term = 1;
}
message Catch {
TypeScriptTerm catchException = 1;
TypeScriptTerm catchBody = 2;
}
message Continue {
TypeScriptTerm term = 1;
}
message DoWhile {
TypeScriptTerm doWhileCondition = 1;
TypeScriptTerm doWhileBody = 2;
}
message Else {
TypeScriptTerm elseCondition = 1;
TypeScriptTerm elseBody = 2;
}
message Finally {
TypeScriptTerm term = 1;
}
message For {
TypeScriptTerm forBefore = 1;
TypeScriptTerm forCondition = 2;
TypeScriptTerm forStep = 3;
TypeScriptTerm forBody = 4;
}
message ForEach {
TypeScriptTerm forEachBinding = 1;
TypeScriptTerm forEachSubject = 2;
TypeScriptTerm forEachBody = 3;
}
message If {
TypeScriptTerm ifCondition = 1;
TypeScriptTerm ifThenBody = 2;
TypeScriptTerm ifElseBody = 3;
}
message Match {
TypeScriptTerm matchSubject = 1;
TypeScriptTerm matchPatterns = 2;
}
message Pattern {
TypeScriptTerm value = 1;
TypeScriptTerm patternBody = 2;
}
message Retry {
TypeScriptTerm term = 1;
}
message Return {
TypeScriptTerm term = 1;
}
message ScopeEntry {
repeated TypeScriptTerm terms = 1;
}
message ScopeExit {
repeated TypeScriptTerm terms = 1;
}
message Statements {
repeated TypeScriptTerm statements = 1;
}
message Throw {
TypeScriptTerm value = 1;
}
message Try {
TypeScriptTerm tryBody = 1;
repeated TypeScriptTerm tryCatch = 2;
}
message While {
TypeScriptTerm whileCondition = 1;
TypeScriptTerm whileBody = 2;
}
message Yield {
TypeScriptTerm term = 1;
}
message AccessibilityModifier {
string contents = 1;
}
message Empty { }
message Error {
repeated ErrorSite errorCallStack = 1;
repeated string errorExpected = 2;
string errorActual = 3;
repeated TypeScriptTerm errorChildren = 4;
}
message Identifier {
bytes name = 1;
}
message Context {
repeated TypeScriptTerm contextTerms = 1;
TypeScriptTerm contextSubject = 2;
}
message Readonly { }
message TypeParameters {
repeated TypeScriptTerm terms = 1;
}
message TypeParameter {
TypeScriptTerm typeParameter = 1;
TypeScriptTerm typeParameterConstraint = 2;
TypeScriptTerm typeParameterDefaultType = 3;
}
message Constraint {
TypeScriptTerm constraintType = 1;
}
message ParenthesizedType {
TypeScriptTerm parenthesizedType = 1;
}
message DefaultType {
TypeScriptTerm defaultType = 1;
}
message PredefinedType {
string predefinedType = 1;
}
message TypeIdentifier {
string contents = 1;
}
message NestedIdentifier {
TypeScriptTerm left = 1;
TypeScriptTerm right = 2;
}
message NestedTypeIdentifier {
TypeScriptTerm left = 1;
TypeScriptTerm right = 2;
}
message GenericType {
TypeScriptTerm genericTypeIdentifier = 1;
TypeScriptTerm genericTypeArguments = 2;
}
message TypeArguments {
repeated TypeScriptTerm typeArguments = 1;
}
message TypePredicate {
TypeScriptTerm typePredicateIdentifier = 1;
TypeScriptTerm typePredicateType = 2;
}
message CallSignature {
TypeScriptTerm callSignatureTypeParameters = 1;
repeated TypeScriptTerm callSignatureParameters = 2;
TypeScriptTerm callSignatureType = 3;
}
message ConstructSignature {
TypeScriptTerm constructSignatureTypeParameters = 1;
repeated TypeScriptTerm constructSignatureParameters = 2;
TypeScriptTerm constructSignatureType = 3;
}
message ArrayType {
TypeScriptTerm arrayType = 1;
}
message LookupType {
TypeScriptTerm lookupTypeIdentifier = 1;
TypeScriptTerm lookupTypeKey = 2;
}
message FlowMaybeType {
TypeScriptTerm flowMaybeType = 1;
}
message TypeQuery {
TypeScriptTerm typeQuerySubject = 1;
}
message IndexTypeQuery {
TypeScriptTerm indexTypeQuerySubject = 1;
}
message ThisType {
string contents = 1;
}
message ExistentialType {
string contents = 1;
}
message AbstractMethodSignature {
repeated TypeScriptTerm abstractMethodSignatureContext = 1;
TypeScriptTerm abstractMethodSignatureName = 2;
repeated TypeScriptTerm abstractMethodSignatureParameters = 3;
}
message IndexSignature {
TypeScriptTerm indexSignatureSubject = 1;
TypeScriptTerm indexSignatureType = 2;
}
message ObjectType {
repeated TypeScriptTerm objectTypeElements = 1;
}
message LiteralType {
TypeScriptTerm literalTypeSubject = 1;
}
message Union {
TypeScriptTerm unionLeft = 1;
TypeScriptTerm unionRight = 2;
}
message Intersection {
TypeScriptTerm intersectionLeft = 1;
TypeScriptTerm intersectionRight = 2;
}
message Module {
TypeScriptTerm moduleIdentifier = 1;
repeated TypeScriptTerm moduleStatements = 2;
}
message InternalModule {
TypeScriptTerm internalModuleIdentifier = 1;
repeated TypeScriptTerm internalModuleStatements = 2;
}
message FunctionType {
TypeScriptTerm functionTypeParameters = 1;
repeated TypeScriptTerm functionFormalParameters = 2;
TypeScriptTerm functionType = 3;
}
message Tuple {
repeated TypeScriptTerm tupleElements = 1;
}
message Constructor {
TypeScriptTerm constructorTypeParameters = 1;
repeated TypeScriptTerm constructorFormalParameters = 2;
TypeScriptTerm constructorType = 3;
}
message TypeAssertion {
TypeScriptTerm typeAssertionParameters = 1;
TypeScriptTerm typeAssertionExpression = 2;
}
message ImportAlias {
TypeScriptTerm importAliasSubject = 1;
TypeScriptTerm importAlias = 2;
}
message Debugger { }
message ShorthandPropertyIdentifier {
string contents = 1;
}
message Super { }
message Undefined { }
message ClassHeritage {
TypeScriptTerm classHeritageExtendsClause = 1;
TypeScriptTerm implementsClause = 2;
}
message AbstractClass {
TypeScriptTerm abstractClassIdentifier = 1;
TypeScriptTerm abstractClassTypeParameters = 2;
repeated TypeScriptTerm classHeritage = 3;
TypeScriptTerm classBody = 4;
}
message ExtendsClause {
repeated TypeScriptTerm extendsClauses = 1;
}
message ImplementsClause {
repeated TypeScriptTerm implementsClauseTypes = 1;
}
message JsxElement {
TypeScriptTerm jsxOpeningElement = 1;
repeated TypeScriptTerm jsxElements = 2;
TypeScriptTerm jsxClosingElement = 3;
}
message JsxSelfClosingElement {
TypeScriptTerm jsxSelfClosingElementIdentifier = 1;
repeated TypeScriptTerm jsxSelfClosingElementAttributes = 2;
}
message JsxOpeningElement {
TypeScriptTerm jsxOpeningElementIdentifier = 1;
repeated TypeScriptTerm jsxAttributes = 2;
}
message JsxText {
string contents = 1;
}
message JsxClosingElement {
TypeScriptTerm jsxClosingElementIdentifier = 1;
}
message JsxExpression {
TypeScriptTerm jsxExpression = 1;
}
message JsxAttribute {
TypeScriptTerm jsxAttributeTarget = 1;
TypeScriptTerm jsxAttributeValue = 2;
}
message JsxFragment {
repeated TypeScriptTerm terms = 1;
}
message JsxNamespaceName {
TypeScriptTerm left = 1;
TypeScriptTerm right = 2;
}
message OptionalParameter {
repeated TypeScriptTerm optionalParameterContext = 1;
TypeScriptTerm optionalParameterSubject = 2;
}
message RequiredParameter {
repeated TypeScriptTerm requiredParameterContext = 1;
TypeScriptTerm requiredParameterSubject = 2;
}
message RestParameter {
repeated TypeScriptTerm restParameterContext = 1;
TypeScriptTerm restParameterSubject = 2;
}
message PropertySignature {
repeated TypeScriptTerm modifiers = 1;
TypeScriptTerm propertySignaturePropertyName = 2;
}
message AmbientDeclaration {
TypeScriptTerm ambientDeclarationBody = 1;
}
message EnumDeclaration {
TypeScriptTerm enumDeclarationIdentifier = 1;
repeated TypeScriptTerm enumDeclarationBody = 2;
}
message AmbientFunction {
repeated TypeScriptTerm ambientFunctionContext = 1;
TypeScriptTerm ambientFunctionIdentifier = 2;
repeated TypeScriptTerm ambientFunctionParameters = 3;
}
message ImportRequireClause {
TypeScriptTerm importRequireIdentifier = 1;
TypeScriptTerm importRequireSubject = 2;
}
message ImportClause {
repeated TypeScriptTerm importClauseElements = 1;
}
message LabeledStatement {
TypeScriptTerm labeledStatementIdentifier = 1;
TypeScriptTerm labeledStatementSubject = 2;
}
message Annotation {
TypeScriptTerm annotationType = 1;
}
message With {
TypeScriptTerm withExpression = 1;
TypeScriptTerm withBody = 2;
}
message ForOf {
TypeScriptTerm forOfBinding = 1;
TypeScriptTerm forOfSubject = 2;
TypeScriptTerm forOfBody = 3;
}
message This { }
message Update {
TypeScriptTerm updateSubject = 1;
}
message ComputedPropertyName {
TypeScriptTerm propertyName = 1;
}
message Decorator {
TypeScriptTerm decoratorTerm = 1;
}
message Import {
repeated Alias importSymbols = 1;
ImportPath importFrom = 2;
}
message QualifiedAliasedImport {
TypeScriptTerm qualifiedAliasedImportAlias = 1;
ImportPath qualifiedAliasedImportFrom = 2;
}
message SideEffectImport {
ImportPath sideEffectImportFrom = 1;
}
message DefaultExport {
TypeScriptTerm defaultExport = 1;
}
message QualifiedExport {
repeated Alias qualifiedExportSymbols = 1;
}
message QualifiedExportFrom {
ImportPath qualifiedExportFrom = 1;
repeated Alias qualifiedExportFromSymbols = 2;
}
message JavaScriptRequire {
TypeScriptTerm javascriptRequireIden = 1;
ImportPath javascriptRequireFrom = 2;
}
message List {
repeated TypeScriptTerm listContent = 1;
}

View File

@ -123,8 +123,8 @@ instance (Enum symbol, Ord symbol, Show symbol) => Assigning symbol (Assignment
Right (state', syntax) -> Right (state', termIn (stateLocation state) (inject syntax)))) (choices a))
assign :: (Enum symbol, Show symbol) => Assignment symbol a -> Source -> AST [] symbol -> Either (Error String) a
assign assignment src = bimap (fmap (either id show)) snd . runAssignment assignment src . State 0 lowerBound . pure
assign :: (Enum symbol, Show symbol) => Source -> Assignment symbol a -> AST [] symbol -> Either (Error String) a
assign src assignment = bimap (fmap (either id show)) snd . runAssignment assignment src . State 0 lowerBound . pure
runAssignment :: Enum symbol => Assignment symbol a -> Source -> State symbol -> Either (Error (Either String symbol)) (State symbol, a)
runAssignment (Assignment nullable firstSet table) src input

View File

@ -172,7 +172,7 @@ instance Declarations1 Identifier where
liftDeclaredName _ (Identifier x) = pure x
-- | An accessibility modifier, e.g. private, public, protected, etc.
newtype AccessibilityModifier a = AccessibilityModifier Text
newtype AccessibilityModifier a = AccessibilityModifier { contents :: Text }
deriving newtype (Eq, Ord, Show)
deriving stock (Foldable, Functor, Generic1, Traversable)
deriving anyclass (Declarations1, Diffable, FreeVariables1, Hashable1, Mergeable, Message1, Named1, ToJSONFields1)

View File

@ -24,7 +24,7 @@ instance Evaluatable Comment where
-- TODO: Differentiate between line/block comments?
-- | HashBang line (e.g. `#!/usr/bin/env node`)
newtype HashBang a = HashBang Text
newtype HashBang a = HashBang { value :: Text }
deriving (Diffable, Eq, Foldable, Functor, Generic1, Hashable1, Mergeable, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Named1, Message1)
instance Eq1 HashBang where liftEq = genericLiftEq

View File

@ -56,7 +56,7 @@ instance Evaluatable Method where
-- | A method signature in TypeScript or a method spec in Go.
data MethodSignature a = MethodSignature { _methodSignatureContext :: ![a], _methodSignatureName :: !a, _methodSignatureParameters :: ![a] }
data MethodSignature a = MethodSignature { methodSignatureContext :: ![a], methodSignatureName :: !a, methodSignatureParameters :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
instance Eq1 MethodSignature where liftEq = genericLiftEq

View File

@ -264,7 +264,7 @@ instance Evaluatable XOr where
go (XOr a b) = boolean <$> liftA2 (/=) (a >>= asBool) (b >>= asBool)
-- | Javascript delete operator
newtype Delete a = Delete a
newtype Delete a = Delete { value :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
instance Eq1 Delete where liftEq = genericLiftEq
@ -276,7 +276,7 @@ instance Evaluatable Delete
-- | A sequence expression such as Javascript or C's comma operator.
data SequenceExpression a = SequenceExpression { _firstExpression :: !a, _secondExpression :: !a }
data SequenceExpression a = SequenceExpression { firstExpression :: !a, secondExpression :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
instance Eq1 SequenceExpression where liftEq = genericLiftEq
@ -288,7 +288,7 @@ instance Evaluatable SequenceExpression
-- | Javascript void operator
newtype Void a = Void a
newtype Void a = Void { value :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
instance Eq1 Void where liftEq = genericLiftEq
@ -300,7 +300,7 @@ instance Evaluatable Void
-- | Javascript typeof operator
newtype Typeof a = Typeof a
newtype Typeof a = Typeof { value :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
instance Eq1 Typeof where liftEq = genericLiftEq

View File

@ -290,7 +290,7 @@ instance Evaluatable DoWhile where
-- Exception handling
newtype Throw a = Throw a
newtype Throw a = Throw { value :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
instance Eq1 Throw where liftEq = genericLiftEq

View File

@ -4,7 +4,7 @@ module Data.Syntax.Type where
import Data.Abstract.Evaluatable
import Data.JSON.Fields
import Diffing.Algorithm
import Prelude hiding (Bool, Float, Int)
import Prelude hiding (Bool, Float, Int, Double)
import Prologue hiding (Map)
import Proto3.Suite.Class
@ -109,7 +109,7 @@ instance Show1 Readonly where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Readonly
newtype Slice a = Slice a
newtype Slice a = Slice { value :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
instance Eq1 Slice where liftEq = genericLiftEq
@ -120,7 +120,7 @@ instance Show1 Slice where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Slice
newtype TypeParameters a = TypeParameters [a]
newtype TypeParameters a = TypeParameters { terms :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable, Named1, Message1)
instance Eq1 TypeParameters where liftEq = genericLiftEq
@ -152,7 +152,7 @@ instance Show1 Int where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for Int
instance Evaluatable Int
data Float a = Float | Double
data Float a = Float
deriving (Diffable, Eq, Foldable, Functor, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)
instance Eq1 Float where liftEq = genericLiftEq
@ -162,6 +162,16 @@ instance Show1 Float where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for Float
instance Evaluatable Float
data Double a = Double
deriving (Diffable, Eq, Foldable, Functor, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)
instance Eq1 Double where liftEq = genericLiftEq
instance Ord1 Double where liftCompare = genericLiftCompare
instance Show1 Double where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for Double
instance Evaluatable Double
data Bool a = Bool
deriving (Diffable, Eq, Foldable, Functor, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1, Declarations1, ToJSONFields1, Hashable1)

View File

@ -82,13 +82,10 @@ instance Show1 f => Show1 (Term f) where
instance (Show1 f, Show a) => Show (Term f a) where
showsPrec = showsPrec1
instance Message1 f => Message (Term f ()) where
instance (Named1 f, Message1 f) => Message (Term f ()) where
encodeMessage num (Term (In _ f)) = Encode.embedded num (liftEncodeMessage encodeMessage 1 f)
decodeMessage num = termIn () . fromMaybe undefined <$> Decode.at (Decode.embedded (liftDecodeMessage decodeMessage 1)) num
dotProto _ = [ DotProtoMessageField (DotProtoField 1 (Prim (Named (Single "Syntax"))) (Single "syntax") [] Nothing) ]
instance Named (Term f a) where
nameOf _ = "Term"
dotProto (_ :: Proxy (Term f ())) = [ DotProtoMessageField (DotProtoField 1 (Prim . Named $ Single (nameOf1 (Proxy @f))) (Single "syntax") [] Nothing) ]
instance Ord1 f => Ord1 (Term f) where
liftCompare comp = go where go t1 t2 = liftCompare2 comp go (unTerm t1) (unTerm t2)

View File

@ -1,3 +1,4 @@
{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME
module Language.JSON.Assignment
( assignment
, Syntax
@ -14,6 +15,7 @@ import qualified Data.Syntax as Syntax
import qualified Data.Syntax.Literal as Literal
import qualified Data.Term as Term
import Language.JSON.Grammar as Grammar
import Proto3.Suite (Named1(..), Named(..))
import Prologue
import Text.Parser.Combinators
@ -31,6 +33,12 @@ type Syntax =
type Term = Term.Term (Sum Syntax) (Record Location)
type Assignment = Deterministic.Assignment Grammar
instance Named1 (Sum Syntax) where
nameOf1 _ = "JSONSyntax"
instance Named (Term.Term (Sum Syntax) ()) where
nameOf _ = "JSONTerm"
assignment :: Assignment Term
assignment = value <|> parseError

View File

@ -1,4 +1,5 @@
{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME
module Language.Ruby.Assignment
( assignment
, Syntax
@ -35,6 +36,7 @@ import qualified Data.Syntax.Statement as Statement
import qualified Data.Term as Term
import qualified Language.Ruby.Syntax as Ruby.Syntax
import Prologue hiding (for)
import Proto3.Suite (Named1(..), Named(..))
-- | The type of Ruby syntax.
type Syntax = '[
@ -124,6 +126,12 @@ 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"
-- | Assignment from AST in Rubys grammar onto a program in Rubys syntax.
assignment :: Assignment Term
assignment = handleError $ makeTerm <$> symbol Program <*> children (Statement.Statements <$> many expression) <|> parseError

View File

@ -1,4 +1,5 @@
{-# LANGUAGE DataKinds, RankNTypes, TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} -- FIXME
module Language.TypeScript.Assignment
( assignment
, Syntax
@ -34,6 +35,7 @@ import qualified Data.Term as Term
import Language.TypeScript.Grammar as Grammar
import qualified Language.TypeScript.Syntax as TypeScript.Syntax
import Prologue
import Proto3.Suite (Named1(..), Named(..))
-- | The type of TypeScript syntax.
type Syntax = '[
@ -165,7 +167,6 @@ type Syntax = '[
, TypeScript.Syntax.Undefined
, TypeScript.Syntax.ClassHeritage
, TypeScript.Syntax.AbstractClass
, TypeScript.Syntax.ExtendsClause
, TypeScript.Syntax.ImplementsClause
, TypeScript.Syntax.JsxElement
, TypeScript.Syntax.JsxSelfClosingElement
@ -207,6 +208,12 @@ type Syntax = '[
type Term = Term.Term (Sum Syntax) (Record Location)
type Assignment = Assignment.Assignment [] Grammar
instance Named1 (Sum Syntax) where
nameOf1 _ = "TypeScriptSyntax"
instance Named (Term.Term (Sum Syntax) ()) where
nameOf _ = "TypeScriptTerm"
-- | Assignment from AST in TypeScripts grammar onto a program in TypeScripts syntax.
assignment :: Assignment Term
assignment = handleError $ makeTerm <$> symbol Program <*> children (Statement.Statements <$> manyTerm statement) <|> parseError
@ -694,7 +701,7 @@ importStatement = makeImportTerm <$> symbol Grammar.ImportStatement <*> childr
<|> (pure <$> defaultImport))
makeImportTerm1 loc from (Just alias, _) = makeTerm loc (TypeScript.Syntax.QualifiedAliasedImport alias from)
makeImportTerm1 loc from (Nothing, symbols) = makeTerm loc (TypeScript.Syntax.Import symbols from)
makeImportTerm1 loc from (Nothing, symbols) = makeTerm loc (TypeScript.Syntax.Import (uncurry TypeScript.Syntax.Alias <$> symbols) from)
makeImportTerm loc ([x], from) = makeImportTerm1 loc from x
makeImportTerm loc (xs, from) = makeTerm loc $ fmap (makeImportTerm1 loc from) xs
importSymbol = symbol Grammar.ImportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> ((Just <$> rawIdentifier) <|> pure Nothing))
@ -755,8 +762,8 @@ exportStatement = makeTerm <$> symbol Grammar.ExportStatement <*> children (flip
exportClause = symbol Grammar.ExportClause *> children (many exportSymbol)
exportSymbol = symbol Grammar.ExportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> (Just <$> rawIdentifier))
<|> symbol Grammar.ExportSpecifier *> children (makeNameAliasPair <$> rawIdentifier <*> pure Nothing)
makeNameAliasPair from (Just alias) = (from, alias)
makeNameAliasPair from Nothing = (from, from)
makeNameAliasPair from (Just alias) = TypeScript.Syntax.Alias from alias
makeNameAliasPair from Nothing = TypeScript.Syntax.Alias from from
rawIdentifier = (symbol Identifier <|> symbol Identifier') *> (name <$> source)
-- TODO: Need to validate that inline comments are still handled with this change in assigning to Path and not a Term.
fromClause = symbol Grammar.String *> (TypeScript.Syntax.importPath <$> source)

View File

@ -1,4 +1,4 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveAnyClass, DuplicateRecordFields #-}
module Language.TypeScript.Syntax where
import qualified Data.Abstract.Environment as Env
@ -14,12 +14,31 @@ import qualified Data.Text as T
import Diffing.Algorithm
import Prologue
import System.FilePath.Posix
import Proto3.Suite
import qualified Proto3.Wire.Encode as Encode
import qualified Proto3.Wire.Decode as Decode
data Relative = Relative | NonRelative
deriving (Eq, Generic, Hashable, Ord, Show, ToJSON)
data Relative = Unknown | Relative | NonRelative
deriving (Bounded, Enum, Finite, MessageField, Named, Eq, Generic, Hashable, Ord, Show, ToJSON)
instance Primitive Relative where
encodePrimitive = Encode.enum
decodePrimitive = either (const def) id <$> Decode.enum
primType _ = Named (Single (nameOf (Proxy @Relative)))
instance HasDefault Relative where
def = Unknown
data ImportPath = ImportPath { unPath :: FilePath, pathIsRelative :: Relative }
deriving (Eq, Generic, Hashable, Ord, Show, ToJSON)
deriving (Eq, Generic, Hashable, Message, Named, Ord, Show, ToJSON)
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 Relative
-- TODO: fix the duplication present in this and Python
importPath :: Text -> ImportPath
@ -44,8 +63,8 @@ resolveWithNodejsStrategy :: ( Member (Modules address) effects
=> ImportPath
-> [String]
-> Evaluator address value effects M.ModulePath
resolveWithNodejsStrategy (ImportPath path Relative) exts = resolveRelativePath path exts
resolveWithNodejsStrategy (ImportPath path NonRelative) exts = resolveNonRelativePath path exts
resolveWithNodejsStrategy (ImportPath path _) exts = resolveRelativePath path exts
-- | Resolve a relative TypeScript import to a known 'ModuleName' or fail.
--
@ -143,8 +162,8 @@ evalRequire modulePath alias = letrec' alias $ \addr -> do
bindAll importedEnv
unit <$ makeNamespace alias addr Nothing
data Import a = Import { importSymbols :: ![(Name, Name)], importFrom :: ImportPath }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data Import a = Import { importSymbols :: ![Alias], importFrom :: ImportPath }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Import where liftEq = genericLiftEq
instance Ord1 Import where liftCompare = genericLiftCompare
@ -160,10 +179,10 @@ instance Evaluatable Import where
where
renamed importedEnv
| Prologue.null symbols = importedEnv
| otherwise = Env.overwrite symbols importedEnv
| otherwise = Env.overwrite (toTuple <$> symbols) importedEnv
data JavaScriptRequire a = JavaScriptRequire { javascriptRequireIden :: !a, javascriptRequireFrom :: ImportPath }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 JavaScriptRequire where liftEq = genericLiftEq
instance Ord1 JavaScriptRequire where liftCompare = genericLiftCompare
@ -177,7 +196,7 @@ instance Evaluatable JavaScriptRequire where
data QualifiedAliasedImport a = QualifiedAliasedImport { qualifiedAliasedImportAlias :: !a, qualifiedAliasedImportFrom :: ImportPath }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 QualifiedAliasedImport where liftEq = genericLiftEq
instance Ord1 QualifiedAliasedImport where liftCompare = genericLiftCompare
@ -190,7 +209,7 @@ instance Evaluatable QualifiedAliasedImport where
rvalBox =<< evalRequire modulePath alias
newtype SideEffectImport a = SideEffectImport { sideEffectImportFrom :: ImportPath }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 SideEffectImport where liftEq = genericLiftEq
instance Ord1 SideEffectImport where liftCompare = genericLiftCompare
@ -204,8 +223,8 @@ instance Evaluatable SideEffectImport where
-- | Qualified Export declarations
newtype QualifiedExport a = QualifiedExport { qualifiedExportSymbols :: [(Name, Name)] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype QualifiedExport a = QualifiedExport { qualifiedExportSymbols :: [Alias] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 QualifiedExport where liftEq = genericLiftEq
instance Ord1 QualifiedExport where liftCompare = genericLiftCompare
@ -214,14 +233,19 @@ instance Show1 QualifiedExport where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable QualifiedExport where
eval (QualifiedExport exportSymbols) = do
-- Insert the aliases with no addresses.
for_ exportSymbols $ \(name, alias) ->
export name alias Nothing
for_ exportSymbols $ \Alias{..} ->
export aliasValue aliasName Nothing
rvalBox unit
data Alias = Alias { aliasValue :: Name, aliasName :: Name }
deriving (Eq, Generic, Hashable, Ord, Show, Message, Named, ToJSON)
toTuple :: Alias -> (Name, Name)
toTuple Alias{..} = (aliasValue, aliasName)
-- | Qualified Export declarations that export from another module.
data QualifiedExportFrom a = QualifiedExportFrom { qualifiedExportFrom :: ImportPath, qualifiedExportFromSymbols :: ![(Name, Name)]}
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data QualifiedExportFrom a = QualifiedExportFrom { qualifiedExportFrom :: ImportPath, qualifiedExportFromSymbols :: ![Alias]}
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 QualifiedExportFrom where liftEq = genericLiftEq
instance Ord1 QualifiedExportFrom where liftCompare = genericLiftCompare
@ -232,13 +256,13 @@ instance Evaluatable QualifiedExportFrom where
modulePath <- resolveWithNodejsStrategy importPath typescriptExtensions
importedEnv <- snd <$> require modulePath
-- Look up addresses in importedEnv and insert the aliases with addresses into the exports.
for_ exportSymbols $ \(name, alias) -> do
let address = Env.lookup name importedEnv
maybe (throwEvalError $ ExportError modulePath name) (export name alias . Just) address
for_ exportSymbols $ \Alias{..} -> do
let address = Env.lookup aliasValue importedEnv
maybe (throwEvalError $ ExportError modulePath aliasValue) (export aliasValue aliasName . Just) address
rvalBox unit
newtype DefaultExport a = DefaultExport { defaultExport :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 DefaultExport where liftEq = genericLiftEq
instance Ord1 DefaultExport where liftCompare = genericLiftCompare
@ -259,7 +283,7 @@ instance Evaluatable DefaultExport where
-- | Lookup type for a type-level key in a typescript map.
data LookupType a = LookupType { lookupTypeIdentifier :: a, lookupTypeKey :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 LookupType where liftEq = genericLiftEq
instance Ord1 LookupType where liftCompare = genericLiftCompare
@ -267,64 +291,64 @@ instance Show1 LookupType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable LookupType
-- | ShorthandPropertyIdentifier used in object patterns such as var baz = { foo } to mean var baz = { foo: foo }
newtype ShorthandPropertyIdentifier a = ShorthandPropertyIdentifier T.Text
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype ShorthandPropertyIdentifier a = ShorthandPropertyIdentifier { contents :: T.Text }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ShorthandPropertyIdentifier where liftEq = genericLiftEq
instance Ord1 ShorthandPropertyIdentifier where liftCompare = genericLiftCompare
instance Show1 ShorthandPropertyIdentifier where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ShorthandPropertyIdentifier
data Union a = Union { _unionLeft :: !a, _unionRight :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data Union a = Union { unionLeft :: !a, unionRight :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Language.TypeScript.Syntax.Union where liftEq = genericLiftEq
instance Ord1 Language.TypeScript.Syntax.Union where liftCompare = genericLiftCompare
instance Show1 Language.TypeScript.Syntax.Union where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Language.TypeScript.Syntax.Union
data Intersection a = Intersection { _intersectionLeft :: !a, _intersectionRight :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data Intersection a = Intersection { intersectionLeft :: !a, intersectionRight :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Intersection where liftEq = genericLiftEq
instance Ord1 Intersection where liftCompare = genericLiftCompare
instance Show1 Intersection where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Intersection
data FunctionType a = FunctionType { _functionTypeParameters :: !a, _functionFormalParameters :: ![a], _functionType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data FunctionType a = FunctionType { functionTypeParameters :: !a, functionFormalParameters :: ![a], functionType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 FunctionType where liftEq = genericLiftEq
instance Ord1 FunctionType where liftCompare = genericLiftCompare
instance Show1 FunctionType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable FunctionType
data AmbientFunction a = AmbientFunction { _ambientFunctionContext :: ![a], _ambientFunctionIdentifier :: !a, _ambientFunctionParameters :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data AmbientFunction a = AmbientFunction { ambientFunctionContext :: ![a], ambientFunctionIdentifier :: !a, ambientFunctionParameters :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 AmbientFunction where liftEq = genericLiftEq
instance Ord1 AmbientFunction where liftCompare = genericLiftCompare
instance Show1 AmbientFunction where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable AmbientFunction
data ImportRequireClause a = ImportRequireClause { _importRequireIdentifier :: !a, _importRequireSubject :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data ImportRequireClause a = ImportRequireClause { importRequireIdentifier :: !a, importRequireSubject :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ImportRequireClause where liftEq = genericLiftEq
instance Ord1 ImportRequireClause where liftCompare = genericLiftCompare
instance Show1 ImportRequireClause where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ImportRequireClause
newtype ImportClause a = ImportClause { _importClauseElements :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype ImportClause a = ImportClause { importClauseElements :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ImportClause where liftEq = genericLiftEq
instance Ord1 ImportClause where liftCompare = genericLiftCompare
instance Show1 ImportClause where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ImportClause
newtype Tuple a = Tuple { _tupleElements :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype Tuple a = Tuple { tupleElements :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Tuple where liftEq = genericLiftEq
instance Ord1 Tuple where liftCompare = genericLiftCompare
@ -333,144 +357,144 @@ instance Show1 Tuple where liftShowsPrec = genericLiftShowsPrec
-- This is a tuple type, not a tuple value, so we can't lean on the shared Tuple value
instance Evaluatable Tuple
data Constructor a = Constructor { _constructorTypeParameters :: !a, _constructorFormalParameters :: ![a], _constructorType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data Constructor a = Constructor { constructorTypeParameters :: !a, constructorFormalParameters :: ![a], constructorType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Language.TypeScript.Syntax.Constructor where liftEq = genericLiftEq
instance Ord1 Language.TypeScript.Syntax.Constructor where liftCompare = genericLiftCompare
instance Show1 Language.TypeScript.Syntax.Constructor where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Language.TypeScript.Syntax.Constructor
data TypeParameter a = TypeParameter { _typeParameter :: !a, _typeParameterConstraint :: !a, _typeParameterDefaultType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data TypeParameter a = TypeParameter { typeParameter :: !a, typeParameterConstraint :: !a, typeParameterDefaultType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 TypeParameter where liftEq = genericLiftEq
instance Ord1 TypeParameter where liftCompare = genericLiftCompare
instance Show1 TypeParameter where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable TypeParameter
data TypeAssertion a = TypeAssertion { _typeAssertionParameters :: !a, _typeAssertionExpression :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data TypeAssertion a = TypeAssertion { typeAssertionParameters :: !a, typeAssertionExpression :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 TypeAssertion where liftEq = genericLiftEq
instance Ord1 TypeAssertion where liftCompare = genericLiftCompare
instance Show1 TypeAssertion where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable TypeAssertion
newtype Annotation a = Annotation { _annotationType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype Annotation a = Annotation { annotationType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Annotation where liftEq = genericLiftEq
instance Ord1 Annotation where liftCompare = genericLiftCompare
instance Show1 Annotation where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Annotation
newtype Decorator a = Decorator { _decoratorTerm :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype Decorator a = Decorator { decoratorTerm :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Decorator where liftEq = genericLiftEq
instance Ord1 Decorator where liftCompare = genericLiftCompare
instance Show1 Decorator where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Decorator
newtype ComputedPropertyName a = ComputedPropertyName a
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype ComputedPropertyName a = ComputedPropertyName { propertyName :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ComputedPropertyName where liftEq = genericLiftEq
instance Ord1 ComputedPropertyName where liftCompare = genericLiftCompare
instance Show1 ComputedPropertyName where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ComputedPropertyName
newtype Constraint a = Constraint { _constraintType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype Constraint a = Constraint { constraintType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Constraint where liftEq = genericLiftEq
instance Ord1 Constraint where liftCompare = genericLiftCompare
instance Show1 Constraint where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Constraint
newtype DefaultType a = DefaultType { _defaultType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype DefaultType a = DefaultType { defaultType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 DefaultType where liftEq = genericLiftEq
instance Ord1 DefaultType where liftCompare = genericLiftCompare
instance Show1 DefaultType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable DefaultType
newtype ParenthesizedType a = ParenthesizedType { _parenthesizedType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype ParenthesizedType a = ParenthesizedType { parenthesizedType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ParenthesizedType where liftEq = genericLiftEq
instance Ord1 ParenthesizedType where liftCompare = genericLiftCompare
instance Show1 ParenthesizedType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ParenthesizedType
newtype PredefinedType a = PredefinedType { _predefinedType :: T.Text }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype PredefinedType a = PredefinedType { predefinedType :: T.Text }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 PredefinedType where liftEq = genericLiftEq
instance Ord1 PredefinedType where liftCompare = genericLiftCompare
instance Show1 PredefinedType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable PredefinedType
newtype TypeIdentifier a = TypeIdentifier T.Text
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype TypeIdentifier a = TypeIdentifier { contents :: T.Text }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 TypeIdentifier where liftEq = genericLiftEq
instance Ord1 TypeIdentifier where liftCompare = genericLiftCompare
instance Show1 TypeIdentifier where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable TypeIdentifier
data NestedIdentifier a = NestedIdentifier !a !a
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data NestedIdentifier a = NestedIdentifier { left :: !a, right :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 NestedIdentifier where liftEq = genericLiftEq
instance Ord1 NestedIdentifier where liftCompare = genericLiftCompare
instance Show1 NestedIdentifier where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable NestedIdentifier
data NestedTypeIdentifier a = NestedTypeIdentifier !a !a
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data NestedTypeIdentifier a = NestedTypeIdentifier { left :: !a, right :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 NestedTypeIdentifier where liftEq = genericLiftEq
instance Ord1 NestedTypeIdentifier where liftCompare = genericLiftCompare
instance Show1 NestedTypeIdentifier where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable NestedTypeIdentifier
data GenericType a = GenericType { _genericTypeIdentifier :: !a, _genericTypeArguments :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data GenericType a = GenericType { genericTypeIdentifier :: !a, genericTypeArguments :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 GenericType where liftEq = genericLiftEq
instance Ord1 GenericType where liftCompare = genericLiftCompare
instance Show1 GenericType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable GenericType
data TypePredicate a = TypePredicate { _typePredicateIdentifier :: !a, _typePredicateType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data TypePredicate a = TypePredicate { typePredicateIdentifier :: !a, typePredicateType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 TypePredicate where liftEq = genericLiftEq
instance Ord1 TypePredicate where liftCompare = genericLiftCompare
instance Show1 TypePredicate where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable TypePredicate
newtype ObjectType a = ObjectType { _objectTypeElements :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype ObjectType a = ObjectType { objectTypeElements :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ObjectType where liftEq = genericLiftEq
instance Ord1 ObjectType where liftCompare = genericLiftCompare
instance Show1 ObjectType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ObjectType
data With a = With { _withExpression :: !a, _withBody :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data With a = With { withExpression :: !a, withBody :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 With where liftEq = genericLiftEq
instance Ord1 With where liftCompare = genericLiftCompare
instance Show1 With where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable With
newtype AmbientDeclaration a = AmbientDeclaration { _ambientDeclarationBody :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype AmbientDeclaration a = AmbientDeclaration { ambientDeclarationBody :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 AmbientDeclaration where liftEq = genericLiftEq
instance Ord1 AmbientDeclaration where liftCompare = genericLiftCompare
@ -479,8 +503,8 @@ instance Show1 AmbientDeclaration where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable AmbientDeclaration where
eval (AmbientDeclaration body) = subtermRef body
data EnumDeclaration a = EnumDeclaration { enumDeclarationIdentifier :: !a, _enumDeclarationBody :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data EnumDeclaration a = EnumDeclaration { enumDeclarationIdentifier :: !a, enumDeclarationBody :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 EnumDeclaration where liftEq = genericLiftEq
instance Ord1 EnumDeclaration where liftCompare = genericLiftCompare
@ -490,88 +514,88 @@ instance Evaluatable EnumDeclaration
instance Declarations a => Declarations (EnumDeclaration a) where
declaredName EnumDeclaration{..} = declaredName enumDeclarationIdentifier
newtype ExtendsClause a = ExtendsClause { _extendsClauses :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype ExtendsClause a = ExtendsClause { extendsClauses :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ExtendsClause where liftEq = genericLiftEq
instance Ord1 ExtendsClause where liftCompare = genericLiftCompare
instance Show1 ExtendsClause where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ExtendsClause
newtype ArrayType a = ArrayType { _arrayType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype ArrayType a = ArrayType { arrayType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ArrayType where liftEq = genericLiftEq
instance Ord1 ArrayType where liftCompare = genericLiftCompare
instance Show1 ArrayType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ArrayType
newtype FlowMaybeType a = FlowMaybeType { _flowMaybeType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype FlowMaybeType a = FlowMaybeType { flowMaybeType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 FlowMaybeType where liftEq = genericLiftEq
instance Ord1 FlowMaybeType where liftCompare = genericLiftCompare
instance Show1 FlowMaybeType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable FlowMaybeType
newtype TypeQuery a = TypeQuery { _typeQuerySubject :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype TypeQuery a = TypeQuery { typeQuerySubject :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 TypeQuery where liftEq = genericLiftEq
instance Ord1 TypeQuery where liftCompare = genericLiftCompare
instance Show1 TypeQuery where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable TypeQuery
newtype IndexTypeQuery a = IndexTypeQuery { _indexTypeQuerySubject :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype IndexTypeQuery a = IndexTypeQuery { indexTypeQuerySubject :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 IndexTypeQuery where liftEq = genericLiftEq
instance Ord1 IndexTypeQuery where liftCompare = genericLiftCompare
instance Show1 IndexTypeQuery where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable IndexTypeQuery
newtype TypeArguments a = TypeArguments { _typeArguments :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype TypeArguments a = TypeArguments { typeArguments :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 TypeArguments where liftEq = genericLiftEq
instance Ord1 TypeArguments where liftCompare = genericLiftCompare
instance Show1 TypeArguments where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable TypeArguments
newtype ThisType a = ThisType T.Text
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype ThisType a = ThisType { contents :: T.Text }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ThisType where liftEq = genericLiftEq
instance Ord1 ThisType where liftCompare = genericLiftCompare
instance Show1 ThisType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ThisType
newtype ExistentialType a = ExistentialType T.Text
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype ExistentialType a = ExistentialType { contents :: T.Text }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ExistentialType where liftEq = genericLiftEq
instance Ord1 ExistentialType where liftCompare = genericLiftCompare
instance Show1 ExistentialType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ExistentialType
newtype LiteralType a = LiteralType { _literalTypeSubject :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype LiteralType a = LiteralType { literalTypeSubject :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 LiteralType where liftEq = genericLiftEq
instance Ord1 LiteralType where liftCompare = genericLiftCompare
instance Show1 LiteralType where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable LiteralType
data PropertySignature a = PropertySignature { _modifiers :: ![a], _propertySignaturePropertyName :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data PropertySignature a = PropertySignature { modifiers :: ![a], propertySignaturePropertyName :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 PropertySignature where liftEq = genericLiftEq
instance Ord1 PropertySignature where liftCompare = genericLiftCompare
instance Show1 PropertySignature where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable PropertySignature
data CallSignature a = CallSignature { _callSignatureTypeParameters :: !a, _callSignatureParameters :: ![a], _callSignatureType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data CallSignature a = CallSignature { callSignatureTypeParameters :: !a, callSignatureParameters :: ![a], callSignatureType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 CallSignature where liftEq = genericLiftEq
instance Ord1 CallSignature where liftCompare = genericLiftCompare
@ -579,24 +603,24 @@ instance Show1 CallSignature where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable CallSignature
-- | Todo: Move type params and type to context
data ConstructSignature a = ConstructSignature { _constructSignatureTypeParameters :: !a, _constructSignatureParameters :: ![a], _constructSignatureType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data ConstructSignature a = ConstructSignature { constructSignatureTypeParameters :: !a, constructSignatureParameters :: ![a], constructSignatureType :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ConstructSignature where liftEq = genericLiftEq
instance Ord1 ConstructSignature where liftCompare = genericLiftCompare
instance Show1 ConstructSignature where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ConstructSignature
data IndexSignature a = IndexSignature { _indexSignatureSubject :: a, _indexSignatureType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data IndexSignature a = IndexSignature { indexSignatureSubject :: a, indexSignatureType :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 IndexSignature where liftEq = genericLiftEq
instance Ord1 IndexSignature where liftCompare = genericLiftCompare
instance Show1 IndexSignature where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable IndexSignature
data AbstractMethodSignature a = AbstractMethodSignature { _abstractMethodSignatureContext :: ![a], _abstractMethodSignatureName :: !a, _abstractMethodSignatureParameters :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data AbstractMethodSignature a = AbstractMethodSignature { abstractMethodSignatureContext :: ![a], abstractMethodSignatureName :: !a, abstractMethodSignatureParameters :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 AbstractMethodSignature where liftEq = genericLiftEq
instance Ord1 AbstractMethodSignature where liftCompare = genericLiftCompare
@ -604,15 +628,15 @@ instance Show1 AbstractMethodSignature where liftShowsPrec = genericLiftShowsPre
instance Evaluatable AbstractMethodSignature
data Debugger a = Debugger
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Debugger where liftEq = genericLiftEq
instance Ord1 Debugger where liftCompare = genericLiftCompare
instance Show1 Debugger where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Debugger
data ForOf a = ForOf { _forOfBinding :: !a, _forOfSubject :: !a, _forOfBody :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data ForOf a = ForOf { forOfBinding :: !a, forOfSubject :: !a, forOfBody :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ForOf where liftEq = genericLiftEq
instance Ord1 ForOf where liftCompare = genericLiftCompare
@ -620,23 +644,23 @@ instance Show1 ForOf where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ForOf
data This a = This
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 This where liftEq = genericLiftEq
instance Ord1 This where liftCompare = genericLiftCompare
instance Show1 This where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable This
data LabeledStatement a = LabeledStatement { _labeledStatementIdentifier :: !a, _labeledStatementSubject :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data LabeledStatement a = LabeledStatement { labeledStatementIdentifier :: !a, labeledStatementSubject :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 LabeledStatement where liftEq = genericLiftEq
instance Ord1 LabeledStatement where liftCompare = genericLiftCompare
instance Show1 LabeledStatement where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable LabeledStatement
newtype Update a = Update { _updateSubject :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype Update a = Update { updateSubject :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Update where liftEq = genericLiftEq
instance Ord1 Update where liftCompare = genericLiftCompare
@ -644,7 +668,7 @@ instance Show1 Update where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Update
data Module a = Module { moduleIdentifier :: !a, moduleStatements :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Module where liftEq = genericLiftEq
instance Ord1 Module where liftCompare = genericLiftCompare
@ -657,9 +681,8 @@ instance Evaluatable Module where
value =<< (eval xs <* makeNamespace name addr Nothing))
data InternalModule a = InternalModule { internalModuleIdentifier :: !a, internalModuleStatements :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 InternalModule where liftEq = genericLiftEq
instance Ord1 InternalModule where liftCompare = genericLiftCompare
@ -675,8 +698,8 @@ instance Declarations a => Declarations (InternalModule a) where
declaredName InternalModule{..} = declaredName internalModuleIdentifier
data ImportAlias a = ImportAlias { _importAliasSubject :: !a, _importAlias :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data ImportAlias a = ImportAlias { importAliasSubject :: !a, importAlias :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ImportAlias where liftEq = genericLiftEq
instance Ord1 ImportAlias where liftCompare = genericLiftCompare
@ -684,7 +707,7 @@ instance Show1 ImportAlias where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ImportAlias
data Super a = Super
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Super where liftEq = genericLiftEq
instance Ord1 Super where liftCompare = genericLiftCompare
@ -692,23 +715,23 @@ instance Show1 Super where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Super
data Undefined a = Undefined
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 Undefined where liftEq = genericLiftEq
instance Ord1 Undefined where liftCompare = genericLiftCompare
instance Show1 Undefined where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Undefined
data ClassHeritage a = ClassHeritage { _classHeritageExtendsClause :: !a, _implementsClause :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data ClassHeritage a = ClassHeritage { classHeritageExtendsClause :: !a, implementsClause :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ClassHeritage where liftEq = genericLiftEq
instance Ord1 ClassHeritage where liftCompare = genericLiftCompare
instance Show1 ClassHeritage where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ClassHeritage
data AbstractClass a = AbstractClass { abstractClassIdentifier :: !a, _abstractClassTypeParameters :: !a, classHeritage :: ![a], classBody :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data AbstractClass a = AbstractClass { abstractClassIdentifier :: !a, abstractClassTypeParameters :: !a, classHeritage :: ![a], classBody :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 AbstractClass where liftEq = genericLiftEq
instance Ord1 AbstractClass where liftCompare = genericLiftCompare
@ -727,104 +750,104 @@ instance Evaluatable AbstractClass where
rvalBox =<< (v <$ bind name addr)
data JsxElement a = JsxElement { _jsxOpeningElement :: !a, _jsxElements :: ![a], _jsxClosingElement :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data JsxElement a = JsxElement { jsxOpeningElement :: !a, jsxElements :: ![a], jsxClosingElement :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 JsxElement where liftEq = genericLiftEq
instance Ord1 JsxElement where liftCompare = genericLiftCompare
instance Show1 JsxElement where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable JsxElement
newtype JsxText a = JsxText T.Text
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype JsxText a = JsxText { contents :: T.Text }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 JsxText where liftEq = genericLiftEq
instance Ord1 JsxText where liftCompare = genericLiftCompare
instance Show1 JsxText where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable JsxText
newtype JsxExpression a = JsxExpression { _jsxExpression :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype JsxExpression a = JsxExpression { jsxExpression :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 JsxExpression where liftEq = genericLiftEq
instance Ord1 JsxExpression where liftCompare = genericLiftCompare
instance Show1 JsxExpression where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable JsxExpression
data JsxOpeningElement a = JsxOpeningElement { _jsxOpeningElementIdentifier :: !a, _jsxAttributes :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data JsxOpeningElement a = JsxOpeningElement { jsxOpeningElementIdentifier :: !a, jsxAttributes :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 JsxOpeningElement where liftEq = genericLiftEq
instance Ord1 JsxOpeningElement where liftCompare = genericLiftCompare
instance Show1 JsxOpeningElement where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable JsxOpeningElement
newtype JsxClosingElement a = JsxClosingElement { _jsxClosingElementIdentifier :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype JsxClosingElement a = JsxClosingElement { jsxClosingElementIdentifier :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 JsxClosingElement where liftEq = genericLiftEq
instance Ord1 JsxClosingElement where liftCompare = genericLiftCompare
instance Show1 JsxClosingElement where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable JsxClosingElement
data JsxSelfClosingElement a = JsxSelfClosingElement { _jsxSelfClosingElementIdentifier :: !a, _jsxSelfClosingElementAttributes :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data JsxSelfClosingElement a = JsxSelfClosingElement { jsxSelfClosingElementIdentifier :: !a, jsxSelfClosingElementAttributes :: ![a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 JsxSelfClosingElement where liftEq = genericLiftEq
instance Ord1 JsxSelfClosingElement where liftCompare = genericLiftCompare
instance Show1 JsxSelfClosingElement where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable JsxSelfClosingElement
data JsxAttribute a = JsxAttribute { _jsxAttributeTarget :: !a, _jsxAttributeValue :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data JsxAttribute a = JsxAttribute { jsxAttributeTarget :: !a, jsxAttributeValue :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 JsxAttribute where liftEq = genericLiftEq
instance Ord1 JsxAttribute where liftCompare = genericLiftCompare
instance Show1 JsxAttribute where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable JsxAttribute
newtype ImplementsClause a = ImplementsClause { _implementsClauseTypes :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype ImplementsClause a = ImplementsClause { implementsClauseTypes :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 ImplementsClause where liftEq = genericLiftEq
instance Ord1 ImplementsClause where liftCompare = genericLiftCompare
instance Show1 ImplementsClause where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ImplementsClause
data OptionalParameter a = OptionalParameter { _optionalParameterContext :: ![a], _optionalParameterSubject :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data OptionalParameter a = OptionalParameter { optionalParameterContext :: ![a], optionalParameterSubject :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 OptionalParameter where liftEq = genericLiftEq
instance Ord1 OptionalParameter where liftCompare = genericLiftCompare
instance Show1 OptionalParameter where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable OptionalParameter
data RequiredParameter a = RequiredParameter { _requiredParameterContext :: ![a], _requiredParameterSubject :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data RequiredParameter a = RequiredParameter { requiredParameterContext :: ![a], requiredParameterSubject :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 RequiredParameter where liftEq = genericLiftEq
instance Ord1 RequiredParameter where liftCompare = genericLiftCompare
instance Show1 RequiredParameter where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable RequiredParameter
data RestParameter a = RestParameter { _restParameterContext :: ![a], _restParameterSubject :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data RestParameter a = RestParameter { restParameterContext :: ![a], restParameterSubject :: !a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 RestParameter where liftEq = genericLiftEq
instance Ord1 RestParameter where liftCompare = genericLiftCompare
instance Show1 RestParameter where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable RestParameter
newtype JsxFragment a = JsxFragment [a]
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
newtype JsxFragment a = JsxFragment { terms :: [a] }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 JsxFragment where liftEq = genericLiftEq
instance Ord1 JsxFragment where liftCompare = genericLiftCompare
instance Show1 JsxFragment where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable JsxFragment
data JsxNamespaceName a = JsxNamespaceName a a
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
data JsxNamespaceName a = JsxNamespaceName { left :: a, right :: a }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Message1, Named1, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 JsxNamespaceName where liftEq = genericLiftEq
instance Ord1 JsxNamespaceName where liftCompare = genericLiftCompare

View File

@ -3,6 +3,8 @@ module Parsing.Parser
( Parser(..)
, SomeTerm(..)
, withSomeTerm
, SomeSyntaxTerm
, withSomeSyntaxTerm
, SomeAnalysisParser(..)
, SomeASTParser(..)
, someParser
@ -188,6 +190,11 @@ data SomeTerm typeclasses ann where
withSomeTerm :: (forall syntax . ApplyAll typeclasses syntax => Term syntax ann -> a) -> SomeTerm typeclasses ann -> a
withSomeTerm with (SomeTerm term) = with term
data SomeSyntaxTerm syntax ann where
SomeSyntaxTerm :: Term syntax ann -> SomeSyntaxTerm syntax ann
withSomeSyntaxTerm :: (forall syntax . Term syntax ann -> a) -> SomeSyntaxTerm syntax ann -> a
withSomeSyntaxTerm with (SomeSyntaxTerm term) = with term
-- | A parser for producing specialized (tree-sitter) ASTs.
data SomeASTParser where

View File

@ -17,6 +17,8 @@ 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
runParse :: (Member (Distribute WrappedTask) effs, Member Task effs) => TermRenderer output -> [Blob] -> Eff effs Builder
runParse JSONTermRenderer = withParsedBlobs (render . renderJSONTerm) >=> serialize JSON
@ -25,11 +27,21 @@ runParse ShowTermRenderer = withParsedBlobs (const (serialize Show))
runParse (SymbolsTermRenderer fields) = withParsedBlobs (\ blob -> decorate (declarationAlgebra blob) >=> render (renderSymbolTerms . renderToSymbols fields blob)) >=> serialize JSON
runParse DOTTermRenderer = withParsedBlobs (const (render renderTreeGraph)) >=> serialize (DOT (termStyle "terms"))
runRawParse :: Member (Distribute WrappedTask) effs => [Blob] -> Eff effs [Term (Sum Ruby.Syntax) ()]
runRawParse = flip distributeFor (\ blob -> WrapTask (do
runRubyParse :: Member (Distribute WrappedTask) effs => [Blob] -> Eff effs [Term (Sum Ruby.Syntax) ()]
runRubyParse = flip distributeFor (\ blob -> WrapTask (do
term <- parse rubyParser blob
pure (() <$ term)))
runTypeScriptParse :: Member (Distribute WrappedTask) effs => [Blob] -> Eff effs [Term (Sum TypeScript.Syntax) ()]
runTypeScriptParse = flip distributeFor (\ blob -> WrapTask (do
term <- parse typescriptParser blob
pure (() <$ term)))
runJSONParse :: Member (Distribute WrappedTask) effs => [Blob] -> Eff effs [Term (Sum JSON.Syntax) ()]
runJSONParse = flip distributeFor (\ blob -> WrapTask (do
term <- parse jsonParser blob
pure (() <$ term)))
withParsedBlobs :: (Member (Distribute WrappedTask) effs, Monoid output) => (forall syntax . (ConstructorName syntax, Foldable syntax, Functor syntax, HasDeclaration syntax, HasPackageDef syntax, Show1 syntax, ToJSONFields1 syntax) => Blob -> Term syntax (Record Location) -> TaskEff output) -> [Blob] -> Eff effs output
withParsedBlobs render = distributeFoldMap (\ blob -> WrapTask (parseSomeBlob blob >>= withSomeTerm (render blob)))

View File

@ -63,6 +63,7 @@ import Data.ByteString.Builder
import Data.Diff
import qualified Data.Error as Error
import Data.Record
import Data.Source (Source)
import Data.Sum
import qualified Data.Syntax as Syntax
import Data.Term
@ -195,53 +196,8 @@ runParser blob@Blob{..} parser = case parser of
parseToAST (configTreeSitterParseTimeout config) language blob
>>= maybeM (throwError (SomeException ParserTimedOut))
AssignmentParser parser assignment -> do
ast <- runParser blob parser `catchError` \ (SomeException err) -> do
writeStat (increment "parse.parse_failures" languageTag)
writeLog Error "failed parsing" (("task", "parse") : blobFields)
throwError (toException err)
config <- ask
time "parse.assign" languageTag $
case Assignment.assign blobSource assignment ast of
Left err -> do
writeStat (increment "parse.assign_errors" languageTag)
logError config Error blob err (("task", "assign") : blobFields)
throwError (toException err)
Right term -> do
for_ (errors term) $ \ err -> case Error.errorActual err of
Just "ParseError" -> do
writeStat (increment "parse.parse_errors" languageTag)
logError config Warning blob err (("task", "parse") : blobFields)
_ -> do
writeStat (increment "parse.assign_warnings" languageTag)
logError config Warning blob err (("task", "assign") : blobFields)
when (optionsFailOnWarning (configOptions config)) $ throwError (toException err)
writeStat (count "parse.nodes" (length term) languageTag)
pure term
DeterministicParser parser assignment -> do
ast <- runParser blob parser `catchError` \ (SomeException err) -> do
writeStat (increment "parse.parse_failures" languageTag)
writeLog Error "failed parsing" (("task", "parse") : blobFields)
throwError (toException err)
config <- ask
time "parse.assign_deterministic" languageTag $
case Deterministic.assign assignment blobSource ast of
Left err -> do
writeStat (increment "parse.assign_deterministic_errors" languageTag)
logError config Error blob err (("task", "assign") : blobFields)
throwError (toException err)
Right term -> do
for_ (errors term) $ \ err -> case Error.errorActual err of
Just "ParseError" -> do
writeStat (increment "parse.parse_errors" languageTag)
logError config Warning blob err (("task", "parse") : blobFields)
_ -> do
writeStat (increment "parse.assign_deterministic_warnings" languageTag)
logError config Warning blob err (("task", "assign") : blobFields)
when (optionsFailOnWarning (configOptions config)) $ throwError (toException err)
writeStat (count "parse.nodes" (length term) languageTag)
pure term
AssignmentParser parser assignment -> runAssignment Assignment.assign parser assignment
DeterministicParser parser assignment -> runAssignment Deterministic.assign parser assignment
MarkdownParser ->
time "parse.cmark_parse" languageTag $
@ -254,3 +210,38 @@ runParser blob@Blob{..} parser = case parser of
errors = cata $ \ (In a syntax) -> case syntax of
_ | Just err@Syntax.Error{} <- project syntax -> [Syntax.unError (getField a) err]
_ -> fold syntax
runAssignment :: ( Apply Foldable syntaxes
, Apply Functor syntaxes
, Element Syntax.Error syntaxes
, Member (Exc SomeException) effs
, Member IO effs
, Member (Reader Config) effs
, Member Telemetry effs
, Member Trace effs
)
=> (Source -> assignment (Term (Sum syntaxes) (Record Assignment.Location)) -> ast -> Either (Error.Error String) (Term (Sum syntaxes) (Record Assignment.Location)))
-> Parser ast
-> assignment (Term (Sum syntaxes) (Record Assignment.Location))
-> Eff effs (Term (Sum syntaxes) (Record Assignment.Location))
runAssignment assign parser assignment = do
ast <- runParser blob parser `catchError` \ (SomeException err) -> do
writeStat (increment "parse.parse_failures" languageTag)
writeLog Error "failed parsing" (("task", "parse") : blobFields)
throwError (toException err)
config <- ask
time "parse.assign" languageTag $
case assign blobSource assignment ast of
Left err -> do
writeStat (increment "parse.assign_errors" languageTag)
logError config Error blob err (("task", "assign") : blobFields)
throwError (toException err)
Right term -> do
for_ (errors term) $ \ err -> case Error.errorActual err of
Just "ParseError" -> do
writeStat (increment "parse.parse_errors" languageTag)
logError config Warning blob err (("task", "parse") : blobFields)
_ -> do
writeStat (increment "parse.assign_warnings" languageTag)
logError config Warning blob err (("task", "assign") : blobFields)
when (optionsFailOnWarning (configOptions config)) $ throwError (toException err)
term <$ writeStat (count "parse.nodes" (length term) languageTag)

View File

@ -21,8 +21,8 @@ shouldRoundtrip :: (Eq a, Show a, Message a) => a -> Expectation
shouldRoundtrip a = go a `shouldBe` Right a
where go = fromByteString . L.toStrict . toLazyByteString
shouldRoundtrip' :: forall f a. (Show (f a), Eq (f a), Show1 f, Eq1 f, Eq a, Show a, Message1 f, Message a) => f a -> Expectation
shouldRoundtrip' a = go a `shouldBe` Right a
shouldRoundtrip1 :: forall f a. (Show (f a), Eq (f a), Show1 f, Eq1 f, Eq a, Show a, Message1 f, Message a) => f a -> Expectation
shouldRoundtrip1 a = go a `shouldBe` Right a
where go = fromByteString1 . L.toStrict . toLazyByteString1
spec :: Spec
@ -33,19 +33,19 @@ spec = parallel $ do
describe "nulls" $
prop "roundtrips" $
\sp -> shouldRoundtrip' @Literal.Null @(Term (Sum Syntax) ()) (unListableF sp)
\sp -> shouldRoundtrip1 @Literal.Null @(Term (Sum Syntax) ()) (unListableF sp)
describe "text elements" $
prop "roundtrips" $
\sp -> shouldRoundtrip' @Literal.TextElement @(Term (Sum Syntax) ()) (unListableF sp)
\sp -> shouldRoundtrip1 @Literal.TextElement @(Term (Sum Syntax) ()) (unListableF sp)
describe "floats" $
prop "roundtrips" $
\sp -> shouldRoundtrip' @Literal.Float @(Term (Sum Syntax) ()) (unListableF sp)
\sp -> shouldRoundtrip1 @Literal.Float @(Term (Sum Syntax) ()) (unListableF sp)
describe "booleans" $
prop "roundtrips" $
\sp -> shouldRoundtrip' @Literal.Boolean @(Term (Sum Syntax) ()) (unListableF sp)
\sp -> shouldRoundtrip1 @Literal.Boolean @(Term (Sum Syntax) ()) (unListableF sp)
describe "terms of syntax" $
prop "roundtrips" $
@ -53,19 +53,19 @@ spec = parallel $ do
describe "arrays" $
prop "roundtrips" $
\sp -> shouldRoundtrip' @Literal.Array @(Term (Sum Syntax) ()) (unListableF sp)
\sp -> shouldRoundtrip1 @Literal.Array @(Term (Sum Syntax) ()) (unListableF sp)
describe "key values" $
prop "roundtrips" $
\sp -> shouldRoundtrip' @Literal.KeyValue @(Term (Sum Syntax) ()) (unListableF sp)
\sp -> shouldRoundtrip1 @Literal.KeyValue @(Term (Sum Syntax) ()) (unListableF sp)
describe "statements" $
prop "roundtrips" $
\sp -> shouldRoundtrip @(Term (Sum '[Statement.Statements, Literal.Null]) ()) (unListableF sp)
\sp -> shouldRoundtrip @(Term (Sum Syntax) ()) (unListableF sp)
describe "statements1" $
prop "roundtrips" $
\sp -> shouldRoundtrip' @Statement.Statements @(Term (Sum '[Statement.Statements, Literal.Null]) ()) (unListableF sp)
\sp -> shouldRoundtrip1 @Statement.Statements @(Term (Sum Syntax) ()) (unListableF sp)
describe "blobs" $ do
it "should roundtrip given a Message instance" $ do

View File

@ -3,8 +3,7 @@
{+(QualifiedAliasedImport
{+(Identifier)+})+}
{+(Import)+}
{ (Import)
->(Import) }
{+(Import)+}
{+(Import)+}
{+(Statements
{+(Import)+}
@ -14,6 +13,7 @@
{+(QualifiedAliasedImport
{+(Identifier)+})+})+}
{+(SideEffectImport)+}
{-(Import)-}
{-(QualifiedAliasedImport
{-(Identifier)-})-}
{-(Import)-}

View File

@ -3,8 +3,7 @@
{+(QualifiedAliasedImport
{+(Identifier)+})+}
{+(Import)+}
{ (Import)
->(Import) }
{+(Import)+}
{+(Import)+}
{+(Statements
{+(Import)+}
@ -14,10 +13,9 @@
{+(QualifiedAliasedImport
{+(Identifier)+})+})+}
{+(SideEffectImport)+}
{+(QualifiedAliasedImport
{+(Identifier)+})+}
{-(QualifiedAliasedImport
{-(Identifier)-})-}
{+(QualifiedAliasedImport{+(Identifier)+})+}
{-(Import)-}
{-(QualifiedAliasedImport{-(Identifier)-})-}
{-(Import)-}
{-(Import)-}
{-(Import)-}

2
vendor/grpc-haskell vendored

@ -1 +1 @@
Subproject commit 9cf03f1f54d912ac21e8d45b5fcc03d9de957414
Subproject commit 2e6c99bb2512548b59505631b6c89e489b92e638