Commit Graph

32 Commits

Author SHA1 Message Date
Carol Nichols
e70c8584d5 Revert "Panic if the grammar verifier sees a token it doesn't recognize"
This reverts commit 9c7d5ae57c.

This was wrong... the `continue` was to ignore the latter half of the
tokens file. Another mechanism will have to be used to keep the model
grammar's tokens in sync with the actual grammar's tokens :-/
2015-05-17 10:48:42 -04:00
Eduard Burtescu
6a59d1824d syntax: replace sess.span_diagnostic.cm with sess.codemap(). 2015-05-14 01:47:56 +03:00
Carol Nichols
9c7d5ae57c Panic if the grammar verifier sees a token it doesn't recognize
To prevent the reference grammar from getting out of sync with the real
grammar, panic if RustLexer.tokens contains an unknown token in a
similar way that verify.rs panics if it encounters an unknown binary
operation token.
2015-05-05 19:47:50 -04:00
Piotr Czarnecki
13bc8afa4b Model lexer: Fix remaining issues 2015-04-21 12:02:12 +02:00
Piotr Czarnecki
e5e343aeb7 Finished unicode support in the model lexer.
Completed XID_Start and XID_Continue rules
2015-04-19 23:05:32 +02:00
Florian Hahn
be437132b8 Add proper XID_Start and XID_Continue rules and use CharPos for span comparison, closes #15679 2015-04-19 23:02:10 +02:00
Jorge Aparicio
17bc7d8d5b cleanup: replace as[_mut]_slice() calls with deref coercions 2015-02-05 13:45:01 -05:00
Jorge Aparicio
bce81e2464 cleanup: s/v.slice*()/&v[a..b]/g + remove redundant as_slice() calls 2015-01-27 09:03:06 -05:00
Alex Crichton
6c29708bf9 regex: Remove in-tree version
The regex library was largely used for non-critical aspects of the compiler and
various external tooling. The library at this point is duplicated with its
out-of-tree counterpart and as such imposes a bit of a maintenance overhead as
well as compile time hit for the compiler itself.

The last major user of the regex library is the libtest library, using regexes
for filters when running tests. This removal means that the filtering has gone
back to substring matching rather than using regexes.
2015-01-23 21:04:10 -08:00
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
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
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
Eduard Burtescu
f1a8f53cf1 Fix fallout in tests from removing the use of Gc in ExpnInfo. 2014-09-18 14:36:18 +03: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
19e1f5cdb6 Lexer; subtly wrong; no makefile 2014-07-21 10:59:57 -07:00