示例#1
0
func handleIndent(tok common.Token, tok2 common.Token, tb *tokBuf) {
  handled := recordAnyIndent(lexer.Token2space(tok).Space(), tok, tb);
  if handled {
    tb.tokBuf.PushBack(tok2);
  } else {
    tb.curTok = tb.tokBuf.PushBack(tok2);
  }
}
示例#2
0
func handleSpace(tok common.Token, tb *tokBuf) bool {
  if tok.Type() == common.TOK_SPACE {
    spaceTok := lexer.Token2space(tok);
    if spaceTok.AtStartOfLine() {
      handlePossibleIndent(tok, tb);
    } else {
      tb.curTok = tb.tokBuf.PushBack(tok);
    }
    return true;
  }
  return false;
}