| OLD | NEW |
| 1 package parser | 1 package parser |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "fmt" | 4 "fmt" |
| 5 "math" | 5 "math" |
| 6 "mojom/mojom_parser/lexer" | 6 "mojom/mojom_parser/lexer" |
| 7 "mojom/mojom_parser/mojom" | 7 "mojom/mojom_parser/mojom" |
| 8 "strconv" | 8 "strconv" |
| 9 ) | 9 ) |
| 10 | 10 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 if !p.OK() { | 288 if !p.OK() { |
| 289 return | 289 return |
| 290 } | 290 } |
| 291 if !p.match(lexer.Equals) { | 291 if !p.match(lexer.Equals) { |
| 292 return | 292 return |
| 293 } | 293 } |
| 294 | 294 |
| 295 var value mojom.ConcreteValue | 295 var value mojom.ConcreteValue |
| 296 if p.peekNextToken("Expecting to find an attribute value.").Kind
== lexer.Name { | 296 if p.peekNextToken("Expecting to find an attribute value.").Kind
== lexer.Name { |
| 297 text := p.readName() | 297 text := p.readName() |
| 298 // TODO(rudominer) Do not throw away the distinction bet
ween a name and a string literal. |
| 298 value = mojom.MakeStringLiteralValue(text) | 299 value = mojom.MakeStringLiteralValue(text) |
| 299 } else { | 300 } else { |
| 300 value = p.parseLiteral() | 301 value = p.parseLiteral() |
| 301 } | 302 } |
| 302 p.attachToken() | 303 p.attachToken() |
| 303 | 304 |
| 304 if !p.OK() { | 305 if !p.OK() { |
| 305 return | 306 return |
| 306 } | 307 } |
| 307 attributes.List = append(attributes.List, mojom.MojomAttribute{k
ey, value}) | 308 attributes.List = append(attributes.List, mojom.MojomAttribute{k
ey, value}) |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 case lexer.ErrorUnknown, lexer.ErrorIllegalChar, | 1606 case lexer.ErrorUnknown, lexer.ErrorIllegalChar, |
| 1606 lexer.ErrorUnterminatedStringLiteral, | 1607 lexer.ErrorUnterminatedStringLiteral, |
| 1607 lexer.ErrorUnterminatedComment: | 1608 lexer.ErrorUnterminatedComment: |
| 1608 message = fmt.Sprintf("%s at %s.", token, token.LongLocationStri
ng()) + message | 1609 message = fmt.Sprintf("%s at %s.", token, token.LongLocationStri
ng()) + message |
| 1609 default: | 1610 default: |
| 1610 message = fmt.Sprintf(unexpected, token.LongLocationString(), to
ken) + message | 1611 message = fmt.Sprintf(unexpected, token.LongLocationString(), to
ken) + message |
| 1611 } | 1612 } |
| 1612 p.err = &ParseError{ParserErrorCodeUnexpectedToken, message} | 1613 p.err = &ParseError{ParserErrorCodeUnexpectedToken, message} |
| 1613 return message | 1614 return message |
| 1614 } | 1615 } |
| OLD | NEW |