Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: mojom/mojom_parser/parser/parsing.go

Issue 1409343009: New Mojom Parser: Make some getters and add a TODO. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojom/mojom_parser/mojom/types.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « mojom/mojom_parser/mojom/types.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698