Skip to content

Parser error with eval if statement: "<expr> or KarateTokenType.TRIPLE_QUOTE expected, got 'if'"</expr> #79

@rupaljain777

Description

@rupaljain777

When using * eval if (condition) { ... } syntax in a Karate feature file, the parser reports an error:

<expr> or KarateTokenType.TRIPLE_QUOTE expected, got 'if'

Image

Steps to Reproduce:

  1. Create a feature file with an eval if statement:
* def arg = {'reqHeader': '#(reqHeader)', 'statusCode': 403}
* eval if (FEATURE_FLAG == "true") {karate.call('classpath:/utils/someFeature.feature', arg);}
  1. The IDE (IntelliJ IDEA with Karate plugin) shows a parser error on the if keyword.

Expected Behavior: The eval if syntax should be recognized as valid Karate DSL without parser errors.
Actual Behavior: Parser fails to recognize if following eval keyword and reports a token error.

Environment:
IDE: IntelliJ IDEA 2024.2.1
OS: macOS
Karate Version: 1.5.2 (but in older version also same issue had been seen)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions