]> git.lizzy.rs Git - rust.git/commit
Lex binary and octal literals more eagerly.
authorHuon Wilson <dbau.pp+github@gmail.com>
Mon, 30 Mar 2015 13:27:13 +0000 (00:27 +1100)
committerHuon Wilson <dbau.pp+github@gmail.com>
Tue, 31 Mar 2015 01:16:42 +0000 (12:16 +1100)
commit606f50c46dd9a3852d36456d2015e1ccf832642e
tree1c992543bb91d02c72328b9021202a9fdcdba01a
parentf00264074fb8f7e3b603eb3469822813632a6d30
Lex binary and octal literals more eagerly.

Previously 0b12 was considered two tokens, 0b1 and 2, as 2 isn't a valid
base 2 digit. This patch changes that to collapse them into one (and
makes `0b12` etc. an error: 2 isn't a valid base 2 digit).

This may break some macro invocations of macros with `tt` (or syntax
extensions) that rely on adjacent digits being separate tokens and hence
is a

[breaking-change]

The fix is to separate the tokens, e.g. `0b12` -> `0b1 2`.

cc https://github.com/rust-lang/rfcs/pull/879
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/mod.rs
src/test/parse-fail/issue-1802-1.rs
src/test/parse-fail/lex-bad-binary-literal.rs [new file with mode: 0644]
src/test/parse-fail/lex-bad-octal-literal.rs [new file with mode: 0644]