-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This version adds support for a new syntax: `iprintln!("a: 0x" a;X ", b: 0x" b;X);` Unlike the older literal-based syntax, this new syntax allows for better error reporting from the compiler and better syntax highlighting from editors not explicitly made aware of this macro (which, to my knowledge at the time of writing, is all of them). Unfortunately, due to the nature of macros, editors may not be able to refactor the contents of ifmt macro calls (e.g. CLion does not appear to rename any identifiers referenced within user-defined macros when doing identifier find/replace) and will not provide any error checking without explicit support.
- Loading branch information
Showing
9 changed files
with
511 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
[package] | ||
name = "demo" | ||
version = "0.1.0" | ||
version = "0.0.0" | ||
authors = ["ct-austin <c@ctaustin.me>"] | ||
edition = "2018" | ||
publish = false | ||
|
||
[dependencies] | ||
ifmt = { version = "0.2.0", path = "../" } | ||
ifmt = { version = "0.3.0", path = "../" } | ||
lazy_static = "1.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
fn main() { | ||
use ifmt::iprintln; | ||
let four = 4; | ||
iprintln!("four plus four is: {four + 4}"); | ||
iprintln!("four plus four is: " four + 4); | ||
// four plus four is: 8 | ||
iprintln!("here's a hex number: 0x{0xb0bi64 * 1321517i64 :x}"); | ||
iprintln!("here's a hex number: 0x" 0xb0bi64 * 1321517i64 ;x); | ||
// here's a hex number: 0xdeadbeef | ||
iprintln!("here's a debugging value: {Some(four):?}"); | ||
iprintln!("here's a debugging value: " Some(four);?); | ||
// here's a debugging value: Some(4) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.