Commit Graph

35 Commits

Author SHA1 Message Date
Florian Hahn
6cfbcca41e Update grammar/verify.rs to work with recent master 2015-01-14 00:20:53 +01:00
Florian Hahn
d397a3e654 Handle question marks in model lexer, closes #15879 2015-01-13 23:31:53 +01:00
Keegan McAllister
c2e26972e3 Un-gate macro_rules 2015-01-05 18:21:14 -08:00
Keegan McAllister
416137eb31 Modernize macro_rules! invocations
macro_rules! is like an item that defines a macro.  Other items don't have a
trailing semicolon, or use a paren-delimited body.

If there's an argument for matching the invocation syntax, e.g. parentheses for
an expr macro, then I think that applies more strongly to the *inner*
delimiters on the LHS, wrapping the individual argument patterns.
2015-01-05 18:21:14 -08:00
Keegan McAllister
60be2f52d2 Replace #[phase] with #[plugin] / #[macro_use] / #[no_link] 2015-01-05 18:21:13 -08:00
Alex Crichton
7d8d06f86b Remove deprecated functionality
This removes a large array of deprecated functionality, regardless of how
recently it was deprecated. The purpose of this commit is to clean out the
standard libraries and compiler for the upcoming alpha release.

Some notable compiler changes were to enable warnings for all now-deprecated
command line arguments (previously the deprecated versions were silently
accepted) as well as removing deriving(Zero) entirely (the trait was removed).

