ISSOtm
15ec6efc28
Fix missing newline in charmap override warning
2021-01-17 20:13:51 +01:00
ISSOtm
57b734a7df
Reinstate RL into the _RS family
...
Removal of colon-less labels lifted the grammar ambiguity that
prevented `RL` from being usable as a variable declarator.
Thus, reinstate its functionality.
2021-01-11 01:38:03 +01:00
ISSOtm
5be1c0da62
Fix intra-section ALIGN not computing offset correctly
2021-01-09 23:29:08 +01:00
ISSOtm
b598911e96
Enable LTO in release builds
...
Fixes #693
2021-01-09 20:31:15 +01:00
ISSOtm
51ce0b038a
Remove removed features from documentation
2021-01-02 02:47:13 +01:00
ISSOtm
bd244e6865
Remove deprecated features
...
Trimming off the fat!
- GLOBAL and XDEF keywords
- Colon-less global labels
- *-comments
2021-01-02 02:42:44 +01:00
ISSOtm
18f3c8ff9a
Un-document deprecated _PI
2021-01-02 01:43:49 +01:00
ISSOtm
c4fb5591ee
Fix size of unterminated REPT/FOREACH blocks
...
Do not "uncapture" ENDR if it was not read in the first place
2020-12-30 15:52:24 +01:00
ISSOtm
aa27e714d4
Make Bison version detection more portable
...
- POSIX sh actually does NOT support `+=`,
but Bash does even in compatibility mode
- `mawk` does not fully support POSIX EREs (regexes),
so work around its lack of brace support
Fixes building on Debian, apparently.
2020-12-29 22:31:15 +01:00
ISSOtm
7bc42d468b
Clean up temp test files even if interrupted
...
Avoids "tmp.*" piling up in /tmp
2020-12-26 14:38:04 +01:00
ISSOtm
097999cad3
Prevent tests from running if RGBDS hasn't been built
...
Prevents a *lot* of spurious errors due to files not generating
2020-12-26 14:26:50 +01:00
ISSOtm
f82edaa7ec
Make gbdiff.bash handle CRLF sym files gracefully
...
Additionally, reduce the amount of lines piped through `cut`,
improving performance
2020-12-26 02:47:04 +01:00
ISSOtm
d8e8b796e7
Update tested projects to latest commits
...
Compatibility fixes, etc.
2020-12-26 02:02:38 +01:00
ISSOtm
900fd8cabc
Improve gbdiff script
...
Use better constructs where possible
- <<< instead of echo|
- Parameter expansions instead of `cut`
- Etc.
Improves performance and reliability somewhat
Also, accept "d" between diff line info parts
2020-12-26 01:44:45 +01:00
ISSOtm
c20ac35074
Refactor readString
...
Much more readable, and avoids `peek(nz)`
2020-12-19 13:02:05 +01:00
ISSOtm
4ef490f3cb
Avoid interpreting Liquid in doc pages
...
They are auto-generated, so they wouldn't normally contain Liquid
(The post-processor may insert some, but it has control over the `raw` tags)
Some code introduced as examples contains `{{` due to nested brace expansions,
which was interpreted as (invalid) Liquid. This fixes such problems.
Additionally, Jekyll generates warnings about excerpts being part of a Liquid
block (the `{% raw %}`). This is fine, since doc pages don't use excerpts.
2020-12-14 10:35:30 +01:00
ISSOtm
8f2a894b88
Add anonymous labels
...
Fix #497
2020-12-14 10:14:40 +01:00
ISSOtm
5aabb915ec
Allow STRCAT to take any number of args
...
Fixes bullet point 1 of #625
2020-12-12 23:46:32 +01:00
ISSOtm
0d9de01f9d
Make charmap-converting a non-UTF8 string non-fatal
2020-12-12 14:16:50 +01:00
ISSOtm
f5b0eae9cd
Remove custom action code when equivalent to default
...
Enables Bison to better reason about it, and should improve performance
2020-12-12 12:22:36 +01:00
ISSOtm
417cceb0de
Document dw and dl with strings
2020-12-11 11:02:20 +01:00
ISSOtm
e54e02dc77
Correct underscore-in-number documentation
...
No radix actually allows underscores at the beginning of a literal
2020-12-10 16:01:18 +01:00
ISSOtm
2bf3b08d76
Document underscores in numeric literals
2020-12-10 15:40:59 +01:00
ISSOtm
21b58b08b8
Fix not shifting CRLF at end of raw lines
...
Fixes line reporting errors on Windows
2020-12-10 15:37:50 +01:00
ISSOtm
3e4c2fe712
Avoid error with old Bison versions
...
`api.token.raw` is only defined starting with Bison 3.5
Since it's not essential, define it on the command-line iff the Bison
version is sufficient.
2020-12-10 15:13:45 +01:00
ISSOtm
bdfce25db0
Avoid running version test when git describe fails
...
Can happen when not enough history has been fetched, notably in our CI
2020-12-10 13:43:22 +01:00
ISSOtm
2b6d9cd1e0
Avoid using yytoken_kind_t
...
Apparently it was added in a fairly recent Bison version...
2020-12-10 13:32:18 +01:00
ISSOtm
bf789dd7b3
Add automated test for version consistency
...
Automatically check that the version number constants
(__RGBDS_MAJOR__ etc.) match `rgbasm -V`
Should avoid the problem with 0.4.2's release...
2020-12-10 12:22:29 +01:00
ISSOtm
9b6f01047c
Enable raw token types
...
Removes one layer of indirection for the parser, and helps remove all literals from the grammar
The latter preparing the next change
2020-12-09 21:22:05 +01:00
ISSOtm
3fe2fa43bb
Switch to GNU Bison as a dependency
...
First step for #595
2020-12-09 20:30:31 +01:00
ISSOtm
ede982b50a
Bump patch level appropriately
...
*HEADDESK*
2020-12-09 20:30:31 +01:00
ISSOtm
319d775c13
Add CI script to create docs on new releases
2020-12-09 16:08:43 +01:00
ISSOtm
44124319a6
Work around old Bison versions not forward-declaring yyparse
...
Notably, macOS still ships 2.3 (from 2008)...
Should fix #214
2020-12-09 16:00:22 +01:00
ISSOtm
462fd7539c
Prohibit nested macros
...
After discussion (starting there:
https://github.com/gbdev/rgbds/pull/594#issuecomment-706437458
), it was decided that plain nested macros should not be
allowed.
Since #590 is fixed, EQUS can be used as a workaround;
multiline strings (#589 ) will make that easier on the
user when implemented.
Fixes #588 , supersedes and closes #594 .
Additionally, closes #388 .
2020-12-09 10:44:39 +01:00
ISSOtm
f16e34b804
Fix captures beginning in expansions
...
Fixes #590
2020-12-09 09:54:55 +01:00
ISSOtm
c3ccdc548e
Remove unnecessary flex dep from Dockerfile
2020-12-09 09:42:19 +01:00
ISSOtm
fd721ca480
Document optional RB/RW/RL argument
2020-12-09 09:39:46 +01:00
ISSOtm
eac365aef0
Allow argument to rb, rw and rl to be optional
...
Fixes #617
2020-12-09 09:31:47 +01:00
ISSOtm
4de6266442
Add explanation of how EXPORT works
...
Fixes #608
2020-12-08 21:07:24 +01:00
ISSOtm
213d985e17
Fix incorrect "sliced" INCBIN causing memory leaks
...
Oh, how I miss RAII...
2020-11-29 12:47:53 +01:00
ISSOtm
de76dcb8fb
Fix possible segfault from -MT and -MQ
...
Happened only if `malloc` failed, so...
2020-11-29 12:47:53 +01:00
Eldred Habert
30fb6bde5e
Merge pull request #615 from ISSOtm/find-sym
...
Create specialized symbol finder functions
2020-11-25 15:17:34 +01:00
ISSOtm
4f842a1248
Create specialized symbol finder functions
...
The old "find symbol with auto scope" function is now three:
- One finds the exact name passed to it, skipping any checks
This is useful e.g. if such checks were already performed.
- One checks that the name is not scoped, and calls the first.
This is useful for names that cannot be scoped, such as checking for EQUS.
Doing this instead of the third should improve performance somehwat, since
this specific case is hit by the lexer each time an identifier is read.
- The last one checks if the name should be expanded (`.loc` → `Glob.loc`),
and that the local part is not scoped. This is essentially the old function.
2020-11-21 01:06:17 +01:00
ISSOtm
cc4d455b8a
Add test for empty local label component
2020-11-21 00:58:40 +01:00
Eldred Habert
0bb5efebfd
Merge pull request #610 from daid/stdin
...
Allow rgbasm and rgblink to use stdout and stdin as input and output
2020-11-08 01:20:44 +01:00
ISSOtm
b6bf7ae620
Fix RGBLINK incorrectly reading file stack nodes
...
This caused node IDs to mismatch, yielding possibly corrupted file stacks
Worst part is, the docs mentioned the reading order had to be reversed...
2020-11-04 02:52:06 +01:00
ISSOtm
dc96cc6d1e
Add zsh completion scripts
...
Can't get bash ones to work, but these do.
2020-11-03 23:29:47 +01:00
ISSOtm
0c55703438
Improve helpers.h
...
Use C11 standard _Noreturn instead of attributes (except, of course, MSVC)
Remove unused helpers
Avoid trapping in release builds, in favor of just unreachability
Improve shim when __builtin_* are not available
2020-10-26 15:19:31 +01:00
ISSOtm
6c57ad2226
Have make clean delete parser artifacts
...
Forgot to update the names there
2020-10-25 16:26:58 +01:00
ISSOtm
9028fb5391
Fix mistakes in RGBDS man pages
...
As reported by `mandoc -Wall`
2020-10-23 01:02:59 +02:00
ISSOtm
12dc49b60a
Make page processor print usage only after reporting all bad opts
2020-10-23 00:40:05 +02:00
Eldred Habert
7e1d20acdf
Merge pull request #607 from anderoonies/inline-comment-#537
...
handle inline c-like comments in lexer
2020-10-19 19:36:49 +02:00
Eldred Habert
42b3a17356
Merge pull request #602 from NieDzejkob/shiftstorm
...
Report only one error when invalid shift has argument
2020-10-13 15:48:16 +02:00
ISSOtm
4ce4fdec71
Mention setting CMAKE_BUILD_TYPE to Release when using CMake
...
Not *necessary*, but if you don't know better, you should probably use it.
Fixes rgbds-www#9
2020-10-13 11:37:25 +02:00
Eldred Habert
05256946ac
Merge pull request #604 from NieDzejkob/narg-overwrite
...
Don't overwrite symbol when it's not allowed
2020-10-13 10:47:57 +02:00
Eldred Habert
73396166aa
Merge pull request #605 from NieDzejkob/invalid-labels
...
Don't consider difference of invalid labels constant
2020-10-13 10:42:05 +02:00
Eldred Habert
e4f5df1306
Merge pull request #603 from NieDzejkob/rpn-realloc
...
reserveSpace: don't assume one doubling is enough
2020-10-12 12:26:44 +02:00
ISSOtm
71d8aeb4c2
Add CMake defines to enable tracing lexer and parser
2020-10-12 09:02:21 +02:00
Eldred Habert
0836f67d42
Merge pull request #601 from NieDzejkob/utf8decoder
...
utf8decoder: Use byte-sized byte argument
2020-10-12 01:49:57 +02:00
Eldred Habert
176a57a1e9
Merge pull request #600 from NieDzejkob/stray-shift
...
Report error when shifting outside a macro
2020-10-12 01:44:10 +02:00
Eldred Habert
0d02355dbf
Merge pull request #599 from NieDzejkob/stray-align
...
Report error when aligning outside of a section
2020-10-12 01:43:35 +02:00
ISSOtm
2dd9015dc6
Remove two stale variables from parser.y
...
They were made useless with the lexer rewrite
2020-10-12 00:52:12 +02:00
ISSOtm
0b1d01792d
Indicate cur offset in linkerscript "backwards org" message
2020-10-12 00:04:08 +02:00
ISSOtm
01637768cf
Rename asmy to more explicit parser
...
This should make the purpose of that file clearer to newcomers
2020-10-11 21:03:41 +02:00
ISSOtm
6a8ae643d5
Mention that SHIFT updates _NARG
...
Fixes #598
2020-10-11 02:13:30 +02:00
ISSOtm
fd83d46ba0
Enable master docs update workflow always
...
There seems to be no way to make the check work, and Actions are disabled
in forks by default anyways.
2020-10-11 02:04:09 +02:00
ISSOtm
914856342c
Fix incorrect documentation of accepted sym names
...
No, they cannot start with a digit!
2020-10-11 01:57:27 +02:00
Eldred Habert
91889fc14a
Merge pull request #593 from Rangi42/issue586
...
Fix #586 : Update the `charmaps` hashmap when an existing charmap is resized
2020-10-10 02:15:04 +02:00
Eldred Habert
f9daf27511
Merge pull request #585 from ISSOtm/msvc-ci
...
Add MSVC in CI
2020-10-06 17:48:13 +02:00
ISSOtm
06f7387466
Avoid using VLA in EQUS dumping
...
MSVC does not support those...
Also add a `develop` warning about VLAs, to avoid future incidents
2020-10-06 08:55:45 +02:00
ISSOtm
21e50eeff1
Have lexer not require <unistd.h> on MSVC
...
Required for `open`, `close`, `read`, and `STDIN_FILENO`,
which are defined elsewhere on MSVC.
2020-10-06 08:55:45 +02:00
ISSOtm
fd4cec93cd
Compile with MSVC as well in CI
2020-10-06 08:55:41 +02:00
ISSOtm
92f2055a6c
Fix implicit cast between enums
...
This caused `make develop` to fail
2020-10-05 01:53:54 +02:00
Eldred Habert
be9b1198e9
Merge pull request #584 from Xeyler/master
...
Add directory summary to README.rst
2020-10-04 20:20:08 +02:00
Eldred Habert
fdfc02ab96
Merge pull request #583 from JL2210/cmake-build-type
...
Modularize CMake build configuration
2020-10-04 19:45:20 +02:00
Eldred Habert
fc7f042ad6
Merge pull request #551 from NieDzejkob/errors-after-unknown-symbol
...
link: Suppress cascading errors.
2020-10-04 19:43:38 +02:00
Eldred Habert
3036b58598
Merge pull request #557 from ISSOtm/new-lexer-electric-boogaloo
...
New lexer 2 — Electric Boogaloo
2020-10-04 16:45:47 +02:00
ISSOtm
2eca43cd2d
Fix critical oversight in lexer buffer refilling
...
Since the lexer buffer wraps, the refilling gets handled in two steps:
First, iff the buffer would wrap, the buffer is refilled until its end.
Then, if more characters are requested, that amount is refilled too.
An important detail is that `read()` may not return as many characters as
requested; for this reason, the first step checks if its `read()` was
"full", and skips the second step otherwise.
This is also where a bug lied.
After a *lot* of trying, I eventually managed to reproduce the bug on an
OpenBSD VM, and after adding a couple of `assert`s in `peekInternal`, this
is what happened, starting at line 724:
0. `lexerState->nbChars` is 0, `lexerState->index` is 19;
1. We end up with `target` = 42, and `writeIndex` = 19;
2. 42 + 19 is greater than `LEXER_BUF_SIZE` (= 42), so the `if` is entered;
3. Within the first `readChars`, **`read` only returns 16 bytes**,
advancing `writeIndex` to 35 and `target` to 26;
4. Within the second `readChars`, a `read(26)` is issued, overflowing the
buffer.
The bug should be clear now: **the check at line 750 failed to work!** Why?
Because `readChars` modifies `writeIndex`.
The fix is simply to cache the number of characters expected, and use that.
2020-10-04 16:10:32 +02:00
ISSOtm
c24694233f
Fix incomplete duplication of REPT nodes
...
"Initialization, sizeof, and the assignment operator ignore the flexible array member."
Oops!
2020-10-04 04:46:01 +02:00
ISSOtm
423a7c4899
Handle \\r better
...
Translate it to \\n regardless of the lexer mode
2020-10-04 04:46:01 +02:00
ISSOtm
ee9e45b3d4
Change assertion condition in __FILE__ buf dumping
...
Removes a false positive from Clang static analysis
2020-10-04 04:46:01 +02:00
ISSOtm
5a65188ca9
Implement compact file stacks in object files
...
Gets rid of `open_memstream`, enabling Windows compatibility again
Also fixes #491 as a nice bonus!
2020-10-04 04:46:01 +02:00
ISSOtm
930080f556
Mark not unmapping macro-containing files as okay
...
There isn't really a better alternative.
Making several mappings instead requires too much bookkeeping.
2020-10-04 04:46:01 +02:00
ISSOtm
8e7afb0ab3
Move some MSVC-specific defines to platform.h
2020-10-04 04:46:01 +02:00
ISSOtm
138523570e
Fix possible uninitialized read on Windows
2020-10-04 04:46:01 +02:00
ISSOtm
82469ac0fd
Shim around mmap on Windows
2020-10-04 04:46:01 +02:00
ISSOtm
96cb5e10ed
Fix range-dependent dead code in recursion depth check
2020-10-04 04:46:01 +02:00
ISSOtm
b224cab3e0
Harmonize printing distance
2020-10-04 04:46:01 +02:00
ISSOtm
7381d7b92f
Remove unnecessarily nested symbol data union
2020-10-04 04:46:01 +02:00
ISSOtm
dbef51ba05
Move isWhitespace to a place where it makes more sense
2020-10-04 04:46:01 +02:00
ISSOtm
c952dd8a6e
Fix fixed-point constants not working correctly
...
And added a test to check their behavior
2020-10-04 04:46:01 +02:00
ISSOtm
b65ea64a58
Add newlines to all test output
...
MacOS treats them differently, for some reason.
2020-10-04 04:46:01 +02:00
ISSOtm
542b5d18f1
Fix possible capture buffer size overflow
...
Attempt to grow it to the max size first.
Seriously, if this triggers, *how*
2020-10-04 04:46:01 +02:00
ISSOtm
71a0a42cfb
Fix C2x use of static_assert
2020-10-04 04:46:01 +02:00
ISSOtm
ac011fe69f
Use common function to discard comments in macro args
2020-10-04 04:46:01 +02:00
ISSOtm
9e3d7a50e6
Handle comments in line continuations
2020-10-04 04:46:00 +02:00
ISSOtm
e33c2ad6a2
Fix INCLUDE ignoring -MG
2020-10-04 04:46:00 +02:00
ISSOtm
615f1072d9
Fix readFractionalPart never shifting characters
2020-10-04 04:46:00 +02:00
ISSOtm
f7b7a97407
Prevent expanding macro args in comments
...
Also use a cleaner way, instead of hardcoding to capture
2020-10-04 04:46:00 +02:00
ISSOtm
ece6853e0f
Implement opt b and opt g
2020-10-04 04:46:00 +02:00