mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 00:38:14 +01:00
Remove token ID/Key distinction, part 11 of N
This commit is contained in:
1 parent
b24a929ec7
commit
eeebd58d7b
20 files changed
+1218
-1425
No files matched your search
@@ -110,19 +110,19 @@ func Render(w io.Writer, tm *t.Map, src []t.Token, comments []string) (err error
|
||||
if prevID != 0 && !prevIsTightRight && !tok.ID.IsTightLeft() {
|
||||
// The "(" token's tight-left-ness is context dependent. For
|
||||
// "f(x)", the "(" is tight-left. For "a * (b + c)", it is not.
|
||||
if tok.ID.Key() != t.KeyOpenParen || !isCloseIdentStrLiteral(tm, prevID) {
|
||||
if tok.ID != t.IDOpenParen || !isCloseIdentStrLiteral(tm, prevID) {
|
||||
buf = append(buf, ' ')
|
||||
}
|
||||
}
|
||||
|
||||
buf = append(buf, tm.ByToken(tok)...)
|
||||
buf = append(buf, tm.ByID(tok.ID)...)
|
||||
|
||||
if tok.ID.Key() == t.KeyOpenCurly {
|
||||
if tok.ID == t.IDOpenCurly {
|
||||
if indent == maxIndent {
|
||||
return errors.New("render: too many \"{\" tokens")
|
||||
}
|
||||
indent++
|
||||
} else if tok.ID.Key() == t.KeyCloseCurly {
|
||||
} else if tok.ID == t.IDCloseCurly {
|
||||
if indent == 0 {
|
||||
return errors.New("render: too many \"}\" tokens")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user