cedar-policy / cedar-docs

Documentation for Cedar policy language
https://docs.cedarpolicy.com
Apache License 2.0
22 stars 19 forks source link

Document supported escape sequences for string literals #117

Open patjakdev opened 2 months ago

patjakdev commented 2 months ago

What were you trying to do?

Understand the syntax for escaping unicode code points and other characters in string literals.

What is wrong and why?

The Policy grammar page describes the string literal syntax as:

STR ::= Fully-escaped Unicode surrounded by '"'s

But it doesn't explain how to escape the unicode at all. Upon reading the Rust library source code, I found it somewhat surprising that the Rustic approach of \u{x...} is used which is somewhat different from many other libraries which use the fixed-width \uxxxx escape approach.

What do we need to do to fix this?

Document how to escape characters (a leading \) and what escape sequences are supported (n, r, u{...}, etc).