about summary refs log tree commit diff
path: root/src/grammar
AgeCommit message (Collapse)AuthorLines
2016-05-25antlr grammar verification script now compiles under latest nightlyMichael Rosenberg-106/+108
2015-12-24Fix whitespace alignmentMichael McConville-2/+2
Trivial, but my eye is twitching.
2015-11-26fix rustc-testAriel Ben-Yehuda-1/+4
2015-10-27Adjust src/grammar for the introduced <- opSimonas Kazlauskas-4/+14
2015-09-24Cleanup interfaces of Name, SyntaxContext and IdentVadim Petrochenkov-4/+4
Make sure Name, SyntaxContext and Ident are passed by value Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined
2015-09-03Use consistent terminology for byte string literalsVadim Petrochenkov-24/+24
Avoid confusion with binary integer literals and binary operator expressions in libsyntax
2015-08-08rustc: rename multiple imports in a listSean McArthur-0/+1
2015-06-08Replace usage of String::from_str with String:fromSimon Sapin-1/+1
2015-05-18Auto merge of #25337 - bleibig:update-grammar, r=nikomatsakisbors-23/+34
* Correctly lex CRLF in string literals * Update `extern CRATE as NAME` syntax * Allow leading `::` in view paths * Allow TySums in type ascriptions and impls * Allow macros to have visibility and attributes * Update syntax for qualified path types and expressions * Allow block expressions to be called () and indexed []
2015-05-17Revert "Panic if the grammar verifier sees a token it doesn't recognize"Carol Nichols-1/+1
This reverts commit 9c7d5ae57c27ebfc019c2c23283bb905d8c3b74f. 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-14syntax: replace sess.span_diagnostic.cm with sess.codemap().Eduard Burtescu-4/+2
2015-05-12Update the bison grammar for various language changesBrian Leibig-23/+34
2015-05-05Panic if the grammar verifier sees a token it doesn't recognizeCarol Nichols-1/+1
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-05Declare other tokens used later in the reference grammarCarol Nichols-3/+3
There were some tokens used in the grammar but not declared. Antlr doesn't really seem to care and happily uses them, but they appear in RustLexer.tokens in a potentially-unexpected order.
2015-05-05Correct a typo in a declared token in the reference grammarCarol Nichols-1/+1
This appears to not have too much of a detrimental effect, but it doesn't seem to be what is intended either. antlr doesn't mind that `PLUS` isn't declared in `tokens` and happily uses the `PLUS` that appears later in the file, but the generated RustLexer.tokens had PLUS at the end rather than where it was intended: NOT=10 TILDE=11 PLUT=12 MINUS=13 ... PLUS=56
2015-04-23Functional changes for associated constants. Cross-crate usage of associated ↵Sean Patrick Santos-2/+21
constants is not yet working.
2015-04-21Model lexer: Fix remaining issuesPiotr Czarnecki-104/+102
2015-04-19Finished unicode support in the model lexer.Piotr Czarnecki-18/+229
Completed XID_Start and XID_Continue rules
2015-04-19Add proper XID_Start and XID_Continue rules and use CharPos for span ↵Florian Hahn-7/+676
comparison, closes #15679
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