Skip to content

Commit

Permalink
Merge #125
Browse files Browse the repository at this point in the history
125: Add raw string syntax to grammar file r=ebkalderon a=torkleyy

Fixes #116 

Co-authored-by: Thomas Schaller <[email protected]>
  • Loading branch information
bors[bot] and torkleyy committed Aug 6, 2018
2 parents cfb92c4 + 3f6f37f commit a124da9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,22 @@ float_exp = ("e" | "E"), digit, {digit};
## String

```ebnf
string = "\"", { no_double_quotation_marks | string_escape }, "\"";
string = string_std | string_raw;
string_std = "\"", { no_double_quotation_marks | string_escape }, "\"";
string_escape = "\\", ("\"" | "\\" | "b" | "f" | "n" | "r" | "t" | ("u", unicode_hex));
string_raw = ("r#", string_raw, "#") | "\"", { unicode_non_greedy }, "\"";
```

> Note: Raw strings start with an `r`, followed by n `#` and a quotation mark
`"`. They may contain any characters or escapes (except the end sequence).
A raw string ends with a quotation mark (`"`), followed by n `#`.
Example:
```rust
r##"This is a "raw string". It can contain quotations or
backslashes (\)!"##
```
I don't know any sane way to write this out in EBNF, if you do, let me know.

## Char

```ebnf
Expand Down

0 comments on commit a124da9

Please sign in to comment.