Skip to content

Instantly share code, notes, and snippets.

@jirfag
Created July 1, 2018 12:26
Show Gist options
  • Select an option

  • Save jirfag/4e8e56c46f49fb626a61d69f93aeb854 to your computer and use it in GitHub Desktop.

Select an option

Save jirfag/4e8e56c46f49fb626a61d69f93aeb854 to your computer and use it in GitHub Desktop.
func (p *printer) addWhitespace(kind ctrlSymbol, text string) {
p.pending = append(p.pending, whitespace{p.lastTok, kind /*text*/})
switch kind {
case semi:
p.lastTok = _Semi
case newline:
p.lastTok = 0
// TODO(gri) do we need to handle /*-style comments containing newlines here?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment