changeset 33307:3454c18569c2

* token.h (token::operator bool): New function.
author John W. Eaton <jwe@octave.org>
date Thu, 04 Apr 2024 00:49:03 -0400
parents acef2a35ba7c
children 9d7e418f0121
files libinterp/parse-tree/token.h
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/token.h	Wed Apr 03 13:28:52 2024 +0100
+++ b/libinterp/parse-tree/token.h	Thu Apr 04 00:49:03 2024 -0400
@@ -115,6 +115,8 @@
   void mark_trailing_space () { m_tspc = true; }
   bool space_follows_token () const { return m_tspc; }
 
+  operator bool () const { return m_type_tag != invalid_token; }
+
   int token_id () const { return m_tok_id; }
 
   bool token_is (int id) const { return m_tok_id == id; }