Sylvie
a68bebf4a2
Use a Defer struct to close files and restore lexer state with RAII ( #1379 )
2024-03-27 10:42:53 -04:00
Rangi42
32db0a0f18
Rename CaptureBody to Capture, and refactor its methods
2024-03-26 12:29:59 -04:00
Rangi42
a167d23d01
Use content-specific destructors for lexer state
...
Also rename `LexerState` content structs from `*LexerState` to `*Content`
2024-03-26 12:29:59 -04:00
Rangi42
8b6ae994b1
Use STR and CAT macros for # and ##
2024-03-25 14:22:43 -04:00
Rangi42
2b44672873
Rename a few variables
2024-03-25 14:22:38 -04:00
Rangi42
3568418c5d
Remove RGBLINK's unimplemented '-s' "smart linking" placeholder flag
2024-03-25 11:36:23 -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
Sylvie
c075ffb570
Update test project commits ( #1377 )
2024-03-22 17:06:39 -04:00
Sylvie
96c808810f
Remove .simple.err files, since we require Bison 3.0 ( #1373 )
2024-03-22 15:36:32 -04:00
Rangi42
6a5518e0c5
Use RAII to unmap or close the lexer states' files automatically
2024-03-22 14:25:36 -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
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
orbea
0f772932a5
Convert bison.sh to posix shell ( #1369 )
...
* Convert bison.sh to posix shell
* Refactor bison.sh to be more like CMakeLists.txt
No current warnings with shellcheck.net.
2024-03-21 16:06:36 -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
Rangi42
32b4a6f284
Use "snake_case" consistently in parsers
2024-03-21 11:44:07 -04:00
Rangi42
6560b7819d
Add make profile, optimized for callgrind
2024-03-21 11:42:12 -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
035678d250
Remove workaround for GitHub Actions issue ( #1368 )
2024-03-20 20:46:08 -04:00
Sylvie
554778da5b
Built-in symbols are "<builtin>", not "<command-line>" ( #1362 )
2024-03-19 16:01:45 -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
Sylvie
33dd97b6a0
Fix CI builds for Ubuntu 22.04 ( #1361 )
...
Ubuntu 22.04 provides LLVM 14, which links an ASan version incompatible with
high-entropy ASLR in newer Linux kernels that GitHub Actions runners use.
2024-03-19 01:05:10 -04:00
Rangi42
a862c7b17b
Use sed instead of awk to extract Bison version
2024-03-18 15:36:45 -04: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
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
Rangi42
b76e196c89
Run clang-format on everything
2024-03-18 14:08:57 -04:00
Rangi42
d06376c170
Use std::unordered_map and std::vector for sections
...
This allows us to control the order in which sections are iterated,
instead of it depending on the internals of `std::map`. (This order
is arbitrary, but should be deterministic regardless.)
2024-03-16 11:51:47 -04:00
Rangi42
cefc4f4aa3
Use std::unordered_map for symbols
2024-03-16 11:19:19 -04:00
Rangi42
a14de10e28
Use std::unordered_map for charmaps
2024-03-16 11:13:14 -04:00
ISSOtm
e4a3509845
Fix build failure with GCC 13
...
It complains about *those* calls returning a dangling reference...
Unfortunately, GCC does not provide more information about what the
reference *is*. (It only mentions the temporary being destroyed at
the end of this *huge* expression.)
I am normally not one to just commit a thing that gets rid of a
warning if I can't explain why, but this eludes me.
Stubbing out the calls to only return a captured variable still
complains, which led me to test that the error wasn't stemming
from the `Visitor` itself... which it seems to?
But I don't see why a reference to the *visitor* should be kept...
Anyway, here is the obligatory part where I state my yearning for Rust :)
2024-03-15 21:40:11 +01:00
Sylvie
eb99fc8681
Use a std::unordered_map for looking up sections by name ( #1357 )
2024-03-13 19:45:52 -04:00
Sylvie
8ec0d01fc4
Sort .sym files in ascending order, and test for it ( #1355 )
2024-03-13 18:32:35 -04:00
Sylvie
658286c8e4
Move a SECTION FRAGMENT test to the test/link/section-fragment folder ( #1354 )
...
Add a binary comparison for the same-label SECTION UNION test
2024-03-13 15:34:27 -04:00
Sylvie
a1bbb3b3f7
Strip CI binaries built with make ( #1345 )
2024-03-13 14:42:11 -04:00