[Opa] outstanding database questions

Frederic Ye frederic.ye at mlstate.com
Thu Mar 1 20:44:17 UTC 2012


On 1 mars 2012, at 21:37, Owen Gunden wrote:

> On Thu, Mar 1, 2012 at 3:23 PM, Owen Gunden <ogunden at phauna.org> wrote:
>>> 3) There is no difference in classic and js-like syntax wrt to the database
>>> embedded syntax.
>>>    Only separator differs "," vs ";" (and maybe write operator "=" vs "<-")
>>>    Have you got translated example that doesn't work ?
>> 
>> Doh; no I didn't, just assumed it would be different.
> 
> Translating the first code in the manual section 7.2 below. I changed
> "or" to "/" and "," to ";". It doesn't like the "database" block:
> 
> % opa --database mongo --parser classic mongo.opa
> In mongo.opa [6:3-6:3 | global chars=168-168]
> Syntax error at line 6, column 3
> The error may be in the following citation, usually in the red part
> (starting at ⚐) or just before:
> <<o
> 
> type user_status = {regular} / {premium} / {admin}
> type user_id = int
> type user = { user_id id; string name; int age; user_status status }
> database ⚐users {
>  user /all[{id}]
>  /all[_]/status = { regular }
> }
> 

"database" is a js-like keyword, if you are using classic syntax, it's "db".

But you seem to be using js-like syntax here, so you should use --parser js-like (or nothing if you are in a recent Opa build, since it's default)

> t>>
> Hint: expected "(" or "/" or ":" or "=" or "as" or "as" or "_" or
> "else" or "then" or "if" or "do" or "type" or "with" or "match" or '	'
> or ' ' or <spacing>
> (while parsing <database path declaration> starting at line 6, column 2)
> Another hint: You are now using the parser for the classical ('old')
> syntax ; if the source uses revised ('new') syntax syntax then you
> should compile with --parser js-like option
> Error
> Syntax error
> _______________________________________________
> Opa mailing list
> Opa at lists.owasp.org
> https://lists.owasp.org/mailman/listinfo/opa



More information about the Opa mailing list