mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-29 22:03:40 -06:00
Python highlighting #1352
git-svn-id: svn://ultimatepp.org/upp/trunk@9294 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
96fd9388a2
commit
eb9cb8a39b
6 changed files with 275 additions and 8 deletions
37
uppsrc/CodeEditor/PythonSyntax.h
Normal file
37
uppsrc/CodeEditor/PythonSyntax.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
class PythonSyntax : public EditorSyntax {
|
||||
private:
|
||||
struct Identation {
|
||||
enum Type {
|
||||
Tab = 0,
|
||||
Space,
|
||||
None
|
||||
};
|
||||
};
|
||||
|
||||
public:
|
||||
PythonSyntax();
|
||||
|
||||
virtual void Highlight(const wchar *start, const wchar *end, HighlightOutput& hls,
|
||||
CodeEditor *editor, int line, int pos);
|
||||
virtual void IndentInsert(CodeEditor& e, int chr, int count);
|
||||
|
||||
private:
|
||||
bool IsSeparator(const wchar* c);
|
||||
|
||||
bool IsKeyword(const WString& w);
|
||||
bool IsSpecialVar(const WString& w);
|
||||
bool IsNumber(const WString& w);
|
||||
|
||||
void InitKeywords();
|
||||
void LoadSyntax(const char* keywordsArray[], const char* specialVarsArray[]);
|
||||
|
||||
bool LineHasColon(const WString& line);
|
||||
int CalculateLineIndetations(const WString& line, Identation::Type type);
|
||||
int CalculateSpaceIndetationSize(CodeEditor& editor);
|
||||
Identation::Type FindIdentationType(CodeEditor& editor, const WString& line);
|
||||
char GetIdentationByType(Identation::Type type);
|
||||
|
||||
private:
|
||||
Index<String> keywords;
|
||||
Index<String> specialVars;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue