GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave::token Class Reference

#include "token.h"

Collaboration diagram for octave::token:

Classes

union  tok_info
 

Public Types

enum  end_tok_type {
  simple_end , classdef_end , enumeration_end , events_end ,
  for_end , function_end , if_end , methods_end ,
  parfor_end , properties_end , switch_end , try_catch_end ,
  unwind_protect_end , while_end
}
 
enum  token_type {
  generic_token , keyword_token , string_token , double_token ,
  ettype_token , sym_rec_token , scls_name_token
}
 

Public Member Functions

 token (const token &)=delete
 
 token (int tv, bool is_keyword, const filepos &beg_pos, const filepos &end_pos)
 
 token (int tv, const char *s, const filepos &beg_pos, const filepos &end_pos)
 
 token (int tv, const filepos &beg_pos, const filepos &end_pos)
 
 token (int tv, const std::string &mth, const std::string &cls, const filepos &beg_pos, const filepos &end_pos)
 
 token (int tv, const std::string &s, const filepos &beg_pos, const filepos &end_pos)
 
 token (int tv, const symbol_record &s, const filepos &beg_pos, const filepos &end_pos)
 
 token (int tv, double d, const std::string &s, const filepos &beg_pos, const filepos &end_pos)
 
 token (int tv, end_tok_type t, const filepos &beg_pos, const filepos &end_pos)
 
 ~token (void)
 
void beg_pos (const filepos &pos)
 
filepos beg_pos (void) const
 
int column (void) const
 
void end_pos (const filepos &pos)
 
filepos end_pos (void) const
 
end_tok_type ettype (void) const
 
bool is_keyword (void) const
 
bool is_symbol (void) const
 
bool iskeyword (void) const
 
int line (void) const
 
void mark_may_be_command (void)
 
void mark_trailing_space (void)
 
bool may_be_command (void) const
 
double number (void) const
 
tokenoperator= (const token &)=delete
 
bool space_follows_token (void) const
 
std::string superclass_class_name (void) const
 
std::string superclass_method_name (void) const
 
symbol_record sym_rec (void) const
 
std::string symbol_name (void) const
 
std::string text (void) const
 
std::string text_rep (void) const
 
int token_value (void) const
 
bool token_value_is (int tv) const
 
token_type ttype (void) const
 

Private Attributes

filepos m_beg_pos
 
filepos m_end_pos
 
bool m_maybe_cmd
 
std::string m_orig_text
 
tok_info m_tok_info
 
int m_tok_val
 
bool m_tspc
 
token_type m_type_tag
 

Detailed Description

Definition at line 38 of file token.h.

Member Enumeration Documentation

◆ end_tok_type

Enumerator
simple_end 
classdef_end 
enumeration_end 
events_end 
for_end 
function_end 
if_end 
methods_end 
parfor_end 
properties_end 
switch_end 
try_catch_end 
unwind_protect_end 
while_end 

Definition at line 53 of file token.h.

◆ token_type

Enumerator
generic_token 
keyword_token 
string_token 
double_token 
ettype_token 
sym_rec_token 
scls_name_token 

Definition at line 42 of file token.h.

Constructor & Destructor Documentation

◆ token() [1/9]

octave::token::token ( int  tv,
const filepos beg_pos,
const filepos end_pos 
)

Definition at line 37 of file token.cc.

◆ token() [2/9]

octave::token::token ( int  tv,
bool  is_keyword,
const filepos beg_pos,
const filepos end_pos 
)

Definition at line 43 of file token.cc.

◆ token() [3/9]

octave::token::token ( int  tv,
const char *  s,
const filepos beg_pos,
const filepos end_pos 
)

Definition at line 51 of file token.cc.

◆ token() [4/9]

octave::token::token ( int  tv,
const std::string &  s,
const filepos beg_pos,
const filepos end_pos 
)

Definition at line 58 of file token.cc.

◆ token() [5/9]

octave::token::token ( int  tv,
double  d,
const std::string &  s,
const filepos beg_pos,
const filepos end_pos 
)

Definition at line 65 of file token.cc.

◆ token() [6/9]

octave::token::token ( int  tv,
end_tok_type  t,
const filepos beg_pos,
const filepos end_pos 
)

Definition at line 72 of file token.cc.

◆ token() [7/9]

octave::token::token ( int  tv,
const symbol_record s,
const filepos beg_pos,
const filepos end_pos 
)

Definition at line 79 of file token.cc.

◆ token() [8/9]

octave::token::token ( int  tv,
const std::string &  mth,
const std::string &  cls,
const filepos beg_pos,
const filepos end_pos 
)

Definition at line 86 of file token.cc.

◆ token() [9/9]

octave::token::token ( const token )
delete

◆ ~token()

Member Function Documentation

