intellij-ton icon indicating copy to clipboard operation
intellij-ton copied to clipboard

(2.0) Error checking when using multiple conditions

Open MicroNovaX opened this issue 1 year ago • 2 comments

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))

MicroNovaX avatar Aug 06 '23 20:08 MicroNovaX

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.

andreypfau avatar Aug 07 '23 03:08 andreypfau

@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.

Oualid200410 avatar May 25 '24 23:05 Oualid200410