Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix(pony): highlighting errors and remove two modes (#1979)
Fixes a few highlighting bugs such as keyword lists not having spaces at the end causing the last keyword of one line and the first keyword of the next to be combined. Also fixed highlighting of `iso` in class definitions and function heads without bodies in traits and interfaces. This also removes the FUNCTION and CLASS modes until there is a more clear benefit to using them. In a couple cases such as an interface with multiple function heads without an `=>` indicating a body they broke the highlighting of the second function head.
- Loading branch information
1 parent
5290313
commit dbe4ffa
Showing
12 changed files
with
94 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
<span class="hljs-keyword">if</span> a == b <span class="hljs-keyword">and</span> b == a <span class="hljs-keyword">then</span> | |||
env.out.print(<span class="hljs-string">"they are the same"</span>) | |||
<span class="hljs-keyword">elseif</span> a > b <span class="hljs-keyword">or</span> b < a <span class="hljs-keyword">then</span> | |||
env.out.print(<span class="hljs-string">"a is bigger"</span>) | |||
<span class="hljs-keyword">else</span> | |||
env.out.print(<span class="hljs-string">"b bigger"</span>) | |||
<span class="hljs-keyword">end</span> | |||
|
|||
<span class="hljs-keyword">while</span> count <= <span class="hljs-number">10</span> <span class="hljs-keyword">do</span> | |||
env.out.print(count.string()) | |||
count = count + <span class="hljs-number">1</span> | |||
<span class="hljs-keyword">end</span> | |||
|
|||
<span class="hljs-keyword">for</span> name <span class="hljs-keyword">in</span> [<span class="hljs-string">"Bob"</span>; <span class="hljs-string">"Fred"</span>; <span class="hljs-string">"Sarah"</span>].values() <span class="hljs-keyword">do</span> | |||
env.out.print(name) | |||
<span class="hljs-keyword">end</span> | |||
|
|||
<span class="hljs-keyword">repeat</span> | |||
env.out.print(<span class="hljs-string">"hello!"</span>) | |||
counter = counter + <span class="hljs-number">1</span> | |||
<span class="hljs-keyword">until</span> counter > <span class="hljs-number">7</span> <span class="hljs-keyword">end</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
if a == b and b == a then | |||
env.out.print("they are the same") | |||
elseif a > b or b < a then | |||
env.out.print("a is bigger") | |||
else | |||
env.out.print("b bigger") | |||
end | |||
|
|||
while count <= 10 do | |||
env.out.print(count.string()) | |||
count = count + 1 | |||
end | |||
|
|||
for name in ["Bob"; "Fred"; "Sarah"].values() do | |||
env.out.print(name) | |||
end | |||
|
|||
repeat | |||
env.out.print("hello!") | |||
counter = counter + 1 | |||
until counter > 7 end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,3 @@ | |||
<span class="hljs-function"><span class="hljs-keyword">new</span> <span class="hljs-title">create</span>(env: <span class="hljs-type">Env</span>, name: <span class="hljs-type">String</span>) =></span> | <span class="hljs-keyword">new</span> create(env: <span class="hljs-type">Env</span>, name: <span class="hljs-type">String</span>) => | ||
_env = env | _env = env | ||
_name = name | _name = name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
<span class="hljs-keyword">interface</span> <span class="hljs-type">Iterator</span>[<span class="hljs-type">A</span>: <span class="hljs-type">A</span>] | |||
<span class="hljs-keyword">fun</span> has_next(): <span class="hljs-type">Bool</span> | |||
<span class="hljs-keyword">fun</span> next(): <span class="hljs-type">T</span>? | |||
|
|||
<span class="hljs-keyword">trait</span> <span class="hljs-type">UnitTest</span> | |||
<span class="hljs-keyword">fun</span> name(): <span class="hljs-type">String</span> | |||
<span class="hljs-keyword">fun</span> <span class="hljs-meta">ref</span> set_up(h: <span class="hljs-type">TestHelper</span>) ? => | |||
<span class="hljs-type">None</span> | |||
<span class="hljs-keyword">fun</span> apply(h: <span class="hljs-type">TestHelper</span>) ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
interface Iterator[A: A] | |||
fun has_next(): Bool | |||
fun next(): T? | |||
|
|||
trait UnitTest | |||
fun name(): String | |||
fun ref set_up(h: TestHelper) ? => | |||
None | |||
fun apply(h: TestHelper) ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,8 +1,8 @@ | |||
<span class="hljs-function"><span class="hljs-keyword">fun</span> <span class="hljs-title">foo</span>(bar: <span class="hljs-type">String</span>): <span class="hljs-type">String</span> =></span> | <span class="hljs-keyword">fun</span> foo(bar: <span class="hljs-type">String</span>): <span class="hljs-type">String</span> => | ||
bar + <span class="hljs-string">"baz"</span> | bar + <span class="hljs-string">"baz"</span> | ||
|
|
||
<span class="hljs-function"><span class="hljs-keyword">new</span> <span class="hljs-title">create</span>(hunger: <span class="hljs-type">I32</span>) =></span> | <span class="hljs-keyword">new</span> create(hunger: <span class="hljs-type">I32</span>) => | ||
_hunger = hunger | _hunger = hunger | ||
|
|
||
<span class="hljs-function"><span class="hljs-keyword">be</span> <span class="hljs-title">feed</span>(food: <span class="hljs-type">I32</span>) =></span> | <span class="hljs-keyword">be</span> feed(food: <span class="hljs-type">I32</span>) => | ||
_hunger = _hunger - food | _hunger = _hunger - food |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,7 +1,11 @@ | |||
<span class="hljs-class"><span class="hljs-keyword">primitive</span> <span class="hljs-type">I32</span> <span class="hljs-keyword">is</span> <span class="hljs-type">SignedInteger</span></span> | <span class="hljs-keyword">primitive</span> <span class="hljs-type">I32</span> <span class="hljs-keyword">is</span> <span class="hljs-type">SignedInteger</span> | ||
|
|
||
<span class="hljs-class"><span class="hljs-keyword">actor</span> <span class="hljs-type">Main</span></span> | <span class="hljs-keyword">actor</span> <span class="hljs-type">Main</span> | ||
|
|
||
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ref</span> <span class="hljs-type">List</span>[<span class="hljs-type">A</span>: <span class="hljs-type">A</span>] <span class="hljs-keyword">is</span> <span class="hljs-type">Seq</span>[<span class="hljs-type">A</span>] <span class="hljs-title">ref</span></span> | <span class="hljs-keyword">class</span> <span class="hljs-meta">ref</span> <span class="hljs-type">List</span>[<span class="hljs-type">A</span>: <span class="hljs-type">A</span>] <span class="hljs-keyword">is</span> <span class="hljs-type">Seq</span>[<span class="hljs-type">A</span>] <span class="hljs-meta">ref</span> | ||
|
|
||
<span class="hljs-class"><span class="hljs-keyword">object</span> <span class="hljs-keyword">is</span> <span class="hljs-type">Hashable</span></span> | <span class="hljs-keyword">object</span> <span class="hljs-keyword">is</span> <span class="hljs-type">Hashable</span> | ||
|
|||
<span class="hljs-keyword">object</span> <span class="hljs-meta">iso</span> | |||
|
|||
<span class="hljs-keyword">primitive</span> <span class="hljs-type">Foo</span> <span class="hljs-keyword">is</span> <span class="hljs-type">Bar</span> <span class="hljs-meta">iso</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,2 +1,2 @@ | |||
<span class="hljs-function"><span class="hljs-keyword">new</span> <span class="hljs-title">create</span>(name': <span class="hljs-type">String</span>) =></span> | <span class="hljs-keyword">new</span> create(name': <span class="hljs-type">String</span>) => | ||
name = name' + <span class="hljs-string">'a'</span> | name = name' + <span class="hljs-string">'a'</span> |