Skip to content

interp: aliases cannot contain pipes #1338

Description

@alexflint

Running alias a='b | c' through interp produces this error:

`|` is not a valid word

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions