From 6e7fcf47e44f5ec298ec3314a395397271b99572 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 16 Mar 2000 11:34:13 +0000 Subject: Moved some functionality from KeyWords into StylingContext so all the lexing code could be moved out to files containing one lexer each. --- include/Accessor.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include/Accessor.h') diff --git a/include/Accessor.h b/include/Accessor.h index e31a8de6d..031ad7a91 100644 --- a/include/Accessor.h +++ b/include/Accessor.h @@ -3,6 +3,8 @@ // Copyright 1998-2000 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. +enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8}; + class Accessor { protected: // bufferSize is a trade off between time taken to copy the characters and SendMessage overhead @@ -15,12 +17,15 @@ protected: int endPos; int lenDoc; int offset; // Optional but including an offset makes GCC generate better code + int codePage; + bool InternalIsLeadByte(char ch); void Fill(int position); public: Accessor(WindowID id_, PropSet &props_, int offset_=0) : id(id_), props(props_), startPos(0x7FFFFFFF), endPos(0), - lenDoc(-1), offset(offset_) { + lenDoc(-1), offset(offset_), codePage(0) { } + void SetCodePage(int codePage_) { codePage = codePage_; } char operator[](int position) { position += offset; if (position < startPos || position >= endPos) { @@ -40,6 +45,9 @@ public: } return buf[position - startPos]; } + bool IsLeadByte(char ch) { + return codePage && InternalIsLeadByte(ch); + } char StyleAt(int position); int GetLine(int position); int LineStart(int line); @@ -54,6 +62,10 @@ public: PropSet &GetPropSet() { return props; } }; +class StylingContext; + +typedef bool (*PFNIsCommentLeader)(StylingContext &styler, int pos, int len); + class StylingContext : public Accessor { char styleBuf[bufferSize]; int validLen; @@ -71,5 +83,6 @@ public: int GetLine(int position); void SetLevel(int line, int level); void Flush(); + int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); }; -- cgit v1.2.3