1036 Commits

Author SHA1 Message Date
CreepySkeleton
14eeff42a5 Allow <mut name:E> in patterns 2019-08-21 19:24:15 +03:00
Ahmed Charles
2bd51e0888 Add support for <mut x:X> allowing for mutable x in action code.
Fixes #136.
2019-08-21 19:24:11 +03:00
CreepySkeleton
abbc3aff54 Add a link to gitter lobby
It's surprisingly hard to google it when you don't  know about it at all.
2019-07-09 17:31:14 +02:00
Markus Westerlind
f10b833634
Version 0.17.1 (#471) 2019-06-24 20:04:22 +02:00
Markus Westerlind
cba3a7463c
fix: Accept dyn Trait as a type (#469)
* refactor: Run rustfix

* fix: Accept `dyn Trait` as a type

Rust has started warning about trait objects without dyn on nightly.

* fix: Accept Fn(A, B) -> Type as a type

* Fixup `dyn Trait` and `dyn Fn()` in tests
2019-06-24 18:42:09 +02:00
Ivan Enderlin
57f72944e3 doc(api) Fix intern_token example (#468)
A very small fix. Thanks for the documentation!
2019-06-18 18:17:17 +02:00
Mr-Andersen
a879a3bd73 Added RustPython to README in Example Uses section 2019-06-12 12:52:18 +02:00
Markus Westerlind
8dd1631682
Version 0.17.0 (#462)
* Version 0.17.0

* Wait for lalrpop-util to be published
2019-05-08 10:16:49 +02:00
Markus Westerlind
6088e99082
Update ena and fix new warnings (#461)
* Update ena and fix new warnings

* Bump minimum rust version to fix docopt
2019-05-06 23:25:19 +02:00
Jan Teske
4cdf34f657 Apply rustfmt (#460)
* Apply rustfmt on all source files

* Condense wildcard suffixes

* Format macro matchers

* Normalize comments

* Fix semicolon placement
2019-05-04 20:00:57 +02:00
Jan Teske
d2476abed5 Fix Clippy warnings (#459)
* Remove `clone` calls from `Copy` types

This commit fixes code that triggered the clippy::clone_on_copy lint.

* Remove redundant field names in struct literals

This commit fixes code that triggered the clippy::redundant_field_names
lint.

* Remove unneeded `return` statements

This commit fixes code that triggered the clippy::needless_return lint.

* Remove unnecessary double parentheses

This commit fixes code that triggered the clippy::double_parens lint.

* Replace `while let` loops with `for` loops

This commit fixes code that triggered the clippy::while_let_on_iterator
lint.

* Remove needless if-else statement

This commit fixes code that triggered the clippy::needless_bool lint.

* Remove empty string from `writeln!` invocations

This commit fixes code that triggered the clippy::writeln_empty_string
lint.

* Remove redundant closures

This commit fixes code that triggered the clippy::redundant_closure
lint.

* Replace length comparisons with `is_empty`

This commit fixes code that triggered the clippy::len_zero lint.

* Remove 'static lifetime param on consts

This commit fixes code that triggered the clippy::const_static_lifetime
lint.

* Replace useless invocations of `format!`

This commit fixes code that triggered the clippy::useless_format lint.

* Remove needless lifetime params from functions

This commit fixes code that triggered the clippy::needless_lifetimes
and clippy::extra_unused_lifetimes lints.

* Replace wildcard field matches with `..`

This commit fixes code that triggered the clippy::unneeded_field_pattern
lint.

* Replace `<char> as u8` with byte literals

This commit fixes code that triggered the clippy::char_lit_as_u8 lint.

* Fix clippy warnings related to iterators

This commit fixes code that triggered the clippy lints:
 - for_kv_map
 - into_iter_on_ref
 - filter_next
 - iter_cloned_collect
 - unnecessary_fold

* Fix clippy warnings related to references

This commit fixes code that triggered the clippy lints:
 - match_ref_pats
 - trivially_copy_pass_by_ref
 - prt_arg
 - toplevel_ref_arg
 - op_ref

* Simplify `if` statements

This commit fixes code triggering the clippy lints:
 - collapsible_if
 - if_same_then_else

* Fix misc clippy warnings

This commit fixes code triggering the clippy lints:
 - write_with_newline
 - inconsistent_digit_grouping
 - range_plus_one
 - or_fun_call
 - assign_op_pattern
 - assertions_on_constants
2019-05-02 21:15:04 +02:00
Jan Teske
6350641977 Replace deprecated trim_left with trim_start (#458)
Now that our minimum supported Rust version is 1.31.0, we can make the
switch from `String::trim_left` (deprecated since 1.33.0) to
`String::trim_start`.

This also lets us get rid of the `allow(deprecated)` introduced as a
workaround for issue #428.
2019-05-01 00:34:57 +02:00
Bastien Orivel
d384284d4e Update term to 0.5 and ascii-canvas to 2.0 (#456) 2019-04-30 18:49:31 +02:00
Jan Teske
4eb95405a5 Replace all uses of try! with ? (#454)
* Ignore trailing commas in `ExpectedDebug`

rust-lang/rust/pull/59076 changed the multiline Debug representation to
always include a trailing comma. This change currently breaks our tests
on beta and nightly, since we use this Debug representation to compare
expected parsing output.

We cannot simply add the trailing commas to the expected output strings,
since that would break on older rustc versions we support. Instead, this
commit makes it so that all trailing commas are stripped before the
comparison.

This workaround can be removed once rust-lang/rust/pull/59076 reaches
our minimum supported rustc version.

* Bump minimum Rust version to 1.31.0

That's required by the current version rustc-demangle, which is a
dependency of mdbook.

* Replace all uses of `try!` with `?`

The `?` operator was added to replace the `try!` macro and should be
used in modern Rust code. `try` is also a reserved keyword in Rust 2018,
so this change prepares for a possible edition switch too.
2019-04-30 15:30:21 +02:00
Jan Teske
9b5ec5fdb1 Ignore trailing commas in ExpectedDebug (#455)
* Ignore trailing commas in `ExpectedDebug`

rust-lang/rust/pull/59076 changed the multiline Debug representation to
always include a trailing comma. This change currently breaks our tests
on beta and nightly, since we use this Debug representation to compare
expected parsing output.

We cannot simply add the trailing commas to the expected output strings,
since that would break on older rustc versions we support. Instead, this
commit makes it so that all trailing commas are stripped before the
comparison.

This workaround can be removed once rust-lang/rust/pull/59076 reaches
our minimum supported rustc version.

* Bump minimum Rust version to 1.31.0

That's required by the current version rustc-demangle, which is a
dependency of mdbook.
2019-04-30 15:30:03 +02:00
Newton Ni
46434782bd Split apart UnrecognizedEOF error variant from UnrecognizedToken (#446)
* Split apart UnrecognizedEOF error variant from UnrecognizedToken

* Factor out fmt_expected function

* Initial attempt at fixing codegen

- Match on lookahead when returning error
- Use last fixed symbol as location of UnrecognizedEOF
- Use `Default::default()` when there are no fixed symbols (?)

* Initial implementation of finding latest optional location

* Fix UnrecognizedToken errors in `Some` test cases

* Fix UnrecognizedEOF test cases

* Fix parentheses around pattern error for 1.26 compatibility

* Add basic test for UnrecognizedEOF (and hopefully trigger Travis build)

* Fix emitted indentation and use travis_wait when testing
2019-03-25 13:35:58 +01:00
Roman Frołow
417f199ec8 type type -> type 2019-03-05 07:37:15 +01:00
Markus Westerlind
cbdafa6494
Merge pull request #451 from rofrol/patch-1
docs: remove unneeded in
2019-03-03 09:08:39 +01:00
Markus Westerlind
4989a9d670
Merge pull request #450 from mikeyhew/remove-fmt-lifetime-warning
Remove warning about hidden lifetime parameter
2019-03-03 09:08:04 +01:00
Roman Frołow
f678f38bcd remove unneeded in 2019-03-03 06:15:42 +01:00
Michael Hewson
2a469030c4 Remove warning about hidden lifetime parameter
On Rust 1.33, the current generated code emits a warning because hidden lifetime parameters in types are deprecated. This occurs in the `impl Display for Token`, and happens because `fmt::Formatter` has a lifetime parameter.

This PR adds an explicit lifetime parameter `'f` to the generated code, so it will work on all supported versions of Rust.
2019-03-02 23:44:14 -05:00
Markus Westerlind
9b773d9fb2
Merge pull request #449 from jwinnie/patch-1
Add gleam to example uses
2019-03-02 08:38:12 +01:00
J Winnie
895575a36e
Add gleam to example uses
https://github.com/lpil/gleam
2019-03-01 19:45:13 -08:00
Markus Westerlind
90b67b999e
Merge pull request #448 from jespersm/remove_print_ok
Remove confusing "ok" message printed to stdout
2019-02-26 10:52:43 +01:00
Markus Westerlind
4d6b014fff
Merge pull request #447 from jespersm/master
Order of string for error message confusing
2019-02-26 10:48:55 +01:00
Jesper Steen Møller
79bcfee0a7 Remove confusing "ok" message printed to stdout 2019-02-26 00:39:06 +01:00
Jesper Steen Møller
48759f18af Order of string for error message confusing 2019-02-22 00:00:43 +01:00
Markus Westerlind
983643086f
Merge pull request #442 from Songbird0/add-missing-link
Add a link to `main.rs`
2019-01-28 22:22:35 +01:00
Songbird0
7fbb1cd7ba
Add a link to main.rs
Add the missing link to `main.rs`.
2019-01-26 19:39:59 +01:00
Markus Westerlind
3d4e3cbc80 chore: lalrpop-snap does not exist 2019-01-20 22:41:05 +05:30
Markus Westerlind
27e5a0eef5 Version 0.16.3 2019-01-20 22:41:05 +05:30
Markus Westerlind
dbd9a13e5b
Merge pull request #435 from Marwes/update
Release preparation
2019-01-20 17:22:45 +01:00
Markus Westerlind
6805efedec Update dependencies 2019-01-20 17:06:11 +01:00
Markus Westerlind
61f52ab179 chore: Snapshot the in-tree parser on every release 2019-01-20 17:06:11 +01:00
Markus Westerlind
fe75f44b4c
Merge pull request #434 from Marwes/opt_memcpy
perf: Avoid some memcpying in reductions
2019-01-19 22:50:36 +01:00
Markus Westerlind
4968e5a608 perf: Avoid some memcpying in reductions
In gluon's parser I have a lalrpop symbol type that ends up at 400Kb
which is expensive to copy around. By moving the `push` call into each
reduction instead we make it easier for LLVM to elide memcpys and I
observed a reduction in memcpy uses from 27% to 18% of of the total
parse time.
2019-01-19 22:09:01 +01:00
Markus Westerlind
becdc9bf19
Merge pull request #433 from alercah/rerun
Support conditional execution by Cargo.
2019-01-19 22:08:48 +01:00
Markus Westerlind
baadb9a24c
Merge pull request #438 from Marwes/snapshot
chore: Don't try to infer whether we are building in the lalrpop work…
2019-01-19 22:07:24 +01:00
Markus Westerlind
7ef0d9e778 Use the PROFILE env rather than hardcoding debug 2019-01-19 16:33:51 +01:00
Alexis Hunt
9592e43313 Support conditional execution by Cargo.
Cargo allows build scripts to emit directives to specify their
dependencies, so that modifying other files does not cause them to be
rerun. This adds a configuration option to emit those directives,
defaulting to false to avoid interfering with other parts of the build
script and leading to hard-to-debug issues.

On Windows, some files cannot be represented in the UTF-8 used by Cargo,
and a build warning is emitted instead.

I've tested this change manually, but didn't see an easy way to test
it programmatically as part of the codebase, especially because
`to_string_lossy()` can never return `None` on Unix platforms.
2019-01-12 11:03:41 -05:00
Markus Westerlind
5ee01e55a4 chore: Don't try to infer whether we are building in the lalrpop workspace
Instead we use --all-features to enable a special `test` feature to run tests with a freshly generated lrgrammar.rs. Since we also have a test to check that the saved lrgrammar.rs is identical to what lalrpop generates we should be ok with this approach.

Closes #436
2019-01-11 22:33:45 +01:00
Niko Matsakis
885f7859db
Merge pull request #437 from alercah/endings
Convert all CRLF line endings to LF.
2019-01-10 17:15:23 -05:00
Alexis Hunt
802ac11a20 Convert all CRLF line endings to LF. 2019-01-10 16:47:50 -05:00
Niko Matsakis
c37319e111
Merge pull request #432 from Marwes/allow_deprecated
Allow trim_left in the generated code
2019-01-10 16:42:27 -05:00
Markus Westerlind
bdd65184e5 fix: Allow the deprecated use of trim_left
Fixes #428
2019-01-10 22:19:23 +01:00
Markus Westerlind
0c67bbed06
fix: Don't make generated files read-only
Don't make generated files read-only
2019-01-05 19:35:07 +01:00
David Flemström
0793ba27a6 Don't make generated files read-only 2019-01-03 14:30:09 +01:00
Markus Westerlind
64bed5ca63
Merge pull request #422 from Marwes/ndm-extract-state-machine-rebase
extract state machine
2018-12-10 21:51:36 +01:00
Stéphane Campinas
39774c0666 typo 2018-12-03 13:57:18 +05:30
Niko Matsakis
548df5c9f8 bump petgraph to 0.4.14 (nightly complains?) 2018-11-29 19:57:56 +01:00