1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

Compare commits

...

6955 Commits

Author SHA1 Message Date
Delyan Angelov
d60f148b0c binary_artifact.yml: chmod 755 thirdparty/tcc/tcc.exe too 2020-12-04 14:08:18 +02:00
spaceface777
50a3009113 fmt: make single-stmt or blocks single-line (#7126) 2020-12-04 13:25:23 +02:00
spaceface777
9345d489f8 ci: fix self compilation with cached modules on macos (#7127) 2020-12-04 13:25:02 +02:00
Delyan Angelov
52ccdd747f cgen: allow for const ( x = opt() ? ) 2020-12-04 13:11:12 +02:00
Delyan Angelov
d0a2992335 regex: align query/regex err pos in optional err messages/panics 2020-12-04 12:43:25 +02:00
Lukas Neubert
02ba923ba7 fmt: do not add braces for trailing struct arg (#7072) 2020-12-04 11:22:26 +02:00
Alexander Medvednikov
34049f7135 ci: yaml is fun 2020-12-04 10:21:17 +01:00
Alexander Medvednikov
951d0ace89 ci: disable gitly -autofree for now 2020-12-04 10:16:07 +01:00
Alexander Medvednikov
b64945a6c0 autofree: lots of fixes in return_statement() 2020-12-04 10:10:40 +01:00
joe-conigliaro
b578e60dd5 tests: add test for fix #cf7b45b 2020-12-04 15:43:28 +11:00
Alexander Medvednikov
da1c361cfe ci: add the -usecache test to macos 2020-12-04 04:32:20 +01:00
joe-conigliaro
cf7b45b074 checker: correctly check arrays with element that is an alias. fixes #6735 2020-12-04 14:26:25 +11:00
Alexander Medvednikov
0c18b3bea6 ci: test -usecache 2020-12-04 04:01:13 +01:00
Tomas Hellström
d12f5f7ba0 x.websocket: vdoc (#7091) 2020-12-04 01:52:26 +01:00
Alexander Medvednikov
cae3bd7f32 gg: vfmt gg.v 2020-12-04 01:27:40 +01:00
Alexander Medvednikov
e160f6e7d2 gg: screen_size() 2020-12-03 23:17:00 +01:00
Delyan Angelov
b37550c279 binary_artifact.yml: unpack to a v/ folder as before. 2020-12-03 22:44:03 +02:00
yuyi
9b6a1552e9 checker: check match return mismatch type (fix #6826) (#7109) 2020-12-03 21:14:23 +02:00
Nick Treleaven
d590ce7675 map: add 3 DenseArray methods for bootstrapping (#7113) 2020-12-03 21:12:53 +02:00
Daniel Däschle
6c100a0bc3 vls,parser: fix an eof error in parsing invalid const declarations (#7115) 2020-12-03 21:11:43 +02:00
penguindark
15ffce1317 regex: fix compilation issues with gcc under ubuntu (#7112) 2020-12-03 19:33:53 +01:00
Delyan Angelov
793f9ae9e3 doctor: use os.uname().machine, on incomplete CPU info; display os.getwd() too 2020-12-03 19:15:17 +02:00
yuyi
06eaded6ea string: change tos_lit to _SLIT (#7079) 2020-12-03 16:02:48 +01:00
Delyan Angelov
b8bb034f91 binary_artifact.yml: restore top level v_{linux,macos,windows}/ folder in the .zip files. 2020-12-03 16:56:39 +02:00
Alexander Medvednikov
110c7e6f90 workflows: build 0.* tags 2020-12-03 15:04:49 +01:00
Delyan Angelov
eefdf4baa6 scanner: do not warn for \x07 in strings 2020-12-03 14:11:32 +02:00
Delyan Angelov
2f6757b315 binary_artifact.yml: chmod 755 the v executables before archiving them. 2020-12-03 12:51:28 +02:00
Delyan Angelov
b1e3db712e binary_artifact.yml: restore .ctags.d/ and .github/ (helps vim/emacs users and running CI tests locally) 2020-12-03 11:52:09 +02:00
Daniel Däschle
558a756431 parser: fix position offset by 1 (#7099) 2020-12-03 11:25:06 +02:00
Delyan Angelov
97ed2bf211 make: remove obsolete references to /var/tmp/tcc 2020-12-03 09:17:31 +02:00
Swastik Baranwal
c5a7c51dfd parser: add a check for known vars in or block (#7094) 2020-12-03 04:46:04 +01:00
yuyi
30da85a4d5 checker: fix optional or_block {none} (#7095) 2020-12-03 01:03:17 +01:00
Uwe Krüger
c1b25dd61d cgen: fix map value op-assign modification (#7101) 2020-12-03 00:40:11 +01:00
Alexander Medvednikov
1037d3a383 checker: make missing mut before an argument a warning 2020-12-02 23:58:06 +01:00
Delyan Angelov
4b94c29c91 tests: use .replace_each() instead of a .replace() chain 2020-12-02 19:47:07 +02:00
joe-conigliaro
ce1fa1194d parser: fix not used parent warning for selective imports. closes #6916 2020-12-03 01:14:49 +11:00
Andréas Livet
93fe2ce22d doc: add anonymous function exemples on filter/map (#7089) 2020-12-02 14:41:31 +01:00
Swastik Baranwal
1356ac63b4 doctor: detect wsl 1 and wsl 2 separately (#7081) 2020-12-02 14:41:13 +01:00
Lukas Neubert
2691163a7e scope: remove redundant name arg from register() (#7077) 2020-12-02 14:40:25 +01:00
heronwr
f8af866f76 builtin: make v_realloc use int parameter instead of u32 (#7080) 2020-12-02 15:35:11 +02:00
joe-conigliaro
cd46eb42d7 checker: fix generic os.fn call (script) without mod prefix. fixes #7073 2020-12-02 21:40:44 +11:00
joe-conigliaro
ca7692c839 error on unknown generic struct init. closes #7085 2020-12-02 20:53:40 +11:00
Enzo
d8b8aca51e gen: fix arr.last().field (#7076) 2020-12-02 04:35:00 +01:00
Andréas Livet
ff26f0539c doc : array slicing examples (#7069) 2020-12-02 04:06:43 +01:00
Lukas Neubert
dedb8f7e41 fmt: smarter wrap of orm lines (#7070) 2020-12-02 04:06:20 +01:00
Tomas Hellström
7c394b9d58 x.websocket: docs and cleanup (#7078) 2020-12-02 04:02:53 +01:00
Alexander Medvednikov
953a51bec8 autofree: fix an off by 1 error 2020-12-02 03:45:08 +01:00
Lukas Neubert
8adc8ed103 parser: do not fail on comment direct after import (#7071) 2020-12-01 22:32:34 +02:00
Delyan Angelov
394e9c4c56 builder: replace single goto start usage, with for { ... continue ... break} 2020-12-01 22:11:44 +02:00
Alexander Medvednikov
c5cd53ca79 parser: bring back old $if position calculation 2020-12-01 18:59:33 +01:00
Alexander Medvednikov
0ff541375d autofree: fix a bug with $if and add a test 2020-12-01 18:58:16 +01:00
Alexander Medvednikov
3612bd58ef fmt: revert the fn \n change 2020-12-01 17:00:06 +01:00
Delyan Angelov
cc1d313d68 tools: fix v build-tools 2020-12-01 17:44:07 +02:00
Alexander Medvednikov
0ddf0a4b92 gg: custom bold font path 2020-12-01 16:30:25 +01:00
yuyi
d3deaa1f59 cgen: fix typeof variadic type (#7063) 2020-12-01 16:11:37 +01:00
Lukas Neubert
4f540e6ac3 doc: mention module shadowing (#7051) 2020-12-01 16:09:33 +01:00
Daniel Däschle
5b6eb7b2c9 cgen: simplify .str() generation (#7038) 2020-12-01 16:09:03 +01:00
Ned Palacios
54e03f60b9 x.json2: remove builder methods (#7008) 2020-12-01 16:23:59 +02:00
yuyi
6a1e0322bd gen: fix interpolation variadic (#7059) 2020-12-01 12:40:38 +02:00
joe-conigliaro
f1965c0510 ast: fmt ast.v 2020-12-01 21:20:27 +11:00
joe-conigliaro
88835a0456 cgen: remove some nasty replacements 2020-12-01 21:17:19 +11:00
joe-conigliaro
9b583f51f1 ast: remove field which should have been removed in #34e124d 2020-12-01 20:15:35 +11:00
joe-conigliaro
34e124d5f7 cgen: auto cast sum type in array init. fixes #6907 2020-12-01 20:03:45 +11:00
Delyan Angelov
fe0ded9a91 tests: add a regression test for the inter module generics inference 2020-12-01 08:07:07 +02:00
joe-conigliaro
a7d917474d checker: simplify generic fn post processing 2020-12-01 16:43:10 +11:00
joe-conigliaro
0e54b9acb5 checker: remove debug println introduced in 4f658ec 2020-12-01 15:14:30 +11:00
joe-conigliaro
4f658ec292 fix auto inferred generic call of mod.func(). closes #6263 2020-12-01 15:10:06 +11:00
Alexander Medvednikov
f4bd953771 pref: vfmt 2020-12-01 04:16:36 +01:00
Alexander Medvednikov
9b7d717a9c workflows: use v_linux.zip etc as asset names (part 2) 2020-12-01 04:07:28 +01:00
Alexander Medvednikov
971031d8cc workflows: use v_linux.zip etc as asset names 2020-12-01 04:06:34 +01:00
Alexander Medvednikov
f26f7ebc9d pref: nocache option 2020-12-01 04:05:44 +01:00
Leah Lundqvist
ab225ff154 jsgen: fix JS.@typeof (#7055) 2020-12-01 04:02:10 +01:00
Lukas Neubert
552de94da6 sqlite: add Windows instructions to readme (#7041) 2020-12-01 04:00:41 +01:00
Daniel Däschle
879d238887 cgen: initial option auto str support (#7004) 2020-12-01 04:00:23 +01:00
Daniel Däschle
6af082e70e doc: detailed documentation of the compiler pipeline (#7043) 2020-12-01 03:58:39 +01:00
spaceface777
83137cbe84 pref: don't use tcc by default in -prod mode (#7053) 2020-12-01 03:58:02 +01:00
Delyan Angelov
be7c88ec35 cleanup: remove submodule tinycc (added in 0248e49) 2020-11-30 23:10:54 +02:00
spaceface777
0248e4955d gen: fix undefing __has_include on macos tcc (#7057) 2020-11-30 21:56:17 +02:00
Delyan Angelov
7511d6e4e8 builder: fix building thirdparty C files with tcc, when run outside vroot 2020-11-30 21:48:21 +02:00
Delyan Angelov
5bca6a4bfe cgen: undef *earlier* __has_include for tcc 2020-11-30 21:29:48 +02:00
Leah Lundqvist
14f45bb8ef fast.v: average measure results, discarding extremes (#7052)
good work
2020-11-30 21:01:11 +02:00
Delyan Angelov
ff42572e93 builder: show the C compiler output on -show-c-output, NOT on -showcc 2020-11-30 20:30:47 +02:00
Larpon
ed08d96932 builtin: remove old type prefixes, add a few missing documentations, add missing punctuation (#7037) 2020-11-30 18:51:00 +01:00
Larpon
0c72c9d2f1 doc: mention present tense convention, explain long comments (#7036) 2020-11-30 18:49:57 +01:00
Delyan Angelov
b11d285680 v: support multiple paths in VMODULES env variable (#7048) 2020-11-30 18:31:37 +01:00
Alexander Medvednikov
376833aea7 builder: show tcc compiler error with -v and -showcc 2020-11-30 17:47:38 +01:00
heronwr
434fa70584 make.bat: fix incorrect sequence in checking for a valid C compiler (#7050) 2020-11-30 16:52:43 +01:00
Lukas Neubert
a98162118b fmt: orm delete (#7035) 2020-11-30 14:02:36 +01:00
Uwe Krüger
a128ab4313 cgen: add support for shared maps (#7042) 2020-11-30 13:25:14 +01:00
Swastik Baranwal
e3fab7e076 parser: add an error for an invalid string prefix (#7019) 2020-11-30 10:58:00 +02:00
yuyi
39b46e95a0 gen: minor optimization in type_to_fmt() (#7028) 2020-11-30 09:35:55 +02:00
yuyi
f7cc3d3718 gen: minor cleanup in gen_expr_to_string() (#7026) 2020-11-30 09:16:50 +02:00
heronwr
9487578c0c make.bat: bootstrap TCC by default and fix miscellaneous bugs (#7027)
good work
2020-11-30 09:15:52 +02:00
Delyan Angelov
aae5812337 os: cleanup os.find_abs_path_of_executable/1 2020-11-30 08:40:39 +02:00
Alexander Medvednikov
05eeb8aa53 token: remove old keyword "embed" 2020-11-30 03:11:40 +01:00
joe-conigliaro
ff63fb74d9 dont allow method on non-local types & no mod for arrays. closes #6971 2020-11-30 11:43:22 +11:00
Alexander Medvednikov
b1bff3f319 workflows: use ./v instead of v 2020-11-29 20:53:33 +01:00
ka-weihe
9367dcda10 all: fix remaining c warnings and add -Werror to CI (#7021) 2020-11-29 21:23:37 +02:00
Alexander Medvednikov
5eb7660608 workflows: releases: build v -prod 2020-11-29 19:57:12 +01:00
spaceface777
4e6bc27b30 compiler: fix self compilation with cached modules on macOS (#7023) 2020-11-29 19:30:35 +01:00
Alexander Medvednikov
c7cefa9ce6 json: fix encoding pointers 2020-11-29 17:45:22 +01:00
Delyan Angelov
adeebad2a6 compiler: use thirdparty/tcc/tcc.exe by default, when no explicit -cc is given (#6598) 2020-11-29 16:18:49 +01:00
yuyi
0b96cd50e1 scanner: fix escape \u (fix #6849) (#7012) 2020-11-29 17:01:40 +02:00
Delyan Angelov
008ce8fc65 repeat: support -p {option}:-prod,'' -p {compiler}:tcc,gcc -t '{T} {option} -cc {compiler} x.v' v 2020-11-29 16:14:11 +02:00
Ned Palacios
6c634086b0 json2: decode fn returns ?T; add new tests (#6933) 2020-11-29 14:54:45 +01:00
Nick Treleaven
8f15af6adc pref: add -m32, -m64 command-line options (#7011) 2020-11-29 14:53:49 +01:00
Nick Treleaven
9772306ae9 help: list -showcc, -w (#7013) 2020-11-29 14:11:12 +01:00
joe-conigliaro
91eca539d0 all: -usecache fixes and self compilation & some type cname optimisation (#7015) 2020-11-29 14:10:45 +01:00
Swastik Baranwal
3afa606154 vfmt: fix eating c in c'foo' (#7009)
* fmt: add formatting for cstrs

* fmt
2020-11-29 10:39:50 +02:00
Takahiro Yaota
49a083fe79 time: improve parse_iso8601 (#7006) 2020-11-29 10:38:14 +02:00
Larpon
1192dfdc8a term.ui: document functions (#6979) 2020-11-29 08:32:04 +02:00
Leah Lundqvist
80c4b8a17a ci: automated builds when pushing "weekly.*" tags (#7005) 2020-11-29 02:16:10 +01:00
Delyan Angelov
a6f1667bce checker: make sym == typ an error 2020-11-29 00:43:06 +02:00
yuyi
f336c2c5cc scanner: fix error of backslash escaping x in ident_string(fix #6850) (#6994) 2020-11-29 00:39:45 +02:00
Daniel Däschle
32c027a0bf parser: disallow ptr type as sum type variant (#6996) 2020-11-28 23:40:40 +02:00
Nick Treleaven
6da6a082c7 parser: fix showing error position for pratt.v (#6997) 2020-11-28 23:39:45 +02:00
Alexander Medvednikov
159abd4727 autofree: fix unused var error 2020-11-28 20:33:32 +01:00
Alexander Medvednikov
91007e87d2 autofree: remove old code 2020-11-28 20:26:32 +01:00
Alexander Medvednikov
cb3367d734 autofree: free_before_break() test 2020-11-28 20:23:54 +01:00
Delyan Angelov
321daede1d cgen: fix a buggy comparison, add ability to do println(sym.debug()) 2020-11-28 19:48:53 +02:00
Alexander Medvednikov
0114333d34 autofree: fix _ 2020-11-28 16:45:08 +01:00
Swastik Baranwal
aadeb62bbf cgen: add a _T_ prefix in the C names for generic fn instances; fixes #6927 (#6999) 2020-11-28 17:07:07 +02:00
Daniel Däschle
6e4dad9acf parser: fix position of array init (#6998) 2020-11-28 17:05:14 +02:00
Alexander Medvednikov
ea04d23e1d tests: valgrind: use -autofree without -experimental 2020-11-28 15:53:08 +01:00
Alexander Medvednikov
57ad943b92 autofree: free arrays on re-assignment 2020-11-28 15:21:53 +01:00
Alexander Medvednikov
ed39d151b7 V 0.1.30 2020-11-28 04:43:11 +01:00
Alexander Medvednikov
86b5f7ef5d string: fix ustring.free() 2020-11-28 03:41:43 +01:00
Alexander Medvednikov
c3ed8bb5da autofree: remove old code 2020-11-28 02:28:43 +01:00
heronwr
a2fedb4285 make.bat: parsing block revision (#6990) 2020-11-28 01:14:14 +02:00
Delyan Angelov
2095d4d955 .ctags.d/v.ctags: upgrade syntax for latest Universal Ctags 5.9.0(7f84a443) 2020-11-28 01:05:16 +02:00
Delyan Angelov
ac27a3ccee parser,cgen: improve [flag]enum Abc{ a b }, allow x := Abc.a | Abc.b 2020-11-27 23:09:14 +02:00
Daniel Däschle
18cf36a22c parser: remove unnecessary match as code (#6972) 2020-11-27 22:25:08 +02:00
Daniel Däschle
04ecc4737c docs: extend the sum type docs (#6982) 2020-11-27 22:24:35 +02:00
yuyi
64fa5e6383 szip: fix szip_test (#6980) 2020-11-27 21:20:43 +01:00
Alexander Medvednikov
22c173c1dc ci: ci can't run tetris :) 2020-11-27 21:00:50 +01:00
nyx-litenite
36240b2284 examples: term.ui: vyper (a simple snake game) (#6943) 2020-11-27 20:55:53 +01:00
Alexander Medvednikov
fcd127ed87 autofree: make -experimental the default 2020-11-27 20:49:48 +01:00
Alexander Medvednikov
f135a9949c ci: build tetris with -autofree 2020-11-27 20:41:17 +01:00
Alexander Medvednikov
13948152b6 cmd/v: rename reuse-tmpc to keepc 2020-11-27 20:16:24 +01:00
Delyan Angelov
1891f55c72 builtin: add voidptr.vbytes(len) and byteptr.vbytes(len) 2020-11-27 18:18:46 +02:00
Swastik Baranwal
2473f65278 cgen: minor cleanup (use replace_each) (#6978) 2020-11-27 16:13:30 +01:00
spaceface777
bbea7fb91f docs: document the [required] struct attribute (#6956) 2020-11-27 15:37:12 +02:00
Delyan Angelov
5ba5a53b77 ci: temporarily ignore failing x as y examples for now 2020-11-27 15:28:40 +02:00
Delyan Angelov
7cd9530006 docs: fix most of the examples (ensure they at least have a valid syntax) 2020-11-27 13:03:32 +02:00
Delyan Angelov
e6116c47be scanner: guarantee an early exit when the parser/scanner is stuck 2020-11-27 12:44:39 +02:00
Delyan Angelov
413d14f53e ci: run docs_ci.yml checks on *every commit*, not just when .md files change. 2020-11-27 12:44:39 +02:00
yuyi
636efb3c20 cgen: fix windows escape errors for comptime @ pseudo vars (#6977) 2020-11-27 11:16:57 +02:00
Daniel Däschle
ee2a5727fb gen: fix assigning an anon fn to a struct field (#6965) 2020-11-27 11:15:48 +02:00
Delyan Angelov
cbe607baf2 vfmt: fix compilation warning 2020-11-27 10:40:56 +02:00
Alexander Medvednikov
9b0c96d792 scanner: allow \r after $ 2020-11-27 03:27:34 +01:00
Alexander Medvednikov
c27818e247 all: remove remaining broken escape sequences 2020-11-27 03:17:19 +01:00
Daniel Däschle
966b95ca4e parser: move mut in if/match to expr (#6973) 2020-11-27 03:08:42 +01:00
Alexander Medvednikov
62ee436944 all: remove broken escape sequences after $ in strings 2020-11-27 03:07:37 +01:00
Daniel Däschle
d71d9ad7c0 сgen: print generic structs (#6967) 2020-11-26 23:57:03 +01:00
spaceface777
6563535a3d term.ui: simplify/fix the truecolor feature test (#6963) 2020-11-26 23:52:20 +01:00
Nick Treleaven
ea8adfdbf9 gen: more efficient for in with a map (#6961) 2020-11-26 23:22:14 +01:00
Alexander Medvednikov
5e59718970 fmt: handle $tmpl 2020-11-26 18:53:38 +01:00
Alexander Medvednikov
5efd393af2 all: make comptime templates usable outside of vweb via $tmpl 2020-11-26 18:40:35 +01:00
Ruofan XU
c6a8c3cad5 cgen: remove unneeded sumtype logic and add more tests (#6959) 2020-11-26 15:29:23 +01:00
Daniel Däschle
52b627feb3 checker: check filter, map and sort left type (#6952) 2020-11-26 11:28:54 +01:00
spaceface777
e03ae19372 term.ui: approximate colors into ansi if rgb isn't supported (#6951) 2020-11-26 00:28:57 +01:00
Takahiro Yaota
258f8f6af9 parser: report unused expression error in if and or blocks (#6953) 2020-11-26 00:28:41 +01:00
Larpon
2957541e48 pref: fix message on inferred run (#6947) 2020-11-25 21:44:26 +02:00
JalonSolov
96b6a03d01 vup: minor change to final output string (#6948) 2020-11-25 20:41:03 +01:00
Daniel Däschle
8e2b7fe3d6 tests: cleanup sum type tests (#6950) 2020-11-25 20:40:29 +01:00
Delyan Angelov
fa126b950a cgen: prevent undefined symbol: tcc_backtrace errors with tcc and -shared -d no_backtrace 2020-11-25 15:47:55 +02:00
heronwr
4e9967a5f1 make.bat: update convention to be consistent and add target support (#6942) 2020-11-25 14:27:52 +01:00
Daniel Däschle
8446433bcf parser: remove __type (#6946) 2020-11-25 14:27:15 +01:00
Delyan Angelov
35a0fe79f9 cgen: generate an unique sort comparator function for each .sort() call 2020-11-25 13:48:42 +02:00
Ekopalypse
a46eda7c44 builder: fix dll generation on Windows (#6939) 2020-11-25 12:18:58 +01:00
Daniel Däschle
7d6f97259f all: refactor UnionSumType to SumType (#6944) 2020-11-25 13:09:40 +02:00
Leah Lundqvist
96b73acad7 jsgen: optional "or blocks" (#6938) 2020-11-24 22:52:23 +01:00
Alexander Medvednikov
23c9563600 examples/tetris: remove old array hacks 2020-11-24 18:14:44 +01:00
Alexander Medvednikov
98034e5504 http: make download_file() return an optional 2020-11-24 18:07:08 +01:00
Daniel Däschle
a042966082 all: remove old sumtype code (#6937) 2020-11-24 17:55:24 +01:00
Daniel Däschle
aa6303f0b2 all: use the new types with old syntax (#6922) 2020-11-24 13:58:29 +01:00
Lukas Neubert
8be9bdacd1 fmt: do not wrap real multiline comments into single line in arrays (#6923) 2020-11-24 12:55:39 +01:00
pancake
aa90625819 js: initial support for optional return unwrapping (#6926) 2020-11-24 12:54:26 +01:00
Daniel Däschle
789912238f gen: generate typedef first on sum types (#6930) 2020-11-24 12:53:39 +01:00
Daniel Däschle
9fbf38c798 parser: fix generic structs from other modules (#6921) 2020-11-23 23:21:11 +01:00
Alexander Medvednikov
e0d64903f8 table: rename atypes.v to types.v now that the order of the files is irrelevant 2020-11-23 18:19:51 +01:00
Takahiro Yaota
07fae5adf6 io: add a test for read_all (#6898) 2020-11-23 16:17:39 +01:00
Nick Treleaven
380e3640e3 gen: add panic message when using '?' with none (#6919) 2020-11-23 16:16:38 +01:00
Daniel Däschle
96539e43b5 all: nested sum types (#6913) 2020-11-23 16:16:13 +01:00
Larpon
c7ca1e7e13 tools/vcomplete: add fish auto completion support (#6917) 2020-11-23 14:53:32 +02:00
Takahiro Yaota
2f9b7fe0f7 vfmt: fix error with return // comment (#6914) 2020-11-23 11:36:20 +02:00
Nick Treleaven
51c737669d checker: check labelled break/continue is inside a matching for loop (#6910) 2020-11-22 20:51:07 +01:00
Alexander Medvednikov
a1827d7f98 autofree: handle array set/get 2020-11-22 20:48:23 +01:00
hirossan4049
67d5dfb315 gg: draw_rounded_rect() (#6909) 2020-11-22 20:13:40 +01:00
Larpon
e403c38d7b cmd/v: add zsh auto completion support (#6912) 2020-11-22 20:12:34 +01:00
Alexander Medvednikov
311b5e8188 autofree: string.clone() fix 2020-11-22 13:45:12 +01:00
Alexander Medvednikov
65005fdae8 builtin: same fix for array.insert 2020-11-22 13:30:48 +01:00
Alexander Medvednikov
f8827c3fe5 builtin: clone the strings correctly in array.push 2020-11-22 13:22:42 +01:00
Alexander Medvednikov
ed7413ee51 autofree: handle SelectorExpr receivers 2020-11-21 23:19:04 +01:00
Daniel Däschle
22fdf76db5 gen: unwrap optional on if guard expr (#6903) 2020-11-21 22:40:05 +01:00
Alexander Medvednikov
2f50a9ea1f utf: fix utf32_to_str 2020-11-21 22:37:16 +01:00
Alexander Medvednikov
9a51f4e3c2 autofree: builtin fixes 2020-11-21 22:33:31 +01:00
Alexander Medvednikov
8cef4e0433 ci: build ved with -autofree 2020-11-21 19:12:52 +01:00
Alexander Medvednikov
2afb9b30e9 autofree: minor fixes; skip in consts 2020-11-21 19:07:47 +01:00
Alexander Medvednikov
ad940ff40e autofree: free parent scope vars only before fn returns 2020-11-21 18:23:50 +01:00
Delyan Angelov
2228d75657 ci: fix formatting of comptime.v 2020-11-21 19:04:31 +02:00
Delyan Angelov
018bd6aac3 os: fix flaky test in process_test.v 2020-11-21 18:01:21 +02:00
Delyan Angelov
fa55c247a2 parser: add -d print_vweb_template_expansions to ease vweb template debugging 2020-11-21 17:59:02 +02:00
pancake
4b19a6e00d js: fix code generation for $if js statements (#6896) 2020-11-21 15:40:37 +01:00
hirossan4049
54df7d1daf gg: new draw_empty_rounded_rect() (#6891) 2020-11-21 15:40:02 +01:00
Delyan Angelov
f2d59fbc0f cmd/v: make echo ...|v same as echo ...|v run - (#6899) 2020-11-21 15:39:47 +01:00
Tomas Hellström
155aa6dac5 x.websocket: fix autobahn tests for wss and wss close behavor (#6901) 2020-11-21 15:45:45 +02:00
Alexander Medvednikov
b6099cd978 sokol: soft full screen on macos 2020-11-21 14:24:01 +01:00
heronwr
6b89249c6d make.bat: refactor for better param parsing and usage help (#6893) 2020-11-21 12:02:03 +01:00
Delyan Angelov
92d3cff957 vfmt: run vfmt over v.v, and add it to v test-cleancode too 2020-11-21 10:24:11 +02:00
Swastik Baranwal
650cdef8b4 checker: disallow array sum types without default field (#6892) 2020-11-21 00:07:25 +01:00
Daniel Däschle
838ad16296 all: refactor ast.Expr to use the new sum type implementation (#6792) 2020-11-21 00:05:57 +01:00
Alexander Medvednikov
ff1752dfff gg: vfmt gg.v 2020-11-21 00:04:29 +01:00
Alexander Medvednikov
c1486925d5 autofree: enable free_before_return test 2020-11-21 00:00:27 +01:00
Alexander Medvednikov
99bdb87a01 all: remove #objc for good 2020-11-20 23:49:52 +01:00
Delyan Angelov
e53b451d60 v complete: fix completion of v fmt cmd/tools/vcomp<Tab> 2020-11-20 21:29:59 +02:00
Larpon
de0cfdd323 v complete: add better support for tool flag completion (#6894) 2020-11-20 20:50:01 +02:00
Delyan Angelov
9673d40bb9 ci: fix failing windows test run_v_code_from_stdin_test.v (2) 2020-11-20 16:57:44 +02:00
Takahiro Yaota
f47c2468bb net: fix socket.read_line with long lines #6842 2020-11-20 15:24:41 +01:00
Larpon
82b16cbf45 v: add shell auto-completion with source <(v complete setup bash) (#6886) 2020-11-20 16:17:31 +02:00
Delyan Angelov
93d460f8fc ci: fix failing windows tests for v run - 2020-11-20 16:14:04 +02:00
Lukas Neubert
5d76e85a23 vfmt: fix extra whitspace in fn type decl with type-only args (#6888) 2020-11-20 15:00:40 +01:00
Alexander Medvednikov
30ddb89e3c gg: UI mode for much lower CPU usage in UI apps 2020-11-20 14:50:26 +01:00
Delyan Angelov
3c4b87bfec checker: add check against fn test_opt() ?{} 2020-11-20 15:12:53 +02:00
Nick Treleaven
9871d24929 fmt: fix labelled break & continue (#6889) 2020-11-20 14:12:40 +01:00
Nick Treleaven
09090bd29f doc: explain labelled break and continue (#6890) 2020-11-20 14:11:56 +01:00
Nick Treleaven
d5242e0bf5 gen: implement labelled break and continue (retry) (#6887) 2020-11-20 12:23:48 +01:00
Alexander Medvednikov
412e2a43e9 clipboard: fix clear() on macos 2020-11-20 12:00:16 +01:00
Ned Palacios
7c2c187743 vdoc: fix markdown and plaintext rendering (#6882) 2020-11-20 12:02:52 +02:00
Lukas Neubert
ef3e8d2c84 vfmt: handle comments after type declarations (#6874) 2020-11-20 11:51:50 +02:00
Delyan Angelov
d382db77ee ci: fix failing clipboard_test.v on MacOS 2020-11-20 11:44:26 +02:00
Ned Palacios
b957c64905 scanner: store errors and warnings on silent mode (#6883) 2020-11-20 11:44:19 +02:00
Nicolas Sauzede
159932d59b v: run code from stdin echo println(2+2) | v run -, with no repl limits (#6884) 2020-11-20 10:25:59 +02:00
Alexander Medvednikov
55a7c907ad clipboard: fix set_text() 2020-11-20 03:28:28 +01:00
Alexander Medvednikov
4328233504 Revert "gen: implement labelled break and continue (#6880)"
This reverts commit e798326a1a.
2020-11-20 02:51:35 +01:00
Delyan Angelov
1b8609c318 builder: fix for v -o x.exe run examples/hello_world.v 2020-11-20 02:38:24 +02:00
Lukas Neubert
a67873f6cf jsgen: tests: ensure output deletion on fail (#6875) 2020-11-20 01:15:32 +01:00
Alexander Medvednikov
d50c919879 clipboard: fix get_text() on macos 2020-11-20 01:08:55 +01:00
Daniel Däschle
925b40e2c0 gitignore: ignore .env (#6879) 2020-11-19 21:16:03 +01:00
Nick Treleaven
e798326a1a gen: implement labelled break and continue (#6880) 2020-11-19 21:13:15 +01:00
Daniel Däschle
41ba942369 parser: smartcast mutable selector (#6881) 2020-11-19 21:05:10 +01:00
Delyan Angelov
2e57a1e1a6 sync: add vlib/sync/bench/many_writers_and_receivers_on_1_channel.v (run with --help) 2020-11-19 21:30:38 +02:00
Daniel Däschle
9feb010355 all: mutable smartcasts (#6878) 2020-11-19 17:28:46 +01:00
Delyan Angelov
48b117618d builtin: support -d no_backtrace, to ease compiling V code on older distros easier 2020-11-19 17:58:33 +02:00
Larpon
f807fd973e compile: infer source file if a binary by the same name exists in same dir #6877 2020-11-19 16:23:55 +01:00
Lukas Neubert
268e3b5d15 ci: change "vid" to "ved" (#6876) 2020-11-19 16:22:51 +01:00
Delyan Angelov
69bb0891c7 vfmt: fix ^A keep.vv test too 2020-11-19 16:25:52 +02:00
Delyan Angelov
92a75c80db vfmt: trim ^A from embedded inline comments too 2020-11-19 15:32:51 +02:00
Delyan Angelov
40770f1697 ci: add timeout-minutes attributes for jobs 2020-11-19 13:16:18 +02:00
Daniel Däschle
e06756ef58 all: match multi aggregate for union sum types (#6868) 2020-11-18 20:52:00 +01:00
Lukas Neubert
df4165c7ee docs_ci: check all md files except thirdparty (#6855) 2020-11-18 18:28:28 +01:00
pancake
d8f64f516b js: fix codegen for multiline strings (#6791) 2020-11-18 18:23:44 +01:00
Anton Zavodchikov
6d99f0af50 x.websocket: expose log field (#6866) 2020-11-18 18:22:44 +01:00
Carlos Esquerdo Bernat
b4ae332e0c web socket: fix wss 2020-11-18 18:21:49 +01:00
Daniel Däschle
ed874ffc5b checker: fix sum type operator check (#6815) 2020-11-17 21:26:40 +01:00
Lukas Neubert
ee5ad2a653 parser: fix duplicated struct attrs on first field (#6859) 2020-11-17 21:25:54 +01:00
Swastik Baranwal
4415feb2df checker: disallow string(bool) (#6863) 2020-11-17 21:23:17 +01:00
Larpon
9f5a3b52a7 all: optimize png images (#6860) 2020-11-17 17:42:21 +01:00
Larpon
4a31b5702e examples: term.ui: add readme, copyright, and pong screenshot (#6858) 2020-11-17 17:41:54 +01:00
Larpon
f44853a87f examples: term.ui - add a pong clone (#6857) 2020-11-17 15:25:41 +01:00
Daniel Däschle
ba2c5f68fc vdoc: trim trailing / (#6856) 2020-11-17 15:08:55 +01:00
Larpon
fdc0cd4c03 term.ui: add dashed lines and rectangles (#6848) 2020-11-17 15:08:35 +01:00
Alexander Medvednikov
e542df549c roadmap: update 2020-11-17 12:19:33 +01:00
Alexander Medvednikov
ed2d62b8e7 roadmap: update 2020-11-17 10:02:44 +01:00
Lukas Neubert
dbdcef5166 quote_path: also quote ampersands (#6846) 2020-11-16 19:26:44 +02:00
Delyan Angelov
d633261a99 os: add Process (#6786) 2020-11-16 17:32:50 +01:00
Alexander Medvednikov
8e473181ed autofree: remove old logic 2020-11-16 17:31:34 +01:00
Alexander Medvednikov
68077b7dbf autofree: handle early returns (part 1) 2020-11-16 17:26:54 +01:00
Lukas Neubert
fdfe2a4e68 check-md: check CONTRIBUTING.md too (#6847) 2020-11-16 16:49:40 +01:00
Larpon
0c54ebdf41 text_editor: add magnet cursor position (#6843) 2020-11-16 14:51:39 +02:00
spaceface777
ac8a2ff12d term.ui: feature-detect the SU spec (#6844) 2020-11-16 14:48:08 +02:00
Delyan Angelov
b3e19c7247 tests: restore skipped return_missing_comp_if.vv and return_missing_comp_if_nested.vv 2020-11-16 10:07:53 +02:00
Delyan Angelov
05933e783d net: add back some lower level client/server tcp tests 2020-11-16 09:59:37 +02:00
Nick Treleaven
4882d338f0 checker: improve array literal element type mismatch error (#6825) 2020-11-16 00:41:24 +02:00
Emily Hudson
cd2a2cef25 vlib/net: add buffered IO, x.net -> net (#6754) 2020-11-15 22:54:47 +02:00
Daniel Däschle
20bec81678 checker: smartcast only if type is not mut (#6841) 2020-11-15 16:53:51 +02:00
Delyan Angelov
4559b4138f cmd: rename test-vet to test-cleancode 2020-11-15 16:40:35 +02:00
Alexander Medvednikov
9cf5a31faf vtest-vet: rename verify_list to vfmt_verify_list 2020-11-15 15:20:49 +01:00
Alexander Medvednikov
5fb4d77764 doc: use fixed-width symbol name at start of comment (#6840) 2020-11-15 15:16:41 +01:00
Alexander Medvednikov
05c56d4577 test: vfmt -verify gg/gg.v 2020-11-15 15:16:08 +01:00
Alexander Medvednikov
ad1510afa0 gg: vfmt gg.v 2020-11-15 15:11:43 +01:00
Alexander Medvednikov
26785668c0 autofree: more tests; gg: fix draw_circle with hidpi 2020-11-15 15:09:44 +01:00
Nick Treleaven
40e7b0eeb3 doc: use fixed-width symbol name at start of comment 2020-11-15 12:58:58 +00:00
Anton Zavodchikov
fe3d2a9aba json2: unescape characters (#6836) 2020-11-15 14:58:17 +02:00
Delyan Angelov
c8b7cfc297 examples: small fix for ctrl-right at the last word of a line 2020-11-15 14:49:55 +02:00
spaceface777
dcbb285ae4 examples: text editor: implement ctrl+arrows to move by word (#6838) 2020-11-15 13:33:08 +01:00
Delyan Angelov
f995aa35ea checker: add a check for x := math.sin<f64>(0) 2020-11-15 11:51:12 +02:00
spaceface777
1ead130eed term.ui: render to the alternate buffer (#6832) 2020-11-14 21:05:22 +02:00
Delyan Angelov
b96a0246b5 ci/tools: check-md.v: add support for "```v live" 2020-11-14 20:02:10 +02:00
Nick Treleaven
01a5b263e5 encoding/csv: improve Reader docs (#6828) 2020-11-14 19:49:36 +02:00
Swastik Baranwal
00464ad988 builtin: add charptr.vstring() and charptr.vstring_with_len() (#6830) 2020-11-14 19:43:42 +02:00
Carlos Esquerdo Bernat
827fb62c29 examples/text_editor: edit multiple files (#6827) 2020-11-14 19:39:59 +02:00
Nick Treleaven
50163508f8 gen: implement type_name method for sum type instances (#6802) 2020-11-14 13:59:03 +02:00
Delyan Angelov
2dc9a45e06 vfmt: fix eating of app.$method(vars); format vlib/vweb/vweb.v 2020-11-14 13:55:10 +02:00
Delyan Angelov
ba8cdb2977 vfmt: fix $for method in App.methods {} turning to App(methods) 2020-11-14 12:24:46 +02:00
Delyan Angelov
d6d202341a table: add a helper pub fn (t Type) debug() []string {} 2020-11-14 11:39:58 +02:00
Delyan Angelov
df385799a2 checker: fix invalid type (typ=0 idx=0) when x,y := gfn(), and gfn returns (Abc,T) 2020-11-14 10:42:56 +02:00
Delyan Angelov
023cddb160 cgen: remove .replace('T', ...) 2020-11-14 10:36:59 +02:00
spaceface777
ec3b96924f examples/text_editor: make scrolling smoother (#6819) 2020-11-14 09:21:46 +02:00
spaceface777
6b47c61fe4 term.ui: handle middle mouse button events and modifier keys (#6821) 2020-11-14 09:14:54 +02:00
Takahiro Yaota
5069be04a2 net: improve socket_test (#6822) 2020-11-14 08:23:22 +02:00
Delyan Angelov
01579957b8 builder: move -c right before the .c thirdparty file 2020-11-13 20:42:26 +02:00
Delyan Angelov
8cb1714255 builder: fix building sqlite3 on windows 2020-11-13 20:35:21 +02:00
spaceface777
eacd6b5d54 examples/text_editor: minor cleanup and simplifications (#6818) 2020-11-13 19:18:05 +02:00
Larpon
b02f03e20a examples: add a simple text editor example to term.ui (#6808) 2020-11-13 15:27:12 +01:00
spaceface777
c315218ed1 term.ui: allow setting the terminal title (#6809) 2020-11-13 15:30:47 +02:00
Delyan Angelov
7feb1742d3 cgen: skip deleted map entries in the auto generated .str() method 2020-11-13 13:37:11 +02:00
Delyan Angelov
a3404a38c6 term_drawing.v: support arrows, 1, 2 and space 2020-11-13 13:08:28 +02:00
pancake
862cae5b02 term: handle keyboard keys in the term_drawing example (#6810) 2020-11-13 11:49:09 +02:00
Delyan Angelov
f6e54dc027 term.ui: improve Ctrl-Z + fg handling 2020-11-13 10:27:53 +02:00
Nick Treleaven
680ac411d7 doc: document sum type smart cast (#6803) 2020-11-12 20:13:37 +01:00
Nick Treleaven
c9997fb919 doc: split out perform from interface example (#6805) 2020-11-12 20:10:09 +01:00
Nick Treleaven
21af7004ff doc: fix embedding example (#6804) 2020-11-12 13:50:37 +01:00
Daniel Däschle
9c569246ef cgen: fix typeof union sum type (#6794) 2020-11-12 12:27:54 +01:00
spaceface777
24f743ee12 term: add term.ui module (part 2) (#6798) 2020-11-12 12:12:51 +01:00
Alexander Medvednikov
4ddfff287c readme: add an overview of the architecture 2020-11-12 09:32:46 +01:00
Alexander Medvednikov
ee86d0e483 readme: contributing => contributing & compiler design 2020-11-12 09:28:19 +01:00
Luke Edwards
a525397022 checker: improve wording on error messages (#6799) 2020-11-11 23:11:27 +02:00
Delyan Angelov
f42a44abec vfmt: fix match x { 10 /* ... */ {} } and a := [1/* x */, /* y */2, 3] 2020-11-11 22:59:43 +02:00
Delyan Angelov
e6cc967ac8 vfmt: small cleanup 2020-11-11 21:43:47 +02:00
Delyan Angelov
8197463b08 vfmt: fix x := Repo<User,Permission>{} 2020-11-11 21:41:04 +02:00
Daniel Däschle
43ce098043 cgen: fix default value init for union sum types (#6795) 2020-11-11 19:56:13 +02:00
Delyan Angelov
a4acb70c64 vfmt: remove rc4.v from known_failing_exceptions 2020-11-11 18:19:03 +02:00
Delyan Angelov
2759b80514 vfmt: remove aes.v and block_generic.v from known_failing_exceptions in v test-fmt 2020-11-11 18:16:45 +02:00
Delyan Angelov
dd1717af34 checker: add a missing return regression test for if branches too 2020-11-11 18:06:13 +02:00
Delyan Angelov
ebfd259333 vfmt: support struct Repo <T, U> { } 2020-11-11 17:50:03 +02:00
Delyan Angelov
7d472d887e scanner: vfmt scanner.v 2020-11-11 17:25:58 +02:00
Delyan Angelov
8c241cb745 checker: check that fns with return values, and matches, do return 2020-11-11 17:23:57 +02:00
Daniel Däschle
6271798ce3 cgen: union sum types implementation (#6745) 2020-11-11 09:18:15 +01:00
spaceface777
bb91dc90a5 checker: fix & on pointers (#6787) 2020-11-10 13:12:21 +02:00
Nick Treleaven
baf2ff1a91 checker: unify invalid argument errors, use argument position (#6785) 2020-11-10 10:40:50 +01:00
Alexander Medvednikov
2254f41722 autofree: free all vars in parent scopes recursively 2020-11-09 15:56:28 +01:00
Nick Treleaven
c76e486765 parser: implement T.name for generic types (#6783) 2020-11-09 14:35:26 +01:00
Alexander Medvednikov
1c257abc23 autofree: simplify: merge tmp arg logic with scope vars 2020-11-09 14:24:46 +01:00
Alexander Medvednikov
507d724ee6 autofree: free before return tests 2020-11-09 11:54:45 +01:00
KJ Lawrence
7108f89b69 pg: fix exec & exec_param_many (#6782) 2020-11-09 08:22:16 +01:00
div72
b0053d8910 x.json2: change default number type to i64 (#6773) 2020-11-09 07:37:53 +01:00
Carlos Esquerdo Bernat
ba366b126f ws: handle close on client quit (#6776) 2020-11-08 20:36:42 +02:00
spaceface777
3c83551dfe parser: fix treating JS fn calls as type casts (#6779) 2020-11-08 20:33:55 +02:00
Tomas Hellström
68cfbd6d66 websocket: fix autobahn test to always use latest v(#6780) 2020-11-08 17:46:06 +01:00
pancake
af5836202c js: fix wrong filename and invalid backend selected when using -o .js (#6777) 2020-11-08 17:45:32 +01:00
pancake
2994e7150f vweb: check function and route parameter count (#6761) 2020-11-08 09:14:24 +01:00
Delyan Angelov
6da8454b3b builder: a small -usecache fix, when v is run in subfolders 2020-11-08 09:18:05 +02:00
Delyan Angelov
4b35495fbe all: support VMODULES environment variable (defaulting to ~/.vmodules) 2020-11-08 08:07:17 +02:00
Delyan Angelov
0ba5544446 checker: add a check for ptr = Abc{} 2020-11-07 21:19:46 +02:00
Nick Treleaven
931882d720 checker: support ?T, &T generic return types (#6772) 2020-11-07 18:27:10 +02:00
Tomas Hellström
b47c23b73e x.websocket: fix the uri port parsing problem. Make failures more informative (#6775) 2020-11-07 18:14:33 +02:00
Delyan Angelov
56817ea137 v search: add an import suggestion for an already existing module in vlib 2020-11-07 18:03:09 +02:00
Swastik Baranwal
6354fa031c checker: add more checks for index_expr (#6737) 2020-11-07 14:55:05 +01:00
Nick Treleaven
125650c986 cgen: fix using brackets for match expression (#6768) 2020-11-07 14:47:27 +01:00
Alexander Medvednikov
0d8114e14d ci: build gitly with -autofree 2020-11-07 04:07:43 +01:00
Alexander Medvednikov
0e8c7ca2e3 autofree: fix string reassignment 2020-11-07 04:00:45 +01:00
Nick Treleaven
62cae1ba00 parser: parse func<T>() when T is a map or array type (#6765) 2020-11-07 02:55:28 +01:00
spaceface777
1d706674f2 cgen: don't generate a default expr if a function ends with return (#6766) 2020-11-06 18:46:41 +02:00
Ned Palacios
6d8a7ced24 cgen: fix setting nested map elements fields (#6744) 2020-11-06 16:32:44 +02:00
Delyan Angelov
e6828560d1 ci: turn off failing websocket_autobahn job for now 2020-11-06 16:28:46 +02:00
spaceface777
a9e9554b11 all: fix most C warnings (#6758) 2020-11-06 16:26:59 +02:00
Delyan Angelov
98e8894d90 x.websocket: more informative errors 2020-11-06 16:10:22 +02:00
Lukas Neubert
2258ab17a4 bin2v: make output compliant to fmt -verify (#6763) 2020-11-06 15:36:14 +02:00
Alexander Medvednikov
3e5871ffb3 autofree: disable optional_return test for now 2020-11-06 10:30:27 +01:00
Alexander Medvednikov
212e6fe52c autofree: do not run in builtin 2020-11-06 10:13:05 +01:00
Delyan Angelov
b14f779853 vweb: add a placeholder for checking route validity at startup 2020-11-05 22:59:11 +02:00
Delyan Angelov
d34c5b767b vfmt: keep the source fn type alias names, instead of the expanded fn declarations 2020-11-05 20:21:37 +02:00
Delyan Angelov
26c2654632 parser: vfmt vlib/v/parser/struct.v 2020-11-05 19:55:20 +02:00
Delyan Angelov
953d102996 parser: prevent a segfault, when compiling cmd/tools/vtest-vet.v in PR 6754 2020-11-05 19:40:15 +02:00
Delyan Angelov
3f9b05a876 vfmt: skip {} for pure fn declarations (let the bodies hit the floor) 2020-11-05 18:59:36 +02:00
Delyan Angelov
e80487b35c vfmt: support inline comments before fields in struct initializations 2020-11-05 18:49:52 +02:00
Delyan Angelov
4bf1c2fdcc vfmt: support match a { x...y {} } 2020-11-05 18:35:14 +02:00
Delyan Angelov
35096cda3f vfmt: support comments after interface methods 2020-11-05 18:23:45 +02:00
Larpon
4051ce869c all: remove unused enum value and improve error message for @ tokens in scanner (#6751) 2020-11-05 12:59:49 +02:00
Larpon
785bf40f67 all: remove comp time '@' expansion from scanner (#6746) 2020-11-05 10:12:32 +02:00
Alexander Medvednikov
1b1d17cfb5 os: basic proof of concept stdout capture; autofree: small fixes 2020-11-05 08:44:37 +01:00
Carlos Esquerdo Bernat
8157f3c6ab websocket: get port of the uri (#6750) 2020-11-05 06:36:50 +01:00
Nick Treleaven
ca8d23acab table: make Table.type_to_str generate proper function type, not fn name (#6716) 2020-11-05 06:34:56 +01:00
Daniel Däschle
a2fc19880a parser: fixes or block position (#6736) 2020-11-04 16:02:01 +02:00
Delyan Angelov
fff70368b7 tests: show all the failed messages even with -silent 2020-11-04 13:38:05 +02:00
Delyan Angelov
9eb655e65c all: add .pos fields to all AST nodes, to avoid wrong positions in error messages 2020-11-04 13:34:12 +02:00
Daniel Däschle
25912673a9 cgen: fix generic json bug (#6731) 2020-11-04 10:21:30 +02:00
Ekopalypse
cc4bb71f29 os: prevent unnecessary dependencies when importing os on windows (#6741) 2020-11-04 10:19:46 +02:00
Delyan Angelov
cd399b7e6e examples: cleanup up the life automaton implementation 2020-11-04 10:00:59 +02:00
Alexander Medvednikov
518da92a7e doc: embedded structs are no longer TODO 2020-11-03 23:08:03 +01:00
Daniel Däschle
9d5be12517 gen: add prefix when printing type aliases (#6701) 2020-11-03 14:13:35 +01:00
Delyan Angelov
18f5ed671d builder: fix -showcc with msvc 2020-11-03 12:37:04 +02:00
Delyan Angelov
aecdfb06e7 x.net: fix C fn redeclaration of C.inet_ntop (prevented compiling x.net and net together) 2020-11-03 10:06:47 +02:00
Delyan Angelov
204fd8be03 builder: improve the function redefinition detector 2020-11-03 10:00:06 +02:00
Delyan Angelov
2c3f695469 checker,parser: treat C.Struct fields as public by default 2020-11-03 09:35:44 +02:00
Alexander Medvednikov
6229965569 tools/fast: use delta*2 for operations that require a C compiler 2020-11-03 02:53:15 +01:00
Alexander Medvednikov
6cd0ff2b52 tools/fast: change delta to 20ms to easier catch commits that slow down the compiler 2020-11-03 02:50:30 +01:00
Alexander Medvednikov
a76460f5d6 tools/fast: change delta from 50ms to 40ms 2020-11-03 02:29:50 +01:00
Delyan Angelov
f32c6784e7 ci/tools: check-md.v: extract examples and check they are compilable (#6719) 2020-11-03 01:04:14 +01:00
Delyan Angelov
ae241785bf vfmt: fix union {} declarations 2020-11-03 00:35:12 +02:00
Lukas Neubert
4ccb219079 clipboard: fix windows warnings and run vfmt (#6715) 2020-11-02 23:00:29 +01:00
Nick Treleaven
788de9938a cgen: fix typeof(expr).name for generic type, pointers, etc (#6712) 2020-11-02 22:59:48 +01:00
Delyan Angelov
2202ee5d66 tests: add tests for continue/break in last statement of an or{} 2020-11-02 12:54:45 +02:00
Delyan Angelov
4e760c703e checker: disallow opt_returning_string() or { ... 123 } (closes #6711) 2020-11-02 05:29:37 +02:00
pancake
d040af4939 checker: improve error message for: a := foo() or { println(err) } (#6710) 2020-11-02 04:52:35 +02:00
Alexander Medvednikov
613d6c043b autofree: fix the tests 2020-11-02 01:39:10 +01:00
Alexander Medvednikov
06e4c45350 tests: re-enable valgrind tests 2020-11-02 01:25:16 +01:00
Daniel Däschle
d5a421e3f5 checker: add alias cast type check (closes #6705) (#6709) 2020-11-02 01:17:35 +01:00
Delyan Angelov
3c0f4c46fa checker: add check preventing if x:=non_optional() {} 2020-11-02 01:58:07 +02:00
Alexander Medvednikov
a0bf796926 autofree: handle SelectorExpr and fix json 2020-11-02 00:57:45 +01:00
zacanger
f0c98fb5c2 doc: fix syntax in sqlite install instructions(#6707) 2020-11-01 22:16:18 +01:00
sunnylcw
f934ca37c9 mysql: patch for Windows and FreeBSD (#6703) 2020-11-01 22:15:33 +01:00
Delyan Angelov
e2505479ee cgen: encode newlines as \n in the assert meta information 2020-11-01 17:01:45 +02:00
Delyan Angelov
e72d9c0f88 parser: protect against infinite loops in -silent mode over invalid .v files 2020-11-01 14:02:32 +02:00
Daniel Däschle
9fdf04b7ff cgen: make generics printable (#6700) 2020-10-31 19:43:06 +02:00
Delyan Angelov
db59585a51 sokol.gfx: fix C.sg_depth_stencil_state compilation with tcc 2020-10-31 14:15:05 +02:00
Ned Palacios
a2a0765eff cgen: fix setting map elements' fields (#6699) 2020-10-31 13:00:04 +01:00
Alexander Medvednikov
b59c5fd82b autofree: do not free tmp vars twice 2020-10-31 08:26:54 +01:00
Delyan Angelov
70cbf56655 cgen: show more informative errors, instead of a invalid type (typ=0 idx=0) verror panic 2020-10-30 20:26:08 +02:00
Delyan Angelov
60659f1407 vup: show the commit date of v too 2020-10-30 16:15:47 +02:00
Delyan Angelov
ff93e8afee builtin: eliminate the usage of _us32_eq for frequent builtin array operations 2020-10-30 14:11:07 +02:00
Delyan Angelov
fee56b1902 v repl: improve the V REPL welcome message 2020-10-30 14:09:43 +02:00
Alexander Medvednikov
791fda16d3 fmt: handle "it" in lambdas 2020-10-30 07:35:44 +01:00
Alexander Medvednikov
2c75b1397c all: struct embedding 2020-10-30 07:09:26 +01:00
Alexander Medvednikov
dca3d13606 autofree: another lambda fix 2020-10-30 00:43:04 +01:00
Ned Palacios
ccc0cb23ed doc: store source content, restructure module directory (#6692) 2020-10-29 17:21:37 +01:00
Ned Palacios
7b5a580c0c util: split bom checking to a separate fn (#6694) 2020-10-29 17:21:08 +01:00
Delyan Angelov
be02ee97fb sync: enable compilation with -autofree 2020-10-29 12:17:08 +02:00
pancake
367067dfff pkgconfig: improve and fix the parser; move to v.pkgconfig (#6695) 2020-10-29 11:57:23 +02:00
Alexander Medvednikov
423044d4d6 autofree: skip lambda for now 2020-10-29 08:59:13 +01:00
Alexander Medvednikov
71dfec3c4d autofree: generate unique names for each arg 2020-10-29 08:26:45 +01:00
pancake
fbd193b27c doc: document pkgconfig (#6687) 2020-10-29 08:02:49 +01:00
Ned Palacios
ce7da85166 parser: make .parse() public (#6693) 2020-10-29 07:10:45 +01:00
Alexander Medvednikov
21002bf2de autofree: fix re-assigning an optional 2020-10-29 07:06:58 +01:00
Alexander Medvednikov
f19ca6b411 autofree: simplify, use more scoping, fix expressions inside or blocks 2020-10-29 01:09:38 +01:00
Delyan Angelov
b0ccc0784e repeat: add a workaround for an -autofree bug 2020-10-28 12:48:27 +02:00
Delyan Angelov
b7121786a5 table: run vfmt over atypes.v 2020-10-28 08:46:54 +02:00
Delyan Angelov
7fb739ebcf table: make mut/not mut aggregate fields equal (for read only access) 2020-10-28 08:43:18 +02:00
Swastik Baranwal
0c987f433d string: enable test for string escaping (#6688) 2020-10-27 15:25:44 +01:00
pancake
36c5eab799 all: add #pkgconfig directive using the new vlib modules (#6673) 2020-10-26 18:05:18 +01:00
Delyan Angelov
cf21c63183 v.vcache: extract v.vcache to a separate module, to test it and reuse it 2020-10-26 18:37:37 +02:00
Delyan Angelov
0c192cfd64 tests: fix warnings when doing ./v -W -progress -check-syntax test-fixed 2020-10-26 14:41:57 +02:00
Delyan Angelov
9772eb7c96 examples: fix warnings when doing ./v -W -progress -check-syntax build-examples 2020-10-26 13:14:26 +02:00
Jabba Laci
a7e3092165 help text is nicely aligned (#6683) 2020-10-26 11:24:25 +02:00
Delyan Angelov
535c4ed0d6 builder: return early in run_compiled_executable_and_exit, when -check-syntax is passed 2020-10-26 11:23:28 +02:00
Rolf Schmidt
3f5be0f4fc mysql: fix unwrapped unsafe code of mysql lib (#6680). (#6681) 2020-10-26 11:21:28 +02:00
Mark
8e478e8909 doc: minor typo/English improvements (#6678) 2020-10-25 13:55:57 +01:00
Delyan Angelov
60cc8ac39c vcache: use 2x wyhash.sum64_string(hk,x).hex_full(), instead of md5.sum(hk.bytes()).hex() 2020-10-25 09:22:31 +02:00
Delyan Angelov
5cb31c2c8f builder: fix support for tcc on windows (openlibm.o) 2020-10-25 03:35:34 +03:00
Endel Dreyer
4653ed3fa5 readme: update patreon badge (#6676) 2020-10-25 02:21:36 +02:00
Delyan Angelov
5f6259dde6 v: add VCACHE support for thirdparty object files and for v build-module 2020-10-25 03:09:07 +03:00
Delyan Angelov
89daec4e93 ci: run vfmt over compile.v and checker.v 2020-10-24 20:41:52 +03:00
Nick Treleaven
6c267f1c74 doc: explain current limitations of generics (#6674) 2020-10-24 19:37:14 +02:00
Delyan Angelov
8b01146b90 compiler: implement -W and -reuse-tmpc 2020-10-24 20:34:50 +03:00
Alexander Medvednikov
42da37e900 autofree: fix if expressions 2020-10-24 19:06:31 +02:00
Delyan Angelov
a52314d70a v test-vet: call testing.setup_new_vtmp_folder() before creating each new test session 2020-10-24 17:19:58 +03:00
Delyan Angelov
23ee3018c3 tools: add v test-vet 2020-10-24 16:37:58 +03:00
Delyan Angelov
296a6095a4 builder: vfmt compile.v 2020-10-24 15:48:11 +03:00
Delyan Angelov
8f85396a31 builder: use unique .tmp.c and .tmp.c.rsp files, and rm them on successfull non debug builds. 2020-10-24 15:08:45 +03:00
Delyan Angelov
ac6fad6a63 checker: fix comptime custom defines usages, add tests 2020-10-24 15:06:51 +03:00
Larpon
e97d3af4b1 tcc: fix 'tcc: error: library atomic not found' on older Ubuntu distros (#6672) 2020-10-24 13:49:57 +03:00
Alexander Medvednikov
c2e9be5a45 cgen: use even more efficient array.delete_last() 2020-10-23 23:04:22 +02:00
Alexander Medvednikov
334497fdc0 cgen: use more efficient array.pop() 2020-10-23 22:52:50 +02:00
Alexander Medvednikov
3b3501cf09 autofree: if expression fixes 2020-10-23 22:50:22 +02:00
Delyan Angelov
8ffbcdc553 cgen: extract g.new_ctemp_var/2, g.new_ctemp_var_then_gen/2 and g.gen_ctemp_var from gen_assert_stmt 2020-10-22 19:48:06 +03:00
Delyan Angelov
66787b05d6 cgen: support most kinds of ast.PrefixExpr in gen_assert_metainfo 2020-10-22 19:25:07 +03:00
Delyan Angelov
f7698ea160 v symlink: fix windows PATH setting (cmd.exe needs C: not c:) 2020-10-22 17:31:37 +03:00
Alexander Medvednikov
66b8462d7a autofree: handle method chains 2020-10-22 03:51:28 +02:00
Delyan Angelov
ab137e4164 cgen: print results of failed callexprs in assert fn() == fn2() (#6665) 2020-10-21 21:58:40 +02:00
Alexander Medvednikov
6d11caf784 autofree: string.replace() test 2020-10-21 19:44:31 +02:00
Swastik Baranwal
019e3b2f4a checker: add error for ast.PrefixExpr on the left side of decl_assign (#6660) 2020-10-21 17:37:30 +02:00
Delyan Angelov
d67e177733 ci: run v vet over cmd/tools and cmd/v too 2020-10-21 15:26:29 +03:00
Delyan Angelov
9322e91d1b v test-fmt: add 1 sec sleep before rebuilding vfmt, to avoid its parallel recompilation afterwards 2020-10-21 15:20:07 +03:00
Delyan Angelov
87f659a0dc ci: fix should_recompile_tool/2 2020-10-21 15:07:57 +03:00
Delyan Angelov
5e523fd03a vc: revert previous commit, vc is now regenerated
This reverts commit e1478d02b1.
2020-10-21 14:53:34 +03:00
Delyan Angelov
e1478d02b1 vc: fix stuck vc bootstrapping (fixes CI) 2020-10-21 14:43:10 +03:00
Delyan Angelov
8bc2f8ccda vfmt: run fmt over cmd/tools/*.v 2020-10-21 14:36:21 +03:00
Delyan Angelov
1aa6c125d9 ci: fix v self 2020-10-21 13:43:18 +03:00
Delyan Angelov
7b552eb590 v test-fmt: fix a typo 2020-10-21 13:37:05 +03:00
Delyan Angelov
28d7532fe8 docs: make the users.sort example directly runnable 2020-10-21 12:57:58 +03:00
Delyan Angelov
02db94c4bc v test-fmt: reuse v.util.should_recompile_tool/2, extracted from v.util.launch_tool/3 2020-10-21 12:54:10 +03:00
Delyan Angelov
dab66593fc vlib: run vfmt over vlib files, so that v doc -m vlib/ can run without warnings 2020-10-21 12:54:10 +03:00
Ned Palacios
5b1ab3b0bb vdoc: use maps, enum-based categorization; fixes (#6659) 2020-10-21 11:26:33 +03:00
Delyan Angelov
0e56b96bda v test-fmt: recompile vfmt only when needed 2020-10-21 11:06:15 +03:00
Delyan Angelov
09128accff ci: fix ./v build-module vlib/v/gen case 2020-10-21 10:13:50 +03:00
Delyan Angelov
c4fa1dbc0b ci: fix syntax error in ci.yml 2020-10-21 09:45:32 +03:00
Delyan Angelov
f09698894a v test-fmt: recompile vfmt once before all other tests, to prevent locking the executable 2020-10-21 09:11:09 +03:00
Delyan Angelov
f3732b730a term: replace assert with panic to enable build-module for it too 2020-10-21 08:49:07 +03:00
Alexander Medvednikov
61611159c7 ci: disable term cache build for now 2020-10-21 00:42:22 +02:00
Alexander Medvednikov
00e9daf790 ci: test building more modules 2020-10-21 00:17:47 +02:00
Lukas Neubert
f3de2cea7d vpm search: mark modules that are already installed (#6657) 2020-10-20 23:02:17 +02:00
Enzo
21db4b338b parser: clean error when nesting unsafe (#6656) 2020-10-20 22:57:24 +03:00
Lukas Neubert
d881185d79 ci: separate workflow for docs line len check (#6653) 2020-10-20 20:14:56 +02:00
Delyan Angelov
5c93f942be docs,tests: add project_with_c_code_2 (passing structs from C to V to C) 2020-10-20 17:59:48 +03:00
Delyan Angelov
0e55534c6e cgen: fix spurious autoref bug, for struct init of a &C.type field, with a byteptr value 2020-10-20 16:28:33 +03:00
Alexey
74ebce6b1f vdoc: fix generating documentation for 3rd-party modules (#6651) 2020-10-20 02:52:56 +02:00
Alexey
3ae3196d42 vdoc: allow to omit timestamp (#6652) 2020-10-19 21:30:37 +02:00
Lukas Neubert
f37e936321 pg, sqlite, mysql: run vfmt (#6650) 2020-10-19 20:11:04 +02:00
Alexander Medvednikov
37d6503437 parser: do not allow fn consts 2020-10-19 13:48:39 +02:00
Delyan Angelov
0d31b39f11 cgen: improve error message for <inttypes.h> 2020-10-19 12:44:53 +03:00
Delyan Angelov
d89986dd5e cgen: use a guarded include for <inttypes.h> too 2020-10-19 12:18:22 +03:00
Quentin Champ
4bc38a2f6c examples: apply todo suggestion in word counter (#6640) 2020-10-18 22:46:13 +02:00
Alexander Medvednikov
2d446aa2ce ci: fix path to V UI examples 2020-10-18 21:42:19 +02:00
Delyan Angelov
92d9569d5d checker: fix #include with @VROOT 2020-10-18 22:31:21 +03:00
Alexander Medvednikov
9f620ab23b ci: build all V UI examples 2020-10-18 21:29:29 +02:00
Alexander Medvednikov
396dca7f48 checker: handle bad $if values 2020-10-18 21:22:37 +02:00
Alexander Medvednikov
30214a7700 Revert "cgen: enable new if expression implementation everywhere"
This reverts commit 958577b98b.
2020-10-18 20:19:52 +02:00
Alexander Medvednikov
958577b98b cgen: enable new if expression implementation everywhere 2020-10-18 20:14:58 +02:00
Delyan Angelov
9cf5c9ac43 tests: simplify print mode logic 2020-10-18 20:49:25 +03:00
Delyan Angelov
2440413310 tests: turn off live_test.v on macos for now (due to frequent false positives) 2020-10-18 19:45:49 +03:00
Delyan Angelov
16ce316695 ci: add V_CI_PERIODIC env for periodic.yml 2020-10-18 19:44:53 +03:00
Delyan Angelov
d75b9c704c ci: use -silent so failures are easier to spot in the logs 2020-10-18 19:38:45 +03:00
Delyan Angelov
7bc94fff9a tests: implement compact progress mode (the old one is available with -expand) 2020-10-18 19:27:29 +03:00
Delyan Angelov
a9659beabe tests: simplify the synchronized printing of results, using chan string 2020-10-18 18:16:33 +03:00
Delyan Angelov
cc477c50ed repeat: cleanup spurious eprintln 2020-10-18 17:31:37 +03:00
Alexander Medvednikov
8a68714095 cgen: new experimental simple if expression implementation 2020-10-18 15:55:18 +02:00
Delyan Angelov
941f138934 vfmt: use rand.ulid() for the worker file name (make v test-fmt more robust) 2020-10-18 13:46:30 +03:00
Delyan Angelov
2f149e6984 vfmt: fix merged param warnings in sokol's particles example and vlib/x/net/udp.v 2020-10-18 13:45:13 +03:00
Delyan Angelov
44753e62ab builder: enable v run x_test.v to allow universal make/compile commands in vim/emacs 2020-10-18 10:34:40 +03:00
Delyan Angelov
8b2e704741 examples: make v -prod build-examples pass without warnings/errors 2020-10-18 09:48:13 +03:00
Delyan Angelov
67ecc04580 examples: build examples/hello_v_js.v without warnings/errors 2020-10-18 09:33:55 +03:00
Delyan Angelov
b7233a23d7 examples: build examples/path_tracing.v with -prod, with no warnings/errors 2020-10-18 09:00:30 +03:00
Delyan Angelov
dd96ba0d24 vfmt: fix type TwoSameArgs = fn (i int, j int) string formatting 2020-10-18 08:54:29 +03:00
Delyan Angelov
5c4ba3474b vfmt: fix init_fn gg.FNCb = voidptr(0) when vfmt-ing gg.v 2020-10-18 08:42:08 +03:00
Alexander Medvednikov
55536bb364 autofree: handle more statements 2020-10-18 00:48:06 +02:00
Swastik Baranwal
acc85be5ae checker: disallow type casting to none (#6635) 2020-10-17 20:02:30 +03:00
Delyan Angelov
9309a07438 net.openssl: update custom missing headers message 2020-10-17 19:30:50 +03:00
Lukas Neubert
dea8662d6b cli: show help for empty root command (#6636) 2020-10-17 19:06:27 +03:00
Delyan Angelov
3c2202572b cgen: produce cleaner error on missing C headers (with optional explanation) (#6637)
Implements support for `#include <openssl/rand.h> # Please install OpenSSL`.
2020-10-17 18:27:06 +03:00
Delyan Angelov
aad122334b vlib: fix warnings due to the vfmt change 2020-10-17 16:26:56 +03:00
Delyan Angelov
8d88b73512 parser: fix formatting 2020-10-16 17:47:23 +03:00
Delyan Angelov
140166e1cd interpolation: support '' (rounding like in C) 2020-10-16 17:28:11 +03:00
Delyan Angelov
11ee68e799 cgen: fix an interface index generation bug 2020-10-16 15:22:25 +03:00
Delyan Angelov
3af700d950 vself: fix v self (it compiled to cmd/v/v without -o) 2020-10-16 15:06:32 +03:00
Lukas Neubert
7471e1fd05 symlink: create /usr/local/bin if it does not exist (#6621) 2020-10-16 09:55:55 +02:00
Delyan Angelov
eab0974e7d net: allow more accurate profiling, using res := C.xxx return res instead of return C.xxx 2020-10-16 00:43:55 +03:00
Delyan Angelov
6cea20e427 tests: fix warnings in live_test.v 2020-10-15 23:15:00 +03:00
Enzo
b083f4014b fmt: fix multiple things and format most of the compiler (#6631)
Format expressions inside string interpolation like the rest (it used to be a+b instead of a + b, not too sure why)
Fix formatting some match branches when there were only one statement inside (it was inlined)
Fix parsing and formatting some comments edge case on struct field init. You should check out this test because the result is a bit different from before. I personally find it more logical but I would understand if the former format was to stay
Fix formatting of void-returning function signature
2020-10-15 22:12:59 +02:00
Delyan Angelov
23644d92a9 vself: allow for ./v -o x self with no further renaming/deleting v itself (#6609) 2020-10-15 22:55:12 +03:00
Delyan Angelov
d261844da0 vweb: fix warnings about fn f(x, y Type) 2020-10-15 22:04:42 +03:00
Nick Treleaven
3c336b566d checker: add check_expected() which returns an optional error (#6623) 2020-10-15 17:30:36 +02:00
Alexander Medvednikov
0dfd51408e autofree: use scopes to avoid dups 2020-10-15 16:26:59 +02:00
Daniel Däschle
df82ef6bc7 base64: encode_url (#6622) 2020-10-15 16:04:06 +02:00
Delyan Angelov
31ef921ef2 ci: fix warnings/errors due to the vfmt change 2020-10-15 16:17:52 +03:00
Delyan Angelov
50a2b033b7 ci: fix failing tests on windows too 2020-10-15 15:54:44 +03:00
Delyan Angelov
5d4cce3e95 ci: fix failing tests 2020-10-15 15:42:16 +03:00
Alexander Medvednikov
8b13f3b53f fmt: fix tests 2020-10-15 12:45:34 +02:00
Alexander Medvednikov
3d4ab7de1e checker: update tests 2020-10-15 12:39:32 +02:00
Alexander Medvednikov
7da1afa140 all: switch to the new fn arg syntax everywhere; add lots of vfmt -verify tests 2020-10-15 12:32:28 +02:00
Alexander Medvednikov
982056894e fmt: use f(x int, y int) instead of f(x, y int) 2020-10-15 12:00:46 +02:00
Swastik Baranwal
314fae7446 checker: add more checks for hash_stmt (#6615) 2020-10-15 11:58:01 +03:00
Delyan Angelov
60296c8900 ci: run v -silent test-fmt as a new task in the code-formatting job 2020-10-15 11:45:09 +03:00
Delyan Angelov
44a42b7273 ci: fix parser.v formatting 2020-10-15 11:41:43 +03:00
Delyan Angelov
effa93d4b8 ci: add dedicated code-formatting job 2020-10-15 11:39:42 +03:00
Delyan Angelov
6326b6d58e parser: add helper method p.trace/2 2020-10-15 11:09:19 +03:00
JalonSolov
a4cc1ab7e3 all: cleanup more match statements (#6616) 2020-10-15 08:08:27 +03:00
Delyan Angelov
3795aaab5c v test-fmt: reformat some skipped files, comment on the remaining ones 2020-10-15 00:39:09 +03:00
Delyan Angelov
e36f11750b v test-fmt: use .skip_files instead of filtering 2020-10-14 23:58:31 +03:00
Delyan Angelov
5dd34c3a8a v test-fmt: skip os.v, linuxsys_bare.v, life.v for now 2020-10-14 23:49:12 +03:00
Delyan Angelov
5a11b87097 tests: do not panic on failed tests, just warn and exit(1). 2020-10-14 23:42:30 +03:00
Delyan Angelov
9e16576380 ci: turn on only the first part of binary_artifact.yml (building) 2020-10-14 23:09:40 +03:00
Delyan Angelov
067c8b39ba ci: comment the new binary_artifact.yml workflow 2020-10-14 23:04:43 +03:00
Delyan Angelov
46c5a2c8fc v test-fmt: fix some embedded comments in expressions 2020-10-14 22:52:33 +03:00
Delyan Angelov
c33a748344 vfmt: handle more comments in interface/struct init/match branches 2020-10-14 22:52:33 +03:00
Alexander Medvednikov
6ad5ecf569 table: add "please create a gh issue" to the "compiler bug" error 2020-10-14 21:09:10 +02:00
Leah Lundqvist
a45481baa3 actions: generate prebuilt binaries every commit (#6617) 2020-10-14 20:09:14 +02:00
Delyan Angelov
988221d87b ci: prioritize the v vet task, so unformatted code fails faster 2020-10-14 20:04:50 +03:00
Delyan Angelov
3c48a6e4ce tests: rename _test.v files with dup names (temp workaround for highly parallel testing) 2020-10-14 18:25:26 +03:00
Delyan Angelov
e02f25a108 test-compiler: fix sporadic fails for vpm/v install 2020-10-14 18:20:19 +03:00
Delyan Angelov
d1e52620c7 crypto.hmac: implement hmac.equal/2 too 2020-10-14 17:21:48 +03:00
Alexander Medvednikov
9355c60b4d cgen: fix for mut val and enable the test 2020-10-14 13:34:49 +02:00
Alexander Medvednikov
25947a7b23 autofree: handle args in optional returns 2020-10-14 13:23:58 +02:00
Alexander Medvednikov
ea09bd5e45 checker/fmt: for mut val fixes 2020-10-14 12:50:19 +02:00
Ekopalypse
ed7e306adc crypto: add hmac module (#6614) 2020-10-14 12:25:58 +02:00
Enzo
a2fba05218 fmt: allow fmt to be run on directories (#6613) 2020-10-13 21:03:53 +02:00
Delyan Angelov
ee0baf62ad vdoc: fix for v doc log 2020-10-13 18:11:57 +03:00
Alexander Medvednikov
194c2c926e doc: use the new table.type_to_str 2020-10-13 16:46:56 +02:00
Alexander Medvednikov
a07f31feae all: for mut val in vals { (part 1) 2020-10-13 16:27:30 +02:00
Delyan Angelov
d316f78f94 vfmt: remove the buggy f.type_to_str, use f.table.type_to_str from now on 2020-10-13 16:17:02 +03:00
Delyan Angelov
1123f4fcc9 vfmt: fix deep nested map types, using f.table.type_to_str 2020-10-13 16:08:25 +03:00
Nick Treleaven
78bcda14c4 checker: infer T from parameter of type []T (#6611) 2020-10-13 15:15:25 +03:00
Larpon
05ec32c331 examples: fix sokol/particles to start up faster (#6610) 2020-10-13 13:16:51 +03:00
Delyan Angelov
28dea17065 ci: prevent Periodic failure, ensure VSMTP_TEST_USER/VSMTP_TEST_PASS are set in smtp_test.v 2020-10-13 09:22:28 +03:00
JalonSolov
57d705e265 ast: minor code cleanup (#6608) 2020-10-12 23:11:51 +02:00
Enzo
da7d531f8f fmt: refactor type_to_str (#6607) 2020-10-12 18:41:42 +03:00
Enzo
93bb7564dc fmt: fix multiple problems with types (#6603) 2020-10-12 09:27:55 +03:00
Nick Treleaven
230e9868d1 doc: improve module imports and tweak module docs (#6591) 2020-10-11 20:36:41 +02:00
scurty-labs
5e86b40469 gg: update draw_circle/arc x, y to f32 (#6595) 2020-10-11 20:36:18 +02:00
Nick Treleaven
d76b55a9c6 doc: Improve string section (#6599) 2020-10-11 20:36:01 +02:00
Delyan Angelov
62f6e65509 repl: fix reset; make echo "print(2.0 * 3.14159)" | ./v print only the result 2020-10-11 10:50:24 +03:00
Delyan Angelov
c7e0a27e0d ci: fix v fmt test, by formatting cgen.v and atypes.v 2020-10-11 10:00:53 +03:00
Delyan Angelov
604b28b1c5 cgen: fix for type FdfFn = fn(...) (x,y) 2020-10-11 09:53:35 +03:00
Delyan Angelov
77c29c6b6f examples: add simple visual rendering of the samples in melody.v 2020-10-10 23:45:40 +03:00
Delyan Angelov
86816b1aad examples: add bytebeat melody using sokol.audio 2020-10-10 19:37:03 +03:00
Nick Treleaven
b677ad9ca5 checker: fix panic on match expression without results (#6597) 2020-10-10 15:42:40 +02:00
Enzo
6038264a4c gen: fix slicing mutable arguments (#6596) 2020-10-10 12:03:23 +02:00
Alexander Medvednikov
d8d80fbf42 gg: add a missing math import and vfmt 2020-10-10 10:37:17 +02:00
Alexander Medvednikov
1332bba7af autofree: wrap up optionals 2020-10-10 10:34:51 +02:00
scurty-labs
b2fdd7fbaf gg: add draw_circle and draw_arc (#6594) 2020-10-10 10:26:08 +02:00
Xavier B
d56072eb53 vweb: fix/remove todos from assets tests (#6593) 2020-10-10 00:54:46 +02:00
Delyan Angelov
e862fad917 parser: support mut static x := y in -translated mode 2020-10-09 22:24:21 +03:00
Justin Jones
04d3ca7dbe http: fix status codes (#6590) 2020-10-09 18:33:16 +03:00
Nick Treleaven
36706126fd checker - improve error for as casting on non-sum type (#6587) 2020-10-09 16:12:12 +02:00
Ned Palacios
fc375a40f8 x.json2: add fast_raw_decode; support for i64 and f32 (#6586) 2020-10-09 16:11:55 +02:00
Nick Treleaven
f734f8167b checker: improve error message for match branch type mismatch (#6588) 2020-10-09 16:11:11 +02:00
Anton Zavodchikov
a6f7f0ac8a vcreate: gitignore executable files (#6585) 2020-10-09 15:56:43 +02:00
Delyan Angelov
0edcd5efb0 repeat.v: support --max_time limit for the average time of a command 2020-10-09 11:08:59 +03:00
Alexander Medvednikov
6d1f85a04b roadmap: minor updates 2020-10-09 01:14:54 +02:00
Alexander Medvednikov
c463c26983 autofree: optionals fix 2020-10-09 01:13:31 +02:00
Nick Treleaven
92630a2821 checker: error if assigning to a function (#6581) 2020-10-09 00:48:39 +02:00
Alexander Medvednikov
7d65e4cb10 autofree: fix and test var declarations 2020-10-08 17:10:20 +02:00
Alexander Medvednikov
1123b8259a time: vfmt time/parse.v 2020-10-08 16:59:43 +02:00
Delyan Angelov
c3626bf2e6 vfmt: prepare for using .source_name in type_to_str 2020-10-08 14:26:12 +03:00
Swastik Baranwal
aea52af9ae checker: add is_mut check for disallowing taking address of map's key and array's element outside unsafe (#6573) 2020-10-08 09:37:18 +03:00
Alexander Medvednikov
393889afa2 readme: minor clarification 2020-10-07 18:18:39 +02:00
Delyan Angelov
efce448b23 parser: always treat MainLetter(x) as a cast, even when the type is not yet known 2020-10-07 15:50:54 +03:00
Delyan Angelov
d46d607334 backporting: remove C typedef redefinitions of map_int/map_string/array_byte/array_string 2020-10-07 11:32:50 +03:00
Delyan Angelov
317a9bae5f backporting: remove redefinition of strconv__Float64u 2020-10-07 11:06:52 +03:00
Delyan Angelov
3d0f4fd756 backporting: cleanup Makefile, use -std=gnu99 by default, honor CFLAGS and LDFLAGS (CentOS 6.9) 2020-10-07 07:05:59 +00:00
shnorbluk
b940dc4f8a cli: help displayed when a Command has no execute function (fix #6530) (#6567) 2020-10-07 05:39:13 +02:00
Delyan Angelov
ce302c29e4 builtin: support also [abc,def].sort(b>a) 2020-10-06 21:33:15 +03:00
Nick Treleaven
f7decfe399 checker: infer generic type T from matching fn call argument (#6298) 2020-10-06 15:34:02 +02:00
Delyan Angelov
580fefe63b ci: run the hello_world.v task first in the performance-regressions job 2020-10-06 16:15:31 +03:00
Delyan Angelov
8e5067421f vet: accumulate the collected errors manually (fixes CI) 2020-10-06 10:02:35 +03:00
Delyan Angelov
70826914a7 ci: fix mut_args_warning.vv error 2020-10-06 09:38:07 +03:00
Delyan Angelov
f943bf2aaf repeat.v: merge results from all series runs for the totals 2020-10-06 08:12:09 +03:00
Alexander Medvednikov
256a572cbe vet: fix vet_errors 2020-10-06 07:07:50 +02:00
Alexander Medvednikov
ed15b40529 parser: do not allow array references + explain why 2020-10-06 06:53:48 +02:00
Alexander Medvednikov
63c9b88e7f vet: remove unnecessary &[]string 2020-10-06 06:43:28 +02:00
Alexander Medvednikov
a51c445df8 ci: vfmt -verify more important files 2020-10-06 06:32:39 +02:00
Alexander Medvednikov
d2d3289a2a all: mark pref.Preferences field as immutable 2020-10-06 06:24:50 +02:00
Delyan Angelov
06a02c41c3 tests: reduce probability of locks during macos runs of live_test.v 2020-10-05 21:20:42 +03:00
Swastik Baranwal
d77669da80 test: add tests for disallowing map/array get element/key address (#6568) 2020-10-05 18:40:51 +03:00
kalapalo
4b410534dd cgen: add C fn memfreedup to cheaders.v (#6563) 2020-10-05 13:14:41 +02:00
Swastik Baranwal
5f07b255bd checker: disallow address of array and map index outside unsafe (#6557) 2020-10-05 13:08:30 +02:00
Ned Palacios
2b1a5d7a56 vdoc: move local scope-based doc generation to its own function (#6565) 2020-10-05 07:59:17 +02:00
Lukas Neubert
7a29240b00 thirdparty: update sokol (#6561) 2020-10-05 05:20:25 +02:00
Enzo
35a83464d0 gen: separate sumtype from classic match (#6547) 2020-10-04 19:50:23 +02:00
Ekopalypse
2622070f14 os: ensure that setenv creates the key on windows (#6560) 2020-10-04 19:43:28 +02:00
Delyan Angelov
0c174104fc checker: allow &=,|=,^=,%= on an integer number type aliases 2020-10-04 15:29:09 +03:00
Delyan Angelov
628b136e85 checker: allow casting from floats/enums to byte 2020-10-04 14:46:24 +03:00
Marcin
aa81ebb600 scanner: fix double quotes escape (#6474) 2020-10-04 10:34:04 +02:00
Tom Paoletti
9ea7369b05 fmt: allow formatting of v shell files (.vsh) (#6555) 2020-10-04 06:33:38 +02:00
Enzo
fd88bfbac8 fmt: fix formatting of anon args (#6545) 2020-10-04 06:32:47 +02:00
Leonardo Cecchi
51987e17df pg: make exec, q_int and q_strings return an optional (#6554) 2020-10-04 06:31:47 +02:00
Enzo
c84848c417 fmt: fix formatting enum with attributes (#6551) 2020-10-03 21:33:02 +03:00
vmcrash
c5e46c9e55 atoi.v: add common_parse_uint2 with error code return values (#6550) 2020-10-03 20:57:37 +03:00
Delyan Angelov
d93b0f047a vdoc: return platform specific prefixes from .vdocignore files 2020-10-03 17:40:28 +03:00
Henrixounez
c324169af0 all: remove intermediate handling for both global definition syntaxes (#6546) 2020-10-03 15:41:45 +02:00
Swastik Baranwal
7e13518cc2 parser: disallow match expr at certain places (#6490) 2020-10-03 16:30:58 +03:00
Henrixounez
a9da4dd437 parser: fix indentation to tabs (#6548) 2020-10-03 14:20:41 +02:00
Delyan Angelov
5aea0d024f docs: add bitwise not (~) to the list of int operators 2020-10-03 15:07:56 +03:00
Nicolas Sauzede
a6071da33b makefile: abstract V exe extension for better coherence (#6544) 2020-10-03 12:17:33 +02:00
Delyan Angelov
de77f0ba0f vfmt: make vlib/v/table/table.v vfmt-able 2020-10-03 12:57:21 +03:00
Enzo
677b0ba2d2 gen: access fields in multi-type sumtype match (#6541) 2020-10-03 11:19:43 +02:00
Delyan Angelov
7b034a54e3 vfmt: make vlib/v/table/atypes.v vfmt-able 2020-10-03 11:48:12 +03:00
Henrixounez
c9574ae7d7 syntax: new global variable declaration syntax (#6540) 2020-10-03 07:03:44 +02:00
Leonardo Cecchi
8ac0bd44bd pg: avoid leaking a PGconn on connection errors (#6543) 2020-10-03 07:03:11 +02:00
Swastik Baranwal
c8a884f57f checker: fix typos in chan (#6539) 2020-10-03 06:59:30 +02:00
kalapalo
eefe067c27 cgen: fix as cast when sumtype is the result of a function call (#6537) 2020-10-03 05:04:15 +02:00
Delyan Angelov
259f6ea42c repeat.v: add --output option 2020-10-02 18:10:30 +03:00
Nicolas Sauzede
8d2f22affe tetris: display lines (#6533) 2020-10-02 16:42:05 +03:00
Nicolas Sauzede
a0aedfbe5c tetris: display next tetro (#6532) 2020-10-02 16:37:00 +03:00
Daniel Däschle
2204bad7cf gen: removes space on struct printing (#6535) 2020-10-02 13:06:02 +02:00
Delyan Angelov
c53ebd89b1 repeat.v: implement a --series option 2020-10-02 13:28:05 +03:00
Delyan Angelov
032a3e6b3a ci: add new performance-regressions job, using cmd/tools/repeat 2020-10-02 12:39:39 +03:00
Delyan Angelov
70c87137a9 live_test.v: wait 5 times more on macos 2020-10-02 11:38:49 +03:00
Delyan Angelov
c747ba1c3f repeat.v: add --fail_percent option 2020-10-02 10:58:05 +03:00
Nick Treleaven
7c86b03505 checker: don't error if last statement in match branch produces a value (#6523) 2020-10-02 09:33:04 +02:00
Daniel Däschle
8e8e808fc9 gen: fix sumtype custom str (#6534) 2020-10-02 09:32:07 +02:00
Nicolas Sauzede
1ddf46f3c6 tetris: add ghost piece (#6531) 2020-10-02 09:30:15 +02:00
Lukas Neubert
94cf8ef1d8 examples: update v_script.vsh (#6515) 2020-10-02 05:18:08 +02:00
Ekopalypse
1a7ac5e382 builtin: VectoredExceptionHandler cast on x86 (#6525) 2020-10-02 05:17:33 +02:00
Nicolas Sauzede
c825275f7f pref: fix whitespace in compiler message (#6529) 2020-10-02 05:16:16 +02:00
Henrixounez
8152b86652 checker: detect correct len expression for multidimensional array init (#6521) 2020-10-02 03:12:33 +02:00
igrekus
417b1450b5 doc: fix phrasing and whitespace (#6520) 2020-10-01 23:41:17 +03:00
Nick Treleaven
7e720a1253 pref: do not check arguments after 'run' command (#6524) 2020-10-01 23:30:39 +03:00
Henrixounez
a57e01fee7 parser: dont allow single letter enums (#6526) 2020-10-01 23:29:49 +03:00
spaceface777
f55f2fb9d1 gen: optimize str == '' to str.len == 0 for performance (#6527) 2020-10-01 23:28:44 +03:00
Delyan Angelov
d595e03928 cmd/tools/repeat.v: cleanup formatting 2020-10-01 23:25:29 +03:00
Delyan Angelov
d96f1bf26d cmd/tools/repeat.v: add and fill a new map[string][]int field CmdResult.oms 2020-10-01 21:06:32 +03:00
Delyan Angelov
9dc75f5cd9 cmd/tools/repeat.v: cleanup 2020-10-01 20:46:45 +03:00
Delyan Angelov
0402179603 cmd/tools/repeat.v: add a --warmup option too 2020-10-01 20:35:56 +03:00
Delyan Angelov
04cd585183 cmd/tools/repeat.v: add a MVP of a command repeater/summarizer, simillar to hyperfine. 2020-10-01 20:05:27 +03:00
Delyan Angelov
ac384db71f builder: cleanup .timing_message/2 2020-10-01 18:21:34 +03:00
Delyan Angelov
a0e4be04be compiler: print more suggestions, without a good specific match 2020-10-01 17:27:31 +03:00
No Name Pro
d9aa6919d8 gitattributes: let github treat all Dockerfile.* files just like Dockerfile (#6522) 2020-10-01 17:22:08 +03:00
Henrixounez
0f1ed1ca09 scanner: add an error for unfinished string literals (#6519) 2020-10-01 16:40:59 +03:00
Delyan Angelov
11b16a63cf checker: add a suggestion for misspelled struct field name errors 2020-10-01 15:36:47 +03:00
Alexander Medvednikov
f534edc371 doc: replace os.base_dir with os.dir 2020-10-01 01:30:22 +02:00
Alexander Medvednikov
4879661f5a os: remove base_dir(); dir() and base() fixes 2020-10-01 01:25:52 +02:00
Enzo
324d547cdb parser: allow multiple types in match branch (#6505) 2020-10-01 01:07:36 +02:00
Nick Treleaven
18be7b115a checker: disallow most statements in if/match expression branches (#6509) 2020-09-30 16:06:22 +02:00
Lukas Neubert
3a8be4d8d9 os: home_dir() remove trailing slash (#6512) 2020-09-30 16:02:54 +02:00
Lukas Neubert
76e373a5f4 v help: fix newline (#6510) 2020-09-30 15:57:22 +03:00
Andrei Kurhan
763ddf78f3 doc: fix Interfaces example (#6499) 2020-09-30 07:42:23 +02:00
Larpon
4cd5153b32 android: enable autofree (#6503) 2020-09-30 07:40:05 +02:00
Alexander Medvednikov
ae7689f739 autofree: simplify, clean up, and fix complex arg exprs 2020-09-30 07:27:24 +02:00
Daniel Däschle
c38a050125 cgen: fix array and map printing (#6508) 2020-09-30 01:26:27 +02:00
Delyan Angelov
96102613f3 doc: improve testing section 2020-09-29 23:48:56 +03:00
Delyan Angelov
dc954bbb03 all: use macos consistently in os.user_os and the compiler 2020-09-29 22:32:20 +03:00
JalonSolov
2fd6c05445 fonts: fix so it does not try for RobotoMonoMono.ttf (#6507) 2020-09-29 13:20:37 +03:00
Alexander Medvednikov
defa9c1d00 cmd: update flags help 2020-09-29 03:28:41 +02:00
Ned Palacios
1aec041371 json: fix encode/decode support for generic structs (#6489) 2020-09-29 03:15:00 +02:00
Nick Treleaven
05dcdfd267 pref: error if unknown argument passed to v (#6487) 2020-09-29 03:13:54 +02:00
Nick Treleaven
9f33b33803 parser: warn about ambiguous infix/prefix op token (#6491) 2020-09-29 03:13:10 +02:00
Alexander Medvednikov
9e31335744 pref: remove obsolete flags 2020-09-29 02:54:05 +02:00
Denis
6981f2afeb help: print errors to stderr (#6486) 2020-09-28 06:14:34 +02:00
Larpon
0e2f267805 examples: add support for transparency / opacity / alpha in particle example (#6488) 2020-09-28 06:14:15 +02:00
Daniel Däschle
06cade6c31 all: change .ReturnType and .Type to .return_type and .typ (#6494) 2020-09-28 06:13:38 +02:00
Delyan Angelov
71e1ca72ec examples/2048: run v -w fmt 2048.v 2020-09-27 22:47:26 +03:00
Delyan Angelov
f9ce7f3542 vfmt: fix formatting for [4][4]int static arrays 2020-09-27 22:46:33 +03:00
Delyan Angelov
cbd7c7d8c6 tests: support VTEST_ONLY in vlib/v/fmt/fmt_keep_test.v too 2020-09-27 22:01:46 +03:00
Delyan Angelov
cfdf66c129 ci: run vfmt over checker.v 2020-09-27 17:08:28 +03:00
Delyan Angelov
7305b2c401 ci: fix for mut arg in cmd/tools/vdoc.v 2020-09-27 16:58:36 +03:00
Delyan Angelov
220f3cc2b9 bare: update Signo enumeration 2020-09-27 16:48:25 +03:00
Delyan Angelov
a6d525eb92 ci: fix is not a variable and cannot be locked failing tests 2020-09-27 16:32:46 +03:00
Emily Hudson
3a869c726b builtin: fix definition of VectoredExceptionHandler (#6495) 2020-09-27 15:56:30 +03:00
Delyan Angelov
03258db26d ci: other mut vlib test fixes 2020-09-27 11:18:55 +03:00
Delyan Angelov
aa889b0edc ci: fix vlib/x/websocket tests 2020-09-27 11:10:56 +03:00
Delyan Angelov
7c6695317c Revert "ci: fix building v from vc"
This reverts commit b3f503e0ce.
2020-09-27 10:36:26 +03:00
Delyan Angelov
b3f503e0ce ci: fix building v from vc 2020-09-27 10:34:11 +03:00
Alexander Medvednikov
c5dc792c5d fmt: args => params 2020-09-27 03:46:15 +02:00
Alexander Medvednikov
3d5292b63f tcp/udp: fix mutability 2020-09-27 03:40:59 +02:00
Alexander Medvednikov
fca344d1fb all: fn args => params 2020-09-27 03:32:56 +02:00
Alexander Medvednikov
e2c7126d11 checker: verify mutability of method args 2020-09-27 03:14:24 +02:00
Delyan Angelov
914c1a527d doc: add `json.decode([]Foo, sfoos)? example 2020-09-26 12:34:26 +03:00
Delyan Angelov
1fb127ba79 tests: sort the test session file paths before running the tests 2020-09-26 10:11:45 +03:00
spaceface777
faca9e2f06 examples/2048: new end screens with alpha, better touch support (#6482) 2020-09-26 09:54:04 +03:00
Delyan Angelov
af37c7ac6b gg: prevent messages about missing font variants without -d debug_font 2020-09-26 09:36:46 +03:00
Daniel Däschle
d782de5b00 gen: struct str fixes (#6483) 2020-09-25 23:12:33 +02:00
Delyan Angelov
b999d01de7 runtime: use GetCurrentProcessorNumber for runtime.nr_cpus() 2020-09-25 22:02:29 +03:00
Nick Treleaven
acbfc11eef doc: tweak Modules section (#6480) 2020-09-25 20:34:58 +02:00
Nick Treleaven
fbae0a7274 checker: warn if fn looks like a test fn but filename doesn't end in _test.v (#6469) 2020-09-25 19:26:11 +03:00
Nick Treleaven
ffee3791e8 doc: improve Testing section (#6479) 2020-09-25 19:25:14 +03:00
spaceface777
d79bb0db24 doctor: small features and tweaks (#6481) 2020-09-25 19:24:00 +03:00
spaceface777
b44620d065 time: use linux high-precision timers on Android as well (#6476) 2020-09-25 18:02:02 +03:00
spaceface777
aa1d5fcbdd flag: fix panic if flag value was not provided (#6478) 2020-09-25 16:31:35 +03:00
spaceface777
ae48b709ed gg: don't call os.is_file() on Android (the font is part of the APK there) (#6475) 2020-09-25 13:06:20 +03:00
Daniel Däschle
abc98c273c parser: require assign on type alias (#6477) 2020-09-25 12:02:32 +02:00
Lukas Neubert
2ea94d621f gg: fix loading variants of many fonts in new_ft() (#6468) 2020-09-25 11:52:57 +02:00
Nick Treleaven
bf8592fe93 doc: tweak Testing section (#6465) 2020-09-25 11:51:39 +02:00
spaceface777
0b95d72354 checker: comp. if branch logic fix (#6473) 2020-09-25 12:48:27 +03:00
Daniel Däschle
90d1a689db gen: fix str gen for pointers in structs (#6462) 2020-09-24 21:14:16 +02:00
Daniel Däschle
e384dea8ac checker: add error for amp on literals (#6467) 2020-09-24 21:13:46 +02:00
Alexander Medvednikov
47a62b12d4 autofree: advanced expr test 2020-09-24 19:22:16 +02:00
Alexander Medvednikov
403cd0d915 Revert "gen: scape string function in gen/str.v (#6452)"
This reverts commit 60fbcc37fc.
2020-09-24 18:19:18 +02:00
Marcin
60fbcc37fc gen: scape string function in gen/str.v (#6452) 2020-09-24 18:18:10 +02:00
Nick Treleaven
be2ac0ba89 fmt: fix writing ConcatExpr (#6466) 2020-09-24 18:04:39 +02:00
Delyan Angelov
dbce01792c gg: try 3 different fonts in system_font_path on MacOS 2020-09-24 17:09:08 +03:00
Delyan Angelov
1f21bc4b49 gg: bugfix on missing font file, remove last empty line in v doctor 2020-09-24 16:53:06 +03:00
Delyan Angelov
d91594dc6b doctor: use just a.println('') instead of a horizontal divider 2020-09-24 16:36:15 +03:00
Delyan Angelov
48d8711b80 doctor: limit horizontal divider to just 20 dashes, to avoid wraps 2020-09-24 16:34:05 +03:00
Nick Treleaven
3925c3fa20 parser: disallow index variable with range for (#6464) 2020-09-24 15:52:44 +03:00
Marcin
fb45e2e046 flag: fix panic on single - 2020-09-24 15:50:44 +03:00
Uwe Krüger
72ecc222ee fmt: support select expressions (#6460) 2020-09-23 22:22:39 +02:00
Daniel Däschle
4f09ddccb4 cgen: implement sum type str gen (#6454) 2020-09-23 20:51:51 +02:00
Henrixounez
b0a2c28c19 vdoc: rendering optimizations (#6457) 2020-09-23 20:50:51 +02:00
Alexander Medvednikov
0cdeaaff6b examples: make 2048 compile 2020-09-23 20:50:03 +02:00
Nick Treleaven
2886b1c67d checker: require binary operands for &&, || (#6449) 2020-09-23 20:48:25 +02:00
Delyan Angelov
99e607d3ac examples/2048: limit the simulation depth in auto mode to 8 2020-09-23 09:26:22 +03:00
Uwe Krüger
9c0758639b cgen: fix for match {...} { and for select {...} { (#6441) 2020-09-23 06:05:12 +02:00
Robin Martijn
4774c89381 vpm: install and check all modules as lowercase modules. (#6445) 2020-09-22 17:02:42 +02:00
spaceface777
d44eabe247 doctor: detect if running in a VM / WSL / chroot (#6447) 2020-09-22 17:41:32 +03:00
Delyan Angelov
46be0710ac examples/2048: add a simple Monte Carlo player on a 2020-09-22 17:32:35 +03:00
Alexander Medvednikov
624f22e27e all: mutability check (part 1); enable mutable sumtype args 2020-09-22 05:28:29 +02:00
Delyan Angelov
1ee0939f69 doctor: ignore # comments in /etc/os-release files too 2020-09-21 22:42:41 +03:00
Delyan Angelov
fe8cf19a8f doctor: protect against malformed /etc/os-release files on linux 2020-09-21 22:38:58 +03:00
Delyan Angelov
f66dcbe6e5 doctor: report tcc location/branch/commit too 2020-09-21 21:46:51 +03:00
Delyan Angelov
61330c60b5 doctor: support arm64 phones 2020-09-21 21:21:07 +03:00
Delyan Angelov
a9ef7d173f doctor: suggest v doctor in issue templates and C builder errors 2020-09-21 18:29:52 +03:00
Ned Palacios
744f685973 vdoc: document variables in a specific pos/scope; support v doc os File (#6354) 2020-09-21 17:40:39 +03:00
Delyan Angelov
8c0b8c5ef7 doctor: detect more Linux distro names, using /etc/os-release first 2020-09-21 17:36:36 +03:00
Swastik Baranwal
077b597bd8 scanner/parser: change error msgs for \0 and \x00 and add error for rbyte and cbyte (#6436) 2020-09-21 17:34:24 +03:00
Sanath Kumar U
f159163856 docs: update the module import example (#6439) 2020-09-21 17:31:11 +03:00
Uwe Krüger
0f1c484ad1 parser/checker: if select { ... } { (#6434) 2020-09-21 07:34:04 +02:00
Alexander Medvednikov
27f91faae5 gg: remove an old compielr hack that's no longer needed 2020-09-21 02:51:14 +02:00
Alexander Medvednikov
8c8fe02000 gg: mouse_move, mouse_down 2020-09-21 02:42:53 +02:00
Leonardo Cecchi
21c5ff681b pg: add binding for PQfinish (close) (#6435) 2020-09-21 01:47:37 +02:00
Henrixounez
e429a77de2 gen: named imported structs operator overloading and str methods (#6433) 2020-09-20 19:51:14 +02:00
Alexander Medvednikov
6bf1865678 examples: add a link to the 2048 WA demo 2020-09-20 19:31:16 +02:00
Henrixounez
5086fd537c checker: prompt error on implicit int overflow by literal (#6410) 2020-09-20 16:29:01 +02:00
Marcin
34884c1631 os: fix binary mode read/write on windows (#6431) 2020-09-20 16:28:45 +02:00
Uwe Krüger
3454677eb9 doc: update channel documentation (#6432) 2020-09-20 16:20:56 +02:00
Delyan Angelov
d7fee91655 doctor: detect more linux distro names 2020-09-20 15:28:34 +03:00
Delyan Angelov
fc1956573e doctor: try lsb_release on linux if it exists, fallback to os.uname if not 2020-09-20 15:10:35 +03:00
Delyan Angelov
b39b195043 doctor: fix cpu/os info on windows 2020-09-20 14:49:27 +03:00
Delyan Angelov
6e5d507b95 doctor: retrieve more OS details on mac/linx/windows 2020-09-20 14:37:51 +03:00
Delyan Angelov
79ac431e9e doctor: add first draft 2020-09-20 13:13:20 +03:00
Delyan Angelov
d4fbf422b3 gg: support transparency for rect/triangle/etc primitives too 2020-09-20 12:05:30 +03:00
Uwe Krüger
4ae88c69ac sync/select: allow push of literals and calculated expressions (#6429) 2020-09-20 03:50:09 +02:00
Alexander Medvednikov
c781a5f245 gg: draw_triangle(); draw_image_flipped() 2020-09-20 03:47:32 +02:00
spaceface777
44deb43252 symlink: remove broken defer (#6428) 2020-09-19 22:26:32 +02:00
Nick Treleaven
9958881cbe parser: support parsing unsafe (as first token) as UnsafeExpr (#6032) 2020-09-19 19:18:36 +03:00
Swastik Baranwal
1c886ad067 scanner: add check for !is_raw for null \0 (#6427) 2020-09-19 19:09:18 +03:00
Henrixounez
4b0e7fc979 checker: check if imported struct is public (#6425) 2020-09-19 18:16:43 +03:00
Henrixounez
4121ba9ea9 parser: fix error about multiple modules showing when eof (#6423) 2020-09-19 02:15:47 +02:00
Uwe Krüger
31a52cdf21 cgen: implement channel select block code generation (#6424) 2020-09-19 02:14:35 +02:00
Lukas Neubert
5782f562ae doc: update condif section (#6418) 2020-09-18 23:48:59 +02:00
Enzo
3126ae305c checker: verify use of blank identifier (#6412) 2020-09-18 23:47:50 +02:00
Delyan Angelov
bc28801993 ci: fix failing ubuntu-musl job 2020-09-18 21:32:05 +03:00
Delyan Angelov
78e6ddee75 tests: enable running v test . inside vlib/v/ too 2020-09-18 19:20:01 +03:00
Delyan Angelov
b4535acbac examples: move the particle module in modules/particle
The goal is enabling running `v build-examples` from outside vroot.
The modules/ folders are already skipped when building examples.
2020-09-18 19:06:04 +03:00
Delyan Angelov
a97716de33 test: do not strip vroot/ from test report 2020-09-18 18:35:38 +03:00
Daniel Däschle
1b9711edde gen: fix C warnings by cleaning up skip_struct_init (#6416)
* gen: removes struct name from list which shouldn't be initialized

* gen: vfmt

* cgen: remove the skip_struct_init list

* Revert "cgen: remove the skip_struct_init list"

This reverts commit d9e1fdbb4c.

* fix ci

* vfmt vlib/v/gen/cgen.v

Co-authored-by: Delyan Angelov <delian66@gmail.com>
2020-09-18 16:36:40 +03:00
Henrixounez
46dc6cc24b repl: fix ctrl+z job to background on linux (#6417) 2020-09-18 16:34:00 +03:00
Delyan Angelov
d2badcdedf vlib: fix more C warns on windows 2020-09-18 13:40:47 +03:00
Henrixounez
c1f04d8c72 builtin: fix min value for int_str (#6411) 2020-09-18 12:56:16 +03:00
Daniel Däschle
ffc8cf3925 gen: c don't generate x >= 0 check for unsigned ints in range exprs in matches (#6414) 2020-09-18 12:53:19 +03:00
Daniel Däschle
f7aa9cb0c5 vlib: fix C warning for UNICODE macro redefinition on windows (#6415) 2020-09-18 12:51:55 +03:00
igrekus
4dda06f9bb doc: fix typos (#6405) 2020-09-18 01:15:25 +02:00
Henrixounez
c02a0f90df checker: prompt error on script expression while inside a file with main (#6400) 2020-09-18 01:14:14 +02:00
Henrixounez
4038ac463c gen: bytes array print not ending prematurely when null byte (#6401) 2020-09-18 01:12:32 +02:00
Nick Treleaven
14743458e5 checker: tweak error messages for or block; use proper type names (#6377) 2020-09-18 01:09:00 +02:00
Daniel Däschle
f59b771c76 parser: fix nested amp (#6402) 2020-09-18 01:04:56 +02:00
Nick Treleaven
69c592e0d6 checker: disallow infix op on an optional type (#6406) 2020-09-18 01:03:55 +02:00
Henrixounez
99574e465d scanner: allow escape on null character (#6404) 2020-09-18 01:02:06 +02:00
Enzo
a1e127ae46 checker: check type in is InfixExpr (#6407) 2020-09-18 01:01:05 +02:00
spaceface777
ff92c3409d ast: merge IfExpr and CompIf (#6011) 2020-09-18 00:58:54 +02:00
Seven Du
98e6d25b42 vweb: make ip() to return peer_ip work (#6399) 2020-09-17 10:38:39 +03:00
Ruofan XU
11f10fdce2 examples: minor optimization of calculator (#6367) 2020-09-17 02:14:26 +03:00
Aqil Contractor
a984f9cf97 vup: add quotes for the people with weird V paths (#6393) 2020-09-17 02:00:56 +03:00
Delyan Angelov
6f7bb30b0a tests: fix strconv.v_sprintf arrity mismatch in format_test.v 2020-09-17 00:33:25 +03:00
Delyan Angelov
80b150d3ad strconv.v_sprintf: add runtime checks&panics on arrity mismatches 2020-09-17 00:24:33 +03:00
Delyan Angelov
bb20586a5e docs: update type redeclaration example 2020-09-16 23:21:27 +03:00
Lukas Neubert
2464deec82 cli: improvements to help and error messages (#6375) 2020-09-16 22:01:44 +02:00
Henrixounez
608df40058 checker: fix error declaration on a value (#6390) 2020-09-16 22:01:15 +02:00
Delyan Angelov
e2e683199d time: do not panic on time.new_time({unix: 1608854400}).str() 2020-09-16 22:14:02 +03:00
spaceface777
96b7cce810 doc: simplify string mutability section (#6369) 2020-09-16 17:40:52 +03:00
Daniel Däschle
c960b5979e vlib: fix incompatible pointer warning (#6385) 2020-09-16 17:40:02 +03:00
Uwe Krüger
1bc9063573 parser: implement parsing of select block (#6379) 2020-09-16 15:34:57 +02:00
Daniel Däschle
3a795e6d9b gen: fixes C warnings by appending U after unsigned integer literals (#6384) 2020-09-16 15:50:41 +03:00
Delyan Angelov
5da698b4bf tests: add support for skipping tests in vlib/v/compiler_errors_test.v too 2020-09-15 19:56:52 +03:00
Lukas Neubert
8b25c29323 vpm outdated: add support for mercurial (#6376) 2020-09-15 19:35:00 +03:00
igrekus
4b1e330219 doc: fix typo (#6370) 2020-09-15 15:50:35 +02:00
Swastik Baranwal
01b28ef1a5 doc: string immutability example 2020-09-14 16:18:10 +02:00
Alexander Medvednikov
f7a77f4041 doc: document snake_case/PascalCase requirement 2020-09-14 16:06:32 +02:00
Nick Treleaven
b552c29bef os: add fn read_bytes_into with buffer argument (#6365) 2020-09-14 15:34:34 +02:00
Lukas Neubert
5c8e1c7eeb help: remove note about v2 backend (#6364) 2020-09-14 15:33:58 +02:00
Delyan Angelov
a9bd6acd52 builtin: fix new_dense_array (avoid the &string(int(...)) bug generating (int*) ) 2020-09-14 16:26:25 +03:00
Delyan Angelov
bbf4983524 autofree: add option_reassigned.v and option_simple.v tests. 2020-09-14 13:04:24 +03:00
Alexander Medvednikov
bffa100aa6 autofree: optional fix 2020-09-13 21:36:33 +02:00
Delyan Angelov
2bd4355a4c os: add check for path.len == 0 in vfopen 2020-09-13 18:08:58 +03:00
Delyan Angelov
8c71ba8912 os: add more error checking for os.read_bytes and os.read_file 2020-09-13 18:03:19 +03:00
Alexander Medvednikov
68948c7947 checker: vfmt checker.v 2020-09-13 16:21:40 +02:00
Tomas Hellström
a160038e1a ci: re-enable autobahn tests (without autofree) (#6360) 2020-09-13 16:20:22 +02:00
Tomas Hellström
a99986041f ci: temporary remove autobahn (#6359) 2020-09-13 15:48:09 +02:00
Vasilis Katsifolis
43942057a4 checker: fix a type check that caused a C error #6238 (#6358) 2020-09-13 15:19:53 +02:00
Uwe Krüger
168daebccf sync/channels: fix bug that caused 100% CPU on block (#6357) 2020-09-13 15:13:06 +02:00
Alexander Medvednikov
fc88f43e50 autofree: make optional methods work 2020-09-13 03:20:34 +02:00
Alexander Medvednikov
f337980e52 autofree: move tmp var generation to a separate method 2020-09-13 03:18:13 +02:00
Alexander Medvednikov
3b589115f0 ci: yaml? 2020-09-13 03:13:23 +02:00
Alexander Medvednikov
9149d8ecb5 autofree: a small simplification 2020-09-13 03:12:09 +02:00
Alexander Medvednikov
f074d766e5 ci: disable gitly autofree build for now 2020-09-13 03:06:16 +02:00
Alexander Medvednikov
db51ee08ea autofree: more fixes in optionals 2020-09-13 03:00:45 +02:00
Yağızcan Değirmenci
e77c4c182d sqlite: fix indentation in readme (#6356) 2020-09-12 16:42:35 +02:00
Alexander Medvednikov
b74c1805d7 cgen/autofree: fix and simplify optionals 2020-09-12 16:40:52 +02:00
Maciej Obarski
f162e61748 doc: reserved keywords update based on token.v (#6050) 2020-09-12 14:10:27 +03:00
Delyan Angelov
37311883c1 tests: add optional_method_err.vv 2020-09-12 13:12:06 +03:00
Delyan Angelov
0801f88d0a tests: cleanup vlib/v/checker/tests/run ; add unused_variable_warning.vv 2020-09-12 12:33:17 +03:00
Ruofan XU
e8909cced0 examples: add regex_with_memoization.v (#6355) 2020-09-12 09:51:30 +03:00
Major Taylor
99a46c8657 2048: fixed movement bug and show score at end (#6353) 2020-09-12 09:25:44 +03:00
Delyan Angelov
60ecb7e4b6 os: change f.write and f.writeln to return options too 2020-09-12 08:39:28 +03:00
Oghogho Odemwingie
332f3a924c builtin: consume matched string length in string.replace_each (#6349) 2020-09-12 02:31:06 +02:00
Uwe Krüger
b10d79c4d9 sync/channels: fixes for try_push/pop(), optimizations (#6352) 2020-09-12 02:29:11 +02:00
Sandro Martini
07b5d6b1b6 vweb: add mime type for json static content (#6347) 2020-09-11 23:14:44 +03:00
Delyan Angelov
96c22a26b9 tests: cleanup if_smartcast_test.v 2020-09-11 22:00:13 +03:00
Delyan Angelov
40ed2e1b3d builtin: use C.write for print/eprint . Call C.SetConsoleOutputCP(C.CP_UTF8) on windows 2020-09-11 16:20:35 +03:00
Delyan Angelov
d46c1f0f20 tests: fix sporadic waitgroup failure on slow windows VMs in anon_fn_test.v 2020-09-11 16:00:24 +03:00
Daniel Däschle
ce62f997f3 all: better type error positions (#6345) 2020-09-11 14:37:14 +02:00
Alexander Medvednikov
62a692b29c checker: make the "unnecessary default" error a warning for now 2020-09-11 13:59:28 +02:00
Alexander Medvednikov
53bed596e7 autofree: do not free _ vars 2020-09-11 13:58:12 +02:00
Alexander Medvednikov
e0d20eadff autofree: free strings on re-assignments 2020-09-11 13:55:20 +02:00
spaceface777
4aaeaa4331 examples/2048: some updates and improvements (#6343) 2020-09-11 13:19:38 +03:00
Alexander Medvednikov
17882db635 autofree: disable ?string test for now 2020-09-10 22:19:18 +02:00
Delyan Angelov
ce6d2759f5 os: add os.open_stdin/0 and os.File.get_line/0 2020-09-10 16:57:03 +03:00
Alexander Medvednikov
67cc515e74 autofree: ?string test 2020-09-10 13:41:30 +02:00
Alexander Medvednikov
03327e5161 time: minor fixes + vfmt 2020-09-10 13:26:01 +02:00
Ned Palacios
368c2a6bf0 vlib: add x/json2 (#6336) 2020-09-10 12:05:40 +02:00
Alexander Medvednikov
bc8aab4775 checker: fix := test 2020-09-09 17:59:51 +02:00
Alexander Medvednikov
3956ea4665 Revert "checker: fix := test"
This reverts commit 818220de45.
2020-09-09 17:55:48 +02:00
Alexander Medvednikov
818220de45 checker: fix := test 2020-09-09 17:50:14 +02:00
Alexander Medvednikov
5d484bf022 checker: better error message for incorrect mut x := 2020-09-09 17:27:16 +02:00
Daniel Däschle
3a146a6dbe checker: fix error pos on default value (#6338) 2020-09-09 15:34:41 +02:00
Alexander Medvednikov
78e28a72ed doc: vfmt and make compile 2020-09-09 14:24:42 +02:00
Alexander Medvednikov
cb43084e26 regex: fix compilation 2020-09-09 14:18:06 +02:00
Alexander Medvednikov
ea31f75098 checker: more default field fixes 2020-09-09 14:14:44 +02:00
Alexander Medvednikov
925f1781b3 checker: default field fixes 2020-09-09 14:05:56 +02:00
Alexander Medvednikov
e018509ba6 checker: test for unnecessary default struct field values 2020-09-09 13:59:52 +02:00
Nick Treleaven
eb95a4333a table: rename Arg to Param (#6337) 2020-09-09 13:21:11 +02:00
Swastik Baranwal
ea2b2ebc07 checker: modify error messages for ptrs (#6325) 2020-09-09 10:07:58 +02:00
bpryer
3f7970db52 term: add get_cursor_position and set_terminal_title (#6279)
* added functions

added:
  - get_cursor_position()
  - set_terminal_title(title string)

* implement term.get_cursor_position and term.set_terminal_title on unix

* Cleanup

* make x,y fields of term.Coord mutable

* fix vrepl compilation

* use more descriptive var names in term_test.v

* do not change the current terminal title in dumb terminals; do not test term.set_terminal_title outside of CI

* unix: in term.set_terminal_title, return true even for dumb terminals

Co-authored-by: Brent Pryer <brent@pryermachine.com>
Co-authored-by: Delyan Angelov <delian66@gmail.com>
2020-09-08 22:00:10 +03:00
Nick Treleaven
49c322f120 checker: simplify argument qualifier errors (#6321) 2020-09-08 19:34:17 +02:00
Ruofan XU
90128ed4ee cc: add support for tcc backend on windows-i386 (#6297) 2020-09-08 15:15:35 +02:00
Larpon
1c5b9db63f io: introduce a go-like io.util module (#6323) 2020-09-08 14:17:01 +02:00
Cezary Drożak
26971da510 v up: correct an error message (#6327) 2020-09-08 00:41:47 +02:00
Enzo
18034bb95c gen: fix multiple call of expression in match (#6324) 2020-09-08 00:38:24 +02:00
Uwe Krüger
5258f52497 fmt: add support for chan types and operations (#6328) 2020-09-08 00:36:05 +02:00
Maciej Obarski
9a5b86e454 arrays: common methods - min, max, idx_min, idx_max, shuffle, merge (#6177) 2020-09-07 13:50:53 +02:00
Yahyaa Masood
5c656899e5 doc: add a missing period (#6199) 2020-09-07 13:50:12 +02:00
Nick Treleaven
497bf226e2 add TESTS.md file to explain different tests (#6318) 2020-09-07 13:48:15 +02:00
Uwe Krüger
2cb711ee15 checker/channels: check mut/& state of transmitted objects (#6315) 2020-09-06 21:24:41 +02:00
Enzo
601d098b48 szip: make compile (#6314) 2020-09-06 15:04:27 +02:00
Larpon
51d7d7cfae os: fix os.mv edge case and Windows style paths (#6302) 2020-09-06 13:12:07 +02:00
Alexander Medvednikov
9fbea31f47 autofree: fix exprs N levels deep 2020-09-06 13:02:32 +02:00
Uwe Krüger
047bf02985 builtin: fix in for various numeric types (#6311) 2020-09-06 12:45:02 +02:00
Larpon
b4b898b769 os: enable is_file tests (#6312) 2020-09-06 12:39:02 +02:00
Uwe Krüger
4d2c8a40d6 sync/atomic2: support 32 bit platforms (#6308) 2020-09-05 14:44:16 +02:00
Alexander Medvednikov
3410705974 autofree: lots of fixes 2020-09-05 12:00:35 +02:00
Uwe Krüger
b015033c53 builtin: add methods to builtin channels (#6303) 2020-09-05 01:36:20 +02:00
Pavel Kolesnikov
246fe3bfb7 builder: cc_linux_cross() fixes (#6287) 2020-09-05 01:35:35 +02:00
Xavier B
8ef55bd8c9 checker: add checks for map key/value types (#6283) 2020-09-04 23:59:54 +02:00
Larpon
81778e507f os: is_file() (#6301) 2020-09-04 22:27:52 +02:00
Larpon
efa49bfbb7 os: make behave more like Unix "mv" command (#6300) 2020-09-04 13:08:47 +02:00
Alexander Medvednikov
333f355e23 Revert "cgen: handle variables called "array""
This reverts commit cc714ca5cc.
2020-09-03 02:43:26 +02:00
Uwe Krüger
b8617ace53 checker: do not allow aliases of chan types (#6294) 2020-09-03 02:03:31 +02:00
Alexander Medvednikov
cc714ca5cc cgen: handle variables called "array" 2020-09-03 02:01:21 +02:00
Pavel Kolesnikov
a3ee217537 builder: use tar instead of unzip in cc_linux_cross() (#6286) 2020-09-02 10:09:06 +02:00
spaceface777
35cbca96e1 checker: implement [required] struct field attribute (#6276) 2020-08-31 23:15:40 +02:00
spaceface777
bd304f1141 checker: check number of fields in short struct inits (#6280) 2020-08-31 22:17:59 +02:00
spaceface777
60a9d49382 cgen: implement [export: 'FooBar'] attribute (#6278) 2020-08-31 21:52:25 +02:00
Sandro Martini
39da5eca89 vweb: hide debug prints 2020-08-31 19:39:46 +02:00
Uwe Krüger
cbcba2e4cf parser: enable module auto import (of sync) (#6271) 2020-08-31 10:44:39 +02:00
florin
b1a8e1e5b2 vweb: escape form key, not only value. (#6269) 2020-08-30 19:09:12 +02:00
Delyan Angelov
ea31c2a643 examples: fix graph for hdpi screens 2020-08-30 19:58:15 +03:00
Xavier B
d33f68ff54 x.websocket: remove debuging leftover (#6264) 2020-08-30 19:35:47 +03:00
pancake
a1dcc3bb9f examples: make the graph example resizable, use cooler lines (#6267) 2020-08-30 19:11:59 +03:00
Nick Treleaven
5d3d14da53 cgen: support typeof(expr).name (#6253) 2020-08-30 08:56:18 +02:00
Lukas Neubert
95ce9f33a9 doc: fix a typo (#6257) 2020-08-30 08:55:53 +02:00
Uwe Krüger
c351f8fa47 checker, builtin: prepage for builtin channels (#6262) 2020-08-30 08:55:31 +02:00
Alexander Medvednikov
d88e8bb9ea doc: document comma in match 2020-08-29 11:03:16 +02:00
Delyan Angelov
2b545f6b90 examples: fix compilation of the graph.v example 2020-08-29 10:14:25 +03:00
Delyan Angelov
93294d4a97 stbi: fix compilation with tcc 2020-08-29 10:13:25 +03:00
Delyan Angelov
718a4692dd os: enable test_write_and_read_bytes again 2020-08-29 07:43:31 +03:00
Uwe Krüger
fe8286c53c checker: implement implicit conversions/promotions to rune (#6249) 2020-08-29 01:59:07 +02:00
Maciej Obarski
7bd2804ce9 all: automatic error propagation in place of "or { return(err) }" 2020-08-29 01:58:03 +02:00
Uwe Krüger
4d425b0e6d fmt: insert space in front of ? for propagation (#6250) 2020-08-29 01:56:43 +02:00
ITotalJustice
1bf7e1596b vbin2v: always lowercase generated const names 2020-08-28 23:45:49 +03:00
Delyan Angelov
30fc374fc5 os.args: fix os.args[0] when compiling graphical apps on windows 2020-08-28 22:39:52 +03:00
Delyan Angelov
02bece54a6 vup: use git pull https://github.com/vlang/v master for updating 2020-08-28 21:49:12 +03:00
Nick Treleaven
7dbae14e19 checker: error on mut name = (#6247) 2020-08-28 20:07:32 +03:00
Delyan Angelov
5d18ece661 ci: fix msvc finding (3) 2020-08-28 20:06:41 +03:00
Delyan Angelov
68864d0703 ci: fix msvc finding (2) 2020-08-28 19:58:17 +03:00
Delyan Angelov
317d15dbe9 ci: fix finding the msvc compiler on windows 2020-08-28 19:48:18 +03:00
Delyan Angelov
3d8a35ced6 ci: fix compiler error tests on windows 2020-08-28 19:27:41 +03:00
Delyan Angelov
dde1b89c5e vup: remove empty new line on unix 2020-08-28 19:09:47 +03:00
Maciej Obarski
2ce5797ec2 os: vfopen returns option now (#6244) 2020-08-28 14:24:00 +02:00
Alexander Medvednikov
789674bd5a tests: autofree: use -experimental flag 2020-08-28 10:22:28 +02:00
Alexander Medvednikov
0890562663 tests: autofree tmp expr test 2020-08-28 10:08:32 +02:00
Swastik Baranwal
39bf02ea68 checker: add error for arr1 <,>,>=,<= arr2 (#6243) 2020-08-28 11:08:07 +03:00
Delyan Angelov
88f75fc1d6 builder: cleanup cc.v; log build_thirdparty_obj_files with -v 2020-08-28 09:38:52 +03:00
spaceface777
d663f57d43 parser: move flag logic to checker (#6239) 2020-08-28 09:24:04 +03:00
Delyan Angelov
5526954fdc vdoc: cleanup warnings on ./v doc -s vlib 2020-08-28 09:03:22 +03:00
Delyan Angelov
d80843bf53 vdoc: parse with enable_globals: true 2020-08-28 08:53:12 +03:00
Delyan Angelov
0975f3bd4c vfmt: support x chan Name in fn args 2020-08-28 01:54:16 +03:00
Delyan Angelov
8f5ca29fcd vfmt: support x := chan Name{cap: 123} 2020-08-27 23:37:39 +03:00
Allie
1d39116a6e examples: fix a typo in the cli example (#6237) 2020-08-27 23:15:49 +03:00
Alexander Medvednikov
27702b5a5d fast: update V with v up instead of git pull 2020-08-27 18:07:28 +02:00
Alexander Medvednikov
a14c6c1ffe autofree: another tmp arg fix 2020-08-27 17:54:36 +02:00
Larpon
d982aa54e8 os: add missing documentation (#6234) 2020-08-27 16:57:01 +02:00
Steve Phillips
b4f03e1c32 roadmap: allow interface definitions to include fields (#6230) 2020-08-27 15:12:24 +02:00
spaceface777
eff319f869 comp_for: allow checking full mehod and arg types (#5997) 2020-08-27 15:00:44 +02:00
Delyan Angelov
7476428def vfmt: handle comments after last const field 2020-08-27 15:07:49 +03:00
Delyan Angelov
f5c245ceb8 ci: fix v build-examples too 2020-08-27 14:35:26 +03:00
Delyan Angelov
8f5cefb116 strconv: fix f64_to_str_lnd and f64_to_str_l after 6921d46 2020-08-27 14:22:04 +03:00
Alexander Medvednikov
c01d17fcc4 tests: fix array_test.v 2020-08-27 13:12:04 +02:00
Alexander Medvednikov
15bdb8f7cd autofree: tmp arg var frees fixes 2020-08-27 11:30:35 +02:00
Delyan Angelov
3b03edd7cb repl: fix compilation after 6921d46 2020-08-27 12:20:31 +03:00
Delyan Angelov
8b3990225a v.checker: run vfmt over vlib/v/checker/checker.v 2020-08-27 12:09:08 +03:00
Delyan Angelov
f73506be49 tests: fix some byte->rune errors 2020-08-27 12:08:05 +03:00
Stunx
fa3e95222e doc: ignore sokol.sapp (#6228) 2020-08-27 08:35:04 +02:00
Xavier B
3e9dc578de checker: disallow interfaces inside sum types (#6232) 2020-08-27 08:33:59 +02:00
Alexander Medvednikov
8dcc73993e net: remove old websocket module 2020-08-27 07:33:59 +02:00
Alexander Medvednikov
6921d46185 all: rune type for `` literals 2020-08-27 06:46:37 +02:00
Delyan Angelov
99dd72efea tests: add another test for 47f59d3 2020-08-26 11:46:29 +03:00
Delyan Angelov
47f59d3fb6 v.scanner: fix error line numbers when comments end with CRLF 2020-08-26 11:39:32 +03:00
Alexander Medvednikov
84b8e0a7e4 tests: enable live tests on macos 2020-08-26 06:50:32 +02:00
Uwe Krüger
393b46a6dd channels: make ch.len and ch.cap available as properties (#6221) 2020-08-26 06:41:51 +02:00
Delyan Angelov
7879510ef5 live: fix hot code reloading on macos (use .dylib, not .so) 2020-08-25 21:40:45 +03:00
Delyan Angelov
9b0ef781dc vup: add more diagnostic lines for v -v up 2020-08-25 19:54:27 +03:00
Delyan Angelov
b9e408c499 vup: use '$app.vexe self' 2020-08-25 19:42:10 +03:00
Alexander Medvednikov
a55bea44da table: register rune type 2020-08-25 18:15:24 +02:00
JalonSolov
45505a8423 vup: do v self then make.bat on Windows (#6219) 2020-08-25 19:12:53 +03:00
Delyan Angelov
cc82ed28f8 tests: enable running fmt_vlib_test.v on != freebsd platforms again 2020-08-25 19:09:47 +03:00
Delyan Angelov
e3f79df3ac tests: support .vv in compiler_test.v too 2020-08-25 18:52:28 +03:00
Delyan Angelov
55fdae77d5 tests: add .vv support for v vet too, and simplify vet_test.v 2020-08-25 18:46:33 +03:00
Delyan Angelov
86dfd3902f tests: use .vv files directly in compiler_errors_test.v 2020-08-25 18:14:06 +03:00
Delyan Angelov
f259d275fc tests: bump simple_tcp_client retries to 20 2020-08-25 17:52:44 +03:00
Delyan Angelov
7b7ab580ab tests: add retry logic in simple_tcp_client in vweb_test.v 2020-08-25 17:05:40 +03:00
Delyan Angelov
1619beda91 tests: fix repl_test.v 2020-08-25 15:59:07 +03:00
Delyan Angelov
ceca1547fb valgrind: fix valgrind_test.v 2020-08-25 15:48:11 +03:00
Alexander Medvednikov
c8b3cd2957 tests: simplify valgrind tests, remove .vv 2020-08-25 13:58:21 +02:00
Alexander Medvednikov
33b4ff75d0 builder: handle bad extensions and support .vv 2020-08-25 13:32:27 +02:00
Nick Treleaven
818db91a9e parser: warn if PostfixExpr followed by ] or ) token (#6214) 2020-08-25 08:50:06 +02:00
Nick Treleaven
479bfa28de cgen: implement fixed array .len property (#6212) 2020-08-25 08:48:28 +02:00
Nick Treleaven
8e4ee54070 glm: fix pointer indexing warnings (#6215) 2020-08-25 08:48:05 +02:00
Delyan Angelov
995a5fed1f v.builder: add -DNDEBUG for non debug -prod builds (affects sokol performance) 2020-08-24 23:10:22 +03:00
Delyan Angelov
3efa670d6a sokol: add new mouse_dx and mouse_dy fields (fix for Android multitouch) 2020-08-24 23:01:14 +03:00
Xavier B
32a894719e x.openssl: remove printlns (#6205) 2020-08-24 17:20:03 +02:00
Nick Treleaven
acc5c95f0d checker: error with *expr if not a pointer (#6211) 2020-08-24 17:19:17 +02:00
spaceface777
60eedc2fc3 make.bat: quote paths when cloning tcc (#6209) 2020-08-24 13:00:30 +02:00
Alexander Medvednikov
35aeb308c6 doc: exit(), panic() 2020-08-24 11:45:40 +02:00
Alexander Medvednikov
55e75d57ae docs: smart casts 2020-08-24 11:14:35 +02:00
Alexander Medvednikov
d547f74cb0 checker/cgen: interface smart casts 2020-08-24 11:10:26 +02:00
Delyan Angelov
912bc8bca1 2048: fix crash, when compiled with gcc > 6 and -prod 2020-08-24 11:12:52 +03:00
Delyan Angelov
b609836f79 ci: run VJOBS=1 ./v test-fixed on the macos job, to better diagnose a sporadic V panic 2020-08-24 10:20:11 +03:00
Delyan Angelov
990da2ee6d ci: install libasound2-dev on ubuntu jobs too 2020-08-24 10:11:09 +03:00
Maciej Obarski
e8e0d9fa42 all: [direct_array_access] tag (#6203) 2020-08-24 09:04:50 +02:00
Delyan Angelov
6a0cb3e552 ci: install libxi-dev and libxcursor-dev on ubuntu 2020-08-24 09:58:03 +03:00
Alexander Medvednikov
702a80fc5a x.net: fix new_tcp_socket() 2020-08-24 03:24:00 +02:00
Delyan Angelov
fa8f5df817 sokol: fix compilation of 2048 on some linux distros (undefined XIQueryVersion and XcursorImageCreate) 2020-08-23 22:17:05 +03:00
Delyan Angelov
2e589a5b0b sokol.audio: add proper #flag for windows (-lole32) 2020-08-23 21:15:59 +03:00
Delyan Angelov
e71aff71ce sokol.audio: fix compilation on macos (link with -framework AudioToolbox) 2020-08-23 20:55:01 +03:00
Delyan Angelov
dad2c6608e examples: implement examples/sokol/sounds/wav_player.v 2020-08-23 20:49:37 +03:00
Charadon
bb60b4227e examples: vfmt calculator.v 2020-08-23 16:18:37 +02:00
Delyan Angelov
1c9e02094c sokol.audio: add simple_sin_tones.v example 2020-08-23 15:28:07 +03:00
Alexander Medvednikov
542b149290 sokol: fix examples and remove copy pasta 2020-08-23 07:47:50 +02:00
Alexander Medvednikov
94c3a912ba gg: update sokol and stb_truetype 2020-08-23 07:25:30 +02:00
Alexander Medvednikov
da452c9c7e thirdparty: update stb_image.h 2020-08-23 05:03:40 +02:00
Alexander Medvednikov
5407d9b062 gg: fix draw_line on hi dpi screens 2020-08-23 04:57:12 +02:00
Tomas Hellström
c5eec881c1 ci: remove openssl install on windows builds 2020-08-23 02:12:54 +02:00
Swastik Baranwal
b2e79dbebd parser: add an error for import mod.sub as mod and import mod as mod (#6194) 2020-08-23 02:12:25 +02:00
Uwe Krüger
61df70fdf5 all: enable x = <-ch or {...} (#6195) 2020-08-23 02:12:05 +02:00
Alexander Medvednikov
7dfae2384b builtin: remove asl.h include 2020-08-22 17:22:14 +02:00
Alexander Medvednikov
9e12095111 gg: image: return an optional instead of panic(); darwin: fix nsstring() 2020-08-22 17:09:30 +02:00
Delyan Angelov
0bdb096bfa x.net: use port 45123 in tcp_test.v, preventing sporadic socket error 98 conflicts with websocket_test.v 2020-08-22 15:29:29 +03:00
Delyan Angelov
94ced907d2 sort: fix C compilation error for fn abc(mut a []int) { a.sort() } 2020-08-22 15:20:49 +03:00
Yarila682
7dde82322a cgen: fix dereferencing a mutable array (#6191) 2020-08-22 12:48:09 +02:00
Daniel Däschle
fcc61a981d all: TypeSymbol.source_name (#6187) 2020-08-22 12:29:15 +02:00
Delyan Angelov
b5ca114a96 ui: fix compiling the calculator ui example with tcc 2020-08-22 12:58:48 +03:00
Tomas Hellström
e9e2a586ce x.websocket: autobahn test (#6190) 2020-08-22 06:51:08 +02:00
Nick Treleaven
98c39a37c0 scanner: warn about interpolation for $f(expr) (#6179) 2020-08-22 05:48:06 +02:00
Alexander Medvednikov
f320be690c x.websocket: skip tests on windows and musl for now 2020-08-22 00:52:45 +02:00
Alexander Medvednikov
793d2ce6dc stbi: more clear panic message 2020-08-22 00:51:16 +02:00
Tomas Hellström
fb148e0b61 x.websockets: new websockets module on top of x.net (#6189) 2020-08-22 00:50:38 +02:00
Nick Treleaven
1b914d217e fmt: don't remove mut from if mut smart cast (#6188) 2020-08-22 00:00:02 +02:00
Delyan Angelov
06967d9297 sort: require a mutable receiver 2020-08-21 21:19:37 +03:00
Lukas Neubert
93e6c3df6a cli: various improvements (#6180) 2020-08-20 23:14:53 +02:00
Emily Hudson
b88569c845 x.net: new net module (#6130) 2020-08-20 23:01:37 +02:00
Delyan Angelov
9b171b76e0 os: call os.real_path/1 before returning in os.find_abs_path_of_executable/1 2020-08-20 19:23:19 +03:00
Daniel Däschle
0c183da116 checker: fix sort return type (#6182) 2020-08-20 17:29:40 +03:00
Delyan Angelov
e8ff94fb8b net.html: simplify map setting (fixes compilation with tcc on aarch64) 2020-08-20 16:45:54 +03:00
Delyan Angelov
dfc4298125 tests: return early in x64_test.v on non AMD64 machines 2020-08-20 15:42:26 +03:00
Delyan Angelov
8c7bcad6b1 cgen: support for $if amd64 {} and $if aarch64 {} 2020-08-20 15:28:37 +03:00
Lukas Neubert
6eea13ecc2 clipboard: wrap pointer indexing in unsafe block (#6178) 2020-08-20 10:33:12 +02:00
Lukas Neubert
d8d707b4fe doc: $else (#6174) 2020-08-20 08:33:08 +02:00
Alexander Medvednikov
b1c042b3ea ci: test v self compilation 4 times with tcc 2020-08-20 08:32:05 +02:00
Alexander Medvednikov
9da7349f63 gg: minor fixes 2020-08-20 08:32:05 +02:00
Lukas Neubert
eabc2daf86 v.mod: remove commas; add example for v.vmod (#6169) 2020-08-19 16:07:10 +02:00
Lukas Neubert
88bca9d17a clipboard: wrap vstring call in unsafe (#6170) 2020-08-19 16:06:23 +02:00
Lukas Neubert
e6e1011e47 examples: cli: more readable and informative program output (#6168) 2020-08-19 14:38:45 +02:00
Nick Treleaven
217f04e311 checker: disallow casting to bool, use some_int != 0 instead (#6138) 2020-08-19 14:37:55 +02:00
Alexander Medvednikov
55b025413d fmt: temporary struct attr fix 2020-08-19 14:33:45 +02:00
Larpon
d9aae023b1 android: initial support for C output using sokol_main (#6164) 2020-08-19 11:00:15 +02:00
spaceface777
c1651bd271 gg: fixes and Android support (#6161) 2020-08-19 07:10:42 +02:00
jhuntos
c42ca84850 pg: fix array init warnings (#6163) 2020-08-19 07:10:09 +02:00
Nick Treleaven
e69f091bbd parser: require ( on same line as name token for fn call or cast (#6160) 2020-08-19 02:37:17 +02:00
Alexander Medvednikov
51bd69cdd8 cgen: fix u64 in struct str() 2020-08-18 16:05:11 +02:00
Delyan Angelov
7727aad90f net.http: fix windows compilation warning 2020-08-18 12:14:21 +03:00
Delyan Angelov
2f6757a56a Revert "cgen: fix all -Wmissing-variable-declarations (#5802)"
This reverts commit ae349ca6ba.

Fixing these warnings, unfortunately also means, that hot code
(which reloads a shared library during runtime) can not use V
constants, because the private static C variables in the shared
library will not be initialized by _vinit(), which is only called
by the main V program.

For example in examples/hot_reload/bounce.v, using `gx.blue`,
defined as:
`    blue   = Color { r:   0, g:   0, b: 255 }`
... will instead use a const with all 0 fields (i.e. a black color).
2020-08-18 11:55:55 +03:00
Delyan Angelov
937a3e14c5 cgen: add g.options_typedefs, g.shared_types, g.channel_definitions 2020-08-18 11:45:36 +03:00
Delyan Angelov
ed156838e6 examples: add 2048 game 2020-08-18 09:29:43 +03:00
pancake
b5b53a5311 vpm: add 'vpm upgrade' to update all the outdated vpm modules (#6157) 2020-08-18 02:44:18 +02:00
Alexander Medvednikov
fe5575f384 fast: checkout each commit 2020-08-18 01:11:58 +02:00
Alexander Medvednikov
40d91cc23b gg: handle bad image index 2020-08-18 01:08:58 +02:00
joe-conigliaro
c599a4c7de checker: remove pos+1 on innermost call 2020-08-18 07:39:40 +10:00
Uwe Krüger
0d7cc8829a cgen: implement channel push()/pop() using <- operator (#6154) 2020-08-17 23:35:36 +02:00
JalonSolov
5c98c0760b gg: use OpenGL on Windows until D3D issues resolved (#6155) 2020-08-17 23:34:51 +02:00
Daniel Däschle
b5c1ea44dc all: fix mutability after if-smartcast (#6129) 2020-08-17 21:11:11 +02:00
Nick Treleaven
36c98b3e5d cgen: implement fixed array 'for in' for lvalue condition (#6151) 2020-08-17 21:10:47 +02:00
Swastik Baranwal
46b4e2a0cd checker: checkmatch types (#6149) 2020-08-17 20:19:21 +02:00
Sandro Martini
dab639662f http: fix new warnings (#6153) 2020-08-17 20:17:17 +02:00
Irabaruta Freeman
fa11e124dd term: add documentation (#6097) 2020-08-17 20:16:18 +02:00
Uwe Krüger
9a5f040f72 all: handle <- arrow token for channel operations (#6152) 2020-08-17 20:12:00 +02:00
joe-conigliaro
c01fd4ac58 parser: remove extra scopes from if & match & fix scope end_pos 2020-08-18 01:51:25 +10:00
Nick Treleaven
6ba6a22a77 checker: prevent from casting non-struct to struct (#6143) 2020-08-17 11:19:44 +02:00
Uwe Krüger
0c7d73c8b0 sync/channels: use references for chan mut X testcase (#6145) 2020-08-16 23:01:49 +02:00
H3RSKO
2aedece23d readme: typo (#6144) 2020-08-16 22:45:03 +02:00
Alexander Medvednikov
b2059c481a checker: fix an incorrect name test 2020-08-16 19:24:00 +02:00
Alexander Medvednikov
f965ddae49 parser: handle several errors in types; cgen: objC includes 2020-08-16 19:16:59 +02:00
Delyan Angelov
191c908f3a tests/valgrind: vfmt fn_with_return_should_free_local_vars.vv 2020-08-16 13:22:32 +03:00
Delyan Angelov
fbe02c5ae1 tests/valgrind: add skipped fn_with_return_should_free_local_vars.vv (-autofree) 2020-08-16 13:20:02 +03:00
Delyan Angelov
fc7a108366 v.builder: fix quoting when building thirdparty source files 2020-08-16 10:18:14 +03:00
Yarila682
29528196f2 os: close opened file descriptors in cp() (#6142) 2020-08-16 04:55:10 +02:00
Nick Treleaven
bab5c21224 parser: warn when fixed-size ArrayInit doesn't have trailing {}. (#6137) 2020-08-16 04:54:05 +02:00
Enzo
a02593204f checker: forbid aliasing an alias (#6118) 2020-08-16 04:53:16 +02:00
Vinicius Rangel
bf065674cc json: maps, memory leak, and error forwarding (#6116) 2020-08-16 02:30:37 +02:00
Delyan Angelov
e7b2aefd36 v.pref: handle | as separators in -path option parsing again (as documented in the help) 2020-08-15 22:09:40 +03:00
Uwe Krüger
c2b4c645a1 sync/channels: document more benchmark results (#6135) 2020-08-15 11:20:51 +02:00
Nick Treleaven
0f0a91fc9e parser: support custom fixed size ArrayInit: [3]int{init: -1} (#6114) 2020-08-15 11:01:54 +02:00
spaceface777
5f3ced7213 builder: only include os when building .vsh files (#6134) 2020-08-14 21:57:32 +02:00
Uwe Krüger
9602a25a0b all: add builtin channel type chan elem_type (#6126) 2020-08-14 21:18:42 +02:00
Nick Treleaven
75212f9fab cgen: error if ForInStmt is not handled (#6131) 2020-08-14 21:01:43 +02:00
Daniel Däschle
b2fee21ef3 checker: check struct casting (#5864) 2020-08-14 14:57:08 +02:00
Nick Treleaven
6016f28171 cgen: fix assigning ArrayInit to fixed array: a = [3]int (#6115) 2020-08-14 13:57:00 +02:00
Nick Treleaven
078ab47a9a cgen: support ==, != on FixedArray (#6119) 2020-08-14 02:03:38 +02:00
Delyan Angelov
2ad2b4c5ba vweb: add more tests. Fix missing Content-Length: header bug on 404. 2020-08-14 02:49:15 +03:00
Delyan Angelov
3640bd2fda tests: skip vweb_test.v on ubuntu-musl and on windows 2020-08-14 01:11:12 +03:00
Delyan Angelov
712f4bd7f8 vweb: add tests 2020-08-14 00:52:02 +03:00
Alexander Medvednikov
fc1f41fc84 checker: fix a string error test 2020-08-13 23:33:18 +02:00
Alexander Medvednikov
88cde776e7 checker: more clear string error 2020-08-13 23:21:15 +02:00
Delyan Angelov
8580a0bcd7 cgen: run vfmt to silence ./v fmt -verify 2020-08-13 21:22:52 +03:00
Delyan Angelov
a62307f711 vweb: fix body appending (missing closing json bracket) 2020-08-13 21:07:31 +03:00
Daniel Däschle
64e8125807 cgen: fixe calling anon fn asynchronously (closes #6088) (#6121) 2020-08-13 20:06:56 +02:00
Daniel Däschle
34b28cb68a fmt: fix anon fn call (#6120) 2020-08-13 20:05:59 +02:00
Delyan Angelov
1135dffe2d cgen: prevent generation of duplicate interface method wrappers 2020-08-13 20:56:58 +03:00
spaceface777
2353814821 vweb: fix body size calculation (#6122) 2020-08-13 20:55:33 +03:00
Delyan Angelov
da7adb5b1b ci: fix failing tests for compiler_errors_test.v 2020-08-13 13:16:41 +03:00
Delyan Angelov
fd5a76a8ad ci: fail compiler_errors_test.v, when at least one of all the parser/checker tests failed 2020-08-13 12:57:16 +03:00
Delyan Angelov
1a96bcf405 ci: fix v vet filtering 2020-08-12 20:34:13 +03:00
Alexander Medvednikov
9478ff472f doc: sorting arrays 2020-08-12 19:14:13 +02:00
Alexander Medvednikov
3b5d56278f vet: skip tests 2020-08-12 18:56:06 +02:00
Alexander Medvednikov
f8be2110ec sort: fix sorting by struct fields 2020-08-12 18:43:41 +02:00
Alexander Medvednikov
e5e31f7210 sort: handle .sort(a.field > b.field) 2020-08-12 06:11:40 +02:00
Alexander Medvednikov
4bc0dde413 all: new .sort(a < b) syntax 2020-08-12 05:54:51 +02:00
Alexander Medvednikov
9800cf1e7b checker: improve array errors; gg: remove unused imports 2020-08-12 03:54:17 +02:00
Uwe Krüger
bb93bf34ec sync/semaphores: use dispatch semaphores on MacOS (#6110) 2020-08-12 03:45:09 +02:00
Delyan Angelov
ca7a64a451 cgen: add support for -g again 2020-08-12 02:05:45 +03:00
Nick Treleaven
6a8a589adb doc: Compile-time reflection section with *new features* (#5962) 2020-08-11 17:57:39 +02:00
Uwe Krüger
433610b5c0 sync/channels: provide .cap and .len() (#6104) 2020-08-11 17:52:13 +02:00
Alexander Medvednikov
bc3b411b12 ci: run v vet on ubuntu-tcc 2020-08-11 17:45:17 +02:00
Swastik Baranwal
9fdb1701e0 checker: add a check for str[i] = a (#6107) 2020-08-11 17:41:54 +02:00
Alexander Medvednikov
99798b83b4 parser: fix match/else check 2020-08-11 17:30:37 +02:00
Alexander Medvednikov
c5aa2bfa51 tests: fix a match test 2020-08-11 16:26:52 +02:00
tarunama
12d66208b8 readme: minor clean up (#6055) 2020-08-11 01:07:17 +02:00
Alexander Medvednikov
1a9dba0005 checker: make << shifts work with custom number types 2020-08-11 01:05:34 +02:00
Alexander Medvednikov
2dd82748e0 checker: simplify << error message 2020-08-11 01:01:33 +02:00
Alexander Medvednikov
6d72209363 checker: minor c2v fixes 2020-08-11 00:51:15 +02:00
Alexander Medvednikov
11113e43e7 checker: a minor perf fix 2020-08-10 23:59:42 +02:00
Nick Treleaven
d8d82a0be4 checker: make has_return fn more efficient (#6103) 2020-08-10 23:59:08 +02:00
Alexander Medvednikov
88988817d0 parser: minor match simplification 2020-08-10 19:54:38 +02:00
Uwe Krüger
c3cdfa1c96 sync/channels: provide `try_push(), try_pop() as public methods (#6101) 2020-08-10 18:06:42 +02:00
Delyan Angelov
36eae1c175 builtin: x.vstring() instead of string(x) (#6102) 2020-08-10 18:05:26 +02:00
Delyan Angelov
eba413853f compiler_errors_test.v: use work.close() instead of sentinel tasks 2020-08-10 15:26:54 +03:00
Nick Treleaven
5e2824e2f2 vfmt: align field attributes (when no inline comment after type) (#6089) 2020-08-10 13:13:42 +03:00
Delyan Angelov
bd32f0969f parser: enable CamelCase named method names for JS. objects 2020-08-10 10:39:14 +03:00
Uwe Krüger
20a65cf9c8 sync/channels: implement close() method (#6098) 2020-08-10 06:22:20 +02:00
Nick Treleaven
fce106cf83 parser: use Attr.arg field for [name: arg] (#6084) 2020-08-10 02:00:14 +02:00
Sandro Martini
c7fae4dd6f vweb: add set_status() (#6087) 2020-08-09 18:05:06 +02:00
Nick Treleaven
2dd90de993 parser: error on [unsafe_fn] (#6090) 2020-08-09 12:22:11 +03:00
Alexander Medvednikov
200f8dacb7 []byte.str2() => bytestr() 2020-08-09 04:22:42 +02:00
Alexander Medvednikov
94f4dfe85b builtin: a temporary []byte.str2() (until runes are implemented) 2020-08-09 04:20:43 +02:00
João Victor Oliveira Couto
f6a85d5305 net.html: create html parser module (#6076) 2020-08-09 04:13:34 +02:00
Louis Schmieder
97fec78b40 io: input/output streams (#6078) 2020-08-09 04:12:29 +02:00
Maciej Obarski
4e8fe9b1a8 doc: variadic function example (#6093) 2020-08-09 04:12:08 +02:00
Alexander Medvednikov
64f218e943 string: fix all cap .title() test 2020-08-09 04:09:48 +02:00
Alexander Medvednikov
c65dbe51d6 parser: c2v fixes 2020-08-09 03:58:14 +02:00
Allie
0692164333 github: add a hint to the issue template (#6086) 2020-08-08 16:24:35 +02:00
Nick Treleaven
6cc8815931 parser: support [unsafe] instead of [unsafe_fn] (#6066) 2020-08-08 16:24:05 +02:00
Maciej Obarski
2a4ef2acbd regex: new options returning interface to the regex module (#6062) 2020-08-08 09:04:12 +03:00
Lukas Neubert
664c26ab4b v update: add verbose output (#6080) 2020-08-07 17:33:13 +02:00
Delyan Angelov
55b8cc1bb2 tests: parallelize compiler_errors_test.v using channels & threads 2020-08-07 16:44:49 +03:00
Delyan Angelov
34d03801de tests: run ws_test.v only with -d network 2020-08-07 10:14:40 +03:00
Alexander Medvednikov
ce4ee2b247 v0.1.29 2020-08-06 19:36:52 +02:00
Delyan Angelov
4568ce8f00 builtin: add sanity check on the number of returned frames by C.backtrace 2020-08-06 19:50:29 +03:00
Alexander Medvednikov
3a461e7cee vfmt: update help 2020-08-06 18:09:14 +02:00
Uwe Krüger
d63daa0798 sync: use mfence on windows-tcc (#6079) 2020-08-06 17:31:05 +02:00
Alexander Medvednikov
ea76a33b43 remove freetype references everywhere 2020-08-06 17:23:57 +02:00
Uwe Krüger
863cf8af60 sync: channel implementation (#6074) 2020-08-06 15:28:19 +02:00
Larpon
09f1362305 os: let temp_dir adhere to posix/fhs version 3.0 on linux and mac (#6069) 2020-08-05 19:02:57 +02:00
Delyan Angelov
b22711ef33 examples/gg/rectangles.v: add missing logo.png picture 2020-08-05 19:56:01 +03:00
Delyan Angelov
d1257f5590 tests/valgrind: add skipped fn_returning_string_param.vv (-autofree) 2020-08-05 19:35:18 +03:00
Delyan Angelov
6c27ce58ed v.util.vtest: extract the common code for VTEST_ONLY in a single place 2020-08-05 19:34:27 +03:00
Maciej Michalec
1152bbd243 repl: fix recognizing anonymous functions defs as function calls (fix #5006) (#6070) 2020-08-05 16:18:28 +02:00
Alexander Medvednikov
ecaccafd31 gg: image cache 2020-08-05 16:00:24 +02:00
Alexander Medvednikov
67aafd03c6 gg: fix image rendering 2020-08-05 14:34:28 +02:00
spaceface777
bf20d6d3db builder: don't panic if msvc rootdir isn't found (#6068) 2020-08-05 13:22:10 +03:00
Delyan Angelov
f331f63f53 ci: fix windows build 2020-08-05 09:09:18 +03:00
Delyan Angelov
5874d7c5ab os: add os.getpid(), use it in os.is_writable_folder on windows 2020-08-05 09:04:40 +03:00
Delyan Angelov
7b1944c2da gg: simplify the image_cache 2020-08-05 08:46:20 +03:00
Delyan Angelov
221a777a80 gg: cache sokol C.sg_image handles 2020-08-05 08:09:25 +03:00
Delyan Angelov
ab7936f514 os.exec: on unix return error, when the command was not found, instead of os.Result 2020-08-05 07:11:51 +03:00
Wertzui123
c261408f54 examples: remove unused import (#6063) 2020-08-05 05:11:58 +02:00
Maciej Michalec
449c98e861 scanner: floats without fraction (fix #5262) (#6064) 2020-08-05 05:11:29 +02:00
Alexander Medvednikov
f3ebd3a6e7 gg: fix image rendering 2020-08-05 03:15:40 +02:00
Maciej Obarski
8d9f38f670 doc: 2d array example (#6058) 2020-08-05 01:46:04 +02:00
Alexander Medvednikov
df332f85b7 vpm: remove vpm.best 2020-08-04 22:10:29 +02:00
Enzo
f238890fe9 compiler: move attributes to declarations (#6026) 2020-08-04 20:10:22 +02:00
Nick Treleaven
3ce6dd6cbc hash: use match expression with ranges (#6046) 2020-08-04 20:09:58 +02:00
Delyan Angelov
3dfe242dbb vfmt: add a regression test for `type SocketMessageFn = fn (mut c Client, msg &Message) ? 2020-08-04 16:13:04 +03:00
Delyan Angelov
cd9bb51af2 vfmt: fix 6040 (part 2) 2020-08-04 16:08:47 +03:00
Delyan Angelov
f9d241ae27 gg,stbi: implement gg.create_image_from_memory/2 2020-08-04 13:18:08 +03:00
Delyan Angelov
216b6bf285 gg: remove tracing println in draw_image 2020-08-04 12:57:54 +03:00
Delyan Angelov
9ce75e10d5 gg: free gg.create_image from having to be called by sokols init_fn callback 2020-08-04 12:37:28 +03:00
Swastik Baranwal
f3817c47f9 token: remove switch keyword (#6056) 2020-08-04 11:04:07 +02:00
Delyan Angelov
f7a0d0a02f ci: fix -autofree compilation of vlib/v/tests/valgrind/strings_and_arrays.vv 2020-08-04 11:30:02 +03:00
Delyan Angelov
9511d086bd oldv: use green color for tracing/diagnostic lines 2020-08-04 11:22:37 +03:00
Alexander Medvednikov
60c642f42d gg: clean up draw_image() 2020-08-04 01:26:56 +02:00
Alexander Medvednikov
7a7572e478 autofree: free temp string exprs 2020-08-04 01:26:34 +02:00
Nick Treleaven
c33dbbc216 fmt: don't add newlines for UnsafeExpr (#6048) 2020-08-04 00:29:10 +02:00
Delyan Angelov
e291c38119 ast: add use case comment for MatchExpr.var_name 2020-08-03 22:10:59 +03:00
Swastik Baranwal
c547e8b191 v/fmt: fix formatting of type Foo = fn (a int)? (#6047) 2020-08-03 19:28:48 +03:00
Delyan Angelov
f605022481 cmd/tools/bench/wyhash.v: minor cleanup of output 2020-08-03 19:25:59 +03:00
Delyan Angelov
df5625bf68 cmd/tools/bench/wyhash.v: use predetermined seed, to ensure comparable results 2020-08-03 18:47:10 +03:00
dils2k
8dede3b535 builder: add a verror, when the output folder is not existing and writable (#5966) 2020-08-03 18:19:36 +03:00
Nick Treleaven
3e4df7f140 v/fmt: fix dropping as ident from if sum is T statement (#6049) 2020-08-03 18:16:06 +03:00
Carlos Esquerdo Bernat
66b3fabeef log: avoid the deprecated .is_opened() method (#6039) 2020-08-03 02:35:08 +03:00
Delyan Angelov
0ac30a8d9c gg: enable image transparency in gg.draw_image2 too 2020-08-03 00:30:08 +03:00
Delyan Angelov
a7ca1682c4 gg: fix gg.draw_image2 (image drawn, but without transparency for now) 2020-08-02 23:47:37 +03:00
Delyan Angelov
0b6b0aca09 parser: fix infinite loop on unexpected $ between statements 2020-08-02 18:17:38 +03:00
Alexander Medvednikov
79b70006e6 examples: simplify gg/rectangles.v 2020-08-02 17:01:10 +02:00
Delyan Angelov
c6ae322f85 parser: add hard limit to the number of statements in a fn 2020-08-02 17:58:05 +03:00
Nick Treleaven
8dcc3cda97 os.cp: fix returning false error on Windows (#6037) 2020-08-02 14:08:45 +03:00
Nick Treleaven
7f447bb82f ast: use Block instead of UnsafeStmt (#5981) 2020-08-02 14:06:44 +03:00
Alexander Medvednikov
cc57b52773 gg: fix typo 2020-08-01 23:52:15 +02:00
Alexander Medvednikov
149de958f3 gg: fix compilation 2020-08-01 23:45:36 +02:00
Alexander Medvednikov
a1593e7db8 checker: 1 line v fmt fix 2020-08-01 23:41:32 +02:00
Alexander Medvednikov
fb4550e582 gg: new create_image() (part 1) 2020-08-01 23:40:28 +02:00
Swastik Baranwal
d56d622a43 checker: add checks for byte casting (#5917) 2020-08-01 23:17:00 +02:00
Maciej Obarski
4b8652755d doc: concurency example with WaitGroup (#6034) 2020-08-01 23:08:57 +02:00
Carlos Esquerdo Bernat
d71c11577a os: move file logic to file.v (#6013) 2020-08-01 23:07:37 +02:00
Duarte Roso
055117dc5f builtin: make byte.hex() two digits format (#5886) 2020-08-01 23:06:08 +02:00
spaceface777
4f37202b72 checker: allow struct fields starting with capitals in builtin (#5998) 2020-08-01 23:01:40 +02:00
spaceface777
1feca22e28 jsgen: don't generate JS. struct decls (#6035) 2020-08-01 22:27:25 +02:00
Alexander Medvednikov
adafd24819 gen: auto_str_methods.v 2020-08-01 16:36:12 +02:00
Maciej Obarski
2c6286b381 doc: another generics example (#6031) 2020-08-01 15:34:23 +02:00
Delyan Angelov
0fb8074353 cgen: add support for $if gcc {} too 2020-07-31 21:25:37 +03:00
Maciej Obarski
fbb260159b doc: add section with examples for for k,v in map{} (#6025) 2020-07-31 19:08:12 +03:00
joe-conigliaro
1ea511b530 builder/cgen: get -usecache working for self cimpilation 2020-07-31 20:10:19 +10:00
Nick Treleaven
eb47ce1e83 ast: fix ParExpr.str(), RangeExpr.str(), SizeOf.str() (#6023) 2020-07-31 02:31:01 +02:00
Louis Schmieder
1fd499ed4a vweb: fix request checking (#6027) 2020-07-31 01:26:56 +02:00
Delyan Angelov
91c9c0c917 checker: fix unknown_method_suggest_name.out test result too 2020-07-30 19:37:36 +03:00
Delyan Angelov
65891f54ed v.util.suggestions: fix hash.crc32.Crc32 case 2020-07-30 19:35:16 +03:00
Delyan Angelov
f300f787f3 checker: add suggestions for method mispellings and unknown types 2020-07-30 18:48:16 +03:00
Delyan Angelov
2c45e601ef builder: increase backtrace size with tcc to 25 frames 2020-07-30 16:56:58 +03:00
Delyan Angelov
3883c34b8c vfmt: fix eating of n in string(x,n) 2020-07-30 12:15:04 +03:00
Lukas Neubert
f2c639c869 builtin: add string.contains_any() (#5963) 2020-07-29 21:48:50 +02:00
Alexander Medvednikov
f269cbdc94 Revert "parser: Support unsafe(expr) (#5973)"
This reverts commit 19c226fcf8.
2020-07-29 21:41:47 +02:00
Delyan Angelov
9c9533dad9 checker: add error for fn f() Struct { return &Struct{} } (#6019) 2020-07-29 21:40:43 +02:00
Delyan Angelov
81f8e910e6 compiler: remove space at the end of warn/error messages to minimize diff churn 2020-07-29 20:37:55 +03:00
Steve Phillips
b5de19dc03 examples/concurrency: cleanup (#6018) 2020-07-29 20:11:08 +03:00
Swastik Baranwal
4500e7131e checker: add a checker error for fn calls on left side of an assignment (#5993) 2020-07-29 18:33:00 +03:00
Carlos Esquerdo Bernat
7b630f0350 ws: send unsolicited pong control frame on connect in ws_test.v (#6010) 2020-07-29 18:11:24 +03:00
Carlos Esquerdo Bernat
2f2463a04c ws: make Client.state pub mut (#6009) 2020-07-29 17:52:33 +03:00
Alexander Medvednikov
280afb2282 builder: rename a to args 2020-07-28 22:33:33 +02:00
Alexander Medvednikov
7ac457f1db roadmap: method expressions 2020-07-28 22:32:07 +02:00
Leah Lundqvist
51c9b49d3f iOS: basic building and running (#5999) 2020-07-28 22:27:38 +02:00
Ruofan XU
1d59d35129 cgen: fix sum type match (#5978) 2020-07-28 22:17:25 +02:00
Delyan Angelov
3df0ef249c ci: comment out sdl2 references 2020-07-28 19:17:44 +03:00
Delyan Angelov
e06448b616 eventbus: update test and docs too 2020-07-28 19:08:16 +03:00
Carlos Esquerdo Bernat
0539b2a7ea eventbus: removed check on publish, always use receiver, args, sender order for callbacks (#5940) 2020-07-28 18:48:25 +03:00
Delyan Angelov
9c028bb299 checker: fix passing enum to a method expecting string 2020-07-28 13:50:40 +03:00
Delyan Angelov
228486555c http: add pub to Method.str() 2020-07-28 12:34:29 +03:00
Delyan Angelov
5bf3b6eda3 gg: fix running tetris and ui examples on linux 2020-07-28 12:12:44 +03:00
Albert Lai
fa0477d558 building-a-simple-web-blog-with-vweb.md: fix bugs in code snippets (#5990) 2020-07-28 11:29:51 +03:00
Carlos Esquerdo Bernat
49a7a835c7 ws: update README.md (#5983) 2020-07-28 11:22:03 +03:00
Nick Treleaven
19c226fcf8 parser: Support unsafe(expr) (#5973) 2020-07-28 11:20:52 +03:00
Enzo
d7ed3cd8b7 fmt: fix SQL formatting in ORM expressions - remove trailing spaces (#5996) 2020-07-28 11:09:42 +03:00
Carlos Esquerdo Bernat
28657fe7cb http: handle all of the http.Method values in .str() (#6002) 2020-07-28 10:39:10 +03:00
Swastik Baranwal
8b66816bdc scanner: more checks for _ as num_sep (#5992) 2020-07-28 16:09:19 +10:00
joe-conigliaro
5d49034c31 http: backend_windows - use Method enum in ssl_do() 2020-07-28 14:35:21 +10:00
joe-conigliaro
395e886b2e http/vweb: use Method enum & add helpers 2020-07-28 14:13:19 +10:00
Alexander Medvednikov
fec9920b1a http: replace method string with an enum 2020-07-27 21:20:23 +02:00
Alexander Medvednikov
65159b8070 gg: bold/mono/italic fonts 2020-07-27 21:20:23 +02:00
Alexander Medvednikov
f33d9f4f68 sokol: sapp_macos_set_title 2020-07-27 21:20:23 +02:00
joe-conigliaro
61c1c4a690 checker: add error for invalid sum type cast MySt{1} 2020-07-28 01:04:04 +10:00
Enzo
2de1437a1e ci: vet all files from the compiler (#5994) 2020-07-27 12:15:29 +02:00
joe-conigliaro
1086150ab9 builder: add comment to parse_imports re: dup file parsing 2020-07-27 12:06:48 +10:00
Alexander Medvednikov
3d19167628 http: fix cookies (part 2) 2020-07-26 22:01:25 +02:00
Nick Treleaven
9f6e4a86e9 doc: improve array docs (#5950) 2020-07-26 20:29:51 +02:00
Alexander Medvednikov
cf4235ab65 http: fix cookies 2020-07-26 15:54:21 +02:00
Delyan Angelov
88345d759a tests: add support for skipping to valgrind_test.v 2020-07-26 16:09:58 +03:00
Ruofan XU
7027b2354b cgen: fix array and map with fns (#5938) 2020-07-26 14:22:02 +02:00
Delyan Angelov
dfa01d8877 rand: add rand.ulid_at_millisecond/1, use it in rand.ulid/0 2020-07-26 14:17:29 +03:00
penguindark
7d52d612ce rand: add rand.ulid() (#5979)
* removed debug println

* added newline to the end of the file

* time: add .unix_time_milli() method; rand,time: add tests

* rand: add more ulid tests; move tests to a separate file random_identifiers_test.v

* run vfmt over vlib/rand/random_identifiers_test.v

* speed up time.unix_time_milli

* simplify and speedup time.unix_time/0 and time.new_time/1

* update comment about rand.ulid()

* fix terminating 0 off by 1 issue in rand.ulid()

* optimize time.new_time()

* restore the master version of vlib/time/parse.v

* make test_unix_time more robust

Co-authored-by: Delyan Angelov <delian66@gmail.com>
2020-07-26 13:10:56 +03:00
Delyan Angelov
9e652c4f40 ci: fix remaining failing tests. Do mut ptr check only outside unsafe{} blocks. 2020-07-26 10:59:07 +03:00
Delyan Angelov
9d056168ae ci: fix failing tests 2020-07-26 10:48:24 +03:00
Delyan Angelov
a7f484d9a7 tests: make output of vlib/v/compiler_errors_test.v more readable 2020-07-26 10:47:55 +03:00
Carlos Esquerdo Bernat
1f8ae5d12c websocket: add tests (#5967) 2020-07-25 22:25:31 +02:00
Alexander Medvednikov
6796b93abd tests: fix compiler_errors_test.v 2020-07-25 22:20:10 +02:00
Delyan Angelov
6fcc6cdc75 rand: add comments for rand.uuid_v4, apply some more perf tweaks 2020-07-25 21:39:54 +03:00
Delyan Angelov
ee3ebed23c rand: further speed up of rand.uuid_v4 2020-07-25 20:21:44 +03:00
Delyan Angelov
3d2fd471b6 ci: prepare for enabling compilation with g++ again 2020-07-25 20:20:49 +03:00
Alexander Medvednikov
7c86156be5 checker: fix unsafe tests 2020-07-25 18:58:23 +02:00
Alexander Medvednikov
34907f7605 checker: do not allow assigning immutable refs to mutable vars 2020-07-25 18:32:36 +02:00
Delyan Angelov
a552674254 vvet: fix segfault on v vet . 2020-07-25 15:57:57 +03:00
Delyan Angelov
d5b837e808 rand: speed up rand.uuid_v4() ~7x, with -prod 2020-07-25 13:09:05 +03:00
Delyan Angelov
c1e14b451e builder: show timing info in bold; also add a checker summary: line with -stats 2020-07-25 10:32:29 +03:00
Alexander Medvednikov
3c1427a4e8 all: fix current module in build-module mode 2020-07-25 01:37:54 +02:00
Louis Schmieder
b58b15993c gen: compile time for (methods and fields) (#5957) 2020-07-25 00:02:44 +02:00
Lukas Neubert
2ccb28a93e checker: run vfmt over checker.v (#5965) 2020-07-24 20:12:01 +03:00
Delyan Angelov
289974dd15 rand: use time microseconds too in default rand initialization; generate proper uuid_v4 2020-07-24 14:33:58 +03:00
Delyan Angelov
c429fa7e27 rand: add test for rand.uuid_v4() 2020-07-24 14:01:48 +03:00
Delyan Angelov
bba0edf9a3 rand: add rand.uuid_v4() 2020-07-24 13:59:24 +03:00
Delyan Angelov
bfca55b87a examples: fix v build-examples 2020-07-24 13:29:47 +03:00
Delyan Angelov
5acc437367 examples: fix compilation 2020-07-24 12:34:19 +03:00
Delyan Angelov
2cf8a53eac vdoc: fix compilation 2020-07-24 12:30:38 +03:00
Delyan Angelov
8c4429c875 parser: fix passing the is_mut flag of anon fn arguments 2020-07-24 11:27:56 +03:00
Delyan Angelov
d204c926a8 tests: fix compilation of if_smartcast_test.v 2020-07-24 10:30:22 +03:00
pancake
04ef2a2671 os: implement os.system for iOS and uncomment the $if ios blocks (#5947) 2020-07-24 10:17:32 +03:00
Delyan Angelov
921b5cddd0 live: fix compilation 2020-07-24 08:45:28 +03:00
Delyan Angelov
d31142ac3e vfmt: fix compilation after the more strict mutability check 2020-07-24 08:43:18 +03:00
Delyan Angelov
d83e2ee330 websocket: fix compilation after the more strict mutability check 2020-07-24 08:41:14 +03:00
Delyan Angelov
346cc5ca2c term: fix panic in term.header, when cols,rows from get_terminal_size are < 2 2020-07-24 08:34:39 +03:00
Delyan Angelov
c2083203b3 v.util: fix util.emanager.set_support_color 2020-07-24 08:31:05 +03:00
Alexander Medvednikov
ec443c65a8 tests: fix some tests 2020-07-24 01:55:55 +02:00
Alexander Medvednikov
d2675b89c0 builtin: fix a mutable var on windows 2020-07-23 23:18:45 +02:00
Alexander Medvednikov
632e27a4a9 all: fix a big mutability bug and update all mutable vars 2020-07-23 23:16:36 +02:00
Alexander Medvednikov
fb41c6659a ci: vfmt -verify parser.v and cgen.v 2020-07-23 22:50:51 +02:00
Alexander Medvednikov
2eee274d6d doc: document C string literals 2020-07-23 22:49:56 +02:00
Alexander Medvednikov
32c1042ac6 parser: disable the duplicate import check for now 2020-07-23 22:20:00 +02:00
Alexander Medvednikov
653d40bfe8 parser: do not duplicate table imports 2020-07-23 21:59:48 +02:00
Nick Treleaven
75aa92b907 doc: add more subheadings & tweaks (#5752) 2020-07-23 18:55:54 +02:00
Nick Treleaven
582338ab79 docs: document for v in low..high { (#5949) 2020-07-23 18:55:35 +02:00
pancake
b7bdb97f7d term: fix crash in header when divider.len < 2 (#5956) 2020-07-23 18:54:29 +02:00
Louis Schmieder
b537d8e23e parser: comp for attrs array (#5903) 2020-07-23 17:19:37 +02:00
Carlos Esquerdo Bernat
7a4c27bd08 log: add flush to log file (#5942) 2020-07-23 08:02:53 +03:00
pancake
36352085ae v: add support for iOS crosscompilation (#5943) 2020-07-23 07:58:44 +03:00
Emily Hudson
0f98445f7f cgen: properly handle more multi-return edge cases (#5933) 2020-07-23 00:39:19 +02:00
Nick Treleaven
76c8e28e86 doc: reinstate the 'Short struct literal syntax' section + tweaks (#5762) 2020-07-23 00:37:37 +02:00
Nick Treleaven
95b7fcadca doc: add memory safety section & unsafe {...} example (#5804) 2020-07-23 00:36:23 +02:00
Iman
b64ccb153a doc: minor fixes (#5878) 2020-07-23 00:35:42 +02:00
Swastik Baranwal
05ea34b561 roadmap: add struct and interface embedding (#5927) 2020-07-23 00:34:44 +02:00
Koki Nishihara
ae4a9aca18 doc: edit comment in array example (#5936) 2020-07-23 00:33:50 +02:00
Uwe Krüger
6586a9a657 fmt: give braced sub expressions a higher priority (#5941) 2020-07-23 00:32:34 +02:00
Delyan Angelov
37c6f6ab1b vfmt: fix compilation with -prod 2020-07-22 21:43:20 +03:00
Delyan Angelov
276c1de190 unsafe: tag with unsafe{} some more pointer manipulations 2020-07-22 21:42:51 +03:00
Delyan Angelov
949ed90b51 utf8: fix a panic in utf8.len("pippo"), mark with unsafe{} direct pointer manipulations 2020-07-22 21:15:27 +03:00
Lukas Neubert
4096432a1d cli: prevent need for unsafe block (#5937) 2020-07-22 20:53:49 +03:00
Iman
d820a97c83 examples: update vcasino.v (#5880) 2020-07-22 20:45:55 +03:00
Ryan Willis
938e71b468 v: fix for import cli { Command } 2020-07-22 20:33:43 +03:00
Nick Treleaven
ee349691f9 v/checker: Warn about pointer indexing outside unsafe {} (#5918) 2020-07-22 20:28:53 +03:00
joe-conigliaro
d46a89b90d parser/checker/fmt: optimize scope lookups by storing object with ident & add if expr smartcast support to vfmt (#5935) 2020-07-23 02:10:31 +10:00
Delyan Angelov
ebbc7bd471 examples: fix crash when running examples/ws/client.v outside of valgrind 2020-07-22 18:42:57 +03:00
Carlos Esquerdo Bernat
b0d76c59f7 websocket utf8: move utf8 functions from websocket to encoding.utf8, add utf8_test.v (4/4) (#5924) 2020-07-22 18:36:24 +03:00
Carlos Esquerdo Bernat
38aa5d6930 websocket example: cleanup and simplify (3/4) (#5923) 2020-07-22 17:44:56 +03:00
Carlos Esquerdo Bernat
635c99e2ed ws: obtain port when not specified (#5922) 2020-07-22 17:35:30 +03:00
Carlos Esquerdo Bernat
0d8ebf5845 websocket: use log instead submodule logger (1/4) (#5921) 2020-07-22 17:31:22 +03:00
Koki Nishihara
44c280e522 doc: fix example program for array (#5926) 2020-07-22 17:28:09 +03:00
Ruofan XU
0f72328d1f cgen: minor generated C source format fix 2020-07-22 17:27:37 +03:00
Carlos Esquerdo Bernat
f09e14a2b9 csv: cleanup reader_test.v 2020-07-22 17:26:26 +03:00
Emily Hudson
1476602f99 builder: pass define flags to msvc (#5931) 2020-07-22 17:24:12 +03:00
spaceface777
6d09842852 doc: document range match branch syntax (#5913) 2020-07-22 02:31:32 +02:00
Ruofan XU
a370dd2867 cgen: further fixes to and array/map of fns (#5916) 2020-07-22 02:30:44 +02:00
kalapalo
c3a2e9b5c4 cgen: fix sum type assignment with pointers (#5868) 2020-07-22 02:28:49 +02:00
Lukas Neubert
0cc8d840a3 vpm: fix and improve outdated (#5902) 2020-07-22 02:25:20 +02:00
spaceface777
f4251dded0 checker: suggest using := when assigning to undefined variable (#5911) 2020-07-21 19:49:53 +03:00
Delyan Angelov
8b930b4888 builder: measure msvc execution too 2020-07-21 19:45:50 +03:00
Delyan Angelov
14fd7d93ca v.pref: fix v build file.v 2020-07-21 19:36:58 +03:00
Delyan Angelov
6dd1494008 encoding.base64: use fixed static arrays for the ending_table and index consts 2020-07-21 17:56:19 +03:00
Delyan Angelov
4cb9e651a6 vfmt: fix sizeof(C.Type) 2020-07-21 16:28:30 +03:00
Delyan Angelov
e1eb9c4ff1 vfmt: fix x := *&int(ptr) 2020-07-21 15:58:17 +03:00
Delyan Angelov
35df792c05 vfmt: fix #include "@VROOT/path/x.h" 2020-07-21 14:26:49 +03:00
Delyan Angelov
8f23accc4e time: add .format_ss_milli and .format_ss_micro methods 2020-07-21 11:58:33 +03:00
Delyan Angelov
0af415fa28 vlib: add unsafe{} wrappers to C. fn calls, to allow compiling with -prod again 2020-07-21 09:05:31 +03:00
Carlos Esquerdo Bernat
6dbc143d67 websocket: move ws example to examples folder (#5875) 2020-07-21 00:55:58 +02:00
Alexander Medvednikov
303b65c0b9 roadmap: io streams 2020-07-20 22:51:17 +02:00
Alexander Medvednikov
059722f211 checker: minor vfmt run 2020-07-20 22:30:09 +02:00
Alexander Medvednikov
3c90da6afa ci: enable vfmt check 2020-07-20 22:26:44 +02:00
Nick Treleaven
15ca64d81d tests: rename pointer_arithmetic_should_be_checked.vv -> unsafe_required.vv (#5897) 2020-07-20 23:04:22 +03:00
Ruofan XU
53e7cb124d example: make quick_sort generic (#5898) 2020-07-20 20:17:01 +03:00
Nick Treleaven
a74cbf55c7 checker: warn if C.m* or C.s* functions are called outside unsafe blocks (#5869) 2020-07-20 20:06:41 +03:00
spaceface777
1a5236e53d jsgen: export module through commonjs (#5895) 2020-07-20 19:57:13 +03:00
Ruofan XU
88c8e194d0 cgen: fix map and array with fns (#5894) 2020-07-20 19:53:02 +03:00
Nick Treleaven
e6fc8eb015 checker: check that array slicing indexes are valid (#5892) 2020-07-20 19:52:03 +03:00
Enzo
8653605b0a fmt: allow for comments in call args and if expressions branches (#5871) 2020-07-20 17:48:33 +03:00
Nick Treleaven
fb76e02c59 builtin: speed up string.clone() by using C.memcpy (#5837) 2020-07-20 17:44:35 +03:00
Lukas Neubert
c93467bca5 vpm: add list command (#5888) 2020-07-20 17:39:37 +03:00
Carlos Esquerdo Bernat
c60948e52e runtime: simplify nr_cpus(), add a test for nr_jobs() 2020-07-20 17:36:44 +03:00
Delyan Angelov
fb4c3ff31a tests: split unsafe.v to vlib/v/tests/unsafe_test.v and a checker output .vv&.out test 2020-07-20 16:53:27 +03:00
Carlos Esquerdo Bernat
60997b3052 net.http: wrap unsafe{} around req.headers.free() (#5891) 2020-07-20 15:39:46 +03:00
Delyan Angelov
c858978348 cgen: add support for -d trace_gen too. Add v tracev command. 2020-07-20 12:36:27 +03:00
Delyan Angelov
587b9dd8aa tests: reduce iterations for the atomic and semaphore tests, to speed up test-fixed 2020-07-20 11:14:55 +03:00
Ruofan XU
9f6aacb739 cgen: fix array of fns init (#5884) 2020-07-19 21:44:03 +02:00
Louis Schmieder
bb60fe2ccf vweb: implement cookie expiration date (#5873) 2020-07-19 21:42:50 +02:00
Enzo
8a855ccae1 fmt,vet: handle var in [single_value] (#5882) 2020-07-19 19:58:34 +02:00
Ruofan XU
0b0f9c9c06 readme: simpler bootstrap test #5874 2020-07-19 20:08:53 +03:00
Delyan Angelov
9c3aa8bfc3 sqlite: add more detailed C.sqlite3_ APIs 2020-07-19 19:14:40 +03:00
Ryan Willis
1114fd28d0 all: import individual symbols feature (#5872) 2020-07-18 21:34:38 +02:00
Nedim
b3011b4f19 examples: add example for using the SMTP module (#5870) 2020-07-18 15:59:54 +03:00
Delyan Angelov
de0fc53d62 CI: fix failing tests because of hash.wyhash duplicates 2020-07-18 15:27:57 +03:00
Delyan Angelov
ca8344460a cli: fix failing test on macos/windows 2020-07-18 15:02:05 +03:00
XeGrox
e5a508c0d7 checker: fix inability to access aliased struct fields (#5861) 2020-07-18 13:58:16 +02:00
Alexander Medvednikov
74d70b8719 all: more cached moduels fixes 2020-07-18 13:49:03 +02:00
Delyan Angelov
3a4f2dfe8b cli: extract improvements to vlib/cli, based on PR 5616 (without cmd/v2) 2020-07-18 14:24:29 +03:00
Alexander Medvednikov
7ab6899538 builtin: fix compilation (part 1) 2020-07-18 11:17:29 +02:00
Alexander Medvednikov
38e5569503 all: cached modules fixes 2020-07-18 11:15:44 +02:00
Delyan Angelov
411eaadc15 CI: make sure vcreate.v is not skipped by v build-tools 2020-07-18 10:42:08 +03:00
Nick Treleaven
105a0e015e checker: warn if unsafe method called outside unsafe block (#5863) 2020-07-17 19:14:12 +02:00
Enzo
90d9040e6e all: make comment expressions + fix vfmt array init (#5851) 2020-07-17 19:13:22 +02:00
Nick Treleaven
39f90e25f3 all: if guard optional: define err in else branch (#5853) 2020-07-17 19:10:01 +02:00
Uwe Krüger
ea322bdd97 checker, cgen: fix call of generic function returning normal type (#5865) 2020-07-17 18:28:45 +02:00
Ryan Willis
e804ba5294 vfmt: add support for VDIFF_TOOL, detect more diffing tools (#5857) 2020-07-17 14:03:07 +03:00
Uwe Krüger
f6947d111b parser: fix sizeof(int) when used as call arg for external function (#5855) 2020-07-17 11:31:35 +03:00
spaceface777
3583302ad4 parser: force ... rather than .. in matches for inclusive ranges (#5852) 2020-07-17 11:30:21 +03:00
Lukas Neubert
fa03f390b3 parser: add error for for i := 0; i++; i < .. (#5850) 2020-07-17 10:31:58 +03:00
Ryan Willis
82e2b1ec33 strconv: use import instead of module in test files (#5856) 2020-07-17 02:35:42 +02:00
Alexander Medvednikov
69ef43ba00 vweb: fix ip() 2020-07-16 21:23:35 +02:00
Alexander Medvednikov
cb1009d91b strconv: more fixes 2020-07-16 20:55:15 +02:00
Alexander Medvednikov
f1b4af33ac tests: atof_test fix 2020-07-16 19:50:09 +02:00
Alexander Medvednikov
9b2cbdacc6 vfmt: verify 2020-07-16 19:46:03 +02:00
Alexander Medvednikov
a989e017fe tests: fix f32_f64_to_string_test.v 2020-07-16 19:41:01 +02:00
Alexander Medvednikov
e4fac6ff97 autofree: fix scope position 2020-07-16 19:40:14 +02:00
Alexander Medvednikov
dc89a914ea cc: build-module/module cache fixes; strconv: move all code in one module 2020-07-16 19:01:56 +02:00
Ryan Willis
f66967a88c vsymlink: real Windows symbolic link, fallback to batch, make.bat updates (#5841) 2020-07-16 18:33:26 +02:00
Swastik Baranwal
f3a505b558 scanner: add check for _ in num literals (#5849) 2020-07-16 17:29:07 +03:00
spaceface777
b900577dae compiler: handle ranges as match conditions (#5847) 2020-07-16 16:41:18 +03:00
joe-conigliaro
612fe1b8fb cgen: autofree scope var position fixes 2020-07-16 20:06:50 +10:00
Alexander Medvednikov
6245876806 vweb: ip() 2020-07-16 00:48:14 +02:00
Nick Treleaven
2492066041 doc: document optional if val := opt { (#5838) 2020-07-15 21:57:41 +02:00
Nick Treleaven
f5e6a83a05 builtin: unsafe vlib pointer indexing (#5836) 2020-07-15 21:56:50 +02:00
Lukas Neubert
cc7c8009a1 vpm: outdated command (#5833) 2020-07-15 21:55:07 +02:00
Alexander Medvednikov
c563168d69 rand: string() 2020-07-15 21:36:09 +02:00
Nick Treleaven
4b0ded0475 checker: Warn instead of error for pointer arithmetic (#5840) 2020-07-15 19:59:39 +02:00
Delyan Angelov
1873a0cb6d builder: pass -g3 for -cg 2020-07-15 12:46:24 +03:00
Enzo
2ee8f93d60 parser: duplicate method declaration on interface (#5825) 2020-07-15 10:23:21 +02:00
Uwe Krüger
8df6e59678 sync: add semaphores (#5831) 2020-07-15 10:22:33 +02:00
spaceface777
6a260ad974 doc: make int base section more concise (#5827) 2020-07-14 20:26:14 +03:00
Nick Treleaven
f5579525c4 doc: enhance the Option example, tweak the Calling C section (#5830) 2020-07-14 20:24:59 +03:00
Delyan Angelov
cf7d03bda6 builtin: implement array.pop() 2020-07-14 20:01:39 +03:00
Enzo
de0b96f52c parser: fail when interface name is duplicated (#5828) 2020-07-14 18:52:51 +02:00
Enzo
d301611de7 fmt: interface decl fixes (#5829) 2020-07-14 18:52:28 +02:00
Alexander Medvednikov
60ce938149 builder: make builtin, strconv, os work with v build-module 2020-07-14 18:27:14 +02:00
Delyan Angelov
5ad957f270 vfmt: fix formatting for x, _ := f() 2020-07-14 19:11:16 +03:00
Delyan Angelov
e23925f2be pref: add -show-timings option 2020-07-14 18:47:40 +03:00
Alexander Medvednikov
06f5279f77 checker: fix multi_const_field_name_duplicate test 2020-07-14 17:44:08 +02:00
Alexander Medvednikov
899c69caf1 checker: fix dup const test 2020-07-14 17:24:08 +02:00
Enzo
880c8e4dc9 cgen: else if guard (#5822) 2020-07-14 17:19:55 +02:00
Alexander Medvednikov
d33fbe4547 checker: format + fix duplicate const error 2020-07-14 17:18:10 +02:00
Swastik Baranwal
c3bdacbf04 doc: add info about _ separator in literals (#5823) 2020-07-14 15:46:13 +02:00
Alexander Medvednikov
c3ec5323f0 autofree: move new scope free behind -experimental for now 2020-07-14 15:30:55 +02:00
Alexander Medvednikov
7231b467a6 autofree: fix stmts() free 2020-07-14 14:50:51 +02:00
Alexander Medvednikov
1338e7fce2 autofree: free in each scope 2020-07-14 13:56:52 +02:00
Delyan Angelov
c363c11e20 doc: fix type of int => type int 2020-07-14 11:38:40 +03:00
Delyan Angelov
3703ade9f1 doc: add a Numbers section. Add tests for 0b prefixed integer literals too 2020-07-14 11:10:43 +03:00
Alexander Medvednikov
361d12bf43 pref: -experimental flag 2020-07-14 00:32:33 +02:00
ka-weihe
df45488e09 cgen: fix warnings (#5820) 2020-07-14 00:16:31 +02:00
joe-conigliaro
042add0e7f ast: fix typo in comment 2020-07-14 04:04:16 +10:00
joe-conigliaro
dd06d90466 checker/gen: temp hack for struct fn type field (fixes ui) 2020-07-14 03:59:00 +10:00
Alexander Medvednikov
1c682d7b89 cgen/autofree: sb.writeln() optimization fixes 2020-07-13 18:59:47 +02:00
Delyan Angelov
e5a5e76a30 cgen: fix for passing functions as voidptr args 2020-07-13 19:45:13 +03:00
Delyan Angelov
e3f7681e89 smtp_test: use assert false return, remove for loop 2020-07-13 18:52:46 +03:00
Delyan Angelov
97d01a5487 test: enable passing username/password through env vars to smtp_test.v 2020-07-13 18:22:36 +03:00
Lukas Neubert
ee46c8075f help: document existence of vet (#5816) 2020-07-13 16:41:47 +02:00
spaceface777
e9c144bf98 smtp: rewrite module api (#5819) 2020-07-13 16:41:23 +02:00
Delyan Angelov
a565848dfa tests: remove duplicate test autolock_array_1_test.v 2020-07-13 15:02:44 +03:00
Uwe Krüger
6e6010d198 checker, cgen: implement auto-lock for a[i]++, a[i]-- (#5817) 2020-07-13 15:01:32 +03:00
Delyan Angelov
b04fff272e tests: move autolock_array_1.v to autolock_array_1_test.v 2020-07-13 14:21:44 +03:00
Uwe Krüger
aa364ddaca checker, cgen: checks for shared/lock, first autolock (#5815) 2020-07-13 12:19:28 +02:00
Delyan Angelov
1baa7ef806 os: implement os.write_file_array and os.read_file_array . 2020-07-13 10:46:37 +03:00
Alexander Medvednikov
db2346069a gg: always use stb_truetype for now 2020-07-13 01:02:50 +02:00
Delyan Angelov
f1fdafcdff pref: add -check-syntax for just parsing files, without checking them 2020-07-12 22:44:38 +03:00
Swastik Baranwal
b5b5176f9b string: add filter method (#5812) 2020-07-12 21:07:28 +03:00
Nedim
8674991bac smtp: add mail sent confirmation and tests for smtp lib (#5813) 2020-07-12 20:42:11 +03:00
spaceface777
8273e021db doc: clarify that an or block may end with a default value (#5814) 2020-07-12 20:27:41 +03:00
Delyan Angelov
87a0765ce4 doc: add that or blocks may end with default values 2020-07-12 19:47:09 +03:00
Takeru Tanaka
f61a7bf3df os,rand.mt19937: fix broken links in code comments (#5806) 2020-07-12 16:18:52 +03:00
Delyan Angelov
d28a1042a0 net.http, net.websocket: allow importing both in the same app 2020-07-12 15:21:40 +03:00
Delyan Angelov
53ee5eb043 vfmt: fix removing cmod. in []Enum return values 2020-07-12 14:40:50 +03:00
Nick Treleaven
53023c1ca9 all: add UnsafeExpr (#5793) 2020-07-12 12:58:33 +02:00
Alexander Medvednikov
cad816a19d gg: text_height() 2020-07-12 12:48:42 +02:00
Delyan Angelov
9c43d36513 parser,checker: add -d trace_parser, -d trace_checker 2020-07-12 12:56:01 +03:00
Delyan Angelov
23c8e1f06d checker: add support for -d debug_stmts to ease debugging checker panics 2020-07-12 12:04:39 +03:00
Alexander Medvednikov
40da32a141 gg: text_width() 2020-07-12 01:46:21 +02:00
Tom Leen
e747dfd50f doc: fix module init signature (#5809) 2020-07-11 21:20:28 +02:00
Nedim
25c397f921 net.smtp: remove credentials from the test (#5808) 2020-07-11 21:19:36 +02:00
Nedim
549c4f54cd net: implementation of SMTP RFC 2821 (#5807) 2020-07-11 21:05:24 +02:00
Delyan Angelov
c891014c77 scanner: reduce memory, increase speed for long commented sections 2020-07-11 21:27:39 +03:00
Delyan Angelov
022cc72740 scanner: parse multiple comments and long strings without a stackoverflow 2020-07-11 20:52:08 +03:00
Alexander Medvednikov
a2cb01e16a parser: parse _x64.v files only with -x64 2020-07-11 19:03:59 +02:00
Alexander Medvednikov
d4dd5645fe parser: remove strconv import 2020-07-11 18:53:50 +02:00
Delyan Angelov
498c8cfc8e builtin: skip print_backtraces on panics with tcc, it does it automatically 2020-07-11 17:51:06 +03:00
yuyi
9b4c81e85f checker: check missing return values in functions (#5803) 2020-07-11 16:30:49 +02:00
Delyan Angelov
37d739684c checker: prevent string(byte), suggest byte.str() instead 2020-07-11 17:09:22 +03:00
Swastik Baranwal
839bd0e150 doc: fix array init (#5801) 2020-07-11 15:37:55 +02:00
ka-weihe
ae349ca6ba cgen: fix all -Wmissing-variable-declarations (#5802) 2020-07-11 15:37:40 +02:00
Alexander Medvednikov
59df2db4e0 ci: disable C++ test for now 2020-07-11 15:36:08 +02:00
Delyan Angelov
26768e8514 vfmt: strip current_module. in fn args more robustly 2020-07-11 16:09:20 +03:00
Delyan Angelov
b55f84c0a8 vfmt: turn off module is imported but never used for vfmt 2020-07-11 15:03:37 +03:00
Delyan Angelov
7c0a298701 vfmt: fix crash when a .v file contains only imports 2020-07-11 14:54:55 +03:00
Delyan Angelov
3aeca70970 benchmark: update the example in the README.md 2020-07-11 14:54:55 +03:00
Alexander Medvednikov
ab3c1f2a08 prealloc: skip frees for now 2020-07-11 13:22:18 +02:00
yuyi
fae601fe39 array: add reverse_in_place for performance (#5798) 2020-07-11 13:17:11 +02:00
Alexander Medvednikov
b92ce38593 os: fix v_realloc call on windows 2020-07-11 12:45:22 +02:00
Alexander Medvednikov
2e275731a3 websocket: fix compilation 2020-07-11 12:41:37 +02:00
Alexander Medvednikov
649821be4c all: use v_realloc 2020-07-11 12:37:54 +02:00
Alexander Medvednikov
867929e0b4 ci: run tests with -prod 2020-07-11 12:19:59 +02:00
Alexander Medvednikov
2a696cb837 vet: prohibit spaces before ) 2020-07-11 12:14:19 +02:00
Alexander Medvednikov
54da8371ac doc: fix compilation and format 2020-07-11 12:04:41 +02:00
Alexander Medvednikov
d94a02ba79 strings: builder.writeln() optimization 2020-07-11 12:03:24 +02:00
Alexander Medvednikov
549d7a487d tests: fix scanner_test.v 2020-07-11 11:51:58 +02:00
Alexander Medvednikov
d4d552fb00 vet: prohibit spaces after ( 2020-07-11 11:41:39 +02:00
Alexander Medvednikov
a1073105e1 all: re-enable -prealloc 2020-07-11 11:25:56 +02:00
Delyan Angelov
2ea187fb85 doc: mention throw/try/catch in the Option section, so people can find it easier 2020-07-11 11:26:22 +03:00
Delyan Angelov
d44fe50953 doc: update the SQLite C interoperability example 2020-07-11 10:49:42 +03:00
Delyan Angelov
006d260d20 vfmt: keep vproto.Name, in module proto in struct inits too 2020-07-11 02:42:57 +03:00
Uwe Krüger
646df49c74 builtin: fix string.hash method for gcc -O2 (#5794) 2020-07-11 01:18:52 +03:00
Delyan Angelov
7248d8422e vfmt: keep vproto.Name, when current module is proto 2020-07-11 00:59:19 +03:00
Uwe Krüger
3c3a91697e doc: describe upcoming automatic lock feature (#5795) 2020-07-10 23:45:03 +02:00
spaceface777
8df8866c5a make.bat: improve diagnostics, do not add V to PATH automatically (#5789) 2020-07-10 22:50:29 +03:00
pancake
7d6ba2d07d checker: add error when interface i, without a .str() method, have i.str() called (#5788) 2020-07-10 22:47:29 +03:00
Delyan Angelov
2fb5c91f4d scanner: remove error check for embedded \x00 chars in c'literals' 2020-07-10 21:42:03 +03:00
Lukas Neubert
10e0c39115 vcreate: various fixes and improvements (#5786) 2020-07-10 18:09:08 +02:00
yuyi
bf14e666ea cgen: add gen_map_equality_fn to compare maps (#5770) 2020-07-10 18:08:17 +02:00
yuyi
0c9c66dd6b cgen: fix mutable array arguments (#5769) 2020-07-10 18:04:51 +02:00
Alexander Medvednikov
9fd0bc93f0 tools/fast: fix commit date 2020-07-10 17:14:14 +02:00
Alexander Medvednikov
49a4ced79c tools/fast: fix commit link and enable -prod 2020-07-10 17:03:39 +02:00
Alexander Medvednikov
0cfa90828c tools/fast: run for each commit 2020-07-10 16:51:16 +02:00
Emily Hudson
7488dd829d all: _allow_multiple_values enum attribute (#5772) 2020-07-10 16:43:02 +02:00
Delyan Angelov
88946a34bb checker: limit showing too many unhandled match cases 2020-07-10 15:49:02 +03:00
penguindark
e85c1fb762 utf8: bug fix in get_uchar (#5775) 2020-07-10 14:44:40 +02:00
Swastik Baranwal
9839b0eb7f parser: handle a,b += 1,1 (fix #5735) (#5783) 2020-07-10 13:59:17 +02:00
vitalyster
1a9690cc62 doc: better [windows_stdcall] info (#5780) 2020-07-10 13:14:08 +02:00
Delyan Angelov
75b7b9564a builder: show the contents of the C .rsp file on -showcc 2020-07-10 13:07:20 +03:00
Alexander Medvednikov
203bec634c tool/fast: use AWS instance for stable benchmarks 2020-07-10 11:53:09 +02:00
Delyan Angelov
ca9790a71f vweb: ensure the tcp connection is always closed at the end of the response 2020-07-10 10:49:39 +03:00
Delyan Angelov
beb90435b5 ci: add a separate 'Install markdown' step to the gitly-compiles job 2020-07-10 10:32:49 +03:00
Delyan Angelov
d3e676bdc1 orm: use errcode comparisons, instead of strcmp(sqlite3_errmsg,msg) 2020-07-10 10:14:30 +03:00
Uwe Krüger
581603f2bd fmt: make formatter know about new keywords shared, rlock (#5779) 2020-07-09 22:41:45 +02:00
Daniel Däschle
fb927dab60 checker: check all branches for return (#5763) 2020-07-09 22:38:43 +02:00
Uwe Krüger
194ecda829 fmt: array_init: use line breaks of first elements in every hierarchy (#5777) 2020-07-09 22:36:49 +02:00
Lukas Neubert
14d83c8457 orm: fix invalid no more rows available error (#5774) 2020-07-09 22:36:01 +02:00
Uwe Krüger
e47ad33af6 fmt: format array elements line-by-line when nl after [ (#5776) 2020-07-09 19:47:12 +02:00
yuyi
31ac20876c cgen: minor formatting of struct_init (#5768) 2020-07-09 17:25:48 +02:00
Louis Schmieder
3792e17885 vweb: fix routing for 0 params (#5773) 2020-07-09 17:16:02 +02:00
Daniel Däschle
c5dc1a33b6 all: remove it smartcast and replace with original variable name (#5764) 2020-07-09 17:14:14 +02:00
Alexander Medvednikov
9511b7d0a1 cc: do not use -ldl in cross compiling for now 2020-07-09 12:29:49 +02:00
Alexander Medvednikov
8c338a7c3b cc: format and fix linuxroot download 2020-07-09 12:26:15 +02:00
Alexander Medvednikov
dfa29b6e4d fast: fix 1mil.v test 2020-07-09 11:56:31 +02:00
Delyan Angelov
73a259496e tests: support VTEST_ONLY=fn_,match_ ./v test-fixed and in compiler_test.v 2020-07-09 10:47:16 +03:00
Delyan Angelov
ce31c4c03e tests: support VTEST_ONLY=parser ./v vlib/v/compiler_errors_test.v 2020-07-09 10:27:31 +03:00
Alexander Medvednikov
c0a0949932 ci: bring back cross-compilation to linux test 2020-07-09 00:46:30 +02:00
Louis Schmieder
373aa3dbc8 vweb: router: fix trailing / (#5760) 2020-07-08 22:15:37 +02:00
Alexander Medvednikov
e3581c5cf6 gg: disable freetype on ios for now 2020-07-08 21:48:09 +02:00
Alexander Medvednikov
b8d762df97 gg: use D3D and stb_truetype on Windows; 2020-07-08 21:43:27 +02:00
Tomas Hellström
2790890bc2 ci: use pre built docker containers for musl (#5759) 2020-07-08 21:30:57 +03:00
Daniel Däschle
c0fa31e75a cgen: if smartcast part 3 (#5755) 2020-07-08 19:14:47 +02:00
Alexander Medvednikov
03b76d19f1 repl: make the info message a bit smaller 2020-07-08 17:22:38 +02:00
Daniel Däschle
e7cd496c31 parser: smartcast fix (#5756) 2020-07-08 16:08:44 +02:00
Nick Treleaven
f834276803 doc: struct literals (#5726) 2020-07-08 16:02:35 +02:00
yuyi
64e9bdc213 parser: fix non-void optional fn missing return value (fix #5736) (#5741) 2020-07-08 16:01:17 +02:00
Nick Treleaven
ec82fa77c5 doc: update match docs (#5753) 2020-07-08 15:56:49 +02:00
Daniel Däschle
5ea17ad2d4 all: if smartcast part 2 (#5754) 2020-07-08 15:46:58 +02:00
Louis Schmieder
7ad03e9d6a vweb: simplify router (#5751) 2020-07-08 15:22:03 +02:00
Daniel Däschle
b62bf59c21 all: if-is smartcast part 1 (#5730) 2020-07-08 15:17:28 +02:00
Emily Hudson
3b0dfd9ae1 cc: use @response files to avoid command line length limits (#5750) 2020-07-08 15:50:17 +03:00
Delyan Angelov
1d24fecc1b cmd: fix building gen_vc.v and vcreate.v by v build-tools 2020-07-08 14:29:55 +03:00
Delyan Angelov
69d3c3f596 cgen: sort const inits/cleanups topologically, skip calling non fn init(){} fns 2020-07-08 14:28:58 +03:00
Alexander Medvednikov
2425c05c42 Revert "cgen: sort const inits/cleanups topologically too"
This reverts commit 38000f8622.
2020-07-08 12:56:56 +02:00
Uwe Krüger
88248b1b66 cgen: add support for shared arrays (#5721) 2020-07-08 11:05:43 +02:00
Delyan Angelov
38000f8622 cgen: sort const inits/cleanups topologically too 2020-07-08 11:22:30 +03:00
Nick Treleaven
97ef860acb [doc] add assert, false, true, unsafe to the keywords (#5700) 2020-07-08 09:50:32 +03:00
Ruofan XU
6c48fc1ff9 readme: describe tcc as an alternative C backend on linux/windows (#5596) 2020-07-08 09:19:45 +03:00
Ruofan XU
9c87ace153 cgen: fix cross assign for functions (#5734) 2020-07-08 09:17:26 +03:00
Louis Schmieder
3bb1d24dad parser: add template path by fn name for vweb (#5737) 2020-07-08 09:12:57 +03:00
yuyi
bd16dd9fdf cgen: fix assert sumtype is (#5739) 2020-07-08 09:05:01 +03:00
Delyan Angelov
d77a78d945 ci: add a separate gitly-compiles job 2020-07-08 08:59:09 +03:00
yuyi
b0ce66d141 gen: fix generated defer (#5717) 2020-07-08 08:39:11 +03:00
Lukas Neubert
317b2dc579 tutorials: fix index() (#5732) 2020-07-07 22:01:18 +02:00
Alexander Medvednikov
246e7e8464 vweb: form error 2020-07-07 21:35:59 +02:00
Emily Hudson
cdfb578565 builder: cache msvc (#5733) 2020-07-07 20:35:49 +02:00
joe-conigliaro
c99200918e checker: fix if 2020-07-08 01:42:42 +10:00
joe-conigliaro
2480cce1ed checker: optimize if & fix typo 2020-07-08 01:36:48 +10:00
Alexander Medvednikov
e0fcd565d5 gg: fix default text size 2020-07-07 17:33:24 +02:00
joe-conigliaro
5fd5e558ae parser/checker/gen: anon fn direct call with args 2020-07-08 01:10:39 +10:00
Louis Schmieder
f8a89e3f8f gg: fix text rendering (#5727) 2020-07-07 17:09:35 +02:00
Matheus Salmi
b3ed2a4dcc doc: update keywords (#5724) 2020-07-07 16:57:39 +02:00
Louis Schmieder
2a7a6fa1eb orm: add delete stmt (#5725) 2020-07-07 16:55:32 +02:00
Alexander Medvednikov
4d7d1eb0c4 http: referer() 2020-07-07 14:37:43 +02:00
yuyi
dc24327b1e cgen: minor optionals fix (#5714) 2020-07-07 14:21:02 +02:00
Tarang11
68e01d87be checker: fix multi assignment for multiple fns (#5716) 2020-07-07 14:18:51 +02:00
Louis Schmieder
d2d4ea42ce vweb: add url query (#5719) 2020-07-07 13:46:57 +02:00
yuyi
4490cd2e8a os: replace panics with optionals (#5718) 2020-07-07 12:41:42 +02:00
Alexander Medvednikov
a6450e8e98 vweb: fix and simplify routing 2020-07-07 12:35:45 +02:00
Alexander Medvednikov
1307cfc97c doc: document array init syntax 2020-07-07 11:55:22 +02:00
Uwe Krüger
ef02373061 all: remove rwshared keyword, make its semantics default for shared (#5710) 2020-07-07 01:57:31 +02:00
Alexander Medvednikov
013c0e6e16 gg: make FT private 2020-07-06 21:40:24 +02:00
Alexander Medvednikov
48f1f814d2 gg: minor fixes 2020-07-06 20:40:54 +02:00
Alexander Medvednikov
0ed8199da2 gg: merge ft module 2020-07-06 20:29:09 +02:00
yuyi
43c8726c37 cgen: minor optimization of comptime (#5705) 2020-07-06 19:58:21 +02:00
Alexander Medvednikov
ebb4935703 examples: simpify text rendering examples 2020-07-06 19:55:49 +02:00
Alexander Medvednikov
1f3d7d393e gg: simplify text rendering 2020-07-06 19:45:00 +02:00
Leah Lundqvist
cfa8e0a81a js: |0 -> parseInt (#5703) 2020-07-06 18:09:54 +02:00
Nick Treleaven
9e7ba5f138 doc: update sum type docs (#5702) 2020-07-06 18:09:38 +02:00
joe-conigliaro
9a4d989188 test: move sumtype int cast test into fn & test var 2020-07-06 23:39:51 +10:00
Leah Lundqvist
659aa8db3c js: fix int division (#5701) 2020-07-06 15:24:24 +02:00
Delyan Angelov
6b2777e681 compiler: support VTMP; tests: delete .tmp.c files on successfull tests 2020-07-06 15:08:46 +03:00
joe-conigliaro
d82e6c9cd9 checker/table: fix sumtype cast from int literal 2020-07-06 21:27:48 +10:00
Delyan Angelov
25771a1afe compiler: remove -keepc option (it is now always on) 2020-07-06 13:42:18 +03:00
yuyi
c94038af89 cgen: improve generated code formatting (#5693) 2020-07-06 12:33:57 +02:00
yuyi
fc7237be7b checker: fix cast to sum type (fix #5690) (#5692) 2020-07-06 12:32:59 +02:00
yuyi
f41edef4c6 checker: add 1/0x0 1/0b0.. division by zero check (#5694) 2020-07-06 12:32:00 +02:00
Rasmus Schultz
1d10b150c5 vdoc: fix font-size (#5696) 2020-07-06 12:31:16 +02:00
Uwe Krüger
c3614c0e38 cgen, sync: implement separate read/write locks for rwshared types (#5687) 2020-07-05 22:53:28 +02:00
Louis Schmieder
3cd9e2cab7 vweb: fix index (#5682) 2020-07-05 22:05:58 +02:00
spaceface777
d0e321c8a3 fmt: allow parsing files without fn main() (#5681) 2020-07-05 20:53:01 +02:00
KrisChambers
8d035a446a Fix v/parser: Failure to parse structs with fields typed as anonymous functions returning having an optional void (?) return type. (#5684)
* Handle optional void return type in function types in struct fields.

* Add more testing for optional return types in struct fields.

* Move language parsing into it's own function

* Fix issue caused by not setting typ.

* Fix test for structs containing anon fn with optional void return types
2020-07-05 19:29:39 +02:00
Alexander Medvednikov
f6ab63f3a0 stbi: remove opengl call 2020-07-05 19:28:31 +02:00
Delyan Angelov
1416c70e73 net.websocket: fix building client.v 2020-07-05 18:44:39 +03:00
Alexander Medvednikov
271786b186 ci: skip some ui examples for now 2020-07-05 17:04:08 +02:00
joe-conigliaro
4e66728477 checker/table: rearrange sumtype check fns 2020-07-06 00:53:56 +10:00
Alexander Medvednikov
1505f3e22c vweb: fix an example 2020-07-05 16:52:20 +02:00
Alexander Medvednikov
36183660e6 remove oldgg, gl, glfw, freetype from vlib now that we have the new sokol based gg 2020-07-05 16:44:28 +02:00
yuyi
96bd4e8794 parser: fix type detection in match (#5679) 2020-07-05 16:35:45 +02:00
joe-conigliaro
9d7f1a236a checker/gen: fix nested sumtype matching 2020-07-06 00:25:04 +10:00
yuyi
34a24eaa4e checker: validate loop var names (#5677) 2020-07-05 15:27:37 +02:00
yuyi
cda9240632 cgen: add unsafe block braces and comments in generated code (#5674) 2020-07-05 13:32:39 +02:00
Delyan Angelov
0fb28eb42e contributing.md: add link to the Github Handbook's flow section 2020-07-05 08:46:42 +03:00
Delyan Angelov
b525553b53 examples: add a simplified mini (v)pwgen program 2020-07-05 01:44:00 +03:00
Delyan Angelov
770ffa1ebd crypto.rand: fix linux/solaris rand.read() compilation 2020-07-05 01:33:43 +03:00
Alexander Medvednikov
188bad4f38 vfmt: handle string attrs 2020-07-04 23:38:28 +02:00
Enzo
7778cbe9f5 all: make os global in scripts (#5669) 2020-07-04 23:37:41 +02:00
yuyi
11866fb017 cgen: improve code formatting of array_init (#5663) 2020-07-04 21:49:04 +02:00
Delyan Angelov
f374e37b61 checker: add details about a non matching functional argument 2020-07-04 22:37:06 +03:00
Alexander Medvednikov
5d0ea97823 roadmap: parallel parser 2020-07-04 21:25:23 +02:00
Delyan Angelov
108913c69e checker: handle error token positions with negative pos.len 2020-07-04 21:55:14 +03:00
Delyan Angelov
0637feb382 checker: use a more readable error message for non matching fn args 2020-07-04 21:23:22 +03:00
Delyan Angelov
db4a9d6b59 checker: stricter check for function type signatures 2020-07-04 21:01:08 +03:00
Ryan Willis
bb6ab185c3 ci: fix periodic integration tests (#5666) 2020-07-04 19:52:25 +02:00
Lukas Neubert
fbfd92a899 tutorials: more blog fixes (#5657) 2020-07-04 18:56:18 +02:00
Daniel Däschle
0626ac2901 checker: fix position of infix expr error 2020-07-04 18:52:40 +02:00
div72
be04de98bb checker: check for enum value duplicates/overflow (#5659) 2020-07-04 18:28:01 +03:00
Delyan Angelov
b018381f10 vfmt: fix as var in match expr as var {} 2020-07-04 16:46:46 +03:00
Delyan Angelov
fe50bdc164 vfmt: ran v vet vlib/v/ and fix spaces 2020-07-04 16:19:54 +03:00
Delyan Angelov
d2a2db7bff vfmt: format scanner.v 2020-07-04 16:14:30 +03:00
Delyan Angelov
5b93b4f37d vfmt: allow multiple comments after if branches 2020-07-04 16:13:58 +03:00
Delyan Angelov
68af46402e vvet: allow passing many files, improve specifity for emacs goto error 2020-07-04 15:29:00 +03:00
Delyan Angelov
dc3101384f checker: cleanup indentation 2020-07-04 14:45:11 +03:00
Delyan Angelov
48029fa9ad checker: check .str() calls too 2020-07-04 14:43:01 +03:00
Delyan Angelov
b4dc968db5 ci: fix compilation of check_os_api_parity.v 2020-07-04 14:27:23 +03:00
Delyan Angelov
35431d457b checker: add check for strict .str() method signature 2020-07-04 14:14:43 +03:00
Delyan Angelov
4403c76406 vfmt: print or { } on a single line 2020-07-04 14:14:43 +03:00
Delyan Angelov
73771b741c examples: add client ip logging to examples/tcp_echo_server.v 2020-07-04 14:14:43 +03:00
Delyan Angelov
bae9ed0350 os: fix file.writeln(s) too, where s contains 0 bytes 2020-07-04 14:14:43 +03:00
Uwe Krüger
3b067f5f85 all: experimental locked concurrency support, part 1 (#5637) 2020-07-04 12:44:25 +02:00
yuyi
27149ba8bc cgen: fix in in mutable arrays (#5647) 2020-07-04 12:12:44 +02:00
Louis Schmieder
56ad6cef54 tutorials: blog fixes (#5652) 2020-07-04 11:38:47 +02:00
Ruofan XU
765ffa37eb cgen: fix == for mut arraay args (#5648) 2020-07-04 11:36:33 +02:00
joe-conigliaro
da98c3c135 checker: use new match syntax everywhere 2020-07-04 19:23:41 +10:00
joe-conigliaro
cdd4a7c880 checker: only check ForInStmt.high once 2020-07-04 19:10:37 +10:00
div72
95696559b7 os: fix early termination when saving binary (#5646) 2020-07-04 01:48:01 +02:00
Ruofan XU
37f31da6c9 parser: minor simplification (#5645) 2020-07-03 23:22:43 +02:00
Alexander Medvednikov
3d3549d65a Revert "parser: advanced division by zero check (#5629)"
This reverts commit f03688e443.
2020-07-03 22:30:51 +02:00
Alexander Medvednikov
e9e437ce05 repl: show short version 2020-07-03 22:30:34 +02:00
Alexander Medvednikov
244d61f8d0 vweb: fix a route matching bug 2020-07-03 22:00:17 +02:00
yuyi
67e85fa9dd cgen: fix indent in for_in_string (#5631) 2020-07-03 18:10:45 +02:00
yuyi
61213263cd cgen: remove extra \n in map.get (#5630) 2020-07-03 18:10:29 +02:00
Nick Treleaven
0b49e4db1c v/checker.v: disallow pointer arithmetic for InfixExpr outside unsafe {} (#5640) 2020-07-03 18:10:10 +02:00
Ruofan XU
a2395ff3e8 cgen: fix mut map with relation op in fn (#5642) 2020-07-03 18:07:11 +02:00
yuyi
9e949622d3 vrepl: pre-imported common modules (#5643) 2020-07-03 18:06:36 +02:00
Alexander Medvednikov
2281163efd vweb: fix a routing bug 2020-07-03 17:50:48 +02:00
Tom Leen
51410fdb6d vweb: add .txt and .md mime types (#5641) 2020-07-03 17:17:25 +02:00
Delyan Angelov
8adaf4efd4 cgen: allow -printfn main for _test.v files too 2020-07-03 17:53:48 +03:00
Delyan Angelov
652380c5fd cgen: fix -printfn main 2020-07-03 17:42:59 +03:00
yuyi
dff385cb37 cgen: fix map_in mut (#5638) 2020-07-03 17:33:53 +03:00
Delyan Angelov
df2749dd50 vfmt: fix indent level of commented match branches 2020-07-03 17:16:20 +03:00
Alexander Medvednikov
b7175b54eb vweb: ['/:arg1/:arg2/action'] attribute 2020-07-03 15:10:39 +02:00
yuyi
f03688e443 parser: advanced division by zero check (#5629) 2020-07-03 11:28:00 +02:00
yuyi
1efbb83060 cgen: add space before else in match (#5632) 2020-07-03 11:23:23 +02:00
yuyi
31104d73b9 vrepl: minor optimization (#5633) 2020-07-03 11:22:34 +02:00
Delyan Angelov
3c432f5e07 orm: require order by instead of just order 2020-07-02 23:37:30 +03:00
Delyan Angelov
7004f74b71 orm: fix LIMIT var as well 2020-07-02 23:29:29 +03:00
Louis Schmieder
421b6d4a80 orm: fix offset when order is given too (#5625) 2020-07-02 23:22:52 +03:00
Delyan Angelov
5813d2bf72 net.socket: add s.peer_ip() 2020-07-02 23:02:56 +03:00
Louis Schmieder
b89cbf3224 orm: add support for ordering (#5624) 2020-07-02 20:29:22 +03:00
Lukas Neubert
6d788654e1 vpm: fixes with underscores for install and search (#5623) 2020-07-02 18:20:42 +02:00
yuyi
68ac8fde26 tests: add mixed and complex types tests for cross assign (#5622) 2020-07-02 18:20:03 +02:00
Delyan Angelov
5b900056f3 vfmt: add _keep.vv tests for the recent fixes, to prevent regressions 2020-07-02 17:50:21 +03:00
Delyan Angelov
d809bbb715 vfmt: fix enum field comments 2020-07-02 17:39:56 +03:00
Delyan Angelov
132170f54c vfmt: handle comments in enum Abc{} and after match branches 2020-07-02 16:51:09 +03:00
Delyan Angelov
6ec86fa344 vfmt: reformat examples/sokol/particles *.v files 2020-07-02 15:31:42 +03:00
Delyan Angelov
05e11f6336 vfmt: fix for x; y; i++ \n {} 2020-07-02 15:30:06 +03:00
Delyan Angelov
37d51e8d74 vfmt: keep top level comments on their own lines 2020-07-02 15:21:09 +03:00
Delyan Angelov
29943d7a91 vfmt: fix eating C. from C.sapp_desc{} and adding & to &&&App() 2020-07-02 15:06:35 +03:00
Ruofan XU
aa270263c9 exampleы: clean up quick_sort (#5620) 2020-07-02 13:32:02 +02:00
Tim Basel
703b060d09 cli: add flag/cmd sorting + get_all_found (#5615) 2020-07-02 11:10:03 +02:00
yuyi
6cbc0e84f0 cgen: fix cross assign with mutable args (fix #5609 #5610 #5611) (#5614) 2020-07-02 11:09:26 +02:00
yuyi
c21527d3c6 cgen: fix indent in multi_return (#5617) 2020-07-02 11:08:27 +02:00
yuyi
e904732554 cgen: remove an extra \n in for loops (#5618) 2020-07-02 11:03:40 +02:00
Uwe Krüger
6c022db786 scanner: fix string interpolation for '$a.b().c' (#5612) 2020-07-02 00:02:59 +02:00
Delyan Angelov
4e34edfa81 vweb: allow quoting @css/@js resources with both ' and " 2020-07-01 22:03:30 +03:00
Alexander Medvednikov
03ffe49aa3 ci: fix a typo 2020-07-01 20:17:01 +02:00
Alexander Medvednikov
2716a37916 ci: fix v vet call; fmt: fix SizeOf 2020-07-01 20:07:33 +02:00
Alexander Medvednikov
66f36f6dcc cgen: fix gen_cross_tmp_variable, part 2 2020-07-01 19:39:41 +02:00
Alexander Medvednikov
625ed030ef cgen: fix getn_cross_tmp_variable 2020-07-01 19:19:49 +02:00
Alexander Medvednikov
dbcb23ddc8 ci: run v vet on cgen and ast 2020-07-01 19:07:19 +02:00
Alexander Medvednikov
da99868a28 ci: run v vet vlib/v/parser 2020-07-01 18:57:14 +02:00
yuyi
40a393926d cgen: fix cross assign of struct fields (#5606) 2020-07-01 18:43:14 +02:00
Delyan Angelov
56ae814cbc gen: fix js main entry point generation 2020-07-01 19:37:24 +03:00
Alexander Medvednikov
5de0f944bd vweb: fix a template leak 2020-07-01 17:04:30 +02:00
Alexander Medvednikov
e78dc4d682 strings: fix a leak in builder 2020-07-01 16:52:04 +02:00
Delyan Angelov
d43722fa85 vweb: fix compiling templates containing ' 2020-07-01 17:44:26 +03:00
yuyi
2f614ad79f parser: optimize cross assign using expr.str() (#5604) 2020-07-01 16:43:13 +02:00
Alexander Medvednikov
013a4fc0f6 cgen: do not free strings in const decls 2020-07-01 16:40:04 +02:00
Alexander Medvednikov
6dad3cc018 cgen: fix a leak 2020-07-01 15:45:02 +02:00
Nick Treleaven
e7339fec15 all: disallow pointer arithmetic for AssignStmt, PostfixExpr outside unsafe{} (#5581) 2020-07-01 14:50:17 +02:00
Alexander Medvednikov
5eb76606ae cgen: store return vals in tmp vars with -autofree 2020-07-01 14:34:14 +02:00
yuyi
92eea7f95a cgen: fix map cross assign (#5603) 2020-07-01 14:03:12 +02:00
Larpon
673fe98cf5 doc: fix formating of points 7, 8, 9 in Example Workflow section (#5602) 2020-07-01 13:36:08 +02:00
Larpon
aec3ea5d32 examples: add sokol particle example (#5599) 2020-07-01 14:29:58 +03:00
yuyi
6c5b638202 parser: fix array cross assign (fix #5577) (#5591) 2020-07-01 12:11:03 +02:00
Tim Basel
7386adfc99 cli: help/version abbrev optional + fix various inconsistencies (#5586) 2020-07-01 10:54:34 +02:00
Delyan Angelov
ca1f47a742 cgen: fix for k,_ in map { x << k } 2020-07-01 11:49:02 +03:00
ylluminate
77bde09c13 tutorial: change speed to agility (#5590) 2020-07-01 10:30:22 +02:00
Delyan Angelov
cfd71560fa cgen: fix << for mut a []Type args 2020-07-01 09:21:50 +03:00
Delyan Angelov
78e1127d99 cgen: treat the main module like any other v module 2020-07-01 00:53:53 +02:00
Lukas Neubert
81e4d3fd09 tutorials: update markdown guide (#5589) 2020-07-01 00:45:19 +02:00
Lukas Neubert
d40334fe9d vpm: replace - in author names with _ (#5583) 2020-06-30 21:42:16 +02:00
Alexander Medvednikov
34ddc9240e tutorials: web blog fixes 2020-06-30 21:04:00 +02:00
Alexander Medvednikov
7df6984261 roadmap: ios/android 2020-06-30 20:34:22 +02:00
Alexander Medvednikov
a11e242bb2 readme: link to gitly, clarify compilation speed claims 2020-06-30 20:21:55 +02:00
Alexander Medvednikov
ba38c94a40 readme: stability guarantee 2020-06-30 20:04:56 +02:00
spaceface777
7ea77a0047 vschannel: fix net segfault on Windows (#5587) 2020-06-30 20:51:07 +03:00
Delyan Angelov
3fed6ca050 cgen: comment out g_str_buf for now 2020-06-30 18:32:04 +03:00
Delyan Angelov
2fd960f12c builtin: implement a double free detection for v strings 2020-06-30 18:32:04 +03:00
nyaascii
f10d2bb75f string: fix trim_prefix and trim_suffix methods (#5572) 2020-06-30 15:44:53 +02:00
Delyan Angelov
af56b01a41 cgen: parametrize g_str_buf size by V_STRBUF_MB; free in _vcleanup() 2020-06-30 16:31:02 +03:00
Nick Treleaven
55989b3c2c doc: split array example & some tweaks (#5564) 2020-06-30 14:37:02 +02:00
Louis Schmieder
f3010cbfb2 http: add post function with json as payload (#5580) 2020-06-30 14:36:11 +02:00
Nick Treleaven
d091f4e5b2 doc: general tweaks (#5566) 2020-06-30 14:29:55 +02:00
Uwe Krüger
8a46911725 checker: check if mut function arg is declared as mut (#5579) 2020-06-30 14:19:22 +02:00
Alexander Medvednikov
8d7eccb8e1 ci: fix gitly test 2020-06-30 14:16:53 +02:00
yuyi
61b8c0b699 cgen: change i++ to ++i in for 2020-06-30 14:14:48 +02:00
yuyi
628f13f1c8 cgen: minor optimization of index_expr() 2020-06-30 14:11:59 +02:00
Alexander Medvednikov
a45ad47841 ci: testing building gitly with -autofree 2020-06-30 14:06:36 +02:00
joe-conigliaro
a3086a2ef3 cgen: optimize generic struct name replacement (temp solution) 2020-06-30 13:45:52 +10:00
joe-conigliaro
73da3c9e4c generic structs: better naming & comments 2020-06-30 09:22:15 +10:00
Louis Schmieder
616b07204d vweb: add cookies with expire date 2020-06-29 21:14:36 +02:00
joe-conigliaro
7565fe595b builder: generic struct fix - derive field type 2020-06-30 04:37:07 +10:00
nyaascii
3436ae99fc picoev: add html() content-type method 2020-06-29 20:25:16 +02:00
Alexander Medvednikov
77e56aa3f9 cgen: fix string frees in calls 2020-06-29 20:20:35 +02:00
joe-conigliaro
ab37dcaa9c generic structs: initial implementation 2020-06-29 20:09:09 +02:00
Tim Basel
76176eddab cli: calculate indent based on name length 2020-06-29 17:59:55 +02:00
Swastik Baranwal
b17ed79773 doc: add as and is keywords 2020-06-29 17:59:31 +02:00
Alexander Medvednikov
5b98cde811 cgen: free temp strings 2020-06-29 17:47:12 +02:00
yuyi
9d845262b7 parser: fix module type cast 2020-06-29 17:15:40 +02:00
yuyi
c69ef876c5 os: remove return none in fn()? 2020-06-29 15:06:26 +02:00
Tim Basel
4a1ce3e1f5 cli: add pretty print for multiline descriptions 2020-06-29 14:47:20 +02:00
Ned Palacios
025652bb78 vdoc: dd .vdocignore + minor fixes 2020-06-29 11:03:09 +02:00
yuyi
c588bdee5a cgen: fix fn()? return 2020-06-29 11:02:40 +02:00
Delyan Angelov
1ba5996404 parser: fix interface functions with no params (ui examples) 2020-06-29 10:53:12 +03:00
Delyan Angelov
b6e6cde3e8 parser: disallow fns with type only args and a body 2020-06-29 10:21:01 +03:00
ka-weihe
1b0b4be287 atof: fix is_space (#5555) 2020-06-29 09:23:51 +03:00
Delyan Angelov
8f1e8a9dde orm: cleanup test (put structs at top) 2020-06-28 22:10:49 +03:00
Alexander Medvednikov
3f59f23427 vweb: fix a leak 2020-06-28 19:55:53 +02:00
Alexander Medvednikov
d2c508e9a9 checker: clean up 2020-06-28 19:44:41 +02:00
Alexander Medvednikov
219ecd18b5 orm: handle unknown tbale names 2020-06-28 19:01:30 +02:00
Alexander Medvednikov
3dea698c93 checker: do not register pseudo variables in sql queries 2020-06-28 18:56:11 +02:00
Alexander Medvednikov
9cbf572561 tests: fix a typo 2020-06-28 15:59:05 +02:00
Alexander Medvednikov
9feaff3464 x64: fix tests 2020-06-28 14:05:18 +02:00
Uwe Krüger
bc9f8babaa docs: describe upcoming concurrency 2020-06-28 13:58:08 +02:00
Alexander Medvednikov
0138f46797 vweb: fix a leak 2020-06-28 13:56:38 +02:00
yuyi
b04e509830 gitignore: git ignore symlink dir 2020-06-28 13:35:23 +02:00
yuyi
05de780219 map: add map['aa']+='str' test 2020-06-28 13:34:59 +02:00
Delyan Angelov
9814497b91 vfmt: fix eating of sql x { ... limit 1 } 2020-06-28 14:27:53 +03:00
Delyan Angelov
fa867578bc vfmt: fix segfault in update where the struct is not yet known 2020-06-28 14:07:28 +03:00
Delyan Angelov
0661273aad vfmt: add support for sql x {} expressions and statements 2020-06-28 13:36:21 +03:00
yuyi
b924c6c4a9 cgen: minor opitimize infix_expr (#5547) 2020-06-28 11:35:49 +02:00
Delyan Angelov
13783aea70 vfmt: support for 'VDIFF_OPTIONS=-w' 2020-06-28 12:35:05 +03:00
Maddi Kopfermann
f5fca00d37 repl: add some array functions 2020-06-28 11:24:38 +02:00
yuyi
d9409006fa cgen: fix a[0]+='str' 2020-06-28 11:16:16 +02:00
0xflotus
03829d9935 doc: fix typos 2020-06-28 02:19:52 +02:00
Alexander Medvednikov
bbaf6e3a1c ci: add gitly.org 2020-06-28 01:13:21 +02:00
Alexander Medvednikov
e666209fe2 vweb: set_content_type() 2020-06-27 23:22:41 +02:00
Emily Hudson
c84bafbdae vlib,cgen: cleanup array inits using `.repeat() instead of new init syntax 2020-06-27 21:46:04 +02:00
Delyan Angelov
2669610be9 sqlite: fix windows-install-sqlite.bat 2020-06-27 21:44:14 +03:00
Delyan Angelov
07cea76e63 sqlite: remove thirdparty/sqlite/shell.c from the amalgamation folder 2020-06-27 21:34:52 +03:00
Delyan Angelov
e9a2f86dcf sqlite: fix windows-install-sqlite.bat 2020-06-27 21:25:55 +03:00
Delyan Angelov
1e5a53abb3 sqlite: support for thirdparty/sqlite amalgamation install 2020-06-27 21:23:26 +03:00
Swastik Baranwal
8e2a8cc7f3 doc: add % in op overloading section 2020-06-27 19:26:21 +02:00
Emily Hudson
1848eb0973 cgen,map: fix leaks in keys() and for x in y 2020-06-27 17:00:27 +02:00
Alexander Medvednikov
190f970544 checker: handle limit and offset 2020-06-27 16:41:29 +02:00
Alexander Medvednikov
3672cfad0b orm: offset test 2020-06-27 16:25:25 +02:00
Alexander Medvednikov
f990a0b3d3 orm: offset 2020-06-27 16:22:41 +02:00
Alexander Medvednikov
f073ffa4ad orm: limit 2020-06-27 16:19:12 +02:00
Louis Schmieder
f8f2fa246e orm: fix sql table names 2020-06-27 15:14:53 +02:00
Alexander Medvednikov
6a335c4416 fmt: run on parser/assign.v 2020-06-27 15:00:28 +02:00
Alexander Medvednikov
2bfe8e5153 vet: a basic version that just checks indentation for now 2020-06-27 14:50:07 +02:00
yuyi
58763ff299 map: remove unused get2() and get3() 2020-06-27 13:58:07 +02:00
Alexander Medvednikov
02b846aa72 vweb: fix json() and text() results 2020-06-27 13:56:15 +02:00
Uwe Krüger
288ea182a8 doc: describe coroutines and how to exchange data 2020-06-26 23:55:34 +02:00
Uwe Krüger
8fe70a24a8 checker: forbid non-reference mut arg or receiver of go function 2020-06-26 23:31:38 +02:00
Tomas Hellström
993cd1467b sync: own submodule for atomic 2020-06-26 23:31:03 +02:00
Alexander Medvednikov
d52f1da7a2 orm: handle missing rows 2020-06-26 20:38:21 +02:00
Alexander Medvednikov
d2a4762c6a doc: fix layout 2020-06-26 20:12:52 +02:00
Tomas Hellström
def99bed02 sync: atomic counters 2020-06-26 20:04:17 +02:00
Alexander Medvednikov
195f4d0911 doc: valign=top 2020-06-26 20:01:30 +02:00
Nick Treleaven
b8d2208c7a doc: fix ToC alignment 2020-06-26 20:00:52 +02:00
Nick Treleaven
6b1b5e001d doc: use nested list for Table of Contents
A nested list is much easier to browse than a table.
Move Imports section below Arrays and Maps for Types grouping.
Move Defer section to Statements group.
Move vfmt section next to Profiling for Tools group.
2020-06-26 19:36:40 +02:00
Emily Hudson
09236a438b msvc: unique names for pdb files, remove test job limit 2020-06-26 17:16:15 +02:00
Delyan Angelov
c83c5e7c61 os: use return none in functions returning ? 2020-06-26 17:57:02 +03:00
joe-conigliaro
2440ffd013 cgen: always unwrap generic type. fix x := &T{} 2020-06-27 00:31:36 +10:00
Delyan Angelov
951f30853a os: fix rmdir on windows 2020-06-26 17:24:36 +03:00
Daniel Däschle
8903f6e0c0 tmpl: add docs for variables 2020-06-26 15:02:49 +02:00
Lukas Neubert
692ca8ac83 os: make all rm functions return an optional 2020-06-26 15:01:10 +02:00
sudo-nice
f703ddfb66 doc: short map syntax doesn't need a comma 2020-06-26 13:07:57 +02:00
jhuntos
20884c9576 pg: call PQclean in rows() 2020-06-26 11:55:59 +02:00
joe-conigliaro
202d479bad checker: fix typo in check_types.v 2020-06-26 15:05:07 +10:00
Alexander Medvednikov
5bd6d3acb5 vfmt: re-enable 2020-06-26 03:22:27 +02:00
Alexander Medvednikov
9a713ff9b0 orm: handle more operators 2020-06-25 22:58:28 +02:00
Alexander Medvednikov
aec7f2f6c4 checker: SqlStmt fixes 2020-06-25 22:37:40 +02:00
Uwe Krüger
46379d92f4 fmt: force break in front of long unbreakable parts, avoid very small sub-expressions 2020-06-25 22:24:28 +02:00
Alexander Medvednikov
328cb7ed7e orm: update with selectors and other fixes 2020-06-25 22:23:19 +02:00
Alexander Medvednikov
450c6e843c orm: update with multiple fields 2020-06-25 17:18:44 +02:00
Alexander Medvednikov
b280e08ee0 orm: update cgen 2020-06-25 17:12:32 +02:00
Alexander Medvednikov
a8b0dfb38a checker: allow casting strings to string aliases 2020-06-25 14:55:53 +02:00
Alexander Medvednikov
ce6f687f65 checker: remove an unnecessary error for unexisting types 2020-06-25 14:51:58 +02:00
Alexander Medvednikov
afa5a134b7 orm: move fields fetching to a separate function to remove copy pasta 2020-06-25 14:43:25 +02:00
yuyi
f1e17f30f6 cgen: fix map_in error 2020-06-25 12:53:12 +02:00
yuyi
5e9c154376 os_api: cp/cp_all/... ?bool => ? 2020-06-25 12:06:47 +02:00
Alexander Medvednikov
786be1d1c3 orm: move type logic to checker, so that sql queries can be used before type def 2020-06-25 12:05:24 +02:00
Uwe Krüger
a1bad50b2f token: use only one representation for precedences 2020-06-25 11:36:13 +02:00
Uwe Krüger
bdecbc1945 fmt: use -1 for *really* no precedence, since & and | have precedence 0 2020-06-25 02:39:33 +02:00
ka-weihe
3bb6b6c8b2 map: comments and renaming 2020-06-24 23:31:19 +02:00
Alexander Medvednikov
bb5793d485 vweb: more xss fixes 2020-06-24 22:38:25 +02:00
Alexander Medvednikov
83b300435a vweb: escape html; table: rename parent_typ to parent_type 2020-06-24 22:12:33 +02:00
yuyi
67d9d94fb3 map: fix m[a]++ etc 2020-06-24 20:41:26 +02:00
Lukas Neubert
955c0b1576 cgen: add 'link' to c_reserved 2020-06-24 20:40:56 +02:00
Uwe Krüger
eb68c222fe fmt: fix weird bug with tabs in string inpertolation 2020-06-24 20:40:29 +02:00
Alexander Medvednikov
9a77c0ab81 parser: fix the for loop check 2020-06-24 16:58:11 +02:00
Alexander Medvednikov
8ac00b8711 parser: check for loop key/val names 2020-06-24 16:54:21 +02:00
Alexander Medvednikov
4b0e606ae8 checker: fix the alias check 2020-06-24 16:52:23 +02:00
Alexander Medvednikov
9df29d0dd2 checker: do not allow {} for aliases; orm: update stmt 2020-06-24 16:35:18 +02:00
Alexander Medvednikov
0ea2e687d1 roadmap: more features 2020-06-24 15:27:26 +02:00
Uwe Krüger
0018e44102 fmt: further improvements by taking precedence into account for subexpressions 2020-06-24 15:19:30 +02:00
Alexander Medvednikov
9d0cc7912a fmt: re-run on gen/fn.v 2020-06-24 14:56:44 +02:00
Alexander Medvednikov
e918f8faf2 fmt: re-run on checker.v and cgen.v 2020-06-24 14:44:06 +02:00
Alexander Medvednikov
11871d9544 fmt: re-run on parser.v and fmt.v 2020-06-24 14:35:00 +02:00
Alexander Medvednikov
090e6e936a orm: SqlStmt 2020-06-24 14:32:17 +02:00
Lukas Neubert
13faf864cb bin2v: validate .v file extension 2020-06-24 14:13:31 +02:00
Lukas Neubert
30169f86c1 os: make rm return an optional 2020-06-24 14:01:19 +02:00
Alexander Medvednikov
7665114ded 0.3 roadmap 2020-06-24 13:44:12 +02:00
Lukas Neubert
8652f422d4 bin2v: specify custom filename for write 2020-06-24 12:56:00 +02:00
Daniel Däschle
852fca2151 all: call anon fns right away 2020-06-24 12:54:39 +02:00
Alexander Medvednikov
cf7ac7be7f cgen: zero_struct_field(); orm: zero un-inited fields 2020-06-24 12:53:39 +02:00
yuyi
5f36874c9b vrepl: fix optional call 2020-06-24 12:45:48 +02:00
yuyi
514ee9d396 cgen: fix optional void return error 2020-06-24 12:45:15 +02:00
Lukas Neubert
d4f0fe12ab bin2v: allow direct file output 2020-06-24 00:00:37 +02:00
Uwe Krüger
56749877ea fmt: fix handling of double quotes inside single quotes 2020-06-23 23:59:58 +02:00
Alexander Medvednikov
11ad18cd28 vweb: page gen time 2020-06-23 21:02:20 +02:00
Delyan Angelov
fcd73bcb63 scanner: ignore CR signs in string literals 2020-06-23 21:10:58 +03:00
Alexander Medvednikov
74af88bc92 Revert "fmt: re-format parser.v and cgen.v"
This reverts commit 6b2808a3f9.
2020-06-23 18:16:24 +02:00
Alexander Medvednikov
6b2808a3f9 fmt: re-format parser.v and cgen.v 2020-06-23 18:05:53 +02:00
ka-weihe
4e447db883 parser/fmt: fix comments in structs/consts 2020-06-23 18:01:56 +02:00
Uwe Krüger
000eaca6be fmt: avoid breaking lines with <= 100 characters 2020-06-23 17:54:39 +02:00
yuyi
7efb3ecb34 checker: check deprecated functions 2020-06-23 16:25:24 +02:00
Alexander Medvednikov
db28796b5f orm: handle bool literals for older sqlite versions 2020-06-23 14:07:39 +02:00
Alexander Medvednikov
16dd889922 orm: test true/false 2020-06-23 13:59:00 +02:00
Alexander Medvednikov
076d0208cd cc: add -ldl and .o in cross builds 2020-06-23 12:57:06 +02:00
Alexander Medvednikov
63ef04e03e os: make write_file() return an optional 2020-06-23 11:41:23 +02:00
Alexander Medvednikov
3774ae0d91 orm: fix = 2020-06-23 11:41:23 +02:00
yuyi
e2b5debc6b checker: check optional type call 2020-06-23 11:39:58 +02:00
yuyi
ed393896f5 checker: check printing of optional type 2020-06-23 11:38:30 +02:00
joe-conigliaro
cff2874608 checker: fn arg - disallow any type with .str() to be passed as string 2020-06-23 08:51:18 +10:00
Delyan Angelov
837df7c074 test-fixed: enable again vlib/sync/pool_test.v on windows 2020-06-22 20:38:47 +03:00
joe-conigliaro
d19a33c420 sync: use Event for waitgroup on windows 2020-06-23 03:23:42 +10:00
Alexander Medvednikov
a4b159a80f orm: order by id by default 2020-06-22 17:13:57 +02:00
Alexander Medvednikov
e3f00ff28b orm: limit 1 test 2020-06-22 16:58:43 +02:00
Alexander Medvednikov
deb09d95b0 orm: fix column == var; limit 1; vweb: @footer 2020-06-22 16:52:16 +02:00
yuyi
73296e486a parser: fix function return anon_fn without parentheses 2020-06-22 16:03:31 +02:00
Delyan Angelov
504fd01f57 test-fixed: skip vlib/sync/pool_test.v on windows for now 2020-06-22 16:27:08 +03:00
Delyan Angelov
b930a11203 parser: fix match x { mod.constname {} } handling 2020-06-22 16:16:39 +03:00
yuyi
d232833573 gen: fix printing of generic arrays 2020-06-22 14:54:24 +02:00
Delyan Angelov
cf4dc93e02 sync: run sync.pool without using concurrency features when VJOBS=1 2020-06-22 14:21:54 +03:00
Richard Warburton
640bbbae85 waitgroup: remove races, make platform independent, document 2020-06-22 11:07:34 +02:00
Alexander Medvednikov
e65879d076 fmt: fix compilation 2020-06-21 23:23:31 +02:00
Alexander Medvednikov
011e26ca9a checker: check sum types in match; cross compilation fixes; orm fixes 2020-06-21 23:09:53 +02:00
Alexander Medvednikov
9c6b772395 doc: update match syntax 2020-06-21 20:02:35 +02:00
yuyi
81c19517d1 cgen: add gen_str_for_multi_return 2020-06-21 17:53:13 +02:00
ka-weihe
7f225f2eaa map: rename size to len 2020-06-21 16:51:02 +02:00
Delyan Angelov
fbe5599526 vdoc: fix segfault in -autofree mode 2020-06-21 17:41:43 +03:00
Delyan Angelov
0d6233cd45 net: support for s.max_single_send_size in Socket.send/2 2020-06-21 17:40:39 +03:00
Alexander Medvednikov
81d17a63e3 doc: add a link to ORM examples 2020-06-21 16:12:16 +02:00
Alexander Medvednikov
9d7afa4e30 doc: update ORM syntax 2020-06-21 16:09:35 +02:00
Delyan Angelov
db05e5b66c vdoc: improve simple HTTP support in serve_html 2020-06-20 20:37:46 +03:00
Delyan Angelov
8a6beac692 vdoc: fix a panic on v doc -s modname with an empty module 2020-06-20 19:33:56 +03:00
Uwe Krüger
37927235cd parser: trigger declaration of array element as error 2020-06-20 14:30:03 +02:00
Daniel Däschle
76dc7eea50 vweb: tmpl: add docs 2020-06-20 13:29:55 +02:00
spaceface777
a02aff9126 jsgen: fixes and improvements 2020-06-20 13:22:49 +02:00
joe-conigliaro
ddd83f1fc6 checker: error if variable used before declaration 2020-06-20 12:42:08 +10:00
Alexander Medvednikov
1d8d19c977 vweb: return $vweb.html() 2020-06-20 03:12:38 +02:00
yuyi
e41ddab3b0 test: add multiple array clone tests 2020-06-20 02:35:22 +02:00
yuyi
e484fe15d3 tests: add nested array not equal tests 2020-06-20 02:34:49 +02:00
yuyi
4dc703af2d cgen: fix nested array equality 2020-06-20 01:40:33 +02:00
JalonSolov
bbd6d0b4e5 vweb: ignore url params on static files 2020-06-20 01:39:55 +02:00
Uwe Krüger
0338d4153a fmt: make linebreak smarter by algorithm based on penalty 2020-06-19 19:54:26 +02:00
Alexander Medvednikov
a609ff4659 orm: skip fields with [skip] 2020-06-19 17:35:50 +02:00
Swastik Baranwal
72b09d4794 term: add clear 2020-06-19 17:15:41 +02:00
Alexander Medvednikov
3cfeb92a4e cgen: fix tmp counter; orm: insert fixes 2020-06-19 17:05:57 +02:00
Alexander Medvednikov
cd8392e42d orm: insert 2020-06-19 16:43:35 +02:00
Uwe Krüger
c78cfa43bc checker: make map literals have a real type 2020-06-19 15:00:27 +02:00
spaceface777
d76e94bba8 make.bat: small tcc self-compilation cleanup 2020-06-19 14:09:34 +02:00
joe-conigliaro
7bc9e234a3 revert: checker: error if variable used before decleration p1 2020-06-19 21:37:09 +10:00
yuyi
dc8b82e9a4 array: fix multiple array clone 2020-06-19 13:32:55 +02:00
joe-conigliaro
8a5ca4cbdc checker: error if variable used before decleration p1 2020-06-19 21:31:33 +10:00
spaceface777
624005bbd0 tcc_win: fix tests 2020-06-19 12:54:56 +02:00
Alexander Medvednikov
e8b21b4242 checker: type x does not support indexing 2020-06-19 12:53:53 +02:00
Alexander Medvednikov
5f5228f0f3 test: fix as checker test 2020-06-19 11:48:19 +02:00
Alexander Medvednikov
d04554f0b7 all: more match updates 2020-06-19 11:46:08 +02:00
Alexander Medvednikov
274ecb71fa checker: as type test 2020-06-19 11:27:20 +02:00
Alexander Medvednikov
d9dd9679e7 cgen: fix a typo 2020-06-19 11:16:51 +02:00
Alexander Medvednikov
ef36520509 checker: check if the type in as exists, skip void type errors 2020-06-19 11:15:15 +02:00
yuyi
5a6d440f68 checker: check array_insert array_prepend type mismatch 2020-06-19 10:49:43 +02:00
Ned Palacios
5ff7d07138 vdoc: fix sorting + other minor improvements 2020-06-19 10:36:45 +02:00
Uwe Krüger
770132ff37 float: make default string representations for floats become alike 2020-06-18 22:33:41 +02:00
joe-conigliaro
1c68417918 parser: error on variable redefinition 2020-06-19 06:16:38 +10:00
spaceface777
68967e833d parser: skip comp_if when building for a different compiler 2020-06-18 22:01:00 +02:00
Alexander Medvednikov
5ddb129bc2 checker: use the new match syntax 2020-06-18 20:38:59 +02:00
Alexander Medvednikov
78b32892ac cgen: use the new match syntax 2020-06-18 20:21:08 +02:00
Alexander Medvednikov
d4b17fb0c3 fmt: use the new match syntax 2020-06-18 20:07:48 +02:00
Uwe Krüger
3b6e66db0d fmt: further fixes for string interpolation and builtin macros 2020-06-18 18:48:23 +02:00
joe-conigliaro
f526754535 docs: update wording & fix typo 2020-06-19 01:52:21 +10:00
joe-conigliaro
98a48ecfb9 docs: add sum type cast & match information 2020-06-19 01:37:41 +10:00
joe-conigliaro
812a9d646a test: fix sumtype shadow & as test 2020-06-19 01:14:53 +10:00
joe-conigliaro
198fdcf1c6 test: change sumtype var shadow and as test 2020-06-19 01:10:16 +10:00
joe-conigliaro
3533335804 test: add match sumtype var shadow and as test 2020-06-19 01:06:40 +10:00
joe-conigliaro
45239cbd62 parser/checker/gen: match shaddow cond var & as support: p2 2020-06-19 00:41:00 +10:00
joe-conigliaro
68143b7b22 parser/checker/gen: match shaddow cond var & as support: p1 2020-06-19 00:33:16 +10:00
Alexander Medvednikov
7be952605b 0.1.28 2020-06-18 15:57:53 +02:00
Alexander Medvednikov
1d28d45c5c builder: add -lpthread; x64: a+b, a-b 2020-06-18 14:14:42 +02:00
yuyi
947e8922f2 cgen: optimize the format of the generated code 2020-06-18 12:08:36 +02:00
yuyi
930c3d73c1 cgen: fix arr.insert(0, [1,2,3]) and arr.prepend([1,2,3]) 2020-06-18 12:08:11 +02:00
yuyi
b806fff90a parser: minor optimization in parse_multi_expr() 2020-06-18 01:15:17 +02:00
yuyi
3f01e2b796 cgen: fix array.insert and arr.prepend 2020-06-18 00:22:34 +02:00
Alexander Medvednikov
7056f875db x64: fix another test 2020-06-17 18:31:08 +00:00
Alexander Medvednikov
60bbad4d86 x64: fix a test 2020-06-17 20:24:39 +02:00
Alexander Medvednikov
a602673adb x64: pass variables to functions 2020-06-17 20:18:51 +02:00
Uwe Krüger
9c9f6415da fmt: more sophisticated analysis for string interpolat 2020-06-17 19:49:13 +02:00
Alexander Medvednikov
325a7c7ec5 orm: more fixes and tests 2020-06-17 14:29:44 +02:00
Alexander Medvednikov
6066414afa orm: select many 2020-06-17 14:18:32 +02:00
joe-conigliaro
effa0061e8 parser: fix incorrect duplicate struct attr error 2020-06-17 20:27:51 +10:00
Swastik Baranwal
0052ab71e9 string: add map method 2020-06-17 12:26:55 +02:00
sudo-nice
5749add670 doc: helping V to determine an array type 2020-06-17 12:03:09 +02:00
Alexander Medvednikov
fb5cae7376 orm: select where id = x 2020-06-17 04:05:20 +02:00
Uwe Krüger
ddb1770af2 cgen: fix unsigned/signed integer comparisons 2020-06-17 02:54:27 +02:00
granbestiapop
02f9b5d0e4 examples: concurrency examples 2020-06-17 02:34:16 +02:00
Alexander Medvednikov
88654ad81b orm: use the new optionals 2020-06-17 01:56:50 +02:00
Alexander Medvednikov
ed58192e4c v orm: select 2020-06-17 00:59:37 +02:00
yuyi
23993d2264 cgen: fix nested array equality error 2020-06-16 18:40:32 +02:00
joe-conigliaro
d478b44915 parser/checker/gen: merge AssignExpr & AssignStmt into just AssignStmt 2020-06-16 21:20:16 +10:00
Alexander Medvednikov
651a203ecb examples: fix sqlite.v 2020-06-16 12:27:47 +02:00
Alexander Medvednikov
9d6b402df0 test: fix sqlite_test.v 2020-06-16 12:23:52 +02:00
Alexander Medvednikov
e8f8defc3e ast: SqlExpr 2020-06-16 12:14:22 +02:00
yuyi
2daf915371 parser: expression evaluated but not used error 2020-06-16 11:06:53 +02:00
Uwe Krüger
f2d9fa3815 cgen: restructure string_inter_literal() 2020-06-16 10:41:51 +02:00
Alexander Medvednikov
015d0c5e33 ci: disable linux cross compilation test for now 2020-06-16 00:52:07 +02:00
Alexander Medvednikov
a69d8c6744 ci: fix cross-compilation test 2020-06-15 22:56:55 +02:00
Alexander Medvednikov
0273933960 ci: test cross compilation to linux on macos 2020-06-15 22:49:13 +02:00
yuyi
730f485591 test: fix test_array_init() 2020-06-15 22:31:11 +02:00
Emily Hudson
49d7a151b7 cgen: edge case for multi-returns 2020-06-15 22:30:16 +02:00
Delyan Angelov
41e0561b05 examples: add overflow protection in path_tracing.v, fix randomization 2020-06-15 19:56:19 +03:00
Delyan Angelov
62a872b8b5 vdoc: fix v doc sokol const formatting 2020-06-15 18:28:00 +03:00
joe-conigliaro
0cd9066f44 parser/cgen: multiple attributes & better errors (closes #5334) 2020-06-15 22:59:09 +10:00
Delyan Angelov
91df872c36 examples: fix unused variable warning in examples/sokol/fonts.v 2020-06-15 15:40:42 +03:00
Delyan Angelov
cadde3e9f0 vlib: fix os.exec().output usages, that may rely on trimmed lines 2020-06-15 15:38:20 +03:00
Delyan Angelov
5af6a685b8 vfmt: fix for 'File abc could not be read' bug 2020-06-15 14:42:41 +03:00
yuyi
b0138e021e cgen: fix in multi_array 2020-06-15 13:21:06 +02:00
Delyan Angelov
e73ed56231 tests: add parser/tests/, move checker_test.v=>compiler_errors_test.v 2020-06-15 10:58:34 +03:00
yuyi
2785a5bf65 checker: check return_duplicate_with_none (closes #5363) 2020-06-15 15:10:45 +10:00
Alexander Medvednikov
b93177c1a8 sokol: fullscreen linux 2020-06-14 23:36:36 +02:00
spaceface777
5f21b152a7 tcc: support tcc on Windows 2020-06-14 23:15:12 +02:00
Delyan Angelov
c874a22b3b doc: use v new instead of v create 2020-06-14 21:20:31 +03:00
yuyi
4e1a09c9f5 cgen: fix array_init temporary variable error 2020-06-14 19:09:27 +02:00
Ruofan XU
90279a7108 checker: use ++ / -- instead of += 1 / -= 1 2020-06-14 19:05:05 +02:00
Swastik Baranwal
a3a91f54a9 checker: handle !is in error messages 2020-06-14 19:03:29 +02:00
Mike 'Fuzzy' Partin
206e64d72c os: add os.uname() 2020-06-14 16:46:30 +03:00
yuyi
2ef0f15b34 string: fix contains behaviour (closes #5371) 2020-06-14 19:24:15 +10:00
yuyi
7e0197c1b8 cgen: fix in empty array 2020-06-14 10:54:10 +02:00
Adam Stankiewicz
471c931ada os: do not trim space from output of exec 2020-06-14 01:41:47 +02:00
Alexander Medvednikov
45a3d8474e cc: remove sysroot hack now that $ bug is fixed 2020-06-13 22:54:20 +02:00
Uwe Krüger
50cd0ed785 parser: fix string array initialization with interpolation 2020-06-13 22:38:10 +02:00
Alexander Medvednikov
0115c5e76c ci: bring back -autofree self test 2020-06-13 18:41:04 +02:00
Uwe Krüger
6113c4fe63 builtin: fix string interpolation for autofree 2020-06-13 18:39:17 +02:00
Alexander Medvednikov
6ce7bb4581 vweb: remove an unnecessary empty newline at the start 2020-06-13 16:59:06 +02:00
Adam Stankiewicz
f2a75d5223 test: run all tests even if some fail 2020-06-13 16:20:45 +02:00
Alexander Medvednikov
183924e2a8 cc: linux cross compilation fixes + make work with openssl 2020-06-13 16:19:19 +02:00
Adam Stankiewicz
b3fc462a78 scanner: fix parsing multiple .amp 2020-06-13 00:01:44 +02:00
Alexander Medvednikov
af27963938 string: do not free empty strings 2020-06-12 17:20:51 +00:00
Alexander Medvednikov
ca63b92d4f cgen: fix _STR 000 2020-06-12 16:55:21 +00:00
yuyi
90f07eb64a parser: fix fn attributes empty error 2020-06-12 18:27:05 +02:00
Alexander Medvednikov
0d1e5abc41 cgen: call va_end() in _str() 2020-06-12 17:33:08 +02:00
Alexander Medvednikov
7750ce5f60 time: fix relative() 2020-06-12 15:28:28 +02:00
joe-conigliaro
0838080fcd tools: add todo to gen_vc 2020-06-12 23:10:22 +10:00
Alexander Medvednikov
b13c95ea48 Revert "vweb: @include tempaltes"
This reverts commit 6b06184ef4.
2020-06-12 14:32:09 +02:00
Daniel Däschle
6b06184ef4 vweb: @include tempaltes 2020-06-12 14:30:07 +02:00
Swastik Baranwal
56ae3797dd checker: add checks and test for ~ operator 2020-06-12 12:05:20 +02:00
yuyi
b4ad174b7f array: fix multiple array.repeat index error 2020-06-12 11:42:26 +02:00
Adam Stankiewicz
827a9e221f cgen: do not double-reference anon fn 2020-06-12 10:48:44 +02:00
Delyan Angelov
0a07dc5762 Revert "_vinit: use static initialization of large const []number"
This reverts commit b306c04e99.
2020-06-12 09:57:38 +03:00
Delyan Angelov
b306c04e99 _vinit: use static initialization of large const []number 2020-06-12 09:41:32 +03:00
joe-conigliaro
0845a9b7c3 tools: update gen_vc init method 2020-06-12 16:34:19 +10:00
joe-conigliaro
438adfc2be tools: update/fix gen_vc 2020-06-12 16:22:01 +10:00
yuyi
47ffedc5de cgen: minor array_init fix 2020-06-12 02:19:48 +02:00
yuyi
ff1437fc5a cgen: fix multi_array index issue 2020-06-12 01:24:25 +02:00
Alexander Medvednikov
c9cfe9d40b vweb: @js and @css template fns 2020-06-11 20:34:59 +02:00
Alexander Medvednikov
72fdb09e46 time: relative_short(); fmt: handle $vweb.html() 2020-06-11 20:26:49 +02:00
Delyan Angelov
3bf9b28773 vlib: add fixes for problems, found by check_os_api_parity.v 2020-06-11 21:16:12 +03:00
Delyan Angelov
5ef9569098 cmd/tools: add check_os_api_parity.v - keep module APIs even 2020-06-11 21:13:36 +03:00
Delyan Angelov
05177b9dcb builder: add 'builtin' to builtin_module_parts instead of .clone() 2020-06-11 19:23:13 +03:00
Delyan Angelov
b2428290f9 builder: fix a const changing bug that prevented 2 builders 2020-06-11 18:35:41 +03:00
yuyi
a66753871d checker: check array.map/filter fn or anon_fn 2020-06-11 13:14:07 +02:00
Alexander Medvednikov
8f3f27f286 vweb: bring back @header 2020-06-11 11:13:41 +02:00
Don Alfons Nisnoni
39c5c9b966 mysql: update documentation 2020-06-11 11:07:17 +03:00
Delyan Angelov
b01709e502 doc: fix formatting 2020-06-11 08:00:14 +03:00
Delyan Angelov
6c087de837 doc: mention charptr in the primitives section too 2020-06-11 07:58:52 +03:00
Daniel Däschle
dc72d2591e vdoc: move builtin to top 2020-06-11 00:52:41 +02:00
Emily Hudson
19c3ba2f8f cgen: ensure struct has empty_struct_declaration to appease msvc 2020-06-11 00:52:06 +02:00
Alexander Medvednikov
684a443b08 cgen: disable _STR_TMP 2020-06-10 21:24:59 +00:00
spaceface777
e50706f25c jsgen: implement array map and filter 2020-06-10 22:18:20 +02:00
spaceface777
6f886dccca jsgen: initial string interpolation support 2020-06-10 20:53:43 +02:00
Daniel Däschle
123d788d0d vweb: include directive 2020-06-10 18:53:04 +02:00
Alexander Medvednikov
a2d7bc6e6f vweb: look for html templates in templates/ 2020-06-10 18:00:11 +02:00
Delyan Angelov
972f60d785 cgen: do use g.write_defer_stmts in opt()? calls 2020-06-10 18:43:23 +03:00
yuyi
b6e2495aa2 cgen: remove redundant code for array.map/filter(anon_fn) 2020-06-10 17:25:54 +02:00
Alexander Medvednikov
1254d7a302 cc: fix windows cross compiling for programs that use json 2020-06-10 17:15:24 +02:00
Emily Hudson
bf7f84d16f cgen: fix using C constants in enums, none propagation 2020-06-10 17:01:55 +02:00
Delyan Angelov
a43b8b5c96 vfmt: add maps_in_fn_args__keep.vv test for 3a369f5 2020-06-10 17:15:53 +03:00
Delyan Angelov
3a369f513c vfmt: fix table.type_to_str(), keep map[string]mod.Type in fn args 2020-06-10 17:12:55 +03:00
yuyi
acf0b84523 cgen: fix array.filter(anon_fn) 2020-06-10 13:18:59 +02:00
yuyi
12faf9fcfa cgen: fix multiple array.map(anon_fn) calls 2020-06-10 13:18:45 +02:00
Alexander Medvednikov
a130d3cd14 vweb: fix unused var warning 2020-06-10 12:17:49 +02:00
Alexander Medvednikov
deddc71720 examples: fix vweb_assets.v 2020-06-10 12:05:35 +02:00
Alexander Medvednikov
b904d7d1ba vweb: debug prints behind $if debug 2020-06-10 11:50:06 +02:00
Alexander Medvednikov
931bba1d7d net: fix windows urlmon flag 2020-06-10 11:25:41 +02:00
Alexander Medvednikov
c261ac4f46 net: fix windows headers 2020-06-10 11:24:37 +02:00
Alexander Medvednikov
2ed4457c5f vweb: init_once() 2020-06-10 11:24:36 +02:00
Tomas Hellström
2dc547a45c time: fix iso8601 parser and utc time 2020-06-10 11:14:55 +02:00
Ned Palacios
8f9f426479 vdoc: plaintext fixes 2020-06-10 11:14:03 +02:00
Ned Palacios
e3c40f1df8 vdoc: minor css fix + add error message 2020-06-10 11:13:42 +02:00
joe-conigliaro
e38a221dc3 checker: fix second use of gloabl ident 2020-06-10 16:59:31 +10:00
Alexander Medvednikov
4a7ec90bef vweb: fix a bug with <span> 2020-06-10 01:43:04 +02:00
Alexander Medvednikov
e5aba94ae4 vweb: use state enum 2020-06-09 23:20:51 +02:00
Alexander Medvednikov
4fdb33bb0a doc: make attrs more clear 2020-06-09 23:04:46 +02:00
Alexander Medvednikov
66696e1329 doc: [inline] 2020-06-09 22:49:40 +02:00
Alexander Medvednikov
3f6c3edd19 doc: minor fixes 2020-06-09 22:47:41 +02:00
Alexander Medvednikov
b9bd296adc doc: attributes 2020-06-09 22:40:36 +02:00
joe-conigliaro
3664bea912 vweb/checker: show tmpl var errors 2020-06-10 02:47:51 +10:00
Delyan Angelov
e8e205284c doc: update performance tuning section 2020-06-09 19:09:41 +03:00
Delyan Angelov
b3e0827f58 ci: change periodic.yml to also install valgrind too 2020-06-09 19:02:57 +03:00
Delyan Angelov
4fc41c4bc4 v: add compiler support for _unlikely_(x) too 2020-06-09 18:11:03 +03: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
Hungry Blue Dev
e649cf84e3 rand: reorganize: phase 2 2020-06-09 15:06:07 +02:00
Alexander Medvednikov
67fcce2d46 readme: glfw is no longer needed 2020-06-09 14:45:55 +02:00
yuyi
85c741519b cgen: fix array.map(fn...) 2020-06-09 12:50:56 +02:00
Alexander Medvednikov
b3e416fb52 vweb: fix duplicate fn error with multiple templates 2020-06-09 12:43:20 +02:00
yuyi
1396dc1c89 cgen: remove extra blank lines 2020-06-09 12:23:08 +02:00
Alexander Medvednikov
3b8f01b4fb sokol: remove duplicate #include ft2build.h 2020-06-09 12:21:35 +02:00
joe-conigliaro
62c80bc2c5 parser: add mod list to allow globals by default 2020-06-09 18:49:15 +10:00
Alexander Medvednikov
82e6628659 fontstash: use freetype only on non-Windows systems 2020-06-09 10:17:09 +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
spaceface777
895c7624e4 jsgen: improve handling of blank_ident 2020-06-09 09:45:50 +02:00
joe-conigliaro
2799a6f065 parser/checker: fix global lookup 2020-06-09 17:08:11 +10:00
Delyan Angelov
c6573f9005 ci: change periodic.yml to use cc in the ubuntu job. 2020-06-09 09:49:23 +03:00
Delyan Angelov
99f311cc5f checker: protect against stackoverflows due to deep expr recursion 2020-06-08 20:35:33 +03:00
spaceface777
30f1c6bad5 parser: fix type_only fns starting with varargs 2020-06-08 19:02:36 +02:00
wilesun
564545d20a cgen: add defered statements before propagating option returns 2020-06-08 18:50:23 +03:00
Adam Stankiewicz
b4dbf9cacf table: remove name from MultiReturn type 2020-06-08 15:40:40 +02:00
Lukas Neubert
0c1d3ffbfe doc: add missing links to ToC 2020-06-08 15:39:35 +02:00
Adam Stankiewicz
586a886975 table: add tests and improve performance 2020-06-08 15:36:59 +02:00
Daniel Däschle
09fa0f1540 vdoc: mobile fixes 2020-06-08 15:32:21 +02:00
Louis Schmieder
d3839b5d68 glm: improve matrix mult function and add tests 2020-06-08 15:31:55 +02:00
Delyan Angelov
b6dc2d9106 vup: support -v 2020-06-08 14:49:16 +03:00
Alexander Medvednikov
1bbfc271c5 vweb: fix unused tmpl warning; remove duplicate code 2020-06-08 13:30:42 +02:00
Daniel Däschle
808975fc86 vdoc: fix toc scrolling 2020-06-08 13:12:07 +02:00
Daniel Däschle
344e9b440a vdoc: fix code formatting 2020-06-08 13:11:55 +02:00
Alexander Medvednikov
dabfc4ebd0 checker: do not display errors for incorrectly initialized vars 2020-06-08 13:10:47 +02:00
Alexander Medvednikov
288a6ee468 vweb: minor tmpl fixes 2020-06-08 12:44:38 +02:00
Delyan Angelov
6f8e91e3a5 ci: fix ubuntu-tcc 2020-06-08 11:51:19 +03:00
yuyi
d4ddfa7e86 vrepl: make work with paths with spaces 2020-06-08 10:29:51 +02:00
Ned Palacios
721a3a24ae vdoc: minor features + fixes 2020-06-08 10:28:46 +02:00
Delyan Angelov
6c9b2b8303 builtin: use tcc_backtrace for tcc (phase 2) 2020-06-08 10:46:51 +03:00
Delyan Angelov
8a16086084 builder: pass -bt10 for tcc (phase 1 for using tcc_backtrace) 2020-06-08 10:40:01 +03:00
Ryan Willis
08814d6de4 tools/vsymlink: use the win32 api to update the system environment 2020-06-08 09:19:31 +02:00
Delyan Angelov
0058b8253d vdoc: fix 'module, comment, import' sequence bug 2020-06-08 09:27:22 +03:00
Enzo Baldisserri
11b7b97311 parser: fail when assigning to _ with := 2020-06-08 00:47:04 +02:00
Ned Palacios
36edd6295f vlib: transfer intro to readme; normalize comments 2020-06-08 00:04:23 +03:00
Daniel Däschle
a530c52b2d vdoc: scroll indicator 2020-06-07 23:01:44 +02:00
Louis Schmieder
2cad6db9f7 http: fix redirect for servers returning lowercase 'location:' header 2020-06-08 00:01:20 +03:00
JalonSolov
8c8df66986 vup: make 'v up' work from release archive, without a .git folder 2020-06-07 23:59:15 +03:00
Alexander Medvednikov
3bbda7103f Revert "parser: allow void return type for C functions"
This reverts commit d7c63922d5.
2020-06-07 19:06:19 +02:00
Alexander Medvednikov
30ade1d6ea tests: test more vweb template features 2020-06-07 19:06:07 +02:00
Swastik Baranwal
d7c63922d5 parser: allow void return type for C functions 2020-06-07 19:45:27 +03:00
Delyan Angelov
add4d391cb ci: disable orm_test.v on windows and musl (it requires pg to be installed) 2020-06-07 18:51:28 +03:00
Delyan Angelov
2b6ba63a55 ci: fix tests (most CI jobs do not have pg set up) 2020-06-07 18:08:31 +03:00
Alexander Medvednikov
e029044b13 pg: fix compilation 2020-06-07 16:05:44 +02:00
Alexander Medvednikov
931cf86cc3 tests: build vweb example 2020-06-07 15:44:33 +02:00
Alexander Medvednikov
8277c976a8 gg: draw_image,draw_rounded_rect placeholder fns 2020-06-07 15:20:42 +02:00
Tomas Hellström
9c8769503f time: add microsecond precision to Time struct 2020-06-07 16:19:09 +03:00
Lukas Neubert
eec5cf1eb1 vpm: use only -v for verbose output 2020-06-07 14:20:56 +02:00
joe-conigliaro
70c18fc7b2 vweb: tmpl access to action method vars 2020-06-07 21:26:47 +10:00
Ned Palacios
cbcdc8434f vdoc: group constants + minor fixes 2020-06-07 12:27:42 +02:00
joe-conigliaro
1c2bf7b244 vweb: impl of comptime tmpl parsing (fix vweb_example) 2020-06-07 20:26:45 +10:00
Delyan Angelov
013bfc7ebc vweb: add vweb.run_app(app,port); fix compilation of vweb_assets/main.v 2020-06-07 11:02:35 +03:00
Daniel Däschle
caa25a3150 vdoc: fix horizontal scrollbar 2020-06-07 01:24:12 +02:00
Daniel Däschle
eb42d2220f vdoc: adds missing color tags; change design of footer 2020-06-07 01:23:56 +02:00
Sumeet Chhetri
442030a7c8 picoev: make compile, add header parsing 2020-06-07 01:23:30 +02:00
Alexander Medvednikov
d62d0c40d2 parser: fix typo 2020-06-06 21:36:55 +02:00
Alexander Medvednikov
4d5ac1e16d vweb: $html 2020-06-06 21:36:34 +02:00
Delyan Angelov
16bf300934 os: fix compilation with -cc gcc -prod of programs using os.cp 2020-06-06 22:05:23 +03:00
Delyan Angelov
e534f8507b vlib: minor tweaks for various module imports, needed for vdoc 2020-06-06 19:14:10 +03:00
Delyan Angelov
8d3f680d07 vdoc: implement .toplevel_comments parsing mode 2020-06-06 19:05:26 +03:00
Delyan Angelov
3aecdeab63 os,gl,sync: cleanup, prepare for .toplevel_comments vdoc mode 2020-06-06 18:47:25 +03:00
Daniel Däschle
32463e94f5 vdoc: help 2020-06-06 17:41:44 +02:00
Alexander Medvednikov
fb6be080fb fmt: fix compilation 2020-06-06 16:52:41 +02:00
Daniel Däschle
7a5f008042 vdoc: normalize to its own file, menu open by default, remove prism css 2020-06-06 16:12:07 +02:00
Alexander Medvednikov
2770077cb0 fmt: x.foo!() experiment 2020-06-06 16:05:24 +02:00
Ned Palacios
e5f12ad74a vdoc: multiple fixes 2020-06-06 14:31:26 +02:00
Alexander Medvednikov
40bd1be85f parser: fix ! 2020-06-06 12:43:35 +02:00
Alexander Medvednikov
100b3986b8 parser: handle ! after CallExpr 2020-06-06 12:28:03 +02:00
joe-conigliaro
34af7ccba9 scanner: cut keyword lookups in half 2020-06-06 19:49:50 +10:00
Ned Palacios
a19aaf2b90 vdoc: add footer, improve accessibility and highlighting 2020-06-06 10:43:50 +02:00
Alexander Medvednikov
7815c5b108 cgen: $action (ComptimeCall); vweb: hello world works! 2020-06-06 10:05:26 +02:00
joe-conigliaro
0a3486b4c5 checker: generic/vewb fix 2020-06-06 17:06:11 +10:00
Ned Palacios
c1ccd56119 vdoc: native syntax highlighting, system font, and intergrate normalize.css 2020-06-06 07:56:17 +02:00
joe-conigliaro
c2fe4ffa85 table: remove fn to set idx & add new derive fn 2020-06-06 12:51:36 +10:00
joe-conigliaro
31d03bb113 checker/cgen: small generic fixes (mut arg return) 2020-06-06 12:24:27 +10:00
Uwe Krüger
de76ac583f parser: fix string interpolation for expressions ending c, r, js 2020-06-05 22:37:34 +02:00
Alexander Medvednikov
11908410f3 vweb: make compile 2020-06-05 21:04:18 +02:00
Alexander Medvednikov
e3917d98c2 generics: another mut arg test 2020-06-05 20:57:05 +02:00
sandrochuber
073d9f3179 docs: fix small typo 2020-06-05 16:23:24 +02:00
Louis Schmieder
5c74e86ec4 gl: add comments & clean up 2020-06-05 15:57:45 +02:00
sudo-nice
ec984bcc0c vdoc: replace hardcoded v with @VEXE 2020-06-05 15:57:16 +02:00
Alexander Medvednikov
3478430762 gg: borderless windows on macos without animation 2020-06-05 15:43:47 +02:00
Don Alfons Nisnoni
44442223a2 vdoc: make vexe_path a const 2020-06-05 14:22:50 +02:00
Daniel Däschle
0aadde2673 vdoc: add syntax highlighting 2020-06-05 12:08:22 +02:00
Delyan Angelov
c1fc61200c gg: support .keydown_fn and .char_fn in addition to .event_fn 2020-06-05 12:39:06 +03:00
joe-conigliaro
3c4e4d4825 gen/checker: copy ptr & flag info in unwrap_generic 2020-06-05 18:41:15 +10:00
Ned Palacios
30e0bda434 vdoc: rewrite usage, add new options + streamline process 2020-06-05 09:59:26 +02:00
yuyi
c9b395f9cf checker: fix for_in_index type error 2020-06-05 09:44:25 +02:00
yuyi
ef46fbb96f cgen: clean up ternary 2020-06-05 08:30:03 +02:00
Delyan Angelov
24b263cf87 vid: bring back scale field to gg.Config, fixes vid compilation 2020-06-05 08:48:31 +03:00
Delyan Angelov
2237968ec1 gg: fix x11 scaling 2020-06-05 08:19:34 +03:00
Alexander Medvednikov
e7f52ebed6 gg/ft: minor Sokol fixes 2020-06-04 23:51:59 +02:00
Daniel Däschle
d0f9bdf85e vdoc: style and other improvements 2020-06-04 23:50:59 +02:00
Daniel Däschle
6118875ee3 vweb: add tmpl api to compile either file or a string 2020-06-04 22:30:25 +02:00
Alexander Medvednikov
13a7ce9e69 gg: GG => Context 2020-06-04 20:26:18 +02:00
Alexander Medvednikov
926ffc8aa9 freetype: use old gg 2020-06-04 20:18:22 +02:00
Alexander Medvednikov
fb7ca56d87 gg: minor fixes 2020-06-04 19:57:16 +02:00
Uwe Krüger
cf9498ef6b cgen: use standard checks for float comparisons 2020-06-04 19:47:41 +02:00
Alexander Medvednikov
42e314d281 examples: skip live gg examples for now 2020-06-04 19:14:24 +02:00
Alexander Medvednikov
c4a6ba76a1 examples: fix bounce.v; clean up tetris.v 2020-06-04 16:53:21 +02:00
joe-conigliaro
1c43204224 table: remove extra parens & inline fn 2020-06-05 00:28:34 +10:00
Alexander Medvednikov
e2976b70dc readme: minor clean up 2020-06-04 16:21:59 +02:00
Alexander Medvednikov
6b6c9d6738 gg: make the Sokol based gg the default 2020-06-04 16:05:15 +02:00
yuyi
dd7ebf7fac parser: check function argument mutable syntax 2020-06-04 15:20:43 +02:00
joe-conigliaro
edd56bc080 table: allow type hold 8 flags at once 2020-06-04 22:38:54 +10:00
yuyi
2230cbae01 make.bat: add `-local flag 2020-06-04 14:07:02 +02:00
Alexander Medvednikov
6081e0d602 ci: bring back v ui build 2020-06-04 12:28:03 +02:00
Alexander Medvednikov
277b7b35d0 cgen: write_fn_attr() 2020-06-04 12:20:14 +02:00
joe-conigliaro
41dca3ef58 checker/cgen: fix mutable generic fn args 2020-06-04 19:32:31 +10:00
yuyi
8a24d7d723 checker: optional return fix 2020-06-04 10:40:32 +02:00
yuyi
5ae8853648 all: change f mut Foo to mut f Foo 2020-06-04 10:35:40 +02:00
Delyan Angelov
0b7fe0a9d0 gg2: add the rest of the sokol callbacks in gg.new_context 2020-06-04 09:48:49 +03:00
Delyan Angelov
576e80b3a9 tetris: restore text rendering with gg2.ft.draw_text 2020-06-03 23:09:34 +03:00
Delyan Angelov
e91642e615 tetris: more accurate fps counters on -d showfps 2020-06-03 19:52:48 +03:00
Swastik Baranwal
d286f67220 parser: update check for non mut types in fn 2020-06-03 18:47:18 +03:00
yuyi
962bbf1c60 fmt: fix ?void format error, add _keep.vv test 2020-06-03 18:45:40 +03:00
yuyi
ffafeac0f8 cgen: optimize gen c code format 2020-06-03 18:24:08 +03:00
Leah Lundqvist
5e2a6ffe65 jsgen: small fix - remove trailing comma in export 2020-06-03 17:30:43 +03:00
Delyan Angelov
8a23cfc0d6 tetris: support instant drop key, add +FPS counter on -d showfps 2020-06-03 16:45:26 +03:00
pancake
e9bcd36d5e builtin: implement generic break_if_debugger_attached() 2020-06-03 14:11:23 +02:00
yuyi
13e09c61ef tests: add multi_dimensional array init tests 2020-06-03 14:10:29 +02:00
scrungofan
439973004a readme: update date 2020-06-03 13:07:25 +02:00
yuyi
1060de88af parser: fix function mutable argument error 2020-06-03 12:28:16 +02:00
Delyan Angelov
dbef9f9c0b v.mod: add repo_url attribute too 2020-06-03 11:58:14 +03:00
spaceface777
4b7c70caca parser: fix JS functions starting with caps 2020-06-03 10:57:32 +02:00
Alexander Medvednikov
d182059ba6 tests: fix fn_test.v 2020-06-03 10:54:47 +02:00
Alexander Medvednikov
00978da2c4 checker: fix mut int test 2020-06-03 10:45:19 +02:00
Alexander Medvednikov
888a43a684 checker: fix mut int test 2020-06-03 10:40:41 +02:00
Alexander Medvednikov
199f4f006b checker: fix mut int check 2020-06-03 10:36:56 +02:00
Delyan Angelov
6a0a2da05c cgen: support $if test { ... } 2020-06-03 10:20:10 +03:00
Alexander Medvednikov
99c70cf9c6 pref: do not allow -o .v 2020-06-03 09:03:46 +02:00
Mike 'Fuzzy' Partin
ac0fee8e64 repl: fix BSDs 2020-06-03 08:44:44 +03:00
yuyi
d0ff9a7c4a parser: correct fn arg position in error message 2020-06-03 08:42:02 +03:00
Delyan Angelov
845084c89d strconv: fix format_dec example 2020-06-03 01:30:46 +03:00
Delyan Angelov
2596b0c612 vdoc: enable printing README.md on stdout too 2020-06-02 23:56:33 +03:00
Alexander Medvednikov
63b8cdea7a checker: require () in a && b || c 2020-06-02 22:21:44 +02:00
Delyan Angelov
0a84f0feb5 vdoc: prevent infinite recursion in get_parent_mod 2020-06-02 23:14:46 +03:00
Alexander Medvednikov
69df472adc ci: build examples on linux 2020-06-02 20:16:32 +02:00
Alexander Medvednikov
7496c1be2a examples: fix remaining examples and add them to CI 2020-06-02 19:47:28 +02:00
Eric Crook
9aa9ea7e2e doc: use vfmt -w 2020-06-02 19:26:16 +02:00
Delyan Angelov
93c44a2199 examples: fix compilation of path_tracing.v 2020-06-02 19:29:27 +03:00
yuyi
f1f4e380a2 make: optimize Makefile 2020-06-02 19:11:58 +03:00
yuyi
1386c5df13 parser: use ? instead of ?void errpr 2020-06-02 17:24:24 +02:00
Uwe Krüger
b0f66a4e05 checker: permit int -> f32, int64 -> f64 and similar promotions again 2020-06-02 17:00:14 +02:00
Alexander Medvednikov
640688d8cf vdoc: fmt doc/doc.v 2020-06-02 16:19:55 +02:00
Alexander Medvednikov
fb3e52ca63 all: !is operator 2020-06-02 16:18:12 +02:00
Alexander Medvednikov
4e51867612 make v build-examples work: part 1 2020-06-02 16:09:41 +02:00
Alexander Medvednikov
78f8a8aee6 cgen: remove g_ hack 2020-06-02 15:49:43 +02:00
Alexander Medvednikov
1139d3b458 gg: move text rendering to gg.ft 2020-06-02 15:35:41 +02:00
yuyi
653a27005b cgen: fix multi dimensional array init error 2020-06-02 15:15:52 +02:00
Delyan Angelov
3521c9045b vpm: change hardcoded ~/.vmodules/ (does not work on windows) 2020-06-02 14:36:49 +03:00
Ned Palacios
b99ba21ddd vdoc: markdown, html, json generation + lots of fixes 2020-06-02 12:10:01 +02:00
Emily Hudson
46dbbd0ed0 json: add enum to json_test to prevent regressions 2020-06-02 12:13:26 +03:00
yuyi
63b2d4be99 cgen: make >8 indent levels work 2020-06-02 10:40:24 +02:00
Alexander Medvednikov
ad8ed851d0 examples: make tetris compile 2020-06-02 09:38:42 +02:00
Alexander Medvednikov
138d730dfa checker: prepare for the is_changed check 2020-06-02 09:00:51 +02:00
Ned Palacios
9fcb8536e8 fmt: fix struct decl gen with c structs 2020-06-02 07:41:02 +02:00
ka-weihe
13c68eb81e rand: fix warnings 2020-06-02 06:39:38 +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
Hungry Blue Dev
a7c84834f4 rand: reorganize (step 1) 2020-06-01 21:13:56 +02:00
Naheel
4fcabb71c4 os: implement cp for nix 2020-06-01 21:11:40 +02:00
Mike 'Fuzzy' Partin
a24bf80228 cmd/v: remove -vv and -vvv from help 2020-06-01 20:15:44 +02:00
Delyan Angelov
4956ca62e3 websocket: move .nonce_size to pub mut: 2020-06-01 20:37:24 +03:00
Delyan Angelov
328a235f94 websocket: add Client.nonce_size field 2020-06-01 20:31:58 +03:00
Emily Hudson
0c7bac4ba7 json: fix enums and byte, cleanup 2020-06-01 19:36:07 +03:00
Delyan Angelov
776c57a478 ci: disable ui examples job for macos too 2020-06-01 19:29:49 +03:00
Delyan Angelov
16cddbf097 ci: disable Vid job for now on macos 2020-06-01 19:15:51 +03:00
Delyan Angelov
6161392648 json: do not generate comptime encode/decode functions already defined in json_primitives.v 2020-06-01 19:04:17 +03:00
Delyan Angelov
c6a7d0a3a0 tests: update the remaining erroring tests, CI should be green now 2020-06-01 18:30:26 +03:00
Delyan Angelov
ae8f7cf569 tests: fix some tests, that failed due to the stricter immutable checks 2020-06-01 18:24:38 +03:00
Delyan Angelov
86862d6a94 checker: remove mod_file_cacher exception 2020-06-01 17:43:03 +03:00
Alexander Medvednikov
3d83934caf checker: check mutating methods; generics fixes 2020-06-01 15:44:10 +02:00
Delyan Angelov
945439dab6 cgen: print actual values on a failed assert (when possible) 2020-06-01 14:43:38 +03:00
Alexander Medvednikov
39bd058acf examples: tetris: remove GLFW dependency 2020-06-01 13:04:46 +02:00
Alexander Medvednikov
9bcbb3868f gg: migrate to sokol; examples: update tetris 2020-06-01 12:57:08 +02:00
Don Alfons Nisnoni
37e3cc0e72 mysql: simplify, add more functionality & documentation 2020-06-01 11:26:39 +02:00
Delyan Angelov
97b9ce04a4 crypto.rand: cleanup test, make it less likely to fail in CI 2020-06-01 07:49:52 +03:00
spaceface777
11e6734912 jsgen: more fixes and improvements 2020-05-31 20:48:31 +02:00
Delyan Angelov
d7bb887c2a vpm: fix v update for offical v modules too, like ui or markdown 2020-05-31 19:18:24 +03:00
pancake
304258162c cgen: when building a shared library, make vinit() a constructor 2020-05-31 17:27:23 +02:00
Mike 'Fuzzy' Partin
411868a43a util: add gdiff to the list of diff utilities to support bsd systems 2020-05-31 17:01:31 +02:00
Alexander Medvednikov
a5ddb613fb builder: linux cross compilation 2020-05-31 15:09:07 +02:00
Delyan Angelov
f1f6fb1a9f json: fix f32 is not struct 2020-05-31 14:17:20 +03:00
Uwe Krüger
faf3248e98 checker: check types for bitwise right shift 2020-05-31 12:58:13 +02:00
Emily Hudson
75eac291ac all: variable sized options 2020-05-31 12:57:26 +02:00
Delyan Angelov
3a36ed3802 doc: fix broken markdown about v symlink 2020-05-31 12:16:09 +03:00
Alexander Medvednikov
bfb926a544 doc: minor clean up 2020-05-31 11:12:37 +02:00
Alexander Medvednikov
f87e872fa2 checker/cgen: interface match 2020-05-31 10:22:21 +02:00
Delyan Angelov
c4241f90e6 docs: fix typo 2020-05-31 09:02:27 +03:00
Delyan Angelov
b17e10c72e docs: mention v run and v symlink earlier 2020-05-31 08:56:50 +03:00
Delyan Angelov
bb9d268bd9 fmt: add struct init keep test, fix another &&Foo bug 2020-05-30 22:34:57 +03:00
Alexander Medvednikov
905f844b16 cgen: return interface fix 2020-05-30 20:18:03 +02:00
Alexander Medvednikov
1ca7a607d3 checker/cgen: return interfaces 2020-05-30 19:54:16 +02:00
Uwe Krüger
b74e1bb05d checker: fix type mismatch in function argument for struct reference init 2020-05-30 15:42:12 +02:00
Emily Hudson
a4de507c6d cgen: panic on assertion failed outside tests 2020-05-30 13:19:52 +02:00
Alexander Medvednikov
dd34e65398 gg: sokol fixes and text rendering benchmark 2020-05-30 12:52:27 +02:00
Delyan Angelov
f9cb0d443b builder: improve suggestion on a w64 cross compile fail on linux 2020-05-30 13:49:03 +03:00
Delyan Angelov
d148920b54 v.util: prepare CI for the external markdown module (needed for vdoc) 2020-05-30 11:06:16 +03:00
JalonSolov
b7dc5b2f7b stopwatch: auto_start option, make pause cumulative 2020-05-30 10:20:54 +03:00
Delyan Angelov
077e06b44e fmt: fix struct field default expressions and tags 2020-05-29 21:22:27 +03:00
yuyi
1e504fb388 parser: check undefined variable of assign_expr 2020-05-29 17:38:40 +02:00
Delyan Angelov
f3c5f36317 parser: allow for struct Abc { f [skip] = -1 } 2020-05-29 12:45:54 +03:00
Pradeep Verghese
b52c98ac43 examples: fix compilation of game_of_life due to type mismatch 2020-05-29 09:45:20 +03:00
Delyan Angelov
0970e61350 repl: fix exiting raw mode by reverting da9b3d8
This reverts commit da9b3d82d2.
2020-05-29 09:03:55 +03:00
Alexander Medvednikov
1c11ac9fdf checker: make sure is is only used with interfaces and sum types 2020-05-29 06:46:01 +02:00
Pradeep Verghese
4b362862ad examples: spectral: minor fixes 2020-05-29 06:41:56 +02:00
yuyi
3a340cbffc checker: fix array_init cast type error 2020-05-29 06:39:46 +02:00
Alexander Medvednikov
bec3e07635 interfaces: fix is 2020-05-29 05:54:53 +02:00
pancake
b3f2c629c6 builder: use .dylib for -shared builds in macOS 2020-05-29 04:52:19 +02:00
sudo-nice
104c278216 vup: replace hardcoded v with $vexe 2020-05-29 04:42:19 +02:00
Alexander Medvednikov
39925b8dac live: simplify elog() 2020-05-29 04:42:02 +02:00
Alexander Medvednikov
96fb7901b3 live: fix reloader.v 2020-05-29 04:36:08 +02:00
Alexander Medvednikov
81b44dc2c9 generics: generic call inside generic call; checker: check mut args at call 2020-05-29 04:30:00 +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
Miller
a849d46e3f doc: fix line breaks to make it 80 characters / line 2020-05-29 03:05:04 +02:00
Tim Basel
7e538d7401 utils: add args to launch_tool 2020-05-28 19:40:09 +03:00
yuyi
28ffe2a6ee checker: add error for struct fields of type []unknown 2020-05-28 19:38:53 +03:00
spaceface777
60716bba29 parser: fix nested array_init syntax 2020-05-28 19:36:57 +03:00
pancake
1d78914a8f parser: support @VROOT in #include too, make it use absolute paths 2020-05-28 19:36:04 +03:00
Delyan Angelov
75b8822f06 scanner: prevent infinite looping, when reaching .eof due to parser bugs 2020-05-28 19:22:11 +03:00
Delyan Angelov
d70cd81875 v.pref: remove 'setting pref.path to ...' when given -v 2020-05-28 18:41:26 +03:00
Matt Baulch
da9b3d82d2 readline: fix stack memory leak on Linux 2020-05-28 15:38:20 +02:00
Alexander Medvednikov
9609b3a9c8 checker: make the method warning an error 2020-05-28 15:30:54 +02:00
Alexander Medvednikov
01dbb25a37 checker: do not allow defining methods on types from other modules 2020-05-28 15:23:20 +02:00
Leah Lundqvist
1d0ebfb691 jsgen: add hash statement 2020-05-28 14:38:10 +02:00
pancake
2943bdc1f6 cgen: add support for $if (mach|darwin|hpux|gnu|qnx|bsd) 2020-05-28 13:33:12 +02:00
Tim Basel
d688d356a7 cli: assign parent by default; add disable_flag 2020-05-28 13:32:43 +02:00
yuyi
977eb895e8 checker: check array init's element type 2020-05-28 13:32:12 +02:00
Ethan Reynolds
6da1d3aff8 gx: convert Color values from int to byte and expand operators 2020-05-28 13:21:20 +02:00
Matt Baulch
c7501e2d3d os: fix build issue caused by fileno on *BSD 2020-05-28 11:08:59 +02:00
Delyan Angelov
a3bd8d3e4c cgen: add trace info about auto str generation 2020-05-28 10:36:29 +03:00
Delyan Angelov
55ef117531 cgen: fix for V structs fields (auto str and json_decode) 2020-05-28 09:55:37 +03:00
Ned Palacios
94f23d96e9 vfmt: fix generation on C idents, fixed arrays 2020-05-28 08:06:20 +02:00
Alexander Medvednikov
d6037cbcf2 generics: fix method calls 2020-05-28 05:58:19 +02:00
Delyan Angelov
ae8cc2f433 live: fix -live compilation && make live_test.v not swallow segfault errors 2020-05-28 03:21:49 +03:00
yuyi
9cbd9db4e7 cgen: fix swap assign of prefix and postfix expr 2020-05-28 02:22:09 +03:00
div72
cecb7d29c7 Prevent vfmt from appending the module name to FnTypeDecl inside the same module (#5080) 2020-05-28 02:19:24 +03:00
Alexander Medvednikov
4988d340b1 generics: fix method calls 2020-05-28 01:19:08 +02:00
Hungry Blue Dev
e89ae7e194 rand: refactor rand.v and random_numbers_test.v 2020-05-28 02:16:17 +03:00
Delyan Angelov
04ca7efc0c websocket: fix compilation of client.v 2020-05-28 01:38:54 +03:00
Delyan Angelov
f6bdb3ae81 v.vmod: cleanup vmod.mod_file_cacher API 2020-05-28 01:38:11 +03:00
Delyan Angelov
2046ae78df builder: improve redefinition of function messages 2020-05-28 00:56:28 +03:00
Delyan Angelov
0292666ac1 builder: use verror instead of panic when a _test.v file does not exist 2020-05-27 21:38:09 +03:00
div72
48cc8dd86b rand: cleanup of rand_f32xxx and rand_f64xxx functions 2020-05-27 20:13:57 +03:00
yuyi
84edbd83da all: fix struct names error 2020-05-27 19:12:34 +03:00
Alexander Medvednikov
670820cc59 parser: do not allow 1 char struct names 2020-05-27 16:00:00 +02:00
Alexander Medvednikov
5423a15f46 generics: more fixes 2020-05-27 15:56:30 +02:00
Larpon
8c753ddf8d rand: add random functions for f32 and f64, [0,max] and [min,max] versions 2020-05-27 16:41:37 +03:00
Ned Palacios
e0db880791 fmt: simplify map_init 2020-05-27 16:26:45 +03:00
Delyan Angelov
a4af4f9fe7 http_test.v: comment yahoo test urls for now 2020-05-27 15:53:57 +03:00
Emily Hudson
0b64e2190f checker,cgen: unpack multi returns in return statements 2020-05-27 15:47:38 +03:00
x0r19x91
72ed673566 builtin: array: fix slice cloning 2020-05-27 14:07:03 +02:00
Larpon
6ca53d7b39 scanner: improve @FN substitution for anon functions 2020-05-27 12:05:50 +03:00
Delyan Angelov
481f103dc9 checker: make an error using non pub fns from other modules 2020-05-27 12:00:19 +03:00
Delyan Angelov
ebbf42dadb tests: add a commented test_generic_fn_with_variadics, which worked with old v 2020-05-27 08:41:12 +03:00
Alexander Medvednikov
59711d9c55 generics: test T{} 2020-05-27 06:53:52 +02:00
Uwe Krüger
013fdb8a4b checker: restrict numeric promotions to cases where no data is lost 2020-05-27 05:42:48 +02:00
Alexander Medvednikov
fc67046bac checker: fix pub fn check 2020-05-27 03:38:21 +02:00
Alexander Medvednikov
7c9279c447 vfmt: make work with comptime 2020-05-27 03:33:40 +02:00
yuyi
23c0bb600c scanner: fix vmod_file on windows 2020-05-27 03:32:39 +02:00
Alexander Medvednikov
6f7628cb67 parser: comptime call fixes 2020-05-27 03:20:25 +02:00
Ned Palacios
b02ec8cbf9 vfmt: fix raw string support 2020-05-27 03:10:47 +02:00
Delyan Angelov
3cfdd2a4cd scanner: add support for @VMOD_FILE 2020-05-26 23:39:15 +03:00
yuyi
bb48851092 cgen: fix mutliple_assign swap 2020-05-26 18:00:51 +02:00
ka-weihe
64173c792f builtin: map: fix memory leak 2020-05-26 17:59:52 +02:00
Larpon
31ba64b409 scanner: add support for @STRUCT compile time substitution 2020-05-26 15:35:11 +02:00
Julia K
285e04393e cgen: fix missing space, remove unnecessary comment 2020-05-26 16:22:28 +03:00
Delyan Angelov
ca19cec9a5 v symlink: use @echo off for v.bat 2020-05-26 15:46:03 +03:00
pancake
8d10adf886 flag: fix a typo 2020-05-26 14:27:01 +02:00
Julia K
2b27072fac compiler: new attributes, prelude customization 2020-05-26 14:12:18 +02:00
Emily Hudson
748b1d3381 cgen: use typ() for array type 2020-05-26 14:11:59 +02:00
Enzo Baldisserri
145b125155 websocket: make compile 2020-05-26 12:50:37 +02:00
Delyan Angelov
e79adc0ba1 v symlink: use a .symlink/v.bat launcher to avoid global PATH polution 2020-05-26 13:34:01 +03:00
Delyan Angelov
7585483c69 v symlink: extract to cmd/tools/vsymlink.v , use setx on windows 2020-05-26 09:30:26 +03:00
Julia K
b4eadb9030 cmd/v: reimplement -path flag 2020-05-26 03:17:52 +02:00
Alexander Medvednikov
b1bbb17254 examples: remove glfw3.dll 2020-05-26 02:11:45 +02:00
Alexander Medvednikov
b4d88ee4af checker: handle map.clone() 2020-05-26 02:09:26 +02:00
ka-weihe
8ea0c812a2 builtin: map.clone() 2020-05-26 01:52:06 +02:00
Alexander Medvednikov
d4fac6add8 ci: disable -autofree self compilation for now 2020-05-26 01:48:11 +02:00
Alexander Medvednikov
0f92800921 cgen: string buffer fix 2020-05-26 00:04:13 +02:00
Delyan Angelov
b0cfd3fa67 parser: reimplement [flag] enum support. Add p.vcodegen too 2020-05-26 00:00:48 +03:00
Delyan Angelov
5825e467b8 checker: fix appending an .enum_val to a struct field of []Enum 2020-05-25 21:48:43 +03:00
spaceface777
f8b237433f jsgen: fix array push operator 2020-05-25 19:34:42 +03:00
Larpon
09dc2eed82 scanner: add support for '@MOD' 2020-05-25 19:33:41 +03:00
Emily Hudson
bf92a8b80e make.bat: use v.exe -cc msvc self when bootstrapping with msvc 2020-05-25 19:32:33 +03:00
Delyan Angelov
2eac2a5c0c make: do not pull tcc on macs 2020-05-25 15:08:21 +03:00
Alexander Medvednikov
bc3e29e77b cgen: fix a bug with tmp strings/free 2020-05-25 11:01:21 +00:00
Alexander Medvednikov
53a10eb312 cgen: use STR_TMP with -autofree 2020-05-25 12:46:18 +02:00
pancake
fe249cd1f8 pref: fix crash in 'v run' without arguments 2020-05-25 12:30:12 +02:00
Enzo Baldisserri
d22609051a checker: CallExpr with handled optional returns plain type 2020-05-25 11:32:14 +02:00
yuyi
30ca08aaa3 parser: fix self-referenced error 2020-05-25 11:31:04 +02:00
Ned Palacios
3aeaa24df6 repl: fix for-loop/if statement duplicate printing bug 2020-05-25 11:35:55 +03:00
Delyan Angelov
96808a0e2a cgen: generalize _vcleanup of array/string consts + valgrind with tcc 2020-05-25 10:24:19 +03:00
Delyan Angelov
ae03aab03e cgen: autofree math.bits and strconv.ftoa constants 2020-05-25 09:53:30 +03:00
Delyan Angelov
6683f98eba cgen: add support for -printfn _vcleanup and -printfn _vinit 2020-05-25 09:47:00 +03:00
Alexander Medvednikov
656bc6b6c8 tests: valgrind: strings are freed now! 2020-05-25 06:23:50 +00:00
Alexander Medvednikov
f41e2c0a4b string: make replace() clone for now; parser: comptime method 2020-05-25 08:17:36 +02:00
Alexander Medvednikov
1b36d7a037 cgen: handle c++ keyword 2020-05-25 05:46:58 +02:00
Alexander Medvednikov
99ce3d456b jsgen: handle ComptimeCall 2020-05-25 05:38:47 +02:00
Alexander Medvednikov
1ef8eacd6e checker/gen: more generics fixes; ComptimeCall 2020-05-25 05:32:36 +02:00
yuyi
ec7863d174 cgen: fix array_init of struct error 2020-05-25 04:45:16 +02:00
spaceface777
4189190bb8 jsgen: start implementing remaining exprs and stmts 2020-05-24 22:49:01 +02:00
Uwe Krüger
fd4d28b7b6 tests: update for stricter type checks 2020-05-24 21:07:32 +02:00
penguindark
4e66c12557 strconv: minor fixes 2020-05-24 21:06:35 +02:00
Lukas Neubert
9315589f85 tutorials: switch to mut f Foo 2020-05-24 21:27:14 +03:00
Delyan Angelov
a0f8005352 checker: support tests/run/ folder, checks many warns/errors/output 2020-05-24 21:13:09 +03:00
Delyan Angelov
23e8c8ecda checker: prevent infinite recursion on a:=b b:=a 2020-05-24 20:55:04 +03:00
yuyi
641fe5c864 checker: fix unresolved variables error on assignments 2020-05-24 20:33:53 +03:00
Delyan Angelov
1754ba19d8 live: cleanup live_test.v output, remove 1s delay 2020-05-24 18:38:43 +03:00
Delyan Angelov
d16485c29e live: make live_test.v more robust 2020-05-24 17:45:53 +03:00
Uwe Krüger
7c4f2b535b cgen: prepare any_in, any_float on v side 2020-05-24 15:26:43 +03:00
Ned Palacios
ed7ed6262f vpm: use current folder v.mod, if no args provided in v install 2020-05-24 15:25:29 +03:00
Delyan Angelov
ddcb5f7da3 gen: fix autogenerated print methods for vargs 2020-05-24 15:05:19 +03:00
Delyan Angelov
465dc685cc repl: treat =x at the start of a new line, the same as println(x) 2020-05-24 14:16:38 +03:00
Uwe Krüger
c4fbae3edc cgen: add definitions of any_float and any_int types to cheader 2020-05-24 11:28:25 +02:00
Ned Palacios
c95a1138ba repl: fix one-line for-loop printing 2020-05-24 11:36:17 +03:00
Delyan Angelov
2adfbfc830 builtin: fix a bug in array_delete 2020-05-24 11:10:41 +03:00
Alexander Medvednikov
7963e48ca1 tests: valgrind: disable string.replace() test for now 2020-05-24 07:33:33 +00:00
Alexander Medvednikov
494f4fe986 tests: valgrind: string.replace() 2020-05-24 07:19:58 +00:00
Delyan Angelov
06540f0e91 net: fix warnings due to uppercase consts 2020-05-24 07:39:47 +03:00
Alexander Medvednikov
85d19dd253 cmd/v: error-limit 2020-05-24 04:47:51 +02:00
Alexander Medvednikov
67750c91d7 generics: lots of fixes 2020-05-24 04:43:03 +02:00
yuyi
4608898bcd checker: fix multiple assign immutable error 2020-05-23 17:30:28 +02:00
Delyan Angelov
4271eb477c cgen: disable C static fn attribute with -cg (improves backtraces) 2020-05-23 14:04:02 +03:00
Delyan Angelov
43eaec325d fmt: add keep tests for struct init, fix warnings 2020-05-23 12:05:21 +03:00
Delyan Angelov
c690c2f984 vfmt: fix formatting of struct init without a module prefix 2020-05-23 11:56:06 +03:00
Delyan Angelov
70f0115e27 options: use panic_debug() for opt()? calls in main with -cg 2020-05-23 11:43:20 +03:00
Enzo Baldisserri
801bca1ef2 compiler: propagate optional 2020-05-23 08:51:15 +02:00
Delyan Angelov
5037d9de37 vlib: remove unused uiold 2020-05-23 09:19:41 +03:00
Delyan Angelov
4af4a8f2ff fmt: fix 'import time as t', then using t.sleep_ms() . 2020-05-22 22:31:24 +03:00
Delyan Angelov
104359365f examples: fix const name warnings due to gx.White, etc... 2020-05-22 20:00:46 +03:00
Delyan Angelov
acb58a1f98 parser: add p.peek_tok3, fix for ...<a.len... 2020-05-22 19:48:47 +03:00
Don Alfons Nisnoni
de09e38d6b readme: update Troubleshooting section 2020-05-22 18:43:39 +03:00
yuyi
dda875a9c8 all: unify const names to snake_case 2020-05-22 17:36:09 +02:00
Delyan Angelov
aef751861d cgen: fix _ := []byte{init:1} 2020-05-22 18:17:20 +03:00
yuyi
b5af6d44c2 make.bat: git pull add --quiet 2020-05-22 16:42:34 +02:00
Delyan Angelov
88fa935376 builtin: fix print mem leak on windows 2020-05-22 12:18:27 +03:00
yuyi
fe0b587b1f make.bat: optimize vc download 2020-05-22 11:46:55 +03:00
Delyan Angelov
1cc52b0fae docs: update obsolete references to the compiler/ folder 2020-05-22 10:11:12 +03:00
Delyan Angelov
7a4f26ac4f compiler: use -lpthread during building v itself. 2020-05-22 08:36:56 +03:00
Alexander Medvednikov
27644333a8 tests: bring back pointers_test.v 2020-05-22 06:21:48 +02:00
penguindark
8bf290acf0 os: minor fixes 2020-05-22 06:21:11 +02:00
Alexander Medvednikov
edabd57e8a parser: use parallel only on macos for now 2020-05-22 02:45:11 +02:00
Alexander Medvednikov
1e853072dc parser: parallel parser, part 1 2020-05-22 02:23:14 +02:00
yuyi
2f171bf5d9 regex: uniform const field names to snake_case 2020-05-21 23:33:51 +02:00
Leah Lundqvist
f2ea8ca62c jsgen: class -> factory 2020-05-21 22:36:06 +02:00
Enzo Baldisserri
1633675c11 gen: fix nested or 2020-05-21 22:35:43 +02:00
Alexander Medvednikov
d3ce6fd2e7 checker: check each generic function for each type 2020-05-21 21:51:52 +02:00
Ruofan XU
b2b0461218 scanner: fix err pos related to num literal 2020-05-21 18:43:57 +02:00
Alexander Medvednikov
227f039652 vfmt: handle generic fn calls 2020-05-21 18:36:25 +02:00
Alexander Medvednikov
87d8e70d6d checker/table: generic fixes 2020-05-21 18:15:04 +02:00
Alexander Medvednikov
7e55261c17 doc: remove snake_case consts for now 2020-05-21 16:34:57 +02:00
Swastik Baranwal
bf7ab19d09 builder: do not allow importing 'builtin' module 2020-05-21 16:31:41 +02:00
Abdullah Atta
cb82ff618b jsgen: proper jsdoc for namespace 2020-05-21 16:31:07 +02:00
Maddi Kopfermann
26cb9e4b9f regex: fix spelling 2020-05-21 16:22:39 +03:00
Ruofan XU
aba09a7e4d scanner: fix err pos related to num literals 2020-05-21 16:20:36 +03:00
Abdullah Atta
9888bacad5 v: make js hello world work 2020-05-21 16:17:16 +03:00
Louis Schmieder
a9999ee10d glm: add uniform functions to gl, add matrix rotation to glm 2020-05-21 16:13:02 +03:00
yuyi
047e982318 gen: fix pointer_str_test.v 2020-05-21 15:09:35 +03:00
Delyan Angelov
0de70e8b2c vpm: handle -v as well as -verbose 2020-05-21 08:30:38 +03:00
Alexander Medvednikov
abb15275f5 checker: update a for in error test 2020-05-21 06:06:11 +02:00
Alexander Medvednikov
45c9ccfc03 tests: simple<string> generics test 2020-05-21 04:56:36 +02:00
Alexander Medvednikov
ce1a181699 all: generic functions 2020-05-21 03:58:53 +02:00
yuyi
b8c028c727 parser: fix -5.str() precedence 2020-05-20 23:26:23 +02:00
Alexander Medvednikov
cd07429cc1 rand: fix compilation on linux 2020-05-20 21:14:17 +00:00
Alexander Medvednikov
ca81442fac parser: fix a small bug with < 2020-05-20 21:47:03 +02:00
Alexander Medvednikov
82cedbaf62 fmt: fix map[string][]string; parser: allow foo<int>(10) 2020-05-20 21:40:24 +02:00
Delyan Angelov
e3a162db77 http: remove redundant consts in backend_nix.c.v 2020-05-20 21:40:29 +03:00
spaceface777
d4c1ea4bba jsgen: fix jsdoc class namespacing bug 2020-05-20 20:34:37 +02:00
Don Alfons Nisnoni
10ad5332e8 parser: improve unused imports warning 2020-05-20 20:50:27 +03:00
Delyan Angelov
9d4fe88d09 compiler: support for -color/-nocolor option overrides 2020-05-20 20:34:04 +03:00
Alexander Medvednikov
80070516fd http: set buffer size to 1536 2020-05-20 19:23:51 +02:00
Alexander Medvednikov
5d08c9d5a8 http: use bufsize const 2020-05-20 19:22:02 +02:00
Delyan Angelov
e49ca2a799 ci: update periodic.yml to use test-fixed too 2020-05-20 19:16:23 +03:00
Alexander Medvednikov
0d3f133436 parser: show location of a previously defined function 2020-05-20 17:27:37 +02:00
spaceface777
dd534fde57 jsgen: many fixes and updates 2020-05-20 16:57:42 +02:00
Louis Schmieder
a0ed1e2878 gl: add bind_attrib_location, also add gl cleanup functions 2020-05-20 16:24:37 +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
bf94b8a1ab tutorials: update import syntax 2020-05-20 15:21:30 +03:00
Delyan Angelov
6eee69f7bc http: cleanup ssl_do, enhance the detection of chunked encoding 2020-05-20 14:32:59 +03:00
Delyan Angelov
ebb3f4e402 ci: add new explict job 'install-modules', to test 'v install' 2020-05-20 12:20:13 +03:00
Delyan Angelov
ac396ea02f http: cleanup backend_nix.c.v, fixes vpm too 2020-05-20 12:04:28 +03:00
Delyan Angelov
1c2376741b http: fix redirects handling 2020-05-20 09:58:57 +03:00
Alexander Medvednikov
0a6d709ce2 http: fix recent changes; picoev: make compile 2020-05-20 05:37:03 +02:00
Sandro Martini
e137fbb1ea array: more tests of initialization 2020-05-19 19:53:47 +02:00
yuyi
b3b86ea6d7 cgen: fix array_init has len but no init error 2020-05-19 18:33:24 +02:00
spaceface777
b10df252dc all: replace is_c, is_js with language 2020-05-19 17:12:47 +02:00
yuyi
74686d0ec4 test: fix alias type errors and type_test.v 2020-05-19 15:04:51 +03:00
Ned Palacios
bd85d2fd2a vfmt: make methods and structs public, to be used in vdoc 2020-05-19 14:19:37 +03:00
spaceface777
e07869af91 builder: fix false-positive import cycle warning 2020-05-19 14:17:03 +03:00
Maddi Kopfermann
96a8eaabc5 repl: handle assigning anonymous function to a variable 2020-05-19 14:15:01 +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
Delyan Angelov
2a62f1a312 ci: check that the generated v and v.exe from v.c and v_win.c actually work 2020-05-18 22:58:53 +03:00
Uwe Krüger
2635be511f all: re-apply C++ support 2020-05-18 21:38:06 +02:00
Alexander Medvednikov
895cefe351 parser: do not allow defining methods on types from other modules 2020-05-18 20:55:22 +02:00
Alexander Medvednikov
57ea9bec30 tests: vfmt test for all vlib/v files 2020-05-18 18:43:07 +02:00
Tanel Liiv
2344c1a435 parser: fix to multi-expr 2020-05-18 18:33:27 +02:00
Alexander Medvednikov
66506673f8 ci: use -municode 2020-05-18 18:31:37 +02:00
Alexander Medvednikov
edec0b9d95 ci: use -mwindows 2020-05-18 18:20:19 +02:00
Alexander Medvednikov
803143c6bd ci: test new v.c on Windows 2020-05-18 18:18:29 +02:00
Alexander Medvednikov
b1bf5f0edc vfmt: wrap long sum type definitions 2020-05-18 18:08:32 +02:00
Delyan Angelov
e7e0da7984 ci: add new compilable-v-c-and-v-win-c job 2020-05-18 19:07:45 +03:00
Alexander Medvednikov
5c0c418818 ast: vfmt ast.v 2020-05-18 18:06:09 +02:00
Alexander Medvednikov
07a78b2843 Revert "all: C++ compiler support"
This reverts commit 9a237c3e82.
2020-05-18 17:05:48 +02:00
Alexander Medvednikov
fc900baf9e parser: a minor simplification 2020-05-18 17:02:29 +02:00
Alexander Medvednikov
90270d8791 vfmt: handle fixed size arrays 2020-05-18 16:52:12 +02:00
Uwe Krüger
9a237c3e82 all: C++ compiler support 2020-05-18 15:51:36 +02:00
Alexander Medvednikov
857276e81f vup: use v.exe 2020-05-18 15:49:26 +02:00
Alexander Medvednikov
905cf326cd make.bat: use v.exe version 2020-05-18 15:46:56 +02:00
Alexander Medvednikov
7c923ce338 make.bat: use v.exe self instead of v self 2020-05-18 15:44:13 +02:00
Alexander Medvednikov
d325cdba0d checker: fmt 2020-05-18 15:43:52 +02:00
Ned Palacios
d94d436273 table, vfmt: fix typ_to_string + some fixes to vfmt 2020-05-18 15:37:06 +02:00
yuyi
ebdfe9a9c5 doc: correct an example 2020-05-18 14:35:51 +02:00
Ned Palacios
ae3df002a2 vmod: add v.mod parser 2020-05-18 14:35:28 +02:00
Delyan Angelov
53ffee1e02 compiler: respect -showcc, -prod, -cg, when cross compiling for windows 2020-05-18 12:11:26 +03:00
Delyan Angelov
59c080be97 tools: update performance_compare.v 2020-05-18 11:46:25 +03:00
Alexander Medvednikov
4f307c1a78 checker: requre & in struct init; http: chunked encoding 2020-05-18 05:11:00 +02:00
Leah Lundqvist
88e6d987d6 js: imports and anon_fn 2020-05-17 21:39:01 +02:00
yuyi
1a990407c7 doc: fix minor typo 2020-05-17 19:24:04 +02:00
Swastik Baranwal
d697b2848a checker: more checks for in and !in 2020-05-17 17:03:32 +02:00
spaceface777
0def084932 checker: fix JS name regression 2020-05-17 16:23:09 +02:00
Alexander Medvednikov
a66eebc651 doc: clarify the short struct syntax 2020-05-17 16:15:02 +02:00
Alexander Medvednikov
89d7d937ae doc: short struct init syntax 2020-05-17 16:11:48 +02:00
Alexander Medvednikov
2de127f045 docs: structs: more info on default field values 2020-05-17 16:01:02 +02:00
Delyan Angelov
627400723c x64 gen: improve error handling for unknown nodes 2020-05-17 15:45:17 +03:00
iRedMail
4a70d2fe51 examples: fix 2 unused var warnings 2020-05-17 14:15:04 +02:00
yuyi
7f4cf08516 parser: check (mut f Foo) syntax 2020-05-17 13:51:18 +02:00
Hungry Blue Dev
b138cadbcb math.fractions: add approximation.v and tests 2020-05-17 12:00:29 +03:00
yuyi
02fb393747 test: fix vrepl and cast test errors 2020-05-17 02:13:08 +02:00
Alexander Medvednikov
81148fa2bd cmd/v: version: print only main repo hash 2020-05-16 23:52:06 +02:00
Delyan Angelov
fb27fe5379 CI: add v build-tools task to the tcc job 2020-05-17 00:14:06 +03:00
Alexander Medvednikov
8cbb9e1c1f pref: move parse_define() 2020-05-16 22:57:55 +02:00
Alexander Medvednikov
5b15b8ccc9 checker: do not allow casting strings 2020-05-16 22:52:41 +02:00
Alexander Medvednikov
6e4ae5a5e6 checker: do not allow casting strings 2020-05-16 22:48:45 +02:00
asvvvad
e245e22875 os: make exists_in_system_path function public 2020-05-16 22:46:05 +02:00
Alexander Medvednikov
0845b2cfbe builder: skip warnings; pref: move pref creation to pref.v 2020-05-16 22:45:38 +02:00
Delyan Angelov
3e4d99a0e3 vup: show the current V version after an update 2020-05-16 22:18:45 +03:00
Delyan Angelov
62cb48d252 repl: treat middle imports in a more forgiving way 2020-05-16 22:03:28 +03:00
Delyan Angelov
a3a19e899d repl: implement list and reset commands 2020-05-16 18:20:47 +00:00
yuyi
6855996cca cgen: fix array_init_with_default 2020-05-16 19:05:26 +02:00
penguindark
48659f4145 regex: small fixes, '-' minus to char classes, remove all C.printf 2020-05-16 17:11:13 +02:00
asvvvad
57dd26650c os: add new function exists_in_system_path 2020-05-16 17:10:34 +02:00
yuyi
655d9bda94 cgen: remove extra ; from if_expr 2020-05-16 17:09:57 +02:00
Enzo Baldisserri
f44a40eee0 checker: check incorrect names 2020-05-16 16:12:23 +02:00
Alexander Medvednikov
3bd88a3cc2 docs: public readonly fields 2020-05-16 15:36:19 +02:00
Swastik Baranwal
37cf46d67a checker: add more checks for modulo 2020-05-16 15:32:46 +02:00
yuyi
9b6ee8e77d cgen: array_init_with_default 2020-05-16 15:21:37 +02:00
Alexander Medvednikov
5767576deb docs: structs: clean up 2020-05-16 15:19:48 +02:00
Alexander Medvednikov
cd43258f41 docs: structs: custom default values 2020-05-16 15:17:27 +02:00
Delyan Angelov
789b75df92 cheaders: fix _MOV macro in the C case 2020-05-16 15:51:09 +03:00
Larpon
aa30549337 scanner: fill out '@FN' placeholder at compile time while scanning 2020-05-16 14:20:19 +02:00
Delyan Angelov
7a404af097 repl: detect fn/enums/struct/const/interface declarations too 2020-05-16 14:40:54 +03:00
Delyan Angelov
034bf46e4d vlib: remove unused arrays module 2020-05-16 00:20:14 +03:00
Tanel Liiv
44502a3fb2 parser: return multi expr 2020-05-15 23:14:53 +02:00
Alexander Medvednikov
7caebc5781 doc: print available modules 2020-05-15 23:09:38 +02:00
Delyan Angelov
2dbb4c2ca7 live: cleanup 2020-05-15 23:51:40 +03:00
spaceface777
7c9bb44784 parser: allow JS methods with more than 1 dot 2020-05-15 22:26:51 +02:00
Swastik Baranwal
04744a5390 string: add trim_prefix and trim_suffix 2020-05-15 19:37:14 +02:00
Delyan Angelov
5d0cc0944e parser: fix v_panic due to -pos in unused var warning (with tcc) 2020-05-15 20:11:27 +03:00
Alexander Medvednikov
c4ca6a9113 sokol: make examples compile 2020-05-15 18:55:29 +02:00
Delyan Angelov
465f0ddf60 regex: fix unused variable warnings in regex_test.v 2020-05-15 18:50:54 +03:00
spaceface777
8de6da01d6 jsgen: prefix JS keywords with 'v_' 2020-05-15 15:55:49 +02:00
yuyi
8500c8885c cgen: fix optional_void error; handle ? return type 2020-05-15 15:55:03 +02:00
Maddi Kopfermann
d73bedc1fb vrepl: fix declaring structs 2020-05-15 16:12:15 +03:00
Delyan Angelov
66cb61c242 builtin: cleanup by turning backtrace* fns to ordinary C. fns 2020-05-15 15:52:06 +03:00
Delyan Angelov
e18268e2f4 cheaders: use backtrace* stubs for both android & musl 2020-05-15 15:37:59 +03:00
Delyan Angelov
2c93deb884 builtin: bootstrap for backtrace functions cleanup 2020-05-15 15:08:42 +03:00
Lukas Neubert
0701c9f204 v.mod: correct version number 2020-05-15 13:49:08 +02:00
Swastik Baranwal
74d2ae518a docs: fix typo 2020-05-15 13:35:33 +02:00
Dario Tarantini
f7605c397a stbi: pub fields in Image 2020-05-15 13:15:04 +02:00
Enzo Baldisserri
d60233b618 cgen: simplify for in range 2020-05-14 22:22:32 +02:00
Alexander Medvednikov
0f251e9ede checker: handle json.decode correctly 2020-05-14 18:30:30 +02:00
Alexander Medvednikov
f49ef39708 checker: handle unexpected or blocks 2020-05-14 18:19:40 +02:00
Alexander Medvednikov
e5d4786371 builder: simplify C error message 2020-05-14 18:14:38 +02:00
Alexander Medvednikov
ab8264f8be docs: interfaces: is 2020-05-14 17:50:48 +02:00
Enzo Baldisserri
fd0d833e33 gen: if expressions with multiple statements 2020-05-14 17:15:25 +02:00
wilesun
2a9cbbe157 cgen: handle sizeof(C.struct) 2020-05-14 17:14:59 +02:00
yuyi
6d0b791ac8 parser: warning about unused imports 2020-05-14 17:14:24 +02:00
Alexander Medvednikov
c3fe2135a4 math.fabs 2020-05-14 16:58:20 +02:00
Alexander Medvednikov
2369a5c8c6 cgen: handle is for interfaces 2020-05-14 16:56:45 +02:00
sudo-nice
b233c24d19 doc: rename field default to init for array 2020-05-14 11:00:13 +03:00
yuyi
70b76a8e31 builder: use verror for not found modules 2020-05-14 10:59:29 +03:00
Delyan Angelov
74005b4362 vfmt: handle file paths with spaces 2020-05-14 09:07:14 +03:00
Delyan Angelov
d830620651 compiler: restore support for --enable-globals flag, and add tests. 2020-05-14 08:43:12 +03:00
Alexander Medvednikov
1cb4aa7642 builder: cross compiling for linux, part 1 2020-05-14 04:15:04 +02:00
Alexey
c86e367b74 ci: fix typo in workflow name 2020-05-13 23:13:31 +02:00
Alexander Medvednikov
e60e8f3b34 builder: bring back cross compilation for windows 2020-05-13 23:02:31 +02:00
Alexander Medvednikov
1bf26a35fa array: rename default to init 2020-05-13 22:00:24 +02:00
Alexander Medvednikov
ab7bc760c6 cgen: new Option part 1 2020-05-13 21:59:08 +02:00
Sandro Martini
9895cab51c tests: add more tests on interfaces 2020-05-13 20:30:18 +02:00
Delyan Angelov
b2e5ae9cd8 examples: fix compilation of the automaton for the game_of_life 2020-05-13 20:25:51 +03:00
Enzo Baldisserri
1ca04e6113 checker: prevent interface instantiation 2020-05-13 19:20:15 +02:00
Hungry Blue Dev
3270545953 fraction: simplify variable names 2020-05-13 18:39:19 +02:00
yuyi
2e0b9de31c parser: error for consts in fns 2020-05-13 18:39:02 +02:00
Enzo Baldisserri
172e4ff853 cgen: simplify if guard else clause 2020-05-13 18:38:00 +02:00
Alexander Medvednikov
33a9822548 parser/vfmt: handle array len and default in array init 2020-05-13 16:11:52 +02:00
Alexander Medvednikov
478ebed069 Revert "makefile: simplify and speed up"
This reverts commit c7e4f5eefb.
2020-05-13 15:33:44 +02:00
Alexander Medvednikov
c92b09d3e7 vup: run make only on breaking changes 2020-05-13 15:15:37 +02:00
Delyan Angelov
f866a8a8e2 examples: fix fibonacci warning 2020-05-13 15:51:17 +03:00
Alexander Medvednikov
c7e4f5eefb makefile: simplify and speed up 2020-05-13 14:50:33 +02:00
Alexander Medvednikov
db5036686b checker: make type is private warning an errror 2020-05-13 14:21:52 +02:00
yuyi
b1511ce995 parser: optimize no main file process 2020-05-13 14:02:04 +02:00
Lukas Neubert
60dd7a7471 vpm: fix v update ui 2020-05-13 08:19:12 +03:00
Alexander Medvednikov
3fd852deee readme: tetris 2020-05-13 04:26:06 +02:00
JalonSolov
5f7a8df885 tools/fast: fix unused var, use Stopwatch, .gitignore 2020-05-13 01:55:33 +02:00
Tanel Liiv
af334e320c cgen: dereference in one place and fix 2020-05-13 01:01:34 +02:00
Alexander Medvednikov
3e6f7d3eb6 freetype: minor fixes 2020-05-13 00:50:46 +02:00
Alexander Medvednikov
7a5a4df4c6 checker: handle println() 2020-05-12 19:38:46 +02:00
Lukas Neubert
b5b8fdaeda gitignore: ignore VS Code workspaces 2020-05-12 19:29:44 +02:00
yuyi
7837abf6b0 parser: optimize stmt() 2020-05-12 17:18:25 +02:00
yuyi
f33de1bc64 all: fix unused variable warnings 2020-05-12 13:57:23 +02:00
yuyi
99b31d8241 parser: unified way to handle struct and enum name check 2020-05-12 13:39:32 +02:00
Alexander Medvednikov
712fd384ee parser: fix eval not used in match 2020-05-12 00:26:39 +02:00
Alexander Medvednikov
27d3800cc3 parser: bring back "evaluated but not used" 2020-05-12 00:19:45 +02:00
Alexander Medvednikov
1c8e14c77c vfmt: handle comments in const blocks 2020-05-12 00:09:59 +02:00
Alexey
b74f4ee3ec ci: remove "quick debug" 2020-05-11 23:57:00 +02:00
Don Alfons Nisnoni
daca6df41a docs: fix TOC navigation links 2020-05-11 23:56:16 +02:00
yuyi
dea2658a80 checker: minor optimization in infix_expr 2020-05-11 23:50:13 +02:00
Kris Cherven
d359a7aefb cgen: fix a goto error 2020-05-11 23:49:08 +02:00
Alexey
e6bc18b21b ci: extract "prebuilt" jobs to separate workflow 2020-05-11 23:01:49 +02:00
Alexander Medvednikov
fd71093a28 docs: more styling fixes 2020-05-11 20:25:48 +02:00
Alexander Medvednikov
0a89aa0044 docs: minor fixes 2020-05-11 20:21:41 +02:00
JalonSolov
649a0140fd x64: fix NUL at end of strings, and length 2020-05-11 16:50:36 +02:00
Alexey
e638d12654 windows: use setup-freetype tool to install freetype 2020-05-11 16:25:37 +02:00
Alexander Medvednikov
e9177faf17 checker: allow *x = y only inside unsafe blocks 2020-05-11 16:05:59 +02:00
Alexander Medvednikov
2618b4fbd3 Revert "tests: add more tests on interfaces "
This reverts commit 538662d99a.
2020-05-11 15:19:55 +02:00
Alexander Medvednikov
aacc35db19 pref: do not enable globals by default 2020-05-11 15:19:47 +02:00
Sandro Martini
538662d99a tests: add more tests on interfaces 2020-05-11 15:13:03 +02:00
kdmult
ea8fcb3981 cgen: fix nested conditional statements 2020-05-11 15:11:48 +02:00
Alexey
6f2dcd819f parser: force visibility of interface methods 2020-05-11 15:10:26 +02:00
Alexander Medvednikov
828f9af64c checker: fmt 2020-05-11 14:38:25 +02:00
Alexander Medvednikov
8a6820d1b7 checker: revert fmt for now 2020-05-11 14:32:41 +02:00
Alexander Medvednikov
ce03761375 parser: fix mut args with the new syntax; checker: fmt 2020-05-11 14:16:20 +02:00
joe-conigliaro
2a40665919 ast/checker: cast no longer needed & use auto deref 2020-05-11 20:02:28 +10:00
jm-duro
8488f7d82b example: improve json example 2020-05-11 12:06:51 +03:00
Kris Cherven
8bc0c31f29 parser: add error for variables, that are evaluated, but not used 2020-05-11 11:13:36 +03:00
Kris Cherven
3a3d00ac72 checker: prevent C error on const mutation 2020-05-11 11:09:58 +03:00
Ned Palacios
38277d1dac cgen: fix gen_str_for_struc when called on a struct with a pointer field 2020-05-11 11:08:21 +03:00
joe-conigliaro
1b3cd7abe0 cgen: fix sum type assign/push from in match branch & type mod 2020-05-11 16:59:55 +10:00
yuyi
64ba59590e cgen: fix multiple assign error 2020-05-11 09:45:11 +03:00
joe-conigliaro
74cc2b2a68 table: add function return type check 2020-05-11 14:47:39 +10:00
Hungry Blue Dev
e52d35bf16 math.fraction: improve documentation, remove unnecessary mut modifiers 2020-05-11 07:20:55 +03:00
yuyi
14bba54ddc vrepl: fix array_init error
* optimize print conditions
2020-05-11 07:15:08 +03:00
Max Mazurov
8f6d69b763 examples: tetris: readme: freetype on Arch 2020-05-11 01:26:59 +02:00
Fabien Salathe
c9c956fc8a flag: fix a comment with an example 2020-05-10 22:27:14 +02:00
Alexey
71c2b26103 checker: fix checking uninitialized refs 2020-05-10 22:26:47 +02:00
Enzo Baldisserri
b09fd66aa2 gen: fix interface pointers 2020-05-10 21:16:22 +02:00
Louis Schmieder
40aad27a67 pg: remove pg. 2020-05-10 21:16:03 +02:00
Delyan Angelov
7c5905164e glm: remove unused variable (prevents compiling ui with -prod) 2020-05-10 19:59:26 +03:00
Delyan Angelov
1bf13f8a09 v version: do more accurate current git hash detection, when not on a branch 2020-05-10 18:56:19 +03:00
Delyan Angelov
d33082dffe oldv: fix compilation, make VGitOptions fields public 2020-05-10 18:41:46 +03:00
Alexander Medvednikov
a2d120b583 cgen: fix reassignment of optionals 2020-05-10 17:41:33 +02:00
eyelash
1722171adc compiler: color only the relevant part of the source code in error messages 2020-05-10 17:24:29 +02:00
Alexander Medvednikov
dae3907c5f docs: clean up toc 2020-05-10 16:55:38 +02:00
Louis Schmieder
3ec2608d6b glm: matrix multiplication; docs: toc 2020-05-10 16:49:29 +02:00
eyelash
72dfe11fa5 scanner: add a colon to error messages (#4818) 2020-05-10 16:29:15 +02:00
eyelash
f396f70ae7 repl: fix newline in error messages 2020-05-10 16:26:56 +02:00
Sumeet Chhetri
8dc0c5a699 cgen: C++ compiler support - Part 1 2020-05-10 16:26:21 +02:00
Hungry Blue Dev
8aba3eaa07 math.fractions: refactor and add more tests 2020-05-10 16:25:33 +02:00
yuyi
43ec01b23d changelog: fix a typo 2020-05-10 16:24:43 +02:00
joe-conigliaro
a73660a4c3 checker/cgen: simplify assigning fn to var 2020-05-11 00:13:30 +10:00
Alexander Medvednikov
0af939c30d docs: table of contents 2020-05-10 15:49:43 +02:00
yuyi
0606d26ba7 csv: fix field multiple lines error 2020-05-10 14:19:26 +02:00
eyelash
eabc72d4fe compiler: print underlines in the same color as the error 2020-05-10 12:27:46 +02:00
Ned Palacios
5f0ad0f562 compiler: add output mode for errors and warnings, support for -silent flag 2020-05-10 12:26:57 +03:00
Ned Palacios
01de1b6375 parser: fix JSON encode function name on invocation 2020-05-10 10:30:35 +03:00
Delyan Angelov
edb921f463 sync: mark sync.WaitGroup and sync.Mutex with [ref_only] 2020-05-10 08:58:54 +03:00
yuyi
7f69c2fbf5 parser: check import in the middle of file error 2020-05-10 07:47:20 +03:00
pancake
76eec7b6ea readline: fix input echo issue on musl-based systems 2020-05-10 07:39:31 +03:00
yuyi
ba3a631954 parser: check for module statement errors 2020-05-10 02:28:56 +02:00
yuyi
85723e3799 checker: check for_in_map using one variable error 2020-05-10 02:28:43 +02:00
Alexander Medvednikov
10da871743 checker: handle unknown fields in fail_if_immutable 2020-05-10 02:07:15 +02:00
Alexander Medvednikov
09f6cd6a75 parser/checker: [ref_only] attribute 2020-05-09 23:45:41 +02:00
Alexander Medvednikov
3052266a40 live: make compile; pref: allow _linux.v etc 2020-05-09 20:31:50 +02:00
Alexander Medvednikov
d7c4630d33 checker: make pub field check an error 2020-05-09 18:34:07 +02:00
yuyi
53989daf9a csv: fix empty line error 2020-05-09 17:35:03 +02:00
yuyi
3eeef6203e checker: check for map_init key duplicate 2020-05-09 16:55:38 +02:00
Alexander Medvednikov
dea9ca2491 cgen: fix a big with &Foo{} init 2020-05-09 15:23:48 +02:00
Alexander Medvednikov
c64f8b0d1f parser/checker: pub: struct fields 2020-05-09 15:16:48 +02:00
Delyan Angelov
809676a856 cgen: fix a sporadic segfault when giving -width in a string interpolation 2020-05-09 15:23:37 +03:00
yuyi
5f435fa1cc parser: check enum name and field name errors 2020-05-09 12:43:10 +02:00
ka-weihe
85763d0539 map: faster get and exists 2020-05-09 12:42:01 +02:00
Don Alfons Nisnoni
1c8d2c21b5 vpm: fix 404 error message 2020-05-08 22:50:36 +02:00
Tanel Liiv
7815a5495c checker: handle multireturn fn calls as if/match last expressions 2020-05-08 22:49:45 +02:00
pancake
b5bf0eeac5 time: add .no_delimiter format option 2020-05-08 21:23:26 +03:00
Sandro Martini
910a8934cb checker: fix typo on error message and related test 2020-05-08 21:21:47 +03:00
Delyan Angelov
4b347ff148 v self: force the subprocess to show colors 2020-05-08 19:04:24 +03:00
Alexander Medvednikov
6ea741e26e Revert "tests: valgrind: enable string tests"
This reverts commit 1ea13ac7f3.
2020-05-08 16:18:14 +02:00
Alexander Medvednikov
1ea13ac7f3 tests: valgrind: enable string tests 2020-05-08 13:18:27 +00:00
Ned Palacios
5b47ec49af parser: add support for multiple struct field attributes 2020-05-08 15:09:42 +02:00
Alexander Medvednikov
c29f76454e cgen: clone strings in struct_init() 2020-05-08 15:07:53 +02:00
yuyi
ef505e21ee parser: check for import errors 2020-05-08 16:01:54 +03:00
Alexander Medvednikov
2f4fc86d58 checker: fix unknown var enum crash 2020-05-08 15:00:06 +02:00
Hungry Blue Dev
dbb3c2a4cd math.fractions: improve .equals() 2020-05-08 15:39:23 +03:00
Delyan Angelov
e08566d571 compiler: do not exit early, when given -o x.c or -o x.js 2020-05-08 15:31:03 +03:00
Delyan Angelov
4c320e1512 profile: support for -profile-no-inline (with it, [inline] fns will not get profiled) 2020-05-08 15:01:59 +03:00
Alexander Medvednikov
847a1035a5 cgen: use tos_lit 2020-05-08 13:25:23 +02:00
Ned Palacios
13b11a4155 parser: fix struct attribute for array struct field 2020-05-08 13:09:40 +02:00
Delyan Angelov
fec7f0f0b9 cgen: fix auto .str() generation for []&T, and fn (t &T) str() string{} 2020-05-08 12:48:07 +03:00
yuyi
8866773f97 vrepl: fix import and comment error in the middle of other lines 2020-05-08 09:34:59 +03:00
Delyan Angelov
621429561c ci: ensure that ubuntu-tcc rebuild twice v with tcc 2020-05-08 08:46:20 +03: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
Delyan Angelov
7207a4970b solaris: fix tests 2020-05-07 16:19:21 +00:00
Alexander Medvednikov
8cfb2ad6c9 string: is_lit 2020-05-07 18:05:57 +02:00
Teymour Aldridge
1991220797 docs: update documentation on iterators 2020-05-07 18:01:09 +02:00
Alexander Medvednikov
ef387779bf cgen: fix -autofree 2020-05-07 17:51:30 +02:00
Alexander Medvednikov
3c6e090ae3 ci: test broken -autofree 2020-05-07 17:45:00 +02:00
Alexander Medvednikov
be063d740b ci: test self compilation with -autofree 2020-05-07 17:37:12 +02:00
yuyi
d096763f62 token: change 'STR' kind to 'string' 2020-05-07 16:26:22 +02:00
yuyi
ab30e81ab5 docs: fix minor typo 2020-05-07 15:36:34 +02:00
Tanel Liiv
d0afa748ff cgen: optional multiple return values 2020-05-07 15:36:04 +02:00
Alexander Medvednikov
12221fb999 cgen: fix msvc struct init 2020-05-07 13:11:24 +02:00
Alexander Medvednikov
6ff93f270c cgen: simplify struct_init() 2020-05-07 13:00:42 +02:00
yuyi
78efe72c4c checker: optimize check string cast error 2020-05-07 12:34:06 +02:00
Teymour Aldridge
9b0b6ec2db docs: improve the clarity, fix grammar 2020-05-07 12:30:41 +02:00
yuyi
78c292b448 make.bat: more cleaning up 2020-05-07 12:29:26 +02:00
Don Alfons Nisnoni
0a930f9862 bitfield: rename functions, getsize => get_size, etc. 2020-05-07 11:21:14 +03:00
Enzo Baldisserri
0f8ed84333 checker: verify interface is not used as receiver 2020-05-07 11:14:51 +03:00
Major Taylor
7d32476841 math: extract platform specific wrapper functions to math.c.v and math.js.v 2020-05-07 08:47:24 +03:00
yuyi
2f52106253 parser: use .next instead of .check, when a token is already known 2020-05-07 07:51:36 +03:00
Uwe Krüger
59aa31cee5 cgen: string interpolation: optimize away some partial strings of 0 length 2020-05-07 04:34:18 +02:00
wilesun
19390871e9 json: handle external types 2020-05-07 04:33:19 +02:00
yuyi
98a1b2782b parser: simplify import 2020-05-07 04:32:29 +02:00
Delyan Angelov
e3366281ee tests: skip sqlite_test.v on musl too, fix compilation of path_tracing.v 2020-05-06 23:50:20 +03:00
Delyan Angelov
6005b7fdb6 tests: skip clipboard_test.v on musl too 2020-05-06 23:26:44 +03:00
Delyan Angelov
4b982890e2 tests: skip http tests on musl targets for now 2020-05-06 22:59:39 +03:00
Delyan Angelov
e33805b2b3 json.decode: fix expressions in the second argument, also fixes news_fetcher.v 2020-05-06 21:44:50 +03:00
Tanel Liiv
b5a1544bf8 parser: allow re-assigning fns to variables 2020-05-06 20:09:29 +02:00
Alexander Medvednikov
b0deac6756 ci: install openssl on ubuntu-musl 2020-05-06 19:30:32 +02:00
Delyan Angelov
f638caef39 compiler: v -autofree can now compile itself 2020-05-06 19:03:51 +03:00
Alexander Medvednikov
2b0f2be18b tests: enable http_test.v 2020-05-06 17:24:50 +02:00
Delyan Angelov
88ef0a75e2 ci: pass V_CI_MUSL=1 on musl CI jobs 2020-05-06 15:10:47 +03:00
Alexander Medvednikov
8d2a4d2436 clipboard: make compile on linux 2020-05-06 12:00:52 +00:00
Alexander Medvednikov
a4f931ef65 tests: bring back the Valgrind test 2020-05-06 13:51:22 +02:00
Alexander Medvednikov
207324d15b strings.builder: remove unused var; clipboard: linux fixes 2020-05-06 11:44:08 +00:00
Alexander Medvednikov
25db5e96a3 strings.builder: fix a memory leak 2020-05-06 11:12:00 +00:00
Don Alfons Nisnoni
e87289f24d Fix typo on checker 2020-05-06 13:57:40 +03:00
Alexander Medvednikov
f80876497e fmt: use the new mut syntax in args 2020-05-06 12:43:46 +02:00
Alexander Medvednikov
b4c93349e8 checker: fix interface name check 2020-05-06 12:32:44 +02:00
Alexander Medvednikov
cc66eb1194 parser/checker: check capital letters in interface names/methods 2020-05-06 12:26:00 +02:00
Alexander Medvednikov
99cf520bd4 parser: mut x Type syntax for args 2020-05-06 12:13:22 +02:00
yuyi
61e00e6796 make.bat: add default msvc2015 config when there is no vswhere.exe 2020-05-06 12:05:52 +02:00
yuyi
51f3f31a4e checker: check string(1) cast error 2020-05-06 12:05:24 +02:00
Don Alfons Nisnoni
5bd3045498 mysql: Using int.str() instead of string(int) 2020-05-06 12:53:47 +03:00
Enzo Baldisserri
215657e16a checker: check interface implementation 2020-05-06 11:29:37 +02:00
yuyi
b627bb933c message: use uniform message reference format 2020-05-06 09:10:40 +03:00
yuyi
c653977c15 cgen: fix struct with map field str() error 2020-05-06 09:08:48 +03:00
ytakahashi
24aff9e511 doc: fix wrong syntax 2020-05-06 02:56:46 +02:00
Alexander Medvednikov
67351c74c8 V 0.1.27 2020-05-06 02:26:43 +02:00
Alexander Medvednikov
fe4c7b082b changelog: 0.1.27 2020-05-06 02:23:00 +02:00
Don Alfons Nisnoni
67a50b5b34 mysql: simplify Result.maps 2020-05-06 00:10:10 +02:00
Enzo Baldisserri
c1f224640f checker: verify that there is a main module 2020-05-06 00:09:46 +02:00
Alexander Medvednikov
25b536d03f cgen: str: do not free "true"/"false" literals 2020-05-05 23:25:14 +02:00
Don Alfons Nisnoni
8fbbf488ab darwin: fix if () warning 2020-05-05 20:07:43 +02:00
Alexander Medvednikov
473ffb5489 builtin: fix a leak in array_str 2020-05-05 18:04:43 +00:00
Sandro Martini
50351eded8 tests: interface: minor fixes 2020-05-05 19:56:11 +02:00
Alexander Medvednikov
fd0f8d06f8 tests: valgrind: use correct flag 2020-05-05 17:55:11 +00:00
Delyan Angelov
9e715b8701 cgen: use c_name() while generating code for or {} 2020-05-05 19:28:25 +03:00
Alexander Medvednikov
ff88906e9a cgen: add new to reserved words 2020-05-05 16:50:59 +02:00
Delyan Angelov
ddb5a8e6e4 time: add specialized vpc_now_darwin to fix -os cross 2020-05-05 17:31:21 +03:00
Sandro Martini
dd2a1455dc tests: add another function to the Animal interface 2020-05-05 16:27:05 +02:00
dumblob
36760f0982 doc: fix wording for "return none" 2020-05-05 16:26:22 +02:00
Tanel Liiv
b16281d6e4 cgen: pass around functions 2020-05-05 16:21:21 +02:00
Alexander Medvednikov
4de48e86d2 doc: sum types 2020-05-05 15:42:53 +02:00
Alexander Medvednikov
7e71799980 checker: check none properly 2020-05-05 15:29:52 +02:00
Alexander Medvednikov
a0ca68ce3f checker: do not allow string(int) 2020-05-05 15:26:42 +02:00
Alexander Medvednikov
c5d295c378 fmt: move struct init logic to a separate fn 2020-05-05 15:06:51 +02:00
Alexander Medvednikov
148661ead6 json: wrap up: encode_array() 2020-05-05 14:54:12 +02:00
Alexander Medvednikov
b3d7b0205a json: handle field attributes 2020-05-05 14:41:27 +02:00
Delyan Angelov
a3bc32f3e0 builder: use time.new_stopwatch instead of benchmark.new_benchmark (reduces exe size) 2020-05-05 15:31:38 +03:00
Alexander Medvednikov
ee92060d4d json: decode_array fix 2020-05-05 14:19:31 +02:00
Alexander Medvednikov
ef6c418eb6 json: decode arrays 2020-05-05 13:23:44 +02:00
dumblob
869444cec6 doc: fix wording for "return none" 2020-05-05 11:37:44 +02:00
Steve Phillips
84fc587ec2 cgen: use a temp var in map() 2020-05-05 10:29:23 +02:00
yuyi
6aca3be474 cgen: fix []map[string]string.str() error 2020-05-05 08:46:19 +03:00
Delyan Angelov
8a7aa1eb3b ci: macos ui job, ensure that ~/.vmodules/ exists. 2020-05-05 08:40:04 +03:00
Ned Palacios
507e457c0a builtin: add parenthesis around frame_addr as a workaround 2020-05-05 08:35:26 +03:00
Delyan Angelov
5a9a102491 ci: fix failing macos job for building V UI examples 2020-05-05 08:32:48 +03:00
Delyan Angelov
f9fe5b60a7 v doc: skip _x.c.v when not on x, i.e. filter files like v itself 2020-05-05 08:08:03 +03:00
Alexander Medvednikov
74c2a3c6e6 ci: bring back V UI test 2020-05-05 02:29:23 +02:00
Alexander Medvednikov
621cb7b914 parser: short struct init syntax 2020-05-05 02:12:51 +02:00
Uwe Krüger
a4b6c3fa5d cgen: hex representation of signed and pointers 2020-05-05 00:24:33 +02:00
Steve Phillips
081338b8bf checker.v: suggest []Type{}, not []Type 2020-05-05 00:20:32 +02:00
Delyan Angelov
1c945faa15 cgen: fix _to_Interface_INAME conversion fns generation 2020-05-05 00:01:54 +03:00
Delyan Angelov
b5fda6e410 cgen: skip interface outside methods, while generating _interface_methods struct 2020-05-04 22:56:58 +03:00
Alexander Medvednikov
32a7bd3a48 parser/checker: do not allow using private types from other modules 2020-05-04 21:56:41 +02:00
Alexander Medvednikov
9aa1a65489 checker: check match condition 2020-05-04 21:03:18 +02:00
Alexander Medvednikov
9823d80e0c json: minor fixes + bring back the test 2020-05-04 20:43:22 +02:00
Delyan Angelov
6e1825b417 cgen: prefix with v_ keyword C fn args too 2020-05-04 19:55:21 +03:00
joe-conigliaro
c9798d3918 table: fix check for fn with no args 2020-05-05 02:44:10 +10:00
joe-conigliaro
2bb995274e table: make table.check ret false & update fn args check 2020-05-05 02:34:11 +10:00
Delyan Angelov
d7e7113047 cgen: fix for char in nums {} 2020-05-04 18:57:33 +03:00
joe-conigliaro
b2157388d9 checker: check method args 2020-05-05 01:32:40 +10:00
Delyan Angelov
36bf99ed5a parser: remove forgotten ----- line 2020-05-04 18:28:55 +03:00
Delyan Angelov
d30eefc3be fmt: improve handling of map[k]v and []map[k]v types 2020-05-04 18:27:07 +03:00
Alexander Medvednikov
fd8a194df0 json: wrap up decode() 2020-05-04 16:46:39 +02:00
Delyan Angelov
5eb71c4a13 fmt: initial support for -debug 2020-05-04 17:27:41 +03:00
Don Alfons Nisnoni
23df9b052e mysql: update code & add a feature to get value as map 2020-05-04 14:58:24 +02:00
ka-weihe
f27fd63f8c builtin: map: one voidptr for all values 2020-05-04 14:56:19 +02:00
yuyi
4794c6a0e7 cmd: simplify internal.help => help 2020-05-04 14:21:32 +02:00
Enzo Baldisserri
8fd69e845f cgen: fix using pointer as interface receiver 2020-05-04 14:21:03 +02:00
Delyan Angelov
0e241162d9 panic: distinguish between builtin and main modules 2020-05-04 14:51:30 +03:00
Delyan Angelov
cdf70c070b tests: add panic_with_cg.vv/.out 2020-05-04 14:34:51 +03:00
joe-conigliaro
57903247e3 parser: add back struct field removed by accident 2020-05-04 21:27:54 +10:00
yuyi
90fc23ccfb checker: fix array init []type{cap: x.len} error 2020-05-04 13:22:09 +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
joe-conigliaro
d75f286230 parser: store FnDecl body position and use for scope 2020-05-04 20:31:34 +10:00
Alexander Medvednikov
0f0b6a0ccd examples: minor bounce.v improvements for the demo 2020-05-04 12:26:39 +02:00
joe-conigliaro
4571a5eb83 gen: use middle of fn pos to load correct scope for free 2020-05-04 20:08:37 +10:00
yuyi
c112b3aec5 tests: fix cleanup of compiler_test.v on windows 2020-05-04 11:33:54 +02:00
Delyan Angelov
068da2ea0f builtin: fix warning about unused skipframes 2020-05-04 12:05:08 +03:00
Alexander Medvednikov
eca24c5d11 tests: interface: rename Speaker to Animal 2020-05-04 10:58:42 +02: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
yuyi
cd5dccd855 gen: fix compilter_test.v error on windows 2020-05-04 10:09:49 +02:00
Enzo Baldisserri
4b3ce79e84 interface: support arguments in methods and simplify 2020-05-04 00:14:59 +02:00
Delyan Angelov
71a92eb87b tests: fix CI failing for builtin __as_cast 2020-05-03 22:25:38 +03:00
Delyan Angelov
242670a33d compiler: add support for panic_debug with -cg 2020-05-03 22:13:59 +03:00
Delyan Angelov
0b750a234f repl: fix for single lines ending with // comment 2020-05-03 20:48:46 +03:00
Delyan Angelov
845ffb59a6 live: use mostly pure V code for reloading, eases customization 2020-05-03 20:22:24 +03:00
yuyi
b4e4e6bb21 vrepl: fix cleanup on windows 2020-05-03 18:13:37 +02:00
Uwe Krüger
4a096bd133 parser: fix string interpolation for default conversion 2020-05-03 18:12:59 +02:00
Alexander Medvednikov
de749e9d3b parser/cgen: interface <<; any type 2020-05-03 18:08:45 +02:00
Alexander Medvednikov
2a016d03ac checker: use []int instead of array_int in errors 2020-05-03 16:49:05 +02:00
Alexander Medvednikov
2a5421133d clipboard: Linux fixes 2020-05-03 16:39:26 +02:00
Alexander Medvednikov
361fad9231 tests: disable valgrind test until fn scopes are fixed 2020-05-03 16:29:15 +02:00
Alexander Medvednikov
16fe8103ba tests: bring back valgrind test 2020-05-03 13:12:05 +02:00
joe-conigliaro
8df7637853 checker: dont re match/cast with position() when already cast to sum type 2020-05-03 14:22:41 +10:00
Delyan Angelov
7e4e3abc2c compiler: circuimvent the dependency cycle v.ast <-> v.table 2020-05-02 22:52:10 +03:00
Delyan Angelov
dbbfb04e7c docs: change obsolete -show_c_cmd to -showcc and -keepc 2020-05-02 19:01:53 +03:00
yuyi
02807aab43 interpolation: fix error on windows_gcc 2020-05-02 18:22:34 +03:00
Alexander Medvednikov
b0018ed594 checker: better << error 2020-05-02 16:48:52 +02:00
Alexander Medvednikov
fca11dd441 0.1.25 changelog 2020-05-02 15:57:26 +02:00
joe-conigliaro
483f0f408c ast: allow scope var shadowing 2020-05-02 23:46:53 +10:00
Tanel Liiv
68ca8ab8a4 array: nested map() 2020-05-02 15:26:58 +02:00
Alexander Medvednikov
44c00199b6 cgen: fix fixed array consts and pointer interfaces 2020-05-02 15:18:58 +02:00
joe-conigliaro
a9a8539e41 checker: small fix in assign_stmt 2020-05-02 20:21:28 +10:00
joe-conigliaro
fd925fbd05 checker: simplify assign_stmt & add better checks 2020-05-02 19:45:08 +10:00
Alexander Medvednikov
06d533b0c1 cgen: clean up _STR 2020-05-02 11:11:32 +02:00
eyelash
716d867f25 cgen: generate static C functions 2020-05-02 10:42:38 +02:00
Alexander Medvednikov
06173834c0 cgen: interface_call() 2020-05-02 10:10:52 +02:00
Delyan Angelov
aa9bb6f71a compiler: fix -live compilation of bounce example with gcc-9 & clang 2020-05-02 02:36:29 +03:00
Alexander Medvednikov
7a51d4d796 cgen: revert new 2020-05-02 00:59:06 +02:00
Alexander Medvednikov
7dc98120c0 cgen: vfmt -live fix; add new to c_reserved 2020-05-02 00:45:45 +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
Alexander Medvednikov
2f64594ce0 cgen: more interface fixes 2020-05-02 00:28:46 +02:00
Delyan Angelov
7038f59ca5 compiler: add back support for -live 2020-05-02 01:14:44 +03:00
Delyan Angelov
d6c1ee0202 hot_reload: cleanup message.v 2020-05-02 01:14:44 +03:00
eyelash
130324df76 compiler: remove debug prints 2020-05-02 00:10:36 +02:00
yuyi
b21be7f670 parser: multiple names error 2020-05-01 18:18:58 +02:00
yuyi
de272654f1 repl: fix import xxx with no fn main error 2020-05-01 18:12:18 +02:00
eyelash
4d04e88679 errors: show line numbers in default color and add a space 2020-05-01 14:46:12 +02:00
Thomas Treffner
73468b4030 readme: release date bump 2020-05-01 14:44:06 +02:00
Delyan Angelov
13e0e63514 hot_reload: fix graph.v compilation 2020-05-01 14:44:22 +03:00
eyelash
6b08cbcb7a compiler: print warnings in magenta 2020-05-01 13:44:15 +03:00
Alexander Medvednikov
0106eb1cf6 cgen: fix thread wrapper 2020-05-01 12:32:10 +02:00
Alexander Medvednikov
0b8a0d1640 checker: fix _ check 2020-05-01 12:22:39 +02:00
joe-conigliaro
fb1c60c53d checker: add back check struct field fn args 2020-05-01 20:12:21 +10:00
Alexander Medvednikov
c1ee14cc3e json: decode() part 1 2020-05-01 12:02:31 +02:00
joe-conigliaro
a0e662bef9 checker: remove debug println from selector_expr 2020-05-01 19:54:47 +10:00
joe-conigliaro
03904085c4 checker: check fn field exprs 2020-05-01 19:50:32 +10:00
Delyan Angelov
35f56bc4f0 vfmt: fix eating ? in $if x ? {}, missing newline in __global ... 2020-05-01 12:29:23 +03:00
Delyan Angelov
59525c8c93 tests: fix missing ? after v fmt run 2020-05-01 12:01:30 +03:00
Delyan Angelov
84785bbb59 tests: fix msvc transient failures when sleep_ms takes longer 2020-05-01 11:58:56 +03:00
Alexander Medvednikov
51da324465 tests: fix eventbus_test.v 2020-05-01 10:57:19 +02:00
Alexander Medvednikov
666801f9f9 docs: v doc 2020-05-01 10:55:48 +02:00
Delyan Angelov
66f4c881ec docs.md: add profiling section 2020-05-01 11:04:00 +03:00
Delyan Angelov
3608c81cb9 time: add stopwatch_test.v 2020-05-01 10:21:15 +03:00
Tanel Liiv
182e7071bf array: map() function 2020-05-01 00:29:54 +02:00
Delyan Angelov
87813e84e9 v.ctags: improve detection of mut x := 2020-04-30 20:20:48 +03:00
Alexander Medvednikov
b0c710c985 checker: allow fn == 0 comparison for now 2020-04-30 18:51:33 +02:00
Delyan Angelov
a6dfc6d46b compiler: support ctags with -print_v_files and .ctags.d/v.ctags 2020-04-30 19:45:50 +03:00
Alexander Medvednikov
250dea7bd1 cgen: another imported interface fix 2020-04-30 18:23:17 +02:00
Alexander Medvednikov
f1903f3c1f parser: fix imported interfaces 2020-04-30 18:06:14 +02:00
Alexander Medvednikov
9971c58ca3 all: remove var key 2020-04-30 16:55:33 +02:00
Alexander Medvednikov
20013e4b4b table: interfaces: unique gen_types 2020-04-30 16:48:46 +02:00
Tim Basel
473617f061 cli: add option with default 2020-04-30 12:18:46 +02:00
yuyi
5481c0fc84 parser: uniform handling of enum field format 2020-04-30 12:18:16 +02:00
yuyi
81ed6ad2a1 checker: check duplicate consts 2020-04-30 12:17:31 +02:00
yuyi
4d415e56d6 checker: check enum field name duplicate 2020-04-30 09:34:18 +02:00
Enzo Baldisserri
50491670af fmt: fix formatting backtick char literal 2020-04-30 09:33:43 +02:00
yuyi
c4f672454f checker: check import duplicates 2020-04-30 09:33:12 +02:00
Henrixounez
f6d74c8a37 checker: error on ternary if type mismatch 2020-04-30 09:32:29 +02:00
Alexey
54d1a29267 dl: improve module 2020-04-29 21:01:19 +02:00
Delyan Angelov
e5ae4b6454 parser: fix match exprs over C.VALUES (needed for C.GLFW_KEY_UP) 2020-04-29 20:35:57 +03:00
yuyi
b2a076e8b8 csv: fix last-field-empty error 2020-04-29 16:50:02 +02:00
Tim Basel
3e4cd12fd0 .gitignore: ignore all binary files by default 2020-04-29 16:49:13 +02:00
Alexander Medvednikov
03cee3fee0 builder: fix run & is_test check 2020-04-29 16:44:50 +02:00
Alexander Medvednikov
be0e848ae8 builder: do not allow v run _test.v 2020-04-29 14:52:32 +02:00
yuyi
1fabb7d5a6 checker: fix string.str() error 2020-04-29 13:51:42 +02:00
Enzo Baldisserri
390d88f933 parser: fail for section redefinition in struct 2020-04-29 13:32:39 +02:00
joe-conigliaro
98cd013908 cgen: fix interface struct sorting 2020-04-29 21:08:39 +10:00
Alexander Medvednikov
51d0ce0222 tests: more interface tests; checker: handle zero selectorexpr type error 2020-04-29 12:46:09 +02:00
Henrixounez
c500044bae checker: unreachable code warning 2020-04-29 12:31:18 +02:00
Alexander Medvednikov
2fc05b814c all: interface arrays 2020-04-29 12:21:15 +02:00
Delyan Angelov
3d8853af2b builder: move warning/error printing into print_warnings_and_errors 2020-04-29 13:04:09 +03:00
Delyan Angelov
1e910c6afe tests: add reference_field_must_be_initialized.vv 2020-04-29 12:56:12 +03:00
Delyan Angelov
bf8ed1815c builder: print collected checker warnings too 2020-04-29 12:38:43 +03:00
penguindark
ad46e1b832 strconv: v_printf documentation
* v_printf documentation

* syntax fix
2020-04-29 12:25:38 +03:00
Delyan Angelov
0e765e34be vfmt: extract v.util.find_working_diff_command, color_compare_files 2020-04-29 11:51:45 +03:00
Delyan Angelov
dd3434598c checker_test: remove generated .v files, when a test is OK 2020-04-29 11:48:51 +03:00
yuyi
117649f40d checker: check devision by zero (int and float) 2020-04-29 10:07:27 +02:00
yuyi
2b48ce21df checker: make sure main has no args and doesn't return 2020-04-29 09:19:46 +02:00
yuyi
a9e33e712a checker: check struct field name duplicate 2020-04-29 09:11:36 +02:00
Henrixounez
0dc7a57e1f scanner: prevent panic with string starting on first character 2020-04-28 18:57:16 +02:00
Delyan Angelov
8c526ad05b tests: ignore vlib/v/checker/tests/*.v files (only *.vv are sources there) 2020-04-28 16:45:25 +03:00
Henrixounez
0afaef5818 checker: ambiguous function call error
* checker: ambiguous function call error

* checker: ambiguous function call error wording

* checker: ambiguous functions tests newline
2020-04-28 16:27:49 +03:00
Delyan Angelov
8a81aa5c93 errors: disambiguate between variable and fn source_context 2020-04-28 16:20:50 +03:00
Delyan Angelov
7924b4d77c compiler: handle a panic when an error is produced, but source == '' 2020-04-28 16:15:56 +03:00
Delyan Angelov
8ea087f957 vfmt: fix compilation; handle the case when fmt.tabs is not enough 2020-04-28 16:04:37 +03:00
Delyan Angelov
eb9448e59e tests: fix CI, by skipping http_test.v again. 2020-04-28 15:24:41 +03:00
Delyan Angelov
c6a15dba50 compiler: add support for size_t 2020-04-28 15:07:19 +03:00
jm-duro
210b6e36b6 http: mutable request fields 2020-04-28 13:57:48 +02:00
Alexander Medvednikov
1e4e882bc2 cc/cgen: cached modules fixes 2020-04-28 13:15:37 +02:00
Sandro Martini
761fb930ce dl: add dynamic load module 2020-04-28 11:53:55 +02:00
Enzo Baldisserri
7bf8731778 checker: check variable mutability for postfix exprs 2020-04-28 11:20:19 +02:00
Delyan Angelov
54b71242fe builder: add autofree compatibility; protect against b.str() twice in a row 2020-04-28 11:03:43 +03:00
yuyi
f2060d431e checker: check division by zero 2020-04-28 09:52:01 +02:00
joe-conigliaro
ef4f4825ac cgen: auto dereference for optional 2020-04-28 15:59:41 +10:00
yuyi
28f5920bb0 cgen: fix map fixed-array .str() error 2020-04-28 07:22:46 +02:00
yuyi
b20777df59 checker: main function called error 2020-04-28 07:21:50 +02:00
Major Taylor
9edbcb823c cli: Fix off-by-one error in smart-wrap 2020-04-28 00:10:36 +03:00
Enzo Baldisserri
682838a0cf checker: check array and fields mutability 2020-04-27 22:53:26 +02:00
Delyan Angelov
ce1215f507 vfmt: set Preferences.is_fmt flag (bugfix) 2020-04-27 23:20:16 +03:00
Alexander Medvednikov
5d073dcce5 x64: # opcodes 2020-04-27 21:38:58 +02:00
joe-conigliaro
9f76a7b250 parser: simplify unused vars & add loop/if vars etc 2020-04-27 23:16:31 +10:00
Delyan Angelov
e67bf674e3 scanner: cleanup, only v.parser now depends on v.scanner 2020-04-27 16:08:04 +03:00
yuyi
e9f764db4f cgen: uniform string output format 2020-04-27 14:48:28 +02:00
Alexander Medvednikov
eb8973c362 builder: module caching fixes 2020-04-27 14:46:25 +02:00
Alexander Medvednikov
f005079e0b pref: rename keep_c 2020-04-27 13:28:00 +02:00
ka-weihe
18faaefe82 map: get: remove malloc and memcpy 2020-04-27 13:27:33 +02:00
Delyan Angelov
73106b5f5e profile: measure defer{} statements too 2020-04-27 13:18:37 +03:00
Alexander Medvednikov
fde929ee30 cgen: remove tos3() call: part 1 2020-04-27 12:10:08 +02:00
Delyan Angelov
dd1ee39271 profile: produce civilized output 2020-04-27 12:45:19 +03:00
yuyi
99a7b69578 cgen: optimize map_to_string format 2020-04-27 10:52:21 +02:00
Delyan Angelov
c84dee5968 profile: move profiling related logic into vlib/v/gen/profile.v 2020-04-27 09:40:13 +03:00
yuyi
95754f211f cgen: generate str function when using x.str() 2020-04-27 08:09:37 +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
Delyan Angelov
e523540f3a profile: use specialized time__vpc_now 2020-04-26 22:14:54 +03:00
Alexander Medvednikov
50a83736ff checker: struct init: handle C types 2020-04-26 19:59:03 +02:00
Alexander Medvednikov
8223efe9df checker: check struct field types 2020-04-26 18:38:29 +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
Alexander Medvednikov
cd45e9ea48 docs: update array docs 2020-04-26 17:19:08 +02:00
penguindark
d16474442a strconv: format test fixes 2020-04-26 16:26:33 +02:00
yuyi
2574dce174 all: fix remaining []array warnings 2020-04-26 16:25:54 +02:00
yuyi
9f4d498ff1 all: updateimport () 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
Enzo Baldisserri
0f2f97e3e5 checker: reorganize tests to match fmt tests 2020-04-26 12:34:42 +02:00
Alexander Medvednikov
41eb4453e3 parser: do not allow redefinition of fn args 2020-04-26 12:01:10 +02:00
Alexander Medvednikov
153ac230ec tests: use new array init syntax, fix mutability 2020-04-26 11:56:30 +02:00
Alexander Medvednikov
0641a31fe0 parser: allow mutable pointer args 2020-04-26 11:53:41 +02:00
eyelash
b495dac780 fix a few warnings
Good find, @eyelash .
2020-04-26 12:42:44 +03:00
Alexander Medvednikov
270566055f checker: make sure all FnDecl types are valid 2020-04-26 10:39:26 +02:00
Alexander Medvednikov
3c08f655af parser: do not allow mutable simple args 2020-04-26 10:35:10 +02:00
Alexander Medvednikov
a56121c329 checker: check mutability in index exprs; parser: set is_mut for args 2020-04-26 10:25:58 +02:00
Delyan Angelov
ee31339dfd parser: fix error position for use x := []Type{} 2020-04-26 10:42:46 +03:00
Alexander Medvednikov
d844ff1381 builder: fix msvc.v 2020-04-26 09:33:40 +02:00
Alexander Medvednikov
20bcb6b8bb tests: fix lef_shift test 2020-04-26 09:29:29 +02:00
penguindark
b67698888c strconv: printf and string format utilities 2020-04-26 10:23:10 +03:00
Alexander Medvednikov
7955181c6c tests: [] fixes 2020-04-26 09:18:29 +02:00
Alexander Medvednikov
3ab8dc0092 parser: array init: []string => []string{} 2020-04-26 09:17:17 +02:00
Delyan Angelov
b898970031 cmd/tools: use same line imports too 2020-04-26 09:32:05 +03:00
yuyi
3a59f5727c checker: fix check main function error (#4601) 2020-04-26 08:04:28 +02:00
Alexander Medvednikov
a48080afec parser: deprecate import(); replace remaining import()s 2020-04-26 07:36:02 +02:00
Delyan Angelov
48f9cc1ed7 tests: make alias_type_exists.vv use type Pigeon Bird syntax 2020-04-26 08:23:09 +03:00
Alexander Medvednikov
f7153ca4fa fmt: array_init(); parser: fn_redefinition_error() 2020-04-26 07:17:01 +02:00
Delyan Angelov
620fc962d7 builtin: use single line imports, to make analysis easier 2020-04-26 08:06:39 +03:00
Alexander Medvednikov
3166833471 parser: fix interface method return type parsing 2020-04-26 07:03:26 +02:00
yuyi
9cfb1e3bf7 cgen: fix struct with fixed array error 2020-04-26 06:54:14 +02:00
Enzo Baldisserri
0b3412cdb5 checker: check that type exists in TypeDecl 2020-04-26 06:40:54 +02:00
yuyi
541b058e90 all: use a !in b instead of !(a in b) 2020-04-26 06:39:23 +02:00
Alexander Medvednikov
2b4ac0e63a checker: handle array of interfaces 2020-04-26 06:29:03 +02:00
Alexander Medvednikov
8000eb3656 parser: revert silent _ prefix rule 2020-04-26 05:34:34 +02:00
Alexander Medvednikov
60a0ba5eaa table: minor interface clean up 2020-04-26 05:34:34 +02:00
Delyan Angelov
a77640165e compiler: faster vmod lookup 2020-04-25 23:43:46 +03:00
Delyan Angelov
08799792a7 tests: fix regex test 2020-04-25 23:42:48 +03:00
Delyan Angelov
cd27300d75 cookie: fix a new match error about redundant else 2020-04-25 23:02:04 +03:00
Delyan Angelov
19d7553d67 tests: fix vlib/net/http/cookie_test.v 2020-04-25 22:53:18 +03:00
Enzo Baldisserri
3e68e429b6 checker: avert if else is unnecessary 2020-04-25 21:51:44 +02:00
Alexander Medvednikov
e0f9c042c1 cgen: interface fixes 2020-04-25 21:24:12 +02:00
Delyan Angelov
86ba1645b0 os: add os.input(prompt) 2020-04-25 22:04:12 +03:00
Enzo Baldisserri
c73d91a8fe fmt: TypeDecl; format more files 2020-04-25 20:58:00 +02:00
Ruofan XU
d86539c4f5 checker: clean up infix_expr 2020-04-25 20:28:49 +02:00
ka-weihe
d72e401378 string: optimize eq 2020-04-25 20:19:53 +02:00
Alexander Medvednikov
b7e5be41f5 checker/cgen: as fixes 2020-04-25 18:41:12 +02:00
yuyi
c26e83f58a array: fix fixed array errors 2020-04-25 18:26:38 +02:00
yuyi
ec9566988a cmdline: minor optimizaztion 2020-04-25 17:49:51 +02:00
Enzo Baldisserri
fb54a2635c fmt: lots of fixes 2020-04-25 17:49:16 +02:00
Delyan Angelov
7c080c5d4a checker: prevent x := voidfn() 2020-04-25 18:06:34 +03:00
Larpon
6a834c0528 checker: use 'mut' instead of 'var' in error message 2020-04-25 17:51:12 +03:00
Delyan Angelov
a20bef65ba fmt: workaround a vfmt limitation preventing formatting of vlib/v/ast/ast.v 2020-04-25 17:34:42 +03:00
Delyan Angelov
9a19531909 compiler: add support for [if myflag] void fn/methods 2020-04-25 16:57:11 +03:00
Delyan Angelov
945f964c0c parser: stay silent about unused variables starting with _ 2020-04-25 15:38:15 +03:00
joe-conigliaro
aacc3c6f7e cgen: generate str for variadic (#4587) 2020-04-25 22:23:47 +10:00
Delyan Angelov
4bcdf11743 cgen: support -profile - and -profile x.txt 2020-04-25 13:41:49 +03:00
Delyan Angelov
eecf92cdb0 cgen: implement -profile support. 2020-04-25 13:05:49 +03:00
joe-conigliaro
41cc96aaec revert parser: simplify array push detection 2020-04-25 18:57:12 +10:00
joe-conigliaro
4675656786 parser: simplify array push detection 2020-04-25 18:42:53 +10:00
Delyan Angelov
1863dda8e5 help: update help .txt files 2020-04-25 11:15:57 +03:00
Delyan Angelov
e0ab318f56 cgen: add support for v -printfn main file.v 2020-04-25 11:15:57 +03:00
joe-conigliaro
900d96c638 parser: allow deref assign without parens pt2 update vlib 2020-04-25 18:14:01 +10:00
joe-conigliaro
7177e71444 revert parser: allow deref assign without parens pt2 update vlib 2020-04-25 18:11:14 +10:00
joe-conigliaro
f92cf69e60 parser: allow deref assign without parens pt2 update vlib 2020-04-25 18:09:52 +10:00
joe-conigliaro
9fff8733a0 parser: allow deref assign without parens pt1 2020-04-25 18:07:30 +10:00
joe-conigliaro
6696e1a6e2 table: move set_nr_muls to method 2020-04-25 17:54:32 +10: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
joe-conigliaro
fbcdffbbc8 table: move Type functions to methods 2020-04-25 17:08:53 +10:00
Alexander Medvednikov
6248899d25 compiler_test: handle panics 2020-04-25 09:05:14 +02:00
Delyan Angelov
1c46dabc84 tetris: cleanup unused variable warnings 2020-04-25 09:49:02 +03: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
Alexander Medvednikov
f1f9e423c3 interfaces: preparatory fixes 2020-04-25 08:00:44 +02:00
Junya Okuno
5600fd8613 net.http: remove redundant httponly handling 2020-04-25 06:15:05 +02:00
Enzo Baldisserri
a924defb94 checker: check in left type 2020-04-25 06:14:17 +02:00
Enzo Baldisserri
fa4739794f checker: fix "unnecessary ()" error position 2020-04-24 20:27:18 +02:00
Delyan Angelov
cc4090cc74 vfmt: remove unused variable check for vfmt 2020-04-24 20:25:11 +03:00
Delyan Angelov
8be10ffbd6 vfmt: always walk over all comptime branches 2020-04-24 19:05:55 +03:00
Delyan Angelov
f6f204387d cgen: fix for msvc 2020-04-24 18:44:25 +03:00
Delyan Angelov
c6a829ce82 cgen: support for error('abc').str() and printing errors 2020-04-24 18:35:33 +03:00
Enzo Baldisserri
323ca2b3bb checker: check duplicates on match with no else
Refactor match duplication test to work even if there is not else, and to include every expression.
Add tests for duplicate expressions in match.
2020-04-24 17:04:39 +03:00
Delyan Angelov
aa15dec660 checker: check default struct field expression types 2020-04-24 16:46:55 +03:00
Delyan Angelov
d6899788dd time: add back vlib/time/time_linux.c.v 2020-04-24 15:28:16 +03:00
yuyi
afa9d42ff0 cgen: fix gen_str_for_array_fixed error 2020-04-24 12:36:45 +02:00
Enzo Baldisserri
288db055ec vself: allow arbitrary arguments 2020-04-24 12:36:27 +02:00
Alexander Medvednikov
a3382a5319 x64: debug opcodes nicely 2020-04-24 09:44:54 +02:00
Delyan Angelov
6bd34a069d benchmark: show xxx.yyy ms, using the new highres timer 2020-04-24 10:26:47 +03:00
Delyan Angelov
117ec722a2 time: remove temporary time__linux.c.v workaround 2020-04-24 09:12:34 +03:00
Delyan Angelov
20637ae54c time: restore building v on linux, till v.c is regenerated with -os cross 2020-04-24 09:00:07 +03:00
Delyan Angelov
863fab0268 comptime: enable again skipping parsing of other platform branches 2020-04-24 08:51:48 +03:00
Delyan Angelov
7a132e5c79 cgen: cleaner comptime ifdefs . 2020-04-24 08:42:31 +03:00
Major Taylor
25f2b171fc time: Timer -> StopWatch; time.Duration 2020-04-24 07:33:25 +02:00
Leah Lundqvist
f3e3d7e0c5 websocket: update to work with latest V 2020-04-24 07:32:51 +02:00
yuyi
998fc8fc07 cgen: add gen_str_for_array_fixed 2020-04-24 07:32:27 +02:00
Alexander Medvednikov
c30c76c285 tests: fix x64 test 2020-04-24 05:26:29 +00:00
yuyi
d455606037 make.bat: do not rebuild with -prod by default 2020-04-24 08:19:24 +03:00
Delyan Angelov
6b31ebe456 Revert "comptime: enable again skipping parsing of other platform branches"
This reverts commit 0f4c5fb1c9.
2020-04-23 22:47:16 +03:00
Delyan Angelov
1d9d9757cf Revert "Revert "compiler: support setting pref.output_cross_c with -os cross""
This reverts commit ba85b8d024.
2020-04-23 22:46:29 +03:00
Delyan Angelov
ba85b8d024 Revert "compiler: support setting pref.output_cross_c with -os cross"
This is reverted until cmd/tools/gen_vc.v
starts passing `-os cross` again, or until
https://github.com/vlang/vc/pull/12 is merged.

This reverts commit 878be4d886.
2020-04-23 22:40:07 +03:00
Delyan Angelov
6180b843a1 make: add -g flag to the default vc->c CC bootstrap step 2020-04-23 21:59:40 +03:00
Alexander Medvednikov
8cb88d5c9a x64: remove fn arg test for now 2020-04-23 20:55:23 +02:00
Delyan Angelov
ebc41375f1 os.executable: fix panic when os.executable_fallback fails (early in startup) 2020-04-23 21:53:18 +03:00
Alexander Medvednikov
1247718cbd x64: pass fn args 2020-04-23 20:27:34 +02:00
Delyan Angelov
0f4c5fb1c9 comptime: enable again skipping parsing of other platform branches 2020-04-23 20:45:16 +03:00
Delyan Angelov
878be4d886 compiler: support setting pref.output_cross_c with -os cross 2020-04-23 20:24:42 +03:00
Tin Le
7bcca827b6 docs: replace remaining var with mut 2020-04-23 19:05:27 +02:00
Delyan Angelov
4f4567513e comptime: fix $if debug {} when giving -cg or -d debug 2020-04-23 18:03:07 +03:00
Delyan Angelov
adb8fb1dc6 comptime: fix custom -d flags and $if x? {}. Fixes ftp_test.v . 2020-04-23 17:52:44 +03:00
Delyan Angelov
1a79e5419f tests: fix aes_test.v by manually dereferencing the mut dst parameter 2020-04-23 16:45:25 +03:00
yuyi
2b4f72ef64 parser: fix empty import error 2020-04-23 14:48:05 +02:00
yuyi
f2e505d962 tests: enable compiler_test.v on Windows 2020-04-23 14:15:15 +02:00
Delyan Angelov
8b5573a6f3 errors: use more distinct and detailed name redefinition messages 2020-04-23 13:15:01 +03:00
JalonSolov
bea918bb87 vup: add missing extension to make it work 2020-04-23 13:06:46 +03:00
Enzo Baldisserri
7e400124e8 parser: allow blank ident in nested loops 2020-04-23 12:00:51 +02:00
Delyan Angelov
fb97c2e01e examples: fix path_tracing.v compilation, using (*ptr) = expression 2020-04-23 12:28:16 +03:00
dumblob
d5eafe79bd doc: fix misleading description of optionals 2020-04-23 05:35:33 +02:00
Alexander Medvednikov
7f5e3b36bc x64: for loop 2020-04-23 05:29:07 +02: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
Alexander Medvednikov
9fe0ca5323 x64: ++ 2020-04-23 01:55:38 +02:00
Kris Cherven
d871595437 all: replace var with mut 2020-04-23 01:16:58 +02:00
yuyi
4e1abc8503 all: remove commas between enum vals 2020-04-23 01:16:16 +02:00
Alexander Medvednikov
d7ee4755c2 parser/cgen: interfaces (part 1) 2020-04-22 20:23:53 +02:00
Kris Cherven
faed178cb1 fmt: fix optional formatting 2020-04-22 20:12:58 +02:00
Enzo Baldisserri
fecf4ddf65 cgen: fix optional pointers 2020-04-22 20:12:30 +02:00
JalonSolov
54c382f6f1 vup: fix unnecessary recompiles
fixes #4441
2020-04-22 20:54:39 +03:00
joe-conigliaro
de182d5809 parser: use single scope for fn args/body 2020-04-22 21:15:38 +10:00
joe-conigliaro
80a4fbf0be parser: anon fn arg scope fix 2020-04-22 21:11:58 +10:00
joe-conigliaro
830b1807c1 test: add comment for assert bug in fn_test 2020-04-22 18:47:46 +10:00
joe-conigliaro
3ca4f5fada checker/parser: anon fn call & return type fix 2020-04-22 18:41:57 +10:00
Delyan Angelov
4b8ed3f831 cgen: fixes for ustring, makes utf8_util_test.v pass 2020-04-22 10:35:14 +03:00
Alexander Medvednikov
b228bd267f ci: bring back Vid test 2020-04-22 07:40:41 +02:00
Alexander Medvednikov
aef756a3fd docs: high order functions 2020-04-22 07:23:05 +02:00
Alexander Medvednikov
50436a0e4a x64: local variables; if 2020-04-22 07:11:17 +02:00
joe-conigliaro
c35e0e49ce cgen: use gen_varg var in condition 2020-04-22 13:31:24 +10:00
joe-conigliaro
c1e8612624 checker/gen: allow vargs to be forwarded. fix/enable variadic test 2020-04-22 13:28:47 +10:00
Kris Cherven
b288ecb795 cgen: add map string generation 2020-04-22 04:00:38 +02:00
Kris Cherven
5c3742fbd2 parser: check var names in for loops 2020-04-22 03:48:51 +02:00
Kris Cherven
155891a4e0 parser: add unused variable warning 2020-04-22 01:52:56 +02:00
Uwe Krüger
08fac28c52 cgen: fix string interpolation for non-standard integer types 2020-04-22 01:48:53 +02:00
penguindark
34fd148f2f ftoa: some fixes for rounding, new functions 2020-04-22 01:42:44 +02:00
joe-conigliaro
b9c0d2d362 cgen: fix passing high order function with body 2020-04-21 22:45:20 +10:00
yuyi
bc4a576c54 flag: fix flag_test.v 2020-04-21 14:44:17 +03:00
yuyi
a8dc0ccbcd checker: add more op checks 2020-04-21 13:26:02 +02:00
Delyan Angelov
7c1d6b60c2 cgen: add g.auto_str_funcs, print &Struct pointers with enum fields 2020-04-21 13:32:17 +03:00
Alexander Medvednikov
baf3bf6778 uiold: make compile (fix vid); x64: mov rbp, rsp 2020-04-21 10:48:52 +02:00
Alexander Medvednikov
071059e8f2 tests: disable sqlite test for now 2020-04-21 10:21:24 +02:00
Alexander Medvednikov
777c4bd57b ci: install sqlite on ubuntu-musl 2020-04-21 10:05:54 +02:00
Alexander Medvednikov
4471314291 clipboard: make the Linux version compile 2020-04-21 07:24:23 +00:00
Delyan Angelov
9d107007a1 x64: enhance diagnostic for unhandled nodes 2020-04-21 09:34:00 +03:00
Alexander Medvednikov
2597816ed6 tests: disable clipboard_test for now 2020-04-21 07:26:16 +02:00
Alexander Medvednikov
ab38605802 tests: disable clipboard on linux; x64: leave() 2020-04-21 06:16:47 +02:00
Alexander Medvednikov
77679d9650 tests: mark more tests as fixed 2020-04-21 05:52:44 +02:00
Alexander Medvednikov
9278a0cfba tests: fix mut_test; x64: sub32() 2020-04-21 05:49:03 +02:00
Alexander Medvednikov
be40de331d tests: fn_test works now 2020-04-21 05:32:37 +02:00
joe-conigliaro
abf5942433 parser/cgen: anon fn var & calling (#4534) 2020-04-21 13:23:36 +10:00
Alexander Medvednikov
ee2e83fef0 go back to mut. decisions, decisions... 2020-04-21 05:11:50 +02:00
Alexander Medvednikov
1bf094fbca parser: mut in receivers 2020-04-21 05:07:49 +02:00
Alexander Medvednikov
cc0e0ed281 fmt: single line match fix; x64: minor fixes 2020-04-21 04:51:53 +02:00
sambeckingham
4ea4d1c8c4 csv: handle missing line ending 2020-04-21 00:02:55 +02:00
Alexander Medvednikov
67a76cee1e tests: fix x64 output comparison 2020-04-20 22:57:41 +02:00
Alexander Medvednikov
10677c2b0c x64: fn call test 2020-04-20 22:36:12 +02:00
Alexander Medvednikov
871c29ea5d x64: fn calls; return; 2020-04-20 22:21:40 +02:00
sambeckingham
b1459ade69 csv: fix missing last column 2020-04-20 21:49:05 +02:00
Ruofan XU
f725b93019 tests: delete an unused file 2020-04-20 21:48:14 +02:00
Alexey
9c0d97335e builtin: improve backtrace on Windows 2020-04-20 20:59:08 +02:00
Ruofan XU
cdb1b0344c checker: improve type check for arithmetic assignment op and fix error pos 2020-04-20 20:56:05 +02:00
yuyi
dbbb27ef8f makefile: show v version at the end 2020-04-20 19:16:15 +03:00
Delyan Angelov
7a03b18bfe vgit: avoid generics; enables compilation of the performance_compare & oldv tools. 2020-04-20 18:39:25 +03:00
Major Taylor
dc8199709f cli: add smart-wrap for help description 2020-04-20 14:50:15 +02:00
yuyi
717e26b45e checker: more infix checks 2020-04-20 14:49:26 +02:00
yuyi
07f69fab19 checker: remove dots from error messages 2020-04-20 11:57:07 +02:00
Alexander Medvednikov
2805f8d0cc tests: fix x64_test.v 2020-04-16 14:19:14 +03:00
Alexander Medvednikov
78cbb7746f tests: fix hello.vv output 2020-04-20 09:07:19 +02:00
Alexander Medvednikov
2642f6a0da cgen: remove _PUSH 2020-04-20 09:04:17 +02:00
Alexander Medvednikov
e006da7259 parser: fix a bad comment 2020-04-20 08:44:14 +02:00
Alexander Medvednikov
4b329cb89d tests: fix a typo 2020-04-20 08:32:10 +02:00
Alexander Medvednikov
ee2f1652b5 fmt: add EOL 2020-04-20 08:30:42 +02:00
Alexander Medvednikov
639dc02cc8 x64: test hello world 2020-04-20 08:27:37 +02:00
Alexander Medvednikov
c1fc768c1b fmt: run on cmd/v; cgen: fix anonymous functions 2020-04-20 07:04:31 +02:00
Alexander Medvednikov
efff96d622 x64: make hello world run 2020-04-20 07:02:09 +02:00
Alexander Medvednikov
19a5436118 cgen: use faster array_push instead of _PUSH; re-fmt cgen.v 2020-04-20 03:54:41 +02:00
yuyi
be3bd520f6 checker: fix for in range type mismatch 2020-04-20 00:21:16 +02:00
Ruofan XU
5edd9cdc3a checker: add type check for bit op 2020-04-19 22:29:45 +02:00
yuyi
dbb81b89fd checker: fix type mismatch of in array 2020-04-19 22:26:58 +02:00
Daniel Däschle
b62bb22fa6 checker: allow C values in enum 2020-04-19 22:26:04 +02:00
Ruofan XU
6c59b306c7 checker: add type check for arithmetic assignment ops 2020-04-19 22:24:12 +02:00
yuyi
3b00132e14 repl: fix << 2020-04-19 21:52:46 +02:00
yuyi
4de16e9f0f tests: enable checker_error_test on windows 2020-04-19 20:48:13 +02:00
Keito Nagai
57859db07c readme: fix docs link 2020-04-19 20:47:36 +02:00
Kris Cherven
95ae915c0c checker/parser: fix outdated error messages 2020-04-19 20:46:48 +02:00
Alexey
583b61f883 readme: use unified style for badges 2020-04-19 20:46:18 +02:00
yuyi
27e04748ed cgen:gen_str_for_array 2020-04-19 10:42:34 +02:00
Alexey
3ee858cd79 cgen: fix struct initialization bugs 2020-04-19 04:44:39 +02:00
Major Taylor
be0a8794c2 time: add Timer; refactor benchmark to use Timer 2020-04-19 03:40:32 +02:00
Enzo Baldisserri
57c142b993 checker: disallow pub in main 2020-04-19 00:07:57 +02:00
Alexander Medvednikov
de9f302412 fmt: array newlines test 2020-04-18 23:58:59 +02:00
Alexey
85c5103ba3 tests: test cflags parsing 2020-04-18 23:45:17 +02:00
Alexey
3d6142064d tests: remove msvc-test 2020-04-18 23:44:42 +02:00
Alexey
85dbd38ada tests: don't skip rand and repl 2020-04-18 23:43:56 +02:00
Alexander Medvednikov
a18201faa7 fmt: save newlines between array elements 2020-04-18 23:09:23 +02:00
Dimitri Merejkowsky
4fe4709b56 docs: fix typo 2020-04-18 21:28:05 +02:00
Alexey
2ab2a58bc5 string: add more interpolation tests 2020-04-18 18:26:07 +02:00
Ruofan XU
b0e498bf0b scanner: refactor ident_dec_number 2020-04-18 17:49:27 +02:00
Tim Basel
86df486988 compiler: rename is_so to is_shared 2020-04-18 17:46:23 +02:00
Major Taylor
392986b763 testing: fix race condition, make messages private 2020-04-18 17:44:21 +02:00
Kris Cherven
3cc7009440 cflag: remove circular dependency 2020-04-18 16:29:43 +02:00
Kris Cherven
eb923b4995 testing: fix count of succeeded tests 2020-04-18 05:49:03 +03:00
yuyi
5374899f29 parser: fix interpolation error 2020-04-18 00:22:03 +02:00
Enzo Baldisserri
0f9322bf36 checker: print error and pos for lacking main or pub main 2020-04-18 00:20:38 +02:00
Enzo Baldisserri
f2be3d7ffb checker: check that right is type exists 2020-04-18 00:19:33 +02:00
Tim Basel
73073cd954 parser: anonymous functions (part 1) 2020-04-17 21:59:19 +02:00
Enzo Baldisserri
fe249ab0c3 vtest: remove pub before main 2020-04-17 21:41:54 +02:00
yuyi
3e324befd0 builder: clean up and simplify some methods 2020-04-17 21:17:19 +02:00
Alexander Medvednikov
515da900e4 fmt: remove \t before same line comments 2020-04-17 20:53:39 +02:00
Alexander Medvednikov
2c778c8849 fmt: single line matches 2020-04-17 20:51:19 +02:00
yuyi
67cd90de6e parser: fix number parse error 2020-04-17 20:31:32 +02:00
Kris Cherven
84ac634c31 checker: disallow pub fn main() 2020-04-17 20:30:43 +02:00
Alexander Medvednikov
c4b7d7cab3 match: shadow variable instead of it 2020-04-17 19:24:10 +02:00
Alexander Medvednikov
c27a10b956 contributing.md: fix a typo 2020-04-17 18:27:03 +02:00
Alexander Medvednikov
405e1ecf88 readme: add | 2020-04-17 18:25:55 +02:00
Alexander Medvednikov
a4161feaaa readme: move contributing.md link to the top 2020-04-17 18:25:42 +02:00
Alexander Medvednikov
a358a6b0c6 contributing.md: v self 2020-04-17 18:20:05 +02:00
Alexander Medvednikov
59baef89a0 parser: assign.v, containers.v, for.v, if.v 2020-04-17 18:16:55 +02:00
Alexander Medvednikov
b53fb365a6 parser: move pratt logic to pratt.v 2020-04-17 18:11:04 +02:00
Alexander Medvednikov
16931fd23f parser: move all struct logic to struct.v 2020-04-17 18:01:02 +02:00
Alexander Medvednikov
ed8855c4cd tests: fix struct_unknown_field.v 2020-04-17 17:20:35 +02:00
Alexander Medvednikov
4a556f72bb checker: allow calling private functions in tests 2020-04-17 17:18:40 +02:00
Alexander Medvednikov
06c1b9e95e table/checker: verify private functions/methods 2020-04-17 17:16:14 +02:00
Daniel Däschle
af30bf939e checker: fix return underlining 2020-04-17 16:16:56 +02:00
Daniel Däschle
c1d9e22ca6 cgen: gen str() from eprintln and eprint as well 2020-04-17 16:15:28 +02:00
yuyi
420ecaf31d cgen: gen_str_for_array() 2020-04-17 16:10:41 +02:00
Daniel Däschle
402e55d115 ast: expr.Position; struct field refactoring 2020-04-17 02:38:39 +02:00
yuyi
8bb11d9035 cgen: fix string_interpolation_struct_test.v error 2020-04-17 01:45:42 +02:00
Major Taylor
7bfc3ef767 cli: fix issue with long cmd and flag names 2020-04-16 23:01:04 +02:00
Enzo Baldisserri
051cc732bb cgen: generate typeof for functions 2020-04-16 21:04:27 +02:00
yuyi
dee64347e0 cgen: fix const_embed_test.v error 2020-04-16 19:43:39 +02:00
Alexey
4c8510dfaf cgen: use wWinMain for Windows GUI applications 2020-04-16 19:42:04 +02:00
Alexey
663c69305a cmd/v: fix processing arguments 2020-04-16 19:41:24 +02:00
Delyan Angelov
aed8370d87 tetris: enable compilation with -prod; cleanup of font loading errors 2020-04-16 19:44:15 +03:00
Kris Cherven
182108faca fmt fmt.v, vfmt.v 2020-04-16 15:54:17 +02:00
Alexey
54226e74cf sokol: add missing C prefixes 2020-04-16 15:53:34 +02:00
Alexander Medvednikov
714ff50322 fmt: use the new receiver syntax 2020-04-16 15:42:40 +02:00
Alexander Medvednikov
4b5acfd960 parser: (var x X) receiver syntax 2020-04-16 15:40:21 +02:00
Alexander Medvednikov
8760313ce5 fmt builder.v 2020-04-16 15:35:19 +02:00
Alexander Medvednikov
af224b4933 parser/cgen: is keyword 2020-04-16 15:32:14 +02:00
Delyan Angelov
cc9828b481 checker: fix building of shared .so libs 2020-04-16 16:30:19 +03:00
Enzo Baldisserri
e05f103c41 cli: make compile 2020-04-16 14:50:04 +02:00
Delyan Angelov
1318c27699 tetris: it now works with v2 (on linux) :-) 2020-04-16 13:30:40 +03:00
Daniel Däschle
19723c927b checker: move more checks from parser 2020-04-16 12:17:15 +02:00
Delyan Angelov
554d87f5b0 tetris: part 1 of fixing compilation with v2 2020-04-16 12:37:59 +03:00
Delyan Angelov
8a1248b2e7 builder: restore module import cycle detection/topological reorder 2020-04-16 12:29:36 +03:00
Daniel Däschle
04db2d02b8 checker: move struct name check from parser to checker 2020-04-16 11:01:18 +02:00
yuyi
54a02996f2 cgen: fix string interpolation float type 2020-04-16 07:30:25 +02:00
Kris Cherven
332d52f459 fmt: stop mangling reference names 2020-04-16 07:28:41 +02:00
joe-conigliaro
c3ddaf16ec cgen: fix sum type casting for array push 2020-04-16 15:18:33 +10:00
Daniel Däschle
a680db44ed parser: change for error message 2020-04-16 06:01:14 +02:00
yuyi
b15780ae51 parser: better const error 2020-04-16 06:00:05 +02:00
axinli
5e4c5f189f docs: fix remaining muts 2020-04-16 05:52:35 +02:00
Alexander Medvednikov
e1a2a4f362 docs: imports and a simple os.get_line() example 2020-04-16 02:01:55 +02:00
Alexander Medvednikov
8e8f543013 docs: mut => var 2020-04-16 01:49:16 +02:00
Delyan Angelov
4b3c44cfd7 Revert "tetris: part 1 of fixing building it with v2"
This reverts commit d42725aafe.
2020-04-16 01:16:54 +03:00
Delyan Angelov
d42725aafe tetris: part 1 of fixing building it with v2 2020-04-16 00:35:16 +03:00
Delyan Angelov
92129d760d checker: fix false positives for sumtype kind of matches 2020-04-16 00:32:56 +03:00
Abdullah Atta
6a186e8f11 jsgen: implement js backend 2020-04-15 23:16:49 +02:00
Kris Cherven
a3ab5df2ed cgen: prepend __ to new_array 2020-04-15 20:12:06 +02:00
Daniel Däschle
27b6f30305 checker: move capital var check from parser to checker 2020-04-15 19:09:51 +02:00
Daniel Däschle
93b942de46 parser: fix a match error 2020-04-15 16:23:03 +02:00
pancake
caed4aad58 v run: simplify 2020-04-15 16:17:17 +02:00
pancake
c0491285f8 v run: fix 'v run' without any other argument 2020-04-15 12:16:07 +03:00
joe-conigliaro
fde83aff0b checker/cgen: fix calling struct field with fn type 2020-04-15 04:28:18 +02:00
Alexander Medvednikov
da28bc7026 Revert "fmt: (var f Foo)"
This reverts commit 4b110756e0.
2020-04-15 04:15:42 +02:00
Alexander Medvednikov
4b110756e0 fmt: (var f Foo) 2020-04-15 03:56:16 +02:00
Kris Cherven
4dd8796dba cgen: fix assignment to nested maps 2020-04-15 02:42:00 +02:00
Alexander Medvednikov
f34352faf9 fmt: use var instead of mut 2020-04-15 01:55:51 +02:00
Alexander Medvednikov
efaec8be8e token/parser: var keyword 2020-04-15 01:45:27 +02:00
Daniel Däschle
4068cbc6eb parser: fix var name check pos 2020-04-14 21:27:17 +02:00
Alexey
e1739549b2 crypto: fix rand module 2020-04-14 21:03:02 +02:00
Alexander Medvednikov
14e1b963f2 parser: do not allow variable names with capital letters 2020-04-14 20:40:00 +02:00
Alexey
91de4e1ece array: test assignment operators 2020-04-14 20:32:06 +02:00
Enzo Baldisserri
86402204a7 checker: fail if else isn't the last branch of match 2020-04-14 20:31:51 +02:00
Alexey
0c63f5c80d builtin: test left/right shift precedence 2020-04-14 19:38:11 +02:00
Daniel Däschle
50871d1a92 checker: for in index type error position 2020-04-14 19:37:56 +02:00
Alexander Medvednikov
deab448d93 cgen: fix array[i] &=, |= etc 2020-04-14 19:36:52 +02:00
Alexander Medvednikov
233ae3f772 fmt: use import module syntax 2020-04-14 19:32:23 +02:00
Alexander Medvednikov
2251634743 parser: hide import deprecation warning for now 2020-04-14 18:36:29 +02:00
Alexander Medvednikov
f91d527154 deprecate import module 2020-04-14 18:27:30 +02:00
Alexander Medvednikov
211275ab49 fmt: always use import() syntax 2020-04-14 18:24:19 +02:00
Alexander Medvednikov
ec10831318 parser: []int{cap:cap, len:len} syntax; minor fixes 2020-04-14 18:10:16 +02:00
Alexey
893d14ef8f cmd/v: process version argument correctly 2020-04-14 18:06:59 +02:00
joe-conigliaro
b33a9fc9e7 parser: fix left shift precedence 2020-04-15 01:41:14 +10:00
Delyan Angelov
2b3204603a parser: add an $if tinyc{} wrapper for the tcc_stack_bug variable 2020-04-14 18:02:55 +03:00
Delyan Angelov
e947d5e8c8 checker: fully exhaustive matches for sumtypes and enums
Also change the vlib/v/checker/tests/inout/match_expr_else.out to reflex the
new error details.
2020-04-14 16:50:43 +03:00
yuyi
449575a122 doc: fix CONTRIBUTING.md typos 2020-04-14 15:13:36 +02:00
Daniel Däschle
75603beeea checker: match exhaustive as stmt and with enum 2020-04-14 15:12:26 +02:00
Delyan Angelov
c04c973f84 cgen: use a temp variable for the array part inside 'for x in array{}' 2020-04-14 13:22:58 +03:00
Delyan Angelov
2df4998acc parser: fix v selfcompilation with tcc (tcc bug workaround) 2020-04-14 11:06:19 +03:00
yuyi
956651384c cgen: fix math/complex_test.v 2020-04-14 07:44:19 +02:00
yuyi
682c619456 array: fix array_byte.str error 2020-04-14 05:55:53 +02:00
Alexander Medvednikov
5f1b88c2c4 checker: do not use !in for now 2020-04-14 04:14:02 +02:00
Alexander Medvednikov
bbc35b1179 checker: check bool and string ops 2020-04-14 04:12:28 +02:00
yuyi
885612afea ftoa: fix strconv/ftoa/f32_f64_to_string_test.v 2020-04-14 03:53:34 +02:00
Alexander Medvednikov
df37597f00 tests: disable cookie test for now 2020-04-14 03:43:59 +02:00
Chris Watson
c6c2fccb23 net.http: add cookie support 2020-04-14 03:34:05 +02:00
Immortalin
080f550625 v up: optimization 2020-04-14 03:32:32 +02:00
yuyi
8bef97fce6 tests: remove array_to_string_test.v from skip list 2020-04-14 01:03:54 +02:00
Daniel Däschle
12e48c6fe2 checker: check match for exhaustion 2020-04-14 01:03:31 +02:00
Alexander Medvednikov
1185f04868 json: encode 2020-04-14 00:37:47 +02:00
Alexander Medvednikov
a9a8f8c804 rand: remove duplicate C fn 2020-04-13 20:11:44 +02:00
krischerven
8c0b25a2ab cgen: fix printing alias types 2020-04-13 20:07:25 +02:00
Alexander Medvednikov
7aacf77262 checker: remove an extra fn check 2020-04-13 20:06:20 +02:00
Alexander Medvednikov
24958df565 parser: do not allow duplicate fns; cgen: move fn code to fn.v 2020-04-13 19:59:57 +02:00
yuyi
fb4cfa72cd cgen: fix str() for arrays 2020-04-13 19:18:22 +02:00
Daniel Däschle
a6100be8df parser: fix position of array init
* parser: fix position of array init
* fix checker_error_test.v tests
2020-04-13 19:08:02 +03:00
krischerven
ac67b1ea1b tests: add new type alias syntax tests 2020-04-13 16:44:21 +02:00
Alexander Medvednikov
c36984cc94 fmt: handle indents 2020-04-13 16:36:32 +02:00
Alexander Medvednikov
2bd22aa4a4 parser: type Foo = Bar 2020-04-13 15:06:02 +02:00
Alexander Medvednikov
77fcd572dc fmt: remove unused imports 2020-04-13 15:05:51 +02:00
Daniel Däschle
8cbdb75dd6 cgen: fix match expr multiline error
* cgen: fix match expr multiline error
* Support for multiple statements in the else part of the match.
* Add a test for the match expression with multiple statements.
2020-04-13 13:05:38 +03:00
Delyan Angelov
d691f46f1e ci: skip again repl_test.v till it passed everywhere 2020-04-13 11:17:20 +03:00
Delyan Angelov
99db5f53f7 repl_test.v: fix compilation (non working ones are for now renamed to .skip) 2020-04-13 11:06:52 +03:00
Daniel Däschle
48de1077ec readme: nicer look 2020-04-13 05:11:56 +02:00
krischerven
74ba8f5cc9 tests: add testing for !in 2020-04-13 02:29:07 +02:00
krischerven
78f9f25a00 cgen: fix !in not working with maps 2020-04-13 02:22:55 +02:00
krischerven
a0d6651e0e tests: fix typeof_test 2020-04-13 02:22:14 +02:00
Daniel Däschle
1a4113d245 checker: store errors in []Error 2020-04-13 01:56:01 +02:00
Enzo Baldisserri
da5a1e458b cgen: fix match expr in assert 2020-04-13 01:53:26 +02:00
morganwu
5deb86de4f examples: fix customer pg table name 2020-04-12 21:51:10 +02:00
Alexander Medvednikov
6ada43df61 fmt: test automatic import insertion 2020-04-12 17:57:05 +02:00
Alexander Medvednikov
810a0725ec tests: fix fmt tests 2020-04-12 17:49:31 +02:00
Alexander Medvednikov
0db0c642c3 vfmt: add missing imports automatically 2020-04-12 17:45:04 +02:00
Daniel Däschle
d55f4ab097 cgen: fix error priting struct which has .str already 2020-04-12 16:25:02 +03:00
Daniel Däschle
5818956cdc cgen: % escape in string interpolated literals
* cgen: % escape in c call to _STR
* tests: add test for string % escape
* Add a test for the % escaping when interpolating inside strings
2020-04-12 16:24:23 +03:00
Daniel Däschle
4449468ca4 parser: correct error position on field and method errors 2020-04-12 15:19:07 +03: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
Daniel Däschle
79dad0bca9 parser: fix enum default value in struct
* parser: fix enum default value in struct

* Add a test for the enum default values in structs.

* Fix compilation of vfmt.

* Run vfmt over enum_default_value_in_struct_test.v

* Cleanup spurious , in vfmt output for enum declarations

Co-authored-by: Delyan Angelov <delian66@gmail.com>
2020-04-12 13:35:54 +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
Ned Palacios
db2c656da8 scanner: !in token 2020-04-12 07:30:26 +02:00
yuyi
c3e78b8c8f vdoc: use the new suffix 2020-04-12 02:50:19 +02:00
krischerven
0a03797694 tests: run vfmt 2020-04-12 01:41:26 +02:00
krischerven
1abdf2d68f cgen: fix missing defer in fn main() 2020-04-12 01:38:14 +02:00
Alexey
0f19f9dd51 tests: test call of variadic function with no arguments 2020-04-12 01:37:34 +02: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
Alexander Medvednikov
449d839684 checker: make sure functions return 2020-04-11 21:50:14 +02:00
Alexander Medvednikov
581d836de6 !in operator 2020-04-11 21:31:54 +02:00
Alexander Medvednikov
1b6ae00966 os: rename os_nix.v to os_nix.c.v 2020-04-11 20:43:17 +02:00
lutherwenxu
dc4db87be3 vlib: use new filename format 2020-04-11 19:51:32 +02:00
Alexey
e64db44bb5 ci: don't run backtrace_test twice 2020-04-11 19:38:48 +02:00
Alexander Medvednikov
f91e3a5d3c cgen: arr[i] +=, /=, -= 2020-04-11 19:07:03 +02:00
Alexey
d078e6bb08 net: check if socket descriptor is valid 2020-04-11 19:06:01 +02:00
Alexey
1fde205f97 time: return optional value directly 2020-04-11 18:56:39 +02:00
Alexey
0050c1915b cgen: call module init function if available 2020-04-11 18:38:51 +02:00
Alexander Medvednikov
d0ac69d12e parser: fix sizeof(&Foo) 2020-04-11 18:38:25 +02:00
yuyi
ea960b2ce2 parser: fix inter literal format error 2020-04-11 17:25:39 +02:00
Alexey
df825506fd cgen: fix check for array equality 2020-04-11 17:25:25 +02:00
Alexander Medvednikov
e8afd7a1b7 ci: msvc tests fix 2020-04-11 16:57:02 +02:00
Alexander Medvednikov
2bd20180e9 ci: bring back msvc tests 2020-04-11 16:32:31 +02:00
Alexander Medvednikov
63d747042e cgen: fix sizeof(&int) 2020-04-11 16:24:25 +02:00
Delyan Angelov
61c1535199 assert: generate tos3/1 calls instead of _STR (bugfix) 2020-04-11 16:18:09 +03:00
Delyan Angelov
30714d16d9 c linker: pass -Xlinker -z -Xlinker muldefs only on Linux with -cache 2020-04-11 15:24:23 +03:00
yuyi
c1aba95d7d parser: refactor script & repl handling 2020-04-11 15:06:26 +03:00
Daniel Däschle
be16c5b21d parser: better error on short init struct 2020-04-11 14:56:55 +03:00
Delyan Angelov
5a1af94452 test-fixed: fix compilation 2020-04-11 14:48:59 +03:00
Swastik Baranwal
6ecb6cfe8e tests: add an operator overloading test 2020-04-11 14:39:51 +03:00
Delyan Angelov
c408223bb5 test-fixed: move tests back to the skip_test_files list 2020-04-11 14:35:25 +03:00
Delyan Angelov
001e0b828a test-fixed: fix CI for ubuntu-tcc 2020-04-11 13:41:59 +03:00
Delyan Angelov
15f4594e44 msvc: fix self compile, by avoiding explicit casting to the same type 2020-04-11 13:35:41 +03:00
Delyan Angelov
b10fcc79ba comptime: fix #ifdef/#endif generation 2020-04-11 12:41:48 +03:00
Delyan Angelov
93d2ab200f cheaders: fix selfcompilation with tcc 2020-04-11 12:18:26 +03: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
Delyan Angelov
c64e447749 v: fix CI 2020-04-11 10:50:59 +03:00
Delyan Angelov
95709811e0 v: support VFLAGS, fix 'v run source.v arg after source' 2020-04-11 10:28:43 +03:00
Delyan Angelov
75c6545857 test-fixed: project_with_modules_having_submodules tests compile too 2020-04-11 10:00:22 +03:00
Delyan Angelov
ba799b3f85 builder: support v.mod/@VROOT, fix -cflags and -cache 2020-04-11 09:57:31 +03:00
Alexander Medvednikov
053de0b8e3 checker: check variable mutability 2020-04-11 04:09:41 +02:00
Alexander Medvednikov
9422cd1009 parser: handle mut & receivers; fix checker_error_test 2020-04-11 02:24:00 +02:00
Alexander Medvednikov
8fbae86bb3 vfmt: skip skipped modules; add module test 2020-04-10 22:32:52 +02:00
Alexander Medvednikov
b95a47b5a7 checker: check fn main(); vfmt: fix for{}, module and module comments 2020-04-10 22:27:54 +02:00
Delyan Angelov
fdac3a1f2e ftp.v: fix compilation 2020-04-10 23:23:42 +03:00
Delyan Angelov
4f74410125 test-fixed: always chdir to main v folder before running the tests 2020-04-10 22:40:56 +03:00
Delyan Angelov
217e6f3b8e checker/parser: allow for fixed array with sizes defined with a const 2020-04-10 22:01:22 +03:00
lutherwenxu
514d989a27 builder: parse .c.v and .js.v correctly 2020-04-10 18:25:23 +02:00
Alexander Medvednikov
fc4a05741c cmd/v: remove debug prints 2020-04-10 18:18:50 +02:00
Alexander Medvednikov
f76931c01e cache builtin modules 2020-04-10 18:11:43 +02:00
Daniel Däschle
c815f84722 parser: fix void assign check 2020-04-10 15:53:06 +03:00
Daniel Däschle
42b3b19af4 checker: fix checker enum infix error 2020-04-10 15:44:01 +03:00
Daniel Däschle
adb379dd63 parser: fix string position 2020-04-10 15:40:52 +03:00
Delyan Angelov
83dfc6b9b9 checker: add more checks for multivar assignments 2020-04-10 15:38:43 +03:00
Delyan Angelov
3573030b9b checker: fix error position for assignment expression 2020-04-10 15:14:05 +03:00
Delyan Angelov
3ea563291c big.v: use again @VROOT/ for #flags 2020-04-10 13:09:04 +03:00
Delyan Angelov
60d6543733 comptime: support @VROOT again 2020-04-10 13:02:00 +03:00
Delyan Angelov
917b9b5124 test-fixed: do not skip big_test.v and socket_udp_test.v 2020-04-10 12:35:37 +03:00
yuyi
7f87ac996d test: fix vlib/math/big/big_test.v 2020-04-10 12:26:15 +03:00
Daniel Däschle
0f11d883fa checker: fix error messages and add checker tests
* checker: fix error messages
* tests: fix command and ignore defect output
2020-04-10 11:59:07 +03:00
Delyan Angelov
74ac9ef195 builder: write intermediate .c files in the vtmp folder again 2020-04-10 11:55:04 +03:00
Delyan Angelov
7d564e9791 cgen: skip inc generation for ForCStmt, when empty in the v source 2020-04-10 10:00:14 +03:00
Alexander Medvednikov
d5fb68e3d6 vfmt: fix struct init; run on struct_test.v 2020-04-10 00:36:50 +02:00
Alexander Medvednikov
9b2511133d vfmt: lots of fixes; cmd/v: -keepc; 2020-04-10 00:30:43 +02:00
Daniel Däschle
32550c6d69 scanner: even better error messages 2020-04-10 00:09:34 +02:00
Daniel Däschle
320fad49c5 checker: check enum 2020-04-09 19:23:49 +02:00
Alexander Medvednikov
6ac64c8586 parser: register #flags 2020-04-09 16:39:53 +02:00
Alexander Medvednikov
2b685fc80a table: bring back parse_cflag() 2020-04-09 15:59:22 +02:00
Daniel Däschle
c0d86eb651 cgen: printing pointer should print the address 2020-04-09 15:35:52 +02:00
Alexander Medvednikov
f508955b64 vfmt: fix mod.Type; run vfmt on ast.v 2020-04-09 15:33:46 +02:00
Alexander Medvednikov
f3c917e0aa fmt: fix array receivers; cmd/v: -showcc 2020-04-09 15:05:06 +02:00
Alexander Medvednikov
d7ae9d7279 cgen: optional fixes; make http compile 2020-04-09 14:03:47 +02:00
Alexey
9e201e1f93 tools: don't skip fixed tests 2020-04-09 13:33:19 +02:00
yuyi
87df587f5a parser: fix script and repl error 2020-04-09 12:46:16 +02:00
Alexey
384d401af0 math: fix bits_test 2020-04-09 12:43:37 +02:00
Daniel Däschle
3fbf91a044 cgen: printing pointers 2020-04-09 12:29:29 +02:00
Delyan Angelov
806f86e4e2 assert: pretty print function calls too 2020-04-09 13:24:26 +03:00
Alexey
56c3a8b9a2 base64: fix build 2020-04-09 12:17:01 +02:00
yuyi
89b83400f5 math: fix factorial_test.v error 2020-04-09 04:21:11 +02:00
yuyi
bf20b01586 map: fix map_test.v error 2020-04-09 03:57:08 +02:00
krischerven
8f8f8c418e cgen: implement equality on arrays 2020-04-09 03:55:37 +02:00
ka-weihe
71190c27a9 fmt: align consts 2020-04-09 01:10:08 +02:00
ka-weihe
77d41d03f5 cgen: inline 2020-04-09 00:35:13 +02:00
Alexander Medvednikov
3f480a358e fix type_alias test 2020-04-08 22:34:21 +02:00
Daniel Däschle
1c340174b7 cgen: print nested structs 2020-04-08 22:14:01 +02:00
Alexander Medvednikov
a08e64f37f cgen: operator overloading 2020-04-08 22:12:42 +02:00
Alexander Medvednikov
3521b7ff89 websocket: fmt example + minor fixes 2020-04-08 21:21:58 +02:00
Abdullah Atta
6f8f8d7b1b websocket: eventbus and other cleanup 2020-04-08 21:19:01 +02:00
Alexander Medvednikov
b40fdd9089 scope: find_const 2020-04-08 19:47:20 +02:00
Leah Lundqvist
b28ab2511c websocket: move library files to root of module 2020-04-08 19:44:30 +02:00
Alexander Medvednikov
fa6aaad6df checker: handle x := x 2020-04-08 19:15:19 +02:00
Daniel Däschle
03c307a8c0 parser: fix struct name error 2020-04-08 19:08:54 +02:00
hazohelet
78fc9bd12b fmt: short_module for enum values 2020-04-08 18:55:50 +02:00
Daniel Däschle
d38acb5487 cgen: fix enum print case 2020-04-08 18:55:10 +02:00
Delyan Angelov
3fd547f2e5 flag: fix compilation of programs using flag module 2020-04-08 19:49:32 +03:00
Delyan Angelov
292b165abe tests: use the yellow color for 'the ok, fail, skip, total' line too 2020-04-08 18:49:00 +03:00
Delyan Angelov
e10290eb8e tests: make the SKIP and FAIL labels more distinctive 2020-04-08 18:42:05 +03:00
Alexander Medvednikov
7a218286b3 cgen: fix returning optional consts; fix csv test 2020-04-08 17:21:36 +02:00
Delyan Angelov
3abbdd4a39 tests: fix vlib/os/environment.v 2020-04-08 18:01:19 +03:00
hazohelet
10c4c44d03 parser: allow C struct declaration that lacks body 2020-04-08 16:54:49 +02:00
Daniel Däschle
a61654009f tests: change skip color to yellow instead of red 2020-04-08 16:52:40 +02:00
krischerven
bcb9d90abb cgen: remove redundant spaces in generated C 2020-04-08 16:52:07 +02:00
Delyan Angelov
5247d5924e tests: stats_test.v, pcg32_test.v, splitmix64_test.v now also pass 2020-04-08 17:29:43 +03:00
Daniel Däschle
6bba7d4e3a cgen: enum str() 2020-04-08 15:54:38 +02:00
Delyan Angelov
1388532bd4 tests: fix crc32_test.v 2020-04-08 16:48:13 +03:00
Delyan Angelov
4f7bfaf5d0 tests: sha256_test.v and sha512_test.v also pass now 2020-04-08 16:39:24 +03:00
Delyan Angelov
a8fe3a59b0 tests: fix sha1 test by fixing << | expressions with explicit parenthesis for now. 2020-04-08 16:30:19 +03:00
Alexander Medvednikov
80888b9518 tests: fix fmt test 2020-04-08 14:25:08 +02:00
Alexander Medvednikov
8426db7fe5 copy thecodrr/vws to vlib/net/websocket 2020-04-08 14:22:31 +02:00
Alexander Medvednikov
5ef5712e91 vfmt: do not generate a space if the comment is empty 2020-04-08 14:19:13 +02:00
Alexander Medvednikov
2e78051933 tests: fix in_expression_test 2020-04-08 13:56:09 +02:00
Alexander Medvednikov
eb78396307 parser: fix prefix precedence 2020-04-08 13:53:11 +02:00
Delyan Angelov
c00ec77737 tests: fix compilation of parser_test.v 2020-04-08 05:57:36 +03:00
Delyan Angelov
ef19aa1de6 assert: fix line position, pretty print float literals and casts 2020-04-08 05:47:29 +03: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
Delyan Angelov
f93445a022 tests: cleanup look for assertions. Fix jump to failure in emacs/vim again 2020-04-08 03:45:49 +03:00
Delyan Angelov
8e06f4e519 tests: rename vlib/rand/rand_test.v to random_numbers_test.v to fix sporadic CI fails 2020-04-08 03:04:04 +03:00
Delyan Angelov
b9ec1479e4 checker: allow again fallthrough in or{} blocks of option calls without assignment 2020-04-08 02:56:24 +03:00
Alexander Medvednikov
a6daf2f78e skip crc32_test for now 2020-04-08 01:39:38 +02:00
Alexander Medvednikov
7ff0c3aaa9 cgen/parser: fix unions 2020-04-08 01:20:55 +02:00
Alexander Medvednikov
cdcb8b6c06 fmt: fix 2020-04-08 01:04:08 +02:00
yuyi
9984691eaf parser: fix float_test.v 2020-04-08 01:00:58 +02:00
Alexander Medvednikov
d54150cd22 vfmt: fix struct init indent and wrapped lines 2020-04-08 00:59:28 +02:00
Alexander Medvednikov
2fbed2f880 cgen: fix _ = ... 2020-04-08 00:46:16 +02:00
ka-weihe
7406abe3b6 map: use strcmp and update wyhash 2020-04-08 00:02:15 +02:00
Daniel Däschle
59ac0bd46b cgen: print bool correctly in interpolation 2020-04-07 23:26:20 +02:00
Delyan Angelov
582ee9e643 urllib: put braces in << | expressions in urllib.v to make test pass 2020-04-07 22:58:29 +03:00
Delyan Angelov
cb52dd85e7 tests: add an isolated test case for long struct names with capitalization 2020-04-07 22:03:20 +03:00
Delyan Angelov
589b932f19 compiler: more permissive structure names, that allow URL as a struct name 2020-04-07 22:00:25 +03:00
Delyan Angelov
900a18f955 v test-fixed: mention explicitly only the files that should be skipped 2020-04-07 20:51:42 +03:00
Major Taylor
efeea40520 tools: 'v create' -> 'v new' 2020-04-07 19:37:15 +02:00
Alexander Medvednikov
6bbd1943dd cgen: fix &string cast; vfmt fixes 2020-04-07 18:51:44 +02:00
Daniel Däschle
4aedef367c cgen: print bool and string correctly in struct 2020-04-07 17:52:15 +02:00
Alexander Medvednikov
50d5e23694 ci: node@v1 2020-04-07 17:41:18 +02:00
Alexander Medvednikov
300e75c0f3 ci: use checkout@v2 2020-04-07 17:37:01 +02:00
Daniel Däschle
7cf9b32742 cmd: show cleaner messages, when v can not compile a tool, or update itself 2020-04-07 17:56:33 +03:00
Daniel Däschle
0024ff848d parser: check if the last or {} block expression is valid
These checks allows for:

a) `x := call() or { 'abc' }`
b) `x := call() or { panic('abc') }`
c) `x := call() or { exit(123) }`
d) `x := call() or { continue }`
e) `x := call() or { break }`
f) `x := call() or { return }`

... but produce errors for:

g) `x := call() or { println('an error') }` , etc.
2020-04-07 17:36:00 +03:00
Alexander Medvednikov
275b20a184 vfmt: handle for ;; loops; run vfmt on parser.v 2020-04-07 15:48:13 +02:00
Alexander Medvednikov
8f9a8e1e7f vfmt: small fixes + run on checker.v and fmt.v 2020-04-07 15:15:49 +02:00
yuyi
3c6a4dedd6 tool: fix vgit.v 2020-04-07 13:14:22 +02:00
Alexander Medvednikov
890940292b Revert "cgen: print bool in struct correctly"
This reverts commit 78440be2b2.
2020-04-07 12:56:05 +02:00
Daniel Däschle
78440be2b2 cgen: print bool in struct correctly 2020-04-07 12:39:10 +02:00
yuyi
7bd98ecddb tools: fix performance_compare.v 2020-04-07 12:38:43 +02:00
yuyi
08d90afb8c builder: fix an error on windows 2020-04-07 12:32:49 +02:00
yuyi
426eb46166 test: fix windows test error 2020-04-07 12:32:09 +02:00
Daniel Däschle
fe0942043c checker: check if BranchStmt is in a loop 2020-04-07 12:29:11 +02:00
Alexander Medvednikov
fd75cce0f3 vfmt: minor fixes + tests 2020-04-07 04:05:59 +02:00
Alexander Medvednikov
887f1a73f7 ci: disable x64 test for now 2020-04-07 03:50:25 +02:00
Daniel Däschle
b0dacef32b time: change unix timestamp to u64 2020-04-07 03:35:47 +02:00
Alexander Medvednikov
605cad3411 ci: msvc: disable tests for now 2020-04-07 03:30:14 +02:00
lutherwenxu
a8c92e6dff checker: remove hack and enforce type checking 2020-04-07 03:27:06 +02:00
Alexander Medvednikov
fa5fcee584 cmd/v: fix run args 2020-04-07 03:21:32 +02:00
Alexander Medvednikov
fa4fb3b847 cmd/v: set is_run 2020-04-07 01:23:36 +02:00
Alexander Medvednikov
33644a4f91 cmd/v: fix run 2020-04-07 01:09:25 +02:00
Alexander Medvednikov
b7560fe4bf parser: do not allow duplicate methods; builder: cleaning up 2020-04-07 01:02:48 +02:00
Alexander Medvednikov
8d150d427a merge and simplify cmd/v and v.builder 2020-04-07 00:44:31 +02:00
Delyan Angelov
8da12eb8a7 errors: column index tweaks for emacs/vim 2020-04-06 23:15:53 +03:00
unclenorton
7b41eaf136 Update readme 2020-04-06 21:24:32 +02:00
Delyan Angelov
333e725380 errors: remove 0 from caret line 2020-04-06 20:41:33 +03:00
Delyan Angelov
bc2ea2f3d4 errors: fix caret position on lines with tabs 2020-04-06 20:35:24 +03:00
Delyan Angelov
3b3d248637 scanner: use formatted errors for s.error too 2020-04-06 19:58:32 +03:00
ka-weihe
5be892c635 cheaders: update wyhash to version gamma 2020-04-06 18:47:29 +02:00
Alexander Medvednikov
7f516dbae2 cgen: minor optionals fixes 2020-04-06 18:46:50 +02:00
Delyan Angelov
d74eb99066 errors: do not bold the actual error message content 2020-04-06 19:46:23 +03:00
Delyan Angelov
7a99949f0e errors: print more informative and pretty errors 2020-04-06 19:40:20 +03:00
Alexander Medvednikov
d865fc26eb http: fix method_and_url_to_response definition 2020-04-06 17:42:47 +02:00
lutherwenxu
e8b26b1b8d checker: make struct_init check more robust 2020-04-06 17:39:52 +02:00
yuyi
4d5fe14968 log: fix example error 2020-04-06 17:22:53 +02:00
Alexander Medvednikov
2006995020 cmd/v: remove clang-format (the generated code is pretty from the start) 2020-04-06 17:11:01 +02:00
Alexander Medvednikov
87c00a61da strconv: fix compilation 2020-04-06 14:53:28 +02:00
Alexander Medvednikov
35fbac8d56 parser/cgen: default struct field values 2020-04-06 14:45:48 +02:00
Major Taylor
f099f90f50 string: fix trim_right, add tests 2020-04-06 14:30:25 +02:00
Alexander Medvednikov
f59c9133da cgen: temporary headers fix 2020-04-06 14:22:59 +02:00
Alexander Medvednikov
1275241133 Update README.md 2020-04-06 13:59:27 +02:00
Alexander Medvednikov
be014fcdd6 checker: << check; initial #flag os support 2020-04-06 02:05:11 +02:00
ka-weihe
a30d292385 map: fix leaksfree fix (#4254) 2020-04-05 23:31:53 +02:00
Alexander Medvednikov
edb93914bb vfmt: re-run on fmt.v 2020-04-05 23:30:16 +02:00
Alexander Medvednikov
852ec61b34 vfmt: fix single line if 2020-04-05 23:00:21 +02:00
ka-weihe
307daacf67 depgraph/map: fix memory bug 2020-04-05 22:09:52 +02:00
Alexander Medvednikov
ffe8452f02 vfmt: fix imports 2020-04-05 21:53:00 +02:00
Alexander Medvednikov
08bbc251ff vfmt: fix multiline comments 2020-04-05 19:35:10 +02:00
Alexander Medvednikov
8260236331 vfmt: run on fmt.v 2020-04-05 18:15:50 +02:00
Alexander Medvednikov
e464c4acc5 vfmt: more fixes + run on cgen.v 2020-04-05 18:03:36 +02:00
Alexander Medvednikov
df45932c03 vfmt: fix same line stmt comments 2020-04-05 16:38:33 +02:00
Daniel Däschle
fe05f310fb make: remove /tmp/vc and /var/tmp/tcc when V_ALWAYS_CLEAN_TMP is set 2020-04-05 17:36:13 +03:00
Alexey
781c20a6ae cgen: bring back Windows fixes 2020-04-05 16:08:16 +02:00
Delyan Angelov
206c1f4ca1 os: implement os.is_writable_folder/1 2020-04-05 16:56:54 +03:00
Delyan Angelov
f139e98745 launch_tool: use println for verbose messages instead of eprintln 2020-04-05 15:31:09 +03:00
Alexey
901f69e122 ci: extend tests 2020-04-05 15:20:28 +03:00
Alexey
48dfa6edc3 .editorconfig: extend rules to .yml and .md files
Added a rule for YAML files
    Ensure we all use the same settings
    Enabled trim_trailing_whitespace for all files, except Markdown ones
    Removed unused comments
    Some of them are even irrelevant
2020-04-05 15:14:19 +03:00
Delyan Angelov
44a271d9e9 v version: show only vhash, when vhash and current_hash are the same 2020-04-05 14:47:01 +03:00
lydiandy
35fab2bb7b ast: pub interface field 2020-04-05 12:31:39 +02:00
Alexey
9c1eaaeb49 cgen: declare empty structs correctly 2020-04-05 12:31:25 +02:00
Alexander Medvednikov
de701ccfac fmt: struct field comments on the same line 2020-04-05 12:25:39 +02:00
Delyan Angelov
0869b230fb ci: fix ci.yml syntax 2020-04-05 13:04:24 +03:00
Delyan Angelov
86a649e017 ci: fix ci.yml syntax 2020-04-05 13:03:01 +03:00
Delyan Angelov
77fcac027e ci: fix tcc, by not running vlib/v/tests/backtrace_test.v there for now 2020-04-05 13:01:48 +03:00
Delyan Angelov
75518e5bb9 ci: extract separate working_with_an_empty_struct_test.v 2020-04-05 12:55:54 +03:00
Delyan Angelov
fde88a2c51 ci: implement 'v test-fixed' and use it on ubuntu,tcc,msvc jobs 2020-04-05 12:40:17 +03:00
Delyan Angelov
5e76d53fcd compiler: support default values in optional blocks 2020-04-05 11:59:15 +03:00
Alexander Medvednikov
05fbe5ab7a parser: move comments 2020-04-05 04:05:09 +02:00
Alexander Medvednikov
2a06263a5b vfmt: more fixes; enable v fmt and v fmt -w 2020-04-05 03:37:38 +02:00
Alexander Medvednikov
97db4c0e9a vfmt: comments and other fixes 2020-04-05 02:08:13 +02:00
Delyan Angelov
45fdbc4df7 support pretty printing of StringInterLiteral in asserts too 2020-04-05 00:51:49 +03:00
Daniel Däschle
e077cce103 vlib: add inode/mode information functionality (#4242)
* vlib: add inode/mode information functionality

* vlib: add docs to inode
2020-04-05 00:37:13 +03:00
Delyan Angelov
ef59bac511 Add passing math, bitfield, os, and strconv tests to the temporary list, run on the Ubuntu CI. 2020-04-05 00:35:54 +03:00
Alexey
98086d7259 strconv: fix atof test 2020-04-04 23:28:47 +02:00
Delyan Angelov
774fb7e850 fix 'assert false' pretty printing 2020-04-05 00:12:16 +03:00
Delyan Angelov
45401954fa fix vlib/os/os_test.v 2020-04-04 23:06:47 +03:00
Delyan Angelov
b0567543c9 add support for errcode in or{} optional blocks. 2020-04-04 21:47:57 +03:00
Alexey
abd0686043 cgen: fix struct initialization 2020-04-04 17:59:49 +02:00
Alexey
bb587c27a8 bitfield: update module 2020-04-04 17:59:26 +02:00
Delyan Angelov
8f06d60084 fix vlib/bitfield/bitfield_test.v 2020-04-04 18:03:06 +03:00
Alexander Medvednikov
33b03449d5 tools: remove vnames.v for now 2020-04-04 16:39:08 +02:00
Alexander Medvednikov
e600feda98 cgen: __argc is already used on windows 2020-04-04 15:59:46 +02:00
Alexey
b8f1152408 clipboard: fix build on Windows 2020-04-04 15:37:13 +02:00
Alexey
6455e57e82 fmt: process C function declarations correctly 2020-04-04 15:36:46 +02:00
krischerven
1960c6f4cb checker: make an error message less ambiguous 2020-04-04 15:36:12 +02:00
Delyan Angelov
4c8703416e fix vlib/math/math_test.v 2020-04-04 16:07:42 +03:00
Alexander Medvednikov
f748390172 parser: do no allow var names with __; cgen: use __argc 2020-04-04 14:55:40 +02:00
Alexander Medvednikov
95a1bd8470 cgen: handle C typedefs 2020-04-04 14:32:42 +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
krischerven
4c6db7a64e cgen: fix mutable arrays 2020-04-04 14:08:38 +02:00
Delyan Angelov
133842bf95 Remove unused self import of v.util into v.util . 2020-04-04 14:49:08 +03:00
joe-conigliaro
b4e5e36d4a checker: var opt & temp [] & non array init error & bug notes 2020-04-04 22:32:16 +11:00
Alexander Medvednikov
d1f653f9bd parser: fix GG struct init 2020-04-04 13:11:50 +02:00
Alexander Medvednikov
c0d4503f25 gl/glfw: update C definitions 2020-04-04 12:56:35 +02:00
Alexey
d56276017c cgen: fix variadics called with 0 vargs 2020-04-04 12:54:45 +02:00
yuyi
8ba6e45d83 time: fix unix_time 2020-04-04 12:10:56 +02:00
lutherwenxu
4bade9bcea cmd/v: fix argument parsing 2020-04-04 12:09:34 +02:00
Alexey
c6fabea49d cgen: generate code for go statement for Windows 2020-04-04 12:09:05 +02:00
yuyi
0796eb4149 os: optimize os_windows.v 2020-04-04 11:59:25 +02:00
Alexey
5313a1401f checker: show actual field name in warn message 2020-04-04 11:57:45 +02:00
Alexey
72df30050d term: fix get_terminal_size on Windows 2020-04-04 11:56:43 +02:00
joe-conigliaro
97d8633557 checker: constant cycle & test fix 2020-04-04 17:05:26 +11:00
joe-conigliaro
c9e290b36f table: simplify/generalise type fns & remove calls 2020-04-04 16:37:11 +11:00
joe-conigliaro
bf59828897 ast: const impl & global scope & objects 2020-04-04 14:14:40 +11:00
yuyi
bb5ed66bb4 eval: fix new_checker call 2020-04-04 02:03:41 +02:00
Delyan Angelov
f8b4a6f168 Disable vfmt for now. 2020-04-03 22:21:17 +03:00
Alexander Medvednikov
1d2de44e19 cgen: fix print(ptr); checker: uninitialized reference error/warning 2020-04-03 20:17:53 +02:00
Alexander Medvednikov
436ef12730 cgen: str(): handle empty structs 2020-04-03 18:49:15 +02:00
Delyan Angelov
b411d29577 v2: fix support for 'go fn()' in modules. sync.pool is again multithreaded. 2020-04-03 19:44:49 +03:00
Alexander Medvednikov
c32ed8af51 cgen: struct str() generation; go() fixes 2020-04-03 18:05:53 +02:00
Delyan Angelov
31c4b1cda6 v2: compile vfmt again; consistent colored error messages 2020-04-03 18:42:22 +03:00
Alexander Medvednikov
52f096f5d9 cgen: go xxx() 2020-04-03 15:18:20 +02:00
Alexey
6a5cc0fa19 tests: update assert output 2020-04-03 13:39:11 +02:00
Alexey
6c4de001b8 cgen: add builtin.init call inside of _vinit 2020-04-03 13:27:19 +02:00
yuyi
50b9faf347 doc: fix doc command error running in vroot 2020-04-03 12:00:33 +02:00
Alexey
4cde6c0865 fmt: process TypeOf node 2020-04-03 11:59:53 +02:00
Alexander Medvednikov
87a185ea9c checker: remove newlines after errors 2020-04-03 11:09:02 +02:00
Alexander Medvednikov
0dad1a89e6 checker: much less verbose error messages 2020-04-03 11:01:09 +02:00
Alexander Medvednikov
1d52847924 checker: error on an unknown ident 2020-04-03 10:52:48 +02:00
Alexander Medvednikov
a25f47124d cgen: make array_set/map_set work with pointers 2020-04-03 10:41:01 +02:00
Alexey
ef339a4896 rand: update module 2020-04-03 08:53:57 +02:00
yuyi
5e6aa5371a scanner: minor optimization (#4211) 2020-04-03 09:46:54 +03:00
Delyan Angelov
6b9bf8cbf7 v2: fixes for most of vlib/builtin/map_test.v . 2020-04-03 00:42:08 +03:00
Delyan Angelov
07c53b1b70 v2: report ill defined consts by name/line, not only how many they are 2020-04-02 22:33:36 +03:00
Alexey
5b6ec8996a sync: fix build on Windows 2020-04-02 20:58:07 +02:00
hazohelet
0e6fe0a4f2 V: fix const bugs and pass const_test.v (#4206)
* fix const bug in v2

* v2: fix const decl

* small comment fix
2020-04-02 19:39:17 +02:00
Alexey
6309e699e5 builtin: add operator precedence test 2020-04-02 19:02:49 +02:00
Alexander Medvednikov
16acc5f312 cmd/v: -backend 2020-04-02 18:34:55 +02:00
Alexander Medvednikov
1eeb5a29ff Update feature_request.md 2020-04-02 18:29:51 +02:00
Alexander Medvednikov
b541117184 Update bug_report.md 2020-04-02 18:29:39 +02:00
Alexander Medvednikov
804d303487 cgen: add () for | and ^ 2020-04-02 18:26:56 +02:00
Alexander Medvednikov
50dabc8a49 fix valgrind_test 2020-04-02 18:22:36 +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
Alexander Medvednikov
fd12e4e826 fix compiler_test.v 2020-04-02 18:12:10 +02:00
Alexander Medvednikov
914e9df6ba Update README.md 2020-04-02 18:05:21 +02:00
Delyan Angelov
61f79270a8 v2: compiler_test.v should fail on errors. 2020-04-02 19:01:31 +03:00
Alexander Medvednikov
d41b7bc813 Update README.md 2020-04-02 17:58:00 +02:00
Alexander Medvednikov
e305757d07 cmd/v: handle -cc and -cg 2020-04-02 17:55:00 +02:00
Alexander Medvednikov
d228b3916b cmd/v: further simplifications 2020-04-02 17:46:43 +02: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
Alexander Medvednikov
40fd924b15 parser: match must be exhaustive; cmd/v: one verbosity level, simpler version 2020-04-02 16:51:16 +02:00
Alexander Medvednikov
f087e819d7 cli: minor fixes 2020-04-02 16:04:57 +02:00
SleepyRoy
d5b2eb3c23 test: remove old num_lit_call_method 2020-04-02 15:52:46 +02:00
Delyan Angelov
ad9848d983 fix cmd/tools/vtest.v build
This PR enables building them again with v2, by making vlib/sync/pool.v
single threaded for now, and by removing the use of generics till they
are fixed in v2.
2020-04-02 15:52:23 +02:00
Delyan Angelov
4ada412a05 v2: stage 2 for enhancing 'v version' with the current git commit hash 2020-04-02 15:51:48 +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
ed05dc8984 ci: enable msvc build 2020-04-02 14:36:10 +02:00
Alexander Medvednikov
be327962d3 strconv: remove an assert for now 2020-04-02 14:26:35 +02:00
Alexander Medvednikov
5b53b3d7e3 cgen/os: minor fixes 2020-04-02 14:00:28 +02:00
Alexander Medvednikov
6e380b8897 cgen: brin back hashes() 2020-04-02 13:49:59 +02:00
Alexander Medvednikov
5b835d294c more windows fixes + bring back windows ci 2020-04-02 13:44:46 +02:00
Alexander Medvednikov
1178bfa578 windows: a temp SUCCESS fix 2020-04-02 13:31:37 +02:00
Delyan Angelov
084f853a2a v2: enhance version with current git commit hash. Cleanup redundant code. 2020-04-02 13:31:02 +02:00
Alexander Medvednikov
d9c7253836 windows: "".to_wide() fixes 2020-04-02 13:24:23 +02:00
Alexander Medvednikov
1fe2933dd9 cgen: windows fixes 2020-04-02 13:09:39 +02:00
Alexander Medvednikov
4981c5a870 parser: fix public interfaces 2020-04-02 12:53:25 +02:00
yuyi
86ea886ad7 scanner: uniform bool type variable names 2020-04-02 12:23:18 +02:00
Delyan Angelov
12b8dc2613 v2: fix version 2020-04-02 10:48:29 +02:00
Alexander Medvednikov
d57b1ca962 fix valgrind test 2020-04-02 10:44:35 +02:00
Alexander Medvednikov
ce771c7a5a ci: remove prod_test for now 2020-04-02 10:31:06 +02:00
Alexander Medvednikov
2fc70900d3 ci: fix syntax error 2020-04-02 10:24:34 +02:00
Alexander Medvednikov
ddb182c988 ci: add more temporary tests 2020-04-02 10:23:24 +02:00
Alexander Medvednikov
461a5b2c18 cgen: fix raw strings 2020-04-02 10:15:35 +02:00
Alexander Medvednikov
1e99968607 ci: test a failed test 2020-04-02 09:50:58 +02:00
Alexander Medvednikov
fcea7f6c9d ci: temporary tests 2020-04-02 09:40:53 +02:00
Alexander Medvednikov
683aa75b8d cgen: fix filter() 2020-04-02 09:32:10 +02:00
Alexey
7b83a3332b make: fix removing files; remove unused echo calls 2020-04-02 09:27:25 +02:00
yuyi
24499aa6de scanner: minor refactoring 2020-04-02 09:27:00 +02:00
krischerven
dac304195e cgen: print: support all the same functionality as println 2020-04-02 09:19:57 +02:00
Major Taylor
3eff266eb9 cgen: vcleanup call fix (#4186) 2020-04-02 09:18:45 +02:00
krischerven
561b7a0ea5 enum: make .str() print the name instead of the value 2020-04-02 03:27:06 +02:00
Alexander Medvednikov
97fbc3dd61 ci fixes 2020-04-02 02:17:33 +02:00
Alexander Medvednikov
07ea1eff81 glfw: more fn definitions 2020-04-02 02:02:12 +02:00
Alexander Medvednikov
507f4ce87a array: handle "0" strings 2020-04-02 01:47:32 +02:00
Alexander Medvednikov
88d15c6611 gl, glfw, freetype fixes 2020-04-02 01:45:22 +02:00
Alexander Medvednikov
1cfe44d9c6 fix windows build 2020-04-02 01:15:00 +02:00
SleepyRoy
74bdc57fad tests: fix num_lit_call_method_test 2020-04-02 00:18:29 +02:00
Alexander Medvednikov
fb4b93dfc0 ci fixes 2020-04-02 00:10:11 +02:00
Alexander Medvednikov
91ffeeb73b parser: fix (x mut &X) 2020-04-01 23:56:55 +02:00
Alexander Medvednikov
c6cf8ace22 glfw and tetris fixes; temporary ci fixes 2020-04-01 23:49:11 +02:00
Alexander Medvednikov
24fc4a4c04 use autofree only with -autofree for now 2020-04-01 23:28:56 +02:00
Alexander Medvednikov
39434155f8 short struct init syntax 2020-04-01 23:23:20 +02:00
Alexander Medvednikov
d9af06f2ad remove remaining files in vlib/compiler 2020-04-01 22:19:09 +02:00
Alexander Medvednikov
8dfb14b1c4 remove 15k lines of code of the old backend; make V2 the default backend 2020-04-01 21:25:31 +02:00
Alexander Medvednikov
30f306dc1a another vfmt2 fix 2020-04-01 18:25:05 +02:00
Alexander Medvednikov
f657c4b514 another vfmt2 fix 2020-04-01 18:16:56 +02:00
Alexander Medvednikov
3ef6436bef fix fmt2 test 2020-04-01 17:52:50 +02:00
Alexander Medvednikov
e3713de41d fix compilation 2020-04-01 17:17:35 +02:00
Alexander Medvednikov
0de853a2ab v2: lots of minor test fixes 2020-04-01 17:14:21 +02:00
joe-conigliaro
6764c7dd5c parser/cgen: typeof test fixes - match & fixed array order 2020-04-02 02:13:21 +11:00
yuyi
bd8d51fc95 token: small optimizations 2020-04-01 16:50:56 +02:00
Alexander Medvednikov
5a0bfa03b3 fix tests 2020-04-01 15:39:54 +02:00
Alexander Medvednikov
3dae1cc131 move sdl module to github.com/vlang/sdl 2020-04-01 15:27:28 +02:00
Alexander Medvednikov
7fd81d3abb parser: fix ^=; disable generics and interface map tests for now 2020-04-01 15:15:21 +02:00
krischerven
3e129cef8f .gitignore: add vim files 2020-04-01 14:57:01 +02:00
SleepyRoy
7bbcc484fb examples: calculator 2020-04-01 14:19:57 +02:00
Alexander Medvednikov
b1b811b5ed v2: static (for translated code only) 2020-04-01 13:38:05 +02:00
Alexander Medvednikov
48832200bb parser: allow types that start with &&; cgen: allow ++/-- exprs for now 2020-04-01 13:18:58 +02:00
yuyi
56a9196be8 token: fix nr_tokens 2020-04-01 12:12:25 +02:00
yuyi
b28e372106 scanner: small optimization 2020-04-01 12:11:52 +02:00
Major Taylor
9bb1b5d1bb v2: enum fields separated by commas 2020-04-01 12:11:00 +02:00
Delyan Angelov
5b990078f9 more precise support for internal module tests 2020-03-31 23:42:30 +02:00
Alexander Medvednikov
2ac074655f fix interface test 2020-03-31 21:05:48 +02:00
Alexander Medvednikov
050ec5d9e3 parser: do not allow string{} outside of builtin 2020-03-31 21:03:21 +02:00
Alexander Medvednikov
a3bd19ce73 cgen: generate enums earlier 2020-03-31 20:26:15 +02:00
Alexander Medvednikov
2b563bc69f v2: initial interface support; fix enum_hex_test.v 2020-03-31 19:59:41 +02:00
Delyan Angelov
50143ad9bf v2: be silent by default 2020-03-31 19:58:44 +02:00
Alexander Medvednikov
2fe0e80569 cgen: enum default values 2020-03-31 19:43:11 +02:00
Alexander Medvednikov
43f72246aa checker: fix index type check 2020-03-31 17:51:16 +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
joe-conigliaro
d048bf66b0 cgen: optimize/generalize typ method 2020-04-01 00:18:25 +11:00
Alexander Medvednikov
956bf23390 memory fixes: 21% of V compiler leaks fixed 2020-03-31 14:33:16 +02:00
SleepyRoy
9b9c1cc834 scanner: fix number literal calling method 2020-03-31 12:47:32 +02:00
Delyan Angelov
b62035e3d0 solaris & termux: fix both, using the more portable termios.h 2020-03-31 12:46:46 +02:00
joe-conigliaro
21e4f2422d cgen: clarify field name 2020-03-31 19:11:47 +11:00
joe-conigliaro
f8169fee48 table: add i8 to number_type_idxs 2020-03-31 16:17:26 +11:00
joe-conigliaro
f58875a202 table: i8 -128 was being cast to int closes #4164 2020-03-31 16:07:30 +11:00
joe-conigliaro
3b621c0ce6 checker: make var_scope mutable 2020-03-31 15:41:14 +11:00
joe-conigliaro
602bc06bee ast: use multi return optional for find_scope_and_var 2020-03-31 15:39:14 +11:00
joe-conigliaro
71ca553190 cgen: multi return/assign optionals 2020-03-31 15:34:59 +11:00
Delyan Angelov
07de351546 v2: support -stats for _test.v files 2020-03-30 17:21:32 +02:00
joe-conigliaro
3440d7edd8 ast: first step merging CallExpr & MethodCallExpr 2020-03-30 21:39:20 +11:00
Delyan Angelov
7785583b34 android: fix termux build 2020-03-29 20:54:21 +02:00
hazohelet
ec025f2020 compiler: use type unresolved for unresolved consts 2020-03-29 19:26:55 +02:00
Alexey
bf9f3057da gitignore: ignore tcp_echo_server executable 2020-03-29 10:10:24 +02:00
yuyi
c9eed0b89b cgen: optimize a replace call 2020-03-29 10:09:27 +02:00
Alexey
a333ac1888 all: remove redundant parentheses in if statements 2020-03-29 10:08:42 +02:00
Delyan Angelov
e09447d011 v and v2: support @VEXE 2020-03-28 21:51:45 +01:00
vamsi-shankar
715d4f6601 math: copysign() 2020-03-28 18:32:38 +01:00
Delyan Angelov
fa02130359 examples/tcp_echo_server: cleanup, use defer{} 2020-03-28 18:10:48 +01:00
Delyan Angelov
a9724fd38d v2: typeof() 2020-03-28 17:37:22 +01:00
joe-conigliaro
837bffd03a parser: parse type - fix multiple & 2020-03-29 01:15:10 +11:00
Alexander Medvednikov
831be43740 checker: check ! operator 2020-03-28 14:38:16 +01:00
joe-conigliaro
718819eb7a map/scope/checker: update just var type & ret zero in map.get3 2020-03-29 00:00:28 +11:00
yuyi
9fb218d379 glfw: temporary fix 2020-03-28 12:47:24 +01:00
Delyan Angelov
784d27f41b examples: add a simple self contained tcp echo server 2020-03-28 10:21:22 +01:00
Alexey
cedf185b41 v2: fix Windows errors 2020-03-28 10:19:38 +01:00
Alexander Medvednikov
4541f29019 ci: install V UI 2020-03-28 09:12:16 +01:00
Alexander Medvednikov
479d5d676e ci: test V UI 2020-03-27 22:09:14 +01:00
Alexander Medvednikov
f627710870 fix repl tests 2020-03-27 20:49:20 +01:00
Alexander Medvednikov
98a0beab03 cgen: generate str() methods; merge c tests 2020-03-27 20:33:30 +01:00
Alexander Medvednikov
eed7c91e87 move compiler tests from compiler/ to v/ 2020-03-27 18:01:46 +01:00
Delyan Angelov
95e67c9502 contributing.md: update git instructions 2020-03-27 16:03:06 +01:00
Alexander Medvednikov
f6db36d7f0 fix parser_test and vfmt.v 2020-03-27 15:24:08 +01:00
Alexander Medvednikov
7369cb7b86 fmt: fix tests 2020-03-27 15:19:13 +01:00
Alexander Medvednikov
473d9fef55 checker: do not allow extra () in if conditions 2020-03-27 14:57:19 +01:00
Alexander Medvednikov
1a751208ca cgen: skip $if os {} block 2020-03-27 14:44:30 +01:00
Alexander Medvednikov
3a691dcc6d ci: fix v2 self compilation 2020-03-27 11:48:06 +01:00
Alexander Medvednikov
cb747316ed ci: V2 self compilation 2020-03-27 11:39:16 +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
yuyi
ed42b864c1 term: fix #4066 2020-03-27 10:01:46 +01:00
r00ster
bee8972632 readline: make some functions public 2020-03-27 09:55:15 +01:00
Alexander Medvednikov
db59c621e8 v2: minor fixes 2020-03-27 08:47:02 +01:00
Joe Conigliaro
883a105aca cgen: fix tests 2020-03-27 17:28:04 +11:00
Joe Conigliaro
7ce7151ad2 cgen: v2 compiles itself - defer stmt / if * in opt parens. 2020-03-27 17:21:22 +11:00
penguindark
8de027c4b4 strconv: fix on ftoa string decimal aproximation, 'nan' string fix 2020-03-26 22:39:46 +01:00
Alexander Medvednikov
9185de3fb7 cgen: fix tests 2020-03-26 22:28:24 +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
yuyi
6892a3e0a8 glfw: remove excess glfw. in module glfw 2020-03-26 17:32:08 +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
c71d36356b v2: optionals fixes 2020-03-26 14:58:11 +01:00
Alexander Medvednikov
b288bf2e7c cgen: or{} for methods 2020-03-26 14:42:14 +01:00
yuyi
9c5de77f12 os: ext => file_ext 2020-03-26 14:18:08 +01:00
yuyi
a6347118cd pg: add windows include and lib flag 2020-03-26 14:17:13 +01:00
Joe Conigliaro
1d0f3abadf cgen/checker: variadic method call fix 2020-03-26 22:40:14 +11:00
Joe Conigliaro
b1d15afe61 checker: array slice type 2020-03-26 22:04:24 +11:00
Alexander Medvednikov
fc86269bc9 checker: array str fixes 2020-03-26 11:32:32 +01:00
Joe Conigliaro
f452518a63 cgen: fix typo & use expected type 2020-03-26 21:11:56 +11:00
Joe Conigliaro
9c6ac7cb71 cgen: fix variadics called with 0 vargs 2020-03-26 21:09:59 +11:00
Alexander Medvednikov
f2c9592b86 cgen: fix () in & exprs 2020-03-26 10:44:59 +01:00
Alexander Medvednikov
1f3428f282 cgen: basic assert 2020-03-26 10:27:46 +01:00
Alexander Medvednikov
ec4be80bcc Revert "db: increase db module level in vlib "
This reverts commit cd6d175180.
2020-03-26 09:23:54 +01:00
yuyi
cd6d175180 db: increase db module level in vlib 2020-03-26 09:21:34 +01:00
Delyan Angelov
fb4f7b6827 v2: enable compilation of short programs with no 'import os' 2020-03-26 09:20:55 +01:00
hazohelet
d8bcd13e86 compiler: fix #3973 by dealing with name mangling problem 2020-03-26 08:54:33 +01:00
Delyan Angelov
d54843275f os_test.v: simplify cleanup 2020-03-26 00:09:30 +01:00
Alexander Medvednikov
aa34d3a4c4 cgen: remove a space 2020-03-25 23:57:46 +01:00
Alexander Medvednikov
25ee30d8cb cgen: fix optional functions with unused return values 2020-03-25 23:57:22 +01:00
Alexander Medvednikov
89a05a474f valgrind tests: skip C warnings for now 2020-03-25 21:46:46 +01:00
Alexander Medvednikov
3b4e0147cd cgen: fix tests 2020-03-25 17:26:03 +01:00
Alexander Medvednikov
7070b1cda9 cgen: GotoStmt, err variable 2020-03-25 17:24:55 +01:00
Alexander Medvednikov
26fab9b274 cgen: fix mutable array args 2020-03-25 17:04:16 +01:00
Alexander Medvednikov
41a089e513 cgen: or block 2020-03-25 16:00:22 +01:00
Alexander Medvednikov
456750ac19 v2: array_test fixes 2020-03-25 14:24:48 +01:00
yuyi
aa0643f785 glfw: fix mut scale bug 2020-03-25 13:44:21 +01:00
Alexander Medvednikov
60fbceea43 memory: free_scope_vars() 2020-03-25 12:26:59 +03:00
Joe Conigliaro
bb76e5da91 parser: array map fixe 2020-03-25 20:09:50 +11:00
Joe Conigliaro
8ba46965b6 checker: array map fixes 2020-03-25 20:07:53 +11:00
Alexander Medvednikov
b495e78f0e v2: add _vinit to tests' fn main 2020-03-25 00:17:39 +01:00
Alexander Medvednikov
a3046b68da cgen: fix tests 2020-03-24 23:41:34 +01:00
Alexander Medvednikov
7f345e310b cgen: fix const name 2020-03-24 22:41:01 +01:00
Alexander Medvednikov
cc9537dd8a cgen: fix tests 2020-03-24 22:35:05 +01:00
Alexander Medvednikov
437bba5566 cgen: generate fn main for tests; fix consts bug 2020-03-24 22:24:03 +01:00
Delyan Angelov
2a7bc63919 vmft2: support for multiline comments, CompIf, AssertStmt, octal literals 2020-03-24 22:18:58 +01:00
Alexander Medvednikov
0e240458d3 os: fix os_test 2020-03-24 17:16:00 +01:00
Alexander Medvednikov
5d976d841b v2: raw strings 2020-03-24 17:07:27 +01:00
Joe Conigliaro
4d3362358f parser: array init &element fix 2020-03-25 02:24:23 +11:00
Alexander Medvednikov
32c8eb6490 os: vfmt os_test.v 2020-03-24 16:18:37 +01:00
Alexander Medvednikov
e012966291 parser/ast: Block 2020-03-24 15:44:17 +01:00
Joe Conigliaro
7aff0cb84f cgen: remove special case for malloc 2020-03-25 00:46:00 +11:00
Joe Conigliaro
d98bb44490 cgen: remove 0 typ checks & unused var 2020-03-24 22:55:41 +11:00
Joe Conigliaro
9a8bd3f7fa checker: variadic method fix 2020-03-24 22:39:11 +11:00
Alexander Medvednikov
f101e9b9e2 v2: string fixes, is_dir fix 2020-03-24 11:14:11 +01:00
Joe Conigliaro
3d2fafa580 cgen: variadic for in loop 2020-03-24 19:42:16 +11:00
joe-conigliaro
309a905409 cgen: remove unused var 2020-03-24 17:27:20 +11:00
joe-conigliaro
e5a111396c cgen: add for map 2020-03-24 17:25:10 +11:00
Joe Conigliaro
0433e24b7f cgen: array init fix 2020-03-24 13:31:16 +11:00
Delyan Angelov
efe21fed66 v2: fix hello world compilation with tcc 2020-03-23 21:26:48 +01:00
Alexander Medvednikov
9c536f2233 compiler: hide the u64 warning for now 2020-03-23 21:00:20 +01:00
Alexander Medvednikov
1cb45e9916 compiler_test: do not run on windows for now 2020-03-23 20:36:34 +01:00
Alexander Medvednikov
ae2d001261 tests: fix the new v2 output tests 2020-03-23 20:30:20 +01:00
SleepyRoy
67ba56c65c expression: set integer literals as int by default 2020-03-23 20:05:37 +01:00
Major Taylor
5c9cbae10d term: fix divide by 0 error on empty delimiter 2020-03-23 20:05:08 +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
Joe Conigliaro
80676cf44f cgen: fix struct init 0 fields & tests 2020-03-23 21:57:54 +11:00
Joe Conigliaro
e13bbd8c40 cgen: map init struct fields & fn type arg fix 2020-03-23 21:17:14 +11:00
Alexander Medvednikov
c808430643 cgen: optimize type_default() 2020-03-23 09:17:32 +01:00
Alexander Medvednikov
4867803f6b cgen: zero struct fields during initialization 2020-03-23 08:59:34 +01:00
joe-conigliaro
a5bd98610f cgen: call arg ref fix 2020-03-23 17:23:10 +11:00
Joe Conigliaro
89af7e7a5b cgen: replace reserved C keywords in identifiers 2020-03-23 13:36:50 +11:00
yuyi
2efc37947d time: calc_unix => unix_time 2020-03-22 19:43:59 +01:00
Chris
e78b97652b glfw: fix "scale is declared as mutable" 2020-03-22 18:39:17 +01:00
Alexander Medvednikov
b69ebd73b2 cgen: minor fixes. v2 can now compile itself! 2020-03-22 16:55:42 +01:00
Joe Conigliaro
99de98ffc7 cgen: fix test 2020-03-23 02:30:45 +11:00
Joe Conigliaro
076bc2b773 cgen/checker: fixes & fixes & tmp fixes :D 2020-03-23 02:22:49 +11:00
Alexander Medvednikov
c0df54b7d3 checker: check $if else 2020-03-22 14:56:13 +01:00
Alexander Medvednikov
ce73ced932 cgen: #else 2020-03-22 14:54:31 +01:00
Alexander Medvednikov
2738a0c776 cgen: backtrace and sigaction fixes 2020-03-22 14:47:45 +01:00
Joe Conigliaro
0609756d36 cgen: fix sum type casts & else if formatting 2020-03-23 00:28:11 +11:00
Alexander Medvednikov
c2ce06eba7 cgen: generate #ifdefs 2020-03-22 13:55:39 +01:00
Alexander Medvednikov
8d8907b61e memory: handle string assignments 2020-03-22 13:40:53 +01:00
Joe Conigliaro
043ea80fa9 checker: comptime if expr/stmts & type check fixes 2020-03-22 23:36:27 +11:00
Alexander Medvednikov
cf8776ac71 valgrind: update the test 2020-03-22 13:33:40 +01:00
Delyan Angelov
3f328a0242 test: fix 'v test vlib/v/tests' 2020-03-22 13:26:16 +01:00
Alexander Medvednikov
4cbba8c45d memory: handle arrays 2020-03-22 13:19:45 +01:00
Alexander Medvednikov
3a938972df memory: autofree fix 2020-03-22 12:06:33 +01:00
Alexander Medvednikov
7b689d8c52 ast: CompIf position 2020-03-22 11:53:08 +01:00
Alexander Medvednikov
ab3f6d9202 cgen: generate indents for more readable C code 2020-03-22 10:12:45 +01:00
Delyan Angelov
53a9329ab6 valgrind: nicer output 2020-03-22 09:44:15 +01:00
Alexander Medvednikov
1ad417734e memory: remove if false 2020-03-22 08:59:44 +01:00
Naheel
c50c6812ce os: fix cp() spaces in files names 2020-03-22 08:43:24 +01:00
Alexander Medvednikov
a02395fe2d valgrind: run the tests 2020-03-21 20:31:30 +01:00
Alexander Medvednikov
85e411bd7c fix valgrind test 2020-03-21 20:10:30 +01:00
Alexander Medvednikov
3e80e22f5d fix prod build 2020-03-21 20:02:37 +01:00
Alexander Medvednikov
e5f6a0949f cgen: autofree: first step 2020-03-21 19:52:19 +01:00
Joe Conigliaro
efbf114a2f checker: ref & deref in prefix expr 2020-03-22 02:41:01 +11:00
penguindark
421f5b6fdf builtin: int to str without offset buffer 2020-03-21 16:00:58 +01:00
Joe Conigliaro
fc43294efc checker: deref fix 2020-03-22 01:27:10 +11:00
Joe Conigliaro
9d80d261b9 gen: rename _init() to _vinit() in cheaders.v 2020-03-22 00:22:43 +11:00
Joe Conigliaro
f7042e9038 cgen: sum type cast & map str() receiver 2020-03-21 23:57:11 +11:00
Alexander Medvednikov
0f1371e1c9 cgen: fix tests 2020-03-21 13:56:21 +01:00
ka-weihe
bf97afb9ed map: small cleanup 2020-03-21 13:55:07 +01:00
Alexander Medvednikov
f962d92623 cgen: use _vinit instead of _init to avoid conflicts on Linux 2020-03-21 13:28:41 +01:00
Joe Conigliaro
eb8d64999f checker: temp map str() method fix 2020-03-21 22:31:25 +11:00
radare
cc75fe4fe5 builtin: Fix undefined behaviour when allocating empty structs (#4088) 2020-03-21 12:24:34 +01:00
Alexander Medvednikov
7b1b647832 parser: disable parser_test.v for now 2020-03-21 11:55:49 +01:00
Alexander Medvednikov
7ad1441c81 cgen: fix the tests 2020-03-21 11:47:23 +01:00
Alexander Medvednikov
b2d1f55702 cgen_test fixes 2020-03-21 11:17:17 +01:00
Alexander Medvednikov
c12985d1d7 cgen: for in; init fixes 2020-03-21 10:22:19 +01:00
Delyan Angelov
ba088056ed solaris: make 'v test-compiler' pass (stage 2) 2020-03-21 09:48:02 +01:00
Alexey
a5c0d89c71 examples: reorganize 2020-03-21 09:47:38 +01:00
Alexander Medvednikov
e57804e6c2 cgen: generate init() 2020-03-21 09:29:16 +01:00
Alexander Medvednikov
c93f515a54 cgen: add _STR definition 2020-03-21 07:10:53 +01:00
Alexander Medvednikov
5f61fbcbe3 fix prod build 2020-03-21 07:04:53 +01:00
Alexander Medvednikov
5072320803 cgen/ast/checker: string interpolation 2020-03-21 07:01:11 +01:00
radare
c21e976cad builtin: do not use unsafe sprintf/vsprintf functions 2020-03-21 06:37:58 +01:00
Joe Conigliaro
7e139b5384 tools: gen_vc escape double quotes in sibject 2020-03-21 10:54:57 +11:00
Alexander Medvednikov
b4561fa814 Revert "term: make compilable with v2 on windows" 2020-03-20 21:15:45 +01:00
Alexander Medvednikov
0f1f724a91 term: make compilable with v2 on windows 2020-03-20 21:12:37 +01:00
Alexander Medvednikov
ec003ff897 cgen: temporary lld fix 2020-03-20 20:46:42 +01:00
Alexander Medvednikov
4b36098e07 cgen: 1 error left 2020-03-20 20:35:00 +01:00
Alexander Medvednikov
8077a7534e cgen: 7 errors left 2020-03-20 20:22:37 +01:00
yuyi
e6a679b019 flag: octal format 2020-03-20 20:21:16 +01:00
Delyan Angelov
f89f83deb6 solaris: _solaris.v and #flag solaris (stage 1) 2020-03-20 20:20:01 +01:00
Alexey
9c668072b9 fmt: fix ForInStmt 2020-03-20 20:19:43 +01:00
Alexander Medvednikov
5a7f683f61 cgen: minor fixes 2020-03-20 17:20:53 +01:00
Alexander Medvednikov
6b571155f4 cgen: fix print(struct); use automatic referencing 2020-03-20 17:11:58 +01:00
Alexander Medvednikov
078f498b17 cgen: fix vals[i].field = x 2020-03-20 17:03:41 +01:00
Alexander Medvednikov
4fac09bcb4 array: simplify reverse() memcpy call 2020-03-20 16:51:36 +01:00
yuyi
2f27758a4b os: realpath => real_path 2020-03-20 16:41:18 +01:00
yuyi
5f32663714 make.bat: fix not at root dir error 2020-03-20 16:40:49 +01:00
Joe Conigliaro
15d4b5fcdb checker/fmt/cgen: fun vfmt on changes from previous commit 2020-03-21 00:46:00 +11:00
Joe Conigliaro
a331abf675 ast/cgen/parser: combine IfExpr branches into single node 2020-03-21 00:39:56 +11:00
Alexander Medvednikov
c993489fe9 cgen: optional expr fix 2020-03-20 13:03:42 +01:00
joe-conigliaro
ed50fef1c0 cgen: dont add overidden fields in assoc 2020-03-20 15:05:50 +11:00
joe-conigliaro
1fb2c3f5b4 cgen: multi return optional fix 2020-03-20 14:59:06 +11:00
joe-conigliaro
525639b42f cgen: fix tests after array.first fix 2020-03-20 14:24:18 +11:00
Alexander Medvednikov
f37b9d99fe cgen: last/first fix 2020-03-19 19:36:15 +01:00
Alexander Medvednikov
b7a036945d cgen: in [] optimization 2020-03-19 16:12:49 +01:00
yuyi
010f3efcf0 os: filename => file_name 2020-03-19 15:49:07 +01:00
Alexander Medvednikov
216c7a16d8 cgen: filter + expected_type fix 2020-03-19 15:18:29 +01:00
Delyan Angelov
0fbb056ac7 hotreload: fix compilation of .so file on macos 2020-03-19 14:50:37 +01:00
Alexander Medvednikov
dd96421a9f compiler: remove old vh generator 2020-03-19 13:24:57 +01:00
Joe Conigliaro
0f08a92302 cgen: fix return formatting 2020-03-19 22:27:47 +11:00
Alexander Medvednikov
b290efa394 ast: TypeOf 2020-03-19 12:15:42 +01:00
Joe Conigliaro
79077b0025 gen: fix multi return optional 2020-03-19 22:13:17 +11:00
Joe Conigliaro
97fbbac973 checker: enum value, use base type no extra info 2020-03-19 21:52:47 +11:00
Alexander Medvednikov
74616d2900 cgen: fix optional functions that return other optional functions 2020-03-19 11:44:27 +01:00
Alexander Medvednikov
b2f05e56b8 cgen: fix tests 2020-03-19 11:23:05 +01:00
Joe Conigliaro
e457bedaa7 gen: remove enum value typedefs :D 2020-03-19 21:21:08 +11:00
Joe Conigliaro
408553e967 gen: add typedefs for optional enums & array clone receiver type fix 2020-03-19 21:04:51 +11:00
Alexander Medvednikov
be01a32f0b math: use automatic dereferencing 2020-03-19 10:24:51 +01:00
Alexander Medvednikov
b5cb1b1fe2 cgen: map_get/map_set 2020-03-19 10:07:31 +01:00
Joe Conigliaro
6c56528cd7 checker: update assoc type 2020-03-19 19:52:33 +11:00
Joe Conigliaro
a456c21249 gen: cgen sum cast in struct init 2020-03-19 19:40:21 +11:00
Joe Conigliaro
6e5b58413a checker: check assoc field exprs 2020-03-19 18:57:33 +11:00
Alexander Medvednikov
013fd5abfe cgen: fix array.last() 2020-03-19 08:49:47 +01:00
Joe Conigliaro
3e70e5f2f1 gen: add in for map and string to cgen 2020-03-19 18:32:42 +11:00
Alexander Medvednikov
28309da1f1 cgen: assoc 2020-03-19 08:14:09 +01:00
Alexander Medvednikov
3dc3b11435 parser: $if blocks for headers 2020-03-19 07:59:01 +01:00
SleepyRoy
f798a0937a expression: set floats as f64 by default 2020-03-19 07:24:49 +01:00
yuyi
969765435e v run: fix spaces in args 2020-03-19 07:22:29 +01:00
fantassin
5824d28a03 term: Solaris headers 2020-03-19 07:07:43 +01:00
Delyan Angelov
cc847f83a8 compiler: when compiling a single .v file, check that it is not a folder 2020-03-19 07:07:02 +01:00
yuyi
9ef8499183 flag: unify apis 2020-03-19 07:06:37 +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
c3d7c57096 cgen: more minor fixes 2020-03-18 19:56:59 +01:00
Alexander Medvednikov
ca0bae0fcd array: fix reverse() 2020-03-18 18:54:11 +01:00
yuyi
f41cf7465b make.bat: optimize 2020-03-18 18:15:33 +01:00
Alexander Medvednikov
fe6707b26d cgen: minor fixes 2020-03-18 16:47:37 +01:00
Alexander Medvednikov
c514f0b672 cgen: automatic dereference and match fix 2020-03-18 16:07:54 +01:00
fantassin
d81d804cb6 cgen: add c headers for Solaris / Illumos 2020-03-18 15:48:42 +01:00
lydiandy
04184f1715 ast: make ReturnStmt field public 2020-03-18 15:39:26 +01:00
Joe Conigliaro
c4f6125a31 gen/checker: add errors for as cast & for in var 2020-03-19 00:50:21 +11:00
Joe Conigliaro
96af21ff68 gen: impl as cast 2020-03-18 23:55:46 +11:00
Joe Conigliaro
5fb90e12b1 checker: ForInStmt only call table.value_type once 2020-03-18 23:29:28 +11:00
Joe Conigliaro
4262ff76c3 checker/parser: check & gen stmts for ForIn & fix key, val vars 2020-03-18 23:18:18 +11:00
lutherwenxu
e37fed437d cmd/v: fix -version and -v collision 2020-03-18 12:42:41 +01:00
Alexander Medvednikov
91378583cc cgen: another expected_type fix 2020-03-18 12:34:27 +01:00
Alexander Medvednikov
af289da844 ast: MatchExpr: expr_type => cond_type 2020-03-18 12:23:32 +01:00
Alexander Medvednikov
256a93e6e6 checker: expected_type fixes 2020-03-18 12:18:48 +01:00
Joe Conigliaro
5fc057d8ac cgen: fix error in expr_with_cast 2020-03-18 20:42:56 +11:00
Joe Conigliaro
54c38e3e3a parser: remove option from err var type 2020-03-18 20:00:33 +11:00
Joe Conigliaro
126ef0f5c2 checker/gen: add unchecked exprs & small fixes 2020-03-18 19:56:19 +11:00
Alexander Medvednikov
a011b8951a cgen: if/match expressions and other fixes 2020-03-18 08:41:49 +01:00
Joe Conigliaro
3fecf154aa gen: move helper fns to ast 2020-03-18 11:19:23 +11:00
Joe Conigliaro
6ca47aeb4b gen: blank identifier fixes 2020-03-18 10:41:04 +11:00
Joe Conigliaro
330745da30 gen: restructure if guard to support else 2020-03-18 04:01:36 +11:00
Joe Conigliaro
91e47caf38 gen: add if guard to cgen 2020-03-18 02:40:41 +11:00
Joe Conigliaro
f965a7d0e6 gen: fix sum type casting & map init 2020-03-18 01:13:55 +11:00
radare
f5e44fbef2 compiler: better NetBSD and OpenBSD support in vfmt and $if 2020-03-17 12:43:59 +01:00
Major Taylor
e2eb0f17d7 string: separate strip_margin tests into different functions 2020-03-17 02:49:51 +01:00
Delyan Angelov
f73b38a0d8 vfmt2: fix literal integer number formatting 2020-03-17 02:49:15 +01:00
yuyi
cff6f4abd6 vself: add -prod options 2020-03-16 15:46:38 +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
yuyi
5ae04dca84 glfw: remove global scale variable 2020-03-16 15:44:26 +01:00
Ian M. Jones
93920a4bb0 vweb: set request data with body text to allow use in actions 2020-03-16 14:30:55 +01:00
Delyan Angelov
c2e453fbb9 vpm: make 'v install' more resilient to server failures 2020-03-16 14:30:22 +01:00
Joe Conigliaro
e03050014d tools: gen_vc update comment 2020-03-17 00:20:40 +11:00
Joe Conigliaro
db9323e7bd tools: gen_vc - add force update flag/option 2020-03-17 00:17:19 +11:00
Joe Conigliaro
d456cc479c builtin: revert map to version before 35dd785 until bug is fixed 2020-03-16 23:01:31 +11:00
Alexander Medvednikov
3b328a2847 vpm: fix server urls 2020-03-16 12:55:49 +01:00
radare
5581b2bd3c builtin: fix backtrace for OpenBSD and NetBSD 2020-03-16 12:10:58 +01:00
Alexander Medvednikov
900ada1112 cgen: match: do not use a temp var; minor fixes 2020-03-16 10:53:36 +01:00
Joe Conigliaro
cf094c6265 cgen: gen fn type declerations 2020-03-16 20:12:03 +11:00
Alexander Medvednikov
0f160707a4 cgen: GoStmt; experimental parallel parser 2020-03-16 08:33:42 +01:00
joe-conigliaro
c947e6ebe6 cgen: cast to sum type 2020-03-16 17:42:45 +11:00
Alexander Medvednikov
66adf7a6b9 cgen: minor sum type fix 2020-03-16 05:02:41 +01:00
Alexander Medvednikov
ac0b235d3a cgen: sum type: it variable 2020-03-16 03:56:38 +01:00
Alexander Medvednikov
37504c487a cgen: sum types: match 2020-03-16 03:19:26 +01:00
Alexander Medvednikov
98fc9ab65b string: disable strip_margins test for now 2020-03-15 23:21:32 +01:00
Major Taylor
c546e88577 vcreate: add init command 2020-03-15 11:20:12 +01:00
Alexander Medvednikov
d10c1c36a9 contributing.md: minor fixes 2020-03-15 09:21:31 +01:00
Alexander Medvednikov
a0e97e0e6e contributing.md: info on the new ast based parser 2020-03-15 09:18:05 +01:00
Alexander Medvednikov
8a8f50a6a0 cgen: unwrapped optionals 2020-03-15 08:18:45 +01:00
Major Taylor
8d19ba9195 string: strip_margin: fix the error message for multiple args 2020-03-15 07:49:37 +01:00
Alexander Medvednikov
8e2537a366 cgen: array init fix; 2020-03-15 07:42:49 +01:00
Major Taylor
2d5c7c8e93 string: add strip_margin 2020-03-15 05:46:12 +01:00
Joe Conigliaro
3e05939b65 cgen: enum fixes 2020-03-15 12:51:31 +11:00
Joe Conigliaro
cfeafb9ab4 cgen: fix null termination bug gen tests to fail 2020-03-15 11:39:29 +11:00
Alexander Medvednikov
28fc9d332c cgen: fix enum vals, includes, in strings 2020-03-15 01:36:20 +01:00
yuyi
a121dfd23a glfw: high dpi on windows 2020-03-15 01:16:55 +01:00
Alexander Medvednikov
843bb6dac1 cgen: lots of fixes 2020-03-15 00:46:08 +01:00
Joe Conigliaro
50ed4004f4 ast/table: use common struct fn decl arguments 2020-03-15 09:21:36 +11:00
Alexey
395bb61cf3 help: keep consistent style of help messages
Use imperative mood everywhere.
End sentences with dots.
Capitalize sentences.
2020-03-14 14:20:44 +01:00
yuyi
8bfa7f0d82 compiler: fix interface bug 2020-03-14 14:19:56 +01:00
Joe Conigliaro
217bbdfd66 cgen: small varg fixes 2020-03-14 23:42:27 +11:00
Joe Conigliaro
9dc79bae5f cgen: fix varg call and struct gen 2020-03-14 23:15:07 +11:00
Joe Conigliaro
cc338df77f parser/checker/gen: update call args to use ast.CallArg 2020-03-14 21:11:43 +11:00
Joe Conigliaro
6752fed9f2 parser: fix generated name for unnamed fn args 2020-03-14 20:24:45 +11:00
Alexander Medvednikov
e8c9f609a4 cgen: enum fixes; sum type definition; const bug fix 2020-03-14 05:20:15 +01:00
yuyi
424bd1c465 scanner: minor optimization 2020-03-13 22:22:59 +01:00
Delyan Angelov
19f9c18305 os: make executable() more robust 2020-03-13 22:19:02 +01:00
lutherwenxu
c2ffd027d0 cmd/v: implement help 2020-03-13 20:52:49 +01:00
Joe Conigliaro
920ab79665 checker: check range exprs 2020-03-13 23:08:03 +11:00
Alexander Medvednikov
973b5c226a cgen: optionals fixes 2020-03-13 12:22:36 +01:00
Yohix
e667e72685 all: fix typos 2020-03-13 09:45:40 +01:00
Alexander Medvednikov
b173cea177 cgen: optionals 2020-03-13 05:57:55 +01:00
Delyan Angelov
9bcb7d115f panic: restore printing of detailed stack backtraces on linux 2020-03-13 04:32:44 +01:00
Ian M. Jones
0e68ca120e vweb.assets: fix am is declared as mutable, but it was never changed message 2020-03-13 04:32:24 +01:00
Alexander Medvednikov
4b4c47461b cgen: error fixes; table: simplify; compiler tests 2020-03-13 01:43:30 +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
Marko Zitkovic
26b9987880 compiler: fix panic when dealing with variadic functions 2020-03-12 18:21:02 +01:00
vitalyster
0df6eaa927 "#flag mingw ..." support 2020-03-12 18:20:19 +01:00
Joe Conigliaro
07921194f2 parser: revert changes to format_str 2020-03-13 00:32:26 +11:00
Joe Conigliaro
597811093c parser/cgen: fix order of escape replacements 2020-03-13 00:21:43 +11:00
Joe Conigliaro
b750f1d1bb compiler: prerequisite changes for upcoming map update 2020-03-12 22:19:13 +11:00
Joe Conigliaro
99398ba652 cgen: escape quotes & nl in string literals 2020-03-12 21:13:46 +11:00
Joe Conigliaro
bb5034f3fe cgen: fix fixed array init assignment 2020-03-12 20:07:42 +11:00
Alexander Medvednikov
d2cf6894fe cgen: fixed array fix 2020-03-12 09:29:52 +01:00
Alexander Medvednikov
92d6eec09a cgen: fix remaining errors. hello world now compiles 2020-03-12 09:11:41 +01:00
joe-conigliaro
853bb4c41e cgen: alias & map types & add map_string/map_int aliases 2020-03-12 17:56:44 +11:00
joe-conigliaro
dfaba54376 cgen: gen fn types in fn arguments 2020-03-12 14:34:00 +11:00
Alexander Medvednikov
bcdb897f07 cgen: fix tests 2020-03-11 23:43:01 +01: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
Alexander Medvednikov
aada19f574 cgen: fix [] => string casts and for in 2020-03-11 19:00:55 +01:00
Alexander Medvednikov
4470252913 parser: fix import's position 2020-03-11 18:52:55 +01:00
Delyan Angelov
de7fed45dc builtin: implement []int.str() 2020-03-11 18:48:59 +01:00
Delyan Angelov
dff17ee0d7 compiler: pass -shared to build a .so file from a module 2020-03-11 17:31:20 +01:00
Joe Conigliaro
01004bc5d8 checker: remove test println from previous commit 2020-03-12 02:29:02 +11:00
Joe Conigliaro
a1314bd199 checker/gen/table: impl fn types & sum/other fixes & tidy 2020-03-12 02:10:46 +11:00
Joe Conigliaro
1cea85df0c compiler: save mutability of unnamed fn args 2020-03-12 01:44:41 +11:00
Joe Conigliaro
7309be55a0 table: fix error in field/method lookup from previous commit 2020-03-11 20:53:14 +11:00
Joe Conigliaro
7513dab185 table/checker: proper parent field/method lookup & cleanup 2020-03-11 20:48:45 +11:00
Alexander Medvednikov
0ad9eb5e16 scanner: remove the "too long name" error; checker: check string() cast arg 2020-03-11 06:46:14 +01:00
Alexander Medvednikov
cd0b81fc5f cgen: fix a bug with [].repeat 2020-03-11 06:30:20 +01:00
Alexander Medvednikov
a2ff24c912 cgen: reference receiver test 2020-03-11 05:56:15 +01:00
Alexander Medvednikov
75db3e4416 cgen: fix ptr indexing 2020-03-11 05:25:15 +01:00
yuyi
9e14850bbf vdoc: show map type correctly 2020-03-11 05:18:20 +01:00
Alexander Medvednikov
b9955aee84 cgen: fix tests 2020-03-11 04:10:42 +01:00
Alexander Medvednikov
7342dfdc6e cgen: fix array_get() 2020-03-11 03:52:01 +01:00
Alexander Medvednikov
22e558aecb cgen: fix C style loops without an init; fix integer consts 2020-03-11 02:44:30 +01:00
Alexander Medvednikov
0d45d21069 cgen: fix string <> methods and multiple returns 2020-03-11 02:28:19 +01:00
Joe Conigliaro
083964522b cgen/fmt: fix assign_stmt fix & cgen test & hash tests & fmt 2020-03-11 11:31:24 +11: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
1143320b8b vdoc: print structs and enums 2020-03-10 19:49:04 +01:00
Alexander Medvednikov
568d859fc0 bignum: move to math.big 2020-03-10 19:31:01 +01:00
Wing-Kam
f1274e34c2 cli: add pre_execute & post_execute 2020-03-10 16:11:17 +01:00
yuyi
f724a4d820 ci: fix workflows/windows-install-sdl.bat 2020-03-10 16:10:05 +01:00
yuyi
8ff86dbee6 os: is_abs => is_abs_path 2020-03-10 16:09:37 +01:00
Alexander Medvednikov
324a48bc64 sha512: make it work with the new parser 2020-03-10 15:47:21 +01:00
Joe Conigliaro
bc184a9f02 checker: properly update var info in AssignStmt 2020-03-11 01:16:30 +11:00
hazohelet
333dac4977 help: update flags 2020-03-10 15:08:08 +01:00
yuyi
57b1b12ab6 os: tmpdir => temp_dir 2020-03-10 15:02:09 +01:00
Charles WANG
7e1870be3e pg: create readme.md 2020-03-10 15:00:22 +01:00
Joe Conigliaro
ddd5a9443d v: fix AssignStmt 2020-03-11 00:45:21 +11:00
Alexander Medvednikov
2f0bb11a96 parser: handle operator methods and fix them in vdoc 2020-03-10 14:40:35 +01:00
Delyan Angelov
7036ca55e6 os: implement os.environ() (part 2/2) (#3971) 2020-03-10 14:25:16 +01:00
bokunodev
877b474fe1 makefile: use new flags 2020-03-10 14:24:34 +01:00
Hugo Locurcio
baf25fe649 doc: improve the cross-platform shell scripts documentation 2020-03-10 14:23:55 +01:00
Joe Conigliaro
c9d30f78b7 v: no optional for scope.innermost & more blank_ident 2020-03-10 23:35:25 +11:00
Joe Conigliaro
ee72474971 v: add multi assign cgen test 2020-03-10 22:26:13 +11:00
Joe Conigliaro
f7a93a69f6 v: fix/gen multi return/assign + merge VarDecl & AssignStmt 2020-03-10 22:01:37 +11:00
yuyi
876b73f92c os: join => join_path 2020-03-09 02:23:34 +01:00
Alexander Medvednikov
e3687dc257 checker: check C args 2020-03-08 22:11:56 +01:00
Alexander Medvednikov
754a6cc93e cgen: fix -> 2020-03-08 19:38:27 +01:00
Delyan Angelov
a58be3af0c cmd/tools/gen_vc.v: use -os cross 2020-03-08 19:00:57 +01:00
Delyan Angelov
f6480be3aa add C.environ to cheaders.v 2020-03-08 17:38:53 +01:00
yuyi
a569959fb8 os api: cachedir => cache_dir 2020-03-08 15:57:47 +01:00
Alexey
83b6292105 fmt: split tests 2020-03-08 15:57:16 +01:00
Delyan Angelov
5f08253f36 vfmt: add support for _keep.vv files, that v fmt should keep without changes 2020-03-08 15:46:04 +01:00
yuyi
23b11c84b1 os api: basedir => base_dir 2020-03-08 15:43:56 +01:00
Delyan Angelov
2bed0d1bb5 fmt: extract array_slices_input.vv from simple_input.vv 2020-03-08 15:42:38 +01:00
Ian M. Jones
c731615dbb vweb: cater for trailing slashes being used in handle_static call 2020-03-08 15:41:59 +01:00
Delyan Angelov
8df265a581 sync: protect against sporadic failing tests in macos 2020-03-08 15:40:50 +01:00
hazohelet
ee6f2f84bb compiler: fix redefinition error message for consts 2020-03-08 15:40:07 +01:00
yuyi
514b94ac69 compile.v: remove duplicate import 2020-03-08 15:39:37 +01:00
Alexander Medvednikov
d9854f2abd cgen: fix mutable receivers 2020-03-07 22:37:03 +01:00
yuyi
783dee1f48 os: merge with filepath 2020-03-07 22:26:26 +01:00
Delyan Angelov
5e541e1f11 vfmt: alias type and sum type + sum type fix 2020-03-07 17:37:55 +01:00
Alexander Medvednikov
fbf80dc315 cgen: array_set() 2020-03-07 16:39:15 +01:00
Alexander Medvednikov
63032c4bb7 cgen: minor fixes 2020-03-07 16:23:10 +01:00
Alexander Medvednikov
24bcc7a93b cgen: array and fixed array fixes 2020-03-07 14:31:40 +01:00
Ian M. Jones
750f37fde7 vweb: fix serving static files 2020-03-07 14:16:03 +01:00
Delyan Angelov
88c1ff91ac cmd/v: handle wrong type of flags 2020-03-07 14:15:23 +01:00
Alexey
5827ff0a01 examples: add license files for fonts 2020-03-07 14:14:37 +01:00
Delyan Angelov
d2ab9d3e77 compiler: fix generation of default .str() methods in interpolation 2020-03-07 14:13:53 +01:00
Joe Conigliaro
09d9dd2607 v: add map init 2020-03-07 18:13:00 +11:00
Alexey
e26907f079 fmt: fix errors in test files 2020-03-07 06:04:33 +01:00
Alexander Medvednikov
150994a933 cgen: fix tests 2020-03-07 06:02:32 +01:00
Alexander Medvednikov
260f708bb2 cgen: array << val 2020-03-07 05:19:15 +01:00
Alexander Medvednikov
c14c81ace6 cgen: fix -> 2020-03-07 04:45:35 +01:00
Nguyen Viet Hung
f5a8d883d2 gx: add hex to rgb color 2020-03-07 04:30:35 +01:00
Alexander Medvednikov
58fb055763 cgen: fix string args in C calls; lower case consts in atof; fix struct types 2020-03-07 01:05:19 +01:00
Alexander Medvednikov
968e310793 cgen: fix match 2020-03-07 00:47:49 +01:00
Alexander Medvednikov
9846fecd84 eval: fix test 2020-03-07 00:42:52 +01:00
Alexander Medvednikov
f699dcac94 checker: check println arg 2020-03-07 00:38:35 +01:00
Alexander Medvednikov
180b9b971a cgen: string_add() 2020-03-07 00:34:14 +01:00
Alexander Medvednikov
3c7b0d6d05 cgen: fix [] 2020-03-07 00:19:27 +01:00
Alexander Medvednikov
124f754443 cgen: typ() 2020-03-06 22:36:51 +01:00
Alexander Medvednikov
1a8b7d0447 cgen: fix slices 2020-03-06 22:24:42 +01:00
Alexey
81ce524705 ast: add Expr to AsCast 2020-03-06 22:12:15 +01:00
Alexey
06df6d25a2 sdl: update readme 2020-03-06 20:43:33 +01:00
Alexander Medvednikov
8a711a8376 cgen: fix tests 2020-03-06 20:25:38 +01:00
Alexander Medvednikov
a277f7d6ab cgen: string[i]; pointers 2020-03-06 20:23:01 +01:00
lutherwenxu
aab31f4b35 cmd/v: rewrite flags 2020-03-06 18:53:29 +01:00
Ian M. Jones
522de0871a pg: fix zero being used for port when not specified in pg.Config 2020-03-06 18:40:24 +01:00
Alexey
5142747ceb examples: move SDL examples from vlib to examples dir 2020-03-06 18:39:40 +01:00
Alexander Medvednikov
5c8617ec68 ast: set IndexType.container_type; array_get() 2020-03-06 17:06:03 +01:00
Joe Conigliaro
ea2a79ec20 v: cgen fix struct ordering 2020-03-07 02:57:27 +11:00
Alexander Medvednikov
be2480c320 cgen: fix several errors 2020-03-06 16:31:44 +01:00
yuyi
ed9075b937 v doc: don't show 'pub' at the beginning 2020-03-06 16:28:20 +01:00
Joe Conigliaro
db22bc579a v: update resovled call expr name 2020-03-07 01:02:40 +11:00
Joe Conigliaro
89cbe76193 v: run cast expr through checker 2020-03-07 00:36:32 +11:00
Alexander Medvednikov
6b6031a3d9 cgen: fix struct init; match SumType1, SumType2 2020-03-06 14:14:33 +01:00
Joe Conigliaro
3de3b38dc1 v: udpate elem_type in ArrayInit node & tests 2020-03-07 00:06:52 +11:00
Alexander Medvednikov
fb785b8adf cgen: optimize const definitions 2020-03-06 14:03:35 +01:00
Alexander Medvednikov
91269961d0 cgen: array types 2020-03-06 13:44:13 +01:00
Joe Conigliaro
7f6b98669e v2: fix tests - gen output 2020-03-06 22:06:41 +11:00
Joe Conigliaro
24dbfbcccf v2: fix struct sorting & cgen tests 2020-03-06 22:01:56 +11:00
Joe Conigliaro
49f3ce0571 v2: add method call receiver to cgen & check method args 2020-03-06 20:52:03 +11:00
Alexander Medvednikov
7a92a47eb3 flag: fix array boundary check 2020-03-06 02:02:32 +01:00
Alexander Medvednikov
efb45579aa pg: add port to config 2020-03-06 02:01:53 +01:00
Joe Conigliaro
7008b1a92c v2: update ident name for resolved const/fn objects 2020-03-06 10:10:01 +11:00
Alexander Medvednikov
04d5dd8997 cgen: sort structs 2020-03-05 23:27:24 +01:00
Alexander Medvednikov
a8e45251c4 sync.pool: simplify usages of pool.work_on_items 2020-03-05 18:37:57 +01:00
Alexander Medvednikov
9c1e50b1aa vdoc: don't show deprecated functions 2020-03-05 16:13:14 +01:00
Alexander Medvednikov
6659f1751e ast: make IdentInfo public 2020-03-05 14:16:08 +01:00
Joe Conigliaro
8ad8d03bc8 v2: remove test code from last commit in parser 2020-03-06 00:00:34 +11:00
Joe Conigliaro
272eaaa704 v2: remove type fields from parser & some cleanup 2020-03-05 23:57:05 +11:00
Alexander Medvednikov
38a54b08e3 doc: don't modify path to vlib 2020-03-05 13:48:06 +01:00
Joe Conigliaro
9921897aa6 v2: add some comments in parser & checker 2020-03-05 22:44:33 +11:00
Joe Conigliaro
6de44db4eb v2: update checker. missing from previous commits 2020-03-05 22:30:16 +11:00
Joe Conigliaro
ee6a8a41f5 v2: remove expr type from fn.v 2020-03-05 22:13:45 +11:00
Joe Conigliaro
4d55a4c097 v2: remove expr types & some dead code from parser 2020-03-05 22:08:43 +11:00
Alexander Medvednikov
bcaf72eccb cgen: update the test 2020-03-05 01:36:44 +01:00
Alexander Medvednikov
484320ed08 cgen: receiver arg 2020-03-05 01:20:36 +01:00
Alexander Medvednikov
b32a94627c cc: -ferror-limit 2020-03-05 00:45:43 +01:00
Alexander Medvednikov
4161cfcdb8 cgen: lots of fixes 2020-03-05 00:43:09 +01:00
Alexander Medvednikov
b7e2af8151 os: better deprecated message 2020-03-04 20:29:17 +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
136aa763a3 cgen: multi return structs + other fixes 2020-03-04 20:17:29 +01:00
Alexander Medvednikov
cd8a5d1f2e fix parser_test.v and string_test.v 2020-03-04 17:39:27 +01:00
Alexander Medvednikov
237ce6ff84 cgen_test: skip definitions 2020-03-04 17:35:13 +01:00
Alexander Medvednikov
59a65d757b examples: use vcalloc 2020-03-04 17:28:05 +01:00
Alexander Medvednikov
c203a744fe glm: fix calloc 2020-03-04 17:22:20 +01:00
Alexander Medvednikov
f27f832ede cgen: definitions + other fixes; calloc fix 2020-03-04 17:08:28 +01:00
Alexander Medvednikov
37453945d0 cgen: remaining nodes; match type fix; v2.c is now generated 2020-03-04 15:48:43 +01:00
Joe Conigliaro
8458ea40f0 v2: add UnsafeStmt to checker & byte/byteptr to check 2020-03-05 00:20:37 +11:00
Joe Conigliaro
7daf8f8fd0 v2: simplify MatchExpr in vfmt 2020-03-04 22:39:18 +11:00
Joe Conigliaro
5872961124 v2: update MatchExpr in vfmt 2020-03-04 22:14:37 +11:00
Joe Conigliaro
e71948461e v2: update MatchExpr 2020-03-04 21:59:45 +11:00
Joe Conigliaro
ed763df42e v2: tidy checker remove old comments & code 2020-03-04 21:08:46 +11:00
Joe Conigliaro
d501ea0afb v2: fix array init 2020-03-04 12:50:32 +11:00
Joe Conigliaro
bac6fc6ee2 v2: remove test println from checker 2020-03-04 09:49:14 +11:00
Joe Conigliaro
ea26b5f30c v2: fix fn call name lookup 2020-03-04 09:46:59 +11:00
Alexander Medvednikov
823b8ad244 table: Type str() 2020-03-03 18:38:41 +01:00
Alexander Medvednikov
2a99422386 cgen: more nodes; exit if there are checker errors 2020-03-03 18:37:38 +01:00
Alexander Medvednikov
0c67b3cff4 checker: fix match return type 2020-03-03 17:29:16 +01:00
Joe Conigliaro
c633dd09c6 v2: dont use type type in << infix in parser 2020-03-04 02:08:40 +11:00
Joe Conigliaro
063ca3b644 v2: make array append << right associative 2020-03-04 02:05:16 +11:00
Joe Conigliaro
147ecc5e17 v2: time - prefix C struct & ast.TypeName to ast.Type 2020-03-04 01:06:21 +11:00
yuyi
448ed41562 os api: rmdir_recursive => rmdir_all 2020-03-03 15:02:50 +01:00
yuyi
3f67ba08b1 glfw, freetype: remove the display of general information 2020-03-03 14:41:26 +01:00
Hugo Locurcio
69f256b900 use LF line endings in examples/quick_sort.v 2020-03-03 14:41:05 +01:00
Joe Conigliaro
af3159791f v2: reset expr_mod after struct_init type is parsed 2020-03-04 00:24:15 +11:00
Delyan Angelov
90996269fd compiler: more precise default error context for C errors 2020-03-03 12:01:23 +01:00
yuyi
ea10f44fe6 os api: flush_stdout => flush 2020-03-03 00:00:30 +01:00
Joe Conigliaro
895a1711cb v2: fix type aliases & add check 2020-03-03 09:19:04 +11:00
yuyi
8ac0739858 os api: cp_r => cp_all 2020-03-02 19:30:04 +01:00
Alexander Medvednikov
22ffe336cb checker: AsCast, CharLiteral, fix integer index check 2020-03-02 19:00:33 +01:00
Alexander Medvednikov
156e36c082 cgen: handle unhandled nodes 2020-03-02 18:43:41 +01:00
Alexander Medvednikov
07a2233220 fix prod build 2020-03-02 18:28:11 +01:00
Alexander Medvednikov
baaa55f196 cgen: fix methods; println 2020-03-02 18:27:00 +01:00
Delyan Angelov
8373ece209 make: fix building v with msys2's make.exe on windows 2020-03-02 18:16:12 +01:00
Alexey
78c885d657 fmt: add support for goto 2020-03-02 17:41:32 +01:00
Delyan Angelov
c6107276df compiler: stabilize the interface code generation a little 2020-03-02 17:10:26 +01:00
Alexey
8fafaf38a3 fmt: add function with variadic arg to test file 2020-03-02 17:10:06 +01:00
Alexey
cca5c5537f fmt: extract common code to methods 2020-03-02 17:09:45 +01:00
Joe Conigliaro
8497d637d9 v2: allow pointers to be initialized with 0 2020-03-02 23:52:41 +11:00
Joe Conigliaro
5b08f307c8 v2: fix map initialization 2020-03-02 22:34:02 +11:00
Joe Conigliaro
16528b12fa v2: allow enum value to be used as int 2020-03-02 21:32:28 +11:00
Joe Conigliaro
f57a651e3b v2: match expr fixes & tmp typeof skip 2020-03-02 20:53:38 +11:00
joe-conigliaro
a8f07157dd v2: implement sym types & handle in table.check 2020-03-02 16:40:18 +11:00
joe-conigliaro
b65fad9ca8 v2: fix if guard var type & handle blank ident in assign 2020-03-02 16:05:40 +11:00
joe-conigliaro
a118c72423 v2: checker - save type in MapInit node 2020-03-02 14:24:45 +11:00
joe-conigliaro
b333d02e3b v2: allow none & error for functions that return optional - checker 2020-03-02 13:58:36 +11:00
Alexander Medvednikov
d05bdad638 pratt: handle &= 2020-03-01 23:26:23 +01:00
Alexander Medvednikov
f921ea2fb7 cgen: test module fns and consts 2020-03-01 22:06:36 +01:00
Alexander Medvednikov
38de6c98fc cgen: test local modules 2020-03-01 21:56:07 +01:00
Joe Conigliaro
a707ffc04a v2: name_expr mod & type & var fixes 2020-03-02 02:14:52 +11:00
Daniel Däschle
7eee5cf116 cmd: use x64 target and v2 parser with run arg 2020-03-01 15:50:07 +01:00
Delyan Angelov
1066ec5cd9 compiler: import modules relative to v.mod 2020-03-01 15:49:39 +01:00
Delyan Angelov
615a4b3452 builtin: add V64_PRINTFORMAT (part 2) 2020-03-01 15:48:54 +01:00
Delyan Angelov
2700fd712b builtin: add V64_PRINTFORMAT (part 1) 2020-03-01 15:30:33 +01:00
Joe Conigliaro
1ab830da4b v2: fix var mistaken for enum in parser 2020-03-02 01:19:10 +11:00
Alexander Medvednikov
82b0024758 fix v2 parser int.v error 2020-03-01 14:57:54 +01:00
Alexander Medvednikov
d7a8b1b4f2 checker: set fn arg expected_type 2020-03-01 14:10:10 +01:00
Nicolas Sauzede
becd87141c fix linux warnings in generated C code 2020-03-01 13:26:09 +01:00
Alexander Medvednikov
7a499b3cd3 checker: fix first() and last(); call_args; method cgen 2020-03-01 13:07:51 +01:00
Joe Conigliaro
9978fb3e2c v2: fix map_init return type in checker 2020-03-01 21:45:44 +11:00
Joe Conigliaro
00dcaf0e04 v2: ArrayInit + all errs & unhandled + arrange nodes + type fix 2020-03-01 15:14:36 +11:00
Alexey
cbffbf3438 array: reverse empty arrays correctly 2020-02-29 20:44:02 +01:00
Alexey
c1e095e587 fmt: process MatchExpr 2020-02-29 20:43:15 +01:00
Alexander Medvednikov
4e88c2286e checker: IfGuard, map fixes 2020-02-29 20:11:04 +01:00
Alexander Medvednikov
ee05b51f47 checker: fix match expected_type 2020-02-29 18:34:25 +01:00
Alexander Medvednikov
a15dcbfb2d checker: set expected_type in several places 2020-02-29 18:25:38 +01:00
Alexander Medvednikov
27ce38937c checker: fix Assoc 2020-02-29 18:07:29 +01:00
Alexander Medvednikov
85f67a3f73 fix prod build 2020-02-29 17:53:04 +01:00
Alexander Medvednikov
d5faf36aa9 fmt: comments 2020-02-29 17:51:38 +01:00
Alexey
5a5f4ce99a fmt: simplify IndexExpr processing 2020-02-29 17:45:08 +01:00
yuyi
a678be7195 fix interface on all platforms 2020-02-29 15:27:28 +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
lydiandy
a485533dc9 make sure scanner and parser both check BOM 2020-02-29 15:05:25 +01:00
yuyi
6c85e285e7 vdoc: show variadic args correctly 2020-02-29 15:04:07 +01:00
Alexey
ee0a0afb25 v2: process or block for CallExpr 2020-02-29 15:03:32 +01:00
Alexey
efff66ada7 fmt: add pub modifier for public enums 2020-02-29 14:38:23 +01:00
Major Taylor
d4b0de2dce log: extended logging level names when printed 2020-02-29 14:31:59 +01:00
Delyan Angelov
f9d5c0110f compiler: @VMODULE 2020-02-29 14:23:45 +01:00
Joe Conigliaro
f67fca826e v2: fix C function & type prefixing 2020-02-29 21:47:47 +11:00
Joe Conigliaro
48f912c2e9 v2: handle variadic in selector_expr 2020-02-29 19:04:47 +11:00
Joe Conigliaro
71b5b0d955 v2: fix C fn calls, save C fns with prefix besides odd cases 2020-02-29 17:24:28 +11:00
Joe Conigliaro
236b7b15bb v2: handle optional in return stmt in checker 2020-02-29 16:32:00 +11:00
Joe Conigliaro
8e013d2174 v2: skip minus in string expr for now 2020-02-29 15:56:16 +11:00
Joe Conigliaro
eb80accfee v2: add ParExpr to checker 2020-02-29 15:36:39 +11:00
Alexander Medvednikov
6855c746bb vfmt: EnumDecl 2020-02-28 17:21:24 +01:00
Major Taylor
ee9cfe22ec scanner: fix a typo in right_shift 2020-02-28 17:16:24 +01:00
Delyan Angelov
10e15e5de7 make and vself: cleanup make based on the new 'v self' 2020-02-28 16:04:22 +01:00
Alexander Medvednikov
ccf4f61521 ast: ParExpr, OrExpr, IfGuardExpr; ForInStmt fix; remove all cap vars 2020-02-28 15:36:41 +01:00
Alexander Medvednikov
6a198df3af v2: ParExpr; mut var decl 2020-02-28 14:41:19 +01:00
Alexander Medvednikov
7f5a15372f os: fix get_raw_line() + minor v2 fixes 2020-02-28 14:05:20 +01:00
Joe Conigliaro
c4b9ef388f v2: handle var decl & assign stmt together 1st step combining 2020-02-28 23:29:04 +11:00
yuyi
8c43644301 tools: v self compiler 2020-02-28 13:02:56 +01:00
Nicolas Sauzede
f5fdbfd004 os: fix getline warning for linux 2020-02-28 02:43:42 +01:00
penguindark
b8f6284daf ftoa: tables with hex constants 2020-02-28 02:43:15 +01:00
Alexander Medvednikov
87205367d1 v2: minor fixes 2020-02-27 21:51:40 +01:00
Alexander Medvednikov
3204f036da ast: move all str() methods to ast/str.v 2020-02-27 21:29:38 +01:00
Alexander Medvednikov
d619944cf5 vfmt: []xxx; mut args 2020-02-27 21:00:33 +01:00
Alexander Medvednikov
4f0d505c65 v2: if x := ; fix for key, val in; CastExpr 2020-02-27 18:02:40 +01:00
Alexander Medvednikov
3bde876097 v2: checker: fix --/++ 2020-02-27 17:31:10 +01:00
Alexander Medvednikov
09b7a7c872 v2: checker: handle clone() 2020-02-27 17:21:13 +01:00
Alexander Medvednikov
b1357d9641 v2: checker: fix filter() 2020-02-27 16:51:47 +01:00
yuyi
b580a497fe compiler: fix an interface bug 2020-02-27 16:31:05 +01:00
Delyan Angelov
1c915c3bd1 add trim_trailing_whitespace to .editorconfig 2020-02-27 12:01:53 +01:00
Joe Conigliaro
aba0bb5e01 v2: fix condition in AssignStmt 2020-02-27 21:15:30 +11:00
Joe Conigliaro
237d83b2ee v2: more work on AssignStmt & multi ret & initial blank ident 2020-02-27 21:12:30 +11:00
joe-conigliaro
cfbd8ab7e7 v2: parser - use defer to make sure scope is closed for filter 2020-02-27 17:00:24 +11:00
Alexander Medvednikov
06fc8a830b v2: fix a bug with mod.const 2020-02-27 03:30:17 +01:00
Alexander Medvednikov
a5db9c3519 os: bring back write_bytes_at() 2020-02-27 00:41:05 +01:00
Alexander Medvednikov
bb6098e2d3 v2: fix type f fn... 2020-02-27 00:18:14 +01:00
Alexander Medvednikov
c51f464446 v2: fix mod.Enum.val and x = .val 2020-02-27 00:12:40 +01:00
Alexey
59d6a675dd vdoc: trim result value 2020-02-26 23:18:31 +01:00
Major Taylor
c72e505fe4 pg: use unsafe 2020-02-26 23:17:56 +01:00
Alexey
394d64bfd0 vdoc: remove duplicated code 2020-02-26 22:44:28 +01:00
Alexey
ca9fa6407f v2: distinguish public and private constants 2020-02-26 22:43:37 +01:00
yuyi
46ec400cb3 vdoc: sort function names 2020-02-26 20:46:09 +01:00
Alexey
70f085be18 v2: process unsafe statements 2020-02-26 20:45:03 +01:00
Alexey
b1ea908b3b fmt: process defer statement 2020-02-26 20:44:42 +01:00
Delyan Angelov
9d61f4fad1 benchmark: make measuring small snippets of code less verbose/easier to use 2020-02-26 16:29:46 +01:00
Alexander Medvednikov
857cbfb0d2 v2: short struct init syntax; .xxx enum checks; unions; assert 2020-02-26 15:51:05 +01:00
SleepyRoy
c26016b132 examples: add quick_sort example 2020-02-26 13:32:39 +01:00
Nicolas Sauzede
30f905999a math: add powf and other float32 functions 2020-02-26 13:31:54 +01:00
Delyan Angelov
7a72167eb7 strings: optimization of repeat + repeat_string() 2020-02-26 13:22:12 +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
joe-conigliaro
c4e83faa57 compiler: allow a type to be used as a variant of multiple sum types 2020-02-26 15:15:38 +11:00
SleepyRoy
bc3d1eaf6e scanner: simplify and unify style 2020-02-25 22:58:51 +01:00
Alexander Medvednikov
0f8b2399ee fmt: fix new EnumVal 2020-02-25 19:59:47 +01:00
Alexander Medvednikov
28ee0f4ebe checker: check enums 2020-02-25 15:02:34 +01:00
SleepyRoy
05ed6c57b6 scanner: add check for wrong decimal numbers 2020-02-25 14:33:29 +01:00
Alexander Medvednikov
f6c2b3a54b v2: enum fixes 2020-02-25 13:30:43 +01:00
Alexander Medvednikov
7e930c2a75 cgen: enum 2020-02-25 11:52:41 +01:00
lydiandy
d4ffed89c0 add typeof test for fn (#3832) 2020-02-25 11:14:59 +01:00
penguindark
200f25a38f ftoa in V (#3831) 2020-02-25 11:12:37 +01:00
SleepyRoy
b17e49ad25 scanner: add check for bin/oct/hex with wrong digits 2020-02-25 11:11:12 +01:00
SleepyRoy
f859c7f93e scanner: fix special case - e or E at the end 2020-02-25 11:10:05 +01:00
Delyan Angelov
b17ade1257 compiler: implement typeof(x) 2020-02-24 21:45:47 +01:00
SleepyRoy
794ee6fc9d scanner: fix bin/oct/hex without number parts 2020-02-24 18:02:36 +01:00
lydiandy
3c0b73c2d6 sokol: fixes 2020-02-24 18:02:22 +01:00
SleepyRoy
96da5b33c0 scanner: fix special case - 0 at the end 2020-02-24 18:01:51 +01:00
yuyi
aae14f4eb4 tool: setup thirdparty 'freetype' 2020-02-24 18:01:34 +01:00
spaceface777
ef8c1203b4 cleanup: replace C for loops with range 2020-02-24 17:55:16 +01:00
Alexey
5918946feb fmt: process attributes 2020-02-24 17:18:14 +01:00
vitalyster
a3a7e0531a darwin: fix MacPorts build 2020-02-24 16:54:04 +01:00
Alexey
87ad5a96b9 v2: stringify multi-return types 2020-02-24 16:38:31 +01:00
Alexey
2bbb8526a3 fmt: process RangeExpr properly 2020-02-24 16:37:20 +01:00
SleepyRoy
7d2eb4f604 scanner: make 0o prefix the only way to define octals 2020-02-23 23:43:04 +01:00
yuyi
9d2a60bb11 os: optimize os_windows.v 2020-02-23 20:46:13 +01:00
yuyi
adb1d3f8c9 scanner: enable 0oxx to handle octals 2020-02-23 12:33:07 +01:00
Alexey
26fa833984 fmt: process assignment statement correctly 2020-02-23 11:22:07 +01:00
Alexander Medvednikov
2eb4f663d6 fix fmt test 2020-02-22 17:14:38 +01:00
Alexander Medvednikov
dd29bfe4d2 fix fmt test 2020-02-22 17:07:03 +01:00
Alexander Medvednikov
d510cd1e0d fmt: else, for in 2020-02-22 16:59:50 +01:00
Alexander Medvednikov
5fef8390a1 fmt: assoc 2020-02-22 14:39:25 +01:00
Alexander Medvednikov
cd41967aa1 fmt: struct pub/mut fields, map init 2020-02-22 14:13:22 +01:00
joe-conigliaro
b250ded3fa v2: fix typo & remove unneeded field 2020-02-22 23:08:14 +11:00
joe-conigliaro
30c8a5a010 v2: temp const fix 2020-02-22 23:04:56 +11:00
Alexander Medvednikov
6f577321f1 checker: fix build 2020-02-22 12:58:16 +01:00
Alexander Medvednikov
e459e6d24a checker: remove unnecessary exits 2020-02-22 12:57:18 +01:00
Major Taylor
72f80461de repl: add newline on exit 2020-02-22 12:41:57 +01:00
yuyi
1a1aa267b7 vlib: remove malloc unsafe warning 2020-02-22 12:41:24 +01:00
Alexander Medvednikov
3c3ca1e61f fmt: fix test 2020-02-21 22:56:50 +01:00
joe-conigliaro
15c288b444 v2: small type cleanup 2020-02-22 08:50:21 +11:00
yuyi
b325320f29 os: minor fixes 2020-02-21 20:14:01 +01:00
Alexander Medvednikov
7acf8efde3 fmt: fix import alias 2020-02-21 20:12:55 +01:00
Alexander Medvednikov
9be87d03f5 type_to_str: fix imported types 2020-02-21 19:56:37 +01:00
Alexander Medvednikov
e0c6766a79 make "unreachable code" a warning in non-prod builds 2020-02-21 18:55:18 +01:00
Alexander Medvednikov
1d90c1cbbf nice 2020-02-21 18:15:41 +01:00
Alexander Medvednikov
4c95e59d5c fmt, doc: &; update 0.2 roadmap 2020-02-21 18:13:34 +01:00
Alexander Medvednikov
9e6773cba8 fmt: optionals; none 2020-02-21 17:52:20 +01:00
Alexander Medvednikov
d075be73e8 fmt: single line if 2020-02-21 16:48:45 +01:00
yuyi
15a2927f09 optimize table.all_test_function_names 2020-02-21 16:29:41 +01:00
Alexander Medvednikov
e9931e6f84 fmt: wrap_long_line() 2020-02-21 16:14:15 +01:00
Alexander Medvednikov
728aeb8092 fmt: wrap long lines 2020-02-21 15:32:48 +01:00
Alexander Medvednikov
b309e7d0e5 type_to_str() 2020-02-21 14:47:42 +01:00
yuyi
6d0a599d0c changelog: grammar, typos 2020-02-21 14:17:27 +01:00
Alexander Medvednikov
6dac2edeef checker: is_number() 2020-02-21 13:44:03 +01:00
yuyi
527377dc86 fix os_test.v 2020-02-21 12:24:13 +01:00
Delyan Angelov
d90a291c5e ui: cleanup warnings from glm module 2020-02-21 12:20:59 +01:00
ka-weihe
6b706a0c99 Add FastestHash to cheaders.v 2020-02-21 12:20:03 +01:00
joe-conigliaro
8bb8b7d76e v2: add ability to store extra information with Type such as optional 2020-02-21 21:44:06 +11:00
Alexey
8677a5981c os: use unified way to deprecate functions 2020-02-20 23:00:02 +01:00
Delyan Angelov
88b402fcf8 bugfix: v should not panic when encountering a file that consists only of comments 2020-02-20 22:59:47 +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
ab8d883fee fix wyhash.h 2020-02-20 18:45:44 +01:00
Alexander Medvednikov
5d5373764e embed wyhash.h 2020-02-20 18:38:05 +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
yuyi
f267a88ddf v up: simplify 2020-02-20 17:41:55 +01:00
ka-weihe
34d926350b map: use hashmap instead of b-tree 2020-02-20 17:28:20 +01:00
Alexander Medvednikov
e35f8e9e23 checker: return errors 2020-02-20 17:05:16 +01:00
Alexander Medvednikov
296e736f5b checker: minor fixes 2020-02-20 16:16:44 +01:00
joe-conigliaro
72bbec89a9 v2: fix error in checker, continue instead of break 2020-02-21 00:20:08 +11:00
Don Alfons Nisnoni
20d900a21d ci: add a simple line length tool to check docs.md 2020-02-20 13:41:02 +01:00
joe-conigliaro
6f7c103e50 v2: checker use kind instead of idx 2020-02-20 23:27:23 +11:00
joe-conigliaro
e7e2c68d09 v2: allow type with str method to be used as fn string argument 2020-02-20 23:18:55 +11:00
Alexander Medvednikov
c099cd8bf6 pratt: fix precedence 2020-02-20 12:59:05 +01:00
Alexander Medvednikov
0074976636 checker: exit if there are errors 2020-02-20 12:05:53 +01:00
yuyi
8be07194c7 string: fix capitalize 2020-02-20 11:33:38 +01:00
yuyi
d51019dd77 unify vexe_path 2020-02-20 11:33:01 +01:00
joe-conigliaro
fcd97f513a v2: module/type/fn name fixes, compile fixes 2020-02-20 21:13:18 +11:00
Delyan Angelov
05329d6731 v: make launch_tool use .exe extension on windows 2020-02-20 10:56:13 +01:00
joe-conigliaro
aab1045045 v2: reorder types idxs, > string defined with v struct. rm unresovled 2020-02-20 11:39:59 +11:00
penguindark
d2cb5ad725 math.bits: make certain functions public + small fixes 2020-02-20 01:31:42 +01:00
Alexander Medvednikov
92e3e48bce v2: checker: [] and in 2020-02-19 21:13:42 +01:00
Alexander Medvednikov
e30bd04579 fix fmt test 2020-02-19 19:57:21 +01:00
Alexander Medvednikov
ec3d67c19f checker: print multiple errors; none 2020-02-19 19:54:42 +01:00
SleepyRoy
d91945cc99 parser: some pure logic code simplifications 2020-02-19 19:43:57 +01:00
Alexander Medvednikov
31b74f02b6 doc: handle submodules 2020-02-19 16:21:46 +01:00
Alexander Medvednikov
092c09d81f vdoc using the new parser 2020-02-19 16:13:34 +01:00
yuyi
391da0ba07 string: optimize starts_with and ends_with 2020-02-19 15:18:09 +01:00
joe-conigliaro
e4179c0008 v2: more array init & index expr fixes 2020-02-20 00:34:44 +11:00
joe-conigliaro
478c48cd6f Merge branch 'master' of https://github.com/vlang/v 2020-02-19 21:45:45 +11:00
joe-conigliaro
69634c60b3 v2: start to fix index expr for map/array/fixed array 2020-02-19 21:45:06 +11:00
joe-conigliaro
42399d24d9 v2: fix index expr for fixed array & map 2020-02-19 21:39:30 +11:00
Alexander Medvednikov
082acfad49 v2: fix more ast positions 2020-02-19 11:31:33 +01:00
Alexander Medvednikov
bc11419ff9 v2: fix for position and check 2020-02-19 11:06:36 +01:00
joe-conigliaro
042bce4b6c v2: dont preifx C fns with module & add todo 2020-02-19 18:08:08 +11:00
joe-conigliaro
83bfd0805e v2: prefix functions with module, except in main & builtin 2020-02-19 17:16:38 +11:00
joe-conigliaro
9b271d1728 v2: remove left over testing printlns 2020-02-19 16:06:16 +11:00
joe-conigliaro
f91bded9b3 v2: add missing table/modules.v 2020-02-19 13:11:55 +11:00
joe-conigliaro
b62a90a212 v2: module/import fixes, use parent_idx instead of parent ptr to remove need to preallocate types array 2020-02-19 13:09:35 +11:00
SleepyRoy
83faa8b59b README: change output to v2 in bootstrap test 2020-02-18 23:00:42 +01:00
Alexey
200d3e6446 vfmt: process imports and module name 2020-02-18 22:35:14 +01:00
SleepyRoy
aaf3ced750 parser: add type check for +=, -=, *=, /= 2020-02-18 22:14:52 +01:00
Alexander Medvednikov
19520ccf4e v2: for in checker 2020-02-18 21:59:42 +01:00
Alexey
39c4842bf9 vfmt2: skip arg type if possible 2020-02-18 21:02:43 +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
Delyan Angelov
290feaac51 vfmt2: allow running the new vfmt with 'v fmt -2' 2020-02-18 20:00:06 +01:00
Delyan Angelov
b991ca4ebc vfmt2: more convenient way to test multiple files for correct formatting 2020-02-18 17:54:14 +01:00
Alexander Medvednikov
4e9bfa95ec v2: the new parser can now parse the entire V compiler 2020-02-18 17:45:59 +01:00
Alexander Medvednikov
4de8d3ae8c parser: short struct syntax for all structs 2020-02-18 16:25:09 +01:00
joe-conigliaro
67756c53dc v2: more cleanup (#3765) 2020-02-18 18:58:20 +11:00
yuyi
392eb1fb55 fix vlib/compiler/aparser.v (#3764) 2020-02-18 18:45:04 +11:00
Alexander Medvednikov
ed01ab763c v2/vfmt2: more fixes 2020-02-18 03:28:41 +01:00
joe-conigliaro
ecb0af36b3 v2: cleanup old & unused code, add new simple tmp vars in cgen 2020-02-18 03:17:21 +01:00
vitalyster
2e1dbd9f5a windows: use %USERPROFILE% for os.home_dir() 2020-02-18 02:12:10 +01:00
Alexander Medvednikov
2ea2fed8a5 vfmt: minor clean up 2020-02-17 22:52:48 +01:00
Alexander Medvednikov
59beec8fae new vfmt using the new parser 2020-02-17 22:50:11 +01:00
prime31
a2838ae6f3 array: add array.trim() 2020-02-17 20:31:40 +01:00
yuyi
6849a4e770 filepath: path separator (#3756) 2020-02-17 20:31:23 +01:00
Daniel Däschle
6079025985 gg: add option to decorate window 2020-02-17 20:29:09 +01:00
Alexey
44e8770b73 ci: fix windows-prebuilt job 2020-02-17 20:08:09 +01:00
Alexander Medvednikov
28c83f3f43 ci: windows fix 2020-02-17 15:19:45 +01:00
Alexander Medvednikov
53f8ae6517 fix prod build 2020-02-17 14:30:01 +01:00
Alexander Medvednikov
1dd6491a2f v2: more parser fixes 2020-02-17 14:15:49 +01:00
Alexander Medvednikov
457035c7ec Update ci.yml 2020-02-17 13:54:05 +01:00
Alexander Medvednikov
503a624cc9 ci: fix windows cmd syntax 2020-02-17 13:37:57 +01:00
Alexander Medvednikov
bc977f8d4a ci: test prebuilt windows package 2020-02-17 12:44:55 +01:00
Alexander Medvednikov
c4faa284ed ci: test prebuilt linux package 2020-02-17 12:35:00 +01:00
joe-conigliaro
d7f74ecf52 v2: move more type handling to checker + some clean up 2020-02-17 12:25:18 +01:00
Don Alfons Nisnoni
41808f80fd docs: fix hot reload link 2020-02-17 12:19:15 +01:00
penguindark
80861f2219 scanner: exponent without sign 2020-02-17 02:35:01 +01:00
joe-conigliaro
1007dd8f23 v2: update parse type not to prefix builtin types with module 2020-02-16 16:16:19 +01:00
Delyan Angelov
195f3f465b option to disable bounds checking; examples/path_tracing.v: optimizations 2020-02-16 16:13:45 +01:00
lutherwenxu
277c55fe5b cmd/v: rewrite default help message 2020-02-16 12:50:25 +01:00
yuyi
e272a10bda vfmt fixes 2020-02-16 12:42:28 +01:00
Alexander Medvednikov
9eeb3dfe7e v2: temporary string cast fix 2020-02-16 12:38:15 +01:00
Alexander Medvednikov
6d8ad58515 v2: mod.Type 2020-02-16 12:31:44 +01:00
Alexander Medvednikov
d4991164cf fix ci 2020-02-15 20:18:50 +01:00
Alexander Medvednikov
87e28e6b49 Update ci.yml 2020-02-15 14:46:05 +01:00
Alexander Medvednikov
14a29823c0 ci: test prebuilt macos package 2020-02-15 14:45:10 +01:00
joe-conigliaro
dc90f4f4a6 v2: remove unresolved types; handle types in checker; add ast.scope 2020-02-15 13:37:48 +01:00
Alexey
c2c6260ba2 readme: fix URL to wiki page and prettify URL titles 2020-02-14 23:26:07 +01:00
yuyi
5a6f4aa61d vcreate: optimizations and small fixes 2020-02-13 19:27:13 +01:00
Alexey
20257d2a5c readme: remove trailing colon from header 2020-02-13 19:25:38 +01:00
penguindark
ce6ee1505f path tracing example 2020-02-13 19:22:35 +01:00
Delyan Angelov
869e16c340 fix CI macOS-latest (failing postgresql brew install) 2020-02-13 19:22:13 +01:00
Alexander Medvednikov
8dd905a14d v2: more parser fixes 2020-02-13 14:08:19 +01:00
Alexey
f00ab076d1 vfmt: simplify reading source lines 2020-02-12 23:19:45 +01:00
Alexey
8d76f7d195 v2: remove redundant EOL normalization in cgen test 2020-02-12 23:19:17 +01:00
Alexander Medvednikov
9d46fb9f90 v2: [] expr for known arrays; p.expected_type 2020-02-12 17:39:51 +01:00
Alexey
ab7a79cb90 ci: fix complilation in periodic workflow 2020-02-12 17:34:11 +01:00
Delyan Angelov
0ad5d53423 net.http: more robust handling of relative /path URL redirects 2020-02-12 14:52:39 +01:00
penguindark
67e7ad13de math.bits: added missing functions and test 2020-02-12 11:32:03 +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
Alexander Medvednikov
2838d12227 v2: fn_args() 2020-02-11 13:03:14 +01:00
joe-conigliaro
d25a0e30dc v2: make index_expr return array array element type 2020-02-11 12:59:40 +01:00
Alexander Medvednikov
9610821884 v2: defer; match a,b; if x := 2020-02-11 10:26:46 +01:00
joe-conigliaro
f7b80c3c62 v2: fix fixed array parsing 2020-02-11 14:45:33 +11:00
Alexander Medvednikov
2d7c80bbc3 v2: match sum type; { x | } 2020-02-11 00:07:01 +01:00
Alexander Medvednikov
a21e3d77e9 fix prod build 2020-02-10 23:47:42 +01:00
Alexander Medvednikov
747f6829ab v2: enum decl; type decl; [start..end] fix; %= 2020-02-10 23:19:50 +01:00
Alexander Medvednikov
26cfaa150e v2: match expr; enum val; string formatting 2020-02-10 20:33:46 +01:00
Nicolas Sauzede
d51c159160 math: add sqrtf 2020-02-10 18:48:44 +01:00
yuyi
c1c2b648ab os: typo in wait 2020-02-10 18:48:01 +01:00
Alexander Medvednikov
d5f90ef64b v2: handle unresolved consts 2020-02-10 18:43:25 +01:00
joe-conigliaro
bf5ed5e451 v2: fix array index, for loop, add cast expr & other minor fixes 2020-02-10 14:43:17 +01:00
Alexander Medvednikov
c9f619dc72 v2: parse filter() 2020-02-10 14:42:57 +01:00
Alexander Medvednikov
3f6ccd3120 v2: minor fixes 2020-02-10 13:58:24 +01:00
radare
211d35d647 fix build on FreeBSD 2020-02-10 09:00:26 +01:00
radare
7dc040b01c fix -prod on OpenBSD 2020-02-10 08:57:35 +01:00
joe-conigliaro
e274c5c485 v2: type sys - store type idx/ptr in int & add helpers 2020-02-10 08:32:08 +01:00
penguindark
9845fd1cf5 math.bits: tests 2020-02-09 21:16:03 +01:00
Delyan Angelov
f76651604d compiler: bugfix for raw'"' 2020-02-09 16:29:05 +01:00
Alexey
984fd8c05e PR template: update selfcompile instruction 2020-02-09 15:41:19 +01:00
joe-conigliaro
94537c5901 compiler: scope type alias to module 2020-02-09 15:40:31 +01:00
Alexander Medvednikov
179fb13a17 Delete v2.v 2020-02-09 10:40:29 +01:00
Alexey
11ded170ee readme: update selfcompile instruction 2020-02-09 10:39:45 +01:00
lutherwenxu
9332a83ce6 move v.v to cmd/v 2020-02-09 10:08:04 +01:00
Leah Lundqvist
3f5e4c55b2 docs: Adv. Topics to h1 2020-02-09 09:32:36 +01:00
joe-conigliaro
7583c350b8 compiler/math.bits: use max u64 consts 2020-02-09 09:25:27 +01:00
Alexey
1eeee40278 string: split into lines correctly 2020-02-09 09:23:57 +01:00
Delyan Angelov
4bb5d7de8b tooling: use term.header for tests 2020-02-08 17:01:10 +01:00
Delyan Angelov
9d8116f895 docs: tips for C/V interoperability 2020-02-08 17:00:35 +01:00
Delyan Angelov
a02e1e0af2 compiler: more actionable error message, when fn main is missing 2020-02-08 17:00:13 +01:00
joe-conigliaro
a2d2586331 v2: map / string / builtin type fixes 2020-02-08 16:59:57 +01:00
Alexander Medvednikov
c2f22a4bf3 readme: update discord link 2020-02-08 12:23:29 +01:00
joe-conigliaro
e01c76c895 v2: fix type resolving 2020-02-08 12:14:53 +01:00
joe-conigliaro
9e9bdc32ea v2: lots of small fixes parent method/field resolution 2020-02-08 09:50:12 +01:00
Alexander Medvednikov
ea9961a8fb fix term_windows.v 2020-02-07 23:16:34 +01:00
Major Taylor
e9827f5a34 vweb: fix typo in 'assets.v' 2020-02-07 23:12:30 +01:00
Alexander Medvednikov
8f9979eb8d fix time_windows.v 2020-02-07 23:11:15 +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
Mahmoud Samir Fayed
99217da6ca examples: update tetris readme 2020-02-07 18:47:05 +01:00
joe-conigliaro
35bef514b0 v2: checker & unresolved fixes & small updates 2020-02-07 18:46:42 +01:00
Don Alfons Nisnoni
36e636743b term: header() 2020-02-07 18:46:20 +01:00
Alexander Medvednikov
0510bc7744 fix int.v 2020-02-07 14:57:48 +01:00
Alexander Medvednikov
c8dcbcb649 parser: allow as in consts 2020-02-07 14:53:07 +01:00
Alexander Medvednikov
9034b1fd08 v2: match cgen; use as for casting 2020-02-07 14:50:52 +01:00
Alexander Medvednikov
27719ded9b Update README.md 2020-02-07 14:31:41 +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
Delyan Angelov
2ce6b190dd @VMODULE relative paths in #flag lines 2020-02-06 17:38:35 +01:00
joe-conigliaro
67a13fc916 v2: start impl multi assign 2020-02-06 17:38:02 +01:00
Alexey
65744207fc time: reorganize module 2020-02-06 14:19:44 +01:00
joe-conigliaro
d9e92a08cb v2: use pointer to table.type, fix unresolved array/map sub-types 2020-02-06 13:57:35 +01:00
Alexander Medvednikov
6c3613407d vweb: fix header.html 2020-02-06 10:41:10 +01:00
Alexey
91e181b14a time: return optional value in parse and parse_iso functions 2020-02-06 10:22:00 +01:00
Delyan Angelov
1618596218 os: fix compiler warnings when just importing os 2020-02-05 11:23:49 +01:00
Alexander Medvednikov
06b5f43e48 builtin: remove unneeded casts 2020-02-05 11:22:24 +01:00
Alexander Medvednikov
efaca5974c ci: build vpm 2020-02-05 11:22:24 +01:00
Exa Stencil
1db07f52d1 Improve vweb example to output the cookie 2020-02-05 10:53:16 +01:00
Alexander Medvednikov
2b433cdf64 v2: match, <<=, >>=, |=, ~, unsafe, map init 2020-02-05 10:00:14 +01:00
Alexey
a61c9c617d time: use _mkgmtime and timegm to calculate unix time 2020-02-05 06:13:11 +01:00
Nicolas Sauzede
9d4c943d64 compiler: add very simple nameof token to get type name as string 2020-02-05 06:12:33 +01:00
Alexander Medvednikov
c595c9eee1 builtin: bring back old hex() 2020-02-04 20:23:03 +01:00
Alexander Medvednikov
f1a0c2f1af v2: parse optionals 2020-02-04 20:22:00 +01:00
Alexander Medvednikov
ac5c4e3203 fix prod build 2020-02-04 17:48:15 +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
vitalyster
21b54723e4 time: fix timezone 2020-02-04 12:17:04 +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
c7f07cd0b6 v2: postfix_expr() checker 2020-02-04 07:37:41 +01:00
origel
4d6958381d glfw: window add set resize callback method 2020-02-04 05:40:16 +01:00
joe-conigliaro
75eebb516f fix bug in levenshtein distance & add tests 2020-02-04 04:21:40 +01:00
joe-conigliaro
b6a62cf20e ci: fix config error from #da8c7eb (#3640) 2020-02-03 23:32:18 +11:00
joe-conigliaro
da8c7eb0fc ci: fix homebrew-service (PostgreSQL) do manual start for now. (#3638) 2020-02-03 23:29:23 +11:00
joe-conigliaro
1e21e76788 tools: gen_vc - update to show subject in commit message 2020-02-03 12:57:41 +01:00
joe-conigliaro
21b6dace8f v2: remove duplication & slight cleanup. share prefs with v1 2020-02-03 12:09:17 +01:00
Alexander Medvednikov
f1f8a2e4dd fix prod build 2020-02-03 12:06:25 +01:00
Alexander Medvednikov
b1bf2e0371 ci: brew services fix 2020-02-03 11:57:57 +01:00
Alexander Medvednikov
64bfae0a0e 2 2020-02-03 11:54:41 +01:00
Alexander Medvednikov
54605823f9 rem1 2020-02-03 11:45:25 +01:00
Alexander Medvednikov
01f45f063e cgen: remove the checker 2020-02-03 11:36:03 +01:00
Alexander Medvednikov
40fd918b58 v2: cgen: remove type resolving for VarDecl 2020-02-03 11:32:00 +01:00
Alexander Medvednikov
6489b48c9c v2: clean up IndexExpr type check 2020-02-03 11:29:50 +01:00
Alexander Medvednikov
e5f5117a7e fix prod build 2020-02-03 11:17:12 +01:00
Alexander Medvednikov
60a4f668b7 v2: fix FnDecl ref bug 2020-02-03 11:13:36 +01:00
Alexander Medvednikov
2af3c0ede4 hmm 2020-02-03 10:58:15 +01:00
Alexander Medvednikov
1ac7a95f9b fix array_test.v 2020-02-03 10:27:06 +01:00
Alexander Medvednikov
50b704c5dd sum type: mut 2020-02-03 09:25:26 +01:00
Alexander Medvednikov
34e9eb32bb sum types: allow modification in match 2020-02-03 09:11:10 +01:00
Alexander Medvednikov
d918903252 v2: move index expr type check 2020-02-03 07:45:09 +01:00
joe-conigliaro
2d5c70832c v2: initial module support 2020-02-03 07:31:54 +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
7808f4c272 hash.wyhash: implement rand function from wyhash original impl 2020-02-03 06:02:28 +01:00
joe-conigliaro
7f709c3285 update copyright years 2020-02-03 05:00:36 +01:00
Delyan Angelov
da21b50750 gg,os: minimize memory allocation 2020-02-03 04:01:39 +01:00
Alexander Medvednikov
71653273f6 v2: range, *, function object 2020-02-02 14:32:12 +01:00
Don Alfons Nisnoni
4fc52948b3 mysql: wrap more APIs & organize module 2020-02-02 12:39:57 +01:00
Alexander Medvednikov
377d8dc42c v2: parser_test: run all tests 2020-02-02 08:06:21 +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
toman222
932392a7fd sqlite: modify exec functions + other fixes 2020-02-02 02:56:09 +01:00
Leah Lundqvist
0ef1ba9ad2 gg: added draw_empty_rounded_rect 2020-02-02 02:55:29 +01:00
Leah Lundqvist
4ca283380a gg: scissor 2020-02-02 02:54:41 +01:00
joe-conigliaro
554d1dd7c6 compiler: make optionals work with multi return 2020-02-02 02:53:23 +01:00
prime31
f0efb42a30 cc: add file style selector to clang-format 2020-02-02 02:51:27 +01:00
joe-conigliaro
8bd17c8016 crypto.rand: update slice method to slice syntax & fix typo in error 2020-02-02 02:50:46 +01:00
joe-conigliaro
05374e162e compiler: attribute test - fix typo in function name 2020-02-01 18:59:34 +11:00
Delyan Angelov
696926a557 compiler: add support for -pretty_c option 2020-02-01 06:37:22 +01:00
radare
bf9eefa694 parser: resolve optional enum type 2020-01-31 16:00:31 +01:00
radare
2fbfbf45c7 os: simplify read_lines( 2020-01-31 15:59:23 +01:00
Alexander Medvednikov
5f76bd04f9 V 0.1.25 2020-01-31 15:31:15 +01:00
Leah Lundqvist
aa625bc22c gg: roundrects 2020-01-31 03:43:46 +01:00
kemalcan bora
c90b53b89d examples: simple linear regression 2020-01-31 02:44:38 +01:00
penguindark
de832375b7 regix: fixes and optimizations 2020-01-31 02:29:54 +01:00
ka-weihe
23dd6e2294 hashmap: optimization of rehashing 2020-01-31 02:29:35 +01:00
joe-conigliaro
80d936adc1 fix attributes on public structs & enums 2020-01-30 01:27:13 +01:00
Leah Lundqvist
6c5879add9 gg: filled arcs and circles 2020-01-30 01:26:45 +01:00
Leah Lundqvist
ed55778d2a math: fast aprox cos and sin 2020-01-29 05:12:43 +01:00
Alexey
5c598a3085 term: reorganize the module 2020-01-29 05:12:12 +01:00
ka-weihe
a14a5fbf95 hashmap: change hash-function to wyhash and add benchmarks 2020-01-29 04:06:05 +01:00
div72
5c29e7b257 http: fixed a bug with ignored user-agent 2020-01-29 04:05:37 +01:00
joe-conigliaro
0f1b0f7ed4 wyhash: update benchmark file location in comment 2020-01-29 10:12:44 +11:00
Alexey
5c00851b44 term: implement get_terminal_size for Windows 2020-01-28 23:44:57 +01:00
joe-conigliaro
007baa2305 hash: add wyhash + benchmark, add fnv1a, add u64.hex() (#3584) 2020-01-28 23:43:09 +01:00
penguindark
5a2534122e regex: named capturing groups, small fixes 2020-01-28 20:34:11 +01:00
Delyan Angelov
9ac0c54eb0 term: fix too long h_divider lines in CI 2020-01-28 20:25:17 +01:00
Mateo Pidal
78c96fe989 term: get_terminal_size() 2020-01-28 05:18:19 +01:00
prime31
08d3401092 array: clear() 2020-01-27 22:31:48 +01:00
Leah Lundqvist
8986633624 gg: draw_arc() 2020-01-27 20:42:32 +01:00
Delyan Angelov
cce0b2425e compiler: prevent vars named 'char' to cause a C error 2020-01-27 20:26:07 +01:00
Steve Phillips
c617cf8e05 examples: fizz_buzz.v 2020-01-27 16:56:46 +01:00
Delyan Angelov
7a79c94a9e tools/oldv: fix default behaviour (regression caused by 760448a) 2020-01-27 16:56:32 +01:00
ka-weihe
31899eac2a hashmap: new load_factor and optimizations 2020-01-27 16:56:18 +01:00
Théo Huchard
bf6b206fca docs: fix consts example 2020-01-27 15:44:02 +01:00
Mike Redko
11aa5343b2 update copyright year in asm.v 2020-01-26 23:33:47 +01:00
Delyan Angelov
e9d3134814 glfw: implement glfw.window.set_should_close 2020-01-26 23:33:12 +01:00
Delyan Angelov
869c8e331e stbi: make compilation faster by generating a stbi.o file 2020-01-26 12:41:43 +01:00
Khairul Azhar Kasmiran
edc44993d1 string: add another test for split_nth() 2020-01-25 19:12:36 +01:00
penguindark
15a63b5bcb regex fixes 2020-01-25 19:12:23 +01:00
Alexander Medvednikov
222fc4b04f parser: no struct fields warnings in C struct initializations 2020-01-25 07:15:49 +01:00
joe-conigliaro
71b50ae7fd fix empty config struct with msvc 2020-01-25 02:11:07 +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
Delyan Angelov
df2d3a268d tests: support -silent flag to silence OK messages in CI jobs 2020-01-24 20:07:44 +01:00
Alexander Medvednikov
f55646746c handle empty config structs 2020-01-24 18:57:32 +01:00
joe-conigliaro
2897bac549 crypto: remove extraneous casts & rename rand_lin to rand_linux 2020-01-23 22:49:13 +01:00
nsauk
dd61a22367 compiler: remove --lzma option from upx call 2020-01-23 22:06:49 +01:00
Delyan Angelov
7b18e5d198 compiler: add 'use -- instead of -= 1' 2020-01-23 21:09:47 +01:00
joe-conigliaro
6d6b2fdda8 compiler: fix depgraph. will also make it work with new b-tree map 2020-01-23 21:08:17 +01:00
joe-conigliaro
20f6cdc53a compiler: fix module alias resolution 2020-01-23 21:07:53 +01:00
toman222
0a93d3b714 sha512: remove unnecessary cast warnings 2020-01-23 21:07:16 +01:00
Henrixounez
f3f50349b2 compiler: fix check restricted names in for..in statement 2020-01-23 21:06:57 +01:00
Shun Sakai
c8c43a2475 update copyright year 2020-01-23 21:04:46 +01:00
joe-conigliaro
9cff1e454c tools: skip pico example on windows (as no windows support yet) (#3542) 2020-01-23 22:58:47 +11:00
joe-conigliaro
82da001faf sokol: fix issue causing win test to fail introduced in 0502a54 2020-01-23 21:56:12 +11:00
joe-conigliaro
543e8dc78a v2: fix bug in scanner, introduced in da9b639 (_ in num literals) 2020-01-23 21:47:13 +11:00
penguindark
da9b6394e8 0bxxxx binary literal support; _ in literals (1_000_000) 2020-01-23 03:28:25 +01:00
Alexander Medvednikov
c3d0814517 remove ui.o 2020-01-23 03:27:03 +01:00
S-YOU
7b345e207d pico.v and dependencies 2020-01-23 03:26:30 +01:00
toman222
5c6032d272 math.bits: fix warnings regarding unnecessary casts 2020-01-22 22:06:40 +01:00
Alexander Medvednikov
a6e1a74f1d gg: windows fix 2020-01-22 21:36:52 +01:00
Alexander Medvednikov
325691b3ef Update PULL_REQUEST_TEMPLATE 2020-01-22 21:32:41 +01:00
Alexander Medvednikov
59b3fc75d0 tmp fix generic test 2020-01-22 21:30:35 +01:00
Alexander Medvednikov
0502a54a36 new gg/freetype modules with sokol/fontstash backends 2020-01-22 20:54:36 +01:00
Abdullah Atta
43ba6766ba improve eventbus 2020-01-22 17:41:08 +01:00
Charles WANG
136c469ef7 array: more eq functions 2020-01-21 18:49:30 +01:00
Jeremy Andrews
dd5751df0c v test v has been deprecated 2020-01-21 18:48:32 +01:00
Delyan Angelov
f4834bd85d compiler: fix stuck parsing of 'enum{}' + handle such bugs 2020-01-21 18:47:52 +01:00
KJ Lawrence
ae3d84df6b os: add open_file function 2020-01-21 16:58:47 +01:00
d2verb
5deb29a7c9 compiler: update cheaders.v for NetBSD support 2020-01-21 16:55:07 +01:00
Delyan Angelov
d92291dd76 repl: execute REPL tests ~1.5x to 2x faster 2020-01-20 23:04:26 +01:00
Delyan Angelov
64a9f43405 Make REPL tests parallel too 2020-01-20 17:06:36 +01:00
nsauk
84438c0139 time: add str() 2020-01-20 15:06:15 +01:00
S-YOU
9b3ac7efa4 v cmd: no need to panic in case of an unknown command 2020-01-20 06:16:04 +01:00
Alexander Medvednikov
d1664dc511 freetype: max_width 2020-01-20 05:14:49 +01:00
Alexander Medvednikov
53b06048d2 fast.v fixes 2020-01-20 02:19:58 +01:00
Delyan Angelov
2f27eb42ed minimal parallel tests with just threads and a waitgroup 2020-01-19 23:33:16 +01:00
Alexander Medvednikov
ab368bdc53 array: test arr << arr 2020-01-19 22:15:37 +01:00
Delyan Angelov
0d52cc97e4 sync: make new_mutex() and new_waitgroup() return &Mutex and &Waitgroup 2020-01-19 20:32:22 +01:00
Delyan Angelov
bc64263dd8 freetype: fix placement of highdpi and lowdpi texts 2020-01-19 20:30:53 +01:00
Delyan Angelov
bfaf2a4a62 freetype: cleanup calculation of text y position while drawing the text 2020-01-19 16:01:08 +01:00
sha0coder
990e44cd14 ftp: protocol compatibility 2020-01-19 13:53:13 +01:00
joe-conigliaro
3a8b437b8d v2: move array_init to checker 2020-01-19 13:52:34 +01:00
Alexander Medvednikov
cf1fd6e950 array: fix arr << arr bug 2020-01-19 12:11:58 +00:00
Alexey
6e9822929f readme: fix screenshot path 2020-01-19 12:40:44 +01:00
Alexander Medvednikov
b1602c72ad v2: a simple fix 2020-01-19 02:44:18 +01:00
joe-conigliaro
09d1eb7c55 v2: type checker + lots of other changes 2020-01-18 23:26:14 +01:00
Delyan Angelov
8c1b03c731 freetype: text_size() so that users can retrieve the vertical size of a text too 2020-01-18 20:08:11 +01:00
S-YOU
09e390eac5 remove string clone because cJSON already did internally 2020-01-18 17:40:58 +01:00
Don Alfons Nisnoni
a9127bedf7 tutorial: Improve grammar 2020-01-18 17:03:46 +01:00
penguindark
36660ce749 regex: bug fixes, docs 2020-01-18 07:38:00 +01:00
Alexander Medvednikov
ad7bc37672 skip httpbin test on msvc for now 2020-01-18 07:27:50 +01:00
Alexander Medvednikov
b2be36d92e fix sokol on windows 2020-01-18 06:27:39 +01:00
Delyan Angelov
24d34a4f2c sokol: fix building of examples and ci tests 2020-01-17 20:05:45 +01:00
Alexander Medvednikov
3d57d3bb7b cc.v: fix C error message part 2 2020-01-17 19:44:03 +01:00
Alexander Medvednikov
2cd24ea722 cc.v: fix C error message 2020-01-17 19:30:45 +01:00
vitalyster
436603aa44 compiler: show last 200 lines in partial output 2020-01-17 14:09:37 +01:00
Delyan Angelov
ddc04979a4 deprecate v runrepl in favour of v repl 2020-01-17 14:09:26 +01:00
Alexander Medvednikov
ccf6134beb rename sokol examples, so that they can be run from root 2020-01-17 00:58:49 +01:00
Alexander Medvednikov
62481e88f3 sokol and fontstash modules 2020-01-16 20:45:52 +01:00
Delyan Angelov
cc606623bb enable $if !network { checks in net tests 2020-01-16 19:44:16 +01:00
Alexander Medvednikov
e1132156f5 make sqlite.DB public; make string.left/right private 2020-01-16 18:41:38 +01:00
Chris Watson
84a6c019e8 http: refactor and reduce duplication 2020-01-16 18:16:11 +01:00
Alexander Medvednikov
756c6d2858 freetype: fix align.right rendering 2020-01-16 17:03:34 +01:00
Don Alfons Nisnoni
1e98a227cc docs: update code that doesn't work 2020-01-16 15:29:00 +01:00
Delyan Angelov
57f72f6cd8 compiler: support optional custom comptime defines: $if custom ? { 2020-01-16 15:28:23 +01:00
penguindark
d6448ee5d6 regex: update README.md 2020-01-16 02:07:36 +01:00
penguindark
25fabac059 regex 0.9c 2020-01-16 00:39:33 +01:00
Alexander Medvednikov
d5f6e37c65 fix graph.v example 2020-01-16 00:07:59 +01:00
Alexander Medvednikov
663a8c9c79 tutorial: a minor vweb update 2020-01-15 22:20:51 +01:00
Alexander Medvednikov
de3ad2b04f fix vweb tutorial project; clean up gg functions a bit 2020-01-15 22:17:45 +01:00
Alexander Medvednikov
4f8848f658 readme: add a twitter badge 2020-01-15 21:47:02 +01:00
Mateo Pidal
502ee8a56c android symlink fix 2020-01-15 19:40:03 +01:00
Kai
9f31390ff1 http: PATCH, DELETE, and PUT methods 2020-01-14 23:19:50 +01:00
Delyan Angelov
4838dda59a compiler: make [live] fn unlock its mutex on early return 2020-01-14 18:58:46 +01:00
Swastik Baranwal
26374971ab time: fix logic 2020-01-14 18:12:28 +01:00
Swastik Baranwal
2741c0b211 string: new type conversion functions 2020-01-14 18:05:38 +01:00
lutherwenxu
2c8848f1bc github: fix issue templates 2020-01-14 16:17:52 +01:00
Mathieu Aubin
dc55ce4764 add static compilation to Makefile 2020-01-14 16:17:17 +01:00
Alexander Medvednikov
6b3f54692a allow short struct initialization with Config structs 2020-01-14 15:34:47 +01:00
Alexander Medvednikov
0b235cc893 temporary nil fn check 2020-01-14 13:15:09 +01:00
penguindark
25e7ceeef0 regex 0.9b 'replace' and 'find_all' added 2020-01-14 02:45:08 +01:00
Mateo Pidal
e87e5e33a7 fix symlink for Termux on Android 2020-01-14 01:34:30 +01:00
Delyan Angelov
fcc10d6358 gg: fixes same image twice lead to invisible rectangles sometimes 2020-01-13 19:59:31 +01:00
invisiblesoldiers
74713ffb62 encoding.binary: removed unneeded castings, rename function 2020-01-13 19:58:14 +01:00
Delyan Angelov
cb3ac33e18 new tool: bin2v to convert arbitrary files to a .v static module file 2020-01-13 17:54:18 +01:00
Delyan Angelov
4a82770f16 fix warnings about clipboard when building ui on linux 2020-01-13 17:53:56 +01:00
Alexander Medvednikov
4c55d3677d ui: skip initialization warning for now 2020-01-13 13:40:50 +01:00
penguindark
8ea0c08a38 vlib.regex module in pure V 2020-01-13 13:30:41 +01:00
Alexander Medvednikov
6733b12ec3 android: use __ANDROID__ 2020-01-13 00:20:16 +01:00
Alexander Medvednikov
9b5e9984bf readme: add a link to V UI 2020-01-12 20:30:21 +01:00
Alexander Medvednikov
e72dfc3212 freetype: remove unused import 2020-01-12 20:08:24 +01:00
Alexander Medvednikov
4c7df98ac9 make private struct warning an error 2020-01-12 19:59:57 +01:00
Alexander Medvednikov
e159347c10 gg: remove 2 prints 2020-01-12 19:54:47 +01:00
Frederico Silva
2678f9289e pg: connect, use password 2020-01-12 19:35:20 +01:00
Delyan Angelov
f317b65808 ui: fixes so that the ui demo works on linux too
* Implement os.resource_abs_path/1 .
* Implement glfw.get_window_size and glfw.get_framebuffer_size .
2020-01-12 19:35:06 +01:00
Alexander Medvednikov
607656d616 Update 0.2_roadmap.txt 2020-01-12 16:44:29 +01:00
Alexander Medvednikov
b6c0b22742 interfaces fixes; freetype.text_width(); gl and stbi fixes 2020-01-12 16:11:28 +01:00
Alexander Medvednikov
938f27e391 remove ui example now that ui has been moved to a separate repo 2020-01-12 03:05:04 +01:00
Delyan Angelov
ba699d8b4f compiler: fix error in case of void function used as a value 2020-01-12 01:46:25 +01:00
Don Alfons Nisnoni
f7f5f43c48 mysql: add select_db method 2020-01-11 13:25:59 +01:00
Alexander Medvednikov
0a33c9ebf5 .editorconfig: indent_size = 4 2020-01-11 13:23:47 +01:00
Swastik Baranwal
e3db628d0c parser: add checks for if statement 2020-01-11 13:21:35 +01:00
Delyan Angelov
06f581e146 vfmt: support for vid like projects having many module main .v files 2020-01-10 23:33:35 +01:00
Swastik Baranwal
5537b09492 parser: add check for string casting 2020-01-10 19:59:15 +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
Delyan Angelov
7bf49aba54 vv: make warns/errors usable in emacs/vim 2020-01-09 14:08:33 +01:00
Delyan Angelov
7882312697 rename $if mac => $if macos , _mac.v => _darwin.v 2020-01-09 11:12:35 +01:00
radare
760448afa4 Use os.rmdir_recursive instead of scripting.run('rm -rf') 2020-01-09 02:01:02 +01:00
Alexander Medvednikov
8a7f2a2696 ci: disable prebuilt tests for now 2020-01-09 01:50:50 +01:00
Alexander Medvednikov
29564ed63d interface fix 2020-01-09 01:40:10 +01:00
Delyan Angelov
c1cc203c17 tools: bugfixes and new features for oldv and performance_compare 2020-01-08 21:45:47 +01:00
Delyan Angelov
0d93eeb3fe compiler: move prelude files to tools/preludes/ 2020-01-08 17:57:41 +01:00
Alexander Medvednikov
56421beb8a ci.yml: small windows fix 2020-01-08 17:23:40 +01:00
Contextualist
2a98cacecd tools: distinguish complier args and tool args 2020-01-08 17:15:05 +01:00
joe-conigliaro
38e5f0d1cf v: initial type work for methods / struct fields 2020-01-08 17:14:42 +01:00
Alexander Medvednikov
526f12feff ci.yml: fix run command 2020-01-08 14:18:26 +01:00
Alexander Medvednikov
ae266f56e2 ci: build examples on windows-prebuilt 2020-01-08 14:11:44 +01:00
Alexander Medvednikov
3d31b21df9 ci.yml: use curl -L 2020-01-08 14:05:45 +01:00
Alexander Medvednikov
c668d0569c ci.yml: debug curl 2020-01-08 13:48:15 +01:00
Alexander Medvednikov
0b0e90dc53 ci.yml: use curl 2020-01-08 11:42:46 +01:00
Alexander Medvednikov
93b6089522 fix ci.yml 2020-01-08 11:35:23 +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
Krzysztof Starzyk
3425934c39 flag: remove println from parse_raw 2020-01-07 18:37:01 +01:00
Alexander Medvednikov
9861b24bc3 struct field check + enable v2 again 2020-01-07 16:09:20 +01:00
joe-conigliaro
2ab7b40f2f v: clean up enum vals; make array_init return array 2020-01-07 15:46:57 +01:00
Delyan Angelov
fb0817277f compiler: force .exe extension, when compiling on windows 2020-01-07 15:42:14 +01:00
Alexander Medvednikov
d823d82207 array type fix; method registration 2020-01-07 13:10:09 +01:00
Delyan Angelov
6d30697d9b time: move time.random() to time.misc module
avoids importing rand to programs that do not need pseudo random generation).
2020-01-07 12:58:24 +01:00
Shivanjan Chakravorty
a0c8ad7398 post increment/decrement repl fix 2020-01-07 12:26:49 +01:00
Alexander Medvednikov
706c6066d5 index expression 2020-01-07 12:18:13 +01:00
joe-conigliaro
b7509577b5 v: cleanup & fixes. update variadic & multiple return 2020-01-07 12:10:07 +01:00
Alexander Medvednikov
8c5923297e do not run cgen_test.v on windows 2020-01-07 01:57:38 +01:00
Alexander Medvednikov
69f3c42b99 method calls; skip string interpolation for now; fix () 2020-01-07 01:08:24 +01:00
Alexander Medvednikov
48ea1153a5 for ;; syntax 2020-01-07 00:14:19 +01:00
Alexander Medvednikov
1e28c1d4fd clean up the parser a bit; run vfmt; add x64 to ci 2020-01-06 23:15:37 +01:00
Alexander Medvednikov
b815878d60 simplify and improve pratt 2020-01-06 16:13:12 +01:00
r00ster
025efcb731 os: add is_executable, is_writable and is_readable 2020-01-06 09:15:06 +01:00
Alexander Medvednikov
126289c19b make the unchanged mutable variable error a warning in non-prod builds 2020-01-06 00:28:29 +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
Delyan Angelov
c24a1b3786 compiler: fix unused import warnings 2020-01-05 16:29:33 +01:00
Ricardo Tomasi
868d6c808b compiler: avoid redeclaration of var during reassignment with optional value 2020-01-05 11:53:40 +01:00
Ricardo Tomasi
15415b2aae Update tetris/README for macOS 2020-01-05 11:52:58 +01:00
joe-conigliaro
5a6f9024d3 v: small fixes typo & register struct & and add array elem pointer 2020-01-05 11:52:03 +01:00
joe-conigliaro
2061394ad7 v: initial impl of new type sys w/ pointer & placeholder support (#3323) 2020-01-04 17:57:25 +01:00
Delyan Angelov
778a1cc34a make g_str_buf a static buffer of size 1K (#3321) 2020-01-04 17:53:37 +01:00
Alexander Medvednikov
7bc5cfc53a fix windows test 2020-01-04 00:24:30 +01:00
Alexander Medvednikov
3344111a03 minor fixes and cleaning up 2020-01-04 00:06:06 +01:00
Delyan Angelov
aeda48d94e vpm: add support for other VCS for modules, like hg
Add ability to pass flags to vpm.

Implement -help , -verbose and -server-url ,
to enable easier diagnostics and testing with a local server.
2020-01-03 22:07:58 +01:00
Delyan Angelov
ddd83c2108 pg: add db.exec_param_many() 2020-01-03 22:07:28 +01:00
Delyan Angelov
67f397f888 os: implement os.cachedir() . Use it inside os.tmpdir() too 2020-01-03 19:46:23 +01:00
joe-conigliaro
43895269ff compiler: implement direct cast for sum type 2020-01-03 14:42:48 +01:00
Alexander Medvednikov
520ec0f53a fix cgen_test 2020-01-03 11:41:39 +01:00
Alexander Medvednikov
7c47f345be mingw on macos 2020-01-03 11:38:30 +01:00
joe-conigliaro
343ded18fd parser: dot fix 2020-01-03 11:36:17 +01:00
Nicolas Sauzede
60eec9fd4d fix Windows/msys2 build by replicating flags from make.bat 2020-01-03 08:53:41 +01:00
Alexander Medvednikov
492dfebd15 SelectorExpr; receivers; struct field check; if expression 2020-01-02 20:09:23 +01:00
sh0f
3c65af8b9a cli: fix warning 2020-01-02 18:09:24 +01:00
Charles WANG
7a031d5e23 update and rename ui_win.v to ui_windows.v 2020-01-02 18:09:09 +01:00
Charles WANG
166dc28480 update ui_linux.v: module ui to uiold 2020-01-02 18:08:54 +01:00
Alexey
3a9a13fc28 docs: replace 'Github' with 'GitHub' 2020-01-02 18:08:34 +01:00
Alexander Medvednikov
a6a9958cfc register fn args; remove dup code 2020-01-02 08:37:41 +01:00
Alexander Medvednikov
460b35137a handle unknown fns; fn.v; type fixes 2020-01-02 08:30:15 +01:00
Alexander Medvednikov
c949e9e636 Revert "ci: bring back x64 test"
This reverts commit 0bd84e8060.
2020-01-01 23:20:46 +01:00
Alexander Medvednikov
e7e07be38c handle unknown functions; fix var types 2020-01-01 23:15:20 +01:00
Alexander Medvednikov
0bd84e8060 ci: bring back x64 test 2020-01-01 22:44:37 +01:00
Alexander Medvednikov
b1d6021875 x64 fixes 2020-01-01 22:34:46 +01:00
Alexander Medvednikov
807c16dd1b uiold fixes 2020-01-01 13:27:21 +01:00
Alexander Medvednikov
e8bbb00bde ui is in a separate repo for now, rename it to avoid conflicts 2020-01-01 13:14:01 +01:00
Alexander Medvednikov
e53bb6a9d4 parser: wrong else 2020-01-01 13:12:38 +01:00
Alexander Medvednikov
327314c2c3 parser: unknown function error 2020-01-01 13:08:05 +01:00
sh0f
f87177d34d base64: fix warnings 2020-01-01 12:58:32 +01:00
Alexander Medvednikov
b7663848ef os: fix create() 2020-01-01 12:57:27 +01:00
Alexander Medvednikov
47908c22df cgen_test: skip empty lines; os: make vc_gen compile 2020-01-01 12:50:25 +01:00
Alexander Medvednikov
78c706ab71 Revert "enable macos syscalls"
This reverts commit d226fa7b17.
2020-01-01 12:24:50 +01:00
Alexander Medvednikov
d226fa7b17 enable macos syscalls 2020-01-01 12:10:39 +01:00
Alexander Medvednikov
2f8969c604 time: Windows fix 2020-01-01 12:01:03 +01:00
Alexander Medvednikov
79b4a757c4 fix cgen_test.v 2020-01-01 10:32:22 +01:00
Alexander Medvednikov
4794598d06 if x := opt() {} else {} 2020-01-01 10:31:50 +01:00
Alexander Medvednikov
96d02849aa parser: parse_file(path) 2020-01-01 10:15:05 +01:00
Alexander Medvednikov
87cff0386c time: gmt offset; macos syscalls 2020-01-01 10:09:19 +01:00
sh0f
3c17851200 time: add test for #3291 2020-01-01 08:00:23 +01:00
sh0f
a99f214a0f time: fix error: array index out of range 2020-01-01 07:27:48 +01:00
C. Bess
abe4898b4a Update README.md 2020-01-01 07:03:39 +01:00
Alexander Medvednikov
51222bad99 Update CHANGELOG.md 2019-12-31 20:56:04 +01:00
Alexander Medvednikov
25f77462e1 Update CHANGELOG.md 2019-12-31 20:54:31 +01:00
Alexander Medvednikov
c75cb86203 0.1.24 2019-12-31 20:49:11 +01:00
Alexander Medvednikov
4d31d5882d x64, v2 backends 2019-12-31 19:42:16 +01:00
Delyan Angelov
222f2f08f6 vfmt: fix formatting of 'import mod as alias' 2019-12-31 19:26:44 +01:00
lutherwenxu
286a0a1371 time: rewrite unix() function 2019-12-31 17:11:47 +01:00
Alexander Medvednikov
67912c692b ci: disable 2 jobs for now 2019-12-31 16:06:01 +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
4424f83470 os: disable write_bytes_at() and read_bytes_at() for now 2019-12-31 11:43:10 +00:00
Alexander Medvednikov
f9cc419dba os: syscalls 2019-12-31 10:16:34 +00:00
joe-conigliaro
80da2341aa v: fix unary +,- & rename token.TokenKind to token.Kind 2019-12-31 10:53:30 +01:00
Delyan Angelov
3a2491e97f vfmt: ensure that by default stdout is used only for the formatted source
and all errors go to stderr
2019-12-31 06:02:49 +01:00
Alexander Medvednikov
3a7f1db947 fix parser tests 2019-12-30 17:05:32 +01:00
Alexander Medvednikov
093a025ebf parse_files(); ast.File 2019-12-30 16:55:59 +01:00
Delyan Angelov
d2f2ac523f flag: fix displaying of both abbreviated and long options
Add tests for the usage screen
2019-12-30 16:38:32 +01:00
joe-conigliaro
d07953b0f0 v: fix postfix unary ++ -- operators & some cleanup 2019-12-30 15:06:56 +01:00
Charles WANG
26ee09c9bb examples: hanoi.v 2019-12-30 11:25:07 +01:00
Charles WANG
ca62b66665 sqlite: a minor fix 2019-12-30 10:49:36 +01:00
Delyan Angelov
25beb7b3f4 in errors, print array_ instead of [] in function names 2019-12-30 10:48:08 +01:00
Alexander Medvednikov
cba6a6fdea as casting 2019-12-30 10:47:34 +01:00
Alexander Medvednikov
2d597d7804 array initialization 2019-12-30 10:37:09 +01:00
Alexander Medvednikov
1d9916f93e fix fn main generation 2019-12-30 09:29:07 +01:00
Alexander Medvednikov
f725aa2e8d rename cgen module to gen; jsgen 2019-12-30 09:21:48 +01:00
Alexander Medvednikov
edf8a2cd08 fix bool expressions 2019-12-30 08:17:58 +01:00
Alexander Medvednikov
806691c1db for loop; struct decl; struct init; < > <= >= 2019-12-30 08:05:20 +01:00
ka-weihe
8a4bce667c B-tree map 2019-12-30 06:57:56 +01:00
Alexander Medvednikov
2d2e0307b8 fn call; if expression; bool literals; 100k line program gen
fix

yay

lovely
2019-12-30 05:57:36 +01:00
Abdullah Atta
63b70ddb06 move http module to net.http 2019-12-30 05:42:23 +01:00
mY9Yd2
6cee50afda os: fix tmpdir on unix 2019-12-30 05:25:26 +01:00
Ulises Jeremias Cornejo Fandos
89d3075f88 math: update complex operators for multiplication and division 2019-12-30 05:24:30 +01:00
Delyan Angelov
a0f32f5c29 tests: improved test output formatting 2019-12-30 05:23:54 +01:00
Abdullah Atta
4f173c8900 vpm: implement & improve install, search, update, remove 2019-12-30 05:22:28 +01:00
Johan Hillerström
2d5f5a0c25 remove debug printing of sum types 2019-12-30 05:21:46 +01:00
radare
49430a5c31 flag help message is now a bit more compact 2019-12-30 05:21:22 +01:00
Delyan Angelov
482f4c1b6c ci: add a new periodic.yml file to test the networking modules 2019-12-29 11:33:33 +01:00
Alexander Medvednikov
349576b5cd fn call + fn args 2019-12-29 08:47:41 +01:00
Alexander Medvednikov
c915c58d12 local vars + Parser.errror() 2019-12-29 07:14:29 +01:00
Alexander Medvednikov
c81fbee4ab fix parser_test.v 2019-12-29 06:49:52 +01:00
Alexander Medvednikov
5a6428f1ff AssignStmt 2019-12-29 06:37:08 +01:00
Alexander Medvednikov
b5fe40624c staments + a sum type fix 2019-12-28 18:53:08 +01:00
Delyan Angelov
68e1d8e8eb net.ftp: make ftp's tests just compile (not run) on CI 2019-12-28 13:55:53 +01:00
Alexander Medvednikov
48585e54df fix parser_text.v 2019-12-28 13:51:36 +01:00
Alexander Medvednikov
59c784ae57 fix cgen_test.v 2019-12-28 12:06:53 +01:00
Alexander Medvednikov
651c7e8de1 cgen tests 2019-12-28 11:55:14 +01:00
Alexander Medvednikov
379c79025b run vfmt on v/ 2019-12-28 10:38:29 +01:00
Alexey
e02d6a3b04 ftp: flatten tests 2019-12-28 09:41:54 +01:00
Delyan Angelov
72acbad3f0 v help: document -verbose flag 2019-12-28 09:41:21 +01:00
Alexander Medvednikov
ec6a8cc9fd move ftp to net/ftp 2019-12-28 09:16:27 +01:00
joe-conigliaro
a986321b6d v: update parser / token & split parsing into methods 2019-12-28 09:15:32 +01:00
Alexey
f40f023487 ftp: cosmetic fixes
Use single quotes for strings.
Use string interpolation instead of concatenation.
Don't print messages in non-debug mode.
Fix typos in error messages.
Add space after comma, add spaces between operators.
extract code to separate functions
2019-12-28 08:53:28 +01:00
Nicolas Sauzede
c09ce9cb42 fix version check to prevent useless rebuilds 2019-12-28 08:51:08 +01:00
Nicolas Sauzede
4925aa594b os: fix deprecated os.dir to work as advertised 2019-12-28 08:49:27 +01:00
joe-conigliaro
a214778b74 fix bug with sum type 2019-12-28 08:48:55 +01:00
Delyan Angelov
0bdf9bbf4f Go back to github actions/checkout@v1 for most of the CI. (#3237) 2019-12-27 20:29:38 +01:00
Alexander Medvednikov
e71b99c528 ci: run on macos latest only 2019-12-27 19:17:09 +01:00
Don Alfons Nisnoni
06fba73ab9 os: add os.symlink() function 2019-12-27 19:10:06 +01:00
sha0coder
7518d2d0dc FTP module 2019-12-27 19:08:44 +01:00
vitalyster
2f23ee4818 windows: cleanup after bootstrapping with unicode entrypoint 2019-12-27 19:07:31 +01:00
Alexander Medvednikov
796c376408 fix parser_test.v 2019-12-27 18:55:51 +01:00
Alexander Medvednikov
66a07d7fe0 FnDecl, Return, statement block 2019-12-27 18:39:19 +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
84fbd5b3d0 ci: add cross-compile job with llvm-mingw (#3233) 2019-12-27 17:57:49 +01:00
vitalyster
c9be519990 git: ignore .vscode/ project directory 2019-12-27 12:18:27 +03:00
Alexander Medvednikov
4da21d80e3 fix () warning 2019-12-27 10:16:00 +01:00
Alexander Medvednikov
fc5f4ff326 make types.check public 2019-12-27 10:12:40 +01:00
Alexander Medvednikov
d27c5eb345 handle floats 2019-12-27 10:09:06 +01:00
Alexander Medvednikov
1af274a714 test_parser + minor fixes 2019-12-27 10:00:44 +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
Alexander Medvednikov
55dbb8b81c v.types module 2019-12-27 09:09:55 +01:00
Unknown User
69e9b0f250 update alpine to 3.11 2019-12-27 10:31:15 +03:00
Alexander Medvednikov
14e9c3c7bb rename compiler2.parser to v.parser etc 2019-12-27 06:09:16 +01:00
BigBlack
98b81252b7 fix #3217 (string.replace) 2019-12-27 07:20:06 +03:00
Alexander Medvednikov
e20ca28d5c fix v prod build 2019-12-27 07:04:41 +03:00
Alexander Medvednikov
0a3adb5de8 ast: return types, variable declaration 2019-12-27 07:01:22 +03:00
BigBlack
320174bd5b fix #3202 2019-12-27 06:09:09 +03:00
Ulises Jeremias Cornejo Fandos
1277ce22f8 math: factorial submodule 2019-12-27 06:08:17 +03:00
Alexey
a5b43e1f4d strconv: fix tests 2019-12-27 06:07:09 +03:00
Alexander Medvednikov
6363118aa9 remove ScalarExpr 2019-12-26 13:21:41 +03:00
Alexander Medvednikov
9b37fc7310 clean up parser_test.v 2019-12-26 13:05:06 +03:00
Alexander Medvednikov
d9835c1ecf move atofq.v to a separate module 2019-12-26 11:56:21 +03:00
Alexander Medvednikov
8d9f89e728 compiler2: proof of concept cgen 2019-12-26 07:47:33 +03:00
joe-conigliaro
fe8a6abb41 compiler2: update operator precedence and associativity (#3218) 2019-12-26 05:40:18 +03:00
Delyan Angelov
c1f4fc3f0f make: fix building on termux 2019-12-25 16:14:08 +03:00
Delyan Angelov
ae4c8af674 fmt: fixes for option syntax formatting 2019-12-25 16:08:52 +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
ccb041c831 arrays: improve range function 2019-12-25 15:52:27 +03:00
Alexey
f2bab4ab9a atoi: add tests 2019-12-25 15:42:00 +03:00
joe-conigliaro
de1be1dc66 compiler2: start implementing pratt style parser 2019-12-25 15:39:58 +03:00
Alexander Medvednikov
ca284482cb new AST built with sum types 2019-12-24 16:04:49 +03:00
Alexander Medvednikov
803ded3dec sum type type Foo = Bar | Baz 2019-12-24 16:04:49 +03:00
Alexey
9dd05474b0 vup: change dir correctly 2019-12-24 05:44:22 +03:00
Delyan Angelov
96fa15c125 v fmt: process .v files from a module too 2019-12-24 05:43:31 +03:00
Alexey
411a83e283 vfmt: use filepath instead of os 2019-12-23 13:38:46 +03:00
Don Alfons Nisnoni
4498dc6a47 tools/fast: remove unused function 2019-12-23 13:37:52 +03:00
yatsen1
137a473bb7 add time.parse_iso 2019-12-23 13:36:51 +03:00
yatsen1
d03f0ec294 fix time.parse() 2019-12-23 13:25:44 +03:00
Charles WANG
b1013697d1 vlib/vweb.v: add public const and functions 2019-12-23 13:24:53 +03:00
Delyan Angelov
cf37028a52 test: use 'stty size' for vtest --- line instead of 'tput cols' 2019-12-23 13:23:53 +03:00
kdmult
6c4ef368d7 ix 'v up' on windows 2019-12-23 13:22:06 +03:00
Alexey
dced76d1a4 os, filepath: reorganize functions 2019-12-23 13:09:22 +03:00
Delyan Angelov
6e130cd446 compiler: support for custom flags
[if custom]fn..{} , #flag custom, $if custom {}
2019-12-23 13:09:00 +03:00
Delyan Angelov
42b1660c7e move vfmt frontend program to tools/vfmt.v 2019-12-23 13:02:50 +03:00
Alexander Medvednikov
28594a65a8 fix enum bitfield 2019-12-23 07:05:52 +03:00
Alexander Medvednikov
7ab993c218 sum types 2019-12-23 06:14:31 +03:00
Alexey
d2c3c66ba4 make.bat: remove obj file after compilation (msvc) 2019-12-22 22:59:51 +03:00
Alexey
dacc129fd8 time: improve tests 2019-12-22 22:58:41 +03:00
Alexander Medvednikov
a251db068f run vfmt on math and sha; add vfmt check to test-compiler 2019-12-22 02:50:20 +03:00
Delyan Angelov
9198285688 add .editorconfig file at the top level of the project 2019-12-22 02:05:55 +03:00
Alexey
b88cb1ca69 extend tests for strings module 2019-12-22 02:05:30 +03:00
Alexander Medvednikov
848cd3cb3e run vfmt on http, net, sync, strconv 2019-12-22 01:57:50 +03:00
れもん
28ecfb231d compiler: map[string]pointer, ?pointer, fix []pointer 2019-12-22 01:44:16 +03:00
Alexander Medvednikov
b76227b781 small vfmt fixes 2019-12-22 01:39:04 +03:00
Alexander Medvednikov
749d3ec14d do not define __offsetof twice 2019-12-22 01:39:04 +03:00
penguindark
5cfbc7bab5 float: bug fix on +zero 2019-12-22 01:38:02 +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
Alexey
4fc8842edb .gitignore: ignore DLL and lib files 2019-12-22 00:46:32 +03:00
Emily Hudson
8512c9fc9d compiler: __offsetof keyword for C offsetof() macro 2019-12-22 00:46:09 +03:00
Alexander Medvednikov
31b7991a93 negative enum vals + [10]C.Foo fix 2019-12-22 00:17:13 +03:00
Delyan Angelov
faca61c50a makefile: run make with -j4 on unix CIs 2019-12-22 00:09:33 +03:00
Charles WANG
24739c9f5a sqlite: add Ubuntu instructions 2019-12-21 10:00:28 +03:00
joe-conigliaro
4dc4f12ccd hashmap: use fnv32 as hash algo 2019-12-21 09:59:12 +03:00
joe-conigliaro
6763a92834 fix multiple type parameters 2019-12-21 09:54:43 +03:00
joe-conigliaro
f7c1b78ec2 clean up generic structs 2019-12-21 05:33:59 +03:00
Alexander Medvednikov
ecd46d381c fix vc generator 2019-12-21 05:25:28 +03:00
Alexander Medvednikov
61bfecfa09 vweb: minor fixes 2019-12-21 05:19:26 +03:00
joe-conigliaro
fbd9fedbfb implement generic structs 2019-12-21 03:53:57 +03:00
Changsen XU 徐昶森
b3a402eb82 add mysql -I flag for ubuntu 18.04 (#3153) 2019-12-20 23:18:23 +03:00
Acid147
d5fdbe9e5d update vtest to print separator with dynamic width 2019-12-20 23:17:48 +03:00
Don Alfons Nisnoni
090f444d8f scanner: small DRY 2019-12-20 23:15:16 +03:00
Steve Phillips
6e9493887d builtin/array.v: Fixed typo in new_array (cap -> cap_) 2019-12-20 23:09:59 +03:00
Delyan Angelov
39899b07d9 tools: update tools/performance_compare.v to have more knowledge about v (#3157)
* update tools/performance_compare.v to have more knowledge about v.

* Cleanup indentation.
2019-12-20 23:09:05 +03:00
Delyan Angelov
b62e28dba5 compiler: fix interface generation for unused interfaces 2019-12-20 23:06:11 +03:00
Alexander Medvednikov
00b8a5d3e4 vfmt: enum fix 2019-12-20 02:38:11 +03:00
Alexander Medvednikov
6af54d0207 fix windows build 2019-12-20 02:20:03 +03:00
Alexander Medvednikov
6210984c97 run vfmt 2019-12-20 02:09:56 +03:00
Alexander Medvednikov
b6fe2ebc0b fix tools test 2019-12-20 00:20:22 +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
ce86626ec2 run vfmt on table.v 2019-12-19 23:26:23 +03:00
Alexander Medvednikov
1679457f6b clean up math_test.v 2019-12-19 22:16:10 +03:00
BigBlack
a38a0f4fb7 parser: fix x.function_pointer() 2019-12-19 21:23:29 +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
519f2990f2 vfmt: minor fixes 2019-12-19 10:02:47 +03:00
BigBlack
aa0ad9d922 fix vweb example 2019-12-19 03:38:39 +03:00
penguindark
929e7c1193 strconv: atof_quick for tasks that need speed but not big accuracy 2019-12-19 03:37:53 +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
Delyan Angelov
9e11de4a8c freebsd: fix BSDmakefile 2019-12-18 14:13:43 +03:00
Charles WANG
0ebe86fbd5 sqlite: readme 2019-12-18 13:22:22 +03:00
BigBlack
2f218b878b fix fn type call 2019-12-18 13:21:49 +03:00
Delyan Angelov
4b7aa4ec09 freebsd: fix compilation 2019-12-18 13:21:20 +03:00
Alexander Medvednikov
67bdc2c7a9 vfmt: fn args fixes 2019-12-18 11:11:47 +03:00
Alexander Medvednikov
569b32bd1e run vfmt on fn.v 2019-12-18 10:07:30 +03:00
Alexander Medvednikov
81045023c4 run vfmt on scanner.v 2019-12-18 08:26:51 +03:00
Abdullah Atta
20e73ff69a os: fix nreadelements naming 2019-12-18 08:22:52 +03:00
Abdullah Atta
489ec05b23 eventbus: remove hacks, add sender 2019-12-18 08:16:33 +03:00
Alexander Medvednikov
02939d776b vfmt: fix in, |, or {} 2019-12-18 08:01:29 +03:00
Alexander Medvednikov
3d1db3519d test enum printing 2019-12-18 05:45:48 +03:00
Alexander Medvednikov
7456d556e1 fix 2 repl tests 2019-12-18 05:02:23 +03:00
Alexander Medvednikov
a46a2e4715 run vfmt on parser.v 2019-12-18 04:43:41 +03:00
Alexander Medvednikov
ad211a86a6 vfmt: re-write V files + fix {} 2019-12-18 04:33:02 +03:00
Alexander Medvednikov
53b334145b lots of vfmt fixes 2019-12-18 04:15:41 +03:00
BigBlack
67cf7f18e6 array of pointers support 2019-12-18 03:26:04 +03:00
prime31
f00f9fbf5a os: fix bug where read_bytes would return only the first byte 2019-12-18 00:16:56 +03:00
BigBlack
e68200538a parser: call struct field fns 2019-12-17 22:00:08 +03:00
Don Alfons Nisnoni
09be75f6ae readme: make github links consistent 2019-12-17 21:57:37 +03:00
Delyan Angelov
d405cfbcf7 gg: remove spurious printing of gl.TEXT_VERT 2019-12-17 19:17:48 +03:00
Delyan Angelov
ba519f105a compiler: option/command parsing bugfix 2019-12-17 16:00:10 +03:00
Alexander Medvednikov
37add98043 fix programs without fn main 2019-12-17 05:05:10 +03:00
Alexander Medvednikov
84f535d242 atof: remove extra() causing warnings 2019-12-17 01:47:30 +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
Johan Hillerström
6008fa44c6 parser: fix generic function call in for in expression 2019-12-17 01:08:30 +03:00
penguindark
3dbf7a4039 atof implementation in V 2019-12-17 01:07:13 +03:00
Alexander Medvednikov
5a56ca0892 parser: handle operator overloading type errors 2019-12-17 00:50:41 +03:00
Alexander Medvednikov
560d1383d1 fix optional struct field assignment 2019-12-17 00:36:28 +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
Alexander Medvednikov
10718557a2 increase the name limit to 15 2019-12-16 19:36:29 +03:00
Alexander Medvednikov
bcde155da7 test the recent type alias string; print vweb templates in verbose mode 2019-12-16 19:34:04 +03:00
BigBlack
8c0e0f8ab7 parser: fix type alias type check 2019-12-16 19:06:40 +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
lutherwenxu
dadf147382 flag: implement *_opt() and *_multi()
It's very often that someone will need to process values that were not
provided separately (eg. generating a complex default value like in V).

This commit allows the user to call the *_opt() functions instead of
forcing them to provide some magical default values.

* flag: Implement int_multi(), float_multi() and string_multi()

These 3 functions are useful when the application expects a flag to be
repeated more than once.

A sample would be:
v -cflags someflag -cflags secondflag

This feature exposes the raw array that the flag parser internally keeps
and allow the application to parse it however they want instead of
dropping everything except the first element.

* flag: Add documentation

Add comments describing what *_opt() and *_multi() do.
2019-12-16 19:03:38 +03:00
vitalyster
d1714c4a2a cc.v: build thirdparty objfiles with msvc when no cc installed 2019-12-16 18:56:37 +03:00
Delyan Angelov
7e0a9fb83a compiler: fix regression for -d option flag 2019-12-16 18:55:10 +03:00
João Victor Oliveira Couto
b30f989f44 builder_js: fix mutable error 2019-12-16 18:54:44 +03:00
Delyan Angelov
8271d239b2 fix regression of 'v build module file.v' 2019-12-16 18:54:10 +03:00
Kaito Sugimoto
9dd86a2de6 math: fix abs (-0.0) 2019-12-15 19:37:17 +03:00
Delyan Angelov
faa04c586f compiler: restore ability to pass -prod option to run and runrepl. (#3095) 2019-12-15 21:21:37 +11:00
joe-conigliaro
f2c40bf49d compiler: fix for -Wl -Wa -Wp dont like spaces (#3091) 2019-12-15 16:24:12 +11:00
joe-conigliaro
717740cfcf simplify cflag parsing 2019-12-15 06:18:14 +03:00
joe-conigliaro
be60193588 workaround for -g with default optional value 2019-12-15 06:11:02 +03:00
Alexander Medvednikov
54b0097cee fix repl_test.v 2019-12-15 05:51:00 +03:00
Alexander Medvednikov
68357876ca fix v_command() 2019-12-15 05:44:34 +03:00
Alexander Medvednikov
12ebed0589 error on an incorrect V command 2019-12-15 05:35:17 +03:00
Alexander Medvednikov
5971aa7fef tutorials: article json 2019-12-15 01:00:04 +03:00
Alexander Medvednikov
48ea136a9a tutorials: vweb: add an article 2019-12-15 00:56:08 +03:00
BigBlack
fc33f9d49c type alias check 2019-12-14 22:01:20 +03:00
Alexander Medvednikov
2e23592264 for: check for redefinitions 2019-12-14 20:00:03 +03:00
Alexander Medvednikov
be2b5698c5 tutorial: update image links 2019-12-14 19:26:22 +03:00
Alexander Medvednikov
45695543ba tutorial: minor fixes 2019-12-14 18:59:02 +03:00
Alexander Medvednikov
94de493b37 tutorial: minor fixes + move code and images to a separate dir 2019-12-14 18:50:32 +03:00
Delyan Angelov
1cd5fab21d testing: support for internal module testing 2019-12-14 15:57:28 +03:00
Alexander Medvednikov
3a2c46a1ce tutorial: use the master branch 2019-12-14 15:50:40 +03:00
Alexander Medvednikov
d49927937b tutorial: fix images 2019-12-14 15:48:13 +03:00
joe-conigliaro
cb9e9286ef compiler: fixes issue #3074 - can't call a generic function twice with the same data type 2019-12-14 17:54:34 +11:00
Alexander Medvednikov
29fc3fc82f vweb tutorial: add a link to Vorum 2019-12-14 08:24:14 +03:00
Alexander Medvednikov
a81c6f44c5 tutorial: add a title 2019-12-14 07:39:51 +03:00
Alexander Medvednikov
7cec5f853c tutorial: minor fixes 2019-12-14 07:36:18 +03:00
Alexander Medvednikov
e99547cd7f vweb tutorial 2019-12-14 07:29:12 +03:00
prime31
75c01dec30 cleanup SDL event system 2019-12-14 03:31:07 +03:00
Alexander Medvednikov
8581c11900 update malloc 2019-12-14 02:46:55 +03:00
Alexander Medvednikov
962109e855 parser: verify async functions 2019-12-14 02:33:19 +03:00
Alexander Medvednikov
ef562413cd -prealloc 2019-12-14 02:28:15 +03:00
Alexander Medvednikov
88cde6e4e6 orm: skip fields 2019-12-14 02:07:06 +03:00
Alexander Medvednikov
797d4364e7 vweb: fix reading request's body/headers 2019-12-13 23:46:11 +03:00
Alexander Medvednikov
fb3da327d6 vweb: fix a cookie bug 2019-12-13 21:11:40 +03:00
Alexander Medvednikov
83b8d642b4 fix csv/writer.v 2019-12-13 20:45:48 +03:00
Alexander Medvednikov
c72bf0e1b1 global access modifier 2019-12-13 20:28:28 +03:00
Alexander Medvednikov
dc83e30a44 access modifiers: update tests/examples 2019-12-13 20:09:11 +03:00
Alexander Medvednikov
78131e78bc fix sruct access modifiers (pub, pub mut, mut) 2019-12-13 20:00:38 +03:00
Delyan Angelov
fc64238a39 testing: allow tests to import the same module with no custom options 2019-12-13 19:28:39 +03:00
Robert Cristof
ec36755407 mysql: add mysql.escape_string() 2019-12-13 19:12:42 +03:00
vitalyster
056454dff5 Fix CI 2019-12-13 18:41:35 +03:00
Alexander Medvednikov
569a64068a ui/examples: users: fix button click 2019-12-12 23:42:51 +03:00
Alexander Medvednikov
cddfbf7395 parser: allow public types pub type Foo Bar 2019-12-12 22:57:47 +03:00
Alexander Medvednikov
b8f728590b string: last_index ?int 2019-12-12 21:54:48 +03:00
penguindark
8e1c27d129 utf8: punctuation 2019-12-12 21:08:44 +03:00
Alexander Medvednikov
0eeb607ffd fix fopen definition 2019-12-12 21:03:08 +03:00
Alexander Medvednikov
bd833deef3 assoc: verify the field exists and verify the type 2019-12-12 20:38:49 +03:00
Alexander Medvednikov
6982f4a5a2 parser: force {} blocks on new lines 2019-12-12 20:27:05 +03:00
Alexander Medvednikov
02c29624d8 freetype: minor fixes 2019-12-12 14:44:29 +03:00
Bryan Christopher Johnson
f86ddcf496 examples/tetris: use standard colors 2019-12-12 14:36:01 +03:00
Alexander Medvednikov
8ba29f968a cc.v: hide "mingw" not found message 2019-12-12 14:27:47 +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
e182274fe7 free memory block 2019-12-11 23:58:51 +03:00
Alexander Medvednikov
ad250523cd fix parser.fileis() 2019-12-11 21:42:22 +03:00
Alexander Medvednikov
6ffed854cc cgen.prepend_to_statement() 2019-12-11 20:51:58 +03:00
Alexander Medvednikov
47f9c02331 Revert "cgen.prepend_to_statement()"
This reverts commit 507c71ad80.
2019-12-11 20:37:39 +03:00
Alexander Medvednikov
507c71ad80 cgen.prepend_to_statement() 2019-12-11 19:33:54 +03:00
taojy123
28f76f10db vweb: fix empty post request blocking 2019-12-11 19:20:46 +03:00
Alexander Medvednikov
7dcd47369b option to pre-allocate a memory block 2019-12-11 18:41:25 +03:00
Delyan Angelov
13769f440f vweb: continue after bad http client connection; performance fixes
* Enable compiling vweb with -prod (by supressing 'declared and not used' warning about 'reset') .

* Fix http responses (now wrk is happy and shows no errors) by adding a Content-Length header.

* Fix -g compilation for urllib.v .

* vweb: println action= only in debug mode.

* vweb: max request headers counting fix.

* Make vweb.html get a 'ctx mut Context' param, just like the other methods.

* vweb: simplify add_header.

* Use a string builder for the most common html case so that the response http text can be send in one go.

* vweb: reduce _STR/string interpolation usage in the most common html response case.

* vweb: refactor common http response formatting into Context.send_response_to_client/2 method.
2019-12-11 17:32:54 +03:00
Alexander Medvednikov
cfeec92826 use -Wunused-function for now 2019-12-11 15:51:12 +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
joe-conigliaro
4e69c40e12 parser: fix use blank ident as value 2019-12-10 21:35:59 +03:00
Alexander Medvednikov
9726e18c0a string: optimize replace() 2019-12-10 18:50:21 +03:00
joe-conigliaro
6d5e9f88f8 parser: allow enums to be used as bitfield flags 2019-12-10 06:16:47 +03:00
Alexander Medvednikov
0650d58818 vweb: readme: list some features of vweb 2019-12-10 00:16:39 +03:00
Alexander Medvednikov
cd54b2878e fix pg orm example 2019-12-10 00:06:37 +03:00
Alexander Medvednikov
51051cdf92 vweb: enable @ logic in the header + fix the example 2019-12-09 23:34:38 +03:00
Alexander Medvednikov
6f49d4c1d2 orm: bool support; vweb fixes 2019-12-09 23:20:29 +03:00
Delyan Angelov
32b0225079 remove os/time references from live programs, fix warnings 2019-12-09 18:53:17 +03:00
Alexander Medvednikov
8082a5e7f4 fix benchmarking stats 2019-12-09 17:25:56 +03:00
Alexander Medvednikov
75280bb54c fix int.str() memory bug 2019-12-09 16:41:13 +03:00
Delyan Angelov
f68d9d1a16 live: always add os and time when compiling -live programs
Fixes fail when -live user programs do not use os and time.
2019-12-09 13:48:41 +03:00
sha0coder
7ffa315566 vlib/http: ssl handshake fix 2019-12-09 13:31:24 +03:00
Delyan Angelov
ed5c9a20e5 update brew instructions for sdl dependencies 2019-12-09 03:18:08 +03:00
Alexander Medvednikov
b2207c3d28 do not prepend module to external fn name 2019-12-09 00:24:50 +03:00
Alexander Medvednikov
4ebf53c6e9 allow non snake_case fn names in imported fns 2019-12-08 23:56:31 +03:00
prime31
faedebbb4e sdl: separate sdl module into multiple, dependent submodules 2019-12-08 23:30:38 +03:00
penguindark
9730164613 atoi: fix leading zeros in string to int conversion 2019-12-08 23:22:33 +03:00
Alexander Medvednikov
8f9b6ac248 '$foo()' string interpolation 2019-12-08 23:18:11 +03:00
Alexander Medvednikov
ef821379da v build-binaries: build v -g v.v and v -g -prod v.v 2019-12-08 21:16:06 +03:00
Alexander Medvednikov
874ff42687 temporary fix of "v -g v.v" 2019-12-08 20:58:16 +03:00
Alexander Medvednikov
e31bf63626 ci: test v -g v.v 2019-12-08 20:45:30 +03:00
Delyan Angelov
1bb38a38bb tooling: add tools/oldv , for use with 'git bisect', or for testing with older V 2019-12-08 20:21:17 +03:00
Alexander Medvednikov
4d1f721558 fix "" string interpolation bug 2019-12-08 20:06:00 +03:00
Alexander Medvednikov
d58982a6f6 vweb: fix tests 2019-12-08 18:07:04 +03:00
Alexander Medvednikov
1c6f7180b2 vweb: fix form parsing 2019-12-08 17:37:23 +03:00
Alexander Medvednikov
02eee49d25 fix defer_test 2019-12-08 15:30:14 +03:00
Alexander Medvednikov
c9886e6f42 use ++ everywhere 2019-12-08 14:34:51 +03:00
Alexander Medvednikov
cc682eafe1 require ++ instead of += 1 2019-12-08 14:11:25 +03:00
Nicolas Sauzede
8bc94947e5 tvintris: fix else cases 2019-12-08 13:45:29 +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
Alexander Medvednikov
6ec626c5e9 improve invalid character errorrs 2019-12-08 12:57:40 +03:00
Alexander Medvednikov
8b0de95c0a improve the C struct check 2019-12-08 04:23:22 +03:00
Alexander Medvednikov
6ae51b2cbf handle unknown C types 2019-12-08 04:10:56 +03:00
Alexander Medvednikov
7adda3b71a vweb: fix get_cookie() 2019-12-08 01:48:49 +03:00
Alexander Medvednikov
5330859034 2 more unneeded casts removed 2019-12-08 01:39:27 +03:00
Alexander Medvednikov
b1174428a5 vweb: fix redirect() 2019-12-08 01:05:57 +03:00
Alexander Medvednikov
30fc29fa6d fix csv test 2019-12-08 01:03:35 +03:00
Alexander Medvednikov
7069cd6ab5 a separate scope for x := opt, part 2 2019-12-08 00:45:42 +03:00
Alexander Medvednikov
b26a0bde38 a separate scope for x := opt, part 1 2019-12-08 00:34:04 +03:00
Alexander Medvednikov
06a0f39f7b a separate scope for 2019-12-08 00:30:06 +03:00
Alexander Medvednikov
dc2da1de98 fix V build 2019-12-08 00:27:24 +03:00
Alexander Medvednikov
8ebc2fe601 do not allow redefinition in x := opt() { 2019-12-07 23:09:48 +03:00
Alexander Medvednikov
b79588dc69 handle bad value in if x := opt() { 2019-12-07 23:05:54 +03:00
Alexander Medvednikov
49f960aea5 fix some windows cast warnings 2019-12-07 22:42:20 +03:00
Alexander Medvednikov
c019dd6f98 test assert in functions that return values 2019-12-07 22:42:20 +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
d73586743b fix assert in functions that return values 2019-12-07 19:33:59 +03:00
Alexander Medvednikov
b9a24e3b51 Revert "use stdint.h with msvc"
This reverts commit 93529031de.
2019-12-07 19:25:17 +03:00
Alexander Medvednikov
93529031de use stdint.h with msvc 2019-12-07 19:20:53 +03:00
Alexander Medvednikov
7d58dc2350 fix examples/v_script.vsh and add it to CI 2019-12-07 18:27:09 +03:00
Alexander Medvednikov
63ec3c0486 fix a wrong "0 character in a string literal" error 2019-12-07 18:19:48 +03:00
Alexander Medvednikov
7b0e378947 fix clipboard_linux.v 2019-12-07 18:16:19 +03:00
Alexander Medvednikov
e1ad1794e3 fix readline_linux.v 2019-12-07 17:46:01 +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
a594e009f2 test high order function 2019-12-07 16:13:25 +03:00
Alexander Medvednikov
f51784ee01 remove unnecessary casts everywhere 2019-12-07 15:51:00 +03:00
Alexander Medvednikov
d7ccbba2c9 do not allow casting a type to itself 2019-12-07 15:31:56 +03:00
Alexander Medvednikov
a854d396ff clipboard: fix mutability on macOS and Windows 2019-12-07 15:22:28 +03:00
Alexander Medvednikov
c2814c1ada vlib: fix remaining mutability errors 2019-12-07 15:13:23 +03:00
Alexander Medvednikov
329485d4b6 vweb: fix headers and cookies 2019-12-07 15:04:05 +03:00
Alexander Medvednikov
cc834dd7a7 parser: x in [] is always false 2019-12-07 03:05:19 +03:00
João Victor Oliveira Couto
5a8c07dcf5 strings: builder: write_b() 2019-12-06 23:02:09 +03:00
Alexander Medvednikov
55f32fc413 more mutability fixes 2019-12-06 19:23:24 +03:00
Alexander Medvednikov
e3b5d7fd7c rename if_st to if_statement 2019-12-06 19:21:26 +03:00
Alexander Medvednikov
bf1b751f47 cli: update mutability 2019-12-06 19:12:01 +03:00
Alexander Medvednikov
c8d111924d check unused and unmodified vars in all modules, not just main 2019-12-06 18:43:56 +03:00
Alexander Medvednikov
bdaa421e8a update 0.2 roadmap 2019-12-06 12:46:59 +03:00
Delyan Angelov
353805e170 os: test is_link() 2019-12-06 12:09:35 +03:00
Alexander Medvednikov
b8ab85ebe9 ci: sleep 3 before creating the db 2019-12-06 02:53:31 +03:00
Alexander Medvednikov
aed22a57e3 fixed size array with const length ([N]int) 2019-12-06 02:41:03 +03:00
Alexander Medvednikov
be323e2fb6 ci: set up pg database to test ORM 2019-12-06 02:11:39 +03:00
Alexander Medvednikov
71c0c4803f ORM fixes 2019-12-06 02:00:37 +03:00
Alexander Medvednikov
79b26b1654 use get_type2 in struct.v 2019-12-05 19:02:33 +03:00
Alexander Medvednikov
cca650c655 better foo must return (int, int) error 2019-12-05 18:55:27 +03:00
Alexander Medvednikov
cb46bf314e get_type.v 2019-12-05 18:48:39 +03:00
BilligsterUser
0a38b307cd os_test: use rmdir() to del dirs 2019-12-05 17:08:55 +03:00
Delyan Angelov
98374ea6fe CI: fix msvc (temporary work around dialogs poping up) 2019-12-05 17:08:18 +03:00
Chanrles WANG
4ca453b6de make.bat improvements 2019-12-05 14:41:57 +03:00
Alexander Medvednikov
4888d27b71 fix v -live on macOS 2019-12-05 14:40:14 +03:00
Alexander Medvednikov
2a1b0a8cae rename table.register_type2() 2019-12-05 14:24:25 +03:00
Delyan Angelov
0ff2754677 tools/vbuild-examples: test hot code reloading examples with -live 2019-12-05 14:22:54 +03:00
Nicolas Sauzede
2e30e1453d sdl: fix old vsdl2 references 2019-12-05 12:58:48 +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
867f952d6b for: ranging through fixed size arrays 2019-12-05 02:17:17 +03:00
Alexander Medvednikov
fb546f376e set max module depth to 5 2019-12-05 01:27:04 +03:00
Alexander Medvednikov
e707ac4f28 test v -live message.v 2019-12-05 00:17:38 +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
Alexander Medvednikov
fb237b9e53 parser: check types in a in b expressions 2019-12-04 22:17:24 +03:00
Alexander Medvednikov
f0f62f6217 readme: 0.2 release date 2019-12-04 13:40:46 +03:00
Alexander Medvednikov
d9248e8d52 parser: fix a wrong index in an error 2019-12-04 13:36:35 +03:00
Delyan Angelov
9a6711fa1b compiler: c'str' now has type charptr 2019-12-04 13:34:06 +03:00
joe-conigliaro
d8bf0df7e9 fix regression with v compilation (#2973) 2019-12-04 21:18:31 +11:00
Alexander Medvednikov
40df0644ca fix all Foo{!} 2019-12-04 13:08:28 +03:00
Alexander Medvednikov
e32cbfcca7 error on C.Foo{!} 2019-12-04 12:56:59 +03:00
Alexander Medvednikov
b2b34e18e4 use the new &C.Foo(0) cast 2019-12-04 12:19:32 +03:00
Alexander Medvednikov
2bafd41183 &C.Foo(0) cast to replace &C.Foo{!} hack 2019-12-04 12:13:17 +03:00
bogen85
a9aaa13a09 freestanding: sys_getuid, sys_waitid; minimal fork check; remove bare.S 2019-12-04 11:46:09 +03:00
joe-conigliaro
39655a7d9b update gen_vc with -output-cross-platform-c 2019-12-04 11:42:18 +03:00
Alexander Medvednikov
47f5e1178f -output-cross-platform-c for creating a single x-platform C file 2019-12-04 02:02:52 +03:00
Alexander Medvednikov
a7054b68fd ci: install dependencies for package tests 2019-12-04 01:49:58 +03:00
Delyan Angelov
eb20dd39b1 freestanding: init consts 2019-12-04 01:40:26 +03:00
Alexander Medvednikov
590566f8c4 ci: use new release links 2019-12-03 22:13:37 +03:00
Alexander Medvednikov
c4a43633da i8, i18, u16 str() 2019-12-03 21:14:17 +03:00
Alexander Medvednikov
66f271f100 fix a string interpolation bug 2019-12-03 20:41:49 +03:00
Alexander Medvednikov
89d40566f4 ci: build examples with prebuilt V binaries 2019-12-03 17:34:48 +03:00
Alexander Medvednikov
f192429c8a $if mac => $if macos 2019-12-03 16:29:37 +03:00
Alexander Medvednikov
ff80e3a5fa i8 print test + $if mac => $if macos 2019-12-03 16:09:43 +03:00
Delyan Angelov
b907cf2179 sync/waitgroup: force sleeping for 1ms
fixes issues #2874 and #2961
2019-12-03 15:05:08 +03:00
Delyan Angelov
0a8d2d5dc7 compiler: guess cc kind for -prod builds, to know when to add -flto 2019-12-03 13:58:24 +03:00
Alexander Medvednikov
d308fef0c2 examples: fix spectral.v 2019-12-03 11:52:38 +03:00
Ulises Jeremias Cornejo Fandos
b31ec4ca9a math: add factorial function (via factorial table) 2019-12-03 11:34:26 +03:00
Enrico Lefass
6d28a80bf8 haiku support (part 2) 2019-12-03 11:26:47 +03:00
Don Alfons Nisnoni
f806e0f9e5 mysql: add error handling 2019-12-03 11:18:20 +03:00
Don Alfons Nisnoni
33793a869f mysql: make the struct public & update some code 2019-12-02 17:26:58 +03:00
Alexander Medvednikov
c0bb88dfb0 allow # in webview module 2019-12-02 12:31:49 +03:00
Alexander Medvednikov
753e926356 debug v symlink error 2019-12-02 12:16:55 +03:00
Alexander Medvednikov
c724c17a56 ci: test v symlink 2019-12-02 11:59:15 +03:00
Don Alfons Nisnoni
254afcb2d0 *C.char => charptr 2019-12-02 11:37:35 +03:00
Alexander Medvednikov
dcbb196e21 Revert "update vcreate.v"
This reverts commit 2c424c1aa6.
2019-12-01 22:57:09 +03:00
Chanrles WANG
2c424c1aa6 update vcreate.v 2019-12-01 20:43:07 +03:00
penguindark
322733d59a encoding.utf8 fixes 2019-12-01 20:41:29 +03:00
Delyan Angelov
ee1edab2a9 implement 'v build-vbinaries' tooling 2019-12-01 16:12:51 +03:00
radare
5ff387bbe4 strings: split_nth and add tests 2019-12-01 16:10:13 +03:00
Delyan Angelov
ec15bfb7d1 v test v => v test-compiler 2019-12-01 12:50:13 +03:00
bogen85
854309a7d8 freestanding: add array support (stack only for now) 2019-12-01 11:27:36 +03:00
Alexander Medvednikov
3fea8f3de5 *char => charptr everywhere 2019-12-01 10:33:26 +03:00
Alexander Medvednikov
698c3823ee charptr fix 2019-12-01 10:11:29 +03:00
Alexander Medvednikov
0999273d32 CReserved => c_reserved; charptr 2019-12-01 09:56:53 +03:00
Alexander Medvednikov
d323b48179 Update CHANGELOG.md 2019-11-30 16:57:56 +03:00
Alexander Medvednikov
a9f54de64e changelog: more 0.1.23 features 2019-11-30 16:55:31 +03:00
Alexander Medvednikov
15aeaf279d 0.1.23 changelog 2019-11-30 16:49:42 +03:00
Alexander Medvednikov
a23a4ed98a update all index() uses 2019-11-30 15:27:16 +03:00
Alexander Medvednikov
2651b8957a parser: fix unreachable code error in if a := opt() 2019-11-30 15:17:27 +03:00
Alexander Medvednikov
81d4f66fbb string: make index() return ?int instead of int/-1 2019-11-30 13:21:21 +03:00
Alexander Medvednikov
cc2bd0bb68 string: make substr private 2019-11-30 12:50:57 +03:00
Alexander Medvednikov
1a0b78ae2f fix the cli module 2019-11-30 12:44:50 +03:00
Alexander Medvednikov
7e4799334f array: make left/right/slice private 2019-11-30 12:37:34 +03:00
Alexander Medvednikov
b38283dcf1 string: make left/right private 2019-11-30 12:06:17 +03:00
ibalbaert
b92a3544f5 docs: fix interfaces example 2019-11-30 11:18:06 +03:00
prime31
ff216e7d50 append module name for module search path 2019-11-30 11:17:37 +03:00
Alexander Medvednikov
68b4dab582 parser: another infinite loop fix 2019-11-30 10:37:28 +03:00
Alexander Medvednikov
c00a7f3a5e parser: fix infnite loop with fn foo(&) {} 2019-11-30 10:21:58 +03:00
Alexander Medvednikov
d71532b64e optimize for c in str { 2019-11-30 09:41:35 +03:00
Delyan Angelov
c7f8f2175b move vlib/builtin/utf8_util.v to vlib/encoding/utf8/utf8_util.v 2019-11-30 08:52:37 +03:00
Emily Hudson
661ddf3d1e compiler: realpath before trying to basefilename 2019-11-30 08:01:31 +03:00
Alexander Medvednikov
850788c4bb parser: fix a bug with & and == 2019-11-29 23:18:10 +03:00
Alexander Medvednikov
4c11eb5ddc -bare => -freestanding 2019-11-29 22:49:05 +03:00
Alexander Medvednikov
f724a956b3 parser: fix a & b == c precedence 2019-11-29 22:42:32 +03:00
Alexander Medvednikov
e957fd6f30 fix ci.yml 2019-11-29 20:02:39 +03:00
Alexander Medvednikov
cca19b6ec4 fix ci.yml 2019-11-29 20:01:57 +03:00
Alexander Medvednikov
881584d04c V 0.1.23 2019-11-29 20:00:33 +03:00
Alexander Medvednikov
43d0199604 ci: test windows package 2019-11-29 19:47:57 +03:00
Alexander Medvednikov
ae171ec28e a small "v test v" fix 2019-11-29 19:32:07 +03:00
Alexander Medvednikov
cb2db3170e ci: test a prebuilt Linux package 2019-11-29 19:26:21 +03:00
Alexander Medvednikov
baaf57e396 ci: don't clone when testing the package 2019-11-29 19:21:38 +03:00
Alexander Medvednikov
d807a01d6b fix ci.yml 2019-11-29 19:19:18 +03:00
Alexander Medvednikov
1bfcdaa2cc ci: test the new prebuilt packages 2019-11-29 19:14:26 +03:00
Alexander Medvednikov
71378b8041 parser: better syntax error for unexpected tokens 2019-11-29 17:06:49 +03:00
joe-conigliaro
11aaee685a generics: fix errors & simplify 2019-11-29 16:46:43 +03:00
penguindark
82d4a731f3 utf8 functions (to_lower etc) 2019-11-29 16:25:25 +03:00
Alexander Medvednikov
431568faad x64: fix off by one error in for loops 2019-11-29 12:33:36 +03:00
Delyan Angelov
39bc38233a android: support more termux users without make errors 2019-11-29 12:29:37 +03:00
Alexander Medvednikov
9e19472c33 show an info message if a C compiler is not installed 2019-11-29 12:12:06 +03:00
bogen85
e31d892598 make _V_mret_ unique by putting p.token_idx in it 2019-11-29 11:11:53 +03:00
bogen85
729f9c3391 bare: add mm_alloc, mm_free
also split errno from return value in existing Linux syscall wrappers
update applicable syscall wrapper checks
2019-11-29 10:14:17 +03:00
Alexander Medvednikov
52d25336db x64: function calls; http: download_file() 2019-11-28 13:24:02 +03:00
prime31
208f67132d added -user_mod_path command line option to add a module search path 2019-11-28 13:04:57 +03:00
Delyan Angelov
7545ea709a enable alpine/musl CI tests 2019-11-28 11:46:52 +03:00
bogen85
3b7466a13d ci: rename multiret_with_ptrtype.v 2019-11-28 09:46:52 +03:00
bogen85
f6ec1b29f9 strconv: make string.int() stop parsing on invalid digit 2019-11-28 09:46:10 +03:00
bogen85
9374168b26 compiler: allow function expecting a void* to receive a byteptr 2019-11-28 09:44:43 +03:00
bogen85
e63300e286 temporary fix for issue #2897 2019-11-27 19:55:32 +03:00
sh0f
dbaa37ea46 urllib: fix string length in escape() 2019-11-27 12:15:05 +03:00
れもん
584786d87c parser: fix in expression 2019-11-27 08:48:04 +03:00
Alexander Medvednikov
38aba37fe9 contributing.md: update x64 info 2019-11-26 16:27:13 +03:00
Alexander Medvednikov
a3b14e00a2 vweb fixes 2019-11-26 16:08:16 +03:00
Alexander Medvednikov
53307597b3 ci: install postgres on ubuntu 2019-11-26 10:15:04 +03:00
Alexander Medvednikov
eb5df5c03d fix ci.yml 2019-11-26 09:59:30 +03:00
Alexander Medvednikov
173eacce3f fix ci.yml 2019-11-26 09:48:08 +03:00
Alexander Medvednikov
db21438648 ci: build Vorum 2019-11-26 09:40:43 +03:00
Alexander Medvednikov
cb8a19efaf vweb: bring back html() test 2019-11-26 09:34:09 +03:00
joe-conigliaro
3107618732 vweb: remove no longer needed special case & fix tmpl 2019-11-26 09:23:11 +03:00
ʇʞʌp
6349bd33d3 compiler: Allow or usage when assigning to struct fields. (#2893) 2019-11-26 09:07:35 +03:00
ʇʞʌp
79a02a4c09 parser: make p.opt()? work for methods 2019-11-26 09:04:59 +03:00
joe-conigliaro
385c045e5a don't add generic parsers to v.files 2019-11-26 09:04:11 +03:00
Alexander Medvednikov
8d241cc164 vweb fixes; ORM fixes; freeing strings 2019-11-26 07:47:16 +03:00
Ned Palacios
bac3c0a63e compiler: add "modules/ " folder for searching local modules 2019-11-26 06:45:26 +03:00
ʇʞʌp
81d552038c parser: allow constant usage in assoc 2019-11-26 06:41:56 +03:00
bogen85
5c217b9e61 fix hexadecimal constants + freestanding fixes 2019-11-26 06:12:37 +03:00
joe-conigliaro
92f920b2b8 make errors from code parsed with statements_from_text show correctly 2019-11-25 22:22:40 +03:00
joe-conigliaro
edd4706480 compiler: parser fixes for vweb 2019-11-25 15:29:55 +03:00
M
837af9b230 freebsd: backtrace 2019-11-25 13:54:56 +03:00
Delyan Angelov
30042ab54b cfns: fix some declarations 2019-11-25 13:54:07 +03:00
joe-conigliaro
7158a012c3 compiler: update to get vweb working 2019-11-25 13:48:25 +03:00
joe-conigliaro
475807566d fix get_last_nl_from_pos when error is last token (#2882) 2019-11-25 20:58:22 +11:00
Delyan Angelov
f7c103d5d2 compiler: remove legacy current workdir from module search 2019-11-25 11:32:11 +03:00
_leif
ee52b4166f log: enum for logger level 2019-11-25 07:50:59 +03:00
Alexander Medvednikov
9bfea5e60b pg: define all C functions 2019-11-25 06:55:29 +03:00
Alexander Medvednikov
feacc2441f socket: fix sizeof 2019-11-25 06:23:09 +03:00
Alexander Medvednikov
a4ab7b14c1 wrap up struct default vals + tests 2019-11-25 05:59:58 +03:00
Unknown User
268a6dc6d9 add missing cfns 2019-11-25 04:35:41 +03:00
Delyan Angelov
5794594e19 compiler: fix vpath module search order regression 2019-11-24 19:39:30 +03:00
Enrico Lefass
f496c1b27b haiku: adding support to v #1 2019-11-24 19:39:04 +03:00
Alexander Medvednikov
19b4cf66ac Windows should work now 2019-11-24 15:31:51 +03:00
Alexander Medvednikov
748e8b7ce4 more Windows definitions 2019-11-24 15:29:11 +03:00
Alexander Medvednikov
b44cbc9b13 define RegQueryValueEx on Windows 2019-11-24 15:21:49 +03:00
Alexander Medvednikov
558024696c lots of C Windows function definitions 2019-11-24 15:16:19 +03:00
Abdullah Atta
d4ae39348f eventbus: make it usable and add README 2019-11-24 14:27:50 +03:00
Alexander Medvednikov
a74f4a661d fix C.GetStdHandle() on Windows 2019-11-24 14:07:14 +03:00
Alexander Medvednikov
24b40be548 default struct vals 2019-11-24 13:53:59 +03:00
Alexander Medvednikov
7cc21be7de clipboard: make compile on Linux 2019-11-24 13:22:57 +03:00
Alexander Medvednikov
81c17e55a6 more C fn definitions 2019-11-24 13:16:11 +03:00
Alexander Medvednikov
f4fe90ea6d C fn definitions on Linux 2019-11-22 19:00:56 +03:00
Alexander Medvednikov
e9e931fe4a force C function definitions 2019-11-24 12:14:22 +03:00
Alexander Medvednikov
1f93bb5a9a os: windows fixes 2019-11-23 21:40:32 +03:00
Alexander Medvednikov
cfd4f0c69c os: fix fullpath call on windows 2019-11-23 21:05:49 +03:00
Alexander Medvednikov
ccb261f00d os: fix unreachable code 2019-11-23 21:00:20 +03:00
Alexander Medvednikov
0aa2196eec os: fix realpath on windows 2019-11-23 20:56:22 +03:00
Alexander Medvednikov
1bd8c465d3 do not allow casting bool to int 2019-11-23 20:40:59 +03:00
Don Alfons Nisnoni
3a6ccf7f31 os: mkdir() error handling 2019-11-23 19:55:18 +03:00
Alexander Medvednikov
0fb0c43c0a pg: minor fixes 2019-11-23 19:48:00 +03:00
Dwight Schauer
e724792a67 freestanding: add core linux syscalls and associated tests 2019-11-23 19:35:57 +03:00
joe-conigliaro
666509623e compiler: use token.pos instead of token.col, calculate col when needed 2019-11-23 19:31:28 +03:00
Delyan Angelov
f42be0622e examples/game_of_life: add a GUI frontend; compiler: local modules relative to a main module 2019-11-23 16:33:25 +03:00
れもん
3d235169c8 parser: fix if expression 2019-11-23 14:25:57 +03:00
Abdullah Atta
0382331499 vlib: add eventbus module 2019-11-23 14:24:25 +03:00
Delyan Angelov
9b4bc0189b backtraces: cleaner looking backtrace output on linux 2019-11-23 14:22:55 +03:00
joe-conigliaro
9c1107f723 compiler: generics fix byteptr support 2019-11-23 10:06:14 +03:00
Alexander Medvednikov
57fbf0b8a9 map: fix in for deleted keys 2019-11-22 20:05:43 +03:00
Alexander Medvednikov
39adc984a8 ci: actually fix x64 2019-11-22 19:58:28 +03:00
Alexander Medvednikov
19fb46b5b1 ci: fix x64 test 2019-11-22 19:52:31 +03:00
Alexander Medvednikov
94318b1287 x64: use correct exe name and set +x 2019-11-22 19:09:14 +03:00
joe-conigliaro
c11025f01f compiler: clean up & optimize generics. add comments & support all param types (#2845) 2019-11-23 00:09:53 +11:00
Alexander Medvednikov
956c605934 ci: test x64 machine codegen 2019-11-22 14:39:04 +03:00
Alexander Medvednikov
9712213f50 x64 machine code generation (ELF) 2019-11-22 14:33:22 +03:00
joe-conigliaro
ab91733a28 small optimization with generics and use os.is_dir in vweb again 2019-11-22 10:55:20 +03:00
Dwight Schauer
4edade5067 compiler: fix a deferencing cast was causing a segfault 2019-11-22 09:11:06 +03:00
joe-conigliaro
8fbfceed30 compiler: generics - support across modules/files 2019-11-22 08:22:11 +03:00
Unknown User
7c802f31d3 parser: fix unused variable warning 2019-11-22 05:23:01 +03:00
Delyan Angelov
d569f23e1c compiler: fix undeclared errors with [][]u16,u32,u64 2019-11-22 05:22:18 +03:00
ylluminate
53a79ff934 readme: add fast.vlang.io 2019-11-22 05:21:19 +03:00
gabixdev
76cd70c232 compiler: add -vpath and -vlib_path options 2019-11-21 15:06:19 +03:00
Delyan Angelov
00365b082f make: fix make on android/termux 2019-11-21 15:03:45 +03:00
Tim Basel
597a6fead2 vlib: cli module 2019-11-21 15:03:12 +03:00
Alexander Medvednikov
8c7f5d5cd8 rename docs/ to doc/ 2019-11-21 04:41:07 +03:00
Don Alfons Nisnoni
65a8db8525 migrate docs from html to doc/docs.md 2019-11-21 04:36:55 +03:00
pfefferminz132
dcea76ff41 fix "v symlink" with relative paths 2019-11-21 04:34:08 +03:00
Alexander Medvednikov
8e32ef382a fix v symlink 2019-11-20 18:27:46 +03:00
Alexander Medvednikov
3e564a2506 parser: fix register() bug in interfaces 2019-11-20 18:19:13 +03:00
Don Alfons Nisnoni
28117353a9 tools/fast.v: calculate the difference between current and previous results 2019-11-20 17:59:37 +03:00
Steve Phillips
0e852e9c81 examples: add random_ips.v 2019-11-20 17:58:24 +03:00
Alexander Medvednikov
01dc267e20 examples: fix gg/freetype example 2019-11-20 07:35:13 +03:00
Alexander Medvednikov
759644ab36 examples: empty gg/freetype project 2019-11-20 07:26:52 +03:00
ʇʞʌp
26fb7e0821 compiler: emit Option_ typedef for fn args and struct fields 2019-11-20 00:58:31 +03:00
kevin70g
5536eb581c time: C.timeval struct member definitions fix 2019-11-19 18:28:29 +03:00
cloudsong
787f49b7a0 interface: enable calling interface with multi-args 2019-11-19 18:27:32 +03:00
joe-conigliaro
4bbed4f910 parser: fix default optional value 2019-11-19 17:47:49 +03:00
Alexander Medvednikov
ddcff7e9c5 rand/pcg32: make the struct public 2019-11-19 14:26:18 +03:00
Delyan Angelov
a620e66af5 compiler: add os.mv_by_cp and use it for the temporary files 2019-11-19 12:55:02 +03:00
Alexander Medvednikov
0cf232d692 parser: a better [] error message 2019-11-19 11:13:19 +03:00
PoLLeN
fe81ccab20 asm.v: fix a small typo 2019-11-19 09:43:02 +03:00
Silvan Büdenbender
94b36250a1 bitfield: fix bit order 2019-11-19 03:32:44 +03:00
Alexander Medvednikov
20d6492775 os: make read_lines() return ?[]string 2019-11-19 02:25:55 +03:00
Alexander Medvednikov
52e3586be3 os: use mkdir() on Linux for now 2019-11-19 00:33:43 +03:00
Alexander Medvednikov
c98db8c437 array: fix sort() for ints 2019-11-19 00:27:35 +03:00
Delyan Angelov
c73f34cc5f net: make net.socket.write, net.socket.read_line more robust 2019-11-19 00:13:14 +03:00
Alexander Medvednikov
1ccd1979a4 vfmt: line comments fixes 2019-11-18 15:12:35 +03:00
Alexander Medvednikov
439bb0c5de foo()? test 2019-11-18 12:11:25 +03:00
Alexander Medvednikov
4c0269597d fix repl tests; change asm syntax a bit 2019-11-18 11:59:13 +03:00
Alexander Medvednikov
f7c7ffecb3 makefile: pre-build builtin modules 2019-11-18 03:51:14 +03:00
Alexander Medvednikov
e081791eaf fix repl tests 2019-11-18 02:34:49 +03:00
Jiten Palaparthi
32fbc2bdf3 remove pub for a private function in array.v 2019-11-18 00:43:23 +03:00
Don Alfons Nisnoni
78c2f8cab3 http: add some docs 2019-11-18 00:42:25 +03:00
Alexander Medvednikov
4fb0b49806 parser: fix the no fn main error in script mode 2019-11-18 00:40:59 +03:00
Alexander Medvednikov
ffb72e855a vhelp: compress option 2019-11-17 15:35:05 +03:00
joe-conigliaro
6d7fe1f83c fix vtool used with paths w/spaces (win/nix) 2019-11-17 14:36:05 +03:00
Alexander Medvednikov
43863edc4f remove asm test from msvc 2019-11-17 07:27:59 +03:00
Alexander Medvednikov
6ae8457f35 fix strings.Builder.str() 2019-11-17 07:05:13 +03:00
Delyan Angelov
be7cf3e812 compiler: support storing temporary files under TMPDIR/v/
Fix for filepath.join not \0 terminating its result
2019-11-17 06:45:20 +03:00
Abdullah Atta
200fcd41ce vlib: add a clipboard module (Windows, macOS, X) 2019-11-17 05:40:03 +03:00
Alexander Medvednikov
3c03051bcf skip asm test on tcc 2019-11-17 01:16:36 +03:00
Alexander Medvednikov
2391c72e4b tcc: 64 bit by default 2019-11-17 01:14:05 +03:00
Alexander Medvednikov
6c51d0bb78 another inline asm test + disable on msvc 2019-11-17 01:07:21 +03:00
Alexander Medvednikov
2964bf9e23 inline assembly 2019-11-17 00:59:49 +03:00
Alexander Medvednikov
5a1de13e10 bare: fix str[idx] 2019-11-16 23:22:40 +03:00
Alexander Medvednikov
0c5854e371 add a c/raw string interpolation test 2019-11-16 22:17:01 +03:00
Swastik Baranwal
5d5268a53d expression: add a check for raw strings 2019-11-16 22:15:22 +03:00
Alexander Medvednikov
8d1eb759f7 fix v -o foo.c build module foo 2019-11-16 21:49:58 +03:00
Michiel Vlootman
328ccebf06 readme: fix link to vweb example 2019-11-16 19:58:55 +03:00
Alexander Medvednikov
dc50ed69cf bare: fix str[idx] 2019-11-16 11:33:04 +03:00
Alexander Medvednikov
a545ccb740 bare: stdint.h 2019-11-16 11:24:25 +03:00
Alexander Medvednikov
56fee6835a http: remove confusing comments and dead code 2019-11-16 10:32:17 +03:00
Alexander Medvednikov
791cee8a8e fix ci.yml 2019-11-16 09:34:57 +03:00
Alexander Medvednikov
d1b8d34dd5 os_linux.v 2019-11-16 09:16:51 +03:00
Nicolas Sauzede
1dadf9d966 fix Windows warnings 2019-11-16 02:30:50 +03:00
Delyan Angelov
e577b40743 compiler: add support for $if x32, x64, big_endian, little_endian 2019-11-15 16:14:28 +03:00
Alexander Medvednikov
751a89ccc8 ci: small fix 2019-11-15 02:33:25 +03:00
Alexander Medvednikov
96cde10696 C string literals (c'str'); bare builtin module; bare println() 2019-11-15 02:29:20 +03:00
Alexander Medvednikov
0b3b241258 ci: test bare metal on linux 2019-11-15 01:20:22 +03:00
Alexander Medvednikov
bd97dc0134 os: realpath potential fix 2019-11-15 01:07:38 +03:00
Alexander Medvednikov
bf669012e7 ci: fix a typo 2019-11-15 00:53:03 +03:00
Alexander Medvednikov
a04c3bac83 CI: ubuntu-musl target 2019-11-15 00:46:40 +03:00
Alexander Medvednikov
9499275180 os: mkdir syscall on linux 2019-11-15 00:15:23 +03:00
Alexander Medvednikov
2545e1c22c fix vpm 2019-11-14 23:33:35 +03:00
Alexander Medvednikov
2dcb8b3bb0 bare: ArchLinux fix? 2019-11-14 22:18:22 +03:00
Alexander Medvednikov
a8b5c00939 parser: allow << >> with enums 2019-11-14 22:14:14 +03:00
Delyan Angelov
a329104dcb compiler: remove dead code (a tcc bug fix) 2019-11-14 11:57:28 +03:00
Alexander Medvednikov
34c4565f7c wrap up -bare 2019-11-14 11:11:52 +03:00
Alexander Medvednikov
6eaa2db533 fix V.js 2019-11-14 10:05:41 +03:00
Alexander Medvednikov
7d924679a6 []: update all examples and tests 2019-11-14 10:00:22 +03:00
Alexander Medvednikov
96b530cf85 update [] 2019-11-14 09:53:05 +03:00
Alexander Medvednikov
4a833d8151 parser: clean up all [] 2019-11-14 09:21:20 +03:00
Alexander Medvednikov
5df5f97daf parser: allow arr = [] instead of arr = []string 2019-11-14 07:15:17 +03:00
Alexander Medvednikov
8d4ef822b6 1 2019-11-14 07:08:11 +03:00
Alexander Medvednikov
1d460c4d49 -bare option 2019-11-14 06:50:21 +03:00
Alexander Medvednikov
b1fa0d25f0 foo()? syntax 2019-11-14 06:15:45 +03:00
BigBlack
72249ce889 fix duplicate #define generation 2019-11-13 23:35:14 +03:00
Alexander Medvednikov
861f2d4bc0 parser: skip $if windows etc blocks on a different os 2019-11-13 21:14:37 +03:00
Alexander Medvednikov
3b929cdd03 update repls tests 2019-11-13 20:40:01 +03:00
Alexander Medvednikov
65426821c4 repl: hide temp filename from output 2019-11-13 20:40:01 +03:00
Silvan Büdenbender
f30b0f1017 bitfield: add from_bytes() function 2019-11-13 19:48:00 +03:00
Alexander Medvednikov
ffa6bcfff5 vfmt: handle comments 2019-11-13 11:54:22 +03:00
Steven Gay
51663520c8 MSVC backtrace 2019-11-13 11:05:06 +03:00
Alexander Medvednikov
714d61aed7 examples: fix a small tetris bug 2019-11-13 06:43:05 +03:00
Alexander Medvednikov
10b0432eca parser: fix mutable map args 2019-11-12 22:35:53 +03:00
Alexander Medvednikov
19c9e226a3 readme: add a logo 2019-11-12 21:37:23 +03:00
Don Alfons Nisnoni
d732be64f6 array: update docs 2019-11-12 19:26:04 +03:00
Delyan Angelov
3643dcbf4b sqlite: use in-memory database in examples and tests 2019-11-12 19:25:30 +03:00
Delyan Angelov
32473eeafe net and http: more consistent error messages 2019-11-12 19:23:53 +03:00
Alexander Medvednikov
35741b46bd readme: remove travis 2019-11-12 05:07:47 +03:00
BigBlack
99169ae4ff parser: ptr++,*(ptr+1) 2019-11-11 23:39:16 +03:00
Daren Liang
bd34524a1c fractions: panic when reciprocal produces invalid fraction 2019-11-11 23:37:32 +03:00
Delyan Angelov
79599b7564 tests: enable tcc tests in CI 2019-11-11 23:27:31 +03:00
Delyan Angelov
cc81e9adfa v test v: cleanup more temporary files 2019-11-11 18:45:11 +03:00
BigBlack
0ab09a57f7 parser: multi-level pointers 2019-11-11 18:43:22 +03:00
Delyan Angelov
de5b4f0497 fix tests for tcc, extract failing stuff to separate simpler files to ease debugging
* Fix compiling vlib/compiler/tests/fn_test.v with tcc.

* Extract failing tests from fn_test.v so that they are more readable and easier to debug.
2019-11-11 17:59:59 +03:00
Alexander Medvednikov
e6775913aa simplify vfmt 2019-11-11 17:04:47 +03:00
Alexander Medvednikov
d9b29bfb4e fix a bug in strings.Builder and wrap up vfmt 2019-11-11 08:24:28 +03:00
Alexander Medvednikov
1cda5c1bc8 skip tcc tests for now 2019-11-11 07:17:11 +03:00
Alexander Medvednikov
f2b1a8cb16 fix option_test.v 2019-11-11 07:09:07 +03:00
Alexander Medvednikov
8947717e3e fix the build 2019-11-11 06:19:18 +03:00
Alexander Medvednikov
0ad0a61db2 remove unnecessary empty lines in cgen 2019-11-11 06:02:01 +03:00
Alexander Medvednikov
730ef96398 another tcc fix 2019-11-11 05:33:19 +03:00
Alexander Medvednikov
bf98eb55ee remove a test until a tcc bug is fixed 2019-11-11 05:27:30 +03:00
Alexander Medvednikov
b3143bb559 parser: remove start_tmp() entirely 2019-11-11 05:22:38 +03:00
Daren Liang
91896af877 math: digits panic for invalid base 2019-11-11 05:21:47 +03:00
Alexander Medvednikov
887c94d9ba parser: second batch of start_tmp() 2019-11-11 05:14:54 +03:00
Alexander Medvednikov
00b3557ce1 parser: start removing start_tmp() 2019-11-11 05:06:24 +03:00
Alexander Medvednikov
f30d0ce667 parser: fix a bug with complex ref fn args 2019-11-11 04:56:13 +03:00
Henrixounez
76c27c0b03 cli: create project helper 2019-11-11 00:48:56 +03:00
Alexander Medvednikov
703202cc08 remove Travis: too unreliable and buggy 2019-11-10 20:47:40 +03:00
Alexander Medvednikov
3c4bb16ce9 disable dereferencing error for now 2019-11-10 20:32:11 +03:00
Alexander Medvednikov
aea5b2e3b6 make unsafe dereferncing warning an error 2019-11-10 20:14:57 +03:00
Alexander Medvednikov
ffa9646749 Revert "print_backtrace_skipping_top_frames: Implementation for MSVC "
This reverts commit d1e7a54f3a.
2019-11-10 20:01:19 +03:00
Alexander Medvednikov
fdf6682254 require unsafe for dereferencing 2019-11-10 19:57:17 +03:00
Alexander Medvednikov
c7f3413d70 more vfmt fixes 2019-11-10 19:49:19 +03:00
Don Alfons Nisnoni
b9728c7af0 string: update split() method 2019-11-10 19:37:36 +03:00
Steven Gay
d1e7a54f3a print_backtrace_skipping_top_frames: Implementation for MSVC 2019-11-10 19:34:53 +03:00
Henrixounez
f8ab629986 readline: fix cursor position with prompt including ansi escape sequences 2019-11-10 19:33:21 +03:00
Alexander Medvednikov
73bd82e706 Revert "ci: disable vid build for now"
This reverts commit e3ad367b80.
2019-11-10 05:29:51 +03:00
Alexander Medvednikov
3d4f85069f more vfmt fixes 2019-11-10 02:44:26 +03:00
kdmult
30481a36dc fix broken doc on windows
* replace hardcoded slash with os.path_separator

* compile only, no link, if building a module
2019-11-09 23:49:15 +03:00
Daren Liang
e6c9c7d571 parser: check type for all integer only assignment operators 2019-11-09 21:57:36 +03:00
Alexander Medvednikov
b1d2c6c730 lots of vfmt fixes 2019-11-09 20:42:29 +03:00
ylluminate
aef02f61e1 V UI readme: Add web (JS/WASM) to platform list 2019-11-09 20:37:31 +03:00
Daren Liang
c607246218 parser: add xor type check 2019-11-09 20:36:56 +03:00
Toby Webb
ab37081f02 add production mode tests
Due to the inability to detect warnings in REPL tests, I implemented running something very similar, but with the -prod flag enabled.
(See https://github.com/vlang/v/pull/2536)

There is also a minor change in os.walk_ext to not add duplicated path separators:
/path//file.ext -> /path/file.ext
2019-11-09 19:35:26 +03:00
Alexander Medvednikov
da574640e7 bring back interface test on msvc 2019-11-09 18:21:01 +03:00
Alexander Medvednikov
f33d8bd596 do not generate interface tables for unused interfaces 2019-11-09 18:13:51 +03:00
Alexander Medvednikov
be4eaa680a skip module test on msvc for now 2019-11-09 02:45:49 +03:00
Alexander Medvednikov
fad0cc2ce5 skip interface test on msvc for now 2019-11-09 02:40:41 +03:00
Alexander Medvednikov
32fec2c26c fix interfaces on msvc 2019-11-08 23:28:32 +03:00
Alexander Medvednikov
cac719c078 []interface 2019-11-08 22:08:02 +03:00
Alexander Medvednikov
6f95be60a1 cc.v: use msvc on Windows by default if gcc is not installed 2019-11-08 21:15:26 +03:00
Daren Liang
c4ff0d565b parser: check mul and div operations on str variables 2019-11-08 20:26:08 +03:00
Delyan Angelov
bc826173cc fix $if msvc conditional define 2019-11-08 16:00:55 +03:00
Alexander Medvednikov
06a7954298 update roadmap 2019-11-08 07:49:56 +03:00
Alexander Medvednikov
7a8e7b4db8 fix interface methods that return a value 2019-11-08 07:43:44 +03:00
Alexander Medvednikov
985fb91ee8 rewrite interfaces 2019-11-08 07:16:53 +03:00
Daren Liang
f5438477df parser: check mul and div operations on strings 2019-11-08 04:32:25 +03:00
Nicolas Sauzede
db4a7edf3a fix threads to actually return a voidptr 2019-11-08 03:09:02 +03:00
Nicolas Sauzede
5a8c3daba3 os: fix stat mode signedness warning 2019-11-08 03:02:02 +03:00
Alexander Medvednikov
27f6b2dd73 table: fix float/integer cast bug 2019-11-08 02:04:00 +03:00
Alexander Medvednikov
f579376638 table: improve check_types() 2019-11-08 01:48:36 +03:00
Nicolas Sauzede
2f5de11c22 fix byteptr warning 2019-11-08 01:30:07 +03:00
Nicolas Sauzede
3a99217592 fix pthread 3rd arg voidptr warning 2019-11-08 00:58:49 +03:00
Alexander Medvednikov
0ca75f7782 tools/fast: run git pull 2019-11-08 00:07:53 +03:00
Alexander Medvednikov
6c1b0785de tools/fast: minor layout fix 2019-11-07 22:24:25 +03:00
Delyan Angelov
a44ba0b8a2 bignum module wrapper for kokke/tiny-bignum-c 2019-11-07 22:04:18 +03:00
Alexander Medvednikov
7a29d959ce tools/fast: test hello world 2019-11-07 21:59:34 +03:00
Alexander Medvednikov
13ee2ad670 tools/fast: use clang 2019-11-07 21:53:07 +03:00
Alexander Medvednikov
c93e51e92d tools/fast.v: small fixes 2019-11-07 21:47:31 +03:00
Alexander Medvednikov
f9e79cd73c tools: fast.v for fast.vlang.io 2019-11-07 21:36:42 +03:00
pfefferminz132
b9e7d02462 math: make ceil return an f64 2019-11-07 19:54:51 +03:00
lorenzo pirro
6bcd0fd9cc optimize reserved type check 2019-11-07 18:45:38 +03:00
Alexander Medvednikov
6d98203572 fix "undefined" error 2019-11-07 17:57:54 +03:00
Alexander Medvednikov
ad7b39d763 fix makefile 2019-11-07 17:57:20 +03:00
Daren Liang
df6bdf59e6 parser: fix mod assign type check 2019-11-07 17:49:40 +03:00
Alexander Medvednikov
fbd71e1539 expression.v 2019-11-07 17:48:48 +03:00
vitalyster
2d3944250f tools: show C output when tool can not be compiled 2019-11-07 16:17:32 +03:00
vitalyster
86447c1301 windows: use CreateProcess for os.exec 2019-11-07 16:01:17 +03:00
lorenzo pirro
d57c0cfde0 parser: fix builtin as name not allowed 2019-11-07 06:00:48 +03:00
Nicolas Sauzede
c8de2c0bd4 fix i64 overflow warning 2019-11-07 06:00:00 +03:00
Alexander Medvednikov
ef71867bb0 make the roadmap clearer 2019-11-07 00:18:54 +03:00
Alexander Medvednikov
c9d0bd7404 print true and false instead of 1 and 0 2019-11-07 00:07:50 +03:00
Alexander Medvednikov
fdd4afa392 for.v and match.v; do not allow arrays in match 2019-11-06 23:30:08 +03:00
lorenzo pirro
bd18f50c8a os: cp_r fn to copy files recursively 2019-11-06 23:05:35 +03:00
vitalyster
8dbeab9a7b make V work on Windows 7 2019-11-06 23:04:40 +03:00
Alexander Medvednikov
e266c8a750 urllib: test str() 2019-11-06 22:35:59 +03:00
Abdullah Atta
c4e9f09f0f urllib: crash when converting URL to str 2019-11-06 22:34:33 +03:00
Alexander Medvednikov
7c70f3df93 parser: & and | type check 2019-11-06 21:20:37 +03:00
Alexander Medvednikov
0f0bef2d33 parser: more typing checks 2019-11-06 20:47:03 +03:00
Alexander Medvednikov
75510e2ea1 remove last test 2019-11-06 18:19:03 +03:00
Alexander Medvednikov
73134035a9 parser: remove last 2019-11-06 18:17:14 +03:00
Alexander Medvednikov
6a812f7293 mod operator tests 2019-11-06 18:04:48 +03:00
Alexander Medvednikov
6afd7d50a6 parser: fix mod type check 2019-11-06 17:52:35 +03:00
Alexander Medvednikov
ca259331e4 parser: fix % type check 2019-11-06 17:35:32 +03:00
Alexander Medvednikov
e3ad367b80 ci: disable vid build for now 2019-11-06 07:06:03 +03:00
Alexander Medvednikov
f6d06fcda2 update tests and examples after the mutability fix 2019-11-06 06:57:04 +03:00
Alexander Medvednikov
b720bb2e77 parser: mark var as changed only if the receiver is mutable 2019-11-06 06:48:57 +03:00
Alexander Medvednikov
8dd335295e new enum step 2 2019-11-06 06:26:04 +03:00
Alexander Medvednikov
4d876d1980 new enum step 1 2019-11-06 06:16:12 +03:00
Alexander Medvednikov
855a736a2c parser: C enums + another enum simplification 2019-11-06 05:14:34 +03:00
Daren Liang
91bb969ed1 stats: use c style for loop 2019-11-06 04:45:05 +03:00
Alvydas Vitkauskas
af81b02ef0 parser: fix shift-assign to work with all integer types 2019-11-06 03:37:31 +03:00
Alvydas Vitkauskas
3080959084 parser: make let shift operators work with all types 2019-11-06 01:02:50 +03:00
Alexander Medvednikov
1b5f724df0 #include warning 2019-11-06 00:32:15 +03:00
Alexander Medvednikov
7fc7c05e9d parser: do not all string casts 2019-11-05 20:41:02 +03:00
Alexander Medvednikov
b91a537c35 it's better to do this locally and update v.c manually 2019-11-05 20:27:53 +03:00
Alexander Medvednikov
75f382c903 remove sigaction() for now 2019-11-01 05:44:02 +03:00
Alexander Medvednikov
1687afba9f remove locale.h and unistd.h 2019-11-05 20:05:25 +03:00
Alexander Medvednikov
b929543782 remove string.h 2019-11-05 20:00:00 +03:00
Alexander Medvednikov
62f54d9d65 remove signal.h 2019-11-05 19:57:53 +03:00
Alexander Medvednikov
dc1ca31071 enable temporary fns.h with C defs 2019-11-05 19:34:56 +03:00
vitalyster
eb069833a8 compiler: detect Cygwin and show error message 2019-11-05 19:33:24 +03:00
Alexander Medvednikov
c5d868c928 start the C header removal process 2019-11-05 19:24:00 +03:00
Alexander Medvednikov
5306c14d78 parser: nothing can be cast to bool 2019-11-05 18:58:42 +03:00
Alexander Medvednikov
07e3699700 parser: do not allow number => bool casts 2019-11-05 18:56:19 +03:00
Alexander Medvednikov
883041fbcc os: replace FILE with voidptr to remove stdlib.h dep 2019-11-05 18:42:10 +03:00
vitalyster
67f68df8a8 compiler: display error when MinGW configuration is outdated 2019-11-05 18:39:44 +03:00
Alexander Medvednikov
b2f8944b1f fix V.js 2019-11-05 18:18:10 +03:00
Alexander Medvednikov
425c9ce401 a special last variable in for loops (experimental) 2019-11-05 17:17:55 +03:00
Delyan Angelov
d279cedd28 v repl: remove dependency on v compiler module, thus making its compilation faster 2019-11-05 15:10:15 +03:00
aliczin
53981c8747 compiler: supress windows (MSVC) warnings 2019-11-05 14:09:33 +03:00
Alexander Medvednikov
f60d44eda9 --enable-globals 2019-11-05 02:43:52 +03:00
Alexander Medvednikov
f8d14a216b parser: print backtrace only in debug mode 2019-11-05 02:30:51 +03:00
Alexander Medvednikov
0a6840b6a6 improve a minor info message 2019-11-05 01:32:21 +03:00
Alexander Medvednikov
ee4db9f96d parser: $if clang, $if msvc, $if mingw 2019-11-04 20:14:34 +03:00
joe-conigliaro
b8b72580a7 compiler: typo detection - fix error & slightly optimize function 2019-11-04 14:35:28 +03:00
joe-conigliaro
5d16f30a3d parser: add error when trying to assign from a function that does not return a value 2019-11-04 14:35:10 +03:00
Henrixounez
b4e8989bd1 compiler: show help instead of repl on argument 2019-11-04 05:05:26 +03:00
Henrixounez
b5d457b5ce readline: catch siguser signal to reset tty 2019-11-04 05:05:12 +03:00
joe-conigliaro
5f1e634d82 compiler: improve typo detection, support all types and fn definitions 2019-11-04 04:59:28 +03:00
joe-conigliaro
a6a233df6b compiler: remove unneeded blank ident assignment (#2634) 2019-11-04 10:59:18 +11:00
Daren Liang
e3d8ab5849 os: do not allow || and \n in system/exec 2019-11-04 02:41:15 +03:00
joe-conigliaro
df5faf35e5 compiler: optionals default value 2019-11-04 02:38:49 +03:00
Alexander Medvednikov
4e64a58ac1 scanner: fix string interpolation in raw strings 2019-11-03 23:57:26 +03:00
Alexander Medvednikov
3449a8bc4d os: do not allow ; and && in system/exec 2019-11-03 23:13:56 +03:00
Alexander Medvednikov
104fab7466 0.20_roadmap.txt 2019-11-02 23:03:41 +03:00
Trivaxy
8de2f00294 os: add windows cp 2019-11-02 22:37:29 +03:00
Alexander Medvednikov
56e1dac03a Revert "vtools: add an info message". This broke repl tests.
This reverts commit 3b3f0eb507.
2019-11-02 14:52:12 +03:00
Alexander Medvednikov
3b3f0eb507 vtools: add an info message 2019-11-02 13:27:09 +03:00
Alexander Medvednikov
3097ba93d7 vtools: do not use -prod, it slows things down too much 2019-11-02 13:26:03 +03:00
joe-conigliaro
4120982da1 compiler: add varg str method & varg / parser optimizations 2019-11-02 13:17:56 +03:00
joe-conigliaro
7b1993b1e4 vlib: filepath module 2019-11-01 19:29:51 +03:00
joe-conigliaro
fe9d884d90 parser: fix forwarding vargs & multiple call varg len fix 2019-11-01 19:14:16 +03:00
Alexander Medvednikov
de8297c983 examples/users.v: fix imports 2019-11-01 19:02:38 +03:00
Alexander Medvednikov
80ba8f07b8 more ui vh fixes 2019-11-01 18:03:24 +03:00
Delyan Angelov
59efd42483 tools/vget => tools/v , search, install, etc
* compiler: rename vget to tools/vpm, implement draft support for v vpm search, v vpm update, v vpm install, v vpm remove, v vpm help .

* compiler: use "v pm" instead of "v vpm" to reduce the redundancy of typing, as suggested by slapden


* Use 'v install modulename', 'v search keywords', 'v update modulename', 'v remove modulename' instead of the longer 'v pm install modulename' etc.
2019-11-01 15:19:04 +03:00
Alexander Medvednikov
a83e233dea building modules can now be done from any directory 2019-11-01 14:16:58 +03:00
Delyan Angelov
15d4f68af6 compiler: pass -no-pie in debug builds so that backtraces work 2019-11-01 13:20:26 +03:00
Delyan Angelov
e15abb3de0 compiler: move v up implementation to tools/vup.v 2019-11-01 13:14:59 +03:00
Danil-Lapirow
15f971ece7 parser: fix broken methods with vargs 2019-11-01 13:03:14 +03:00
Delyan Angelov
bfe039fcba compiler: extract testing to tools/vtest.v 2019-11-01 02:15:03 +03:00
Enrico Lefass
a691cc857e time: add new public functions for formatting 2019-11-01 02:13:03 +03:00
Alexander Medvednikov
f8f7881f89 thirdparty/ui for macOS (temporary) 2019-11-01 01:14:08 +03:00
Nicolas Sauzede
71450828bd fix missing protos for popen and backtrace_symbols 2019-11-01 00:52:08 +03:00
Alexander Medvednikov
e07d3c7827 ui vh hack 2019-11-01 00:47:11 +03:00
Alexander Medvednikov
91df08f56d cc: experimental -fast option for tcc/codegen in the future 2019-11-01 00:37:24 +03:00
Alexander Medvednikov
987f5fd2a1 string: bring back strconv 2019-11-01 00:28:52 +03:00
Alexander Medvednikov
01dba479a4 makefile: remove -O2 2019-10-31 22:30:35 +03:00
Alexander Medvednikov
ae696e7ccb Revert "Revert "array: fix and document array functions""
This reverts commit b1eb9d6b15.
2019-10-31 21:50:20 +03:00
Alexander Medvednikov
4c96ca4e62 string: remove strconv dep 2019-10-31 21:50:11 +03:00
Alexander Medvednikov
128d37c671 vh fixes for the UI module 2019-10-31 21:26:12 +03:00
Alexander Medvednikov
5be8b47e1c cc.v: disable tcc on android 2019-10-31 20:32:34 +03:00
Alexander Medvednikov
b1eb9d6b15 Revert "array: fix and document array functions"
This reverts commit 7fa33fc250.
2019-10-31 20:29:58 +03:00
Henrixounez
55f6e810cf repl: moved as a tool and using readline 2019-10-31 19:01:04 +03:00
ytakahashi
114953f28d match: fix typo and remove arrows 2019-10-31 18:58:19 +03:00
Alvydas Vitkauskas
7fa33fc250 array: fix and document array functions 2019-10-31 15:46:50 +03:00
JayatiGoyal
07ad60b89b readmeL removed some spaces 2019-10-31 14:40:17 +03:00
Don Alfons Nisnoni
0c229aacdd readline: use new enum syntax 2019-10-31 14:06:48 +03:00
joe-conigliaro
5acdf425ab parser: move duplicate code into single function 2019-10-31 13:49:57 +03:00
Alexander Medvednikov
b1730b768d remove a println() 2019-10-31 12:15:45 +03:00
Alexander Medvednikov
d5cf4d6fd5 compiler: -o dir/file: create a new directory if it doesn't exist 2019-10-30 20:53:34 +03:00
Amal Shaji
e8d34002e1 map: fixed deletion of non-existent keys 2019-10-30 20:19:59 +03:00
Alexander Medvednikov
5da3c49497 json: rename jsgen.v to json_gen.v 2019-10-30 19:45:33 +03:00
Alexander Medvednikov
6b4dcb916b ci: bring back Vid build 2019-10-30 19:36:54 +03:00
Alexander Medvednikov
316cf025ae arrays: fix range 2019-10-30 17:30:49 +03:00
Alexander Medvednikov
a9ca9f45af fix enum/match combo in sync_windows.v 2019-10-30 17:29:05 +03:00
Alexander Medvednikov
9044f1437c v doc 2019-10-30 17:07:41 +03:00
Alexander Medvednikov
08c1f408d3 fix sync_windows.v 2019-10-30 16:43:40 +03:00
Alexander Medvednikov
2bd2501dc0 fix new enums in tests 2019-10-30 16:38:47 +03:00
Alexander Medvednikov
aa39451c8b arrays.range(min, max) 2019-10-30 16:21:57 +03:00
Alexander Medvednikov
96f7620628 instead of Enum.foo require .foo if it's enough + some UI fixes 2019-10-30 15:48:33 +03:00
ath3
9abbfa7862 examples/fibonacci: stop before overflowing and use u64 2019-10-30 14:54:38 +03:00
Delyan Angelov
ba6cc5df2a compiler: print asserted source line on failure 2019-10-30 12:15:33 +03:00
Don Alfons Nisnoni
ee6ec3faf3 crypto: fix a typo 2019-10-29 19:59:55 +03:00
sunnylcw
79279e01f5 sqlite: add flags for FreeBSD to pass sqlite test 2019-10-29 17:13:56 +03:00
lorenzo pirro
d42c53346d array: eq() for builtins (byte, string, int, i64, f32) 2019-10-29 14:26:00 +03:00
Alexander Medvednikov
2798e59e7f makefile: build V with -O2 2019-10-29 12:42:20 +03:00
Danil-Lapirow
f161ff9db5 parser: fix tmp is already started issue 2019-10-28 23:50:58 +03:00
ytakahashi
6a609cb046 log: make const/struct public 2019-10-28 18:53:02 +03:00
Michael Chrisco
ed445860eb tetris: update readme 2019-10-28 16:47:17 +03:00
Delyan Angelov
3950b10d2a compiler: make Fn struct public 2019-10-28 16:37:18 +03:00
Alexander Medvednikov
9e9935acbc math: make consts and structs public 2019-10-28 16:33:36 +03:00
Alexander Medvednikov
ddcd1d2cec Update CHANGELOG.md 2019-10-28 13:15:12 +03:00
Alexander Medvednikov
33b5afa893 V 0.1.22 2019-10-28 13:12:44 +03:00
Delyan Angelov
15deaa7eb6 compiler: improve errors when building thirdparty .o files 2019-10-28 12:43:57 +03:00
Alexander Medvednikov
44b99bc299 ci: don't run sqlite test on windows for now 2019-10-28 12:32:03 +03:00
Alexander Medvednikov
a7568ea54b ci: install libsqlite package 2019-10-28 11:45:27 +03:00
Alexander Medvednikov
373873d71f fix sqlite test 2019-10-28 10:40:48 +03:00
Danil-Lapirow
a2bafaa254 parser: add error on array comparison 2019-10-28 10:26:42 +03:00
Alexander Medvednikov
c5fa99c66c darwin not supported yet 2019-10-28 10:25:56 +03:00
Alexander Medvednikov
d54bbc8737 fix sqlite test 2019-10-28 10:21:32 +03:00
Alexander Medvednikov
1ac1626357 sqlite example 2019-10-28 00:10:58 +03:00
Alexander Medvednikov
16c4415d4c a very simple sqlite driver 2019-10-28 00:02:52 +03:00
Alexander Medvednikov
1390a39053 clean up switch tokens 2019-10-27 22:42:52 +03:00
Don Alfons Nisnoni
8358528888 string: add some docs 2019-10-27 22:29:55 +03:00
Alexander Medvednikov
384e81fe28 fix travis 2019-10-27 21:51:40 +03:00
Alexander Medvednikov
07d37fbfc0 ci: remove vid for now 2019-10-27 21:40:26 +03:00
Alexander Medvednikov
9cddf22fff glfw: make two structs public 2019-10-27 21:23:33 +03:00
Alexander Medvednikov
9c5abd575f parser: remove switch_statement() 2019-10-27 13:03:40 +03:00
Alexander Medvednikov
e890f682e2 [if] fn: remove unused expression 2019-10-27 12:42:31 +03:00
Alexander Medvednikov
5946f67328 final switch => match 2019-10-27 12:38:50 +03:00
Don Alfons Nisnoni
acaf66ac80 readline: switch => match 2019-10-27 12:38:36 +03:00
Alexander Medvednikov
293cf18266 enable [if vfmt] 2019-10-27 12:16:33 +03:00
Alexander Medvednikov
d00fdca38f [if vfmt] for fgen() functions 2019-10-27 12:13:08 +03:00
joe-conigliaro
d81b0675f0 array: bring back left & right method tests 2019-10-27 12:05:19 +03:00
Alexander Medvednikov
6e0a789b6d tetris: minor fixes 2019-10-27 10:24:28 +03:00
Alexander Medvednikov
efdadc3758 tetris/glfw: fix warnings 2019-10-27 10:13:40 +03:00
joe-conigliaro
59378dce46 compiler/vlib: replace substr/left/right with [start..end] everywhere 2019-10-27 10:03:15 +03:00
Don Alfons Nisnoni
ed55826686 log/net: switch => match 2019-10-27 09:45:03 +03:00
Nicolas Sauzede
7ba5248e56 os_win.v: switch => match 2019-10-27 09:36:40 +03:00
joe-conigliaro
a075ce160e compiler: add [..2] & [2..] support for slices 2019-10-27 09:36:04 +03:00
Alexander Medvednikov
e80cf185b9 allow public unions and interfaces 2019-10-27 02:23:52 +03:00
Alexander Medvednikov
ef022c2326 [if vfmt] function attribute for skipping functions for performance 2019-10-27 02:11:31 +03:00
Alexander Medvednikov
ee51313e2c test array and string slices 2019-10-27 01:37:29 +03:00
Alexander Medvednikov
dd12a85429 array: fix a regression 2019-10-26 22:26:30 +03:00
Alexander Medvednikov
570a7aaaf3 a[start..end] slicing 2019-10-26 22:20:13 +03:00
Don Alfons Nisnoni
678ce54e70 os: document functions 2019-10-26 20:21:07 +03:00
Delyan Angelov
2d05c906d5 base64: some optimizations
* Add a test for the base64 encoding/decoding of long strings (i.e. mainly memory allocation).

* Make vlib/encoding/base64/base64_memory_test.v resemble more test.v from https://github.com/kostya/benchmarks .

* base64: some optimizations, also add base64.encode_in_buffer and base64.decode_in_buffer .

* Fix tests passing static strings.

* Reduce time needed for base64_memory_test.v .

* Optimize encoding.base64.Index access too (it is static), which speeds up decoding.
2019-10-26 18:20:36 +03:00
vitalyster
272b0aec82 os: fix os.get_error_msg on Windows 2019-10-26 14:58:05 +03:00
Alexander Medvednikov
6944161b15 array: clean up filter() 2019-10-26 14:53:55 +03:00
Alexander Medvednikov
70c9565607 array: fix map() return type and handle []bool 2019-10-26 14:49:36 +03:00
Alexander Medvednikov
f40d672a12 array: map() test 2019-10-26 14:32:56 +03:00
Alexander Medvednikov
4ef10c92f4 array: map() method 2019-10-26 14:28:11 +03:00
Alexander Medvednikov
f6f5b8cfb1 bring back string.h for now 2019-10-26 11:51:22 +03:00
Alexander Medvednikov
fbd41eacba remove string.h include 1 2019-10-26 11:43:25 +03:00
Alexander Medvednikov
ef45a87882 remove string.h include 2019-10-26 11:29:56 +03:00
Alexander Medvednikov
58f0503f6d cc.v: bring back implicit fn declaration 2019-10-26 11:09:20 +03:00
Alexander Medvednikov
cba12d0106 macos libproc fix 2 2019-10-26 02:19:14 +03:00
Alexander Medvednikov
203f967677 macos libproc fix 1 2019-10-26 02:16:37 +03:00
Alexander Medvednikov
7de95a642e remove more C headers 2019-10-26 02:08:46 +03:00
Alexander Medvednikov
dc2c62807a string: faster int() 2019-10-25 23:41:18 +03:00
Alexander Medvednikov
5510327d70 array_test.v: str() test 2019-10-25 22:40:52 +03:00
Alexander Medvednikov
8d2111169a fix V.js methods and duplicate .str() in arrays 2019-10-25 22:38:39 +03:00
Mihael Dimoski
b6fa252fc9 time: make Time struct public 2019-10-25 22:04:25 +03:00
Delyan Angelov
8364130a1f compiler: implement error_with_code(s string, code int)
Make available the integer code as errcode to callers/unwrappers
2019-10-25 22:03:42 +03:00
Alexander Medvednikov
9c5a359de3 fix V.js methods after the recent generics fix 2019-10-25 21:57:32 +03:00
Simon Heuser
280c7d396c generics: generic methods, cast to T 2019-10-25 21:32:27 +03:00
Alexander Medvednikov
7d02eccbce cc.v: fix tcc check 2019-10-25 20:11:53 +03:00
Alexander Medvednikov
c30f16a038 parser: add ; after a goto label 2019-10-25 18:53:45 +03:00
Alexander Medvednikov
090e1a87b7 linux: use gcc if tcc fails 2019-10-25 18:49:49 +03:00
Alexander Medvednikov
be0830b24f builtin: do not use backtrace with musl 2019-10-25 18:38:47 +03:00
Alexander Medvednikov
c7e6d379da $if glibc { 2019-10-25 18:33:02 +03:00
Alexander Medvednikov
ef9cae6dc0 bring back backtrace 2019-10-25 17:59:41 +03:00
Alexander Medvednikov
a83aa28a67 urllib: switch => match 2019-10-25 17:54:34 +03:00
Alexander Medvednikov
d0cbb4041b disable backtrace for now 2019-10-25 17:38:07 +03:00
Delyan Angelov
32b3611026 sync: new_mutex() and new_waitgroup() 2019-10-25 17:24:40 +03:00
Alexander Medvednikov
e04c4ad852 remove execinfo.h include 2019-10-25 17:20:49 +03:00
joe-conigliaro
7d418e9105 parser: cleanup & reuse 2019-10-25 16:34:12 +03:00
Alexander Medvednikov
784847cf18 make V compile 2019-10-25 16:06:21 +03:00
Alexander Medvednikov
ea3f9b5b9a remove execinfo.h header 2019-10-25 12:13:38 +03:00
Alexander Medvednikov
4e21e9ed44 minor V.js fixes 2019-10-25 12:13:38 +03:00
Toby Webb
97096e4e6c Add fibonnaci example to gitignore 2019-10-25 10:28:26 +03:00
Toby Webb
c456ba6bde parser: fix incorrect unused var message 2019-10-25 10:27:43 +03:00
joe-conigliaro
4443fef6c3 compiler: add const to typo suggestions + small typo format update 2019-10-25 10:26:14 +03:00
Alexander Medvednikov
d4c1bba856 fix V.js 2019-10-24 22:58:01 +03:00
Alexander Medvednikov
892d1c6aab vweb: first step to revive it 2019-10-24 22:46:58 +03:00
Simon Ernst
2032da7fe2 os: make Result public 2019-10-24 21:58:28 +03:00
Alexander Medvednikov
36eb1b77d0 compiler: remove remaining switch statements and show a warning 2019-10-24 19:26:51 +03:00
Alexander Medvednikov
753fe32793 parser: remove more switch statements 2019-10-24 16:02:24 +03:00
Alexander Medvednikov
695245d307 struct.v 2019-10-24 15:56:10 +03:00
Alexander Medvednikov
bac690bbc8 parser: replace the switch statement in parse() 2019-10-24 15:50:46 +03:00
Alexander Medvednikov
3a929faf26 enums: make in work without specifying the full type 2019-10-24 15:41:34 +03:00
Alexander Medvednikov
560ae9352c nice enum works 2019-10-24 15:41:34 +03:00
Alexander Medvednikov
dca49e43d9 c defs 2019-10-24 15:41:34 +03:00
Larpon
98c016b41d os: walk() function 2019-10-24 15:17:09 +03:00
joe-conigliaro
580abe0de4 lower/snake case consts & enums 2019-10-24 14:48:20 +03:00
joe-conigliaro
fe17dd9a7e vlib: make more structs, consts, & enums public 2019-10-24 22:35:11 +11:00
Alexander Medvednikov
75a6c759c7 enum snake_case check 2019-10-24 14:25:03 +03:00
Alexander Medvednikov
3d6bdc2dc3 public enums + more public structs (libs/examples/tests) 2019-10-24 13:24:50 +03:00
joe-conigliaro
1a2db54bc1 compiler: cgen - fix typo. dependency was spelled wrong 2019-10-24 21:23:11 +11:00
Alexander Medvednikov
4a88a28a3b make all necessary structs public 2019-10-24 12:51:00 +03:00
Alexander Medvednikov
dce3275df4 make necessary consts public 2019-10-24 12:36:57 +03:00
Alexander Medvednikov
1c564bc118 compiler: public consts and structs 2019-10-24 12:26:43 +03:00
joe-conigliaro
71d965b6a2 compiler: add hint to use references for dependant struct fields 2019-10-24 11:18:50 +03:00
Anders Nissen
1ce2acb4ef examples: use i64 in Fibonacci 2019-10-24 10:25:47 +03:00
joe-conigliaro
baf49b2523 show struct dependency cycles in error & update module cycle error (#2517) 2019-10-24 15:53:39 +11:00
Alexander Medvednikov
f14425ec18 do not allow one letter struct names 2019-10-23 23:46:07 +03:00
Tony Kostanjsek
c58c03167d vlib/darwin: remove assert 2019-10-23 23:40:07 +03:00
joe-conigliaro
2f5a742f3e compiler: generic variadic fix 2019-10-23 19:44:05 +03:00
joe-conigliaro
0cf3e2e677 compiler: add variadic support for generic functions 2019-10-23 17:48:06 +03:00
Sergio Abreu García
374133086d tetris.v: minor User Interface improvements 2019-10-23 16:19:05 +03:00
Alexander Medvednikov
054dd237a4 V.js: remove u8 2019-10-23 15:56:57 +03:00
Alexander Medvednikov
1db1e0f4b7 1 2019-10-23 15:55:14 +03:00
Alexander Medvednikov
6174dfb424 fix V.js 2019-10-23 15:51:52 +03:00
Alexander Medvednikov
e69117a8f3 vh types + fn receiver name check 2019-10-23 15:42:50 +03:00
Alexander Medvednikov
27e254c738 now bring _windows.v back 2019-10-23 12:54:45 +03:00
Alexander Medvednikov
95321f5b33 fix module_test.v 2019-10-23 12:50:18 +03:00
Alexander Medvednikov
1752f6879c os: remove duplicate consts 2019-10-23 12:45:52 +03:00
Alexander Medvednikov
8021a01365 rename windows files for now 2019-10-23 12:37:42 +03:00
Alexander Medvednikov
b298b397dc vh gen: consts before fns 2019-10-23 12:35:51 +03:00
Alexander Medvednikov
92185a1a6f os: move windows consts to a separate file 2019-10-23 12:28:48 +03:00
Alexander Medvednikov
2e28691254 _windows.v fix 2019-10-23 12:25:00 +03:00
Alexander Medvednikov
5ef4b2064f windows: _win.v => windows.v 2019-10-23 12:21:33 +03:00
Alexander Medvednikov
a6aad880f7 gg: resizable window option 2019-10-23 12:17:08 +03:00
Alexander Medvednikov
8b74c711c6 vh generation: consts + cleanup 2019-10-23 11:09:54 +03:00
Enrico Lefass
fcead2f79e time: squash three occasions of const(...) into one 2019-10-23 08:41:16 +03:00
Alexander Medvednikov
0806aa353c match: second step 2019-10-23 01:06:06 +03:00
Alexander Medvednikov
d8edc27805 match: this needs a 2 step PR 2019-10-23 01:00:52 +03:00
Alexander Medvednikov
9743b04fe6 update match statement 2019-10-23 00:56:25 +03:00
Alexander Medvednikov
4574039e4d new vh generation + simpler match statement 2019-10-23 00:45:17 +03:00
Sergio Abreu García
14c273f273 gg: fix clear function 2019-10-22 23:06:56 +03:00
Alexander Medvednikov
8bfb5425e3 update PR template 2019-10-22 23:04:36 +03:00
Alexander Medvednikov
7696a600f6 compiler: fix V build on Windows 2019-10-22 21:29:32 +03:00
Delyan Angelov
eeea257467 clean up empty lines in errors; simplify source line tracking 2019-10-22 18:38:17 +03:00
Alexander Medvednikov
d289a90cc7 readme: windows make.bat clarification 2019-10-22 09:21:59 +03:00
Arthur Kennedy Otieno
fb89c12d90 V.js: remove a text block resulting in syntax errors 2019-10-22 08:02:31 +03:00
Robin Martijn
03cd34fb54 examples: use is_letter() method 2019-10-22 08:00:28 +03:00
Toby Webb
fdfa564865 parser: minor syntax fix 2019-10-21 22:04:57 +03:00
Alexander Medvednikov
a29c80ca3d make the unsafe error a warning for now 2019-10-21 18:53:55 +03:00
joe-conigliaro
7680d9a23c compiler: variadic fn - fix unexpected token , error from #2433 (#2468)
* merge master
* fix unexpected token
2019-10-21 23:30:34 +11:00
Delyan Angelov
eef73eea22 tools: new tool to extracts function names declared in V files 2019-10-21 14:14:28 +03:00
Delyan Angelov
cd8b0d04bb parser: support for 'enum Color {red = 31 yellow green blue}' 2019-10-21 14:00:41 +03:00
Emily Hudson
a52cb315cb fix memory bug with generic code generation 2019-10-21 13:54:37 +03:00
Toby Webb
dfc654f84e const declarations should be order independent 2019-10-21 08:57:29 +03:00
Emily Hudson
2829298de7 live: Fix MSVC hot code reloading (#2460) 2019-10-21 12:15:43 +11:00
Alexander Medvednikov
333f0ab89f fix v.js test 2019-10-20 20:52:31 +03:00
Alexander Medvednikov
3d6b936f38 parser: undefined error 2019-10-20 20:47:27 +03:00
Enrico Lefass
c23155790a os: add pub fn read_bytes and pub fn read_bytes_at 2019-10-20 20:45:16 +03:00
Alexander Medvednikov
81b1b882fd bultin: mark unsafe functions 2019-10-20 20:29:24 +03:00
Alexander Medvednikov
c13b58e6db [deprecated] attribute 2019-10-20 20:15:48 +03:00
Alexander Medvednikov
1b518c158b unsafe keyword + make array.free() an unsafe method 2019-10-20 20:10:44 +03:00
joe-conigliaro
f7c00b8180 compiler: blank ident - consolidate duplicated code into single function 2019-10-20 12:24:12 +03:00
Simon Heuser
8a31ee4b53 generic functions 2019-10-20 10:19:37 +03:00
Alexander Medvednikov
f63e24e51d clean up vtest.v a bit 2019-10-20 09:56:33 +03:00
eau
6d8548d7a5 compiler: add missing header file on OpenBSD 2019-10-20 07:00:01 +03:00
Ole-Martin Bratteng
b73387647c v.js: make eprintln use console.error 2019-10-19 15:42:37 +03:00
Delyan Angelov
5977fc0644 compiler: print relative file paths for files in the current directory 2019-10-19 12:03:04 +03:00
joe-conigliaro
c24d94f87f compiler: fix mistake in comptime.v (#2425)
* merge master
* fix mistake in comptime.v
2019-10-19 19:40:01 +11:00
joe-conigliaro
b51b8858d6 compiler: update & enable cflag error (#2420)
* merge master
* update & enable cflag error
2019-10-19 11:38:02 +11:00
joe-conigliaro
22c7438795 compiler: cflag error - closes #2406 (#2417)
* merge master
* fix blank ident & add cflag error
* undo cflag changes
* add missing brace
* undo change to comptime
* improve error message
* update
2019-10-19 08:18:08 +11:00
joe-conigliaro
28b24eeef6 compiler: blank ident error fixes + other small cflag / parser fixes (#2418)
* merge master
* fix blank ident & add cflag error
* undo cflag changes
* fix gen_js
* undo gen_js changes
* fix
* fix
2019-10-19 08:00:47 +11:00
Alexander Medvednikov
c18578af6f compiler: linux tcc fixes 2019-10-18 20:49:43 +03:00
Unknown User
1795d34a1f Makefile: use LDFLAGS 2019-10-18 20:22:47 +03:00
Swastik Baranwal
5c5cdea4f2 examples: V script 2019-10-18 20:18:30 +03:00
Danil-Lapirow
bb9d95e9aa parser: allow '' in attributes 2019-10-18 20:17:23 +03:00
joe-conigliaro
689003454b only register initial varg struct on first pass (#2404) 2019-10-18 19:28:14 +11:00
Alexander Medvednikov
368e8e85a8 compiler: info message when trying to use an old command 2019-10-18 09:56:57 +03:00
joe-conigliaro
6dea2359ab strconv: optimize functions
also make it the responsibility if the caller to properly trim whitespace
2019-10-18 08:20:03 +03:00
Alexander Medvednikov
c355e967ad move array filter codegen to comptime.v 2019-10-18 07:58:54 +03:00
Alexander Medvednikov
d501dc4c11 compiler: first step to validate cmd flags 2019-10-18 07:48:46 +03:00
Alexander Medvednikov
80e79a3966 array: optimized generic filter() 2019-10-18 07:30:39 +03:00
pfefferminz132
eda0c73bef compiler: use eprintln for cache diagnostic messages 2019-10-18 06:16:33 +03:00
joe-conigliaro
8d16762f03 strconv module + use it in builtin/string instead of C functions 2019-10-17 19:37:55 +03:00
Simon Ernst
270934441c os: make ls() return an optional 2019-10-17 14:30:05 +03:00
joe-conigliaro
4932a32d91 compiler: fix os import by default in v scripts 2019-10-17 11:52:46 +03:00
Cc
22e7e807f3 examples: fibonacci 2019-10-17 11:11:24 +03:00
Unknown User
f46b58b09d int: i64 hex() use PRIx64 2019-10-17 11:06:54 +03:00
joe-conigliaro
b32a462b2e math: new consts + helpers funcs for string to int / float 2019-10-17 09:04:57 +03:00
Alexander Medvednikov
5cd38ec91b V shell scripts 2019-10-17 08:27:27 +03:00
Vinicius Rangel
96152510e5 parser: interpolation calling twice fix
if string interpolation needs to call a function, it will cache the
return to .len & .str usage in the generated code
2019-10-17 07:02:02 +03:00
Vinicius Rangel
5481f226dd parser: Infinite multi-dimensional array 2019-10-17 06:52:58 +03:00
Alexander Medvednikov
5faa7e7861 Revert "repl: add readline for user input "
This reverts commit 83732642ac.
2019-10-17 03:37:30 +03:00
Henrixounez
83732642ac repl: add readline for user input 2019-10-16 18:38:07 +03:00
Henrixounez
99e07718da readline: fix reading on linux, crash on mac 2019-10-16 12:46:24 +03:00
joe-conigliaro
280ccfa177 math: fns for gettng bit repr of float & vice versa 2019-10-16 11:19:03 +03:00
Alexander Medvednikov
66f36be7d0 Revert "repl: readline line editing "
This reverts commit 1956c6f906.
2019-10-16 03:31:48 +03:00
Alexander Medvednikov
00fd1abf82 readline: fix macos 2019-10-16 03:20:40 +03:00
Alexander Medvednikov
526f1a3172 Revert "Revert "parser: fix programs without fn main""
This reverts commit 61af044316.
2019-10-16 03:20:16 +03:00
vitalyster
9b38f59184 msvc: detect x86 host and use x86 build tools 2019-10-16 02:54:35 +03:00
ytakahashi
c3e1ada405 examples: fix word_counter 2019-10-16 02:52:36 +03:00
Henrixounez
1956c6f906 repl: readline line editing 2019-10-16 02:50:48 +03:00
vitalyster
0e0f0ae5ea escape os.exec('"$vexec"') to support directories with spaces 2019-10-16 02:49:51 +03:00
Nicolas Sauzede
69b4594bb3 makefile: download tcc linux and windows only 2019-10-15 17:22:16 +03:00
Simon Heuser
a5d61f6da0 math.complex: make fields public 2019-10-15 12:43:28 +03:00
Alexander Medvednikov
49d6c26da4 parser: do not allow str[i++]; update contributing.md 2019-10-15 11:06:22 +03:00
Henrixounez
bb1eca3564 readline: basic mac and windows version using os.getline 2019-10-15 09:04:22 +03:00
Danny Feliz
195da8ef3f readme: more syntax highlighting 2019-10-15 09:03:21 +03:00
Simo Aleksandrov
8ebb3a0fb8 readme: Update syntax highlighting 2019-10-15 09:01:56 +03:00
Alexander Medvednikov
75e2a29cb5 string: bring back strtoul for now 2019-10-15 08:53:35 +03:00
Alexander Medvednikov
f9593bd857 builtin: float.v + remove #include <math.h> 2019-10-15 08:41:45 +03:00
Alexander Medvednikov
4b176ba855 string: test i64() and u64() 2019-10-15 04:26:19 +03:00
Alexander Medvednikov
10ed65bc12 fix float.eq() 2019-10-15 03:45:11 +03:00
Alexander Medvednikov
91690a1b54 fix f64 tcc eq crash 2019-10-13 04:27:57 +03:00
joe-conigliaro
ae3ec380f8 add notice about msvc compilation (#2340) 2019-10-14 18:36:29 +11:00
Alexander Medvednikov
83b18af69e readme: use v v.v 2019-10-14 10:26:11 +03:00
Nicolas Sauzede
eb031b6800 compiler: enhance non-pub struct fields error message 2019-10-14 10:15:21 +03:00
Alexander Medvednikov
2d127cb694 tcc windows fixes 2019-10-14 09:03:11 +03:00
Alexander Medvednikov
a68222b55b comptime: fix tcc check 2019-10-14 08:53:03 +03:00
joe-conigliaro
60e7c12e92 put back temp removed flags and env vars (#2339) 2019-10-14 16:51:12 +11:00
joe-conigliaro
9a2b8a0814 compiler: move msvc compiler to -cc flag instead of -os (#2338)
* move msvc to -cc flag instead of -os

* undo unrelated change

* do first build without msvc

* remvove flags temp

* fix comment
2019-10-14 16:41:46 +11:00
Alexander Medvednikov
093d8a2b00 compiler: remove math dependency 2019-10-14 08:34:48 +03:00
joe-conigliaro
7dc740d084 CI: fis vjs build failure (#2337)
* fix ci building v

* fix v.js

* more js fix

* test

* fix

* remove testing
2019-10-14 15:42:27 +11:00
joe-conigliaro
de10a529b0 CI: fix building v 2019-10-14 07:08:02 +03:00
Alexander Medvednikov
e2bca190a9 compiler: v.v fixes 2019-10-14 05:18:48 +03:00
Alexander Medvednikov
387e56e215 move compiler/main.v to v.v 2019-10-14 04:41:37 +03:00
joe-conigliaro
e5b0478e19 compiler: optimize, don't rescan module directory for files (#2334)
* optimize, don't rescan module directory for files
* move from table to v
2019-10-14 12:07:59 +11:00
Alexander Medvednikov
6a951751f7 compiler: fix building_v 2019-10-14 03:56:53 +03:00
Alexander Medvednikov
b237ffcf09 Revert "move compiler/main.v to v.v"
This reverts commit 3748de8736.
2019-10-14 03:48:36 +03:00
Alexander Medvednikov
5a80bf27f4 Revert "update makefile"
This reverts commit 4229892e29.
2019-10-14 03:48:26 +03:00
Alexander Medvednikov
4229892e29 update makefile 2019-10-14 03:40:18 +03:00
Alexander Medvednikov
3748de8736 move compiler/main.v to v.v 2019-10-14 03:38:06 +03:00
Delyan Angelov
47115fd579 compiler: remove setting of v.pref.building_v flag in compiler/main.v . It is not needed anymore. (#2330) 2019-10-14 09:19:49 +11:00
Alexander Medvednikov
61af044316 Revert "parser: fix programs without fn main"
This reverts commit bf21108fdb.
2019-10-13 17:55:12 +03:00
Alexander Medvednikov
b1806b57d8 tests: no main fn 2019-10-13 17:50:55 +03:00
joe-conigliaro
5dfdd87707 makefile: use just uname, not uname -o - osx has no -o (#2327)
* use just uname, not uname -s in makefile

* add mac detect
2019-10-14 01:15:12 +11:00
joe-conigliaro
a90427a663 parser: fix variadic function unused var C error 2019-10-13 16:58:54 +03:00
Delyan Angelov
53c64abdeb compiler: make compiler an ordinary vlib/compiler module
* Move compiler/ under vlib/compiler/ .

* Add a minimal compiler/main.v driver program.

* Cleanup compiler/main.v .

* Make most compiler tests pass again.

* Apply the fix by @joe-conigliaro , so that the rest of the compiler tests are fixed too.

* Thanks to @avitkauskas, now the vlib/vcompiler/tests/str_gen_test.v test does not need to be special cased anymore.

* Reapply @joe-conigliaro fix for vgen.
2019-10-13 16:37:43 +03:00
Nicolas Sauzede
59d4535f84 makefile: Detect Linux 2019-10-13 16:13:25 +03:00
joe-conigliaro
6e62d9709f prepare for compiler module rename (#2323) 2019-10-13 22:34:29 +11:00
Delyan Angelov
d3a206d6db compiler: prepare for moving compiler to vlib/vcompiler (stage 1)
* compiler: prepare for moving under vlib/vcompiler .

* make: stabilize the Makefile (extract rules for freshly cloning vc and tccbin).
2019-10-13 13:11:52 +03:00
Nicolas Sauzede
12eba4d311 makfile: remove tcc before clone 2019-10-13 12:13:07 +03:00
joe-conigliaro
8e90724684 compiler: optimize parse_lib_imports (#2319)
* optimize parse_lib_imports
* comment unused import
2019-10-13 15:11:40 +11:00
Alexander Medvednikov
039dafb30f ci: fix ubuntu-gcc 2019-10-13 04:55:57 +03:00
Alexander Medvednikov
9845fade89 use tcc on linux by default 2019-10-12 16:54:53 +03:00
joe-conigliaro
efe03a39cc parser: p.mod clean up 2019-10-13 03:05:11 +03:00
Alexander Medvednikov
ae2af4c36d parser: a small immutable field fix 2019-10-13 01:50:19 +03:00
joe-conigliaro
343dced36d parser: only check visibility of init function not method 2019-10-13 01:19:32 +03:00
Toby Webb
bf21108fdb parser: fix programs without fn main 2019-10-13 01:10:45 +03:00
Nicolas Sauzede
1292163637 runtime: add windows support for nr_cpus() 2019-10-13 01:01:15 +03:00
Alexander Medvednikov
432e074b4e fix complex_test.v 2019-10-12 22:39:18 +03:00
Alexander Medvednikov
208f17a73a disable the snake_case const warning for now 2019-10-12 22:38:06 +03:00
Alexander Medvednikov
a76165828b snake_case consts 2019-10-12 22:36:14 +03:00
Alexander Medvednikov
81f8b26127 os.path_separator 2019-10-12 22:18:19 +03:00
Alexander Medvednikov
9850193348 modules cache: reduce verbosity 2019-10-12 22:14:16 +03:00
Vitalie Ciubotaru
ae6a426689 bitfield: remove workaround in assignment operations 2019-10-12 22:03:18 +03:00
Simon Heuser
6860501994 parser: enable deferred stms for void and optional functions 2019-10-12 22:01:50 +03:00
Toby Webb
5d606000b9 scanner: fix Scanner.debug_tokens skipping first char 2019-10-12 21:33:53 +03:00
Simon Heuser
85c05b6822 parser: disallow or{} block for non-optionals 2019-10-12 17:53:53 +03:00
Swastik Baranwal
336e82d162 parser: _ warning => error 2019-10-12 14:21:06 +03:00
joe-conigliaro
a06e2298f0 compiler: detect and error on public init function & remove empty init functions 2019-10-12 13:54:58 +03:00
Delyan Angelov
065ce39577 compiler: -g and -debug should always add -g at least in the C compiler by default
* compiler: -g and -debug should always add -g at least in the C compiler by default.

* Set first the C backend debug_options, so that the optimization_options can override them later.

* Implement cleaner named is_debug, is_vlines, is_keep_c and is_cache options (i.e. -g/-cg, -keep_c, -cache v flags).

* Check and reset file/line numbers in the generated main program, only if v.pref.is_vlines is true.
2019-10-12 13:54:01 +03:00
joe-conigliaro
342e6a14a2 compiler: better detection of module path supplied to build module command (#2305)
compiler: better detection of module path supplied to `build module` command (#2305)
2019-10-12 20:48:57 +11:00
Don Alfons Nisnoni
5ef2c947f7 szip: use &zip instead of *zip (#2301) 2019-10-12 12:46:33 +03:00
joe-conigliaro
1e121d36a4 compiler: module cache. const init - fix implicit declaration of function warning (#2303)
compiler: module cache. const init - fix implicit declaration of function warning (#2303)
2019-10-12 17:53:42 +11:00
joe-conigliaro
40156392f8 compiler: cached modules - windows fixes & organise cached module path (#2302)
compiler: cached modules - windows fixes & organise cached module path (#2302)
2019-10-12 16:41:41 +11:00
joe-conigliaro
dd053d79b0 vlib/examples: fix gl/glfw/gg examples. rename init functions 2019-10-12 06:03:15 +03:00
Alexander Medvednikov
b107b4f1e5 modules: create the modules directory if it's missing, use cache/ 2019-10-12 05:04:59 +03:00
Toby Webb
acbca7584b parser: fix multiline strings with CRLF endings for Linux 2019-10-12 04:48:26 +03:00
joe-conigliaro
baeb2e3c0e compiler: module init, add init fn definition (#2298)
* test

* only call existing module init

* add back comment

* add def
2019-10-12 12:35:33 +11:00
Alexander Medvednikov
114fce4242 make.bat: a better info message 2019-10-12 04:19:28 +03:00
Alexander Medvednikov
155d692959 fix alias generation 2019-10-12 04:11:07 +03:00
Alexander Medvednikov
4c91a5c94b module caching: generate type aliases 2019-10-12 04:09:37 +03:00
Alexander Medvednikov
4cd9099f74 disable $if for headers for now 2019-10-12 03:49:36 +03:00
Alexander Medvednikov
6db7518189 make $if work with includes: skip the body if the target is different 2019-10-12 03:48:32 +03:00
joe-conigliaro
9faefe85e1 compiler: cached module - cleanup, remove unneeded code (#2297)
* test

* only call existing module init

* add back comment
2019-10-12 11:38:56 +11:00
Toby Webb
f461a21a50 compiler: fix v command to accept '.v' as valid file 2019-10-12 03:03:37 +03:00
joe-conigliaro
51388fea75 compiler: module init function & init consts for cached modules 2019-10-12 01:17:37 +03:00
Don Alfons Nisnoni
c7e47e6884 array: minor clean up 2019-10-12 00:06:30 +03:00
Delyan Angelov
2b087dbf95 backtraces: add source line numbers too on linux
* Add source line numbers to backtraces on linux.

* Fix -g (broken after token caching).

* reset the #line directives after all the v code is compiled

* cleanup p.cgen.line setting inside p.next() .

* Support windows filepaths like "C:\Users\travis\build\vlang\v\v.exe.tmp.c" inside generated #line directives.

* Try to diagnose better windows-gcc failing.

* Revert "Try to diagnose better windows-gcc failing."

* implement and use cescaped_path/1 .

* Use cescaped_path/1 consistently throughout compiler/ .
2019-10-12 00:04:42 +03:00
Alexander Medvednikov
c254c9842b glfw: bring back 64 bit glfw3.dll 2019-10-11 14:20:53 +03:00
Alexander Medvednikov
9193242a76 fix runtime module test 2019-10-11 14:16:02 +03:00
Alexander Medvednikov
af46bf515f glfw: bring back 64 bit glfw3.dll 2019-10-11 13:47:56 +03:00
Alexander Medvednikov
52c2fa44b8 runtime: nr_cpus() 2019-10-11 13:47:56 +03:00
Alexander Medvednikov
a280e98d7f fix the build 2019-10-11 06:57:08 +03:00
Alexander Medvednikov
726aaecc46 compiler: make V compilable wit the tcc backend 2019-10-11 06:49:53 +03:00
Alexander Medvednikov
c3787e17fd Revert "compiler: remove math dependency"
This reverts commit 67ae167013.
2019-10-11 05:37:26 +03:00
Don Alfons Nisnoni
942c56ca95 array: add reduce() method 2019-10-11 04:12:40 +03:00
Alexander Medvednikov
67ae167013 compiler: remove math dependency 2019-10-11 03:12:34 +03:00
Alexander Medvednikov
25ef0ee593 parser: remove an unnecessary line 2019-10-11 03:00:06 +03:00
Alexander Medvednikov
e7e0514379 no longer download vlib if it's missing 2019-10-10 23:20:41 +03:00
Alexander Medvednikov
e1dd4c19b5 compiler: cache modules if they are not built yet 2019-10-10 22:53:59 +03:00
vitalyster
a5ccc4673b http: handle and print socket errors 2019-10-10 20:24:36 +03:00
Delyan Angelov
4f4ac45670 performance_compare: support passing --vcrepo and --hyperfine_options
* support passing --vcrepo and --hyperfine_options. Streamline output.

* Compare the performance of compiling a simple hello world program too.

* Remove redundant vprod comparisons. Instead use v .
2019-10-10 20:10:41 +03:00
vitalyster
f86a52aae6 socket: reuse socket parameters in addrinfo hints 2019-10-10 20:09:43 +03:00
Delyan Angelov
e61dce6441 freetype: fix compiler warning about ctx._draw_text 2019-10-10 20:09:19 +03:00
vitalyster
e64609387d term: colors on Windows console
* isConsole moved to builtin is_atty function
* Windows console initialization moved to builtin.init
2019-10-10 20:08:36 +03:00
lhmwzy
de36b61931 compiler: fix symbol error in DragonFlyBSD 2019-10-10 20:05:22 +03:00
joe-conigliaro
f8fefd5a60 urllib: rem underscore methods from; add strings index_bytes 2019-10-10 20:04:11 +03:00
Delyan Angelov
f3abb9e682 fix 'v -debug examples/hello_world.v' 2019-10-10 20:02:32 +03:00
joe-conigliaro
1b79964827 compiler: allow -debug to work with no prebuilt modules. only use when prebuilt files exist (#2283)
* only use prebuilt modules if they exist (builtin)
2019-10-10 23:00:18 +11:00
Alexander Medvednikov
7423b21429 cc: fix -g 2019-10-10 04:05:27 +03:00
Alexander Medvednikov
48e13a3362 a small cached modules fix 2019-10-10 03:48:11 +03:00
Alexander Medvednikov
4d941b5fdb make V compile itself using cached modules: ~0.3s speed-up 2019-10-10 03:36:27 +03:00
Alexander Medvednikov
2ee252be5f fix vid compilation 2019-10-10 01:46:05 +03:00
Alexander Medvednikov
9385ed27ae fix v.js 2019-10-10 01:27:16 +03:00
Alexander Medvednikov
1f6535afb0 array/map: remove _get(), _push() etc 2019-10-10 01:15:19 +03:00
Alexander Medvednikov
cdfb7428c8 array/map: use get() instead of _get() etc 2019-10-10 01:07:00 +03:00
Alexander Medvednikov
52168d0781 fix table.v 2019-10-10 00:56:33 +03:00
Alexander Medvednikov
2411b8d1e7 module cache fixes; do not allow function names starting with _ 2019-10-10 00:44:26 +03:00
vitalyster
0796e1dd69 socket: no need to initialize WinSock on each request 2019-10-09 21:01:31 +03:00
joe-conigliaro
febd532c4a parser: allow multi returns in high order fns 2019-10-09 20:55:36 +03:00
joe-conigliaro
236b34c009 parser: fix single decl/assign bug & update error msg 2019-10-09 20:54:52 +03:00
Alexander Medvednikov
b1da59845e array: fix initialization of empty fixed size arrays 2019-10-09 15:26:30 +03:00
sunnylcw
2403abe1ee compiler: Add C headers to avoid undefined symbol error in FreeBSD 2019-10-09 14:28:30 +03:00
joe-conigliaro
909d3eed0a parser: allow all return types when fn used as param ) 2019-10-09 14:27:23 +03:00
Alexander Medvednikov
80a6d78595 fix msvc build 2019-10-09 07:22:33 +03:00
Alexander Medvednikov
3f1d7e1260 fix msvc build 2019-10-09 07:15:42 +03:00
Alexander Medvednikov
d8622dd3e5 fix msvc build 2019-10-09 07:10:33 +03:00
Alexander Medvednikov
29f578d172 cc: bring back os.rm() 2019-10-09 07:02:45 +03:00
Alexander Medvednikov
7690b58691 remove experimental os2 test 2019-10-09 06:41:55 +03:00
Alexander Medvednikov
a9a73d9315 caching modules: almost there 2019-10-09 06:35:58 +03:00
Delyan Angelov
dbd72ee828 v test: add ability to test a folder or a set of _test.v files
* v test: support for running 'v test folder/' .

* Support passing multiple folders and also single _test.v files to 'v test' .

* Update vhelp too, with descriptions of v test folder/ and v -stats .

* Fix running `v test v` from outside the root of the v tree.
2019-10-09 06:01:43 +03:00
joe-conigliaro
f570cbfca8 http/win: fix schannel from crashing 2019-10-09 01:59:23 +03:00
Anders Busch
c620da9089 compiler: rename Tok/Token to Token/TokenKind 2019-10-09 01:05:34 +03:00
joe-conigliaro
89ea8a0275 parser: fix regression with blank identifier & decl assign 2019-10-08 19:26:07 +03:00
Unknown User
c1eb714a7f bitfield: change [0;n] to [0].repeat(n) 2019-10-08 13:24:02 +03:00
Unknown User
6edc25f512 pg: remove unused imports 2019-10-08 13:23:39 +03:00
Don Alfons Nisnoni
fecf3f19c3 array: add filter() method 2019-10-08 13:23:17 +03:00
vitalyster
e10848e0d5 windows: read console with ReadConsole when it is not redirected 2019-10-08 12:29:09 +03:00
joe-conigliaro
b4bf12378e fix newline being added when using print with int 2019-10-08 09:52:11 +03:00
vitalyster
0963328aed windows: make redirected console detection available to other modules 2019-10-08 03:11:26 +03:00
Delyan Angelov
60d4f47f7a improve crash diagnosis/detection when a test segfaults 2019-10-08 02:34:55 +03:00
joe-conigliaro
9defbf989d compiler: improve module import error messages 2019-10-08 02:32:12 +03:00
Unknown User
64349b5006 make.bat: use C99 2019-10-07 23:22:32 +03:00
joe-conigliaro
8fea5170be compiler: multiple return - allow mut decl & disallow assignment with deceleration (#2251) 2019-10-07 21:19:44 +11:00
Delyan Angelov
ac5241b5bd compiler: implement -stats option for running a _test.v file
* Draft implementation of `v -stats file_test.v` .

* compiler: call stuff in vlib/benchmark/tests/always_imported.v, when doing `v -stats file_test.v`

* Nicer looking output from 'v -stats file_test.v' .

* Tweak colors and layout of -stats file_test.v .

* Fix a hardcoded path in compiler/main.v .

* Show colorized OK/FAIL for the examples in 'v test v' too.

* Add some comments about the purpose of the methods inside vlib/benchmark/tests/always_imported.v .

* when fails are 0, do not colorize their number at all.
2019-10-07 08:51:26 +03:00
Alexander Medvednikov
f1923d454c parser: make verbose mode less verbose 2019-10-07 01:25:53 +03:00
Alexander Medvednikov
fdef2b0f8b makefile: use C 99 standard 2019-10-06 17:35:14 +03:00
Henrixounez
30e7cd8ed5 repl: handle print and one-line conditions 2019-10-06 17:21:10 +03:00
Alexander Medvednikov
03bc5ab3d5 compiler: use the new optimized in 2019-10-06 16:56:22 +03:00
Henrixounez
5acadbab32 readline: optional return, automatic raw mode and standalone functions 2019-10-06 16:28:41 +03:00
Alexey Lustin
aaf286ec5e fix find vsdevcmd.bat in VS2019Preview 2019-10-06 16:27:50 +03:00
Enrico Lefass
b0573bd4e4 time: add new public format function ddmmy() 2019-10-06 16:24:37 +03:00
Delyan Angelov
cd5431575a compiler: fix -obf regression (main__main) 2019-10-06 16:23:52 +03:00
Alexander Medvednikov
b242e8d7ff optimize a in [1,2,3] to a == 1 || a == 2 || a == 3 2019-10-06 06:07:38 +03:00
Alexander Medvednikov
62133c6ffa Create CODE_OF_CONDUCT.md 2019-10-06 04:43:48 +03:00
Alexander Medvednikov
883be6ae88 Delete CONDUCT.md 2019-10-06 04:43:33 +03:00
Alexander Medvednikov
65aafb3cf1 3d arrays are not supported yet 2019-10-06 04:18:55 +03:00
Alexander Medvednikov
6a0599b5f4 raw strings with r'raw' 2019-10-06 04:11:08 +03:00
Delyan Angelov
ebc50432c7 compiler: initializing fixed arrays with [1,2,3] 2019-10-06 03:07:02 +03:00
joe-conigliaro
22f162c3cd parser: multiple returns, allow assignment as well as deceleration closes 2019-10-05 19:17:08 +03:00
Alexander Medvednikov
735336e569 array: 2d and 3d test 2019-10-05 16:03:19 +03:00
Yohanan Baruchel
136ede989f readme: grammar fix 2019-10-05 15:59:34 +03:00
Delyan Angelov
9a0a8e89fb compiler: generate a v.c that is compatible with latest tcc 2019-10-05 15:46:13 +03:00
joe-conigliaro
72ae12877e remvoe dupe in main & fix js string.builder (#2233) 2019-10-05 18:07:10 +10:00
joe-conigliaro
a62dec2053 compiler: remove unneeded field & manually add parser to v.parsers (#2232)
compiler: remove unneeded field & manually add parser to v.parsers (#2232)
2019-10-05 16:52:50 +10:00
Alexander Medvednikov
e14861694c another v.js fix 2019-10-05 08:03:26 +03:00
Alexander Medvednikov
ed99fc2d42 v.js: fix strings.Builder 2019-10-05 07:40:32 +03:00
joe-conigliaro
24136ab88b compiler: get existing parser using path 2019-10-05 07:10:28 +03:00
Don Alfons Nisnoni
68bcf6830c array: add index() method 2019-10-04 23:07:19 +03:00
unknown-v
19c7b95d00 add *.exp & *.ilk to .gitignore (#2230) 2019-10-04 23:06:26 +03:00
ylluminate
ce5ee57ef8 Update CONTRIBUTING.md with workflow example
* Update CONTRIBUTING.md with workflow example

Added [@spytheman's example](https://discordapp.com/channels/592103645835821068/592106336838352923/627559453788733440). Please review @spytheman and @medvednikov with any improvements or updates and clarifications! :) Hope this helps.  I'm sure I can make things a little more consistent or improve formatting a little, but I wanted to get this at least somewhere where we won't forget to share it.

* Update CONTRIBUTING.md

Additional tweaks as per comments.
2019-10-04 23:06:10 +03:00
Alexander Medvednikov
0525e6f76a ci: build V using V 2019-10-04 17:30:47 +03:00
Nicolas Sauzede
433e69e560 makefile: Recompile V itself also for nix, if needed
* Only self rebuild if v.c and v HEAD versions differ
2019-10-04 16:12:54 +03:00
joe-conigliaro
549413b48b compiler: no more mem error, so recycle import table struct 2019-10-04 16:12:16 +03:00
Delyan Angelov
f43c4fd81c tools/performance_compare: speed it up and make it more robust
* tools/performance_compare is now more robust. It uses the C source from the time of the v commit, instead of always the latest one. It also now clones https://github.com/vlang/vc just once per comparison, not for every build.

* Remove obsoleted tools/compare_v_performance_between_commits shell script.
2019-10-04 16:11:29 +03:00
vitalyster
d2c5b6d964 msvc: generate PDB for prod builds 2019-10-04 16:09:45 +03:00
Alexander Medvednikov
52f4f4026b compiler: cache modules 2019-10-04 15:48:09 +03:00
Alexander Medvednikov
f45d3f07ed fix 3 last C warnings and make sure no new warnings are introduced 2019-10-04 05:49:41 +03:00
hazohelet
ac7824b669 parser: delete dead code 2019-10-03 07:06:40 +03:00
Alexander Medvednikov
745413331b Revert "remove accidental duplicate code"
This reverts commit 7eaf289e33.
2019-10-03 02:41:48 +03:00
Alexander Medvednikov
7eaf289e33 remove accidental duplicate code 2019-10-03 02:21:38 +03:00
Alexander Medvednikov
9d57599b33 vhelp.v: -shared 2019-10-03 02:02:06 +03:00
unknown-v
b3805140ec Remove json_test.exp & json_test.lib 2019-10-03 02:00:11 +03:00
Delyan Angelov
fce4199412 compiler: let methods return voidptr without a segfault 2019-10-03 01:28:24 +03:00
Swastik Baranwal
7d763e0776 fix js build 2019-10-02 15:46:08 +03:00
Alexander Medvednikov
08fd62339e scanner: fix string interpolation in " strings 2019-10-02 15:31:44 +03:00
Alexander Medvednikov
96c3f10a0e 1 2019-10-02 15:31:03 +03:00
Alexander Medvednikov
5ba354fa2c if a := foo() { syntax for handling optionals 2019-10-01 22:57:38 +03:00
hazohelet
56e4ed1e6b compiler: float comparison uses machine epsilon by default 2019-10-01 22:38:36 +03:00
hazohelet
f35f6083cd add C default comparison operator macros for future bitwise comparisons 2019-10-01 21:21:05 +03:00
hazohelet
30ca149be7 table.v: fix typo 2019-10-01 18:08:10 +03:00
joe-conigliaro
7fd2ef975b parser: add v error if assigning var to blank identifier _
also fix C warn & double semicolon
2019-10-01 15:40:11 +03:00
Delyan Angelov
b7d1a175a8 compiler: print relative paths for user code 2019-10-01 15:39:19 +03:00
joe-conigliaro
9e7ee40477 compiler: fix expression in multiple return 2019-10-01 14:53:52 +03:00
joe-conigliaro
8fe0e88c05 parser: fix multi return with multiple blank identifiers 2019-10-01 14:49:15 +03:00
joe-conigliaro
282cd44cec compiler: variadic fn - improve error, fix bug when only arg is varg 2019-10-01 14:48:19 +03:00
unknown-v
ceee2923dd remove freetype submodule 2019-10-01 14:44:37 +03:00
Delyan Angelov
f332e858d1 compiler: enhanced wording of obsolete import const error message 2019-10-01 14:43:26 +03:00
Delyan Angelov
2ac80485c0 C backend: fix a couple of C warnings on Linux 2019-10-01 14:35:59 +03:00
Alexander Medvednikov
243626c7c1 readline: capitalize structs 2019-10-01 06:28:06 +03:00
Alexander Medvednikov
841d824216 builtin: a very early version of the hashmap 2019-10-01 06:20:50 +03:00
Alexander Medvednikov
d535e78c98 october.plan 2019-10-01 01:51:19 +03:00
ylluminate
061da15d0b Fix CHANGELOG.md typo 2019-10-01 00:17:54 +03:00
Alexander Medvednikov
aaba7fdb29 download vlib if it is missing 2019-09-30 23:56:53 +03:00
Alexander Medvednikov
2aa6ab71db darwin: no need to free the buffer 2019-09-30 23:29:53 +03:00
Tony Kostanjsek
39cfb1d6a6 darwin: resource_path() 2019-09-30 23:29:14 +03:00
Alexander Medvednikov
223032f0ce V 0.1.21 2019-09-30 22:39:52 +03:00
Alexander Medvednikov
fa7e0ce58a make v test v work in any directory 2019-09-30 21:58:02 +03:00
Zaoqi
21f39f3e7f travis: xcode11 2019-09-30 19:51:25 +03:00
joe-conigliaro
7311db60a0 compiler: vargs - for loop support & indexing / dot fixes 2019-09-30 17:11:12 +03:00
Alexander Medvednikov
5ac62bbb75 Update README.md 2019-09-30 15:45:05 +03:00
joe-conigliaro
f7c8e923c0 compiler/lang: add variadic function args support 2019-09-30 13:46:50 +03:00
joe-conigliaro
5fb3c0e3a8 compiler: add error when embedding struct in itself 2019-09-30 13:41:11 +03:00
joe-conigliaro
a5b4ed2909 compiler: typo in module name erroneously reports "import cycle" 2019-09-30 13:40:19 +03:00
Delyan Angelov
e72fe25224 compiler: more precise 'declared and not used' error positioning
* compiler: extract and cleanup error handling functionality into its own file compiler/compile_errors.v

* compiler: implement p.error_with_token_index and p.warn_with_token_index and use them. Fix tests.

* tools/performance_compare: add a 'Source lines in compiler/' line

* MSVC does not have STDOUT_FILENO nor STDERR_FILENO ...
2019-09-29 20:37:39 +03:00
hazohelet
6d483c0a56 parser: float1 == float2 uses machine epsilon by default 2019-09-29 18:27:53 +03:00
hazohelet
21f9dc6b7c cheaders: add DEFAULT_EQUAL for future float eqbit() 2019-09-29 17:39:38 +03:00
Alexander Medvednikov
83022a2478 fix pushing to mutable array args 2019-09-29 17:02:28 +03:00
joe-conigliaro
918edad525 crypto: make sum methods safe 2019-09-29 16:44:52 +03:00
Don Alfons Nisnoni
a1f0e940b7 add .vrepl_temp.v to .gitignore and fix some grammar 2019-09-29 13:58:37 +03:00
Alexander Medvednikov
ee8ff39454 rename ModPath to v_modules_path; do not allow long variable names without _ 2019-09-29 05:34:17 +03:00
Delyan Angelov
8b8cd13929 parser: add some infrastructure for more specific errors
* compiler: change s.line_nr in just one place, so that s.last_nl_pos will be updated in tandem too.

* Cleanup spurious spaces.

* Store ScannerPos info inside the cached tokens.

Use the stored information when errors are encountered.

* Fix #2079 ( cannot use type...in assignment ).

* do not store scannerpos per each token, instead rescan the source once on error to get the position.

* compiler: implement highlighting for errors. Use only line/col info stored in the cached tokens.

* fixing building on windows

* Split can_show_color to _nix and _win files.
2019-09-29 04:33:23 +03:00
Alexander Medvednikov
cbf5de7c8f PR template: add a test if you fixed a bug 2019-09-29 04:28:57 +03:00
Alexander Medvednikov
d68e31a863 fix os_win.v 2019-09-29 04:16:15 +03:00
Alexander Medvednikov
a52662fca0 do not allow duplicate methods; fix os_win.v; minor fixes and docs 2019-09-29 04:13:32 +03:00
Alexander Medvednikov
d482b1f824 struct capitalization: fix the rest of tests 2019-09-28 22:26:44 +03:00
Alexander Medvednikov
ed93185cb7 fix base64 test 2019-09-28 22:23:22 +03:00
Alexander Medvednikov
9eac16b976 parser: struct names must be capitalized 2019-09-28 22:20:34 +03:00
Delyan Angelov
a4cbe78d97 compiler: streamline main function handling
* compiler: streamline C main function generation

* fix most tests

* compiler: fix for 'go update()' in graph.v . More precise parser error messages.

* Fix temporarily examples/hot_reload/message.v by using os inside it (os.clear).

* Make graph.v easier to quickly modify by defining y outside the loop.

* Fix failure of /v/nv/compiler/tests/defer_test.v when run with 'v -g' (#line directive was not on its own line, but right after } ).

* Do not pass the os.args to tests, even if the tests import os (they are more stable when run in a controlled environment).

* fix declared and not used in the js backend.

* fix js main => main__main too.
2019-09-28 20:42:29 +03:00
Delyan Angelov
0160c7a89d compiler: change s.line_nr in just one place in tandem with s.last_nl_pos
* compiler: change s.line_nr in just one place, so that s.last_nl_pos will be updated in tandem too.

* v test v: run repl tests again

* Show gcc version in both windows gcc cases in a) github actions, and b) travis .

* adding inline to is_name_char is_nl and contains_capital does not help actually, just increases slightly binary size.

* Cleanup spurious spaces.
2019-09-28 20:41:11 +03:00
joe-conigliaro
ed3a4961d0 compiler: blank identifier for loops. dont declare any variables 2019-09-28 19:53:56 +03:00
Swastik Baranwal
7952d591b9 parser: Update Division or Modulo by Zero Message 2019-09-28 19:52:52 +03:00
Alexander Medvednikov
d59d921e84 disable the vget test for now 2019-09-28 15:18:48 +03:00
Alexander Medvednikov
e19b630ab1 disable the vget test for now 2019-09-28 15:00:51 +03:00
Alexander Medvednikov
0bfb88e2e6 fix the vget test 2019-09-28 14:58:24 +03:00
Alexander Medvednikov
dc28c787d1 travis: re-write the vget test in V 2019-09-28 14:40:09 +03:00
Dongliang Ma
46ac22f3e5 vget fixes
* refactor(tools): remove trailing spaces in vget.v

* refactor(tools): fix mix tabs and spaces

* fix(tools): vget should exit non-zero when call with invalid arguments

* refactor(tools): extract vmodules directory create and chdir logic

* feat(tools): add travis-ci check to vget
2019-09-28 14:21:52 +03:00
sunnylcw
4b03abdaff compiler: enable FreeBSD's cflags for freetype & glfw 2019-09-28 14:18:04 +03:00
Delyan Angelov
366c50674c tooling: add tools/compare_v_performance_between_commits
easily compare v performance/size across commits.

* fix eprintln on linux (it now uses stderr, and flushes it).

* flag: cleaner usage information.
2019-09-28 14:17:16 +03:00
lutherwenxu
5c79c0e743 compiler: enforce reserved keywords replacement
* compiler: Enforce reserved keywords replacement on empty value initialization

* compiler: Add test for reserved keywords enforcement

A new struct has been introduced in the tests that contains all C reserved keywords that are not reserved in V. Some read and write are tested too.
2019-09-28 14:13:09 +03:00
hazohelet
fd2d9c214c f64: fix .eq() 2019-09-28 14:04:03 +03:00
joe-conigliaro
fbd414fd2f crypto.md5: fix u64 modulus operation 2019-09-28 14:02:57 +03:00
joe-conigliaro
0fc9ada0aa parser: use actual blank ident for consts 2019-09-28 13:59:54 +03:00
Delyan Angelov
6bba4b1be0 string: document the tradeoffs for V strings 2019-09-28 13:54:30 +03:00
Alexander Medvednikov
60eb73adb4 array: single element array test 2019-09-28 13:52:38 +03:00
luoheng
5348c667cc compiler/parser: fix single element in array error 2019-09-28 13:50:30 +03:00
lutherwenxu
a4d2633a33 string: Properly null-terminate repeated string 2019-09-28 13:31:12 +03:00
joe-conigliaro
802da8f31d compiler: clean up. remove new_parser_string_id (#2140)
* clean up

* fix comment

* fix comment
2019-09-28 04:56:05 +03:00
Alexander Medvednikov
a5391c8882 string.repeat: re-write without a libc function call 2019-09-28 02:51:42 +03:00
Alexander Medvednikov
1821dac795 compiler: remove old generics hack; disable generics and repl tests for
now
2019-09-28 02:29:04 +03:00
unknown-v
7c83c0569f make.bat: del v3.exe after gcc bootstrap 2019-09-27 21:42:42 +03:00
Alexander Medvednikov
dd58298500 compiler: fix interfaces after the recent tokens change 2019-09-27 21:01:08 +03:00
unknown-v
14a8d4ae3c parser: replace "≠" with "!=" 2019-09-27 18:55:30 +03:00
Alvydas Vitkauskas
931b71c428 string: improve repeat() 2019-09-27 15:49:09 +03:00
joe-conigliaro
ad99b82930 compiler: make vgen use strings.Builder & allow parser creation from string 2019-09-27 14:02:01 +03:00
Alexander Medvednikov
8cbfd7a9da parser: partial interface fix 2019-09-27 06:03:54 +03:00
Alexander Medvednikov
8f9c0b621e parser: fix columns in errors 2019-09-27 05:27:57 +03:00
Alexander Medvednikov
da43267e09 parser: cached tokens (second step) 2019-09-27 04:01:12 +03:00
Alexander Medvednikov
a45255337d bring back "parser: cache tokens (first step)"
This reverts commit 0fcdd7db35.
2019-09-27 04:00:48 +03:00
vitalyster
a1e45e3247 darwin: use system ssl headers 2019-09-27 01:35:25 +03:00
Alexander Medvednikov
367f8d6130 solaris: add -lm 2019-09-27 00:53:57 +03:00
Alexander Medvednikov
74bbf592d1 solaris: another fix 2019-09-27 00:30:41 +03:00
Alexander Medvednikov
fcf8f7fc93 solaris: small fix 2019-09-27 00:24:15 +03:00
Alexander Medvednikov
107e9107c8 solaris support 2019-09-27 00:23:27 +03:00
Don Alfons Nisnoni
fb4f14ba76 string: add repeat() method 2019-09-26 22:54:53 +03:00
vitalyster
9834ccfcd9 windows: Unicode and IPv6 http/sockets
cleanup schannel implementation (drop NT4.0 compatibility, use unicode strings, etc)
restore http tests
fix socket test: it did not throw before
2019-09-26 22:54:15 +03:00
Delyan Angelov
22d91148ca compiler: passing -g3 adds mode debug info 2019-09-26 21:58:08 +03:00
joe-conigliaro
47da52b85b crypto.[sha256/sha512]: remove extraneous casts & use rotations from math.bits 2019-09-26 16:38:12 +03:00
joe-conigliaro
c069525e8c crypto.[md5/rc4/sha1]: remove extraneous casts 2019-09-26 14:57:31 +03:00
joe-conigliaro
f1f720cc78 pg: update optional return syntax 2019-09-26 14:23:29 +03:00
joe-conigliaro
896f978b94 crypto.aes: remove extraneous casts 2019-09-26 14:22:47 +03:00
joe-conigliaro
a5ea7e4304 math.bits: remove extraneous casts 2019-09-26 14:14:04 +03:00
joe-conigliaro
157ef46d5a parser: fix a few things in with blank ident 2019-09-26 14:09:59 +03:00
Alexander Medvednikov
0fcdd7db35 Revert "parser: cache tokens (first step)"
This reverts commit 8992707fbb.
2019-09-26 06:05:18 +03:00
Alexander Medvednikov
8992707fbb parser: cache tokens (first step) 2019-09-26 05:20:08 +03:00
Alexander Medvednikov
04e4018228 compiler: small fixes + some logic for freeing strings 2019-09-26 03:24:58 +03:00
Don Alfons Nisnoni
b1f0df0fd1 mysql: make compile 2019-09-26 03:18:26 +03:00
Delyan Angelov
33df5edc08 http: remove const started, use _ instead 2019-09-25 23:58:32 +03:00
Delyan Angelov
ab291902d8 compiler: remove special case for http__init_module call
tmp fix until `fn init()` is supported
2019-09-25 23:28:51 +03:00
Alexander Medvednikov
4c898ab6b3 strings: simplify repeat() 2019-09-25 22:08:51 +03:00
Delyan Angelov
3fbfc5fbd4 repl: tests show difference (in color where available) 2019-09-25 22:00:56 +03:00
joe-conigliaro
d4bae356ba compiler/vlib: add error for no new vars in loop ("_,_") & remove "." from errors 2019-09-25 17:59:50 +03:00
joe-conigliaro
a124d1f0eb CI: apt update 2019-09-25 15:41:34 +03:00
joe-conigliaro
8974aa4513 compiler/vlib: change _ := to _ = and disable _ := 2019-09-25 15:10:45 +03:00
joe-conigliaro
746655c1d5 compiler: re assignable blank identifier _ & no longer a variable 2019-09-25 14:53:44 +03:00
Alexander Medvednikov
ab52b453cb map: make .keys() pure 2019-09-25 05:56:10 +03:00
Alexander Medvednikov
55d09d23b4 compiler: rename cerror() to verror(); some small optimizations 2019-09-24 19:38:04 +03:00
joe-conigliaro
3317d7fd7c compiler: clean up multiple returns and verify number of returned values 2019-09-24 13:14:04 +03:00
joe-conigliaro
a44a03f9a5 compiler: fix mark_var_used() 2019-09-24 06:18:06 +03:00
Alexander Medvednikov
f7d8fb0cf4 string: bring back old index() without an allocation 2019-09-23 23:34:42 +03:00
Alexander Medvednikov
d74c91616f remove all p.log()'s 2019-09-23 23:18:55 +03:00
Alexander Medvednikov
d2d75f3824 parser: do not allow "int?", only "?int" 2019-09-23 23:17:06 +03:00
Alexander Medvednikov
f27f3515ae compiler: optimize mark_var_used() etc 2019-09-23 23:06:40 +03:00
Alexander Medvednikov
8d52d877fb compiler: free local_vars 2019-09-23 22:16:52 +03:00
Delyan Angelov
0e39df24d4 net: make socket.recv return the allocated buffer and the message length 2019-09-23 19:48:18 +03:00
Alexander Medvednikov
bf1ee28194 ui: Objective-C @interface support for Cocoa; minor clean-ups 2019-09-23 15:54:17 +03:00
joe-conigliaro
fbc19311b5 compiler: clean up get_file_import_table 2019-09-23 15:12:23 +03:00
joe-conigliaro
422ba3a3ce compiler: unused module check always 2019-09-23 15:11:05 +03:00
Alexander Medvednikov
69b498d85d CI: bring back vid test 2019-09-23 13:56:25 +03:00
Henrixounez
db44004d51 readline: utf8 compatibility 2019-09-23 13:43:24 +03:00
joe-conigliaro
23c84516e2 compiler: error on unused imports 2019-09-23 13:42:20 +03:00
Ideriha
71484e89d6 readme: How to exit from REPL doesn't match actual output of REPL 2019-09-23 13:41:17 +03:00
joe-conigliaro
090ca27b15 compiler: improve module typo error message 2019-09-23 13:40:18 +03:00
joe-conigliaro
23e30962b9 compiler: multiple returns - add test & fix use with array/map 2019-09-23 13:39:35 +03:00
joe-conigliaro
60d932e57d compiler: functions with multiple returns 2019-09-23 05:45:19 +03:00
Alexander Medvednikov
a0c5113611 readme: bring back the Travis badge
it's good to have 2 CI setups just to be sure
2019-09-23 02:32:19 +03:00
Alexander Medvednikov
b10886bc21 Revert "remove Travis: GitHub CI is a lot faster and more reliable"
This reverts commit 9d1814ab81.
2019-09-23 02:18:45 +03:00
Alexander Medvednikov
b4207e1be7 compiler: allow "u64_var == 0" without casting the const literal 2019-09-23 02:14:10 +03:00
Delyan Angelov
a585c8c22c compiler: compile thirdparty object files using module specific flags 2019-09-23 00:51:59 +03:00
joe-conigliaro
7aaf4012e4 math.bits: add missing pub to fn's 2019-09-23 00:51:03 +03:00
Delyan Angelov
1b91b31698 rand: add pcg32 and splitmix64 implementations 2019-09-23 00:50:22 +03:00
Swastik Baranwal
ab528bb043 changelog typo 2019-09-22 17:24:44 +03:00
Delyan Angelov
7421781150 CI: split jobs into more steps; compiler: fix "v test v" with tcc 2019-09-22 17:24:15 +03:00
Delyan Angelov
049e228003 compiler: pass -cflags to thirdparty building stage too 2019-09-22 10:56:02 +03:00
Alexander Medvednikov
cec2173381 array: fix memory bug with mutable array args 2019-09-22 10:33:47 +03:00
Alexander Medvednikov
45e9a8fd66 readme: remove travis badge 2019-09-22 10:06:15 +03:00
Alexander Medvednikov
9d1814ab81 remove Travis: GitHub CI is a lot faster and more reliable 2019-09-22 10:02:28 +03:00
Alexander Medvednikov
6a788bb364 testing: do not allow fn main in tests and make sure there is at least one test fn 2019-09-22 09:49:33 +03:00
Zaoqi
104e4c9fc7 github actions: simplify ci.yml, test js backend on windows 2019-09-21 18:34:17 +03:00
luoheng
f1d5f8e2bf parser: allow ! only with bools 2019-09-21 18:21:45 +03:00
Alexander Medvednikov
c01edc650d 0.1.21 changelog 2019-09-21 17:42:38 +03:00
Alexander Medvednikov
a232b215a7 double quotes for denoting strings 2019-09-21 17:18:02 +03:00
joe-conigliaro
b1e1536d56 compiler: fix live reload on win with auto completed filename .\file.v 2019-09-21 17:08:48 +03:00
Michiel Vlootman
9b7ca248f0 similarity.v: update a comment 2019-09-21 14:59:06 +03:00
Alexander Medvednikov
15bf3f2eb8 readme: fix CI link 2019-09-21 14:34:22 +03:00
joe-conigliaro
0d88e122be github actions: one os for each except win (GCC/MSVC) 2019-09-21 04:56:26 +03:00
vitalyster
111007470e array: malloc => calloc 2019-09-21 02:29:09 +03:00
Nicolas Sauzede
56e880117e fix windows printf output to match standard unix line buffering 2019-09-21 01:29:11 +03:00
Alexander Medvednikov
90e26a34c5 scanner: better interpolation names + disable vweb html test for now 2019-09-21 01:27:13 +03:00
Alexander Medvednikov
6ebd62020a double quote 2019-09-21 01:23:53 +03:00
Alexander Medvednikov
ecc8728643 vweb: allow running vweb apps from a different directory 2019-09-21 01:17:52 +03:00
Alexander Medvednikov
79abc0c16f vweb: fix html example 2019-09-21 01:10:37 +03:00
Alexander Medvednikov
d51622d721 readme: github actions CI badge 2019-09-20 20:49:53 +03:00
Henrixounez
ffcff9ebd4 builtins: ustring comparisons, concatenation and other functions 2019-09-20 19:07:38 +03:00
Zaoqi
fd68c44dfa Add Github Actions 2019-09-20 19:05:53 +03:00
iRedMail
55720e7f98 tetris: add "module main" 2019-09-20 19:05:14 +03:00
joe-conigliaro
d80a3365c4 math.bits: add some more helpers, to be used in upcoming biginteger 2019-09-20 17:39:36 +03:00
Zaoqi
5a03eaca89 .gitignore: prepend / 2019-09-20 17:06:00 +03:00
vitalyster
a42b4e219c net.socket: windows fixes and test
* added missing ai_canonname in addrinfo structure
* ai_canonname, ai_addr and ai_addrlen must be zeroed before getaddrinfo call
* write() must not be used on windows sockets
* added (Socket).get_port() function which is useful when socket was initialized with 0 (random) port
* tests is fixed, test server started listening on random port to avoid conflicts
2019-09-20 17:04:39 +03:00
vitalyster
f1bb25bfaf windows: Unicode input in REPL 2019-09-20 17:03:13 +03:00
Delyan Angelov
f042dfb861 compiler: fix line numbers in unused variable error messages 2019-09-20 13:42:37 +03:00
joe-conigliaro
f657d70a67 typo detection: only check fn variables in same or higher scope 2019-09-20 12:23:42 +03:00
joe-conigliaro
ba4ea351c7 bootstrap: add BSD makefile 2019-09-20 12:22:54 +03:00
Alexander Medvednikov
9a7fface7d make the unused variable error a warning in non-production builds 2019-09-19 19:50:43 +03:00
Alexander Medvednikov
b6bb6a5a60 do not allow go print() 2019-09-19 18:02:31 +03:00
Alexander Medvednikov
c8a781bf77 disable -compress on windows 2019-09-19 16:05:17 +03:00
Alexander Medvednikov
afb372bbdf -compress option 2019-09-19 15:52:38 +03:00
Alexander Medvednikov
ad6ab39287 table: use ?Var in find_const() 2019-09-19 14:19:44 +03:00
Alexander Medvednikov
f629069572 autofree: free strings 2019-09-19 14:04:27 +03:00
joe-conigliaro
486b3d2f92 crypto.rand: fix rand test from failing sometimes 2019-09-19 13:12:40 +03:00
joe-conigliaro
153c6d5416 compiler: fix v up when run from dir with space in name 2019-09-19 13:11:25 +03:00
Alexander Medvednikov
a94c1556ce array: remove temporary repeat2() 2019-09-19 05:22:24 +03:00
Alexander Medvednikov
cb31eeec55 compiler: first step to require explicit definition of imported C fns 2019-09-19 05:16:25 +03:00
Alexander Medvednikov
13e4c79f58 table: use optional in find_method() 2019-09-19 04:56:22 +03:00
vitalyster
059cb9cb74 cleanup make.bat and .travis.yml 2019-09-19 00:05:07 +03:00
vitalyster
377956e969 js: no need to generate ES6 classes 2019-09-19 00:03:54 +03:00
Alexander Medvednikov
74b82b688c table: simplify find_method() 2019-09-18 19:48:28 +03:00
Danil-Lapirow
b0092235fc parser: fix a more complicated "in" usage 2019-09-18 16:13:22 +03:00
joe-conigliaro
b9cc6535f6 crypto.rand: rename read_u64 to int_u64 + clean up 2019-09-18 16:12:16 +03:00
joe-conigliaro
f187c35fb2 vlib: inline certain functions 2019-09-18 15:45:32 +03:00
joe-conigliaro
695d4018ea compiler: let attributes work with pub functions 2019-09-18 15:32:55 +03:00
Alexander Medvednikov
040d03912b table: use an optional for find_fn() 2019-09-18 15:06:34 +03:00
Alexander Medvednikov
1c6cbdace5 make sure "v test v" is run in the V repo 2019-09-18 14:43:44 +03:00
Alexander Medvednikov
d180324413 find_field: use optional 2019-09-18 14:28:11 +03:00
Alexander Medvednikov
d1500511e6 "none" keyword for optionals + more memory fixes 2019-09-18 14:15:10 +03:00
ylluminate
e40ab547ba readme: remove version number; link to changelog 2019-09-17 22:58:39 +03:00
Alexander Medvednikov
b94636bf77 Update CHANGELOG.md 2019-09-17 22:24:53 +03:00
Alexander Medvednikov
ecffa8e1d9 v.js: fix for .. 2019-09-17 22:21:44 +03:00
joe-conigliaro
32ad33558d crypto.rand: add PRNG function read_u64 2019-09-17 22:03:54 +03:00
Alexander Medvednikov
1796869da7 V 0.1.20 2019-09-17 21:48:24 +03:00
Alexander Medvednikov
3c0fce4928 makefile: hide the warnings for now 2019-09-17 18:01:49 +03:00
vitalyster
52c5f0172e compiler: always define _UNICODE and UNICODE on Windows 2019-09-17 14:56:32 +03:00
Alexander Medvednikov
79a98d7bcf V 0.1.20 changelog 2019-09-17 13:58:21 +03:00
Alexander Medvednikov
0a2f7a6ba7 fix tests 2019-09-17 13:37:25 +03:00
Alexander Medvednikov
1397d532c6 compiler: check if mutable receivers are modified 2019-09-17 13:10:43 +03:00
joe-conigliaro
9c9e6290a6 remove unnecessary mut argument (#2016) 2019-09-17 01:09:19 +03:00
Alexander Medvednikov
19b04d5427 math: fix const warnings 2019-09-16 22:49:18 +03:00
Nicolas Sauzede
ff009f1c4e rand: rand_r(seed) 2019-09-16 22:21:21 +03:00
Delyan Angelov
083d747302 V.js: on linux -lm is needed 2019-09-16 22:00:59 +03:00
Alexander Medvednikov
ca239fcf98 travis: another js fix 2019-09-16 21:15:33 +03:00
vitalyster
f7a0fefe27 glfw: printf -> println 2019-09-16 21:07:34 +03:00
Alexander Medvednikov
4462404151 travis: fix js test 2019-09-16 20:53:29 +03:00
Alexander Medvednikov
a81656568b travis: test JS backend 2019-09-16 19:02:16 +03:00
Alexander Medvednikov
c76d09f9a5 make V.js compile 2019-09-16 18:31:13 +03:00
BigBlack
3e52984e88 compiler: another C function call fix 2019-09-16 18:28:20 +03:00
Delyan Angelov
7cf7215557 testing: always show benchmarks 2019-09-16 18:27:55 +03:00
hazohelet
9158ba4640 vlib: add Android checks to build V on Android 2019-09-16 18:23:11 +03:00
Delyan Angelov
a45895a3af new benchmark module + make the tests use it 2019-09-16 17:29:06 +03:00
hazohelet
3325775944 compiler: add android to supported platforms 2019-09-16 17:16:24 +03:00
joe-conigliaro
155fecadb7 compiler: fix empty structs 2019-09-16 14:44:12 +03:00
Alexander Medvednikov
74ec57e0e1 travis: run "v -o v compiler" 2019-09-16 14:27:23 +03:00
Alexander Medvednikov
57cfdeeaf0 Revert "os: fix get_line in windows"
This reverts commit 279f7d57cb.
2019-09-16 13:54:30 +03:00
Alexander Medvednikov
615fa91675 update september.plan 2019-09-16 13:53:42 +03:00
BigBlack
279f7d57cb os: fix get_line in windows 2019-09-16 13:43:59 +03:00
joe-conigliaro
cbd4478b5e compiler: fix msvc empty struct & enable travis msvc 2019-09-16 13:01:07 +03:00
unknown-v
5f43a61e0d examples: update [0;n] to [0].repeat(n) 2019-09-16 01:55:54 +03:00
Delyan Angelov
854de4e7e0 repl: add more stats and tests; compiler: tcc fixes 2019-09-16 00:41:12 +03:00
Alvydas Vitkauskas
ff4ef337da compiler: remove unreachable code 2019-09-16 00:40:31 +03:00
joe-conigliaro
5db25352e5 compiler: fix module typo detection 2019-09-15 20:39:48 +03:00
joe-conigliaro
075a8e5ccb compiler: improve typo detection 2019-09-15 20:07:12 +03:00
Alexander Medvednikov
52fc16bc8a travis: don't run on msvc for now 2019-09-15 20:00:12 +03:00
Alexander Medvednikov
0b81c5a3cb bring back assert outside of tests 2019-09-15 19:43:35 +03:00
Alexander Medvednikov
3db4d66824 operator | not defined on bool 2019-09-15 19:35:48 +03:00
Alexander Medvednikov
48c05b5a45 cgen: use *char in all functions with *char args to avoid warnings 2019-09-15 18:56:33 +03:00
Delyan Angelov
35f927e64e repl: add some timing statistics when running REPL test files 2019-09-15 18:08:16 +03:00
Alexander Medvednikov
d4a30d022b Update september.plan 2019-09-15 16:52:46 +03:00
Alexander Medvednikov
849bef987c more C warnings fixed 2019-09-15 15:53:57 +03:00
Delyan Angelov
e3bd72e8e2 travis: spawn 2 separate windows instances 2019-09-15 15:52:12 +03:00
Alexander Medvednikov
3e923871cf compiler: use *char() cast in C functions to afix warnings 2019-09-15 15:19:18 +03:00
Alexander Medvednikov
897db23203 fix vhelp.v 2019-09-15 14:15:31 +03:00
Alexander Medvednikov
bcf3dbf974 improve vhelp.v a bit 2019-09-15 14:08:40 +03:00
joe-conigliaro
b71bb95f7d msvc: empty struct decl fix 2019-09-15 12:27:28 +03:00
joe-conigliaro
f077fbd32d vlib: change [0;n] to [0].repeat(n) 2019-09-15 12:26:05 +03:00
Henrixounez
602e472b8a builtin: getchar for unicode characters 2019-09-15 04:41:24 +03:00
Henrixounez
04ff9ede9f readline: allow writing without tty + small fixes 2019-09-15 04:33:31 +03:00
Delyan Angelov
1d7b9a3b0b v up: on windows delete existing v_old.exe before renaming the new v.exe to it 2019-09-15 04:33:08 +03:00
Vitor Oliveira
2eeb4c6153 .gitignore: add macOS files 2019-09-15 04:32:41 +03:00
Alexander Medvednikov
b5833a0826 readme: javascript backend 2019-09-15 04:10:12 +03:00
Alexander Medvednikov
4a43c2fa1a Revert "compiler: pass -l flags without space (needed for tcc)"
This reverts commit 982a162fbf.
2019-09-15 03:55:56 +03:00
Alexander Medvednikov
5cc81b91cb JavaSript backend (early stage) 2019-09-15 03:49:57 +03:00
Delyan Angelov
982a162fbf compiler: pass -l flags without space (needed for tcc) 2019-09-14 23:55:12 +03:00
Vitor Oliveira
1a099c9284 vlib: fix several typos 2019-09-14 23:54:14 +03:00
Alexander Medvednikov
3d2c266980 compiler: -autofree flag 2019-09-14 18:54:55 +03:00
Delyan Angelov
079dcd1fff readme: update instructions for installing glfw/freetype on windows. (#1974) 2019-09-14 18:46:07 +03:00
Alexander Medvednikov
f4fa81735d travis: use ./ on windows 2019-09-14 18:39:04 +03:00
Alexander Medvednikov
05d4e8e2e8 travis: build V 4 times on Windows 2019-09-14 18:37:48 +03:00
Alexander Medvednikov
682eedce59 compiler: remove the temporary windows check 2019-09-14 18:34:59 +03:00
Henrixounez
c604a5c02f compiler: no free on stack allocated array 2019-09-14 13:40:59 +03:00
Zaoqi
d340dd79b8 travis: use xcode10.3 (#1970) 2019-09-14 13:10:05 +03:00
joe-conigliaro
b96cbe2177 compiler: temporary memory fix on windows 2019-09-14 13:09:25 +03:00
joe-conigliaro
81bf67ba4f hash.crc32: change *Crc32 to &Crc32 2019-09-13 22:45:04 +03:00
unknown-v
3dc4abddec cc.v: build_module mode fix
Create the modules directory if it's not there.
2019-09-13 20:47:17 +03:00
joe-conigliaro
c614639e7b compiler: use os.PathSeparator 2019-09-13 18:59:17 +03:00
Alexander Medvednikov
21f3b9eccc compiler: do not free memory on Windows for now 2019-09-13 16:27:09 +03:00
Nicolas Sauzede
7f3cfea02b compiler: improve the help message 2019-09-13 16:19:41 +03:00
joe-conigliaro
5aaa794519 compiler: clean up the typo check 2019-09-13 16:15:30 +03:00
Alexander Medvednikov
9dd86f6fb8 compiler: more memory logic + replace "cur_fn &Fn" with "cur_fn Fn" 2019-09-13 15:47:31 +03:00
Vitor Oliveira
f3a74e7d80 compiler: fix typo in main.v 2019-09-13 14:25:05 +03:00
joe-conigliaro
41734affb3 compiler: detect typos in function/variable/module names 2019-09-13 14:10:24 +03:00
Alexander Medvednikov
5055ac4b23 makefile: now that v.c is regenerated after every commit, it is no longer needed to run "v -o v compiler" 2019-09-13 14:02:34 +03:00
BigBlack
8fe46d5db5 compiler: call string method in C funtion parameter 2019-09-13 02:41:51 +03:00
Rahul Nair
2880baa1bc dockerfile: fix build failure 2019-09-13 01:19:57 +03:00
iRedMail
92b634de7c Fixes old syntax and make Row.vals mutable
- Replace `*` by `&` for C code
- Make `Row.vals` mutable. Otherwise line 56 will raise error.
2019-09-13 00:46:51 +03:00
Alexander Medvednikov
b6ebe0828d changelog: remove a duplicate 2019-09-12 11:49:29 +03:00
Alexander Medvednikov
a555b1fcff V 0.1.19 2019-09-12 03:59:34 +03:00
Vitor Oliveira
c66fbd9bff compile: fix typos in vhelp.v 2019-09-11 23:54:36 +03:00
unknown-v
26edb7d797 scanner: @FILE escape \ 2019-09-11 20:16:42 +03:00
BigBlack
f8d4d6cdc7 compiler: 32-bit option 2019-09-11 19:26:35 +03:00
Henrixounez
af60f9ead4 compiler: escapes quote on literals 2019-09-11 15:48:08 +03:00
Alexander Medvednikov
949dfc59fd readme: minor fixes 2019-09-11 15:32:40 +03:00
Alexander Medvednikov
9853323157 array: make ".contains()" private, use "in" everywhere 2019-09-11 15:12:13 +03:00
Delyan Angelov
63f2f2b294 compiler: improve v --help . Move help descriptions to compiler/vhelp.v 2019-09-11 13:35:03 +03:00
BigBlack
e6354567e5 compiler: fix sizeof and cc 2019-09-11 13:34:19 +03:00
Delyan Angelov
3588c3363d backtraces: on android (bionic), there is no execinfo.h 2019-09-11 13:31:29 +03:00
Delyan Angelov
25af013896 readme: Add Troubleshooting section
Describe common solutions/answers to problems with v compilation.
2019-09-11 13:30:55 +03:00
Vitor Oliveira
797b35cdcb compiler: add vfmt() to reduce complexity 2019-09-11 01:49:56 +03:00
Delyan Angelov
bc606415c3 compiler: stage 2 of vhash support 2019-09-11 01:12:46 +03:00
Delyan Angelov
a53c69de38 os: use path separator more consistently 2019-09-11 01:08:23 +03:00
Delyan Angelov
08262b5c43 compiler: stage 1 of printing shortened commit on v --version 2019-09-10 23:08:48 +03:00
Alexander Medvednikov
03b3278369 compiler: replace the rest of .build with .build_module 2019-09-10 18:19:29 +03:00
Vitor Oliveira
edd8528049 compiler: rename build to build_module 2019-09-10 17:36:14 +03:00
Vitor Oliveira
cd47f09f86 Isolate install_v to reduce complexity 2019-09-10 13:09:36 +03:00
Delyan Angelov
0ade45db08 compiler: print the offending source line on error 2019-09-10 13:08:43 +03:00
Alexander Medvednikov
7fc678c961 fix urllib_test.v 2019-09-09 14:21:18 +03:00
Alexander Medvednikov
00687de43b memory: clean up all arrays in the V compiler 2019-09-09 13:55:47 +03:00
Vitor Oliveira
2f9caf49d3 Add comma to contributing.md 2019-09-09 13:23:30 +03:00
Alexander Medvednikov
735c78fc6d fix bitfield.v 2019-09-09 02:38:15 +03:00
Alexander Medvednikov
a6ec6e23bc bf: minor clean up 2019-09-09 02:31:43 +03:00
Vitor Oliveira
f70d206881 Fix typos 2019-09-09 02:03:44 +03:00
Alexander Medvednikov
31c9a2a744 fix bitfield_test.v 2019-09-08 17:55:27 +03:00
Alexander Medvednikov
ae866260c8 bf: rename to bitfield 2019-09-08 17:45:51 +03:00
Alexander Medvednikov
71224ad17c compiler: fix building_v 2019-09-08 17:19:42 +03:00
Alexander Medvednikov
6dcdb224a1 bf: fix resize() 2019-09-08 16:10:59 +03:00
Alexander Medvednikov
dcc42c858b glfw: GPU driver info 2019-09-08 15:54:16 +03:00
Alexander Medvednikov
2644b9a5e0 Update september.plan 2019-09-08 15:38:29 +03:00
Alexander Medvednikov
a6f927a6e9 bring back automatic array_free() 2019-09-08 14:50:18 +03:00
joe-conigliaro
cb6fadf917 remove freetype submodule accidentally added in #1890 2019-09-08 12:02:03 +03:00
joe-conigliaro
e78e284380 compiler: tidy flag order 2019-09-07 19:19:17 +03:00
Alexander Medvednikov
570e5f968d Update september.plan 2019-09-07 15:16:33 +03:00
Alexander Medvednikov
0dd47b1771 readme: links to wiki 2019-09-07 14:59:00 +03:00
Alexander Medvednikov
4ce31348c2 readme: minor fixes 2019-09-07 14:50:12 +03:00
Delyan Angelov
d5665997e0 compiler: @FILE, @LINE, @FN, @COLUMN 2019-09-07 13:44:41 +03:00
Alexander Medvednikov
76a89c832e parser: small optimizations 2019-08-26 01:19:39 +03:00
Joe Conigliaro
794cd561cd fix libpath issue 2019-09-07 12:04:52 +03:00
Flavien CADET
c1f76aec3a vweb: fix a typo 2019-09-06 20:30:20 +03:00
joe-conigliaro
b7361d00aa compiler: fix v test v on paths with spaces 2019-09-06 19:30:55 +03:00
Joe Conigliaro
6de1f14a56 fix comments & rearrange method 2019-09-06 16:00:46 +03:00
Henrixounez
bfdab586e3 compiler: allow to declare C function with pointers with & 2019-09-06 15:13:38 +03:00
joe-conigliaro
8ac0a2b2dd compiler: rework flags & support win path spaces + more 2019-09-06 15:12:04 +03:00
iBug ♦
e8068b5e1d readme: Add CentOS / RHEL / Fedora instructions 2019-09-06 13:23:51 +03:00
Henrixounez
3de99d365e compiler: allows dir spelling with slash at the end 2019-09-06 13:23:19 +03:00
joe-conigliaro
79d4d56fe5 string: implement is_space in V & make trim_space use trim 2019-09-06 13:22:37 +03:00
Carlos Esquerdo Bernat
8a77d4482c vweb: fix headers 2019-09-05 15:46:24 +03:00
Henrixounez
f83bc9528d readline: added suspend handling and dont print special characters 2019-09-05 15:06:41 +03:00
Alexander Medvednikov
c12d4d1bd2 make "build module" generate an object file 2019-09-05 13:01:30 +03:00
BigBlack
7cf058feac parser: function pointers 2019-09-05 12:09:41 +03:00
Henrixounez
726fcb5eec compiler: check if-expressions returning only one type 2019-09-05 12:08:40 +03:00
Delyan Angelov
818bea34a4 Update PULL_REQUEST_TEMPLATE
Ask people to delete the PR boilerplate text.
2019-09-05 12:07:28 +03:00
Joe Conigliaro
96e959342a compiler/msvc: support paths with hyphen 2019-09-05 04:06:13 +03:00
Henrixounez
cc5470d068 readline: overwrite mode and eof fix 2019-09-05 02:02:04 +03:00
Delyan Angelov
ec61821bf7 compiler: support explicit runrepl argument, so that the v repl can be launched with options like -debug and so on. 2019-09-04 19:50:51 +03:00
joe-conigliaro
d1210b9e9f compiler/cgen: fix github username in error message 2019-09-04 19:49:53 +03:00
joe-conigliaro
a0b3d0809d makefile: uname osx fix & detect MinGW & MSYS 2019-09-04 19:49:11 +03:00
Joe Conigliaro
2ae2ede06a fix *Type warning in examples 2019-09-04 19:48:19 +03:00
Danil-Lapirow
c6f7479a72 parser: add return dropping to false to check whether statements return 2019-09-04 19:48:01 +03:00
Danil-Lapirow
5c43bfbf13 parser: add additional paren for multi case branch 2019-09-04 19:47:37 +03:00
Joe Conigliaro
dd670fb4a3 workaround msvc 0 struct field bug 2019-09-04 19:47:13 +03:00
Henrixounez
540602fab6 main: updated help on building a module 2019-09-04 19:46:42 +03:00
Alexander Medvednikov
3b4703e3b5 Revert "travis: bring back msvs test"
This reverts commit 86d95fcd22.
2019-09-04 18:47:23 +03:00
Alexander Medvednikov
86d95fcd22 travis: bring back msvs test 2019-09-04 18:25:42 +03:00
Joe Conigliaro
afde6f582d workaround for fn_test on windows 2019-09-04 18:24:41 +03:00
Alexander Medvednikov
2c8c6e6636 travis: don't run msvc tests for now 2019-09-04 18:01:50 +03:00
joe-conigliaro
8e25019634 simplify & optimize cgen sort_structs 2019-09-04 11:41:21 +03:00
Sauzede, Nicolas
a206667b4d Make Makefile make windows build succesfully on MSYS2/mingw64 2019-09-04 02:43:24 +03:00
vitalyster
38d26c8080 Travis: run msvc tests 2019-09-03 20:15:08 +03:00
joe-conigliaro
b4d033ff54 compiler: generalize mod dag & use for sorting structs also 2019-09-03 19:11:21 +03:00
Delyan Angelov
db110759ab vweb: fix warnings 2019-09-03 19:10:56 +03:00
joe-conigliaro
6921c15b7b compiler: fix repl chained_fields test (windows) 2019-09-03 18:42:40 +03:00
joe-conigliaro
5dcfda0600 crypto.rand: improve test to actually check for difference in data 2019-09-03 16:10:26 +03:00
Delyan Angelov
c9a39dfdb5 compiler: build tetris executable on windows with both msvc and mingw gcc 2019-09-03 16:09:43 +03:00
Vitaly Takmazov
fcc6dd1d4d make.bat: remove diagnostic output and msvc banners 2019-09-03 16:08:05 +03:00
Henrixounez
216f343f09 readline: history feature 2019-09-03 16:07:20 +03:00
Vitaly Takmazov
7dd754ae74 Travis: break windows tests 2019-09-03 16:05:38 +03:00
Joe Conigliaro
1f67d9edd8 fix bugs breaking tests 2019-09-03 15:21:52 +03:00
Delyan Angelov
ecb661f719 tetris: fix &Foo instead of *Foo warnings. 2019-09-03 11:39:06 +03:00
Vitaly Takmazov
83d724fb70 print_backtrace: do not use printf directly 2019-09-03 11:09:55 +03:00
Delyan Angelov
d681e1cae3 compiler: fix deprecation message for u8. 2019-09-02 21:04:27 +03:00
Henrixounez
510fb2a981 readline: add custom prompt feature 2019-09-02 20:22:33 +03:00
Delyan Angelov
93716ee944 crypto: add utility hexhash functions 2019-09-02 20:22:19 +03:00
Alexander Medvednikov
bb9eec8696 json: use & 2019-09-02 19:17:05 +03:00
Henrixounez
9b8de9b59c readline: clear the screen on ctrl+l 2019-09-02 15:33:46 +03:00
F1ssi0N
892c948a44 Make sure to actually generate the empty struct declaration 2019-09-02 15:33:03 +03:00
Alexander Medvednikov
1c6d51f271 remove u8 and i32 from tests and examples 2019-09-02 15:02:25 +03:00
Alexander Medvednikov
0db1eaa55a parser: get_type2() for the upcoming type system refactoring 2019-09-02 14:55:26 +03:00
Alexander Medvednikov
718041194f os: clean up 2019-09-02 13:57:00 +03:00
Alexander Medvednikov
b667940c68 parser: fix a +1 bug when skipping function body 2019-09-02 13:57:00 +03:00
Henrixounez
33ae7520e7 readline: added suppr key to delete characters right of cursor 2019-09-02 13:36:04 +03:00
Alexander Medvednikov
738c90c51b readme: debian/ubuntu instructions 2019-09-01 23:15:47 +03:00
Alexander Medvednikov
89924c2703 readme: Visual Studio is now supported 2019-09-01 23:02:07 +03:00
Alexander Medvednikov
89acf68f08 readme: remove notes section 2019-09-01 22:56:49 +03:00
Alexander Medvednikov
0e2c41e0f9 replace *Foo with &Foo everywhere 2019-09-01 22:51:16 +03:00
Alexander Medvednikov
aaab24dcf8 use &Foo instead of *Foo warning 2019-09-01 22:45:06 +03:00
Alexander Medvednikov
59ba551d3b u8 + i32 warnings 2019-09-01 22:41:29 +03:00
Alexander Medvednikov
3bd7bcfac3 remove u8 and i32 aliases 2019-09-01 22:37:22 +03:00
Alexander Medvednikov
d078aa360b parser: use map[string]Type instead of []Type 2019-09-01 22:30:49 +03:00
Alexander Medvednikov
4edccce9a3 array: sort ints 2019-09-01 22:30:49 +03:00
Henrixounez
fe3639d547 readline: multiline wrapping for editing and cursor 2019-09-01 20:43:47 +03:00
Alexander Medvednikov
847b43f6e4 fix make.bat 2019-09-01 16:43:40 +03:00
Alexander Medvednikov
24fdefe152 v test: print all fails 2019-09-01 14:14:46 +03:00
Delyan Angelov
011afeb2ea compiler: fix building v with tcc on linux 2019-09-01 14:12:37 +03:00
Alexander Medvednikov
bfa6505636 compiler: replace &Type with Type 2019-09-01 14:05:03 +03:00
Alexander Medvednikov
961e778ed1 map_test.v: format + ref test 2019-09-01 14:05:03 +03:00
Alexander Medvednikov
af5b2e1b3c glfw: make Pos fields public 2019-09-01 07:09:18 +03:00
teggot
c04cca1ae4 Allow use FP without calling it 2019-09-01 02:20:35 +03:00
Henrixounez
4abfb686ec readline: moving cursor feature 2019-09-01 01:02:33 +03:00
Henrixounez
95b107cbc6 readline: reworked dispatch architecture for easier features add 2019-08-31 21:18:32 +03:00
joe-conigliaro
e1dd8716fb tools: gen_vc - add purge flag 2019-08-31 19:00:40 +03:00
joe-conigliaro
b737eb1a87 tools: move gen_vc into the v repo 2019-08-31 17:44:01 +03:00
Alexander Medvednikov
0a4a1ca36c compiler: simplify a[index] = val 2019-08-31 13:30:08 +03:00
teggot
b6ecbd8bc3 Check for type, not name 2019-08-31 11:47:55 +03:00
MoGu
c3f9b90911 fix msvc bootstrap 2019-08-31 11:39:09 +03:00
Alexander Medvednikov
72363ada84 array: make .set() private + format 2019-08-31 02:35:05 +03:00
Alexander Medvednikov
29b4114bc0 compiler: simplify [0; n] 2019-08-31 01:34:43 +03:00
Emily Hudson
04a200d3d8 compiler: fix array initialisation generation for msvc 2019-08-31 00:59:21 +03:00
Henrixounez
a9a4032a11 readline: basic reading on linux 2019-08-31 00:54:53 +03:00
Alexander Medvednikov
e38ee80c98 Revert "Delete .gitattributes"
This reverts commit 3bb559b4c8.
2019-08-31 00:43:07 +03:00
kawa-yoiko
4f0f99e663 parser: fix mutability with chained fields 2019-08-30 20:19:06 +03:00
Alexander Medvednikov
dae4c4b83f final linguist test 2019-08-30 13:57:53 +03:00
Delyan Angelov
e3389e8ec1 log: add seconds to terminal output too. 2019-08-30 13:06:02 +03:00
Alexander Medvednikov
13f3f79eb8 linguist test 2019-08-30 13:01:20 +03:00
kawa-yoiko
6d35f68242 parser: restore outer variable in index exprs 2019-08-30 12:16:39 +03:00
Alexander Medvednikov
3bb559b4c8 Delete .gitattributes 2019-08-30 01:17:43 +03:00
Alexander Medvednikov
d5d1b74f90 time: do not include <unistd.h> on windows 2019-08-30 01:10:29 +03:00
Alexander Medvednikov
3c5087902d fix msvc build 2019-08-30 01:06:10 +03:00
Henrixounez
87ed442d9e compiler: nested structure print error fix 2019-08-30 00:55:59 +03:00
Alexander Medvednikov
0c31172fb0 make print() generic, just like println() 2019-08-30 00:41:25 +03:00
Emily Hudson
7fc899dfd6 bootstrap: single make.bat, default msvc option for forcing gcc 2019-08-30 00:13:53 +03:00
Alexander Medvednikov
b17bf5843c compiler: fix v_win.c generation 2019-08-30 00:07:54 +03:00
Alexander Medvednikov
2fe20cd092 compiler: fix struct order bug 2019-08-29 23:46:12 +03:00
Henrixounez
c6b79dfd24 compiler: check for reserved names during struct declaration 2019-08-29 22:41:21 +03:00
Henrixounez
2507735596 compiler: stricter non-allocation condition for print optimization 2019-08-29 22:19:30 +03:00
Henrixounez
29e0396eca compiler: adds handling of two variables for loop on string 2019-08-29 21:41:16 +03:00
Shiqing
519028e263 Fix incorrect string open/close check in REPL 2019-08-29 21:40:49 +03:00
Henrixounez
52c2763ee3 compiler: prompt error if trying to use f for floats 2019-08-29 21:39:58 +03:00
Henrixounez
4b9cc1246e compiler: allow functions return without main function 2019-08-29 21:39:39 +03:00
joe-conigliaro
cd625b04eb http: windows - make https requests work in threads 2019-08-29 12:33:20 +03:00
Delyan Angelov
4f62e8235f repl: add a test for naked strings. 2019-08-29 12:30:33 +03:00
Delyan Angelov
83954acfd4 compiler: use cerror instead of panic. 2019-08-29 11:50:18 +03:00
joe-conigliaro
32683ad6fd sync: fix mutex on win & waitgroup (all os) update. fixes news_fetcher example on win (#1776) 2019-08-29 11:48:03 +03:00
Joe Conigliaro
4a506b0566 fix issue #1777 2019-08-29 11:46:05 +03:00
Alexander Medvednikov
beef793e83 make.bat: make sure v.exe has been generated 2019-08-29 00:38:09 +03:00
Alexander Medvednikov
92a1eb958a make.bat: exit if compilation failed 2019-08-29 00:18:30 +03:00
Alexander Medvednikov
91ece782af compiler: move Var back to table.v now that the struct bug is fixed 2019-08-28 21:23:46 +03:00
Alexander Medvednikov
5b1700e52a compiler: fix struct order bug 2019-08-28 21:19:34 +03:00
Alexander Medvednikov
f29079daac better winroot.zip info message 2019-08-28 21:19:34 +03:00
Delyan Angelov
c92654a044 fix building v on alpine with musl libc 2019-08-28 19:26:18 +03:00
unknown-v
fed9f01b2d use -rdynamic only if host os is not windows 2019-08-28 16:23:53 +03:00
Vitaly Takmazov
5124eae47d msvc: check exit code 2019-08-28 13:26:27 +03:00
Alexander Medvednikov
287a53ee39 Update september.plan 2019-08-28 04:05:29 +03:00
Alexander Medvednikov
0f9f8f6aa9 Update september.plan 2019-08-28 04:04:46 +03:00
Delyan Angelov
73c6bae480 print backtraces on panic on mac and linux 2019-08-27 23:29:13 +03:00
joe-conigliaro
02fc7e14cd make trim use cutset like trim_right/trim_left 2019-08-27 22:53:32 +03:00
joe-conigliaro
3db50f724b net.urllib: Update with latest changes from go lib 2019-08-27 22:44:41 +03:00
Delyan Angelov
2d87fea074 compiler: allow passing options to v run 2019-08-27 21:08:54 +03:00
Alexander Medvednikov
96747187b4 Create .gitattributes 2019-08-27 19:52:32 +03:00
Alexander Medvednikov
0a37200fda GitHub supports V now! 2019-08-27 19:36:40 +03:00
Alexander Medvednikov
e2c7d3b2d9 v symlink 2019-08-27 19:35:48 +03:00
Alexander Medvednikov
57ab8546fe travis: run "v test v" instead of the mak_tests.bat wrapper 2019-08-27 13:21:05 +03:00
Alexander Medvednikov
f6147b7ac7 Revert "switch deprecation notice"
This reverts commit a43b831965.
2019-08-27 13:10:18 +03:00
Alexander Medvednikov
b48b076dac remove is_play 2019-08-27 13:10:18 +03:00
Sunny Lam
a5b44b3bc5 disable implicit-function-declaration for FreeBSD 2019-08-27 12:53:50 +03:00
Alexander Medvednikov
631e6a0d09 readme: minor changes 2019-08-27 04:17:50 +03:00
Alexander Medvednikov
cca85566d3 parser: fix duplicate enum generation 2019-08-27 02:48:55 +03:00
Alexander Medvednikov
a43b831965 switch deprecation notice 2019-08-27 02:47:49 +03:00
Alexander Medvednikov
ab0a78a498 fix sync_win.v 2019-08-27 00:46:27 +03:00
Danil-Lapirow
7edcbeca1a parser: match expression + match fixes 2019-08-27 00:39:11 +03:00
Alexander Medvednikov
b6336f730b update september.plan 2019-08-27 00:31:47 +03:00
Alexander Medvednikov
d4b6b6c833 freetype: render all Unicode characters 2019-08-27 00:20:54 +03:00
Delyan Angelov
99c9410cc2 compiler: add all C reserved words to CReserved 2019-08-26 20:04:57 +03:00
Robin Martijn
d88315d789 news_fetcher: unlock mutex before terminating 2019-08-26 20:04:14 +03:00
Robin Martijn
5df31c16f7 json: fix #1751; support unsigned integers 2019-08-26 20:02:19 +03:00
teggot
f34d14d901 Register map type while declaration 2019-08-26 20:01:34 +03:00
joe-conigliaro
857cf00caf builtin.string: make trim_left/right() behave correctly 2019-08-26 14:18:58 +03:00
Delyan Angelov
aa438c7c3f os: fix exec() and get_raw_line(); fix Windows tests and examples 2019-08-26 13:51:48 +03:00
Henrixounez
fe50aeb130 compiler: prevent multiple same field initialization 2019-08-26 13:39:45 +03:00
Swastik Baranwal
db525524ee string: title() and small fixes 2019-08-26 13:32:53 +03:00
Robin Martijn
754b8082fb time/vlib: fix day_of_week() with sakamoto's algorithm 2019-08-25 23:35:01 +03:00
Delyan Angelov
d945e9c72e Force git to ignore temporary *.tmp.c files too. 2019-08-25 21:28:54 +03:00
joe-conigliaro
836cc32d78 http: allocate memory dynamically on Windows 2019-08-25 21:27:12 +03:00
Delyan Angelov
ec4ff6e811 compiler tcc: tcc does not have emmintrin.h, so define STBI_NO_SIMD if tcc is used. 2019-08-25 21:24:28 +03:00
Henrixounez
ad32a3770b compiler: cast correctly strings between byte* and char* when needed 2019-08-25 01:50:44 +03:00
Henrixounez
0a0d6536c2 compiler: access index when casting array into an array[] for pointer 2019-08-25 01:49:51 +03:00
Henrixounez
f22d5c5624 vlib: remove negative checks on unsigned (#1728) 2019-08-25 01:48:38 +03:00
Delyan Angelov
a62e6b127a http: send headers and request data 2019-08-25 01:48:06 +03:00
Alexander Medvednikov
57880aed18 compiler: fix linux crash 2019-08-24 15:04:31 +03:00
Alexander Medvednikov
dfc7c9c00f final tcc fixes 2019-08-24 14:39:27 +03:00
Alexander Medvednikov
cd10890258 minor tcc fixes 2019-07-08 03:44:47 +02:00
Alexander Medvednikov
4c07df6a21 small webassembly fix 2019-08-24 03:09:23 +03:00
Alexander Medvednikov
c00be49d91 travis: disable msvc test for now 2019-08-24 03:01:37 +03:00
Alexander Medvednikov
031e7fe113 os: libproc.h on macos only 2019-08-24 02:53:11 +03:00
Alexander Medvednikov
7fd9827318 all: add missing includes 2019-08-24 02:48:47 +03:00
teggot
2be0777c98 Fix issue of missing code in C 2019-08-24 00:27:48 +03:00
teggot
421b6ce4ac Fix typo 2019-08-24 00:26:30 +03:00
Alexander Medvednikov
d98c20466e cc.v: build with "implicit-function-declaration" and fix declarations
required for the webassembly backend

2
2019-08-24 00:20:53 +03:00
Delyan Angelov
1b3a21f197 compiler: use absolute paths for the c files and clean them up 2019-08-23 20:05:02 +03:00
Alexander Medvednikov
0589decc43 parser: change the new_parser() signature 2019-08-23 13:43:31 +03:00
Alexander Medvednikov
624a932420 compiler: cc.v 2019-08-23 12:06:01 +03:00
Michiel Vlootman
817f5bf0a6 add test for [json:fieldname]
Added test also tests the output from json.encode to make sure the json:fieldname attribute is used.
2019-08-23 11:43:11 +03:00
Delyan Angelov
d362f73af8 compiler: support passing -cc to specify the desired C compiler 2019-08-23 11:42:48 +03:00
Alexander Medvednikov
df593870ae scanner: fix a string overflow 2019-08-23 03:28:25 +03:00
Alexander Medvednikov
8f1bf6033e compiler: remove module_path() 2019-08-23 03:10:37 +03:00
Alexander Medvednikov
e39cb41d6b json: custom json field names with "[json:field_name]" 2019-08-23 02:54:39 +03:00
Alexander Medvednikov
7086547471 compiler: replace STRUCT_DEFAULT_VALUE with {0} 2019-08-23 02:38:18 +03:00
Alexander Medvednikov
6c6cbe0821 changelog for the upcoming V 0.1.19 2019-08-23 00:26:59 +03:00
Alexander Medvednikov
f61b14584a remove "import const" everywhere 2019-08-23 00:09:03 +03:00
Alexander Medvednikov
dcfc9eb1a1 remove from the language 2019-08-22 23:19:31 +03:00
Alexander Medvednikov
2eb9440095 http: disable the tests for now 2019-08-22 22:48:31 +03:00
Alexander Medvednikov
75b632baad examples: use == instead of = in pg/customer.v 2019-08-22 22:33:57 +03:00
Alexander Medvednikov
abe61e28fe examples: fix tetris 2019-08-22 22:28:27 +03:00
Alexander Medvednikov
eb5fcafa77 table: TypeCategory; freetype: remove C code; [typedef] C structs;
Objective-C interfaces
2019-08-22 22:18:55 +03:00
SewerynKaminski
c8da79d785 Fix terminal goto control sequence building 2019-08-22 20:10:54 +03:00
Henrixounez
780ddaf22b compiler: handles printing of structures and arrays of structures 2019-08-22 14:34:33 +03:00
Henrixounez
232532ba3b repl: clear screen and help menu 2019-08-22 14:24:37 +03:00
Henrixounez
be99a65f2b compiler: comptime generated str methods for arrays are public 2019-08-22 14:22:44 +03:00
Danil-Lapirow
fe8145c697 json: add raw json test 2019-08-22 14:22:16 +03:00
Delyan Angelov
77b31de117 compiler: produce errors in C "filepath:line:column:" format 2019-08-22 14:15:11 +03:00
Henrixounez
9b3b22d6b3 compiler: allows compound assignment operators on array 2019-08-22 04:57:43 +03:00
Delyan Angelov
ffb6c6f5b4 net: add udp socket support and a simple udp server example. 2019-08-22 04:01:04 +03:00
Delyan Angelov
51818346df http: support plain http protocol 2019-08-21 20:04:06 +03:00
Joe Conigliaro
e35ef3b83e tls_ctx was definded before TlsContext 2019-08-21 15:04:40 +03:00
Alexander Medvednikov
453f3020c3 Update september.plan 2019-08-20 22:37:49 +03:00
Alexander Medvednikov
838e84fed9 Create september.plan 2019-08-20 22:03:24 +03:00
Delyan Angelov
1ddc9dc604 orm: allow variables like q.nr_orders in queries too. 2019-08-20 21:35:13 +03:00
Alexander Medvednikov
caa6eacf39 readme: orm 2019-08-20 17:35:11 +03:00
Delyan Angelov
cf06faf09b orm: allow both integer and string arguments in db.select and db.select limit 1 2019-08-20 17:32:39 +03:00
Alexander Medvednikov
900df8ecf9 Update README.md 2019-08-20 17:29:06 +03:00
Delyan Angelov
49899c649c orm: fix select .. limit 1 . This case now returns an ?Row. 2019-08-20 16:33:14 +03:00
Emily Hudson
151686501d compiler: fix MSVC flag parsing 2019-08-20 16:32:15 +03:00
Delyan Angelov
9ff8793666 compiler: refactoring - extract cheaders.v and live.v from main.v . 2019-08-20 11:26:50 +03:00
Carlos Esquerdo Bernat
cf23c289ec tests: cleanup 2019-08-20 11:18:12 +03:00
Istvan
dee411149e pg: config struct for connecting 2019-08-20 11:08:06 +03:00
Alexander Medvednikov
33e730b3fa ui: users_gui example 2019-08-20 00:19:55 +03:00
Alexander Medvednikov
707ddba143 examples: rename hot_code_reloading to hot_reload 2019-08-20 00:08:45 +03:00
Alexander Medvednikov
01586d6d67 ui: ui_lin.v and ui_win.v 2019-08-19 00:28:33 +03:00
Alexander Medvednikov
ac6c6e36c3 V UI readme: better wording 2019-08-19 00:14:39 +03:00
Alexander Medvednikov
7465ff97b3 V UI info 2019-08-19 00:12:35 +03:00
Delyan Angelov
41efe545f2 repl_test: remove dependance on echo, use stdin redirection instead. 2019-08-18 23:02:32 +03:00
Henrixounez
e1d2c83ff6 repl: functions and conditional blocks support 2019-08-18 22:50:38 +03:00
F1ssi0N
ecc8059a9e Dont test as much - they are probably not necessary 2019-08-18 20:23:42 +03:00
Henrixounez
14c2319dcc compiler: prevent accessing negative index of arrays 2019-08-18 20:11:47 +03:00
Henrixounez
38db845378 compiler: auto dereference mutable variable upon return 2019-08-18 20:09:01 +03:00
Henrixounez
14f13ff55a tests: v implementation of repl tests 2019-08-18 19:26:55 +03:00
Henrixounez
aae063b9ad repl: dont save line if last compilation errored 2019-08-18 19:25:46 +03:00
Alexander Medvednikov
f654c4af7a ui README.md 2019-08-18 18:28:29 +03:00
Alexander Medvednikov
ac8a6d180c ui license 2019-08-18 18:20:17 +03:00
Alexander Medvednikov
18d0a08ace freetype: fix utf crash 2019-08-18 18:13:12 +03:00
Delyan Angelov
f013359a44 compiler: improve error handling for 'v install' 2019-08-18 17:57:57 +03:00
Emily Hudson
d373b331fa ompiler: MSVC related fixes and v test v for windows testing
* MSVC related fixes and v test v for windows testing

* If second stage crashes on windows goto error

* use os.exec instead of system so that the error can be printed

* use -debug for osx vid

* Fix some whitespace to trigger a rebuild
2019-08-18 17:25:33 +03:00
S-YOU
0066afe7fc mysql module 2019-08-18 17:24:43 +03:00
Delyan Angelov
bbc5c14d99 repl: fix compiler/tests/repl/error.repl test case. 2019-08-18 17:24:02 +03:00
Alexander Medvednikov
89b5a0fc25 ui: fix focus_app() 2019-08-18 17:01:31 +03:00
Alexander Medvednikov
56fbafe03a cc(): fix -x objective-c; ui.focus_app() 2019-08-18 16:59:36 +03:00
Alexander Medvednikov
f9fb6f0be4 orm_test: remove pg import for now 2019-08-18 15:02:36 +03:00
joe-conigliaro
22348f2245 http: add vschannel_cleanup() back 2019-08-18 13:04:17 +03:00
Delyan Angelov
4a27b8f43d compiler: improved error, when c compiler is missing/not found. 2019-08-18 13:03:28 +03:00
S-YOU
329e7bd2c8 add static inline attribute 2019-08-18 13:02:07 +03:00
Alexander Medvednikov
8e1c31e860 cc(): print compilation error correctly 2019-08-18 01:30:48 +03:00
Alexander Medvednikov
fe2d2bd2a3 fmt: remove trailing spaces 2019-08-17 22:21:43 +03:00
Alexander Medvednikov
8a1324c141 os: make exec() return ?Result with exit code and output 2019-08-17 21:11:40 +03:00
Alexander Medvednikov
60bf668281 string: fix trim_right 2019-08-17 20:07:40 +03:00
Alexander Medvednikov
d984f2ccec make: remove curl dependency 2019-08-17 19:24:24 +03:00
Joe Conigliaro
e5ebb83bd9 add test for writer 2019-08-17 17:43:43 +03:00
joe-conigliaro
547241c13c http: make do() return errors instead of panic 2019-08-17 17:02:01 +03:00
Joe Conigliaro
1274cdf0af path must start with / 2019-08-17 16:37:31 +03:00
unknown-v
4f8acca153 bat files: v.c to v_win.c 2019-08-17 16:31:44 +03:00
teggot
79c727f014 Add support for raw json fields in structs 2019-08-17 16:20:40 +03:00
Alexander Medvednikov
100bb7c54c os: clean up windows functions 2019-08-17 16:17:43 +03:00
Alexander Medvednikov
7ed0438b04 os: remove PathSeparator hack now that we have v_win.c 2019-08-17 16:02:59 +03:00
Massimiliano Bertinetti
845ae8cf5a tetris: Added instruction for Arch / Manjaro Linux 2019-08-17 15:53:06 +03:00
joe-conigliaro
1ba701e036 encoding.csv: add write support 2019-08-17 15:51:20 +03:00
joe-conigliaro
56566ba3d0 http: follow redirects (openssl & schannel) + fix url params 2019-08-17 15:50:47 +03:00
Alexander Medvednikov
a4e648627e make.bat: v_win.c 2019-08-17 13:47:18 +03:00
Alexander Medvednikov
90d15215af make_tests.bat: v_win.c 2019-08-17 13:26:26 +03:00
Alexander Medvednikov
88d775e78e msvc.bat: use v_win.c 2019-08-17 12:56:42 +03:00
Alexander Medvednikov
20dd538b65 make.bat: use v_win.c 2019-08-17 12:51:22 +03:00
Nicolas Sauzede
4760fea489 examples/tetris: use better unique colors, implement game over/pause 2019-08-17 02:56:09 +03:00
unknown-v
49205dcce3 examples: fix maps warnings 2019-08-17 02:55:11 +03:00
Alexander Medvednikov
be141d9c5f os: Windows fixes 2019-08-17 02:09:36 +03:00
Alexander Medvednikov
37a607dce5 fix v test v 2019-08-17 01:15:38 +03:00
Alexander Medvednikov
1c1c3925fc Travis: don't install glfw for now 2019-08-17 00:57:26 +03:00
Alexander Medvednikov
c6e7838a44 V 0.1.18 2019-08-17 00:48:07 +03:00
Alexander Medvednikov
a336775ae6 Makefile: use ./v 2019-08-16 23:31:45 +03:00
Alexander Medvednikov
94b900bd0a map: allow array values 2019-08-16 23:28:47 +03:00
Alexander Medvednikov
54b3c4d2c5 json: error if the module is not imported 2019-08-16 18:32:35 +03:00
Alexander Medvednikov
d3812a73d3 Travis: don't install openssl on Windows 2019-08-16 17:07:28 +03:00
Marco Böttcher
d6d17fe3f2 scanner: string interpolation with $var at the end 2019-08-16 17:06:27 +03:00
Alexander Medvednikov
1372d04b43 Delete test.sh 2019-08-16 17:03:56 +03:00
Alexander Medvednikov
b188ecf680 Makefile: re-write make test in V 2019-08-16 16:51:46 +03:00
Delyan Angelov
5ea4b463bb compiler: fix issue #1612 . 2019-08-16 14:05:42 +03:00
Alexander Medvednikov
c156cef972 vweb: fix the test 2019-08-16 09:58:27 +03:00
Alexander Medvednikov
09340d48a0 Makefile: simplify 2019-08-16 09:36:14 +03:00
Alexander Medvednikov
40e788552c Makefile: fix info message 2019-08-16 09:25:10 +03:00
Alexander Medvednikov
dc9cebe26c orm fixes; glfw: remove C code 2019-08-16 09:10:03 +03:00
kambrium
a5af903362 Fixed typo 2019-08-16 09:02:09 +03:00
Alexander Medvednikov
c0cc4701af $if debug { 2019-08-16 08:50:36 +03:00
Marco Böttcher
87216cff63 compiler: '\$' escape 2019-08-15 12:41:23 +03:00
Joe Conigliaro
5eee980499 auto init struct map fields 2019-08-14 23:54:45 +03:00
Henrixounez
772c0c3f93 compiler: prevent string to byte cast 2019-08-14 09:48:05 +03:00
Henrixounez
437ba14521 compiler: prompts an error when accessing a map with wrong type 2019-08-14 09:46:46 +03:00
joe-conigliaro
7b48f7ac9e encoding.csv module 2019-08-14 09:45:56 +03:00
Emily Hudson
f52c68a510 compiler: bootstrap with MSVC
Add make_msvc.bat to bootstrap with msvc and test it with travis
2019-08-13 23:04:20 +03:00
Delyan Angelov
a0c8fa5bbc http openssl: on linux, prefer newer openssl installations when available 2019-08-13 10:49:07 +03:00
Alexander Medvednikov
89d0b75311 vweb: remove the broken test for now 2019-08-13 01:15:09 +03:00
Alexander Medvednikov
287ab1ffb0 Makefile: don't build vget (openssl dependency) 2019-08-13 01:07:21 +03:00
Alexander Medvednikov
a11961b0d3 vweb: make mime_types a const 2019-08-13 01:04:26 +03:00
Alexander Medvednikov
bc563930f7 string: remove abs() 2019-08-12 21:16:01 +03:00
Alexander Medvednikov
ef2ab31e88 sql: only accept strings and ints for now 2019-08-12 21:07:03 +03:00
Alexander Medvednikov
cba4d59712 vweb: make app_test.v compile 2019-08-12 17:38:30 +03:00
Alexander Medvednikov
6002511052 pg: remove printf 2019-08-12 16:41:41 +03:00
Alexander Medvednikov
baa537bfd5 remove azure-pipelines.yml for now 2019-08-12 16:38:58 +03:00
Henrixounez
2ba1edaa80 repl: default printing fix and test 2019-08-12 16:19:56 +03:00
Emily Hudson
decdd8be9f Prevent people on platforms that arent 'windows' from being able to build with msvc 2019-08-12 15:11:13 +03:00
Alexander Medvednikov
15a42f1f35 array.clone() 2019-08-12 14:41:40 +03:00
Alexander Medvednikov
32754e3b4c small sql fix 2019-08-12 14:41:40 +03:00
joe-conigliaro
8a2714b35a fix typo 2019-08-12 11:03:49 +03:00
Alexander Medvednikov
e03162bf4b readme: minor changes 2019-08-12 11:00:29 +03:00
Alexander Medvednikov
02971a7eb3 readme: simpler structure 2019-08-12 10:54:35 +03:00
Alexander Medvednikov
98b108a45c readme: use symlink 2019-08-12 10:49:20 +03:00
Henrixounez
872aa536d8 compiler: unsigned number properly printed and converted to string
fix: array accessing now works with unsigned numbers
2019-08-12 09:15:53 +03:00
iRedMail
92cb199e8c readme: add libssl-dev on Debian/Ubuntu 2019-08-12 09:14:48 +03:00
Delyan Angelov
e96f0b5409 Makefile: use simpler shell syntax. 2019-08-12 09:13:44 +03:00
Alexander Medvednikov
3c6a11eb0b fix mut_test.v 2019-08-11 22:45:21 +03:00
Zaoqi
4d44de7685 Docker: minor fixes 2019-08-11 22:41:27 +03:00
Alexander Medvednikov
8c3475b902 generate .str() for all arrays 2019-08-11 22:39:45 +03:00
Emily Hudson
f628d6d35d Bootstrap twice on windows 2019-08-11 21:04:39 +03:00
Nick Treleaven
ea30ba4555 map: remove temporary fields _keys, key_i 2019-08-11 19:43:21 +02:00
Delyan Angelov
7957ec3186 v install: fix installing a single module 2019-08-11 17:35:55 +02:00
Carlos Esquerdo Bernat
d526cfc205 vweb: fix V panic: array index out of range: 1/0 2019-08-11 14:07:22 +02:00
Alexander Medvednikov
72a7eb6e35 parser: do not allow 1 % 0 2019-08-11 14:47:34 +03:00
Stefanos Baziotis
02ea168f71 Fix deprecated error 2019-08-11 13:24:31 +02:00
Delyan Angelov
891913e182 vget: handle more errors. 2019-08-11 13:22:13 +02:00
Delyan Angelov
2197c210e7 http: remove superfluous new line in stdout, when making a http request. 2019-08-11 13:15:29 +02:00
joe-conigliaro
5a84a4e507 vlib.http: schannel cleanup. use ctx struct instead of passing args everywhere 2019-08-11 13:13:33 +02:00
Alexander Medvednikov
68a4c125c5 examples/tetris: ttf font for printing the score 2019-08-10 13:37:15 +02:00
Alexander Medvednikov
8f8e0dfad7 V ORM 2019-08-10 13:35:29 +02:00
iRedMail
c67783bcd1 v install: install multiple modules in one command: 'v install m1 m2 m3 …' 2019-08-10 12:21:31 +02:00
Alexander Medvednikov
a0b583d8c8 fix vget 2019-08-10 12:05:18 +02:00
Alexander Medvednikov
cb1c177d49 Update README.md 2019-08-10 11:51:55 +02:00
Zaoqi
2e4e9dbc6f readme: add Debian,Manjaro,Fedora 2019-08-10 11:50:39 +02:00
iRedMail
5a76255297 Allow extra http methods with form: PUT, PATCH
- Allow extra http methods with form: PUT, PATCH
- Rename `post_form` to `form`
2019-08-10 11:44:54 +02:00
Julian Schurhammer
1864e92ff4 parser: disallow statements after a return, branch check $if, $else, switch, and loops correctly 2019-08-10 10:26:42 +02:00
Delyan Angelov
58b52aa9fb Makefile: 'make install' should build v too. 2019-08-10 10:20:59 +02:00
Alexander Medvednikov
cb7e87589c Update Makefile 2019-08-10 10:17:58 +02:00
Alexander Medvednikov
25d97ebbe4 v install: always build vget 2019-08-10 10:14:49 +02:00
joe-conigliaro
a0b59783a2 vlib.http: fix http schannel & follow redirects & cleanup 2019-08-10 10:05:59 +02:00
iRedMail
2ebfc8ab73 Fix copy issue and symbol link
- Fix the issue while running `make install` on Debian 10:

```
# make install
rm -rf /usr/local/{bin/v,lib/vlang}
mkdir -p /usr/local/lib/vlang /usr/local/bin
cp -fr {v,vlib,thirdparty} /usr/local/lib/vlang
cp: cannot stat '{v,vlib,thirdparty}': No such file or directory
make: *** [Makefile:49: install] Error 1
```

- Force to create symbol link if `${PREFIX}/bin/v` already exists.
2019-08-10 08:37:25 +02:00
Alexander Medvednikov
5a80d587d5 makefile: use latest v.c 2019-08-10 08:21:32 +02:00
Rendims
45766dcb2e main: generate main body on new line
Fix issue #1551
2019-08-10 07:14:44 +02:00
Alexander Medvednikov
d4441e4353 freetype: clean up new_context() 2019-08-10 07:13:25 +02:00
Alexander Medvednikov
11c2f634f3 examples/tetris: better font initialization 2019-08-10 07:13:25 +02:00
Henrixounez
7879bde8bb repl: enabled back and added automated tests
fixed typos and macos errors
2019-08-10 07:01:40 +02:00
Rendims
fdb1433c24 Makefile: rebuild compiler when sources change 2019-08-10 00:11:17 +02:00
Henrixounez
a81875b24b REPL: checks if EOF
Check if newline to not create empty println
2019-08-10 00:10:42 +02:00
Delyan Angelov
7d8b296943 freetype,gg: option to pass a custom font_path to freetype.new_context . 2019-08-10 00:10:26 +02:00
Vitaly Takmazov
6f03ed0b13 darwin: fix freetype include path for Homebrew and Macports 2019-08-10 00:09:15 +02:00
Henrixounez
146a9507c6 REPL: fix repl using older binary on piping
repl: delete binary files when exiting
2019-08-10 00:08:21 +02:00
Henrixounez
81cdda842c compiler: fix panic on open bracket without newline 2019-08-09 22:39:29 +02:00
Delyan Angelov
5c29a7ef7d v run: windows and repl fixes 2019-08-09 22:37:31 +02:00
Nicolas Sauzede
efa540e883 examples: tetris: draw score 2019-08-09 13:03:29 +02:00
Delyan Angelov
796b9dab74 compiler: passing -show_c_cmd should always print the C compiler command. 2019-08-09 13:02:25 +02:00
joe-conigliaro
d9a83481a5 http: initial windows schannel http support 2019-08-09 12:52:14 +02:00
Alexander Medvednikov
181a39d752 fix int_test.v 2019-08-09 10:21:21 +02:00
Alexander Medvednikov
ae0e3efb8e scanner: experimental ≠ etc support 2019-08-09 09:32:51 +02:00
Julian Schurhammer
6a9bda806f parser: panic and exit count as returns 2019-08-09 08:17:31 +02:00
Alexander Medvednikov
fbc480fbed ft: rename to freetype 2019-08-08 16:43:11 +02:00
Alexander Medvednikov
865eee2f6b gg: remove draw_text() 2019-08-08 16:09:04 +02:00
Alexander Medvednikov
5ea1c538b6 fn: fix & argument bug 2019-08-08 16:09:04 +02:00
Alexander Medvednikov
5e7d3c6aa9 Travis: fix macos 2019-08-08 15:42:24 +02:00
Alexander Medvednikov
2f29246c3f Travis: build Vid 2019-08-08 15:17:10 +02:00
joe-conigliaro
66ffa764dd compiler: properly add submodule to types 2019-08-08 14:35:53 +02:00
joe-conigliaro
b8d37e0d53 properly add submodule to type 2019-08-08 10:33:47 +02:00
Alexander Medvednikov
27fad0f19b ft: clean up 2019-08-08 10:08:44 +02:00
Julian Schurhammer
61983a6799 parser: check that functions return in all if/else branches 2019-08-08 09:49:56 +02:00
Julian Schurhammer
28147c0930 os.exec: return ?string instead of string 2019-08-08 07:30:05 +02:00
Alexander Medvednikov
1470b3da11 parser: better immutability error messages 2019-08-08 07:00:36 +02:00
dm1try
1c38661ff7 openssl: add Brew openssl path
closes #1509
2019-08-08 06:26:28 +02:00
Emily Hudson
802ff1d012 compiler: scoped defer + build tests with msvc 2019-08-07 17:51:21 +02:00
Marco Böttcher
c924a6cf00 flag: allow to define flags with abbreviation
* flag: allow to check the count of the free args to produce an error

* flag: allow to define flags with abbreviation

flags could be defined to use a single char as abbreviation like
'--output' or '-o'
'--help' or '-h'
2019-08-07 16:52:10 +02:00
Joe Conigliaro
1270e8a9f2 fix error in msvc_win 2019-08-07 16:31:19 +02:00
Alexander Medvednikov
4b69d43f9f fix examples 2019-08-07 14:16:10 +02:00
Alexander Medvednikov
b5d67f226f openssl: use system headers on non-Windows systems 2019-08-07 14:09:15 +02:00
Joe Conigliaro
25d84f72a9 last mut fixes 2019-08-07 14:07:37 +02:00
Alexander Medvednikov
78c20e02ee tmp test fix 2019-08-07 13:50:28 +02:00
Alexander Medvednikov
4b86ba6f6a main.v: fix msvc 2019-08-07 13:41:40 +02:00
Alexander Medvednikov
cebb6cd537 ft: minor fixes 2019-08-07 13:39:54 +02:00
Alexander Medvednikov
ff6e0df0a5 array: minor fixes 2019-08-07 13:39:54 +02:00
joe-conigliaro
511a3d3901 vlib.crypto+other: fix mut args 2019-08-07 13:37:07 +02:00
Alexander Medvednikov
818c4a14e5 compiler: fix a bug with mutable array args 2019-08-07 12:36:45 +02:00
joe-conigliaro
0bcc53c366 vlib: fix mutable args 2019-08-07 09:53:33 +02:00
Alexander Medvednikov
34e0b164eb make function arguments immutable by default 2019-08-07 08:59:00 +02:00
Cody Ley-Han
06b8bd9382 Add a logger interface to the std modules 2019-08-07 08:06:53 +02:00
Delyan Angelov
d072178cef v run: recompile and execute changed file.v just once. 2019-08-07 08:04:40 +02:00
Zaoqi
c7312d9d1c Update Makefile 2019-08-07 06:01:03 +02:00
Alexander Medvednikov
52f473d1c7 all: fix immutable fn args 2019-08-07 05:28:00 +02:00
Alexander Medvednikov
76def48f01 compiler: make Windows headers work with clang-format 2019-08-07 05:28:00 +02:00
FoXy
fa99402314 VGet: Fix for dot folder name import 2019-08-07 04:28:55 +02:00
Vitaly Takmazov
8d35649d90 openssl_backend: add MacPorts libssl path 2019-08-07 04:28:15 +02:00
Delyan Angelov
7607b00952 http: chunked decoding support 2019-08-07 03:57:47 +02:00
Alexander Medvednikov
6bde860043 http test: not today 2019-08-06 17:31:48 +02:00
Alexander Medvednikov
0851848080 Travis: windows openssl fix 2019-08-06 17:23:41 +02:00
Alexander Medvednikov
9642d03e2b Travis: replace curl with openssl on Linux 2019-08-06 17:21:30 +02:00
Alexander Medvednikov
ac335269b3 bring back the http test 2019-08-06 17:06:44 +02:00
Alexander Medvednikov
0a0bd4014c Travis: install openssl on Windows 2019-08-06 17:03:45 +02:00
Alexander Medvednikov
b7a6c761b3 openssl: make compile on Linux 2019-08-06 16:35:49 +02:00
FoXy
67d6702c1f Create VModules directory before Clone 2019-08-06 16:09:44 +02:00
joe-conigliaro
60d206c29d http: use urllib.parse 2019-08-06 14:43:09 +02:00
Alexander Medvednikov
1b2e49be1c http: disable the test until windows is fixed 2019-08-06 14:28:27 +02:00
Alexander Medvednikov
3316968266 http: only run the get test on linux/macos for now 2019-08-06 14:15:42 +02:00
Alexander Medvednikov
8b75f2125a http: init_module() to init openssl once 2019-08-06 14:03:01 +02:00
Alexander Medvednikov
eece058f18 h1 2019-08-06 14:03:01 +02:00
Alexander Medvednikov
e7fcc33597 Travis: macos fix 2019-08-06 13:49:13 +02:00
Alexander Medvednikov
a3f7459963 Travis: install openssl on macOS 2019-08-06 13:37:25 +02:00
Alexander Medvednikov
e6d4708b5a thirdparty/openssl headers 2019-08-06 13:32:09 +02:00
Alexander Medvednikov
bea8f6d7e5 http: remove libcurl dependency; replace it with a simple OpenSSL backend 2019-08-06 13:32:09 +02:00
joe-conigliaro
69932758db net.urllib: update enum / const style 2019-08-06 13:01:05 +02:00
Henrixounez
347e59d604 compiler: fix scanner overflowing string on numbers without newline 2019-08-06 11:50:09 +02:00
Alexander Medvednikov
7a7b5040e2 http: fix response headers and status code; clean up ft and gg 2019-08-06 03:06:27 +02:00
Marco Böttcher
ff730b4eb0 flag: allow to check the count of the free args to produce an error 2019-08-06 01:56:42 +02:00
Vitaly Takmazov
43b81688f6 socket: WSACleanup should not be called on socket close 2019-08-06 01:50:45 +02:00
catull
3f3b7665ca Makefile: fix /usr/local 2019-08-06 01:49:11 +02:00
Marco Böttcher
aff8d05040 compiler: add a test case to ensure more stable local modules 2019-08-05 10:05:00 +02:00
Emily Hudson
3e31e116f3 CI: Windows - build and test both msvc and gcc (#1466) 2019-08-05 10:03:38 +02:00
Zaoqi
afac2bf4de readme: Building without make: add git clone (#1468) 2019-08-05 09:59:48 +02:00
unknown-v
22eaceb17c http_win: set status_code ,remove unused var 2019-08-05 09:59:07 +02:00
joe-conigliaro
01c2d25ae5 compiler: rename pkg to mod and auto save file import table 2019-08-05 09:49:52 +02:00
S-YOU
5939238655 add @VMOD to resolve modules path 2019-08-05 09:42:50 +02:00
Joe Conigliaro
2fab73983b add builtin import pass + use builder in map 2019-08-05 06:01:53 +02:00
Alexander Medvednikov
5ed338dc2e bring back map.str() 2019-08-05 04:34:12 +02:00
Alexander Medvednikov
8d3617b3de fix fn_test.v and urllib.v 2019-08-05 03:31:22 +02:00
Alexander Medvednikov
350e13679c force () in complex bool expressions: (a && b) || c instead of a && b || c 2019-08-05 03:22:28 +02:00
S-YOU
58117f1312 vget: clone with depth 1 and use module name instead of repository name 2019-08-05 03:04:23 +02:00
Delyan Angelov
0379b9cc69 compiler: conditional guard for platform specific #includes directives in _xxx.v files. 2019-08-05 02:17:49 +02:00
Emily Hudson
59a4c923c4 Fix for jsdecode struct initialisation 2019-08-04 13:42:48 +02:00
ma6174
12dfd5f016 fix Raspberry Pi build 2019-08-04 11:24:23 +02:00
Delyan Angelov
9a3570a5b3 compiler: proper line numbers in debuggers (fixes regression after 207bab5). 2019-08-04 11:05:54 +02:00
Alexander Medvednikov
4bc1f73fd0 fix gg.v 2019-08-04 09:46:49 +02:00
Alexander Medvednikov
ee437de8d3 type name check fixes 2019-08-04 09:38:46 +02:00
Alexander Medvednikov
8bce5cb810 force snake_case in struct fields 2019-08-04 09:18:16 +02:00
Alexander Medvednikov
576192949d fixed size array with const size: numbers := [N]int 2019-08-04 04:11:16 +02:00
Nicolas Sauzede
f306fbb2f0 net connect: fix error/return type 2019-08-04 01:46:55 +02:00
Alexander Medvednikov
43fb954234 os: fix executable on FreeBSD and older C compilers 2019-08-04 00:16:37 +02:00
Alexander Medvednikov
01531369f7 bring back local modules 2019-08-04 00:11:56 +02:00
Alexander Medvednikov
9eb385d9ee Revert "remove pg from vlib"
This reverts commit 15c5f671f0.
2019-08-04 00:11:56 +02:00
Alvydas Vitkauskas
331d6f98ee string: fix bug and add tests for string.count 2019-08-03 22:24:03 +02:00
Delyan Angelov
93d27b0b9f vweb assets: the assets cache files are now immutable after creation. (#1454) 2019-08-03 22:16:26 +10:00
joe-conigliaro
45e76609b0 vweb.assets: adds AssetManager for combining/minifying/caching css & js assets (#1452)
* start

* more work

* more

* more work

* update comments

* add back mut

* make minify faster

* add mut

* revert option size

* ret bool from public methods not ?bool for now

* update comments etc

* update comment

* dont return option for now

* clean up
2019-08-03 20:09:09 +10:00
Alexander Medvednikov
e446f988f7 clean up map initialization 2019-08-03 10:26:36 +02:00
Alexander Medvednikov
a5f5b52204 map := { 'foo': 'bar' } syntax 2019-08-03 10:20:04 +02:00
Joe Conigliaro
bfddb9a80f make array.hex() use lowercase 2019-08-03 08:23:13 +02:00
Alexander Medvednikov
15c5f671f0 remove pg from vlib 2019-08-03 03:49:17 +02:00
Alvydas Vitkauskas
bfdce806c4 fix string.count 2019-08-03 03:41:15 +02:00
joe-conigliaro
d4c07d9b66 hash.crc32: modify sum methods to take []byte instead of string 2019-08-03 03:40:54 +02:00
Alexander Medvednikov
34a98e3df0 vweb fixes 2019-08-03 02:27:56 +02:00
Alexander Medvednikov
9e380e2886 vweb: clean up 2019-08-02 23:45:36 +02:00
Alexander Medvednikov
b2874f1200 vweb: fix get_cookie() and redirect() 2019-08-02 23:41:02 +02:00
joe-conigliaro
faf2f9920e string.v: string.count(substr) 2019-08-02 23:30:22 +02:00
joe-conigliaro
9e76d8a638 net.urllib: fix values (used for query string/form data) 2019-08-02 23:28:55 +02:00
Alvydas Vitkauskas
69084b0c57 change error printing format 2019-08-02 23:26:23 +02:00
Vitaly Takmazov
910f350a26 string_test: fix randomly failed test
* memory should be initialized with zeros before creating string
* there is no string([]array) constructor, string(byteptr) does not count length correctly, using string(byteptr, len) to fix
2019-08-02 19:20:36 +02:00
Alexander Medvednikov
ed3f1d315b vweb: remove favicon hack 2019-08-02 10:15:20 +00:00
Alexander Medvednikov
8990eb06ec Revert "remove vlib/glfw (it's a vpm module now)"
This reverts commit cdfc4c8372.
2019-08-02 11:33:49 +02:00
joe-conigliaro
7bf1c7f005 net.urllib: change confusing name of internal method 2019-08-02 08:52:37 +02:00
joe-conigliaro
2bdbc327d9 vlib.crypto: add last commit to help track changes. (#1426) 2019-08-02 06:37:19 +02:00
unknown-v
a27165f07e add []u64.str() 2019-08-02 06:07:16 +02:00
joe-conigliaro
be0796ce14 urllib: fix error message 2019-08-02 06:00:34 +02:00
Alexander Medvednikov
81da1f1ab2 vweb: run app.init() once 2019-08-02 05:54:40 +02:00
Alexander Medvednikov
8ecd62e56f comptime: fix app.$action() or {} 2019-08-02 05:20:18 +02:00
Alexander Medvednikov
f81562ee7e vweb: 404 2019-08-02 04:11:42 +02:00
Alexander Medvednikov
c145a5cd7d readme: add v install glfw 2019-08-02 02:13:33 +02:00
joe-conigliaro
8369525d8a net.urllib: fix unescape 2019-08-02 00:31:47 +02:00
Sylvio Tavares
0e798b4c51 time: fix rand() 2019-08-02 00:31:02 +02:00
Alexander Medvednikov
b57752e67e vweb: parse request headers 2019-08-01 18:51:21 +02:00
Alexander Medvednikov
3580179602 vweb: fix actions with ? 2019-08-01 17:57:06 +02:00
Alexander Medvednikov
3cd88cbb6f travis: install glfw vpm module 2019-08-01 17:40:45 +02:00
Alexander Medvednikov
cdfc4c8372 remove vlib/glfw (it's a vpm module now) 2019-08-01 17:31:04 +02:00
Alexander Medvednikov
a7e464fee9 user modules + v install from vpm 2019-08-01 17:28:25 +02:00
joe-conigliaro
d3c89273e8 net.urllib module 2019-08-01 15:01:03 +02:00
vitalyster
0197f20d47 make_tests.bat: exit with error on failed test 2019-08-01 13:23:36 +02:00
Alexander Medvednikov
eb313ebb5b option: increase the temporary limit 2019-08-01 01:19:45 +02:00
Alvydas Vitkauskas
cd49c2103b os: fix read_lines for win/dos files on unix 2019-08-01 00:48:10 +02:00
unknown-v
b124539507 Update download_win.v 2019-07-31 23:22:05 +02:00
Alexander Medvednikov
0243f9b0e9 term: remove enable_term_color_win() 2019-07-31 23:19:27 +02:00
Alexander Medvednikov
2c7e0c0257 http: fix download_win.v 2019-07-31 23:03:38 +02:00
Alexander Medvednikov
8058bf3750 http_nix.v: remove remaining C code 2019-07-31 23:01:06 +02:00
Alexander Medvednikov
448aaa36f2 http: clean up http_win.v and remove all remaining C code 2019-07-31 22:54:55 +02:00
unknown-v
46154c25b5 Update http_win.v 2019-07-31 22:45:29 +02:00
Alexander Medvednikov
54d2f9921f http: Windows fixes + clean up 2019-07-31 22:27:39 +02:00
Alexander Medvednikov
aac8503d83 http: use optionals (finally) 2019-07-31 22:15:24 +02:00
Alexander Medvednikov
15f1169102 disable REPL until it is fixed 2019-07-31 21:05:20 +02:00
Alexander Medvednikov
d3d4ee6b39 http: replace escape() with escape_url() 2019-07-31 20:57:34 +02:00
Vitaly Takmazov
550e8cd0cb http.escape and http.unescape for windows 2019-07-31 19:23:17 +02:00
Felix Scholz
12ecd0f3dc term: allow more colors to be used (bright styled ansi, rgb and hex)
* introduce bright versions of standard ansi colors

* allow developer to colorize messages with rgb

* allow developer to colorize messages using hex

* fix broken formatting
2019-07-31 19:22:38 +02:00
Henrixounez
715bd21118 compiler: check is ptr when free in closing scope (#1399) 2019-07-31 19:21:49 +02:00
vitalyster
37a0e6ebef Travis: run tests for Windows (#1403) 2019-07-31 19:01:52 +02:00
Henrixounez
7918a790b4 compiler: check if output file is a folder 2019-07-31 12:02:59 +02:00
Alvydas Vitkauskas
2e1da4b4bc Merge pull request #1050 from avitkauskas/fix-read-lines
os: fix read_lines
2019-07-31 10:56:36 +02:00
Joe Conigliaro
8c04b5fe9c use map.delete and last_node 2019-07-31 10:56:12 +02:00
Vitaly Takmazov
9b45b9ce66 repl: do not eat first line
for some reason first line was skipped
2019-07-31 10:52:39 +02:00
Alexander Medvednikov
ddb4f45b02 another map bug fix + fix some warnings 2019-07-31 10:47:58 +02:00
jilio
fa24a0cec5 os: fix is_dir 2019-07-31 10:38:29 +02:00
Vitaly Takmazov
68b46bb943 windows: utf-8 stdout was not initialized when we have main()
Initialization moved to init_consts for that
2019-07-31 10:20:40 +02:00
Vitaly Takmazov
f3d6bc9146 compiler: no need to optimize println on Windows
this fixes string interpolation
2019-07-31 10:01:02 +02:00
Alexander Medvednikov
e592485395 map: test the new fix 2019-07-31 09:57:19 +02:00
Alexander Medvednikov
a80f32254e map: fix delete() 2019-07-31 09:56:14 +02:00
vitalyster
375bc1352c f64.eq()
fixes float comparison tests
2019-07-31 09:20:40 +02:00
Alexander Medvednikov
e0b45e33ea string: fix a bug with split() 2019-07-31 07:26:22 +02:00
Alexander Medvednikov
a4882f1955 better C error message 2019-07-31 07:16:18 +02:00
jilio
6294c7878e vweb: recursive handle_static with mime types 2019-07-31 06:10:53 +02:00
Alexander Medvednikov
031f13ad11 readme: v up 2019-07-31 04:53:24 +02:00
Alexander Medvednikov
5c9a08ce81 v up: Windows fix 2019-07-31 04:49:29 +02:00
Alexander Medvednikov
f6e717a5fd v up to update V 2019-07-31 04:40:38 +02:00
Alexander Medvednikov
27d09ed514 http: make escape public on Windows 2019-07-31 04:00:43 +02:00
Alexander Medvednikov
8a7ddd102e vweb: tmpl fixes 2019-07-31 04:00:43 +02:00
Alexander Medvednikov
95d76993c9 .div hack 2019-07-31 04:00:43 +02:00
Alexander Medvednikov
8bb41d2de5 vweb: print address of the app 2019-07-31 04:00:43 +02:00
joe-conigliaro
1202631fa6 crypto.rand module 2019-07-31 03:24:12 +02:00
Alexander Medvednikov
17e8c1d628 map.delete(key) 2019-07-30 21:27:31 +02:00
Alexander Medvednikov
ad8b105b2c vweb example 2019-07-30 21:15:17 +02:00
AtjonTV
5b68e2ff50 Fix module import errors by checking dirs with dir_exists 2019-07-30 19:57:27 +02:00
Alexander Medvednikov
79be98d2fb Revert "Support for the printf optimisation for windows and wide strings"
This reverts commit acd28fa495.
2019-07-30 18:28:00 +02:00
Alexander Medvednikov
3e458a8801 vweb: small fixes 2019-07-30 18:27:52 +02:00
d2verb
9bcb5aaa55 defer: fix #1281 2019-07-30 18:05:06 +02:00
F1ssi0N
acd28fa495 Support for the printf optimisation for windows and wide strings 2019-07-30 18:04:19 +02:00
Vitaly Takmazov
3794129c91 make_tests.bat: run tests under Windows(gcc) 2019-07-30 17:13:07 +02:00
Alexander Medvednikov
548611bedc vweb: serve static files and vweb.text() 2019-07-30 15:53:35 +02:00
joe-conigliaro
5e57d099d7 v panic debug information 2019-07-30 15:08:14 +02:00
Richard Warburton
07ed320110 sync: WaitGroup 2019-07-30 15:06:16 +02:00
Alexander Medvednikov
a6df3e51d2 vweb.json() 2019-07-30 05:13:44 +02:00
joe-conigliaro
74b3ef3a3f minor module fixes 2019-07-30 03:49:47 +02:00
Vitaly Takmazov
468aac9750 glfw: add MacPorts library path 2019-07-30 03:49:12 +02:00
Vitaly Takmazov
a2d4d38e8a pg: add Darwin flag for MacPorts installation path 2019-07-30 03:48:49 +02:00
Joe Conigliaro
cfe581e2ab fix term 2019-07-30 03:15:46 +02:00
Alexander Medvednikov
69b6e682cb pg: fix GCC compilation error 2019-07-30 00:28:35 +02:00
Alexander Medvednikov
5bb8416baf update vweb readme 2019-07-29 19:46:26 +02:00
Alexander Medvednikov
626da27ad6 better C error message 2019-07-29 19:39:56 +02:00
Delyan Angelov
4a1970a322 http: return ?string 2019-07-29 19:18:26 +02:00
Alexander Medvednikov
ba6bcdb469 fix vweb template compilation 2019-07-29 19:14:07 +02:00
Alexander Medvednikov
460b4ee39f vweb documentation 2019-07-29 18:50:25 +02:00
Alexander Medvednikov
319094c7f8 update 0.1.7 changelog 2019-07-29 18:44:48 +02:00
Alexander Medvednikov
54f847a85b V 0.1.17 2019-07-29 18:31:47 +02:00
Alexander Medvednikov
ce1288e946 clean up 2019-07-29 18:24:48 +02:00
Alexander Medvednikov
207bab5f79 generics, vweb, comptime codegen, etc 2019-07-29 18:24:48 +02:00
Delyan Angelov
f1373874ef compiler: fix issue #1350 - an error is produced, when a void fn returns a value 2019-07-29 16:35:56 +02:00
Mike 'Fuzzy' Partin
ff72d9104d log: added timestamps 2019-07-29 16:34:22 +02:00
joe-conigliaro
d87030972e crypto: use new copy & clone 2019-07-29 16:33:35 +02:00
Richard Warburton
6701c3b263 Fixes #1362 2019-07-29 16:32:39 +02:00
Vitalie Ciubotaru
4100cca613 bf: fix a bug in bf.resize() (var name coincides with function name) 2019-07-29 16:31:48 +02:00
Alvydas Vitkauskas
8484de86c7 fix #1353 os.get_line 2019-07-29 04:44:54 +02:00
joe-conigliaro
45029f8c86 term: move enable_term_color_win() to colors_win.v 2019-07-29 04:44:21 +02:00
joe-conigliaro
1a22482c09 move module tests 2019-07-28 17:20:24 +02:00
joe-conigliaro
df06eee5e8 fn copy(dst, src) []byte 2019-07-28 17:19:59 +02:00
joe-conigliaro
c7edeb00a8 term: add better error detection on Windows 2019-07-28 17:19:03 +02:00
Joe Conigliaro
2a30564ed1 fix 2019-07-28 17:15:24 +02:00
Alexander Medvednikov
dbb64ec149 Revert "modules: fix "is not a directory" error"
This reverts commit d38940ad57.
2019-07-28 01:22:15 +02:00
Alexander Medvednikov
d38940ad57 modules: fix "is not a directory" error 2019-07-28 01:11:38 +02:00
Delyan Angelov
9cd2d68505 Fix #1334. Module glfw now imports gl. 2019-07-27 18:36:33 +02:00
Alexander Medvednikov
b0913dc5a8 print "running [exe name]" only in verbose mode 2019-07-27 16:42:17 +02:00
F1ssi0N
720648703b Hack interfaces into working with arguments 2019-07-27 16:30:57 +02:00
joe-conigliaro
26a1762156 make empty module dir error less confusing 2019-07-27 02:18:56 +02:00
Martin Rauscher
80ec11edcb use /opt/ instead of /etc/ for binary storage 2019-07-27 01:15:20 +02:00
Joe Conigliaro
3850227b46 use mod var 2019-07-27 01:14:35 +02:00
joe-conigliaro
7b95f09f86 detect import of non existent modules 2019-07-26 18:24:40 +02:00
joe-conigliaro
979917144f internal modules 2019-07-26 18:02:58 +02:00
joe-conigliaro
920ac3f92e crypto.rc4 module 2019-07-26 16:48:49 +02:00
Emily Hudson
90bb48db5d interactive debugging 2019-07-26 16:45:16 +02:00
Martin Rauscher
8b195ba32a Make building with docker more effecient
- cleaning up apt cache will reduce image size
- doing COPY after apt will allow to reuse previous layer on recompile
2019-07-25 22:16:19 +02:00
joe-conigliaro
ebf858b9ae crypto: remove unnecessary casts and comments 2019-07-25 18:41:38 +02:00
Joe Conigliaro
655cad58b2 add note & fix typo 2019-07-25 18:13:29 +02:00
Alexander Medvednikov
20a885ff1d []byte.clone() 2019-07-25 18:07:25 +02:00
Alexander Medvednikov
d8b83bdd00 crypto: add Go's license 2019-07-25 18:07:25 +02:00
joe-conigliaro
61f3982ee8 crypto.aes module 2019-07-25 17:49:57 +02:00
Alexander Medvednikov
f7530234c7 fix Windows build 2019-07-25 15:05:44 +02:00
Alexander Medvednikov
2ac579ca0a wrap up the new mut check 2019-07-25 14:13:35 +02:00
Alexander Medvednikov
ceb0139329 fix tests 2019-07-25 14:06:26 +02:00
Alexander Medvednikov
2ad0d0200d make the new mut check work with fn foo(mut bar) 2019-07-25 14:04:45 +02:00
Alexander Medvednikov
9ccd3bde01 do not allow declaring a mutable variable if it's never modified 2019-07-25 13:44:34 +02:00
Emily Hudson
dbf027acb8 MSVC: Use vswhere instead of mscrazy (#1307)
* Use vswhere + our own reg stuff instead of microsoft_craziness

* Cleanup code

* HKEY is a pointer so RegKey should be a pointer
2019-07-25 12:29:24 +02:00
Delyan Angelov
61fea2d82a #! support on Unix systems 2019-07-25 12:27:59 +02:00
unknown-v
082098ab67 sync_win.v : Add a Missing Closing Bracket 2019-07-25 12:25:38 +02:00
Mike 'Fuzzy' Partin
094f097e26 test.zsh: Renamed and made more portable 2019-07-25 12:25:12 +02:00
Alexander Medvednikov
3a8cdadcf5 free strings 2019-07-25 01:22:45 +02:00
Alexander Medvednikov
d1b732cbcc function argument benchmark 2019-07-25 00:13:54 +02:00
Alexander Medvednikov
9837d6cf69 fix option_test.v 2019-07-24 22:49:16 +02:00
Alexander Medvednikov
299d41e3b9 os: fix a memory leak in File.write(string) 2019-07-24 22:47:06 +02:00
Alexander Medvednikov
d2b33397cc optionals: better errors 2019-07-24 22:41:46 +02:00
0x9ef
a3e9a36553 Fix returned hash sum type 2019-07-24 20:29:11 +02:00
F1ssi0N
ca70d1f8a3 os: Make windows allocations more consistent & LocalFree args_list
if max is 512 then allocate `max * sizeof(wchar_t)`
2019-07-24 19:10:06 +02:00
F1ssi0N
f8bc893972 Re-add the case for msvc now that it is a valid comp-time option 2019-07-24 18:14:44 +02:00
AtjonTV
99355ae8b2 os: Implement a read-all for STDIN 2019-07-24 18:14:13 +02:00
Alexander Medvednikov
505f784047 fix log example 2019-07-24 17:59:54 +02:00
yep84
94a599d630 log: allow file logging 2019-07-24 17:50:29 +02:00
Emily Hudson
049d78a78d Change CGen so that v.c is compileable with msvc 2019-07-24 17:46:41 +02:00
Alexander Medvednikov
41f4ec5a3b Makefile: don't build thirdparty modules on installation 2019-07-24 17:39:04 +02:00
0x9ef
aea6a8075b Windows mutex 2019-07-24 17:36:20 +02:00
Alexander Medvednikov
2306901e6e os.flush_stdout() 2019-07-24 16:15:28 +02:00
Maciej Sopyło
58577f57c6 fix: segfault when using string.ustring_tmp() 2019-07-24 16:06:12 +02:00
Alexander Medvednikov
09c447e2b8 remove type keyword hack 2019-07-24 15:44:25 +02:00
Alexander Medvednikov
6b2063a2ea mutable args: don't allow primitives 2019-07-24 15:33:41 +02:00
Alexander Medvednikov
7ea688aa43 fix mutable array args 2019-07-24 15:10:48 +02:00
Emily Hudson
32aae80a64 Windows: fix some heap corruptions, fix msvc not building with unicode flags, fix os.getwd, fix mscrazy using a less recent installation 2019-07-24 15:00:26 +02:00
Vitaly Takmazov
0bbefca875 Windows: unicode command line 2019-07-24 14:32:36 +02:00
vitalyster
93a3521a67 Update make.bat 2019-07-24 13:15:00 +02:00
Alexander Medvednikov
7f29928aec examples: fix news_fetcher on Windows 2019-07-24 12:34:25 +02:00
vitalyster
fcb1f211e3 Windows Unicode I/O 2019-07-24 12:16:45 +02:00
Alexander Medvednikov
c28a490c17 @ for escaping keywords 2019-07-24 02:28:29 +02:00
Alexander Medvednikov
facf55cbc0 examples/news_fetcher: don't print the ids 2019-07-24 00:56:42 +02:00
lutherwenxu
4f11185231 Fix news_fetcher example
News_fetcher now uses proper numbering with mutex lock instead of the cursor
2019-07-24 00:54:16 +02:00
Alexander Medvednikov
13e1b4edb1 V 0.1.16 2019-07-24 00:45:32 +02:00
Nick Treleaven
6eb8766e59 http.new_request: Don't ignore mutated variables url, data 2019-07-24 00:32:41 +02:00
Justice Suh
d72c859bf9 net: socket error handling 2019-07-24 00:31:39 +02:00
Alexander Medvednikov
2291e9fcfe Revert "Windows Unicode support"
This reverts commit 8462e99bc5.
2019-07-24 00:24:34 +02:00
Alexander Medvednikov
b48e23757f msvc fixes 2019-07-24 00:20:07 +02:00
Zaoqi
be7f89f664 Update README.md (#1280) 2019-07-24 00:09:56 +02:00
d2verb
88758082d2 scanner.v: refactoring 2019-07-24 00:06:48 +02:00
vitalyster
8462e99bc5 Windows Unicode support 2019-07-23 23:40:24 +02:00
Emily Hudson
e25ea7f9dd add MSVC C backend support; fix live code reloading on Windows; other Windows fixes 2019-07-23 23:23:13 +02:00
Alexander Medvednikov
3cf8e18cf6 include <pthread> on all BSDs 2019-07-23 23:15:21 +02:00
joe-conigliaro
b06cfd702d module aliasing and sub modules for import () syntax 2019-07-23 23:12:55 +02:00
Alexander Medvednikov
527b9e13fa key in map syntax 2019-07-23 23:00:09 +02:00
Vitalie Ciubotaru
bd95f5bf8f bf: add basic documentation 2019-07-23 18:29:04 +02:00
TillCoyote
732099fa08 math: hypot() 2019-07-23 18:28:30 +02:00
Jonathan Vice
d69bac5565 glfw: fix typo 2019-07-23 18:27:53 +02:00
Archan Patkar
7b4c3ec618 math/complex: restructuring cmath as a submodule of math 2019-07-23 13:35:44 +02:00
Delyan Angelov
04bd8d7f7d compiler: Fix for #1268 . Passing -o file.c, skips the C compiler invocation and leaves the intermediary file.c . 2019-07-23 13:35:19 +02:00
d2verb
e25664dfbf Update .gitignore & add examples/hot_code_reloading/.gitignore 2019-07-23 13:30:02 +02:00
Alexander Medvednikov
89042b0f97 examples/tetris: an extra collision check 2019-07-23 03:29:11 +02:00
Alexander Medvednikov
083ee6c3c2 readme: docker 2019-07-23 02:41:55 +02:00
ANAGO Andy Ronnel
2c31469ec2 Dockerfile 2019-07-23 00:31:43 +02:00
unknown-v
981185e42f Windows displays a NaN as -1.#IND
https://stackoverflow.com/a/347940
2019-07-23 00:29:47 +02:00
Alexander Medvednikov
a2a0b149b2 examples/graph: update the graph instantly; add a couple of graphs 2019-07-23 00:24:42 +02:00
Rendims
5375038d88 string: avoid double allocation in trim_space() 2019-07-23 00:13:00 +02:00
Alexander Medvednikov
dd070e616d Makefile: rebuild thirdparty/ 2019-07-22 20:29:50 +02:00
Delyan Angelov
a307a51b46 live reload: stability fixes 2019-07-22 19:08:32 +02:00
Alexander Medvednikov
390394b56b string: make substr() copy the data, like in Java and C#; remove .cstr()
this makes managing memory used by strings much easier
V strings are now fully compatible with C strings
2019-07-22 17:03:45 +02:00
Alexander Medvednikov
59eac5686f readme: *BSD support 2019-07-22 16:07:37 +02:00
Alexander Medvednikov
11199b9635 Makefile: hot code reloading can now be tested 2019-07-22 13:46:35 +02:00
Alexander Medvednikov
01caee5b53 include <pthread> on macOS 2019-07-22 13:45:02 +02:00
Alexander Medvednikov
5933f2107a examples/graph: a small import fix 2019-07-22 13:45:02 +02:00
whoami
64e9d9e2c3 Makefile: add install, uninstall, symlink targets 2019-07-22 13:43:30 +02:00
joe-conigliaro
0ed240e123 modules: cycle error improvements 2019-07-22 12:44:08 +02:00
Delyan Angelov
a65ae726ee live reload: fix SIGSEGV when calling dlclose, while a live fn is still running. 2019-07-22 12:25:41 +02:00
Rui Sun
913cd2ede4 update README.md correct path 2019-07-22 12:19:00 +02:00
Alexander Medvednikov
4430b9475d Remove Azure for now 2019-07-22 12:16:24 +02:00
Alexander Medvednikov
d15261ac2a Travis: use shell syntax on Windows 2019-07-21 21:21:23 +02:00
Alexander Medvednikov
9cad88bdb8 Travis: make V compile itself on Windows 2019-07-21 21:17:42 +02:00
Alexander Medvednikov
20dbe0f3a7 Travis: fix Windows attempt #1 2019-07-21 21:15:23 +02:00
Alexander Medvednikov
0875e93716 Update .travis.yml 2019-07-21 21:08:29 +02:00
Alexander Medvednikov
e11c23a817 main.v: print how much time cc() took; more flags explained 2019-07-21 19:42:51 +02:00
Alexander Medvednikov
18d95114e0 testing: do not print anything if a test passed successfully 2019-07-21 17:59:25 +02:00
joe-conigliaro
135f200ea2 modules: cyclic import detection 2019-07-21 17:53:35 +02:00
Alexander Medvednikov
23c5f88f3e Revert "Windows Unicode I/O "
This reverts commit 3e005074a3.
2019-07-21 17:29:40 +02:00
Alexander Medvednikov
9c9fe7029e fix os.is_dir on Windows 2019-07-21 17:14:25 +02:00
Alexander Medvednikov
4d5336897e array.slice(): bounds out of range check 2019-07-21 16:55:04 +02:00
Alexander Medvednikov
ac238a5362 allow multiple defers 2019-07-21 16:34:21 +02:00
Alexander Medvednikov
5d188130e5 fix memory free 2019-07-21 16:30:10 +02:00
Alexander Medvednikov
e2364f6285 main.v: update help 2019-07-21 14:42:54 +02:00
Alexander Medvednikov
40c31f701f free arrays when they are out of scope
main.v: update help
2019-07-21 14:42:31 +02:00
Alexander Medvednikov
385f1c856e Create test.sh 2019-07-21 13:44:20 +02:00
Alexander Medvednikov
a6e4720a4d os: fix popen on Windows 2019-07-21 13:37:27 +02:00
vitalyster
3e005074a3 Windows Unicode I/O 2019-07-21 13:29:32 +02:00
Alexander Medvednikov
6e6f6bc387 free/malloc fixes 2019-07-21 12:36:21 +02:00
Alexander Medvednikov
975286302c fix Tetris onkeydown 2019-07-21 11:56:43 +02:00
Alexander Medvednikov
3245377683 fix defer before returns 2019-07-21 00:52:21 +02:00
Alexander Medvednikov
1b4656a4dc string cast: better error message 2019-07-21 00:04:34 +02:00
Alexander Medvednikov
c3c6648c57 string(bytes_array) cast 2019-07-20 22:03:38 +02:00
Alexander Medvednikov
7f512eaf72 examples/hot_code_reloading: graph builder improvements 2019-07-20 17:59:40 +02:00
Alexander Medvednikov
5c12d13b19 builtin: make string.add() private 2019-07-20 16:43:33 +02:00
Alexander Medvednikov
72159d4169 vlib/glm: fix glm_test.v 2019-07-20 16:39:09 +02:00
Alexander Medvednikov
769cda1d1f simplify gg; remove forced OpenGL dependency; graph builder /w hot code reloading 2019-07-20 16:06:15 +02:00
Brian Callahan
876dee6435 OpenBSD needs pthread.h
Like Linux, OpenBSD also needs pthread.h (likely that all the BSDs do).
2019-07-20 11:48:06 +02:00
Alexander Medvednikov
26ed3fb372 examples/hot_code_reloading: graph builder 2019-07-19 13:15:47 +02:00
Archan Patkar
760034b6b1 math/stats: added basic stats operations 2019-07-19 11:50:32 +02:00
0x9ef
d6ddfa124d Fixed get_error_msg for *nix
* Fixed undefined: get_error_msg
2019-07-18 20:21:48 +02:00
d2verb
67c2932f34 parser: change cur_line, tmp_line only in main pass 2019-07-18 20:21:23 +02:00
Delyan Angelov
38c58f9f1b compiler: fix #1193 . Flag -c_options is now named -cflags.
You can also pass -cflags '-Os -fno-inline-small-functions'
2019-07-18 19:45:31 +02:00
Delyan Angelov
97e97222ee live reload: All of the [live] functions are reloaded now, not just the first one. 2019-07-18 19:34:28 +02:00
joe-conigliaro
b3bdcfda42 Fix modules order 2019-07-18 19:25:46 +02:00
Alexander Medvednikov
382f85fa39 -live: fix an info message 2019-07-18 18:03:09 +02:00
Alexander Medvednikov
53b6c91d18 allow building code with [live] without -live 2019-07-18 16:02:06 +02:00
Delyan Angelov
1ef0f3b549 live reload: the reload_so function now uses too, instead of hard coding the v name (which some people do not have in their PATH or have as an alias) 2019-07-18 15:56:38 +02:00
joe-conigliaro
ea2412297d crypto.sha512: change hardcoded u64's back to consts 2019-07-18 11:34:04 +02:00
joe-conigliaro
53ac6d352f auto detect u64 const 2019-07-18 10:55:39 +02:00
joe-conigliaro
43070412f7 implement crypto.sha256 + some crypto cleanup 2019-07-18 10:50:05 +02:00
Vitalie Ciubotaru
c0911ea74b bf: add reverse(), resize(), pos() and rotate() 2019-07-18 10:49:32 +02:00
Alexander Medvednikov
f5c8ee4742 string(buffer, len) cast 2019-07-18 04:50:44 +02:00
d2verb
92fbe56276 table: fix #1219 2019-07-18 04:32:49 +02:00
Alexander Medvednikov
6f99876b6e readme: add -lm 2019-07-18 03:03:33 +02:00
whoami
810e85541c Makefile: update 2019-07-18 00:09:27 +02:00
Alexander Medvednikov
c35adbea91 vfmt fixes 2019-07-17 21:00:39 +02:00
whoami
7bbaf432e6 Makefile: ability to compile thirdparty libraries (for linux packages) 2019-07-17 20:40:50 +02:00
joe-conigliaro
8cd1f962d3 implement missing string to int type methods (#1210)
* implement missing string to int methods

* make number base auto detected
2019-07-17 20:11:14 +02:00
Alexander Medvednikov
7dc7502fe2 fix REPL and hot code reloading for users that don't have V in PATH 2019-07-17 19:23:47 +02:00
unknown-v
9d4b4df54f net : fix error msg
from 
os.hostname() cannot get the host name
to
net.hostname() cannot get the host name
2019-07-17 18:42:10 +02:00
joe-conigliaro
0ca58aba5e Fix array.reverse() test 2019-07-17 18:35:40 +02:00
Ned Palacios
b17df207f2 additional .gitignore rules for windows development 2019-07-17 18:23:28 +02:00
Joe Conigliaro
09fb000e67 fix 2019-07-17 18:21:39 +02:00
Alexander Medvednikov
251e32948e fix Windows build: move hostname to net/ 2019-07-17 13:50:58 +02:00
Alexander Medvednikov
b9f3f2d622 v script 2019-07-17 13:49:42 +02:00
joe-conigliaro
55b8a9acb9 crypto.sha512 2019-07-17 11:00:15 +02:00
Alexander Medvednikov
bdf1717703 examples/bounce.v: minor fixes 2019-07-17 02:55:28 +02:00
Ned Palacios
9782d85709 enable render term color on windows by default 2019-07-17 02:52:17 +02:00
Alexander Medvednikov
14ad70d3a0 match: else 2019-07-17 02:47:45 +02:00
Alexander Medvednikov
76d6e9fd1a minor match_test.v fixes 2019-07-17 02:44:41 +02:00
Alexander Medvednikov
a9463a180d new match statement 2019-07-17 02:41:08 +02:00
Igor Pershikov
3f506714ec Fix bug with BOM 2019-07-17 00:05:04 +02:00
Yash Tripathi
982496ffce math: faster factorial function 2019-07-17 00:03:51 +02:00
unknown-v
a743ecaff9 Windows : fix build
curl -Os https://raw.githubusercontent.com/vlang/vc/master/v.c
cc -std=gnu11 -w -o v v.c -lm
ccK5ic4o.o:v.c:(.text+0x6f62): undefined reference to `__imp_gethostname'
collect2.exe: error: ld returned 1 exit status
2019-07-17 00:02:31 +02:00
0x9ef
8ef3313d63 Fixed buf on hostname and added optional type.
Before submitting this PR, submit https://github.com/vlang/v/pull/1188
2019-07-17 00:02:07 +02:00
0x9ef
91a712fdf0 Check for max error code overflow
If do not check the overflow of the maximum error code (15841), this can lead to a program crash.
2019-07-17 00:01:42 +02:00
Delyan Angelov
5d0cb1437c Add support for VFLAGS environment variable, merged with cmd args.
Using VFLAGS, you can pass common options through it to the V compiler,
without having to manually specify them everytime when you type V ...
In addition, since environment variables are *inherited*, all subprocess
V compilers, which V launches (for example when compiling with -live),
will *also* use the same VFLAGS environment variable.

Example usage:
  export VFLAGS="-debug -show_c_cmd"
  v -live message.v

=> This will keep *both* of the generated C source files .message.c
   *AND* .message_shared_lib.c . It will also cause both V compile
   subprocesses to print their resulting C compiler backend lines.
   This is very useful when using GDB to debug problems.
2019-07-16 19:35:16 +02:00
Delyan Angelov
17580f3013 Support for passing different options to the C compiler backend.
Example: 'v -c_options=-Os' will pass -Os to the C compiler.
In effect the C compiler will optimize the generated binary for size.
2019-07-16 19:34:44 +02:00
Rustem B
47b0221b82 os: hostname function 2019-07-16 19:23:47 +02:00
Joe Conigliaro
36442976c3 fix dir_exists on win 2019-07-16 18:31:49 +02:00
Alexander Medvednikov
1748632144 do not create ~/.vlang directory 2019-07-16 17:44:25 +02:00
Ned Palacios
e638e47af5 setenv and unsetenv for windows fix 2019-07-16 17:18:08 +02:00
Alexander Medvednikov
f5fa43d2fa os: fix executable() for all other BSDs 2019-07-16 16:37:59 +02:00
Alexander Medvednikov
674969665e freebsd fix 2019-07-16 16:22:25 +02:00
Alexander Medvednikov
6fabd36732 freebsd: fix os.executable() 2019-07-16 16:19:55 +02:00
Ned Palacios
c3ad75191d os: fix 'rm' and 'rmdir' implementation on windows 2019-07-16 15:55:51 +02:00
Alexander Medvednikov
8aa7da1be1 http_win: fix BUF_MAX 2019-07-16 15:29:27 +02:00
Alexander Medvednikov
54b069f9ad fix high order fns 2019-07-16 14:39:34 +02:00
joe-conigliaro
9c586e7e92 crypto md5 2019-07-16 14:20:51 +02:00
Alexander Medvednikov
8c516bec4f [][]int 2019-07-16 13:56:48 +02:00
Alexander Medvednikov
31032d3a62 allow field 'type' 2019-07-16 13:01:39 +02:00
Alexander Medvednikov
830f63e86a make maps work with structs defined in different modules 2019-07-16 12:18:52 +02:00
Alexander Medvednikov
0a4a9a35c3 .key_type 2019-07-16 12:17:17 +02:00
Alexander Medvednikov
961ffb1868 Windows: temporary fix of dir_exists 2019-07-16 03:17:49 +02:00
Alexander Medvednikov
48d5650765 examples/hot_code_reloading: move the square faster 2019-07-16 02:23:09 +02:00
Alexander Medvednikov
eb7aee5ae0 store temp C files in the same directory 2019-07-16 02:12:05 +02:00
Alexander Medvednikov
9c63cac54d another Windows fix 2019-07-16 02:06:39 +02:00
Alexander Medvednikov
090cdcf3b9 os: fix PathSeparator on Windows 2019-07-16 01:59:28 +02:00
Alexander Medvednikov
cc06fe7ae6 os.dir(); fix vroot on Windows 2019-07-16 01:57:06 +02:00
Alexander Medvednikov
9177256726 Update CHANGELOG.md 2019-07-16 00:03:20 +02:00
Alexander Medvednikov
8902256592 V 0.1.15 2019-07-15 23:56:18 +02:00
Alexander Medvednikov
edbcefb811 fix and simplify VROOT 2019-07-15 23:33:31 +02:00
Alexander Medvednikov
24a1e0e24a better os.executable on macos 2019-07-15 23:25:11 +02:00
Justice Suh
b20d7ad086 builtin: Move free from array.v to builtin.v 2019-07-15 22:56:10 +02:00
Alexander Medvednikov
840e496a51 force snake_case in variable names 2019-07-15 22:53:33 +02:00
Alexander Medvednikov
100bcc2034 use defer 2019-07-15 22:18:43 +02:00
Alexander Medvednikov
17c6ba04a2 defer statement 2019-07-15 22:13:12 +02:00
Archan Patkar
d58174e77f math: moved fraction to math/fraction 2019-07-15 21:16:41 +02:00
Alexander Medvednikov
62e6e03492 -ldl is only required on Linux 2019-07-15 20:40:37 +02:00
0x9ef
9b5383341d Add get_error_msg 2019-07-15 20:39:09 +02:00
Alexander Medvednikov
9b020fad53 fix OpenBSD build 2019-07-15 20:22:48 +02:00
Alexander Medvednikov
374781da1a OpenBSD, NetBSD, DragonFly support 2019-07-15 20:19:07 +02:00
Alexander Medvednikov
ecda895003 move zip C dependency to thirdparty/ 2019-07-15 19:30:53 +02:00
Alexander Medvednikov
449fd372f9 *_nix.v support 2019-07-15 19:23:09 +02:00
Alexander Medvednikov
b36a9f7e55 glfw always on top 2019-07-15 19:23:09 +02:00
Paparoni Alvardo
f27777af56 Add wrapper of https://github.com/kuba--/zip 2019-07-15 18:55:00 +02:00
joe-conigliaro
a7529b7b05 sha1 implementation + helper funcs 2019-07-15 17:49:01 +02:00
Delyan Angelov
37aff9b107 hot reload: no -sanitize is needed anymore, -live is now enough on both Linux and MacOS X
* hot reload for GL programs: force the main executable (the shared library loader) to be build with -rdynamic flag, when -live is passed to v compiler.

* hot reload: optimize away a redundant load_so/0 call at the start of the reload_so thread.

* hot code reload for MacOSX requires -flat_namespace flag instead of -rdynamic (on linux).
2019-07-15 17:32:00 +02:00
Alexander Medvednikov
7c6f59afa6 FreeBSD support 2019-07-15 17:24:44 +02:00
Carl Bordum Hansen
92fb9c8b94 VCasino was printing the opposite of intended 2019-07-15 17:20:16 +02:00
d2verb
4020a3ab8c Prevent main function form returning value 2019-07-15 17:19:24 +02:00
d2verb
40ad868f22 Fix #1107 2019-07-15 16:30:06 +02:00
Alexander Medvednikov
5a9116b697 http: make do() public 2019-07-15 16:06:23 +02:00
Nick Treleaven
d8df8474bc http_win.do: Reject URL without '://'
Before it would accept 'domain/path' but set host = 'ath'.
2019-07-15 15:43:54 +02:00
Paparoni Alvardo
7058333f17 Add get_module_filename 2019-07-15 14:27:33 +02:00
Archan Patkar
4af58e0925 cmath: added arg, log and complex pow operations 2019-07-15 14:27:03 +02:00
Henrixounez
48c06df5f5 parser: fix bug not printing percentages 2019-07-15 14:26:39 +02:00
d2verb
916b13b286 fix maps 2019-07-15 12:33:18 +02:00
Delyan Angelov
0556f5fd4e When compiling with -shared (a step in compiling with -live), store the C intermediary file in a different file than main (loader) file, so that debugging symbol lookup information is correct (the files are not replaced constantly with each other). 2019-07-15 12:30:03 +02:00
Delyan Angelov
60ad97c4fb fix hot code reloading for GUI example bounce on linux: works when compiled with 'v -live -sanitize bounce.v' .
It crashes with SIGSEGV, when -sanitize is not given.
Also thirdparty/glad/glad.o should be build with -fPIC .
2019-07-15 12:28:35 +02:00
Alexander Medvednikov
3b1964e9df migrate remaining code to the new maps 2019-07-14 22:26:21 +02:00
Alexander Medvednikov
f7dbbf5810 re-write map.v and update the compiler 2019-07-14 22:08:17 +02:00
Vitalie Ciubotaru
9a3baf5609 bf: add setall(), clearall(), string() and str2bf() 2019-07-14 18:24:37 +02:00
Alexander Medvednikov
7fa1f423e2 fix time_test.v 2019-07-14 17:08:14 +02:00
joe-conigliaro
6c2e313155 add missing implementation of os.getexepath for mac 2019-07-14 16:50:24 +02:00
hazohelet
441281dd4f parser: fix small typo 2019-07-14 16:48:57 +02:00
Alexander Medvednikov
6995cc0234 time: fix test_days_in_month() 2019-07-14 16:47:02 +02:00
nxshock
1ce295b683 time: days_in_month() 2019-07-14 16:43:57 +02:00
0x9ef
82ed0156c5 Fixed clang build for windows.
Fixed:
C:\Users\C182~1\AppData\Local\Temp\ccb5oFDP.o: In function `os__fork':
C:/Users/─рэ //.vlang//v2.exe.c:4831: undefined reference to `fork'
C:\Users\C182~1\AppData\Local\Temp\ccb5oFDP.o: In function `os__wait':
C:/Users/─рэ //.vlang//v2.exe.c:4840: undefined reference to `wait'
collect2.exe: error: ld returned 1 exit status
2019-07-14 12:38:03 +02:00
Justice Suh
436d7592c7 os: fork() and wait() 2019-07-14 10:22:41 +02:00
Alexander Medvednikov
48f841bb26 make enums defined in other modules work 2019-07-14 00:10:53 +02:00
Justice Suh
5dfd5fa3e7 net: add windows socket support 2019-07-14 00:04:45 +02:00
d2verb
2cb12b4f4e rand: change rand.seed() to receive seed value 2019-07-13 18:17:45 +02:00
Alexander Medvednikov
af7d49103b json: Windows fix 2019-07-13 16:47:23 +02:00
joe-conigliaro
b4afa964fc hash/crc32 2019-07-13 15:11:32 +02:00
Nick Treleaven
cec3ea5b4d Document v -lib and don't advertise --help long option
--help and --version are accepted, but these don't fit the `-option`
format of V's other options. To avoid confusion, don't mention them.
2019-07-13 14:54:31 +02:00
Alexander Medvednikov
90c8da2254 readme: clarify installation instructions 2019-07-13 12:49:55 +02:00
Justice Suh
5d7bac2016 os: add flush method 2019-07-13 12:30:52 +02:00
unknown-v
3281e44e84 http_win : fix buf length
Line 157 : buf[nr_read] = 0 
set the null character '\0'
2019-07-13 12:30:21 +02:00
d2verb
2811145437 Add enum_test.v 2019-07-13 12:19:57 +02:00
joe-conigliaro
298ca8676f Change import syntax to "import as alias" 2019-07-13 12:15:16 +02:00
Alexander Medvednikov
163cd8576b travis: make.bat 2019-07-12 21:10:22 +02:00
Alexander Medvednikov
14a8f3dae3 travis: fix windows 2019-07-12 20:58:43 +02:00
d2verb
14bbf766b0 Update examples/.gitignore 2019-07-12 20:46:58 +02:00
Vitalie Ciubotaru
ef899b7c09 bf: add cmp(), join(), slice(), popcount() and hamming() 2019-07-12 20:46:37 +02:00
Koustav Chowdhury
2538a7e752 math : fix typos 2019-07-12 20:45:56 +02:00
Nick Treleaven
4c4e0c690c Fix missing rename of pos -> hpos; move s next to use site 2019-07-12 20:43:42 +02:00
aguspiza
d0e7d0070d fix travis windows user home 2019-07-12 20:35:01 +02:00
Alexander Medvednikov
5baff9beda http: Windows fixes 2019-07-12 16:26:02 +02:00
Alexander Medvednikov
7d5f29dbd1 Update CHANGELOG.md 2019-07-12 16:11:32 +02:00
Alexander Medvednikov
635516fbd4 travis: bring back Windows 2019-07-12 16:10:32 +02:00
Alexander Medvednikov
c9b1027ef6 readme: simplify installation instructions 2019-07-12 15:58:10 +02:00
Marco Böttcher
cb9fb66ccf flag: added a simple command line parser 2019-07-12 15:47:27 +02:00
hazohelet
2a0d8072c1 delete unnecessary lines 2019-07-12 15:46:15 +02:00
Archan Patkar
846d4e2210 cmath: Added Cot,Sec,Cosec support for complex 2019-07-12 12:56:21 +02:00
eulerkochy
7f4c3cda4d reduce redundant code, add tests for reduce and gcd 2019-07-12 08:50:11 +02:00
Koustav Chowdhury
08866f1331 math : add error and gamma functions; sort all functions 2019-07-12 07:46:40 +02:00
joe-conigliaro
9a957ccc18 module aliasing & file import scope 2019-07-12 07:37:54 +02:00
Alexander Medvednikov
56b7c9e35f for key, val in map syntax 2019-07-12 07:27:30 +02:00
Alexander Medvednikov
e246833daa math.v note 2019-07-12 07:01:14 +02:00
hazohelet
b039538a27 parser: fix if expressions with multiple else if's 2019-07-12 06:54:01 +02:00
Alexander Medvednikov
5b3295db94 remove # from gg and glm 2019-07-12 06:50:25 +02:00
hazohelet
e15c2da1f4 enable else-if expression 2019-07-12 06:04:37 +02:00
Alexander Medvednikov
22b41c7873 V 0.1.14 2019-07-12 05:23:00 +02:00
Alexander Medvednikov
28d379dc7b make glfw work on Windows 2019-07-12 05:04:27 +02:00
hazohelet
560ba55572 enable consts with operators in scripts 2019-07-12 04:53:51 +02:00
Alexander Medvednikov
f834644db4 make gg work on Windows; prebuild glad and cJSON; new ft module 2019-07-12 04:50:14 +02:00
eulerkochy
06e7354d18 change log2 implementation to use C.log2() 2019-07-11 20:42:51 +02:00
Archan Patkar
7701be2242 cmath: added inverse trig operations 2019-07-11 16:53:34 +02:00
Alexander Medvednikov
da51fea605 fix disappearing printf when compiling with 2019-07-10 22:07:56 +02:00
Alexander Medvednikov
4a8ba9756f disable u32 check for now 2019-07-10 22:05:50 +02:00
Alexander Medvednikov
892d2b58ac Makefile: add -lm 2019-07-10 21:59:08 +02:00
Alexander Medvednikov
9efe305093 fix Linux build 2019-07-10 21:57:15 +02:00
Alexander Medvednikov
e1a6453302 move Complex logic to cmath
It was causing problems with cross compiling for Linux, and it should be
a separate module anyway, just like in Go and Python.
2019-07-10 21:47:13 +02:00
Alexander Medvednikov
3d4cd0bbc0 check integer const overflow at compilation 2019-07-10 21:22:03 +02:00
Archan Patkar
69d2db0f1e math: added complex trig operations 2019-07-10 20:50:43 +02:00
Alexander Medvednikov
1b09e37a80 fix typ_to_fmt() 2019-07-10 14:38:39 +02:00
Alexander Medvednikov
c8fc262da3 println: make aliases printable 2019-07-10 14:26:37 +02:00
Alexander Medvednikov
fba8443f30 allow defining methods on aliases 2019-07-10 14:18:21 +02:00
hazohelet
00ea112b66 complex, fraction: simplify and format source code 2019-07-10 13:51:48 +02:00
Alexander Medvednikov
9907f07602 fix the __ error message 2019-07-10 10:08:37 +02:00
Alexander Medvednikov
28843a12c7 cache string.hash() 2019-07-10 10:00:12 +02:00
Alexander Medvednikov
2ab1ad8b30 Update CHANGELOG.md 2019-07-10 09:22:42 +02:00
Alexander Medvednikov
0b108908ed Update CHANGELOG.md 2019-07-10 09:20:02 +02:00
Alexander Medvednikov
1b24253d8c V 0.1.3 changelog 2019-07-10 09:19:30 +02:00
Alexander Medvednikov
e1ddac1590 utf8: remove unused UTF8_CHAR_LEN macro and add a simple utf8 test 2019-07-10 09:07:04 +02:00
Alexander Medvednikov
68228f9977 parser: clean up submodule implementation a bit 2019-07-10 09:02:04 +02:00
Alexander Medvednikov
87762d6cf3 DOT => .dot 2019-07-10 02:07:54 +02:00
Alexander Medvednikov
c44d54fb4c V 0.1.13 2019-07-10 02:03:09 +02:00
Alexander Medvednikov
26ef99293d new enum syntax; update the compiler (p.tok == .name) 2019-07-10 02:02:38 +02:00
Koustav Chowdhury
385f47c0cd add abs for complex, add tests (#1043) 2019-07-09 21:12:51 +02:00
Vitalie Ciubotaru
c4fcfcec88 bf: add a module implementing operations with bit arrays (#1049) 2019-07-09 21:11:09 +02:00
Henrixounez
26af513e1b repl: remove void line for unused and compile as repl 2019-07-09 20:55:37 +02:00
Delyan Angelov
932f6d1bef Fix hot code reloading on linux 2019-07-09 20:54:23 +02:00
Archan Patkar
3f916efb64 math: additional complex operations with tests 2019-07-09 20:51:46 +02:00
Henrixounez
7b1be8a2bd CI: Add back erased commits and dont test hot code examples 2019-07-09 20:44:30 +02:00
archanpatkar
f767218107 term: optimized move function 2019-07-07 22:48:20 +02:00
hazohelet
ccf733ac95 add angle func 2019-07-07 22:42:03 +02:00
eulerkochy
b40ad7c83f save a byteptr memory, add tests 2019-07-07 22:37:17 +02:00
Alexander Medvednikov
045d480c8c clean up the examples a bit 2019-07-07 22:09:08 +02:00
Alexander Medvednikov
7fed451226 inotify TODO 2019-07-07 22:04:41 +02:00
Alexander Medvednikov
de8dc4cddb hot code reloading examples 2019-07-07 22:02:27 +02:00
Nick Treleaven
af19aa5096 Fix #1021 - Optional or branch doesn't define err 2019-07-07 01:24:36 +02:00
joe-conigliaro
8a2d25247f submodules 2019-07-07 01:22:47 +02:00
aguspiza
36908fa304 fix for #1020 2019-07-07 01:20:56 +02:00
pverghese
144d7ca362 Added benchmarks 2019-07-07 01:19:54 +02:00
vertical222
8c3e47c9de nbody.v fixes 2019-07-07 01:18:04 +02:00
archanpatkar
818f8252f6 math: basic complex number support with tests 2019-07-07 01:16:49 +02:00
pverghese
758267254d Added Benchmark-games: spectralnorm 2019-07-06 16:49:30 +02:00
Alexander Medvednikov
59796a4168 small REPL fixes 2019-07-06 15:39:26 +02:00
Shivanjan Chakravorty
f630d3f342 main: vrepl interactive shell update 2019-07-06 12:07:44 +02:00
vertical222
0f8682d2f0 Create nbody.v 2019-07-06 12:03:30 +02:00
Henrixounez
28c2a949b2 compiler: fix errors on dots methods 2019-07-06 12:02:18 +02:00
hazohelet
204bcee951 fix typo 2019-07-06 12:01:58 +02:00
Alexander Medvednikov
68b7ae26b3 fix tests 2019-07-05 22:12:06 +02:00
Alexander Medvednikov
8d407cec90 another Windows \r\n bug fix 2019-07-05 22:07:44 +02:00
Alexander Medvednikov
871fb3831a do not allow fn main() to return a value 2019-07-05 22:03:00 +02:00
Alexander Medvednikov
d47e2f113f Revert "make function arguments immutable"
This reverts commit 0f0ed8d716.
2019-07-05 02:44:22 +02:00
Alexander Medvednikov
0f0ed8d716 make function arguments immutable 2019-07-05 00:24:13 +02:00
Alexander Medvednikov
74dbb1bce3 interface: fix function is private bug 2019-07-04 23:30:11 +02:00
Alexander Medvednikov
60c4d99407 Update README.md 2019-07-04 22:52:23 +02:00
Alexander Medvednikov
9afa9ad15a readme: simpler Windows instructions 2019-07-04 22:50:09 +02:00
Alexander Medvednikov
ebbea9f560 Revert "Added const INVALID_HANDLE_VALUE"
This reverts commit adef37f0f4.
2019-07-04 22:39:20 +02:00
Alexander Medvednikov
92528205c1 minor fixes 2019-07-04 22:39:15 +02:00
0x9ef
adef37f0f4 Added const INVALID_HANDLE_VALUE 2019-07-04 22:26:07 +02:00
d2verb
504c0d6077 Modify examples/.gitignore 2019-07-04 22:05:12 +02:00
Alexander Medvednikov
cc77d8cdd2 fix Windows line ending bug 2019-07-04 21:55:29 +02:00
Alexander Medvednikov
9b0bb2f72c make.bat for easier compilation on Windows 2019-07-04 20:44:44 +02:00
Justice Suh
9e4ae929a4 os: remove test file 2019-07-04 20:37:35 +02:00
joe-conigliaro
4e1afc148a os: add term colors for Windows +minor fixes 2019-07-04 17:39:35 +02:00
archanpatkar
b745234a52 math:added basic tests for fraction and fixed typo 2019-07-04 17:38:36 +02:00
Alexander Medvednikov
300ed59598 do not allow import builtin 2019-07-04 17:36:53 +02:00
Alexander Medvednikov
8f10e37370 make << work with appending arrays; PostgreSQL driver 2019-07-04 17:31:14 +02:00
Cytown
fcf8909c75 add test for array_repeat with f32/f64
Signed-off-by: Cytown <cytown@gmail.com>
2019-07-04 13:01:51 +02:00
Cytown
fbe8f6c774 fix array initial with [0.0/f32/f64; length] compile error
solution: add array_f32/array_f64 type
Signed-off-by: Cytown <cytown@gmail.com>
2019-07-04 13:01:51 +02:00
Joe Conigliaro
6b0e4a1d7b fix ls() win not ret []string when cant open dir 2019-07-04 12:59:41 +02:00
Kriyszig
801e06318f Factorial doesn't accept negative numbers
Previously factorial could accept negative number which isn't defined
2019-07-04 12:59:06 +02:00
Alexander Medvednikov
ebbd63811d readme: move Windows instructions to a wiki 2019-07-04 12:40:07 +02:00
Alexander Medvednikov
fcf071b630 readme: Visual Studio build instructions 2019-07-04 12:36:42 +02:00
Alexander Medvednikov
d117c0a742 Update README.md 2019-07-04 02:50:33 +02:00
Alexander Medvednikov
cbd78a9bc0 Update CHANGELOG.md 2019-07-04 02:39:14 +02:00
Alexander Medvednikov
04d7b08444 V 0.1.12 changelog 2019-07-04 02:38:28 +02:00
Alexander Medvednikov
68ed555e91 V 0.1.12 2019-07-04 02:21:27 +02:00
joe-conigliaro
4d9c6197fd initial Implementation of ls() for windows 2019-07-04 02:16:39 +02:00
marco
155e1fa961 FIX #202
allow interface method with empty (void) return type

-> only look for type declaration if no new line has been
   while skipping whitespace
2019-07-04 01:04:10 +02:00
Alexander Medvednikov
7fdd94fcbb println: fix a bug with u64 etc and newlines 2019-07-04 00:54:40 +02:00
Alexander Medvednikov
1e32a4cec4 println: optimize and remove memory leaks 2019-07-04 00:40:30 +02:00
Alexander Medvednikov
5d4d3b838b StringsBuilder => strings.Builder; strings.repeat() 2019-07-03 22:18:46 +02:00
Archan Patkar
e35ff0533b math: adopted i64 in Fraction and typo fixed 2019-07-03 21:50:54 +02:00
Alexander Medvednikov
8c36b9499d make json work with new optionals 2019-07-03 21:50:06 +02:00
Alexander Medvednikov
dec0d961f5 os: clean up file functions, use optionals 2019-07-03 21:37:12 +02:00
archanpatkar
ffb4da791d math: converted gcd and lcm to support i64 2019-07-03 19:40:44 +02:00
Ivan Sharavuev
290e1df893 Move token string length from magic number to constant. 2019-07-03 18:58:50 +02:00
nxshock
b3e5c89ba9 time: add is_leap_year(year int) 2019-07-03 18:55:07 +02:00
Alexander Medvednikov
d9753ee2c6 lots of vfmt fixes 2019-07-03 16:37:21 +02:00
pverghese
05ef1e0681 Removed unnecessary printf statement which corrupts output of http.get 2019-07-03 16:13:52 +02:00
archanpatkar
5e0ae9a429 net: added listen_backlog to enable custom backlog 2019-07-03 16:13:02 +02:00
Zaoqi
015467778d Update .gitignore 2019-07-03 16:12:37 +02:00
Justice Suh
a25c4bb59f compiler: add debug flag 2019-07-03 16:10:21 +02:00
archanpatkar
4037019bb7 Added support for Fractions 2019-07-03 16:07:59 +02:00
Alexander Medvednikov
7a3b5c20dd time: fix empty unix 2019-07-03 01:27:38 +02:00
Justice Suh
5c42a31b9b os: capture signals 2019-07-02 23:08:57 +02:00
AtjonTV
ab20db8e6e look for modules in current path 2019-07-02 21:55:57 +02:00
Nick Treleaven
75da1e4240 Speed up and simplify string.replace 2019-07-02 21:51:40 +02:00
S-YOU
53e439bc99 setsockopt arg optvalue supposed to be ptr 2019-07-02 21:49:05 +02:00
Alexander Medvednikov
1bbf3a3a0c make compiler 2019-07-02 21:45:51 +02:00
Alexander Medvednikov
a9b8bc067f enums (mode == .default_mode syntax); fix foo.bar[0].baz = val 2019-07-02 21:39:26 +02:00
Justice Suh
859c8ffdb8 net: socket send and recv 2019-07-02 19:45:38 +02:00
RustemB
cd4fe63355 math: digits function; SqrtTau; extra spaces; re writed doc's to correct form; test for factorial 2019-07-02 19:19:02 +02:00
joe-conigliaro
4ed67fbe7e implement get_line & get_raw_line for windows + REPL 2019-07-02 16:39:40 +02:00
lemoncmd
b9586a4017 builtin : fix buffer overflow and i64 issue with hex() 2019-07-02 15:18:56 +02:00
yep84
b57d227aa0 Allow to parse uppercase hex number 2019-07-02 15:03:01 +02:00
jiro4989
30633ff14f Fix "Nested comments won't compile" (#908) 2019-07-02 02:19:15 +02:00
aguspiza
1cd95091f2 remove additional line from write_file 2019-07-01 23:46:06 +02:00
Henrixounez
dc8c84a2a8 compiler: tmp variables on scripts inside generated main function 2019-07-01 23:42:09 +02:00
0x9ef
01d5f4d744 Change permission from 'r' to 'rb'
it is preferable to open the file in binary mode.
2019-07-01 23:41:32 +02:00
yep84
2ca9866f86 Handle --version arg as it already do for help 2019-07-01 22:04:28 +02:00
d2verb
e27a3b65f1 Fix #898 2019-07-01 20:56:31 +02:00
0x9ef
1ca20196d0 Created os_win.v and added get_file_handle 2019-07-01 17:57:55 +02:00
Alexander Medvednikov
95841a31d4 Revert "Added permission bits."
This reverts commit ae1313a35c.
2019-07-01 17:46:28 +02:00
0x9ef
ae1313a35c Added permission bits. 2019-07-01 17:37:01 +02:00
musou1500
668646f8f9 add str function for rune 2019-07-01 17:36:23 +02:00
Justice Suh
571410dd48 net: low level socket api 2019-07-01 17:31:38 +02:00
Alexander Medvednikov
d09758f723 fix a typo 2019-07-01 17:29:29 +02:00
archanpatkar
235a7ecd7f Restructured termcolor to term module 2019-07-01 17:26:23 +02:00
Alexander Medvednikov
6ddc57c190 fix cc_windows_cross() 2019-07-01 17:23:30 +02:00
Maulana Akmal
24b0fd5097 Refactor BuildMode enum to lowercase 2019-07-01 17:20:59 +02:00
Antoine Folie
32e32cee5c builtin : fix issue with int.hex 2019-07-01 17:20:14 +02:00
Alexander Medvednikov
61c7fa073b fix compilation on Linux 2019-07-01 17:04:09 +02:00
Alexander Medvednikov
4c3f1386ef V 0.1.11 2019-07-01 16:53:54 +02:00
Alexander Medvednikov
99a9a6572a lots of Windows fixes and cross compilation for Windows 2019-07-01 16:51:17 +02:00
Alexander Medvednikov
e71213ba4f Update README.md 2019-07-01 10:51:38 +02:00
Zaoqi
00174cdb83 fix #872 2019-07-01 10:46:42 +02:00
Zaoqi
9fcc3ed0e6 fix #872 2019-07-01 10:46:42 +02:00
Alexander Medvednikov
52f93ae45f fix http 2019-07-01 02:58:49 +02:00
Alexander Medvednikov
36d343e931 fix examples 2019-07-01 02:52:50 +02:00
0x9ef
87fb898864 Create types_win.v for Win API basic types. 2019-07-01 02:45:40 +02:00
Alexander Medvednikov
ff0401a3c3 Update README.md 2019-07-01 02:29:32 +02:00
Alexander Medvednikov
5936ab16c8 fix maps; use maps for storing functions; verify struct initialization 2019-07-01 02:24:39 +02:00
Alexander Medvednikov
8e6cb1e1c2 readme: CONTRIBUTING.md 2019-06-30 22:34:51 +02:00
Alexander Medvednikov
bf09916496 Rename CodeStructure.md to CONTRIBUTING.md 2019-06-30 22:34:25 +02:00
Archan Patkar
74d234f8cd remove duplication by using a new Preferences struct 2019-06-30 22:03:17 +02:00
0x9ef
42a622c10f Create const.v for Unix/Win32 API constants. 2019-06-30 21:59:56 +02:00
Alexander Medvednikov
ef5a91a87a os: make write_bytes() public 2019-06-30 21:07:24 +02:00
Alexander Medvednikov
fde0e39abf net: clean up 2019-06-30 21:00:22 +02:00
Alexander Medvednikov
6a1b16c72c net: listen and accept 2019-06-30 20:57:25 +02:00
Alexander Medvednikov
9062338cb4 fix compilation 2019-06-30 20:48:26 +02:00
Alexander Medvednikov
61b51f6149 os.File clean up + socket.v (dial()) 2019-06-30 20:28:50 +02:00
Alexander Medvednikov
386367c3d5 os: remove unused functions 2019-06-30 20:28:50 +02:00
Zaoqi
5bd188edad Update main.v 2019-06-30 15:34:28 +02:00
paolopaoletto
e2a535c3ce math.v: log_n, log2, exp2, cbrt and docs 2019-06-30 15:33:37 +02:00
Alexander Medvednikov
392b49c661 Update README.md 2019-06-30 15:26:03 +02:00
Alexander Medvednikov
4885a68b9a Update README.md 2019-06-30 15:06:26 +02:00
Alexander Medvednikov
0f33ca1249 travis: remove Windows for now 2019-06-30 15:02:49 +02:00
Alexander Medvednikov
820aa3d3b3 os: remove os_mac.v and os_win.v, fix os.ls() on Windows 2019-06-30 14:57:27 +02:00
Alexander Medvednikov
b0c844415d time.ticks() on Linux/macOS 2019-06-30 14:48:13 +02:00
Nick Treleaven
b79defd7a9 Pre-allocate KMP prefix for string.index 2019-06-30 13:58:46 +02:00
Alexander Medvednikov
388eb36ecb map_test.v 2019-06-30 13:44:08 +02:00
chai2010
c5a0b3734a base: refine test 2019-06-30 13:17:28 +02:00
Zaoqi
437b32fe78 fmt: id []typ 2019-06-30 13:06:45 +02:00
Zaoqi
8d13880cab Update os.v 2019-06-30 13:05:41 +02:00
bitsnaps
067f131b53 remove unnecessary println
comment out unnecessary println for interface.
2019-06-30 11:51:34 +02:00
Alexander Medvednikov
d0c47f3f2a array.v: make _push private 2019-06-29 23:56:55 +02:00
Alexander Medvednikov
159990132f fix v run . on Windows 2019-06-29 23:41:12 +02:00
Alexander Medvednikov
a2b80d5b3d REPL: exit to exit 2019-06-29 22:56:23 +02:00
Dinar Garipov
f4f1622528 vlib: update and cleanup tests + fix PR template 2019-06-29 22:49:57 +02:00
Xiphin
2dccdd347f Update README.md 2019-06-29 22:46:29 +02:00
Alexander Medvednikov
90f33fc7b3 V 0.1.10 changelog 2019-06-29 22:05:02 +02:00
Alexander Medvednikov
acaa19054b V 0.1.10 2019-06-29 21:51:25 +02:00
Alexander Medvednikov
1bcf94f7f4 Windows: another \r\n fix 2019-06-29 21:31:13 +02:00
Alexander Medvednikov
18525922fd Windows fixes 2019-06-29 21:26:39 +02:00
shamofu
18082274ca clean up: remove redundant spaces 2019-06-29 18:05:57 +02:00
Rustem B
7eab373922 math: gcd and lcm functions 2019-06-29 17:24:55 +02:00
Alexander Medvednikov
0afcadcfd1 Update README.md 2019-06-29 16:52:36 +02:00
Alexander Medvednikov
0bb3acef87 PR template: ask for fn docs and tests 2019-06-29 16:50:13 +02:00
lutherwenxu
4b3b69ab15 gitignore: Add gitignore to the build location
This commit moved gitignore to the build location
2019-06-29 16:45:05 +02:00
2098 changed files with 206100 additions and 12310 deletions

44
.ctags.d/v.ctags Normal file
View File

@@ -0,0 +1,44 @@
## TODO: support more precise struct/const/enum fields
--langdef=V
--map-V=+.v
--map-V=+.vv
--map-V=+.vsh
--kinddef-V=m,imodule,imported modules
--kinddef-V=M,module,modules
--kinddef-V=C,cfunction,cfunctions
--kinddef-V=f,function,functions
--kinddef-V=h,method,functions
--kinddef-V=c,const,constants
--kinddef-V=v,variable,variables
--kinddef-V=s,struct,structs
--kinddef-V=e,enum,enums
--kinddef-V=i,interface,interfaces
--kinddef-V=S,sfield,struct field
--kinddef-V=E,efield,enum field
--_roledef-V.m=imported,imported module
--_roledef-V.M=declared,module declaration
--regex-V=/^module[[:blank:]]+([0-9a-zA-Z]+)[[:blank:]]*$/\1/M/{_role=declared}{scope=push}
--regex-V=/^import[[:blank:]]+(([0-9a-zA-Z]+)?|.*\.([a-zA-Z_][0-9a-zA-Z]+))[[:blank:]]*$/\2\3/m/{_role=imported}{scope=ref}
--regex-V=/^[[:blank:]]*fn[[:blank:]]+C\.([a-zA-Z_][0-9a-zA-Z_]*)\(/C.\1/C/
--regex-V=/^(pub)?[[:blank:]]*fn[[:blank:]]+([a-zA-Z_][0-9a-zA-Z_]*)\(/\2/f/
--regex-V=/^(pub)?[[:blank:]]*fn[[:blank:]]+\(.*\)[[:blank:]]*([a-zA-Z_][0-9a-zA-Z_]*)\(/\2/h/
--regex-V=/^(pub)?[[:blank:]]*struct[[:blank:]]+([a-zA-Z_][0-9a-zA-Z_]*)[[:blank:]]*\{/\2/s/{scope=push}
--regex-V=/^(pub)?[[:blank:]]*enum[[:blank:]]+([a-zA-Z_][0-9a-zA-Z_]*)[[:blank:]]*\{/\2/e/{scope=push}
--regex-V=/^(pub)?[[:blank:]]*interface[[:blank:]]+([a-zA-Z_][0-9a-zA-Z_]*)[[:blank:]]*\{/\2/i/{scope=push}
--regex-V=/^[[:blank:]]*([a-zA-Z_][0-9a-zA-Z_]+)[[:blank:]]*(,)?[[:blank:]]*(\/\/.*)?$/\1/E/{scope=ref}
--regex-V=/^[[:blank:]]*([a-zA-Z_][0-9a-zA-Z_]+)[[:blank:]]+\??\&?(\[[0-9]*\])?([a-zA-Z_][0-9a-zA-Z_.]+)[[:blank:]]*(\/\/.*)?$/\1/S/{scope=ref}
--regex-V=/^[[:blank:]]*\}[[:blank:]]*$//{scope=pop}{placeholder}
## Variables:
--regex-V=/^[[:blank:]]*(mut[[:blank:]]+)?([a-zA-Z_][0-9a-zA-Z_]+)[[:blank:]]*:=/\2/v/
## Consts:
--regex-V=/^(pub)?[[:blank:]]*const[[:blank:]]+\([[:blank:]]*/const/c/{scope=push}
##NB: the next variable regexp should work only inside const ( ), but currently works for ordinary assignments too:
--regex-V=/^[[:blank:]]*([a-zA-Z_][0-9a-zA-Z_]+)[[:blank:]]*=/\1/v/{scope=ref}
--regex-V=/^[[:blank:]]*\)[[:blank:]]*$//{scope=pop}{placeholder}
--extras=+q
--extras=+r
--fields=+r

24
.editorconfig Normal file
View File

@@ -0,0 +1,24 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.v]
indent_style = tab
indent_size = 4
[*.{yml,yaml}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[*.{txt,out}]
insert_final_newline = false
[Makefile]
indent_style = tab

6
.gitattributes vendored
View File

@@ -1,2 +1,4 @@
*.v linguist-language=Go
website/* linguist-vendored
*.v linguist-language=V text=auto eol=lf
*.vv linguist-language=V text=auto eol=lf
*.bat text=auto eol=crlf
Dockerfile.* linguist-language=Dockerfile

1
.github/FUNDING.yml vendored
View File

@@ -1,3 +1,4 @@
# These are supported funding model platforms
patreon: vlang
github: [medvednikov]

View File

@@ -1,18 +1,18 @@
---
name: Bug report for V
about: Please use the apropriate label when submitting an issue: bug/feature request/question.
about: Please use the appropriate label when submitting an issue: bug/feature request/question.
title: "New issue"
labels: ''
assignees: ''
---
<!-- You can use `v doctor` to fill up the next fields -->
#### V version:
#### OS:
#### C Compiler:

View File

@@ -2,11 +2,15 @@
name: Bug report
about: Bug report
title: ''
labels: bug
labels: 'Bug'
assignees: ''
---
<!-- Please make sure to run `v up` before reporting any issues as it may have already been fixed.
It's also advisable to update all relvant modules using `v outdated` and `v install` -->
<!-- You can use `v doctor` to fill up the next fields -->
**V version:**
**OS:**

View File

@@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature request
labels: 'Feature Request'
assignees: ''
---

View File

@@ -1,15 +1,41 @@
Please title your PR as follows: `time: fix foo bar`. Always start with the thing you are fixing, then describe the fix.
<!--
Please title your PR as follows: `time: fix foo bar`.
Always start with the thing you are fixing, then describe the fix.
Don't use past tense (e.g. "fixed foo bar").
Explain what your PR does and why.
Before submitting a PR, please run the tests with `make test`, and make sure V can still compile itself. Run this twice:
If you are adding a new function, please document it and add tests:
./v -o v
./v -o v
```
// foo does foo and bar
fn foo() {
// file_test.v
fn test_foo() {
assert foo() == ...
...
}
```
If you are fixing a bug, please add a test that covers it.
Before submitting a PR, please:
A) run the tests with `v test-compiler` .
B) make sure, that V can still compile itself:
```shell
./v -o v cmd/v
./v -o v cmd/v
```
See also `TESTS.md`.
I try to process PRs as soon as possible. They should be handled within 24 hours.
Applying labels to PRs is not needed.
Thanks a lot for your contribution!
-->

15
.github/workflows/alpine.build.sh vendored Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh -l
set -e
pwd
uname -a
make -j4
./v version
du -s .
echo "DONE"

22
.github/workflows/alpine.test.sh vendored Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/sh -l
set -e
pwd
uname -a
du -s .
ls -lat
##./v test-compiler
## try running the known failing tests first to get faster feedback
./v test vlib/builtin/string_test.v vlib/strings/builder_test.v
./v test-fixed
./v build-vbinaries
echo "DONE"

153
.github/workflows/binary_artifact.yml vendored Normal file
View File

@@ -0,0 +1,153 @@
name: Build binary artifacts
on:
push:
tags:
- weekly.**
- 0.**
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [gcc]
steps:
- uses: actions/checkout@v1
- name: Compile
env:
CC: ${{ matrix.compiler }}
run: make && ./v -cc $CC -o v -prod cmd/v
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: linux
path: |
.
!./.git
!./vc
!./v_old
- name: Create binary only artifact
uses: actions/upload-artifact@v2
with:
name: linux-binary
path: ./v
build-macos:
runs-on: macos-latest
strategy:
matrix:
compiler: [clang]
steps:
- uses: actions/checkout@v1
- name: Compile
env:
CC: ${{ matrix.compiler }}
run: make && ./v -cc $CC -o v -prod cmd/v
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: macos
path: |
.
!./.git
!./vc
!./v_old
- name: Create binary only artifact
uses: actions/upload-artifact@v2
with:
name: macos-binary
path: ./v
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: msys2/setup-msys2@v2
- name: Compile
run: ./make.bat
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: windows
path: |
.
!./.git
!./vc
!./v_old
- name: Create binary only artifact
uses: actions/upload-artifact@v2
with:
name: windows-binary
path: ./v.exe
release:
name: Create Github Release
needs: [build-linux, build-windows, build-macos]
runs-on: ubuntu-latest
steps:
- name: Get short tag name
uses: jungwinter/split@v1
id: split
with:
msg: ${{ github.ref }}
seperator: /
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.split.outputs._2 }}
name: ${{ steps.split.outputs._2 }}
commit: ${{ github.sha }}
draft: false
prerelease: false
publish:
needs: [release]
runs-on: ubuntu-latest
strategy:
matrix:
version: [linux, macos, windows]
steps:
- uses: actions/checkout@v1
- name: Fetch artifacts
uses: actions/download-artifact@v1
with:
name: ${{ matrix.version }}
path: ./${{ matrix.version }}
- name: Build Zip Archives
run: |
mkdir -p workdir/
mv ${{ matrix.version }}/ workdir/v/
cd workdir/v/
chmod 755 v || true
chmod 755 v.exe || true
chmod 755 thirdparty/tcc/tcc.exe || true
cd ..
zip -r9 --symlinks ../v_${{ matrix.version }}.zip v/*
cd ..
rm -rf workdir/
- name: Get short tag name
uses: jungwinter/split@v1
id: split
with:
msg: ${{ github.ref }}
seperator: /
- name: Get release
id: get_release_info
uses: leahlundqvist/get-release@v1.3.1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ steps.split.outputs._2 }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./v_${{ matrix.version }}.zip
asset_name: v_${{ matrix.version }}.zip
asset_content_type: application/zip

596
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,596 @@
name: CI
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
jobs:
code-formatting:
runs-on: ubuntu-18.04
timeout-minutes: 30
env:
VFLAGS: -cc tcc
steps:
- uses: actions/checkout@v2
- name: Environment info
run: echo $VFLAGS $GITHUB_SHA $GITHUB_REF
- name: Build local v
run: make -j4
- name: v test-cleancode
run: ./v -silent test-cleancode
- name: v test-fmt
run: ./v -silent test-fmt
# v-fmt:
# runs-on: ubuntu-18.04
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v2
# - name: getting all branch metainfo from github
# run: |
# git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
# echo "Changed files compared to origin/master are:" && git diff --name-status origin/master HEAD -- '*.v'
# - name: Build v (there is no need for dependencies for fmt)
# run: make -j4
# - name: Build a production cmd/tools/vfmt
# run: ./v -prod -d vfmt cmd/tools/vfmt.v
# - name: Run v fmt -diff on only the changed files. Does NOT fail for now.
# run: git diff --name-status origin/master HEAD -- '*.v' |grep -v '^D'|rev|cut -f1|rev| xargs ./v fmt -noerror -diff
# - name: Run v test-fmt
# run: echo "TODO" #./v test-fmt
performance-regressions:
runs-on: ubuntu-18.04
timeout-minutes: 30
env:
VFLAGS: -cc gcc
steps:
- uses: actions/checkout@v2
- name: Environment info
run: echo $VFLAGS $GITHUB_SHA $GITHUB_REF
- name: Build local v
run: (make -j4)
- name: Clone & Build vmaster/v
run: |
git clone --depth=1 https://github.com/vlang/v vmaster/
(cd vmaster; make -j4)
- name: V versions
run: ./v version && ./vmaster/v version
- name: Build the repeat tool
run: ./v cmd/tools/repeat.v
- name: Repeat -o hw.c examples/hello_world.v
run: cmd/tools/repeat --max_time 150 --series 3 --count 15 --warmup 3 --fail_percent 10 './v -show-timings -o hw.c examples/hello_world.v' './vmaster/v -show-timings -o hw.c examples/hello_world.v'
- name: Repeat -o v.c cmd/v
run: cmd/tools/repeat --max_time 750 --series 3 --count 15 --warmup 3 --fail_percent 10 './v -show-timings -o v.c cmd/v' './vmaster/v -show-timings -o v.c cmd/v'
ubuntu-tcc:
runs-on: ubuntu-18.04
timeout-minutes: 30
env:
VFLAGS: -cc tcc -cflags -bt10
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list; sudo apt-get update;
sudo apt-get install --quiet -y libssl-dev sqlite3 libsqlite3-dev valgrind
sudo apt-get install --quiet -y libglfw3 libglfw3-dev libfreetype6-dev libxi-dev libxcursor-dev libasound2-dev
## sudo apt-get install --quiet -y libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev
- name: Build v
run: |
echo $VFLAGS
sudo ln -s $PWD/thirdparty/tcc/tcc.exe /usr/local/bin/tcc ## TODO: remove
make -j4
./v -cg -cflags -Werror -o v cmd/v
- name: Test v->c
run: |
thirdparty/tcc/tcc.exe -version
./v -cg -o v cmd/v # Make sure vtcc can build itself twice
# ./v -silent test-compiler
- name: v self compilation
run: ./v -o v2 cmd/v && ./v2 -o v3 cmd/v && ./v3 -o v4 cmd/v
- name: Fixed tests
run: ./v -silent test-fixed
- name: Test building v tools
run: ./v -silent build-tools
- name: v doctor
run: |
./v doctor
- name: Test v binaries
run: ./v -silent build-vbinaries
# Alpine docker pre-built container
alpine-docker-musl-gcc:
name: alpine-musl
runs-on: ubuntu-latest
timeout-minutes: 30
container:
image: thevlang/vlang:alpine-build
env:
V_CI_MUSL: 1
VFLAGS: -cc gcc
volumes:
- ${{github.workspace}}:/opt/vlang
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build V
run: |
make CC=clang
- name: Test V fixed tests
run: |
v -silent test-fixed
macos:
runs-on: macOS-latest
timeout-minutes: 30
env:
VFLAGS: -cc clang
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: |
##brew install libpq openssl freetype ### these are *already installed* on Catalina ...
brew uninstall --ignore-dependencies libpq ## libpq is a dependency of PHP
brew install postgresql
brew install glfw
## brew install sdl2 sdl2_ttf sdl2_mixer sdl2_image
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
- name: Build V
run: make -j4 && ./v -cg -cflags -Werror -o v cmd/v
- name: Build V using V
run: ./v -o v2 cmd/v && ./v2 -o v3 cmd/v
- name: v self with -usecache
run: ./v -o v2 -usecache cmd/v
- name: Test symlink
run: ./v symlink
# - name: Set up pg database
# run: |
# pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
# psql -d postgres -c 'select rolname from pg_roles'
# psql -d postgres -c 'create database customerdb;'
# psql -d customerdb -f examples/database/pg/mydb.sql
# - name: Test v->c
# run: ./v -silent test-compiler
# - name: Test v binaries
# run: ./v -silent build-vbinaries
## - name: Test v->js
## run: ./v -o hi.js examples/hello_v_js.v && node hi.js
- name: Fixed tests
run: VJOBS=1 ./v -silent test-fixed
- name: Build examples
run: ./v -silent build-examples
- name: Build examples with -autofree
run: |
./v -autofree -experimental -o tetris examples/tetris/tetris.v
- name: v doctor
run: |
./v doctor
- name: Cross-compilation to Linux
run: ./v -os linux cmd/v
# - name: Test vsh
# run: ./v examples/v_script.vsh
- name: Test ved
run: |
git clone --depth 1 https://github.com/vlang/ved
cd ved && ../v -o ved .
# ../v -autofree .
- name: Build V UI examples
run: |
git clone --depth 1 https://github.com/vlang/ui
cd ui
mkdir -p ~/.vmodules
ln -s $(pwd) ~/.vmodules/ui
../v examples/rectangles.v
../v run examples/build_examples.vsh
ubuntu:
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: |
sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list;
sudo apt-get update;
sudo apt-get install --quiet -y postgresql libpq-dev libssl-dev sqlite3 libsqlite3-dev valgrind
sudo apt-get install --quiet -y libglfw3 libglfw3-dev libfreetype6-dev libxi-dev libxcursor-dev libasound2-dev
## sudo apt-get install --quiet -y libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev
- name: Build V
run: make -j4 && ./v -cc gcc -cg -cflags -Werror -o v cmd/v
# - name: Test V
# run: ./v -silent test-compiler
# - name: Test v binaries
# run: ./v -silent build-vbinaries
## - name: Test v->js
## run: ./v -o hi.js examples/hello_v_js.v && node hi.js
# - name: Build Vorum
# run: git clone --depth 1 https://github.com/vlang/vorum && cd vorum && ../v . && cd ..
# - name: Build vpm
# run: git clone --depth 1 https://github.com/vlang/vpm && cd vpm && ../v . && cd ..
# - name: Freestanding
# run: ./v -freestanding -o bare vlib/os/bare/bare_example_linux.v
- name: v self compilation
run: ./v -o v2 cmd/v && ./v2 -o v3 cmd/v && ./v3 -o v4 cmd/v
- name: v self with -usecache
run: ./v -o v2 -usecache cmd/v
- name: Fixed tests
run: |
./v -silent test-fixed
- name: Fixed tests (-prod)
run: ./v -o vprod -prod cmd/v && ./vprod -silent test-fixed
- name: Build examples
run: ./v -silent build-examples
- name: Build examples with -autofree
run: |
./v -autofree -experimental -o tetris examples/tetris/tetris.v
- name: Build modules
run: |
./v build-module vlib/os
./v build-module vlib/builtin
./v build-module vlib/strconv
./v build-module vlib/time
./v build-module vlib/term
./v build-module vlib/math
./v build-module vlib/strings
./v build-module vlib/v/token
./v build-module vlib/v/ast
./v build-module vlib/v/parser
./v build-module vlib/v/gen
./v build-module vlib/v/depgraph
./v build-module vlib/os/cmdline
- name: x64 machine code generation
run: |
exit
./v -o vprod -prod cmd/v
cd cmd/tools
echo "Generating a 1m line V file..."
../../vprod gen1m.v
./gen1m > 1m.v
echo "Building it..."
../../vprod -backend x64 -o 1m 1m.v
echo "Running it..."
ls
# - name: SDL examples
# run: git clone --depth 1 https://github.com/vlang/sdl && cd sdl
# ./1m
#run: echo "TODO" #cd examples/x64 && ../../v -x64 hello_world.v && ./hello_world
# - name: Coveralls GitHub Action
# uses: coverallsapp/github-action@v1.0.1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# ubuntu-autofree-selfcompile:
# runs-on: ubuntu-18.04
# timeout-minutes: 30
# env:
# VFLAGS: -cc gcc
# steps:
# - uses: actions/checkout@v2
# - name: Build V
# run: make -j4
# - name: V self compilation with -autofree
# run: ./v -o v2 -autofree cmd/v && ./v2 -o v3 -autofree cmd/v && ./v3 -o v4 -autofree cmd/v
# Ubuntu docker pre-built container
ubuntu-musl:
name: ubuntu-musl
runs-on: ubuntu-latest
timeout-minutes: 30
container:
image: thevlang/vlang:ubuntu-build
env:
V_CI_MUSL: 1
V_CI_UBUNTU_MUSL: 1
VFLAGS: -cc musl-gcc
volumes:
- ${{github.workspace}}:/opt/vlang
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build V
run: |
echo $VFLAGS && make -j4 && ./v -cg -o v cmd/v
- name: Test V fixed tests
run: |
./v -silent test-fixed
# ubuntu-musl:
# runs-on: ubuntu-18.04
# timeout-minutes: 30
# env:
# VFLAGS: -cc musl-gcc
# V_CI_MUSL: 1
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: 12.x
# - name: Install dependencies
# run: |
# sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list;
# sudo apt-get update;
# sudo apt-get install --quiet -y musl musl-tools libssl-dev sqlite3 libsqlite3-dev valgrind
# sudo apt-get install --quiet -y libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev
# - name: Build v
# run: echo $VFLAGS && make -j4 && ./v -cg -o v cmd/v
# # - name: Test v binaries
# # run: ./v -silent build-vbinaries
# ## - name: Test v->js
# ## run: ./v -o hi.js examples/hello_v_js.v && node hi.js
# - name: quick debug
# run: ./v -stats vlib/strconv/format_test.v
# - name: Fixed tests
# run: ./v -silent test-fixed
ubuntu-llvm-mingw:
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
# - name: Cross-compile V
# run: docker build . -f Dockerfile.cross
windows-gcc:
runs-on: windows-2019
timeout-minutes: 30
env:
VFLAGS: -cc gcc
steps:
- uses: actions/checkout@v2
#- uses: actions/setup-node@v1
# with:
# node-version: 12.x
- name: Build
run: |
gcc --version
.\make.bat -gcc
- name: Test new v.c
run: .\v.exe -o v.c cmd/v && gcc -Werror -municode -w v.c
- name: Install dependencies
run: |
.\v.exe setup-freetype
.\.github\workflows\windows-install-sqlite.bat
## .\.github\workflows\windows-install-sdl.bat
- name: Fixed tests
run: |
.\v.exe -silent test-fixed
# - name: Test
# run: |
# .\v.exe -silent test-compiler
## v.js dosent work on windows
#.\v.exe -o hi.js examples/hello_v_js.v
#node hi.js
# - name: Test v binaries
# run: ./v -silent build-vbinaries
# - name: v2 self compilation
# run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
windows-msvc:
runs-on: windows-2019
timeout-minutes: 30
env:
VFLAGS: -cc msvc
steps:
- uses: actions/checkout@v2
#- uses: actions/setup-node@v1
# with:
# node-version: 12.x
- name: Build
run: |
echo %VFLAGS%
echo $VFLAGS
.\make.bat -msvc
.\v.exe -cflags /WX self
- name: Install dependencies
run: |
.\v.exe setup-freetype
.\.github\workflows\windows-install-sqlite.bat
## .\.github\workflows\windows-install-sdl.bat
- name: Fixed tests
run: |
./v -cg cmd\tools\vtest-fixed.v
./v -silent test-fixed
- name: v doctor
run: |
./v doctor
# - name: Test
# run: |
# .\v.exe -silent test-compiler
# ## v.js dosent work on windows
#.\v.exe -o hi.js examples/hello_v_js.v
#node hi.js
# - name: Test v binaries
# run: ./v -silent build-vbinaries
windows-tcc:
runs-on: windows-2019
timeout-minutes: 30
# We are simulating a user with no cc installed.
# This way, v's cc detection on Windows is also tested.
# env:
# VFLAGS: -cc tcc
steps:
- uses: actions/checkout@v2
#- uses: actions/setup-node@v1
# with:
# node-version: 12.x
- name: Build
# We need to move gcc and msvc, so that V can't find an existing C compiler and downloads tcc
run: |
'for /f "usebackq tokens=*" %i in (`where gcc.exe`) do move /Y "%i" "%i.old"' | cmd
'for /f "usebackq tokens=*" %i in (`where vswhere.exe`) do move /Y "%i" "%i.old"' | cmd
move "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe.old"
.\make.bat
- name: Test new v.c
run: .\v.exe -o v.c cmd/v && .\thirdparty\tcc\tcc.exe -Werror -w -ladvapi32 -bt10 v.c
- name: Install dependencies
run: |
.\v.exe setup-freetype
.\.github\workflows\windows-install-sqlite.bat
## .\.github\workflows\windows-install-sdl.bat
- name: Fixed tests
run: |
.\v.exe -silent test-fixed
# - name: Test
# run: |
# .\v.exe -silent test-compiler
## v.js dosent work on windows
#.\v.exe -o hi.js examples/hello_v_js.v
#node hi.js
# - name: Test v binaries
# run: ./v -silent build-vbinaries
# - name: v2 self compilation
# run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
compilable-v-c-and-v-win-c:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
sudo apt install --quiet -y mingw-w64 wine-stable winetricks
- name: Build V
run: make -j4
- name: v.c can be compiled and run
run: |
./v -os cross -o /tmp/v.c cmd/v
gcc -g -std=gnu11 -w -o v_from_vc /tmp/v.c -lm -lpthread
ls -lart v_from_vc
./v_from_vc version
- name: v_win.c can be compiled and run
run: |
./v -os windows -o /tmp/v_win.c cmd/v
x86_64-w64-mingw32-gcc /tmp/v_win.c -std=c99 -w -municode -o v_from_vc.exe
ls -lart v_from_vc.exe
winetricks nocrashdialog
wine v_from_vc.exe version
ubuntu-c-plus-plus:
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list;
sudo apt-get update;
sudo apt-get install --quiet -y postgresql libpq-dev libssl-dev sqlite3 libsqlite3-dev
sudo apt-get install --quiet -y libglfw3 libglfw3-dev libfreetype6-dev libxi-dev libxcursor-dev libasound2-dev
sudo apt-get install --quiet -y valgrind g++-9
## sudo apt-get install --quiet -y libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev
- name: Build V
run: make -j4
- name: g++ version
run: g++-9 --version
- name: V self compilation with g++
run: ./v -cc g++-9 -o v2 cmd/v && ./v2 -cc g++-9 -o v3 cmd/v
## - name: Running tests with g++
## run: ./v -cc g++-9 -silent test-fixed
install-modules:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install --quiet -y libssl-dev
- name: Build V
run: make -j4
- name: Installing V modules
run: |
./v install ui
./v install nedpals.args
gitly-compiles:
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install --quiet -y libssl-dev sqlite3 libsqlite3-dev
- name: Build V
run: make -j2 && ./v -cc gcc -o v cmd/v
- name: Install markdown
run: ./v install markdown
- name: Build Gitly
run: |
git clone --depth 1 https://github.com/vlang/gitly
cd gitly
../v .
cd ..
websocket_autobahn:
name: Autobahn integrations tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run autobahn services
run: docker-compose -f ${{github.workspace}}/vlib/x/websocket/tests/autobahn/docker-compose.yml up -d
- name: Build client test
run: docker exec autobahn_client "/src/v" "/src/vlib/x/websocket/tests/autobahn/autobahn_client.v"
- name: Run client test
run: docker exec autobahn_client "/src/vlib/x/websocket/tests/autobahn/autobahn_client"
- name: Build client wss test
run: docker exec autobahn_client "/src/v" "/src/vlib/x/websocket/tests/autobahn/autobahn_client_wss.v"
- name: Run client wss test
run: docker exec autobahn_client "/src/vlib/x/websocket/tests/autobahn/autobahn_client_wss"
- name: Run server test
run: docker exec autobahn_server "wstest" "-m" "fuzzingclient" "-s" "/config/fuzzingclient.json"
- name: Copy reports
run: docker cp autobahn_server:/reports ${{github.workspace}}/reports
- name: Copy reports wss
run: docker cp autobahn_server_wss:/reports ${{github.workspace}}/reports_wss
- name: Test success
run: docker exec autobahn_server "python" "/check_results.py"
- name: Test success WSS
run: docker exec autobahn_server_wss "python" "/check_results.py"
- name: Publish all reports
uses: actions/upload-artifact@v2
with:
name: full report
path: ${{github.workspace}}/reports
- name: Publish report client
uses: actions/upload-artifact@v2
with:
name: client
path: ${{github.workspace}}/reports/clients/index.html
- name: Publish report server
uses: actions/upload-artifact@v2
with:
name: server
path: ${{github.workspace}}/reports/servers/index.html
- name: Publish all reports WSS
uses: actions/upload-artifact@v2
with:
name: full report wss
path: ${{github.workspace}}/reports_wss
- name: Publish report client wss
uses: actions/upload-artifact@v2
with:
name: client wss
path: ${{github.workspace}}/reports_wss/clients/index.html

16
.github/workflows/docs_ci.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: Docs CI
### Run on *EVERY* commit. The documentation *SHOULD* stay valid, and
### the developers should receive early warning if they break it.
on: [push, pull_request]
jobs:
check-markdown:
runs-on: ubuntu-18.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- name: Build V
run: make
- name: Check markdown line length & code examples
run: ./v run cmd/tools/check-md.v -all

58
.github/workflows/periodic.yml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: Periodic
on:
schedule:
- cron: '31 1,12 * * *'
jobs:
network-tests-ubuntu:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
V_CI_PERIODIC: 1
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install --quiet -y libssl-dev sqlite3 libsqlite3-dev valgrind
- name: Build v
run: make -j4
- name: Symlink V
run: sudo ./v symlink
- name: Run network tests
run: ./v -d network -silent test-fixed
network-tests-macos:
runs-on: macOS-latest
timeout-minutes: 30
env:
V_CI_PERIODIC: 1
steps:
- uses: actions/checkout@v2
- name: Setup openssl library path
run: export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
- name: Build V
run: make -j4
- name: Symlink V
run: sudo ./v symlink
- name: Ensure thirdparty/cJSON/cJSON.o is compiled, before running tests.
run: ./v examples/json.v
- name: Run network tests
run: ./v -d network -silent test-fixed
network-windows-msvc:
runs-on: windows-2019
timeout-minutes: 30
env:
V_CI_PERIODIC: 1
VFLAGS: -cc msvc
steps:
- uses: actions/checkout@v2
- name: Build
run: |
echo %VFLAGS%
echo $VFLAGS
.\make.bat -msvc
- name: Run network tests
run: .\v.exe -d network -silent test-fixed

56
.github/workflows/prebuilt.yml vendored Normal file
View File

@@ -0,0 +1,56 @@
name: Test prebuilt binaries
on:
release:
types: [edited, published]
jobs:
ubuntu:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --quiet -y postgresql libpq-dev libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev valgrind
## sudo apt-get install --quiet -y libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev
- name: Download V
run: |
tag=${GITHUB_REF##*/}
wget https://github.com/vlang/v/releases/download/$tag/v_linux.zip
unzip v_linux.zip
./v -version
- name: Test V
run: |
./v run examples/hello_world.v
macos:
runs-on: macOS-latest
timeout-minutes: 5
steps:
- name: Install dependencies
run: |
brew install freetype glfw openssl
# brew install sdl2 sdl2_ttf sdl2_mixer sdl2_image
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
- name: Download V
run: |
tag=${GITHUB_REF##*/}
wget https://github.com/vlang/v/releases/download/$tag/v_macos.zip
unzip v_macos.zip
./v -version
- name: Test V
run: |
./v run examples/hello_world.v
windows:
runs-on: windows-latest
timeout-minutes: 5
steps:
- name: Download V
run: |
Set-Variable -Name "tag" -Value $env:GITHUB_REF.split("/", 3)[-1]
& curl -L https://github.com/vlang/v/releases/download/$tag/v_windows.zip -o v_windows.zip
& unzip .\v_windows.zip
& .\v.exe -version
- name: Test V
run: |
& .\v.exe run .\examples\hello_world.v

View File

@@ -0,0 +1,16 @@
@echo off
curl -L https://www.libsdl.org/release/SDL2-devel-2.0.10-VC.zip -o SDL2.zip
curl -L https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-VC.zip -o SDL2_ttf.zip
curl -L https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip -o SDL2_image.zip
curl -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip -o SDL2_mixer.zip
unzip SDL2.zip -d thirdparty/
unzip SDL2_ttf.zip -d thirdparty/
unzip SDL2_image.zip -d thirdparty/
unzip SDL2_mixer.zip -d thirdparty/
move /y thirdparty/SDL2-2.0.10 thirdparty/SDL2
move /y thirdparty/SDL2_ttf-2.0.15 thirdparty/SDL2_ttf
move /y thirdparty/SDL2_image-2.0.5 thirdparty/SDL2_image
move /y thirdparty/SDL2_mixer-2.0.4 thirdparty/SDL2_mixer

View File

@@ -0,0 +1,12 @@
@echo off
curl -L https://www.sqlite.org/2020/sqlite-amalgamation-3320300.zip -o sqlite-amalgamation-3320300.zip
unzip sqlite-amalgamation-3320300.zip -d thirdparty\
del thirdparty\sqlite-amalgamation-3320300\shell.c
move /y thirdparty\sqlite-amalgamation-3320300 thirdparty\sqlite
dir thirdparty\sqlite

78
.gitignore vendored
View File

@@ -1,2 +1,78 @@
# ignore all build binaries
*
!*/
!*.*
*.exe
*.o
*.so
.*.c
*.tmp.c
*.obj
*.exp
*.ilk
*.pdb
*.dll
*.lib
*.bak
a.out
.noprefix.vrepl_temp
# ignore v build files
/vc
/v.c
/v.*.c
/v.c.out
.vrepl_temp.v
fns.txt
.noprefix.vrepl_temp.v
# ignore temp directories
/temp
/tmp
# unignore special files without extension
!.github/PULL_REQUEST_TEMPLATE
!.editorconfig
!.gitattributes
!.gitignore
!BSDmakefile
!Dockerfile
!Dockerfile.alpine
!Dockerfile.cross
!LICENSE
!Makefile
# ignore editor files
.idea
.project
.classpath
.c9
*.launch
.settings/
*.sublime-workspace
.vscode/
*.code-workspace
*~
*.swp
*.swo
*.swn
.env
# ignore debugger files
cachegrind.out.*
.gdb_history
*.dSYM
*_test
*.def
# ignore system files
.DS_Store
._*
thumbs.db
/.symlink
/.bin
_docs
# ignore vs databases
*.suo
*.VC.db

View File

@@ -1,44 +0,0 @@
language: c
matrix:
include:
- os: linux
dist: xenial
sudo: required
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-5
- g++-5
- make
- libglfw3
- libglfw3-dev
- libfreetype6-dev
- libcurl3-dev
- os: windows
language: sh
filter_secrets: false
- os: osx
osx_image: xcode10.2
addons:
homebrew:
packages:
- freetype
- glfw
#env:
# - MATRIX_EVAL="brew install freetype glfw"
script:
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc
fi
- |
if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then
choco install make
cp "C:\\ProgramData\\chocolatey\\bin\\gcc.exe" "C:\\ProgramData\\chocolatey\\bin\\cc.exe"
fi
- export VROOT=$(pwd)
- make
- make test

27
0.3_roadmap.txt Normal file
View File

@@ -0,0 +1,27 @@
- = TODO
+ = done
- make `-autofree` the default
- coroutines
+ channels
+ lock{}
+ thread safe arrays
- thread safe maps
- C2V translator
- doom.v
- rune type, replace `ustring` with `[]rune`, fix `byte.str()`
- maps with non-string keys
+ iOS/Android support
- parallel parser (and maybe checker/gen?)
- `recover()` from panics
+ IO streams
+ struct embedding
- interface embedding
- interfaces: allow struct fields (not just methods)
- vfmt: fix common errors automatically to save time (make vars mutable and vice versa, add missing imports etc)
- method expressions with an explicit receiver as the first argument
+ short generics syntax (`foo(5)` instead of `foo<int>(5)`)
- fix all remaining generics issues
- merge v.c and v_win.c
- more advanced errors, not just `error('message')`
- VLS for autocomplete, refactoring, go to definition etc

8
BSDmakefile Normal file
View File

@@ -0,0 +1,8 @@
CC ?= cc
all:
rm -rf vc/
git clone --depth 1 --quiet https://github.com/vlang/vc
$(CC) -std=gnu11 -w -o v vc/v.c -lm -lexecinfo
rm -rf vc/
@echo "V has been successfully built"

View File

@@ -1,10 +1,380 @@
## V 0.1.30
*28 Nov 2020*
(V 0.2 RC)
TODO
# 0.1.8
## V 0.1.27
*5 May 2020*
- vfmt has been re-written from scratch using the new AST parser.
It's much faster, cleaner, and can format
files with compilation errors.
- `strconv`, `sprintf`, and `printf` in native V, without any libc calls.
- Interfaces are now a lot more stable and have all expected features.
- Lots of x64 backend improvements: function calls, if expressions, for loops, local variables.
- `map()` and `filter()` methods can now be chained.
- New `[]int{cap:cap, len:len}` syntax for initializing array length and capacity.
- New `is` keyword for checking the type of sum types and interfaces.
- `as` can now be used to cast interfaces and sum types.
- Profiling with `-profile`. Prints a nice table with details about every single function call:
number of calls, average time per call, total time per function
- `import(xxx)` syntax has been removed in favor of `import xxx` for simplicity and greppability.
- Lots of fixes and improvements in the type checker.
- `time.StopWatch`
- `dl` module for dynamic loading.
- Automatic `str()` method generation for every single type, including all arrays.
- Short struct initialization syntax for imitating named function args: `foo(bar:0, baz:1)`.
- New operator `!in`.
- Performance improvements in critical parts of the builtin data structures (array, map).
- High order functions improvements (functions can now be returned etc).
- Anonymous functions that can be defined inside other functions.
- Built-in JSON module is back.
- Closures.
- Lots and lots of new tests added, including output tests that test error messages.
- Multiple errors are now printed, the compiler no longer stops after the first error.
- The new JS backend using the AST parser (almost complete).
- Variadic functions.
- `net.websocket` module (early stage).
- `vlib` is now memory leak free, lots of `autofree` improvements.
- Simplified and cleaned up `cmd/v`, `v.builder`.
- V UI was updated to work with the new backend.
## V 0.1.25
*1 Apr 2020*
- The entire compiler has been re-written with an AST parser.
The code is now a lot cleaner and more maintainable.
~15k lines of old compiler code were removed.
## V 0.1.24
*31 Dec 2019*
- A new parser/generator built on top of an AST that simplifies code greatly
and allows to implement new backends much faster.
- Sum types (`type Expr = IfExpr | MatchExpr | IntegerLiteral`).
- B-tree map (sped up the V compiler by ~10%).
- `v fmt -w`.
- The entire code base has been formatted with vfmt.
- Generic structs.
- SDL module.
- Arrays of pointers.
- os: `is_link()`, `is_dir()`, `exists()`.
- Ranging through fixed size arrays.
- Lots of fixes in ORM and vweb.
- The first tutorial: [building a simple web application with vweb](https://github.com/vlang/v/blob/master/tutorials/building-a-simple-web-blog-with-vweb.md)
- Match expressions now must be exhaustive.
- freestanding: `malloc()`/`free()`.
- `++` is now required instead of `+= 1` for consistency.
- Interpolated strings now allow function calls: `println('val = $get_val()')`.
- `string.replace_each([])` for an efficient replacement of multiple values.
- More utf8 helper functions.
- `-prealloc` option for block allocations.
- `type` aliases.
- Running `v` with an unknown command will result in an error.
- `atof` implementation in pure V.
- Enums can now have negative values.
- New `filepath` module.
- `math.factorial`.
- `ftp` module.
- New syntax for casting: `val as Type`.
- Fewer libc functions used (soon V will have no dependency on libc).
## V 0.1.23
*30 Nov 2019*
- [Direct x64 machine code generation](https://github.com/vlang/v/issues/2849).
Hello world being built in 3 milliseconds.
- Bare metal support via the `-freestanding` flag, to build programs without linking to libc.
- Prebuilt V packages for Linux, macOS, and Windows.
- `string.index()` now returns `?int` instead of `int/-1`.
- Lots of fixes in Generics.
- vweb framework for developing web applications is back.
- Vorum, the forum/blogging software written in vweb, can now be compiled and has been added to CI.
- REPL, `v up` have been split up into separate applications to keep the core V compiler small.
- V now enforces short enum syntax (`.green` instead of `Color.green`) when it's enough.
- V UI for macOS.
- Interfaces have been rewritten. `[]interface` support.
- `os.cp()` for copying files and directores.
- Additional compile-time flags: `$if clang, msvc, mingw, x32, x64, big_endian, little_endian {`.
- All C functions now have to be declared, all missing C functions have been defined.
- Global variables (only with the `--enable-globals` flag)
for low level applications like kernels and drivers.
- Nothing can be cast to bool (previously code like `if bool(1) {` worked).
- `<<` and `>>` now work with all integer types.
- V detects Cygwin and shows an error (V supports Windows natively).
- Improved type checking of some operators (`%, |, &` etc).
- Windows 7 support.
- `println(true)` now prints `true` instead of `1`.
- `os.exec()` now uses `CreateProcess` on Windows.
- fast.vlang.io website for monitoring the performance of V after every commit.
- On Windows Visual Studio is now used automatically if GCC is not installed.
- vfmt!
- Lots of cleaning up in the compiler code.
- Multi-level pointers in unsafe code (`****int`).
- MSVC backtrace.
- `$if os {` blocks are now skipped on a different OS.
- C string literals (`c'hello'`).
- AlpineLinux/musl fixes + added to CI.
- Inline assembly.
- Clipboard module (Windows, macOS, X).
- `foo()?` syntax for error propagation.
- Docs have been migrated from HTML to `doc/docs.md`.
- `eventbus` module.
- Haiku OS support.
- `malloc/free` on bare metal.
- `utf8` helper functions (`to_lower()`, `to_upper()`, etc).
- Optimization of `for c in str {`.
- `string/array.left/right/slice/substr` were removed (use `[a..b]` slicing syntax instead).
## V 0.1.22
*28 Oct 2019*
- Generic functions (`fn foo<T>(bar T) T {`) with varargs support.
- `array[start..end]` and `string[start..end]` slicing syntax.
- Optimized `array.filter()` and `array.map()`.
- `sqlite` module.
- Cached modules for faster compilation.
- Dramatic compilation optimizations: [V now compiles itself in 0.10 - 0.30 seconds](https://github.com/vlang/v/wiki/The-V-language-now-compiles-itself-in-0.09-seconds)
- V scripts (simpler and cross-platform alternative to Bash).
- Infinite multi-dimensional arrays (`[][][]int`).
- `unsafe`.
- `[deprecated]` attribute.
- `[if]` function attributes for compile time function exclusion for performance.
- `switch` has been completely removed from the language and replaced by
`match` everywhere.
- `pub struct` and `pub const`, previously all structs and consts were public
by default.
- `musl` support (V can now run on, for example, Alpine Linux).
- Module header generation. V now supports closed source modules, which are still
used in some industries.
- Constants were added to typo suggestions.
- `color in [.green, .red, .blue]` now works without specifying `Color.green`.
- V compiler is now a module that can be used by other programs.
- Backtraces now have source lines on Linux.
- `runtime.nr_cpus()`.
- `fn init()` for module initialization.
- `a in [1, 2, 3]` optimization: no array gets allocated.
- Raw strings: `s := r'hello\nworld'`.
- `if a := func() { }` syntax for handling optionals.
- f32/f64 comparison now uses machine epsilon by default.
## V 0.1.21
*30 Sep 2019*
- `none` keyword for optionals.
- Solaris support.
- All table lookup functions now use `none`.
- varargs: `fn foo(bar int, params ...string) {`.
- Double quotes (`"`) can now also be used to denote strings.
- GitHub Actions CI in addition to Travis.
- `-compress` option. The V binary built with `-compress` is only ~90 KB!
- More memory management.
- Unused modules result in an error.
- "Unused variable/module" errors are now warnings in non-production builds.
- Duplicate methods with the same name can no longer be defined.
- Struct names must be capitalized, variable/function names must use snake_case.
- Error messages are now even nicer!
- Lots of fixes in automatic `.str()` method generation for structs and arrays.
- ~30% faster parser (files are no longer parsed separately for each pass).
- `_` is no longer a variable, but an actual syntax construct to skip unused values, like in Go.
- Multiple returns (`fn foo() (int, string) {`).
- `!` can now only be used with booleans.
## V 0.1.20
*17 Sep 2019*
- JavaScript backend!
- Hundreds of C warnings were fixed. `gcc v.c` now builds without
any warnings.
- The mutability check now applies to function args (mutable
receivers that are not modified result in a compilation error).
- V tests now show how long each test took.
- Official Android support (only console applications via Termux for now).
- Typo check. If a variable/function/module etc is misspelled,
V will suggest the correct name.
- Lots of Microsoft C fixes, and a separate Travis instance for
this backend.
- Bitwise operators `|`, `^`, `&` no longer work with booleans.
## V 0.1.19
*12 Sep 2019*
- Lots of refactoring, simplifications, and optimizations in the compiler.
- Experimental memory management at compilation (only for the V compiler itself for now).
- Lots of ORM fixes.
- Functions can now be inlined via the `[inline]` attribute.
- New `mysql` module.
- Better error format that is supported by all major editors (go to error).
- Error messages now point to the actual place where the error happened.
- Custom json field names: `struct User { last_name string [json:lastName] }`.
- Raw json fields via the `[raw]` attribute.
- All C code was removed from the `freetype` module.
- `gg` module can now render all Unicode characters.
- `[typedef]` attribute for imported C struct typedefs.
- Support of Objective C interfaces (primarily for using Cocoa).
- REPL: clear command and custom functions.
- REPL tests (which are also used for testing certain compiler errors).
- Syntax bug fixed: `foo[0] += 10` is now possible.
- http: support plain HTTP protocol and follow redirects.
- http: header data is now processed correctly.
- net: basic UDP support.
- `import const` was removed from the language.
- `array.contains()` was removed from the language (`in` should be used instead).
- `[0; len]` syntax was removed (replaced with a simpler `[0].repeat(len)`)
- Primitive aliases were removed to simplify the language.
- GitHub supports V now!
- Backtraces are now printed on panics.
- A new awesome `readline` module.
- V.c is now regenerated automatically after every commit.
- A bug with struct ordering was fixed, now structs can be declared in any order.
- V modules can now be built with `v build module`.
- `@FILE, @LINE, @FN, @COLUMN` for debugging.
## V 0.1.18
*16 Aug 2019*
- Built-in ORM (`uk_customers = db.select from Customer where country == 'uk' && nr_orders > 0`).
- Map initialization syntax: `m := { foo: bar, baz: foo }`.
- `map.delete(key)`.
- `libcurl` dependency was removed from the `http` module.
- All function arguments are now immutable by default (previously they could be
modifed inside the function).
- `http` functions now return optionals.
- `sync.WaitGroup`.
- `vweb` static files serving.
- `crypto.rand` module.
- `v up` to update V.
- SChannel support on Windows.
- `net.urllib` module.
- vpm package manager, `v install`.
- `()` are now required in complex bool expressions: `(a && b) || c` instead of `a && b || c`.
- All arrays now have a default `.str()` method.
- Bootstrapping V with MSVC.
- Experimental `≠` etc support.
- `encoding.csv` module.
- `$if debug {` for running code in debug mode only.
- Map struct fields are now initialized automatically, just like arrays.
- Maps now support array values.
- `json` functions can no longer be used if the `json` module is not imported.
## V 0.1.17
*29 Jul 2019*
- `vweb` module for developing web apps in V.
- vtalk, open source V forum software.
- Generics (very limited right now, but they will be gradually improved).
- Comptime codegen (`foo.$method()` where `method` is a string).
- @ for escaping keywords (e.g. `struct Foo { @type string }`).
- Windows Unicode fixes (V can now work with non-ASCII paths etc on Windows).
- Fix mutable args bugs + don't allow primitive arguments to be modified.
- Declaring a mutable variable and never modifying it results in a compilation error.
- Interactive debugging support.
- `sync` module for Windows.
- `#!` support on Unix systems (V scripts).
- Lots of Visual Studio fixes.
- `crypto.aes` and `crypto.rc4` modules.
- Internal modules.
## V 0.1.16
*23 Jul 2019*
- V can now be used with Visual Studio!
- Hot code reloading now works with graphical applications (e.g. graph.v, bounce.v).
- Compile time memory management for arrays.
- High order functions.
- `match` expression (replacing `switch`).
- Import cycle detection.
- `crypto/md5`, `crypto/sha256`, and `crypro/sha512` modules.
- `os.executable()` - a cross platform function that returns full path to current executable.
- `~/.vlang` and `VROOT` were removed entirely. The installation is a lot cleaner now.
- V can now be packaged for all Linux distros.
- Arch Linux package.
- `string(bytes_buffer, len)`, `string(bytes_array)` casts.
- Multiple `defer`s.
- `key in map` syntax (replacing `map.exists(key)`).
## V 0.1.15
*15 Jul 2019*
- FreeBSD, OpenBSD, NetBSD, DragonFly support.
- Hot reloading now works with graphical applications: [bounce.v](examples/hot_reload/bounce.v)
- VROOT was removed, the installation process is now much simpler.
- `defer` statement.
- map.v was re-written. It's now much faster.
- `for key, val in map` syntax.
- `flag` module for parsing command line arguments.
- `zip` module.
- `crypto/sha1` module.
- Submodules and module aliases (`import encoding.base64 as b64`).
## V 0.1.14
*12 Jul 2019*
- `gg` module Windows support, V Tetris runs on Windows.
- Compile `glad` and `cJSON` only once. Programs using `gg` or `json` compile a bit faster.
- `v.c` has been cleaned up and minimized (~16k => ~10k lines of code).
- `type` aliases can now have methods.
- Const overflow check during compilation (`byte(1000)` will no longer compile).
## V 0.1.13
*10 Jul 2019*
- New enum syntax (`token == .name`), enum values are no longer global consts.
- Submodules (`import encoding.base64`).
- Hot code reloading.
- Special `err` variable for getting error values.
- Complex numbers.
- `<<` can now append arrays (`numbers << [1, 2, 3]`).
- Lots of Windows fixes (Windows still needs some work).
- Lots of REPL improvements (e.g. `>> 2 + 3` works now, no `println` required).
- The website was made easily translatable, it's now partially available in several languages.
## V 0.1.12
*4 Jul 2019*
- V can finally compile itself on Windows (https://github.com/vlang/v#mingw-w64).
- `os` module now uses optionals in all functions that return `File`.
- Lots of bugs with optionals were fixed.
- `println` was optimized. It no longer results in allocations.
Now it also works correctly with all integer types.
- Lots of `vfmt` fixes, it will be enabled tomorrow.
- New `strings` module.
- Lots of other fixes and improvements, thanks to all the contributors.
## V 0.1.11
*1 Jul 2019*
- Cross compilation for Windows!
- Lots of Windows fixes.
- socket.v.
- maps fixed.
## V 0.1.9 - 0.1.10
*29 Jun 2019*
- Windows support via MinGW-w64. Pre-built Windows binary.
- File structure has been simplified: all vlib modules were moved to the vlib/ directory,
makefile was moved to the root.
- One single archive with pre-built binaries for all operating systems.
- `mut var := val` was fixed (previously `mut var = val` was allowed as well).
## V 0.1.8
*28 Jun 2019*
- Single file programs without `fn main` now work as expected.
- REPL has been fixed: it now supports imports, consts, function definitions, etc.
- REPL has been fixed: it now supports imports, consts, function definitions, etc.
# 0.1.7
## V 0.1.7
*27 Jun 2019*
- All C code in the compiler and vlib has been replaced with V.
- `#` syntax for embedding C code has been removed.
- Exported functions now need to be marked with `pub`, all public vlib functions have been updated.

View File

@@ -1 +1,4 @@
# Code of Conduct
Be nice and respectful.

167
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,167 @@
## Code Structure
I tried to make the code of the compiler and vlib as simple and readable as
possible. One of V's goals is to be open to developers with different levels
of experience in compiler development. Compilers don't need to be black boxes
full of magic that only few people understand.
The V compiler is modular, and can be used by other applications. It is located
in `cmd/v/` and `vlib/v/`.
The most important and useful command to remember when working on the V compiler
is `v self`.
It rebuilds the V compiler.
Be careful, if you introduce a breaking change and rebuild V, you will no longer
be able to use V to build itself. So it's a good idea to make a backup copy of a
working compiler executable.
But don't worry, you can always simply run `make` (or `make.bat`), it will
download the C version of the compiler and rebuild it from scratch.
The architecture of the compiler is very simple and has three distinct steps:
Parse/generate AST (`v.parser`) => Check types (`v.checker`)
=> Generate C/JavaScript/machine code (`v.gen`)
The main files are:
1. `cmd/v/v.v` The entry point.
- V figures out the build mode.
- Constructs the compiler object (`struct V`).
- Creates a list of .v files that need to be parsed.
- Creates a parser object for each file and runs `parse()` on them.
- The correct backend is called (C, JS, x64), and a binary is compiled.
2. `v/scanner` The scanner's job is to parse a list of characters and convert
them to tokens.
3. `v/token` This is simply a list of all tokens, their string values, and a
couple of helper functions.
4. `v/parser` The parser. It converts a list of tokens into an AST.
In V, objects can be used before declaration, so unknown types are marked as
unresolved. They are resolved later in the type checker.
5. `v/table` V creates one table object that is shared by all parsers. It
contains all types, consts, and functions, as well as several helpers to search
for objects by name, register new objects, modify types' fields, etc.
6. `v/checker` Type checker and resolver. It processes the AST and makes sure
the types are correct. Unresolved types are resolved, type information is added
to the AST.
7. `v/gen` C backend. It simply walks the AST and generates C code that can be
compiled with Clang, GCC, Visual Studio, and TCC.
8. `json.v` defines the json code generation. This file will be removed once V
supports comptime code generation, and it will be possible to do this using the
language's tools.
9. `v/gen/x64` is the directory with all the machine code generation logic. It
defines a set of functions that translate assembly instructions to machine code
and build the binary from scratch byte by byte. It manually builds all headers,
segments, sections, symtable, relocations, etc. Right now it only has basic
support of the x64 platform/ELF format.
The rest of the directories are vlib modules: `builtin/` (strings, arrays,
maps), `time/`, `os/`, etc. Their documentation is pretty clear.
## Example Workflow for Contributing
(provided by [@spytheman](https://github.com/spytheman))
(If you don't already have a GitHub account, please create one. Your GitHub
username will be referred to later as 'YOUR_GITHUB_USERNAME'. Change it
accordingly in the steps below.)
1. Fork https://github.com/vlang/v using GitHub's interface to your own account.
Let's say that the forked repository is at
`https://github.com/YOUR_GITHUB_USERNAME/v` .
2. Clone the main v repository https://github.com/vlang/v to a local folder on
your computer, say named nv/ (`git clone https://github.com/vlang/v nv`)
3. `cd nv`
4. `git remote add pullrequest https://github.com/YOUR_GITHUB_USERNAME/v`
NB: the remote named `pullrequest` should point to YOUR own forked repo, not the
main v repository! After this, your local cloned repository is prepared for
making pullrequests, and you can just do normal git operations such as:
`git pull` `git status` and so on.
5. When finished with a feature/bugfix/change, you can:
`git checkout -b fix_alabala`
6. `git push pullrequest` # (NOTE: the `pullrequest` remote was setup on step 4)
7. On GitHub's web interface, go to: https://github.com/vlang/v/pulls
Here the UI shows a dialog with a button to make a new pull request based on
the new pushed branch.
(Example dialog: https://url4e.com/gyazo/images/364edc04.png)
8. After making your pullrequest (aka, PR), you can continue to work on the
branch `fix_alabala` ... just do again `git push pullrequest` when you have more
commits.
9. If there are merge conflicts, or a branch lags too much behind V's master,
you can do the following:
1. `git pull --rebase origin master` # solve conflicts and do
`git rebase --continue`
2. `git push pullrequest -f` # this will overwrite your current remote branch
with the updated version of your changes.
The point of doing the above steps, is to never directly push to the main V
repository, *only to your own fork*. Since your local `master` branch tracks the
main V repository's master, then `git checkout master`, as well as
`git pull --rebase origin master` will continue to work as expected
(these are actually used by `v up`) and git can always do it cleanly.
Git is very flexible, so there are other ways to accomplish the same thing.
See the [GitHub flow](https://guides.github.com/introduction/git-handbook/#github), for more information.
## Using Github's hub CLI tool
You can download the `hub` tool from https://hub.github.com/ . Using
`hub`, you will not need to go through the (sometimes) slow website
to make PRs. Most remote operations can be done through the `hub` CLI
command.
NB: You still need to have a GitHub account.
### Preparation:
(steps 1..3 need to be done just *once*):
1. `hub clone vlang/v my_v`
2. `cd my_v`
3. `hub fork --remote-name pullrequest`
4. `git checkout -b my_cool_feature` # Step 4 is better done *once per each new
feature/bugfix* that you make.
### Improve V by making commits:
5. `git commit -am "math: add a new function copysign"`
### Testing your commits locally:
You can test locally whether your changes have not broken something by
running: `v test-compiler`. See `TESTS.md` for more details.
### Publishing your commits to GitHub:
6. `git push pullrequest`
### Making a PR with `hub`:
(so that your changes can be merged to the main V repository)
7. `hub pull-request`
Optionally, you can track the status of your PR CI tests with:
8. `hub ci-status --verbose`
### Fixing failing tests:
If everything is OK, after 5-10 minutes, the CI tests should pass for
all platforms. If not, visit the URLs for the failing CI jobs, see
which tests have failed and then fix them by making more changes. Just use
`git push pullrequest` to publish your changes. The CI tests will
run with your updated code. Use `hub ci-status --verbose` to monitor
their status.

View File

@@ -1,39 +0,0 @@
## Code Structure
I tried making the code of the compiler and vlib as simple and readable as possible. One of V's goals is to be open to developers with different levels of experience in compiler development. Compilers don't need to be black boxes full of magic that only few people understand.
The compiler itself is located in `compiler/`
It has only 8 files (soon to be 7):
1. `main.v` The entry point.
- V figures out the build mode.
- Constructs the compiler object (`struct V`).
- Creates a list of .v files that need to be parsed.
- Creates a parser object for each file and runs `parse()` on them (this should work concurrently in the future). The parser emits C or x64 code directly. For performance reasons, there are no intermediate steps (no AST or Assembly code generation).
- If the parsing is successful, a single C file is generated by merging the output from the parsers and carefully arranging all definitions (C is a single pass language).
- Finally, a C compiler is called to compile this C file and generate an executable or a library.
2. `parser.v` The core of the compiler. This is the largest file (~3.5k loc). `parse()` method asks the scanner to generate a list of tokens for the file it needs to parse. Then it simply goes through all the tokens one by one.
In V objects can be used before declaration, so there are 2 passes. During the first pass it only looks at declarations and skips function bodies. It memorizes all function signatures, types, consts, etc. During the second pass it looks at function bodies and generates C (e.g. `cgen('if ($expr) {'`) or machine code (e.g. `gen.mov(EDI, 1)`).
The formatter is embedded in the parser. Correctly formatted tokens are emitted as they are parsed. This allowed to simplify the compiler and avoid duplication, but slowed it down a bit. In the future this will be fixed with build flags and separate binaries for C generation, machine code generation, and formatting. This way there will be no unnecessary branching and function calls.
3. `scanner.v` The scanner's job is to parse a list of characters and convert them to tokens. It also takes care of string interpolation, which is a mess at the moment.
4. `token.v` This is simply a list of all tokens, their string values, and a couple of helper functions.
5. `table.v` V creates one table object that is shared by all parsers. It contains all types, consts, and functions, as well as several helpers to search for objects by name, register new objects, modify types' fields, etc.
6. `cgen.v` The small `Cgen` struct helps generate C code. It's also shared by all parsers. It has a couple of functions that allow to go back and set something that was previously unknown (like with `a := 0` => `int a = 0;`). Some of these functions are hacky and need improvements and simplifications.
7. `fn.v` Handles declaring and calling normal and async functions and methods. This file is about 1000 lines of code, and has some complex logic. It needs to be cleaned up and simplified a bit.
8. `json.v` defines the json code generation. This file will be removed once V supports comptime code generation, and it will be possible to do this using the language's tools.
9. `x64/` is the directory with all the machine code generation logic. It will be available in early July. Obviously this is the most complex part of the compiler. It defines a set of functions that translate assembly instructions to machine code, it builds complicated binaries from scratch byte by byte. It manually builds all headers, segments, sections, symtable, relocations, etc. Right now it only has basic support of the x64 platform/Mach-O format, and it can only generate `.o` files, which then have to be linked with `lld`.
The rest of the directories are vlib modules: `builtin/` (strings, arrays, maps), `time/`, `os/`, etc. Their documentation is pretty clear.

14
Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
#same container that golang use
FROM buildpack-deps:buster-curl
LABEL maintainer="ANAGO Ronnel <anagoandy@gmail.com>"
WORKDIR /opt/vlang
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gcc clang make git && \
apt-get clean && rm -rf /var/cache/apt/archives/* && \
rm -rf /var/lib/apt/lists/*
COPY . .
RUN make && \
ln -s /opt/vlang/v /usr/local/bin/v
CMD [ "bash" ]

20
Dockerfile.alpine Normal file
View File

@@ -0,0 +1,20 @@
FROM alpine:3.11
LABEL maintainer="spytheman <spytheman@bulsynt.org>"
WORKDIR /opt/vlang
ENV VVV /opt/vlang
ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN mkdir -p /opt/vlang && ln -s /opt/vlang/v /usr/bin/v
RUN apk --no-cache add \
git make upx gcc \
musl-dev \
openssl-dev sqlite-dev \
libx11-dev glfw-dev freetype-dev
## RUN apk --no-cache add --virtual sdl2deps sdl2-dev sdl2_ttf-dev sdl2_mixer-dev sdl2_image-dev
RUN git clone https://github.com/vlang/v /opt/vlang && make && v -version

10
Dockerfile.cross Normal file
View File

@@ -0,0 +1,10 @@
FROM mstorsjo/llvm-mingw
LABEL maintainer="Vitaly Takmazov <vitalyster@gmail.com>"
COPY . .
RUN make
RUN ./v -os windows -o v.c cmd/v
RUN x86_64-w64-mingw32-gcc v.c -std=c99 -w -municode -o v.exe
RUN file v.exe
CMD [ "bash" ]

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2019 Alexander Medvednikov
Copyright (c) 2019-2020 Alexander Medvednikov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

140
Makefile
View File

@@ -1,20 +1,130 @@
all: clean v
$(info V has been successfully built)
CC ?= cc
CFLAGS ?=
LDFLAGS ?=
TMPDIR ?= /tmp
VROOT ?= .
VC ?= ./vc
V ?= ./v
VCREPO ?= https://github.com/vlang/vc
TCCREPO ?= https://github.com/vlang/tccbin
v: v.c
cc -std=gnu11 -w -o v v.c
./v -o v compiler
rm v.c
VCFILE := v.c
TMPTCC := $(VROOT)/thirdparty/tcc
TCCBRANCH := thirdparty-unknown-unknown
GITCLEANPULL := git clean -xf && git pull --quiet
GITFASTCLONE := git clone --depth 1 --quiet --single-branch
v.c:
curl -Os https://raw.githubusercontent.com/vlang/vc/master/v.c
#### Platform detections and overrides:
_SYS := $(shell uname 2>/dev/null || echo Unknown)
_SYS := $(patsubst MSYS%,MSYS,$(_SYS))
_SYS := $(patsubst MINGW%,MinGW,$(_SYS))
test: v
./v -prod -o vprod compiler # Test prod build
echo "Running V tests..."
find . -name '*_test.v' -print0 | xargs -0 -n1 ./v
echo "Building V examples..."
find examples -name '*.v' -print0 | xargs -0 -n1 ./v
ifneq ($(filter $(_SYS),MSYS MinGW),)
WIN32 := 1
V:=./v.exe
endif
ifeq ($(_SYS),Linux)
LINUX := 1
TCCBRANCH := thirdparty-linux-amd64
endif
ifeq ($(_SYS),Darwin)
MAC := 1
TCCBRANCH := thirdparty-macos-amd64
endif
ifeq ($(_SYS),FreeBSD)
LDFLAGS += -lexecinfo
endif
ifdef ANDROID_ROOT
ANDROID := 1
undefine LINUX
TCCBRANCH := thirdparty-linux-arm64
endif
#####
ifdef WIN32
TCCBRANCH := thirdparty-windows-amd64
VCFILE := v_win.c
endif
all: latest_vc latest_tcc
ifdef WIN32
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS)
ifdef prod
$(V) -prod self
else
$(V) self
endif
else
$(CC) $(CFLAGS) -g -std=gnu99 -w -o $(V) $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS)
ifdef ANDROID
chmod 755 v
endif
ifdef prod
$(V) -prod self
else
$(V) self
endif
ifndef ANDROID
$(MAKE) modules
endif
endif
@echo "V has been successfully built"
@$(V) -version
#clean: clean_tmp
#git clean -xf
clean:
-rm -f v.c v vprod
rm -rf $(TMPTCC)
rm -rf $(VC)
latest_vc: $(VC)/.git/config
ifndef local
cd $(VC) && $(GITCLEANPULL)
else
@echo "Using local vc"
endif
fresh_vc:
$(GITFASTCLONE) $(VCREPO) $(VC)
latest_tcc: $(TMPTCC)/.git/config
ifndef ANDROID
ifndef local
cd $(TMPTCC) && $(GITCLEANPULL)
else
@echo "Using local tcc"
endif
endif
fresh_tcc:
ifndef ANDROID
rm -rf $(TMPTCC)
$(GITFASTCLONE) --branch $(TCCBRANCH) $(TCCREPO) $(TMPTCC)
endif
$(TMPTCC)/.git/config:
$(MAKE) fresh_tcc
$(VC)/.git/config:
$(MAKE) fresh_vc
selfcompile:
$(V) -cg -o v cmd/v
selfcompile-static:
$(V) -cg -cflags '--static' -o v-static cmd/v
modules: module_builtin module_strings module_strconv
module_builtin:
#$(V) build module vlib/builtin > /dev/null
module_strings:
#$(V) build module vlib/strings > /dev/null
module_strconv:
#$(V) build module vlib/strconv > /dev/null

282
README.md
View File

@@ -1,155 +1,253 @@
# The V Programming Language 0.1.x
<div align="center">
<p>
<img width="80" src="https://raw.githubusercontent.com/donnisnoni95/v-logo/master/dist/v-logo.svg?sanitize=true">
</p>
<h1>The V Programming Language</h1>
[![Build Status](https://dev.azure.com/alexander0785/vlang/_apis/build/status/vlang-CI?branchName=master)](https://dev.azure.com/alexander0785/vlang/_build/latest?definitionId=1&branchName=master) [![Build Status](https://travis-ci.org/vlang/v.svg?branch=master)](https://travis-ci.org/vlang/v)
[vlang.io](https://vlang.io) |
[Docs](https://github.com/vlang/v/blob/master/doc/docs.md) |
[Changelog](https://github.com/vlang/v/blob/master/CHANGELOG.md) |
[Speed](https://fast.vlang.io/) |
[Contributing & compiler design](https://github.com/vlang/v/blob/master/CONTRIBUTING.md)
https://vlang.io
</div>
<div align="center">
Documentation: https://vlang.io/docs
Twitter: https://twitter.com/v_language
Discord (primary community): https://discord.gg/n7c74HM
Installing V: https://github.com/vlang/v#installing-v-from-source
[![Build Status][WorkflowBadge]][WorkflowUrl]
[![Sponsor][SponsorBadge]][SponsorUrl]
[![Patreon][PatreonBadge]][PatreonUrl]
[![Discord][DiscordBadge]][DiscordUrl]
[![Twitter][TwitterUrl]][TwitterBadge]
</div>
## Key Features of V
- Simplicity: the language can be learned in half an hour, less if you already know Go
- Fast compilation: ~100k loc/s right now, ~1.2 million loc/s once x64 generation is mature enough
- Simplicity: the language can be learned in less than an hour
- Fast compilation: ≈80k loc/s with a Clang backend,
≈1 million loc/s with x64 and tcc backends *(Intel i5-7500, SSD, no optimization)*
- Easy to develop: V compiles itself in less than a second
- Performance: within 5% of C
- Performance: as fast as C (V's main backend compiles to human readable C)
- Safety: no null, no globals, no undefined behavior, immutability by default
- C to V translation
- Hot code reloading
- Powerful UI and graphics libraries
- [Cross-platform UI library](https://github.com/vlang/ui)
- Built-in graphics library
- Easy cross compilation
- REPL
- [Built-in ORM](https://github.com/vlang/v/blob/master/doc/docs.md#orm)
- [Built-in web framework](https://github.com/vlang/v/blob/master/vlib/vweb/README.md)
- C and JavaScript backends
V 1.0 release is planned for December 2019.
## Stability guarantee and future changes
## Notes
Despite being at an early development stage, the V language is relatively stable and has
backwards compatibility guarantee, meaning that the code you write today is guaranteed
to work a month, a year, or five years from now.
GitHub marks V's code as written in Go. It's actually written in V, GitHub doesn't support the language yet.
There still may be minor syntax changes before the 1.0 release, but they will be handled
automatically via `vfmt`, as has been done in the past.
The compilation is temporarily slower for this release:
The V core APIs (primarily the `os` module) will still have minor changes until
they are stabilized in 2020. Of course the APIs will grow after that, but without breaking
existing code.
- Debug builds are used (use `./v -prod -o v .` to get faster compilation).
- vlib is recompiled with every program you build.
- The new formatter runs on every single token and slows the compiler down by ~20%. This will be taken care of.
- There are a lot of known issues that are quick to fix (like function lookups being O(n)).
There's some old hacky code written when V was 2 months old. All of it will be quickly cleaned up. There are ~500 lines of C code, which will be removed by the end of June.
## Code structure
https://github.com/vlang/v/blob/master/CodeStructure.md
Unlike many other languages, V is not going to be always changing, with new features
being introduced and old features modified. It is always going to be a small and simple
language, very similar to the way it is right now.
## Installing V from source
### Linux and macOS
You'll need Clang or GCC. On macOS run `xcode-select --install` if you don't have XCode or XCode tools installed.
### Linux, macOS, Windows, *BSD, Solaris, WSL, Android, Raspbian
```bash
# You can clone V anywhere
git clone https://github.com/vlang/v
cd v
make
```
Or build without make:
```bash
# Download the V compiler's source translated to C
curl -sO https://raw.githubusercontent.com/vlang/vc/master/v.c
cc -std=gnu11 -w -o v v.c # Build it with Clang or GCC
./v -o v . # Use the resulting V binary to build V from V source
./v -o v . # Build the compiler again to make sure it works
```
That's it! Now you have a V executable at `[path to V repo]/v`.
`[path to V repo]` can be anywhere.
You can create a symlink so that it's globally available:
(On Windows `make` means running `make.bat`, so make sure you use `cmd.exe`)
```
sudo ln -s [path to V repo]/v /usr/local/bin/v
```
Now you can try `./v run examples/hello_world.v` (`v.exe` on Windows).
V is being constantly updated. To update V, simply run
```
git pull origin master
make
```
### Windows
V works great on Windows Subsystem for Linux. The instructions are the same as above.
If you want to build v.exe on Windows without WSL, you can use MinGW-w64 or Visual Studio.
#### MinGW-w64
[Download](https://downloads.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe?r=&ts=1561736169&use_mirror=gigenet) and install MinGW-w64.
Make sure the `C:/mingw-w64/bin` directory is in system's PATH.
V is being constantly updated. To update V, simply run:
```bash
v up
```
### C compiler
It's recommended to use Clang or GCC or Visual Studio.
If you are doing development, you most likely already have one of those installed.
Otherwise, follow these instructions:
- [Installing a C compiler on Linux and macOS](https://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Linux-and-macOS)
- [Installing a C compiler on Windows](https://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Windows)
However, if none is found when running `make` on Linux or Windows,
TCC would be downloaded and set as an alternative C backend.
It's very lightweight (several MB) so this shouldn't take too long.
### Symlinking
NB: it is *highly recommended*, that you put V on your PATH. That saves
you the effort to type in the full path to your v executable every time.
V provides a convenience `v symlink` command to do that more easily.
On Unix systems, it creates a `/usr/local/bin/v` symlink to your
executable. To do that, run:
```bash
sudo ./v symlink
```
On Windows, start a new shell with administrative privileges, for
example by <kbd>Windows Key</kbd>, then type `cmd.exe`, right click on its menu
entry, and choose `Run as administrator`. In the new administrative
shell, cd to the path, where you have compiled v.exe, then type:
```bat
.\v.exe symlink
```
That will make v available everywhere, by adding it to your PATH.
Please restart your shell/editor after that, so that it can pick
the new PATH variable.
NB: there is no need to run `v symlink` more than once - v will
continue to be available, even after `v up`, restarts and so on.
You only need to run it again, if you decide to move the V repo
folder somewhere else.
### Docker
<details><summary>Expand Docker instructions</summary>
```bash
# You can clone V anywhere
git clone https://github.com/vlang/v
cd v/compiler
# Download the V compiler's source translated to C
curl -sO https://raw.githubusercontent.com/vlang/vc/master/v.c
gcc -std=gnu11 -w -o v.exe v.c # Build it with GCC
cd v
docker build -t vlang .
docker run --rm -it vlang:latest
v
```
### Docker with Alpine/musl
### Testing
```bash
git clone https://github.com/vlang/v
cd v
docker build -t vlang --file=Dockerfile.alpine .
docker run --rm -it vlang:latest
/usr/local/v/v
```
$ cd examples
$ v run hello_world.v
hello world
</details>
### Testing and running the examples
Make sure V can compile itself:
```bash
v self
```
```bash
$ v
V 0.1.2
Use Ctrl-D to exit
V 0.1.x
Use Ctrl-C or `exit` to exit
>>> println('hello world')
hello world
>>>
```
Now if you want, you can start tinkering with the compiler. If you introduce a breaking change and rebuild V, you will no longer be able to use V to build itself. So it's a good idea to make a backup copy of a working compiler executable.
### Running the examples
```
```bash
cd examples
v hello_world.v && ./hello_world # or simply
v run hello_world.v # this builds the program and runs it right away
v word_counter.v && ./word_counter cinderella.txt
v run news_fetcher.v
v run tetris.v
v run tetris/tetris.v
```
<img src='https://raw.githubusercontent.com/vlang/v/master/examples/tetris/screenshot.png' width=300>
NB: In order to build Tetris or 2048 (or anything else using `sokol` or `gg` graphics modules)
on some Linux systems, you need to install `libxi-dev` and `libxcursor-dev` .
In order to build Tetris and anything else using the graphics module, you will need to install glfw and freetype.
If you plan to use the http package, you also need to install OpenSSL on non-Windows systems.
If you plan to use the http package, you also need to install libcurl.
```
```bash
macOS:
brew install glfw freetype curl
brew install openssl
Ubuntu:
sudo apt install libglfw3 libglfw3-dev libfreetype6-dev libcurl3-dev
Debian/Ubuntu:
sudo apt install libssl-dev
Arch:
sudo pacman -S glfw-x11 curl freetype2
Arch/Manjaro:
openssl is installed by default
Fedora:
sudo dnf install openssl-devel
```
glfw and libcurl dependencies will be removed soon.
## V UI
<a href="https://github.com/vlang/ui">
<img src='https://raw.githubusercontent.com/vlang/ui/master/examples/screenshot.png' width=712>
</a>
https://github.com/vlang/ui
<!---
## JavaScript backend
[examples/hello_v_js.v](examples/hello_v_js.v):
```v
fn main() {
for i in 0..3 {
println('Hello from V.js')
}
}
```
```bash
v -o hi.js examples/hello_v_js.v && node hi.js
Hello from V.js
Hello from V.js
Hello from V.js
```
-->
## Developing web applications
Check out the [Building a simple web blog](https://github.com/vlang/v/blob/master/tutorials/building-a-simple-web-blog-with-vweb.md)
tutorial and Gitly, a light and fast alternative to GitHub/GitLab:
https://github.com/vlang/gitly
<img src="https://user-images.githubusercontent.com/687996/85933714-b195fe80-b8da-11ea-9ddd-09cadc2103e4.png">
## Troubleshooting
Please see the [Troubleshooting](https://github.com/vlang/v/wiki/Troubleshooting) section on our [wiki page](https://github.com/vlang/v/wiki)
[WorkflowBadge]: https://github.com/vlang/v/workflows/CI/badge.svg
[DiscordBadge]: https://img.shields.io/discord/592103645835821068?label=Discord&logo=discord&logoColor=white
[PatreonBadge]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dvlang%26type%3Dpledges
[SponsorBadge]: https://camo.githubusercontent.com/da8bc40db5ed31e4b12660245535b5db67aa03ce/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d53706f6e736f72266d6573736167653d254532253944254134266c6f676f3d476974487562
[TwitterBadge]: https://twitter.com/v_language
[WorkflowUrl]: https://github.com/vlang/v/commits/master
[DiscordUrl]: https://discord.gg/vlang
[PatreonUrl]: https://patreon.com/vlang
[SponsorUrl]: https://github.com/sponsors/medvednikov
[TwitterUrl]: https://img.shields.io/twitter/follow/v_language.svg?style=flatl&label=Follow&logo=twitter&logoColor=white&color=1da1f2

69
TESTS.md Normal file
View File

@@ -0,0 +1,69 @@
# Automated tests
In the `v` repo there are several different tests. The main types are:
* `_test.v` tests - check that `test_` functions succeed. These can be
run per directory or individually.
* `.out` tests - run a `.vv` file and check the output matches the
contents of the `.out` file with the same base name. This is
particularly useful for checking that errors are printed.
Tip: use `v -cc tcc` when compiling tests for speed.
## `v test-compiler`
This builds and tests:
* `vc` repo
* `_test.v` files
* examples
* `v install` a module
Some of these can be invoked separately.
## `vlib/v/compiler_errors_test.v`
This runs tests for:
* `checker/tests/*.vv`
* `parser/tests/*.vv`
## `vlib/v/tests`
General runnable program tests.
## Actual code
* `v build-examples`
* `v build-tools`
## `v test-fixed`
Test `vlib`.
## vfmt tests
In `vlib/v/fmt/` there's:
* `fmt_test.v`
This checks `.out` tests.
* `fmt_keep_test.v`
This verifies that `_keep.v` files would be unchanged by `vfmt -w`.
* `fmt_vlib_test.v`
This checks all source files are formatted and prints a summary. This
is not required.
* `v test-fmt`
Test all files in the current directory are formatted.
## `.github/workflows/ci.yml`
This runs various CI tests, e.g.:
* `v vet vlib/v` - style checker
* `v fmt -verify` on certain source files

View File

@@ -1,39 +0,0 @@
jobs:
- job: LinuxBuild
pool:
vmImage: 'ubuntu-16.04'
displayName: "V Linux Build"
steps:
- script: |
sudo apt install -y libglfw3 libglfw3-dev libfreetype6-dev libcurl3-dev
displayName: 'Install Dependencies'
- script: |
make
displayName: 'Build V'
- script: |
make test
displayName: 'Run Tests'
- job: WindowsBuild
pool:
vmImage: 'vs2017-win2016'
displayName: "V Windows Build"
- job: OSXBuild
pool:
vmImage: 'macOS-10.13'
displayName: "V MacOSX Build"
steps:
- script: |
brew install glfw freetype curl
displayName: 'Install Dependencies'
- script: |
make && make test
displayName: 'Build V'
trigger:
branches:
include:
- '*'
pr:
autoCancel: false
branches:
include:
- '*'

55
cmd/tools/bench/wyhash.v Normal file
View File

@@ -0,0 +1,55 @@
module main
import hash.fnv1a
import hash as wyhash
import rand
import benchmark
fn main() {
rand.seed([u32(42), 0])
sample_size := 10000000
min_str_len := 20
max_str_len := 40
println('Generating $sample_size strings between $min_str_len - $max_str_len chars long...')
mut checksum := u64(0)
mut start_pos := 0
mut bgenerating := benchmark.start()
mut bytepile := []byte{}
for _ in 0 .. sample_size * max_str_len {
bytepile << byte(rand.int_in_range(40, 125))
}
mut str_lens := []int{}
for _ in 0 .. sample_size {
str_lens << rand.int_in_range(min_str_len, max_str_len)
}
bgenerating.measure('generating strings')
println('Hashing each of the generated strings...')
//
mut bhashing_1 := benchmark.start()
start_pos = 0
checksum = 0
for len in str_lens {
end_pos := start_pos + len
checksum ^= wyhash.wyhash_c(unsafe { bytepile.data + start_pos }, u64(len), 1)
start_pos = end_pos
}
bhashing_1.measure('wyhash.wyhash_c | checksum: ${checksum:22}')
mut bhashing_2 := benchmark.start()
start_pos = 0
checksum = 0
for len in str_lens {
end_pos := start_pos + len
checksum ^= wyhash.sum64(bytepile[start_pos..end_pos], 1)
start_pos = end_pos
}
bhashing_2.measure('wyhash.sum64 | checksum: ${checksum:22}')
mut bhashing_3 := benchmark.start()
start_pos = 0
checksum = 0
for len in str_lens {
end_pos := start_pos + len
checksum ^= fnv1a.sum64(bytepile[start_pos..end_pos])
start_pos = end_pos
}
bhashing_3.measure('fnv1a.sum64 | checksum: ${checksum:22}')
}

271
cmd/tools/check-md.v Normal file
View File

@@ -0,0 +1,271 @@
module main
import os
import rand
import term
import v.pref
const (
too_long_line_length = 100
term_colors = term.can_show_color_on_stderr()
)
fn main() {
files_paths := if '-all' in os.args { md_file_paths() } else { os.args[1..] }
mut warnings := 0
mut errors := 0
mut oks := 0
mut all_md_files := []MDFile{}
for file_path in files_paths {
real_path := os.real_path(file_path)
lines := os.read_lines(real_path) or {
println('"$file_path" does not exist')
warnings++
continue
}
mut mdfile := MDFile{
path: file_path
}
for i, line in lines {
if line.len > too_long_line_length {
if mdfile.state == .vexample {
println(wline(file_path, i, line.len, 'long V example line'))
warnings++
} else if mdfile.state == .codeblock {
println(wline(file_path, i, line.len, 'long code block line'))
warnings++
} else if line.starts_with('|') {
println(wline(file_path, i, line.len, 'long table'))
warnings++
} else if line.contains('https') {
println(wline(file_path, i, line.len, 'long link'))
warnings++
} else {
eprintln(eline(file_path, i, line.len, 'line too long'))
errors++
}
}
mdfile.parse_line(i, line)
}
all_md_files << mdfile
}
for mut mdfile in all_md_files {
new_errors, new_oks := mdfile.check_examples()
errors += new_errors
oks += new_oks
}
// println('all_md_files: $all_md_files')
if warnings > 0 || errors > 0 || oks > 0 {
println('\nWarnings: $warnings | Errors: $errors | OKs: $oks')
}
if errors > 0 {
exit(1)
}
}
fn md_file_paths() []string {
mut files_to_check := []string{}
md_files := os.walk_ext('.', '.md')
for file in md_files {
if file.starts_with('./thirdparty') {
continue
}
files_to_check << file
}
return files_to_check
}
fn ftext(s string, cb fn (string) string) string {
if term_colors {
return cb(s)
}
return s
}
fn btext(s string) string {
return ftext(s, term.bold)
}
fn mtext(s string) string {
return ftext(s, term.magenta)
}
fn rtext(s string) string {
return ftext(s, term.red)
}
fn wline(file_path string, lnumber int, column int, message string) string {
return btext('$file_path:${lnumber + 1}:${column + 1}:') + btext(mtext(' warn:')) + rtext(' $message')
}
fn eline(file_path string, lnumber int, column int, message string) string {
return btext('$file_path:${lnumber + 1}:${column + 1}:') + btext(rtext(' error: $message'))
}
//
const (
default_command = 'compile'
)
struct VCodeExample {
mut:
text []string
command string
sline int
eline int
}
enum MDFileParserState {
markdown
vexample
codeblock
}
struct MDFile {
path string
mut:
examples []VCodeExample
current VCodeExample
state MDFileParserState = .markdown
}
fn (mut f MDFile) parse_line(lnumber int, line string) {
if line.starts_with('```v') {
if f.state == .markdown {
f.state = .vexample
mut command := line.replace('```v', '').trim_space()
if command == '' {
command = default_command
}
f.current = VCodeExample{
sline: lnumber
command: command
}
}
return
}
if line.starts_with('```') {
match f.state {
.vexample {
f.state = .markdown
f.current.eline = lnumber
f.examples << f.current
f.current = VCodeExample{}
return
}
.codeblock {
f.state = .markdown
return
}
.markdown {
f.state = .codeblock
return
}
}
}
if f.state == .vexample {
f.current.text << line
}
}
fn (mut f MDFile) dump() {
for e in f.examples {
eprintln('f.path: $f.path | example: $e')
}
}
fn (mut f MDFile) check_examples() (int, int) {
mut errors := 0
mut oks := 0
vexe := pref.vexe_path()
for e in f.examples {
if e.command == 'ignore' {
continue
}
if e.command == 'wip' {
continue
}
fname := os.base(f.path).replace('.md', '_md')
uid := rand.ulid()
vfile := os.join_path(os.temp_dir(), 'check_${fname}_example_${e.sline}__${e.eline}__${uid}.v')
mut should_cleanup_vfile := true
// eprintln('>>> checking example $vfile ...')
vcontent := e.text.join('\n')
os.write_file(vfile, vcontent) or {
panic(err)
}
mut acommands := e.command.split(' ')
for command in acommands {
match command {
'compile' {
res := os.system('"$vexe" -silent -o x.c $vfile')
os.rm('x.c') or { }
if res != 0 {
eprintln(eline(f.path, e.sline, 0, 'example failed to compile'))
eprintln(vcontent)
should_cleanup_vfile = false
errors++
continue
}
oks++
}
'live' {
res := os.system('"$vexe" -silent -live -o x.c $vfile')
if res != 0 {
eprintln(eline(f.path, e.sline, 0, 'example failed to compile with -live'))
eprintln(vcontent)
should_cleanup_vfile = false
errors++
continue
}
oks++
}
'failcompile' {
res := os.system('"$vexe" -silent -o x.c $vfile')
os.rm('x.c') or { }
if res == 0 {
eprintln(eline(f.path, e.sline, 0, '`failcompile` example compiled'))
eprintln(vcontent)
should_cleanup_vfile = false
errors++
continue
}
oks++
}
'oksyntax' {
res := os.system('"$vexe" -silent -check-syntax $vfile')
if res != 0 {
eprintln(eline(f.path, e.sline, 0, '`oksyntax` example with invalid syntax'))
eprintln(vcontent)
should_cleanup_vfile = false
errors++
continue
}
oks++
}
'badsyntax' {
res := os.system('"$vexe" -silent -check-syntax $vfile')
if res == 0 {
eprintln(eline(f.path, e.sline, 0, '`badsyntax` example can be parsed fine'))
eprintln(vcontent)
should_cleanup_vfile = false
errors++
continue
}
oks++
}
else {
eprintln(eline(f.path, e.sline, 0, 'unrecognized command: "$command", use one of: wip/ignore/compile/failcompile/oksyntax/badsyntax'))
should_cleanup_vfile = false
errors++
}
}
}
if should_cleanup_vfile {
os.rm(vfile) or {
panic(err)
}
}
}
return errors, oks
}

View File

@@ -0,0 +1,131 @@
module main
import os
import v.util
import v.pref
import v.builder
import v.ast
import term
const (
base_os = 'linux'
os_names = ['linux', 'macos', 'windows']
skip_modules = [
'builtin.bare',
'builtin.js',
'strconv',
'strconv.ftoa',
'hash',
'strings',
'crypto.rand',
'os.bare',
'os2',
'picohttpparser',
'picoev',
'szip',
'v.eval',
]
)
struct App {
diff_cmd string
is_verbose bool
modules []string
mut:
api_differences map[string]int
}
fn main() {
vexe := pref.vexe_path()
vroot := os.dir(vexe)
util.set_vroot_folder(vroot)
os.chdir(vroot)
cmd := util.find_working_diff_command() or {
''
}
mut app := App{
diff_cmd: cmd
is_verbose: os.getenv('VERBOSE').len > 0
modules: if os.args.len > 1 { os.args[1..] } else { all_vlib_modules() }
}
for mname in app.modules {
if !app.is_verbose {
eprintln('Checking module: $mname ...')
}
api_base := app.gen_api_for_module_in_os(mname, base_os)
for oname in os_names {
if oname == base_os {
continue
}
api_os := app.gen_api_for_module_in_os(mname, oname)
app.compare_api(api_base, api_os, mname, base_os, oname)
}
}
howmany := app.api_differences.len
eprintln('NB: please, do run `git clean -xf` after this tool, or at least `find thirdparty/ |grep .o$|xargs rm`')
eprintln('otherwise, `./v test-fixed` may show false positives, due to .o files compiled with a cross compiler.')
if howmany > 0 {
eprintln(term.header('Found $howmany modules with different APIs', '='))
for m in app.api_differences.keys() {
eprintln('Module: $m')
}
exit(1)
}
}
fn all_vlib_modules() []string {
mut vlib_v_files := os.walk_ext('vlib', '.v')
mut vmodulesmap := map[string]int{}
for f in vlib_v_files {
if f.contains('/tests/') || f.ends_with('_test.v') {
continue
}
vmodulename := os.dir(f).replace('/', '.').replace('vlib.', '')
if vmodulename in skip_modules {
continue
}
vmodulesmap[vmodulename] = vmodulesmap[vmodulename] + 1
}
mut modules := vmodulesmap.keys()
modules.sort()
return modules
}
fn (app App) gen_api_for_module_in_os(mod_name string, os_name string) string {
if app.is_verbose {
eprintln('Checking module: ${mod_name:-30} for OS: ${os_name:-10} ...')
}
mpath := os.join_path('vlib', mod_name.replace('.', '/'))
tmpname := '/tmp/${mod_name}_${os_name}.c'
prefs, _ := pref.parse_args(['-os', os_name, '-o', tmpname, '-shared', mpath])
mut b := builder.new_builder(prefs)
b.compile_c()
mut res := []string{}
for f in b.parsed_files {
for s in f.stmts {
if s is ast.FnDecl {
if s.is_pub {
fn_signature := s.stringify(b.table, mod_name)
fn_mod := s.modname()
if fn_mod == mod_name {
fline := '$fn_mod: $fn_signature'
res << fline
}
}
}
}
}
res.sort()
return res.join('\n')
}
fn (mut app App) compare_api(api_base string, api_os string, mod_name string, os_base string, os_target string) {
res := util.color_compare_strings(app.diff_cmd, api_base, api_os)
if res.len > 0 {
summary := 'Different APIs found for module: `$mod_name`, between OS base: `$os_base` and OS: `$os_target`'
eprintln(term.header(summary, '-'))
eprintln(res)
eprintln(term.h_divider('-'))
app.api_differences[mod_name] = 1
}
}

5
cmd/tools/fast/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
fast
index.html
table.html
v.c
v2

128
cmd/tools/fast/fast.v Normal file
View File

@@ -0,0 +1,128 @@
// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
import os
import time
fn main() {
exe := os.executable()
dir := os.dir(exe)
vdir := os.dir(os.dir(os.dir(dir)))
if !os.exists('$vdir/v') && !os.is_dir('$vdir/vlib') {
println('fast.html generator needs to be located in `v/cmd/tools/fast`')
}
println('fast.html generator\n')
// Fetch the last commit's hash
println('Fetching updates...')
ret := os.system('$vdir/v up')
if ret != 0 {
println('failed to update V')
return
}
mut commit_hash := exec('git rev-parse HEAD')
commit_hash = commit_hash[..8]
if os.exists('last_commit.txt') {
last_commit := os.read_file('last_commit.txt') ?
if last_commit.trim_space() == commit_hash.trim_space() {
println('No new commits to benchmark. Commit $commit_hash has already been processed.')
return
}
commit_hash = last_commit.trim_space()
}
if !os.exists('table.html') {
os.create('table.html') ?
}
mut table := os.read_file('table.html') ?
/*
// Do nothing if it's already been processed.
if table.contains(commit_hash) {
println('Commit $commit_hash has already been processed')
return
}
*/
last_commits := exec('git log --pretty=format:"%h" -n 50').split('\n')
// Fetch all unprocessed commits (commits after the last processed commit)
mut commits := []string{}
println('!last_commit="$commit_hash"')
for i, c in last_commits {
if c == commit_hash {
commits = last_commits[..i].reverse()
break
}
}
println(last_commits)
println('Commits to benchmark:')
println(commits)
for i, commit in commits {
message := exec('git log --pretty=format:"%s" -n1 $commit')
println('\n${i + 1}/$commits.len Benchmarking commit $commit "$message"')
// Build an optimized V
println('Checking out ${commit}...')
exec('git checkout $commit')
println(' Building vprod...')
exec('v -o $vdir/vprod -prod $vdir/cmd/v')
diff1 := measure('$vdir/vprod -cc clang -o v.c $vdir/cmd/v', 'v.c')
diff2 := measure('$vdir/vprod -cc clang -o v2 $vdir/cmd/v', 'v2')
diff3 := measure('$vdir/vprod -x64 $vdir/cmd/tools/1mil.v', 'x64 1mil')
diff4 := measure('$vdir/vprod -cc clang $vdir/examples/hello_world.v', 'hello.v')
// println('Building V took ${diff}ms')
commit_date := exec('git log -n1 --pretty="format:%at" $commit')
date := time.unix(commit_date.int())
mut out := os.create('table.html') ?
// Place the new row on top
table = '<tr>
<td>$date.format()</td>
<td><a target=_blank href="https://github.com/vlang/v/commit/$commit">$commit</a></td>
<td>$message</td>
<td>${diff1}ms</td>
<td>${diff2}ms</td>
<td>${diff3}ms</td>
<td>${diff4}ms</td>
</tr>\n' +
table.trim_space()
out.writeln(table)
out.close()
// Regenerate index.html
header := os.read_file('header.html') ?
footer := os.read_file('footer.html') ?
mut res := os.create('index.html') ?
res.writeln(header)
res.writeln(table)
res.writeln(footer)
res.close()
}
exec('git checkout master')
os.write_file('last_commit.txt', commits[commits.len - 1]) ?
}
fn exec(s string) string {
e := os.exec(s) or {
panic(err)
}
return e.output.trim_right('\r\n')
}
// returns milliseconds
fn measure(cmd string, description string) int {
println(' Measuring $description')
println(' Warming up...')
for _ in 0 .. 3 {
exec(cmd)
}
println(' Building...')
mut runs := []int{}
for r in 0 .. 5 {
println(' Sample ${r+1}/5')
sw := time.new_stopwatch({})
exec(cmd)
runs << int(sw.elapsed().milliseconds())
}
// discard lowest and highest time
runs.sort()
runs = runs[1..4]
mut sum := 0
for run in runs {
sum += run
}
return int(sum / 3)
}

View File

@@ -0,0 +1,67 @@
const delta = 20;
(function () {
var table = document.querySelector("table");
var isTbody = table.children[0].nodeName == "TBODY";
var trs = isTbody
? table.children[0].querySelectorAll("tr")
: table.querySelectorAll("tr");
trs.forEach(function (tr, idx) {
if (idx != 0 && idx + 1 < trs.length) {
var vc = 3, vv = 4, vf = 5, vh = 6;
var textContent = {
vc: tr.children[vc].textContent,
vv: tr.children[vv].textContent,
vf: tr.children[vf].textContent,
vh: tr.children[vh].textContent
};
var currentData = {
vc: int(textContent.vc.slice(0, -2)),
vv: int(textContent.vv.slice(0, -2)),
vf: int(textContent.vf.slice(0, -2)),
vh: int(textContent.vh.slice(0, -2))
};
var prevData = {
vc: int(trs[idx + 1].children[vc].textContent.slice(0, -2)),
vv: int(trs[idx + 1].children[vv].textContent.slice(0, -2)),
vf: int(trs[idx + 1].children[vf].textContent.slice(0, -2)),
vh: int(trs[idx + 1].children[vh].textContent.slice(0, -2))
};
var result = {
vc: currentData.vc - prevData.vc,
vv: currentData.vv - prevData.vv,
vf: currentData.vf - prevData.vf,
vh: currentData.vh - prevData.vh
};
if (Math.abs(result.vc) > delta)
tr.children[vc].appendChild(createElement(result.vc));
if (Math.abs(result.vv) > delta * 2)
tr.children[vv].appendChild(createElement(result.vv));
if (Math.abs(result.vf) > delta * 2)
tr.children[vf].appendChild(createElement(result.vf));
if (Math.abs(result.vh) > delta * 2)
tr.children[vh].appendChild(createElement(result.vh));
}
});
function int(src) {
return src - 0;
}
function getClassName(x) {
if (x == 0)
return "equal";
return x < 0 ? "plus" : "minus";
}
function createElement(result) {
var el = document.createElement("span");
var parsedResult = parseResult(result);
el.classList.add("diff");
el.classList.add(getClassName(result));
el.textContent = parsedResult;
return el;
}
function parseResult(x) {
if (x == 0)
return "0";
return x > 0 ? "+" + x : x;
}
})();

View File

@@ -0,0 +1,4 @@
</table>
<script src="main.js"></script>
</body>
</html>

View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Is V still fast?</title>
<style>
*, body {
font-family: Menlo, Monospace, 'Courier New';
}
table, td {
border-collapse: collapse;
border: 1px solid #dfdfdf;
}
td {
padding: 5px;
position: relative;
}
.diff {
border-radius: 2.5px;
color: #ffffff;
padding: 0 5px 0 5px;
position: absolute;
right: 5px;
}
.minus {
background-color: rgb(195, 74, 104);
}
.plus {
background-color: #8BC34A;
}
.equal {
background-color: rgb(113, 68, 172);
}
</style>
</head>
<body>
<h2>Is V still fast?</h2>
Monitoring compilation speed for each commit. <br><br>
Running on an AWS t2.micro instance (1 vCPU). <br><br>
Source code: <a target=blank href='https://github.com/vlang/v/blob/master/cmd/tools/fast/fast.v'>fast.v</a> <br><br>
<table>
<tr>
<td></td>
<td></td>
<td style='width:400px'></td>
<td style='width:120px'>v -o v.c</td>
<td style='width:120px'>v -o v</td>
<td style='width:130px'>v -x64 1mil.v</td>
<td style='width:120px'>v hello.v</td>
</tr>

18
cmd/tools/gen1m.v Normal file
View File

@@ -0,0 +1,18 @@
fn main() {
println('fn print(a int) {}')
// println('fn println(a string) {}')
for i in 0 .. 100000 {
println('
fn foo${i}() {
x := $i
mut a := 1
a += 2
print(a)
a = 0
a = 1
}
')
}
// println('fn main() {foo1()} ')
println('fn main() { println("1m DONE") } ')
}

379
cmd/tools/gen_vc.v Normal file
View File

@@ -0,0 +1,379 @@
module main
// This tool regenerates V's bootstrap .c files
// every time the V master branch is updated.
// if run with the --serve flag it will run in webhook
// server mode awaiting a request to http://host:port/genhook
// available command line flags:
// --work-dir gen_vc's working directory
// --purge force purge the local repositories
// --serve run in webhook server mode
// --port port for http server to listen on
// --log-to either 'file' or 'terminal'
// --log-file path to log file used when --log-to is 'file'
// --dry-run dont push anything to remote repo
// --force force update even if already up to date
import os
import log
import flag
import time
import vweb
import net.urllib
// git credentials
const (
git_username = os.getenv('GITUSER')
git_password = os.getenv('GITPASS')
)
// repository
const (
// git repo
git_repo_v = 'github.com/vlang/v'
git_repo_vc = 'github.com/vlang/vc'
// local repo directories
git_repo_dir_v = 'v'
git_repo_dir_vc = 'vc'
)
// gen_vc
const (
// name
app_name = 'gen_vc'
// version
app_version = '0.1.2'
// description
app_description = "This tool regenerates V\'s bootstrap .c files every time the V master branch is updated."
// assume something went wrong if file size less than this
too_short_file_limit = 5000
// create a .c file for these os's
vc_build_oses = [
'nix', // all nix based os
'windows',
]
)
// default options (overridden by flags)
const (
// gen_vc working directory
work_dir = '/tmp/gen_vc'
// dont push anything to remote repo
dry_run = false
// server port
server_port = 7171
// log file
log_file = '$work_dir/log.txt'
// log_to is either 'file' or 'terminal'
log_to = 'terminal'
)
// errors
const (
err_msg_build = 'error building'
err_msg_make = 'make failed'
err_msg_gen_c = 'failed to generate .c file'
err_msg_cmd_x = 'error running cmd'
)
struct GenVC {
// logger
// flag options
options FlagOptions
mut:
logger &log.Log
// true if error was experienced running generate
gen_error bool
}
// webhook server
struct WebhookServer {
pub mut:
vweb vweb.Context
gen_vc &GenVC
}
// storage for flag options
struct FlagOptions {
work_dir string
purge bool
serve bool
port int
log_to string
log_file string
dry_run bool
force bool
}
fn main() {
mut fp := flag.new_flag_parser(os.args.clone())
fp.application(app_name)
fp.version(app_version)
fp.description(app_description)
fp.skip_executable()
show_help := fp.bool('help', 0, false, 'Show this help screen\n')
flag_options := parse_flags(mut fp)
if show_help {
println(fp.usage())
exit(0)
}
fp.finalize() or {
eprintln(err)
println(fp.usage())
return
}
// webhook server mode
if flag_options.serve {
vweb.run<WebhookServer>(flag_options.port)
} else {
// cmd mode
mut gen_vc := new_gen_vc(flag_options)
gen_vc.init()
gen_vc.generate()
}
}
// new GenVC
fn new_gen_vc(flag_options FlagOptions) &GenVC {
mut logger := &log.Log{}
logger.set_level(.debug)
if flag_options.log_to == 'file' {
logger.set_full_logpath(flag_options.log_file)
}
return &GenVC{
options: flag_options
logger: logger
}
}
// WebhookServer init
pub fn (mut ws WebhookServer) init_once() {
mut fp := flag.new_flag_parser(os.args.clone())
flag_options := parse_flags(mut fp)
ws.gen_vc = new_gen_vc(flag_options)
ws.gen_vc.init()
// ws.gen_vc = new_gen_vc(flag_options)
}
pub fn (mut ws WebhookServer) init() {
// ws.init_once()
}
pub fn (mut ws WebhookServer) index() {
eprintln('WebhookServer.index() called')
}
// gen webhook
pub fn (mut ws WebhookServer) genhook() {
// request data
// println(ws.vweb.req.data)
// TODO: parse request. json or urlencoded
// json.decode or net.urllib.parse
ws.gen_vc.generate()
// error in generate
if ws.gen_vc.gen_error {
ws.vweb.json('{status: "failed"}')
return
}
ws.vweb.json('{status: "ok"}')
}
pub fn (ws &WebhookServer) reset() {
}
// parse flags to FlagOptions struct
fn parse_flags(mut fp flag.FlagParser) FlagOptions {
return FlagOptions{
serve: fp.bool('serve', 0, false, 'run in webhook server mode')
work_dir: fp.string('work-dir', 0, work_dir, 'gen_vc working directory')
purge: fp.bool('purge', 0, false, 'force purge the local repositories')
port: fp.int('port', 0, server_port, 'port for web server to listen on')
log_to: fp.string('log-to', 0, log_to, "log to is \'file\' or \'terminal\'")
log_file: fp.string('log-file', 0, log_file, "log file to use when log-to is \'file\'")
dry_run: fp.bool('dry-run', 0, dry_run, 'when specified dont push anything to remote repo')
force: fp.bool('force', 0, false, 'force update even if already up to date')
}
}
// init
fn (mut gen_vc GenVC) init() {
// purge repos if flag is passed
if gen_vc.options.purge {
gen_vc.purge_repos()
}
}
// regenerate
fn (mut gen_vc GenVC) generate() {
// set errors to false
gen_vc.gen_error = false
// check if gen_vc dir exists
if !os.is_dir(gen_vc.options.work_dir) {
// try create
os.mkdir(gen_vc.options.work_dir) or {
panic(err)
}
// still dosen't exist... we have a problem
if !os.is_dir(gen_vc.options.work_dir) {
gen_vc.logger.error('error creating directory: $gen_vc.options.work_dir')
gen_vc.gen_error = true
return
}
}
// cd to gen_vc dir
os.chdir(gen_vc.options.work_dir)
// if we are not running with the --serve flag (webhook server)
// rather than deleting and re-downloading the repo each time
// first check to see if the local v repo is behind master
// if it isn't behind theres no point continuing further
if !gen_vc.options.serve && os.is_dir(git_repo_dir_v) {
gen_vc.cmd_exec('git -C $git_repo_dir_v checkout master')
// fetch the remote repo just in case there are newer commits there
gen_vc.cmd_exec('git -C $git_repo_dir_v fetch')
git_status := gen_vc.cmd_exec('git -C $git_repo_dir_v status')
if !git_status.contains('behind') && !gen_vc.options.force {
gen_vc.logger.warn('v repository is already up to date.')
return
}
}
// delete repos
gen_vc.purge_repos()
// clone repos
gen_vc.cmd_exec('git clone --depth 1 https://$git_repo_v $git_repo_dir_v')
gen_vc.cmd_exec('git clone --depth 1 https://$git_repo_vc $git_repo_dir_vc')
// get output of git log -1 (last commit)
git_log_v := gen_vc.cmd_exec('git -C $git_repo_dir_v log -1 --format="commit %H%nDate: %ci%nDate Unix: %ct%nSubject: %s"')
git_log_vc := gen_vc.cmd_exec('git -C $git_repo_dir_vc log -1 --format="Commit %H%nDate: %ci%nDate Unix: %ct%nSubject: %s"')
// date of last commit in each repo
ts_v := git_log_v.find_between('Date:', '\n').trim_space()
ts_vc := git_log_vc.find_between('Date:', '\n').trim_space()
// parse time as string to time.Time
last_commit_time_v := time.parse(ts_v) or {
panic(err)
}
last_commit_time_vc := time.parse(ts_vc) or {
panic(err)
}
// git dates are in users local timezone and v time.parse does not parse
// timezones at the moment, so for now get unix timestamp from output also
t_unix_v := git_log_v.find_between('Date Unix:', '\n').trim_space().int()
t_unix_vc := git_log_vc.find_between('Date Unix:', '\n').trim_space().int()
// last commit hash in v repo
last_commit_hash_v := git_log_v.find_between('commit', '\n').trim_space()
last_commit_hash_v_short := last_commit_hash_v[..7]
// subject
last_commit_subject := git_log_v.find_between('Subject:', '\n').trim_space().replace('"',
'\\"')
// log some info
gen_vc.logger.debug('last commit time ($git_repo_v): ' + last_commit_time_v.format_ss())
gen_vc.logger.debug('last commit time ($git_repo_vc): ' + last_commit_time_vc.format_ss())
gen_vc.logger.debug('last commit hash ($git_repo_v): $last_commit_hash_v')
gen_vc.logger.debug('last commit subject ($git_repo_v): $last_commit_subject')
// if vc repo already has a newer commit than the v repo, assume it's up to date
if t_unix_vc >= t_unix_v && !gen_vc.options.force {
gen_vc.logger.warn('vc repository is already up to date.')
return
}
// try build v for current os (linux in this case)
gen_vc.cmd_exec('make -C $git_repo_dir_v')
v_exec := '$git_repo_dir_v/v'
// check if make was successful
gen_vc.assert_file_exists_and_is_not_too_short(v_exec, err_msg_make)
// build v.c for each os
for os_name in vc_build_oses {
vc_suffix := if os_name == 'nix' { '' } else { '_${os_name[..3]}' }
v_flags := if os_name == 'nix' { '-os cross' } else { '-os $os_name' }
c_file := 'v${vc_suffix}.c'
// try generate .c file
gen_vc.cmd_exec('$v_exec $v_flags -o $c_file $git_repo_dir_v/cmd/v')
// check if the c file seems ok
gen_vc.assert_file_exists_and_is_not_too_short(c_file, err_msg_gen_c)
// embed the latest v commit hash into the c file
gen_vc.cmd_exec('sed -i \'1s/^/#define V_COMMIT_HASH "$last_commit_hash_v_short"\\n/\' $c_file')
// move to vc repo
gen_vc.cmd_exec('mv $c_file $git_repo_dir_vc/$c_file')
// add new .c file to local vc repo
gen_vc.cmd_exec('git -C $git_repo_dir_vc add $c_file')
}
// check if the vc repo actually changed
git_status := gen_vc.cmd_exec('git -C $git_repo_dir_vc status')
if git_status.contains('nothing to commit') {
gen_vc.logger.error('no changes to vc repo: something went wrong.')
gen_vc.gen_error = true
}
// commit changes to local vc repo
gen_vc.cmd_exec_safe('git -C $git_repo_dir_vc commit -m "[v:master] $last_commit_hash_v_short - $last_commit_subject"')
// push changes to remote vc repo
gen_vc.cmd_exec_safe('git -C $git_repo_dir_vc push https://${urllib.query_escape(git_username)}:${urllib.query_escape(git_password)}@$git_repo_vc master')
}
// only execute when dry_run option is false, otherwise just log
fn (mut gen_vc GenVC) cmd_exec_safe(cmd string) string {
return gen_vc.command_execute(cmd, gen_vc.options.dry_run)
}
// always execute command
fn (mut gen_vc GenVC) cmd_exec(cmd string) string {
return gen_vc.command_execute(cmd, false)
}
// execute command
fn (mut gen_vc GenVC) command_execute(cmd string, dry bool) string {
// if dry is true then dont execute, just log
if dry {
return gen_vc.command_execute_dry(cmd)
}
gen_vc.logger.info('cmd: $cmd')
r := os.exec(cmd) or {
gen_vc.logger.error('$err_msg_cmd_x: "$cmd" could not start.')
gen_vc.logger.error(err)
// something went wrong, better start fresh next time
gen_vc.purge_repos()
gen_vc.gen_error = true
return ''
}
if r.exit_code != 0 {
gen_vc.logger.error('$err_msg_cmd_x: "$cmd" failed.')
gen_vc.logger.error(r.output)
// something went wrong, better start fresh next time
gen_vc.purge_repos()
gen_vc.gen_error = true
return ''
}
return r.output
}
// just log cmd, dont execute
fn (mut gen_vc GenVC) command_execute_dry(cmd string) string {
gen_vc.logger.info('cmd (dry): "$cmd"')
return ''
}
// delete repo directories
fn (mut gen_vc GenVC) purge_repos() {
// delete old repos (better to be fully explicit here, since these are destructive operations)
mut repo_dir := '$gen_vc.options.work_dir/$git_repo_dir_v'
if os.is_dir(repo_dir) {
gen_vc.logger.info('purging local repo: "$repo_dir"')
gen_vc.cmd_exec('rm -rf $repo_dir')
}
repo_dir = '$gen_vc.options.work_dir/$git_repo_dir_vc'
if os.is_dir(repo_dir) {
gen_vc.logger.info('purging local repo: "$repo_dir"')
gen_vc.cmd_exec('rm -rf $repo_dir')
}
}
// check if file size is too short
fn (mut gen_vc GenVC) assert_file_exists_and_is_not_too_short(f string, emsg string) {
if !os.exists(f) {
gen_vc.logger.error('$err_msg_build: $emsg .')
gen_vc.gen_error = true
return
}
fsize := os.file_size(f)
if fsize < too_short_file_limit {
gen_vc.logger.error('$err_msg_build: $f exists, but is too short: only $fsize bytes.')
gen_vc.gen_error = true
return
}
}

View File

@@ -0,0 +1,121 @@
module scripting
import os
import term
const (
term_colors = term.can_show_color_on_stdout()
)
pub fn set_verbose(on bool) {
// setting a global here would be the obvious solution,
// but V does not have globals normally.
if on {
os.setenv('VERBOSE', '1', true)
}
else {
os.unsetenv('VERBOSE')
}
}
pub fn cprintln(message string) {
mut omessage := message
omessage = if term_colors { term.green(omessage) } else { omessage }
println(omessage)
}
pub fn verbose_trace(label string, message string) {
if os.getenv('VERBOSE').len > 0 {
slabel := 'scripting.${label}'
cprintln('# ${slabel:-25s} : $message')
}
}
pub fn verbose_trace_exec_result(x os.Result) {
if os.getenv('VERBOSE').len > 0 {
cprintln('# cmd.exit_code : ${x.exit_code.str():-4s} cmd.output:')
cprintln('# ----------------------------------- #')
mut lnum := 1
lines := x.output.split_into_lines()
for line in lines {
cprintln('# ${lnum:3d}: $line')
lnum++
}
cprintln('# ----------------------------------- #')
}
}
pub fn chdir(path string) {
verbose_trace(@FN, 'cd $path')
os.chdir(path)
}
pub fn rmrf(path string) {
verbose_trace(@FN, 'rm -rf $path')
if os.exists(path) {
if os.is_dir(path) {
os.rmdir_all(path)
}else{
os.rm(path)
}
}
}
pub fn exec(cmd string) ?os.Result {
verbose_trace(@FN, cmd)
x := os.exec(cmd) or {
verbose_trace(@FN, '## failed.')
return error(err)
}
verbose_trace_exec_result(x)
return x
}
pub fn run(cmd string) string {
verbose_trace(@FN, cmd)
x := os.exec(cmd) or {
verbose_trace(@FN, '## failed.')
return ''
}
verbose_trace_exec_result(x)
if x.exit_code == 0 {
return x.output.trim_right('\r\n')
}
return ''
}
pub fn exit_0_status(cmd string) bool {
verbose_trace(@FN, cmd)
x := os.exec(cmd) or {
verbose_trace(@FN, '## failed.')
return false
}
verbose_trace_exec_result(x)
if x.exit_code == 0 {
return true
}
return false
}
pub fn tool_must_exist (toolcmd string) {
verbose_trace(@FN, toolcmd)
if exit_0_status('type $toolcmd') {
return
}
eprintln('Missing tool: $toolcmd')
eprintln('Please try again after you install it.')
exit(1)
}
pub fn used_tools_must_exist(tools []string) {
for t in tools {
tool_must_exist(t)
}
}
pub fn show_sizes_of_files(files []string) {
for f in files {
size := os.file_size(f)
println('${size:10d} $f')
}
}

View File

@@ -0,0 +1,398 @@
module testing
import os
import time
import term
import benchmark
import sync
import v.pref
import v.util.vtest
pub struct TestSession {
pub mut:
files []string
skip_files []string
vexe string
vroot string
vtmp_dir string
vargs string
failed bool
benchmark benchmark.Benchmark
rm_binaries bool = true
silent_mode bool
progress_mode bool
root_relative bool // used by CI runs, so that the output is stable everywhere
nmessages chan LogMessage // many publishers, single consumer/printer
nmessage_idx int // currently printed message index
nprint_ended chan int // read to block till printing ends, 1:1
}
enum MessageKind {
ok
fail
skip
sentinel
}
struct LogMessage {
message string
kind MessageKind
}
pub fn (mut ts TestSession) append_message(kind MessageKind, msg string) {
ts.nmessages <- LogMessage{
message: msg
kind: kind
}
}
pub fn (mut ts TestSession) print_messages() {
empty := term.header(' ', ' ')
mut print_msg_time := time.new_stopwatch({})
for {
// get a message from the channel of messages to be printed:
mut rmessage := <-ts.nmessages
if rmessage.kind == .sentinel {
// a sentinel for stopping the printing thread
if !ts.silent_mode && ts.progress_mode {
eprintln('')
}
ts.nprint_ended <- 0
return
}
ts.nmessage_idx++
msg := rmessage.message.replace_each([
'TMP1',
'${ts.nmessage_idx:1d}',
'TMP2',
'${ts.nmessage_idx:2d}',
'TMP3',
'${ts.nmessage_idx:3d}',
'TMP4',
'${ts.nmessage_idx:4d}',
])
is_ok := rmessage.kind == .ok
//
time_passed := print_msg_time.elapsed().seconds()
if time_passed > 10 && ts.silent_mode && is_ok {
// Even if OK tests are suppressed,
// show *at least* 1 result every 10 seconds,
// otherwise the CI can seem stuck ...
eprintln(msg)
print_msg_time.restart()
continue
}
if ts.progress_mode {
// progress mode, the last line is rewritten many times:
if is_ok && !ts.silent_mode {
print('\r$empty\r$msg')
} else {
// the last \n is needed, so SKIP/FAIL messages
// will not get overwritten by the OK ones
eprint('\r$empty\r$msg\n')
}
continue
}
if !ts.silent_mode || !is_ok {
// normal expanded mode, or failures in -silent mode
eprintln(msg)
continue
}
}
}
pub fn new_test_session(_vargs string) TestSession {
mut skip_files := []string{}
skip_files << '_non_existing_'
$if solaris {
skip_files << 'examples/gg/gg2.v'
skip_files << 'examples/pico/pico.v'
skip_files << 'examples/sokol/fonts.v'
skip_files << 'examples/sokol/drawing.v'
}
vargs := _vargs.replace('-progress', '').replace('-progress', '')
vexe := pref.vexe_path()
new_vtmp_dir := setup_new_vtmp_folder()
return TestSession{
vexe: vexe
vroot: os.dir(vexe)
skip_files: skip_files
vargs: vargs
vtmp_dir: new_vtmp_dir
silent_mode: _vargs.contains('-silent')
progress_mode: _vargs.contains('-progress')
}
}
pub fn (mut ts TestSession) init() {
ts.files.sort()
ts.benchmark = benchmark.new_benchmark_no_cstep()
}
pub fn (mut ts TestSession) test() {
// Ensure that .tmp.c files generated from compiling _test.v files,
// are easy to delete at the end, *without* affecting the existing ones.
current_wd := os.getwd()
if current_wd == os.wd_at_startup && current_wd == ts.vroot {
ts.root_relative = true
}
//
ts.init()
mut remaining_files := []string{}
for dot_relative_file in ts.files {
relative_file := dot_relative_file.replace('./', '')
file := os.real_path(relative_file)
$if windows {
if file.contains('sqlite') || file.contains('httpbin') {
continue
}
}
$if !macos {
if file.contains('customer') {
continue
}
}
$if msvc {
if file.contains('asm') {
continue
}
}
$if tinyc {
if file.contains('asm') {
continue
}
}
remaining_files << dot_relative_file
}
remaining_files = vtest.filter_vtest_only(remaining_files, {
fix_slashes: false
})
ts.files = remaining_files
ts.benchmark.set_total_expected_steps(remaining_files.len)
mut pool_of_test_runners := sync.new_pool_processor({
callback: worker_trunner
})
// for handling messages across threads
ts.nmessages = chan LogMessage{cap: 10000}
ts.nprint_ended = chan int{cap: 0}
ts.nmessage_idx = 0
go ts.print_messages()
pool_of_test_runners.set_shared_context(ts)
pool_of_test_runners.work_on_pointers(remaining_files.pointers())
ts.benchmark.stop()
ts.append_message(.sentinel, '') // send the sentinel
_ := <-ts.nprint_ended // wait for the stop of the printing thread
eprintln(term.h_divider('-'))
// cleanup generated .tmp.c files after successfull tests:
if ts.benchmark.nfail == 0 {
if ts.rm_binaries {
os.rmdir_all(ts.vtmp_dir)
}
}
}
fn worker_trunner(mut p sync.PoolProcessor, idx int, thread_id int) voidptr {
mut ts := &TestSession(p.get_shared_context())
tmpd := ts.vtmp_dir
show_stats := '-stats' in ts.vargs.split(' ')
// tls_bench is used to format the step messages/timings
mut tls_bench := &benchmark.Benchmark(p.get_thread_context(idx))
if isnil(tls_bench) {
tls_bench = benchmark.new_benchmark_pointer()
tls_bench.set_total_expected_steps(ts.benchmark.nexpected_steps)
p.set_thread_context(idx, tls_bench)
}
tls_bench.no_cstep = true
dot_relative_file := p.get_string_item(idx)
mut relative_file := dot_relative_file.replace('./', '')
if ts.root_relative {
relative_file = relative_file.replace(ts.vroot + os.path_separator, '')
}
file := os.real_path(relative_file)
// Ensure that the generated binaries will be stored in the temporary folder.
// Remove them after a test passes/fails.
fname := os.file_name(file)
generated_binary_fname := if os.user_os() == 'windows' { fname.replace('.v', '.exe') } else { fname.replace('.v',
'') }
generated_binary_fpath := os.join_path(tmpd, generated_binary_fname)
if os.exists(generated_binary_fpath) {
if ts.rm_binaries {
os.rm(generated_binary_fpath)
}
}
mut cmd_options := [ts.vargs]
if !ts.vargs.contains('fmt') {
cmd_options << ' -o "$generated_binary_fpath"'
}
cmd := '"$ts.vexe" ' + cmd_options.join(' ') + ' "$file"'
ts.benchmark.step()
tls_bench.step()
if relative_file.replace('\\', '/') in ts.skip_files {
ts.benchmark.skip()
tls_bench.skip()
ts.append_message(.skip, tls_bench.step_message_skip(relative_file))
return sync.no_result
}
if show_stats {
ts.append_message(.ok, term.h_divider('-'))
status := os.system(cmd)
if status == 0 {
ts.benchmark.ok()
tls_bench.ok()
} else {
ts.failed = true
ts.benchmark.fail()
tls_bench.fail()
return sync.no_result
}
} else {
r := os.exec(cmd) or {
ts.failed = true
ts.benchmark.fail()
tls_bench.fail()
ts.append_message(.fail, tls_bench.step_message_fail(relative_file))
return sync.no_result
}
if r.exit_code != 0 {
ts.failed = true
ts.benchmark.fail()
tls_bench.fail()
ts.append_message(.fail, tls_bench.step_message_fail('$relative_file\n$r.output\n'))
} else {
ts.benchmark.ok()
tls_bench.ok()
ts.append_message(.ok, tls_bench.step_message_ok(relative_file))
}
}
if os.exists(generated_binary_fpath) {
if ts.rm_binaries {
os.rm(generated_binary_fpath)
}
}
return sync.no_result
}
pub fn vlib_should_be_present(parent_dir string) {
vlib_dir := os.join_path(parent_dir, 'vlib')
if !os.is_dir(vlib_dir) {
eprintln('$vlib_dir is missing, it must be next to the V executable')
exit(1)
}
}
pub fn v_build_failing(zargs string, folder string) bool {
return v_build_failing_skipped(zargs, folder, [])
}
pub fn prepare_test_session(zargs string, folder string, oskipped []string, main_label string) TestSession {
vexe := pref.vexe_path()
parent_dir := os.dir(vexe)
vlib_should_be_present(parent_dir)
vargs := zargs.replace(vexe, '')
eheader(main_label)
if vargs.len > 0 {
eprintln('v compiler args: "$vargs"')
}
mut session := new_test_session(vargs)
files := os.walk_ext(os.join_path(parent_dir, folder), '.v')
mut mains := []string{}
mut skipped := oskipped
for f in files {
if !f.contains('modules') && !f.contains('preludes') {
// $if !linux {
// run pg example only on linux
if f.contains('/pg/') {
continue
}
// }
if f.contains('life_gg') || f.contains('/graph.v') || f.contains('rune.v') {
continue
}
$if windows {
// skip pico example on windows
if f.ends_with('examples\\pico\\pico.v') {
continue
}
}
c := os.read_file(f) or {
panic(err)
}
maxc := if c.len > 300 { 300 } else { c.len }
start := c[0..maxc]
if start.contains('module ') && !start.contains('module main') {
skipped_f := f.replace(os.join_path(parent_dir, ''), '')
skipped << skipped_f
}
mains << f
}
}
session.files << mains
session.skip_files << skipped
return session
}
pub fn v_build_failing_skipped(zargs string, folder string, oskipped []string) bool {
main_label := 'Building $folder ...'
finish_label := 'building $folder'
mut session := prepare_test_session(zargs, folder, oskipped, main_label)
session.test()
eprintln(session.benchmark.total_message(finish_label))
return session.failed
}
pub fn build_v_cmd_failed(cmd string) bool {
res := os.exec(cmd) or {
return true
}
if res.exit_code != 0 {
eprintln('')
eprintln(res.output)
return true
}
return false
}
pub fn building_any_v_binaries_failed() bool {
eheader('Building V binaries...')
eprintln('VFLAGS is: "' + os.getenv('VFLAGS') + '"')
vexe := pref.vexe_path()
parent_dir := os.dir(vexe)
vlib_should_be_present(parent_dir)
os.chdir(parent_dir)
mut failed := false
v_build_commands := ['$vexe -o v_g -g cmd/v', '$vexe -o v_prod_g -prod -g cmd/v',
'$vexe -o v_cg -cg cmd/v', '$vexe -o v_prod_cg -prod -cg cmd/v', '$vexe -o v_prod -prod cmd/v']
mut bmark := benchmark.new_benchmark()
for cmd in v_build_commands {
bmark.step()
if build_v_cmd_failed(cmd) {
bmark.fail()
failed = true
eprintln(bmark.step_message_fail('command: $cmd . See details above ^^^^^^^'))
eprintln('')
continue
}
bmark.ok()
eprintln(bmark.step_message_ok('command: $cmd'))
}
bmark.stop()
eprintln(term.h_divider('-'))
eprintln(bmark.total_message('building v binaries'))
return failed
}
pub fn eheader(msg string) {
eprintln(term.header(msg, '-'))
}
pub fn header(msg string) {
println(term.header(msg, '-'))
}
pub fn setup_new_vtmp_folder() string {
now := time.sys_mono_now()
new_vtmp_dir := os.join_path(os.temp_dir(), 'v', 'test_session_$now')
os.mkdir_all(new_vtmp_dir)
os.setenv('VTMP', new_vtmp_dir, true)
return new_vtmp_dir
}

View File

@@ -0,0 +1,176 @@
module vgit
import os
import flag
import scripting
const (
remote_v_repo_url = 'https://github.com/vlang/v'
remote_vc_repo_url = 'https://github.com/vlang/vc'
)
pub fn check_v_commit_timestamp_before_self_rebuilding(v_timestamp int) {
if v_timestamp >= 1561805697 {
return
}
eprintln('##################################################################')
eprintln('# WARNING: v self rebuilding, before 5b7a1e8 (2019-06-29 12:21) #')
eprintln('# required the v executable to be built *inside* #')
eprintln('# the toplevel compiler/ folder. #')
eprintln('# #')
eprintln('# That is not supported by this tool. #')
eprintln('# You will have to build it manually there. #')
eprintln('##################################################################')
}
pub fn validate_commit_exists(commit string) {
if commit.len == 0 {
return
}
cmd := "git cat-file -t \'$commit\' "
if !scripting.exit_0_status(cmd) {
eprintln('Commit: "$commit" does not exist in the current repository.')
exit(3)
}
}
pub fn line_to_timestamp_and_commit(line string) (int, string) {
parts := line.split(' ')
return parts[0].int(), parts[1]
}
pub fn normalized_workpath_for_commit(workdir string, commit string) string {
nc := 'v_at_' + commit.replace('^', '_').replace('-', '_').replace('/', '_')
return os.real_path(workdir + os.path_separator + nc)
}
pub fn prepare_vc_source(vcdir string, cdir string, commit string) (string, string) {
scripting.chdir(cdir)
// Building a historic v with the latest vc is not always possible ...
// It is more likely, that the vc *at the time of the v commit*,
// or slightly before that time will be able to build the historic v:
vline := scripting.run('git rev-list -n1 --timestamp "$commit" ')
v_timestamp, v_commithash := line_to_timestamp_and_commit(vline)
check_v_commit_timestamp_before_self_rebuilding(v_timestamp)
scripting.chdir(vcdir)
scripting.run('git checkout master')
vcbefore := scripting.run('git rev-list HEAD -n1 --timestamp --before=$v_timestamp ')
_, vccommit_before := line_to_timestamp_and_commit(vcbefore)
scripting.run('git checkout "$vccommit_before" ')
scripting.run('wc *.c')
scripting.chdir(cdir)
return v_commithash, vccommit_before
}
pub fn clone_or_pull(remote_git_url string, local_worktree_path string) {
// NB: after clone_or_pull, the current repo branch is === HEAD === master
if os.is_dir(local_worktree_path) && os.is_dir(os.join_path(local_worktree_path, '.git')) {
// Already existing ... Just pulling in this case is faster usually.
scripting.run('git -C "$local_worktree_path" checkout --quiet master')
scripting.run('git -C "$local_worktree_path" pull --quiet ')
} else {
// Clone a fresh
scripting.run('git clone --quiet "$remote_git_url" "$local_worktree_path" ')
}
}
pub struct VGitContext {
pub:
cc string = 'cc' // what compiler to use
workdir string = '/tmp' // the base working folder
commit_v string = 'master' // the commit-ish that needs to be prepared
path_v string // where is the local working copy v repo
path_vc string // where is the local working copy vc repo
v_repo_url string // the remote v repo URL
vc_repo_url string // the remote vc repo URL
pub mut:
// these will be filled by vgitcontext.compile_oldv_if_needed()
commit_v__hash string // the git commit of the v repo that should be prepared
commit_vc_hash string // the git commit of the vc repo, corresponding to commit_v__hash
vexename string // v or v.exe
vexepath string // the full absolute path to the prepared v/v.exe
vvlocation string // v.v or compiler/ or cmd/v, depending on v version
}
pub fn (mut vgit_context VGitContext) compile_oldv_if_needed() {
vgit_context.vexename = if os.user_os() == 'windows' { 'v.exe' } else { 'v' }
vgit_context.vexepath = os.real_path(os.join_path(vgit_context.path_v, vgit_context.vexename))
mut command_for_building_v_from_c_source := ''
mut command_for_selfbuilding := ''
if 'windows' == os.user_os() {
command_for_building_v_from_c_source = '$vgit_context.cc -std=c99 -municode -w -o cv.exe "$vgit_context.path_vc/v_win.c" '
command_for_selfbuilding = './cv.exe -o $vgit_context.vexename {SOURCE}'
} else {
command_for_building_v_from_c_source = '$vgit_context.cc -std=gnu11 -w -o cv "$vgit_context.path_vc/v.c" -lm -lpthread'
command_for_selfbuilding = './cv -o $vgit_context.vexename {SOURCE}'
}
scripting.chdir(vgit_context.workdir)
clone_or_pull(vgit_context.v_repo_url, vgit_context.path_v)
clone_or_pull(vgit_context.vc_repo_url, vgit_context.path_vc)
scripting.chdir(vgit_context.path_v)
scripting.run('git checkout $vgit_context.commit_v')
v_commithash, vccommit_before := prepare_vc_source(vgit_context.path_vc, vgit_context.path_v,
vgit_context.commit_v)
vgit_context.commit_v__hash = v_commithash
vgit_context.commit_vc_hash = vccommit_before
if os.exists('cmd/v') {
vgit_context.vvlocation = 'cmd/v'
} else {
vgit_context.vvlocation = if os.exists('v.v') { 'v.v' } else { 'compiler' }
}
if os.is_dir(vgit_context.path_v) && os.exists(vgit_context.vexepath) {
// already compiled, so no need to compile v again
return
}
// Recompilation is needed. Just to be sure, clean up everything first.
scripting.run('git clean -xf')
scripting.run(command_for_building_v_from_c_source)
build_cmd := command_for_selfbuilding.replace('{SOURCE}', vgit_context.vvlocation)
scripting.run(build_cmd)
// At this point, there exists a file vgit_context.vexepath
// which should be a valid working V executable.
}
pub struct VGitOptions {
pub mut:
workdir string // the working folder (typically /tmp), where the tool will write
v_repo_url string // the url of the V repository. It can be a local folder path, if you want to eliminate network operations...
vc_repo_url string // the url of the vc repository. It can be a local folder path, if you want to eliminate network operations...
show_help bool // whether to show the usage screen
verbose bool // should the tool be much more verbose
}
pub fn add_common_tool_options(mut context VGitOptions, mut fp flag.FlagParser) []string {
tdir := os.temp_dir()
context.workdir = os.real_path(fp.string('workdir', `w`, tdir, 'A writable base folder. Default: $tdir'))
context.v_repo_url = fp.string('vrepo', 0, remote_v_repo_url, 'The url of the V repository. You can clone it locally too. See also --vcrepo below.')
context.vc_repo_url = fp.string('vcrepo', 0, remote_vc_repo_url, 'The url of the vc repository. You can clone it
${flag.space}beforehand, and then just give the local folder
${flag.space}path here. That will eliminate the network ops
${flag.space}done by this tool, which is useful, if you want
${flag.space}to script it/run it in a restrictive vps/docker.
')
context.show_help = fp.bool('help', `h`, false, 'Show this help screen.')
context.verbose = fp.bool('verbose', `v`, false, 'Be more verbose.')
if context.show_help {
println(fp.usage())
exit(0)
}
if context.verbose {
scripting.set_verbose(true)
}
if os.is_dir(context.v_repo_url) {
context.v_repo_url = os.real_path(context.v_repo_url)
}
if os.is_dir(context.vc_repo_url) {
context.vc_repo_url = os.real_path(context.vc_repo_url)
}
commits := fp.finalize() or {
eprintln('Error: ' + err)
exit(1)
}
for commit in commits {
validate_commit_exists(commit)
}
return commits
}

View File

@@ -0,0 +1,15 @@
module vhelp
import os
pub fn show_topic(topic string) {
vexe := os.real_path(os.getenv('VEXE'))
vroot := os.dir(vexe)
target_topic := os.join_path(vroot, 'cmd', 'v', 'help', '${topic}.txt')
content := os.read_file(target_topic) or {
eprintln('Unknown topic: $topic')
exit(1)
}
println(content)
}

110
cmd/tools/oldv.v Normal file
View File

@@ -0,0 +1,110 @@
import os
import flag
import scripting
import vgit
const (
tool_version = '0.0.3'
tool_description = ' Checkout an old V and compile it as it was on specific commit.
| This tool is useful, when you want to discover when something broke.
| It is also useful, when you just want to experiment with an older historic V.
|
| The VCOMMIT argument can be a git commitish like HEAD or master and so on.
| When oldv is used with git bisect, you probably want to give HEAD. For example:
| git bisect start
| git bisect bad
| git checkout known_good_commit
| git bisect good
| ## Now git will automatically checkout a middle commit between the bad and the good
| cmd/tools/oldv HEAD --command="run commands in oldv folder, to verify if the commit is good or bad"
| ## See what the result is, and either do: ...
| git bisect good
| ## ... or do:
| git bisect bad
| ## Now you just repeat the above steps, each time running oldv with the same command, then mark the result as good or bad,
| ## until you find the commit, where the problem first occurred.
| ## When you finish, do not forget to do:
| git bisect reset'.strip_margin()
)
struct Context {
mut:
vgo vgit.VGitOptions
commit_v string = 'master'
// the commit from which you want to produce a working v compiler (this may be a commit-ish too)
commit_vc string = 'master'
// this will be derived from commit_v
commit_v_hash string // this will be filled from the commit-ish commit_v using rev-list. It IS a commit hash.
path_v string // the full path to the v folder inside workdir.
path_vc string // the full path to the vc folder inside workdir.
cmd_to_run string // the command that you want to run *in* the oldv repo
cc string = 'cc'
// the C compiler to use for bootstrapping.
cleanup bool // should the tool run a cleanup first
}
fn (mut c Context) compile_oldv_if_needed() {
mut vgit_context := vgit.VGitContext{
workdir: c.vgo.workdir
v_repo_url: c.vgo.v_repo_url
vc_repo_url: c.vgo.vc_repo_url
cc: c.cc
commit_v: c.commit_v
path_v: c.path_v
path_vc: c.path_vc
}
vgit_context.compile_oldv_if_needed()
c.commit_v_hash = vgit_context.commit_v__hash
if !os.exists(vgit_context.vexepath) && c.cmd_to_run.len > 0 {
// NB: 125 is a special code, that git bisect understands as 'skip this commit'.
// it is used to inform git bisect that the current commit leads to a build failure.
exit(125)
}
}
fn main() {
scripting.used_tools_must_exist(['git', 'cc'])
mut context := Context{}
mut fp := flag.new_flag_parser(os.args)
fp.application(os.file_name(os.executable()))
fp.version(tool_version)
fp.description(tool_description)
fp.arguments_description('VCOMMIT')
fp.skip_executable()
fp.limit_free_args(1, 1)
context.cleanup = fp.bool('clean', 0, true, 'Clean before running (slower).')
context.cmd_to_run = fp.string('command', `c`, '', 'Command to run in the old V repo.\n')
commits := vgit.add_common_tool_options(mut context.vgo, mut fp)
if commits.len > 0 {
context.commit_v = commits[0]
} else {
context.commit_v = scripting.run('git rev-list -n1 HEAD')
}
scripting.cprintln('################# context.commit_v: $context.commit_v #####################')
context.path_v = vgit.normalized_workpath_for_commit(context.vgo.workdir, context.commit_v)
context.path_vc = vgit.normalized_workpath_for_commit(context.vgo.workdir, 'vc')
if !os.is_dir(context.vgo.workdir) {
eprintln('Work folder: $context.vgo.workdir , does not exist.')
exit(2)
}
ecc := os.getenv('CC')
if ecc != '' {
context.cc = ecc
}
if context.cleanup {
scripting.rmrf(context.path_v)
scripting.rmrf(context.path_vc)
}
context.compile_oldv_if_needed()
scripting.chdir(context.path_v)
scripting.cprintln('# v commit hash: $context.commit_v_hash')
scripting.cprintln('# checkout folder: $context.path_v')
if context.cmd_to_run.len > 0 {
cmdres := os.exec(context.cmd_to_run) or {
panic(err)
}
scripting.cprintln('# command: ${context.cmd_to_run:-34s} exit code: ${cmdres.exit_code:-4d} result:')
println(cmdres.output)
exit(cmdres.exit_code)
}
}

View File

@@ -0,0 +1,194 @@
import os
import flag
import scripting
import vgit
const (
tool_version = '0.0.5'
tool_description = " Compares V executable size and performance,
| between 2 commits from V\'s local git history.
| When only one commit is given, it is compared to master.
| ".strip_margin()
)
struct Context {
cwd string // current working folder
mut:
vgo vgit.VGitOptions
a string // the full path to the 'after' folder inside workdir
b string // the full path to the 'before' folder inside workdir
vc string // the full path to the vc folder inside workdir. It is used during bootstrapping v from the C source.
commit_before string // the git commit for the 'before' state
commit_after string // the git commit for the 'after' state
warmups int // how many times to execute a command before gathering stats
hyperfineopts string // use for additional CLI options that will be given to the hyperfine command
vflags string // other v options to pass to compared v commands
}
fn new_context() Context {
return Context{
cwd: os.getwd()
commit_after: 'master'
warmups: 4
}
}
fn (c Context) compare_versions() {
// Input is validated at this point...
// Cleanup artifacts from previous runs of this tool:
scripting.chdir(c.vgo.workdir)
scripting.run('rm -rf "$c.a" "$c.b" "$c.vc" ')
// clone the VC source *just once per comparison*, and reuse it:
scripting.run('git clone --quiet "$c.vgo.vc_repo_url" "$c.vc" ')
println('Comparing V performance of commit $c.commit_before (before) vs commit $c.commit_after (after) ...')
c.prepare_v(c.b, c.commit_before)
c.prepare_v(c.a, c.commit_after)
scripting.chdir(c.vgo.workdir)
if c.vflags.len > 0 {
os.setenv('VFLAGS', c.vflags, true)
}
// The first is the baseline, against which all the others will be compared.
// It is the fastest, since hello_world.v has only a single println in it,
mut perf_files := []string{}
perf_files <<
c.compare_v_performance('source_hello', ['vprod @DEBUG@ -o source.c examples/hello_world.v', 'vprod -o source.c examples/hello_world.v', 'v @DEBUG@ -o source.c examples/hello_world.v', 'v -o source.c examples/hello_world.v'])
perf_files <<
c.compare_v_performance('source_v', ['vprod @DEBUG@ -o source.c @COMPILER@', 'vprod -o source.c @COMPILER@', 'v @DEBUG@ -o source.c @COMPILER@', 'v -o source.c @COMPILER@'])
perf_files <<
c.compare_v_performance('binary_hello', ['vprod -o hello examples/hello_world.v', 'v -o hello examples/hello_world.v'])
perf_files <<
c.compare_v_performance('binary_v', ['vprod -o binary @COMPILER@', 'v -o binary @COMPILER@'])
println('All performance files:')
for f in perf_files {
println(' $f')
}
}
fn (c &Context) prepare_v(cdir string, commit string) {
mut cc := os.getenv('CC')
if cc == '' {
cc = 'cc'
}
mut vgit_context := vgit.VGitContext{
cc: cc
commit_v: commit
path_v: cdir
path_vc: c.vc
workdir: c.vgo.workdir
v_repo_url: c.vgo.v_repo_url
vc_repo_url: c.vgo.vc_repo_url
}
vgit_context.compile_oldv_if_needed()
scripting.chdir(cdir)
println('Making a v compiler in $cdir')
scripting.run('./v -cc $cc -o v $vgit_context.vvlocation')
println('Making a vprod compiler in $cdir')
scripting.run('./v -cc $cc -prod -o vprod $vgit_context.vvlocation')
println('Stripping and compressing cv v and vprod binaries in $cdir')
scripting.run('cp cv cv_stripped')
scripting.run('cp v v_stripped')
scripting.run('cp vprod vprod_stripped')
scripting.run('strip *_stripped')
scripting.run('cp cv_stripped cv_stripped_upxed')
scripting.run('cp v_stripped v_stripped_upxed')
scripting.run('cp vprod_stripped vprod_stripped_upxed')
scripting.run('upx -qqq --lzma cv_stripped_upxed')
scripting.run('upx -qqq --lzma v_stripped_upxed')
scripting.run('upx -qqq --lzma vprod_stripped_upxed')
scripting.show_sizes_of_files(['$cdir/cv', '$cdir/cv_stripped', '$cdir/cv_stripped_upxed'])
scripting.show_sizes_of_files(['$cdir/v', '$cdir/v_stripped', '$cdir/v_stripped_upxed'])
scripting.show_sizes_of_files(['$cdir/vprod', '$cdir/vprod_stripped', '$cdir/vprod_stripped_upxed'])
vversion := scripting.run('$cdir/v -version')
vcommit := scripting.run('git rev-parse --short --verify HEAD')
println('V version is: $vversion , local source commit: $vcommit')
if vgit_context.vvlocation == 'cmd/v' {
if os.exists('vlib/v/ast/ast.v') {
println('Source lines of the compiler: ' +
scripting.run('find cmd/v/ vlib/v/ -name "*.v" | grep -v /tests/ | xargs wc | tail -n -1'))
} else {
println('Source lines of the compiler: ' +
scripting.run('wc cmd/v/*.v vlib/compiler/*.v | tail -n -1'))
}
} else if vgit_context.vvlocation == 'v.v' {
println('Source lines of the compiler: ' + scripting.run('wc v.v vlib/compiler/*.v | tail -n -1'))
} else {
println('Source lines of the compiler: ' + scripting.run('wc compiler/*.v | tail -n -1'))
}
}
fn (c Context) compare_v_performance(label string, commands []string) string {
println('---------------------------------------------------------------------------------')
println('Compare v performance when doing the following commands ($label):')
mut source_location_a := ''
mut source_location_b := ''
if os.exists('$c.a/cmd/v') {
source_location_a = 'cmd/v'
} else {
source_location_a = if os.exists('$c.a/v.v') { 'v.v ' } else { 'compiler/ ' }
}
if os.exists('$c.b/cmd/v') {
source_location_b = 'cmd/v'
} else {
source_location_b = if os.exists('$c.b/v.v') { 'v.v ' } else { 'compiler/ ' }
}
timestamp_a, _ := vgit.line_to_timestamp_and_commit(scripting.run('cd $c.a/ ; git rev-list -n1 --timestamp HEAD'))
timestamp_b, _ := vgit.line_to_timestamp_and_commit(scripting.run('cd $c.b/ ; git rev-list -n1 --timestamp HEAD'))
debug_option_a := if timestamp_a > 1570877641 { '-cg ' } else { '-debug ' }
debug_option_b := if timestamp_b > 1570877641 { '-cg ' } else { '-debug ' }
mut hyperfine_commands_arguments := []string{}
for cmd in commands {
println(cmd)
}
for cmd in commands {
hyperfine_commands_arguments <<
" \'cd ${c.b:-34s} ; ./$cmd \' ".replace_each(['@COMPILER@', source_location_b, '@DEBUG@', debug_option_b])
}
for cmd in commands {
hyperfine_commands_arguments <<
" \'cd ${c.a:-34s} ; ./$cmd \' ".replace_each(['@COMPILER@', source_location_a, '@DEBUG@', debug_option_a])
}
// /////////////////////////////////////////////////////////////////////////////
cmd_stats_file := os.real_path([c.vgo.workdir, 'v_performance_stats_${label}.json'].join(os.path_separator))
comparison_cmd := 'hyperfine $c.hyperfineopts ' + '--export-json $cmd_stats_file ' + '--time-unit millisecond ' +
'--style full --warmup $c.warmups ' + hyperfine_commands_arguments.join(' ')
// /////////////////////////////////////////////////////////////////////////////
if c.vgo.verbose {
println(comparison_cmd)
}
os.system(comparison_cmd)
println('The detailed performance comparison report was saved to: $cmd_stats_file .')
println('')
return cmd_stats_file
}
fn main() {
scripting.used_tools_must_exist(['cp', 'rm', 'strip', 'make', 'git', 'upx', 'cc', 'wc', 'tail',
'find', 'xargs', 'hyperfine'])
mut context := new_context()
mut fp := flag.new_flag_parser(os.args)
fp.application(os.file_name(os.executable()))
fp.version(tool_version)
fp.description(tool_description)
fp.arguments_description('COMMIT_BEFORE [COMMIT_AFTER]')
fp.skip_executable()
fp.limit_free_args(1, 2)
context.vflags = fp.string('vflags', 0, '', 'Additional options to pass to the v commands, for example "-cc tcc"')
context.hyperfineopts = fp.string('hyperfine_options', 0, '', 'Additional options passed to hyperfine.
${flag.space}For example on linux, you may want to pass:
$flag.space--hyperfine_options "--prepare \'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches\'"
')
commits := vgit.add_common_tool_options(mut context.vgo, mut fp)
context.commit_before = commits[0]
if commits.len > 1 {
context.commit_after = commits[1]
}
context.b = vgit.normalized_workpath_for_commit(context.vgo.workdir, context.commit_before)
context.a = vgit.normalized_workpath_for_commit(context.vgo.workdir, context.commit_after)
context.vc = vgit.normalized_workpath_for_commit(context.vgo.workdir, 'vc')
if !os.is_dir(context.vgo.workdir) {
msg := 'Work folder: ' + context.vgo.workdir + ' , does not exist.'
eprintln(msg)
exit(2)
}
context.compare_versions()
}

View File

@@ -0,0 +1,28 @@
# V preludes:
The cmd/tools/preludes/ contains small v code snippets, that V uses when
compiling certain v programs. V adds the files below automatically itself.
Each file is used in different situations (see below).
NB: preludes are *NOT* intended to be used by user programs/modules.
The folder cmd/tools/preludes/ is *NOT* a v module.
## Details:
### cmd/tools/preludes/live_main.v
Used when compiling live programs. This file is used by the main executable
live program, that starts the file change monitoring thread. Each live program
needs module `os` and module `time`, in order for the background file change
monitoring thread to work properly.
### cmd/tools/preludes/live_shared.v
Used when compiling live programs, for the shared library portion of the live
programs, that is reloaded each time the code is changed.
### cmd/tools/preludes/tests_assertions.v
Used when compiling `_test.v` programs.
It specifies how failed assertions will look.
### cmd/tools/preludes/tests_with_stats.v
Used when compiling `_test.v` programs with -stats option.
It specifies how the result will appear ('assert' vs 'asserts' and so on).

View File

@@ -0,0 +1,9 @@
module main
// This prelude is loaded in every v program compiled with -live,
// in both the main executable, and in the shared library.
import live
const (
no_warning_live_is_used = live.is_used
)

View File

@@ -0,0 +1,9 @@
module main
// This prelude is loaded in every v program compiled with -live,
// but only for the main executable.
import live.executable
const (
no_warning_live_executable_is_used = executable.is_used
)

View File

@@ -0,0 +1,9 @@
module main
// This prelude is loaded in every v program compiled with -live,
// but only for the shared library.
import live.sharedlib
const (
no_warning_live_shared_is_used = sharedlib.is_used
)

View File

@@ -0,0 +1,7 @@
module main
import time
const (
profiled_program_time_used = time.seconds_per_minute
)

View File

@@ -0,0 +1,44 @@
module main
import os
import term
// //////////////////////////////////////////////////////////////////
// / This file will get compiled as part of the main program,
// / for a _test.v file.
// / The methods defined here are called back by the test program's
// / assert statements, on each success/fail. The goal is to make
// / customizing the look & feel of the assertions results easier,
// / since it is done in normal V code, instead of in embedded C ...
// //////////////////////////////////////////////////////////////////
// TODO copy pasta builtin.v fn ___print_assert_failure
fn cb_assertion_failed(i &VAssertMetaInfo) {
use_color := term.can_show_color_on_stderr()
use_relative_paths := match os.getenv('VERROR_PATHS') {
'absolute' { false }
else { true }
}
final_filename := if use_relative_paths { i.fpath } else { os.real_path(i.fpath) }
final_funcname := i.fn_name.replace('main.', '').replace('__', '.')
final_src := if use_color { term.bold(i.src) } else { i.src }
eprintln('')
eprintln('$final_filename:${i.line_nr+1}: failed assert in function $final_funcname')
eprintln('Source : `$final_src`')
if i.op.len > 0 && i.op != 'call' {
mut slvalue := '$i.lvalue'
mut srvalue := '$i.rvalue'
lpostfix := if slvalue == i.llabel { '.' } else { '<= `$i.llabel`' }
rpostfix := if srvalue == i.rlabel { '.' } else { '<= `$i.rlabel`' }
if use_color {
slvalue = term.bold(term.yellow(slvalue))
srvalue = term.bold(term.yellow(srvalue))
}
eprintln(' left value: $slvalue $lpostfix')
eprintln(' right value: $srvalue $rpostfix')
}
}
fn cb_assertion_ok(i &VAssertMetaInfo) {
// do nothing for now on an OK assertion
// println('OK ${(i.line_nr+1):5d}|${i.src}')
}

View File

@@ -0,0 +1,91 @@
module main
// /////////////////////////////////////////////////////////////////////
// / This file will get compiled as a part of the same module,
// / in which a given _test.v file is, when v is given -stats argument
// / The methods defined here are called back by the test program's
// / main function, so that customizing the look & feel of the results
// / is easy, since it is done in normal V code, instead of in embedded C ...
// /////////////////////////////////////////////////////////////////////
import os
import benchmark
const (
inner_indent = ' '
)
struct BenchedTests {
mut:
bench benchmark.Benchmark
oks int
fails int
test_suit_file string
step_func_name string
}
// ///////////////////////////////////////////////////////////////////
// Called at the start of the test program produced by `v -stats file_test.v`
fn start_testing(total_number_of_tests int, vfilename string) BenchedTests {
mut b := BenchedTests{
bench: benchmark.new_benchmark()
}
b.bench.set_total_expected_steps(total_number_of_tests)
b.test_suit_file = vfilename
println('running tests in: $b.test_suit_file')
return b
}
// Called before each test_ function, defined in file_test.v
fn (mut b BenchedTests) testing_step_start(stepfunc string) {
b.step_func_name = stepfunc.replace('main.', '').replace('__', '.')
b.oks = C.g_test_oks
b.fails = C.g_test_fails
b.bench.step()
}
// Called after each test_ function, defined in file_test.v
fn (mut b BenchedTests) testing_step_end() {
ok_diff := C.g_test_oks - b.oks
fail_diff := C.g_test_fails - b.fails
// ////////////////////////////////////////////////////////////////
if ok_diff == 0 && fail_diff == 0 {
b.bench.neither_fail_nor_ok()
println(inner_indent + b.bench.step_message_ok(' NO asserts | ') + b.fn_name())
return
}
// ////////////////////////////////////////////////////////////////
if ok_diff > 0 {
b.bench.ok_many(ok_diff)
}
if fail_diff > 0 {
b.bench.fail_many(fail_diff)
}
// ////////////////////////////////////////////////////////////////
if ok_diff > 0 && fail_diff == 0 {
println(inner_indent + b.bench.step_message_ok(nasserts(ok_diff)) + b.fn_name())
return
}
if fail_diff > 0 {
println(inner_indent + b.bench.step_message_fail(nasserts(fail_diff)) + b.fn_name())
return
}
}
fn (b &BenchedTests) fn_name() string {
return b.step_func_name + '()'
}
// Called at the end of the test program produced by `v -stats file_test.v`
fn (mut b BenchedTests) end_testing() {
b.bench.stop()
println(inner_indent + b.bench.total_message('running V tests in "' + os.file_name(b.test_suit_file) +
'"'))
}
// ///////////////////////////////////////////////////////////////////
fn nasserts(n int) string {
if n == 1 {
return '${n:5d} assert | '
}
return '${n:5d} asserts | '
}

297
cmd/tools/repeat.v Normal file
View File

@@ -0,0 +1,297 @@
module main
import os
import flag
import time
import term
import math
import scripting
import v.util
struct CmdResult {
mut:
runs int
cmd string
icmd int
outputs []string
oms map[string][]int
summary map[string]Aints
timings []int
atiming Aints
}
struct Context {
mut:
count int
series int
warmup int
show_help bool
show_output bool
fail_on_regress_percent int
fail_on_maxtime int // in ms
verbose bool
commands []string
results []CmdResult
cmd_template string // {T} will be substituted with the current command
cmd_params map[string][]string
cline string // a terminal clearing line
}
struct Aints {
values []int
mut:
imin int
imax int
average f64
stddev f64
}
fn new_aints(vals []int) Aints {
mut res := Aints{
values: vals
}
mut sum := i64(0)
mut imin := math.max_i32
mut imax := -math.max_i32
for i in vals {
sum += i
if i < imin {
imin = i
}
if i > imax {
imax = i
}
}
res.imin = imin
res.imax = imax
if vals.len > 0 {
res.average = sum / f64(vals.len)
}
//
mut devsum := f64(0.0)
for i in vals {
x := f64(i) - res.average
devsum += (x * x)
}
res.stddev = math.sqrt(devsum / f64(vals.len))
return res
}
fn (a Aints) str() string {
return util.bold('${a.average:9.3f}') +
'ms ± σ: ${a.stddev:-5.1f}ms, min max: ${a.imin}ms ${a.imax}ms'
}
const (
max_fail_percent = 100000
max_time = 60 * 1000 // ms
performance_regression_label = 'Performance regression detected, failing since '
)
fn main() {
mut context := Context{}
context.parse_options()
context.run()
context.show_diff_summary()
}
fn (mut context Context) parse_options() {
mut fp := flag.new_flag_parser(os.args)
fp.application(os.file_name(os.executable()))
fp.version('0.0.1')
fp.description('Repeat command(s) and collect statistics. NB: you have to quote each command, if it contains spaces.')
fp.arguments_description('CMD1 CMD2 ...')
fp.skip_executable()
fp.limit_free_args_to_at_least(1)
context.count = fp.int('count', `c`, 10, 'Repetition count.')
context.series = fp.int('series', `s`, 2, 'Series count. `-s 2 -c 4 a b` => aaaabbbbaaaabbbb, while `-s 3 -c 2 a b` => aabbaabbaabb.')
context.warmup = fp.int('warmup', `w`, 2, 'Warmup runs. These are done *only at the start*, and are ignored.')
context.show_help = fp.bool('help', `h`, false, 'Show this help screen.')
context.show_output = fp.bool('output', `O`, false, 'Show command stdout/stderr in the progress indicator for each command. NB: slower, for verbose commands.')
context.verbose = fp.bool('verbose', `v`, false, 'Be more verbose.')
context.fail_on_maxtime = fp.int('max_time', `m`, max_time, 'Fail with exit code 2, when first cmd takes above M milliseconds (regression).')
context.fail_on_regress_percent = fp.int('fail_percent', `f`, max_fail_percent, 'Fail with exit code 3, when first cmd is X% slower than the rest (regression).')
context.cmd_template = fp.string('template', `t`, '{T}', 'Command template. {T} will be substituted with the current command.')
cmd_params := fp.string_multi('parameter', `p`, 'A parameter substitution list. `{p}=val1,val2,val2` means that {p} in the template, will be substituted with each of val1, val2, val3.')
for p in cmd_params {
parts := p.split(':')
if parts.len > 1 {
context.cmd_params[parts[0]] = parts[1].split(',')
}
}
if context.show_help {
println(fp.usage())
exit(0)
}
if context.verbose {
scripting.set_verbose(true)
}
commands := fp.finalize() or {
eprintln('Error: ' + err)
exit(1)
}
context.commands = context.expand_all_commands(commands)
context.results = []CmdResult{len: context.commands.len, init: CmdResult{}}
context.cline = '\r' + term.h_divider('')
}
fn (mut context Context) clear_line() {
print(context.cline)
}
fn (mut context Context) expand_all_commands(commands []string) []string {
mut all_commands := []string{}
for cmd in commands {
maincmd := context.cmd_template.replace('{T}', cmd)
mut substituted_commands := [maincmd]
for paramk, paramlist in context.cmd_params {
for paramv in paramlist {
mut new_substituted_commands := []string{}
for cscmd in substituted_commands {
scmd := cscmd.replace(paramk, paramv)
new_substituted_commands << scmd
}
substituted_commands << new_substituted_commands
}
}
all_commands << substituted_commands
}
mut unique := map[string]int{}
for x in all_commands {
if x.contains('{') && x.contains('}') {
continue
}
unique[x] = 1
}
return unique.keys()
}
fn (mut context Context) run() {
mut run_warmups := 0
for si in 1 .. context.series + 1 {
for icmd, cmd in context.commands {
mut runs := 0
mut duration := 0
mut sum := 0
mut oldres := ''
println('Series: ${si:4}/${context.series:-4}, command: $cmd')
if context.warmup > 0 && run_warmups < context.commands.len {
for i in 1 .. context.warmup + 1 {
print('\r warming up run: ${i:4}/${context.warmup:-4} for ${cmd:-50s} took ${duration:6} ms ...')
mut sw := time.new_stopwatch({})
os.exec(cmd) or {
continue
}
duration = int(sw.elapsed().milliseconds())
}
run_warmups++
}
context.clear_line()
for i in 1 .. (context.count + 1) {
avg := f64(sum) / f64(i)
print('\rAverage: ${avg:9.3f}ms | run: ${i:4}/${context.count:-4} | took ${duration:6} ms')
if context.show_output {
print(' | result: ${oldres:s}')
}
mut sw := time.new_stopwatch({})
res := scripting.exec(cmd) or {
continue
}
duration = int(sw.elapsed().milliseconds())
if res.exit_code != 0 {
eprintln('${i:10} non 0 exit code for cmd: $cmd')
continue
}
context.results[icmd].outputs <<
res.output.trim_right('\r\n').replace('\r\n', '\n').split('\n')
context.results[icmd].timings << duration
sum += duration
runs++
oldres = res.output.replace('\n', ' ')
}
context.results[icmd].cmd = cmd
context.results[icmd].icmd = icmd
context.results[icmd].runs += runs
context.results[icmd].atiming = new_aints(context.results[icmd].timings)
context.clear_line()
print('\r')
mut m := map[string][]int{}
for o in context.results[icmd].outputs {
x := o.split(':')
if x.len > 1 {
k := x[0]
v := x[1].trim_left(' ').int()
m[k] << v
}
}
mut summary := map[string]Aints{}
for k, v in m {
// show a temporary summary for the current series/cmd cycle
s := new_aints(v)
println(' $k: $s')
summary[k] = s
}
// merge current raw results to the previous ones
old_oms := context.results[icmd].oms
mut new_oms := map[string][]int{}
for k, v in m {
if old_oms[k].len == 0 {
new_oms[k] = v
} else {
new_oms[k] << old_oms[k]
new_oms[k] << v
}
}
context.results[icmd].oms = new_oms
// println('')
}
}
// create full summaries, taking account of all runs
for icmd in 0 .. context.results.len {
mut new_full_summary := map[string]Aints{}
for k, v in context.results[icmd].oms {
new_full_summary[k] = new_aints(v)
}
context.results[icmd].summary = new_full_summary
}
}
fn (mut context Context) show_diff_summary() {
context.results.sort_with_compare(fn (a &CmdResult, b &CmdResult) int {
if a.atiming.average < b.atiming.average {
return -1
}
if a.atiming.average > b.atiming.average {
return 1
}
return 0
})
println('Summary (commands are ordered by ascending mean time), after $context.series series of $context.count repetitions:')
base := context.results[0].atiming.average
mut first_cmd_percentage := f64(100.0)
for i, r in context.results {
cpercent := (r.atiming.average / base) * 100 - 100
first_marker := if r.icmd == 0 { util.bold('>') } else { ' ' }
if r.icmd == 0 {
first_cmd_percentage = cpercent
}
println(' $first_marker${(i + 1):3} | ${cpercent:6.1f}% slower | ${r.cmd:-55s} | $r.atiming')
}
$if debugcontext ? {
println('context: $context')
}
if int(base) > context.fail_on_maxtime {
print(performance_regression_label)
println('average time: ${base:6.1f} ms > $context.fail_on_maxtime ms threshold.')
exit(2)
}
if context.fail_on_regress_percent == max_fail_percent || context.results.len < 2 {
return
}
fail_threshold_max := f64(context.fail_on_regress_percent)
if first_cmd_percentage > fail_threshold_max {
print(performance_regression_label)
println('${first_cmd_percentage:5.1f}% > ${fail_threshold_max:5.1f}% threshold.')
exit(3)
}
}

View File

@@ -0,0 +1,81 @@
module main
import os
import time
import os.cmdline
enum Target {
both
stderr
stdout
alternate
}
fn s2target(s string) Target {
return match s {
'both' { Target.both }
'stderr' { Target.stderr }
'alternate' { Target.alternate }
else { Target.stdout }
}
}
struct Context {
mut:
timeout_ms int
period_ms int
exitcode int
target Target
omode Target
is_verbose bool
}
fn (mut ctx Context) println(s string) {
if ctx.target == .alternate {
ctx.omode = if ctx.omode == .stderr { Target.stdout } else { Target.stderr }
}
if ctx.target in [.both, .stdout] || ctx.omode == .stdout {
println('stdout, $s')
}
if ctx.target in [.both, .stderr] || ctx.omode == .stderr {
eprintln('stderr, $s')
}
}
fn do_timeout(c &Context) {
mut ctx := c
time.sleep_ms(ctx.timeout_ms)
exit(ctx.exitcode)
}
fn main() {
mut ctx := Context{}
args := os.args[1..]
if '-h' in args || '--help' in args {
println("Usage:
test_os_process [-v] [-h] [-target stderr/stdout/both/alternate] [-exitcode 0] [-timeout_ms 1000] [-period_ms 100]
Prints lines periodically (-period_ms), to stdout/stderr (-target).
After a while (-timeout_ms), exit with (-exitcode).
This program is useful for platform independent testing
of child process/standart input/output control.
It is used in V\'s `os` module tests.
")
}
ctx.is_verbose = '-v' in args
ctx.target = s2target(cmdline.option(args, '-target', 'both'))
ctx.exitcode = cmdline.option(args, '-exitcode', '0').int()
ctx.timeout_ms = cmdline.option(args, '-timeout_ms', '1000').int()
ctx.period_ms = cmdline.option(args, '-period_ms', '100').int()
if ctx.target == .alternate {
ctx.omode = .stdout
}
if ctx.is_verbose {
eprintln('> args: $args | context: $ctx')
}
go do_timeout(&ctx)
for i := 1; true; i++ {
ctx.println('$i')
time.sleep_ms(ctx.period_ms)
}
time.sleep(100000)
}

149
cmd/tools/vbin2v.v Normal file
View File

@@ -0,0 +1,149 @@
module main
import os
import flag
import strings
const (
tool_version = '0.0.4'
tool_description = 'Converts a list of arbitrary files into a single v module file.'
)
struct Context {
mut:
files []string
prefix string
show_help bool
module_name string
write_file string
}
fn (context Context) header() string {
mut header_s := ''
header_s += 'module $context.module_name\n'
header_s += '\n'
allfiles := context.files.join(' ')
mut options := []string{}
if context.prefix.len > 0 {
options << '-p $context.prefix'
}
if context.module_name.len > 0 {
options << '-m $context.module_name'
}
if context.write_file.len > 0 {
options << '-w $context.write_file'
}
soptions := options.join(' ')
header_s += '// File generated by:\n'
header_s += '// v bin2v $allfiles $soptions\n'
header_s += '// Please, do not edit this file.\n'
header_s += '// Your changes may be overwritten.\n'
header_s += 'const (\n'
return header_s
}
fn (context Context) footer() string {
return ')\n'
}
fn (context Context) file2v(bname string, fbytes []byte, bn_max int) string {
mut sb := strings.new_builder(1000)
bn_diff_len := bn_max - bname.len
sb.write('\t${bname}_len' + ' '.repeat(bn_diff_len - 4) + ' = $fbytes.len\n')
mut last_len := sb.len
fbyte := fbytes[0]
sb.write('\t$bname' + ' '.repeat(bn_diff_len) + ' = [byte($fbyte), ')
for i := 1; i < fbytes.len; i++ {
b := int(fbytes[i]).str()
sb_diff_len := sb.len - last_len
if i < 30 && sb_diff_len > 86 {
sb.write('$b,\n\t\t')
last_len = sb.len
} else if sb_diff_len > 88 && 92 - sb_diff_len < b.len {
sb.write('$b,\n\t\t')
last_len = sb.len
} else if i == fbytes.len - 1 {
sb.write(b)
} else {
sb.write('$b, ')
}
}
sb.write(']!!\n')
return sb.str()
}
fn (context Context) bname_and_bytes(file string) ?(string, []byte) {
fname := os.file_name(file)
fname_no_dots := fname.replace('.', '_')
byte_name := '$context.prefix$fname_no_dots'.to_lower()
fbytes := os.read_bytes(file) or {
return error('Error: $err')
}
return byte_name, fbytes
}
fn (context Context) max_bname_len(bnames []string) int {
mut max := 0
for n in bnames {
if n.len > max {
max = n.len
}
}
// Add 4 to max due to "_len" suffix
return max + 4
}
fn main() {
mut context := Context{}
mut fp := flag.new_flag_parser(os.args[1..])
fp.application('v bin2v')
fp.version(tool_version)
fp.description(tool_description)
fp.arguments_description('FILE [FILE]...')
context.show_help = fp.bool('help', `h`, false, 'Show this help screen.')
context.module_name = fp.string('module', `m`, 'binary', 'Name of the generated module.')
context.prefix = fp.string('prefix', `p`, '', 'A prefix put before each resource name.')
context.write_file = fp.string('write', `w`, '', 'Write directly to a file with the given name.')
if context.show_help {
println(fp.usage())
exit(0)
}
files := fp.finalize() or {
eprintln('Error: ' + err)
exit(1)
}
real_files := files.filter(it != 'bin2v')
if real_files.len == 0 {
println(fp.usage())
exit(0)
}
context.files = real_files
if context.write_file != '' && !context.write_file.ends_with('.v') {
context.write_file += '.v'
}
mut file_byte_map := map[string][]byte{}
for file in real_files {
bname, fbytes := context.bname_and_bytes(file) or {
eprintln(err)
continue
}
file_byte_map[bname] = fbytes
}
max_bname := context.max_bname_len(file_byte_map.keys())
if context.write_file.len > 0 {
mut out_file := os.create(context.write_file) or {
panic(err)
}
out_file.write_str(context.header())
for bname, fbytes in file_byte_map {
out_file.write_str(context.file2v(bname, fbytes, max_bname))
}
out_file.write_str(context.footer())
} else {
println(context.header())
for bname, fbytes in file_byte_map {
println(context.file2v(bname, fbytes, max_bname))
}
println(context.footer())
}
}

View File

@@ -0,0 +1,16 @@
module main
import os
import testing
fn main() {
args := os.args
args_string := args[1..].join(' ')
params := args_string.all_before('build-examples')
if testing.v_build_failing(params, 'examples') {
exit(1)
}
if testing.v_build_failing(params + '-live', os.join_path('examples', 'hot_reload')) {
exit(1)
}
}

36
cmd/tools/vbuild-tools.v Normal file
View File

@@ -0,0 +1,36 @@
module main
import os
import testing
import v.util
fn p(s string) string {
println(s)
return s
}
fn main() {
args := os.args
args_string := args[1..].join(' ')
skips := []string{}
vexe := os.getenv('VEXE')
vroot := os.dir(vexe)
util.ensure_modules_for_all_tools_are_installed('-v' in args)
folder := 'cmd/tools'
main_label := 'Building $folder ...'
finish_label := 'building $folder'
mut session := testing.prepare_test_session(args_string.all_before('build-tools'), folder, skips, main_label)
session.rm_binaries = false
session.test()
eprintln(session.benchmark.total_message(finish_label))
if session.failed {
exit(1)
}
//
mut executables := os.ls(session.vtmp_dir)?
executables.sort()
executables = executables.filter(it !in ['gen1m', 'gen_vc', 'fast', 'wyhash'])
for exe in executables {
os.mv_by_cp(os.join_path(session.vtmp_dir, exe), os.join_path(vroot, 'cmd', 'tools', exe))
}
}

View File

@@ -0,0 +1,9 @@
module main
import testing
fn main() {
if testing.building_any_v_binaries_failed() {
exit(1)
}
}

424
cmd/tools/vcomplete.v Normal file
View File

@@ -0,0 +1,424 @@
// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
//
// Utility functions helping integrate with various shell auto-completion systems.
// The install process and communication is inspired from that of [kitty](https://sw.kovidgoyal.net/kitty/#completion-for-kitty)
// This method avoids writing and maintaining external files on the user's file system.
// The user will be responsible for adding a small line to their .*rc - that will ensure *live* (i.e. not-static)
// auto-completion features.
//
// # bash
// To install auto-completion for V in bash, simply add this code to your `~/.bashrc`:
// `source /dev/stdin <<<"$(v complete setup bash)"`
// On more recent versions of bash (>3.2) this should suffice:
// `source <(v complete setup bash)`
//
// # fish
// For versions of fish <3.0.0, add the following to your `~/.config/fish/config.fish`
// `v complete setup fish | source`
// Later versions of fish source completions by default.
//
// # zsh
// To install auto-completion for V in zsh - please add the following to your `~/.zshrc`:
// ```
// autoload -Uz compinit
// compinit
// # Completion for v
// v complete setup zsh | source /dev/stdin
// ```
// Please note that you should let v load the zsh completions after the call to compinit
//
// # powershell //TODO
//
module main
import os
const (
auto_complete_shells = ['bash', 'fish', 'zsh', 'powershell'] // list of supported shells
vexe = os.getenv('VEXE')
)
// Snooped from cmd/v/v.v, vlib/v/pref/pref.v
const (
auto_complete_commands = [
/* simple_cmd */
'fmt',
'up',
'vet',
'self',
'tracev',
'symlink',
'bin2v',
'test',
'test-fmt',
'test-compiler',
'test-fixed',
'test-cleancode',
'repl',
'complete',
'build-tools',
'build-examples',
'build-vbinaries',
'setup-freetype',
'doc',
'doctor',
/* commands */
'help',
'new',
'init',
'complete',
'translate',
'self',
'search',
'install',
'update',
'upgrade',
'outdated',
'list',
'remove',
'vlib-docs',
'get',
'version',
'run',
'build',
'build-module',
]
auto_complete_flags = [
'-apk',
'-show-timings',
'-check-syntax',
'-v',
'-progress',
'-silent',
'-g',
'-cg',
'-repl',
'-live',
'-sharedlive',
'-shared',
'--enable-globals',
'-enable-globals',
'-autofree',
'-compress',
'-freestanding',
'-no-preludes',
'-prof',
'-profile',
'-profile-no-inline',
'-prod',
'-simulator',
'-stats',
'-obfuscate',
'-translated',
'-color',
'-nocolor',
'-showcc',
'-show-c-output',
'-experimental',
'-usecache',
'-prealloc',
'-parallel',
'-x64',
'-W',
'-keepc',
'-w',
'-print_v_files',
'-error-limit',
'-os',
'-printfn',
'-cflags',
'-define',
'-d',
'-cc',
'-o',
'-b',
'-path',
'-custom-prelude',
'-name',
'-bundle',
'-V',
'-version',
'--version',
]
auto_complete_flags_doc = [
'-all',
'-f',
'-h',
'-help',
'-m',
'-o',
'-readme',
'-v',
'-filename',
'-pos',
'-no-timestamp',
'-inline-assets',
'-open',
'-p',
'-s',
'-l',
]
auto_complete_flags_fmt = [
'-c',
'-diff',
'-l',
'-w',
'-debug',
'-verify',
]
auto_complete_flags_bin2v = [
'-h',
'--help',
'-m',
'--module',
'-p',
'--prefix',
'-w',
'--write',
]
auto_complete_flags_self = [
'-prod',
]
auto_complete_compilers = [
'cc',
'gcc',
'tcc',
'tinyc',
'clang',
'mingw',
'msvc',
]
)
fn auto_complete(args []string) {
if args.len <= 1 || args[0] != 'complete' {
if args.len == 1 {
eprintln('auto completion require arguments to work.')
} else {
eprintln('auto completion failed for "$args".')
}
exit(1)
}
sub := args[1]
sub_args := args[1..]
match sub {
'setup' {
if sub_args.len <= 1 || sub_args[1] !in auto_complete_shells {
eprintln('please specify a shell to setup auto completion for ($auto_complete_shells).')
exit(1)
}
shell := sub_args[1]
mut setup := ''
match shell {
'bash' { setup = '
_v_completions() {
local src
local limit
# Send all words up to the word the cursor is currently on
let limit=1+\$COMP_CWORD
src=\$($vexe complete bash \$(printf "%s\\n" \${COMP_WORDS[@]: 0:\$limit}))
if [[ \$? == 0 ]]; then
eval \${src}
#echo \${src}
fi
}
complete -o nospace -F _v_completions v
' }
'fish' { setup = '
function __v_completions
# Send all words up to the one before the cursor
$vexe complete fish (commandline -cop)
end
complete -f -c v -a "(__v_completions)"
' }
'zsh' { setup = '
#compdef v
_v() {
local src
# Send all words up to the word the cursor is currently on
src=\$($vexe complete zsh \$(printf "%s\\n" \${(@)words[1,\$CURRENT]}))
if [[ \$? == 0 ]]; then
eval \${src}
#echo \${src}
fi
}
compdef _v v
' }
// 'powershell' {} //TODO
else {}
}
println(setup)
}
'bash' {
if sub_args.len <= 1 {
exit(0)
}
mut lines := []string{}
list := auto_complete_request(sub_args[1..])
for entry in list {
lines << "COMPREPLY+=(\'$entry\')"
}
println(lines.join('\n'))
}
'fish' {
if sub_args.len <= 1 {
exit(0)
}
mut lines := []string{}
list := auto_complete_request(sub_args[1..])
for entry in list {
lines << '$entry'
}
println(lines.join('\n'))
}
'zsh' {
if sub_args.len <= 1 {
exit(0)
}
mut lines := []string{}
list := auto_complete_request(sub_args[1..])
for entry in list {
lines << 'compadd -U -S \"\" -- \'$entry\';'
}
println(lines.join('\n'))
}
// 'powershell' {} //TODO
else {}
}
exit(0)
}
fn auto_complete_request(args []string) []string {
// Using space will ensure a uniform input in cases where the shell
// returns the completion input as a string (['v','run'] vs. ['v run']).
split_by := ' '
request := args.join(split_by)
mut list := []string{}
// new_part := request.ends_with('\n\n')
mut parts := request.trim_right(' ').split(split_by)
if parts.len <= 1 { // 'v <tab>' -> top level commands.
for command in auto_complete_commands {
list << command
}
} else {
part := parts.last().trim(' ')
mut parent_command := ''
for i := parts.len - 1; i >= 0; i-- {
if parts[i].starts_with('-') {
continue
}
parent_command = parts[i]
break
}
get_flags := fn (base []string, flag string) []string {
if flag.len == 1 { return base
} else { return base.filter(it.starts_with(flag))
}
}
if part.starts_with('-') { // 'v -<tab>' -> flags.
match parent_command {
'bin2v' { // 'v bin2v -<tab>'
list = get_flags(auto_complete_flags_bin2v, part)
}
'build' { // 'v build -<tab>' -> flags.
list = get_flags(auto_complete_flags, part)
}
'doc' { // 'v doc -<tab>' -> flags.
list = get_flags(auto_complete_flags_doc, part)
}
'fmt' { // 'v fmt -<tab>' -> flags.
list = get_flags(auto_complete_flags_fmt, part)
}
'self' { // 'v self -<tab>' -> flags.
list = get_flags(auto_complete_flags_self, part)
}
else {
for flag in auto_complete_flags {
if flag == part {
if flag == '-cc' { // 'v -cc <tab>' -> list of available compilers.
for compiler in auto_complete_compilers {
path := os.find_abs_path_of_executable(compiler) or {
''
}
if path != '' {
list << compiler
}
}
}
} else if flag.starts_with(part) { // 'v -<char(s)><tab>' -> flags matching "<char(s)>".
list << flag
}
}
}
}
} else {
match part {
'help' { // 'v help <tab>' -> top level commands except "help".
list = auto_complete_commands.filter(it != part && it != 'complete')
}
else {
// 'v <char(s)><tab>' -> commands matching "<char(s)>".
// Don't include if part matches a full command - instead go to path completion below.
for command in auto_complete_commands {
if part != command && command.starts_with(part) {
list << command
}
}
}
}
}
// Nothing of value was found.
// Mimic shell dir and file completion
if list.len == 0 {
mut ls_path := '.'
mut collect_all := part in auto_complete_commands
mut path_complete := false
if part.ends_with(os.path_separator) || part == '.' || part == '..' {
// 'v <command>(.*/$|.|..)<tab>' -> output full directory list
ls_path = '.' + os.path_separator + part
collect_all = true
} else if !collect_all && part.contains(os.path_separator) && os.is_dir(os.dir(part)) {
// 'v <command>(.*/.* && os.is_dir)<tab>' -> output completion friendly directory list
ls_path = os.dir(part)
path_complete = true
}
entries := os.ls(ls_path) or {
return list
}
last := part.all_after_last(os.path_separator)
if path_complete {
path := part.all_before_last(os.path_separator)
for entry in entries {
if entry.starts_with(last) {
list << os.join_path(path, entry)
}
}
// If only one possible file - send full path to completion system.
// Please note that this might be bash specific - needs more testing.
if list.len == 1 {
list = [list[0]]
}
} else {
for entry in entries {
if collect_all {
list << entry
} else {
if entry.starts_with(last) {
list << entry
}
}
}
}
}
}
return list
}
fn main() {
args := os.args[1..]
// println('"$args"')
auto_complete(args)
}

145
cmd/tools/vcreate.v Normal file
View File

@@ -0,0 +1,145 @@
module main
// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
//
// This module follows a similar convention to Rust: `init` makes the
// structure of the program in the _current_ directory, while `new`
// makes the program structure in a _sub_ directory. Besides that, the
// functionality is essentially the same.
import os
struct Create {
mut:
name string
description string
}
fn cerror(e string) {
eprintln('\nerror: $e')
}
fn vmod_content(name string, desc string) string {
return [
'Module {',
" name: '$name'",
" description: '$desc'",
" version: '0.0.0'",
' dependencies: []',
'}',
].join('\n')
}
fn main_content() string {
return [
'module main\n',
'fn main() {',
" println('Hello World!')",
'}',
].join('\n')
}
fn gen_gitignore(name string) string {
return [
'# Binaries for programs and plugins',
'main',
'$name',
'*.exe',
'*.exe~',
'*.so',
'*.dylib',
'*.dll',
].join('\n')
}
fn (c &Create) write_vmod(new bool) {
vmod_path := if new { '$c.name/v.mod' } else { 'v.mod' }
mut vmod := os.create(vmod_path) or {
cerror(err)
exit(1)
}
vmod.write_str(vmod_content(c.name, c.description))
vmod.close()
}
fn (c &Create) write_main(new bool) {
if !new && (os.exists('${c.name}.v') || os.exists('src/${c.name}.v')) {
return
}
main_path := if new { '$c.name/${c.name}.v' } else { '${c.name}.v' }
mut main := os.create(main_path) or {
cerror(err)
exit(2)
}
main.write_str(main_content())
main.close()
}
fn (c &Create) create_git_repo(dir string) {
// Create Git Repo and .gitignore file
if !os.is_dir('$dir/.git') {
os.exec('git init $dir') or {
cerror('Unable to create git repo')
exit(4)
}
if !os.exists('$dir/.gitignore') {
mut fl := os.create('$dir/.gitignore') or {
// We don't really need a .gitignore, it's just a nice-to-have
return
}
fl.write_str(gen_gitignore(c.name))
fl.close()
}
}
}
fn create() {
mut c := Create{}
c.name = os.input('Input your project name: ')
if c.name == '' {
cerror('project name cannot be empty')
exit(1)
}
if c.name.contains('-') {
cerror('"$c.name" should not contain hyphens')
exit(1)
}
if os.is_dir(c.name) {
cerror('$c.name folder already exists')
exit(3)
}
c.description = os.input('Input your project description: ')
println('Initialising ...')
os.mkdir(c.name) or {
panic(err)
}
c.write_vmod(true)
c.write_main(true)
c.create_git_repo(c.name)
}
fn init_project() {
if os.exists('v.mod') {
cerror('`v init` cannot be run on existing v modules')
exit(3)
}
mut c := Create{}
c.name = os.file_name(os.getwd())
c.description = ''
c.write_vmod(false)
c.write_main(false)
c.create_git_repo('')
println("Change your module's description in `v.mod`")
}
fn main() {
if os.args[1] == 'new' {
create()
} else if os.args[1] == 'init' {
init_project()
} else {
cerror('Unknown command: ${os.args[1]}')
exit(1)
}
println('Complete!')
}

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" class="dropdown-arrow" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M7 10l5 5 5-5z"/></svg>

After

Width:  |  Height:  |  Size: 175 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" class="dark-icon" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24"><g><rect fill="none" height="24" width="24"/></g><g><g><g><path d="M11.1,12.08C8.77,7.57,10.6,3.6,11.63,2.01C6.27,2.2,1.98,6.59,1.98,12c0,0.14,0.02,0.28,0.02,0.42 C2.62,12.15,3.29,12,4,12c1.66,0,3.18,0.83,4.1,2.15C9.77,14.63,11,16.17,11,18c0,1.52-0.87,2.83-2.12,3.51 c0.98,0.32,2.03,0.5,3.11,0.5c3.5,0,6.58-1.8,8.37-4.52C18,17.72,13.38,16.52,11.1,12.08z"/></g><path d="M7,16l-0.18,0C6.4,14.84,5.3,14,4,14c-1.66,0-3,1.34-3,3s1.34,3,3,3c0.62,0,2.49,0,3,0c1.1,0,2-0.9,2-2 C9,16.9,8.1,16,7,16z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 642 B

View File

@@ -0,0 +1,582 @@
:root {
--background-color: #fff;
--link-color: #2779bd;
--text-color: #000;
--ref-symbol-color: #dae1e7;
--ref-symbol-hover-color: #b8c2cc;
--title-bottom-line-color: #f1f5f8;
--footer-top-line-color: #f1f5f8;
--footer-text-color: #616161;
--code-signature-border-color: #a0aec0;
--menu-background-color: #4b6c88;
--menu-text-color: #fff;
--menu-indent-line-color: #3b3b3b66;
--menu-indent-line-active-color: #00000066;
--menu-scrollbar-color: #a0aec0;
--menu-toggle-icon-color: #fff;
--menu-toggle-icon-hover-color: #00000044;
--menu-search-background-color: #00000044;
--menu-search-font-color: #fff;
--toc-text-color: #2779bd;
--toc-indicator-color: #4299e1;
--code-default-text-color: #5c6e74;
--code-background-color: #edf2f7;
--code-keyword-text-color: #2b6cb0;
--code-builtin-text-color: #0a0a0a;
--code-function-text-color: #319795;
--code-comment-text-color: #93a1a1;
--code-punctuation-text-color: #999999;
--code-symbol-text-color: #702459;
--code-operator-text-color: #a67f59;
}
:root.dark .dark-icon {
display: none;
}
:root:not(.dark) .light-icon {
display: none;
}
.dark body {
--background-color: #1a202c;
--text-color: #fff;
--link-color: #90cdf4;
--ref-symbol-color: #2d3748;
--ref-symbol-hover-color: #4a5568;
--title-bottom-line-color: #2d3748;
--footer-top-line-color: #2d3748;
--footer-text-color: #bbd3e1;
--code-signature-border-color: #4a5568;
--menu-background-color: #2d3748;
--menu-text-color: #fff;
--menu-indent-line-color: #4a5568;
--menu-indent-line-active-color: #90cdf4;
--menu-scrollbar-color: #4a5568;
--menu-toggle-icon-color: #fff;
--menu-search-background-color: #4a5568;
--menu-search-font-color: #fff;
--toc-text-color: #90cdf4;
--toc-indicator-color: #4299e1;
--code-default-text-color: #cbd5e0;
--code-background-color: #2d3748;
--code-builtin-text-color: #68d391;
--code-keyword-text-color: #63b3ed;
--code-function-text-color: #4fd1c5;
--code-comment-text-color: #a0aec0;
--code-punctuation-text-color: #a0aec0;
--code-symbol-text-color: #ed64a6;
}
body {
margin: 0;
font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
background-color: #fff;
background-color: var(--background-color);
color: #000;
color: var(--text-color);
overflow-y: scroll;
}
/** Reset for menus */
.doc-nav ul,
.doc-toc ul {
list-style: none;
padding: 0;
margin: 0;
}
/* Left nav */
.doc-nav {
position: fixed;
width: 100%;
left: 0;
right: 0;
top: 0;
display: flex;
background-color: #4b6c88;
background-color: var(--menu-background-color);
color: #fff;
color: var(--menu-text-color);
flex-direction: column;
overflow-y: auto;
height: 100vh;
z-index: 10;
scrollbar-width: thin;
scrollbar-color: #a0aec0 transparent;
scrollbar-color: var(--menu-scrollbar-color) transparent;
}
*::-webkit-scrollbar {
width: 8px;
height: 8px;
}
*::-webkit-scrollbar-track {
background: transparent;
}
*::-webkit-scrollbar-thumb {
background-color: #a0aec0;
background-color: var(--menu-scrollbar-color);
border: 3px solid transparent;
}
.doc-nav li {
line-height: 1.8;
font-weight: 300;
}
.doc-nav .content.show {
display: flex;
}
.doc-nav .content.hidden {
display: none;
}
.doc-nav #toggle-menu {
cursor: pointer;
padding: 0.3rem;
fill: #fff;
fill: var(--menu-toggle-icon-color);
}
.doc-nav #toggle-menu:active {
background-color: #00000044;
background-color: var(--menu-toggle-icon-hover-color);
border-radius: 5rem;
}
.doc-nav > .heading-container {
position: relative;
/* IE11 */
position: sticky;
position: -webkit-sticky;
top: 0;
background-color: #4b6c88;
background-color: var(--menu-background-color);
z-index: 10;
}
.doc-nav > .heading-container > .heading {
display: flex;
padding: 0 1rem;
height: 56px;
}
.doc-nav > .heading-container > .heading > .module {
font-size: 1.6rem;
font-weight: 500;
margin: 0;
}
.doc-nav > .heading-container > .heading > .toggle-version-container {
display: flex;
align-items: center;
}
.doc-nav > .heading-container > .heading > .toggle-version-container > #dark-mode-toggle {
cursor: pointer;
fill: #fff;
display: flex;
visibility: hidden;
}
.doc-nav > .heading-container > .heading > .toggle-version-container > #dark-mode-toggle > svg {
width: 1.2rem;
height: 1.2rem;
}
.doc-nav > .heading-container > .heading > #search {
margin-top: 1rem;
border: none;
border-radius: 0.2rem;
padding: 0.5rem 1rem;
outline: none;
background-color: #00000044;
background-color: var(--menu-search-background-color);
color: #fff;
color: var(--menu-search-text-color);
margin-left: -0.6rem;
margin-right: -0.6rem;
}
.doc-nav > .heading-container > .heading > #search::placeholder {
color: #edf2f7;
text-transform: uppercase;
font-size: 12px;
font-weight: 600;
}
.doc-nav > .heading-container > .heading > #search:-ms-input-placeholder {
color: #edf2f7;
text-transform: uppercase;
font-size: 12px;
font-weight: 600;
}
.doc-nav > .content {
padding: 0 2rem 2rem 2rem;
display: flex;
flex-direction: column;
}
.doc-nav > .content > ul > li.active {
font-weight: 600;
}
.doc-nav > .content > ul > li.open ul {
display: initial;
}
.doc-nav > .content > ul > li.open > .menu-row > .dropdown-arrow {
transform: initial;
}
.doc-nav > .content > ul > li > .menu-row {
display: flex;
align-items: center;
}
.doc-nav > .content > ul > li > .menu-row > .dropdown-arrow {
transform: rotate(-90deg);
height: 18px;
width: 18px;
margin-left: calc(-18px - 0.3rem);
margin-right: 0.3rem;
cursor: pointer;
fill: #fff;
pointer-events: all;
}
.doc-nav > .content > ul > li > ul {
margin: 0.4rem 0;
display: none;
}
.doc-nav > .content > ul > li > ul > li {
border-color: #ffffff66;
border-color: var(--menu-indent-line-color);
border-left-width: 1.7px;
border-left-style: solid;
padding-left: 0.7rem;
}
.doc-nav > .content > ul > li > ul > li.active {
border-color: #00000066;
border-color: var(--menu-indent-line-active-color);
}
.doc-nav > .content a {
color: #fff;
color: var(--menu-text-color);
text-decoration: none;
user-select: none;
}
.doc-nav > .content a:hover {
text-decoration: underline;
}
/* Main content */
.doc-container {
display: flex;
flex-direction: column-reverse;
margin-top: 56px;
}
.doc-content {
display: flex;
flex-direction: column;
padding: 1rem;
overflow: hidden;
}
.doc-content p {
line-height: 1.4;
}
.doc-content a {
color: #2779bd;
color: var(--link-color);
}
.doc-content > .doc-node {
padding: 5rem 0 2rem 0;
margin-top: -4rem;
overflow: hidden;
word-break: break-all; /* IE11 */
word-break: break-word;
}
.doc-content > .doc-node.const:nth-child(2) {
padding-bottom: 0 !important;
}
.doc-content > .doc-node.const:not(:first-child) {
padding-top: 4rem;
}
.doc-content > .doc-node.const:not(:last-child) {
padding-bottom: 2rem;
}
.doc-content > .timestamp {
font-size: 0.8rem;
color: #b8c2cc;
color: var(--timestamp-color);
}
.doc-content > .doc-node > .title {
display: flex;
align-items: center;
margin-bottom: 1rem;
border-bottom: 1px solid #f1f5f8;
border-bottom: 1px solid var(--title-bottom-line-color);
}
.doc-content > .doc-node > .title > .link {
display: flex;
margin-left: auto;
fill: #dae1e7;
fill: var(--ref-symbol-color);
}
.doc-content > .doc-node > .title > .link:hover {
fill: #b8c2cc;
fill: var(--ref-symbol-hover-color);
}
.doc-content > .doc-node h1 {
font-size: 2.5rem;
font-weight: 400;
}
.doc-content > .doc-node .signature {
border-color: #a0aec0;
border-color: var(--code-signature-border-color);
border-left-width: 3px;
border-left-style: solid;
}
.doc-content > .doc-node > ul > li .task-list-item-checkbox {
margin-right: 0.5rem;
}
.doc-content > .doc-node > .title h1,
.doc-content > .doc-node > .title h2,
.doc-content > .doc-node > .title h3,
.doc-content > .doc-node > .title h4,
.doc-content > .doc-node > .title h5,
.doc-content > .doc-node > .title h6 {
font-weight: 400;
padding-top: 0.6rem 0;
margin: 0;
}
.doc-content > .doc-node > .title h1 a,
.doc-content > .doc-node > .title h2 a,
.doc-content > .doc-node > .title h3 a,
.doc-content > .doc-node > .title h4 a,
.doc-content > .doc-node > .title h5 a,
.doc-content > .doc-node > .title h6 a {
text-decoration: none;
color: #dae1e7;
color: var(--ref-symbol-color);
}
.doc-content > .doc-node > .title h1 a:hover,
.doc-content > .doc-node > .title h2 a:hover,
.doc-content > .doc-node > .title h3 a:hover,
.doc-content > .doc-node > .title h4 a:hover,
.doc-content > .doc-node > .title h5 a:hover,
.doc-content > .doc-node > .title h6 a:hover {
color: #b8c2cc;
color: var(--ref-symbol-hover-color);
}
.doc-content > .footer {
padding-top: 1rem;
margin-top: auto;
bottom: 1rem;
color: 616161;
color: var(--footer-text-color);
border-color: #f1f5f8;
border-color: var(--footer-top-line-color);
border-top-style: solid;
border-top-width: 1px;
font-size: 0.8rem;
font-weight: 500;
}
/* Right menu */
.doc-toc {
right: 0;
top: 0;
height: 100%;
overflow-y: auto;
padding: 1rem 1rem 0 1rem;
width: 100%;
box-sizing: border-box;
-ms-overflow-style: none;
scrollbar-width: none;
}
.doc-toc::-webkit-scrollbar {
display: none;
}
.doc-toc li {
line-height: 1.5;
}
.doc-toc a {
color: #2779bd;
color: var(--toc-text-color);
font-size: 0.9rem;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
display: block;
text-decoration: none;
border-left-width: 2px;
border-left-style: solid;
border-color: transparent;
padding-left: 0.4rem;
}
.doc-toc a:hover {
text-decoration: underline;
}
.doc-toc a.active {
border-color: #4299e1;
border-color: var(--toc-indicator-color);
}
.doc-toc li ul {
margin: 0.2rem 0 0.2rem;
font-size: 0.7rem;
list-style: none;
}
.doc-toc li ul a {
font-weight: 400;
padding-left: 0.8rem;
}
/* Code highlight */
pre, code, pre code {
color: #5c6e74;
color: var(--code-default-text-color);
font-size: 0.948em;
text-shadow: none;
font-family: monospace;
background-color: #edf2f7;
background-color: var(--code-background-color);
border-radius: 0.25rem;
}
pre code {
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
display: block;
overflow-x: auto;
padding: 1rem;
}
code {
padding: 0.2rem;
vertical-align: middle;
}
pre {
overflow: auto;
margin: 0;
}
.namespace {
opacity: .7;
}
.token.comment {
color: #93a1a1;
color: var(--code-comment-text-color)
}
.token.punctuation {
color: #999999;
color: var(--code-punctuation-text-color);
}
.token.number,
.token.symbol {
color: #702459;
color: var(--code-symbol-text-color);
}
.token.string,
.token.char,
.token.builtin {
color: #38a169;
color: var(--code-builtin-text-color);
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #a67f59;
color: var(--code-operator-text-color);
background: transparent;
}
.token.boolean,
.token.keyword {
color: #2b6cb0;
color: var(--code-keyword-text-color);
}
.token.function {
color: #319795;
color: var(--code-function-text-color);
}
/* Medium screen and up */
@media (min-width: 768px) {
.doc-container {
flex-direction: row;
}
.doc-content {
font-size: 0.95rem;
flex: 1;
padding: 1rem 2rem;
}
.doc-toc {
position: relative;
/* IE11 */
position: sticky;
position: -webkit-sticky;
align-self: flex-start;
top: 56px;
height: auto;
height: 100vh;
min-width: 200px;
width: auto;
max-width: 300px;
}
.doc-toc > ul {
padding-bottom: 1rem;
}
}
@media (max-width: 1023px) {
.doc-nav.hidden {
height: auto;
}
.doc-nav > .heading-container > .heading {
align-items: center;
}
.doc-nav > .heading-container > .heading > .toggle-version-container {
flex-grow: 1;
padding: 0 1rem;
justify-content: space-between;
}
.doc-nav > .heading-container > .heading > #search {
display: none;
}
}
@media (min-width: 1024px) {
.doc-nav {
width: 300px;
}
.doc-nav #toggle-menu {
display: none;
}
.doc-nav > .heading-container > .heading {
height: auto;
padding: 1rem 2rem;
flex-direction: column-reverse;
justify-content: center;
}
.doc-nav > .heading-container > .heading > .toggle-version-container {
align-items: center;
margin-bottom: 0.2rem;
display: flex;
flex-direction: row-reverse;
}
.doc-nav > .heading-container > .heading > .toggle-version-container > #dark-mode-toggle {
margin-right: auto;
}
.doc-nav .content.show,
.doc-nav .content.hidden {
display: flex;
}
.doc-content > .doc-node.const:nth-child(2) {
padding-bottom: 0 !important;
}
.doc-content > .doc-node.const:not(:first-child) {
padding-top: 0;
}
.doc-content > .doc-node.const:not(:last-child) {
padding-bottom: 1rem;
}
.doc-container {
margin-top: 0;
margin-left: 300px;
}
.doc-node {
padding-top: 1rem !important;
margin-top: 0 !important;
}
.doc-toc {
top: 0;
}
}

View File

@@ -0,0 +1,121 @@
(function() {
if (document.body.scrollIntoView) {
var docnav = document.querySelector('.doc-nav');
var active = docnav.querySelector('li.active');
if (active) {
active.scrollIntoView({ block: 'center', inline: 'nearest' });
}
}
setupScrollSpy();
setupMobileToggle();
setupDarkMode();
setupSearch();
setupCollapse();
})();
function setupScrollSpy() {
var sectionPositions = [];
var sections = document.querySelectorAll('section');
sections.forEach(function(section) {
sectionPositions.push(section.offsetTop);
});
var scrollPos = 0;
window.addEventListener('scroll', function(e) {
// Reset classes
document.querySelectorAll('.doc-toc a[class="active"]').forEach(function(link) {
link.classList.remove('active');
});
// Set current menu link as active
var scrollPosition = document.documentElement.scrollTop || document.body.scrollTop;
for (var i = 0; i < sectionPositions.length; i++) {
var section = sections[i];
var position = sectionPositions[i];
if (position >= scrollPosition) {
var link = document.querySelector('.doc-toc a[href="#' + section.id + '"]');
if (link) {
link.classList.add('active');
var docToc = document.querySelector('.doc-toc');
var tocHeight = docToc.clientHeight;
var scrollTop = docToc.scrollTop;
if ((document.body.getBoundingClientRect()).top < scrollPos && scrollTop < link.offsetTop - 10) {
docToc.scrollTop = link.clientHeight + link.offsetTop - tocHeight + 10;
} else if (scrollTop > link.offsetTop - 10) {
docToc.scrollTop = link.offsetTop - 10;
}
}
break;
}
}
scrollPos = (document.body.getBoundingClientRect()).top;
});
}
function setupMobileToggle() {
var toggle = document.getElementById('toggle-menu');
toggle.addEventListener('click', function(ev) {
document.querySelectorAll('.doc-nav').forEach(function(el) {
el.classList.toggle('hidden');
});
document.querySelectorAll('.doc-nav .content').forEach(function(el) {
el.classList.toggle('hidden');
el.classList.toggle('show');
});
});
}
function setupDarkMode() {
var html = document.getElementsByTagName('html')[0];
var darkModeToggle = document.getElementById('dark-mode-toggle');
darkModeToggle.addEventListener('click', function() {
html.classList.toggle('dark');
var isDarkModeEnabled = html.classList.contains('dark');
localStorage.setItem('dark-mode', isDarkModeEnabled);
darkModeToggle.setAttribute('aria-checked', isDarkModeEnabled)
});
if (localStorage.getItem('dark-mode') === 'true') {
html.classList.add('dark');
}
// Check if css var() is supported and enable dark mode toggle
if (window.CSS && CSS.supports('color', 'var(--fake-var)')) {
darkModeToggle.style.visibility = 'unset';
}
}
function setupSearch() {
var searchInput = document.getElementById('search');
searchInput.addEventListener('input', function(e) {
var searchValue = e.target.value.toLowerCase();
var menuItems = document.querySelectorAll('.content > ul > li');
for (var i = 0; i < menuItems.length; i++) {
var menuItem = menuItems[i];
var links = menuItem.querySelectorAll('a');
var hasResult = false;
for (var li = 0; li < links.length; li++) {
var link = links[li];
if (!searchValue || link.text.toLowerCase().indexOf(searchValue) !== -1) {
hasResult = true;
}
if (li > 0) {
if (!searchValue || link.text.toLowerCase().indexOf(searchValue) !== -1) {
link.style.display = '';
} else {
link.style.display = 'none';
}
}
}
menuItem.style.display = !searchValue || hasResult ? '' : 'none';
}
});
}
function setupCollapse() {
var dropdownArrows = document.querySelectorAll('.dropdown-arrow');
for (var i = 0; i < dropdownArrows.length; i++) {
var dropdownArrow = dropdownArrows[i];
dropdownArrow.addEventListener('click', function(e) {
var parent = e.target.parentElement.parentElement.parentElement;
parent.classList.toggle('open');
});
}
}

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" class="light-icon" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z"/></svg>

After

Width:  |  Height:  |  Size: 499 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>

After

Width:  |  Height:  |  Size: 350 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" id="toggle-menu" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>

After

Width:  |  Height:  |  Size: 201 B

171
cmd/tools/vdoc-resources/normalize.css vendored Normal file
View File

@@ -0,0 +1,171 @@
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
html {
line-height: 1.15;
-webkit-text-size-adjust: 100%;
}
main {
display: block;
}
h1 {
font-size: 2em;
margin: 0.67em 0;
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
pre {
font-family: monospace, monospace;
font-size: 1em;
}
a {
background-color: transparent;
}
abbr[title] {
border-bottom: none;
text-decoration: underline;
text-decoration: underline dotted;
}
b,
strong {
font-weight: bolder;
}
kbd,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
small {
font-size: 80%;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
img {
border-style: none;
}
button,
input,
optgroup,
select,
textarea {
font-family: inherit;
font-size: 100%;
line-height: 1.15;
margin: 0;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
fieldset {
padding: 0.35em 0.75em 0.625em;
}
legend {
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal;
}
progress {
vertical-align: baseline;
}
textarea {
overflow: auto;
}
[type="checkbox"],
[type="radio"] {
box-sizing: border-box;
padding: 0;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
-webkit-appearance: textfield;
outline-offset: -2px;
}
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit;
}
summary {
display: list-item;
}
template {
display: none;
}
[hidden] {
display: none;
}

1064
cmd/tools/vdoc.v Normal file

File diff suppressed because it is too large Load Diff

286
cmd/tools/vdoctor.v Normal file
View File

@@ -0,0 +1,286 @@
import os
import time
import v.util
import runtime
struct App {
mut:
report_lines []string
cached_cpuinfo map[string]string
}
fn (mut a App) println(s string) {
a.report_lines << s
}
fn (mut a App) collect_info() {
mut os_kind := os.user_os()
mut arch_details := []string{}
arch_details << '$runtime.nr_cpus() cpus'
if runtime.is_32bit() {
arch_details << '32bit'
}
if runtime.is_64bit() {
arch_details << '64bit'
}
if runtime.is_big_endian() {
arch_details << 'big endian'
}
if runtime.is_little_endian() {
arch_details << 'little endian'
}
if os_kind == 'macos' {
arch_details << a.cmd({
command: 'sysctl -n machdep.cpu.brand_string'
})
}
if os_kind == 'linux' {
info := a.cpu_info()
mut cpu_details := ''
if cpu_details == '' {
cpu_details = info['model name']
}
if cpu_details == '' {
cpu_details = info['hardware']
}
if cpu_details == '' {
cpu_details = os.uname().machine
}
arch_details << cpu_details
}
if os_kind == 'windows' {
arch_details << a.cmd({
command: 'wmic cpu get name /format:table'
line: 1
})
}
//
mut os_details := ''
wsl_check := a.cmd({
command: 'cat /proc/sys/kernel/osrelease'
})
if os_kind == 'linux' {
os_details = a.get_linux_os_name()
info := a.cpu_info()
if 'hypervisor' in info['flags'] {
if 'microsoft' in wsl_check {
// WSL 2 is a Managed VM and Full Linux Kernel
// See https://docs.microsoft.com/en-us/windows/wsl/compare-versions
os_details += ' (WSL 2)'
} else {
os_details += ' (VM)'
}
}
// WSL 1 is NOT a Managed VM and Full Linux Kernel
// See https://docs.microsoft.com/en-us/windows/wsl/compare-versions
if 'Microsoft' in wsl_check {
os_details += ' (WSL)'
}
// From https://unix.stackexchange.com/a/14346
if a.cmd(command: '[ "$(awk \'\$5=="/" {print \$1}\' </proc/1/mountinfo)" != "$(awk \'\$5=="/" {print \$1}\' </proc/$$/mountinfo)" ] ; echo \$?') == '0' {
os_details += ' (chroot)'
}
} else if os_kind == 'macos' {
mut details := []string{}
details << a.cmd({
command: 'sw_vers -productName'
})
details << a.cmd({
command: 'sw_vers -productVersion'
})
details << a.cmd({
command: 'sw_vers -buildVersion'
})
os_details = details.join(', ')
} else if os_kind == 'windows' {
wmic_info := a.cmd({
command: 'wmic os get * /format:value'
line: -1
})
p := a.parse(wmic_info, '=')
caption, build_number, os_arch := p['caption'], p['buildnumber'], p['osarchitecture']
os_details = '$caption v$build_number $os_arch'
} else {
ouname := os.uname()
os_details = '$ouname.release, $ouname.version'
}
a.line('OS', '$os_kind, $os_details')
a.line('Processor', arch_details.join(', '))
a.line('CC version', a.cmd({
command: 'cc --version'
}))
a.println('')
a.line('getwd', os.getwd())
vexe := os.getenv('VEXE')
vroot := os.dir(vexe)
os.chdir(vroot)
a.line('vroot', vroot)
a.line('vexe', vexe)
a.line('vexe mtime', time.unix(os.file_last_mod_unix(vexe)).str())
is_writable_vroot := os.is_writable_folder(vroot) or {
false
}
a.line('is vroot writable', is_writable_vroot.str())
a.line('V full version', util.full_v_version(true))
vtmp := os.getenv('VTMP')
if vtmp != '' {
a.line('env VTMP', '"$vtmp"')
}
vflags := os.getenv('VFLAGS')
if vflags != '' {
a.line('env VFLAGS', '"$vflags"')
}
a.println('')
a.line('Git version', a.cmd({
command: 'git --version'
}))
a.line('Git vroot status', a.git_info())
a.line('.git/config present', os.is_file('.git/config').str())
//
a.report_tcc_version('thirdparty/tcc')
}
struct CmdConfig {
line int
command string
}
fn (mut a App) cmd(c CmdConfig) string {
x := os.exec(c.command) or {
return 'N/A'
}
if x.exit_code == 0 {
if c.line < 0 {
return x.output
}
output := x.output.split_into_lines()
if output.len > 0 && output.len > c.line {
return output[c.line]
}
}
return 'Error: $x.output'
}
fn (mut a App) line(label string, value string) {
a.println('$label: ${util.bold(value)}')
}
fn (app &App) parse(config string, sep string) map[string]string {
mut m := map[string]string{}
for line in config.split_into_lines() {
sline := line.trim_space()
if sline.len == 0 || sline[0] == `#` {
continue
}
x := sline.split(sep)
if x.len < 2 {
continue
}
m[x[0].trim_space().to_lower()] = x[1].trim_space().trim('"')
}
return m
}
fn (mut a App) get_linux_os_name() string {
mut os_details := ''
linux_os_methods := ['os-release', 'lsb_release', 'kernel', 'uname']
for m in linux_os_methods {
match m {
'os-release' {
if !os.is_file('/etc/os-release') {
continue
}
lines := os.read_file('/etc/os-release') or {
continue
}
vals := a.parse(lines, '=')
if vals['PRETTY_NAME'] == '' {
continue
}
os_details = vals['PRETTY_NAME']
break
}
'lsb_release' {
exists := a.cmd({
command: 'type lsb_release'
})
if exists.starts_with('Error') {
continue
}
os_details = a.cmd({
command: 'lsb_release -d -s'
})
break
}
'kernel' {
if !os.is_file('/proc/version') {
continue
}
os_details = a.cmd({
command: 'cat /proc/version'
})
break
}
'uname' {
ouname := os.uname()
os_details = '$ouname.release, $ouname.version'
break
}
else {}
}
}
return os_details
}
fn (mut a App) cpu_info() map[string]string {
if a.cached_cpuinfo.len > 0 {
return a.cached_cpuinfo
}
info := os.exec('cat /proc/cpuinfo') or {
return a.cached_cpuinfo
}
vals := a.parse(info.output, ':')
a.cached_cpuinfo = vals
return vals
}
fn (mut a App) git_info() string {
mut out := a.cmd({
command: 'git -C . describe --abbrev=8 --dirty --always --tags'
}).trim_space()
os.exec('git -C . remote add V_REPO https://github.com/vlang/v') or { } // ignore failure (i.e. remote exists)
os.exec('git -C . fetch V_REPO') or { }
commit_count := a.cmd({
command: 'git rev-list @{0}...V_REPO/master --right-only --count'
}).int()
if commit_count > 0 {
out += ' ($commit_count commit(s) behind V master)'
}
return out
}
fn (mut a App) report_tcc_version(tccfolder string) {
if !os.is_file(os.join_path(tccfolder, '.git', 'config')) {
a.line(tccfolder, 'N/A')
return
}
tcc_branch_name := a.cmd({
command: 'git -C $tccfolder rev-parse --abbrev-ref HEAD'
})
tcc_commit := a.cmd({
command: 'git -C $tccfolder describe --abbrev=8 --dirty --always --tags'
})
a.line('$tccfolder status', '$tcc_branch_name $tcc_commit')
}
fn (mut a App) report_info() {
for x in a.report_lines {
println(x)
}
}
fn main() {
mut app := App{}
app.collect_info()
app.report_info()
}

344
cmd/tools/vfmt.v Normal file
View File

@@ -0,0 +1,344 @@
// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
module main
import os
import os.cmdline
import rand
import v.ast
import v.pref
import v.fmt
import v.util
import v.parser
import v.table
import vhelp
struct FormatOptions {
is_l bool
is_c bool // NB: This refers to the '-c' fmt flag, NOT the C backend
is_w bool
is_diff bool
is_verbose bool
is_all bool
is_worker bool
is_debug bool
is_noerror bool
is_verify bool // exit(1) if the file is not vfmt'ed
}
const (
formatted_file_token = '\@\@\@' + 'FORMATTED_FILE: '
platform_and_file_extensions = [
['windows', '_windows.v'],
['linux', '_lin.v', '_linux.v', '_nix.v'],
['macos', '_mac.v', '_darwin.v'],
['freebsd', '_bsd.v', '_freebsd.v'],
['netbsd', '_bsd.v', '_netbsd.v'],
['openbsd', '_bsd.v', '_openbsd.v'],
['solaris', '_solaris.v'],
['haiku', '_haiku.v'],
['qnx', '_qnx.v'],
]
)
fn main() {
// if os.getenv('VFMT_ENABLE') == '' {
// eprintln('v fmt is disabled for now')
// exit(1)
// }
toolexe := os.executable()
util.set_vroot_folder(os.dir(os.dir(os.dir(toolexe))))
args := util.join_env_vflags_and_os_args()
foptions := FormatOptions{
is_c: '-c' in args
is_l: '-l' in args
is_w: '-w' in args
is_diff: '-diff' in args
is_verbose: '-verbose' in args || '--verbose' in args
is_all: '-all' in args || '--all' in args
is_worker: '-worker' in args
is_debug: '-debug' in args
is_noerror: '-noerror' in args
is_verify: '-verify' in args
}
if foptions.is_verbose {
eprintln('vfmt foptions: $foptions')
}
if foptions.is_worker {
// -worker should be added by a parent vfmt process.
// We launch a sub process for each file because
// the v compiler can do an early exit if it detects
// a syntax error, but we want to process ALL passed
// files if possible.
foptions.format_file(cmdline.option(args, '-worker', ''))
exit(0)
}
// we are NOT a worker at this stage, i.e. we are a parent vfmt process
possible_files := cmdline.only_non_options(cmdline.options_after(args, ['fmt']))
if foptions.is_verbose {
eprintln('vfmt toolexe: $toolexe')
eprintln('vfmt args: ' + os.args.str())
eprintln('vfmt env_vflags_and_os_args: ' + args.str())
eprintln('vfmt possible_files: ' + possible_files.str())
}
mut files := []string{}
for file in possible_files {
if os.is_dir(file) {
files << os.walk_ext(file, '.v')
files << os.walk_ext(file, '.vsh')
continue
}
if !file.ends_with('.v') && !file.ends_with('.vv') && !file.ends_with('.vsh') {
verror('v fmt can only be used on .v files.\nOffending file: "$file"')
continue
}
if !os.exists(file) {
verror('"$file" does not exist')
continue
}
files << file
}
if files.len == 0 {
vhelp.show_topic('fmt')
exit(0)
}
mut cli_args_no_files := []string{}
for a in os.args {
if a !in files {
cli_args_no_files << a
}
}
mut errors := 0
for file in files {
fpath := os.real_path(file)
mut worker_command_array := cli_args_no_files.clone()
worker_command_array << ['-worker', util.quote_path(fpath)]
worker_cmd := worker_command_array.join(' ')
if foptions.is_verbose {
eprintln('vfmt worker_cmd: $worker_cmd')
}
worker_result := os.exec(worker_cmd) or {
errors++
continue
}
if worker_result.exit_code != 0 {
eprintln(worker_result.output)
if worker_result.exit_code == 1 {
eprintln('vfmt error while formatting file: $file .')
}
errors++
continue
}
if worker_result.output.len > 0 {
if worker_result.output.contains(formatted_file_token) {
wresult := worker_result.output.split(formatted_file_token)
formatted_warn_errs := wresult[0]
formatted_file_path := wresult[1].trim_right('\n\r')
foptions.post_process_file(fpath, formatted_file_path)
if formatted_warn_errs.len > 0 {
eprintln(formatted_warn_errs)
}
continue
}
}
errors++
}
if errors > 0 {
eprintln('Encountered a total of: $errors errors.')
if foptions.is_noerror {
exit(0)
}
exit(1)
}
}
fn (foptions &FormatOptions) format_file(file string) {
mut prefs := pref.new_preferences()
prefs.is_fmt = true
if foptions.is_verbose {
eprintln('vfmt2 running fmt.fmt over file: $file')
}
table := table.new_table()
// checker := checker.new_checker(table, prefs)
file_ast := parser.parse_file(file, table, .parse_comments, prefs, &ast.Scope{
parent: 0
})
// checker.check(file_ast)
formatted_content := fmt.fmt(file_ast, table, foptions.is_debug)
file_name := os.file_name(file)
ulid := rand.ulid()
vfmt_output_path := os.join_path(os.temp_dir(), 'vfmt_${ulid}_$file_name')
os.write_file(vfmt_output_path, formatted_content)
if foptions.is_verbose {
eprintln('fmt.fmt worked and $formatted_content.len bytes were written to $vfmt_output_path .')
}
eprintln('$formatted_file_token$vfmt_output_path')
}
fn print_compiler_options(compiler_params &pref.Preferences) {
eprintln(' os: ' + compiler_params.os.str())
eprintln(' ccompiler: $compiler_params.ccompiler')
eprintln(' path: $compiler_params.path ')
eprintln(' out_name: $compiler_params.out_name ')
eprintln(' vroot: $compiler_params.vroot ')
eprintln('lookup_path: $compiler_params.lookup_path ')
eprintln(' out_name: $compiler_params.out_name ')
eprintln(' cflags: $compiler_params.cflags ')
eprintln(' is_test: $compiler_params.is_test ')
eprintln(' is_script: $compiler_params.is_script ')
}
fn (foptions &FormatOptions) post_process_file(file string, formatted_file_path string) {
if formatted_file_path.len == 0 {
return
}
if foptions.is_diff {
diff_cmd := util.find_working_diff_command() or {
eprintln(err)
return
}
if foptions.is_verbose {
eprintln('Using diff command: $diff_cmd')
}
println(util.color_compare_files(diff_cmd, file, formatted_file_path))
return
}
if foptions.is_verify {
diff_cmd := util.find_working_diff_command() or {
eprintln(err)
return
}
x := util.color_compare_files(diff_cmd, file, formatted_file_path)
if x.len != 0 {
println("$file is not vfmt'ed")
exit(1)
}
return
}
fc := os.read_file(file) or {
eprintln('File $file could not be read')
return
}
formatted_fc := os.read_file(formatted_file_path) or {
eprintln('File $formatted_file_path could not be read')
return
}
is_formatted_different := fc != formatted_fc
if foptions.is_c {
if is_formatted_different {
eprintln('File is not formatted: $file')
exit(2)
}
return
}
if foptions.is_l {
if is_formatted_different {
eprintln('File needs formatting: $file')
}
return
}
if foptions.is_w {
if is_formatted_different {
os.mv_by_cp(formatted_file_path, file) or {
panic(err)
}
eprintln('Reformatted file: $file')
} else {
eprintln('Already formatted file: $file')
}
return
}
print(formatted_fc)
}
fn (f FormatOptions) str() string {
return 'FormatOptions{ is_l: $f.is_l, is_w: $f.is_w, is_diff: $f.is_diff, is_verbose: $f.is_verbose,' +
' is_all: $f.is_all, is_worker: $f.is_worker, is_debug: $f.is_debug, is_noerror: $f.is_noerror,' +
' is_verify: $f.is_verify" }'
}
fn file_to_target_os(file string) string {
for extensions in platform_and_file_extensions {
for ext in extensions {
if file.ends_with(ext) {
return extensions[0]
}
}
}
return ''
}
fn file_to_mod_name_and_is_module_file(file string) (string, bool) {
mut mod_name := 'main'
mut is_module_file := false
flines := read_source_lines(file) or {
return mod_name, is_module_file
}
for fline in flines {
line := fline.trim_space()
if line.starts_with('module ') {
if !line.starts_with('module main') {
is_module_file = true
mod_name = line.replace('module ', ' ').trim_space()
}
break
}
}
return mod_name, is_module_file
}
fn read_source_lines(file string) ?[]string {
source_lines := os.read_lines(file) or {
return error('can not read $file')
}
return source_lines
}
fn get_compile_name_of_potential_v_project(file string) string {
// This function get_compile_name_of_potential_v_project returns:
// a) the file's folder, if file is part of a v project
// b) the file itself, if the file is a standalone v program
pfolder := os.real_path(os.dir(file))
// a .v project has many 'module main' files in one folder
// if there is only one .v file, then it must be a standalone
all_files_in_pfolder := os.ls(pfolder) or {
panic(err)
}
mut vfiles := []string{}
for f in all_files_in_pfolder {
vf := os.join_path(pfolder, f)
if f.starts_with('.') || !f.ends_with('.v') || os.is_dir(vf) {
continue
}
vfiles << vf
}
if vfiles.len == 1 {
return file
}
// /////////////////////////////////////////////////////////////
// At this point, we know there are many .v files in the folder
// We will have to read them all, and if there are more than one
// containing `fn main` then the folder contains multiple standalone
// v programs. If only one contains `fn main` then the folder is
// a project folder, that should be compiled with `v pfolder`.
mut main_fns := 0
for f in vfiles {
slines := read_source_lines(f) or {
panic(err)
}
for line in slines {
if line.contains('fn main()') {
main_fns++
if main_fns > 1 {
return file
}
}
}
}
return pfolder
}
fn verror(s string) {
util.verror('vfmt error', s)
}

601
cmd/tools/vpm.v Normal file
View File

@@ -0,0 +1,601 @@
// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
module main
import os
import os.cmdline
import net.http
import json
import vhelp
import v.vmod
const (
default_vpm_server_urls = ['https://vpm.vlang.io']
valid_vpm_commands = ['help', 'search', 'install', 'update', 'upgrade', 'outdated',
'list', 'remove']
excluded_dirs = ['cache', 'vlib']
supported_vcs_systems = ['git', 'hg']
supported_vcs_folders = ['.git', '.hg']
supported_vcs_update_cmds = {
'git': 'git pull'
'hg': 'hg pull --update'
}
supported_vcs_install_cmds = {
'git': 'git clone --depth=1'
'hg': 'hg clone'
}
supported_vcs_outdated_steps = {
'git': ['git fetch', 'git rev-parse @', 'git rev-parse @{u}']
'hg': ['hg incoming']
}
)
struct Mod {
id int
name string
url string
nr_downloads int
vcs string
}
struct Vmod {
mut:
name string
version string
deps []string
}
fn main() {
init_settings()
// This tool is intended to be launched by the v frontend,
// which provides the path to V inside os.getenv('VEXE')
args := os.args // args are: vpm [options] SUBCOMMAND module names
params := cmdline.only_non_options(args[1..])
verbose_println('cli params: $params')
if params.len < 1 {
vpm_help()
exit(5)
}
vpm_command := params[0]
mut module_names := params[1..]
ensure_vmodules_dir_exist()
// println('module names: ') println(module_names)
match vpm_command {
'help' {
vpm_help()
}
'search' {
vpm_search(module_names)
}
'install' {
if module_names.len == 0 && os.exists('./v.mod') {
println('Detected v.mod file inside the project directory. Using it...')
manifest := vmod.from_file('./v.mod') or {
panic(err)
}
module_names = manifest.dependencies
}
vpm_install(module_names)
}
'update' {
vpm_update(module_names)
}
'upgrade' {
vpm_upgrade()
}
'outdated' {
vpm_outdated()
}
'list' {
vpm_list()
}
'remove' {
vpm_remove(module_names)
}
else {
println('Error: you tried to run "v $vpm_command"')
println('... but the v package management tool vpm only knows about these commands:')
for validcmd in valid_vpm_commands {
println(' v $validcmd')
}
exit(3)
}
}
}
fn vpm_search(keywords []string) {
search_keys := keywords.map(it.replace('_', '-'))
if settings.is_help {
vhelp.show_topic('search')
exit(0)
}
if search_keys.len == 0 {
println(' v search requires *at least one* keyword')
exit(2)
}
modules := get_all_modules()
installed_modules := get_installed_modules()
joined := search_keys.join(', ')
mut index := 0
for mod in modules {
// TODO for some reason .filter results in substr error, so do it manually
for k in search_keys {
if !mod.contains(k) {
continue
}
if index == 0 {
println('Search results for "$joined":\n')
}
index++
mut parts := mod.split('.')
// in case the author isn't present
if parts.len == 1 {
parts << parts[0]
parts[0] = ' '
} else {
parts[0] = ' by ${parts[0]} '
}
installed := if mod in installed_modules { ' (installed)' } else { '' }
println('${index}. ${parts[1]}${parts[0]}[$mod]$installed')
break
}
}
if index == 0 {
vexe := os.getenv('VEXE')
vroot := os.real_path(os.dir(vexe))
mut messages := ['No module(s) found for `$joined` .']
for vlibmod in search_keys {
if os.is_dir(os.join_path(vroot, 'vlib', vlibmod)) {
messages << 'There is already an existing "$vlibmod" module in vlib, so you can just `import $vlibmod` .'
}
}
for m in messages {
println(m)
}
} else {
println('\nUse "v install author_name.module_name" to install the module.')
}
}
fn vpm_install(module_names []string) {
if settings.is_help {
vhelp.show_topic('install')
exit(0)
}
if module_names.len == 0 {
println(' v install requires *at least one* module name')
exit(2)
}
mut errors := 0
for n in module_names {
name := n.trim_space().replace('_', '-')
mod := get_module_meta_info(name) or {
errors++
println('Errors while retrieving meta data for module $name:')
println(err)
continue
}
mut vcs := mod.vcs
if vcs == '' {
vcs = supported_vcs_systems[0]
}
if vcs !in supported_vcs_systems {
errors++
println('Skipping module "$name", since it uses an unsupported VCS {$vcs} .')
continue
}
mod_name_as_path := mod.name.replace('.', os.path_separator).replace('-', '_').to_lower()
final_module_path := os.real_path(os.join_path(settings.vmodules_path, mod_name_as_path))
if os.exists(final_module_path) {
vpm_update([name])
continue
}
println('Installing module "$name" from $mod.url to $final_module_path ...')
vcs_install_cmd := supported_vcs_install_cmds[vcs]
cmd := '$vcs_install_cmd "$mod.url" "$final_module_path"'
verbose_println(' command: $cmd')
cmdres := os.exec(cmd) or {
errors++
println('Could not install module "$name" to "$final_module_path" .')
verbose_println('Error command: $cmd')
verbose_println('Error details: $err')
continue
}
if cmdres.exit_code != 0 {
errors++
println('Failed installing module "$name" to "$final_module_path" .')
verbose_println('Failed command: $cmd')
verbose_println('Failed command output:\n$cmdres.output')
continue
}
resolve_dependencies(name, final_module_path, module_names)
}
if errors > 0 {
exit(1)
}
}
fn vpm_update(m []string) {
mut module_names := m
if settings.is_help {
vhelp.show_topic('update')
exit(0)
}
if module_names.len == 0 {
module_names = get_installed_modules()
}
mut errors := 0
for name in module_names {
final_module_path := valid_final_path_of_existing_module(name) or {
continue
}
os.chdir(final_module_path)
println('Updating module "$name"...')
verbose_println(' work folder: $final_module_path')
vcs := vcs_used_in_dir(final_module_path) or {
continue
}
vcs_cmd := supported_vcs_update_cmds[vcs[0]]
verbose_println(' command: $vcs_cmd')
vcs_res := os.exec('$vcs_cmd') or {
errors++
println('Could not update module "$name".')
verbose_println('Error command: $vcs_cmd')
verbose_println('Error details:\n$err')
continue
}
if vcs_res.exit_code != 0 {
errors++
println('Failed updating module "$name".')
verbose_println('Failed command: $vcs_cmd')
verbose_println('Failed details:\n$vcs_res.output')
continue
} else {
verbose_println(' $vcs_res.output.trim_space()')
}
resolve_dependencies(name, final_module_path, module_names)
}
if errors > 0 {
exit(1)
}
}
fn get_outdated() ?[]string {
module_names := get_installed_modules()
mut outdated := []string{}
for name in module_names {
final_module_path := valid_final_path_of_existing_module(name) or {
continue
}
os.chdir(final_module_path)
vcs := vcs_used_in_dir(final_module_path) or {
continue
}
vcs_cmd_steps := supported_vcs_outdated_steps[vcs[0]]
mut outputs := []string{}
for step in vcs_cmd_steps {
res := os.exec(step) or {
verbose_println('Error command: $step')
verbose_println('Error details:\n$err')
return error('Error while checking latest commits for "$name".')
}
if vcs[0] == 'hg' {
if res.exit_code == 1 {
outdated << name
}
} else {
outputs << res.output
}
}
if vcs[0] == 'git' && outputs[1] != outputs[2] {
outdated << name
}
}
return outdated
}
fn vpm_upgrade() {
outdated := get_outdated() or {
exit(1)
}
if outdated.len > 0 {
vpm_update(outdated)
} else {
println('Modules are up to date.')
}
}
fn vpm_outdated() {
outdated := get_outdated() or {
exit(1)
}
if outdated.len > 0 {
println('Outdated modules:')
for m in outdated {
println(' $m')
}
} else {
println('Modules are up to date.')
}
}
fn vpm_list() {
module_names := get_installed_modules()
if module_names.len == 0 {
println('You have no modules installed.')
exit(0)
}
println('Installed modules:')
for mod in module_names {
println(' $mod')
}
}
fn vpm_remove(module_names []string) {
if settings.is_help {
vhelp.show_topic('remove')
exit(0)
}
if module_names.len == 0 {
println(' v update requires *at least one* module name')
exit(2)
}
for name in module_names {
final_module_path := valid_final_path_of_existing_module(name) or {
continue
}
println('Removing module "$name"...')
verbose_println('removing folder $final_module_path')
os.rmdir_all(final_module_path)
// delete author directory if it is empty
author := name.split('.')[0]
author_dir := os.real_path(os.join_path(settings.vmodules_path, author))
if os.is_dir_empty(author_dir) {
verbose_println('removing author folder $author_dir')
os.rmdir(author_dir)
}
}
}
fn valid_final_path_of_existing_module(name string) ?string {
mod_name_as_path := name.replace('.', os.path_separator).replace('-', '_').to_lower()
name_of_vmodules_folder := os.join_path(settings.vmodules_path, mod_name_as_path)
final_module_path := os.real_path(name_of_vmodules_folder)
if !os.exists(final_module_path) {
println('No module with name "$name" exists at $name_of_vmodules_folder')
return none
}
if !os.is_dir(final_module_path) {
println('Skipping "$name_of_vmodules_folder", since it is not a folder.')
return none
}
vcs_used_in_dir(final_module_path) or {
println('Skipping "$name_of_vmodules_folder", since it does not use a supported vcs.')
return none
}
return final_module_path
}
fn ensure_vmodules_dir_exist() {
if !os.is_dir(settings.vmodules_path) {
println('Creating $settings.vmodules_path/ ...')
os.mkdir(settings.vmodules_path) or {
panic(err)
}
}
}
fn vpm_help() {
vhelp.show_topic('vpm')
}
fn vcs_used_in_dir(dir string) ?[]string {
mut vcs := []string{}
for repo_subfolder in supported_vcs_folders {
checked_folder := os.real_path(os.join_path(dir, repo_subfolder))
if os.is_dir(checked_folder) {
vcs << repo_subfolder.replace('.', '')
}
}
if vcs.len == 0 {
return none
}
return vcs
}
fn get_installed_modules() []string {
dirs := os.ls(settings.vmodules_path) or {
return []
}
mut modules := []string{}
for dir in dirs {
adir := os.join_path(settings.vmodules_path, dir)
if dir in excluded_dirs || !os.is_dir(adir) {
continue
}
if os.exists(os.join_path(adir, 'v.mod')) && os.exists(os.join_path(adir, '.git', 'config')) {
// an official vlang module with a short module name, like `vsl`, `ui` or `markdown`
modules << dir
continue
}
author := dir
mods := os.ls(adir) or {
continue
}
for m in mods {
vcs_used_in_dir(os.join_path(adir, m)) or {
continue
}
modules << '${author}.$m'
}
}
return modules
}
fn get_all_modules() []string {
url := get_working_server_url()
r := http.get(url) or {
panic(err)
}
if r.status_code != 200 {
println('Failed to search vpm.vlang.io. Status code: $r.status_code')
exit(1)
}
s := r.text
mut read_len := 0
mut modules := []string{}
for read_len < s.len {
mut start_token := '<a href="/mod'
end_token := '</a>'
// get the start index of the module entry
mut start_index := s.index_after(start_token, read_len)
if start_index == -1 {
break
}
// get the index of the end of anchor (a) opening tag
// we use the previous start_index to make sure we are getting a module and not just a random 'a' tag
start_token = '">'
start_index = s.index_after(start_token, start_index) + start_token.len
// get the index of the end of module entry
end_index := s.index_after(end_token, start_index)
if end_index == -1 {
break
}
modules << s[start_index..end_index]
read_len = end_index
if read_len >= s.len {
break
}
}
return modules
}
fn resolve_dependencies(name string, module_path string, module_names []string) {
vmod_path := os.join_path(module_path, 'v.mod')
if !os.exists(vmod_path) {
return
}
data := os.read_file(vmod_path) or {
return
}
vmod := parse_vmod(data)
mut deps := []string{}
// filter out dependencies that were already specified by the user
for d in vmod.deps {
if d !in module_names {
deps << d
}
}
if deps.len > 0 {
println('Resolving $deps.len dependencies for module "$name"...')
verbose_println('Found dependencies: $deps')
vpm_install(deps)
}
}
fn parse_vmod(data string) Vmod {
keys := ['name', 'version', 'deps']
mut m := {
'name': ''
'version': ''
'deps': ''
}
for key in keys {
mut key_index := data.index('$key:') or {
continue
}
key_index += key.len + 1
m[key] = data[key_index..data.index_after('\n', key_index)].trim_space().replace("'",
'').replace('[', '').replace(']', '')
}
mut vmod := Vmod{}
vmod.name = m['name']
vmod.version = m['version']
if m['deps'].len > 0 {
vmod.deps = m['deps'].split(',')
}
return vmod
}
fn get_working_server_url() string {
server_urls := if settings.server_urls.len > 0 { settings.server_urls } else { default_vpm_server_urls }
for url in server_urls {
verbose_println('Trying server url: $url')
http.head(url) or {
verbose_println(' $url failed.')
continue
}
return url
}
panic('No responding vpm server found. Please check your network connectivity and try again later.')
}
// settings context:
struct VpmSettings {
mut:
is_help bool
is_verbose bool
server_urls []string
vmodules_path string
}
const (
settings = &VpmSettings{}
)
fn init_settings() {
mut s := &VpmSettings(0)
unsafe {
s = settings
}
s.is_help = '-h' in os.args || '--help' in os.args || 'help' in os.args
s.is_verbose = '-v' in os.args
s.server_urls = cmdline.options(os.args, '-server-url')
s.vmodules_path = os.vmodules_dir()
}
fn verbose_println(s string) {
if settings.is_verbose {
println(s)
}
}
fn get_module_meta_info(name string) ?Mod {
mut errors := []string{}
for server_url in default_vpm_server_urls {
modurl := server_url + '/jsmod/$name'
verbose_println('Retrieving module metadata from: $modurl ...')
r := http.get(modurl) or {
errors << 'Http server did not respond to our request for ${modurl}.'
errors << 'Error details: $err'
continue
}
if r.status_code == 404 || r.text.contains('404') {
errors <<
'Skipping module "$name", since $server_url reported that "$name" does not exist.'
continue
}
if r.status_code != 200 {
errors <<
'Skipping module "$name", since $server_url responded with $r.status_code http status code. Please try again later.'
continue
}
s := r.text
if s.len > 0 && s[0] != `{` {
errors << 'Invalid json data'
errors << s.trim_space().limit(100) + '...'
continue
}
mod := json.decode(Mod, s) or {
errors << 'Skipping module "$name", since its information is not in json format.'
continue
}
if '' == mod.url || '' == mod.name {
errors << 'Skipping module "$name", since it is missing name or url information.'
continue
}
return mod
}
return error(errors.join_lines())
}

362
cmd/tools/vrepl.v Normal file
View File

@@ -0,0 +1,362 @@
// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
module main
import os
import term
import readline
import os.cmdline
import v.util
struct Repl {
mut:
indent int // indentation level
in_func bool // are we inside a new custom user function
line string // the current line entered by the user
//
modules []string // all the import modules
includes []string // all the #include statements
functions []string // all the user function declarations
functions_name []string // all the user function names
lines []string // all the other lines/statements
temp_lines []string // all the temporary expressions/printlns
}
const (
is_stdin_a_pipe = (is_atty(0) == 0)
)
fn new_repl() &Repl {
return &Repl{
modules: ['os', 'time', 'math']
}
}
fn (mut r Repl) checks() bool {
mut in_string := false
was_indent := r.indent > 0
for i := 0; i < r.line.len; i++ {
if r.line[i] == `\'` && (i == 0 || r.line[i - 1] != `\\`) {
in_string = !in_string
}
if r.line[i] == `{` && !in_string {
r.line = r.line[..i + 1] + '\n' + r.line[i + 1..]
i++
r.indent++
}
if r.line[i] == `}` && !in_string {
r.line = r.line[..i] + '\n' + r.line[i..]
i++
r.indent--
if r.indent == 0 {
r.in_func = false
}
}
if i + 2 < r.line.len && r.indent == 0 && r.line[i + 1] == `f` && r.line[i + 2] == `n` {
r.in_func = true
}
}
return r.in_func || (was_indent && r.indent <= 0) || r.indent > 0
}
fn (r &Repl) function_call(line string) bool {
for function in r.functions_name {
is_function_definition := line.replace(' ', '').starts_with('$function:=')
if line.starts_with(function) && !is_function_definition {
return true
}
}
return false
}
fn (r &Repl) current_source_code(should_add_temp_lines bool) string {
mut all_lines := []string{}
for mod in r.modules {
all_lines << 'import $mod\n'
}
all_lines << r.includes
all_lines << r.functions
all_lines << r.lines
if should_add_temp_lines {
all_lines << r.temp_lines
}
return all_lines.join('\n')
}
fn repl_help() {
println(util.full_v_version(false))
println('
|help Displays this information.
|list Show the program so far.
|reset Clears the accumulated program, so you can start a fresh.
|Ctrl-C, Ctrl-D, exit Exits the REPL.
|clear Clears the screen.
'.strip_margin())
}
fn run_repl(workdir string, vrepl_prefix string) {
if !is_stdin_a_pipe {
println(util.full_v_version(false))
println('Use Ctrl-C or `exit` to exit, or `help` to see other available commands')
}
file := os.join_path(workdir, '.${vrepl_prefix}vrepl.v')
temp_file := os.join_path(workdir, '.${vrepl_prefix}vrepl_temp.v')
mut prompt := '>>> '
defer {
if !is_stdin_a_pipe {
println('')
}
os.rm(file)
os.rm(temp_file)
$if windows {
os.rm(file[..file.len - 2] + '.exe')
os.rm(temp_file[..temp_file.len - 2] + '.exe')
$if msvc {
os.rm(file[..file.len - 2] + '.ilk')
os.rm(file[..file.len - 2] + '.pdb')
os.rm(temp_file[..temp_file.len - 2] + '.ilk')
os.rm(temp_file[..temp_file.len - 2] + '.pdb')
}
} $else {
os.rm(file[..file.len - 2])
os.rm(temp_file[..temp_file.len - 2])
}
}
mut r := new_repl()
vexe := os.getenv('VEXE')
for {
if r.indent == 0 {
prompt = '>>> '
} else {
prompt = '... '
}
oline := r.get_one_line(prompt) or {
break
}
line := oline.trim_space()
if line == '' && oline.ends_with('\n') {
continue
}
if line.len <= -1 || line == '' || line == 'exit' {
break
}
r.line = line
if r.line == '\n' {
continue
}
if r.line == 'clear' {
term.erase_display('2')
continue
}
if r.line == 'help' {
repl_help()
continue
}
if r.line.contains(':=') && r.line.contains('fn(') {
r.in_func = true
r.functions_name << r.line.all_before(':= fn(').trim_space()
}
if r.line.starts_with('fn') {
r.in_func = true
r.functions_name << r.line.all_after('fn').all_before('(').trim_space()
}
was_func := r.in_func
if r.checks() {
for rline in r.line.split('\n') {
if r.in_func || was_func {
r.functions << rline
} else {
r.temp_lines << rline
}
}
if r.indent > 0 {
continue
}
r.line = ''
}
if r.line == 'debug_repl' {
eprintln('repl: $r')
continue
}
if r.line == 'reset' {
r = new_repl()
continue
}
if r.line == 'list' {
source_code := r.current_source_code(true)
println('//////////////////////////////////////////////////////////////////////////////////////')
println(source_code)
println('//////////////////////////////////////////////////////////////////////////////////////')
continue
}
// Save the source only if the user is printing something,
// but don't add this print call to the `lines` array,
// so that it doesn't get called during the next print.
if r.line.starts_with('=') {
r.line = 'println(' + r.line[1..] + ')'
}
if r.line.starts_with('print') {
source_code := r.current_source_code(false) + '\n$r.line\n'
os.write_file(file, source_code)
s := os.exec('"$vexe" -repl run "$file"') or {
rerror(err)
return
}
print_output(s)
} else {
mut temp_line := r.line
mut temp_flag := false
func_call := r.function_call(r.line)
filter_line := r.line.replace(r.line.find_between("\'", "\'"), '').replace(r.line.find_between('"',
'"'), '')
possible_statement_patterns := [
'=',
'++',
'--',
'<<',
'//',
'/*',
'fn ',
'pub ',
'mut ',
'enum ',
'const ',
'struct ',
'interface ',
'import ',
'#include ',
':=',
'for ',
'or ',
'insert',
'delete',
'prepend',
'sort',
'clear',
'trim',
]
mut is_statement := false
for pattern in possible_statement_patterns {
if filter_line.contains(pattern) {
is_statement = true
break
}
}
// NB: starting a line with 2 spaces escapes the println heuristic
if oline.starts_with(' ') {
is_statement = true
}
if !is_statement && !func_call && r.line != '' {
temp_line = 'println($r.line)'
temp_flag = true
}
mut temp_source_code := ''
if temp_line.starts_with('import ') {
mod := r.line.fields()[1]
if mod !in r.modules {
temp_source_code = '$temp_line\n' + r.current_source_code(false)
}
} else if temp_line.starts_with('#include ') {
temp_source_code = '$temp_line\n' + r.current_source_code(false)
} else {
for i, l in r.lines {
if (l.starts_with('for ') || l.starts_with('if ')) && l.contains('println') {
r.lines.delete(i)
break
}
}
temp_source_code = r.current_source_code(true) + '\n$temp_line\n'
}
os.write_file(temp_file, temp_source_code)
s := os.exec('"$vexe" -repl run "$temp_file"') or {
rerror(err)
return
}
if !func_call && s.exit_code == 0 && !temp_flag {
for r.temp_lines.len > 0 {
if !r.temp_lines[0].starts_with('print') {
r.lines << r.temp_lines[0]
}
r.temp_lines.delete(0)
}
if r.line.starts_with('import ') {
mod := r.line.fields()[1]
if mod !in r.modules {
r.modules << mod
}
} else if r.line.starts_with('#include ') {
r.includes << r.line
} else {
r.lines << r.line
}
} else {
for r.temp_lines.len > 0 {
r.temp_lines.delete(0)
}
}
print_output(s)
}
}
}
fn print_output(s os.Result) {
lines := s.output.trim_right('\n\r').split('\n')
for line in lines {
if line.contains('.vrepl_temp.v:') {
// Hide the temporary file name
sline := line.all_after('.vrepl_temp.v:')
idx := sline.index(' ') or {
println(sline)
return
}
println(sline[idx + 1..])
} else if line.contains('.vrepl.v:') {
// Ensure that .vrepl.v: is at the start, ignore the path
// This is needed to have stable .repl tests.
idx := line.index('.vrepl.v:') or {
return
}
println(line[idx..])
} else {
println(line)
}
}
}
fn main() {
// Support for the parameters replfolder and replprefix is needed
// so that the repl can be launched in parallel by several different
// threads by the REPL test runner.
args := cmdline.options_after(os.args, ['repl'])
replfolder := os.real_path(cmdline.option(args, '-replfolder', '.'))
replprefix := cmdline.option(args, '-replprefix', 'noprefix.')
os.chdir(replfolder)
if !os.exists(os.getenv('VEXE')) {
println('Usage:')
println(' VEXE=vexepath vrepl\n')
println(' ... where vexepath is the full path to the v executable file')
return
}
run_repl(replfolder, replprefix)
}
fn rerror(s string) {
println('V repl error: $s')
os.flush()
}
fn (mut r Repl) get_one_line(prompt string) ?string {
mut readline := readline.Readline{}
if is_stdin_a_pipe {
iline := os.get_raw_line()
if iline.len == 0 {
return none
}
return iline
}
rline := readline.read_line(prompt) or {
return none
}
return rline
}

51
cmd/tools/vself.v Normal file
View File

@@ -0,0 +1,51 @@
module main
import os
import os.cmdline
import v.pref
fn main() {
vexe := pref.vexe_path()
vroot := os.dir(vexe)
os.chdir(vroot)
os.setenv('VCOLORS', 'always', true)
self_idx := os.args.index('self')
args := os.args[1..self_idx]
jargs := args.join(' ')
obinary := cmdline.option(args, '-o', '')
sargs := if obinary != '' { jargs } else { '$jargs -o v2 ' }
cmd := '$vexe $sargs cmd/v'
options := if args.len > 0 { '($sargs)' } else { '' }
println('V self compiling ${options}...')
compile(vroot, cmd)
if obinary != '' {
// When -o was given, there is no need to backup/rename the original.
// The user just wants an independent copy of v, and so we are done.
return
}
backup_old_version_and_rename_newer()
}
fn compile(vroot string, cmd string) {
result := os.exec(cmd) or {
panic(err)
}
if result.exit_code != 0 {
eprintln('cannot compile to `$vroot`: \n$result.output')
exit(1)
}
if result.output.len > 0 {
println(result.output.trim_space())
}
}
fn backup_old_version_and_rename_newer() {
v_file := if os.user_os() == 'windows' { 'v.exe' } else { 'v' }
v2_file := if os.user_os() == 'windows' { 'v2.exe' } else { 'v2' }
bak_file := if os.user_os() == 'windows' { 'v_old.exe' } else { 'v_old' }
if os.exists(bak_file) {
os.rm(bak_file)
}
os.mv(v_file, bak_file)
os.mv(v2_file, v_file)
}

View File

@@ -0,0 +1,23 @@
module main
import os
import v.pref
fn main() {
$if windows {
println('Setup freetype...')
vroot := os.dir(pref.vexe_path())
os.chdir(vroot)
if os.is_dir('./thirdparty/freetype') {
println('Thirdparty "freetype" is already installed.')
} else {
s := os.exec('git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries ./thirdparty/freetype/') or {
panic(err)
}
println(s.output)
println('Thirdparty "freetype" installed successfully.')
}
} $else {
println('It is only for Windows to setup thirdparty "freetype".')
}
}

181
cmd/tools/vsymlink.v Normal file
View File

@@ -0,0 +1,181 @@
import os
import v.pref
$if windows {
$if tinyc {
#flag -lAdvapi32
#flag -lUser32
}
}
fn main() {
vexe := os.real_path(pref.vexe_path())
$if windows {
setup_symlink_windows(vexe)
} $else {
setup_symlink(vexe)
}
}
fn setup_symlink(vexe string) {
link_dir := '/usr/local/bin'
if !os.exists(link_dir) {
os.mkdir_all(link_dir)
}
mut link_path := link_dir + '/v'
mut ret := os.exec('ln -sf $vexe $link_path') or {
panic(err)
}
if ret.exit_code == 0 {
println('Symlink "$link_path" has been created')
} else if os.system("uname -o | grep -q \'[A/a]ndroid\'") == 0 {
println('Failed to create symlink "$link_path". Trying again with Termux path for Android.')
link_path = '/data/data/com.termux/files/usr/bin/v'
ret = os.exec('ln -sf $vexe $link_path') or {
panic(err)
}
if ret.exit_code == 0 {
println('Symlink "$link_path" has been created')
} else {
eprintln('Failed to create symlink "$link_path". Try again with sudo.')
}
} else {
eprintln('Failed to create symlink "$link_path". Try again with sudo.')
}
}
fn setup_symlink_windows(vexe string) {
$if windows {
// Create a symlink in a new local folder (.\.bin\.v.exe)
// Puts `v` in %PATH% without polluting it with anything else (like make.bat).
// This will make `v` available on cmd.exe, PowerShell, and MinGW(MSYS)/WSL/Cygwin
vdir := os.real_path(os.dir(vexe))
vsymlinkdir := os.join_path(vdir, '.bin')
mut vsymlink := os.join_path(vsymlinkdir, 'v.exe')
if !os.exists(vsymlinkdir) {
os.mkdir_all(vsymlinkdir) // will panic if fails
} else {
os.rm(vsymlink)
}
// First, try to create a native symlink at .\.bin\v.exe
os.symlink(vsymlink, vexe) or {
// typically only fails if you're on a network drive (VirtualBox)
// do batch file creation instead
eprintln('Could not create a native symlink: $err')
eprintln('Creating a batch file instead...')
vsymlink = os.join_path(vsymlinkdir, 'v.bat')
if os.exists(vsymlink) {
os.rm(vsymlink)
}
os.write_file(vsymlink, '@echo off\n$vexe %*')
eprintln('$vsymlink file written.')
}
if !os.exists(vsymlink) {
warn_and_exit('Could not create $vsymlink')
}
println('Symlink $vsymlink to $vexe created.')
println('Checking system %PATH%...')
reg_sys_env_handle := get_reg_sys_env_handle() or {
warn_and_exit(err)
return
}
// TODO: Fix defers inside ifs
// defer {
// C.RegCloseKey(reg_sys_env_handle)
// }
// if the above succeeded, and we cannot get the value, it may simply be empty
sys_env_path := get_reg_value(reg_sys_env_handle, 'Path') or {
''
}
current_sys_paths := sys_env_path.split(os.path_delimiter).map(it.trim('/$os.path_separator'))
mut new_paths := [vsymlinkdir]
for p in current_sys_paths {
if p == '' {
continue
}
if p !in new_paths {
new_paths << p
}
}
new_sys_env_path := new_paths.join(';')
if new_sys_env_path == sys_env_path {
println('System %PATH% was already configured.')
} else {
println('System %PATH% was not configured.')
println('Adding symlink directory to system %PATH%...')
set_reg_value(reg_sys_env_handle, 'Path', new_sys_env_path) or {
warn_and_exit(err)
C.RegCloseKey(reg_sys_env_handle)
return
}
println('done.')
}
println('Notifying running processes to update their Environment...')
send_setting_change_msg('Environment') or {
eprintln(err)
warn_and_exit('You might need to run this again to have the `v` command in your %PATH%')
C.RegCloseKey(reg_sys_env_handle)
return
}
C.RegCloseKey(reg_sys_env_handle)
println('')
println('Note: restart your shell/IDE to load the new %PATH%.')
println('After restarting your shell/IDE, give `v version` a try in another dir!')
}
}
fn warn_and_exit(err string) {
eprintln(err)
exit(1)
}
// get the system environment registry handle
fn get_reg_sys_env_handle() ?voidptr {
$if windows { // wrap for cross-compile compat
// open the registry key
reg_key_path := 'Environment'
reg_env_key := voidptr(0) // or HKEY (HANDLE)
if C.RegOpenKeyEx(os.hkey_current_user, reg_key_path.to_wide(), 0, 1 | 2, &reg_env_key) != 0 {
return error('Could not open "$reg_key_path" in the registry')
}
return reg_env_key
}
return error('not on windows')
}
// get a value from a given $key
fn get_reg_value(reg_env_key voidptr, key string) ?string {
$if windows {
// query the value (shortcut the sizing step)
reg_value_size := 4095 // this is the max length (not for the registry, but for the system %PATH%)
mut reg_value := &u16(malloc(reg_value_size))
if C.RegQueryValueEx(reg_env_key, key.to_wide(), 0, 0, reg_value, &reg_value_size) != 0 {
return error('Unable to get registry value for "$key", try rerunning as an Administrator')
}
return string_from_wide(reg_value)
}
return error('not on windows')
}
// sets the value for the given $key to the given $value
fn set_reg_value(reg_key voidptr, key string, value string) ?bool {
$if windows {
if C.RegSetValueEx(reg_key, key.to_wide(), 0, 1, value.to_wide(), 4095) != 0 {
return error('Unable to set registry value for "$key", are you running as an Administrator?')
}
return true
}
return error('not on windows')
}
// Broadcasts a message to all listening windows (explorer.exe in particular)
// letting them know that the system environment has changed and should be reloaded
fn send_setting_change_msg(message_data string) ?bool {
$if windows {
if C.SendMessageTimeout(os.hwnd_broadcast, os.wm_settingchange, 0, message_data.to_wide(), os.smto_abortifhung, 5000, 0) ==
0 {
return error('Could not broadcast WM_SETTINGCHANGE')
}
return true
}
return error('not on windows')
}

View File

@@ -0,0 +1,96 @@
module main
import os
import testing
import v.util
const (
vet_known_failing_exceptions = [
'nonexistent',
]
vet_folders = [
'vlib/sqlite',
'vlib/v',
'cmd/v',
'cmd/tools',
]
verify_known_failing_exceptions = [
'nonexistant',
]
vfmt_verify_list = [
'cmd/v/v.v',
'vlib/builtin/array.v',
'vlib/os/file.v',
'vlib/math/bits/bits.v',
'vlib/time/time.v',
'vlib/term/colors.v',
'vlib/term/term.v',
'vlib/v/ast/',
'vlib/v/builder/',
'vlib/v/cflag/',
'vlib/v/checker/',
'vlib/v/depgraph/',
'vlib/v/doc/',
'vlib/v/errors/',
'vlib/v/eval/',
'vlib/v/fmt/',
'vlib/v/gen/auto_str_methods.v',
'vlib/v/gen/cgen.v',
'vlib/v/gen/cgen_test.v',
'vlib/v/gen/cmain.v',
'vlib/v/gen/comptime.v',
'vlib/v/gen/fn.v',
'vlib/v/gen/json.v',
'vlib/v/gen/live.v',
'vlib/v/gen/profile.v',
'vlib/v/gen/sql.v',
'vlib/v/gen/str.v',
'vlib/v/gen/x64/elf.v',
'vlib/v/gen/x64/elf_obj.v',
'vlib/v/gen/x64/gen.v',
'vlib/v/parser/',
'vlib/v/pref/',
'vlib/v/scanner/',
'vlib/v/table/',
'vlib/v/util/',
'vlib/v/vet/',
'vlib/v/vmod/',
'vlib/gg/gg.v',
]
)
fn main() {
args := os.args
args_string := args[1..].join(' ')
pass_args := args_string.all_before('test-cleancode')
v_test_vetting(pass_args)
}
fn tsession(vargs string, tool_source string, tool_cmd string, tool_args string, flist []string, slist []string) testing.TestSession {
testing.setup_new_vtmp_folder()
util.prepare_tool_when_needed(tool_source)
testing.eheader('Run `$tool_cmd` over most .v files')
mut test_session := testing.new_test_session('$vargs $tool_args')
test_session.files << flist
test_session.skip_files << slist
test_session.test()
eprintln(test_session.benchmark.total_message('running `$tool_cmd` over most .v files'))
return test_session
}
fn v_test_vetting(vargs string) {
vet_session := tsession(vargs, 'vvet.v', 'v vet', 'vet', vet_folders, vet_known_failing_exceptions)
verify_session := tsession(vargs, 'vfmt.v', 'v fmt -verify', 'fmt -verify', vfmt_verify_list,
verify_known_failing_exceptions)
//
if vet_session.benchmark.nfail > 0 || verify_session.benchmark.nfail > 0 {
eprintln('\n')
if vet_session.benchmark.nfail > 0 {
eprintln('WARNING: `v vet` failed $vet_session.benchmark.nfail times.')
}
if verify_session.benchmark.nfail > 0 {
eprintln('WARNING: `v fmt -verify` failed $verify_session.benchmark.nfail times.')
}
exit(1)
}
}

View File

@@ -0,0 +1,71 @@
module main
import os
import testing
import benchmark
import v.pref
fn main() {
args := os.args
args_string := args[1..].join(' ')
v_test_compiler(args_string.all_before('test-compiler'))
}
fn v_test_compiler(vargs string) {
vexe := pref.vexe_path()
parent_dir := os.dir(vexe)
testing.vlib_should_be_present(parent_dir)
// Changing the current directory is needed for some of the compiler tests,
// vlib/v/tests/local_test.v and vlib/v/tests/repl/repl_test.v
os.chdir(parent_dir)
/*
if !os.exists(parent_dir + '/v.v') {
eprintln('v.v is missing, it must be next to the V executable')
exit(1)
}
*/
// Make sure v.c can be compiled without warnings
$if macos {
if os.exists('/cmd/v') {
os.system('$vexe -o v.c cmd/v')
if os.system('cc -Werror v.c') != 0 {
eprintln('cc failed to build v.c without warnings')
exit(1)
}
eprintln('v.c can be compiled without warnings. This is good :)')
}
}
building_tools_failed := testing.v_build_failing(vargs, 'cmd/tools')
eprintln('')
testing.eheader('Testing all _test.v files...')
mut compiler_test_session := testing.new_test_session(vargs)
compiler_test_session.files << os.walk_ext(parent_dir, '_test.v')
compiler_test_session.test()
eprintln(compiler_test_session.benchmark.total_message('running V tests'))
eprintln('')
building_examples_failed := testing.v_build_failing(vargs, 'examples')
eprintln('')
building_live_failed := testing.v_build_failing(vargs + '-live', os.join_path('examples',
'hot_reload'))
eprintln('')
//
testing.setup_new_vtmp_folder()
v_module_install_cmd := '$vexe install nedpals.args'
eprintln('')
testing.eheader('Installing a v module with: $v_module_install_cmd')
mut vmark := benchmark.new_benchmark()
ret := os.system(v_module_install_cmd)
if ret != 0 {
eprintln('failed to run v install')
}
desired_path := os.join_path(pref.default_module_path, 'nedpals', 'args')
if !(os.exists(desired_path) && os.is_dir(desired_path)) {
eprintln('v failed to install a test module')
}
vmark.stop()
eprintln('Installing a v module took: ' + vmark.total_duration().str() + 'ms')
//
if building_tools_failed || compiler_test_session.failed || building_examples_failed || building_live_failed {
exit(1)
}
}

85
cmd/tools/vtest-fixed.v Normal file
View File

@@ -0,0 +1,85 @@
module main
import os
import testing
import v.pref
const (
skip_test_files = [
'vlib/net/http/http_httpbin_test.v',
]
skip_on_musl = []string{}
skip_on_ubuntu_musl = [
// 'vlib/v/gen/js/jsgen_test.v',
'vlib/net/http/cookie_test.v',
'vlib/net/http/http_test.v',
'vlib/net/http/status_test.v',
'vlib/net/websocket/ws_test.v',
'vlib/sqlite/sqlite_test.v',
'vlib/orm/orm_test.v',
'vlib/clipboard/clipboard_test.v',
'vlib/vweb/tests/vweb_test.v',
'vlib/x/websocket/websocket_test.v',
]
skip_on_linux = []string{}
skip_on_non_linux = [
'vlib/net/websocket/ws_test.v',
]
skip_on_windows = [
'vlib/orm/orm_test.v',
'vlib/net/websocket/ws_test.v',
'vlib/x/websocket/websocket_test.v',
'vlib/vweb/tests/vweb_test.v',
]
skip_on_non_windows = []string{}
skip_on_macos = []string{}
skip_on_non_macos = []string{}
)
// NB: musl misses openssl, thus the http tests can not be done there
// NB: http_httpbin_test.v: fails with 'cgen error: json: map_string_string is not struct'
fn main() {
vexe := pref.vexe_path()
vroot := os.dir(vexe)
os.chdir(vroot)
args := os.args
args_string := args[1..].join(' ')
cmd_prefix := args_string.all_before('test-fixed')
title := 'testing all fixed tests'
all_test_files := os.walk_ext(os.join_path(vroot, 'vlib'), '_test.v')
testing.eheader(title)
mut tsession := testing.new_test_session(cmd_prefix)
tsession.files << all_test_files
tsession.skip_files << skip_test_files
//
if os.getenv('V_CI_MUSL').len > 0 {
tsession.skip_files << skip_on_musl
}
if os.getenv('V_CI_UBUNTU_MUSL').len > 0 {
tsession.skip_files << skip_on_ubuntu_musl
}
$if !linux {
tsession.skip_files << skip_on_non_linux
}
$if linux {
tsession.skip_files << skip_on_linux
}
$if windows {
tsession.skip_files << skip_on_windows
}
$if !windows {
tsession.skip_files << skip_on_non_windows
}
$if macos {
tsession.skip_files << skip_on_macos
}
$if !macos {
tsession.skip_files << skip_on_non_macos
}
tsession.test()
eprintln(tsession.benchmark.total_message(title))
if tsession.benchmark.nfail > 0 {
eprintln('\nWARNING: failed $tsession.benchmark.nfail times.\n')
exit(1)
}
}

59
cmd/tools/vtest-fmt.v Normal file
View File

@@ -0,0 +1,59 @@
module main
import os
import testing
import v.util
const (
known_failing_exceptions = [
'vlib/crypto/aes/const.v',
/* multiple narrow columns of []string turned to 1 long single column, otherwise works */
'vlib/vweb/vweb.v',
/* $for method in T.methods { => $for method in T(methods) { , `return // xx` => parse expr error */
'vlib/v/gen/js/tests/life.v',
/* error: unexpected `,`, expecting ), on JS.setInterval(fn () { show(game) game = step(game) }, 500) */
'vlib/builtin/js/builtin.v',
/* JS.console.error(s) => JS.error(s), JS.process.exit(c) => JS.exit(c) */
'vlib/builtin/js/jsfns_node.js.v',
'vlib/builtin/js/jsfns.js.v',
'vlib/builtin/js/jsfns_browser.js.v',
'vlib/builtin/bare/linuxsys_bare.v',
/* error: expr(): bad token `asm`, on `asm {}` */
'vlib/picoev/picoev.v',
/* the fn args are removed, then `cb fn (picohttpparser.Request, mut picohttpparser.Response)` can not be reparsed */
'vlib/os/os.v' /* os.v - `a := [ c'/bin/sh', c'-c', byteptr(cmd.str), 0 ]` */,
]
)
fn main() {
args := os.args
args_string := args[1..].join(' ')
v_test_formatting(args_string.all_before('test-fmt'))
}
fn v_test_formatting(vargs string) {
all_v_files := v_files()
util.prepare_tool_when_needed('vfmt.v')
testing.eheader('Run "v fmt" over all .v files')
mut vfmt_test_session := testing.new_test_session('$vargs fmt -worker')
vfmt_test_session.files << all_v_files
vfmt_test_session.skip_files << known_failing_exceptions
vfmt_test_session.test()
eprintln(vfmt_test_session.benchmark.total_message('running vfmt over V files'))
if vfmt_test_session.benchmark.nfail > 0 {
eprintln('\nWARNING: v fmt failed $vfmt_test_session.benchmark.nfail times.\n')
exit(1)
}
}
fn v_files() []string {
mut files_that_can_be_formatted := []string{}
all_test_files := os.walk_ext('.', '.v')
for tfile in all_test_files {
if tfile.starts_with('./vlib/v/cgen/tests') {
continue
}
files_that_can_be_formatted << tfile
}
return files_that_can_be_formatted
}

48
cmd/tools/vtest.v Normal file
View File

@@ -0,0 +1,48 @@
module main
import os
import os.cmdline
import testing
fn main() {
args := os.args
if args.last() == 'test' {
println('Usage:')
println(' A)')
println(' v test folder/ : run all v tests in the given folder.')
println(' v -stats test folder/ : the same, but print more stats.')
println(' B)')
println(' v test file_test.v : run test functions in a given test file.')
println(' v -stats test file_test.v : as above, but with more stats.')
println(' NB: you can also give many and mixed folder/ file_test.v arguments after test.')
println('')
return
}
args_to_executable := args[1..]
args_before := cmdline.options_before(args_to_executable, ['test'])
args_after := cmdline.options_after(args_to_executable, ['test'])
if args_after.join(' ') == 'v' {
eprintln('`v test v` has been deprecated.')
eprintln('Use `v test-compiler` instead.')
exit(1)
}
mut ts := testing.new_test_session(args_before.join(' '))
for targ in args_after {
if os.exists(targ) && targ.ends_with('_test.v') {
ts.files << targ
continue
}
if os.is_dir(targ) {
// Fetch all tests from the directory
ts.files << os.walk_ext(targ.trim_right(os.path_separator), '_test.v')
continue
}
println('Unrecognized test file $targ .')
}
testing.header('Testing...')
ts.test()
println(ts.benchmark.total_message('running V _test.v files'))
if ts.failed {
exit(1)
}
}

17
cmd/tools/vtracev.v Normal file
View File

@@ -0,0 +1,17 @@
module main
import os
import v.pref
fn main() {
vexe := pref.vexe_path()
vroot := os.dir(vexe)
os.chdir(vroot)
os.setenv('VCOLORS', 'always', true)
self_idx := os.args.index('tracev')
args := os.args[1..self_idx]
args_str := args.join(' ')
options := if args.len > 0 { '($args_str)' } else { '' }
println('Compiling a `tracev` executable ${options}...')
os.system('$vexe -cg -d trace_parser -d trace_checker -d trace_gen -o tracev $args_str cmd/v')
}

129
cmd/tools/vup.v Normal file
View File

@@ -0,0 +1,129 @@
module main
import os
import v.pref
import v.util
struct App {
is_verbose bool
vexe string
vroot string
}
fn new_app() App {
vexe := os.real_path(pref.vexe_path())
return App{
is_verbose: '-v' in os.args
vexe: vexe
vroot: os.dir(vexe)
}
}
fn main() {
app := new_app()
os.chdir(app.vroot)
println('Updating V...')
app.update_from_master()
v_hash := util.githash(false)
current_hash := util.githash(true)
// println(v_hash)
// println(current_hash)
if v_hash == current_hash {
app.show_current_v_version()
return
}
$if windows {
app.backup('cmd/tools/vup.exe')
}
app.recompile_v()
os.exec('"$app.vexe" cmd/tools/vup.v') or {
panic(err)
}
app.show_current_v_version()
}
fn (app App) update_from_master() {
if app.is_verbose {
println('> updating from master ...')
}
if !os.exists('.git') {
// initialize as if it had been cloned
app.git_command('init')
app.git_command('remote add origin https://github.com/vlang/v')
app.git_command('fetch')
app.git_command('reset --hard origin/master')
app.git_command('clean --quiet -xdf --exclude v.exe --exclude cmd/tools/vup.exe')
} else {
// pull latest
app.git_command('pull https://github.com/vlang/v master')
}
}
fn (app App) recompile_v() {
// NB: app.vexe is more reliable than just v (which may be a symlink)
vself := '"$app.vexe" self'
if app.is_verbose {
println('> recompiling v itself with `$vself` ...')
}
if self_result := os.exec(vself) {
println(self_result.output.trim_space())
if self_result.exit_code == 0 {
return
}
}
app.make(vself)
}
fn (app App) make(vself string) {
mut make := 'make'
$if windows {
make = 'make.bat'
}
println('`$vself` failed, running `$make`...')
make_result := os.exec(make) or {
panic(err)
}
println(make_result.output)
}
fn (app App) show_current_v_version() {
if vout := os.exec('"$app.vexe" version') {
mut vversion := vout.output.trim_space()
if vout.exit_code == 0 {
latest_v_commit := vversion.split(' ').last().all_after('.')
if latest_v_commit_time := os.exec('git show -s --format=%ci $latest_v_commit') {
if latest_v_commit_time.exit_code == 0 {
vversion += ', timestamp: ' + latest_v_commit_time.output.trim_space()
}
}
}
println('Current V version:')
println(vversion)
}
}
fn (app App) backup(file string) {
backup_file := '${file}_old.exe'
if os.exists(backup_file) {
os.rm(backup_file)
}
os.mv(file, backup_file)
}
fn (app App) git_command(command string) {
git_result := os.exec('git $command') or {
panic(err)
}
if git_result.exit_code != 0 {
if git_result.output.contains('Permission denied') {
eprintln('No access to `$app.vroot`: Permission denied')
} else {
eprintln(git_result.output)
}
exit(1)
} else {
if app.is_verbose {
println(git_result.output)
}
}
}

75
cmd/tools/vvet.v Normal file
View File

@@ -0,0 +1,75 @@
// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
module main
import v.vet
import v.pref
import v.parser
import v.util
import v.table
import os
import os.cmdline
struct VetOptions {
is_verbose bool
mut:
errors []string
}
fn (vet_options &VetOptions) vprintln(s string) {
if !vet_options.is_verbose {
return
}
println(s)
}
fn main() {
args := util.join_env_vflags_and_os_args()
paths := cmdline.only_non_options(cmdline.options_after(args, ['vet']))
mut vet_options := VetOptions{
is_verbose: '-verbose' in args || '-v' in args
}
for path in paths {
if !os.exists(path) {
eprintln('File/folder $path does not exist')
continue
}
if path.ends_with('_test.v') || (path.contains('/tests/') && !path.contains('vlib/v/vet/')) {
eprintln('skipping $path')
continue
}
if path.ends_with('.v') || path.ends_with('.vv') {
vet_options.vet_file(path)
} else if os.is_dir(path) {
vet_options.vprintln("vetting folder '$path'...")
vfiles := os.walk_ext(path, '.v')
vvfiles := os.walk_ext(path, '.vv')
mut files := []string{}
files << vfiles
files << vvfiles
for file in files {
if file.ends_with('_test.v') || file.contains('/tests/') { // TODO copy pasta
continue
}
vet_options.vet_file(file)
}
}
}
if vet_options.errors.len > 0 {
for err in vet_options.errors {
eprintln(err)
}
eprintln('NB: You can run `v fmt -w file.v` to fix these automatically')
exit(1)
}
}
fn (mut vet_options VetOptions) vet_file(path string) {
mut prefs := pref.new_preferences()
prefs.is_vet = true
table := table.new_table()
vet_options.vprintln("vetting file '$path'...")
file_ast, errors := parser.parse_vet_file(path, table, prefs)
vet_options.errors << errors
vet.vet(file_ast, table, true)
}

14
cmd/v/help/bin2v.txt Normal file
View File

@@ -0,0 +1,14 @@
Usage:
v bin2v [options] FILE [FILE]...
Converts a list of arbitrary files into a single v module file.
You can use this tool to embed binary files, like pictures or fonts inside
the executable of a v program, such that it would not need access to external
resources during runtime, and it would be as self-contained as possible.
Options:
-h, --help Show this help screen.
-m, --module <string> Name of the generated module.
-p, --prefix <string> A prefix put before each resource name.
-w, --write <string> Write directly to a file with the given name.

69
cmd/v/help/build-c.txt Normal file
View File

@@ -0,0 +1,69 @@
Usage: v [build flags] ['build'] <file.v|directory>
This command compiles the given target, along with their dependencies, into an executable.
This help topic explores C-backend specific build flags.
For help regarding building an executable, see `v help build`.
These build flags are enabled on `build` and `run` as long as the backend is set to `c`:
-cc <compiler>
Change the C compiler V invokes to the specified compiler.
The C compiler is required to support C99.
Officially supported/tested C compilers include: `clang`, `gcc`, `tcc`, `mingw-w64` and `msvc`.
-cflags <flag>
Pass the provided flag as is to the C compiler.
Can be specified multiple times to provide multiple flags.
Use quotes to wrap the flag argument if it contains spaces.
-printfn <fn_name>
Prints the content of the generated C function named fn_name. You can repeat that many times.
This is useful when you just want to quickly tweak the generated C code,
without opening the generated .c file in an text editor.
-cg
Enable generating more debug information in the compiled executable.
This makes program backtraces more useful.
Using debuggers like gdb/lldb with such executables is easier too.
-compress
Strip the compiled executable to compress it.
-freestanding
Build the executable without dependency on libc.
Supported only on `linux` targets currently.
-live
Build the executable with live capabilities (`[live]`).
-os <os>, -target-os <os>
Change the target OS that V tries to compile for.
By default, the target OS is the host system.
When OS is `cross`, V will attempt to output cross-platform C code.
List of OS supported by V: `linux`, `windows`, `ios`, `mac`, `freebsd`, `openbsd`,
`netbsd`, `dragonfly`, `solaris`, `android` and `haiku`.
-m32, -m64
Specify whether 32-bit or 64-bit machine code is generated.
-sanitize
Pass flags related to sanitization to the C compiler.
-shared
Tell V to compile a shared object instead of an executable.
The resulting file extension will be `.dll` on Windows and `.so` on Unix systems
-no-prelude
Prevents V from generating a prelude in generated .c files, useful for freestanding targets
where eg. you replace C standard library with your own, or some definitions/headers break something.
-custom-prelude <path>
Useful for similar use-case as above option, except it replaces V-generated prelude with
your custom one loaded from specified <path>.
-showcc
Prints the C command that is used to build the program.
-keepc
Do not remove the temporary .tmp.c and .tmp.c.rsp files. Also do not use a random prefix for them, so they would be fixed and predictable.

131
cmd/v/help/build.txt Normal file
View File

@@ -0,0 +1,131 @@
Usage: v [build flags] ['build'] <file.v|directory>
This command compiles the given target, along with their dependencies, into an executable.
When compiling packages, build ignores files that end in '_test.v'.
When compiling a single main package, build writes the resulting executable to an output file
named after the build target. ('v abc.v' and 'v abc/' both write either 'abc' or 'abc.exe')
The '.exe' suffix is added when writing a Windows executable.
By default, the executable is stored in the same directory as the compiled source code.
The -o flag forces build to write the resulting executable or object to the d output file or directory,
instead of the default behavior described in the last two paragraphs.
You can put common options inside an environment variable named VFLAGS, so that
you don't have to repeat them.
You can set it like this: `export VFLAGS="-cc clang -debug"` on *nix,
`set VFLAGS=-cc msvc` on Windows.
V respects the TMPDIR environment variable, and will put .tmp.c files in TMPDIR/v/ .
If you have not set it, a suitable platform specific folder (like /tmp) will be used.
The build flags are shared by the build and run commands:
-b <backend>, -backend <backend>
Specify the backend to use while building the executable.
Current list of supported backends:
* `c` (default) - V outputs C source code which is passed to a C compiler to be compiled.
* `js` - V outputs JS source code which can be passed to NodeJS to be ran.
* `x64` - V outputs Linux 64-bit executable directly (highly experimental!).
-d <flag>[=<value>], -define <flag>[=<value>]
Define the provided flag.
If value is not provided, it is assumed to be set to `true`.
`value` should be `1` or `0` to indicate `true` and `false` respectively otherwise.
-e <experiment>, -experiments <experiment>
Enable the specified experiment.
Currently, the only experiment available is: `prealloc`
-cg
Compile the executable in debug mode, allowing code to be debugged more easily.
-o <output>, -output <output>
Force V to output the executable in a specific location
(relative to the current working directory if not absolute).
-obf, -obfuscate
Turn on obfuscation for the code being built. Currently only renames symbols.
-path
Specify the order of path V looks up in while searching for imported dependencies,
separated by pipes (`|`). In addition to absolute paths, you can
also use these special strings too:
@vmodules - replaced with the location of the global ~/.vmodules/ folder
(modules installed with `v install` are there). You can change
its location by setting the environment variable VMODULES.
@vlib - replaced with the location of the v's vlib folder.
Using these, you can arrange for very flexible search orders for you project, for example:
-path "/v/my_project_private_modules|@vlib|@vmodules"
By default, -path is just "@vlib|@vmodules" .
-prod
Compile the executable in production mode where most optimizations are enabled.
-prof, -profile <file.txt>
Compile the executable with all functions profiled.
The profile results will be stored in `file.txt`.
The format is 4 fields, separated by a space, for each v function:
a) how many times it was called
b) how much *nanoseconds in total* it took
c) an average for each function (i.e. (b) / (a) )
d) the function name
NB: if you want to output the profile info to stdout, use `-profile -`.
-profile-no-inline
Skip [inline] functions when profiling.
-stats
Enable more detailed statistics reporting, while compiling test files.
You can use that with `v test` too, for example:
v -stats test vlib/
... will run test_ functions inside all _test.v files inside vlib/ ,
and will report detailed statistics about how much time each test_ function took, how many
assertions were made, how many tests passed/failed and so on.
-translated
Enable features that are discouraged in regular V code but required for translated V code.
-v
Enable verbosity in the V compiler while compiling
-print_v_files
Just print the list of all parsed .v files, then stop processing further.
This is useful for running external processing tools:
./v -print_v_files cmd/v | etags -L -
... will generate a TAGS file, that emacs can then use to jump
to the definition of functions used by v itself. For vim:
./v -print_v_files cmd/v | ctags -L -
... will generate a simillar tags file, that vi compatible editors can use.
NB: an useful, although not entirely accurate regexp based Universal Ctags options file
for V is located in `.ctags.d/v.ctags` . If you use https://ctags.io/ , it will be used
up automatically, or you can specify it explicitly with --options=.ctags.d/v.ctags .
-color, -nocolor
Force the use of ANSI colors for the error/warning messages, or disable them completely.
By default V tries to show its errors/warnings in ANSI color. The heuristic that it uses
to detect whether or not to use ANSI colors may not work in all cases.
These options allow you to override the default detection.
-check-syntax
Only scan and parse the files, but then stop. Useful for very quick syntax checks.
-show-timings
Print a summary about how long each compiler stage took, for example:
PARSE: 152ms
CHECK: 62ms
C GEN: 103ms
C tcc: 95ms
-w
Hide all warnings.
-W
Treat all warnings as errors, even in development builds.
For C-specific build flags, use `v help build-c`.
See also:
`v help run` for documentation regarding `v run`.

48
cmd/v/help/default.txt Normal file
View File

@@ -0,0 +1,48 @@
V is a tool for managing V source code.
Usage:
v [options] [command] [arguments]
Examples:
v hello.v Compile the file `hello.v` and output it as `hello` or `hello.exe`.
v run hello.v Same as above but also run the produced executable immediately after compilation.
v -cg run hello.v Same as above, but make debugging easier (in case your program crashes).
v -o h.c hello.v Translate `hello.v` to `h.c`. Do not compile further.
V supports the following commands:
* New project scaffolding:
new Setup the file structure for a V project (in a sub folder).
init Setup the file structure for an already existing V project.
* Ordinary development:
run Compile and run a V program.
test Run all test files in the provided directory.
fmt Format the V code provided.
vet Report suspicious code constructs.
doc Generate the documentation for a V module.
vlib-docs Generate and open the documentation of all the vlib modules.
repl Run the REPL.
* Installation/self updating:
symlink Create a symbolic link for V.
up Run the V self-updater.
self [-prod] Run the V self-compiler, use -prod to optimize compilation.
version Print the version text and exits.
* Module/package management:
install Install a module from VPM.
remove Remove a module that was installed from VPM.
search Search for a module from VPM.
update Update an installed module from VPM.
upgrade Upgrade all the outdated modules.
list List all installed modules.
outdated Show installed modules that need updates.
* Others:
build Build V code in the provided path (the default, so you can skip the word `build`).
translate Translate C code to V (coming soon in 0.3).
tracev Produce a tracing version of the v compiler.
Use `tracev yourfile.v` when the compiler panics.
NB: `tracev` is much slower and more verbose than ordinary `v`
Use "v help <command>" for more information about a command, example: `v help build`, `v help build-c`
Use "v help other" to see less frequently used commands.
Note: Help is required to write more help topics.
Only build, doc, fmt, run, test, search, install, remove, update, bin2v are properly documented currently.

35
cmd/v/help/doc.txt Normal file
View File

@@ -0,0 +1,35 @@
Usage:
v doc [flags] [module_name / folder / V file] [symbol name]
Examples:
v doc os
v doc os File
v doc -o math.html math
v doc -m -f html vlib/
Generates the documentation of a given directory, module, or V source file
and prints or saves them to its desired format. It can generate HTML, JSON,
or Markdown format.
Options:
-all Includes private and public functions/methods/structs/consts/enums.
-f Specifies the output format to be used.
-h, -help Prints this help text.
-m Generate docs for modules listed in that folder.
-o Specifies the output file/folder path where to store the generated docs.
Set it to "stdout" to print the output instead of saving the contents
to a file.
-readme Include README.md to docs if present.
-v Enables verbose logging. For debugging purposes.
-filename Specifies the specific file to document.
-pos Specifies the position. Used with `-filename`.
-no-timestamp Omit timestamp in the output file.
For HTML mode:
-inline-assets Embeds the contents of the CSS and JS assets into the webpage directly.
-open Launches the browser when the server docs has started.
-p Specifies the port to be used for the docs server.
-s Serve HTML-generated docs via HTTP.
For plain text mode:
-l Show the locations of the generated signatures.

31
cmd/v/help/fmt.txt Normal file
View File

@@ -0,0 +1,31 @@
Usage:
v fmt [options] path_to_source.v [path_to_other_source.v]
Formats the given V source files, then prints their formatted source to stdout.
Options:
-c Check if file is already formatted.
If it is not, print filepath, and exit with code 2.
-diff Display the differences between the formatted source(s) and the original source(s).
This will attempt to find a working `diff` command automatically unless you
specify one with the VDIFF_TOOL environment variable.
-l List files whose formatting differs from vfmt.
-w Write result to (source) file(s) instead of to stdout.
-debug Print the kinds of encountered AST statements/expressions on stderr.
-verify Make sure the provided file is already formatted. Useful for checking code contributions
in CI for example.
Environment Variables:
VDIFF_TOOL A command-line tool that will be executed with the original file path
and a temporary formatted file path as arguments. e.g.
`VDIFF_TOOL=opendiff v fmt -diff path/to/file.v` will become:
opendiff path/to/file.v /tmp/v/vfmt_file.v
VDIFF_OPTIONS A set of command-line options to be sent immediately after the
`diff` command. e.g.
VDIFF_OPTIONS="-W 80 -y" v fmt -diff path/to/file.v /tmp/v/vfmt_file.v

28
cmd/v/help/help.v Normal file
View File

@@ -0,0 +1,28 @@
module help
// TODO: move this file outside internal, and merge it with cmd/tools/modules/vhelp/vhelp.v .
import os
import v.pref
const (
unknown_topic = 'V Error: Unknown help topic provided. Use `v help` for usage information.'
)
pub fn print_and_exit(topic string) {
vexe := pref.vexe_path()
vroot := os.dir(vexe)
for b in topic {
if (b >= `a` && b <= `z`) || b == `-` || (b >= `0` && b <= `9`) {
continue
}
eprintln(unknown_topic)
exit(1)
}
target_topic := os.join_path(vroot, 'cmd', 'v', 'help', '${topic}.txt')
content := os.read_file(target_topic) or {
eprintln(unknown_topic)
exit(1)
}
println(content)
exit(0)
}

12
cmd/v/help/install.txt Normal file
View File

@@ -0,0 +1,12 @@
Usage:
v install module [module] [module] [...]
^^^^^^^^^^^^^ will install the modules you specified
You can also do `v install` directly if you have dependencies stored
inside the `v.mod` file. This will automatically installs the modules
specified inside of it.
Options:
-help - Show usage info.
-v - Print more details about the performed operation.
-server-url - When doing network operations, use this vpm server. Can be given multiple times.

14
cmd/v/help/other.txt Normal file
View File

@@ -0,0 +1,14 @@
These are utility commands that you can also launch through v,
but which are used less frequently by users:
bin2v Convert a binary file to a v source file,
that can be later embedded in a module or program.
build-examples Test if all examples can be built.
build-tools Test if all tools can be built.
build-vbinaries Test if V can be built with different configuration.
test-fmt Test if all files in the current directory are formatted properly.
test-compiler Test if V is working properly by running all tests, including the compiler ones.
NB: this can take a minute or two to run
setup-freetype Setup thirdparty freetype on Windows.

9
cmd/v/help/remove.txt Normal file
View File

@@ -0,0 +1,9 @@
Usage:
a) v remove module [module] [module] [...]
^^^^^^^^^^^^ will remove the listed modules
b) v remove
^^^^^^^^^^^^ will remove ALL installed modules
Options:
-help - Show usage info.
-v - Print more details about the performed operation.
-server-url - When doing network operations, use this vpm server. Can be given multiple times.

13
cmd/v/help/run.txt Normal file
View File

@@ -0,0 +1,13 @@
Usage: v [build flags] run <file.v|directory|-> [arguments...]
This command is equivalent to running `v build` and running the compiled executable.
The executable is passed the arguments as provided in [arguments...].
If the target is '-', it means that the V source code to build comes from stdin.
If the '-o' option is not specified, and the target is '-', a temporary base name for the executable will be used.
The exit status of run will be:
* `1` if the compilation failed.
* The exit code of the compiled executable otherwise.
For more about build flags, see `v help build`.

8
cmd/v/help/search.txt Normal file
View File

@@ -0,0 +1,8 @@
Usage:
v search keyword1 [keyword2] [...]
^^^^^^^^^^^^^^^^^ will search https://vpm.vlang.io/ for matching modules,
and will show details about them
Options:
-help - Show usage info.
-v - Print more details about the performed operation.
-server-url - When doing network operations, use this vpm server. Can be given multiple times.

Some files were not shown because too many files have changed in this diff Show More