wxMaxima
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Static Protected Attributes
MaximaTokenizer Class Reference

Maximatokenizer breaks down maxima input to individual commands. More...

#include <MaximaTokenizer.h>

Collaboration diagram for MaximaTokenizer:
[legend]

Data Structures

class  Token
 A maxima code snippet from this tokenizer. More...
 

Public Types

using TokenList = std::vector< Token >
 

Public Member Functions

 MaximaTokenizer (const wxString &commands, const Configuration *const configuration)
 The constructor.
 
TokenList PopTokens () &&
 
 MaximaTokenizer (const wxString &commands, const Configuration *const configuration, const TokenList &initialTokens)
 A constructor that adds additional words to the token list.
 

Static Public Member Functions

static bool IsAlpha (wxChar ch)
 
static bool IsNum (wxChar ch)
 
static bool IsAlphaNum (wxChar ch)
 
static bool IsSpace (wxChar ch)
 
static const wxString & UnicodeNumbers ()
 
static const wxString & Operators ()
 

Protected Types

typedef std::unordered_map< wxString, int, wxStringHash > StringHash
 

Protected Attributes

TokenList m_tokens
 The tokens the string is divided into.
 
const Configuration *const m_configuration = NULL
 

Static Protected Attributes

static const wxString m_additional_alphas = wxS("\\_%ยต")
 ASCII symbols that wxIsalnum() doesn't see as chars, but maxima does.
 
static const wxString m_not_alphas
 Unicode Operators and other special non-ascii characters.
 
static const wxString m_spaces
 Space characters.
 
static const wxString m_plusSigns
 Plus sign.
 
static const wxString m_minusSigns
 Minus sign.
 
static const wxString m_linebreaks
 Linebreak characters.
 
static const wxString m_unicodeNumbers
 Unicode numbers.
 
static const wxString m_operators
 Operators.
 
static StringHash m_hardcodedFunctions
 Names of functions that don't require parenthesis.
 

Detailed Description

Maximatokenizer breaks down maxima input to individual commands.

Effectively this is a maxima parser minus the fact that maxima is extensible and we cannot know in what directions the user or a loaded package has extended it.

Constructor & Destructor Documentation

◆ MaximaTokenizer()

MaximaTokenizer::MaximaTokenizer ( const wxString &  commands,
const Configuration *const  configuration 
)

The constructor.

Parameters
commandsThe maxima commands to tokenize
configurationA pointer to the configuration object

Field Documentation

◆ m_hardcodedFunctions

MaximaTokenizer::StringHash MaximaTokenizer::m_hardcodedFunctions
staticprotected

Names of functions that don't require parenthesis.

The maxima parser automatically parses everything that is followed by an opening parenthesis as a function. But a few things like "then" are very similar to functions except that they don't require an argument. These fake functions are kept in this hash.

◆ m_linebreaks

const wxString MaximaTokenizer::m_linebreaks
staticprotected
Initial value:
=
wxS("\n") wxS("\u2028") wxS("\u2029")

Linebreak characters.

◆ m_minusSigns

const wxString MaximaTokenizer::m_minusSigns
staticprotected
Initial value:
=
"-" wxS("\u2796") wxS("\uFE63") wxS("\uFF0D")

Minus sign.

◆ m_not_alphas

const wxString MaximaTokenizer::m_not_alphas
staticprotected
Initial value:
=
L"\u00B7\u2212\u2260\u2264\u2265\u2265\u2212\u00B2\u00B3\u00BD\u221E"
"\u22C0\u22C1\u22BB\u22BC\u22BD\u00AC\u2264\u2265\u2212" wxS("\uFE62")
wxS("\uFF0B") wxS("\uFB29") wxS("\u2795") wxS("\u2064") wxS("\u2796")
wxS("\uFE63") wxS("\uFF0D")

Unicode Operators and other special non-ascii characters.

◆ m_operators

const wxString MaximaTokenizer::m_operators
staticprotected
Initial value:
=
wxS("\u221A\u22C0\u22C1\u22BB\u22BC\u22BD\u00AC\u222b\u2264\u2265\u2211"
"\u2260+-*/^:=#'!()[]{}")

Operators.

◆ m_plusSigns

const wxString MaximaTokenizer::m_plusSigns
staticprotected
Initial value:
=
"+" wxS("\uFE62") wxS("\uFF0B") wxS("\uFB29") wxS("\u2795") wxS("\u2064")

Plus sign.

◆ m_spaces

const wxString MaximaTokenizer::m_spaces
staticprotected
Initial value:
=
wxS(" ") wxS("\u00A0")
wxS("\xDCB6")
wxS("\u1680")
wxS("\u2000")
wxS("\u2001")
wxS("\u2002")
wxS("\u2003")
wxS("\u2004")
wxS("\u2005")
wxS("\u2006")
wxS("\u2007")
wxS("\u2008")
wxS("\t") wxS("\r")

Space characters.

◆ m_unicodeNumbers

const wxString MaximaTokenizer::m_unicodeNumbers
staticprotected
Initial value:
=
wxS("\u00BD\u00B2\u00B3\u221E")

Unicode numbers.


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