diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 53465c071f3..07e22b02c55 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1298,6 +1298,16 @@ impl LitKind { } } + /// Returns true if this is a numeric literal. + pub fn is_numeric(&self) -> bool { + match *self { + LitKind::Int(..) | + LitKind::Float(..) | + LitKind::FloatUnsuffixed(..) => true, + _ => false, + } + } + /// Returns true if this literal has no suffix. Note: this will return true /// for literals with prefixes such as raw strings and byte strings. pub fn is_unsuffixed(&self) -> bool { |