◆ beg_pos() [1/2]

void octave::token::beg_pos ( const filepos pos)
inline

Definition at line 114 of file token.h.

References m_beg_pos.

◆ beg_pos() [2/2]

filepos octave::token::beg_pos ( void  ) const
inline

Definition at line 111 of file token.h.

References m_beg_pos.

Referenced by octave::base_parser::end_token_error(), and octave::base_parser::make_assign_op().

◆ column()

◆ end_pos() [1/2]

void octave::token::end_pos ( const filepos pos)
inline

Definition at line 115 of file token.h.

References m_end_pos.

◆ end_pos() [2/2]

filepos octave::token::end_pos ( void  ) const
inline

Definition at line 112 of file token.h.

References m_end_pos.

◆ ettype()

token::end_tok_type octave::token::ettype ( void  ) const

◆ is_keyword()

bool octave::token::is_keyword ( void  ) const
inline

Definition at line 127 of file token.h.

References iskeyword().

◆ is_symbol()

bool octave::token::is_symbol ( void  ) const
inline

Definition at line 132 of file token.h.

References m_type_tag, and sym_rec_token.

Referenced by octave::lexical_feedback::maybe_mark_previous_token_as_variable().

◆ iskeyword()

bool octave::token::iskeyword ( void  ) const
inline

Definition at line 121 of file token.h.

References ettype_token, keyword_token, and m_type_tag.

Referenced by is_keyword(), and octave::lexical_feedback::previous_token_is_keyword().

◆ line()

◆ mark_may_be_command()

void octave::token::mark_may_be_command ( void  )
inline

Definition at line 102 of file token.h.

References m_maybe_cmd.

Referenced by octave::base_lexer::handle_identifier().

◆ mark_trailing_space()

void octave::token::mark_trailing_space ( void  )
inline

Definition at line 105 of file token.h.

References m_tspc.

Referenced by octave::lexical_feedback::mark_previous_token_trailing_space().

◆ may_be_command()

bool octave::token::may_be_command ( void  ) const
inline

Definition at line 103 of file token.h.

References m_maybe_cmd.

Referenced by octave::lexical_feedback::previous_token_may_be_command().

◆ number()

double octave::token::number ( void  ) const

◆ operator=()

token& octave::token::operator= ( const token )
delete

◆ space_follows_token()

bool octave::token::space_follows_token ( void  ) const
inline

Definition at line 106 of file token.h.

References m_tspc.

Referenced by octave::lexical_feedback::space_follows_previous_token().

◆ superclass_class_name()

std::string octave::token::superclass_class_name ( void  ) const

◆ superclass_method_name()

std::string octave::token::superclass_method_name ( void  ) const

◆ sym_rec()

symbol_record octave::token::sym_rec ( void  ) const

◆ symbol_name()

std::string octave::token::symbol_name ( void  ) const

◆ text()

std::string octave::token::text ( void  ) const

◆ text_rep()

std::string octave::token::text_rep ( void  ) const

Definition at line 159 of file token.cc.

References m_orig_text.

Referenced by octave::base_parser::make_constant().

◆ token_value()

int octave::token::token_value ( void  ) const
inline

Definition at line 108 of file token.h.

References m_tok_val.

Referenced by octave_lex(), and octave::lexical_feedback::previous_token_value().

◆ token_value_is()

bool octave::token::token_value_is ( int  tv) const
inline

Definition at line 109 of file token.h.

References m_tok_val.

Referenced by octave::lexical_feedback::previous_token_value_is().

◆ ttype()

token::token_type octave::token::ttype ( void  ) const

Definition at line 125 of file token.cc.

References m_type_tag.

Member Data Documentation

◆ m_beg_pos

filepos octave::token::m_beg_pos
private

Definition at line 155 of file token.h.

Referenced by beg_pos(), column(), and line().

◆ m_end_pos

filepos octave::token::m_end_pos
private

Definition at line 156 of file token.h.

Referenced by end_pos().

◆ m_maybe_cmd

bool octave::token::m_maybe_cmd
private

Definition at line 151 of file token.h.

Referenced by mark_may_be_command(), and may_be_command().

◆ m_orig_text

std::string octave::token::m_orig_text
private

Definition at line 225 of file token.h.

Referenced by text_rep().

◆ m_tok_info

tok_info octave::token::m_tok_info
private

◆ m_tok_val

int octave::token::m_tok_val
private

Definition at line 158 of file token.h.

Referenced by token_value(), and token_value_is().

◆ m_tspc

bool octave::token::m_tspc
private

Definition at line 153 of file token.h.

Referenced by mark_trailing_space(), and space_follows_token().

◆ m_type_tag

token_type octave::token::m_type_tag
private

The documentation for this class was generated from the following files: