23#ifndef MAXIMATOKENIZER_H
24#define MAXIMATOKENIZER_H
34#include "Configuration.h"
35#include <unordered_map>
65 explicit Token(wxString&& text) : m_text(std::move(text)) {}
66 explicit Token(
const wxString &text) : m_text(text) {}
67 Token(wxString&& text,
TextStyle style) : m_text(std::move(text)), m_style(style) {}
68 Token(
const wxString& text,
TextStyle style) : m_text(text), m_style(style) {}
69 Token& operator=(
Token&& t)
noexcept { m_text = std::move(t.m_text); m_style = t.m_style;
return *
this; }
70 Token& operator=(
const Token& t) { m_text = t.m_text; m_style = t.m_style;
return *
this; }
71 Token(
Token&& token)
noexcept { *
this = std::move(token); }
73 TextStyle GetTextStyle()
const {
return m_style; }
74 const wxString &GetText()
const {
return m_text; }
75 operator const wxString &()
const {
return m_text; }
80 static bool IsAlpha(wxChar ch);
81 static bool IsNum(wxChar ch);
82 static bool IsAlphaNum(wxChar ch);
83 static bool IsSpace(wxChar ch);
85 static const wxString &Operators() {
return m_operators; }
87 using TokenList = std::vector<Token>;
88 TokenList PopTokens() && {
return std::move(
m_tokens); }
92 const TokenList &initialTokens);
116 typedef std::unordered_map <wxString, int, wxStringHash> StringHash;
This file declares everything needed for the text style system used to style all the elements on the ...
TextStyle
All text styles known to wxMaxima.
Definition: TextStyle.h:231
The configuration storage for the current worksheet.
Definition: Configuration.h:85
A maxima code snippet from this tokenizer.
Definition: MaximaTokenizer.h:62
Maximatokenizer breaks down maxima input to individual commands.
Definition: MaximaTokenizer.h:51
static const wxString m_plusSigns
Plus sign.
Definition: MaximaTokenizer.h:104
static StringHash m_hardcodedFunctions
Names of functions that don't require parenthesis.
Definition: MaximaTokenizer.h:124
static const wxString m_not_alphas
Unicode Operators and other special non-ascii characters.
Definition: MaximaTokenizer.h:100
static const wxString m_unicodeNumbers
Unicode numbers.
Definition: MaximaTokenizer.h:110
static const wxString m_spaces
Space characters.
Definition: MaximaTokenizer.h:102
static const wxString m_operators
Operators.
Definition: MaximaTokenizer.h:112
static const wxString m_minusSigns
Minus sign.
Definition: MaximaTokenizer.h:106
TokenList m_tokens
The tokens the string is divided into.
Definition: MaximaTokenizer.h:96
static const wxString m_additional_alphas
ASCII symbols that wxIsalnum() doesn't see as chars, but maxima does.
Definition: MaximaTokenizer.h:98
static const wxString m_linebreaks
Linebreak characters.
Definition: MaximaTokenizer.h:108