summary refs log tree commit diff
path: root/src/grammar
AgeCommit message (Collapse)AuthorLines
2015-03-15Strip all leading/trailing newlinesTamir Duberstein-1/+0
2015-03-01Bison grammar: parse higher ranked constraints in where clausesBrian Leibig-2/+12
2015-03-01Bison grammar: allow ExprQualifiedPath to have optional "as TRAIT_REF"Brian Leibig-13/+18
2015-03-01Bison grammar: support parsing default trait implsBrian Leibig-0/+8
2015-02-10Bison grammar: fix precedence with ranges followed by blocksBrian Leibig-1/+3
2015-02-10Bison grammar: refactor items to allow "extern crate" in stmtsBrian Leibig-8/+2
2015-02-10Bison grammar: add qualified path expressionsBrian Leibig-0/+31
2015-02-10Bison grammar: refactor index expressions to use ordinary expressions as ↵Brian Leibig-74/+12
indexes, remove index_expr and expr_norange
2015-02-08Auto merge of #22011 - fhahn:separate-parse-fail-tests, r=nikomatsakisbors-12/+20
This PR moves all `compile-fail` tests that fail at the parsing stage to a `parse-fail` directory, in order to use the tests in the `parse-fail` directory to test if the new LALR parser rejects the same files as the Rust parser. I also adjusted the `testparser.py` script to handle the tests in `parse-fail` differently. However during working on this, I discovered, that Rust's parser sometimes fails during parsing, but does not return a nonzero return code, e.g. compiling `/test/compile-fail/doc-before-semi.rs` with `-Z parse-only` prints an error message, but returns status code 0. Compiling the same file without `-Z parse-only`, the same error message is displayed, but error code 101 returned. I'll look into that over the next week.
2015-02-06Move compile-fail tests that are rejected by the parser to parse-failFlorian Hahn-12/+20
2015-02-06Rollup merge of #21954 - jbcrail:fix-misspelled-comments, r=steveklabnikManish Goregaokar-1/+1
The spelling corrections were made in both documentation comments and regular comments.
2015-02-05testparser has long linesBrian Anderson-0/+3
2015-02-05Clean up tidy scripts, coverage, performanceBrian Anderson-0/+2
This restructures tidy.py to walk the tree itself, and improves performance considerably by not loading entire files into buffers for licenseck. Splits build rules into 'tidy', 'tidy-basic', 'tidy-binaries', 'tidy-errors', 'tidy-features'.
2015-02-05cleanup: replace `as[_mut]_slice()` calls with deref coercionsJorge Aparicio-4/+4
2015-02-04Fix for misspelled comments.Joseph Crail-1/+1
The spelling corrections were made in both documentation comments and regular comments.
2015-01-27cleanup: s/`v.slice*()`/`&v[a..b]`/g + remove redundant `as_slice()` callsJorge Aparicio-11/+10
2015-01-24Auto merge of #21452 - bleibig:bison-grammar, r=nikomatsakisbors-0/+2613
This adds a new lexer/parser combo for the entire Rust language can be generated with with flex and bison, taken from my project at https://github.com/bleibig/rust-grammar. There is also a testing script that runs the generated parser with all *.rs files in the repository (except for tests in compile-fail or ones that marked as "ignore-test" or "ignore-lexer-test"). If you have flex and bison installed, you can run these tests using the new "check-grammar" make target. This does not depend on or interact with the existing testing code in the grammar, which only provides and tests a lexer specification. OS X users should take note that the version of bison that comes with the Xcode toolchain (2.3) is too old to work with this grammar, they need to download and install version 3.0 or later. The parser builds up an S-expression-based AST, which can be displayed by giving the "-v" argument to parser-lalr (normally it only gives output on error). It is only a rough approximation of what is parsed and doesn't capture every detail and nuance of the program. Hopefully this should be sufficient for issue #2234, or at least a good starting point.
2015-01-23regex: Remove in-tree versionAlex Crichton-12/+13
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-20Add a LALR grammar for Rust with testing supportBrian Leibig-0/+2613
2015-01-14Update grammar/verify.rs to work with recent masterFlorian Hahn-9/+9
2015-01-13Handle question marks in model lexer, closes #15879Florian Hahn-0/+6
2015-01-05Un-gate macro_rulesKeegan McAllister-1/+1
2015-01-05Modernize macro_rules! invocationsKeegan McAllister-2/+2
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-05Replace #[phase] with #[plugin] / #[macro_use] / #[no_link]Keegan McAllister-3/+2
2015-01-03Remove deprecated functionalityAlex Crichton-4/+3
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-03sed -i -s 's/\bmod,/self,/g' **/*.rsJorge Aparicio-1/+1
2014-12-30Update src/grammar/README.mdFlorian Hahn-2/+2
2014-12-30src/grammar/check.sh now prints test summaryFlorian Hahn-0/+17
2014-12-30Handle function calls to integers in model lexer correctlyFlorian Hahn-2/+58
closes #15877
2014-12-29rollup merge of #20310: fhahn/issue-15877-model-lexer-rangeAlex Crichton-1/+2
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-29Handle range in model lexer correctly #15877Florian Hahn-1/+2
2014-12-29Update grammer/verify.rs to work with recent masterFlorian Hahn-30/+32
2014-12-14Modify `regex::Captures::{at,name}` to return `Option`Eric Kidd-4/+4
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-11-20Adjust Antlr4 lexer to include suffixes.Huon Wilson-29/+15
This makes the formal lexical grammar (more closely) reflect the one implemented by the compiler.
2014-11-19Update src/grammar for language changes.Huon Wilson-20/+21
2014-11-19Switch to an independent enum for `Lit*` subtokens.Huon Wilson-24/+26
2014-11-17Fallout from deprecationAaron Turon-1/+1
This commit handles the fallout from deprecating `_with` and `_equiv` methods.
2014-10-30Use common variants for open and close delimitersBrendan Zabarauskas-6/+6
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-29Rename fail! to panic!Steve Klabnik-2/+2
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-28Use an enum rather than a bool in token::IdentBrendan Zabarauskas-2/+3
2014-10-28Use PascalCase for token variantsBrendan Zabarauskas-100/+102
2014-09-29Update ANTLR float suffix grammarPatrick Reisert-2/+1
- 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-18Fix fallout in tests from removing the use of Gc in ExpnInfo.Eduard Burtescu-1/+1
2014-07-27adding proof of context-sensitivy of raw string literalsAlexis Beingessner-6/+41
2014-07-21Don't run lexer tests by defaultCorey Richardson-2/+3
2014-07-21Add a ton of ignore-lexer-testCorey Richardson-1/+1
2014-07-21Shuffle around check-lexer conditionsCorey Richardson-13/+41
2014-07-21Break apart long lines in verify.rsCorey Richardson-1/+3
2014-07-21lexer tests: makefile/configureCorey Richardson-2/+25
2014-07-21Byte/raw binary literal fixesCorey Richardson-4/+24