Commit graph

40 commits

Author SHA1 Message Date
Daniel Kang
a9a93801b7 add 'times' module 2019-01-29 17:39:25 -08:00
Daniel Kang
378bf510d3 add Time type; add is_array, is_immutable_array, is_map, is_immutable_map, is_time, time builtin function 2019-01-29 16:01:14 -08:00
Daniel Kang
85da0cdc24 force using TrueValue, FalseValue, UndefinedValue 2019-01-28 13:09:40 -08:00
Chyroc
d413d2ffe7 feat: add builtin function: type 2019-01-28 13:19:03 +08:00
Daniel Kang
85001be9b8 implement immutable array and map 2019-01-25 14:54:58 -08:00
Daniel Kang
37016f4e17 add 'printf' and 'sprintf' builtin functions 2019-01-24 16:38:04 -08:00
Daniel Kang
2486457fdf add Iterable interface 2019-01-23 13:36:03 -08:00
Daniel Kang
a562964007
Merge pull request #30 from d5/indexable
Indexable and IndexAssignable
2019-01-23 09:29:19 -08:00
Mike Bazuin
e94b3dab0f Added builtin function from_json
objects/builtin_json.go:
	- Added function builtinFromJSON

objects/builtins.go:
	- Added builtin function from_json

runtim/vm_builtin_test.go:
	- Added tests for builtin function from_json
2019-01-23 17:24:53 +01:00
Mike Bazuin
c4e6e61fb6 Added builtin function to_json
objects/builtin_json.go:
	- Added function builtinToJSON

objects/builtins.go:
	- Added builtin function to_json

runtime/vm_builtin_test.go
	- Added tests for builtin function to_json
2019-01-23 17:24:53 +01:00
Mike Bazuin
65f84ec2d1 Added conversion functions: objectToInterface
objects/conversion.go:
	- Added private helper function
2019-01-23 17:23:51 +01:00
Daniel Kang
1045afd5a4 add Indexable / IndexAssignable interface 2019-01-22 15:44:37 -08:00
Mike Bazuin
d8c83b6578 Moved interfaceToObject from scripts/conversion.go to objects/conversion.go as FromInterface 2019-01-22 21:09:52 +01:00
Daniel Kang
814851abe6 fix compile errors 2019-01-18 14:52:07 -08:00
Mike Bazuin
fae85000cf Convert returns second argument Object as it self in case of failure of conversion of first argument
objects/builtin_convert.go
- Changed type check of in case of args[0] failure to always return
  args[1] if set

runtime/vm_builtin_test.go:
- Changed tests according to changes in objects/builtin_convert.go
2019-01-18 23:29:04 +01:00
Mike Bazuin
a747c98fb5 Builtin converts now take default values
objects/builtin_convert.go: Added defaults to all builtin convert functions except
bool as this one returns false for undefined, instead of undefined.

runtime/vm_builtin_test.go: Added tests for checking default value
behaviour for builtin convert funcs
2019-01-18 22:21:42 +01:00
Daniel Kang
a8d838ad3e Compile can take custom stdlibs 2019-01-18 09:19:45 -08:00
Daniel Kang
9b1a0a36bf add more comments 2019-01-18 01:57:14 -08:00
Daniel Kang
8cad04841e add os File functions; add Bytes type 2019-01-18 01:43:46 -08:00
Daniel Kang
44c55ea296 add some more os module functions, add more built-int functions 2019-01-17 21:23:20 -08:00
Daniel Kang
552e9c01c5 separate objects conversion functions 2019-01-17 16:52:07 -08:00
Daniel Kang
cb5cbad3ad len builtin supports map and module map 2019-01-17 16:51:26 -08:00
Daniel Kang
d4757efc68 use 'strconv.Quote()` instead of string formatter 2019-01-17 16:51:00 -08:00
Daniel Kang
3f55a6b5b0
Modules (#5)
Implement module imports
2019-01-17 01:56:05 -08:00
Daniel Kang
8171d58071
Error Object (#4)
add error expression and error object
2019-01-16 12:23:20 -08:00
Daniel Kang
47da30bb5b some more tests in objects 2019-01-15 20:21:35 -08:00
Daniel Kang
40ad7aa1bb Fix undefined value compatibility 2019-01-15 17:21:58 -08:00
Daniel Kang
344c96d280 add objects tests 2019-01-15 10:35:51 -08:00
Daniel Kang
e1e0e0cb24 fix golint, ineffectassign issues and add some more tests 2019-01-15 10:14:16 -08:00
Daniel Kang
575d969956 split iterator files 2019-01-14 23:52:52 -08:00
Daniel Kang
b79fd4f7ef
Fix lint issues (#2)
* addressing golint issues

* fix all lint issues.
2019-01-14 22:24:33 -08:00
Daniel Kang
dab498651a add tests for Object.BinaryOp 2019-01-14 05:22:28 -08:00
Daniel Kang
8a2784853b add documentation comment on Object and Callable interface 2019-01-14 04:47:36 -08:00
Daniel Kang
ca128af33b reduce number of memory allocation in object binary operators 2019-01-13 14:24:39 -08:00
Daniel Kang
27438eea6f update directory package structure 2019-01-11 02:27:28 -08:00
Daniel Kang
b638f0db87 add objects.Callable 2019-01-09 19:07:03 -08:00
Daniel Kang
c2305f3cce fix parsing and equality bug of "undefined" 2019-01-09 17:26:30 -08:00
Daniel Kang
ce7e5cc980 type conversion builtin functions: string(), int(), bool(), float(), char() 2019-01-09 17:18:37 -08:00
Daniel Kang
cce71f0cd5 update script package 2019-01-09 12:39:40 -08:00
Daniel Kang
2c3282da21 initial commit 2019-01-08 23:17:42 -08:00