Skip to content

Commit 35aff16

Browse files
authored
Allow comments in things. (#714)
1 parent 5c88f96 commit 35aff16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+370
-49
lines changed

spec/examples/array_literal

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,14 @@ component Main {
5353
<div/>
5454
}
5555
}
56+
-------------------------------------------------------------------------------
57+
module Test {
58+
fun test : Array(String) {
59+
[
60+
// Start Comment
61+
"Item 1",
62+
// End comment
63+
"Item 2"
64+
] of String
65+
}
66+
}

spec/examples/operation

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,10 @@ component Main {
151151
"Hello" + "There"
152152
}
153153
}
154+
-------------------------------------------------------------------------------
155+
component Main {
156+
fun render : String {
157+
"Hello" // Some comment
158+
+ "There"
159+
}
160+
}

spec/examples/pipe

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,17 @@ component Main {
7676
<div/>
7777
}
7878
}
79+
-------------------------------------------------------------------------------
80+
component Main {
81+
fun test (value : String) {
82+
value
83+
}
84+
85+
fun render : Html {
86+
"test"
87+
// Some comment
88+
|> test
89+
90+
<div/>
91+
}
92+
}

spec/formatters/array_with_comments

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module Test {
2+
fun test : Array(String) {
3+
[
4+
// Item 1 Comment
5+
"Item 1",
6+
// Item 2 comment
7+
"Item 2"
8+
// End comment
9+
] of String
10+
}
11+
}
12+
--------------------------------------------------------------------------------
13+
module Test {
14+
fun test : Array(String) {
15+
[
16+
// Item 1 Comment
17+
"Item 1",
18+
// Item 2 comment
19+
"Item 2"
20+
// End comment
21+
] of String
22+
}
23+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
component Main {
2+
fun render : String {
3+
"Hello" // Some comment
4+
+ "There"
5+
}
6+
}
7+
--------------------------------------------------------------------------------
8+
component Main {
9+
fun render : String {
10+
"Hello" // Some comment
11+
+ "There"
12+
}
13+
}

spec/formatters/pipe_with_comment

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
component Main {
2+
fun test (value : String) {
3+
value
4+
}
5+
6+
fun render : Html {
7+
"test"
8+
// Some comment
9+
|> test
10+
11+
<div/>
12+
}
13+
}
14+
--------------------------------------------------------------------------------
15+
component Main {
16+
fun test (value : String) {
17+
value
18+
}
19+
20+
fun render : Html {
21+
"test"
22+
// Some comment
23+
|> test
24+
25+
<div/>
26+
}
27+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
type A {
2+
a : String
3+
}
4+
5+
module Test {
6+
fun test : A {
7+
let x =
8+
{ a : "Blah" }
9+
10+
{ x|
11+
// Comment
12+
a:"Hello"
13+
// End Comment
14+
}
15+
}
16+
}
17+
--------------------------------------------------------------------------------
18+
type A {
19+
a : String
20+
}
21+
22+
module Test {
23+
fun test : A {
24+
let x =
25+
{ a: "Blah" }
26+
27+
{ x |
28+
// Comment
29+
a: "Hello"
30+
// End Comment
31+
}
32+
}
33+
}

spec/formatters/record_with_comments

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
type A {
2+
a : String
3+
}
4+
5+
module Test {
6+
fun test : A {
7+
{
8+
// Comment
9+
a:"Hello"
10+
// End Comment
11+
}
12+
}
13+
}
14+
--------------------------------------------------------------------------------
15+
type A {
16+
a : String
17+
}
18+
19+
module Test {
20+
fun test : A {
21+
{
22+
// Comment
23+
a: "Hello"
24+
// End Comment
25+
}
26+
}
27+
}

spec/formatters/tuple_with_comments

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module Test {
2+
fun test : Tuple(String, String) {
3+
{
4+
// Comment for "Blah"
5+
"Blah",
6+
// Comment for "Joe"
7+
"Joe"
8+
// End comment
9+
}
10+
}
11+
}
12+
--------------------------------------------------------------------------------
13+
module Test {
14+
fun test : Tuple(String, String) {
15+
{
16+
// Comment for "Blah"
17+
"Blah",
18+
// Comment for "Joe"
19+
"Joe"
20+
// End comment
21+
}
22+
}
23+
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
/*A*/typeTest{/*B*/a:String,/*C*/b:Blah}
1+
/*A*/typeTest{
2+
/*B*/a:String,/*C*/b:Blah// End comment
3+
}
24
--------------------------------------------------------------------------------
35
/* A */
46
type Test {
@@ -7,4 +9,6 @@ type Test {
79

810
/* C */
911
b : Blah
12+
13+
// End comment
1014
}

0 commit comments

Comments
 (0)