Commit Graph

978 Commits (23a7d4a0c6ddb0c86f5edc50ece5e736a667f188)

Author SHA1 Message Date
yuyi 12faf9fcfa
cgen: fix multiple array.map(anon_fn) calls 2020-06-10 13:18:45 +02:00
Ned Palacios 8f9f426479
vdoc: plaintext fixes 2020-06-10 11:14:03 +02:00
Delyan Angelov c7d4360931 v: add full compiler support for _likely_(x) 2020-06-09 17:42:43 +03:00
Delyan Angelov 6663e94780 builtin: add C._likely_ support 2020-06-09 16:36:53 +03:00
yuyi 85c741519b
cgen: fix array.map(fn...) 2020-06-09 12:50:56 +02:00
Alexander Medvednikov 5dcd2303c9 builtin: fix string.fields() 2020-06-09 10:15:20 +02:00
yuyi d472a27489
cgen: fix array.map(anon_fn) 2020-06-09 10:14:10 +02:00
Alexander Medvednikov dabfc4ebd0 checker: do not display errors for incorrectly initialized vars 2020-06-08 13:10:47 +02:00
Delyan Angelov 6c9b2b8303 builtin: use tcc_backtrace for tcc (phase 2) 2020-06-08 10:46:51 +03:00
Ryan Willis 08814d6de4
tools/vsymlink: use the win32 api to update the system environment 2020-06-08 09:19:31 +02:00
Enzo Baldisserri 11b7b97311
parser: fail when assigning to _ with := 2020-06-08 00:47:04 +02:00
Tomas Hellström 9c8769503f
time: add microsecond precision to Time struct 2020-06-07 16:19:09 +03:00
Alexander Medvednikov 13a7ce9e69 gg: GG => Context 2020-06-04 20:26:18 +02:00
Uwe Krüger cf9498ef6b
cgen: use standard checks for float comparisons 2020-06-04 19:47:41 +02:00
yuyi 5ae8853648
all: change `f mut Foo` to `mut f Foo` 2020-06-04 10:35:40 +02:00
pancake e9bcd36d5e
builtin: implement generic break_if_debugger_attached() 2020-06-03 14:11:23 +02:00
Alexander Medvednikov 63b8cdea7a checker: require () in a && b || c 2020-06-02 22:21:44 +02:00
Uwe Krüger 076089d3c5
checker: apply stricter type checks to function args and return types 2020-06-01 21:15:59 +02:00
Naheel 4fcabb71c4
os: implement cp for nix 2020-06-01 21:11:40 +02:00
Delyan Angelov 945439dab6 cgen: print actual values on a failed assert (when possible) 2020-06-01 14:43:38 +03:00
Delyan Angelov 97b9ce04a4 crypto.rand: cleanup test, make it less likely to fail in CI 2020-06-01 07:49:52 +03:00
Emily Hudson 75eac291ac
all: variable sized options 2020-05-31 12:57:26 +02:00
Emily Hudson f0a9b88ac4
all: add stdcall attribute, unhandled exception handler, get_raw_stdin, v_realloc 2020-05-29 03:06:27 +02:00
yuyi 84edbd83da
all: fix struct names error 2020-05-27 19:12:34 +03:00
Delyan Angelov 481f103dc9 checker: make an error using non `pub` fns from other modules 2020-05-27 12:00:19 +03:00
Uwe Krüger 013fdb8a4b
checker: restrict numeric promotions to cases where no data is lost 2020-05-27 05:42:48 +02:00
ka-weihe 64173c792f
builtin: map: fix memory leak 2020-05-26 17:59:52 +02:00
ka-weihe 8ea0c812a2
builtin: map.clone() 2020-05-26 01:52:06 +02:00
Alexander Medvednikov f41e2c0a4b string: make replace() clone for now; parser: comptime method 2020-05-25 08:17:36 +02:00
Uwe Krüger fd4d28b7b6
tests: update for stricter type checks 2020-05-24 21:07:32 +02:00
Delyan Angelov 2adfbfc830 builtin: fix a bug in array_delete 2020-05-24 11:10:41 +03:00
yuyi dda875a9c8
all: unify const names to snake_case 2020-05-22 17:36:09 +02:00
Delyan Angelov 88fa935376 builtin: fix print mem leak on windows 2020-05-22 12:18:27 +03:00
Leah Lundqvist f2ea8ca62c
jsgen: class -> factory 2020-05-21 22:36:06 +02:00
Abdullah Atta 9888bacad5
v: make js hello world work 2020-05-21 16:17:16 +03:00
Tanel Liiv c9f3a05ef6
checker: fix map/filter called with a plain fn argument 2020-05-20 15:28:33 +03:00
Delyan Angelov ac396ea02f http: cleanup backend_nix.c.v, fixes vpm too 2020-05-20 12:04:28 +03:00
Delyan Angelov 931c846602 os: cleanup code duplication for os.create and os.open 2020-05-19 13:38:06 +03:00
Alexander Medvednikov 03525843a0 parser: do not allow calling private functions 2020-05-18 22:54:11 +02:00
Uwe Krüger 2635be511f
all: re-apply C++ support 2020-05-18 21:38:06 +02:00
Alexander Medvednikov 07a78b2843 Revert "all: C++ compiler support"
This reverts commit 9a237c3e82.
2020-05-18 17:05:48 +02:00
Uwe Krüger 9a237c3e82
all: C++ compiler support 2020-05-18 15:51:36 +02:00
Alexander Medvednikov 4f307c1a78 checker: requre & in struct init; http: chunked encoding 2020-05-18 05:11:00 +02:00
yuyi 7f4cf08516
parser: check `(mut f Foo)` syntax 2020-05-17 13:51:18 +02:00
Enzo Baldisserri f44a40eee0
checker: check incorrect names 2020-05-16 16:12:23 +02:00
yuyi 9b6ee8e77d
cgen: array_init_with_default 2020-05-16 15:21:37 +02:00
Delyan Angelov 2dbb4c2ca7 live: cleanup 2020-05-15 23:51:40 +03:00
Swastik Baranwal 04744a5390
string: add trim_prefix and trim_suffix 2020-05-15 19:37:14 +02:00
Delyan Angelov 66cb61c242 builtin: cleanup by turning backtrace* fns to ordinary C. fns 2020-05-15 15:52:06 +03:00
Delyan Angelov 2c93deb884 builtin: bootstrap for backtrace functions cleanup 2020-05-15 15:08:42 +03:00
Alexander Medvednikov ab7bc760c6 cgen: new Option part 1 2020-05-13 21:59:08 +02:00
ka-weihe 85763d0539
map: faster get and exists 2020-05-09 12:42:01 +02:00
Uwe Krüger 722a2c71c3
builtin: new_array: cap should not be less than len 2020-05-07 22:41:41 +02:00
Delyan Angelov 673acdbd00 tcc: fix selfcompilation with tcc. Temporarily disable crashing interface test 2020-05-07 20:59:45 +03:00
Alexander Medvednikov 8cfb2ad6c9 string: is_lit 2020-05-07 18:05:57 +02:00
Delyan Angelov f638caef39 compiler: v -autofree can now compile itself 2020-05-06 19:03:51 +03:00
Ned Palacios 507e457c0a
builtin: add parenthesis around frame_addr as a workaround 2020-05-05 08:35:26 +03:00
ka-weihe f27fd63f8c
builtin: map: one voidptr for all values 2020-05-04 14:56:19 +02:00
Uwe Krüger f831910c5c
utf: fix string length calculation for combining characters 2020-05-04 13:21:11 +02:00
ka-weihe a72f3ed0c7
builtin: voidptr.str() and byteptr.str() 2020-05-04 13:20:18 +02:00
Delyan Angelov 068da2ea0f builtin: fix warning about unused skipframes 2020-05-04 12:05:08 +03:00
Delyan Angelov acd80f052b
tests: improve diagnostic output on failure 2020-05-04 11:21:25 +03:00
yuyi e0e064ff08
scanner: fix string slash line breaks error 2020-05-04 10:19:23 +02:00
Tanel Liiv 68ca8ab8a4
array: nested map() 2020-05-02 15:26:58 +02:00
Uwe Krüger 170ee4312f
cgen: string interpolation field width support for large integers and utf8 strings 2020-05-02 00:43:59 +02:00
Tanel Liiv 182e7071bf
array: map() function 2020-05-01 00:29:54 +02:00
Henrixounez f6d74c8a37
checker: error on ternary if type mismatch 2020-04-30 09:32:29 +02:00
yuyi 1fabb7d5a6
checker: fix string.str() error 2020-04-29 13:51:42 +02:00
Enzo Baldisserri 682838a0cf
checker: check array and fields mutability 2020-04-27 22:53:26 +02:00
joe-conigliaro 9f76a7b250
parser: simplify unused vars & add loop/if vars etc 2020-04-27 23:16:31 +10:00
yuyi e9f764db4f
cgen: uniform string output format 2020-04-27 14:48:28 +02:00
ka-weihe 18faaefe82
map: get: remove malloc and memcpy 2020-04-27 13:27:33 +02:00
Alexander Medvednikov 3256d060f7 array: inline ensure_cap 2020-04-27 07:39:33 +02:00
Alexander Medvednikov ef26f27753 builtin: replace `isnil` calls for perfomance 2020-04-27 07:13:36 +02:00
Alexander Medvednikov 83552a0d58 array: replace make() with the new init syntax 2020-04-26 17:52:27 +02:00
Alexander Medvednikov f23948010a parser: new array init syntax 2020-04-26 17:28:48 +02:00
yuyi 2574dce174
all: fix remaining `[]array` warnings 2020-04-26 16:25:54 +02:00
yuyi 9f4d498ff1
all: update`import ()` and `[]array` 2020-04-26 13:49:31 +02:00
Larpon 7b39ab6d06
string: fix replace_each edge case error message 2020-04-26 12:40:39 +02:00
Alexander Medvednikov 153ac230ec tests: use new array init syntax, fix mutability 2020-04-26 11:56:30 +02:00
Alexander Medvednikov 270566055f checker: make sure all FnDecl types are valid 2020-04-26 10:39:26 +02:00
Alexander Medvednikov 3ab8dc0092 parser: array init: `[]string` => `[]string{}` 2020-04-26 09:17:17 +02:00
Delyan Angelov 620fc962d7 builtin: use single line imports, to make analysis easier 2020-04-26 08:06:39 +03:00
ka-weihe d72e401378
string: optimize eq 2020-04-25 20:19:53 +02:00
Alexander Medvednikov d54b48b300 table: interface cast fix 2020-04-25 09:18:10 +02:00
Alexander Medvednikov 9229a963ed array: use __new_array everywhere 2020-04-25 09:10:54 +02:00
Alexander Medvednikov 48857090fc runtime `as` type check: part 2 2020-04-25 08:42:23 +02:00
Alexander Medvednikov 2d187fb951 runtime `as` type check: part 1 2020-04-25 08:36:53 +02:00
Delyan Angelov c6a829ce82 cgen: support for error('abc').str() and printing errors 2020-04-24 18:35:33 +03:00
yuyi 5664cbd3d0
enum: check enum name and modify related files 2020-04-23 05:16:10 +02:00
Alexander Medvednikov 45e21085c7 tests: re-enable some old array tests 2020-04-23 04:23:19 +02:00
Enzo Baldisserri fecf4ddf65
cgen: fix optional pointers 2020-04-22 20:12:30 +02:00
Delyan Angelov 4b8ed3f831 cgen: fixes for ustring, makes utf8_util_test.v pass 2020-04-22 10:35:14 +03:00
Kris Cherven b288ecb795
cgen: add map string generation 2020-04-22 04:00:38 +02:00
Kris Cherven 155891a4e0
parser: add unused variable warning 2020-04-22 01:52:56 +02:00
Alexey 9c0d97335e
builtin: improve backtrace on Windows 2020-04-20 20:59:08 +02:00
yuyi 27e04748ed
cgen:gen_str_for_array 2020-04-19 10:42:34 +02:00
Delyan Angelov 8a1248b2e7 builder: restore module import cycle detection/topological reorder 2020-04-16 12:29:36 +03:00
Kris Cherven a3ab5df2ed
cgen: prepend __ to new_array 2020-04-15 20:12:06 +02:00
Alexey 91de4e1ece
array: test assignment operators 2020-04-14 20:32:06 +02:00
Alexey 0c63f5c80d
builtin: test left/right shift precedence 2020-04-14 19:38:11 +02:00
Alexander Medvednikov f91d527154 deprecate `import module` 2020-04-14 18:27:30 +02:00
Alexander Medvednikov ec10831318 parser: `[]int{cap:cap, len:len}` syntax; minor fixes 2020-04-14 18:10:16 +02:00
yuyi 682c619456
array: fix array_byte.str error 2020-04-14 05:55:53 +02:00
ka-weihe e247690fe1
map: fast_string_eq and improved comments
* improved comments and fast_string_eq
* make it pass CI
* enumerate traits
* Add parameter back
* remove space
* remove parameter
* Allow bootstrap compilation in one step with old vc (add new_map/2 shim).
2020-04-12 15:10:06 +03:00
yuyi 0ced7116b6
string: add is_upper/is_lower and fix parser.match_expr error
* string: add is_upper/is_lower and fix parser.match_expr error

