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

Compare commits

...

5250 Commits

Author SHA1 Message Date
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
Alexander Medvednikov
08c8b4ba22 V 0.1.9 2019-06-29 13:11:15 +02:00
Alexander Medvednikov
fd610b97d2 Azure: remove cd compiler 2019-06-29 13:04:59 +02:00
Alexander Medvednikov
9af2e4a62e travis: remove cd compiler 2019-06-29 13:04:07 +02:00
Alexander Medvednikov
37f7fb9597 Makefile: better info message 2019-06-29 13:02:53 +02:00
Alexander Medvednikov
882700dd1b readme: new simpler instructions 2019-06-29 12:58:52 +02:00
Alexander Medvednikov
5b7a1e84a4 move Makefile to root 2019-06-29 12:54:57 +02:00
Alexander Medvednikov
3ddbe015b4 bring back examples 2019-06-29 12:34:32 +02:00
Alexander Medvednikov
2251a84273 glad license 2019-06-29 12:11:25 +02:00
Alexander Medvednikov
761ba17018 move compiler tests to compiler/ 2019-06-29 12:10:19 +02:00
Alexander Medvednikov
4594d78bd6 move all vlib modules to vlib/ 2019-06-29 12:00:31 +02:00
Alexander Medvednikov
bdcbcb075b make test: test V prod build 2019-06-29 11:45:30 +02:00
Alexander Medvednikov
249fa95eab Revert 'compiler: allow mut passed as argument to be modified'. This broke 2019-06-29 11:42:47 +02:00
aguspiza
e4bfd32191 windows build 2019-06-29 11:04:29 +02:00
aguspiza
476c80ff08 fix windows build 2019-06-29 11:03:39 +02:00
Joe Conigliaro
e9c00c3d39 Windows: Implement getwd() & make ls() public. 2019-06-29 10:35:30 +02:00
aguspiza
bed7440ebb tetris improvements
added getexepath() to os module
added some wrapper functions to glfw
removed hardcored path in gg module
better tetris example exit and resource loading
2019-06-28 21:40:47 +02:00
Alexander Medvednikov
84f5d7e64b Update README.md 2019-06-28 21:37:22 +02:00
Alexander Medvednikov
6f79cb20cd readme: windows build instructions 2019-06-28 21:36:37 +02:00
Alexander Medvednikov
37e2da9d23 exit REPL on Windows 2019-06-28 21:28:55 +02:00
Alexander Medvednikov
2a2b402277 $if fix 2019-06-28 21:28:03 +02:00
Alexander Medvednikov
1bcccf0d1e make V compilable on Windows with mingw-w64 2019-06-28 21:24:51 +02:00
Henrixounez
d8caa6431f compiler: checks if variables are unused on scripts main function 2019-06-28 21:05:04 +02:00
Henrixounez
165dfe5fe0 compiler: allow mut passed as argument to be modified 2019-06-28 20:15:49 +02:00
lutherwenxu
ffa69921f5 gl: Remove C hashes
Remove C hashes from the gl code.
2019-06-28 17:26:11 +02:00
leonlau
b0bc53730c fix_replace 2019-06-28 17:24:56 +02:00
Henrixounez
b6b313d246 compiler: clears MainFn when recompile on repl 2019-06-28 17:24:18 +02:00
Henrixounez
748c45203d compiler: add EOF checks in scanner to prevent panic exits
swap s.text[s.pos + 1] to nextc
2019-06-28 17:14:47 +02:00
Alexander Medvednikov
56608dfd2b remove #ifdef, #ifndef, etc 2019-06-28 17:07:03 +02:00
Henrixounez
0026b228c3 scanner: fix on single letter variable declaration on first line 2019-06-28 16:22:23 +02:00
Alexander Medvednikov
0b7cc5f01a time: clean up 2019-06-28 16:05:55 +02:00
Alexander Medvednikov
b81f615a75 parser.v: string interpolation for pointers 2019-06-28 15:56:07 +02:00
Alexander Medvednikov
8abc461a55 int.v: fix hex() 2019-06-28 15:50:08 +02:00
Zaoqi
4cd48a6e18 Update main.v: fix typos (#753) 2019-06-28 15:47:38 +02:00
shivakishore14
65fed2d784 Create new line while pressing enter in repl.
Pressing Enter in repl should create new line instead of quiting the repl.
2019-06-28 15:44:54 +02:00
Alexander Medvednikov
4aab26d3e3 mut v := update examples 2019-06-28 15:24:48 +02:00
Alexander Medvednikov
77b6da23c4 README: use curl instead of wget 2019-06-28 15:09:01 +02:00
Alexander Medvednikov
99a0aa2300 fix main.v 2019-06-28 15:06:39 +02:00
Alexander Medvednikov
42bb85197a force mut a := ..., do not allow mut a = ... 2019-06-28 15:04:41 +02:00
Alexander Medvednikov
806ad80360 Update issue templates 2019-06-28 14:08:41 +02:00
1439 changed files with 161655 additions and 13329 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

5
.gitattributes vendored
View File

@@ -1,2 +1,3 @@
*.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

1
.github/FUNDING.yml vendored
View File

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

View File

@@ -1,6 +1,6 @@
---
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: ''

View File

@@ -2,14 +2,13 @@
name: Bug report
about: Bug report
title: ''
labels: bug
labels: 'Bug'
assignees: ''
---
**V version:**
**OS:**
**C compiler version:**
**What did you do?**

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,40 @@
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
```
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"

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

@@ -0,0 +1,17 @@
#!/bin/sh -l
set -e
pwd
uname -a
du -s .
ls -lat
./v test-compiler
./v build-vbinaries
echo "DONE"

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

@@ -0,0 +1,381 @@
name: CI
on: [push, pull_request]
jobs:
# v-fmt:
# runs-on: ubuntu-18.04
# 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
ubuntu-tcc:
runs-on: ubuntu-18.04
env:
VFLAGS: -cc /var/tmp/tcc/bin/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 libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev valgrind
- name: Build v
run: |
echo $VFLAGS
make -j4
./v -cg -o v cmd/v
- name: Test v->c
run: |
sudo ln -s /var/tmp/tcc/bin/tcc /usr/local/bin/tcc
tcc -version
./v -cg -o v cmd/v # Make sure vtcc can build itself twice
# ./v -silent test-compiler
- name: Fixed tests
run: ./v test-fixed
- name: Test building v tools
run: ./v build-tools
# - name: Test v binaries
# run: ./v -silent build-vbinaries
alpine-docker-musl-gcc:
name: alpine-musl
runs-on: ubuntu-latest
env:
V_CI_MUSL: 1
steps:
- name: Checkout
uses: actions/checkout@v2
# - name: Build V
# uses: spytheman/docker_alpine_v@v7.0
# with:
# entrypoint: .github/workflows/alpine.build.sh
# - name: Test V
# uses: spytheman/docker_alpine_v@v7.0
# with:
# entrypoint: .github/workflows/alpine.test.sh
macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest]
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 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 -o v cmd/v
- name: Build V using V
run: ./v -o v2 cmd/v && ./v2 -o v3 cmd/v
- name: Test symlink
run: sudo ./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: Test symlink
run: ./v symlink && v -o v2 cmd/v
- name: Fixed tests
run: ./v test-fixed
- name: Build examples
run: ./v build-examples
# - name: Cross-compilation to Linux
# run: ./v -os linux cmd/v
# - name: Test vsh
# run: ./v examples/v_script.vsh
- name: Test vid
run: |
git clone --depth 1 https://github.com/vlang/vid
cd vid && ../v -o vid .
- 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 examples/users.v
../v examples/calculator.v
ubuntu:
runs-on: ubuntu-18.04
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 libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev valgrind
- name: Build V
run: make -j4 && ./v -cc gcc -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: Build V UI examples
# run: ./v install ui && git clone --depth 1 https://github.com/vlang/ui && cd ui && ../v examples/calculator.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: Fixed tests
run: |
./v test-fixed
- name: Build examples
run: ./v build-examples
- 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: V self compilation with -autofree
run: ./v -o v2 -autofree cmd/v && ./v2 -o v3 -autofree cmd/v && ./v3 -o v4 -autofree cmd/v
# - 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-musl:
runs-on: ubuntu-18.04
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 libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev valgrind
- 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 test-fixed
ubuntu-llvm-mingw:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
# - name: Cross-compile V
# run: docker build . -f Dockerfile.cross
windows-gcc:
runs-on: windows-2019
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 -skip-path
- name: Test new v.c
run: .\v.exe -o v.c cmd/v && gcc -municode -w v.c
- name: Install dependencies
run: |
.\v.exe setup-freetype
.\.github\workflows\windows-install-sdl.bat
.\.github\workflows\windows-install-sqlite.bat
- name: Fixed tests
run: |
.\v.exe 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
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 -skip-path
- name: Install dependencies
run: |
.\v.exe setup-freetype
.\.github\workflows\windows-install-sdl.bat
.\.github\workflows\windows-install-sqlite.bat
- name: Fixed tests
run: |
./v -cg cmd\tools\vtest-fixed.v
./v 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
windows-tcc:
runs-on: windows-2019
# 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 doesn't find a C compiler
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 -skip-path
- name: Test new v.c
run: .\v.exe -o v.c cmd/v && .\thirdparty\tcc\tcc.exe -w -ladvapi32 -bt10 v.c
- name: Install dependencies
run: |
.\v.exe setup-freetype
.\.github\workflows\windows-install-sdl.bat
.\.github\workflows\windows-install-sqlite.bat
- name: Fixed tests
run: |
.\v.exe 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
docs-line-len-check:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build
run: make
- name: Check docs line length
run: ./v run cmd/tools/check-md.v doc/docs.md CHANGELOG.md
compilable-v-c-and-v-win-c:
runs-on: ubuntu-latest
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
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 libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev valgrind g++-9
- name: Build V
run: make -j4
- name: g++ version
run: g++-9 --version
- name: Running tests with g++
run: ./v -cc g++-9 test-fixed
- name: V self compilation with g++
run: ./v -cc g++-9 -o v2 cmd/v && ./v2 -cc g++-9 -o v3 cmd/v
install-modules:
runs-on: ubuntu-latest
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

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

@@ -0,0 +1,53 @@
name: Periodic
on:
schedule:
- cron: '31 1,12 * * *'
jobs:
network-tests-ubuntu:
runs-on: ubuntu-latest
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 test-fixed
network-tests-macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest]
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 test-fixed
network-windows-msvc:
runs-on: windows-2019
env:
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 test-fixed

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

@@ -0,0 +1,51 @@
name: Test prebuilt binaries
on:
release:
types: [edited, published]
jobs:
ubuntu:
runs-on: ubuntu-latest
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 libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev valgrind
- 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
steps:
- name: Install dependencies
run: |
brew install freetype glfw openssl 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
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

73
.gitignore vendored
View File

@@ -1,2 +1,73 @@
# 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
# ignore debugger files
cachegrind.out.*
.gdb_history
*.dSYM
*_test
*.def
# ignore system files
.DS_Store
._*
thumbs.db
/.symlink/*
/.bin/*
_docs

View File

@@ -1,36 +0,0 @@
language: c
matrix:
include:
- os: linux
sudo: required
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-5
- g++-5
- make
- libglfw3
- libglfw3-dev
- libfreetype6-dev
- libcurl3-dev
- 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
- export VROOT=$(pwd)
- cd ./compiler
- make
- make test

13
0.3_roadmap.txt Normal file
View File

@@ -0,0 +1,13 @@
+ = done
- = TODO
- coroutines
- bring back lock{}
- thread safe arrays/maps
- C2V translator
- doom.v
- rune type, replace ustring with []rune
- maps with non-string keys

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,369 @@
## V 0.1.27
*5 May 2020*
# 0.1.8
- 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 detailed information 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 and fixed size 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, allowing 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 V/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 (`[a..b]` slicing syntax should be used 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 code reloading now works with graphical applications: [bounce.v](https://github.com/vlang/v/blob/master/examples/hot_code_reloading/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.
- `glad` and `cJSON` are now compiled only once, this makes compilation of programs using `gg` and `json` 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 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.

158
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,158 @@
## 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`, it will download the C
version of the compiler and rebuild it from scratch.
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.
## 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`
### 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

129
Makefile Normal file
View File

@@ -0,0 +1,129 @@
CC ?= cc
CFLAGS ?=
LDFLAGS ?=
TMPDIR ?= /tmp
VC ?= ./vc
VCFILE := v.c
TMPTCC := /var/tmp/tcc
VCREPO := https://github.com/vlang/vc
TCCREPO := https://github.com/vlang/tccbin
GITCLEANPULL := git clean -xf && git pull --quiet
GITFASTCLONE := git clone --depth 1 --quiet
#### Platform detections and overrides:
_SYS := $(shell uname 2>/dev/null || echo Unknown)
_SYS := $(patsubst MSYS%,MSYS,$(_SYS))
_SYS := $(patsubst MINGW%,MinGW,$(_SYS))
ifneq ($(filter $(_SYS),MSYS MinGW),)
WIN32 := 1
endif
ifeq ($(_SYS),Linux)
LINUX := 1
endif
ifeq ($(_SYS),Darwin)
MAC := 1
endif
ifeq ($(_SYS),FreeBSD)
LDFLAGS += -lexecinfo
endif
ifdef ANDROID_ROOT
ANDROID := 1
undefine LINUX
endif
#####
ifdef WIN32
TCCREPO := https://github.com/vlang/tccbin_win
VCFILE := v_win.c
endif
all: latest_vc latest_tcc
ifdef WIN32
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o v.exe $(VC)/$(VCFILE) $(LDFLAGS)
ifdef prod
./v.exe -prod self
else
./v.exe self
endif
else
$(CC) $(CFLAGS) -g -std=gnu11 -w -o v $(VC)/$(VCFILE) $(LDFLAGS) -lm -lpthread
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 -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 MAC
ifndef local
cd $(TMPTCC) && $(GITCLEANPULL)
else
@echo "Using local tcc"
endif
endif
endif
fresh_tcc:
ifndef ANDROID
ifndef MAC
rm -rf $(TMPTCC)
$(GITFASTCLONE) $(TCCREPO) $(TMPTCC)
endif
endif
$(TMPTCC)/.git/config:
ifndef MAC
$(MAKE) fresh_tcc
endif
$(VC)/.git/config:
$(MAKE) fresh_vc
selfcompile:
./v -keepc -cg -o v cmd/v
selfcompile-static:
./v -keepc -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

250
README.md
View File

@@ -1,143 +1,219 @@
# 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](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: 100k — 1.2 million loc/s
- Easy to develop: V compiles itself in less than a second
- Performance: within 5% of C
- Performance: within 3% of 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
- C and JavaScript backends
V 1.0 release is planned for December 2019.
## Notes
GitHub marks V's code as written in Go. It's actually written in V, GitHub doesn't support the language yet.
The compilation is temporarily slower for this release:
- 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
A stable 0.2 release is planned for June 2020. Right now V is in an alpha stage.
## 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/compiler
cd v
make
```
Or build without make:
That's it! Now you have a V executable at `[path to V repo]/v`.
`[path to V repo]` can be anywhere.
(On Windows `make` means running `make.bat`, so make sure you use `cmd.exe`)
Now you can try `./v run examples/hello_world.v` (`v.exe` on Windows).
V is being constantly updated. To update V, simply run:
```
v up
```
### C compiler
You'll need 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)
### 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 everytime.
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
# Download the V compiler's source translated to C
wget 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
sudo ./v symlink
```
That's it! Now you have a V executable at `v/compiler/v`.
You can create a symlink so that it's globally available:
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
```
sudo ln -s [path to V repo]/compiler/v /usr/local/bin/v
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
git clone https://github.com/vlang/v
cd v
docker build -t vlang .
docker run --rm -it vlang:latest
v
```
V is being constantly updated. To update V, simply run
### Docker with Alpine/musl:
```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
```
</details>
### Testing and running the examples
Make sure V can compile itself:
```
git pull origin master
cd compiler/
make clean
make
v -o v2 cmd/v
```
### 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 will need Visual Studio. Microsoft doesn't make it easy for developers. Mingw-w64 could suffice, but if you plan to develop UI and graphical apps, VS is your only option.
V temporarily can't be compiled with Visual Studio. This will be fixed asap.
### Testing
```
$ cd examples
$ v run hello_world.v
hello world
```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>
In order to build Tetris and anything else using the graphics module on non-Windows systems, you will need to install freetype libraries.
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 libcurl.
If you plan to use the http package, you also need to install OpenSSL on non-Windows systems.
```
macOS:
brew install glfw freetype curl
brew install freetype openssl
Ubuntu:
sudo apt install libglfw3 libglfw3-dev libfreetype6-dev libcurl3-dev
Debian/Ubuntu:
sudo apt install libfreetype6-dev libssl-dev
Arch:
sudo pacman -S glfw-x11 curl freetype2
Arch/Manjaro:
sudo pacman -S freetype2
Fedora:
sudo dnf install freetype-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
```
-->
## 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.herokuapp.com%2Fvlang%2Fpledges&label=Patreon
[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

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: |
cd compiler && make
displayName: 'Build V'
- script: |
cd compiler && 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: |
cd compiler && make && make test
displayName: 'Build V'
trigger:
branches:
include:
- '*'
pr:
autoCancel: false
branches:
include:
- '*'

View File

@@ -1,112 +0,0 @@
// Copyright (c) 2019 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 base64
const (
Index = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62, 63, 62, 62, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0,
0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 63, 0, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51]
)
pub fn decode(data string) string {
mut padding := 0
if data.ends_with('=') {
if data.ends_with('==') {
padding = 2
} else {
padding = 1
}
}
//input_length is the length of meaningful data
input_length := data.len - padding
output_length := input_length * 3 / 4
mut i := 0
mut j := 0
mut str := malloc(output_length)
for i < input_length {
mut char_a := 0
mut char_b := 0
mut char_c := 0
mut char_d := 0
if i < input_length {
char_a = Index[int(data[i])]
i++
}
if i < input_length {
char_b = Index[int(data[i])]
i++
}
if i < input_length {
char_c = Index[int(data[i])]
i++
}
if i < input_length {
char_d = Index[int(data[i])]
i++
}
decoded_bytes := (char_a << 18) | (char_b << 12) | (char_c << 6) | (char_d << 0)
str[j] = decoded_bytes >> 16
str[j+1] = (decoded_bytes >> 8) & 0xff
str[j+2] = (decoded_bytes >> 0) & 0xff
j += 3
}
return tos(str, output_length)
}
const (
EncodingTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
)
pub fn encode(data string) string {
input_length := data.len
output_length := 4 * ((input_length + 2) / 3)
mut i := 0
mut j := 0
mut str := malloc(output_length)
for i < input_length {
mut octet_a := 0
mut octet_b := 0
mut octet_c := 0
if i < input_length {
octet_a = int(data[i])
i++
}
if i < input_length {
octet_b = int(data[i])
i++
}
if i < input_length {
octet_c = int(data[i])
i++
}
triple := ((octet_a << 0x10) + (octet_b << 0x08) + octet_c)
str[j+0] = EncodingTable[(triple >> 3 * 6) & 63] // 63 is 0x3F
str[j+1] = EncodingTable[(triple >> 2 * 6) & 63]
str[j+2] = EncodingTable[(triple >> 1 * 6) & 63]
str[j+3] = EncodingTable[(triple >> 0 * 6) & 63]
j += 4
}
mod_table := [0, 2, 1]
for i = 0; i < mod_table[input_length % 3]; i++ {
str[output_length - 1 - i] = `=`
}
return tos(str, output_length)
}

View File

@@ -1,16 +0,0 @@
import base64
fn test_decode() {
assert base64.decode('TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=')
== 'Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.'
// Test for incorrect padding.
assert base64.decode('aGk') == 'hi'
assert base64.decode('aGk=') == 'hi'
assert base64.decode('aGk==') == 'hi'
}
fn test_encode() {
assert base64.encode('Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.')
== 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4='
}

View File

@@ -1,227 +0,0 @@
// Copyright (c) 2019 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 builtin
struct array {
// Using a void pointer allows to implement arrays without generics and without generating
// extra code for every type.
pub:
data voidptr
len int
cap int
element_size int
}
// Private function, used by V (`nums := []int`)
fn new_array(mylen, cap, elm_size int) array {
arr := array {
len: mylen
cap: cap
element_size: elm_size
data: malloc(cap * elm_size)
}
return arr
}
// Private function, used by V (`nums := [1, 2, 3]`)
fn new_array_from_c_array(len, cap, elm_size int, c_array voidptr) array {
arr := array {
len: len
cap: cap
element_size: elm_size
data: malloc(cap * elm_size)
}
// TODO Write all memory functions (like memcpy) in V
C.memcpy(arr.data, c_array, len * elm_size)
return arr
}
// Private function, used by V (`nums := [1, 2, 3] !`)
fn new_array_from_c_array_no_alloc(len, cap, elm_size int, c_array voidptr) array {
arr := array {
len: len
cap: cap
element_size: elm_size
data: c_array
}
return arr
}
// Private function, used by V (`[0; 100]`)
fn array_repeat(val voidptr, nr_repeats, elm_size int) array {
arr := array {
len: nr_repeats
cap: nr_repeats
element_size: elm_size
data: malloc(nr_repeats * elm_size)
}
for i := 0; i < nr_repeats; i++ {
C.memcpy(arr.data + i * elm_size, val, elm_size)
}
return arr
}
pub fn (a mut array) append_array(b array) {
for i := 0; i < b.len; i++ {
val := b[i]
a._push(val)
}
}
pub fn (a mut array) sort_with_compare(compare voidptr) {
C.qsort(a.data, a.len, a.element_size, compare)
}
pub fn (a mut array) insert(i int, val voidptr) {
if i >= a.len {
panic('array.insert: index larger than length')
return
}
a._push(val)
size := a.element_size
C.memmove(a.data + (i + 1) * size, a.data + i * size, (a.len - i) * size)
a.set(i, val)
}
pub fn (a mut array) prepend(val voidptr) {
a.insert(0, val)
}
pub fn (a mut array) delete(idx int) {
size := a.element_size
C.memmove(a.data + idx * size, a.data + (idx + 1) * size, (a.len - idx) * size)
a.len--
a.cap--
}
fn (a array) _get(i int) voidptr {
if i < 0 || i >= a.len {
panic('array index out of range: $i/$a.len')
}
return a.data + i * a.element_size
}
pub fn (a array) first() voidptr {
if a.len == 0 {
panic('array.first: empty array')
}
return a.data + 0
}
pub fn (a array) last() voidptr {
if a.len == 0 {
panic('array.last: empty array')
}
return a.data + (a.len - 1) * a.element_size
}
pub fn (s array) left(n int) array {
if n >= s.len {
return s
}
return s.slice(0, n)
}
pub fn (s array) right(n int) array {
if n >= s.len {
return s
}
return s.slice(n, s.len)
}
pub fn (s array) slice(start, _end int) array {
mut end := _end
if start > end {
panic('invalid slice index: $start > $end')
}
if end >= s.len {
end = s.len
}
l := end - start
res := array {
element_size: s.element_size
data: s.data + start * s.element_size
len: l
cap: l
}
return res
}
pub fn (a mut array) set(idx int, val voidptr) {
if idx < 0 || idx >= a.len {
panic('array index out of range: $idx / $a.len')
}
C.memcpy(a.data + a.element_size * idx, val, a.element_size)
}
pub fn (arr mut array) _push(val voidptr) {
if arr.len >= arr.cap - 1 {
cap := (arr.len + 1) * 2
// println('_push: realloc, new cap=$cap')
if arr.cap == 0 {
arr.data = malloc(cap * arr.element_size)
}
else {
arr.data = C.realloc(arr.data, cap * arr.element_size)
}
arr.cap = cap
}
C.memcpy(arr.data + arr.element_size * arr.len, val, arr.element_size)
arr.len++
}
pub fn (arr mut array) _push_many(val voidptr, size int) {
if arr.len >= arr.cap - size {
cap := (arr.len + size) * 2
// println('_push: realloc, new cap=$cap')
if arr.cap == 0 {
arr.data = malloc(cap * arr.element_size)
}
else {
arr.data = C.realloc(arr.data, cap * arr.element_size)
}
arr.cap = cap
}
C.memcpy(arr.data + arr.element_size * arr.len, val, arr.element_size * size)
arr.len += size
}
pub fn (a[]int) str() string {
mut res := '['
for i := 0; i < a.len; i++ {
val := a[i]
res += '$val'
if i < a.len - 1 {
res += ', '
}
}
res += ']'
return res
}
pub fn (a[]int) free() {
// println('array free')
C.free(a.data)
}
// TODO generic
// "[ 'a', 'b', 'c' ]"
pub fn (a[]string) str() string {
mut res := '['
for i := 0; i < a.len; i++ {
val := a[i]
res += '"$val"'
if i < a.len - 1 {
res += ', '
}
}
res += ']'
return res
}
fn free(a voidptr) {
C.free(a)
}

View File

@@ -1,138 +0,0 @@
import os
const (
q = [1, 2, 3]
A = 8
)
fn test_ints() {
mut a := [1, 5, 2, 3]
assert a.len == 4
assert a[0] == 1
assert a[2] == 2
assert a.last() == 3
println(a)
a << 4
println(a)
assert a.len == 5
assert a[4] == 4
assert a.last() == 4
// assert a.contains(4) == true
// assert a.contains(777) == false
// assert a.str() == '51234'
mut s := a.str()
assert s == '[1, 5, 2, 3, 4]'
// Insert
// val := 5
// a.insert(1, val)// 1 5 2 3 4
s = a.str()
assert a[1] == 5
assert a.last() == 4
// a.sort()
s = a.str()
assert s == '[1, 5, 2, 3, 4]'
// Delete
a.delete(0)
assert a.str() == '[5, 2, 3, 4]'
a.delete(1)
assert a.str() == '[5, 3, 4]'
}
fn test_short() {
a := [1, 2, 3]
assert a.len == 3
assert a.cap == 3
assert a[0] == 1
assert a[1] == 2
assert a[2] == 3
}
fn test_large() {
mut a := [0; 0]
for i := 0; i < 10000; i++ {
a << i
}
assert a.len == 10000
assert a[234] == 234
}
struct Chunk {
val string
}
struct K {
q []Chunk
}
fn test_empty() {
mut chunks := []Chunk{}
a := Chunk{}
assert chunks.len == 0
chunks << a
assert chunks.len == 1
chunks = []Chunk{}
assert chunks.len == 0
chunks << a
assert chunks.len == 1
}
fn test_push() {
mut a := []int
a << 1
a << 3
assert a[1] == 3
assert a.str() == '[1, 3]'
}
fn test_strings() {
s := 'hi'
if s.contains('i') {
// println('$s')
}
a := ['a', 'b', 'c']
assert a.str() == '["a", "b", "c"]'
// println(a)
}
fn test_repeat() {
a := [0; 5]
// a := [0 x 5]
assert a.len == 5
assert a[0] == 0 && a[1] == 0 && a[2] == 0 && a[3] == 0 && a[4] == 0
}
fn test_right() {
a := [1, 2, 3, 4]
b := a.right(1)
assert b[0] == 2
assert b[1] == 3
}
fn test_left() {
a := [1, 2, 3]
b := a.left(2)
assert b[0] == 1
assert b[1] == 2
}
fn test_slice() {
a := [1, 2, 3, 4]
b := a.slice(2, 4)
for val in b {
println(val)
}
assert a.slice(1, 2).len == 1
println(a.slice(2, 4))
}
fn test_push_many() {
mut a := [1, 2, 3]
b := [4, 5, 6]
a._push_many(b.data, b.len)
assert a.len == 6
assert a[0] == 1
assert a[3] == 4
assert a[5] == 6
println(a)
}

View File

@@ -1,113 +0,0 @@
// Copyright (c) 2019 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 builtin
pub fn exit(code int) {
C.exit(code)
}
// isnil returns true if an object is nil (only for C objects).
pub fn isnil(v voidptr) bool {
return v == 0
}
fn on_panic(f fn (int) int) {
// TODO
}
pub fn print_backtrace() {
return
$if mac {
buffer := [100]voidptr
nr_ptrs := C.backtrace(buffer, 100)
C.backtrace_symbols_fd(buffer, nr_ptrs, 1)
}
}
pub fn panic(s string) {
println('V panic: $s')
print_backtrace()
C.exit(1)
}
pub fn println(s string) {
// Should never happen
if isnil(s.str) {
panic('println(NIL)')
}
C.printf('%.*s\n', s.len, s.str)
}
pub fn eprintln(s string) {
if isnil(s.str) {
panic('eprintln(NIL)')
}
$if mac {
C.fprintf(stderr, '%.*s\n', s.len, s.str)
}
// TODO issues with stderr and cross compiling for Linux
$else {
println(s)
}
}
pub fn print(s string) {
C.printf('%.*s', s.len, s.str)
}
__global total_m i64 = 0
pub fn malloc(n int) byteptr {
if n < 0 {
panic('malloc(<0)')
}
#ifdef VPLAY
if n > 10000 {
panic('allocating more than 10 KB is not allowed in the playground')
}
#endif
#ifdef DEBUG_ALLOC
total_m += n
println('\n\n\nmalloc($n) total=$total_m')
print_backtrace()
#endif
ptr := C.malloc(n)
if isnil(ptr) {
panic('malloc($n) failed')
}
return ptr
}
pub fn calloc(n int) byteptr {
if n < 0 {
panic('calloc(<0)')
}
return C.calloc(n, 1)
}
fn _strlen(s byteptr) int {
// TODO don't call a C function, implement it in V
return C.strlen(s)
}
// `fn foo() ?Foo { return foo }` => `fn foo() ?Foo { return opt_ok(foo); }`
fn opt_ok(data voidptr) Option {
return Option {
data: data
ok: true
}
}
fn memdup(src voidptr, sz int) voidptr {
mem := malloc(sz)
return C.memcpy(mem, src, sz)
}
pub fn error(s string) Option {
return Option {
error: s
}
}

View File

@@ -1,161 +0,0 @@
// Copyright (c) 2019 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 builtin
pub fn (d double) str() string {
buf := malloc(sizeof(double) * 5 + 1)// TODO
C.sprintf(buf, '%f', d)
return tos(buf, _strlen(buf))
}
pub fn (d f64) str() string {
buf := malloc(sizeof(double) * 5 + 1)// TODO
C.sprintf(buf, '%f', d)
return tos(buf, _strlen(buf))
}
pub fn (d f32) str() string {
buf := malloc(sizeof(double) * 5 + 1)// TODO
C.sprintf(buf, '%f', d)
return tos(buf, _strlen(buf))
}
pub fn ptr_str(ptr voidptr) string {
buf := malloc(sizeof(double) * 5 + 1)// TODO
C.sprintf(buf, '%p', ptr)
return tos(buf, _strlen(buf))
}
// fn (nn i32) str() string {
// return i
// }
pub fn (nn int) str() string {
mut n = nn
if n == 0 {
return '0'
}
max := 16
mut buf := malloc(max)
mut len := 0
mut is_neg = false
if n < 0 {
n = -n
is_neg = true
}
// Fill the string from the end
for n > 0 {
d := n % 10
buf[max - len - 1] = d + int(`0`)
len++
n = n / 10
}
// Prepend - if it's negative
if is_neg {
buf[max - len - 1] = `-`
len++
}
return tos(buf + max - len, len)
}
pub fn (nn u8) str() string {
mut n = nn
if n == u8(0) {
return '0'
}
max := 5
mut buf := malloc(max)
mut len := 0
mut is_neg = false
if n < u8(0) {
n = -n
is_neg = true
}
// Fill the string from the end
for n > u8(0) {
d := n % u8(10)
buf[max - len - 1] = d + u8(`0`)
len++
n = n / u8(10)
}
// Prepend - if it's negative
if is_neg {
buf[max - len - 1] = `-`
len++
}
return tos(buf + max - len, len)
}
pub fn (nn i64) str() string {
mut n = nn
if n == i64(0) {
return '0'
}
max := 32
mut buf := malloc(max)
mut len := 0
mut is_neg = false
if n < i64(0) {
n = -n
is_neg = true
}
// Fill the string from the end
for n > i64(0) {
d := int(n % i64(10))
buf[max - len - 1] = d + int(`0`)
len++
n = n / i64(10)
}
// Prepend - if it's negative
if is_neg {
buf[max - len - 1] = `-`
len++
}
return tos(buf + max - len, len)
}
pub fn (b bool) str() string {
if b {
return 'true'
}
return 'false'
}
pub fn (n int) hex() string {
s := n.str()
hex := malloc(s.len + 2)
C.sprintf(hex, '0x%x', n)
return tos(hex, s.len + 2)
}
pub fn (n i64) hex() string {
s := n.str()
hex := malloc(s.len + 2)
C.sprintf(hex, '0x%x', n)
return tos(hex, s.len + 2)
}
pub fn (a[]byte) contains(val byte) bool {
for aa in a {
if aa == val {
return true
}
}
return false
}
/* TODO
fn (c rune) str() string {
}
*/
pub fn (c byte) str() string {
mut str := string {
len: 1
str: malloc(2)
}
str.str[0] = c
str.str[1] = `\0`
return str
}

View File

@@ -1,181 +0,0 @@
// Copyright (c) 2019 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 builtin
struct map {
// cap int
// keys []string
// table byteptr
// keys_table *string
// table *Entry
element_size int
// collisions []Entry
pub:
entries []Entry
is_sorted bool
}
struct Entry {
pub:
key string
val voidptr
// linked list for collisions
// next *Entry
}
pub fn new_map(cap, elm_size int) map {
res := map {
// len: len,
element_size: elm_size
// entries:
// keys: []string
}
return res
}
fn (m &map) new_entry(key string, val voidptr) Entry {
new_e := Entry {
key: key
val: malloc(m.element_size)
// next: 0
}
C.memcpy(new_e.val, val, m.element_size)
return new_e
}
fn (m mut map) _set(key string, val voidptr) {
e := m.new_entry(key, val)
for i := 0; i < m.entries.len; i++ {
entry := m.entries[i]
if entry.key == key {
// e := Entry2{key: key, val: val}
m.entries[i] = e
return
}
}
m.entries << e// m.new_entry(key, val)
m.is_sorted = false
}
fn volt_abs(n int) int {
// println('volt_abs($n)')
if n < 0 {
// println('< 0: -($n)')
return -n
}
return n
}
fn (m map) bs(query string, start, end int, out voidptr) {
// println('bs "$query" $start -> $end')
mid := start + ((end - start) / 2)
if end - start == 0 {
last := m.entries[end]
C.memcpy(out, last.val, m.element_size)
return
}
if end - start == 1 {
first := m.entries[start]
C.memcpy(out, first.val, m.element_size)
return
}
if mid >= m.entries.len {
return
}
mid_msg := m.entries[mid]
// println('mid.key=$mid_msg.key')
if query < mid_msg.key {
m.bs(query, start, mid, out)
return
}
m.bs(query, mid, end, out)
}
fn compare_map(a, b *Entry) int {
if a.key < b.key {
return -1
}
if a.key > b.key {
return 1
}
return 0
}
pub fn (m mut map) sort() {
m.entries.sort_with_compare(compare_map)
m.is_sorted = true
}
pub fn (m map) keys() []string {
mut keys := []string{}
for i := 0; i < m.entries.len; i++ {
entry := m.entries[i]
keys << entry.key
}
return keys
}
fn (m map) get(key string, out voidptr) bool {
if m.is_sorted {
// println('\n\nget "$key" sorted')
m.bs(key, 0, m.entries.len, out)
return true
}
for i := 0; i < m.entries.len; i++ {
entry := m.entries[i]
if entry.key == key {
C.memcpy(out, entry.val, m.element_size)
return true
}
}
return false
}
pub fn (m map) exists(key string) bool {
for i := 0; i < m.entries.len; i++ {
entry := m.entries[i]
if entry.key == key {
return true
}
}
return false
}
pub fn (m map) print() {
println('<<<<<<<<')
for i := 0; i < m.entries.len; i++ {
// entry := m.entries[i]
// println('$entry.key => $entry.val')
}
/*
for i := 0; i < m.cap * m.element_size; i++ {
b := m.table[i]
print('$i: ')
C.printf('%02x', b)
println('')
}
*/
println('>>>>>>>>>>')
}
pub fn (m map) free() {
// C.free(m.table)
// C.free(m.keys_table)
}
pub fn (m map_string) str() string {
// return 'not impl'
if m.entries.len == 0 {
return '{}'
}
// TODO use bytes buffer
mut s := '{\n'
for entry in m.entries {
val := m[entry.key]
s += ' "$entry.key" => "$val"\n'
}
s += '}'
return s
}

View File

@@ -1,12 +0,0 @@
// Copyright (c) 2019 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 builtin
struct Option {
data voidptr
error string
ok bool
}

View File

@@ -1,840 +0,0 @@
// Copyright (c) 2019 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 builtin
// V strings are not null-terminated.
struct string {
pub:
str byteptr
len int
}
struct ustring {
pub:
s string
runes []int
len int
}
// For C strings only
fn C.strlen(s byteptr) int
fn todo() { }
// Converts a C string to a V string
pub fn tos(s byteptr, len int) string {
// This should never happen.
if isnil(s) {
panic('tos(): nil string')
}
return string {
str: s
len: len
}
}
pub fn tos_clone(s byteptr) string {
if isnil(s) {
panic('tos: nil string')
return string{}
}
len := strlen(s)
res := tos(s, len)
return res.clone()
}
// Same as `tos`, but calculates the length. Called by `string(bytes)` casts.
fn tos2(s byteptr) string {
if isnil(s) {
panic('tos2: nil string')
return string{}
}
len := C.strlen(s)
res := tos(s, len)
return res
}
pub fn (a string) clone() string {
mut b := string {
len: a.len
str: malloc(a.len + 1)
}
for i := 0; i < a.len; i++ {
b[i] = a[i]
}
b[a.len] = `\0`
return b
}
pub fn (s string) cstr() byteptr {
clone := s.clone()
return clone.str
}
pub fn (s string) replace(rep, with string) string {
if s.len == 0 || rep.len == 0 {
return ''
}
if !s.contains(rep) {
return s
}
// println('"$s" replace "$rep" with "$with" rep.len=$rep.len')
// TODO PERF Allocating ints is expensive. Should be a stack array
// Get locations of all reps within this string
mut idxs := []int{}
// idxs := []int {
// 2, 8, 14
// }
for i := 0; i < s.len; i++ {
// Do we have the string we are looking for (rep) starting at i?
// Go thru all chars in rep and compare.
mut rep_i := 0
mut j := i
for rep_i < rep.len && j < s.len && s[j] == rep[rep_i] {
rep_i++
j++
}
if rep_i == rep.len {
idxs << i
}
}
// Dont change the string if there's nothing to replace
if idxs.len == 0 {
return s
}
// Now we know the number of replacements we need to do and we can calc the len of the new string
new_len := s.len + idxs.len * (with.len - rep.len)
mut b := malloc(new_len + 1)// add a newline just in case
// Fill the new string
mut idx_pos := 0
mut cur_idx := idxs[idx_pos]
mut b_i = 0
for i := 0; i < s.len; i++ {
// Reached the location of rep, replace it with "with"
if i == cur_idx {
for j := 0; j < with.len; j++ {
b[b_i] = with[j]
b_i++
}
// Skip the length of rep, since we just replaced it with "with"
i += rep.len - 1
// Go to the next index
idx_pos++
if idx_pos < idxs.len {
cur_idx = idxs[idx_pos]
}
}
// Rep doesnt start here, just copy
else {
b[b_i] = s[i]
b_i++
}
}
b[new_len] = `\0`
return tos(b, new_len)
}
pub fn (s string) int() int {
return C.atoi(s.str)
}
pub fn (s string) f32() f32 {
return C.atof(s.str)
}
// ==
fn (s string) eq(a string) bool {
if isnil(s.str) {
panic('string.eq(): nil string')
}
if s.len != a.len {
return false
}
for i := 0; i < s.len; i++ {
if s[i] != a[i] {
return false
}
}
return true
}
// !=
fn (s string) ne(a string) bool {
return !s.eq(a)
}
// s < a
fn (s string) lt(a string) bool {
for i := 0; i < s.len; i++ {
if i >= a.len || s[i] > a[i] {
return false
}
else if s[i] < a[i] {
return true
}
}
if s.len < a.len {
return true
}
return false
}
// s <= a
fn (s string) le(a string) bool {
return s.lt(a) || s.eq(a)
}
// s > a
fn (s string) gt(a string) bool {
return !s.le(a)
}
// s >= a
fn (s string) ge(a string) bool {
return !s.lt(a)
}
// TODO `fn (s string) + (a string)` ? To be consistent with operator overloading syntax.
pub fn (s string) add(a string) string {
new_len := a.len + s.len
mut res := string {
len: new_len
str: malloc(new_len + 1)
}
for j := 0; j < s.len; j++ {
res[j] = s[j]
}
for j := 0; j < a.len; j++ {
res[s.len + j] = a[j]
}
res[new_len] = `\0`// V strings are not null terminated, but just in case
return res
}
pub fn (s string) split(delim string) []string {
// println('string split delim="$delim" s="$s"')
mut res := []string
if delim.len == 0 {
res << s
return res
}
if delim.len == 1 {
return s.split_single(delim[0])
// println('split 1 only')
// os.exit()
}
mut i := 0
mut start := 0// - 1
for i < s.len {
// printiln(i)
mut a := s[i] == delim[0]
mut j := 1
for j < delim.len && a {
a = a && s[i + j] == delim[j]
j++
}
last := i == s.len - 1
if a || last {
if last {
i++
}
mut val := s.substr(start, i)
// println('got it "$val" start=$start i=$i delim="$delim"')
if val.len > 0 {
// todo perf
// val now is '___VAL'. remove '___' from the start
if val.starts_with(delim) {
// println('!!')
val = val.right(delim.len)
}
res << val.trim_space()
}
start = i
}
i++
}
return res
}
pub fn (s string) split_single(delim byte) []string {
mut res := []string
if int(delim) == 0 {
res << s
return res
}
mut i := 0
mut start := 0
for i < s.len {
a := s[i] == delim
b := i == s.len - 1
if a || b {
if i == s.len - 1 {
i++
}
val := s.substr(start, i)
if val.len > 0 {
res << val.trim_space()
}
start = i + 1
}
i++
}
return res
}
pub fn (s string) split_into_lines() []string {
mut res := []string
if s.len == 0 {
return res
}
mut start := 0
for i := 0; i < s.len; i++ {
last := i == s.len - 1
if int(s[i]) == 10 || last {
if last {
i++
}
line := s.substr(start, i)
res << line
start = i + 1
}
}
return res
}
// 'hello'.left(2) => 'he'
pub fn (s string) left(n int) string {
if n >= s.len {
return s
}
return s.substr(0, n)
}
pub fn (s string) right(n int) string {
if n >= s.len {
return ''
}
return s.substr(n, s.len)
}
// Because the string is immutable, it is safe for multiple strings to share
// the same storage, so slicing s results in a new 2-word structure with a
// potentially different pointer and length that still refers to the same byte
// sequence. This means that slicing can be done without allocation or copying,
// making string slices as efficient as passing around explicit indexes.
// substr without allocations. Reuses memory and works great. BUT. This substring does not have
// a \0 at the end, and it's not possible to add it. So if we have s = 'privet'
// and substr := s.substr_fast(1, 4) ('riv')
// puts(substr.str) will print 'rivet'
// Avoid using C functions with these substrs!
pub fn (s string) substr(start, end int) string {
/*
if start > end || start >= s.len || end > s.len || start < 0 || end < 0 {
panic('substr($start, $end) out of bounds (len=$s.len)')
return ''
}
*/
if start >= s.len {
return ''
}
len := end - start
res := string {
str: s.str + start
len: len
}
return res
}
// KMP search
pub fn (s string) index(p string) int {
if p.len > s.len {
return -1
}
mut prefix := [0]
mut j := 0
for i := 1; i < p.len; i++ {
for p[j] != p[i] && j > 0 {
j = prefix[j - 1]
}
if p[j] == p[i] {
j++
}
prefix << j
}
j = 0
for i := 0; i < s.len; i++ {
for p[j] != s[i] && j > 0 {
j = prefix[j - 1]
}
if p[j] == s[i] {
j++
}
if j == p.len {
prefix.free()
return i - p.len + 1
}
}
prefix.free()
return -1
}
pub fn (s string) last_index(p string) int {
if p.len > s.len {
return -1
}
mut i := s.len - p.len
for i >= 0 {
mut j := 0
for j < p.len && s[i + j] == p[j] {
j++
}
if j == p.len {
return i
}
i--
}
return -1
}
pub fn (s string) index_after(p string, start int) int {
if p.len > s.len {
return -1
}
mut strt := start
if start < 0 {
strt = 0
}
if start >= s.len {
return -1
}
mut i := strt
for i < s.len {
mut j := 0
mut ii := i
for j < p.len && s[ii] == p[j] {
j++
ii++
}
if j == p.len {
return i
}
i++
}
return -1
}
pub fn (s string) contains(p string) bool {
res := s.index(p) > 0 - 1
return res
}
pub fn (s string) starts_with(p string) bool {
res := s.index(p) == 0
return res
}
pub fn (s string) ends_with(p string) bool {
if p.len > s.len {
return false
}
res := s.last_index(p) == s.len - p.len
return res
}
// TODO only works with ASCII
pub fn (s string) to_lower() string {
mut b := malloc(s.len)// TODO + 1 ??
for i := 0; i < s.len; i++ {
b[i] = C.tolower(s.str[i])
}
return tos(b, s.len)
}
pub fn (s string) to_upper() string {
mut b := malloc(s.len)// TODO + 1 ??
for i := 0; i < s.len; i++ {
b[i] = C.toupper(s.str[i])
}
return tos(b, s.len)
}
// 'hey [man] how you doin'
// find_between('[', ']') == 'man'
pub fn (s string) find_between(start, end string) string {
start_pos := s.index(start)
if start_pos == -1 {
return ''
}
// First get everything to the right of 'start'
val := s.right(start_pos + start.len)
end_pos := val.index(end)
if end_pos == -1 {
return val
}
return val.left(end_pos)
}
// TODO generic
pub fn (ar[]string) contains(val string) bool {
for s in ar {
if s == val {
return true
}
}
return false
}
// TODO generic
pub fn (ar[]int) contains(val int) bool {
for i, s in ar {
if s == val {
return true
}
}
return false
}
/*
pub fn (a[]string) to_c() voidptr {
char ** res = malloc(sizeof(char*) * a.len);
for i := 0; i < a.len; i++ {
val := a[i]
# res[i] = val.str;
}
return res;
return 0
}
*/
fn is_space(c byte) bool {
return C.isspace(c)
}
pub fn (c byte) is_space() bool {
return is_space(c)
}
pub fn (s string) trim_space() string {
if s == '' {
return ''
}
// println('TRIM SPACE "$s"')
mut i := 0
for i < s.len && is_space(s[i]) {
i++
}
mut res := s.right(i)
mut end := res.len - 1
for end >= 0 && is_space(res[end]) {
// C.printf('end=%d c=%d %c\n', end, res.str[end])
end--
}
res = res.left(end + 1)
// println('after SPACE "$res"')
return res
}
pub fn (s string) trim(c byte) string {
if s == '' {
return ''
}
mut i := 0
for i < s.len && c == s[i] {
i++
}
mut res := s.right(i)
mut end := res.len - 1
for end >= 0 && c == res[end] {
end--
}
res = res.left(end + 1)
return res
}
pub fn (s string) trim_left(cutset string) string {
mut start := s.index(cutset)
if start != 0 {
return s
}
for start < s.len - 1 && s[start] == cutset[0] {
start++
}
return s.right(start)
}
pub fn (s string) trim_right(cutset string) string {
pos := s.last_index(cutset)
if pos == -1 {
return s
}
return s.left(pos)
}
// fn print_cur_thread() {
// //C.printf("tid = %08x \n", pthread_self());
// }
fn compare_strings(a, b *string) int {
if a.lt(b) {
return -1
}
if a.gt(b) {
return 1
}
return 0
}
fn compare_strings_by_len(a, b *string) int {
if a.len < b.len {
return -1
}
if a.len > b.len {
return 1
}
return 0
}
fn compare_lower_strings(a, b *string) int {
aa := a.to_lower()
bb := b.to_lower()
return compare_strings(aa, bb)
}
pub fn (s mut []string) sort() {
s.sort_with_compare(compare_strings)
}
pub fn (s mut []string) sort_ignore_case() {
s.sort_with_compare(compare_lower_strings)
}
pub fn (s mut []string) sort_by_len() {
s.sort_with_compare(compare_strings_by_len)
}
pub fn (s string) ustring() ustring {
mut res := ustring {
s: s
// runes will have at least s.len elements, save reallocations
// TODO use VLA for small strings?
runes: new_array(0, s.len, sizeof(int))
}
for i := 0; i < s.len; i++ {
char_len := utf8_char_len(s.str[i])
//# char_len =UTF8_CHAR_LEN(s.str[i]);
// println('cl=$char_len')
res.runes << i
i += char_len - 1
res.len++
}
return res
}
// A hack that allows to create ustring without allocations.
// It's called from functions like draw_text() where we know that the string is going to be freed
// right away. Uses global buffer for storing runes []int array.
__global g_ustring_runes []int
pub fn (s string) ustring_tmp() ustring {
mut res := ustring {
s: s
runes: 0
}
res.runes = g_ustring_runes
res.runes.len = s.len
mut j := 0
for i := 0; i < s.len; i++ {
//char_len := 0
//# char_len =UTF8_CHAR_LEN(s.str[i]);
char_len := utf8_char_len(s.str[i])
res.runes[j] = i
j++
i += char_len - 1
res.len++
}
return res
}
fn (u ustring) substr(start, end int) string {
// println('substr($start, $end)')
// println('runes=')
// println(u.runes)
start = u.runes[start]
// handle last char
if end >= u.runes.len {
end = u.s.len
}
else {
end = u.runes[end]
}
// println('fast $start, $end')
return u.s.substr(start, end)
}
fn (u ustring) left(pos int) string {
return u.substr(0, pos)
}
fn (u ustring) right(pos int) string {
return u.substr(pos, u.len)
}
fn (s string) at(idx int) byte {
if idx < 0 || idx >= s.len {
panic('string index out of range: $idx / $s.len')
}
return s.str[idx]
}
pub fn (u ustring) at(idx int) string {
return u.substr(idx, idx + 1)
}
fn (u ustring) free() {
u.runes.free()
}
fn abs(a int) int {
if a >= 0 {
return a
}
return -a
}
pub fn (c byte) is_digit() bool {
return c >= `0` && c <= `9`
}
pub fn (c byte) is_letter() bool {
return (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`)
}
pub fn (s string) free() {
C.free(s.str)
}
fn (arr[]string) free() {
for s in arr {
s.free()
}
C.free(arr.data)
}
// all_before('23:34:45.234', '.') == '23:34:45'
pub fn (s string) all_before(dot string) string {
pos := s.index(dot)
if pos == -1 {
return s
}
return s.left(pos)
}
pub fn (s string) all_before_last(dot string) string {
pos := s.last_index(dot)
if pos == -1 {
return s
}
return s.left(pos)
}
pub fn (s string) all_after(dot string) string {
pos := s.last_index(dot)
if pos == -1 {
return s
}
return s.right(pos + dot.len)
}
// fn (s []string) substr(a, b int) string {
// return join_strings(s.slice_fast(a, b))
// }
pub fn (a[]string) join(del string) string {
if a.len == 0 {
return ''
}
mut len := 0
for i, val in a {
len += val.len + del.len
}
len -= del.len
// Allocate enough memory
mut res := ''
res.len = len
res.str = malloc(res.len + 1)
mut idx := 0
// Go thru every string and copy its every char one by one
for i, val in a {
for j := 0; j < val.len; j++ {
c := val[j]
res.str[idx] = val.str[j]
idx++
}
// Add del if it's not last
if i != a.len - 1 {
for k := 0; k < del.len; k++ {
res.str[idx] = del.str[k]
idx++
}
}
}
res.str[res.len] = `\0`
return res
}
pub fn (s[]string) join_lines() string {
return s.join('\n')
}
pub fn (s string) reverse() string {
mut res := string {
len: s.len
str: malloc(s.len + 1)
}
for i := s.len - 1; i >= 0; i-- {
res[s.len-i-1] = s[i]
}
return res
}
// 'hello'.limit(2) => 'he'
// 'hi'.limit(10) => 'hi'
pub fn (s string) limit(max int) string {
u := s.ustring()
if u.len <= max {
return s
}
return u.substr(0, max)
}
// TODO is_white_space()
pub fn (c byte) is_white() bool {
i := int(c)
return i == 10 || i == 32 || i == 9 || i == 13 || c == `\r`
}
// TODO move this to strings.repeat()
pub fn repeat_char(c byte, n int) string {
if n <= 0 {
return ''
}
mut arr := malloc(n + 1)
for i := 0; i < n; i++ {
arr[i] = c
}
arr[n] = `\0`
return tos(arr, n)
}
pub fn (s string) hash() int {
mut hash := int(0)
for i := 0; i < s.len; i++ {
// if key == 'Content-Type' {
// println('$i) $hash')
// }
hash = hash * int(31) + int(s.str[i])
}
return hash
}

View File

@@ -1,39 +0,0 @@
// Copyright (c) 2019 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 builtin
struct StringBuilder {
buf []byte
len int
}
pub fn new_string_builder(initial_size int) StringBuilder {
return StringBuilder {
buf: new_array(0, initial_size, sizeof(byte))
}
}
pub fn (b mut StringBuilder) write(s string) {
b.buf._push_many(s.str, s.len)
b.len += s.len
}
pub fn (b mut StringBuilder) writeln(s string) {
b.buf._push_many(s.str, s.len)
b.buf << `\n`
b.len += s.len + 1
}
pub fn (b StringBuilder) str() string {
return tos(b.buf.data, b.len)
}
pub fn (b StringBuilder) cut(n int) {
b.len -= n
}
pub fn (b mut StringBuilder) free() {
C.free(b.buf.data)
}

View File

@@ -1,293 +0,0 @@
// Copyright (c) 2019 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
fn test_add() {
mut a := 'a'
a += 'b'
assert a==('ab')
a = 'a'
for i := 1; i < 1000; i++ {
a += 'b'
}
assert a.len == 1000
assert a.ends_with('bbbbb')
a += '123'
assert a.ends_with('3')
}
fn test_ends_with() {
a := 'browser.v'
assert a.ends_with('.v')
}
fn test_between() {
s := 'hello [man] how you doing'
assert s.find_between('[', ']') == 'man'
}
fn test_compare() {
a := 'Music'
b := 'src'
assert b>=(a)
}
fn test_lt() {
a := ''
b := 'a'
c := 'a'
d := 'b'
e := 'aa'
f := 'ab'
assert a<(b)
assert !(b<c)
assert c<(d)
assert !(d<e)
assert c<(e)
assert e<(f)
}
fn test_ge() {
a := 'aa'
b := 'aa'
c := 'ab'
d := 'abc'
e := 'aaa'
assert b>=(a)
assert c>=(b)
assert d>=(c)
assert !(c>=d)
assert e>=(a)
}
fn test_compare_strings() {
a := 'aa'
b := 'aa'
c := 'ab'
d := 'abc'
e := 'aaa'
assert compare_strings(a, b) == 0
assert compare_strings(b, c) == -1
assert compare_strings(c, d) == -1
assert compare_strings(d, e) == 1
assert compare_strings(a, e) == -1
assert compare_strings(e, a) == 1
}
fn test_sort() {
mut vals := [
'arr', 'an', 'a', 'any'
]
len := vals.len
vals.sort()
assert len == vals.len
assert vals[0] == 'a'
assert vals[1] == 'an'
assert vals[2] == 'any'
assert vals[3] == 'arr'
}
fn test_split() {
mut s := 'volt/twitch.v:34'
mut vals := s.split(':')
assert vals.len == 2
assert vals[0]== 'volt/twitch.v'
assert vals[1]== '34'
// /////////
s = '2018-01-01z13:01:02'
vals = s.split('z')
assert vals.len == 2
assert vals[0]=='2018-01-01'
assert vals[1]== '13:01:02'
// /////////////
s = '4627a862c3dec29fb3182a06b8965e0025759e18___1530207969___blue'
vals = s.split('___')
assert vals.len == 3
assert vals[0]== '4627a862c3dec29fb3182a06b8965e0025759e18'
assert vals[1]=='1530207969'
assert vals[2]== 'blue'
}
fn test_trim_space() {
a := ' a '
assert a.trim_space() == 'a'
code := '
fn main() {
println(2)
}
'
code_clean := 'fn main() {
println(2)
}'
assert code.trim_space() == code_clean
}
fn test_join() {
mut strings := [ 'a', 'b', 'c' ]
mut s := strings.join(' ')
assert s == 'a b c'
strings = ['one
two ',
'three!
four!']
s = strings.join(' ')
assert s.contains('one') && s.contains('two ') && s.contains('four')
}
fn test_clone() {
mut a := 'a'
a += 'a'
a += 'a'
mut b := a
mut c := a.clone()
assert c == a
assert c == 'aaa'
assert b == 'aaa'
}
fn test_replace() {
a := 'hello man!'
mut b := a.replace('man', 'world')
assert b==('hello world!')
b = b.replace('!', '')
assert b==('hello world')
b = b.replace('h', 'H')
assert b==('Hello world')
b = b.replace('kek', 'lul')
assert b==('Hello world')
s := 'hey man how are you'
assert s.replace('man ', '') == 'hey how are you'
lol := 'lol lol lol'
assert lol.replace('lol', 'kek') == 'kek kek kek'
b = 'oneBtwoBBthree'
assert b.replace('B', '') == 'onetwothree'
b = '**char'
assert b.replace('*char', 'byteptr') == '*byteptr'
}
fn test_itoa() {
num := 777
assert num.str() == '777'
big := 7779998
assert big.str() == '7779998'
a := 3
assert a.str() == '3'
b := 5555
assert b.str() == '5555'
zero := 0
assert zero.str() == '0'
neg := -7
assert neg.str() == '-7'
}
fn test_reassign() {
a := 'hi'
mut b := a
b += '!'
assert a == 'hi'
assert b == 'hi!'
}
fn test_runes() {
s := 'привет'
assert s.len == 12
s2 := 'privet'
assert s2.len == 6
u := s.ustring()
assert u.len == 6
assert s2.substr(1, 4).len == 3
assert s2.substr(1, 4) == 'riv'
assert u.substr(1, 4).len == 6
assert u.substr(1, 4) == 'рив'
assert s2.substr(1, 2) == 'r'
assert u.substr(1, 2) == 'р'
assert s2.ustring().at(1) == 'r'
assert u.at(1) == 'р'
// ///////
first := u.at(0)
last := u.at(u.len - 1)
assert first.len == 2
assert last.len == 2
}
fn test_lower() {
mut s := 'A'
assert s.to_lower() == 'a'
assert s.to_lower().len == 1
s = 'HELLO'
assert s.to_lower() == 'hello'
assert s.to_lower().len == 5
s = 'Aloha'
assert s.to_lower() == 'aloha'
s = 'Have A nice Day!'
assert s.to_lower() == 'have a nice day!'
s = 'hi'
assert s.to_lower() == 'hi'
}
fn test_left_right() {
s := 'ALOHA'
assert s.left(3) == 'ALO'
assert s.right(3) == 'HA'
u := s.ustring()
assert u.left(3) == 'ALO'
assert u.right(3) == 'HA'
}
fn test_contains() {
s := 'view.v'
assert s.contains('vi')
assert !s.contains('random')
}
fn test_arr_contains() {
a := ['a', 'b', 'c']
assert a.contains('b')
ints := [1, 2, 3]
assert ints.contains(2)
}
fn test_to_num() {
s := '7'
assert s.int() == 7
f := '71.5 hasdf'
assert f.f32() == 71.5
b := 1.52345
mut a := '${b:.03f}'
assert a == '1.523'
num := 7
a = '${num:03d}'
vals := ['9']
assert vals[0].int() == 9
}
fn test_hash() {
s := '10000'
assert s.hash() == 46730161
s2 := '24640'
assert s2.hash() == 47778736
s3 := 'Content-Type'
assert s3.hash() == 949037134
s4 := 'bad_key'
assert s4.hash() == -346636507
s5 := '24640'
// From a map collision test
assert s5.hash() % ((1 << 20) -1) == s.hash() % ((1 << 20) -1)
assert s5.hash() % ((1 << 20) -1) == 592861
}
fn test_trim_left() {
mut s := 'module main'
assert s.trim_left(' ') == 'module main'
s = ' module main'
assert s.trim_left(' ') == 'module main'
}
fn test_all_after() {
s := 'fn hello'
q := s.all_after('fn ')
assert q == 'hello'
}

View File

@@ -1,93 +0,0 @@
// Copyright (c) 2019 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 builtin
pub fn utf8_char_len(b byte) int {
return (( 0xe5000000 >> (( b >> 3 ) & 0x1e )) & 3 ) + 1
}
// Convert utf32 to utf8
// utf32 == Codepoint
pub fn utf32_to_str(code u32) string {
icode := int(code) //Prevents doing casts everywhere
mut buffer := malloc(5)
if icode <= 127 /* 0x7F */ {
buffer[0] = icode
return tos(buffer, 1)
}
if (icode <= 2047 /* 0x7FF */) {
buffer[0] = 192 /*0xC0*/ | (icode >> 6) /* 110xxxxx */
buffer[1] = 128 /*0x80*/ | (icode & 63 /*0x3F*/) /* 10xxxxxx */
return tos(buffer, 2)
}
if (icode <= 65535 /* 0xFFFF */) {
buffer[0] = 224 /*0xE0*/ | (icode >> 12) /* 1110xxxx */
buffer[1] = 128 /*0x80*/ | ((icode >> 6) & 63 /*0x3F*/) /* 10xxxxxx */
buffer[2] = 128 /*0x80*/ | (icode & 63 /*0x3F*/) /* 10xxxxxx */
return tos(buffer, 3)
}
if (icode <= 1114111 /* 0x10FFFF */) {
buffer[0] = 240 /*0xF0*/ | (icode >> 18) /* 11110xxx */
buffer[1] = 128 /*0x80*/ | ((icode >> 12) & 63 /*0x3F*/) /* 10xxxxxx */
buffer[2] = 128 /*0x80*/ | ((icode >> 6) & 63 /*0x3F*/) /* 10xxxxxx */
buffer[3] = 128 /*0x80*/ | (icode & 63 /*0x3F*/) /* 10xxxxxx */
return tos(buffer, 4)
}
return ''
}
// TODO copypasta
pub fn utf32_to_str_no_malloc(code u32, buf voidptr) string {
icode := int(code) //Prevents doing casts everywhere
mut buffer := byteptr(buf)
if icode <= 127 /* 0x7F */ {
buffer[0] = icode
return tos(buffer, 1)
}
if (icode <= 2047 /* 0x7FF */) {
buffer[0] = 192 /*0xC0*/ | (icode >> 6) /* 110xxxxx */
buffer[1] = 128 /*0x80*/ | (icode & 63 /*0x3F*/) /* 10xxxxxx */
return tos(buffer, 2)
}
if (icode <= 65535 /* 0xFFFF */) {
buffer[0] = 224 /*0xE0*/ | (icode >> 12) /* 1110xxxx */
buffer[1] = 128 /*0x80*/ | ((icode >> 6) & 63 /*0x3F*/) /* 10xxxxxx */
buffer[2] = 128 /*0x80*/ | (icode & 63 /*0x3F*/) /* 10xxxxxx */
return tos(buffer, 3)
}
if (icode <= 1114111 /* 0x10FFFF */) {
buffer[0] = 240 /*0xF0*/ | (icode >> 18) /* 11110xxx */
buffer[1] = 128 /*0x80*/ | ((icode >> 12) & 63 /*0x3F*/) /* 10xxxxxx */
buffer[2] = 128 /*0x80*/ | ((icode >> 6) & 63 /*0x3F*/) /* 10xxxxxx */
buffer[3] = 128 /*0x80*/ | (icode & 63 /*0x3F*/) /* 10xxxxxx */
return tos(buffer, 4)
}
return ''
}
// Convert utf8 to utf32
pub fn (_rune string) utf32_code() int {
if _rune.len == 0 {
return 0
}
// save ASC symbol as is
if _rune.len == 1 {
return int(_rune[0])
}
mut b := byte(int(_rune[0]))
// TODO should be
// res := int( rune[0] << rune.len)
b = b << _rune.len
mut res := int(b)
mut shift := 6 - _rune.len
for i := 1; i < _rune.len; i++ {
c := int(_rune[i])
res = res << shift
res |= c & 63 /* 0x3f */
shift = 6
}
return res
}

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

@@ -0,0 +1,53 @@
module main
import hash.fnv1a
import hash.wyhash
import rand
import time
fn main() {
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 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)
}
println('Hashing each of the generated strings...')
t0 := time.ticks()
mut start_pos := 0
for len in str_lens {
end_pos := start_pos + len
str := string(bytepile[start_pos..end_pos],len)
wyhash.wyhash_c(&str.str, u64(str.len), 1)
start_pos = end_pos
}
t1 := time.ticks()
d1 := t1 - t0
println(' * wyhash4 C: ${d1}ms')
start_pos = 0
for len in str_lens {
end_pos := start_pos + len
str := string(bytepile[start_pos..end_pos],len)
wyhash.sum64_string(str, 1)
start_pos = end_pos
}
t2 := time.ticks()
d2 := t2 - t1
println(' * wyhash4: ${d2}ms')
start_pos = 0
for len in str_lens {
end_pos := start_pos + len
str := string(bytepile[start_pos..end_pos],len)
fnv1a.sum64_string(str)
start_pos = end_pos
}
t3 := time.ticks()
d3 := t3 - t2
println(' * fnv1a64: ${d3}ms')
}

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

@@ -0,0 +1,31 @@
module main
import os
const (
too_long_line_length = 100
)
fn main() {
files_paths := os.args[1..]
mut errors := 0
for file_path in files_paths {
real_path := os.real_path(file_path)
lines := os.read_lines(real_path) or {
continue
}
for i, line in lines {
if line.len > too_long_line_length {
eprintln('$real_path:${i+1}:${line.len+1}: line too long')
errors++
}
}
}
// TODO: uncomment this AFTER doc/docs.md line lengths are fixed
/*
if errors > 0 {
exit(1)
}
*/
}

View File

@@ -0,0 +1,126 @@
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.wyhash', '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, 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 {
fnd := s as ast.FnDecl
if fnd.is_pub {
fn_signature := fnd.str(b.table)
fn_mod := fnd.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, api_os, mod_name, os_base, 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

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

@@ -0,0 +1,86 @@
// 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('git pull --rebase')
if ret != 0 {
println('failed to git pull')
return
}
mut commit_hash := exec('git rev-parse HEAD')
commit_hash = commit_hash[..7]
if !os.exists('table.html') {
os.create('table.html') or { panic(err) }
}
mut table := os.read_file('table.html') or { panic(err) }
// Do nothing if it's already been processed.
if table.contains(commit_hash) {
println('Commit $commit_hash has already been processed')
return
}
// Build an optimized V
println('Building vprod...')
exec('v -o $vdir/vprod -prod $vdir/cmd/v')
println('Measuring...')
diff1 := measure('$vdir/vprod -cc clang -o v.c $vdir/cmd/v')
diff2 := measure('$vdir/vprod -cc clang -o v2 $vdir/cmd/v')
diff3 := measure('$vdir/vprod -x64 $vdir/cmd/tools/1mil.v')
diff4 := measure('$vdir/vprod -cc clang $vdir/examples/hello_world.v')
//println('Building V took ${diff}ms')
commit_date := exec('git log -n1 --pretty="format:%at"')
message := exec('git log -n1 --pretty="format:%s"')
date := time.unix(commit_date.int())
mut out := os.create('table.html') or { panic(err) }
// Place the new row on top
table =
'<tr>
<td>${date.format()}</td>
<td><a target=_blank href="https://github.com/vlang/v/commit/$commit_hash">$commit_hash</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') or { panic(err) }
footer := os.read_file('footer.html') or { panic(err) }
mut res := os.create('index.html') or { panic(err) }
res.writeln(header)
res.writeln(table)
res.writeln(footer)
res.close()
}
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) int {
println('Warming up...')
for _ in 0..3 {
exec(cmd)
}
println('Building...')
sw := time.new_stopwatch({})
exec(cmd)
return int(sw.elapsed().milliseconds())
}

View File

@@ -0,0 +1,65 @@
(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) > 50)
tr.children[vc].appendChild(createElement(result.vc));
if (Math.abs(result.vv) > 50)
tr.children[vv].appendChild(createElement(result.vv));
if (Math.abs(result.vf) > 50)
tr.children[vf].appendChild(createElement(result.vf));
if (Math.abs(result.vh) > 50)
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,52 @@
<!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>
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>

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

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

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

@@ -0,0 +1,395 @@
// 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
module main
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)
}
// cmd mode
else {
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()
}
// 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,100 @@
module scripting
import os
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 verbose_trace(label string, message string) {
if os.getenv('VERBOSE').len > 0 {
slabel := 'scripting.${label}'
println('# ${slabel:-25s} : $message')
}
}
pub fn verbose_trace_exec_result(x os.Result) {
if os.getenv('VERBOSE').len > 0 {
println('# cmd.exit_code : ${x.exit_code.str():-4s} cmd.output:')
println('# ----------------------------------- #')
mut lnum := 1
lines := x.output.split_into_lines()
for line in lines {
println('# ${lnum:3d}: $line')
lnum++
}
println('# ----------------------------------- #')
}
}
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 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,304 @@
module testing
import os
import term
import benchmark
import sync
import v.pref
pub struct TestMessageHandler {
mut:
messages []string
pub mut:
message_idx int
mtx &sync.Mutex
}
pub struct TestSession {
pub mut:
files []string
skip_files []string
vexe string
vroot string
vargs string
failed bool
benchmark benchmark.Benchmark
show_ok_tests bool
message_handler &TestMessageHandler
}
pub fn (mut mh TestMessageHandler) append_message(msg string) {
mh.mtx.lock()
mh.messages << msg
mh.mtx.unlock()
}
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('-silent', '')
vexe := pref.vexe_path()
return TestSession{
vexe: vexe
vroot: os.dir(vexe)
skip_files: skip_files
vargs: vargs
show_ok_tests: !_vargs.contains('-silent')
message_handler: &TestMessageHandler(0)
}
}
pub fn (mut ts TestSession) init() {
ts.benchmark = benchmark.new_benchmark_no_cstep()
}
pub fn (mut ts TestSession) test() {
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
}
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.message_handler = &TestMessageHandler{
mtx: sync.new_mutex()
}
pool_of_test_runners.set_shared_context(ts)
pool_of_test_runners.work_on_pointers(remaining_files.pointers())
ts.benchmark.stop()
eprintln(term.h_divider('-'))
}
pub fn (mut m TestMessageHandler) display_message() {
m.mtx.lock()
defer {
m.messages.clear()
m.mtx.unlock()
}
for msg in m.messages {
m.message_idx++
eprintln(msg.
replace("TMP1", "${m.message_idx:1d}").
replace("TMP2", "${m.message_idx:2d}").
replace("TMP3", "${m.message_idx:3d}")
)
}
}
fn worker_trunner(mut p sync.PoolProcessor, idx int, thread_id int) voidptr {
mut ts := &TestSession(p.get_shared_context())
defer { ts.message_handler.display_message() }
tmpd := os.temp_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)
relative_file := dot_relative_file.replace(ts.vroot + os.path_separator, '').replace('./', '')
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) {
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}"'
// eprintln('>>> v cmd: $cmd')
ts.benchmark.step()
tls_bench.step()
if relative_file.replace('\\', '/') in ts.skip_files {
ts.benchmark.skip()
tls_bench.skip()
ts.message_handler.append_message(tls_bench.step_message_skip(relative_file))
return sync.no_result
}
if show_stats {
ts.message_handler.append_message(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.message_handler.append_message(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.message_handler.append_message(tls_bench.step_message_fail('${relative_file}\n$r.output\n'))
}
else {
ts.benchmark.ok()
tls_bench.ok()
if ts.show_ok_tests {
ts.message_handler.append_message(tls_bench.step_message_ok(relative_file))
}
}
}
if os.exists(generated_binary_fpath) {
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 v_build_failing_skipped(zargs string, folder string, skipped []string) bool {
main_label := 'Building $folder ...'
finish_label := 'building $folder'
vexe := pref.vexe_path()
parent_dir := os.dir(vexe)
vlib_should_be_present(parent_dir)
vargs := zargs.replace(vexe, '')
eheader(main_label)
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{}
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
}
}
mains << f
}
}
session.files << mains
session.skip_files << skipped
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)
testing.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, '-'))
}

View File

@@ -0,0 +1,184 @@
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 := vgit.line_to_timestamp_and_commit(vline)
vgit.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 := vgit.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 := vgit.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, vgit.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, vgit.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 {
vgit.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','internal','help','${topic}.txt')
content := os.read_file(target_topic) or {
eprintln('Unknown topic: $topic')
exit(1)
}
println(content)
}

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

@@ -0,0 +1,112 @@
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'
)
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')
}
println('################# 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)
println('# v commit hash: $context.commit_v_hash')
println('# checkout folder: $context.path_v')
if context.cmd_to_run.len > 0 {
cmdres := os.exec(context.cmd_to_run) or {
panic(err)
}
println('# 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,209 @@
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.
'
)
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,5 @@
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

View File

@@ -0,0 +1,5 @@
module main
// This prelude is loaded in every v program compiled with -live,
// but only for the main executable.
import live.executable

View File

@@ -0,0 +1,5 @@
module main
// This prelude is loaded in every v program compiled with -live,
// but only for the shared library.
import live.shared

View File

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

View File

@@ -0,0 +1,41 @@
module main
import os
// //////////////////////////////////////////////////////////////////
// / 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) {
// color_on := 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('__', '.')
eprintln('')
eprintln('$final_filename:${i.line_nr+1}: failed assert in ${final_funcname}')
eprintln('Source : ${i.src}')
if i.op.len > 0 && i.op != 'call' {
eprintln(' left value: ${i.llabel} = ${i.lvalue}')
if i.rlabel == i.rvalue {
eprintln(' right value: $i.rlabel')
}
else {
eprintln(' right value: ${i.rlabel} = ${i.rvalue}')
}
}
}
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,89 @@
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 | '
}

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

@@ -0,0 +1,122 @@
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 += '\n'
header_s += 'const (\n'
return header_s
}
fn (context Context) footer() string {
return ')\n'
}
fn (context Context) file2v(file string) string {
mut sb := strings.new_builder(1000)
fname := os.file_name(file)
fname_no_dots := fname.replace('.', '_')
byte_name := '${context.prefix}${fname_no_dots}'
fbytes := os.read_bytes(file) or {
eprintln('Error: $err')
return ''
}
fbyte := fbytes[0]
sb.write(' ${byte_name}_len = ${fbytes.len}\n')
sb.write(' ${byte_name} = [ byte(${fbyte}), \n ')
for i := 1; i < fbytes.len; i++ {
b := int(fbytes[i]).str()
sb.write('${b:4s}, ')
if 0 == i % 16 {
sb.write('\n ')
}
}
sb.write('\n]!!\n')
sb.write('\n')
return sb.str()
}
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.ends_with('.v') {
context.write_file += '.v'
}
if context.write_file.len > 0 {
mut out_file := os.create(context.write_file) or { panic(err) }
out_file.write(context.header())
for file in real_files {
out_file.write(context.file2v(file))
}
out_file.write(context.footer())
}
else {
println(context.header())
for file in real_files {
println(context.file2v(file))
}
println(context.footer())
}
}

View File

@@ -0,0 +1,19 @@
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)
}
}

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

@@ -0,0 +1,18 @@
module main
import os
import testing
import v.util
fn main() {
args := os.args
args_string := args[1..].join(' ')
// TODO: fix cmd/tools/gen_vc.v / vweb too
skips := [
'cmd/tools/gen_vc.v'
]
util.ensure_modules_for_all_tools_are_installed('-v' in args)
if testing.v_build_failing_skipped(args_string.all_before('build-tools'), 'cmd/tools', skips) {
exit(1)
}
}

View File

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

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

@@ -0,0 +1,159 @@
// 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.
module main
import os
struct Create {
mut:
name string
description string
}
fn cerror(e string){
eprintln('\nerror: $e')
}
fn vmod_content(name, desc string) string {
return [
'Module {',
' name: \'${name}\',',
' description: \'${desc}\',',
' 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 [
'main',
'$name',
'*.so',
'*.dylib',
'*.dll'
].join('\n')
}
fn (c &Create)create_vmod() {
mut vmod := os.create('${c.name}/v.mod') or {
cerror(err)
exit(1)
}
vmod.write(vmod_content(c.name, c.description))
vmod.close()
}
fn (c &Create)create_main() {
mut main := os.create('${c.name}/${c.name}.v') or {
cerror(err)
exit(2)
}
main.write(main_content())
main.close()
}
fn (c &Create)init_vmod() {
mut vmod := os.create('v.mod') or {
cerror(err)
exit(1)
}
vmod.write(vmod_content(c.name, c.description))
vmod.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(gen_gitignore(c.name))
fl.close()
}
}
}
fn (c &Create)init_main() {
// The file already exists, don't over-write anything.
// Searching in the 'src' directory allows flexibility user module structure
if os.exists('${c.name}.v') || os.exists('src/${c.name}.v') {
return
}
mut main := os.create('${c.name}.v') or {
cerror(err)
exit(2)
}
main.write(main_content())
main.close()
}
fn create() {
mut c := Create{}
print('Input your project name: ')
c.name = os.get_line()
if os.is_dir(c.name) {
cerror('${c.name} folder already exists')
exit(3)
}
print('Input your project description: ')
c.description = os.get_line()
println('Initialising ...')
os.mkdir(c.name) or {
panic(err)
}
c.create_vmod()
c.create_main()
c.create_git_repo(c.name)
}
fn init() {
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.init_vmod()
c.init_main()
c.create_git_repo('')
println("Change your module's description in `v.mod`")
}
fn main() {
if 'new' == os.args[1] {
create()
} else if 'init' == os.args[1] {
init()
} 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,576 @@
: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: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.9rem;
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: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;
}

895
cmd/tools/vdoc.v Normal file
View File

@@ -0,0 +1,895 @@
module main
import markdown
import net
import net.urllib
import os
import os.cmdline
import time
import strings
import v.doc
import v.scanner
import v.table
import v.token
import v.vmod
enum HighlightTokenTyp {
unone
boolean
builtin
char
comment
function
keyword
name
number
operator
punctuation
string
symbol
}
const (
css_js_assets = ['doc.css', 'normalize.css' 'doc.js']
allowed_formats = ['md', 'markdown', 'json', 'text', 'stdout', 'html', 'htm']
exe_path = os.executable()
exe_dir = os.dir(exe_path)
res_path = os.join_path(exe_dir, 'vdoc-resources')
vexe_path = os.base_dir(@VEXE)
html_content = '
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }} | vdoc</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
{{ head_assets }}
</head>
<body>
<div id="page">
<header class="doc-nav hidden">
<div class="heading-container">
<div class="heading">
<input type="text" id="search" placeholder="Search...">
<div class="module">{{ head_name }}</div>
<div class="toggle-version-container">
<span>{{ version }}</span>
<div id="dark-mode-toggle" role="switch" aria-checked="false" aria-label="Toggle dark mode">{{ light_icon }}{{ dark_icon }}</div>
</div>
{{ menu_icon }}
</div>
</div>
<nav class="content hidden">
<ul>
{{ toc_links }}
</ul>
</nav>
</header>
<div class="doc-container">
<div class="doc-content">
{{ contents }}
<div class="footer">
{{ footer_content }}
</div>
</div>
{{ right_content }}
</div>
</div>
{{ footer_assets }}
</body>
</html>
'
)
enum OutputType {
unset
html
markdown
json
plaintext
stdout
}
struct DocConfig {
mut:
pub_only bool = true
show_loc bool = false // for plaintext
serve_http bool = false // for html
is_multi bool = false
is_verbose bool = false
include_readme bool = false
open_docs bool = false
server_port int = 8046
inline_assets bool = false
output_path string
input_path string
output_type OutputType = .unset
docs []doc.Doc
manifest vmod.Manifest
}
fn slug(title string) string {
return title.replace(' ', '-')
}
fn open_url(url string) {
$if windows {
os.system('start $url')
}
$if macos {
os.system('open $url')
}
$if linux {
os.system('xdg-open $url')
}
}
fn (mut cfg DocConfig) serve_html() {
docs := cfg.render()
dkeys := docs.keys()
if dkeys.len < 1 {
eprintln('no documentation created, the module has no `pub` functions')
exit(1)
}
def_name := docs.keys()[0]
//
server_url := 'http://localhost:' + cfg.server_port.str()
server := net.listen(cfg.server_port) or {
panic(err)
}
println('Serving docs on: $server_url')
if cfg.open_docs {
open_url(server_url)
}
content_type := match cfg.output_type {
.html { 'text/html' }
.markdown { 'text/markdown' }
.json { 'application/json' }
else { 'text/plain' }
}
server_context := VdocHttpServerContext {
docs: docs
content_type: content_type
default_filename: def_name
}
for {
con := server.accept() or {
server.close() or { }
panic(err)
}
handle_http_connection(mut con, server_context)
con.close() or {
eprintln('error closing the connection: $err')
}
}
}
struct VdocHttpServerContext {
docs map[string]string
content_type string
default_filename string
}
fn handle_http_connection(mut con net.Socket, ctx &VdocHttpServerContext) {
s := con.read_line()
first_line := s.all_before('\r\n')
if first_line.len == 0 {
send_http_response(mut con, 501, ctx.content_type, 'bad request')
return
}
request_parts := first_line.split(' ')
if request_parts.len != 3 {
send_http_response(mut con, 501, ctx.content_type, 'bad request')
return
}
urlpath := request_parts[1]
filename := if urlpath == '/' { ctx.default_filename.trim_left('/') } else { urlpath.trim_left('/') }
if ctx.docs[filename].len == 0 {
send_http_response(mut con, 404, ctx.content_type, 'file not found')
return
}
send_http_response(mut con, 200, ctx.content_type, ctx.docs[filename])
}
fn send_http_response(mut con net.Socket, http_code int, content_type string, html string) {
content_length := html.len.str()
shttp_code := http_code.str()
mut http_response := strings.new_builder(20000)
http_response.write('HTTP/1.1 ')
http_response.write(shttp_code)
http_response.write(' OK\r\n')
http_response.write('Server: VDoc\r\n')
http_response.write('Content-Type: ')
http_response.write(content_type)
http_response.write('\r\n')
http_response.write('Content-Length: ')
http_response.write(content_length)
http_response.write('\r\n')
http_response.write('Connection: close\r\n')
http_response.write('\r\n')
http_response.write(html)
sresponse := http_response.str()
con.send_string(sresponse) or {
eprintln('error sending http response: $err')
}
}
fn get_src_link(repo_url string, file_name string, line_nr int) string {
mut url := urllib.parse(repo_url) or {
return ''
}
if url.path.len <= 1 || file_name.len == 0 {
return ''
}
url.path = url.path.trim_right('/') + match url.host {
'github.com' { '/blob/master/$file_name' }
'gitlab.com' { '/-/blob/master/$file_name' }
'git.sir.ht' { '/tree/master/$file_name' }
else { '' }
}
if url.path == '/' { return '' }
url.fragment = 'L$line_nr'
return url.str()
}
fn js_compress(str string) string {
mut js := strings.new_builder(200)
lines := str.split_into_lines()
rules := [') {', ' = ', ', ', '{ ', ' }', ' (', '; ', ' + ', ' < ', ' - ', ' || ', ' var', ': ', ' >= ', ' && ', ' else if', ' === ', ' !== ', ' else ']
clean := ['){', '=', ',', '{', '}', '(', ';', '+', '<', '-', '||', 'var', ':', '>=', '&&', 'else if', '===', '!==', 'else']
for line in lines {
mut trimmed := line.trim_space()
if trimmed.starts_with('//') || (trimmed.starts_with('/*') && trimmed.ends_with('*/')) { continue }
for i in 0..rules.len-1 {
trimmed = trimmed.replace(rules[i], clean[i])
}
js.write(trimmed)
}
return js.str()
}
fn escape(str string) string {
return str.replace_each(['"', '\\"', '\r\n', '\\n', '\n', '\\n'])
}
fn (cfg DocConfig) gen_json(idx int) string {
dcs := cfg.docs[idx]
mut jw := strings.new_builder(200)
jw.writeln('{\n\t"module_name": "$dcs.head.name",\n\t"description": "${escape(dcs.head.comment)}",\n\t"contents": [')
for i, cn in dcs.contents {
name := cn.name.all_after(dcs.head.name)
jw.writeln('\t\t{')
jw.writeln('\t\t\t"name": "$name",')
jw.writeln('\t\t\t"signature": "${escape(cn.content)}",')
jw.writeln('\t\t\t"description": "${escape(cn.comment)}"')
jw.write('\t\t}')
if i < dcs.contents.len-1 { jw.writeln(',') }
}
jw.writeln('\n\t],')
jw.write('\t"generator": "vdoc",\n\t"time_generated": "${dcs.time_generated.str()}"\n}')
return jw.str()
}
fn html_highlight(code string, tb &table.Table) string {
builtin := ['bool', 'string', 'i8', 'i16', 'int', 'i64', 'i128', 'byte', 'u16', 'u32', 'u64', 'u128', 'rune', 'f32', 'f64', 'any_int', 'any_float', 'byteptr', 'voidptr', 'any']
highlight_code := fn (tok token.Token, typ HighlightTokenTyp) string {
lit := if typ in [.unone, .operator, .punctuation] {
tok.kind.str()
} else if typ == .string {
"'$tok.lit'"
} else if typ == .char {
'`$tok.lit`'
} else { tok.lit }
return if typ in [.unone, .name] { lit } else { '<span class="token $typ">$lit</span>' }
}
s := scanner.new_scanner(code, .parse_comments, false)
mut tok := s.scan()
mut next_tok := s.scan()
mut buf := strings.new_builder(200)
mut i := 0
for i < code.len {
if i == tok.pos {
mut tok_typ := HighlightTokenTyp.unone
match tok.kind {
.name {
if tok.lit in builtin || tb.known_type(tok.lit) {
tok_typ = .builtin
} else if next_tok.kind == .lcbr {
tok_typ = .symbol
} else if next_tok.kind == .lpar {
tok_typ = .function
} else {
tok_typ = .name
}
}
.comment {
tok_typ = .comment
}
.chartoken {
tok_typ = .char
}
.string {
tok_typ = .string
}
.number {
tok_typ = .number
}
.key_true, .key_false {
tok_typ = .boolean
}
.lpar, .lcbr, .rpar, .rcbr, .lsbr,
.rsbr, .semicolon, .colon, .comma, .dot {
tok_typ = .punctuation
}
else {
if token.is_key(tok.lit) || token.is_decl(tok.kind) {
tok_typ = .keyword
} else if tok.kind == .decl_assign || tok.kind.is_assign() || tok.is_unary() || tok.kind.is_relational() || tok.kind.is_infix() {
tok_typ = .operator
}
}
}
buf.write(highlight_code(tok, tok_typ))
if next_tok.kind != .eof {
i = tok.pos + tok.len
tok = next_tok
next_tok = s.scan()
} else {
break
}
} else {
buf.write_b(code[i])
i++
}
}
return buf.str()
}
fn doc_node_html(dd doc.DocNode, link string, head bool, tb &table.Table) string {
mut dnw := strings.new_builder(200)
link_svg := '<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>'
head_tag := if head { 'h1' } else { 'h2' }
md_content := markdown.to_html(dd.comment)
hlighted_code := html_highlight(dd.content, tb)
is_const_class := if dd.name == 'Constants' { ' const' } else { '' }
mut sym_name := dd.name
if dd.attrs.exists('parent') && dd.attrs['parent'] !in ['void', '', 'Constants'] {
sym_name = dd.attrs['parent'] + '.' + sym_name
}
node_id := slug(sym_name)
hash_link := if !head { ' <a href="#$node_id">#</a>' } else { '' }
dnw.writeln('<section id="$node_id" class="doc-node$is_const_class">')
if dd.name != 'README' && dd.attrs['parent'] != 'Constants' {
dnw.write('<div class="title"><$head_tag>$sym_name$hash_link</$head_tag>')
if link.len != 0 {
dnw.write('<a class="link" rel="noreferrer" target="_blank" href="$link">$link_svg</a>')
}
dnw.write('</div>')
}
if head {
dnw.write(md_content)
} else {
dnw.writeln('<pre class="signature"><code>$hlighted_code</code></pre>')
dnw.writeln(md_content)
}
dnw.writeln('</section>')
return dnw.str()
}
fn (cfg DocConfig) readme_idx() int {
for i, dc in cfg.docs {
if dc.head.name != 'README' { continue }
return i
}
return -1
}
fn write_toc(cn doc.DocNode, nodes []doc.DocNode, toc &strings.Builder) {
toc_slug := if cn.content.len == 0 { '' } else { slug(cn.name) }
toc.write('<li class="open"><a href="#$toc_slug">${cn.name}</a>')
children := nodes.find_children_of(cn.name)
if cn.name != 'Constants' {
toc.writeln(' <ul>')
for child in children {
cname := cn.name + '.' + child.name
toc.writeln('<li><a href="#${slug(cname)}">${child.name}</a></li>')
}
toc.writeln('</ul>')
}
toc.writeln('</li>')
}
fn (cfg DocConfig) write_content(cn &doc.DocNode, dcs &doc.Doc, hw &strings.Builder) {
base_dir := os.base_dir(os.real_path(cfg.input_path))
file_path_name := if cfg.is_multi { cn.file_path.replace('$base_dir/', '') } else { os.file_name(cn.file_path) }
src_link := get_src_link(cfg.manifest.repo_url, file_path_name, cn.pos.line)
children := dcs.contents.find_children_of(cn.name)
if cn.content.len != 0 {
hw.write(doc_node_html(cn, src_link, false, dcs.table))
}
for child in children {
child_file_path_name := child.file_path.replace('$base_dir/', '')
child_src_link := get_src_link(cfg.manifest.repo_url, child_file_path_name, child.pos.line)
hw.write(doc_node_html(child, child_src_link, false, dcs.table))
}
}
fn (cfg DocConfig) gen_html(idx int) string {
dcs := cfg.docs[idx]
time_gen := '$dcs.time_generated.day $dcs.time_generated.smonth() $dcs.time_generated.year $dcs.time_generated.hhmmss()'
mut toc := strings.new_builder(200)
mut toc2 := strings.new_builder(200)
mut contents := strings.new_builder(200)
// generate toc first
contents.writeln(doc_node_html(dcs.head, '', true, dcs.table))
for cn in dcs.contents {
cfg.write_content(&cn, &dcs, &contents)
if cn.attrs['parent'] == 'Constants' || cn.attrs['category'] == 'Methods' { continue }
write_toc(cn, dcs.contents, &toc)
} // write head
// get resources
doc_css := cfg.get_resource(css_js_assets[0], true)
normalize_css := cfg.get_resource(css_js_assets[1], true)
doc_js := cfg.get_resource(css_js_assets[2], !cfg.serve_http)
light_icon := cfg.get_resource('light.svg', true)
dark_icon := cfg.get_resource('dark.svg', true)
menu_icon := cfg.get_resource('menu.svg', true)
arrow_icon := cfg.get_resource('arrow.svg', true)
// write css
version := if cfg.manifest.version.len != 0 { cfg.manifest.version } else { '' }
header_name := if cfg.is_multi && cfg.docs.len > 1 {
os.file_name(os.real_path(cfg.input_path))
} else if cfg.docs.len == 2 && idx+1 < cfg.docs.len && cfg.readme_idx() != -1 {
cfg.docs[cfg.readme_idx()+1].head.name
} else {
dcs.head.name
}
// write nav1
if cfg.is_multi || cfg.docs.len > 1 {
mut submod_prefix := ''
mut docs := cfg.docs.filter(it.head.name == 'builtin')
docs << cfg.docs.filter(it.head.name != 'builtin')
for i, doc in docs {
if i-1 >= 0 && doc.head.name.starts_with(submod_prefix + '.') {
continue
}
names := doc.head.name.split('.')
submod_prefix = if names.len > 1 { names[0] } else { doc.head.name }
href_name := if doc.head.name == 'README' {
'./index.html'
} else if submod_prefix !in cfg.docs.map(it.head.name) {
'#'
} else if cfg.docs.len == 2 && cfg.readme_idx() == -1 {
'./docs.html'
} else {
'./' + doc.head.name + '.html'
}
submodules := cfg.docs.filter(it.head.name.starts_with(submod_prefix + '.'))
dropdown := if submodules.len > 0 { arrow_icon } else { '' }
mut is_submodule_open := false
for _, cdoc in submodules {
if cdoc.head.name == dcs.head.name {
is_submodule_open = true
}
}
active_class := if doc.head.name == dcs.head.name { ' active' } else { '' }
toc2.write('<li class="open$active_class"><div class="menu-row">$dropdown<a href="$href_name">${submod_prefix}</a></div>')
for j, cdoc in submodules {
if j == 0 {
toc2.write('<ul>')
}
submod_name := cdoc.head.name.all_after(submod_prefix + '.')
sub_selected_classes := if cdoc.head.name == dcs.head.name { ' class="active"' } else { '' }
toc2.write('<li$sub_selected_classes><a href="./${cdoc.head.name}.html">${submod_name}</a></li>')
if j == submodules.len - 1 {
toc2.write('</ul>')
}
}
toc2.write('</li>')
}
}
return html_content
.replace('{{ title }}', dcs.head.name)
.replace('{{ head_name }}', header_name)
.replace('{{ version }}', version)
.replace('{{ light_icon }}', light_icon)
.replace('{{ dark_icon }}', dark_icon)
.replace('{{ menu_icon }}', menu_icon)
.replace('{{ head_assets }}', if cfg.inline_assets {
'\n <style>$doc_css</style>\n <style>$normalize_css</style>'
} else {
'\n <link rel="stylesheet" href="$doc_css" />\n <link rel="stylesheet" href="$normalize_css" />'
})
.replace('{{ toc_links }}', if cfg.is_multi || cfg.docs.len > 1 { toc2.str() } else { toc.str() })
.replace('{{ contents }}', contents.str())
.replace('{{ right_content }}', if cfg.is_multi && cfg.docs.len > 1 && dcs.head.name != 'README' {
'<div class="doc-toc"><ul>' + toc.str() + '</ul></div>'
} else { '' })
.replace('{{ footer_content }}', 'Powered by vdoc. Generated on: $time_gen')
.replace('{{ footer_assets }}', if cfg.inline_assets {
'<script>$doc_js</script>'
} else {
'<script src="$doc_js"></script>'
})
}
fn (cfg DocConfig) gen_plaintext(idx int) string {
dcs := cfg.docs[idx]
mut pw := strings.new_builder(200)
pw.writeln('${dcs.head.content}\n')
if dcs.head.comment.trim_space().len > 0 {
pw.writeln('// ' + dcs.head.comment.replace('\n', '\n// ') + '\n')
}
for cn in dcs.contents {
pw.writeln(cn.content)
if cn.comment.len > 0 {
pw.writeln('\/\/ ' + cn.comment.trim_space() + '\n')
}
if cfg.show_loc {
pw.writeln('Location: ${cn.file_path}:${cn.pos.line}:${cn.pos.col}\n\n')
}
}
return pw.str()
}
fn (cfg DocConfig) gen_markdown(idx int, with_toc bool) string {
dcs := cfg.docs[idx]
mut hw := strings.new_builder(200)
mut cw := strings.new_builder(200)
hw.writeln('# ${dcs.head.content}\n${dcs.head.comment}\n')
if with_toc {
hw.writeln('## Contents')
}
for cn in dcs.contents {
name := cn.name.all_after(dcs.head.name + '.')
if with_toc {
hw.writeln('- [#$name](${slug(name)})')
}
cw.writeln('## $name')
cw.writeln('```v\n${cn.content}\n```${cn.comment}\n')
cw.writeln('[\[Return to contents\]](#Contents)\n')
}
cw.writeln('#### Generated by vdoc. Last generated: ${dcs.time_generated.str()}')
return hw.str() + '\n' + cw.str()
}
fn (cfg DocConfig) render() map[string]string {
mut docs := map[string]string
for i, doc in cfg.docs {
// since builtin is generated first, ignore it
mut name := if doc.head.name == 'README' || cfg.docs.len == 1 {
'index'
} else if !cfg.is_multi && !os.is_dir(cfg.output_path) {
os.file_name(cfg.output_path)
} else if i-1 >= 0 && cfg.readme_idx() != -1 && cfg.docs.len == 2 {
'docs'
} else {
doc.head.name
}
name = name + match cfg.output_type {
.html { '.html' }
.markdown { '.md' }
.json { '.json' }
else { '.txt' }
}
output := match cfg.output_type {
.html { cfg.gen_html(i) }
.markdown { cfg.gen_markdown(i, true) }
.json { cfg.gen_json(i) }
else { cfg.gen_plaintext(i) }
}
docs[name] = output.trim_space()
}
cfg.vprintln('Rendered: ' + docs.keys().str())
return docs
}
fn (cfg DocConfig) get_readme(path string) string {
mut fname := ''
for name in ['readme', 'README'] {
if os.exists(os.join_path(path, '${name}.md')) {
fname = name
break
}
}
if fname == '' {
return ''
}
readme_path := os.join_path(path, '${fname}.md')
cfg.vprintln('Reading README file from $readme_path')
readme_contents := os.read_file(readme_path) or { '' }
return readme_contents
}
fn (mut cfg DocConfig) generate_docs_from_file() {
if cfg.output_path.len == 0 {
if cfg.output_type == .unset {
cfg.output_type = .stdout
} else {
cfg.vprintln('No output path has detected. Using input path instead.')
cfg.output_path = cfg.input_path
}
} else if cfg.output_type == .unset {
cfg.vprintln('Output path detected. Identifying output type..')
ext := os.file_ext(cfg.output_path)
cfg.set_output_type_from_str(ext.all_after('.'))
}
if cfg.include_readme && cfg.output_type !in [.html, .stdout] {
eprintln('vdoc: Including README.md for doc generation is supported on HTML output, or when running directly in the terminal.')
exit(1)
}
is_vlib := 'vlib' in cfg.input_path
dir_path := if is_vlib {
vexe_path
} else if os.is_dir(cfg.input_path) {
cfg.input_path
} else {
os.base_dir(cfg.input_path)
}
manifest_path := os.join_path(dir_path, 'v.mod')
if os.exists(manifest_path) {
cfg.vprintln('Reading v.mod info from $manifest_path')
if manifest := vmod.from_file(manifest_path) {
cfg.manifest = manifest
}
}
if cfg.include_readme {
readme_contents := cfg.get_readme(dir_path)
if cfg.output_type == .stdout {
println(markdown.to_plain(readme_contents))
}
if cfg.output_type == .html {
cfg.docs << doc.Doc{
head: doc.DocNode{
name: 'README',
comment: readme_contents
}
time_generated: time.now()
}
}
}
dirs := if cfg.is_multi { get_modules_list(cfg.input_path) } else { [cfg.input_path] }
for dirpath in dirs {
cfg.vprintln('Generating docs for ${dirpath}...')
mut dcs := doc.generate(dirpath, cfg.pub_only, true) or {
mut err_msg := err
if errcode == 1 {
mod_list := get_modules_list(cfg.input_path)
println('Available modules:\n==================')
for mod in mod_list {
println(mod.all_after('vlib/').all_after('modules/').replace('/', '.'))
}
err_msg += ' Use the `-m` flag if you are generating docs of a directory containing multiple modules.'
}
eprintln(err_msg)
exit(1)
}
if dcs.contents.len == 0 { continue }
if cfg.is_multi {
readme_contents := cfg.get_readme(dirpath)
dcs.head.comment = readme_contents
}
if cfg.pub_only {
for i, c in dcs.contents {
dcs.contents[i].content = c.content.all_after('pub ')
}
}
cfg.docs << dcs
}
if cfg.serve_http {
cfg.serve_html()
return
}
cfg.vprintln('Rendering docs...')
if cfg.output_path.len == 0 {
outputs := cfg.render()
if outputs.len == 0 {
println('No documentation for $dirs')
} else {
first := outputs.keys()[0]
println(outputs[first])
}
} else {
if !os.is_dir(cfg.output_path) {
cfg.output_path = os.real_path('.')
}
if !os.exists(cfg.output_path) {
os.mkdir(cfg.output_path) or {
panic(err)
}
}
if cfg.is_multi {
cfg.output_path = os.join_path(cfg.output_path, '_docs')
if !os.exists(cfg.output_path) {
os.mkdir(cfg.output_path) or {
panic(err)
}
} else {
for fname in css_js_assets {
os.rm(os.join_path(cfg.output_path, fname))
}
}
}
outputs := cfg.render()
for file_name, content in outputs {
output_path := os.join_path(cfg.output_path, file_name)
println('Generating ${output_path}...')
os.write_file(output_path, content)
}
}
}
fn (mut cfg DocConfig) set_output_type_from_str(format string) {
match format {
'htm', 'html' {
cfg.output_type = .html
}
'md', 'markdown' {
cfg.output_type = .markdown
}
'json' {
cfg.output_type = .json
}
'stdout' {
cfg.output_type = .stdout
}
else {
cfg.output_type = .plaintext
}
}
cfg.vprintln('Setting output type to "$cfg.output_type"')
}
fn (cfg DocConfig) vprintln(str string) {
if cfg.is_verbose {
println('vdoc: $str')
}
}
fn lookup_module(mod string) ?string {
mod_path := mod.replace('.', os.path_separator)
compile_dir := os.real_path(os.base_dir('.'))
modules_dir := os.join_path(compile_dir, 'modules', mod_path)
vlib_path := os.join_path(vexe_path, 'vlib', mod_path)
vmodules_path := os.join_path(os.home_dir(), '.vmodules', mod_path)
paths := [modules_dir, vlib_path, vmodules_path]
for path in paths {
if os.is_dir_empty(path) { continue }
return path
}
return error('vdoc: Module "${mod}" not found.')
}
fn get_modules_list(path string) []string {
files := os.walk_ext(path, 'v')
mut dirs := []string{}
for file in files {
if 'vlib' in path && ('examples' in file || 'test' in file || 'js' in file || 'x64' in file || 'bare' in file || 'uiold' in file || 'vweb' in file) { continue }
dirname := os.base_dir(file)
if dirname in dirs { continue }
dirs << dirname
}
dirs.sort()
return dirs
}
fn (cfg DocConfig) get_resource(name string, minify bool) string {
path := os.join_path(res_path, name)
mut res := os.read_file(path) or { panic('could not read $path') }
if minify {
res = if name.ends_with('.js') { js_compress(res) } else { res.replace('\n', ' ') }
}
// TODO: Make SVG inline for now
if cfg.inline_assets || path.ends_with('.svg') {
return res
} else {
output_path := os.join_path(cfg.output_path, name)
if !os.exists(output_path) {
println('Generating ${output_path}...')
os.write_file(output_path, res)
}
return name
}
}
fn main() {
args := os.args[2..].clone()
if args.len == 0 || args[0] in ['help', '-h', '--help'] {
os.system('${@VEXE} help doc')
exit(0)
}
mut cfg := DocConfig{
manifest: vmod.Manifest{ repo_url: '' }
}
for i := 0; i < args.len; i++ {
arg := args[i]
current_args := args[i..]
match arg {
'-all' {
cfg.pub_only = false
}
'-f' {
format := cmdline.option(current_args, '-f', '')
allowed_str := allowed_formats.join(', ')
if format !in allowed_formats {
eprintln('vdoc: "$format" is not a valid format. Only $allowed_str are allowed.')
exit(1)
}
cfg.set_output_type_from_str(format)
i++
}
'-inline-assets' {
cfg.inline_assets = true
}
'-l' {
cfg.show_loc = true
}
'-m' {
cfg.is_multi = true
}
'-o' {
opath := cmdline.option(current_args, '-o', '')
cfg.output_path = os.real_path(opath)
i++
}
'-open' {
cfg.open_docs = true
}
'-p' {
s_port := cmdline.option(current_args, '-o', '')
s_port_int := s_port.int()
if s_port.len == 0 {
eprintln('vdoc: No port number specified on "-p".')
exit(1)
}
if s_port != s_port_int.str() {
eprintln('vdoc: Invalid port number.')
exit(1)
}
cfg.server_port = s_port_int
}
'-s' {
cfg.inline_assets = true
cfg.serve_http = true
if cfg.output_type == .unset {
cfg.output_type = .html
}
}
'-readme' {
cfg.include_readme = true
}
'-v' {
cfg.is_verbose = true
}
else {
cfg.input_path = arg
break
}
}
}
if cfg.input_path.len == 0 {
eprintln('vdoc: No input path found.')
exit(1)
}
$if windows {
cfg.input_path = cfg.input_path.replace('/', os.path_separator)
} $else {
cfg.input_path = cfg.input_path.replace('\\', os.path_separator)
}
is_path := cfg.input_path.ends_with('.v') || cfg.input_path.split(os.path_separator).len > 1 || cfg.input_path == '.'
if cfg.input_path == 'vlib' {
cfg.is_multi = true
cfg.input_path = os.join_path(vexe_path, 'vlib')
} else if !is_path {
cfg.vprintln('Input "$cfg.input_path" is not a valid path. Looking for modules named "$cfg.input_path"...')
mod_path := lookup_module(cfg.input_path) or {
eprintln(err)
exit(1)
}
cfg.input_path = mod_path
}
cfg.generate_docs_from_file()
}

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

@@ -0,0 +1,313 @@
// 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 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
}
const (
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']]
formatted_file_token = '\@\@\@' + 'FORMATTED_FILE: '
)
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
}
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 !file.ends_with('.v') && !file.ends_with('.vv') {
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_with_spaces(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)
vfmt_output_path := os.join_path(os.temp_dir(), 'vfmt_' + 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, formatted_file_path string) {
if formatted_file_path.len == 0 {
return
}
if foptions.is_diff {
diff_cmd := util.find_working_diff_command() or {
eprintln('No working "diff" CLI command found.')
return
}
println(util.color_compare_files(diff_cmd, file, formatted_file_path))
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' + ' }'
}
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)
}

87
cmd/tools/vnames.v Normal file
View File

@@ -0,0 +1,87 @@
module main
/*
QTODO
import os
import flag
import strings
import compiler
import v.pref
const (
tool_version = '0.0.1'
tool_description = ' Extracts the function names declared in a v file.'
)
fn f_to_string(fmod string, f compiler.Fn) ?string {
svisibility := if f.is_public {
'public'
}else{
'private'
}
if fmod != f.v_fn_module() { return none }
if fmod == 'builtin' {
return '$svisibility\t' + f.v_fn_name()
}
return '$svisibility\t' + f.v_fn_module() + '.' + f.v_fn_name()
}
fn analyze_v_file(file string) {
println('')
hash := strings.repeat(`#`, (76 - file.len) / 2)
println('$hash $file $hash')
// main work:
mut pref := &pref.Preferences{
path: file
}
pref.fill_with_defaults()
mut v := compiler.new_v(pref)
v.add_v_files_to_compile()
for f in v.files { v.parse(f, .decl) }
fi := v.get_file_parser_index( file ) or { panic(err) }
fmod := v.parsers[fi].mod
// output:
mut fns :=[]string
for _, f in v.table.fns {
fname := f_to_string(fmod, f) or { continue }
fns << fname
}
fns.sort()
for f in fns { println(f) }
}
fn main(){
toolexe := os.executable()
compiler.set_vroot_folder(os.dir(os.dir(os.dir(toolexe))))
mut fp := flag.new_flag_parser(os.args)
fp.application(os.file_name(toolexe))
fp.version( tool_version )
fp.description( tool_description )
fp.arguments_description('FILE.v/FOLDER [FILE.v/FOLDER]...')
fp.limit_free_args_to_at_least(1)
fp.skip_executable()
show_help:=fp.bool('help', `h`, false, 'Show this help screen\n')
if( show_help ){
println( fp.usage() )
exit(0)
}
mut files := []string{}
locations := fp.finalize() or { eprintln('Error: ' + err) exit(1) }
for xloc in locations {
loc := os.real_path(xloc)
xfiles := if os.is_dir(loc){ os.walk_ext(loc,'.v') } else { [loc] }
filtered_files := xfiles.filter(!it.ends_with('_js.v'))
files << filtered_files
}
for file in files {
analyze_v_file(file)
}
}
*/
fn main() {}

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

@@ -0,0 +1,492 @@
module main
import os
import os.cmdline
import net.http
import json
import vhelp
import v.vmod
const (
default_vpm_server_urls = ['https://vpm.best', 'https://vpm.vlang.io']
valid_vpm_commands = ['help', 'search', 'install', 'update', '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'
}
)
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)
}
'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) {
if settings.is_help {
vhelp.show_topic('search')
exit(0)
}
if keywords.len == 0 {
println(' v search requires *at least one* keyword')
exit(2)
}
modules := get_all_modules()
joined := keywords.join(', ')
mut index := 0
for mod in modules {
// TODO for some reason .filter results in substr error, so do it manually
for k in keywords {
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] = ''
}
println('${index}. ${parts[1]} by ${parts[0]} [$mod]')
break
}
}
println('\nUse "v install author.module_name" to install the module')
if index == 0 {
println('No module(s) found for "$joined"')
}
}
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()
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
}
final_module_path := os.real_path(os.join_path(settings.vmodules_path,mod.name.replace('.', os.path_separator)))
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
}
resolve_dependencies(name, final_module_path, module_names)
}
if errors > 0 {
exit(1)
}
}
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 {
name_of_vmodules_folder := os.join_path(settings.vmodules_path,name.replace('.', os.path_separator))
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, 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.home_dir() + '.vmodules'
}
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())
}

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

@@ -0,0 +1,302 @@
// 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
//
imports []string // all the import 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
}
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 {
if line.starts_with(function) {
return true
}
}
return false
}
fn (r &Repl) current_source_code(should_add_temp_lines bool) string {
mut all_lines := []string{}
all_lines << r.imports
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(true))
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.
')
}
fn run_repl(workdir string, vrepl_prefix string) {
println(util.full_v_version(true))
println('Use Ctrl-C or `exit` to exit')
file := os.join_path(workdir, '.${vrepl_prefix}vrepl.v')
temp_file := os.join_path(workdir, '.${vrepl_prefix}vrepl_temp.v')
mut prompt := '>>> '
defer {
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 := Repl{}
mut readline := readline.Readline{}
vexe := os.getenv('VEXE')
for {
if r.indent == 0 {
prompt = '>>> '
} else {
prompt = '... '
}
oline := readline.read_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 = 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 '
]
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 ') || 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 ') || r.line.starts_with('#include ') {
mut imports := r.imports
r.imports = [r.line]
r.imports << imports
} 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()
}

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

@@ -0,0 +1,41 @@
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('self')
args := os.args[1..self_idx]
args_str := args.join(' ')
options := if args.len > 0 { '($args_str)' } else { '' }
println('V self compiling ${options}...')
cmd := '$vexe -o v2 $args_str cmd/v'
result := os.exec(cmd) or { panic(err) }
if result.exit_code != 0 {
mut err := 'Permission denied'
if !result.output.contains('Permission denied') {
err = '\n$result.output'
}
eprintln('cannot compile to `$vroot`: $err')
exit(1)
}
if result.output.len > 0 {
println(result.output)
}
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,26 @@
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".')
}
}

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

