package shell type Block struct { BaseToken } type DollarBlock struct { BaseToken } type BlockParameters struct{} type DollarBlockParameters struct { BlockParameters } func (p *BlockParameters) Enter(i *CharIterator) error { return i.Next() } func (p *DollarBlockParameters) SubParsers() []Parser { return []Parser{ &BaseParser{ parameters: &WordParameters{}, }, } } func (p *DollarBlockParameters) MakeToken() Token { return &DollarBlock{} } func (p *BlockParameters) SubParsers() []Parser { return []Parser{ &BaseParser{ parameters: &StatementParameters{}, }, } } func (p *BlockParameters) Supports(charsBefore []rune, r rune) bool { if r == '{' { return len(charsBefore) == 0 || countBackslashSuffixes(charsBefore)%2 == 0 } return false } func (p *BlockParameters) ShouldLeave(charsBefore []rune, r rune) bool { if r == '}' { return len(charsBefore) == 0 || countBackslashSuffixes(charsBefore)%2 == 0 } return false } func (p *BlockParameters) MakeToken() Token { return &Block{} }