Blueprint to support multiline (Go style raw) strings

Bug: 206961391
Test: m nothing and diff the ninja files
Change-Id: I9a7ffafe6a3992bf05180a032f4b277cbecb7dc6
This commit is contained in:
Usta Shrestha 2022-01-18 18:35:08 -05:00
parent 62823dcf01
commit 53bc344a81
2 changed files with 7 additions and 6 deletions

View file

@ -451,7 +451,7 @@ func (p *parser) parseValue() (value Expression) {
return p.parseVariable()
case '-', scanner.Int: // Integer might have '-' sign ahead ('+' is only treated as operator now)
return p.parseIntValue()
case scanner.String:
case scanner.String, scanner.RawString:
return p.parseStringValue()
case '[':
return p.parseListValue()
@ -509,7 +509,7 @@ func (p *parser) parseStringValue() *String {
LiteralPos: p.scanner.Position,
Value: str,
}
p.accept(scanner.String)
p.accept(p.tok)
return value
}

View file

@ -144,7 +144,8 @@ var validParseTestCases = []struct {
{`
foo {
stuff: ["asdf", "jkl;", "qwert",
"uiop", "bnm,"]
"uiop", ` + "`bnm,\n`" +
`]
}
`,
[]Definition{
@ -153,7 +154,7 @@ var validParseTestCases = []struct {
TypePos: mkpos(3, 2, 3),
Map: Map{
LBracePos: mkpos(7, 2, 7),
RBracePos: mkpos(67, 5, 3),
RBracePos: mkpos(68, 6, 3),
Properties: []*Property{
{
Name: "stuff",
@ -161,7 +162,7 @@ var validParseTestCases = []struct {
ColonPos: mkpos(17, 3, 9),
Value: &List{
LBracePos: mkpos(19, 3, 11),
RBracePos: mkpos(63, 4, 19),
RBracePos: mkpos(64, 5, 2),
Values: []Expression{
&String{
LiteralPos: mkpos(20, 3, 12),
@ -181,7 +182,7 @@ var validParseTestCases = []struct {
},
&String{
LiteralPos: mkpos(57, 4, 13),
Value: "bnm,",
Value: "bnm,\n",
},
},
},