@@ -0,0 +1,186 @@
import os
import v.pref
const (
hkey_current_user = voidptr(0x80000001)
hwnd_broadcast = voidptr(0xffff)
)
$if windows {
$if tinyc {
#flag -lAdvapi32
#flag -lUser32
}
}
fn main(){
$if windows {
setup_symlink_on_windows()
} $else {
setup_symlink_on_unix()
}
}
fn setup_symlink_on_unix(){
vexe := pref.vexe_path()
mut link_path := '/usr/local/bin/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 {
println('Failed to create symlink "$link_path". Try again with sudo.')
}
} else {
println('Failed to create symlink "$link_path". Try again with sudo.')
}
}
fn setup_symlink_on_windows(){
$if windows {
vexe := pref.vexe_path()
// NB: Putting $vdir directly into PATH will also result in
// make.bat being global, which is NOT what we want.
//
// Instead, we create a small launcher v.bat, in a new local
// folder .bin/ . That .bin/ folder can then be put in PATH
// without poluting it with anything else - just a `v`
// command will be available, similar to unix.
//
// Creating a real NTFS symlink to the real executable was also
// tried, but then os.real_path( os.executable() ) returns the
// path to the symlink, unfortunately, unlike on posix systems
// ¯\_(ツ)_/¯
vdir := os.real_path(os.dir(vexe))
vsymlinkdir := os.join_path(vdir, '.bin')
vsymlinkbat := os.join_path(vsymlinkdir, 'v.bat')
if os.exists(vsymlinkbat) {
print('Batch script $vsymlinkbat already exists, checking system %PATH%...')
}
else {
os.rmdir_all(vsymlinkdir)
os.mkdir_all(vsymlinkdir)
os.write_file(vsymlinkbat, '@echo off\n${vexe} %*')
if !os.exists(vsymlinkbat) {
eprintln('Could not create $vsymlinkbat')
exit(1)
}
else {
print('Created $vsymlinkbat, checking system %PATH%...')
}
}
reg_sys_env_handle := get_reg_sys_env_handle() or {
warn_and_exit(err)
return
}
defer {
C.RegCloseKey(reg_sys_env_handle)
}
sys_env_path := get_reg_value(reg_sys_env_handle, 'Path') or {
warn_and_exit(err)
return
}
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 !in new_paths {
new_paths << p
}
}
new_sys_env_path := new_paths.join(';')
if new_sys_env_path == sys_env_path {
println('configured.')
}
else {
print('not configured.\nSetting system %PATH%...')
set_reg_value(reg_sys_env_handle, 'Path', new_sys_env_path) or {
warn_and_exit(err)
return
}
println('done.')
}
print('Letting running process know to update their Environment...')
send_setting_change_msg('Environment') or {
eprintln('\n' + err)
warn_and_exit('You might need to run this again to have `v` in your %PATH%')
return
}
println('finished.\n\nNote: restart your shell/IDE to load the new %PATH%.')
println('\nAfter 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 {
// open the registry key
reg_key_path := 'Environment'
reg_env_key := voidptr(0) // or HKEY (HANDLE)
if C.RegOpenKeyEx(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(hwnd_broadcast, 0x001A, 0, message_data.to_wide(), 2, 5000, 0) == 0 {
return error('Could not broadcast WM_SETTINGCHANGE')
}
return true
}
return error('not on windows')
}

View File

@@ -0,0 +1,68 @@
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('')
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)
}
}

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

@@ -0,0 +1,74 @@
module main
import os
import testing
import v.pref
const (
skip_test_files = [
'vlib/net/http/http_httpbin_test.v',
]
skip_on_musl = [
'vlib/net/http/http_test.v',
'vlib/net/http/cookie_test.v',
'vlib/net/websocket/ws_test.v'
'vlib/sqlite/sqlite_test.v',
'vlib/orm/orm_test.v',
'vlib/clipboard/clipboard_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',
]
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 !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 {
panic('\nWARNING: failed ${tsession.benchmark.nfail} times.\n')
}
}

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

@@ -0,0 +1,69 @@
module main
import os
import testing
const (
known_failing_exceptions = ['./examples/vweb/vweb_example.v',
'./cmd/tools/gen_vc.v',
'./cmd/tools/modules/vgit/vgit.v', // generics
'./cmd/tools/preludes/live_main.v',
'./cmd/tools/preludes/live_shared.v',
'./cmd/tools/preludes/tests_assertions.v',
'./cmd/tools/preludes/tests_with_stats.v',
'./cmd/tools/performance_compare.v', // generics
'./cmd/tools/oldv.v', // generics
'./tutorials/code/blog/article.v',
'./tutorials/code/blog/blog.v',
'./vlib/arrays/arrays.v',
'./vlib/arrays/arrays_test.v',
'./vlib/builtin/js/hashmap.v',
'./vlib/v/tests/fn_variadic_test.v',
'./vlib/v/tests/generic_test.v',
'./vlib/crypto/aes/aes.v',
'./vlib/crypto/aes/aes_cbc.v',
'./vlib/crypto/aes/block_generic.v',
'./vlib/crypto/aes/const.v',
'./vlib/crypto/aes/cypher_generic.v',
'./vlib/crypto/rc4/rc4.v',
'./vlib/eventbus/eventbus_test.v',
'./vlib/os/bare/bare_example_linux.v',
'./vlib/szip/szip.v',
'./vlib/uiold/examples/users_gui/users.v',
'./vlib/vweb/assets/assets.v',
'./vlib/vweb/vweb.v',
]
)
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()
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.test()
eprintln(vfmt_test_session.benchmark.total_message('running vfmt over V files'))
if vfmt_test_session.benchmark.nfail > 0 {
panic('\nWARNING: v fmt failed ${vfmt_test_session.benchmark.nfail} times.\n')
}
}
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 in known_failing_exceptions {
continue
}
if tfile.starts_with('./vlib/v/cgen/tests') {
continue
}
files_that_can_be_formatted << tfile
}
return files_that_can_be_formatted
}

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

@@ -0,0 +1,53 @@
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)
}
}

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

@@ -0,0 +1,101 @@
module main
import os
import v.pref
import v.util
struct App {
is_verbose bool
vexe string
vroot string
}
fn new_app() App {
vexe := 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...')
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 origin 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('v.exe')
make_result := os.exec('make.bat') or {
panic(err)
}
println(make_result.output)
app.backup('cmd/tools/vup.exe')
} $else {
self_result := os.exec('./v self') or {
panic(err)
}
println(self_result.output)
if self_result.exit_code != 0 {
// v self failed, have to use make
println('v self failed, running make...')
make_result := os.exec('make') or {
panic(err)
}
println(make_result.output)
}
}
os.exec('v cmd/tools/vup.v') or {
panic(err)
}
app.show_current_v_version()
}
fn (app App) show_current_v_version() {
println('Current V version:')
os.system('$app.vexe version')
}
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('have no access `$app.vroot`: Permission denied')
} else {
eprintln(git_result.output)
}
exit(1)
} else {
if app.is_verbose {
println(git_result.output)
}
}
}

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

@@ -0,0 +1,38 @@
// 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.ast
import v.pref
import v.parser
import v.util
import v.table
import os
fn main() {
mut prefs := pref.new_preferences()
prefs.is_vet = true
table := table.new_table()
args := util.join_env_vflags_and_os_args()
if args.len < 3 {
return
}
path := args[2]
if path.ends_with('.v') {
vet_file(path, table, prefs)
} else if os.is_dir(path) {
println("vet'ing directory '$path'...")
files := os.walk_ext(path, '.v')
for file in files {
vet_file(file, table, prefs)
}
}
}
fn vet_file(path string, table &table.Table, prefs &pref.Preferences) {
file_ast := parser.parse_file(path, table, .parse_comments, prefs, &ast.Scope{
parent: 0
})
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.

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

@@ -0,0 +1,72 @@
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`:
-arch <architecture>
Change the architecture that V will tell the C compiler to build.
List of supported architectures: `x86` and `x64` (default).
-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.
-keepc
Specify that you want V to not delete the intermediate generated C source code.
Use with -cg for best debugging experience.
-freestanding
Build the executable without dependency on libc.
Supported only on `linux` targets currently.
-live
Build the executable with live capabilities (`[live]`).
-manual-free
Enable manually freeing on all V code. This will cause memory leaks in vlib.
Currently enabled until a stable auto-free system is in place.
-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`, `mac`, `freebsd`, `openbsd`, `netbsd`,
`dragonfly`, `solaris`, `android` and `haiku`.
-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>.

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

@@ -0,0 +1,116 @@
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!).
* `v2`/`experimental` - Invokes the experimental AST-powered V compiler that will replace the
current backends when finished
-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).
@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.
For C-specific build flags, use `v help build-c`.
See also:
`v help run` for documentation regarding `v run`.

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

@@ -0,0 +1,41 @@
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 -keepc -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.
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.
* Others:
build Build a 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).
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.

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

@@ -0,0 +1,25 @@
Usage:
v doc [flags] [module_name / folder / V file]
Examples:
v doc os
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.
-inline-assets Embeds the contents of the CSS and JS assets into the webpage directly.
-l Show the locations of the generated signatures. (For plaintext only)
-m Generate docs for modules listed in that folder.
-o Specifies the output file/folder path where to store the generated docs.
-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.
-readme Include README.md to docs if present.
-v Enables verbose logging. For debugging purposes.
-h, -help Prints this help text.

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

@@ -0,0 +1,17 @@
Usage:
v [flags] fmt 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 only diffs between the formatted source and the original source.
-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.
NB: vfmt after 2020/04/01 is based on the new AST compiler code, and
thus is much faster, and more flexible than before.
It may also EAT some of your code for now, so please be careful, and
make frequent BACKUPS.

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
}
println(unknown_topic)
exit(1)
}
target_topic := os.join_path(vroot, 'cmd', 'v', 'help', '${topic}.txt')
content := os.read_file(target_topic) or {
println(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.

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