diff --git a/autotests/folding/highlight.pony.fold b/autotests/folding/highlight.pony.fold --- a/autotests/folding/highlight.pony.fold +++ b/autotests/folding/highlight.pony.fold @@ -149,8 +149,13 @@ env.out.print(f(20).string()) /* nested /* commentary */ */ -// simgle comment +// single comment +class A +class _A +x' +x'' +x'.string() '\uaaaa' '\Ubbbbbb' '\xcc' @@ -175,8 +180,13 @@ a.endnormal +print();print() + /* syntactically false: */ +class _aA +class _a +class a 0b2332 0b 0x @@ -197,5 +207,7 @@ "\ua" "\uaaa" "\uyyyy" +a'a class badType +print(); diff --git a/autotests/html/highlight.pony.html b/autotests/html/highlight.pony.html --- a/autotests/html/highlight.pony.html +++ b/autotests/html/highlight.pony.html @@ -6,11 +6,11 @@
 // Test file for Pony syntax highlighting, released under MIT License
 
-primitive Red   fun apply(): U32 => 0xFFFF0000
+primitive Red   fun apply(): U32 => 0xFFFF0000
 
 primitive Colours
-  fun black(): U32 => 0xFF000000
-  fun red(): U32 => 0xFFFF0000
+  fun black(): U32 => 0xFF000000
+  fun red(): U32 => 0xFFFF0000
 
 primitive Black
 primitive Blue
@@ -24,28 +24,28 @@
 for colour in ColourList().values() do
 end
 
-type EGLEvent is (U8, F32, F32)
+type EGLEvent is (U8, F32, F32)
 (var code, var x, var y) = @getEvent[EGLEvent]()
 
 primitive _XDisplayHandle
 primitive _EGLDisplayHandle
 
-let x_dpy = @XOpenDisplay[Pointer[_XDisplayHandle]](U32(0))
+let x_dpy = @XOpenDisplay[Pointer[_XDisplayHandle]](U32(0))
 if x_dpy.is_null() then
   env.out.print("XOpenDisplay failed")
 end
 
-let e_dpy = @eglGetDisplay[Pointer[_EGLDisplayHandle]](x_dpy)
+let e_dpy = @eglGetDisplay[Pointer[_EGLDisplayHandle]](x_dpy)
 if e_dpy.is_null() then
   env.out.print("eglGetDisplay failed")
 end
 
 primitive _EGLConfigHandle
-let a = Array[U16](8)
+let a = Array[U16](8)
 a.push(0x3040)
 a.push(0b01011)
-let config = Pointer[_EGLConfigHandle]
-if @eglChooseConfig[U32](e_dpy, a, config, U32(1), Pointer[U32]) == 0 then
+let config = Pointer[_EGLConfigHandle]
+if @eglChooseConfig[U32](e_dpy, a, config, U32(1), Pointer[U32]) == 0 then
     env.out.print("eglChooseConfig failed")
 end
 
@@ -86,22 +86,22 @@
 use "ponytest"
 
 actor Main is TestList
-  new create(env: Env) => PonyTest(env, this)
+  new create(env: Env) => PonyTest(env, this)
   new make() => None
 
   fun tag tests(test: PonyTest) =>
-    test(_TestAddition)
+    test(_TestAddition)
 
 class iso _TestAddition is UnitTest
   """
   Adding 2 numbers
   """
   fun name(): String => "u32/add"
 
   fun apply(h: TestHelper): TestResult =>
-    h.expect_eq[U32](2 + 2, 4)
+    h.expect_eq[U32](2 + 2, 4)
 
-fun tag log(msg: String, verbose: Bool = false)
+fun tag log(msg: String, verbose: Bool = false)
 be fail() =>
 be assert_failed(msg: String) =>
 fun tag assert_true(actual: Bool, msg: String = "") ?
@@ -131,16 +131,16 @@
     """
     """
 
