func (p *Parser) registerReference(name string) (int16, bool) {
	r, present := p.arch.Register[name]
	if present {
		return r, true
	}
	if !p.arch.RegisterPrefix[name] {
		p.errorf("expected register; found %s", name)
		return 0, false
	}
	p.get('(')
	tok := p.get(scanner.Int)
	num, err := strconv.ParseInt(tok.String(), 10, 16)
	p.get(')')
	if err != nil {
		p.errorf("parsing register list: %s", err)
		return 0, false
	}
	r, ok := p.arch.RegisterNumber(name, int16(num))
	if !ok {
		p.errorf("illegal register %s(%d)", name, r)
		return 0, false
	}
	return r, true
}
// registerReference parses a register given either the name, R10, or a parenthesized form, SPR(10).
registerReference parses a register given either the name, R10, or a parenthesized form, SPR(10).
// registerReference parses a register given either the name R10 or a parenthesized form SPR ( 10 ) .
func (p *Parser) registerReference(name string) (int16, bool) {
	r, present := p.arch.Register[name]
	if present {
		return r, true
	}
	if !p.arch.RegisterPrefix[name] {
		p.errorf("expected register; found %s", name)
		return 0, false
	}
	p.get('(')
	tok := p.get(scanner.Int)
	num, err := strconv.ParseInt(tok.String(), 10, 16)
	p.get(')')
	if err != nil {
		p.errorf("parsing register list: %s", err)
		return 0, false
	}
	r, ok := p.arch.RegisterNumber(name, int16(num))
	if !ok {
		p.errorf("illegal register %s(%d)", name, r)
		return 0, false
	}
	return r, true
}
func ( p * Parser ) registerReference ( name string ) ( int16 , bool ) { r , present := p . arch . Register [ name ] if present { return r , true } if ! p . arch . RegisterPrefix [ name ] { p . errorf ( " " , name ) return 0 , false } p . get ( '(' ) tok := p . get ( scanner . Int ) num , err := strconv . ParseInt ( tok . String ( ) , 10 , 16 ) p . get ( ')' ) if err != nil { p . errorf ( " " , err ) return 0 , false } r , ok := p . arch . RegisterNumber ( name , int16 ( num ) ) if ! ok { p . errorf ( " " , name , r ) return 0 , false } return r , true }
registerReference parses a register given either the name, R10, or a parenthesized form, SPR(10).
registerReference parses a register given either the name R10 or a parenthesized form SPR ( 10 ) .