mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 02:33:33 +00:00
implement support for C-style string literal concatenation in td files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66663 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eda2ec35a1
commit
d7a50cf28c
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
class Y<string S> {
|
class Y<string S> {
|
||||||
string T = !strconcat(S, "foo");
|
string T = !strconcat(S, "foo");
|
||||||
|
|
||||||
|
// String values concatenate lexically, as in C.
|
||||||
|
string S = "foo" "bar";
|
||||||
}
|
}
|
||||||
|
|
||||||
def Z : Y<"fu">;
|
def Z : Y<"fu">;
|
||||||
|
@ -505,7 +505,7 @@ Init *TGParser::ParseIDValue(Record *CurRec,
|
|||||||
///
|
///
|
||||||
/// SimpleValue ::= IDValue
|
/// SimpleValue ::= IDValue
|
||||||
/// SimpleValue ::= INTVAL
|
/// SimpleValue ::= INTVAL
|
||||||
/// SimpleValue ::= STRVAL
|
/// SimpleValue ::= STRVAL+
|
||||||
/// SimpleValue ::= CODEFRAGMENT
|
/// SimpleValue ::= CODEFRAGMENT
|
||||||
/// SimpleValue ::= '?'
|
/// SimpleValue ::= '?'
|
||||||
/// SimpleValue ::= '{' ValueList '}'
|
/// SimpleValue ::= '{' ValueList '}'
|
||||||
@ -523,7 +523,19 @@ Init *TGParser::ParseSimpleValue(Record *CurRec) {
|
|||||||
switch (Lex.getCode()) {
|
switch (Lex.getCode()) {
|
||||||
default: TokError("Unknown token when parsing a value"); break;
|
default: TokError("Unknown token when parsing a value"); break;
|
||||||
case tgtok::IntVal: R = new IntInit(Lex.getCurIntVal()); Lex.Lex(); break;
|
case tgtok::IntVal: R = new IntInit(Lex.getCurIntVal()); Lex.Lex(); break;
|
||||||
case tgtok::StrVal: R = new StringInit(Lex.getCurStrVal()); Lex.Lex(); break;
|
case tgtok::StrVal: {
|
||||||
|
std::string Val = Lex.getCurStrVal();
|
||||||
|
Lex.Lex();
|
||||||
|
|
||||||
|
// Handle multiple consequtive concatenated strings.
|
||||||
|
while (Lex.getCode() == tgtok::StrVal) {
|
||||||
|
Val += Lex.getCurStrVal();
|
||||||
|
Lex.Lex();
|
||||||
|
}
|
||||||
|
|
||||||
|
R = new StringInit(Val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case tgtok::CodeFragment:
|
case tgtok::CodeFragment:
|
||||||
R = new CodeInit(Lex.getCurStrVal()); Lex.Lex(); break;
|
R = new CodeInit(Lex.getCurStrVal()); Lex.Lex(); break;
|
||||||
case tgtok::question: R = new UnsetInit(); Lex.Lex(); break;
|
case tgtok::question: R = new UnsetInit(); Lex.Lex(); break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user