Commit Graph

722 Commits

Author SHA1 Message Date
Rangi42
b85c5cde8f Use std::shared_ptr for MacroArgs 2024-03-22 14:25:36 -04:00
ISSOtm
e255af9e10 Do not limit strings to 255 characters 2024-03-22 14:25:36 -04:00
ISSOtm
9f239f6dcc Use std::shared_ptr<std::string> for lexed/parsed strings 2024-03-22 14:25:36 -04:00
ISSOtm
412073774c Refactor string-formatting routines to append to an existing string 2024-03-22 14:25:36 -04:00
ISSOtm
52e8e1f9fc Simplify \@ handling by using std::shared_ptr<std::string>
This has been relocated from macro.cpp to fstack.cpp, since both
MACRO and REPT/FOR nodes have their own unique `\@` values.
2024-03-22 14:25:36 -04:00
Sylvie
04405fb444 Use std::shared_ptr for fstack nodes (#1371) 2024-03-22 13:27:21 -04:00
Sylvie
dd43723e20 Use methods for RPN Expression (#1372) 2024-03-22 04:41:04 -04:00
Rangi42
de667c8afb Remove unused Visitor template 2024-03-22 03:29:56 -04:00
Sylvie
f792580816 Only restore parent context's \@ value if it had one defined (#1366)
This way, if a child context initializes `\@`, the parent won't
reset it. And if the child context did not initialize `\@`,
then resetting it would be redundant.
2024-03-21 19:53:49 -04:00
Sylvie
0300971a17 Fix some header #includes with clangd LSP (#1370)
Co-authored-by: ISSOtm <eldredhabert0@gmail.com>
2024-03-21 15:13:10 -04:00
Sylvie
0af1e512c2 Use std::get_if instead of std::visit (#1367)
`std::visit` is (arguably) cleaner code, but older versions of gcc
and clang (not very old; the ones packaged with Ubuntu 22.04 LTS)
compile them as tables of function pointers, instead of efficient
jump tables.
2024-03-20 22:37:54 -04:00
Sylvie
fec2266dd8 Use std::string for string-formatted values (#1360)
* Use `std::string` for string-formatted values

* Make `formatString` and `formatNumber` be `const`
2024-03-19 07:43:18 +01:00
Rangi42
40db9d5cef Use std::string for lexer state paths 2024-03-18 14:42:05 -04:00
Rangi42
05d79d87f6 Pass std::string references to RPN functions 2024-03-18 14:42:05 -04:00
Rangi42
e96675be03 Pass std::string references to fstack functions 2024-03-18 14:42:05 -04:00
Rangi42
472d1bde06 Pass std::string references to symbol functions 2024-03-18 14:42:05 -04:00
Rangi42
6cabb8c9af Pass std::string references to output functions 2024-03-18 14:42:05 -04:00
Rangi42
7b11c528ef Pass std::string references to section functions 2024-03-18 14:42:05 -04:00
Rangi42
91164ac1b0 Pass std::string references to charmap functions 2024-03-18 14:42:05 -04:00
Sylvie
eb99fc8681 Use a std::unordered_map for looking up sections by name (#1357) 2024-03-13 19:45:52 -04:00
Rangi42
846a9411b9 Refactor FileStackNode::dump to not need a helper function 2024-03-10 14:14:34 -04:00
Rangi42
58fdaa8747 Avoid a couple of clang-format quirks 2024-03-10 12:31:03 -04:00
Sylvie
820f6b5b3c Consistently format type qualifiers like const on the right (#1347) 2024-03-10 12:21:52 -04:00
Rangi42
569b940b82 No need to manually do the Expression destructor's job 2024-03-09 19:33:53 -05:00
Sylvie
17444e825a Reduce the header declarations (#1342)
- Since we have style rules to include foo.hpp at the top of its
  corresponding foo.cpp, this takes any headers included by foo.hpp
  as being also guaranteed for foo.cpp.

- Use C-style <foo.h> instead of <cfoo>, since the latter only
  guarantees putting symbols in the `std` namespace, which we are
  not using for C functions (e.g. `printf` not `std::printf`).

- Remove now-unused `__PRETTY_FUNCTION__` reporting
2024-03-09 14:55:39 -05:00
Sylvie
5681be1fd8 Use automatic allocation and std::move for RPN bytes (#1336) 2024-03-09 11:12:34 -05:00
Sylvie
4a7d333891 Use std::unique_ptr for rgblink sections (#1337) 2024-03-09 11:12:01 -05:00
Sylvie
53537cf9af Remove now-unnecessary enum keyword (#1338)
C++ does not need it
2024-03-08 19:40:41 -05:00
Rangi42
75cc12bb3d Use std::optional for fstack paths 2024-03-07 21:41:02 -05:00
Rangi42
aed172071b Replace some macros with static functions or constants 2024-03-07 16:10:05 -05:00
Rangi42
097b7c3baf Use std::string for symbol names 2024-03-07 12:40:33 -05:00
Rangi42
bf45ebb178 Run clang-format to fix some inconsistent style 2024-03-07 11:52:53 -05:00
Rangi42
84bedc7bbe Use automatic allocation for RPN reasons 2024-03-07 09:58:45 -05:00
Sylvie
292adb27a3 Adapt the RGBASM parser to C++ (#1333)
This uses variants instead of a `%union`, and "complete symbols"
that can call complex constructors.
2024-03-06 20:40:36 -05:00
Rangi42
053aa80951 Improve some const correctness in RGBASM 2024-03-06 13:53:03 -05:00
Rangi42
bd88787cb3 Use FileStackNode constructor to avoid std::monostate possibility 2024-03-05 14:22:29 -05:00
Sylvie
e74073e480 Run clang-format on everything (#1332) 2024-03-04 14:22:49 -05:00
Sylvie
b004648a13 Use std::variant for symbol values (#1331) 2024-03-04 08:55:33 -05:00
Rangi42
f2c875e71e Avoid using std::get except in holds_alternative-asserting accessors 2024-03-03 23:33:23 -05:00
Rangi42
13904dc536 Remove EQUS callbacks for symbols
They're no longer used since `__FILE__` was removed
2024-03-03 21:26:44 -05:00
Sylvie
447c561aaa Use std::variant for symbol values (#1330) 2024-03-03 21:16:36 -05:00
Sylvie
f8dab23e8f Use uncommented sizes for pointer-to-array arguments (#1329)
This is syntactically valid despite not being enforced, and
is a feature we already use elsewhere.
2024-03-03 19:43:08 -05:00
Sylvie
8cf446b14c Use std::variant for lexer mmap/buffer state (#1328) 2024-03-03 18:45:50 -05:00
Evie
6b67c82b94 Implement -c #none (#1301)
Also adds a test case for round-tripping `-r` with `-c #none`.
2024-03-03 18:45:33 -05:00
Rangi42
930a5c3e44 Replace RGBLINK non-null pointers with references 2024-03-03 00:57:03 -05:00
Rangi42
277ea9be28 Replace RGBASM non-null pointers with references 2024-03-03 00:57:03 -05:00
Rangi42
d812acff24 Check RGBGFX warning/error format strings with format_ macro 2024-03-02 23:17:54 -05:00
Rangi42
2e1b0b6421 Remove commented-out C-only macro features 2024-03-02 20:17:22 -05:00
Rangi42
52f8ecc347 We do not call malloc/free any more 2024-03-02 08:16:44 -05:00
Rangi42
19bb12754b Use new allocation for expanding \# 2024-03-02 08:04:59 -05:00