summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-02-26 12:32:18 +0100
committerPéter Diviánszky <divipp@gmail.com>2016-02-26 12:32:18 +0100
commit5ea5e05a87c76d80194dbdfac177994aa870b783 (patch)
treebc1c27ab28fa248b343c13e949caa3ab9a3caaa9
parentc0d38528840c15998c02ef8e04a0a7b7be34ad5d (diff)
add Range type
-rw-r--r--ddl/Definitions.hs9
-rw-r--r--ddl/out/LambdaCube.IR.cpp2
-rw-r--r--ddl/out/LambdaCube.IR.hpp2
-rw-r--r--ddl/out/LambdaCube.IR.hs2
-rw-r--r--ddl/out/LambdaCube.IR.purs2
-rw-r--r--ddl/out/LambdaCube.IR.swift2
-rw-r--r--ddl/out/LambdaCube.IR2.hpp2
-rw-r--r--ddl/out/LambdaCube.Mesh.cpp2
-rw-r--r--ddl/out/LambdaCube.Mesh.hpp2
-rw-r--r--ddl/out/LambdaCube.Mesh.hs2
-rw-r--r--ddl/out/LambdaCube.Mesh.purs2
-rw-r--r--ddl/out/LambdaCube.Mesh.swift2
-rw-r--r--ddl/out/LambdaCube.Mesh2.hpp2
-rw-r--r--ddl/out/LambdaCube.PipelineSchema.cpp2
-rw-r--r--ddl/out/LambdaCube.PipelineSchema.hpp2
-rw-r--r--ddl/out/LambdaCube.PipelineSchema.hs2
-rw-r--r--ddl/out/LambdaCube.PipelineSchema.purs2
-rw-r--r--ddl/out/LambdaCube.PipelineSchema.swift2
-rw-r--r--ddl/out/LambdaCube.PipelineSchema2.hpp2
-rw-r--r--ddl/out/LambdaCube.TypeInfo.cpp47
-rw-r--r--ddl/out/LambdaCube.TypeInfo.hpp21
-rw-r--r--ddl/out/LambdaCube.TypeInfo.hs47
-rw-r--r--ddl/out/LambdaCube.TypeInfo.purs46
-rw-r--r--ddl/out/LambdaCube.TypeInfo.swift32
-rw-r--r--ddl/out/LambdaCube.TypeInfo2.hpp17
-rw-r--r--ddl/out/TestData.cpp2
-rw-r--r--ddl/out/TestData.hpp2
-rw-r--r--ddl/out/TestData.hs2
-rw-r--r--ddl/out/TestData.purs2
-rw-r--r--ddl/out/TestData.swift2
-rw-r--r--ddl/out/TestData2.hpp2
31 files changed, 197 insertions, 70 deletions
diff --git a/ddl/Definitions.hs b/ddl/Definitions.hs
index 04f461c..1849ed2 100644
--- a/ddl/Definitions.hs
+++ b/ddl/Definitions.hs
@@ -459,12 +459,17 @@ mesh = do
459 ] 459 ]
460 460
461typeInfo = do 461typeInfo = do
462 data_ "TypeInfo" $ do 462 data_ "Range" $ do
463 constR_ "TypeInfo" 463 constR_ "Range"
464 [ "startLine" #:: Int 464 [ "startLine" #:: Int
465 , "startColumn" #:: Int 465 , "startColumn" #:: Int
466 , "endLine" #:: Int 466 , "endLine" #:: Int
467 , "endColumn" #:: Int 467 , "endColumn" #:: Int
468 ]
469
470 data_ "TypeInfo" $ do
471 constR_ "TypeInfo"
472 [ "range" #:: "Range"
468 , "text" #:: String 473 , "text" #:: String
469 ] 474 ]
470 475
diff --git a/ddl/out/LambdaCube.IR.cpp b/ddl/out/LambdaCube.IR.cpp
index 67e5f0d..dfe47f8 100644
--- a/ddl/out/LambdaCube.IR.cpp
+++ b/ddl/out/LambdaCube.IR.cpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:56.948155000000Z 2// 2016-02-26T11:29:11.442441000000Z
3 3
4#include "LambdaCube.IR.hpp" 4#include "LambdaCube.IR.hpp"
5template<> json toJSON<std::shared_ptr<ArrayValue>>(std::shared_ptr<ArrayValue> &v) { 5template<> json toJSON<std::shared_ptr<ArrayValue>>(std::shared_ptr<ArrayValue> &v) {
diff --git a/ddl/out/LambdaCube.IR.hpp b/ddl/out/LambdaCube.IR.hpp
index fa8f583..6e10c94 100644
--- a/ddl/out/LambdaCube.IR.hpp
+++ b/ddl/out/LambdaCube.IR.hpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:56.948155000000Z 2// 2016-02-26T11:29:11.442441000000Z
3 3
4#ifndef HEADER_LambdaCube.IR_H 4#ifndef HEADER_LambdaCube.IR_H
5#define HEADER_LambdaCube.IR_H 5#define HEADER_LambdaCube.IR_H
diff --git a/ddl/out/LambdaCube.IR.hs b/ddl/out/LambdaCube.IR.hs
index b1ab3ce..0bed2ec 100644
--- a/ddl/out/LambdaCube.IR.hs
+++ b/ddl/out/LambdaCube.IR.hs
@@ -1,5 +1,5 @@
1-- generated file, do not modify! 1-- generated file, do not modify!
2-- 2016-02-26T10:42:56.948155000000Z 2-- 2016-02-26T11:29:11.442441000000Z
3 3
4{-# LANGUAGE OverloadedStrings, RecordWildCards #-} 4{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
5module LambdaCube.IR where 5module LambdaCube.IR where
diff --git a/ddl/out/LambdaCube.IR.purs b/ddl/out/LambdaCube.IR.purs
index f21a121..ac7e585 100644
--- a/ddl/out/LambdaCube.IR.purs
+++ b/ddl/out/LambdaCube.IR.purs
@@ -1,5 +1,5 @@
1-- generated file, do not modify! 1-- generated file, do not modify!
2-- 2016-02-26T10:42:56.948155000000Z 2-- 2016-02-26T11:29:11.442441000000Z
3 3
4module LambdaCube.IR where 4module LambdaCube.IR where
5import Prelude 5import Prelude
diff --git a/ddl/out/LambdaCube.IR.swift b/ddl/out/LambdaCube.IR.swift
index 2b55d76..6aa412d 100644
--- a/ddl/out/LambdaCube.IR.swift
+++ b/ddl/out/LambdaCube.IR.swift
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:56.948155000000Z 2// 2016-02-26T11:29:11.442441000000Z
3 3
4typealias StreamName = Int 4typealias StreamName = Int
5 5
diff --git a/ddl/out/LambdaCube.IR2.hpp b/ddl/out/LambdaCube.IR2.hpp
index cad7c73..6564ba1 100644
--- a/ddl/out/LambdaCube.IR2.hpp
+++ b/ddl/out/LambdaCube.IR2.hpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:56.948155000000Z 2// 2016-02-26T11:29:11.442441000000Z
3 3
4#ifndef HEADER_LambdaCube.IR_H 4#ifndef HEADER_LambdaCube.IR_H
5#define HEADER_LambdaCube.IR_H 5#define HEADER_LambdaCube.IR_H
diff --git a/ddl/out/LambdaCube.Mesh.cpp b/ddl/out/LambdaCube.Mesh.cpp
index a2e34cb..25ea594 100644
--- a/ddl/out/LambdaCube.Mesh.cpp
+++ b/ddl/out/LambdaCube.Mesh.cpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.342809000000Z 2// 2016-02-26T11:29:11.794796000000Z
3 3
4#include "LambdaCube.Mesh.hpp" 4#include "LambdaCube.Mesh.hpp"
5template<> json toJSON<std::shared_ptr<MeshAttribute>>(std::shared_ptr<MeshAttribute> &v) { 5template<> json toJSON<std::shared_ptr<MeshAttribute>>(std::shared_ptr<MeshAttribute> &v) {
diff --git a/ddl/out/LambdaCube.Mesh.hpp b/ddl/out/LambdaCube.Mesh.hpp
index 383ccea..9f84d29 100644
--- a/ddl/out/LambdaCube.Mesh.hpp
+++ b/ddl/out/LambdaCube.Mesh.hpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.342809000000Z 2// 2016-02-26T11:29:11.794796000000Z
3 3
4#ifndef HEADER_LambdaCube.Mesh_H 4#ifndef HEADER_LambdaCube.Mesh_H
5#define HEADER_LambdaCube.Mesh_H 5#define HEADER_LambdaCube.Mesh_H
diff --git a/ddl/out/LambdaCube.Mesh.hs b/ddl/out/LambdaCube.Mesh.hs
index 340570e..0a25a4d 100644
--- a/ddl/out/LambdaCube.Mesh.hs
+++ b/ddl/out/LambdaCube.Mesh.hs
@@ -1,5 +1,5 @@
1-- generated file, do not modify! 1-- generated file, do not modify!
2-- 2016-02-26T10:42:57.342809000000Z 2-- 2016-02-26T11:29:11.794796000000Z
3 3
4{-# LANGUAGE OverloadedStrings, RecordWildCards #-} 4{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
5module LambdaCube.Mesh where 5module LambdaCube.Mesh where
diff --git a/ddl/out/LambdaCube.Mesh.purs b/ddl/out/LambdaCube.Mesh.purs
index 517d76b..c80739d 100644
--- a/ddl/out/LambdaCube.Mesh.purs
+++ b/ddl/out/LambdaCube.Mesh.purs
@@ -1,5 +1,5 @@
1-- generated file, do not modify! 1-- generated file, do not modify!
2-- 2016-02-26T10:42:57.342809000000Z 2-- 2016-02-26T11:29:11.794796000000Z
3 3
4module LambdaCube.Mesh where 4module LambdaCube.Mesh where
5import Prelude 5import Prelude
diff --git a/ddl/out/LambdaCube.Mesh.swift b/ddl/out/LambdaCube.Mesh.swift
index d469011..92b35b1 100644
--- a/ddl/out/LambdaCube.Mesh.swift
+++ b/ddl/out/LambdaCube.Mesh.swift
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.342809000000Z 2// 2016-02-26T11:29:11.794796000000Z
3 3
4enum MeshAttribute { 4enum MeshAttribute {
5 case A_Float(Array<Float>) 5 case A_Float(Array<Float>)
diff --git a/ddl/out/LambdaCube.Mesh2.hpp b/ddl/out/LambdaCube.Mesh2.hpp
index 855fafa..960b61a 100644
--- a/ddl/out/LambdaCube.Mesh2.hpp
+++ b/ddl/out/LambdaCube.Mesh2.hpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.342809000000Z 2// 2016-02-26T11:29:11.794796000000Z
3 3
4#ifndef HEADER_LambdaCube.Mesh_H 4#ifndef HEADER_LambdaCube.Mesh_H
5#define HEADER_LambdaCube.Mesh_H 5#define HEADER_LambdaCube.Mesh_H
diff --git a/ddl/out/LambdaCube.PipelineSchema.cpp b/ddl/out/LambdaCube.PipelineSchema.cpp
index 9161ceb..1d4b81a 100644
--- a/ddl/out/LambdaCube.PipelineSchema.cpp
+++ b/ddl/out/LambdaCube.PipelineSchema.cpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.323154000000Z 2// 2016-02-26T11:29:11.775644000000Z
3 3
4#include "LambdaCube.PipelineSchema.hpp" 4#include "LambdaCube.PipelineSchema.hpp"
5template<> json toJSON<std::shared_ptr<StreamType>>(std::shared_ptr<StreamType> &v) { 5template<> json toJSON<std::shared_ptr<StreamType>>(std::shared_ptr<StreamType> &v) {
diff --git a/ddl/out/LambdaCube.PipelineSchema.hpp b/ddl/out/LambdaCube.PipelineSchema.hpp
index 4ed14d4..16a0f8d 100644
--- a/ddl/out/LambdaCube.PipelineSchema.hpp
+++ b/ddl/out/LambdaCube.PipelineSchema.hpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.323154000000Z 2// 2016-02-26T11:29:11.775644000000Z
3 3
4#ifndef HEADER_LambdaCube.PipelineSchema_H 4#ifndef HEADER_LambdaCube.PipelineSchema_H
5#define HEADER_LambdaCube.PipelineSchema_H 5#define HEADER_LambdaCube.PipelineSchema_H
diff --git a/ddl/out/LambdaCube.PipelineSchema.hs b/ddl/out/LambdaCube.PipelineSchema.hs
index 5f6822b..55ae6f8 100644
--- a/ddl/out/LambdaCube.PipelineSchema.hs
+++ b/ddl/out/LambdaCube.PipelineSchema.hs
@@ -1,5 +1,5 @@
1-- generated file, do not modify! 1-- generated file, do not modify!
2-- 2016-02-26T10:42:57.323154000000Z 2-- 2016-02-26T11:29:11.775644000000Z
3 3
4{-# LANGUAGE OverloadedStrings, RecordWildCards #-} 4{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
5module LambdaCube.PipelineSchema where 5module LambdaCube.PipelineSchema where
diff --git a/ddl/out/LambdaCube.PipelineSchema.purs b/ddl/out/LambdaCube.PipelineSchema.purs
index 258744a..eb467b2 100644
--- a/ddl/out/LambdaCube.PipelineSchema.purs
+++ b/ddl/out/LambdaCube.PipelineSchema.purs
@@ -1,5 +1,5 @@
1-- generated file, do not modify! 1-- generated file, do not modify!
2-- 2016-02-26T10:42:57.323154000000Z 2-- 2016-02-26T11:29:11.775644000000Z
3 3
4module LambdaCube.PipelineSchema where 4module LambdaCube.PipelineSchema where
5import Prelude 5import Prelude
diff --git a/ddl/out/LambdaCube.PipelineSchema.swift b/ddl/out/LambdaCube.PipelineSchema.swift
index 6019917..93ed8ef 100644
--- a/ddl/out/LambdaCube.PipelineSchema.swift
+++ b/ddl/out/LambdaCube.PipelineSchema.swift
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.323154000000Z 2// 2016-02-26T11:29:11.775644000000Z
3 3
4enum StreamType { 4enum StreamType {
5 case Attribute_Word 5 case Attribute_Word
diff --git a/ddl/out/LambdaCube.PipelineSchema2.hpp b/ddl/out/LambdaCube.PipelineSchema2.hpp
index fbf04ff..585da42 100644
--- a/ddl/out/LambdaCube.PipelineSchema2.hpp
+++ b/ddl/out/LambdaCube.PipelineSchema2.hpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.323154000000Z 2// 2016-02-26T11:29:11.775644000000Z
3 3
4#ifndef HEADER_LambdaCube.PipelineSchema_H 4#ifndef HEADER_LambdaCube.PipelineSchema_H
5#define HEADER_LambdaCube.PipelineSchema_H 5#define HEADER_LambdaCube.PipelineSchema_H
diff --git a/ddl/out/LambdaCube.TypeInfo.cpp b/ddl/out/LambdaCube.TypeInfo.cpp
index 643afda..a965e4f 100644
--- a/ddl/out/LambdaCube.TypeInfo.cpp
+++ b/ddl/out/LambdaCube.TypeInfo.cpp
@@ -1,18 +1,50 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.376331000000Z 2// 2016-02-26T11:29:11.823283000000Z
3 3
4#include "LambdaCube.TypeInfo.hpp" 4#include "LambdaCube.TypeInfo.hpp"
5template<> json toJSON<std::shared_ptr<TypeInfo>>(std::shared_ptr<TypeInfo> &v) { 5template<> json toJSON<std::shared_ptr<Range>>(std::shared_ptr<Range> &v) {
6 json obj({}); 6 json obj({});
7 switch (v->tag) { 7 switch (v->tag) {
8 case ::TypeInfo::tag::TypeInfo: 8 case ::Range::tag::Range:
9 obj["tag"] = "TypeInfo"; 9 obj["tag"] = "Range";
10 { 10 {
11 std::shared_ptr<data::TypeInfo> tv = std::static_pointer_cast<data::TypeInfo>(v); 11 std::shared_ptr<data::Range> tv = std::static_pointer_cast<data::Range>(v);
12 obj["startLine"] = toJSON(tv->startLine); 12 obj["startLine"] = toJSON(tv->startLine);
13 obj["startColumn"] = toJSON(tv->startColumn); 13 obj["startColumn"] = toJSON(tv->startColumn);
14 obj["endLine"] = toJSON(tv->endLine); 14 obj["endLine"] = toJSON(tv->endLine);
15 obj["endColumn"] = toJSON(tv->endColumn); 15 obj["endColumn"] = toJSON(tv->endColumn);
16 }
17 break;
18 }
19 return obj;
20}
21
22template<> std::shared_ptr<Range> fromJSON<std::shared_ptr<Range>>(W<std::shared_ptr<Range>> v, json &obj) {
23 enum ::Range::tag tagType;
24 std::string tag = obj["tag"];
25 if (tag == "Range") {
26 tagType = ::Range::tag::Range;
27 std::shared_ptr<data::Range> tv(new data::Range());
28 tv->startLine = fromJSON(W<Int>(), obj["startLine"]);
29 tv->startColumn = fromJSON(W<Int>(), obj["startColumn"]);
30 tv->endLine = fromJSON(W<Int>(), obj["endLine"]);
31 tv->endColumn = fromJSON(W<Int>(), obj["endColumn"]);
32 return tv;
33 }
34 else throw "unknown constructor: " + tag;
35 std::shared_ptr<::Range> o(new ::Range());
36 o->tag = tagType;
37 return o;
38}
39
40template<> json toJSON<std::shared_ptr<TypeInfo>>(std::shared_ptr<TypeInfo> &v) {
41 json obj({});
42 switch (v->tag) {
43 case ::TypeInfo::tag::TypeInfo:
44 obj["tag"] = "TypeInfo";
45 {
46 std::shared_ptr<data::TypeInfo> tv = std::static_pointer_cast<data::TypeInfo>(v);
47 obj["range"] = toJSON(tv->range);
16 obj["text"] = toJSON(tv->text); 48 obj["text"] = toJSON(tv->text);
17 } 49 }
18 break; 50 break;
@@ -26,10 +58,7 @@ template<> std::shared_ptr<TypeInfo> fromJSON<std::shared_ptr<TypeInfo>>(W<std::
26 if (tag == "TypeInfo") { 58 if (tag == "TypeInfo") {
27 tagType = ::TypeInfo::tag::TypeInfo; 59 tagType = ::TypeInfo::tag::TypeInfo;
28 std::shared_ptr<data::TypeInfo> tv(new data::TypeInfo()); 60 std::shared_ptr<data::TypeInfo> tv(new data::TypeInfo());
29 tv->startLine = fromJSON(W<Int>(), obj["startLine"]); 61 tv->range = fromJSON(W<std::shared_ptr<::Range>>(), obj["range"]);
30 tv->startColumn = fromJSON(W<Int>(), obj["startColumn"]);
31 tv->endLine = fromJSON(W<Int>(), obj["endLine"]);
32 tv->endColumn = fromJSON(W<Int>(), obj["endColumn"]);
33 tv->text = fromJSON(W<String>(), obj["text"]); 62 tv->text = fromJSON(W<String>(), obj["text"]);
34 return tv; 63 return tv;
35 } 64 }
diff --git a/ddl/out/LambdaCube.TypeInfo.hpp b/ddl/out/LambdaCube.TypeInfo.hpp
index dd6b023..993388d 100644
--- a/ddl/out/LambdaCube.TypeInfo.hpp
+++ b/ddl/out/LambdaCube.TypeInfo.hpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.376331000000Z 2// 2016-02-26T11:29:11.823283000000Z
3 3
4#ifndef HEADER_LambdaCube.TypeInfo_H 4#ifndef HEADER_LambdaCube.TypeInfo_H
5#define HEADER_LambdaCube.TypeInfo_H 5#define HEADER_LambdaCube.TypeInfo_H
@@ -8,19 +8,32 @@
8 8
9#include "LambdaCube.IR.hpp" 9#include "LambdaCube.IR.hpp"
10 10
11class TypeInfo { 11class Range {
12 public: 12 public:
13 enum class tag { 13 enum class tag {
14 TypeInfo 14 Range
15 } tag; 15 } tag;
16}; 16};
17namespace data { 17namespace data {
18 class TypeInfo : public ::TypeInfo { 18 class Range : public ::Range {
19 public: 19 public:
20 Int startLine; 20 Int startLine;
21 Int startColumn; 21 Int startColumn;
22 Int endLine; 22 Int endLine;
23 Int endColumn; 23 Int endColumn;
24 Range() { tag = tag::Range; }
25 };
26}
27class TypeInfo {
28 public:
29 enum class tag {
30 TypeInfo
31 } tag;
32};
33namespace data {
34 class TypeInfo : public ::TypeInfo {
35 public:
36 std::shared_ptr<::Range> range;
24 String text; 37 String text;
25 TypeInfo() { tag = tag::TypeInfo; } 38 TypeInfo() { tag = tag::TypeInfo; }
26 }; 39 };
diff --git a/ddl/out/LambdaCube.TypeInfo.hs b/ddl/out/LambdaCube.TypeInfo.hs
index f23bd83..01bf5a6 100644
--- a/ddl/out/LambdaCube.TypeInfo.hs
+++ b/ddl/out/LambdaCube.TypeInfo.hs
@@ -1,5 +1,5 @@
1-- generated file, do not modify! 1-- generated file, do not modify!
2-- 2016-02-26T10:42:57.376331000000Z 2-- 2016-02-26T11:29:11.823283000000Z
3 3
4{-# LANGUAGE OverloadedStrings, RecordWildCards #-} 4{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
5module LambdaCube.TypeInfo where 5module LambdaCube.TypeInfo where
@@ -17,12 +17,19 @@ import Control.Monad
17 17
18import LambdaCube.IR 18import LambdaCube.IR
19 19
20data TypeInfo 20data Range
21 = TypeInfo 21 = Range
22 { startLine :: Int 22 { startLine :: Int
23 , startColumn :: Int 23 , startColumn :: Int
24 , endLine :: Int 24 , endLine :: Int
25 , endColumn :: Int 25 , endColumn :: Int
26 }
27
28 deriving (Show, Eq, Ord)
29
30data TypeInfo
31 = TypeInfo
32 { range :: Range
26 , text :: String 33 , text :: String
27 } 34 }
28 35
@@ -34,32 +41,50 @@ data CompileResult
34 deriving (Show, Eq, Ord) 41 deriving (Show, Eq, Ord)
35 42
36 43
37instance ToJSON TypeInfo where 44instance ToJSON Range where
38 toJSON v = case v of 45 toJSON v = case v of
39 TypeInfo{..} -> object 46 Range{..} -> object
40 [ "tag" .= ("TypeInfo" :: Text) 47 [ "tag" .= ("Range" :: Text)
41 , "startLine" .= startLine 48 , "startLine" .= startLine
42 , "startColumn" .= startColumn 49 , "startColumn" .= startColumn
43 , "endLine" .= endLine 50 , "endLine" .= endLine
44 , "endColumn" .= endColumn 51 , "endColumn" .= endColumn
45 , "text" .= text
46 ] 52 ]
47 53
48instance FromJSON TypeInfo where 54instance FromJSON Range where
49 parseJSON (Object obj) = do 55 parseJSON (Object obj) = do
50 tag <- obj .: "tag" 56 tag <- obj .: "tag"
51 case tag :: Text of 57 case tag :: Text of
52 "TypeInfo" -> do 58 "Range" -> do
53 startLine <- obj .: "startLine" 59 startLine <- obj .: "startLine"
54 startColumn <- obj .: "startColumn" 60 startColumn <- obj .: "startColumn"
55 endLine <- obj .: "endLine" 61 endLine <- obj .: "endLine"
56 endColumn <- obj .: "endColumn" 62 endColumn <- obj .: "endColumn"
57 text <- obj .: "text" 63 pure $ Range
58 pure $ TypeInfo
59 { startLine = startLine 64 { startLine = startLine
60 , startColumn = startColumn 65 , startColumn = startColumn
61 , endLine = endLine 66 , endLine = endLine
62 , endColumn = endColumn 67 , endColumn = endColumn
68 }
69 parseJSON _ = mzero
70
71instance ToJSON TypeInfo where
72 toJSON v = case v of
73 TypeInfo{..} -> object
74 [ "tag" .= ("TypeInfo" :: Text)
75 , "range" .= range
76 , "text" .= text
77 ]
78
79instance FromJSON TypeInfo where
80 parseJSON (Object obj) = do
81 tag <- obj .: "tag"
82 case tag :: Text of
83 "TypeInfo" -> do
84 range <- obj .: "range"
85 text <- obj .: "text"
86 pure $ TypeInfo
87 { range = range
63 , text = text 88 , text = text
64 } 89 }
65 parseJSON _ = mzero 90 parseJSON _ = mzero
diff --git a/ddl/out/LambdaCube.TypeInfo.purs b/ddl/out/LambdaCube.TypeInfo.purs
index 3252a7f..8641df1 100644
--- a/ddl/out/LambdaCube.TypeInfo.purs
+++ b/ddl/out/LambdaCube.TypeInfo.purs
@@ -1,5 +1,5 @@
1-- generated file, do not modify! 1-- generated file, do not modify!
2-- 2016-02-26T10:42:57.376331000000Z 2-- 2016-02-26T11:29:11.823283000000Z
3 3
4module LambdaCube.TypeInfo where 4module LambdaCube.TypeInfo where
5import Prelude 5import Prelude
@@ -18,12 +18,18 @@ import Data.Argonaut.Decode (DecodeJson, decodeJson)
18 18
19import LambdaCube.IR 19import LambdaCube.IR
20 20
21data TypeInfo 21data Range
22 = TypeInfo 22 = Range
23 { startLine :: Int 23 { startLine :: Int
24 , startColumn :: Int 24 , startColumn :: Int
25 , endLine :: Int 25 , endLine :: Int
26 , endColumn :: Int 26 , endColumn :: Int
27 }
28
29
30data TypeInfo
31 = TypeInfo
32 { range :: Range
27 , text :: String 33 , text :: String
28 } 34 }
29 35
@@ -34,33 +40,51 @@ data CompileResult
34 40
35 41
36 42
37instance encodeJsonTypeInfo :: EncodeJson TypeInfo where 43instance encodeJsonRange :: EncodeJson Range where
38 encodeJson v = case v of 44 encodeJson v = case v of
39 TypeInfo r -> 45 Range r ->
40 "tag" := "TypeInfo" ~> 46 "tag" := "Range" ~>
41 "startLine" := r.startLine ~> 47 "startLine" := r.startLine ~>
42 "startColumn" := r.startColumn ~> 48 "startColumn" := r.startColumn ~>
43 "endLine" := r.endLine ~> 49 "endLine" := r.endLine ~>
44 "endColumn" := r.endColumn ~> 50 "endColumn" := r.endColumn ~>
45 "text" := r.text ~>
46 jsonEmptyObject 51 jsonEmptyObject
47 52
48instance decodeJsonTypeInfo :: DecodeJson TypeInfo where 53instance decodeJsonRange :: DecodeJson Range where
49 decodeJson json = do 54 decodeJson json = do
50 obj <- decodeJson json 55 obj <- decodeJson json
51 tag <- obj .? "tag" 56 tag <- obj .? "tag"
52 case tag of 57 case tag of
53 "TypeInfo" -> do 58 "Range" -> do
54 startLine <- obj .? "startLine" 59 startLine <- obj .? "startLine"
55 startColumn <- obj .? "startColumn" 60 startColumn <- obj .? "startColumn"
56 endLine <- obj .? "endLine" 61 endLine <- obj .? "endLine"
57 endColumn <- obj .? "endColumn" 62 endColumn <- obj .? "endColumn"
58 text <- obj .? "text" 63 pure $ Range
59 pure $ TypeInfo
60 { startLine:startLine 64 { startLine:startLine
61 , startColumn:startColumn 65 , startColumn:startColumn
62 , endLine:endLine 66 , endLine:endLine
63 , endColumn:endColumn 67 , endColumn:endColumn
68 }
69
70instance encodeJsonTypeInfo :: EncodeJson TypeInfo where
71 encodeJson v = case v of
72 TypeInfo r ->
73 "tag" := "TypeInfo" ~>
74 "range" := r.range ~>
75 "text" := r.text ~>
76 jsonEmptyObject
77
78instance decodeJsonTypeInfo :: DecodeJson TypeInfo where
79 decodeJson json = do
80 obj <- decodeJson json
81 tag <- obj .? "tag"
82 case tag of
83 "TypeInfo" -> do
84 range <- obj .? "range"
85 text <- obj .? "text"
86 pure $ TypeInfo
87 { range:range
64 , text:text 88 , text:text
65 } 89 }
66 90
diff --git a/ddl/out/LambdaCube.TypeInfo.swift b/ddl/out/LambdaCube.TypeInfo.swift
index 2e2fb0f..504c232 100644
--- a/ddl/out/LambdaCube.TypeInfo.swift
+++ b/ddl/out/LambdaCube.TypeInfo.swift
@@ -1,13 +1,20 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.376331000000Z 2// 2016-02-26T11:29:11.823283000000Z
3 3
4enum TypeInfo { 4enum Range {
5 case TypeInfo(TypeInfo_Data) 5 case Range(Range_Data)
6 struct TypeInfo_Data { 6 struct Range_Data {
7 var startLine : Int 7 var startLine : Int
8 var startColumn : Int 8 var startColumn : Int
9 var endLine : Int 9 var endLine : Int
10 var endColumn : Int 10 var endColumn : Int
11 }
12}
13
14enum TypeInfo {
15 case TypeInfo(TypeInfo_Data)
16 struct TypeInfo_Data {
17 var range : Range
11 var text : String 18 var text : String
12 } 19 }
13} 20}
@@ -71,15 +78,25 @@ extension Maybe {
71 78
72 79
73 80
74extension TypeInfo { 81extension Range {
75 var toJSON : [String: AnyObject] { 82 var toJSON : [String: AnyObject] {
76 switch self { 83 switch self {
77 case .TypeInfo(let v): 84 case .Range(let v):
78 return [ "tag" : "TypeInfo" 85 return [ "tag" : "Range"
79 , "startLine" : v.startLine.toJSON 86 , "startLine" : v.startLine.toJSON
80 , "startColumn" : v.startColumn.toJSON 87 , "startColumn" : v.startColumn.toJSON
81 , "endLine" : v.endLine.toJSON 88 , "endLine" : v.endLine.toJSON
82 , "endColumn" : v.endColumn.toJSON 89 , "endColumn" : v.endColumn.toJSON
90 ]
91 }
92 }
93}
94extension TypeInfo {
95 var toJSON : [String: AnyObject] {
96 switch self {
97 case .TypeInfo(let v):
98 return [ "tag" : "TypeInfo"
99 , "range" : v.range.toJSON
83 , "text" : v.text.toJSON 100 , "text" : v.text.toJSON
84 ] 101 ]
85 } 102 }
@@ -113,6 +130,7 @@ enum Type {
113 case List(Type) 130 case List(Type)
114 case Maybe(Type) 131 case Maybe(Type)
115 case Map(Type,Type) 132 case Map(Type,Type)
133 case Range
116 case TypeInfo 134 case TypeInfo
117 case CompileResult 135 case CompileResult
118} 136}
diff --git a/ddl/out/LambdaCube.TypeInfo2.hpp b/ddl/out/LambdaCube.TypeInfo2.hpp
index cffe5ea..b5c16d7 100644
--- a/ddl/out/LambdaCube.TypeInfo2.hpp
+++ b/ddl/out/LambdaCube.TypeInfo2.hpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.376331000000Z 2// 2016-02-26T11:29:11.823283000000Z
3 3
4#ifndef HEADER_LambdaCube.TypeInfo_H 4#ifndef HEADER_LambdaCube.TypeInfo_H
5#define HEADER_LambdaCube.TypeInfo_H 5#define HEADER_LambdaCube.TypeInfo_H
@@ -9,12 +9,25 @@
9#include "LambdaCube.IR.hpp" 9#include "LambdaCube.IR.hpp"
10 10
11namespace data { 11namespace data {
12 class TypeInfo { 12 class Range {
13 public: 13 public:
14 Int startLine; 14 Int startLine;
15 Int startColumn; 15 Int startColumn;
16 Int endLine; 16 Int endLine;
17 Int endColumn; 17 Int endColumn;
18 };
19}
20class Range {
21public:
22 enum class tag {
23 Range
24 } tag;
25 std::shared_ptr<data::Range> Range;
26};
27namespace data {
28 class TypeInfo {
29 public:
30 std::shared_ptr<::Range> range;
18 String text; 31 String text;
19 }; 32 };
20} 33}
diff --git a/ddl/out/TestData.cpp b/ddl/out/TestData.cpp
index 5eaf158..881c6ba 100644
--- a/ddl/out/TestData.cpp
+++ b/ddl/out/TestData.cpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.396138000000Z 2// 2016-02-26T11:29:11.839781000000Z
3 3
4#include "TestData.hpp" 4#include "TestData.hpp"
5template<> json toJSON<std::shared_ptr<ClientInfo>>(std::shared_ptr<ClientInfo> &v) { 5template<> json toJSON<std::shared_ptr<ClientInfo>>(std::shared_ptr<ClientInfo> &v) {
diff --git a/ddl/out/TestData.hpp b/ddl/out/TestData.hpp
index 8aa75cd..b49ee9c 100644
--- a/ddl/out/TestData.hpp
+++ b/ddl/out/TestData.hpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.396138000000Z 2// 2016-02-26T11:29:11.839781000000Z
3 3
4#ifndef HEADER_TestData_H 4#ifndef HEADER_TestData_H
5#define HEADER_TestData_H 5#define HEADER_TestData_H
diff --git a/ddl/out/TestData.hs b/ddl/out/TestData.hs
index 6c17fc9..ec33f72 100644
--- a/ddl/out/TestData.hs
+++ b/ddl/out/TestData.hs
@@ -1,5 +1,5 @@
1-- generated file, do not modify! 1-- generated file, do not modify!
2-- 2016-02-26T10:42:57.396138000000Z 2-- 2016-02-26T11:29:11.839781000000Z
3 3
4{-# LANGUAGE OverloadedStrings, RecordWildCards #-} 4{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
5module TestData where 5module TestData where
diff --git a/ddl/out/TestData.purs b/ddl/out/TestData.purs
index 2fa0812..02942ca 100644
--- a/ddl/out/TestData.purs
+++ b/ddl/out/TestData.purs
@@ -1,5 +1,5 @@
1-- generated file, do not modify! 1-- generated file, do not modify!
2-- 2016-02-26T10:42:57.396138000000Z 2-- 2016-02-26T11:29:11.839781000000Z
3 3
4module TestData where 4module TestData where
5import Prelude 5import Prelude
diff --git a/ddl/out/TestData.swift b/ddl/out/TestData.swift
index 875f73c..6a1a868 100644
--- a/ddl/out/TestData.swift
+++ b/ddl/out/TestData.swift
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.396138000000Z 2// 2016-02-26T11:29:11.839781000000Z
3 3
4enum ClientInfo { 4enum ClientInfo {
5 case ClientInfo(ClientInfo_Data) 5 case ClientInfo(ClientInfo_Data)
diff --git a/ddl/out/TestData2.hpp b/ddl/out/TestData2.hpp
index 0fa5e60..0ec32f2 100644
--- a/ddl/out/TestData2.hpp
+++ b/ddl/out/TestData2.hpp
@@ -1,5 +1,5 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-02-26T10:42:57.396138000000Z 2// 2016-02-26T11:29:11.839781000000Z
3 3
4#ifndef HEADER_TestData_H 4#ifndef HEADER_TestData_H
5#define HEADER_TestData_H 5#define HEADER_TestData_H