openMSX
Public Member Functions | Static Public Member Functions | List of all members
TclParser Class Reference

#include <TclParser.hh>

Public Member Functions

 TclParser (Tcl_Interp *interp, std::string_view input)
 Input: Tcl interpreter and command to parse. More...
 
std::string getColors () const
 Ouput: a string of equal length of the input command where each character indicates the type of the corresponding character in the command. More...
 
int getLast () const
 Get Start of the last subcommand. More...
 

Static Public Member Functions

static bool isProc (Tcl_Interp *interp, std::string_view str)
 Is the given string a valid Tcl command. More...
 

Detailed Description

Definition at line 11 of file TclParser.hh.

Constructor & Destructor Documentation

◆ TclParser()

TclParser::TclParser ( Tcl_Interp *  interp,
std::string_view  input 
)

Input: Tcl interpreter and command to parse.

Definition at line 71 of file TclParser.cc.

References utf8::unchecked::size().

Member Function Documentation

◆ getColors()

std::string TclParser::getColors ( ) const
inline

Ouput: a string of equal length of the input command where each character indicates the type of the corresponding character in the command.

Currently the possible colors are: 'E' -> error 'c' -> comment 'v' -> variable 'l' -> literal (string or number) 'p' -> proc 'o' -> operator '.' -> other

Definition at line 28 of file TclParser.hh.

◆ getLast()

int TclParser::getLast ( ) const
inline

Get Start of the last subcommand.

This is the command that should be completed by tab-completion.

Definition at line 32 of file TclParser.hh.

References DEBUG_PRINT, isProc(), and utf8::unchecked::size().

Referenced by openmsx::GlobalCommandController::source().

◆ isProc()

bool TclParser::isProc ( Tcl_Interp *  interp,
std::string_view  str 
)
static

Is the given string a valid Tcl command.

This also takes the 'lazy' Tcl scripts into account.

Definition at line 235 of file TclParser.cc.

References gl::min(), and strCat().

Referenced by getLast().


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