Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
Add support for octal literals to Rust lexer (rouge-ruby#1643)
Browse files Browse the repository at this point in the history
The Rust lexer is missing support for octal literals. This commit adds
support.
  • Loading branch information
nsfisis authored and mattt committed May 19, 2021
1 parent 8ace1f9 commit 84f623f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/rouge/lexers/rust.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def macro_closed?
rule %r(
( 0b[10_]+
| 0x[0-9a-fA-F_]+
| 0o[0-7]+
| [0-9_]+
) (u#{size}?|i#{size})?
)x, Num::Integer
Expand Down
2 changes: 1 addition & 1 deletion spec/visual/samples/rust
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn h(a: i32) -> i32 {
let b = (a / 4 + 1_000) * 2 - 3;
let c = (a | 0b0100) & 0xF;

c ^ !b
c ^ !b ^ 0o707
}

fn main() {
Expand Down

0 comments on commit 84f623f

Please sign in to comment.