Skip to content

Precedence issue with ":" #166

Open
Open
@szhorvat

Description

Describe the bug

x y : z is parsed as Optional[Times[x, y], z], according to the Wolfram Language -> Show FullForm menu item. This is also reflected in how the incremental selection works ("expand selection").

The correct parsing is Times[x, Pattern[y, z]]. There are two problems here: (1) precedence of : vs implicit multiplication (2) confusion between Optional and Pattern.

Let us look at another example:

x y_ : z (notice the _) is parsed as Optional[Times[x, Pattern[y]], z].

The correct parsing is Times[x, Optional[Pattern[y, Blank[]], z]]. Again, two issues: (1) precedence of : vs implicit multiplication (2) Pattern[y] vs Pattern[y, Blank[]]

As far as I can tell, in both cases it is only (1) that affects the functionality of the plugin, and (2) can be ignored. It affects incremental selections.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions