]> git.lizzy.rs Git - rust.git/commit
add new enum ast::StrStyle as field to ast::lit_str
authorBenjamin Herr <ben@0x539.de>
Tue, 8 Oct 2013 00:49:10 +0000 (02:49 +0200)
committerBenjamin Herr <ben@0x539.de>
Tue, 8 Oct 2013 01:43:28 +0000 (03:43 +0200)
commit9d7b13004192b8eef1f68501035d05c85dee8c47
treec96d00a2f583c825b91836764219440f5b9cb7b6
parent97878725532c4d1dd1af07e88175462178d78cdb
add new enum ast::StrStyle as field to ast::lit_str

For the benefit of the pretty printer we want to keep track of how
string literals in the ast were originally represented in the source
code.

This commit changes parser functions so they don't extract strings from
the token stream without at least also returning what style of string
literal it was. This is stored in the resulting ast node for string
literals, obviously, for the package id in `extern mod = r"package id"`
view items, for the inline asm in `asm!()` invocations.

For `asm!()`'s other arguments or for `extern "Rust" fn()` items, I just
the style of string, because it seemed disproportionally cumbersome to
thread that information through the string processing that happens with
those string literals, given the limited advantage raw string literals
would provide in these positions.

The other syntax extensions don't seem to store passed string literals
in the ast, so they also discard the style of strings they parse.
25 files changed:
src/librustc/front/test.rs
src/librustc/metadata/creader.rs
src/librustc/metadata/encoder.rs
src/librustc/middle/check_const.rs
src/librustc/middle/const_eval.rs
src/librustc/middle/trans/consts.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/tvec.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/check/mod.rs
src/librustdoc/clean.rs
src/librustpkg/util.rs
src/libsyntax/ast.rs
src/libsyntax/attr.rs
src/libsyntax/ext/asm.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/bytes.rs
src/libsyntax/ext/deriving/generic.rs
src/libsyntax/ext/env.rs
src/libsyntax/ext/fmt.rs
src/libsyntax/ext/format.rs
src/libsyntax/ext/quote.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs