Commit graph

1760 commits

Author SHA1 Message Date
Penelope Haze
d37df4c7c2
Update dreammaker crate readme to use proper subdomain (#352)
Lummox says you shouldn't use the `secure` subdomain for the BYOND 
forums.
2023-04-07 23:10:55 -07:00
Tad Hardesty
00df33a093 Bump versions for suite 1.7.3 2023-02-01 19:05:09 -08:00
Tad Hardesty
b02afe7786 Indent match_annotation! bodies 2023-01-30 19:07:22 -08:00
Tad Hardesty
75c989bf14 Add hover for macro documentation 2023-01-30 19:07:22 -08:00
dependabot[bot]
7a2f3b00da
Bump git2 from 0.15.0 to 0.16.1 (#348)
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.15.0 to 0.16.1.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](https://github.com/rust-lang/git2-rs/compare/git2-curl-0.15.0...0.16.1)

---
updated-dependencies:
- dependency-name: git2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-20 17:51:24 -08:00
dependabot[bot]
c40fa46644
Bump bumpalo from 3.11.0 to 3.11.1 (#346)
Bumps [bumpalo](https://github.com/fitzgen/bumpalo) from 3.11.0 to 3.11.1.
- [Release notes](https://github.com/fitzgen/bumpalo/releases)
- [Changelog](https://github.com/fitzgen/bumpalo/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fitzgen/bumpalo/compare/3.11.0...3.11.1)

---
updated-dependencies:
- dependency-name: bumpalo
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-20 15:38:07 -08:00
Tad Hardesty
9d278dcd8e Fix parsing heredocs with multiple quotes in a row
Previously misparsed {"foo""bar"} as String("foo\"\"\"bar").
2023-01-15 22:21:20 -08:00
TiviPlus
10d9575f9e
Add missing _binobj var for generators (#342)
Similar to the database binobj, it's a internal object whose string representation is useful for reading the generator's arguments.
2022-10-30 01:45:33 -07:00
LatteKat
5c07083706
Bump up all dependencies (#336) 2022-09-14 17:43:23 -07:00
tigercat2000
8641274b25
Fix edge case where delay has non-1 overflow (#331)
Sometimes, Dream Maker just doesn't get rid of extra delay information when a state has the number of frames edited.

This means we need to truncate our delay list to the number of frames specified by the frames key.

This always worked fine- however, we also simplify `delays = 1,1,...` to `Frames::Count(delays.len())`.

The bug in our code was that we checked if our `delays = 1,1,...` *before* truncating the array in the truncation case, so we would output `Frames::Delays([1,1])` for this metadata.

Caused a PartialEq failure in IDB here:
https://github.com/tigercat2000/IconDiffBot2-test/pull/20
https://github.com/ParadiseSS13/Paradise/pull/18326
2022-07-11 22:57:15 -07:00
tigercat2000
4420bb5d60
Add an IconFile to gif/png renderer (#318)
This is finally something I'm comfortable with having added upstream, the API is stabilized and functions well for IDB2's use-case, but should be able to be used by other projects as well.

New dependencies:
- Added the `either` crate to get around an annoying type issue with chained iterators.
- Added the `derivative` crate to make `State` realistically comparable across different icon files (important for diffing in IDB2)
  - `offset` is ignored for PartialEq.

Notes on public API changes:
- Most of the new stuff is in the inline module `dmm_tools::dmi::render`.
- `IconFile`, `Rgba8`, and `Image` are now `Debug`
- `from_bytes` on `Image`, `IconFile`, and `State` no longer takes an explicit &[u8] array, instead it takes the trait bound `<B: AsRef<[u8]>>` for ease of "eat my ownership because I don't care"
- `IconFile` has a new function `pub fn get_icon_state<S: AsRef<str>>(&self, icon_state: S) -> io::Result<&State>` for looking up states by name.
- `Image` has a `clear()` method which fills the data array with defaults.
- `State` has a new member, `pub duplicate: Option<u32>`, which is used for correctly supporting duplicate icon states by enumerating how many times the state name has been seen before this particular `State` was read.
- `State` has a `get_icon_state` method which backs `IconFile`'s `get_icon_state`.
- `State` has a `is_animated(&self) -> bool` method which is used in IDB2 for precalculating the file extension
- `State` also has `get_state_name_index`, which is used by `parse_metadata` to give duplicate states a unique entry into the `state_names` `BTreeMap`.
- `parse_metadata` now keeps track of duplicate states and puts them in `state_names` according to the above.
2022-07-09 15:30:19 -07:00
Tad Hardesty
4a7d19401e Update to auxtools debug server v2.2.3 2022-06-27 17:10:00 -07:00
Mothblocks
f80d6373e7
Check for empty docs_in in flush_docs (#327)
Might speed things up a little.
2022-06-17 16:54:02 -07:00
Jordan Dominion
2be4bc87e3
Add some missing vars to database builtins (#326)
See stddef.dm https://www.byond.com/forum/post/2371109

Fixes #325
2022-06-15 18:07:15 -07:00
moxian
6f26e074de
Add a few simple derives to dmi-related structs (#320)
Specifically, add `#[derive(Clone, PartialEq)]` to `dmi::{Metadata, State, Frames}`

As per (very weakly authoritative) <https://rust-lang.github.io/api-guidelines/interoperability.html> one should derive all the std's traits whenever feasible. Currently for my own project I only need `State::Clone`. The `PartialEq` is being added for consistency with it being present on other structs already, and the rest of the `std`'s traits feel a bit like an overkill presently (despite what the guidelines might say)
2022-05-17 19:28:10 -07:00
moxian
860d6c48a6
Change panics when parsing a malformed dmi to return a Result instead (#319)
Currently parsing a malformed - but also well-formed, yet ancient - .dmi files results in a panic deep within the guts of SpacemanDMM. That's undesirable, since `.dmi`'s which SpacemanDMM does not understand (yet BYOND dreammaker handles fine) do exist in the wild (see https://github.com/ParadiseSS13/Paradise/pull/17800 for a couple of examples).

I don't think teaching SpacemanDMM of the legacy file formats is worth it, but making it return a Result instead of outright panicking definitely is (and it's much less work than the former).

This is technically a breaking change since it changes the signature of the public `dreammaker::dmi::Metadata::meta_from_str()`. (But it's probably rarely used, and definitely easy to fix at the call site?..)

Co-authored-by: Tad Hardesty <tad@platymuus.com>
2022-05-17 19:27:40 -07:00
Tad Hardesty
e979b2e69a Include values of Prefab and Pop in their Hash and Eq impls 2022-05-11 19:52:54 -07:00
Tad Hardesty
a2eaf42f9e Fix panic in langserver in case of disk I/O time rounding errors 2022-05-11 19:52:54 -07:00
Spookerton
59e161b02f
Add /dm_filter hidden type to builtins (#312)
reference to this type -
<https://www.byond.com/forum/post/2544111#comment25180960>

After some cursory poking, /dm_filter is a hidden type that can be used to manipulate filter instances without using the runtime search operator (:). There is no official reference material for it. It does not descend from datum, cannot be subtyped, and can only be created *successfully* by a valid call to proc/filter(...).  All filter types create the same kind of /dm_filter but with different properties, of which I believe type is the only const.

A contributor on Bay tried to use it but checker doesn't know about it. I'm not familiar with the guts of suite, but I think this is all that's necessary?
2022-05-11 19:52:50 -07:00
tigercat2000
4302562211
Add [u8] read/write functions to Image/IconFile/Metadata (#316)
This is so IconDiffBot2 can operate purely in memory.

Metadata::from_bytes and IconFile::from_bytes take an &[u8] as the 
sequence of bytes of a valid PNG+DMI file to produce their types.

Image::to_bytes gives a Vec<u8> which is just the output from 
png::Encoder.

There is no Image::from_bytes because there's no reason not to use 
IconFile::from_bytes, and there is no to_bytes for Metadata or IconFile 
because they don't support to_file either. IconFile could, but it's 
unnecessary.

Co-authored-by: Tad Hardesty <tad@platymuus.com>
2022-05-11 19:51:34 -07:00
LatteKat
8d57ddf399
Update all dependencies (#314)
notable changes:
- dmdoc: changes in brokenlink callback, no longer takes &str directly, borrows instead, so the closure must not outlive the doc its parsing
- langserver: some structs's member names are changed to uppercase, doc-id version is not an option<> anymore, some u64s are changed to be u32 instead, oneof enum uses in some cases

Co-authored-by: Tad Hardesty <tad@platymuus.com>
2022-05-11 19:42:55 -07:00
tigercat2000
a0430d44e3
Fix Clippy lints (#315)
This resolves every single error raised by [Clippy](https://github.com/rust-lang/rust-clippy) for every active crate. Most are formatting or redundant code, there's only a few things that are functionally better.

* Implement PartialEq manually on Prefab and Pop to ensure consistency with Hash
* Disable clippy::if_same_then_else for simple elif chains
* Add a standard path for the unit test codebase so I don't have to worry about git add
* Collapse nested if within smart cables loop
* mem::replace(x, X::default()) -> mem::take(x)
* Single character strings -> chars
* Use a const fn for Constant::null, unwrap_or -> unwrap_or_else calls to it
* writeln! always uses \n alone
* Address complex type signatures with type aliases
* PickArgs shouldn't have Box in it's type alias
* Random unnecessary variable access
* Add and remove closures where appropriate
* No more redundant field names in struct initialization
* Remove unnecessary references
* Use strip_prefix instead of starts_with -> [..]
* Use Range.contains instead of >= && <= comparisons
* Group hex literals by 4
* Elide lifetimes wherever possible
* Replace match with matches! wherever possible
* Remove needless borrows
* Control flow cleanup
* Misc signature & redundancy fixes
* Rename functions or move them to the correct std Trait
* Just ignore the too many arguments lint on the big ugly functions
* require! wasn't doing anything in tree_block.
  tree_entries returns a Status<()>, thus passing () to self.require.
  Macro expansion:
    ```rust
    fn tree_block(
        &mut self,
        current: NodeIndex,
        proc_kind: Option<ProcDeclKind>,
        var_type: Option<VarTypeBuilder>,
    ) -> Status<()> {
        match self.exact(Token::Punct(Punctuation::LBrace))? {
            Some(x) => x,
            None => return Ok(None),
        };
        Ok(Some({
            let v = self.tree_entries(
                current,
                proc_kind,
                var_type,
                Token::Punct(Punctuation::RBrace),
            );
            self.require(v)?
        }))
    }
    fn tree_entries(
        &mut self,
        current: NodeIndex,
        proc_kind: Option<ProcDeclKind>,
        var_type: Option<VarTypeBuilder>,
        terminator: Token,
    ) -> Status<()> {
    ```
* Fix large enum variants

Co-authored-by: Tad Hardesty <tad@platymuus.com>

* Clarify intent on some of the linted code
2022-04-30 11:02:50 -07:00
fira
7e5335e78d
Fix Sleep/Purity checks being skipped under certain overrides (#311)
* bugfix: fix part of the proc tree not being traversed for sleeps/purity when overrides are present

* add unit test

* copypasting whitespace be like

Co-authored-by: Fira <mekkiti@gmail.com>
2022-04-15 19:05:11 +08:00
KIBORG04
963c2c0792
Update dockerfile (#303)
I made it work
2022-02-09 16:38:23 -08:00
pali
0a121f6ae5
Add lints for the switch(rand(L, H)) pattern (#302)
A pattern such as

```dm
switch(rand(1, 3))
  if(1)
    foo()
  if(2)
    bar()
  if(3)
    baz()
```

is not uncommon in SS13 code. Sadly, it is also not uncommon for people to add new cases to a longer switch of this form and forget to change the `rand` arguments at the top. This PR adds a linter warning for when the `rand` range is not fully covered by the cases and for when a case lies completely outside of the `rand` range.

This currently generates 7 warnings on tgstation master. Sadly, it is (at least to me) not quite clear if the omissions of a part of the `rand` range are intentional there or not. However, I believe that even if they are intentional it is worth adding the missing part of the range as a case with empty body explicitly to make the intent clear to future developers.

As a less related (but perhaps more important) addition this PR now also adds a warning for switch branches of the form `if(X || Y)` which is pretty much always a mistake and should instead be `if(X, Y)`. This lint generates 5 warnings on current tg code, seemingly all being actual mistakes.
2022-02-07 17:09:44 -08:00
Tad Hardesty
4c24fcb883 Fix tests failing due to subtraction followed by overflow 2022-01-04 17:37:47 -08:00
Tad Hardesty
4756f31219 Improve error locations in DMM parser
Fixes a case where parse errors could refer to LocatedTokens with
locations starting at 0,0 instead of at where the input string was
actually taken from.
2022-01-03 17:59:25 -08:00
quardbreak
0bc598a459
Fix homepage links for dmdoc and interval-tree (#301) 2021-12-27 12:34:40 -08:00
Tad Hardesty
0ec49aa113 Bump dm-langserver to v1.5.1 for minor release 2021-12-18 16:52:57 -08:00
Tad Hardesty
f99b009a1c Run cargo update 2021-12-18 16:51:36 -08:00
Tad Hardesty
11d720000c Hide setup time if it's less than 1ms 2021-12-04 20:08:06 -08:00
Tad Hardesty
4d12ef5bf0 Run dreamchecker from the language server in a background thread 2021-12-04 19:58:45 -08:00
Tad Hardesty
e79c86ad58 Split diagnostics into their own method 2021-12-04 19:38:25 -08:00
Tad Hardesty
7aa2439422 Populate find-all-references table in a background thread
This hovers around 0.57s on my system, which will now be deducted from
the total time to load the environment.
2021-12-04 17:58:53 -08:00
Tad Hardesty
456e8f472a Reserve space for 16k types to save on reallocs 2021-12-04 17:18:45 -08:00
Tad Hardesty
0647969685 Store an index rather than a copy for a type's name 2021-12-04 17:18:31 -08:00
Tad Hardesty
af9f0ec238 Comment out or suppress warnings for unused fields 2021-12-04 16:28:52 -08:00
Tad Hardesty
9e42d0038e Move SymbolIdSource into ObjectTreeBuilder 2021-12-04 16:27:38 -08:00
Tad Hardesty
8b47ea8147 Reserve 1 instead of 4 ProcValue entries for most procs 2021-12-04 16:16:59 -08:00
Tad Hardesty
f82df10f80 Split dap_types module into its own crate 2021-11-28 16:12:57 -08:00
Tad Hardesty
b93a7e1cd3 Update release scripts for restructure 2021-11-21 23:37:29 -08:00
Tad Hardesty
8c9b6b19c1 Fix buffer_file setting the capacity too low
Doesn't really impact idle memory usage, but it's more correct this way.
2021-11-21 20:42:06 -08:00
Tad Hardesty
43eabde619 Default #define stack capacity to 1 instead of 4 2021-11-21 20:34:44 -08:00
Tad Hardesty
3a326ec195 Remove unused enable_procs call from dmm-tools-cli 2021-11-21 20:08:34 -08:00
Tad Hardesty
3c83e513b2 Use Box<[T]> for ProcValue::parameters 2021-11-21 03:29:21 -08:00
Tad Hardesty
f2345b6c1f Store only presence/absence of code rather than builtin/invalid flag 2021-11-21 03:21:09 -08:00
Tad Hardesty
3682e04389 Remove unused DMError from objtree::Code 2021-11-21 02:46:01 -08:00
Tad Hardesty
f641186e01 Compress the Constant enum from 136 to 32 bytes 2021-11-21 02:46:01 -08:00
Tad Hardesty
c5b5fb0ca8 Use Box<str> in Term::InterpString and Call
Reduces sizeof(Term) to 40 (5 pointers).

Linux-gnu langserver idle on /tg/station13 is about 464 MiB.
2021-11-20 18:30:13 -08:00
Tad Hardesty
0ebd024795 Merge NewType enum into Term and split out MiniExpr
Reduces sizeof(Term) to 48 bytes (6 pointers).
2021-11-20 18:10:53 -08:00