GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
token Class Reference

#include "token.h"

Collaboration diagram for token:
Collaboration graph
[legend]

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 (int tv, int l=-1, int c=-1)
 
 token (int tv, bool is_keyword, int l=-1, int c=-1)
 
 token (int tv, const char *s, int l=-1, int c=-1)
 
 token (int tv, const std::string &s, int l=-1, int c=-1)
 
 token (int tv, double d, const std::string &s=std::string(), int l=-1, int c=-1)
 
 token (int tv, end_tok_type t, int l=-1, int c=-1)
 
 token (int tv, symbol_table::symbol_record *s, int l=-1, int c=-1)
 
 token (int tv, const std::string &mth, const std::string &cls, int l=-1, int c=-1)
 
 ~token (void)
 
int column (void) const
 
end_tok_type ettype (void) const
 
bool is_keyword (void) const
 
bool is_symbol (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
 
bool space_follows_token (void) const
 
std::string superclass_class_name (void)
 
std::string superclass_method_name (void)
 
symbol_table::symbol_recordsym_rec (void)
 
std::string symbol_name (void) const
 
std::string text (void) const
 
std::string text_rep (void)
 
int token_value (void) const
 
bool token_value_is (int tv) const
 
token_type ttype (void) const
 

Private Member Functions

 token (const token &tok)
 
tokenoperator= (const token &tok)
 

Private Attributes

union {
   end_tok_type   et
 
   double   num
 
   struct {
      std::string *   class_nm
 
      std::string *   method_nm
 
   }   sc
 
   symbol_table::symbol_record *   sr
 
   std::string *   str
 
}; 
 
int column_num
 
int line_num
 
bool maybe_cmd
 
std::string orig_text
 
int tok_val
 
bool tspc
 
token_type type_tag
 

Detailed Description

Definition at line 30 of file token.h.

Member Enumeration Documentation

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 46 of file token.h.

Enumerator
generic_token 
keyword_token 
string_token 
double_token 
ettype_token 
sym_rec_token 
scls_name_token 

Definition at line 35 of file token.h.

Constructor & Destructor Documentation

token::token ( int  tv,
int  l = -1,
int  c = -1 
)

Definition at line 35 of file token.cc.

References column_num, generic_token, line_num, maybe_cmd, tok_val, tspc, and type_tag.

token::token ( int  tv,
bool  is_keyword,
int  l = -1,
int  c = -1 
)

Definition at line 45 of file token.cc.

References column_num, generic_token, keyword_token, line_num, maybe_cmd, tok_val, tspc, and type_tag.

token::token ( int  tv,
const char s,
int  l = -1,
int  c = -1 
)

Definition at line 55 of file token.cc.

References column_num, line_num, maybe_cmd, str, string_token, tok_val, tspc, and type_tag.

token::token ( int  tv,
const std::string &  s,
int  l = -1,
int  c = -1 
)

Definition at line 66 of file token.cc.

References column_num, line_num, maybe_cmd, str, string_token, tok_val, tspc, and type_tag.

token::token ( int  tv,
double  d,
const std::string &  s = std::string (),
int  l = -1,
int  c = -1 
)

Definition at line 77 of file token.cc.

References column_num, d, double_token, line_num, maybe_cmd, num, orig_text, tok_val, tspc, and type_tag.

token::token ( int  tv,
end_tok_type  t,
int  l = -1,
int  c = -1 
)

Definition at line 89 of file token.cc.

References column_num, et, ettype_token, line_num, maybe_cmd, tok_val, tspc, and type_tag.

token::token ( int  tv,
symbol_table::symbol_record s,
int  l = -1,
int  c = -1 
)

Definition at line 100 of file token.cc.

References column_num, line_num, maybe_cmd, sr, sym_rec_token, tok_val, tspc, and type_tag.

token::token ( int  tv,
const std::string &  mth,
const std::string &  cls,
int  l = -1,
int  c = -1 
)

Definition at line 111 of file token.cc.

References column_num, line_num, maybe_cmd, sc, scls_name_token, tok_val, tspc, and type_tag.

token::~token ( void  )

Definition at line 124 of file token.cc.

References sc, scls_name_token, str, string_token, and type_tag.

token::token ( const token tok)
private

Member Function Documentation

int token::column ( void  ) const
inline
token::end_tok_type token::ettype ( void  ) const

Definition at line 164 of file token.cc.

References et, ettype_token, and type_tag.

Referenced by octave_base_parser::end_token_ok().

bool token::is_keyword ( void  ) const
inline

Definition at line 89 of file token.h.

Referenced by lexical_feedback::previous_token_is_keyword().

bool token::is_symbol ( void  ) const
inline

Definition at line 94 of file token.h.

Referenced by lexical_feedback::maybe_mark_previous_token_as_variable().

int token::line ( void  ) const
inline
void token::mark_may_be_command ( void  )
inline

Definition at line 77 of file token.h.

Referenced by octave_base_lexer::handle_identifier().

void token::mark_trailing_space ( void  )
inline

Definition at line 80 of file token.h.

Referenced by lexical_feedback::mark_previous_token_trailing_space().

bool token::may_be_command ( void  ) const
inline

Definition at line 78 of file token.h.

Referenced by lexical_feedback::previous_token_may_be_command().

double token::number ( void  ) const

Definition at line 151 of file token.cc.

References double_token, num, and type_tag.

Referenced by octave_base_lexer::display_token(), and octave_base_parser::make_constant().

token& token::operator= ( const token tok)
private
bool token::space_follows_token ( void  ) const
inline

Definition at line 81 of file token.h.

Referenced by lexical_feedback::space_follows_previous_token().

std::string token::superclass_class_name ( void  )

Definition at line 185 of file token.cc.

References sc, scls_name_token, and type_tag.

std::string token::superclass_method_name ( void  )

Definition at line 178 of file token.cc.

References sc, scls_name_token, and type_tag.

symbol_table::symbol_record * token::sym_rec ( void  )

Definition at line 171 of file token.cc.

References sr, sym_rec_token, and type_tag.

Referenced by octave_base_lexer::display_token().

std::string token::symbol_name ( void  ) const
std::string token::text ( void  ) const
std::string token::text_rep ( void  )

Definition at line 192 of file token.cc.

References orig_text.

Referenced by octave_base_parser::make_constant().

int token::token_value ( void  ) const
inline

Definition at line 83 of file token.h.

Referenced by lexical_feedback::previous_token_value().

bool token::token_value_is ( int  tv) const
inline

Definition at line 84 of file token.h.

Referenced by lexical_feedback::previous_token_value_is().

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

Definition at line 158 of file token.cc.

References type_tag.

Member Data Documentation

union { ... }
std::string* token::class_nm

Definition at line 134 of file token.h.

int token::column_num
private

Definition at line 122 of file token.h.

Referenced by token().

end_tok_type token::et

Definition at line 129 of file token.h.

Referenced by ettype(), and token().

int token::line_num
private

Definition at line 121 of file token.h.

Referenced by token().

bool token::maybe_cmd
private

Definition at line 119 of file token.h.

Referenced by token().

std::string* token::method_nm

Definition at line 133 of file token.h.

double token::num

Definition at line 128 of file token.h.

Referenced by number(), and token().

std::string token::orig_text
private

Definition at line 137 of file token.h.

Referenced by text_rep(), and token().

struct { ... } token::sc

Definition at line 130 of file token.h.

Referenced by sym_rec(), symbol_name(), and token().

std::string* token::str

Definition at line 127 of file token.h.

Referenced by text(), token(), and ~token().

int token::tok_val
private

Definition at line 123 of file token.h.

Referenced by token().

bool token::tspc
private

Definition at line 120 of file token.h.

Referenced by token().

token_type token::type_tag
private

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