addIdentDef records the token definition for the instruction inst with the given id.
(id string, inst *Instruction, def *Token)
| 693 | // addIdentDef records the token definition for the instruction inst with the |
| 694 | // given id. |
| 695 | func (p *parser) addIdentDef(id string, inst *Instruction, def *Token) { |
| 696 | i, existing := p.idents[id] |
| 697 | if !existing { |
| 698 | i = &Identifier{} |
| 699 | p.idents[id] = i |
| 700 | } |
| 701 | if i.Definition == nil { |
| 702 | i.Definition = inst |
| 703 | } else { |
| 704 | p.err(def, "id '%v' redeclared", id) |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | // addIdentRef adds a identifier reference for the token ref. |
| 709 | func (p *parser) addIdentRef(ref *Token) { |