Esempio n. 1
0
/**
 * Free registers of variables no longer referenced.
 */
func (p *VariablePool) Free(location parser.State16) {
	for _, v := range p._map {
		index := len(v.locations) - 1
		if index < 0 {
			continue
		}
		lastloc := v.locations[index].End()
		if lastloc < location.End() {
			// Last reference in routine was farther
			// than current scan location
			v.Deallocate()
		}
	}
}
Esempio n. 2
0
File: errors.go Progetto: hfern/min
func errorExpectingOneOf(tok parser.State16, src *string, expected []parser.Rule) error {
	expected_str := make([]string, 0, len(expected))
	for i, expect := range expected {
		expected_str[i] = parser.Rul3s[expect]
	}
	return newError(
		"Unexpected ",
		parser.Rul3s[tok.Rule],
		" at line ",
		line_no(src, tok.Begin()),
		". Expected one of (",
		strings.Join(expected_str, ","),
		").",
	)
}