<ClCompile Include="..\editlib\pascal.cpp" />\r
<ClCompile Include="..\editlib\perl.cpp" />\r
<ClCompile Include="..\editlib\php.cpp" />\r
+ <ClCompile Include="..\editlib\plain.cpp" />\r
<ClCompile Include="..\editlib\po.cpp" />\r
<ClCompile Include="..\editlib\powershell.cpp" />\r
<ClCompile Include="..\editlib\python.cpp" />\r
<ClInclude Include="..\editlib\fpattern.h" />\r
<ClInclude Include="..\editlib\gotodlg.h" />\r
<ClInclude Include="..\editlib\LineInfo.h" />\r
+ <ClInclude Include="..\editlib\crystallineparser.h" />\r
<ClInclude Include="..\editlib\memcombo.h" />\r
<ClInclude Include="..\editlib\registry.h" />\r
<ClInclude Include="..\editlib\splash.h" />\r
<ClCompile Include="..\editlib\wcwidth.cpp">\r
<Filter>editlib</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\editlib\plain.cpp">\r
+ <Filter>editlib\parsers</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ResourceCompile Include="Sample.rc">\r
<ClInclude Include="..\editlib\wcwidth.h">\r
<Filter>editlib</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\editlib\crystallineparser.h">\r
+ <Filter>editlib\parsers</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<Image Include="res\mg_icons.bmp">\r
<ClCompile Include="..\editlib\pascal.cpp" />\r
<ClCompile Include="..\editlib\perl.cpp" />\r
<ClCompile Include="..\editlib\php.cpp" />\r
+ <ClCompile Include="..\editlib\plain.cpp" />\r
<ClCompile Include="..\editlib\po.cpp" />\r
<ClCompile Include="..\editlib\powershell.cpp" />\r
<ClCompile Include="..\editlib\python.cpp" />\r
<ClInclude Include="..\editlib\fpattern.h" />\r
<ClInclude Include="..\editlib\gotodlg.h" />\r
<ClInclude Include="..\editlib\LineInfo.h" />\r
+ <ClInclude Include="..\editlib\crystallineparser.h" />\r
<ClInclude Include="..\editlib\memcombo.h" />\r
<ClInclude Include="..\editlib\registry.h" />\r
<ClInclude Include="..\editlib\splash.h" />\r
<ClCompile Include="..\editlib\wcwidth.cpp">\r
<Filter>editlib</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\editlib\plain.cpp">\r
+ <Filter>editlib\parsers</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ResourceCompile Include="Sample.rc">\r
<ClInclude Include="..\editlib\wcwidth.h">\r
<Filter>editlib</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\editlib\crystallineparser.h">\r
+ <Filter>editlib\parsers</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<Image Include="res\mg_icons.bmp">\r
<ClCompile Include="..\editlib\pascal.cpp" />
<ClCompile Include="..\editlib\perl.cpp" />
<ClCompile Include="..\editlib\php.cpp" />
+ <ClCompile Include="..\editlib\plain.cpp" />
<ClCompile Include="..\editlib\po.cpp" />
<ClCompile Include="..\editlib\powershell.cpp" />
<ClCompile Include="..\editlib\python.cpp" />
<ClInclude Include="..\editlib\fpattern.h" />
<ClInclude Include="..\editlib\gotodlg.h" />
<ClInclude Include="..\editlib\LineInfo.h" />
+ <ClInclude Include="..\editlib\crystallineparser.h" />
<ClInclude Include="..\editlib\memcombo.h" />
<ClInclude Include="..\editlib\registry.h" />
<ClInclude Include="..\editlib\splash.h" />
<ClCompile Include="..\editlib\ctextmarkerdlg.cpp">
<Filter>editlib</Filter>
</ClCompile>
- <ClCompile Include="..\editlib\wcwidth.cpp">\r
- <Filter>editlib</Filter>\r
- </ClCompile>\r
+ <ClCompile Include="..\editlib\wcwidth.cpp">
+ <Filter>editlib</Filter>
+ </ClCompile>
+ <ClCompile Include="..\editlib\plain.cpp">
+ <Filter>editlib\parsers</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Sample.rc">
<ClInclude Include="..\editlib\ctextmarkerdlg.h">
<Filter>editlib</Filter>
</ClInclude>
- <ClInclude Include="..\editlib\wcwidth.h">\r
- <Filter>editlib</Filter>\r
- </ClInclude>\r
+ <ClInclude Include="..\editlib\wcwidth.h">
+ <Filter>editlib</Filter>
+ </ClInclude>
+ <ClInclude Include="..\editlib\crystallineparser.h">
+ <Filter>editlib\parsers</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="res\mg_icons.bmp">
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_USER1 0x0020
-#define COOKIE_EXT_USER1 0x0040
-
-DWORD CCrystalTextView::
-ParseLineAsp (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineAsp (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & (COOKIE_EXT_COMMENT|COOKIE_EXT_USER1);
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~(COOKIE_EXT_COMMENT|COOKIE_EXT_USER1)) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineBasic (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineBasic (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineBatch (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineBatch (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
#include "wcwidth.h"
using std::vector;
+using CrystalLineParser::TEXTBLOCK;
// Escaped character constants in range 0x80-0xFF are interpreted in current codepage
// Using C locale gets us direct mapping to Unicode codepoints
// See ccrystaltextview.h for table declaration.
CCrystalTextView::TextDefinition CCrystalTextView::m_SourceDefs[] =
{
- CCrystalTextView::SRC_PLAIN, _T ("Plain"), _T ("txt,doc,diz"), &CCrystalTextView::ParseLinePlain, SRCOPT_AUTOINDENT, /*4,*/ _T (""), _T (""), _T (""), (DWORD)-1,
- CCrystalTextView::SRC_ASP, _T ("ASP"), _T ("asp,ascx"), &CCrystalTextView::ParseLineAsp, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T (""), _T (""), _T ("'"), (DWORD)-1,
- CCrystalTextView::SRC_BASIC, _T ("Basic"), _T ("bas,vb,vbs,frm,dsm,cls,ctl,pag,dsr"), &CCrystalTextView::ParseLineBasic, SRCOPT_AUTOINDENT, /*4,*/ _T (""), _T (""), _T ("\'"), (DWORD)-1,
- CCrystalTextView::SRC_BATCH, _T ("Batch"), _T ("bat,btm,cmd"), &CCrystalTextView::ParseLineBatch, SRCOPT_INSERTTABS|SRCOPT_AUTOINDENT, /*4,*/ _T (""), _T (""), _T ("rem "), (DWORD)-1,
- CCrystalTextView::SRC_C, _T ("C"), _T ("c,cc,cpp,cxx,h,hpp,hxx,hm,inl,rh,tlh,tli,xs"), &CCrystalTextView::ParseLineC, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_CSHARP, _T ("C#"), _T ("cs"), &CCrystalTextView::ParseLineCSharp, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_CSS, _T ("CSS"), _T ("css"), &CCrystalTextView::ParseLineCss, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T (""), (DWORD)-1,
- CCrystalTextView::SRC_DCL, _T ("DCL"), _T ("dcl,dcc"), &CCrystalTextView::ParseLineDcl, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_FORTRAN, _T ("Fortran"), _T ("f,f90,f9p,fpp,for,f77"), &CCrystalTextView::ParseLineFortran, SRCOPT_INSERTTABS|SRCOPT_AUTOINDENT, /*8,*/ _T (""), _T (""), _T ("!"), (DWORD)-1,
- CCrystalTextView::SRC_GO, _T ("Go"), _T ("go"), &CCrystalTextView::ParseLineGo, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_HTML, _T ("HTML"), _T ("html,htm,shtml,ihtml,ssi,stm,stml,jsp"), &CCrystalTextView::ParseLineHtml, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("<!--"), _T ("-->"), _T (""), (DWORD)-1,
- CCrystalTextView::SRC_INI, _T ("INI"), _T ("ini,reg,vbp,isl"), &CCrystalTextView::ParseLineIni, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU|SRCOPT_EOLNUNIX, /*2,*/ _T (""), _T (""), _T (";"), (DWORD)-1,
- CCrystalTextView::SRC_INNOSETUP, _T ("InnoSetup"), _T ("iss"), &CCrystalTextView::ParseLineInnoSetup, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("{"), _T ("}"), _T (";"), (DWORD)-1,
- CCrystalTextView::SRC_INSTALLSHIELD, _T ("InstallShield"), _T ("rul"), &CCrystalTextView::ParseLineIS, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_JAVA, _T ("Java"), _T ("java,jav,js"), &CCrystalTextView::ParseLineJava, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_LISP, _T ("AutoLISP"), _T ("lsp,dsl"), &CCrystalTextView::ParseLineLisp, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T (";|"), _T ("|;"), _T (";"), (DWORD)-1,
- CCrystalTextView::SRC_NSIS, _T ("NSIS"), _T ("nsi,nsh"), &CCrystalTextView::ParseLineNsis, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T (";"), (DWORD)-1,
- CCrystalTextView::SRC_PASCAL, _T ("Pascal"), _T ("pas"), &CCrystalTextView::ParseLinePascal, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("{"), _T ("}"), _T (""), (DWORD)-1,
- CCrystalTextView::SRC_PERL, _T ("Perl"), _T ("pl,pm,plx"), &CCrystalTextView::ParseLinePerl, SRCOPT_AUTOINDENT|SRCOPT_EOLNUNIX, /*4,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
- CCrystalTextView::SRC_PHP, _T ("PHP"), _T ("php,php3,php4,php5,phtml"), &CCrystalTextView::ParseLinePhp, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_PO, _T ("PO"), _T ("po,pot"), &CCrystalTextView::ParseLinePo, SRCOPT_AUTOINDENT|SRCOPT_EOLNUNIX, /*4,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
- CCrystalTextView::SRC_POWERSHELL, _T ("PowerShell"), _T ("ps1"), &CCrystalTextView::ParseLinePowerShell, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
- CCrystalTextView::SRC_PYTHON, _T ("Python"), _T ("py"), &CCrystalTextView::ParseLinePython, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_REXX, _T ("REXX"), _T ("rex,rexx"), &CCrystalTextView::ParseLineRexx, SRCOPT_AUTOINDENT, /*4,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_RSRC, _T ("Resources"), _T ("rc,dlg,r16,r32,rc2"), &CCrystalTextView::ParseLineRsrc, SRCOPT_AUTOINDENT, /*4,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_RUBY, _T ("Ruby"), _T ("rb,rbw,rake,gemspec"), &CCrystalTextView::ParseLineRuby, SRCOPT_AUTOINDENT|SRCOPT_EOLNUNIX, /*4,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
- CCrystalTextView::SRC_RUST, _T ("Rust"), _T ("rs"), &CCrystalTextView::ParseLineRust, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_SGML, _T ("Sgml"), _T ("sgml"), &CCrystalTextView::ParseLineSgml, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("<!--"), _T ("-->"), _T (""), (DWORD)-1,
- CCrystalTextView::SRC_SH, _T ("Shell"), _T ("sh,conf"), &CCrystalTextView::ParseLineSh, SRCOPT_INSERTTABS|SRCOPT_AUTOINDENT|SRCOPT_EOLNUNIX, /*4,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
- CCrystalTextView::SRC_SIOD, _T ("SIOD"), _T ("scm"), &CCrystalTextView::ParseLineSiod, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU, /*2,*/ _T (";|"), _T ("|;"), _T (";"), (DWORD)-1,
- CCrystalTextView::SRC_SQL, _T ("SQL"), _T ("sql"), &CCrystalTextView::ParseLineSql, SRCOPT_AUTOINDENT, /*4,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_TCL, _T ("TCL"), _T ("tcl"), &CCrystalTextView::ParseLineTcl, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU|SRCOPT_EOLNUNIX, /*2,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
- CCrystalTextView::SRC_TEX, _T ("TEX"), _T ("tex,sty,clo,ltx,fd,dtx"), &CCrystalTextView::ParseLineTex, SRCOPT_AUTOINDENT, /*4,*/ _T (""), _T (""), _T ("%"), (DWORD)-1,
- CCrystalTextView::SRC_VERILOG, _T ("Verilog"), _T ("v,vh"), &CCrystalTextView::ParseLineVerilog, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
- CCrystalTextView::SRC_VHDL, _T ("VHDL"), _T ("vhd,vhdl,vho"), &CCrystalTextView::ParseLineVhdl, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T (""), _T (""), _T ("--"), (DWORD)-1,
- CCrystalTextView::SRC_XML, _T ("XML"), _T ("xml"), &CCrystalTextView::ParseLineXml, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("<!--"), _T ("-->"), _T (""), (DWORD)-1
+ CCrystalTextView::SRC_PLAIN, _T ("Plain"), _T ("txt,doc,diz"), &CrystalLineParser::ParseLinePlain, SRCOPT_AUTOINDENT, /*4,*/ _T (""), _T (""), _T (""), (DWORD)-1,
+ CCrystalTextView::SRC_ASP, _T ("ASP"), _T ("asp,ascx"), &CrystalLineParser::ParseLineAsp, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T (""), _T (""), _T ("'"), (DWORD)-1,
+ CCrystalTextView::SRC_BASIC, _T ("Basic"), _T ("bas,vb,vbs,frm,dsm,cls,ctl,pag,dsr"), &CrystalLineParser::ParseLineBasic, SRCOPT_AUTOINDENT, /*4,*/ _T (""), _T (""), _T ("\'"), (DWORD)-1,
+ CCrystalTextView::SRC_BATCH, _T ("Batch"), _T ("bat,btm,cmd"), &CrystalLineParser::ParseLineBatch, SRCOPT_INSERTTABS|SRCOPT_AUTOINDENT, /*4,*/ _T (""), _T (""), _T ("rem "), (DWORD)-1,
+ CCrystalTextView::SRC_C, _T ("C"), _T ("c,cc,cpp,cxx,h,hpp,hxx,hm,inl,rh,tlh,tli,xs"), &CrystalLineParser::ParseLineC, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_CSHARP, _T ("C#"), _T ("cs"), &CrystalLineParser::ParseLineCSharp, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_CSS, _T ("CSS"), _T ("css"), &CrystalLineParser::ParseLineCss, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T (""), (DWORD)-1,
+ CCrystalTextView::SRC_DCL, _T ("DCL"), _T ("dcl,dcc"), &CrystalLineParser::ParseLineDcl, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_FORTRAN, _T ("Fortran"), _T ("f,f90,f9p,fpp,for,f77"), &CrystalLineParser::ParseLineFortran, SRCOPT_INSERTTABS|SRCOPT_AUTOINDENT, /*8,*/ _T (""), _T (""), _T ("!"), (DWORD)-1,
+ CCrystalTextView::SRC_GO, _T ("Go"), _T ("go"), &CrystalLineParser::ParseLineGo, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_HTML, _T ("HTML"), _T ("html,htm,shtml,ihtml,ssi,stm,stml,jsp"), &CrystalLineParser::ParseLineHtml, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("<!--"), _T ("-->"), _T (""), (DWORD)-1,
+ CCrystalTextView::SRC_INI, _T ("INI"), _T ("ini,reg,vbp,isl"), &CrystalLineParser::ParseLineIni, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU|SRCOPT_EOLNUNIX, /*2,*/ _T (""), _T (""), _T (";"), (DWORD)-1,
+ CCrystalTextView::SRC_INNOSETUP, _T ("InnoSetup"), _T ("iss"), &CrystalLineParser::ParseLineInnoSetup, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("{"), _T ("}"), _T (";"), (DWORD)-1,
+ CCrystalTextView::SRC_INSTALLSHIELD, _T ("InstallShield"), _T ("rul"), &CrystalLineParser::ParseLineIS, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_JAVA, _T ("Java"), _T ("java,jav,js"), &CrystalLineParser::ParseLineJava, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_LISP, _T ("AutoLISP"), _T ("lsp,dsl"), &CrystalLineParser::ParseLineLisp, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T (";|"), _T ("|;"), _T (";"), (DWORD)-1,
+ CCrystalTextView::SRC_NSIS, _T ("NSIS"), _T ("nsi,nsh"), &CrystalLineParser::ParseLineNsis, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T (";"), (DWORD)-1,
+ CCrystalTextView::SRC_PASCAL, _T ("Pascal"), _T ("pas"), &CrystalLineParser::ParseLinePascal, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("{"), _T ("}"), _T (""), (DWORD)-1,
+ CCrystalTextView::SRC_PERL, _T ("Perl"), _T ("pl,pm,plx"), &CrystalLineParser::ParseLinePerl, SRCOPT_AUTOINDENT|SRCOPT_EOLNUNIX, /*4,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
+ CCrystalTextView::SRC_PHP, _T ("PHP"), _T ("php,php3,php4,php5,phtml"), &CrystalLineParser::ParseLinePhp, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_PO, _T ("PO"), _T ("po,pot"), &CrystalLineParser::ParseLinePo, SRCOPT_AUTOINDENT|SRCOPT_EOLNUNIX, /*4,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
+ CCrystalTextView::SRC_POWERSHELL, _T ("PowerShell"), _T ("ps1"), &CrystalLineParser::ParseLinePowerShell, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
+ CCrystalTextView::SRC_PYTHON, _T ("Python"), _T ("py"), &CrystalLineParser::ParseLinePython, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_REXX, _T ("REXX"), _T ("rex,rexx"), &CrystalLineParser::ParseLineRexx, SRCOPT_AUTOINDENT, /*4,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_RSRC, _T ("Resources"), _T ("rc,dlg,r16,r32,rc2"), &CrystalLineParser::ParseLineRsrc, SRCOPT_AUTOINDENT, /*4,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_RUBY, _T ("Ruby"), _T ("rb,rbw,rake,gemspec"), &CrystalLineParser::ParseLineRuby, SRCOPT_AUTOINDENT|SRCOPT_EOLNUNIX, /*4,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
+ CCrystalTextView::SRC_RUST, _T ("Rust"), _T ("rs"), &CrystalLineParser::ParseLineRust, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_SGML, _T ("Sgml"), _T ("sgml"), &CrystalLineParser::ParseLineSgml, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("<!--"), _T ("-->"), _T (""), (DWORD)-1,
+ CCrystalTextView::SRC_SH, _T ("Shell"), _T ("sh,conf"), &CrystalLineParser::ParseLineSh, SRCOPT_INSERTTABS|SRCOPT_AUTOINDENT|SRCOPT_EOLNUNIX, /*4,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
+ CCrystalTextView::SRC_SIOD, _T ("SIOD"), _T ("scm"), &CrystalLineParser::ParseLineSiod, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU, /*2,*/ _T (";|"), _T ("|;"), _T (";"), (DWORD)-1,
+ CCrystalTextView::SRC_SQL, _T ("SQL"), _T ("sql"), &CrystalLineParser::ParseLineSql, SRCOPT_AUTOINDENT, /*4,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_TCL, _T ("TCL"), _T ("tcl"), &CrystalLineParser::ParseLineTcl, SRCOPT_AUTOINDENT|SRCOPT_BRACEGNU|SRCOPT_EOLNUNIX, /*2,*/ _T (""), _T (""), _T ("#"), (DWORD)-1,
+ CCrystalTextView::SRC_TEX, _T ("TEX"), _T ("tex,sty,clo,ltx,fd,dtx"), &CrystalLineParser::ParseLineTex, SRCOPT_AUTOINDENT, /*4,*/ _T (""), _T (""), _T ("%"), (DWORD)-1,
+ CCrystalTextView::SRC_VERILOG, _T ("Verilog"), _T ("v,vh"), &CrystalLineParser::ParseLineVerilog, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("/*"), _T ("*/"), _T ("//"), (DWORD)-1,
+ CCrystalTextView::SRC_VHDL, _T ("VHDL"), _T ("vhd,vhdl,vho"), &CrystalLineParser::ParseLineVhdl, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T (""), _T (""), _T ("--"), (DWORD)-1,
+ CCrystalTextView::SRC_XML, _T ("XML"), _T ("xml"), &CrystalLineParser::ParseLineXml, SRCOPT_AUTOINDENT|SRCOPT_BRACEANSI, /*2,*/ _T ("<!--"), _T ("-->"), _T (""), (DWORD)-1
};
/////////////////////////////////////////////////////////////////////////////
if (L > 0)
dwCookie = (*m_ParseCookies)[L - 1];
ASSERT (dwCookie != - 1);
- (*m_ParseCookies)[L] = ParseLine (dwCookie, L, nullptr, nBlocks);
+ (*m_ParseCookies)[L] = ParseLine (dwCookie, GetLineChars(L), GetLineLength(L), nullptr, nBlocks);
ASSERT ((*m_ParseCookies)[L] != - 1);
L++;
}
return (*m_ParseCookies)[nLineIndex];
}
-std::vector<CCrystalTextView::TEXTBLOCK> CCrystalTextView::
+std::vector<TEXTBLOCK> CCrystalTextView::
GetAdditionalTextBlocks (int nLineIndex)
{
return {};
explicit IntArray(int len) { SetSize(len); }
};
-std::vector<CCrystalTextView::TEXTBLOCK> CCrystalTextView::
+std::vector<TEXTBLOCK> CCrystalTextView::
MergeTextBlocks (const std::vector<TEXTBLOCK>& blocks1, const std::vector<TEXTBLOCK>& blocks2) const
{
size_t i, j, k;
return mergedBlocks;
}
-std::vector<CCrystalTextView::TEXTBLOCK>
+std::vector<TEXTBLOCK>
CCrystalTextView::GetMarkerTextBlocks(int nLineIndex) const
{
std::vector<TEXTBLOCK> allblocks;
return allblocks;
}
-std::vector<CCrystalTextView::TEXTBLOCK>
+std::vector<TEXTBLOCK>
CCrystalTextView::GetTextBlocks(int nLineIndex)
{
int nLength = GetViewableLineLength (nLineIndex);
blocks[0].m_nColorIndex = COLORINDEX_NORMALTEXT;
blocks[0].m_nBgColorIndex = COLORINDEX_BKGND;
nBlocks++;
- (*m_ParseCookies)[nLineIndex] = ParseLine(dwCookie, nLineIndex, blocks.data(), nBlocks);
+ (*m_ParseCookies)[nLineIndex] = ParseLine(dwCookie, GetLineChars(nLineIndex), GetLineLength(nLineIndex), blocks.data(), nBlocks);
ASSERT((*m_ParseCookies)[nLineIndex] != -1);
blocks.resize(nBlocks);
bDBCSLeadPrev = IsLeadByte(szLine[nIndex]);
}
- if (szLine && m_pTextBuffer->IsMBSTrail(nLineIndex, nIndex)) nIndex--;
+ if (szLine && IsMBSTrail(szLine, nIndex)) nIndex--;
return nIndex;
}
}
DWORD CCrystalTextView::
-ParseLinePlain (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+ParseLine (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- return 0;
-}
-
-DWORD CCrystalTextView::
-ParseLine (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
-{
- return (this->*(m_CurSourceDef->ParseLineX)) (dwCookie, nLineIndex, pBuf, nActualItems);
+ return m_CurSourceDef->ParseLineX (dwCookie, pszChars, nLength, pBuf, nActualItems);
}
int CCrystalTextView::
#include <vector>
#include "cregexp.h"
#include "crystalparser.h"
+#include "crystallineparser.h"
////////////////////////////////////////////////////////////////////////////
// Forward class declarations
friend CCrystalParser;
-public:
- // Syntax coloring overrides
- struct TEXTBLOCK
- {
- int m_nCharPos;
- int m_nColorIndex;
- int m_nBgColorIndex;
- };
-
protected:
// Search parameters
bool m_bLastSearch;
// function to draw a single screen line
// (a wrapped line can consist of many screen lines
virtual void DrawScreenLine( CDC *pdc, CPoint &ptOrigin, const CRect &rcClip,
- const std::vector<TEXTBLOCK>& blocks, int &nActualItem,
+ const std::vector<CrystalLineParser::TEXTBLOCK>& blocks, int &nActualItem,
COLORREF crText, COLORREF crBkgnd, bool bDrawWhitespace,
LPCTSTR pszChars,
int nOffset, int nCount, int &nActualOffset, CPoint ptTextPos );
//END SW
- std::vector<TEXTBLOCK> MergeTextBlocks(const std::vector<TEXTBLOCK>& blocks1, const std::vector<TEXTBLOCK>& blocks2) const;
- std::vector<TEXTBLOCK> GetMarkerTextBlocks(int nLineIndex) const;
- virtual std::vector<TEXTBLOCK> GetAdditionalTextBlocks (int nLineIndex);
+ std::vector<CrystalLineParser::TEXTBLOCK> MergeTextBlocks(const std::vector<CrystalLineParser::TEXTBLOCK>& blocks1, const std::vector<CrystalLineParser::TEXTBLOCK>& blocks2) const;
+ std::vector<CrystalLineParser::TEXTBLOCK> GetMarkerTextBlocks(int nLineIndex) const;
+ virtual std::vector<CrystalLineParser::TEXTBLOCK> GetAdditionalTextBlocks (int nLineIndex);
public:
virtual CString GetHTMLLine (int nLineIndex, LPCTSTR pszTag);
virtual CString GetHTMLStyles ();
- std::vector<TEXTBLOCK> GetTextBlocks(int nLineIndex);
+ std::vector<CrystalLineParser::TEXTBLOCK> GetTextBlocks(int nLineIndex);
protected:
virtual CString GetHTMLAttribute (int nColorIndex, int nBgColorIndex, COLORREF crText, COLORREF crBkgnd);
public :
void GoToLine (int nLine, bool bRelative);
- DWORD ParseLine (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLinePlain (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineAsp (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineBasic (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineBatch (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineC (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineCSharp (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineCss (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineDcl (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineFortran (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineGo (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineHtml (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineIni (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineInnoSetup (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineIS (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineJava (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineLisp (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineNsis (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLinePascal (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLinePerl (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLinePhp (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLinePo (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLinePowerShell (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLinePython (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineRexx (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineRsrc (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineRuby (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineRust (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineSgml (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineSh (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineSiod (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineSql (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineTcl (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineTex (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineVerilog (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineVhdl (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
- DWORD ParseLineXml (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
+ DWORD ParseLine (DWORD dwCookie, const TCHAR *pszChars, int nLength, CrystalLineParser::TEXTBLOCK * pBuf, int &nActualItems);
// Attributes
public :
TextType type;
TCHAR name[256];
TCHAR exts[256];
- DWORD (CCrystalTextView:: * ParseLineX) (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems);
+ DWORD (* ParseLineX) (DWORD dwCookie, const TCHAR *pszChars, int nLength, CrystalLineParser::TEXTBLOCK * pBuf, int &nActualItems);
DWORD flags;
// DWORD tabsize;
TCHAR opencomment[8];
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineC (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineC (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
LPCTSTR pszCommentBegin = nullptr;
LPCTSTR pszCommentEnd = nullptr;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
#include "crystalparser.h"
#include "crystaleditviewex.h"
+using CrystalLineParser::TEXTBLOCK;
//////////////////////////////////////////////////////////////////////
// Konstruktion/Destruktion
if( m_pSyntaxParser != nullptr )
{
CCrystalTextBlock *pTextBlock =
- pBuf? new CCrystalTextBlock( (CCrystalTextBlock::TEXTBLOCK*)pBuf, nActualItems ) : nullptr;
+ pBuf? new CCrystalTextBlock( (TEXTBLOCK*)pBuf, nActualItems ) : nullptr;
dwCookie = m_pSyntaxParser->ParseLine( dwCookie, nLineIndex, pTextBlock );
if( pTextBlock != nullptr )
The calculated flags for this line (see dwCookie).\r
*/\r
virtual DWORD ParseLine( DWORD dwCookie, int nLineIndex, \r
- TEXTBLOCK *pBuf, int &nActualItems );\r
+ CrystalLineParser::TEXTBLOCK *pBuf, int &nActualItems );\r
\r
/** @attributes */\r
protected:\r
--- /dev/null
+#pragma once\r
+\r
+#define DEFINE_BLOCK(pos, colorindex) \\r
+ASSERT((pos) >= 0 && (pos) <= nLength);\\r
+if (pBuf != nullptr)\\r
+ {\\r
+ if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\\r
+ if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\\r
+ pBuf[nActualItems].m_nCharPos = (pos);\\r
+ pBuf[nActualItems].m_nColorIndex = (colorindex);\\r
+ pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\\r
+ nActualItems ++;}\\r
+ }\r
+\r
+#define COOKIE_COMMENT 0x0001\r
+#define COOKIE_PREPROCESSOR 0x0002\r
+#define COOKIE_EXT_COMMENT 0x0004\r
+#define COOKIE_STRING 0x0008\r
+#define COOKIE_CHAR 0x0010\r
+#define COOKIE_USER1 0x0020\r
+#define COOKIE_EXT_USER1 0x0040\r
+#define COOKIE_SECTION 0x0080\r
+#define COOKIE_KEY 0x0100\r
+#define COOKIE_EXT_COMMENT2 0x0200\r
+#define COOKIE_USER2 0x0400\r
+#define COOKIE_VARIABLE 0x0800\r
+#define COOKIE_RAWSTRING 0x1000\r
+#define COOKIE_EXT_DEFINITION 0x2000\r
+#define COOKIE_EXT_VALUE 0x4000\r
+\r
+#define COOKIE_GET_EXT_COMMENT_DEPTH(cookie) (((cookie) & 0x0F000000) >> 24)\r
+#define COOKIE_SET_EXT_COMMENT_DEPTH(cookie, depth) (cookie) = (((cookie) & 0xF0FFFFFF) | ((depth) << 24))\r
+#define COOKIE_GET_RAWSTRING_NUMBER_COUNT(cookie) (((cookie) & 0xF0000000) >> 28)\r
+#define COOKIE_SET_RAWSTRING_NUMBER_COUNT(cookie, count) (cookie) = (((cookie) & 0x0FFFFFFF) | ((count) << 28))\r
+\r
+namespace CrystalLineParser\r
+{\r
+// Syntax coloring overrides\r
+struct TEXTBLOCK\r
+{\r
+ int m_nCharPos;\r
+ int m_nColorIndex;\r
+ int m_nBgColorIndex;\r
+};\r
+\r
+DWORD ParseLinePlain(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineAsp(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineBasic(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineBatch(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineC(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineCSharp(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineCss(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineDcl(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineFortran(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineGo(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineHtml(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineIni(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineInnoSetup(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineIS(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineJava(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineLisp(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineNsis(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLinePascal(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLinePerl(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLinePhp(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLinePo(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLinePowerShell(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLinePython(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineRexx(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineRsrc(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineRuby(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineRust(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineSgml(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineSh(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineSiod(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineSql(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineTcl(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineTex(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineVerilog(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineVhdl(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+DWORD ParseLineXml(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems);\r
+\r
+}\r
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
+#include "crystallineparser.h"
#include "crystaltextblock.h"
+using CrystalLineParser::TEXTBLOCK;
+
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#pragma once
+namespace CrystalLineParser { struct TEXTBLOCK; }
+
/**
Objects of this class are passed to CCrystalParser::ParseLine() to get the
positions of color changes in a text line.
friend class CCrystalTextView;
friend class CCrystalEditViewEx;
-protected:
- struct TEXTBLOCK
- {
- int m_nCharPos;
- int m_nColorIndex;
- };
-
// construction/destruction
protected:
- CCrystalTextBlock( TEXTBLOCK *pTextBlock, int &rnActualItems );
+ CCrystalTextBlock( CrystalLineParser::TEXTBLOCK *pTextBlock, int &rnActualItems );
// operations
public:
// attributes
protected:
/** text block to work on */
- TEXTBLOCK *m_pTextBlock;
+ CrystalLineParser::TEXTBLOCK *m_pTextBlock;
/** Index */
int &m_rnActualItems;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineCSharp (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineCSharp (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return IsXKeyword (s_apszCss2KeywordList, pszChars, nLength);
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_EXT_DEFINITION 0x0020
-#define COOKIE_EXT_VALUE 0x0040
-
-DWORD CCrystalTextView::
-ParseLineCss (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineCss (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & (COOKIE_EXT_COMMENT|COOKIE_EXT_DEFINITION|COOKIE_EXT_VALUE);
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~(COOKIE_EXT_COMMENT|COOKIE_EXT_DEFINITION|COOKIE_EXT_VALUE)) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineDcl (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineDcl (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineFortran (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineFortran (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////\r
\r
#include "StdAfx.h"\r
-#include "ccrystaltextview.h"\r
-#include "ccrystaltextbuffer.h"\r
+#include "crystallineparser.h"\r
#include "SyntaxColors.h"\r
#include "string_util.h"\r
\r
return true;\r
}\r
\r
-#define DEFINE_BLOCK(pos, colorindex) \\r
-ASSERT((pos) >= 0 && (pos) <= nLength);\\r
-if (pBuf != nullptr)\\r
- {\\r
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\\r
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\\r
- pBuf[nActualItems].m_nCharPos = (pos);\\r
- pBuf[nActualItems].m_nColorIndex = (colorindex);\\r
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\\r
- nActualItems ++;}\\r
- }\r
-\r
-#define COOKIE_COMMENT 0x0001\r
-#define COOKIE_EXT_COMMENT 0x0004\r
-#define COOKIE_STRING 0x0008\r
-#define COOKIE_CHAR 0x0010\r
-#define COOKIE_RAWSTRING 0x0020\r
-\r
-DWORD CCrystalTextView::\r
-ParseLineGo (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)\r
+DWORD\r
+CrystalLineParser::ParseLineGo (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)\r
{\r
- int nLength = GetLineLength (nLineIndex);\r
if (nLength == 0)\r
return dwCookie & (COOKIE_EXT_COMMENT | COOKIE_RAWSTRING);\r
\r
- LPCTSTR pszChars = GetLineChars (nLineIndex);\r
LPCTSTR pszCommentBegin = nullptr;\r
LPCTSTR pszCommentEnd = nullptr;\r
bool bRedefineBlock = true;\r
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_USER1 0x0020
-#define COOKIE_EXT_USER1 0x0040
-
-DWORD CCrystalTextView::
-ParseLineHtml (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineHtml (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & (COOKIE_EXT_COMMENT|COOKIE_EXT_USER1);
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~(COOKIE_EXT_COMMENT|COOKIE_EXT_USER1)) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_SECTION 0x0020
-#define COOKIE_KEY 0x0040
-
-DWORD CCrystalTextView::
-ParseLineIni (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineIni (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_EXT_COMMENT2 0x0020
-#define COOKIE_SECTION 0x0040
-
-DWORD CCrystalTextView::
-ParseLineInnoSetup (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineInnoSetup (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & (COOKIE_EXT_COMMENT | COOKIE_EXT_COMMENT2);
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= (COOKIE_EXT_COMMENT | COOKIE_EXT_COMMENT2);
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineIS (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineIS (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineJava (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineJava (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineLisp (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineLisp (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineNsis (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineNsis (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_EXT_COMMENT2 0x0020
-
-DWORD CCrystalTextView::
-ParseLinePascal (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLinePascal (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & (COOKIE_EXT_COMMENT | COOKIE_EXT_COMMENT2);
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= (COOKIE_EXT_COMMENT | COOKIE_EXT_COMMENT2);
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLinePerl (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLinePerl (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_USER1 0x0020
-#define COOKIE_USER2 0x0040
-#define COOKIE_EXT_USER1 0x0080
-
-DWORD CCrystalTextView::
-ParseLinePhp (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLinePhp (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & (COOKIE_EXT_COMMENT|COOKIE_EXT_USER1);
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~(COOKIE_EXT_COMMENT|COOKIE_EXT_USER1)) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
--- /dev/null
+#include "StdAfx.h"\r
+#include "crystallineparser.h"\r
+\r
+DWORD\r
+CrystalLineParser::ParseLinePlain (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)\r
+{\r
+ return 0;\r
+}\r
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLinePo (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLinePo (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_VARIABLE 0x0020
-
-DWORD CCrystalTextView::
-ParseLinePowerShell (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLinePowerShell (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLinePython (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLinePython (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineRexx (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineRexx (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineRsrc (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineRsrc (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_VARIABLE 0X0020
-
-DWORD CCrystalTextView::
-ParseLineRuby(DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineRuby(DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
////////////////////////////////////////////////////////////////////////////\r
\r
#include "StdAfx.h"\r
-#include "ccrystaltextview.h"\r
-#include "ccrystaltextbuffer.h"\r
+#include "crystallineparser.h"\r
#include "SyntaxColors.h"\r
#include "string_util.h"\r
#include <algorithm>\r
return true;\r
}\r
\r
-#define DEFINE_BLOCK(pos, colorindex) \\r
-ASSERT((pos) >= 0 && (pos) <= nLength);\\r
-if (pBuf != nullptr)\\r
- {\\r
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\\r
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\\r
- pBuf[nActualItems].m_nCharPos = (pos);\\r
- pBuf[nActualItems].m_nColorIndex = (colorindex);\\r
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\\r
- nActualItems ++;}\\r
- }\r
-\r
-#define COOKIE_COMMENT 0x0001\r
-#define COOKIE_EXT_COMMENT 0x0004\r
-#define COOKIE_STRING 0x0008\r
-#define COOKIE_RAWSTRING 0x0020\r
-#define COOKIE_GET_EXT_COMMENT_DEPTH(cookie) (((cookie) & 0x0F00) >> 8)\r
-#define COOKIE_SET_EXT_COMMENT_DEPTH(cookie, depth) (cookie) = (((cookie) & 0xF0FF) | ((depth) << 8))\r
-#define COOKIE_GET_RAWSTRING_NUMBER_COUNT(cookie) (((cookie) & 0xF000) >> 12)\r
-#define COOKIE_SET_RAWSTRING_NUMBER_COUNT(cookie, count) (cookie) = (((cookie) & 0x0FFF) | ((count) << 12))\r
-\r
-DWORD CCrystalTextView::\r
-ParseLineRust (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)\r
+DWORD\r
+CrystalLineParser::ParseLineRust (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)\r
{\r
- int nLength = GetLineLength (nLineIndex);\r
if (nLength == 0)\r
- return dwCookie & (COOKIE_EXT_COMMENT | COOKIE_RAWSTRING | COOKIE_STRING | 0xFF00);\r
+ return dwCookie & (COOKIE_EXT_COMMENT | COOKIE_RAWSTRING | COOKIE_STRING | 0xFF000000);\r
\r
- LPCTSTR pszChars = GetLineChars (nLineIndex);\r
LPCTSTR pszRawStringBegin = nullptr;\r
LPCTSTR pszCommentBegin = nullptr;\r
LPCTSTR pszCommentEnd = nullptr;\r
}\r
}\r
\r
- dwCookie &= COOKIE_EXT_COMMENT | COOKIE_RAWSTRING | COOKIE_STRING | 0xFF00;\r
+ dwCookie &= COOKIE_EXT_COMMENT | COOKIE_RAWSTRING | COOKIE_STRING | 0xFF000000;\r
return dwCookie;\r
}\r
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_USER1 0x0020
-#define COOKIE_EXT_USER1 0x0040
-
-DWORD CCrystalTextView::
-ParseLineSgml (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineSgml (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineSh (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineSh (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineSiod (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineSiod (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineSql (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineSql (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
}
return false;
}
+
+bool IsMBSTrail (const TCHAR *pszChars, int nCol)
+{
+#ifdef _UNICODE
+ const wchar_t *current = pszChars + nCol;
+ if (*current >= 0xDC00 && *current <= 0xDFFF) // surrogate pair
+ return true;
+ return false;
+#else // _UNICODE
+ const unsigned char *string = (const unsigned char *) pszChars;
+ const unsigned char *current = string + nCol;
+ if (_ismbstrail (string, current) < 0)
+ return true;
+ return false;
+#endif // _UNICODE
+}
int xisalnum(wint_t c);
int xisspace(wint_t c);
bool IsXKeyword(LPCTSTR pszKey, size_t nKeyLen, LPCTSTR pszKeywordList[], size_t nKeywordListCount, int (*compare)(LPCTSTR, LPCTSTR, size_t));
+
+bool IsMBSTrail(const TCHAR *pszChars, int nCol);
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
-#include "ccrystaltextbuffer.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineTcl (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineTcl (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
}
}
- if (pszChars[nLength - 1] != '\\' || m_pTextBuffer->IsMBSTrail(nLineIndex, nLength - 1))
+ if (pszChars[nLength - 1] != '\\' || IsMBSTrail(pszChars, nLength - 1))
dwCookie &= COOKIE_EXT_COMMENT;
return dwCookie;
}
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineTex (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineTex (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineVerilog (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineVerilog (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bWasCommentStart = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return false;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-
-DWORD CCrystalTextView::
-ParseLineVhdl (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineVhdl (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bRedefineBlock = true;
bool bDecIndex = false;
bool bNum = false;
////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
-#include "ccrystaltextview.h"
+#include "crystallineparser.h"
#include "SyntaxColors.h"
#include "string_util.h"
return true;
}
-#define DEFINE_BLOCK(pos, colorindex) \
-ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != nullptr)\
- {\
- if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
- if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
- pBuf[nActualItems].m_nCharPos = (pos);\
- pBuf[nActualItems].m_nColorIndex = (colorindex);\
- pBuf[nActualItems].m_nBgColorIndex = COLORINDEX_BKGND;\
- nActualItems ++;}\
- }
-
-#define COOKIE_COMMENT 0x0001
-#define COOKIE_PREPROCESSOR 0x0002
-#define COOKIE_EXT_COMMENT 0x0004
-#define COOKIE_STRING 0x0008
-#define COOKIE_CHAR 0x0010
-#define COOKIE_USER1 0x0020
-#define COOKIE_EXT_USER1 0x0040
-
-DWORD CCrystalTextView::
-ParseLineXml (DWORD dwCookie, int nLineIndex, TEXTBLOCK * pBuf, int &nActualItems)
+DWORD
+CrystalLineParser::ParseLineXml (DWORD dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
{
- int nLength = GetLineLength (nLineIndex);
if (nLength == 0)
return dwCookie & COOKIE_EXT_COMMENT;
- LPCTSTR pszChars = GetLineChars (nLineIndex);
bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0;
bool bRedefineBlock = true;
bool bDecIndex = false;
String sDir[3];
String subprefix[3];
- int nIndex;
std::copy(paths.begin(), paths.end(), sDir);
if (!subdir[0].empty())
{
- for (nIndex = 0; nIndex < paths.GetSize(); nIndex++)
+ for (int nIndex = 0; nIndex < paths.GetSize(); nIndex++)
{
sDir[nIndex] = paths::ConcatPath(sDir[nIndex], subdir[nIndex]);
subprefix[nIndex] = subdir[nIndex] + backslash;
}
DirItemArray dirs[3], aFiles[3];
- for (nIndex = 0; nIndex < nDirs; nIndex++)
+ for (int nIndex = 0; nIndex < nDirs; nIndex++)
LoadAndSortFiles(sDir[nIndex], &dirs[nIndex], &aFiles[nIndex], casesensitive);
// Allow user to abort scanning
// i points to current directory in left list (leftDirs)
// j points to current directory in right list (rightDirs)
- for (nIndex = 0; nIndex < nDirs; nIndex++)
- if (dirs[nIndex].size() != 0 || aFiles[nIndex].size() != 0) break;
- if (nIndex == nDirs)
- return 0;
+ {
+ int nIndex;
+ for (nIndex = 0; nIndex < nDirs; nIndex++)
+ if (dirs[nIndex].size() != 0 || aFiles[nIndex].size() != 0) break;
+ if (nIndex == nDirs)
+ return 0;
+ }
DirItemArray::size_type i=0, j=0, k=0;
while (true)
}
break;
}
+
+ if (parent != nullptr)
+ {
+ for (int nIndex = 0; nIndex < nDirs; ++nIndex)
+ if (parent->diffcode.exists(nIndex) && parent->diffFileInfo[nIndex].size == DirItem::FILE_SIZE_NONE)
+ parent->diffFileInfo[nIndex].size = 0;
+
+ DIFFITEM *dic = parent->GetFirstChild();
+ while (dic)
+ {
+ for (int nIndex = 0; nIndex < nDirs; ++nIndex)
+ {
+ if (dic->diffFileInfo[nIndex].size != DirItem::FILE_SIZE_NONE)
+ parent->diffFileInfo[nIndex].size += dic->diffFileInfo[nIndex].size;
+ }
+ dic = dic->GetFwdSiblingLink();
+ }
+ }
+
return 1;
}
CDiffContext *pCtxt = myStruct->context;
DIFFITEM *pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
int ncount = 0;
-
+
while (pos != nullptr)
{
if (pCtxt->ShouldAbort())
}
if (di.diffcode.isDirectory() && pCtxt->m_bRecursive)
{
+ for (int i = 0; i < pCtxt->GetCompareDirs(); ++i)
+ if (di.diffcode.exists(i))
+ di.diffFileInfo[i].size = 0;
if (di.diffcode.isScanNeeded() && !di.diffcode.isResultFiltered())
{
di.RemoveChildren();
ncount += DirScan_UpdateMarkedItems(myStruct, curpos);
}
}
+ if (parentdiffpos != nullptr && pCtxt->m_bRecursive)
+ {
+ for (int nIndex = 0; nIndex < pCtxt->GetCompareDirs(); ++nIndex)
+ if (curpos->diffFileInfo[nIndex].size != DirItem::FILE_SIZE_NONE)
+ parentdiffpos->diffFileInfo[nIndex].size += curpos->diffFileInfo[nIndex].size;
+ }
}
return ncount;
}
<ClCompile Include="..\Externals\crystaledit\editlib\pascal.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\perl.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\php.cpp" />\r
+ <ClCompile Include="..\Externals\crystaledit\editlib\plain.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\po.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\powershell.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\python.cpp" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\fpattern.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\gotodlg.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\LineInfo.h" />\r
+ <ClInclude Include="..\Externals\crystaledit\editlib\crystallineparser.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\memcombo.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\registry.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\statbar.h" />\r
<ClCompile Include="OptionsPanel.cpp">\r
<Filter>MFCGui\Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\Externals\crystaledit\editlib\plain.cpp">\r
+ <Filter>EditLib\parsers</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="charsets.h">\r
<ClInclude Include="pch.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\Externals\crystaledit\editlib\crystallineparser.h">\r
+ <Filter>EditLib\parsers</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<None Include="res\binarydiff.ico">\r
<ClCompile Include="..\Externals\crystaledit\editlib\pascal.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\perl.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\php.cpp" />\r
+ <ClCompile Include="..\Externals\crystaledit\editlib\plain.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\po.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\powershell.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\python.cpp" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\fpattern.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\gotodlg.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\LineInfo.h" />\r
+ <ClInclude Include="..\Externals\crystaledit\editlib\crystallineparser.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\memcombo.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\registry.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\statbar.h" />\r
<ClCompile Include="OptionsPanel.cpp">\r
<Filter>MFCGui\Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\Externals\crystaledit\editlib\plain.cpp">\r
+ <Filter>EditLib\parsers</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="charsets.h">\r
<ClInclude Include="pch.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\Externals\crystaledit\editlib\crystallineparser.h">\r
+ <Filter>EditLib\parsers</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<None Include="res\binarydiff.ico">\r
<ClCompile Include="..\Externals\crystaledit\editlib\pascal.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\perl.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\php.cpp" />\r
+ <ClCompile Include="..\Externals\crystaledit\editlib\plain.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\po.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\powershell.cpp" />\r
<ClCompile Include="..\Externals\crystaledit\editlib\python.cpp" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\fpattern.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\gotodlg.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\LineInfo.h" />\r
+ <ClInclude Include="..\Externals\crystaledit\editlib\crystallineparser.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\memcombo.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\registry.h" />\r
<ClInclude Include="..\Externals\crystaledit\editlib\statbar.h" />\r
<ClCompile Include="OptionsPanel.cpp">\r
<Filter>MFCGui\Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\Externals\crystaledit\editlib\plain.cpp">\r
+ <Filter>EditLib\parsers</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="charsets.h">\r
<ClInclude Include="pch.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\Externals\crystaledit\editlib\crystallineparser.h">\r
+ <Filter>EditLib\parsers</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<None Include="res\binarydiff.ico">\r
#endif
using std::vector;
+using CrystalLineParser::TEXTBLOCK;
/** @brief Timer ID for delayed rescan. */
const UINT IDT_RESCAN = 2;
pDoc->UpdateHeaderActivity(m_nThisPane, !!bActivate);
}
-std::vector<CCrystalTextView::TEXTBLOCK> CMergeEditView::GetAdditionalTextBlocks (int nLineIndex)
+std::vector<TEXTBLOCK> CMergeEditView::GetAdditionalTextBlocks (int nLineIndex)
{
static const std::vector<TEXTBLOCK> emptyBlocks;
if (m_bDetailView)
void SelectArea(const CPoint & ptStart, const CPoint & ptEnd) { SetSelection(ptStart, ptEnd); } // make public
using CGhostTextView::GetSelection;
virtual void UpdateSiblingScrollPos (bool bHorz) override;
- virtual std::vector<TEXTBLOCK> GetAdditionalTextBlocks (int nLineIndex) override;
+ virtual std::vector<CrystalLineParser::TEXTBLOCK> GetAdditionalTextBlocks (int nLineIndex) override;
virtual COLORREF GetColor(int nColorIndex) override;
virtual void GetLineColors (int nLineIndex, COLORREF & crBkgnd,
COLORREF & crText, bool & bDrawWhitespace) override;