expression.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package node
  2. type MaybeExpr interface { MaybeExpr() }
  3. func (impl Expr) MaybeExpr() {}
  4. func (impl Expr) ConstValue() {}
  5. type Expr struct {
  6. Node `part:"expr"`
  7. Call Call `part:"call"`
  8. Pipeline MaybePipeline `part_opt:"pipeline"`
  9. }
  10. type MaybeCall interface { MaybeCall() }
  11. func (impl Call) MaybeCall() {}
  12. type Call struct {
  13. Node `part:"call"`
  14. Func VariousTerm `part:"func.term"`
  15. Arg MaybeCall `part_opt:"arg.call"`
  16. }
  17. type VariousTerm struct {
  18. Node `part:"term"`
  19. Term Term `use:"first"`
  20. }
  21. type Term interface { Term() }
  22. type MaybePipeline interface { MaybePipeline() }
  23. func (impl Pipeline) MaybePipeline() {}
  24. type Pipeline struct {
  25. Node `part:"pipeline"`
  26. Operator PipeOperator `part:"pipe_op"`
  27. Func VariousTerm `part:"pipe_func.term"`
  28. Arg MaybeCall `part_opt:"pipe_arg.call"`
  29. Next MaybePipeline `part_opt:"pipeline"`
  30. }
  31. type PipeOperator struct {
  32. Node `part:"pipe_op"`
  33. }