danvim / ProcalParsing

0 stars 2 forks source link

Revamp Hidden Multiplication: an attempt with nud/led instead of hardcode regex #26

Closed bryanchun closed 7 years ago

bryanchun commented 7 years ago

Illustration of thought:

Each Node can specify whether it supports hidden multiplication or not in an attribute of the class. Hence checking can be done by finding out whether there is some consecutive nodes both with this attribute.

For example, let say we have a boolean property hiddenMultiplicative

NumberNode.hiddenMultiplicative = true;
VariableNode.hiddenMultiplicative = true;
ConstantNode.hiddenMultiplicative = true;
AdditionNode.hiddenMultiplicative = false;
<NumberNode><VariableNode> // invokes Hidden multiplication
<VariableNode><VariableNode> // self-chain: invokes Hidden multiplication
<NumberNode><NumberNode> // commutative: invokes Hidden multiplication but shall this be banned?
<VariableNode><ConstantNode> // invokes Hidden multiplication
<NumberNode><AdditionNode> // Not invoked
bryanchun commented 7 years ago

Bug of this way:

2(3)/5

becomes 2(3/5) not (23)/5 for 2/3(5) performs like (2/3)*5

danvim commented 7 years ago

This issue was closed because this suggestion does not work with the code structure and please refer to #1