Skip to content

jhrcek/elm-syntax-sscce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This SSCCE demonstrates a likely bug in elm-syntax

It seems that parsing expressions doesn't take operator precedence in account.

Input elm module being parsed:

module A exposing (..)

bool1 = True && True || True
bool2 = True || True && True

numeric1 = 1 ^ 2 * 3 + 4
numeric2 = 1 + 2 * 3 ^ 4

Output expressions formatted as trees. Notice that the expressions trees are right biased in all cases, despite operator precedence being (see elm/core Basics.elm)

  • && > ||
  • ^ > * > +
&&
│
├─ True
│
└─ ||
   │
   ├─ True
   │
   └─ True

||
│
├─ True
│
└─ &&
   │
   ├─ True
   │
   └─ True

^
│
├─ 1
│
└─ *
   │
   ├─ 2
   │
   └─ +
      │
      ├─ 3
      │
      └─ 4

+
│
├─ 1
│
└─ *
   │
   ├─ 2
   │
   └─ ^
      │
      ├─ 3
      │
      └─ 4

To reproduce this issue run

elm make src/Main.elm
# Now open index.html in your browser

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages