Running alias a='b | c' through interp produces this error:
This is because the interpreter processes aliases by parsing the expression on the right as a sequence of words here. There is a suggestive TODO just above those lines:
// TODO: parse any CallExpr perhaps, or even any Stmt
However, further down the line it seems that a slice of words is needed in order to call expand.Fields. I guess this is actually a pretty non-trivial change because parsing arbitrary CallExprs or Stmts within aliases will necessitate some AST surgery later on in order to replace the aliased word/token with the parsed CallEpr or Stmt.
Any advice on how to implement this?
Running
alias a='b | c'through interp produces this error:This is because the interpreter processes aliases by parsing the expression on the right as a sequence of words here. There is a suggestive TODO just above those lines:
However, further down the line it seems that a slice of words is needed in order to call expand.Fields. I guess this is actually a pretty non-trivial change because parsing arbitrary CallExprs or Stmts within aliases will necessitate some AST surgery later on in order to replace the aliased word/token with the parsed CallEpr or Stmt.
Any advice on how to implement this?