arr-ai / arrai

The ultimate data engine.
http://arr.ai
Apache License 2.0
20 stars 15 forks source link

IdentExpr implementation improvement #467

Closed ericzhang6222 closed 4 years ago

ericzhang6222 commented 4 years ago

Now IdentExpr has a Bind method, so it behaves like a pattern when bound. It shouldn't do that. The correct structure/way is to wrap all exprs in ExprPattern instead of making them behave individually like patterns. Then the grammar:

pattern -> extra 
        | %!patternterms(pattern|expr)
        | C* odelim="(" identpattern=IDENT cdelim=")" C*
        | IDENT
        | NUM 
        | C* "(" exprpattern=expr:SEQ_COMMENT,? ")" C* 
        | C* exprpattern=STR C*;

can be changed to:

pattern -> extra 
        | %!patternterms(pattern|expr)
        | IDENT
        | NUM 
        | C* "(" exprpattern=expr:SEQ_COMMENT,? ")" C* 
        | C* exprpattern=STR C*;

C* odelim="(" identpattern=IDENT cdelim=")" C* will be removed.

ericzhang6222 commented 4 years ago

It comes from #442