Rangi42
32db0a0f18
Rename CaptureBody to Capture, and refactor its methods
2024-03-26 12:29:59 -04:00
Rangi42
cb59119881
Use automatically-allocated std::string_view for macros
2024-03-25 11:33:17 -04:00
Rangi42
d9e5e57e27
Make CaptureBufs be parser values instead of a single static global
2024-03-23 19:44:54 -04:00
Rangi42
e9e8915725
Refactor to keep lexerState and lexerStateEOL static
...
Also run `clang-format` on everything
2024-03-23 19:14:46 -04:00
Rangi42
507439bc25
Refactor macro args to be owned collectively by their fstack contexts
2024-03-22 14:25:36 -04:00
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
Sylvie
dd43723e20
Use methods for RPN Expression ( #1372 )
2024-03-22 04:41:04 -04:00
Rangi42
32b4a6f284
Use "snake_case" consistently in parsers
2024-03-21 11:44:07 -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
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
Rangi42
04899a21cd
Pass std::string references to parser semantic functions instead of .c_str() pointers
...
This also refactors some semantic functions to be more efficient
2024-03-18 14:42:05 -04:00
Rangi42
8f77518406
Use std::string for most intermediate parsed strings
...
This is a work in progress: its performance is unacceptably slow,
and it is obviously not a complete refactoring:
- The parser's semantic functions are still written for C-style
strings, taking `.c_str()` pointers instead of `std::string`
references (and using their methods, `<algorithm>`s, etc).
- Quoted string literals from the lexer still use our `String`
struct, which wraps around a fixed-size char array.
- Symbol values, macro arguments, and so forth are still pointers
to C-style strings with unclear ownership semantics (i.e. we
still have "leaks as a feature").
2024-03-18 14:42:05 -04:00
Sylvie
820f6b5b3c
Consistently format type qualifiers like const on the right ( #1347 )
2024-03-10 12:21:52 -04:00
Rangi42
d982d47c56
Use move semantics for more parsed values
2024-03-09 20:05:09 -05:00
Rangi42
569b940b82
No need to manually do the Expression destructor's job
2024-03-09 19:33:53 -05:00
Sylvie
3323cb56fe
Make enum patterns more explicit ( #1343 )
2024-03-09 14:55:17 -05:00
Sylvie
5681be1fd8
Use automatic allocation and std::move for RPN bytes ( #1336 )
2024-03-09 11:12:34 -05:00
Rangi42
0bfade4435
Fix enum: REG_SP == REG_AF == 3
2024-03-08 20:00:29 -05:00
Rangi42
40704b5055
Remove unused yyerror declaration
...
Also reformat some `enum`s
2024-03-08 19:47:57 -05:00
Sylvie
53537cf9af
Remove now-unnecessary enum keyword ( #1338 )
...
C++ does not need it
2024-03-08 19:40:41 -05:00
Rangi42
097b7c3baf
Use std::string for symbol names
2024-03-07 12:40:33 -05:00
Rangi42
104fd6c70d
Use automatic allocation for some parser values
2024-03-06 22:17:35 -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
75105016f7
Make sure that parsed subexpressions are fully defined
...
We were not initializing some expressions, and they were using
the values of the previous expressions instead. This just so
happened to not crash the tests, and to sometimes even give valid
results (although `BANK()` of a non-label symbol being $4B4E4142,
the ASCII balue of "BANK", was something we missed).
2024-03-06 16:00:55 -05:00
Rangi42
f419f206e5
Fix a latent bug with parsing macro args
...
This seems to only have worked by coincidence; `$$` was an
undefined value that happened to equal `$1` already.
2024-03-06 15:14:17 -05:00
Rangi42
82824a4bf2
Avoid using Bison's typed mid-rule actions
...
These work with `%union`, but will not work with C++ `variant`
2024-03-06 14:19:37 -05:00
Sylvie
e74073e480
Run clang-format on everything ( #1332 )
2024-03-04 14:22:49 -05:00
Rangi42
277ea9be28
Replace RGBASM non-null pointers with references
2024-03-03 00:57:03 -05:00
Rangi42
2069a95e0f
Use std::string for macro args
2024-03-02 05:23:15 -05:00
Rangi42
b130c2e27c
Use std::string for STRFMT spec and args
2024-03-02 05:09:43 -05:00
Rangi42
ba00cf5684
Use std::string for section names
2024-03-02 04:47:02 -05:00
Sylvie
1ac3c0262f
Refactor structs to use methods instead of functions ( #1322 )
2024-03-01 13:11:45 -05:00
Rangi42
91d22f180e
Reorganize the asm parser to be more like the linker script parser
...
Split the declarations into those required for the `%union` and
those only required for the `code`.
Only declare functions on top; define them at the bottom.
2024-02-29 16:23:53 -05:00
Sylvie
043db49676
Replace NULL with nullptr ( #1321 )
2024-02-29 15:06:33 -05:00
Sylvie
eff8c324c8
Remove now-unnecessary struct keyword ( #1320 )
...
C++ acts like structs are `typedef`ed by default
We do have to keep `struct stat`, since there's ambiguity
with the function also called `stat`.
2024-02-29 14:41:58 -05:00
Rangi42
1210a7441f
Use std::visit with Visitor helper instead of std::holds_alternatve
2024-02-29 13:44:08 -05:00
Rangi42
7daa8759c9
Use std::variant for STRFMT arguments
2024-02-29 13:44:08 -05:00
Rangi42
962398969b
Use std::string for PURGE args
2024-02-29 13:44:08 -05:00
Rangi42
a24df27cd8
Use std::vector for charmap output
2024-02-29 13:44:08 -05:00
Rangi42
843f3394c8
Use automatic allocation for DS args
2024-02-29 13:44:08 -05:00
Rangi42
b1aa98b43d
Use automatic allocation for PURGE args
2024-02-29 13:44:08 -05:00