The distribution no longer contains the libtime or libregex_macros crates. Both
of these have been deprecated for some time and are available externally.
2015-01-03 23:43:57 -08:00
Jorge Aparicio
56dcbd17fd sed -i -s 's/\bmod,/self,/g' **/*.rs 2015-01-03 22:42:21 -05:00
Florian Hahn
1e278c1cd1 Update src/grammar/README.md 2014-12-30 16:49:27 +01:00
Florian Hahn
f066acf645 src/grammar/check.sh now prints test summary 2014-12-30 16:46:07 +01:00
Florian Hahn
b41a24f314 Handle function calls to integers in model lexer correctly
closes #15877
2014-12-30 14:03:48 +01:00
Alex Crichton
021c2f3712 rollup merge of #20310: fhahn/issue-15877-model-lexer-range
This patch for #15877 uses Antlr's input lookahead (`_input.LA(1) != '.'`) to solve the conflict between the LIT_FLOAT and the range syntax.

Note that in order to execute the grammar tests, #20245 should land first.
2014-12-29 16:36:55 -08:00
Florian Hahn
808945c21c Handle range in model lexer correctly #15877 2014-12-29 21:29:31 +01:00
Florian Hahn
adda8997b1 Update grammer/verify.rs to work with recent master 2014-12-29 19:40:40 +01:00
Eric Kidd
c2b0d7dd88 Modify regex::Captures::{at,name} to return Option
Closes #14602.  As discussed in that issue, the existing `at` and `name`
functions represent two different results with the empty string:

1. Matched the empty string.
2. Did not match anything.

Consider the following example.  This regex has two named matched
groups, `key` and `value`. `value` is optional:

```rust
// Matches "foo", "foo;v=bar" and "foo;v=".
regex!(r"(?P<key>[a-z]+)(;v=(?P<value>[a-z]*))?");
```

We can access `value` using `caps.name("value")`, but there's no way for
us to distinguish between the `"foo"` and `"foo;v="` cases.

Early this year, @BurntSushi recommended modifying the existing `at` and
`name` functions to return `Option`, instead of adding new functions to
the API.

This is a [breaking-change], but the fix is easy:

- `refs.at(1)` becomes `refs.at(1).unwrap_or("")`.
- `refs.name(name)` becomes `refs.name(name).unwrap_or("")`.
2014-12-14 08:56:51 -05:00
Huon Wilson
7586abf01b Adjust Antlr4 lexer to include suffixes.
This makes the formal lexical grammar (more closely) reflect the one
implemented by the compiler.
2014-11-20 00:02:42 +11:00
Huon Wilson
9d20a46799 Update src/grammar for language changes. 2014-11-19 13:10:43 +11:00
Huon Wilson
5b5638f686 Switch to an independent enum for Lit* subtokens. 2014-11-19 12:52:31 +11:00
Aaron Turon
7213de1c49 Fallout from deprecation
This commit handles the fallout from deprecating `_with` and `_equiv` methods.
2014-11-17 11:26:48 -08:00
Brendan Zabarauskas
936d999b52 Use common variants for open and close delimiters
This common representation for delimeters should make pattern matching easier. Having a separate `token::DelimToken` enum also allows us to enforce the invariant that the opening and closing delimiters must be the same in `ast::TtDelimited`, removing the need to ensure matched delimiters when working with token trees.
2014-10-30 09:35:52 +11:00
Steve Klabnik
7828c3dd28 Rename fail! to panic!
https://github.com/rust-lang/rfcs/pull/221

The current terminology of "task failure" often causes problems when
writing or speaking about code. You often want to talk about the
possibility of an operation that returns a Result "failing", but cannot
because of the ambiguity with task failure. Instead, you have to speak
of "the failing case" or "when the operation does not succeed" or other
circumlocutions.

Likewise, we use a "Failure" header in rustdoc to describe when
operations may fail the task, but it would often be helpful to separate
out a section describing the "Err-producing" case.

We have been steadily moving away from task failure and toward Result as
an error-handling mechanism, so we should optimize our terminology
accordingly: Result-producing functions should be easy to describe.

To update your code, rename any call to `fail!` to `panic!` instead.
Assuming you have not created your own macro named `panic!`, this
will work on UNIX based systems:

    grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g'

You can of course also do this by hand.

[breaking-change]
2014-10-29 11:43:07 -04:00
Brendan Zabarauskas
cd049591a2 Use an enum rather than a bool in token::Ident 2014-10-28 15:55:37 +11:00
Brendan Zabarauskas
d8b1fa0ae0 Use PascalCase for token variants 2014-10-28 15:55:37 +11:00
Patrick Reisert
9cc366311d Update ANTLR float suffix grammar
- Removes f128 from the grammar, which is no longer support in rustc
- The fragment modifier is added so it won't parse float suffix as a separate token
2014-09-29 12:52:35 +02:00
Eduard Burtescu
f1a8f53cf1 Fix fallout in tests from removing the use of Gc in ExpnInfo. 2014-09-18 14:36:18 +03:00
Alexis Beingessner
6444b5e82b adding proof of context-sensitivy of raw string literals 2014-07-27 02:13:19 -04:00
Corey Richardson
857bb60fe0 Don't run lexer tests by default 2014-07-21 19:26:20 -07:00
Corey Richardson
35c0bf3292 Add a ton of ignore-lexer-test 2014-07-21 18:38:40 -07:00
Corey Richardson
c41a7dfcc7 Shuffle around check-lexer conditions 2014-07-21 18:38:40 -07:00
Corey Richardson
dd3afb42d1 Break apart long lines in verify.rs 2014-07-21 18:37:17 -07:00
Corey Richardson
cbd6799110 lexer tests: makefile/configure 2014-07-21 18:37:17 -07:00
Corey Richardson
f8fd32ef9d Byte/raw binary literal fixes 2014-07-21 10:59:58 -07:00
Corey Richardson
9fc5cf902f Refine the tooling, handle comments 2014-07-21 10:59:58 -07:00
Corey Richardson
76a1552021 First pass at line comment correctness 2014-07-21 10:59:57 -07:00
Corey Richardson
1a1a9d5445 Add raw string literal ambiguity document 2014-07-21 10:59:57 -07:00
Corey Richardson
19e1f5cdb6 Lexer; subtly wrong; no makefile 2014-07-21 10:59:57 -07:00