Opa: {false,null,true} can't be used as name prefixes

Created on 24 Jul 2019  路  2Comments  路  Source: open-policy-agent/opa

Expected Behavior

These statements should define rules:

false_asdf = "hello"
null_asdf = "hello"
true_asdf = "hello"

Actual Behavior

$ opa run
OPA 0.12.1 (commit 2799e148, built at 2019-07-06T15:26:32Z)

Run 'help' to see a list of commands.

> false_asdf = "hello"
|
1 error occurred: 2:1: rego_parse_error: no match found
        false_asdf = "hello"
bug

All 2 comments

@goosmurf thanks for reporting this. The issue seems to be that scalars are ordered before vars in the grammar and so the parser successfully consumes true/false/null and then tries to continue parsing from the next character (e.g., _ in your examples) and fails (because it's going to expect whitespace or an infix operator like =, ==, etc.) We should be able to fix this entirely inside of the grammar.

Fixed by #1611

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tsandall picture tsandall  路  5Comments

ghost picture ghost  路  6Comments

tsandall picture tsandall  路  6Comments

tsandall picture tsandall  路  7Comments

kadimulam picture kadimulam  路  8Comments