From a9efcd698e2c4d1e9bd3bf07a4da286b4e5ae7ab Mon Sep 17 00:00:00 2001 From: Ryusei Yamaguchi Date: Mon, 11 Apr 2016 14:02:06 +0900 Subject: [PATCH] Add Lua target --- compile-test.hxml | 4 ++++ test/TestInternalEncoding.hx | 2 +- test/TestInternalEncodingIter.hx | 2 +- unifill/InternalEncoding.hx | 4 ++-- unifill/Unifill.hx | 4 ++-- unifill/Utf16.hx | 2 +- unifill/Utf8.hx | 2 +- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/compile-test.hxml b/compile-test.hxml index 462bdbb..517643c 100644 --- a/compile-test.hxml +++ b/compile-test.hxml @@ -34,3 +34,7 @@ --next -python test/test.py -cmd python3 test/test.py + +--next +-lua test/test.lua +-cmd lua test/test.lua diff --git a/test/TestInternalEncoding.hx b/test/TestInternalEncoding.hx index 9e8fcdf..cc4f9b8 100644 --- a/test/TestInternalEncoding.hx +++ b/test/TestInternalEncoding.hx @@ -17,7 +17,7 @@ class TestInternalEncoding extends haxe.unit.TestCase { } public function test_isValidString() { - #if (neko || php || cpp || macro) + #if (neko || php || cpp || lua || macro) assertTrue(InternalEncoding.isValidString("𩸽あëa")); assertFalse(InternalEncoding.isValidString("𩸽\xe3\x81ëa")); assertFalse(InternalEncoding.isValidString("\xc0")); diff --git a/test/TestInternalEncodingIter.hx b/test/TestInternalEncodingIter.hx index 93ed3a0..1dc59cf 100644 --- a/test/TestInternalEncodingIter.hx +++ b/test/TestInternalEncodingIter.hx @@ -7,7 +7,7 @@ class TestInternalEncodingIter extends haxe.unit.TestCase { public function test_InternalEncodingIter() { var s = "𩸽あëa"; var itr = new InternalEncodingIter(s, 0, s.length); - #if (neko || php || cpp || macro) + #if (neko || php || cpp || lua || macro) var index = [0, 4, 7, 9, 10]; #elseif python var index = [0, 1, 2, 3, 4]; diff --git a/unifill/InternalEncoding.hx b/unifill/InternalEncoding.hx index a0eb094..531ae37 100644 --- a/unifill/InternalEncoding.hx +++ b/unifill/InternalEncoding.hx @@ -1,6 +1,6 @@ package unifill; -#if (neko || php || cpp || macro) +#if (neko || php || cpp || lua || macro) private typedef UtfX = Utf8; #elseif python private typedef UtfX = Utf32; @@ -20,7 +20,7 @@ class InternalEncoding { public static var internalEncoding(get, never) : String; static inline function get_internalEncoding() : String - #if (neko || php || cpp || macro) + #if (neko || php || cpp || lua || macro) return "UTF-8"; #elseif python return "UTF-32"; diff --git a/unifill/Unifill.hx b/unifill/Unifill.hx index e1c41cb..82c7b64 100644 --- a/unifill/Unifill.hx +++ b/unifill/Unifill.hx @@ -29,7 +29,7 @@ class Unifill { Returns the code point as Int at position `index` by code points of String `s`. **/ public static inline function uCharCodeAt(s : String, index : Int) : Int { - #if (neko || php || cpp || macro) + #if (neko || php || cpp || lua || macro) return cast haxe.Utf8.charCodeAt(s, index); #else var i = InternalEncoding.offsetByCodePoints(s, 0, index); @@ -144,7 +144,7 @@ class Unifill { Appends the character `c` to StringBuf `sb`. **/ public static inline function uAddChar(sb : StringBuf, c : CodePoint) : Void { - #if (neko || php || cpp || macro) + #if (neko || php || cpp || lua || macro) Utf8.encodeWith(function(c) sb.addChar(c), c.toInt()); #elseif python // Utf32.encodeWith(function(c) sb.addChar(c), c.toInt()); diff --git a/unifill/Utf16.hx b/unifill/Utf16.hx index afc2eb0..6887a5e 100644 --- a/unifill/Utf16.hx +++ b/unifill/Utf16.hx @@ -209,7 +209,7 @@ private class Utf16Impl { } -#if !(neko || php || cpp || macro || python) +#if !(neko || php || cpp || lua || macro || python) private abstract StringU16Buffer(StringBuf) { diff --git a/unifill/Utf8.hx b/unifill/Utf8.hx index 6276614..f1e45d9 100644 --- a/unifill/Utf8.hx +++ b/unifill/Utf8.hx @@ -248,7 +248,7 @@ private class Utf8Impl { } -#if (neko || php || cpp || macro) +#if (neko || php || cpp || lua || macro) private abstract StringU8(String) {