Sylvie
a13723c523
Implement 0x/0o/0b number prefixes ( #1533 )
2024-10-08 15:56:00 -04:00
Rangi42
a9e49a09fd
Allow tab character after backslash line continuation
2024-10-01 22:41:55 -04:00
Sylvie
6b89938da7
Avoid treating labels and macros differently in column 1 ( #1515 )
...
Fixes #1512
2024-09-23 01:26:25 +02:00
Sylvie
9ef2e43bf7
Track local label scope, string equated as .. ( #1504 )
2024-09-18 09:52:30 -04:00
Sylvie
197f6cb0ba
No need for .c_str() with keywordDict lookups ( #1505 )
2024-09-18 12:23:05 +02:00
Rangi42
02439b18c0
\# will always be defined inside macros
...
This lets the case structure here match the other branches
2024-09-15 00:00:00 -04:00
Sylvie
122ef95d9c
Implement . string constant for the current label scope ( #1499 )
2024-09-13 21:20:01 +02:00
Rangi42
6bc2446966
Rephrase error messages for consistency
2024-09-10 21:38:50 +02:00
Rangi42
8cd0e66297
Revert "Implement INCLUDE_ONCE directive ( #1481 )"
...
This reverts commit 5f07095f6d .
2024-09-08 11:30:31 -04:00
sukus
5f07095f6d
Implement INCLUDE_ONCE directive ( #1481 )
...
Identify files by (device, inode), not by path, so that symlinks,
relative paths, case-insensitive paths, or other edge cases
do not result in double includes.
2024-09-08 00:02:02 -04:00
ISSOtm
610f04beeb
Fix condition for assuming at EOF
...
Part of that condition's purpose is to ensure that we read the correct
lexer state; but it's possible now for the fstack to be non-empty
*before* the lexer state is registered, i.e. if there is an error
in the function that registers it.
This causes a NULL pointer deref.
2024-09-05 17:48:52 +02:00
Sylvie
1283b0b6a6
Allow dollar signs in identifiers ( #1493 )
2024-09-03 23:09:06 +02:00
Rangi42
a098213053
Rearrange switches so default cases are last
2024-09-01 13:00:04 -04:00
Sylvie
b438c83bda
Implement a '#' prefix for raw identifiers that may alias keywords ( #1480 )
...
* Implement a '#' prefix for raw identifiers that may alias keywords
* Review comments
* Disallow hashless raw identifiers in interpolations
* Run clang-format
2024-08-21 19:31:44 +02:00
Sylvie
57c3d74b9e
Use a custom generic tagged union Either instead of std::variant for efficiency ( #1476 )
...
* Implement custom generic tagged union `Either`
This should be more efficient than `std::variant`, while still
keeping runtime safety as it `assert`s when `get`ting values.
* Use `Either` for RPN expressions
* Use `Either` for file stack node data
* Use `Either` for `File` buffer
* Use `Either` for `STRFMT` args
* Use `Either` for RGBLINK symbol values
* Support an equivalent of `std::monostate` for `Either`
* Use `Either` for lexer tokens
* Use `Either` for symbol values
* Use `Either` for lexer mmap/buffer state
2024-08-20 21:19:11 +02:00
Rangi42
ee3a93a442
Test macro args \0 and \<0>
2024-08-18 21:38:45 -04:00
Sylvie
b987e5669f
Comment the parsers better ( #1463 )
2024-08-09 21:36:52 -04:00
Sylvie
e93190d491
Implement BITWIDTH and TZCOUNT functions ( #1450 )
2024-08-07 10:39:30 -04:00
Sylvie
7435630d6a
Error messages note when a symbol has been purged ( #1453 )
2024-08-06 15:35:06 -04:00
Sylvie
13a8895fca
Improve the error messages for interpolating undefined or invalid symbols ( #1423 )
2024-07-25 17:36:02 -04:00
Sylvie
ee748cfe26
Miscellaneous refactoring of code and docs ( #1411 )
2024-06-18 20:47:31 +02:00
Sylvie
623c3f662c
Allow NUL characters in strings ( #1405 )
2024-06-18 14:26:18 -04:00
Rangi42
39e9315e8a
Use a smaller size for the lexer buffer
...
Large sizes are more efficient when it's actually buffered,
but most of the time `mmap` is used instead, and the extra size
just slows down allocation of lexer states.
2024-05-17 20:59:42 -04:00
Sylvie
e2633d5b66
Use the standard stream buffer size for the lexer buffer ( #1396 )
2024-05-17 11:02:36 +02:00
Sylvie
a234da42a6
Replace assert with assume for release build optimization ( #1390 )
2024-04-02 11:09:31 -04:00
Rangi42
eb708ebee5
Rename some variables left from the C parser (e.g. yylval)
2024-03-29 19:42:23 -04:00
Rangi42
106e516962
Split the .peek() method into its next-char and lookahead cases
2024-03-28 15:37:25 -04:00
Rangi42
6f74e4fb9c
Remove the suboptimal .canPeek() and .peek() methods
2024-03-28 14:49:36 -04:00
Rangi42
83c0634f15
Refactor peekInternal to be a LexerState method
2024-03-28 13:21:28 -04:00
Rangi42
4172d330b9
Refactor BufferedContent and Expansion to have methods
...
Use a buffer size that is a power of two for fast modulus
2024-03-28 12:57:23 -04:00
Rangi42
cf7bdb19b6
Run clang-format 14 on everything
...
Later versions may need some proprties added or changed to not
format closing braces weirdly.
2024-03-28 09:17:27 -04:00
ISSOtm
20b7b591d4
Run clang-format
...
Fix some small style inconsistencies
2024-03-28 01:41:25 +01:00
ISSOtm
e5078aba3b
Clean up #includes
...
Remove unused headers, and avoid relying on transitive inclusions
`include-what-you-use` has been very useful for this!
2024-03-28 01:25:38 +01:00
ISSOtm
cae7b5dcf6
Use standard attribute syntax instead of IBM __attribute__
...
Move format attrs to proper standard location
For some reason, GCC 13 is more lax than earlier versions...
2024-03-27 20:01:12 -04:00
Rangi42
dcb4e40388
Use QUOTEDSTRLEN macro instead of sizeof or strlen
2024-03-27 11:50:48 -04:00
Rangi42
b6039870e5
Remove now-redundant MmappedContent struct
2024-03-27 11:27:34 -04:00
Rangi42
78801e324c
Group pointer and size as a ContentSpan struct
2024-03-27 11:27:34 -04:00
Rangi42
bf0cabb3ea
Use std::shared_ptr for lexer capture buffers
2024-03-27 11:27:34 -04:00
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
2b44672873
Rename a few variables
2024-03-25 14:22:38 -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
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
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