github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/optgen/lang/expr.og.go (about)

     1  // Code generated by langgen; DO NOT EDIT.
     2  
     3  package lang
     4  
     5  import (
     6  	"bytes"
     7  	"fmt"
     8  )
     9  
    10  type RootExpr struct {
    11  	Defines DefineSetExpr
    12  	Rules   RuleSetExpr
    13  	Src     *SourceLoc
    14  }
    15  
    16  func (e *RootExpr) Op() Operator {
    17  	return RootOp
    18  }
    19  
    20  func (e *RootExpr) ChildCount() int {
    21  	return 2
    22  }
    23  
    24  func (e *RootExpr) Child(nth int) Expr {
    25  	switch nth {
    26  	case 0:
    27  		return &e.Defines
    28  	case 1:
    29  		return &e.Rules
    30  	}
    31  	panic(fmt.Sprintf("child index %d is out of range", nth))
    32  }
    33  
    34  func (e *RootExpr) ChildName(nth int) string {
    35  	switch nth {
    36  	case 0:
    37  		return "Defines"
    38  	case 1:
    39  		return "Rules"
    40  	}
    41  	return ""
    42  }
    43  
    44  func (e *RootExpr) Value() interface{} {
    45  	return nil
    46  }
    47  
    48  func (e *RootExpr) Visit(visit VisitFunc) Expr {
    49  	children := visitChildren(e, visit)
    50  	if children != nil {
    51  		return &RootExpr{Defines: *children[0].(*DefineSetExpr), Rules: *children[1].(*RuleSetExpr), Src: e.Source()}
    52  	}
    53  	return e
    54  }
    55  
    56  func (e *RootExpr) Source() *SourceLoc {
    57  	return e.Src
    58  }
    59  
    60  func (e *RootExpr) InferredType() DataType {
    61  	return AnyDataType
    62  }
    63  
    64  func (e *RootExpr) String() string {
    65  	var buf bytes.Buffer
    66  	e.Format(&buf, 0)
    67  	return buf.String()
    68  }
    69  
    70  func (e *RootExpr) Format(buf *bytes.Buffer, level int) {
    71  	formatExpr(e, buf, level)
    72  }
    73  
    74  type DefineSetExpr []*DefineExpr
    75  
    76  func (e *DefineSetExpr) Op() Operator {
    77  	return DefineSetOp
    78  }
    79  
    80  func (e *DefineSetExpr) ChildCount() int {
    81  	return len(*e)
    82  }
    83  
    84  func (e *DefineSetExpr) Child(nth int) Expr {
    85  	return (*e)[nth]
    86  }
    87  
    88  func (e *DefineSetExpr) ChildName(nth int) string {
    89  	return ""
    90  }
    91  
    92  func (e *DefineSetExpr) Value() interface{} {
    93  	return nil
    94  }
    95  
    96  func (e *DefineSetExpr) Visit(visit VisitFunc) Expr {
    97  	children := visitChildren(e, visit)
    98  	if children != nil {
    99  		typedChildren := make(DefineSetExpr, len(children))
   100  		for i := 0; i < len(children); i++ {
   101  			typedChildren[i] = children[i].(*DefineExpr)
   102  		}
   103  		return &typedChildren
   104  	}
   105  	return e
   106  }
   107  
   108  func (e *DefineSetExpr) Source() *SourceLoc {
   109  	return nil
   110  }
   111  
   112  func (e *DefineSetExpr) InferredType() DataType {
   113  	return AnyDataType
   114  }
   115  
   116  func (e *DefineSetExpr) String() string {
   117  	var buf bytes.Buffer
   118  	e.Format(&buf, 0)
   119  	return buf.String()
   120  }
   121  
   122  func (e *DefineSetExpr) Format(buf *bytes.Buffer, level int) {
   123  	formatExpr(e, buf, level)
   124  }
   125  
   126  type RuleSetExpr []*RuleExpr
   127  
   128  func (e *RuleSetExpr) Op() Operator {
   129  	return RuleSetOp
   130  }
   131  
   132  func (e *RuleSetExpr) ChildCount() int {
   133  	return len(*e)
   134  }
   135  
   136  func (e *RuleSetExpr) Child(nth int) Expr {
   137  	return (*e)[nth]
   138  }
   139  
   140  func (e *RuleSetExpr) ChildName(nth int) string {
   141  	return ""
   142  }
   143  
   144  func (e *RuleSetExpr) Value() interface{} {
   145  	return nil
   146  }
   147  
   148  func (e *RuleSetExpr) Visit(visit VisitFunc) Expr {
   149  	children := visitChildren(e, visit)
   150  	if children != nil {
   151  		typedChildren := make(RuleSetExpr, len(children))
   152  		for i := 0; i < len(children); i++ {
   153  			typedChildren[i] = children[i].(*RuleExpr)
   154  		}
   155  		return &typedChildren
   156  	}
   157  	return e
   158  }
   159  
   160  func (e *RuleSetExpr) Source() *SourceLoc {
   161  	return nil
   162  }
   163  
   164  func (e *RuleSetExpr) InferredType() DataType {
   165  	return AnyDataType
   166  }
   167  
   168  func (e *RuleSetExpr) String() string {
   169  	var buf bytes.Buffer
   170  	e.Format(&buf, 0)
   171  	return buf.String()
   172  }
   173  
   174  func (e *RuleSetExpr) Format(buf *bytes.Buffer, level int) {
   175  	formatExpr(e, buf, level)
   176  }
   177  
   178  type DefineExpr struct {
   179  	Comments CommentsExpr
   180  	Tags     TagsExpr
   181  	Name     StringExpr
   182  	Fields   DefineFieldsExpr
   183  	Src      *SourceLoc
   184  }
   185  
   186  func (e *DefineExpr) Op() Operator {
   187  	return DefineOp
   188  }
   189  
   190  func (e *DefineExpr) ChildCount() int {
   191  	return 4
   192  }
   193  
   194  func (e *DefineExpr) Child(nth int) Expr {
   195  	switch nth {
   196  	case 0:
   197  		return &e.Comments
   198  	case 1:
   199  		return &e.Tags
   200  	case 2:
   201  		return &e.Name
   202  	case 3:
   203  		return &e.Fields
   204  	}
   205  	panic(fmt.Sprintf("child index %d is out of range", nth))
   206  }
   207  
   208  func (e *DefineExpr) ChildName(nth int) string {
   209  	switch nth {
   210  	case 0:
   211  		return "Comments"
   212  	case 1:
   213  		return "Tags"
   214  	case 2:
   215  		return "Name"
   216  	case 3:
   217  		return "Fields"
   218  	}
   219  	return ""
   220  }
   221  
   222  func (e *DefineExpr) Value() interface{} {
   223  	return nil
   224  }
   225  
   226  func (e *DefineExpr) Visit(visit VisitFunc) Expr {
   227  	children := visitChildren(e, visit)
   228  	if children != nil {
   229  		return &DefineExpr{Comments: *children[0].(*CommentsExpr), Tags: *children[1].(*TagsExpr), Name: *children[2].(*StringExpr), Fields: *children[3].(*DefineFieldsExpr), Src: e.Source()}
   230  	}
   231  	return e
   232  }
   233  
   234  func (e *DefineExpr) Source() *SourceLoc {
   235  	return e.Src
   236  }
   237  
   238  func (e *DefineExpr) InferredType() DataType {
   239  	return AnyDataType
   240  }
   241  
   242  func (e *DefineExpr) String() string {
   243  	var buf bytes.Buffer
   244  	e.Format(&buf, 0)
   245  	return buf.String()
   246  }
   247  
   248  func (e *DefineExpr) Format(buf *bytes.Buffer, level int) {
   249  	formatExpr(e, buf, level)
   250  }
   251  
   252  type CommentsExpr []CommentExpr
   253  
   254  func (e *CommentsExpr) Op() Operator {
   255  	return CommentsOp
   256  }
   257  
   258  func (e *CommentsExpr) ChildCount() int {
   259  	return len(*e)
   260  }
   261  
   262  func (e *CommentsExpr) Child(nth int) Expr {
   263  	return &(*e)[nth]
   264  }
   265  
   266  func (e *CommentsExpr) ChildName(nth int) string {
   267  	return ""
   268  }
   269  
   270  func (e *CommentsExpr) Value() interface{} {
   271  	return nil
   272  }
   273  
   274  func (e *CommentsExpr) Visit(visit VisitFunc) Expr {
   275  	children := visitChildren(e, visit)
   276  	if children != nil {
   277  		typedChildren := make(CommentsExpr, len(children))
   278  		for i := 0; i < len(children); i++ {
   279  			typedChildren[i] = *children[i].(*CommentExpr)
   280  		}
   281  		return &typedChildren
   282  	}
   283  	return e
   284  }
   285  
   286  func (e *CommentsExpr) Source() *SourceLoc {
   287  	return nil
   288  }
   289  
   290  func (e *CommentsExpr) InferredType() DataType {
   291  	return AnyDataType
   292  }
   293  
   294  func (e *CommentsExpr) String() string {
   295  	var buf bytes.Buffer
   296  	e.Format(&buf, 0)
   297  	return buf.String()
   298  }
   299  
   300  func (e *CommentsExpr) Format(buf *bytes.Buffer, level int) {
   301  	formatExpr(e, buf, level)
   302  }
   303  
   304  type CommentExpr string
   305  
   306  func (e *CommentExpr) Op() Operator {
   307  	return CommentOp
   308  }
   309  
   310  func (e *CommentExpr) ChildCount() int {
   311  	return 0
   312  }
   313  
   314  func (e *CommentExpr) Child(nth int) Expr {
   315  	panic(fmt.Sprintf("child index %d is out of range", nth))
   316  }
   317  
   318  func (e *CommentExpr) ChildName(nth int) string {
   319  	return ""
   320  }
   321  
   322  func (e *CommentExpr) Value() interface{} {
   323  	return string(*e)
   324  }
   325  
   326  func (e *CommentExpr) Visit(visit VisitFunc) Expr {
   327  	return e
   328  }
   329  
   330  func (e *CommentExpr) Source() *SourceLoc {
   331  	return nil
   332  }
   333  
   334  func (e *CommentExpr) InferredType() DataType {
   335  	return StringDataType
   336  }
   337  
   338  func (e *CommentExpr) String() string {
   339  	var buf bytes.Buffer
   340  	e.Format(&buf, 0)
   341  	return buf.String()
   342  }
   343  
   344  func (e *CommentExpr) Format(buf *bytes.Buffer, level int) {
   345  	formatExpr(e, buf, level)
   346  }
   347  
   348  type TagsExpr []TagExpr
   349  
   350  func (e *TagsExpr) Op() Operator {
   351  	return TagsOp
   352  }
   353  
   354  func (e *TagsExpr) ChildCount() int {
   355  	return len(*e)
   356  }
   357  
   358  func (e *TagsExpr) Child(nth int) Expr {
   359  	return &(*e)[nth]
   360  }
   361  
   362  func (e *TagsExpr) ChildName(nth int) string {
   363  	return ""
   364  }
   365  
   366  func (e *TagsExpr) Value() interface{} {
   367  	return nil
   368  }
   369  
   370  func (e *TagsExpr) Visit(visit VisitFunc) Expr {
   371  	children := visitChildren(e, visit)
   372  	if children != nil {
   373  		typedChildren := make(TagsExpr, len(children))
   374  		for i := 0; i < len(children); i++ {
   375  			typedChildren[i] = *children[i].(*TagExpr)
   376  		}
   377  		return &typedChildren
   378  	}
   379  	return e
   380  }
   381  
   382  func (e *TagsExpr) Source() *SourceLoc {
   383  	return nil
   384  }
   385  
   386  func (e *TagsExpr) InferredType() DataType {
   387  	return AnyDataType
   388  }
   389  
   390  func (e *TagsExpr) String() string {
   391  	var buf bytes.Buffer
   392  	e.Format(&buf, 0)
   393  	return buf.String()
   394  }
   395  
   396  func (e *TagsExpr) Format(buf *bytes.Buffer, level int) {
   397  	formatExpr(e, buf, level)
   398  }
   399  
   400  type TagExpr string
   401  
   402  func (e *TagExpr) Op() Operator {
   403  	return TagOp
   404  }
   405  
   406  func (e *TagExpr) ChildCount() int {
   407  	return 0
   408  }
   409  
   410  func (e *TagExpr) Child(nth int) Expr {
   411  	panic(fmt.Sprintf("child index %d is out of range", nth))
   412  }
   413  
   414  func (e *TagExpr) ChildName(nth int) string {
   415  	return ""
   416  }
   417  
   418  func (e *TagExpr) Value() interface{} {
   419  	return string(*e)
   420  }
   421  
   422  func (e *TagExpr) Visit(visit VisitFunc) Expr {
   423  	return e
   424  }
   425  
   426  func (e *TagExpr) Source() *SourceLoc {
   427  	return nil
   428  }
   429  
   430  func (e *TagExpr) InferredType() DataType {
   431  	return StringDataType
   432  }
   433  
   434  func (e *TagExpr) String() string {
   435  	var buf bytes.Buffer
   436  	e.Format(&buf, 0)
   437  	return buf.String()
   438  }
   439  
   440  func (e *TagExpr) Format(buf *bytes.Buffer, level int) {
   441  	formatExpr(e, buf, level)
   442  }
   443  
   444  type DefineFieldsExpr []*DefineFieldExpr
   445  
   446  func (e *DefineFieldsExpr) Op() Operator {
   447  	return DefineFieldsOp
   448  }
   449  
   450  func (e *DefineFieldsExpr) ChildCount() int {
   451  	return len(*e)
   452  }
   453  
   454  func (e *DefineFieldsExpr) Child(nth int) Expr {
   455  	return (*e)[nth]
   456  }
   457  
   458  func (e *DefineFieldsExpr) ChildName(nth int) string {
   459  	return ""
   460  }
   461  
   462  func (e *DefineFieldsExpr) Value() interface{} {
   463  	return nil
   464  }
   465  
   466  func (e *DefineFieldsExpr) Visit(visit VisitFunc) Expr {
   467  	children := visitChildren(e, visit)
   468  	if children != nil {
   469  		typedChildren := make(DefineFieldsExpr, len(children))
   470  		for i := 0; i < len(children); i++ {
   471  			typedChildren[i] = children[i].(*DefineFieldExpr)
   472  		}
   473  		return &typedChildren
   474  	}
   475  	return e
   476  }
   477  
   478  func (e *DefineFieldsExpr) Source() *SourceLoc {
   479  	return nil
   480  }
   481  
   482  func (e *DefineFieldsExpr) InferredType() DataType {
   483  	return AnyDataType
   484  }
   485  
   486  func (e *DefineFieldsExpr) String() string {
   487  	var buf bytes.Buffer
   488  	e.Format(&buf, 0)
   489  	return buf.String()
   490  }
   491  
   492  func (e *DefineFieldsExpr) Format(buf *bytes.Buffer, level int) {
   493  	formatExpr(e, buf, level)
   494  }
   495  
   496  type DefineFieldExpr struct {
   497  	Comments CommentsExpr
   498  	Name     StringExpr
   499  	Type     StringExpr
   500  	Src      *SourceLoc
   501  }
   502  
   503  func (e *DefineFieldExpr) Op() Operator {
   504  	return DefineFieldOp
   505  }
   506  
   507  func (e *DefineFieldExpr) ChildCount() int {
   508  	return 3
   509  }
   510  
   511  func (e *DefineFieldExpr) Child(nth int) Expr {
   512  	switch nth {
   513  	case 0:
   514  		return &e.Comments
   515  	case 1:
   516  		return &e.Name
   517  	case 2:
   518  		return &e.Type
   519  	}
   520  	panic(fmt.Sprintf("child index %d is out of range", nth))
   521  }
   522  
   523  func (e *DefineFieldExpr) ChildName(nth int) string {
   524  	switch nth {
   525  	case 0:
   526  		return "Comments"
   527  	case 1:
   528  		return "Name"
   529  	case 2:
   530  		return "Type"
   531  	}
   532  	return ""
   533  }
   534  
   535  func (e *DefineFieldExpr) Value() interface{} {
   536  	return nil
   537  }
   538  
   539  func (e *DefineFieldExpr) Visit(visit VisitFunc) Expr {
   540  	children := visitChildren(e, visit)
   541  	if children != nil {
   542  		return &DefineFieldExpr{Comments: *children[0].(*CommentsExpr), Name: *children[1].(*StringExpr), Type: *children[2].(*StringExpr), Src: e.Source()}
   543  	}
   544  	return e
   545  }
   546  
   547  func (e *DefineFieldExpr) Source() *SourceLoc {
   548  	return e.Src
   549  }
   550  
   551  func (e *DefineFieldExpr) InferredType() DataType {
   552  	return AnyDataType
   553  }
   554  
   555  func (e *DefineFieldExpr) String() string {
   556  	var buf bytes.Buffer
   557  	e.Format(&buf, 0)
   558  	return buf.String()
   559  }
   560  
   561  func (e *DefineFieldExpr) Format(buf *bytes.Buffer, level int) {
   562  	formatExpr(e, buf, level)
   563  }
   564  
   565  type RuleExpr struct {
   566  	Comments CommentsExpr
   567  	Name     StringExpr
   568  	Tags     TagsExpr
   569  	Match    *FuncExpr
   570  	Replace  Expr
   571  	Src      *SourceLoc
   572  }
   573  
   574  func (e *RuleExpr) Op() Operator {
   575  	return RuleOp
   576  }
   577  
   578  func (e *RuleExpr) ChildCount() int {
   579  	return 5
   580  }
   581  
   582  func (e *RuleExpr) Child(nth int) Expr {
   583  	switch nth {
   584  	case 0:
   585  		return &e.Comments
   586  	case 1:
   587  		return &e.Name
   588  	case 2:
   589  		return &e.Tags
   590  	case 3:
   591  		return e.Match
   592  	case 4:
   593  		return e.Replace
   594  	}
   595  	panic(fmt.Sprintf("child index %d is out of range", nth))
   596  }
   597  
   598  func (e *RuleExpr) ChildName(nth int) string {
   599  	switch nth {
   600  	case 0:
   601  		return "Comments"
   602  	case 1:
   603  		return "Name"
   604  	case 2:
   605  		return "Tags"
   606  	case 3:
   607  		return "Match"
   608  	case 4:
   609  		return "Replace"
   610  	}
   611  	return ""
   612  }
   613  
   614  func (e *RuleExpr) Value() interface{} {
   615  	return nil
   616  }
   617  
   618  func (e *RuleExpr) Visit(visit VisitFunc) Expr {
   619  	children := visitChildren(e, visit)
   620  	if children != nil {
   621  		return &RuleExpr{Comments: *children[0].(*CommentsExpr), Name: *children[1].(*StringExpr), Tags: *children[2].(*TagsExpr), Match: children[3].(*FuncExpr), Replace: children[4], Src: e.Source()}
   622  	}
   623  	return e
   624  }
   625  
   626  func (e *RuleExpr) Source() *SourceLoc {
   627  	return e.Src
   628  }
   629  
   630  func (e *RuleExpr) InferredType() DataType {
   631  	return AnyDataType
   632  }
   633  
   634  func (e *RuleExpr) String() string {
   635  	var buf bytes.Buffer
   636  	e.Format(&buf, 0)
   637  	return buf.String()
   638  }
   639  
   640  func (e *RuleExpr) Format(buf *bytes.Buffer, level int) {
   641  	formatExpr(e, buf, level)
   642  }
   643  
   644  type FuncExpr struct {
   645  	Name Expr
   646  	Args SliceExpr
   647  	Src  *SourceLoc
   648  	Typ  DataType
   649  }
   650  
   651  func (e *FuncExpr) Op() Operator {
   652  	return FuncOp
   653  }
   654  
   655  func (e *FuncExpr) ChildCount() int {
   656  	return 2
   657  }
   658  
   659  func (e *FuncExpr) Child(nth int) Expr {
   660  	switch nth {
   661  	case 0:
   662  		return e.Name
   663  	case 1:
   664  		return &e.Args
   665  	}
   666  	panic(fmt.Sprintf("child index %d is out of range", nth))
   667  }
   668  
   669  func (e *FuncExpr) ChildName(nth int) string {
   670  	switch nth {
   671  	case 0:
   672  		return "Name"
   673  	case 1:
   674  		return "Args"
   675  	}
   676  	return ""
   677  }
   678  
   679  func (e *FuncExpr) Value() interface{} {
   680  	return nil
   681  }
   682  
   683  func (e *FuncExpr) Visit(visit VisitFunc) Expr {
   684  	children := visitChildren(e, visit)
   685  	if children != nil {
   686  		return &FuncExpr{Name: children[0], Args: *children[1].(*SliceExpr), Src: e.Source()}
   687  	}
   688  	return e
   689  }
   690  
   691  func (e *FuncExpr) Source() *SourceLoc {
   692  	return e.Src
   693  }
   694  
   695  func (e *FuncExpr) InferredType() DataType {
   696  	return e.Typ
   697  }
   698  
   699  func (e *FuncExpr) String() string {
   700  	var buf bytes.Buffer
   701  	e.Format(&buf, 0)
   702  	return buf.String()
   703  }
   704  
   705  func (e *FuncExpr) Format(buf *bytes.Buffer, level int) {
   706  	formatExpr(e, buf, level)
   707  }
   708  
   709  type NamesExpr []NameExpr
   710  
   711  func (e *NamesExpr) Op() Operator {
   712  	return NamesOp
   713  }
   714  
   715  func (e *NamesExpr) ChildCount() int {
   716  	return len(*e)
   717  }
   718  
   719  func (e *NamesExpr) Child(nth int) Expr {
   720  	return &(*e)[nth]
   721  }
   722  
   723  func (e *NamesExpr) ChildName(nth int) string {
   724  	return ""
   725  }
   726  
   727  func (e *NamesExpr) Value() interface{} {
   728  	return nil
   729  }
   730  
   731  func (e *NamesExpr) Visit(visit VisitFunc) Expr {
   732  	children := visitChildren(e, visit)
   733  	if children != nil {
   734  		typedChildren := make(NamesExpr, len(children))
   735  		for i := 0; i < len(children); i++ {
   736  			typedChildren[i] = *children[i].(*NameExpr)
   737  		}
   738  		return &typedChildren
   739  	}
   740  	return e
   741  }
   742  
   743  func (e *NamesExpr) Source() *SourceLoc {
   744  	return nil
   745  }
   746  
   747  func (e *NamesExpr) InferredType() DataType {
   748  	return AnyDataType
   749  }
   750  
   751  func (e *NamesExpr) String() string {
   752  	var buf bytes.Buffer
   753  	e.Format(&buf, 0)
   754  	return buf.String()
   755  }
   756  
   757  func (e *NamesExpr) Format(buf *bytes.Buffer, level int) {
   758  	formatExpr(e, buf, level)
   759  }
   760  
   761  type NameExpr string
   762  
   763  func (e *NameExpr) Op() Operator {
   764  	return NameOp
   765  }
   766  
   767  func (e *NameExpr) ChildCount() int {
   768  	return 0
   769  }
   770  
   771  func (e *NameExpr) Child(nth int) Expr {
   772  	panic(fmt.Sprintf("child index %d is out of range", nth))
   773  }
   774  
   775  func (e *NameExpr) ChildName(nth int) string {
   776  	return ""
   777  }
   778  
   779  func (e *NameExpr) Value() interface{} {
   780  	return string(*e)
   781  }
   782  
   783  func (e *NameExpr) Visit(visit VisitFunc) Expr {
   784  	return e
   785  }
   786  
   787  func (e *NameExpr) Source() *SourceLoc {
   788  	return nil
   789  }
   790  
   791  func (e *NameExpr) InferredType() DataType {
   792  	return StringDataType
   793  }
   794  
   795  func (e *NameExpr) String() string {
   796  	var buf bytes.Buffer
   797  	e.Format(&buf, 0)
   798  	return buf.String()
   799  }
   800  
   801  func (e *NameExpr) Format(buf *bytes.Buffer, level int) {
   802  	formatExpr(e, buf, level)
   803  }
   804  
   805  type AndExpr struct {
   806  	Left  Expr
   807  	Right Expr
   808  	Src   *SourceLoc
   809  	Typ   DataType
   810  }
   811  
   812  func (e *AndExpr) Op() Operator {
   813  	return AndOp
   814  }
   815  
   816  func (e *AndExpr) ChildCount() int {
   817  	return 2
   818  }
   819  
   820  func (e *AndExpr) Child(nth int) Expr {
   821  	switch nth {
   822  	case 0:
   823  		return e.Left
   824  	case 1:
   825  		return e.Right
   826  	}
   827  	panic(fmt.Sprintf("child index %d is out of range", nth))
   828  }
   829  
   830  func (e *AndExpr) ChildName(nth int) string {
   831  	switch nth {
   832  	case 0:
   833  		return "Left"
   834  	case 1:
   835  		return "Right"
   836  	}
   837  	return ""
   838  }
   839  
   840  func (e *AndExpr) Value() interface{} {
   841  	return nil
   842  }
   843  
   844  func (e *AndExpr) Visit(visit VisitFunc) Expr {
   845  	children := visitChildren(e, visit)
   846  	if children != nil {
   847  		return &AndExpr{Left: children[0], Right: children[1], Src: e.Source()}
   848  	}
   849  	return e
   850  }
   851  
   852  func (e *AndExpr) Source() *SourceLoc {
   853  	return e.Src
   854  }
   855  
   856  func (e *AndExpr) InferredType() DataType {
   857  	return e.Typ
   858  }
   859  
   860  func (e *AndExpr) String() string {
   861  	var buf bytes.Buffer
   862  	e.Format(&buf, 0)
   863  	return buf.String()
   864  }
   865  
   866  func (e *AndExpr) Format(buf *bytes.Buffer, level int) {
   867  	formatExpr(e, buf, level)
   868  }
   869  
   870  type NotExpr struct {
   871  	Input Expr
   872  	Src   *SourceLoc
   873  	Typ   DataType
   874  }
   875  
   876  func (e *NotExpr) Op() Operator {
   877  	return NotOp
   878  }
   879  
   880  func (e *NotExpr) ChildCount() int {
   881  	return 1
   882  }
   883  
   884  func (e *NotExpr) Child(nth int) Expr {
   885  	switch nth {
   886  	case 0:
   887  		return e.Input
   888  	}
   889  	panic(fmt.Sprintf("child index %d is out of range", nth))
   890  }
   891  
   892  func (e *NotExpr) ChildName(nth int) string {
   893  	switch nth {
   894  	case 0:
   895  		return "Input"
   896  	}
   897  	return ""
   898  }
   899  
   900  func (e *NotExpr) Value() interface{} {
   901  	return nil
   902  }
   903  
   904  func (e *NotExpr) Visit(visit VisitFunc) Expr {
   905  	children := visitChildren(e, visit)
   906  	if children != nil {
   907  		return &NotExpr{Input: children[0], Src: e.Source()}
   908  	}
   909  	return e
   910  }
   911  
   912  func (e *NotExpr) Source() *SourceLoc {
   913  	return e.Src
   914  }
   915  
   916  func (e *NotExpr) InferredType() DataType {
   917  	return e.Typ
   918  }
   919  
   920  func (e *NotExpr) String() string {
   921  	var buf bytes.Buffer
   922  	e.Format(&buf, 0)
   923  	return buf.String()
   924  }
   925  
   926  func (e *NotExpr) Format(buf *bytes.Buffer, level int) {
   927  	formatExpr(e, buf, level)
   928  }
   929  
   930  type ListExpr struct {
   931  	Items SliceExpr
   932  	Src   *SourceLoc
   933  	Typ   DataType
   934  }
   935  
   936  func (e *ListExpr) Op() Operator {
   937  	return ListOp
   938  }
   939  
   940  func (e *ListExpr) ChildCount() int {
   941  	return 1
   942  }
   943  
   944  func (e *ListExpr) Child(nth int) Expr {
   945  	switch nth {
   946  	case 0:
   947  		return &e.Items
   948  	}
   949  	panic(fmt.Sprintf("child index %d is out of range", nth))
   950  }
   951  
   952  func (e *ListExpr) ChildName(nth int) string {
   953  	switch nth {
   954  	case 0:
   955  		return "Items"
   956  	}
   957  	return ""
   958  }
   959  
   960  func (e *ListExpr) Value() interface{} {
   961  	return nil
   962  }
   963  
   964  func (e *ListExpr) Visit(visit VisitFunc) Expr {
   965  	children := visitChildren(e, visit)
   966  	if children != nil {
   967  		return &ListExpr{Items: *children[0].(*SliceExpr), Src: e.Source()}
   968  	}
   969  	return e
   970  }
   971  
   972  func (e *ListExpr) Source() *SourceLoc {
   973  	return e.Src
   974  }
   975  
   976  func (e *ListExpr) InferredType() DataType {
   977  	return e.Typ
   978  }
   979  
   980  func (e *ListExpr) String() string {
   981  	var buf bytes.Buffer
   982  	e.Format(&buf, 0)
   983  	return buf.String()
   984  }
   985  
   986  func (e *ListExpr) Format(buf *bytes.Buffer, level int) {
   987  	formatExpr(e, buf, level)
   988  }
   989  
   990  type ListAnyExpr struct {
   991  	Src *SourceLoc
   992  }
   993  
   994  func (e *ListAnyExpr) Op() Operator {
   995  	return ListAnyOp
   996  }
   997  
   998  func (e *ListAnyExpr) ChildCount() int {
   999  	return 0
  1000  }
  1001  
  1002  func (e *ListAnyExpr) Child(nth int) Expr {
  1003  	panic(fmt.Sprintf("child index %d is out of range", nth))
  1004  }
  1005  
  1006  func (e *ListAnyExpr) ChildName(nth int) string {
  1007  	return ""
  1008  }
  1009  
  1010  func (e *ListAnyExpr) Value() interface{} {
  1011  	return nil
  1012  }
  1013  
  1014  func (e *ListAnyExpr) Visit(visit VisitFunc) Expr {
  1015  	return e
  1016  }
  1017  
  1018  func (e *ListAnyExpr) Source() *SourceLoc {
  1019  	return e.Src
  1020  }
  1021  
  1022  func (e *ListAnyExpr) InferredType() DataType {
  1023  	return AnyDataType
  1024  }
  1025  
  1026  func (e *ListAnyExpr) String() string {
  1027  	var buf bytes.Buffer
  1028  	e.Format(&buf, 0)
  1029  	return buf.String()
  1030  }
  1031  
  1032  func (e *ListAnyExpr) Format(buf *bytes.Buffer, level int) {
  1033  	formatExpr(e, buf, level)
  1034  }
  1035  
  1036  type BindExpr struct {
  1037  	Label  StringExpr
  1038  	Target Expr
  1039  	Src    *SourceLoc
  1040  	Typ    DataType
  1041  }
  1042  
  1043  func (e *BindExpr) Op() Operator {
  1044  	return BindOp
  1045  }
  1046  
  1047  func (e *BindExpr) ChildCount() int {
  1048  	return 2
  1049  }
  1050  
  1051  func (e *BindExpr) Child(nth int) Expr {
  1052  	switch nth {
  1053  	case 0:
  1054  		return &e.Label
  1055  	case 1:
  1056  		return e.Target
  1057  	}
  1058  	panic(fmt.Sprintf("child index %d is out of range", nth))
  1059  }
  1060  
  1061  func (e *BindExpr) ChildName(nth int) string {
  1062  	switch nth {
  1063  	case 0:
  1064  		return "Label"
  1065  	case 1:
  1066  		return "Target"
  1067  	}
  1068  	return ""
  1069  }
  1070  
  1071  func (e *BindExpr) Value() interface{} {
  1072  	return nil
  1073  }
  1074  
  1075  func (e *BindExpr) Visit(visit VisitFunc) Expr {
  1076  	children := visitChildren(e, visit)
  1077  	if children != nil {
  1078  		return &BindExpr{Label: *children[0].(*StringExpr), Target: children[1], Src: e.Source()}
  1079  	}
  1080  	return e
  1081  }
  1082  
  1083  func (e *BindExpr) Source() *SourceLoc {
  1084  	return e.Src
  1085  }
  1086  
  1087  func (e *BindExpr) InferredType() DataType {
  1088  	return e.Typ
  1089  }
  1090  
  1091  func (e *BindExpr) String() string {
  1092  	var buf bytes.Buffer
  1093  	e.Format(&buf, 0)
  1094  	return buf.String()
  1095  }
  1096  
  1097  func (e *BindExpr) Format(buf *bytes.Buffer, level int) {
  1098  	formatExpr(e, buf, level)
  1099  }
  1100  
  1101  type RefExpr struct {
  1102  	Label StringExpr
  1103  	Src   *SourceLoc
  1104  	Typ   DataType
  1105  }
  1106  
  1107  func (e *RefExpr) Op() Operator {
  1108  	return RefOp
  1109  }
  1110  
  1111  func (e *RefExpr) ChildCount() int {
  1112  	return 1
  1113  }
  1114  
  1115  func (e *RefExpr) Child(nth int) Expr {
  1116  	switch nth {
  1117  	case 0:
  1118  		return &e.Label
  1119  	}
  1120  	panic(fmt.Sprintf("child index %d is out of range", nth))
  1121  }
  1122  
  1123  func (e *RefExpr) ChildName(nth int) string {
  1124  	switch nth {
  1125  	case 0:
  1126  		return "Label"
  1127  	}
  1128  	return ""
  1129  }
  1130  
  1131  func (e *RefExpr) Value() interface{} {
  1132  	return nil
  1133  }
  1134  
  1135  func (e *RefExpr) Visit(visit VisitFunc) Expr {
  1136  	children := visitChildren(e, visit)
  1137  	if children != nil {
  1138  		return &RefExpr{Label: *children[0].(*StringExpr), Src: e.Source()}
  1139  	}
  1140  	return e
  1141  }
  1142  
  1143  func (e *RefExpr) Source() *SourceLoc {
  1144  	return e.Src
  1145  }
  1146  
  1147  func (e *RefExpr) InferredType() DataType {
  1148  	return e.Typ
  1149  }
  1150  
  1151  func (e *RefExpr) String() string {
  1152  	var buf bytes.Buffer
  1153  	e.Format(&buf, 0)
  1154  	return buf.String()
  1155  }
  1156  
  1157  func (e *RefExpr) Format(buf *bytes.Buffer, level int) {
  1158  	formatExpr(e, buf, level)
  1159  }
  1160  
  1161  type AnyExpr struct {
  1162  	Src *SourceLoc
  1163  	Typ DataType
  1164  }
  1165  
  1166  func (e *AnyExpr) Op() Operator {
  1167  	return AnyOp
  1168  }
  1169  
  1170  func (e *AnyExpr) ChildCount() int {
  1171  	return 0
  1172  }
  1173  
  1174  func (e *AnyExpr) Child(nth int) Expr {
  1175  	panic(fmt.Sprintf("child index %d is out of range", nth))
  1176  }
  1177  
  1178  func (e *AnyExpr) ChildName(nth int) string {
  1179  	return ""
  1180  }
  1181  
  1182  func (e *AnyExpr) Value() interface{} {
  1183  	return nil
  1184  }
  1185  
  1186  func (e *AnyExpr) Visit(visit VisitFunc) Expr {
  1187  	return e
  1188  }
  1189  
  1190  func (e *AnyExpr) Source() *SourceLoc {
  1191  	return e.Src
  1192  }
  1193  
  1194  func (e *AnyExpr) InferredType() DataType {
  1195  	return e.Typ
  1196  }
  1197  
  1198  func (e *AnyExpr) String() string {
  1199  	var buf bytes.Buffer
  1200  	e.Format(&buf, 0)
  1201  	return buf.String()
  1202  }
  1203  
  1204  func (e *AnyExpr) Format(buf *bytes.Buffer, level int) {
  1205  	formatExpr(e, buf, level)
  1206  }
  1207  
  1208  type SliceExpr []Expr
  1209  
  1210  func (e *SliceExpr) Op() Operator {
  1211  	return SliceOp
  1212  }
  1213  
  1214  func (e *SliceExpr) ChildCount() int {
  1215  	return len(*e)
  1216  }
  1217  
  1218  func (e *SliceExpr) Child(nth int) Expr {
  1219  	return (*e)[nth]
  1220  }
  1221  
  1222  func (e *SliceExpr) ChildName(nth int) string {
  1223  	return ""
  1224  }
  1225  
  1226  func (e *SliceExpr) Value() interface{} {
  1227  	return nil
  1228  }
  1229  
  1230  func (e *SliceExpr) Visit(visit VisitFunc) Expr {
  1231  	children := visitChildren(e, visit)
  1232  	if children != nil {
  1233  		typedChildren := SliceExpr(children)
  1234  		return &typedChildren
  1235  	}
  1236  	return e
  1237  }
  1238  
  1239  func (e *SliceExpr) Source() *SourceLoc {
  1240  	return nil
  1241  }
  1242  
  1243  func (e *SliceExpr) InferredType() DataType {
  1244  	return AnyDataType
  1245  }
  1246  
  1247  func (e *SliceExpr) String() string {
  1248  	var buf bytes.Buffer
  1249  	e.Format(&buf, 0)
  1250  	return buf.String()
  1251  }
  1252  
  1253  func (e *SliceExpr) Format(buf *bytes.Buffer, level int) {
  1254  	formatExpr(e, buf, level)
  1255  }
  1256  
  1257  type StringExpr string
  1258  
  1259  func (e *StringExpr) Op() Operator {
  1260  	return StringOp
  1261  }
  1262  
  1263  func (e *StringExpr) ChildCount() int {
  1264  	return 0
  1265  }
  1266  
  1267  func (e *StringExpr) Child(nth int) Expr {
  1268  	panic(fmt.Sprintf("child index %d is out of range", nth))
  1269  }
  1270  
  1271  func (e *StringExpr) ChildName(nth int) string {
  1272  	return ""
  1273  }
  1274  
  1275  func (e *StringExpr) Value() interface{} {
  1276  	return string(*e)
  1277  }
  1278  
  1279  func (e *StringExpr) Visit(visit VisitFunc) Expr {
  1280  	return e
  1281  }
  1282  
  1283  func (e *StringExpr) Source() *SourceLoc {
  1284  	return nil
  1285  }
  1286  
  1287  func (e *StringExpr) InferredType() DataType {
  1288  	return StringDataType
  1289  }
  1290  
  1291  func (e *StringExpr) String() string {
  1292  	var buf bytes.Buffer
  1293  	e.Format(&buf, 0)
  1294  	return buf.String()
  1295  }
  1296  
  1297  func (e *StringExpr) Format(buf *bytes.Buffer, level int) {
  1298  	formatExpr(e, buf, level)
  1299  }
  1300  
  1301  type NumberExpr int64
  1302  
  1303  func (e *NumberExpr) Op() Operator {
  1304  	return NumberOp
  1305  }
  1306  
  1307  func (e *NumberExpr) ChildCount() int {
  1308  	return 0
  1309  }
  1310  
  1311  func (e *NumberExpr) Child(nth int) Expr {
  1312  	panic(fmt.Sprintf("child index %d is out of range", nth))
  1313  }
  1314  
  1315  func (e *NumberExpr) ChildName(nth int) string {
  1316  	return ""
  1317  }
  1318  
  1319  func (e *NumberExpr) Value() interface{} {
  1320  	return int64(*e)
  1321  }
  1322  
  1323  func (e *NumberExpr) Visit(visit VisitFunc) Expr {
  1324  	return e
  1325  }
  1326  
  1327  func (e *NumberExpr) Source() *SourceLoc {
  1328  	return nil
  1329  }
  1330  
  1331  func (e *NumberExpr) InferredType() DataType {
  1332  	return Int64DataType
  1333  }
  1334  
  1335  func (e *NumberExpr) String() string {
  1336  	var buf bytes.Buffer
  1337  	e.Format(&buf, 0)
  1338  	return buf.String()
  1339  }
  1340  
  1341  func (e *NumberExpr) Format(buf *bytes.Buffer, level int) {
  1342  	formatExpr(e, buf, level)
  1343  }
  1344  
  1345  type CustomFuncExpr struct {
  1346  	Name NameExpr
  1347  	Args SliceExpr
  1348  	Src  *SourceLoc
  1349  	Typ  DataType
  1350  }
  1351  
  1352  func (e *CustomFuncExpr) Op() Operator {
  1353  	return CustomFuncOp
  1354  }
  1355  
  1356  func (e *CustomFuncExpr) ChildCount() int {
  1357  	return 2
  1358  }
  1359  
  1360  func (e *CustomFuncExpr) Child(nth int) Expr {
  1361  	switch nth {
  1362  	case 0:
  1363  		return &e.Name
  1364  	case 1:
  1365  		return &e.Args
  1366  	}
  1367  	panic(fmt.Sprintf("child index %d is out of range", nth))
  1368  }
  1369  
  1370  func (e *CustomFuncExpr) ChildName(nth int) string {
  1371  	switch nth {
  1372  	case 0:
  1373  		return "Name"
  1374  	case 1:
  1375  		return "Args"
  1376  	}
  1377  	return ""
  1378  }
  1379  
  1380  func (e *CustomFuncExpr) Value() interface{} {
  1381  	return nil
  1382  }
  1383  
  1384  func (e *CustomFuncExpr) Visit(visit VisitFunc) Expr {
  1385  	children := visitChildren(e, visit)
  1386  	if children != nil {
  1387  		return &CustomFuncExpr{Name: *children[0].(*NameExpr), Args: *children[1].(*SliceExpr), Src: e.Source()}
  1388  	}
  1389  	return e
  1390  }
  1391  
  1392  func (e *CustomFuncExpr) Source() *SourceLoc {
  1393  	return e.Src
  1394  }
  1395  
  1396  func (e *CustomFuncExpr) InferredType() DataType {
  1397  	return e.Typ
  1398  }
  1399  
  1400  func (e *CustomFuncExpr) String() string {
  1401  	var buf bytes.Buffer
  1402  	e.Format(&buf, 0)
  1403  	return buf.String()
  1404  }
  1405  
  1406  func (e *CustomFuncExpr) Format(buf *bytes.Buffer, level int) {
  1407  	formatExpr(e, buf, level)
  1408  }