ton-blockchain / intellij-ton

TON Development plugin for the IntelliJ Platform
https://plugins.jetbrains.com/plugin/23382-ton
GNU General Public License v3.0
65 stars 8 forks source link

(2.0) Error checking when using multiple conditions #110

Open MicroNovaX opened 11 months ago

MicroNovaX commented 11 months ago

While using multiple conditions, the lexer does not notice the error. Broken code: (cpu > max_cpu | cpu < min_cpu) Working code: ((cpu > max_cpu) | (cpu < min_cpu))

andreypfau commented 11 months ago

for reference: Lexer splits raw text into a list of tokens Token((), ID(cpu), Token(>), ID(max_cpu), Token(|), ID(cpu), Token(<), ID(min_cpu), Token()) Here issue related to Parser (which transforms list of tokens into AST (asbtract syntax tree)). As i understand, expected parser behavior is:

ParenExpression {
  OrExpression {
    ParenExpression {
      ID(cpu), Token(>), ID(max_cpu)
    }
    Token(|)
    ParenExpression {
      ID(cpu), Token(<), ID(min_cpu)
    }
  }
}

But actually it's not.

Oualid200410 commented 1 month ago

@andreypfau andreypfau on Aug 7, 2023 Member for reference: Lexer splits raw text into a list of tokens Token((), ID(cpu), Token(>), ID(max_cpu), Token(|), ID(cpu), Token(<), ID(min_cpu), Token()) Here issue related to Parser (which transforms list of tokens into AST (asbtract syntax tree)). As i understand, expected parser behavior is:

ParenExpression { OrExpression { ParenExpression { ID(cpu), Token(>), ID(max_cpu) } Token(|) ParenExpression { ID(cpu), Token(<), ID(min_cpu) } } } But actually it's not.