-let dice: Array[U32] = [1; 2; 3
+let dice: Array[U32] = [1; 2; 3
   4
   5
   6
 ]
 
 actor Main
-  fun foo(n:U32): {ref(U32): U32} =>
-    var s: Array[U32] = Array[U32].init(n, 1)
-    {ref(i:U32)(s): U32 =>
+  fun foo(n:U32): {ref(U32): U32} =>
+    var s: Array[U32] = Array[U32].init(n, 1)
+    {ref(i:U32)(s): U32 =>
       try
         s(0) = s(0) + i
         s(0)
@@ -155,8 +155,13 @@
     env.out.print(f(20).string())
 
 /* nested /* commentary */ */
-// simgle comment
+// single comment
 
+class A
+class _A
+x'
+x''
+x'.string()
 '\uaaaa'
 '\Ubbbbbb'
 '\xcc'
@@ -172,37 +177,44 @@
 3_43_4
 0x0_4
 
-fun create(): U32 => 0
-fun iso create(): U32 => 0
-fun \\ abc \\  iso create(): U32 => 0
+fun create(): U32 => 0
+fun iso create(): U32 => 0
+fun \\ abc \\  iso create(): U32 => 0
 class \\ packet, blah \\ iso Xyz
 if \\ likely \\ a then
 end
 
 a.endnormal
 
+print();print()
+
 /* syntactically false: */
 
+class _aA
+class _a
+class a
 0b2332
 0b
 0x
 0xgf
 0f00
-3.
+3.
 .3
-3.e3
+3.e3
 3_
 3__43_4
 ''
-'\u'
-'\ua'
-'\uaaa'
-'\uaaaaa'
-'\uyyyy'
+'\u'
+'\ua'
+'\uaaa'
+'\uaaaaa'
+'\uyyyy'
 "\u"
 "\ua"
 "\uaaa"
 "\uyyyy"
+a'a
 
 class badType
+print();
 
diff --git a/autotests/input/highlight.pony b/autotests/input/highlight.pony --- a/autotests/input/highlight.pony +++ b/autotests/input/highlight.pony @@ -149,8 +149,13 @@ env.out.print(f(20).string()) /* nested /* commentary */ */ -// simgle comment +// single comment +class A +class _A +x' +x'' +x'.string() '\uaaaa' '\Ubbbbbb' '\xcc' @@ -175,8 +180,13 @@ a.endnormal +print();print() + /* syntactically false: */ +class _aA +class _a +class a 0b2332 0b 0x @@ -197,5 +207,7 @@ "\ua" "\uaaa" "\uyyyy" +a'a class badType +print(); diff --git a/autotests/reference/highlight.pony.ref b/autotests/reference/highlight.pony.ref --- a/autotests/reference/highlight.pony.ref +++ b/autotests/reference/highlight.pony.ref @@ -1,10 +1,10 @@ // Test file for Pony syntax highlighting, released under MIT License

-primitive Red fun apply(): U32 => 0xFFFF0000
+primitive Red fun apply(): U32 => 0xFFFF0000

primitive Colours
- fun black(): U32 => 0xFF000000
- fun red(): U32 => 0xFFFF0000
+ fun black(): U32 => 0xFF000000
+ fun red(): U32 => 0xFFFF0000

primitive Black
primitive Blue
@@ -18,28 +18,28 @@ for colour in ColourList().values() do
end

-type EGLEvent is (U8, F32, F32)
+type EGLEvent is (U8, F32, F32)
(var code, var x, var y) = @getEvent[EGLEvent]()

primitive _XDisplayHandle
primitive _EGLDisplayHandle

-let x_dpy = @XOpenDisplay[Pointer[_XDisplayHandle]](U32(0))
+let x_dpy = @XOpenDisplay[Pointer[_XDisplayHandle]](U32(0))
if x_dpy.is_null() then
env.out.print("XOpenDisplay failed")
end

-let e_dpy = @eglGetDisplay[Pointer[_EGLDisplayHandle]](x_dpy)
+let e_dpy = @eglGetDisplay[Pointer[_EGLDisplayHandle]](x_dpy)
if e_dpy.is_null() then
env.out.print("eglGetDisplay failed")
end

primitive _EGLConfigHandle
-let a = Array[U16](8)
+let a = Array[U16](8)
a.push(0x3040)
a.push(0b01011)
-let config = Pointer[_EGLConfigHandle]
-if @eglChooseConfig[U32](e_dpy, a, config, U32(1), Pointer[U32]) == 0 then
+let config = Pointer[_EGLConfigHandle]
+if @eglChooseConfig[U32](e_dpy, a, config, U32(1), Pointer[U32]) == 0 then
env.out.print("eglChooseConfig failed")
end

@@ -80,22 +80,22 @@ use "ponytest"

actor Main is TestList
- new create(env: Env) => PonyTest(env, this)
+ new create(env: Env) => PonyTest(env, this)
new make() => None

fun tag tests(test: PonyTest) =>
- test(_TestAddition)
+ test(_TestAddition)

class iso _TestAddition is UnitTest
"""
Adding 2 numbers
"""
fun name(): String => "u32/add"

fun apply(h: TestHelper): TestResult =>
- h.expect_eq[U32](2 + 2, 4)
+ h.expect_eq[U32](2 + 2, 4)

-fun tag log(msg: String, verbose: Bool = false)
+fun tag log(msg: String, verbose: Bool = false)
be fail() =>
be assert_failed(msg: String) =>
fun tag assert_true(actual: Bool, msg: String = "") ?
@@ -125,16 +125,16 @@ """
"""

-let dice: Array[U32] = [1; 2; 3
+let dice: Array[U32] = [1; 2; 3
4
5
6
]

actor Main
- fun foo(n:U32): {ref(U32): U32} =>
- var s: Array[U32] = Array[U32].init(n, 1)
- {ref(i:U32)(s): U32 =>
+ fun foo(n:U32): {ref(U32): U32} =>
+ var s: Array[U32] = Array[U32].init(n, 1)
+ {ref(i:U32)(s): U32 =>
try
s(0) = s(0) + i
s(0)
@@ -149,8 +149,13 @@ env.out.print(f(20).string())

/* nested /* commentary */ */
-// simgle comment
+// single comment

+class A
+class _A
+x'
+x''
+x'.string()
'\uaaaa'
'\Ubbbbbb'
'\xcc'
@@ -166,36 +171,43 @@ 3_43_4
0x0_4

-fun create(): U32 => 0
-fun iso create(): U32 => 0
-fun \\ abc \\ iso create(): U32 => 0
+fun create(): U32 => 0
+fun iso create(): U32 => 0
+fun \\ abc \\ iso create(): U32 => 0
class \\ packet, blah \\ iso Xyz
if \\ likely \\ a then
end

a.endnormal

+print();print()
+
/* syntactically false: */

+class _aA
+class _a
+class a
0b2332
0b
0x
0xgf
0f00
-3.
+3.
.3
-3.e3
+3.e3
3_
3__43_4
''
-'\u'
-'\ua'
-'\uaaa'
-'\uaaaaa'
-'\uyyyy'
+'\u'
+'\ua'
+'\uaaa'
+'\uaaaaa'
+'\uyyyy'
"\u"
"\ua"
"\uaaa"
"\uyyyy"
+a'a

class badType
+print();
diff --git a/data/syntax/pony.xml b/data/syntax/pony.xml --- a/data/syntax/pony.xml +++ b/data/syntax/pony.xml @@ -2,15 +2,16 @@ - - - + + - + + + ]> else elseif + elseiftype end @@ -117,11 +119,8 @@ #alias #any - + this use object as @@ -133,27 +132,31 @@ consume addressof digestof + + true + false - + @@ -164,17 +167,18 @@ - - - - - + + + + + + + - - + @@ -193,12 +197,14 @@ - + + + - + - + @@ -258,8 +264,8 @@ - - + +