ast: pattern matching