* to_capital => capitalize, to_title => title

* is_titled => is_title, is_capitalized => is_capital
2020-04-12 13:09:05 +03:00
Alexander Medvednikov 4b029567e5 tests: test string literal indexing and mutable array filter 2020-04-11 23:32:00 +02:00
Alexander Medvednikov 39245f088a array: test !in and filter 2020-04-11 23:01:50 +02:00
lutherwenxu dc4db87be3
vlib: use new filename format 2020-04-11 19:51:32 +02:00
yuyi ea960b2ce2
parser: fix inter literal format error 2020-04-11 17:25:39 +02:00
Delyan Angelov 6433c23a34 string: add s.strip_margin_custom/1, instead of passing varargs to s.strip_margin()
The reason for adding s.strip_margin_custom/1 is that
passing varargs interfere with the current implementation of the
builtin module caching.
2020-04-11 11:06:12 +03:00
yuyi bf20b01586
map: fix map_test.v error 2020-04-09 03:57:08 +02:00
Alexander Medvednikov eb78396307 parser: fix prefix precedence 2020-04-08 13:53:11 +02:00
Delyan Angelov 3bad02abdd cgen: do comparison of f32/f64 values for == and != by calling f64_eq(a,b) and f64_ne(a,b) 2020-04-08 03:51:06 +03:00
ka-weihe 7406abe3b6
map: use strcmp and update wyhash 2020-04-08 00:02:15 +02:00
Alexander Medvednikov 6bbd1943dd cgen: fix &string cast; vfmt fixes 2020-04-07 18:51:44 +02:00
lutherwenxu a8c92e6dff
checker: remove hack and enforce type checking 2020-04-07 03:27:06 +02:00
Major Taylor f099f90f50
string: fix trim_right, add tests 2020-04-06 14:30:25 +02:00
ka-weihe a30d292385
map: fix leaksfree fix (#4254) 2020-04-05 23:31:53 +02:00
ka-weihe 307daacf67
depgraph/map: fix memory bug 2020-04-05 22:09:52 +02:00
Alexey 781c20a6ae
cgen: bring back Windows fixes 2020-04-05 16:08:16 +02:00
Alexander Medvednikov f748390172 parser: do no allow var names with __; cgen: use __argc 2020-04-04 14:55:40 +02:00
Alexander Medvednikov 440f1cf4c6 map: remove old get methods 2020-04-04 14:22:39 +02:00
Alexander Medvednikov 46aed151ab parser: snake_case check; array: mutable array test 2020-04-04 14:09:58 +02:00
Alexey 6c4de001b8
cgen: add `builtin.init` call inside of `_vinit` 2020-04-03 13:27:19 +02:00
Delyan Angelov 6b9bf8cbf7 v2: fixes for most of vlib/builtin/map_test.v . 2020-04-03 00:42:08 +03:00
Alexey 6309e699e5
builtin: add operator precedence test 2020-04-02 19:02:49 +02:00
Delyan Angelov abf15e863c
v2: compile vrepl, 'fn main(){println(2+2)}' runs now
It works if you give it complete V programs like
fn main(){println(2+2)}
but not for single expressions like 2+2 or statements like a:='abc'
2020-04-02 19:21:12 +03:00
penguindark 83289d74a7
builtin: fix int to hex 2020-04-02 17:16:17 +02:00
Alexey 8c050eff07
msvc: add a workaround to fix backtrace (#4200) 2020-04-02 17:11:12 +02:00
Alexey 01aa2b86f5
array, map: cast voidptr to byteptr 2020-04-02 15:31:44 +02:00
Alexander Medvednikov d4df916581 array: cast data to byteptr 2020-04-02 14:58:45 +02:00
Alexander Medvednikov 461a5b2c18 cgen: fix raw strings 2020-04-02 10:15:35 +02:00
Alexander Medvednikov 507f4ce87a array: handle "0" strings 2020-04-02 01:47:32 +02:00
Alexander Medvednikov 1cfe44d9c6 fix windows build 2020-04-02 01:15:00 +02:00
Alexander Medvednikov f98cc9c017 cgen: fix ARR_LEN 2020-03-31 17:16:12 +02:00
Alexander Medvednikov 9d630dff30 allow slicing of fixed size arrays 2020-03-31 16:48:00 +02:00
Alexey a333ac1888
all: remove redundant parentheses in `if` statements 2020-03-29 10:08:42 +02:00
joe-conigliaro 718819eb7a
map/scope/checker: update just var type & ret zero in map.get3 2020-03-29 00:00:28 +11:00
Alexey cedf185b41
v2: fix Windows errors 2020-03-28 10:19:38 +01:00
Alexander Medvednikov 473d9fef55 checker: do not allow extra () in if conditions 2020-03-27 14:57:19 +01:00
Alexander Medvednikov 7fdce50718 cgen: write defer statements at the end of the function 2020-03-27 11:21:00 +01:00
Joe Conigliaro fd8bb2c95c tests: small array/struct test notes & tmp fix 2020-03-27 20:47:24 +11:00
Alexander Medvednikov db59c621e8 v2: minor fixes 2020-03-27 08:47:02 +01:00
Alexander Medvednikov f0334b2e12 cgen: fix `arr[i] *= x` and `2d_arr << arr` 2020-03-26 22:09:25 +01:00
Delyan Angelov f489c89987
v2: more informative assert output; string interpolation formatting 2020-03-26 19:17:14 +01:00
Alexander Medvednikov eb57f192d4 cgen: fix test 2020-03-26 17:21:52 +01:00
Alexander Medvednikov 75c2ef7947 cgen: fix octal and hex int literals 2020-03-26 17:14:24 +01:00
Alexander Medvednikov ed3e0c43bc cgen: for c in string; short struct init syntax fixes; 2020-03-26 17:03:14 +01:00
Alexander Medvednikov fc86269bc9 checker: array str fixes 2020-03-26 11:32:32 +01:00
Alexander Medvednikov 26fab9b274 cgen: fix mutable array args 2020-03-25 17:04:16 +01:00
Alexander Medvednikov 456750ac19 v2: array_test fixes 2020-03-25 14:24:48 +01:00
Alexander Medvednikov b495e78f0e v2: add _vinit to tests' fn main 2020-03-25 00:17:39 +01:00
Alexander Medvednikov 437bba5566 cgen: generate fn main for tests; fix consts bug 2020-03-24 22:24:03 +01:00
Alexander Medvednikov 5d976d841b v2: raw strings 2020-03-24 17:07:27 +01:00
Alexander Medvednikov 32c8eb6490 os: vfmt os_test.v 2020-03-24 16:18:37 +01:00
Alexander Medvednikov f101e9b9e2 v2: string fixes, is_dir fix 2020-03-24 11:14:11 +01:00
SleepyRoy 67ba56c65c
expression: set integer literals as int by default 2020-03-23 20:05:37 +01:00
Alexander Medvednikov 2e29e09b1b cgen: fix map_get: use zero value if the key was not found 2020-03-23 20:02:09 +01:00
Alexander Medvednikov 2738a0c776 cgen: backtrace and sigaction fixes 2020-03-22 14:47:45 +01:00
Joe Conigliaro 043ea80fa9 checker: comptime if expr/stmts & type check fixes 2020-03-22 23:36:27 +11:00
Alexander Medvednikov e5f6a0949f cgen: autofree: first step 2020-03-21 19:52:19 +01:00
penguindark 421f5b6fdf
builtin: int to str without offset buffer 2020-03-21 16:00:58 +01:00
ka-weihe bf97afb9ed
map: small cleanup 2020-03-21 13:55:07 +01:00
radare cc75fe4fe5
builtin: Fix undefined behaviour when allocating empty structs (#4088) 2020-03-21 12:24:34 +01:00
Delyan Angelov ba088056ed
solaris: make 'v test-compiler' pass (stage 2) 2020-03-21 09:48:02 +01:00
radare c21e976cad
builtin: do not use unsafe sprintf/vsprintf functions 2020-03-21 06:37:58 +01:00
Alexander Medvednikov 4fac09bcb4 array: simplify reverse() memcpy call 2020-03-20 16:51:36 +01:00
SleepyRoy f798a0937a
expression: set floats as f64 by default 2020-03-19 07:24:49 +01:00
Alexander Medvednikov 66639924a4 map: make compilable with V2 2020-03-19 07:05:20 +01:00
ka-weihe bd0548548a
map: new memory layout and map.get2() 2020-03-19 06:52:34 +01:00
Alexander Medvednikov ca0bae0fcd array: fix reverse() 2020-03-18 18:54:11 +01:00
Alexander Medvednikov fe6707b26d cgen: minor fixes 2020-03-18 16:47:37 +01:00
Alexander Medvednikov a011b8951a cgen: if/match expressions and other fixes 2020-03-18 08:41:49 +01:00
Major Taylor e2eb0f17d7
string: separate strip_margin tests into different functions 2020-03-17 02:49:51 +01:00
yuyi 456c0250b0
string: fix strip_margin 2020-03-16 15:46:09 +01:00
Alexander Medvednikov d39dd53998 string: bring back test_strip_margins 2020-03-16 15:45:54 +01:00
Joe Conigliaro d456cc479c builtin: revert map to version before 35dd785 until bug is fixed 2020-03-16 23:01:31 +11:00
radare 5581b2bd3c
builtin: fix backtrace for OpenBSD and NetBSD 2020-03-16 12:10:58 +01:00
Alexander Medvednikov 98fc9ab65b string: disable strip_margins test for now 2020-03-15 23:21:32 +01:00
Major Taylor 8d19ba9195
string: strip_margin: fix the error message for multiple args 2020-03-15 07:49:37 +01:00
Major Taylor 2d5c7c8e93
string: add `strip_margin` 2020-03-15 05:46:12 +01:00
Delyan Angelov 9bcb7d115f
panic: restore printing of detailed stack backtraces on linux 2020-03-13 04:32:44 +01:00
Alexander Medvednikov b43ac2783d map: make compilable with the new compiler 2020-03-12 20:26:29 +01:00
ka-weihe 35dd7855a0
map: new memory layout and optimizations 2020-03-12 19:36:05 +01:00
Joe Conigliaro b750f1d1bb compiler: prerequisite changes for upcoming map update 2020-03-12 22:19:13 +11:00
Alexander Medvednikov a182b5c531 cgen: more errors fixed 2020-03-11 23:22:40 +01:00
Alexander Medvednikov e0c85f87ae cgen: args fixes 2020-03-11 21:11:27 +01:00
Delyan Angelov de7fed45dc
builtin: implement []int.str() 2020-03-11 18:48:59 +01:00
Alexander Medvednikov 75db3e4416 cgen: fix ptr indexing 2020-03-11 05:25:15 +01:00
penguindark 630913d872
builtin: new str(), hex() functions without C.printf 2020-03-11 00:38:11 +01:00
Alexander Medvednikov de55a26cfe cgen: lots of fixes 2020-03-10 23:21:29 +01:00
Alexander Medvednikov e3687dc257 checker: check C args 2020-03-08 22:11:56 +01:00
yuyi 783dee1f48
os: merge with filepath 2020-03-07 22:26:26 +01:00
Alexander Medvednikov 63032c4bb7 cgen: minor fixes 2020-03-07 16:23:10 +01:00
Alexander Medvednikov b0ece3a9d8
sync: implement pool.work_on_items to process a list of items in parallel 2020-03-04 20:28:42 +01:00
Alexander Medvednikov cd8a5d1f2e fix parser_test.v and string_test.v 2020-03-04 17:39:27 +01:00
Alexander Medvednikov f27f832ede cgen: definitions + other fixes; calloc fix 2020-03-04 17:08:28 +01:00
Hugo Locurcio 69f256b900
use LF line endings in examples/quick_sort.v 2020-03-03 14:41:05 +01:00
Delyan Angelov 615a4b3452
builtin: add V64_PRINTFORMAT (part 2) 2020-03-01 15:48:54 +01:00
Alexander Medvednikov 82b0024758 fix v2 parser int.v error 2020-03-01 14:57:54 +01:00
Nicolas Sauzede becd87141c
fix linux warnings in generated C code 2020-03-01 13:26:09 +01:00
Alexey cbffbf3438
array: reverse empty arrays correctly 2020-02-29 20:44:02 +01:00
Alexey 99cbc58db8
array: update `array.repeat` 2020-02-29 15:25:49 +01:00
Alexey 632a538eb3
string: update `string.repeat` behavior
Panic if a repeat count is negative.
Return an empty string if a repeat count is zero.
2020-02-29 15:25:31 +01:00
penguindark 39429f7ac9
atof: lots of fixes
* removed sprintf for f64 and f32 use

* removed all pointers from the code, used unions instead

* solved module name problem

* fixed tests on vlib/math

* fix for alpine-linux math test

* small fix on byte allocation for ftoa
2020-02-26 12:14:06 +01:00
spaceface777 ef8c1203b4
cleanup: replace C for loops with range 2020-02-24 17:55:16 +01:00
SleepyRoy 7d2eb4f604
scanner: make `0o` prefix the only way to define octals 2020-02-23 23:43:04 +01:00
yuyi adb1d3f8c9
scanner: enable 0oxx to handle octals 2020-02-23 12:33:07 +01:00
Alexander Medvednikov e56bf42270 v2: xor, for x = ... 2020-02-20 21:28:08 +01:00
Alexey c85ccad0a6
string: update check if a char is a space 2020-02-20 20:14:54 +01:00
Alexey e4de1e1e89
string: add more test cases 2020-02-20 20:14:21 +01:00
Alexander Medvednikov 7705281459 map: use hashmap instead of b-tree 2020-02-20 20:05:06 +01:00
Alexander Medvednikov f413b2fa49 Revert "map: use hashmap instead of b-tree"
This reverts commit 34d926350b.
2020-02-20 17:58:17 +01:00
ka-weihe 34d926350b
map: use hashmap instead of b-tree 2020-02-20 17:28:20 +01:00
yuyi 8be07194c7
string: fix capitalize 2020-02-20 11:33:38 +01:00
Alexander Medvednikov ec3d67c19f checker: print multiple errors; none 2020-02-19 19:54:42 +01:00
yuyi 391da0ba07
string: optimize starts_with and ends_with 2020-02-19 15:18:09 +01:00
Alexander Medvednikov 082acfad49 v2: fix more ast positions 2020-02-19 11:31:33 +01:00
Alexander Medvednikov 19520ccf4e v2: for in checker 2020-02-18 21:59:42 +01:00
Alexander Medvednikov c314ab7b60 fix cmdline_test.v 2020-02-18 20:31:15 +01:00
Alexander Medvednikov 31c1483b9d vfmt2: fn args, comments 2020-02-18 20:20:15 +01:00
Alexander Medvednikov 480af3f381 v2: checker fixes 2020-02-18 20:06:01 +01:00
prime31 a2838ae6f3
array: add `array.trim()` 2020-02-17 20:31:40 +01:00
Delyan Angelov 195f3f465b
option to disable bounds checking; examples/path_tracing.v: optimizations 2020-02-16 16:13:45 +01:00
Alexander Medvednikov d9cf98f772 v2: imports 2020-02-12 01:16:38 +01:00
Alexander Medvednikov 0ec5680156 array: bring back reduce test 2020-02-11 13:22:22 +01:00
Alexander Medvednikov 17212f816c v2: high order functions 2020-02-11 13:21:41 +01:00
joe-conigliaro e274c5c485 v2: type sys - store type idx/ptr in int & add helpers 2020-02-10 08:32:08 +01:00
Delyan Angelov f76651604d
compiler: bugfix for raw'"' 2020-02-09 16:29:05 +01:00
Alexey 1eeee40278
string: split into lines correctly 2020-02-09 09:23:57 +01:00
Alexander Medvednikov 18c440c990 fix int_test.v 2020-02-07 22:16:14 +01:00
Alexander Medvednikov d66bc24e7f remove `as` casts for basic types 2020-02-07 22:10:48 +01:00
Alexander Medvednikov f782388148 v2: minor fixes 2020-02-07 21:29:28 +01:00
Alexander Medvednikov 0510bc7744 fix int.v 2020-02-07 14:57:48 +01:00
Alexander Medvednikov 9034b1fd08 v2: match cgen; use `as` for casting 2020-02-07 14:50:52 +01:00
Alexander Medvednikov 18a3961992 array.v: use `as` cast 2020-02-07 09:38:28 +01:00
Alexander Medvednikov b23854b2ab array.v: fix the build 2020-02-07 09:22:52 +01:00
Alexander Medvednikov f241945d70 v2: `as` cast 2020-02-07 09:19:45 +01:00
Alexander Medvednikov bb60b3081f v2: parse builtin successfully 2020-02-07 07:34:18 +01:00
Alexander Medvednikov 06b5f43e48 builtin: remove unneeded casts 2020-02-05 11:22:24 +01:00
Alexander Medvednikov 2b433cdf64 v2: match, <<=, >>=, |=, ~, unsafe, map init 2020-02-05 10:00:14 +01:00
Alexander Medvednikov c595c9eee1 builtin: bring back old hex() 2020-02-04 20:23:03 +01:00
Alexander Medvednikov 80daaff874 v2: scopes, or, in, hex 2020-02-04 17:44:39 +01:00
Alexander Medvednikov 9b60a50d07 v2: maps, <<, >>, method calls 2020-02-04 12:50:58 +01:00
joe-conigliaro 85e4e4cb40
v2: resolve unresolved call expression types & add test 2020-02-04 12:03:12 +01:00
Alexander Medvednikov 83f0c228e9 v2: parse builtin.v, cfns.v float.v 2020-02-04 09:54:15 +01:00
Alexander Medvednikov 432ee93916 v2: break, continue, for in fixes, fixed size array, | 2020-02-04 08:29:50 +01:00
Alexander Medvednikov 1ac7a95f9b fix array_test.v 2020-02-03 10:27:06 +01:00
Alexander Medvednikov 34e9eb32bb sum types: allow modification in `match` 2020-02-03 09:11:10 +01:00
Alexander Medvednikov d87cb3f672 v2: consts, $if, attributes, globals, if/for type check, prefs 2020-02-03 07:03:32 +01:00
joe-conigliaro 7f709c3285
update copyright years 2020-02-03 05:00:36 +01:00
Alexander Medvednikov 71653273f6 v2: range, *, function object 2020-02-02 14:32:12 +01:00
Alexander Medvednikov 9f4661391d v2: simplify the type system; an initial version of the V interpreter 2020-02-02 07:56:18 +01:00
ka-weihe 23dd6e2294
hashmap: optimization of rehashing 2020-01-31 02:29:35 +01:00
ka-weihe a14a5fbf95
hashmap: change hash-function to wyhash and add benchmarks 2020-01-29 04:06:05 +01:00
joe-conigliaro 007baa2305
hash: add wyhash + benchmark, add fnv1a, add u64.hex() (#3584) 2020-01-28 23:43:09 +01:00
prime31 08d3401092 array: clear() 2020-01-27 22:31:48 +01:00
ka-weihe 31899eac2a hashmap: new load_factor and optimizations 2020-01-27 16:56:18 +01:00
Khairul Azhar Kasmiran edc44993d1 string: add another test for split_nth() 2020-01-25 19:12:36 +01:00
ka-weihe 7d797090ff map: bring back b-tree 2020-01-24 20:13:59 +01:00
ka-weihe 6fd175d9be hashmap: new and fast hashmap with dynamic size 2020-01-24 20:13:17 +01:00
Delyan Angelov 219239eadc string.split_nth - return the rest of the string as the last value in the result array 2020-01-24 20:12:36 +01:00
Shun Sakai c8c43a2475 update copyright year 2020-01-23 21:04:46 +01:00
penguindark da9b6394e8 0bxxxx binary literal support; _ in literals (1_000_000) 2020-01-23 03:28:25 +01:00
Alexander Medvednikov 0502a54a36 new gg/freetype modules with sokol/fontstash backends 2020-01-22 20:54:36 +01:00
Charles WANG 136c469ef7 array: more eq functions 2020-01-21 18:49:30 +01:00
Alexander Medvednikov ab368bdc53
array: test `arr << arr` 2020-01-19 22:15:37 +01:00
Alexander Medvednikov cf1fd6e950 array: fix arr << arr bug 2020-01-19 12:11:58 +00:00
Alexander Medvednikov e1132156f5 make sqlite.DB public; make string.left/right private 2020-01-16 18:41:38 +01:00
Alexander Medvednikov de3ad2b04f fix vweb tutorial project; clean up gg functions a bit 2020-01-15 22:17:45 +01:00
Swastik Baranwal 2741c0b211 string: new type conversion functions 2020-01-14 18:05:38 +01:00
Alexander Medvednikov 4c7df98ac9 make private struct warning an error 2020-01-12 19:59:57 +01:00
Alexander Medvednikov b6c0b22742 interfaces fixes; freetype.text_width(); gl and stbi fixes 2020-01-12 16:11:28 +01:00
vitalyster 66a6fa163e windows: read console using ReadFile/ReadConsole (#3387) 2020-01-10 14:06:40 +01:00
vitalyster 8412c6f03f windows: println using WriteFile/WriteConsole 2020-01-09 22:47:13 +01:00
Alexander Medvednikov e70ef5334a fix array copy; ci: test prebuilt Windows package 2020-01-08 11:33:09 +01:00
Alexander Medvednikov e3275f6083 fix array_test.v 2020-01-08 10:27:20 +01:00
Alexander Medvednikov 3c0fca9258 register methods (wip) 2020-01-08 10:19:18 +01:00
Alexander Medvednikov d823d82207 array type fix; method registration 2020-01-07 13:10:09 +01:00
Alexander Medvednikov 706c6066d5 index expression 2020-01-07 12:18:13 +01:00
Alexander Medvednikov 48ea1153a5 for ;; syntax 2020-01-07 00:14:19 +01:00
Delyan Angelov 4c3df963fa v repl: fix println regression on linux 2020-01-05 22:49:09 +01:00
Delyan Angelov 8053175ead android: fix os.create and builtin 2020-01-05 20:13:35 +01:00
Alexander Medvednikov 3344111a03 minor fixes and cleaning up 2020-01-04 00:06:06 +01:00
Alexander Medvednikov 492dfebd15 SelectorExpr; receivers; struct field check; if expression 2020-01-02 20:09:23 +01:00
Alexander Medvednikov 4d31d5882d x64, v2 backends 2019-12-31 19:42:16 +01:00
Alexander Medvednikov da5fb5dcbd Revert "x64, v2 backends"
This reverts commit 81ae54d9bd.
2019-12-31 13:23:12 +01:00
Alexander Medvednikov 81ae54d9bd x64, v2 backends 2019-12-31 13:21:22 +01:00
Alexander Medvednikov 907254b9e8 Revert "B-tree map "
This reverts commit 8a4bce667c.
2019-12-31 12:46:56 +01:00
Alexander Medvednikov f9cc419dba os: syscalls 2019-12-31 10:16:34 +00:00
Alexander Medvednikov cba6a6fdea `as` casting 2019-12-30 10:47:34 +01:00
ka-weihe 8a4bce667c B-tree map 2019-12-30 06:57:56 +01:00
Alexander Medvednikov 651c7e8de1 cgen tests 2019-12-28 11:55:14 +01:00
Delyan Angelov 6c16bac908 vfmt: it can now be used for _platform.v files too, no matter the host os 2019-12-27 17:59:04 +01:00
vitalyster 3f0f8bac49 windows: do not link gdi32/shell32 to console applications
* read os.args from argv when we have console
* dynamically load CommandLineToArgvW when we are GUI app
* link gdi32/shell32 in glfw module
2019-12-27 11:27:19 +03:00
BigBlack 98b81252b7 fix #3217 (string.replace) 2019-12-27 07:20:06 +03:00
BigBlack 320174bd5b fix #3202 2019-12-27 06:09:09 +03:00
Alexander Medvednikov d9835c1ecf move atofq.v to a separate module 2019-12-26 11:56:21 +03:00
vitalyster 1d86f4b5d1 ensure that `v fmt` can be run over most .v files on each PR 2019-12-25 15:54:48 +03:00
Alexey dced76d1a4 os, filepath: reorganize functions 2019-12-23 13:09:22 +03:00
れもん 28ecfb231d compiler: map[string]pointer, ?pointer, fix []pointer 2019-12-22 01:44:16 +03:00
Alexander Medvednikov ef28a6b872 final vfmt run before CI check 2019-12-22 00:58:57 +03:00
Alexander Medvednikov 2b9392c46c move hashmap to its own module for now 2019-12-22 00:54:25 +03:00
Emily Hudson 8512c9fc9d compiler: __offsetof keyword for C offsetof() macro 2019-12-22 00:46:09 +03:00
joe-conigliaro 4dc4f12ccd hashmap: use fnv32 as hash algo 2019-12-21 09:59:12 +03:00
Steve Phillips 6e9493887d builtin/array.v: Fixed typo in new_array (cap -> cap_) 2019-12-20 23:09:59 +03:00
Alexander Medvednikov d082b3f4b9 run vfmt on vlib/builtin 2019-12-20 00:12:29 +03:00
Alexander Medvednikov 76c800ffb6 bring back array.eq 2019-12-19 23:49:40 +03:00
Alexander Medvednikov d38687f893 run vfmt on cc, cgen, comptime, if_match 2019-12-19 23:43:23 +03:00
Alexander Medvednikov 2096018b00 map: another fix + test 2019-12-19 21:17:12 +03:00
Alexander Medvednikov 26f5d34e64 map: fix a bug with an incorrect size after delete() 2019-12-19 21:11:42 +03:00
Alexander Medvednikov df2f98e276 run vfmt on more files 2019-12-19 02:38:54 +03:00
Alexander Medvednikov 1cef83aea4 run vfmt on array.v 2019-12-18 21:20:41 +03:00
BigBlack 67cf7f18e6 array of pointers support 2019-12-18 03:26:04 +03:00
Alexander Medvednikov ea781a557f array: slice_clone() 2019-12-17 01:29:40 +03:00
Alexander Medvednikov 562f24336d add ./v2 to gitignore 2019-12-17 01:21:18 +03:00
penguindark 3dbf7a4039 atof implementation in V 2019-12-17 01:07:13 +03:00
Alexander Medvednikov 54707ff81d do not allow calloc(0) 2019-12-16 22:48:55 +03:00
Alexander Medvednikov e7856a1afc do not allow malloc(0) 2019-12-16 21:29:32 +03:00
Delyan Angelov b7c477cc18 freestanding: ptr_str, string concat, struct declaration
* compiler: extract c_common_macros from c_headers, and use it in bare_c_headers too. Support for ptr_str and string concatenation in -freestanding mode.

* Add tests for structs and string concatenation in -freestanding mode .

* Move check_string_add_works to string/string.v .
2019-12-16 19:05:33 +03:00
Alexander Medvednikov 8581c11900 update malloc 2019-12-14 02:46:55 +03:00
Alexander Medvednikov ef562413cd -prealloc 2019-12-14 02:28:15 +03:00
Alexander Medvednikov b8f728590b string: last_index ?int 2019-12-12 21:54:48 +03:00
Alexander Medvednikov 0eeb607ffd fix fopen definition 2019-12-12 21:03:08 +03:00
Alexander Medvednikov 88ec9c235d sort structs: handle fixed size arrays 2019-12-12 14:21:22 +03:00
Alexander Medvednikov 576618d8cc string cloning; fix `foo.str += 's'` 2019-12-12 05:20:52 +03:00
Alexander Medvednikov ad250523cd fix parser.fileis() 2019-12-11 21:42:22 +03:00
Alexander Medvednikov 7dcd47369b option to pre-allocate a memory block 2019-12-11 18:41:25 +03:00
joe-conigliaro 3486118ab7 compiler: force custom struct .str() methods to be defined public 2019-12-11 03:24:26 +03:00
Alexander Medvednikov f286387647 vweb: secure HttpOnly cookies 2019-12-11 03:20:30 +03:00
Alexander Medvednikov cdfbb2978d strings: replace_each([]); orm: update 2019-12-10 23:57:49 +03:00
Alexander Medvednikov 9726e18c0a string: optimize replace() 2019-12-10 18:50:21 +03:00
Alexander Medvednikov 6f49d4c1d2 orm: bool support; vweb fixes 2019-12-09 23:20:29 +03:00
Alexander Medvednikov 75280bb54c fix int.str() memory bug 2019-12-09 16:41:13 +03:00
penguindark 9730164613 atoi: fix leading zeros in string to int conversion 2019-12-08 23:22:33 +03:00
Alexander Medvednikov 4d1f721558 fix "" string interpolation bug 2019-12-08 20:06:00 +03:00
bogen85 8178e1f7da freestanding: malloc/free with mm_alloc an mm_free
Added more array support that depends on malloc. Added string clone (that uses malloc). Added test for it. Eliminated stack allocated buffers from most of the unit checks.
2019-12-08 13:44:52 +03:00
bogen85 751ba48bf5 freestanding improvements (exit, function checks)
Fixed exit for freestanding (as assert now uses it).
Running each function check now in a forked process so they can be killed or return other exit codes (and so each function runs, even if others crash)
2019-12-07 22:25:19 +03:00
Alexander Medvednikov 9cba3bdf78 windows: WideCharToMultiByte() returns an int 2019-12-07 17:31:07 +03:00
Alexander Medvednikov ad6adf327e vlib: fix missing `else{}` in match statements 2019-12-07 17:23:37 +03:00
Alexander Medvednikov 2fb7fba856 require `else` in `match` statements 2019-12-07 17:01:44 +03:00
Alexander Medvednikov d7ccbba2c9 do not allow casting a type to itself 2019-12-07 15:31:56 +03:00
Alexander Medvednikov be323e2fb6 ci: set up pg database to test ORM 2019-12-06 02:11:39 +03:00
Alexander Medvednikov cb46bf314e get_type.v 2019-12-05 18:48:39 +03:00
Alexander Medvednikov 90e3ab8c1e debugging v -live message.v 2019-12-05 12:48:23 +03:00
Nicolas Sauzede 9d854c5df0 vlib: sdl module + tVintris example 2019-12-05 11:25:55 +03:00
Alexander Medvednikov 6dd1270539 builtin: remove an unnecessary malloc() call 2019-12-05 11:08:41 +03:00
Alexander Medvednikov 2144c162c4 os: is_link() 2019-12-04 23:53:11 +03:00
Alexander Medvednikov a57e29dfc5 os: replace dir_exists with is_dir; file_exists() => exists() 2019-12-04 23:17:45 +03:00