Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Trying to fix line endings

  • Loading branch information...
commit e2613c16e86879b4f32e2dea62c2380470b6bb79 1 parent 60f9c14
@JarrettBillingsley authored
View
2  compile.bat
@@ -1,2 +1,2 @@
-@echo off
+@echo off
build @croctest
View
20 croc.ddoc
@@ -1,10 +1,10 @@
-D_COMMENT = <pre class="d_comment">$0</pre>
-D_STRING = <pre class="d_string">$0</pre>
-D_KEYWORD = <pre class="d_keyword">$0</pre>
-D_PSYMBOL = <pre class="d_psymbol">$0</pre>
-D_PARAM = <pre class="d_param">$0</pre>
-RPAREN = )
-LT = &lt;
-GT = &gt;
-DDOC_LICENSE = $(B License:)$(BR)<pre class="license">$0</pre>$(BR)
-DDOC_PARAMS = $(B Params:)$(BR)<table class="params">$0</table>$(BR)
+D_COMMENT = <pre class="d_comment">$0</pre>
+D_STRING = <pre class="d_string">$0</pre>
+D_KEYWORD = <pre class="d_keyword">$0</pre>
+D_PSYMBOL = <pre class="d_psymbol">$0</pre>
+D_PARAM = <pre class="d_param">$0</pre>
+RPAREN = )
+LT = &lt;
+GT = &gt;
+DDOC_LICENSE = $(B License:)$(BR)<pre class="license">$0</pre>$(BR)
+DDOC_PARAMS = $(B Params:)$(BR)<table class="params">$0</table>$(BR)
View
4 croc/compile.bat
@@ -1,3 +1,3 @@
-@echo off
-cd ..
+@echo off
+cd ..
call compile.bat
View
4 croc/run.bat
@@ -1,3 +1,3 @@
-@echo off
-cd ..
+@echo off
+cd ..
call run.bat
View
6 crocc.brf
@@ -1,4 +1,4 @@
-crocc.d
--clean
--release
+crocc.d
+-clean
+-release
-op
View
12 croci.brf
@@ -1,7 +1,7 @@
-croci.d
--clean
--release
--op
--O
--w
+croci.d
+-clean
+-release
+-op
+-O
+-w
-version=CrocBuiltinDocs
View
16 croctest.brf
@@ -1,9 +1,9 @@
-croctest.d
--clean
--debug
--unittest
--debug=LEAK_DETECTOR
--version=CrocGLCheckErrors
--version=CrocBuiltinDocs
--g
+croctest.d
+-clean
+-debug
+-unittest
+-debug=LEAK_DETECTOR
+-version=CrocGLCheckErrors
+-version=CrocBuiltinDocs
+-g
-w
View
38 docs.rrf
@@ -1,19 +1,19 @@
--debug
--Dqdocs
--candydoc
--explicit
--clean
--c
-minid.ddoc
-minid/alloc.d
-minid/api.d
-minid/ast.d
-minid/bind.d
-minid/commandline.d
-minid/compiler.d
-minid/ex.d
-minid/interpreter.d
-minid/serialization.d
-minid/types.d
-minid/utils.d
-minid/vm.d
+-debug
+-Dqdocs
+-candydoc
+-explicit
+-clean
+-c
+minid.ddoc
+minid/alloc.d
+minid/api.d
+minid/ast.d
+minid/bind.d
+minid/commandline.d
+minid/compiler.d
+minid/ex.d
+minid/interpreter.d
+minid/serialization.d
+minid/types.d
+minid/utils.d
+minid/vm.d
View
394 downloads/Croc.chl
@@ -1,197 +1,197 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// ConTEXT Croc highlighter by Jarrett Billingsley
-//
-//////////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////
-// language name
-
-Language: Croc
-
-
-//////////////////////////////////////////////////////////////////////////////
-// default file filter
-// note: if more than one extension is associated, eg:
-// C/C++ files (*.c,*.cpp,*.h,*.hpp)|*.c;*.cpp;*.h;*.hpp
-
-Filter: Croc source files (*.croc)|*.croc
-
-
-//////////////////////////////////////////////////////////////////////////////
-// help file which will be invokend when F1 is pressed
-
-HelpFile:
-
-
-//////////////////////////////////////////////////////////////////////////////
-// language case sensitivity
-// 0 - no
-// 1 - yes
-
-CaseSensitive: 1
-
-
-//////////////////////////////////////////////////////////////////////////////
-// comment type: LineComment - comment to the end of line
-// BlockCommentBeg - block comment begin, it could be
-// multiline
-// BlockCommentEnd - block comment end
-
-LineComment: //
-BlockCommentBeg: /*
-BlockCommentEnd: */
-
-
-//////////////////////////////////////////////////////////////////////////////
-// identifier characters
-// note: characters shouldn't be delimited, except arrays
-// array of chars could be defined as from_char..to_char
-
-IdentifierBegChars: a..z A..Z _
-IdentifierChars: a..z A..Z _ 0..9
-
-//////////////////////////////////////////////////////////////////////////////
-// numeric constants begin characters
-// note: characters shouldn't be delimited, except arrays
-// array of chars could be defined as from_char..to_char
-// number always starts with 0..9 except when NumConstBeg
-// defines other
-
-NumConstBegChars: 0..9
-
-
-//////////////////////////////////////////////////////////////////////////////
-// numeric constants characters
-// note: characters shouldn't be delimited, except arrays
-// array of chars could be defined as from_char..to_char
-// number always starts with 0..9 except when NumConstBeg
-// defines other
-
-NumConstChars: 0..9 _ abcdefxABCDEFX
-
-
-//////////////////////////////////////////////////////////////////////////////
-// escape character
-
-EscapeChar: \
-
-
-//////////////////////////////////////////////////////////////////////////////
-// keyword table
-// note: delimited with spaces, lines could be wrapped
-// you may divide keywords into two groups which can be
-// highlighted differently
-
-KeyWords1:
- as
- assert
- break
- case
- catch
- class
- continue
- coroutine
- default
- do
- else
- false
- finally
- for
- foreach
- function
- global
- if
- import
- in
- is
- local
- module
- namespace
- null
- return
- scope
- super
- switch
- this
- throw
- true
- try
- vararg
- while
- with
- yield
-
-//////////////////////////////////////////////////////////////////////////////
-// string delimiter: StringBegChar - string begin char
-// StringEndChar - string end char
-// MultilineStrings - enables multiline strings, as perl
-// has it
-
-StringBegChar: "'`
-StringEndChar: "'`
-MultilineStrings: 1
-
-
-//////////////////////////////////////////////////////////////////////////////
-// use preprocessor: 0 - no
-// 1 - yes
-// note: if yes, '#' and statements after it will be
-// highlighted with Preprocessor defined colors
-
-UsePreprocessor: 0
-
-
-//////////////////////////////////////////////////////////////////////////////
-// highlight line: 0 - no
-// 1 - yes
-// note: if yes, current line will be highlighted
-
-CurrLineHighlighted: 1
-
-
-//////////////////////////////////////////////////////////////////////////////
-// colors
-// note: first value is foreground, second is background color
-// and third (optional) represents font attribute:
-// B - bold
-// I - italic
-// U - underline
-// S - strike out
-// attributes can be combined: eg. B or BI
-// as value, it could be used any standard windows color:
-// clBlack, clMaroon, clGreen, clOlive, clNavy,
-// clPurple, clTeal, clGray, clSilver, clRed, clLime,
-// clYellow, clBlue, clFuchsia, clAqua, clLtGray,
-// clDkGray, clWhite, clScrollBar, clBackground,
-// clActiveCaption, clInactiveCaption, clMenu, clWindow,
-// clWindowFrame, clMenuText, clWindowText, clCaptionText,
-// clActiveBorder, clInactiveBorder, clAppWorkSpace,
-// clHighlight, clHighlightText, clBtnFace, clBtnShadow,
-// clGrayText, clBtnText, clInactiveCaptionText,
-// clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText,
-// clInfoBk
-// as value, it could be used hex numeric constant too:
-// $BBGGRR - BB: blue, GG: green, RR: red, eg: $FF6A00
-
-SpaceCol: clWhite clBlack
-KeyWords1Col: $ff0000 $000000
-KeyWords2Col: $ff0000 $000000
-IdentifierCol: clWhite clBlack
-CommentCol: clGreen clBlack
-NumberCol: $0040FF40 clBlack
-StringCol: $000080FF clBlack
-SymbolCol: clWhite clBlack
-PreprocessorCol: clRed clBlack
-SelectionCol: clWhite clNavy
-CurrentLineCol: clWhite $00202020
-OverrideTxtFgColor: 0
-BlockAutoindent: 1
-BlockBegStr: {
-BlockEndStr: }
-Keyword1Col: clRed clBlack
-Keyword2Col: $00FF40FF clBlack
-Keyword3Col: clYellow clBlack
-MatchedBracesCol: $00FF8080 clBlack
-Keyword4Col: clWindowText clWindow
-Keyword5Col: clWindowText clWindow
+//////////////////////////////////////////////////////////////////////////////
+//
+// ConTEXT Croc highlighter by Jarrett Billingsley
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+// language name
+
+Language: Croc
+
+
+//////////////////////////////////////////////////////////////////////////////
+// default file filter
+// note: if more than one extension is associated, eg:
+// C/C++ files (*.c,*.cpp,*.h,*.hpp)|*.c;*.cpp;*.h;*.hpp
+
+Filter: Croc source files (*.croc)|*.croc
+
+
+//////////////////////////////////////////////////////////////////////////////
+// help file which will be invokend when F1 is pressed
+
+HelpFile:
+
+
+//////////////////////////////////////////////////////////////////////////////
+// language case sensitivity
+// 0 - no
+// 1 - yes
+
+CaseSensitive: 1
+
+
+//////////////////////////////////////////////////////////////////////////////
+// comment type: LineComment - comment to the end of line
+// BlockCommentBeg - block comment begin, it could be
+// multiline
+// BlockCommentEnd - block comment end
+
+LineComment: //
+BlockCommentBeg: /*
+BlockCommentEnd: */
+
+
+//////////////////////////////////////////////////////////////////////////////
+// identifier characters
+// note: characters shouldn't be delimited, except arrays
+// array of chars could be defined as from_char..to_char
+
+IdentifierBegChars: a..z A..Z _
+IdentifierChars: a..z A..Z _ 0..9
+
+//////////////////////////////////////////////////////////////////////////////
+// numeric constants begin characters
+// note: characters shouldn't be delimited, except arrays
+// array of chars could be defined as from_char..to_char
+// number always starts with 0..9 except when NumConstBeg
+// defines other
+
+NumConstBegChars: 0..9
+
+
+//////////////////////////////////////////////////////////////////////////////
+// numeric constants characters
+// note: characters shouldn't be delimited, except arrays
+// array of chars could be defined as from_char..to_char
+// number always starts with 0..9 except when NumConstBeg
+// defines other
+
+NumConstChars: 0..9 _ abcdefxABCDEFX
+
+
+//////////////////////////////////////////////////////////////////////////////
+// escape character
+
+EscapeChar: \
+
+
+//////////////////////////////////////////////////////////////////////////////
+// keyword table
+// note: delimited with spaces, lines could be wrapped
+// you may divide keywords into two groups which can be
+// highlighted differently
+
+KeyWords1:
+ as
+ assert
+ break
+ case
+ catch
+ class
+ continue
+ coroutine
+ default
+ do
+ else
+ false
+ finally
+ for
+ foreach
+ function
+ global
+ if
+ import
+ in
+ is
+ local
+ module
+ namespace
+ null
+ return
+ scope
+ super
+ switch
+ this
+ throw
+ true
+ try
+ vararg
+ while
+ with
+ yield
+
+//////////////////////////////////////////////////////////////////////////////
+// string delimiter: StringBegChar - string begin char
+// StringEndChar - string end char
+// MultilineStrings - enables multiline strings, as perl
+// has it
+
+StringBegChar: "'`
+StringEndChar: "'`
+MultilineStrings: 1
+
+
+//////////////////////////////////////////////////////////////////////////////
+// use preprocessor: 0 - no
+// 1 - yes
+// note: if yes, '#' and statements after it will be
+// highlighted with Preprocessor defined colors
+
+UsePreprocessor: 0
+
+
+//////////////////////////////////////////////////////////////////////////////
+// highlight line: 0 - no
+// 1 - yes
+// note: if yes, current line will be highlighted
+
+CurrLineHighlighted: 1
+
+
+//////////////////////////////////////////////////////////////////////////////
+// colors
+// note: first value is foreground, second is background color
+// and third (optional) represents font attribute:
+// B - bold
+// I - italic
+// U - underline
+// S - strike out
+// attributes can be combined: eg. B or BI
+// as value, it could be used any standard windows color:
+// clBlack, clMaroon, clGreen, clOlive, clNavy,
+// clPurple, clTeal, clGray, clSilver, clRed, clLime,
+// clYellow, clBlue, clFuchsia, clAqua, clLtGray,
+// clDkGray, clWhite, clScrollBar, clBackground,
+// clActiveCaption, clInactiveCaption, clMenu, clWindow,
+// clWindowFrame, clMenuText, clWindowText, clCaptionText,
+// clActiveBorder, clInactiveBorder, clAppWorkSpace,
+// clHighlight, clHighlightText, clBtnFace, clBtnShadow,
+// clGrayText, clBtnText, clInactiveCaptionText,
+// clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText,
+// clInfoBk
+// as value, it could be used hex numeric constant too:
+// $BBGGRR - BB: blue, GG: green, RR: red, eg: $FF6A00
+
+SpaceCol: clWhite clBlack
+KeyWords1Col: $ff0000 $000000
+KeyWords2Col: $ff0000 $000000
+IdentifierCol: clWhite clBlack
+CommentCol: clGreen clBlack
+NumberCol: $0040FF40 clBlack
+StringCol: $000080FF clBlack
+SymbolCol: clWhite clBlack
+PreprocessorCol: clRed clBlack
+SelectionCol: clWhite clNavy
+CurrentLineCol: clWhite $00202020
+OverrideTxtFgColor: 0
+BlockAutoindent: 1
+BlockBegStr: {
+BlockEndStr: }
+Keyword1Col: clRed clBlack
+Keyword2Col: $00FF40FF clBlack
+Keyword3Col: clYellow clBlack
+MatchedBracesCol: $00FF8080 clBlack
+Keyword4Col: clWindowText clWindow
+Keyword5Col: clWindowText clWindow
View
46 dsss.conf
@@ -1,23 +1,23 @@
-name = croc
-
-[croc]
-buildflags = -release -O
-
-version(Posix) {
- buildflags += -version=CrocReadline -llreadline -llhistory
-}
-
-[croci.d]
-target = croci
-buildflags = -release -O -w
-
-version(Posix) {
- buildflags += -version=CrocReadline -llreadline -llhistory
-}
-
-[crocc.d]
-target = crocc
-
-[croctest.d]
-target = croctest
-buildflags = -debug -g -unittest -debug=LEAK_DETECTOR -w -version=CrocGLCheckErrors
+name = croc
+
+[croc]
+buildflags = -release -O
+
+version(Posix) {
+ buildflags += -version=CrocReadline -llreadline -llhistory
+}
+
+[croci.d]
+target = croci
+buildflags = -release -O -w
+
+version(Posix) {
+ buildflags += -version=CrocReadline -llreadline -llhistory
+}
+
+[crocc.d]
+target = crocc
+
+[croctest.d]
+target = croctest
+buildflags = -debug -g -unittest -debug=LEAK_DETECTOR -w -version=CrocGLCheckErrors
View
128 lib.brf
@@ -1,65 +1,65 @@
-croc\api.d
-croc\api_checks.d
-croc\api_debug.d
-croc\api_interpreter.d
-croc\api_stack.d
-croc\base_alloc.d
-croc\base_gc.d
-croc\base_hash.d
-croc\base_opcodes.d
-croc\compiler.d
-croc\compiler_ast.d
-croc\compiler_astvisitor.d
-croc\compiler_codegen.d
-croc\compiler_docgen.d
-croc\compiler_lexer.d
-croc\compiler_parser.d
-croc\compiler_semantic.d
-croc\compiler_types.d
-croc\ex.d
-croc\ex_bind.d
-croc\ex_commandline.d
-croc\ex_format.d
-croc\ex_json.d
-croc\interpreter.d
-croc\serialization.d
-croc\serialization_simple.d
-croc\stdlib_array.d
-croc\stdlib_base.d
-croc\stdlib_char.d
-croc\stdlib_compiler.d
-croc\stdlib_debug.d
-croc\stdlib_gc.d
-croc\stdlib_hash.d
-croc\stdlib_io.d
-croc\stdlib_json.d
-croc\stdlib_math.d
-croc\stdlib_memblock.d
-croc\stdlib_modules.d
-croc\stdlib_os.d
-croc\stdlib_regexp.d
-croc\stdlib_serialization.d
-croc\stdlib_stream.d
-croc\stdlib_string.d
-croc\stdlib_stringbuffer.d
-croc\stdlib_thread.d
-croc\stdlib_time.d
-croc\stdlib_utils.d
-croc\types.d
-croc\types_array.d
-croc\types_class.d
-croc\types_funcdef.d
-croc\types_function.d
-croc\types_instance.d
-croc\types_memblock.d
-croc\types_namespace.d
-croc\types_nativeobj.d
-croc\types_string.d
-croc\types_table.d
-croc\types_thread.d
-croc\types_weakref.d
-croc\utils.d
-croc\vm.d
--Tcroc.lib
--release
+croc\api.d
+croc\api_checks.d
+croc\api_debug.d
+croc\api_interpreter.d
+croc\api_stack.d
+croc\base_alloc.d
+croc\base_gc.d
+croc\base_hash.d
+croc\base_opcodes.d
+croc\compiler.d
+croc\compiler_ast.d
+croc\compiler_astvisitor.d
+croc\compiler_codegen.d
+croc\compiler_docgen.d
+croc\compiler_lexer.d
+croc\compiler_parser.d
+croc\compiler_semantic.d
+croc\compiler_types.d
+croc\ex.d
+croc\ex_bind.d
+croc\ex_commandline.d
+croc\ex_format.d
+croc\ex_json.d
+croc\interpreter.d
+croc\serialization.d
+croc\serialization_simple.d
+croc\stdlib_array.d
+croc\stdlib_base.d
+croc\stdlib_char.d
+croc\stdlib_compiler.d
+croc\stdlib_debug.d
+croc\stdlib_gc.d
+croc\stdlib_hash.d
+croc\stdlib_io.d
+croc\stdlib_json.d
+croc\stdlib_math.d
+croc\stdlib_memblock.d
+croc\stdlib_modules.d
+croc\stdlib_os.d
+croc\stdlib_regexp.d
+croc\stdlib_serialization.d
+croc\stdlib_stream.d
+croc\stdlib_string.d
+croc\stdlib_stringbuffer.d
+croc\stdlib_thread.d
+croc\stdlib_time.d
+croc\stdlib_utils.d
+croc\types.d
+croc\types_array.d
+croc\types_class.d
+croc\types_funcdef.d
+croc\types_function.d
+croc\types_instance.d
+croc\types_memblock.d
+croc\types_namespace.d
+croc\types_nativeobj.d
+croc\types_string.d
+croc\types_table.d
+croc\types_thread.d
+croc\types_weakref.d
+croc\utils.d
+croc\vm.d
+-Tcroc.lib
+-release
-clean
View
2  run.bat
@@ -1,2 +1,2 @@
-@echo off
+@echo off
croctest
View
14 tests/all.croc
@@ -1,8 +1,8 @@
-module tests.all
-
-import tests.compiler.compiler
-import tests.array
-import tests.baselib
-import tests.char
-import tests.hash
+module tests.all
+
+import tests.compiler.compiler
+import tests.array
+import tests.baselib
+import tests.char
+import tests.hash
import tests.interpreter
View
198 tests/array.croc
@@ -1,100 +1,100 @@
-module tests.array
-
-import tests.common : xfail
-
-// croc.array
-local a = [1 2 3]
-a = a[1 ..]
-a[] = [4 5]
-#a = 10
-#a = 1000
-#a = 10
-a[3 .. 5] = a[4 .. 6]
-a = [1, 2, (\->3)()]
-local x = 3 in a
-x = 5 in a
-a = a ~ [1]
-a = a ~ 1
-a = [i for i in 1 .. 3]
-a = array.new(1000)
-a = array.new(300)
-
-// croc.arraylib
-a = array.new(5)
-array.new(10, 0)
-xfail$\{ array.new(-3) }
-
-a = array.range(10)
-array.range(3, 8)
-array.range(2, 10, 3)
-xfail$\{ array.range(1, 10, -2) }
-array.range(10, 2)
-
-a.sort()
-a.sort("reverse")
-a.sort(\x, y -> x <=> y)
-xfail$\{ a.sort(\x, y -> null) }
-a.reverse()
-a.dup()
-
-foreach(i, v; a){}
-foreach(i, v; a, "reverse"){}
-a.expand()
-a.toString();
-["hi", 'c'].toString()
-a.apply(\x -> x)
-a.map(\x -> x)
-a.reduce(\x, y -> x);
-[].reduce(\x, y -> x)
-a.each(\i, v -> false)
-array.range(100).filter(\i, v -> true)
-xfail$\{ a.filter(\i -> null) }
-
-a.find(5)
-a.find(8980)
-a.findIf(\v -> !toBool(v & 1))
-a.findIf(\v -> v == 5239)
-xfail$\{ a.findIf(\v -> null) }
-a = array.range(50)
-a.bsearch(3)
-a.bsearch(-54)
-a.bsearch(24)
-a.bsearch(50)
-a.pop()
-a.pop(0)
-a.pop(-1)
-xfail$\{ a.pop(-500000) }
-xfail$\{ [].pop() }
-
-a.set(3, 2, 1)
-a.min()
-a.set(1, 2, 3)
-a.max()
-a.set()
-xfail$\{ a.min() }
-a.set(2, 7, 4, 1, 2, 6)
-a.extreme(\a, b -> a < b)
-xfail$\{ a.extreme(\a -> null) }
-a.all()
-a.all(\a -> a)
-a.any()
-a.any(\a -> a)
-a.fill(5)
-a.append()
-a.append(1, 2, 3);
-[[1 2], [3 4]].flatten()
-xfail$\{ local x = [0]; x[0] = x; x.flatten() }
-
-a = [1 2 3 4 5 6 7 8 9 10]
-a.makeHeap()
-// a.pushHeap(11)
-// a.popHeap()
-// xfail$\{ [].popHeap() }
-a.sortHeap()
-
-a = [1 2 2 3 4 5 5 5 5]
-a.count(2)
-a.count(2, \x, y -> x == y)
-xfail$\{ a.count(2, \x, y -> null) }
-a.countIf(\x -> toBool(x & 1))
+module tests.array
+
+import tests.common : xfail
+
+// croc.array
+local a = [1 2 3]
+a = a[1 ..]
+a[] = [4 5]
+#a = 10
+#a = 1000
+#a = 10
+a[3 .. 5] = a[4 .. 6]
+a = [1, 2, (\->3)()]
+local x = 3 in a
+x = 5 in a
+a = a ~ [1]
+a = a ~ 1
+a = [i for i in 1 .. 3]
+a = array.new(1000)
+a = array.new(300)
+
+// croc.arraylib
+a = array.new(5)
+array.new(10, 0)
+xfail$\{ array.new(-3) }
+
+a = array.range(10)
+array.range(3, 8)
+array.range(2, 10, 3)
+xfail$\{ array.range(1, 10, -2) }
+array.range(10, 2)
+
+a.sort()
+a.sort("reverse")
+a.sort(\x, y -> x <=> y)
+xfail$\{ a.sort(\x, y -> null) }
+a.reverse()
+a.dup()
+
+foreach(i, v; a){}
+foreach(i, v; a, "reverse"){}
+a.expand()
+a.toString();
+["hi", 'c'].toString()
+a.apply(\x -> x)
+a.map(\x -> x)
+a.reduce(\x, y -> x);
+[].reduce(\x, y -> x)
+a.each(\i, v -> false)
+array.range(100).filter(\i, v -> true)
+xfail$\{ a.filter(\i -> null) }
+
+a.find(5)
+a.find(8980)
+a.findIf(\v -> !toBool(v & 1))
+a.findIf(\v -> v == 5239)
+xfail$\{ a.findIf(\v -> null) }
+a = array.range(50)
+a.bsearch(3)
+a.bsearch(-54)
+a.bsearch(24)
+a.bsearch(50)
+a.pop()
+a.pop(0)
+a.pop(-1)
+xfail$\{ a.pop(-500000) }
+xfail$\{ [].pop() }
+
+a.set(3, 2, 1)
+a.min()
+a.set(1, 2, 3)
+a.max()
+a.set()
+xfail$\{ a.min() }
+a.set(2, 7, 4, 1, 2, 6)
+a.extreme(\a, b -> a < b)
+xfail$\{ a.extreme(\a -> null) }
+a.all()
+a.all(\a -> a)
+a.any()
+a.any(\a -> a)
+a.fill(5)
+a.append()
+a.append(1, 2, 3);
+[[1 2], [3 4]].flatten()
+xfail$\{ local x = [0]; x[0] = x; x.flatten() }
+
+a = [1 2 3 4 5 6 7 8 9 10]
+a.makeHeap()
+// a.pushHeap(11)
+// a.popHeap()
+// xfail$\{ [].popHeap() }
+a.sortHeap()
+
+a = [1 2 2 3 4 5 5 5 5]
+a.count(2)
+a.count(2, \x, y -> x == y)
+xfail$\{ a.count(2, \x, y -> null) }
+a.countIf(\x -> toBool(x & 1))
xfail$\{ a.countIf(\x -> null) }
View
214 tests/baselib.croc
@@ -1,108 +1,108 @@
-module tests.baselib
-
-import tests.common : xfail
-
-// GC
-collectGarbage()
-bytesAllocated()
-
-// functional
-curry(\x, y -> x + y, 3)(4)
-bindContext(\->this, 3)()
-
-// reflection
-findGlobal("frendle")
-isSet("tests")
-isSet("frendle")
-typeof(5)
-nameOf(_G)
-nameOf(nameOf)
-nameOf(StringBuffer)
-xfail$\{ nameOf(4) }
-fieldsOf(class{})
-fieldsOf(class{}())
-xfail$\{ fieldsOf(4) }
-foreach(v; allFieldsOf(class:StringBuffer{ opLength = 4; this() :xx = 4 }())){}
-xfail$\{ foreach(v; allFieldsOf(5)){} }
-hasField(StringBuffer, "x")
-hasMethod(StringBuffer, "x")
-findField(StringBuffer, "opLength")
-findField(StringBuffer, "forbleborble")
-xfail$\{ findField(4, "x") }
-rawSetField(class{}(), "x", 5)
-rawGetField(class{x}(), "x")
-attrs(class{}, {})
-hasAttributes(StringBuffer)
-attributesOf(StringBuffer)
-
-// conversion
-toString(5, 'x')
-toString('x')
-rawToString(5)
-toBool(5)
-toInt(false)
-toInt(5)
-toInt(4.5)
-toInt('x')
-toInt("5")
-xfail$\{ toInt(null) }
-toFloat(false)
-toFloat(5)
-toFloat(4.5)
-toFloat('x')
-toFloat("5")
-xfail$\{ toFloat(null) }
-toChar(5)
-format()
-format(4.5, 'x', {})
-format("hello {} world", 3)
-format("{")
-format("{r}")
-format("{0}")
-
-// console
-write(4)
-writeln(4)
-writef(4)
-writefln(4)
-
-{
- local t = {}
- t.s = "\'\"\\\a\b\f\n\r\t\vx\u2000\U00100000"
- t.a = [0 1 2 3]
- t.a[0] = t.a
- t.t = t
- t.n = namespace N { x = 5; y = 10 }
- t.n.n = t.n
- t.c = 'x'
- t.w = weakref({})
-
- dumpVal(t)
-}
-
-// dynamic compilation
-loadString("")
-loadString("", "")
-loadString("", namespace N{})
-loadString("", "", namespace N{})
-eval("1")
-eval("1", namespace N{})
-loadJSON("{}")
-toJSON({})
-
-// function metatable
-toJSON.environment();
-(\->1).environment(namespace N{})
-toJSON.isNative()
-toJSON.numParams()
-toJSON.isVararg()
-toJSON.name()
-
-// weak reference stuff
-deref(null)
-deref(false)
-deref(0)
-deref(0.0)
-deref('\0')
-deref(weakref({}))
+module tests.baselib
+
+import tests.common : xfail
+
+// GC
+collectGarbage()
+bytesAllocated()
+
+// functional
+curry(\x, y -> x + y, 3)(4)
+bindContext(\->this, 3)()
+
+// reflection
+findGlobal("frendle")
+isSet("tests")
+isSet("frendle")
+typeof(5)
+nameOf(_G)
+nameOf(nameOf)
+nameOf(StringBuffer)
+xfail$\{ nameOf(4) }
+fieldsOf(class{})
+fieldsOf(class{}())
+xfail$\{ fieldsOf(4) }
+foreach(v; allFieldsOf(class:StringBuffer{ opLength = 4; this() :xx = 4 }())){}
+xfail$\{ foreach(v; allFieldsOf(5)){} }
+hasField(StringBuffer, "x")
+hasMethod(StringBuffer, "x")
+findField(StringBuffer, "opLength")
+findField(StringBuffer, "forbleborble")
+xfail$\{ findField(4, "x") }
+rawSetField(class{}(), "x", 5)
+rawGetField(class{x}(), "x")
+attrs(class{}, {})
+hasAttributes(StringBuffer)
+attributesOf(StringBuffer)
+
+// conversion
+toString(5, 'x')
+toString('x')
+rawToString(5)
+toBool(5)
+toInt(false)
+toInt(5)
+toInt(4.5)
+toInt('x')
+toInt("5")
+xfail$\{ toInt(null) }
+toFloat(false)
+toFloat(5)
+toFloat(4.5)
+toFloat('x')
+toFloat("5")
+xfail$\{ toFloat(null) }
+toChar(5)
+format()
+format(4.5, 'x', {})
+format("hello {} world", 3)
+format("{")
+format("{r}")
+format("{0}")
+
+// console
+write(4)
+writeln(4)
+writef(4)
+writefln(4)
+
+{
+ local t = {}
+ t.s = "\'\"\\\a\b\f\n\r\t\vx\u2000\U00100000"
+ t.a = [0 1 2 3]
+ t.a[0] = t.a
+ t.t = t
+ t.n = namespace N { x = 5; y = 10 }
+ t.n.n = t.n
+ t.c = 'x'
+ t.w = weakref({})
+
+ dumpVal(t)
+}
+
+// dynamic compilation
+loadString("")
+loadString("", "")
+loadString("", namespace N{})
+loadString("", "", namespace N{})
+eval("1")
+eval("1", namespace N{})
+loadJSON("{}")
+toJSON({})
+
+// function metatable
+toJSON.environment();
+(\->1).environment(namespace N{})
+toJSON.isNative()
+toJSON.numParams()
+toJSON.isVararg()
+toJSON.name()
+
+// weak reference stuff
+deref(null)
+deref(false)
+deref(0)
+deref(0.0)
+deref('\0')
+deref(weakref({}))
xfail$\{ deref({}) }
View
30 tests/char.croc
@@ -1,16 +1,16 @@
-module tests.char
-
-local c = 'h'
-c.toLower()
-c.toUpper()
-c.isAlpha()
-c.isAlNum()
-c.isLower()
-c.isUpper()
-c.isDigit()
-c.isCtrl()
-c.isPunct()
-c.isSpace()
-c.isHexDigit()
-c.isAscii()
+module tests.char
+
+local c = 'h'
+c.toLower()
+c.toUpper()
+c.isAlpha()
+c.isAlNum()
+c.isLower()
+c.isUpper()
+c.isDigit()
+c.isCtrl()
+c.isPunct()
+c.isSpace()
+c.isHexDigit()
+c.isAscii()
c.isValid()
View
76 tests/common.croc
@@ -1,39 +1,39 @@
-module tests.common
-
-function xpass(s: string|function)
-{
- try
- {
- if(isString(s))
- loadString(s)
- else
- s()
- }
- catch(e)
- throw "Expected to pass but failed"
-}
-
-function xfail(s: string|function)
-{
- try
- {
- if(isString(s))
- loadString(s)
- else
- s()
- }
- catch(e)
- return
-
- throw "Expected to fail but passed"
-}
-
-function xfailex(s: string)
-{
- try
- loadString(s)()
- catch(e)
- return
-
- throw "Expected to fail but passed"
+module tests.common
+
+function xpass(s: string|function)
+{
+ try
+ {
+ if(isString(s))
+ loadString(s)
+ else
+ s()
+ }
+ catch(e)
+ throw "Expected to pass but failed"
+}
+
+function xfail(s: string|function)
+{
+ try
+ {
+ if(isString(s))
+ loadString(s)
+ else
+ s()
+ }
+ catch(e)
+ return
+
+ throw "Expected to fail but passed"
+}
+
+function xfailex(s: string)
+{
+ try
+ loadString(s)()
+ catch(e)
+ return
+
+ throw "Expected to fail but passed"
}
View
756 tests/compiler/compiler.croc
@@ -1,378 +1,378 @@
-#!/usr/bin/croci
-@attrs({})
-module tests.compiler.compiler
-import FRACK = tests.dummy: xxx = XXX, YYY
-import("tests.dummy")
-
-import tests.common : xpass, xfail, xfailex
-
-// ast
-class O {}
-function foo(x = null, y = true, z = 'x') { return 1, 2, 3 }
-namespace N {}
-assert(true, "foo")
-assert(true)
-foo()
-while(false){}
-do{}while(false)
-for(;false;){}
-for(i: 0 .. 1){continue}
-foreach(c; "x"){}
-switch(4){case 4, 5: foo(); foo(); case true: default: break}
-try{}catch(e){}finally{}
-O = 4
-O || foo()
-O += 1
-O -= 1
-O *= 2
-O /= 2
-O %= 2
-O |= O
-O ^= O
-O &= 1
-O <<= 1
-O >>= 1
-O >>>= 1
-O = O | 5
-O = O & 5
-O = O ^ 5
-O = O << 5
-O = O >> 5
-O = O >>> 5
-O = O - 5
-O = O * 5
-O = O / 5
-O = O % 5
-O = -O
-O = ~O
-O = !O
-O = #"hi"
-O++
-O--
-++O
---O
-O = O + 5
-xfail("O = 4 + 'x'")
-xfailex("O = `hi` ~ 5")
-O = "hi"
-O ~= 'x'
-O = O ~ 'x'
-O ?= 0
-O = namespace Neener{}
-O = [i for i in 0 .. 3]
-O[0] = O[0]
-O[0 .. 1] = O[0 .. 1]
-#O = 0
-xfail("4 + 5")
-xfail("x, y = 5")
-xfail("5 += 6")
-O = true ? 4 : 5
-true ? foo() : foo()
-true && foo()
-false || foo()
-O = 4 == 5
-O = 4 != 5
-O = 4 is 5
-O = 4 !is 5
-O = 4 < 5
-O = 4 <= 5
-O = 4 > 5
-O = 4 >= 5
-O = 4 <=> 5
-O = Object as Object
-O = 'x' in "hello"
-O = 'x' !in "hello"
-O = coroutine foo
-O = class{}
-O = class O {}
-O.x = 5
-O.x = O.x
-N = O.super
-O, N = foo()
-O = class{ function f(){ return this } this() {}}
-O.f()
-O.("f")()
-O, N = O.f()
-O = null
-if(null){}
-function bar(vararg){ local x, y = vararg; x = #vararg; x = vararg[0]; vararg[0] = x; x, y = vararg[] }
-if(5){}
-O = 5 + 4.5
-if(4.5){}
-if('x'){}
-O = 'x' <=> 'y'
-if("hi"){}
-O = (4 + 5)
-O = {}
-function coro() { local x, y = yield(5); yield() }
-O = [c for c in "hello"]
-O = [c for c in "hello" if c < 'x']
-O = [x for x in [1, 2, 3] for y in [1, 2, 3]]
-O = [x for x in [1, 2, 3] for y in [1, 2, 3] if y == 1]
-O = [i for i in 0 .. 10 for j in 0 .. 1]
-O = [i for i in 0 .. 10 if i & 1]
-O = {[k] = v for k, v in {}}
-
-// lexer
-xfail(`local x = {`)
-O = "\u0fF9"
-xfail("x = 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")
-O = .3
-O = 0b10_10
-xfail("O = 0b3")
-O = 0x9_3502
-xfail("O = 0xg")
-O = [1, 2, 3][0..2]
-O = 34_54
-O = 0._4
-O = 0.2
-O = 0.3_3e-4_5
-xfail("O = 0.3e")
-xfail(`O = "\ugggg"`)
-xfail(`O = "\`) /+ ` +/
-O = "\a\b\f\n\r\t\v\\\"\'\x34\u0034\U00000034"
-xfail(`O = "\/"`)
-loadJSON(`["\/"]`)
-xfail(`O = "\xFF"`)
-xfail(`O = "\uFFFF`)
-xfail(`O = "\U0000FFFF"`)
-xfail(`O = "\UFFFFFFFF"`)
-O = "\110"
-xfail(`O = "\189"`)
-xfail(`O = "`)
-O = "o hai
-there"
-O = `hi ``there`
-xfail("O = '")
-xfail("O = 'x")
-O = '\x34'
-O = \->4
-/*
-aosfk*
-*/
-xfail("/*")
-xfail("f() g()")
-/+
-aoskf /
-/+ aoskf + aaskf +/
-+/
-xfail("/+")
-@attrs({}) function brak() {}
-O = @"hello"
-xfail("__x = 5")
-
-// parser
-foo = function() {}
-foo(1, 2, 3)
-eval("4 + 5")
-xfailex(`eval("4 + 5 5")`)
-loadJSON("{}")
-xfail("for(;;);")
-xfail("while(false)")
-xpass("@foo.bar.baz @quux function f() {}")
-xpass("@foo(with 5, 2, 3) function f() {}")
-xfail("@foo local x")
-xpass("local function f(){} local class O{} local namespace N{}")
-xfail("local for")
-xfail("@foo for")
-global function BRAK(){}
-xfail("f = function(x, y) { greep }")
-foo = function(this: int, x, vararg) = 5
-xfail("f = function(x: int|int){}")
-foo = function(x: instance A.B.C, y: null|function|namespace|class|instance){}
-foo = function(x: instance(A), y: A.B, z: instance A){}
-xfail("f = function(x: instance 4){}")
-foo = function(x: bool|float|char|table|array|thread|nativeobj|weakref, y: A){}
-foo = function freep(x: !null, y: any){}
-xfail(`f = \x -> yield`)
-xpass("global class O:I{ @foo function foo() {} @foo this(){} }")
-xfail("class O { x = 5; x }")
-xfail("class O {")
-xfail("class O {5}")
-xpass("global namespace N:M{x; function y(){}}")
-xfail("namespace N { x = 5; x }")
-xfail("namespace N {")
-xfail("namespace N {5}")
-for(local x = 5, O = 0; false; x++, O++){}
-for(i: 0 .. 10, 2){}
-foreach(k, v; {}){}
-xfail("foreach(k, v; {}){")
-foreach(k, v; [], "reverse"){}
-xfail("foreach(v; 1, 2, 3, 4){}")
-if(local x = true){}else{}
-xfail("return 3 return")
-xfail("try{}")
-while(local x = false){}
-xpass(`x = super.foo(); super.("foo")(3); super.f $ 5, 5; y = :y`)
-xpass(`:("x") = 5; :super.x = 5`)
-xfail("++for")
-loadJSON(`[null, true, false, 4, 4.5, [], {"x":5, "y":10}]`)
-xfailex(`loadJSON("[freep]")`)
-O = { function foo() {}, x = 5 }
-O.foo $ 5, 10;
-(O.foo) $ 5, 10
-xfail("foo()
-(bar)()")
-O.foo(with 5, 20)
-local A = [1, 2, 3, 4, 5]
-A[] = A[..]
-A[0..] = A[..5]
-xfail("x = [x for x, y in 0 .. 10]")
-A = [x for x in 0 .. 10, 3]
-xfail("x = [x for x in `hello`, 4, 43, 2]")
-{ local xx = \{} }
-
-// semantic
-foo = function(x = freep(), y: int = 5, z = 4.5, w = "hai"){}
-xfail("function foo(x: int = 'x'){}")
-xfail("import(5)")
-if(false){}else{}
-if(foo is foo){}
-while(true){break}
-do{break}while(true)
-for(;true;){break}
-xfail("for(i: 4.5 .. 5){}")
-xfail("for(i: 4 .. 5.5){}")
-xfail("for(i: 4 .. 5, 4.5){}")
-xfail("for(i: 4 .. 5, 0){}")
-O ?= null
-O = "hi"
-O ~= 'x' ~ O
-O = false ? 1 : 2
-O = O ? O : O
-O = true || true
-O = false || false
-O = O || O
-O = true && true
-O = false && false
-O = O && O
-O = 3 | 4
-xfail("x = 3 | 4.5")
-O = 3 ^ 4
-xfail("x = 3 ^ 4.5")
-O = 3 & 4
-xfail("x = 3 & 4.5")
-O = null is null
-O = true is true
-O = 3.4 is 3.4
-O = 3.0 == 3
-O = 'x' is 'x'
-O = "hi" is "hi"
-O = 3 is 'x'
-xfail("x = 4 == null")
-O = null < null
-O = 3 < 4
-O = 3 < 4.5
-O = "x" < "y"
-xfail("x = 4 < `u`")
-O = O <=> O
-O = O as Object
-xfail("x = 4 as 5")
-O = 3 << 4
-xfail("x = 3 << 4.5")
-O = 3 >> 4
-xfail("x = 3 >> 4.5")
-O = 3 >>> 4
-xfail("x = 3 >>> 4.5")
-O = 3 - 4
-O = 3.4 - 4
-xfail("x = 3 - 'x'")
-O = 'x' ~ 'y' ~ 'z' ~ 'w'
-O = 3 * 4
-O = 3.4 * 4
-xfail("x = 3 * 'x'")
-O = 3 / 4
-O = 3.4 / 4
-xfail("x = 3 / 'x'")
-xfail("x = 3 / 0")
-O = 3 % 4
-O = 3.4 % 4
-xfail("x = 3 % 'x'")
-xfail("x = 3 % 0")
-O = -3
-O = -3.4
-xfail("x = -'x'")
-O = !true
-O = 5
-A = !(3 < O)
-A = !(3 <= O)
-A = !(3 > O)
-A = !(3 >= O)
-A = !(3 == O)
-A = !(3 != O)
-A = !(3 is O)
-A = !(3 !is O)
-O = 'x'
-A = !(O in "hello")
-A = !(O !in "hello")
-if(!(A && A)){}
-if(!(A || A)){}
-O = ~5
-xfail("x = ~'x'")
-xfail("x = #4")
-xfail("x.(4) = 5")
-xfail("x.(5)()")
-xfail("x = 4[5]")
-O = "hello"[3]
-O = "hello"[-1]
-xfail("x = `hello`[53]")
-xfail("x = vararg['x']")
-xfail("x = 4[5..6]")
-O = "hello"[2 .. 4]
-O = "hello"[-3 .. -1]
-O = "hello"[]
-xfail("x = `hello`[3 .. 235]")
-xfail("x = vararg[3.4 ..]")
-xfail("x = vararg[.. 3.4]")
-O = (function(){}())
-A = [x for k, v in {} if k !is null for i in 0 .. 10]
-A = [x for k in 0 .. 0 if k !is null for i in 0 .. 10]
-
-// codegen
-xfail("local x; local x")
-{ local function fork() { local a = []; for(i: 0 .. 10) a ~= \->i } }
-switch(5) { case null, 3.5, 'x', "hi": break; default: break; }
-xfail("switch(5) { case 3: case 3: break; }")
-{
- local z = 0;
-
- (function()
- {
- local x, y;
- foo = function() return 1, 2, 3;
- x = [0, 0, 0]
- y = 0
- x[y], y = foo()
- x[z], z = foo()
- })()
-}
-xpass("global x, y = foo(); x.x, y.x = foo(); vararg[x], vararg[y] = foo()")
-xpass("arr[0 .. 10], arr[11 .. 20] = foo(); #arr1, #arr2 = foo()")
-xpass("global x = false; global y = vararg[0]; global z = #a; global w = vararg")
-xpass("global x = vararg[]; x = a[0]; x = #a; x = vararg; x = vararg[]")
-xpass("local x; x = vararg; x = vararg[]; return foo()")
-xfail("continue")
-for(i: 0 .. 1) { local f = \->i; continue }
-xfail("break")
-for(i: 0 .. 1) { local f = \->i; break }
-xfail("import foo = bar: foo = baz")
-xfail("import foo: bar = baz, baz = qus")
-xpass("import foo: bar, baz")
-xfail("local x, x")
-xpass("global x, y")
-xpass("if(local x = foo()){}else{}")
-xpass("while(local x = true){}while(local x = foo()){}while(foo()){}")
-xpass("do{}while(foo())")
-xpass("for(local x = 5, foo(); bar(); baz++, quux++){}")
-xpass("foreach(k, v; a, b, c){}foreach(k, v; a, b()){}foreach(k, v; a()){}")
-xpass("switch(4){case foo(): break;}")
-xpass("return x, foo()")
-xpass("try{}finally{}")
-xfail("function foo() = #vararg")
-xpass("foo(bar, baz())")
-xfail("function foo() = vararg[0]")
-xfail("function foo() = vararg[]")
-xfail("function foo() = vararg")
-xpass("a = [1, 2, foo()]")
-xpass("yield(foo())")
-xpass("if(x?y:z){}if(this){}if((foo())){}")
+#!/usr/bin/croci
+@attrs({})
+module tests.compiler.compiler
+import FRACK = tests.dummy: xxx = XXX, YYY
+import("tests.dummy")
+
+import tests.common : xpass, xfail, xfailex
+
+// ast
+class O {}
+function foo(x = null, y = true, z = 'x') { return 1, 2, 3 }
+namespace N {}
+assert(true, "foo")
+assert(true)
+foo()
+while(false){}
+do{}while(false)
+for(;false;){}
+for(i: 0 .. 1){continue}
+foreach(c; "x"){}
+switch(4){case 4, 5: foo(); foo(); case true: default: break}
+try{}catch(e){}finally{}
+O = 4
+O || foo()
+O += 1
+O -= 1
+O *= 2
+O /= 2
+O %= 2
+O |= O
+O ^= O
+O &= 1
+O <<= 1
+O >>= 1
+O >>>= 1
+O = O | 5
+O = O & 5
+O = O ^ 5
+O = O << 5
+O = O >> 5
+O = O >>> 5
+O = O - 5
+O = O * 5
+O = O / 5
+O = O % 5
+O = -O
+O = ~O
+O = !O
+O = #"hi"
+O++
+O--
+++O
+--O
+O = O + 5
+xfail("O = 4 + 'x'")
+xfailex("O = `hi` ~ 5")
+O = "hi"
+O ~= 'x'
+O = O ~ 'x'
+O ?= 0
+O = namespace Neener{}
+O = [i for i in 0 .. 3]
+O[0] = O[0]
+O[0 .. 1] = O[0 .. 1]
+#O = 0
+xfail("4 + 5")
+xfail("x, y = 5")
+xfail("5 += 6")
+O = true ? 4 : 5
+true ? foo() : foo()
+true && foo()
+false || foo()
+O = 4 == 5
+O = 4 != 5
+O = 4 is 5
+O = 4 !is 5
+O = 4 < 5
+O = 4 <= 5
+O = 4 > 5
+O = 4 >= 5
+O = 4 <=> 5
+O = Object as Object
+O = 'x' in "hello"
+O = 'x' !in "hello"
+O = coroutine foo
+O = class{}
+O = class O {}
+O.x = 5
+O.x = O.x
+N = O.super
+O, N = foo()
+O = class{ function f(){ return this } this() {}}
+O.f()
+O.("f")()
+O, N = O.f()
+O = null
+if(null){}
+function bar(vararg){ local x, y = vararg; x = #vararg; x = vararg[0]; vararg[0] = x; x, y = vararg[] }
+if(5){}
+O = 5 + 4.5
+if(4.5){}
+if('x'){}
+O = 'x' <=> 'y'
+if("hi"){}
+O = (4 + 5)
+O = {}
+function coro() { local x, y = yield(5); yield() }
+O = [c for c in "hello"]
+O = [c for c in "hello" if c < 'x']
+O = [x for x in [1, 2, 3] for y in [1, 2, 3]]
+O = [x for x in [1, 2, 3] for y in [1, 2, 3] if y == 1]
+O = [i for i in 0 .. 10 for j in 0 .. 1]
+O = [i for i in 0 .. 10 if i & 1]
+O = {[k] = v for k, v in {}}
+
+// lexer
+xfail(`local x = {`)
+O = "\u0fF9"
+xfail("x = 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")
+O = .3
+O = 0b10_10
+xfail("O = 0b3")
+O = 0x9_3502
+xfail("O = 0xg")
+O = [1, 2, 3][0..2]
+O = 34_54
+O = 0._4
+O = 0.2
+O = 0.3_3e-4_5
+xfail("O = 0.3e")
+xfail(`O = "\ugggg"`)
+xfail(`O = "\`) /+ ` +/
+O = "\a\b\f\n\r\t\v\\\"\'\x34\u0034\U00000034"
+xfail(`O = "\/"`)
+loadJSON(`["\/"]`)
+xfail(`O = "\xFF"`)
+xfail(`O = "\uFFFF`)
+xfail(`O = "\U0000FFFF"`)
+xfail(`O = "\UFFFFFFFF"`)
+O = "\110"
+xfail(`O = "\189"`)
+xfail(`O = "`)
+O = "o hai
+there"
+O = `hi ``there`
+xfail("O = '")
+xfail("O = 'x")
+O = '\x34'
+O = \->4
+/*
+aosfk*
+*/
+xfail("/*")
+xfail("f() g()")
+/+
+aoskf /
+/+ aoskf + aaskf +/
++/
+xfail("/+")
+@attrs({}) function brak() {}
+O = @"hello"
+xfail("__x = 5")
+
+// parser
+foo = function() {}
+foo(1, 2, 3)
+eval("4 + 5")
+xfailex(`eval("4 + 5 5")`)
+loadJSON("{}")
+xfail("for(;;);")
+xfail("while(false)")
+xpass("@foo.bar.baz @quux function f() {}")
+xpass("@foo(with 5, 2, 3) function f() {}")
+xfail("@foo local x")
+xpass("local function f(){} local class O{} local namespace N{}")
+xfail("local for")
+xfail("@foo for")
+global function BRAK(){}
+xfail("f = function(x, y) { greep }")
+foo = function(this: int, x, vararg) = 5
+xfail("f = function(x: int|int){}")
+foo = function(x: instance A.B.C, y: null|function|namespace|class|instance){}
+foo = function(x: instance(A), y: A.B, z: instance A){}
+xfail("f = function(x: instance 4){}")
+foo = function(x: bool|float|char|table|array|thread|nativeobj|weakref, y: A){}
+foo = function freep(x: !null, y: any){}
+xfail(`f = \x -> yield`)
+xpass("global class O:I{ @foo function foo() {} @foo this(){} }")
+xfail("class O { x = 5; x }")
+xfail("class O {")
+xfail("class O {5}")
+xpass("global namespace N:M{x; function y(){}}")
+xfail("namespace N { x = 5; x }")
+xfail("namespace N {")
+xfail("namespace N {5}")
+for(local x = 5, O = 0; false; x++, O++){}
+for(i: 0 .. 10, 2){}
+foreach(k, v; {}){}
+xfail("foreach(k, v; {}){")
+foreach(k, v; [], "reverse"){}
+xfail("foreach(v; 1, 2, 3, 4){}")
+if(local x = true){}else{}
+xfail("return 3 return")
+xfail("try{}")
+while(local x = false){}
+xpass(`x = super.foo(); super.("foo")(3); super.f $ 5, 5; y = :y`)
+xpass(`:("x") = 5; :super.x = 5`)
+xfail("++for")
+loadJSON(`[null, true, false, 4, 4.5, [], {"x":5, "y":10}]`)
+xfailex(`loadJSON("[freep]")`)
+O = { function foo() {}, x = 5 }
+O.foo $ 5, 10;
+(O.foo) $ 5, 10
+xfail("foo()
+(bar)()")
+O.foo(with 5, 20)
+local A = [1, 2, 3, 4, 5]
+A[] = A[..]
+A[0..] = A[..5]
+xfail("x = [x for x, y in 0 .. 10]")
+A = [x for x in 0 .. 10, 3]
+xfail("x = [x for x in `hello`, 4, 43, 2]")
+{ local xx = \{} }
+
+// semantic
+foo = function(x = freep(), y: int = 5, z = 4.5, w = "hai"){}
+xfail("function foo(x: int = 'x'){}")
+xfail("import(5)")
+if(false){}else{}
+if(foo is foo){}
+while(true){break}
+do{break}while(true)
+for(;true;){break}
+xfail("for(i: 4.5 .. 5){}")
+xfail("for(i: 4 .. 5.5){}")
+xfail("for(i: 4 .. 5, 4.5){}")
+xfail("for(i: 4 .. 5, 0){}")
+O ?= null
+O = "hi"
+O ~= 'x' ~ O
+O = false ? 1 : 2
+O = O ? O : O
+O = true || true
+O = false || false
+O = O || O
+O = true && true
+O = false && false
+O = O && O
+O = 3 | 4
+xfail("x = 3 | 4.5")
+O = 3 ^ 4
+xfail("x = 3 ^ 4.5")
+O = 3 & 4
+xfail("x = 3 & 4.5")
+O = null is null
+O = true is true
+O = 3.4 is 3.4
+O = 3.0 == 3
+O = 'x' is 'x'
+O = "hi" is "hi"
+O = 3 is 'x'
+xfail("x = 4 == null")
+O = null < null
+O = 3 < 4
+O = 3 < 4.5
+O = "x" < "y"
+xfail("x = 4 < `u`")
+O = O <=> O
+O = O as Object
+xfail("x = 4 as 5")
+O = 3 << 4
+xfail("x = 3 << 4.5")
+O = 3 >> 4
+xfail("x = 3 >> 4.5")
+O = 3 >>> 4
+xfail("x = 3 >>> 4.5")
+O = 3 - 4
+O = 3.4 - 4
+xfail("x = 3 - 'x'")
+O = 'x' ~ 'y' ~ 'z' ~ 'w'
+O = 3 * 4
+O = 3.4 * 4
+xfail("x = 3 * 'x'")
+O = 3 / 4
+O = 3.4 / 4
+xfail("x = 3 / 'x'")
+xfail("x = 3 / 0")
+O = 3 % 4
+O = 3.4 % 4
+xfail("x = 3 % 'x'")
+xfail("x = 3 % 0")
+O = -3
+O = -3.4
+xfail("x = -'x'")
+O = !true
+O = 5
+A = !(3 < O)
+A = !(3 <= O)
+A = !(3 > O)
+A = !(3 >= O)
+A = !(3 == O)
+A = !(3 != O)
+A = !(3 is O)
+A = !(3 !is O)
+O = 'x'
+A = !(O in "hello")
+A = !(O !in "hello")
+if(!(A && A)){}
+if(!(A || A)){}
+O = ~5
+xfail("x = ~'x'")
+xfail("x = #4")
+xfail("x.(4) = 5")
+xfail("x.(5)()")
+xfail("x = 4[5]")
+O = "hello"[3]
+O = "hello"[-1]
+xfail("x = `hello`[53]")
+xfail("x = vararg['x']")
+xfail("x = 4[5..6]")
+O = "hello"[2 .. 4]
+O = "hello"[-3 .. -1]
+O = "hello"[]
+xfail("x = `hello`[3 .. 235]")
+xfail("x = vararg[3.4 ..]")
+xfail("x = vararg[.. 3.4]")
+O = (function(){}())
+A = [x for k, v in {} if k !is null for i in 0 .. 10]
+A = [x for k in 0 .. 0 if k !is null for i in 0 .. 10]
+
+// codegen
+xfail("local x; local x")
+{ local function fork() { local a = []; for(i: 0 .. 10) a ~= \->i } }
+switch(5) { case null, 3.5, 'x', "hi": break; default: break; }
+xfail("switch(5) { case 3: case 3: break; }")
+{
+ local z = 0;
+
+ (function()
+ {
+ local x, y;
+ foo = function() return 1, 2, 3;
+ x = [0, 0, 0]
+ y = 0
+ x[y], y = foo()
+ x[z], z = foo()
+ })()
+}
+xpass("global x, y = foo(); x.x, y.x = foo(); vararg[x], vararg[y] = foo()")
+xpass("arr[0 .. 10], arr[11 .. 20] = foo(); #arr1, #arr2 = foo()")
+xpass("global x = false; global y = vararg[0]; global z = #a; global w = vararg")
+xpass("global x = vararg[]; x = a[0]; x = #a; x = vararg; x = vararg[]")
+xpass("local x; x = vararg; x = vararg[]; return foo()")
+xfail("continue")
+for(i: 0 .. 1) { local f = \->i; continue }
+xfail("break")
+for(i: 0 .. 1) { local f = \->i; break }
+xfail("import foo = bar: foo = baz")
+xfail("import foo: bar = baz, baz = qus")
+xpass("import foo: bar, baz")
+xfail("local x, x")
+xpass("global x, y")
+xpass("if(local x = foo()){}else{}")
+xpass("while(local x = true){}while(local x = foo()){}while(foo()){}")
+xpass("do{}while(foo())")
+xpass("for(local x = 5, foo(); bar(); baz++, quux++){}")
+xpass("foreach(k, v; a, b, c){}foreach(k, v; a, b()){}foreach(k, v; a()){}")
+xpass("switch(4){case foo(): break;}")
+xpass("return x, foo()")
+xpass("try{}finally{}")
+xfail("function foo() = #vararg")
+xpass("foo(bar, baz())")
+xfail("function foo() = vararg[0]")
+xfail("function foo() = vararg[]")
+xfail("function foo() = vararg")
+xpass("a = [1, 2, foo()]")
+xpass("yield(foo())")
+xpass("if(x?y:z){}if(this){}if((foo())){}")
View
6 tests/dummy.croc
@@ -1,4 +1,4 @@
-module tests.dummy;
-
-global XXX = 5;
+module tests.dummy;
+
+global XXX = 5;
global YYY = 10;
View
4 tests/files/lines.txt
@@ -1,3 +1,3 @@
-a
-b
+a
+b
c
View
36 tests/hash.croc
@@ -1,19 +1,19 @@
-module tests.hash
-
-import hash = hash
-
-// croc.table
-local t = {}
-local x = 'x' in t
-x = #t
-foreach(k, v; t) {}
-t.x = weakref({})
-collectGarbage()
-
-// croc.namespace
-foreach(k, v; namespace N {x}){}
-hash.remove(namespace N {x}, "x")
-hash.clear(namespace N {})
-
-// croc.hashlib
+module tests.hash
+
+import hash = hash
+
+// croc.table
+local t = {}
+local x = 'x' in t
+x = #t
+foreach(k, v; t) {}
+t.x = weakref({})
+collectGarbage()
+
+// croc.namespace
+foreach(k, v; namespace N {x}){}
+hash.remove(namespace N {x}, "x")
+hash.clear(namespace N {})
+
+// croc.hashlib
// GODDOMOT FRONK
View
1,266 tests/interpreter.croc
@@ -1,634 +1,634 @@
-module tests.interpreter
-
-import tests.common : xfail
-
-function foo(vararg){}
-
-// wut
-{
- xfail$\{ tests.forble() }
- xfail$\{ (class{ constructor = 5 })() }
- local namespace Crap { function foob() {} }
- local x
- local function foo() { x = 3; function bar() = x }
- foo()
-}
-
-// debug stuff
-debug.currentLine(0)
-
-// calling
-{
- local class Frendle
- {
- this() {}
- function opMethod() {}
- }
-
- Frendle().forble()
- Frendle().forble(with 0)
- xfail$\{ (class{}()).forble() }
- Frendle.opMethod()
- xfail$\{ Frendle.forble() }
- foo(Frendle())
- local x, y, z = Frendle()
-
- local f = Frendle()
- f.forble = function forble(){}
- f.forble()
-}
-
-// table stuff
-{
- local t = { function forble() {} }
- t.forble()
- t.keys()
- xfail$\{ t.borble() }
-}
-
-// coroutines
-{
- local co = coroutine function()
- {
- yield()
- yield()
- }
-
- co()
- co()
- co()
- xfail$\{ co() }
-
- co = coroutine function() { co() }
- xfail$\{ co() }
-
- co = coroutine \{ yield((\->0)()) }
- co()
-
- co = coroutine format
- co()
-}
-
-// moar calling
-{
- ({ function opCall(){} })()
- xfail$\{ ({})() }
-}
-
-// toString
-{
- toString(null)
- toString(true)
- toString(0)
- toString(4.5)
- toString('x')
- toString({function toString() = ""})
- xfail$\{ toString({function toString(){}}) }
- toString({})
- rawToString([])
- toString(foo)
- toString(write)
- toString(class{})
- toString(class{}())
- toString(_G)
- rawToString(_G)
- toString(coroutine\{})
- toString(weakref({}))
-}
-
-// in
-{
- local x = 'x' in "x"
- xfail$\{ x = 5 in "x" }
- x = 5 in [1 2 3]
- x = "foo" in _G
- xfail$\{ x = 5 in _G }
- xfail$\{ x = 5 in (class{})() }
- local class Frendle { function opIn() = false }
- x = 5 in Frendle()
- x = 5 !in Frendle()
-}
-
-// idx
-{
- local x = [1 2 3][1]
- xfail$\{ x = [1 2 3]['x'] }
- x = [1 2 3][-1]
- xfail$\{ x = [1 2 3][5] }
- local s = "hello"
- x = s[2]
- x = s[-2]
- xfail$\{ x = s['x'] }
- xfail$\{ x = s[9] }
- local class Frendle { function opIndex() = 0 }
- x = Frendle()[4]
- xfail$\{ x = (class{})[4] }
- local t = {x = 5}
- x = t.x
- x = t.y
- t.opIndex = \->0
- x = t.y
- hash.get(t, "y")
-}
-
-// idxa
-{
- xfail$\{ ([1])['x'] = 5 }
- xfail$\{ ([1])[-3] = 5 }
- xfail$\{ local s = "hi"; s[0] = 6 };
- (class{function opIndexAssign(){}}())[0] = 5
- xfail$\{ ({})[null] = 5 };
- ({function opIndexAssign(){}})[null] = 5
-}
-
-// field
-{
- local x
- xfail$\{ x = (class{}).x }
- xfail$\{ x = (class{}()).x }
- x = (class{function opField() = 0}()).x
- x = (class{x}()).x
- xfail$\{ x = _G.oskfoaksf }
- xfail$\{ x = 5.x }
- xfail$\{ x = _G.(x) }
- xfail$\{ _G.(x) = x }
-}
-
-// fielda
-{
- (class{function opFieldAssign(){}}()).x = 5;
- (class{x}()).x = 5;
- (class{this():x = 5}()).x = 5
- xfail$\{ 5.x = 5 }
-}
-
-// cmp
-{
- local x = 5
- local y = x < 3
- y = x < 3.0
- x = 5.0
- y = x < 3
- y = x < 3.0
- x = null
- y = x < null
- x = true
- y = x < false
- x = 'x'
- y = x < 'y'
- x = "x"
- y = x < "y"
- y = x < "x"
- x = {function opCmp() = 0}
- y = x < {}
- y = {} < x
- y = x < 3
- y = 3 < x
- xfail$\{ y = {} < {} }
- xfail$\{ y = [] < [] }
- xfail$\{ y = 3 < {function opCmp() = null} }
-}
-
-// switchcmp
-{
- local a = 2
- local b = class{}()
-
- local inst = class{function opCmp() = 1}()
-
- switch(inst)
- {
- case a: break
- case b: break
- case inst: break
- }
-
- switch(b)
- {
- case a: break
- case inst: break
- case b: break
- }
-
- switch(5)
- {
- case a: break
- default: break
- }
-}
-
-// equals
-{
- local x = 5
- local y = x == 3
- y = x == 3.0
- x = 5.0
- y = x == 3
- y = x == 3.0
- x = null
- y = x == null
- x = true
- y = x == false
- x = 'x'
- y = x == 'y'
- x = "x"
- y = x == "y"
- y = x == "x"
- x = {function opEquals() = false}
- y = x == {}
- y = {} == x
- y = x == 3
- y = 3 == x
- xfail$\{ y = {} == {} }
- xfail$\{ y = [] == [] }
- xfail$\{ y = 3 == {function opEquals() = null} }
-}
-
-// len
-{
- local s = "hi"
- local x = #s
- x = #{}
- x = #{opLength = \->0}
- xfail$\{ x = #class{} }
-}
-
-// lena
-{
- local a = []
- #a = 3
- xfail$\{ #a = 'x' }
- xfail$\{ #a = -1 }
- xfail$\{ #{} = 0 }
- #{ function opLengthAssign(){} } = 0
-}
-
-// slice
-{
- local a = [1 2 3 4 5]
- local b = a[]
- xfail$\{ b = a[100 .. 100] }
- xfail$\{ b = a['x' .. 'y'] }
- b = a[1 .. 4]
- b = a[-4 .. -1]
- xfail$\{ b = a[0 .. 'x'] }
-
- a = "hello"
- b = a[]
- xfail$\{ b = a[100 .. 100] }
- xfail$\{ b = a['x' .. 'y'] }
- b = a[1 .. 4]
-
- b = (class{opSlice = \->0}())[]
- xfail$\{ b = {}[] }
-}
-
-// slicea
-{
- local a = [1 2 3 4 5]
- local b = a.dup()
- b[] = a
- xfail$\{ b[100 .. 100] = a[] }
- xfail$\{ b['x' .. 'y'] = a[] }
- xfail$\{ b[0 .. 3] = a }
- xfail$\{ b[] = 5 };
- (class{function opSliceAssign(){}}())[] = a
- xfail$\{ ({})[] = a }
-}
-
-// binop
-{
- local x = 5
- local y = x + 3
- y = x - 3
- y = x * 3
- y = x / 3
- y = x % 3
- y = x + 3.0
- y = x - 3.0
- y = x * 3.0
- y = x / 3.0
- y = x % 3.0
- xfail$\{ y = x / 0 }
- xfail$\{ y = x % 0 }
- x = 5.0
- y = x - 3
- y = x * 3
- y = x / 3
- y = x % 3
- y = x + 3.0
- y = x - 3.0
- y = x * 3.0
- y = x / 3.0
- y = x % 3.0
-
- x = class{opAdd = \->0}()
- y = x + 3
- y = 3 + x
- xfail$\{ y = 3 - x }
- x.opAdd_r = \->0
- y = 3 + x
- xfail$\{ y = class{}() + 3 }
-}
-
-// reflbinop
-{
- local x = 5
- xfail$\{ x /= 0 }
- xfail$\{ x %= 0 }
- x += 3
- x -= 3
- x *= 3
- x /= 3
- x %= 3
- x = 5
- x += 3.0
- x -= 3.0
- x *= 3.0
- x /= 3.0
- x %= 3.0
- x = 5.0
- x += 3
- x -= 3
- x *= 3
- x /= 3
- x %= 3
- x = class{opAddAssign = \{}}()
- x += 3
- xfail$\{ x = class{}(); x += 3 }
-}
-
-// neg
-{
- local x = 5
- local y = -x
- x = 5.0
- y = -x
- y = -{opNeg = \->0}
- xfail$\{ y = -{} }
-}
-
-// binarybinop
-{
- local x = 3
- local y = x & 5
- y = x | 5
- y = x ^ 5
- y = x << 5
- y = x >> 5
- y = x >>> 5
- y = (class{opAnd = \->0}()) & 5
-}
-
-// reflbinarybinop
-{
- local x = 5
- x &= 3
- x |= 3
- x ^= 3
- x <<= 3
- x >>= 3
- x >>>= 3
- x = class{opAndAssign = \{}}()
- x &= 5
- xfail$\{ x = {}; x &= 3 }
-}
-
-// com
-{
- local x = 5
- local y = ~x
- y = ~{opCom = \->0}
- xfail$\{ y = ~{} }
-}
-
-// inc
-{
- local x = 5
- x++
- x = 5.0
- x++
- x = {opInc = \{}}
- x++
- xfail$\{ x = {}; x++ }
-}
-
-// dec
-{
- local x = 5
- x--
- x = 5.0
- x--
- x = {opDec = \{}}
- x--
- xfail$\{ x = {}; x-- }
-}
-
-// cat
-{
- local s = "hello"
- local x = s ~ 'c' ~ []
- x = s ~ 'c' ~ (class{opCat_r = \-> 0}())
- xfail$\{ x = s ~ 'c' ~ 24 }
- x = [1 2] ~ 3
- x = [1 2] ~ (class{opCat_r = \-> 0}())
- x = [1 2] ~ (class{}())
- x = (class{}()) ~ [1]
- x = (class{opCat = \->0}()) ~ 3
- xfail$\{ x = (class{}()) ~ 3 }
- x = {} ~ {opCat_r = \-> 0}
- xfail$\{ x = {} ~ {} }
- x = 3 ~ [1]
- x = 3 ~ {opCat_r = \-> 0}
- xfail$\{ x = 3 ~ s }
- xfail$\{ x = 3 ~ {} }
- x = [1] ~ [2]
-}
-
-// cateq
-{
- local s = "hello"
- s ~= "hi"
- s ~= 'c'
- xfail$\{ s ~= 4 }
- s = []
- s ~= 3
- s ~= []
- s = class{opCatAssign = \{}}()
- s ~= 4
- xfail$\{ s = {}; s ~= 4 }
- xfail$\{ s = 5; s ~= 4 }
-}
-
-// throw
-{
- local ex = class{toString = \{ throw "foo"}}()
- xfail$\{ throw ex }
-}
-
-// as
-{
- xfail$\{ local x = xfail as xfail }
- local x = 0
- x = x as Vector
- x = StringBuffer("") as Vector
-}
-
-// superof
-{
- local x = Object.super
- x = class{}.super
- x = (class{}()).super
- x = _G.super
- x = tests.super
- xfail$\{ x = xfail.super }
-}
-
-// stressing
-{
- local function forble(x)
- {
- if(x)
- try forble(x - 1); catch(e){} finally{}
- }
-
- forble(300)
-}
-
-// execute
-{
- // get
- local x
- xfail$\{ x = forbleborble }
-
- // cmov
- x ?= 5
-
- // newglob
- xfail$\{ global freep; global freep }
-
- //import
- xfail$\{ import(x) }
-
- // not
- x = !x
-
- // cmp
- x = 5
- if(x < 0){}
- if(x <= 0){}
- if(x == 0){}
- if(x > 0){}
- if(x >= 0){}
- if(x != 0){}
-
- // cmp3
- x = x <=> 5
-
- // is
- x = x is 5
- x = 0
- x = x is 0
-
- // switch
- switch(5) { case 5: break }
- xfail$\{ switch(5) { case 0: break } }
-
- // for, forloop
- for(i: 0 .. 10){}
- xfail$\{ local x = 0.0; for(i: x .. 10){} }
- xfail$\{ local x = 0; for(i: 0 .. 10, x){} }
- for(i: 10 .. 0){}
-
- // foreach, foreachloop
- foreach(v; [1 2]){}
- xfail$\{ foreach(v; 5){} }
- xfail$\{ foreach(v; class{opApply = \-> 5}()){} }
- local co = coroutine \->0
- co()
- xfail$\{ foreach(v; co){} }
- co = coroutine \{ yield(1); yield(3) }
- foreach(v, _; co){}
-
- // endfinal
- (\{ try try return 0, 1; finally{} finally {} })()
- xfail$\{ try throw "noes"; finally{} }
-
- // function calling
- xfail$\{ local x = 5; (class{}()).(x)() }
- xfail$\{ super.foo() }
- class A{}
- A.foo = \{}
- class B : A { foo = \{ super.foo()} }
- xfail$\{ B().foo(with 5) }
- B().foo()
- B.foo(\{}())
- x = \{};
- (\->x())()
- B.foo = \->({foo=\{}}).foo()
- B().foo()
- B.foo = \->format()
- B().foo()
-
- // vararg stuff
- local function foo(vararg)
- {