Exemple #1
0
func (r *Result) Emit(c token.Code, s string) error {
	if r.Verbose {
		r.t.Logf("%s %#v", c.Name(), s)
	}
	r.Tokens = append(r.Tokens, c, s)
	return nil
}
Exemple #2
0
// GetStyle returns Style for token.Code.
func (t *Definition) GetStyle(tc token.Code) Style {
	// FIXME: style cascading
	s := t.findStyle(tc)
	for s == nil {
		tc = tc.Parent()
		if tc == 0 {
			return Style{}
		}
		s = t.findStyle(tc)
	}
	return *s
}
Exemple #3
0
func (f *htmlFormatter) Emit(c token.Code, s string) (err error) {
	// FIXME: support lineNumbers option.
	_, err = fmt.Fprintf(f.writer, `<span class="%s">%s</span>`,
		c.ShortName(), html.EscapeString(s))
	return
}