Commit Graph

167 Commits

Author SHA1 Message Date
cf7ea6fbef Add exit() function 2024-09-07 00:44:47 -04:00
594d1a627f Fix some C string and path resolving issues 2024-09-06 15:39:00 -04:00
176205a22d Print stack trace if $TOMO_STACKTRACE is set 2024-09-06 14:41:34 -04:00
4b352f89a3 Add Shell dsl type 2024-09-06 11:37:33 -04:00
44892df4c5 Add Text.trim() 2024-09-06 00:03:28 -04:00
04c8fb0362 Replace $Type with Type$info for builtin TypeInfos 2024-09-05 15:31:54 -04:00
391c1b6bde Rename table_t -> Table_t 2024-09-05 14:57:31 -04:00
abe45a3c25 Rename array_t -> Array_t 2024-09-05 14:56:37 -04:00
3a556296b6 Add Text:repeat() 2024-09-04 21:22:03 -04:00
00543b4e87 Add Text.map(pat, fn) 2024-09-04 21:02:37 -04:00
3513b94fc7 Unify parsing code to correctly handle parsing integers and numbers with
a &success boolean. Check for overflow as well.
2024-09-04 16:08:34 -04:00
05bc754679 Add ask() as a way to get user input 2024-09-04 14:55:00 -04:00
1092185c84 Improve codegen by making test() even more concise 2024-09-04 05:01:21 -04:00
df844946f7 Add Text:matches() for convenience and performance 2024-09-04 00:34:27 -04:00
b8bb4ada8b Add recursive mode to text replacement and update docs 2024-09-03 23:16:45 -04:00
850fc8fbe1 Clean up text replacement API to use backrefs instead of match_chain() 2024-09-03 22:56:53 -04:00
c14ed3e3e7 Add Text.replace_all({Pattern:Text}) and tweak API for replacement to
support placeholders
2024-09-03 20:48:11 -04:00
3c2c1a308b Bugifx for Pattern.from_unsafe_text 2024-09-03 15:27:13 -04:00
6622fb8089 Bugfix for text method lookups 2024-09-03 15:25:33 -04:00
64143f0a13 Syntax overhaul (comments back to #, print statments to !!),
using `$/.../` for patterns and using a DSL for patterns
2024-09-03 13:19:41 -04:00
5feecff9d9 Deprecate Where and change channel API to use a boolean front value 2024-09-03 03:53:36 -04:00
6c22999ede Add text slicing 2024-09-02 23:56:08 -04:00
5aa5a5e99b Fix some stuff around Text:find() and text indexing 2024-09-02 23:47:16 -04:00
5d6fa135b1 Add Text:find_all() 2024-09-02 23:26:55 -04:00
6d7e09bf18 Add Text:split() and use that with an empty pattern instead of Text:clusters() 2024-09-02 23:07:08 -04:00
9214e621bf Add Text:lines() 2024-09-02 22:57:49 -04:00
708acda54e WIP fixes for synthetic graphemes and adding some text conversion
methods
2024-09-02 22:30:19 -04:00
620ebeab8d Fixing string methods 2024-09-02 20:22:13 -04:00
337aa911a9 Auto promote to C String from Text 2024-09-02 19:53:09 -04:00
6d7a359f8f Bugfix some text replacement things 2024-09-02 19:49:52 -04:00
a197875214 Bugfix for say() when length is >512, and added back the newline
optional parameter (default=yes)
2024-08-23 12:42:10 -04:00
dceb925573 Bugfix for parsing ints 2024-08-23 11:38:54 -04:00
ad51b208b4 Overhaul of import syntax. Now everything uses use: use foo, `use
./foo.tm`, `use <foo.h>`, `use libfoo.so`
2024-08-22 14:02:48 -04:00
2055439be4 Variables can no longer hold function pointers, only closure_t's. This
makes error reporting easier and prevents issues where some functions
could be assigned, but not others. Also change outputs so Void returns
don't show up when displaying types, now just: `func()`
2024-08-21 00:49:22 -04:00
934b843b1c Add .text_content as a field on DSLs instead of a method 2024-08-19 14:29:58 -04:00
4e732a718d Restructure things so that DSL constructors do proper escaping 2024-08-19 13:23:02 -04:00
8363d53bd2 Update channel API to take a Where parameter 2024-08-18 23:59:13 -04:00
b76fbd3beb Add Int:clamped() and Num:clamped() 2024-08-18 23:20:54 -04:00
1e4f41bc28 Remove duplicated line 2024-08-18 16:33:40 -04:00
9de57eaf65 Remove some num functions 2024-08-18 16:28:52 -04:00
a49870f810 Add primality testing and next_prime()/prev_prime() 2024-08-18 15:22:51 -04:00
da4d07c665 Fix up some bigint logic issues 2024-08-18 12:47:29 -04:00
752ab8212c Split BigIntType out of IntType and switch to using enums for the size
of ints/nums
2024-08-18 11:49:51 -04:00
bac188ce07 Change division and modulus to use euclidean division, plus fix up a few
integer bugs
2024-08-16 14:24:20 -04:00
04714e00d7 Add Bool:random(p=0.5) 2024-08-16 14:18:23 -04:00
e56fd1aa94 Add Int:sqrt() 2024-08-13 16:36:41 -04:00
e0223a4c20 Support ^ exponentiation for integers 2024-08-13 16:32:00 -04:00
9edace28e2 Fix ranges 2024-08-13 03:20:01 -04:00
9b9087bfef Get rid of slow_* int functions 2024-08-13 02:42:02 -04:00
d08f795794 Partially working first draft of bigints 2024-08-13 01:30:25 -04:00
2ecb5fe885 Add channels and threads 2024-08-11 14:47:34 -04:00
8d3d591312 Add Sets to the language 2024-08-10 15:15:38 -04:00
c045c54309 Add a Range datatype with creation methods like 5:to(10) and
modification methods like `range:by(2)` or `range:reversed()`
2024-08-05 14:40:28 -04:00
99b00530ce Change structs/enums so they allow for field/tag names that are C
keywords
2024-08-03 16:39:04 -04:00
17be975d3a Fix integer random functions so they correctly handle all representable
ranges
2024-08-03 16:23:28 -04:00
fb95bbb1d4 Deprecate array:pairs() and switch iterator functions to use enums 2024-07-20 16:45:13 -04:00
d3f14cf53c Support nested lambda closures 2024-07-14 14:13:23 -04:00
445f79cb70 Add iterator functions 2024-07-13 17:17:58 -04:00
0c15c74352 Clean up some type checking with math operations and metamethods 2024-07-01 11:43:18 -04:00
8724dcd821 Fix issue with using libraries 2024-06-19 16:09:22 -04:00
9f8be0c502 Support library name as a separate environment field from namespace 2024-06-16 16:08:35 -04:00
7a53e10826 Fix issue with type namespaces not getting properly prefixed by library
namespace
2024-06-16 15:12:00 -04:00
81d55cacb7 Do dynamic library symbol prefixing using 'patchelf' 2024-06-13 21:20:50 -04:00
39ac885125 Change c/header transpilation order and fix some issues 2024-06-08 14:39:52 -04:00
8c7d530080 Split header compilation into a separate function 2024-06-06 16:28:53 -04:00
c5c3be9e5d Deprecate Text.slice() 2024-05-20 15:27:42 -04:00
5b1960859f Hook up Text.has(), Text.trimmed(), Text.without() 2024-05-20 15:19:31 -04:00
7dddfb71a0 Add Text.slice() 2024-05-19 14:38:44 -04:00
1df26851d7 Add syntax for "inline C(...)" 2024-05-18 16:31:34 -04:00
a1d18fd422 Add C string type 2024-05-18 14:38:41 -04:00
02fe49a764 Deprecate interfaces (RIP) 2024-05-12 20:13:19 -04:00
d143c72b22 WIP, but functional interfaces 2024-05-12 13:50:06 -04:00
2e27b88c1b Improved syntax for optionals 2024-04-30 13:18:47 -04:00
803995aea2 Prevent doubling up file prefix 2024-04-23 12:25:27 -04:00
5fd85d7e0b Add Num.mix() 2024-04-22 14:49:36 -04:00
d2348f0894 Fix namespace vars 2024-04-21 15:08:53 -04:00
3590bf3407 Better imports for types 2024-04-21 14:58:33 -04:00
369c601a56 Invert escaping so user symbols get prepended with "$" and builtin
symbols don't
2024-04-16 13:50:07 -04:00
17cb6ffd88 Add Bool.from_text() 2024-04-10 13:33:40 -04:00
e6f78f1d89 Add from_text() method for ints/nums 2024-04-10 13:23:49 -04:00
04d9adc813 Switch naming convention to use '$' in symbols more 2024-03-29 12:54:31 -04:00
135e23094c Improve codegen for table/array iteration by inlining the iteration
macros
2024-03-26 14:02:48 -04:00
f21fc700bb Handle type namespaces in other modules 2024-03-22 01:52:00 -04:00
4592e95fa9 Pull namespaces from the type binding 2024-03-21 13:33:10 -04:00
adbb07fdc2 Module imports 2024-03-19 14:22:03 -04:00
df2e01c15e Add some better file comments 2024-03-18 12:47:07 -04:00
655b677895 Preface symbols with file prefix 2024-03-17 20:40:40 -04:00
d5d3f564bb Remove some shadowed variables 2024-03-14 02:48:07 -04:00
fdc3eadba2 Array comprehensions 2024-03-14 02:37:56 -04:00
a33f730617 Rearranging some files 2024-03-10 00:03:21 -05:00
00d4e98ba1 Extra lambda test 2024-03-09 16:08:03 -05:00
b04a1b3090 Implement lambdas and closures 2024-03-09 16:03:38 -05:00
8427037bb9 Refactor table methods to take table structs where possible 2024-03-08 14:33:54 -05:00
55b4528da6 Tweak environment order of operations and resolutions 2024-03-08 13:39:27 -05:00
139da8e55f Remove dead code 2024-03-08 13:04:18 -05:00
9479b3937c Just use mathlib symbols, don't redefine them 2024-03-07 00:44:57 -05:00
e29aa52460 Struct and enum methods and static members 2024-03-04 13:51:47 -05:00
0b7ca098ae Fix some bugs relating to NUL termination of strings 2024-03-04 01:34:12 -05:00
1f6aa4cac7 Add methods for text:clusters(), text:codepoints(), text:bytes() 2024-03-03 19:40:01 -05:00
8fab88c56f Rename Str -> Text 2024-03-03 18:15:45 -05:00